Skip to content

Commit df1eaf0

Browse files
authored
[BulkActions] Bring everything up to the top (#11622)
### WHY are these changes introduced? Fixes Shopify/web#119088 We want to further update the bulk/select actions to re-combine them into the same piece of UI. We had broken bulk and select actions up as part of the initial Index Filtering and Search work, but now realise that keeping them colocated is the best UX for our merchants. ### WHAT is this pull request doing? <img width="1624" alt="Screenshot 2024-02-22 at 12 23 50" src="https://github.com/Shopify/polaris/assets/2562596/11b33a11-474a-42fb-8475-1137da228481"> This PR: - re-introduces all the select logic to the BulkActions component - left-align select actions, right-align bulk actions - rewrites the BulkActions component to a function component from a class component - updates the logic to show/hide promoted actions, as the previous method was broken - deprecate the SelectAllActions component - updates IndexTable & ResourceList to remove SelectAllActions, update BulkActions implementation - removes the useIsSelectAllActionsSticky hook (never exported, only used to position the SelectAllActions internally within ResourceList/IndexTable The biggest piece of work is updating how the bulk actions show/rollup logic works. Beforehand, it would either show all promoted actions if they fit, or roll every single one up behind a meatball menu. This wasn't great, as we should show as many as possible in the available space. As part of the update to a function component, we now utilise a similar layout sizing mechanism as we use in both the Tabs and ActionMenu -> Actions components, to render as many promoted actions as we possibly can in the available space. ### How to 🎩 Spin URL for IndexTable: https://admin.web.bulk-ui-refresh.marc-thomas.eu.spin.dev/store/shop1/products?selectedView=all Spin URL for ResourceList: https://admin.web.bulk-ui-refresh.marc-thomas.eu.spin.dev/store/shop1/products/32 Spin URL for Updated Draft orders (using Shopify/web `ResourceListWithHeader`): https://admin.web.bulk-ui-refresh.marc-thomas.eu.spin.dev/store/shop1/draft_orders?selectedView=all ### 🎩 checklist - [x] Tested a [snapshot](https://github.com/Shopify/polaris/blob/main/documentation/Releasing.md#-snapshot-releases) - [x] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [x] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [x] Updated the component's `README.md` with documentation changes - [x] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
1 parent 6cc80fd commit df1eaf0

23 files changed

+918
-1486
lines changed

.changeset/rare-kings-repeat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': minor
3+
---
4+
5+
Updated the BulkActions component to include logic to handling selecting and deselecting rows

polaris-react/src/components/BulkActions/BulkActions.module.scss

Lines changed: 76 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,56 @@ $bulk-actions-button-stacking-order: (
55
focused: 20,
66
);
77

8-
.Group {
9-
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
10-
@include text-style-input;
8+
.BulkActionsOuterLayout {
9+
position: relative;
10+
flex: 1;
11+
width: 100%;
12+
}
13+
14+
.BulkActionsSelectAllWrapper {
15+
min-height: 24px;
1116
display: flex;
1217
align-items: center;
13-
flex-wrap: wrap;
14-
opacity: 0;
15-
width: 100%;
16-
justify-content: flex-start;
17-
transition: var(--p-motion-duration-100) var(--p-motion-ease);
18-
transition-property: opacity;
19-
will-change: opacity;
18+
gap: var(--p-space-200);
19+
}
2020

21-
&.Group-not-sticky {
22-
opacity: 1;
23-
}
21+
.BulkActionsPromotedActionsWrapper {
22+
flex: 1;
23+
}
2424

25-
&.Group-entering,
26-
&.Group-exiting {
27-
opacity: 0;
28-
display: flex;
29-
}
25+
.BulkActionsLayout {
26+
display: flex;
27+
flex-wrap: wrap;
28+
align-items: center;
29+
justify-content: flex-end;
30+
flex: 1 1 auto;
31+
gap: var(--p-space-100);
3032

31-
&.Group-entered {
32-
opacity: 1;
33-
display: flex;
33+
> * {
34+
flex: 0 0 auto;
3435
}
36+
}
3537

36-
&.Group-exited {
37-
opacity: 0;
38-
display: none;
39-
}
38+
.BulkActionsLayout--measuring {
39+
visibility: hidden;
40+
height: 0;
41+
}
4042

41-
&.Group-measuring {
42-
transition: none;
43-
display: flex;
44-
opacity: 0;
43+
.BulkActionsMeasurerLayout {
44+
position: absolute;
45+
display: flex;
46+
flex-wrap: wrap;
47+
align-items: center;
48+
justify-content: flex-end;
49+
flex: 1 1 auto;
50+
gap: 0;
51+
padding: 0;
52+
visibility: hidden;
53+
height: 0;
54+
width: 100%;
55+
56+
> * {
57+
flex: 0 0 auto;
4558
}
4659
}
4760

@@ -83,3 +96,37 @@ $bulk-actions-button-stacking-order: (
8396
cursor: default;
8497
pointer-events: none;
8598
}
99+
100+
.PaginatedSelectAll {
101+
font-size: var(--p-text-body-sm-font-size);
102+
font-weight: var(--p-font-weight-medium);
103+
line-height: var(--p-text-body-sm-font-line-height);
104+
}
105+
106+
.AllAction {
107+
font-size: var(--p-text-body-sm-font-size);
108+
font-weight: var(--p-font-weight-medium);
109+
line-height: var(--p-text-body-sm-font-line-height);
110+
border: 0;
111+
background: none;
112+
padding: 0;
113+
cursor: pointer;
114+
color: var(--p-color-text-emphasis);
115+
outline: none;
116+
// stylelint-disable-next-line -- needed for focus ring
117+
@include focus-ring;
118+
119+
&:hover,
120+
&:focus {
121+
color: var(--p-color-text-emphasis-hover);
122+
}
123+
124+
&:active {
125+
color: var(--p-color-text-emphasis-active);
126+
}
127+
128+
&:focus-visible:not(:active) {
129+
// stylelint-disable-next-line -- needed for focus ring
130+
@include focus-ring($style: 'focused');
131+
}
132+
}

0 commit comments

Comments
 (0)