Skip to content

Commit 2b8904f

Browse files
mrcthmszakwarsametranslation-platform[bot]
authored
[BulkActions] Update BulkActions and add in SelectAllActions (#7290)
### WHY are these changes introduced? Fixes Shopify/web#74192 Spin link in situ: https://admin.web.discounts-update-save-as.marc-thomas.eu.spin.dev/store/shop1/orders?inContextTimeframe=none ### WHAT is this pull request doing? #### Before <img width="2440" alt="Screenshot 2022-09-28 at 11 42 54" src="https://user-images.githubusercontent.com/2562596/192759539-4fece161-5bef-44ed-961f-4a342f495c69.png"> <img width="2440" alt="Screenshot 2022-09-28 at 11 42 28" src="https://user-images.githubusercontent.com/2562596/192759582-834b2d6a-f0e2-4d07-803f-4be435559495.png"> #### After <img width="2440" alt="Screenshot 2022-09-28 at 11 42 39" src="https://user-images.githubusercontent.com/2562596/192761041-9b38059f-3b80-4a8e-8261-633589098bb4.png"> <img width="2440" alt="Screenshot 2022-09-28 at 11 42 43" src="https://user-images.githubusercontent.com/2562596/192761078-f7fe25e1-4181-49ab-8545-c6e923917d2c.png"> <img width="2440" alt="Screenshot 2022-09-28 at 11 43 00" src="https://user-images.githubusercontent.com/2562596/192761112-bca384f4-ec7f-435c-80a7-b96f2ef7cbb8.png"> <img width="2440" alt="Screenshot 2022-09-28 at 11 43 03" src="https://user-images.githubusercontent.com/2562596/192761145-e6feb191-0430-420c-a77f-9dac004a418a.png"> This PR updates the BulkActions component, used on the IndexTable and ResourceList components, as well as moving some functionality from BulkActions into the new SelectAllActions component. This is to support the [Unified Index Filtering and Search](https://minerva.shopifycloud.com/auth/minerva?request=2905eaf2-0cf1-493c-b6d3-82e6385d6352&rd=https://vault.shopify.io%2Fprojects%2F24858) project. This PR introduces a new UX pattern for the BulkActions component. It has been separated from the `Select X` actions – which is now the `SelectAllActions` component, and the `BulkActions` component gets rendered afterward in the DOM. Components that consume the BulkActions use the new `useIsBulkActionSticky` hook to determine whether the BulkActions component should be `position: fixed` or `position: absolute` with a calculated top position. We have had to do this rather than use a regular `position: sticky` on the BulkActions element, as the keyboard focus order needs to be logically preserved, and moving the BulkActions component under the table/resource list HTML in the DOM would provide a bad experience for users navigating via keyboard. The IndexTable and ResourceList components have been updated with this new component. The `CheckableButton` component has been simplified, as a lot of the logic required in the existing implementation is no longer needed. As part of this work, small-screen BulkActions and SelectAllActions support has been removed, as we are removing bulk action and select functionality for small screens, as an intentional decision as part of the Unified Index Filtering and Search project. <!-- ℹ️ Delete the following for small / trivial changes --> ### How to 🎩 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) <!-- Give as much information as needed to experiment with the component in the playground. --> <details> <summary>Copy-paste this code in <code>playground/Playground.tsx</code>:</summary> ```jsx import React from 'react'; import {Page} from '../src'; export function Playground() { return ( <Page title="Playground"> {/* Add the code you want to test in here */} </Page> ); } ``` </details> ### 🎩 checklist - [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 Co-authored-by: Zakaria Warsame <zakaria.warsame@shopify.com> Co-authored-by: translation-platform[bot] <34770790+translation-platform[bot]@users.noreply.github.com>
1 parent 5f3b61d commit 2b8904f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1314
-1073
lines changed

.changeset/odd-spoons-dance.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+
Separated BulkActions and SelectAllActions for new sticky bulk actions experience

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
{
9090
"name": "polaris-react-cjs",
9191
"path": "polaris-react/build/cjs/index.js",
92-
"limit": "216 kB"
92+
"limit": "218 kB"
9393
},
9494
{
9595
"name": "polaris-react-esm",

polaris-react/locales/cs.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
"defaultItemSingular": "Položka",
283283
"defaultItemPlural": "Položky",
284284
"allItemsSelected": "Bylo vybráno veškeré zboží typu {resourceNamePlural} ({itemsLength} a více).",
285-
"selected": "Vybráno: {selectedItemsCount}",
285+
"selected": "Vybráno: {selectedItemsCount}.",
286286
"a11yCheckboxDeselectAllSingle": "Zrušit výběr: {resourceNameSingular}",
287287
"a11yCheckboxSelectAllSingle": "Vybrat: {resourceNameSingular}",
288288
"a11yCheckboxDeselectAllMultiple": "Zrušit celý výběr: {resourceNamePlural} ({itemsLength})",
@@ -294,7 +294,7 @@
294294
"onboardingBadgeText": "Novinka",
295295
"resourceLoadingAccessibilityLabel": "{resourceNamePlural} se načítají…",
296296
"selectAllLabel": "Vybrat vše: {resourceNamePlural}",
297-
"selected": "Vybráno: {selectedItemsCount}",
297+
"selected": "Vybráno: {selectedItemsCount}.",
298298
"undo": "Vrátit zpět",
299299
"selectAllItems": "Vybrat vše typu {resourceNamePlural} ({itemsLength} a více)",
300300
"selectItem": "Vybrat: {resourceName}",

polaris-react/locales/da.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
"defaultItemSingular": "Vare",
281281
"defaultItemPlural": "Varer",
282282
"allItemsSelected": "Alle mere end {itemsLength} {resourceNamePlural} er valgt.",
283-
"selected": "{selectedItemsCount} valgt",
283+
"selected": "{selectedItemsCount} valgt.",
284284
"a11yCheckboxDeselectAllSingle": "Fravælg {resourceNameSingular}",
285285
"a11yCheckboxSelectAllSingle": "Vælg {resourceNameSingular}",
286286
"a11yCheckboxDeselectAllMultiple": "Fravælg alle {itemsLength} {resourceNamePlural}",
@@ -292,7 +292,7 @@
292292
"onboardingBadgeText": "Nyhed",
293293
"resourceLoadingAccessibilityLabel": "Indlæser {resourceNamePlural}…",
294294
"selectAllLabel": "Vælg alle {resourceNamePlural}",
295-
"selected": "{selectedItemsCount} valgt",
295+
"selected": "{selectedItemsCount} valgt.",
296296
"undo": "Fortryd",
297297
"selectAllItems": "Vælg alle {itemsLength}+ {resourceNamePlural}",
298298
"selectItem": "Vælg {resourceName}",

polaris-react/locales/de.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
"defaultItemSingular": "Artikel",
281281
"defaultItemPlural": "Artikel",
282282
"allItemsSelected": "Alle {itemsLength}+ {resourceNamePlural} wurden ausgewählt.",
283-
"selected": "{selectedItemsCount} ausgewählt",
283+
"selected": "{selectedItemsCount} ausgewählt.",
284284
"a11yCheckboxDeselectAllSingle": "Auswahl für {resourceNameSingular} aufheben",
285285
"a11yCheckboxSelectAllSingle": "{resourceNameSingular} auswählen",
286286
"a11yCheckboxDeselectAllMultiple": "Auswahl für alle {itemsLength} {resourceNamePlural} aufheben",
@@ -292,7 +292,7 @@
292292
"onboardingBadgeText": "Neu",
293293
"resourceLoadingAccessibilityLabel": "{resourceNamePlural} werden geladen ...",
294294
"selectAllLabel": "Alle {resourceNamePlural} auswählen",
295-
"selected": "{selectedItemsCount} ausgewählt",
295+
"selected": "{selectedItemsCount} ausgewählt.",
296296
"undo": "Rückgängig machen",
297297
"selectAllItems": "Alle {itemsLength}+ {resourceNamePlural} auswählen",
298298
"selectItem": "{resourceName} auswählen",

polaris-react/locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
"defaultItemSingular": "Item",
163163
"defaultItemPlural": "Items",
164164
"allItemsSelected": "All {itemsLength}+ {resourceNamePlural} are selected.",
165-
"selected": "{selectedItemsCount} selected",
165+
"selected": "{selectedItemsCount} selected.",
166166
"a11yCheckboxDeselectAllSingle": "Deselect {resourceNameSingular}",
167167
"a11yCheckboxSelectAllSingle": "Select {resourceNameSingular}",
168168
"a11yCheckboxDeselectAllMultiple": "Deselect all {itemsLength} {resourceNamePlural}",
@@ -174,7 +174,7 @@
174174
"onboardingBadgeText": "New",
175175
"resourceLoadingAccessibilityLabel": "Loading {resourceNamePlural}…",
176176
"selectAllLabel": "Select all {resourceNamePlural}",
177-
"selected": "{selectedItemsCount} selected",
177+
"selected": "{selectedItemsCount} selected.",
178178
"undo": "Undo",
179179
"selectAllItems": "Select all {itemsLength}+ {resourceNamePlural}",
180180
"selectItem": "Select {resourceName}",

polaris-react/locales/es.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
"defaultItemSingular": "Artículo",
282282
"defaultItemPlural": "Artículos",
283283
"allItemsSelected": "Hay más de {itemsLength} {resourceNamePlural} seleccionados.",
284-
"selected": "Seleccionados: {selectedItemsCount}",
284+
"selected": "Seleccionados: {selectedItemsCount}.",
285285
"a11yCheckboxDeselectAllSingle": "Deseleccionar {resourceNameSingular}",
286286
"a11yCheckboxSelectAllSingle": "Seleccionar {resourceNameSingular}",
287287
"a11yCheckboxDeselectAllMultiple": "Deseleccionar {itemsLength} {resourceNamePlural}",
@@ -293,7 +293,7 @@
293293
"onboardingBadgeText": "Nuevo",
294294
"resourceLoadingAccessibilityLabel": "Cargando {resourceNamePlural}...",
295295
"selectAllLabel": "Seleccionar los recursos de {resourceNamePlural}",
296-
"selected": "Seleccionados: {selectedItemsCount}",
296+
"selected": "Seleccionados: {selectedItemsCount}.",
297297
"undo": "Deshacer",
298298
"selectAllItems": "Seleccionar los más de {itemsLength} recursos de {resourceNamePlural}",
299299
"selectItem": "Seleccionar {resourceName}",

polaris-react/locales/fi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
"defaultItemSingular": "Tuote",
281281
"defaultItemPlural": "Tuotteet",
282282
"allItemsSelected": "Kaikki {itemsLength} ja {resourceNamePlural} on valittu.",
283-
"selected": "{selectedItemsCount} valittu",
283+
"selected": "{selectedItemsCount} valittu.",
284284
"a11yCheckboxDeselectAllSingle": "Poista valinta kohteesta {resourceNameSingular}",
285285
"a11yCheckboxSelectAllSingle": "Valitse {resourceNameSingular}",
286286
"a11yCheckboxDeselectAllMultiple": "Poista kaikkien valinta: {itemsLength} x {resourceNamePlural}",
@@ -292,7 +292,7 @@
292292
"onboardingBadgeText": "Uusi",
293293
"resourceLoadingAccessibilityLabel": "Ladataan {resourceNamePlural}…",
294294
"selectAllLabel": "Valitse kaikki {resourceNamePlural}",
295-
"selected": "{selectedItemsCount} valittu",
295+
"selected": "{selectedItemsCount} valittu.",
296296
"undo": "Peru",
297297
"selectAllItems": "Valitse kaikki {itemsLength} ja {resourceNamePlural}",
298298
"selectItem": "Valitse {resourceName}",

polaris-react/locales/fr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
"defaultItemSingular": "Article",
282282
"defaultItemPlural": "Articles",
283283
"allItemsSelected": "La totalité des {itemsLength}+ {resourceNamePlural} sont sélectionnés.",
284-
"selected": "{selectedItemsCount} sélectionné(s)",
284+
"selected": "{selectedItemsCount} sélectionné(s)",
285285
"a11yCheckboxDeselectAllSingle": "Désélectionner {resourceNameSingular}",
286286
"a11yCheckboxSelectAllSingle": "Sélectionner {resourceNameSingular}",
287287
"a11yCheckboxDeselectAllMultiple": "Désélectionner la totalité des {itemsLength} {resourceNamePlural}",
@@ -293,7 +293,7 @@
293293
"onboardingBadgeText": "Nouveau",
294294
"resourceLoadingAccessibilityLabel": "Chargement de {resourceNamePlural} en cours…",
295295
"selectAllLabel": "Sélectionner la totalité des {resourceNamePlural}",
296-
"selected": "{selectedItemsCount} sélectionné(s)",
296+
"selected": "{selectedItemsCount} sélectionné(s)",
297297
"undo": "Annuler",
298298
"selectAllItems": "Sélectionner la totalité des {itemsLength}+ {resourceNamePlural}",
299299
"selectItem": "Sélectionner {resourceName}",

polaris-react/locales/it.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
"defaultItemSingular": "Articolo",
282282
"defaultItemPlural": "Articoli",
283283
"allItemsSelected": "Tutti gli oltre {itemsLength} {resourceNamePlural} sono selezionati.",
284-
"selected": "{selectedItemsCount} selezionati",
284+
"selected": "{selectedItemsCount} selezionati.",
285285
"a11yCheckboxDeselectAllSingle": "Deseleziona {resourceNameSingular}",
286286
"a11yCheckboxSelectAllSingle": "Seleziona {resourceNameSingular}",
287287
"a11yCheckboxDeselectAllMultiple": "Deseleziona tutto: {itemsLength} {resourceNamePlural}",
@@ -293,7 +293,7 @@
293293
"onboardingBadgeText": "Novità",
294294
"resourceLoadingAccessibilityLabel": "Caricamento {resourceNamePlural} in corso",
295295
"selectAllLabel": "Seleziona tutto: {resourceNamePlural}",
296-
"selected": "{selectedItemsCount} selezionati",
296+
"selected": "{selectedItemsCount} selezionati.",
297297
"undo": "Annulla",
298298
"selectAllItems": "Seleziona tutti i {itemsLength}+ {resourceNamePlural}",
299299
"selectItem": "Seleziona {resourceName}",

0 commit comments

Comments
 (0)