Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BulkActions] Update BulkActions and add in SelectAllActions #7833

Merged
merged 4 commits into from
Dec 5, 2022

Conversation

mrcthms
Copy link
Contributor

@mrcthms mrcthms commented Dec 2, 2022

It's the revert of the revert 🫠

WHY are these changes introduced?

Fixes https://github.com/Shopify/web/issues/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

Screenshot 2022-09-28 at 11 42 54

Screenshot 2022-09-28 at 11 42 28

After

Screenshot 2022-09-28 at 11 42 39

Screenshot 2022-09-28 at 11 42 43

Screenshot 2022-09-28 at 11 43 00

Screenshot 2022-09-28 at 11 43 03

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 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.

How to 🎩

πŸ–₯ Local development instructions
πŸ—’ General tophatting guidelines
πŸ“„ Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
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>
  );
}

🎩 checklist

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2022

size-limit report πŸ“¦

Path Size
polaris-react-cjs 211.03 KB (+0.03% πŸ”Ί)
polaris-react-esm 136.28 KB (+0.08% πŸ”Ί)
polaris-react-esnext 192.05 KB (+0.09% πŸ”Ί)
polaris-react-css 42 KB (+0.22% πŸ”Ί)

@mrcthms
Copy link
Contributor Author

mrcthms commented Dec 2, 2022

/snapit

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2022

🫰✨ Thanks @mrcthms! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221202143827
yarn add @shopify/polaris-migrator@0.0.0-snapshot-release-20221202143827
yarn add @shopify/polaris@0.0.0-snapshot-release-20221202143827

@mrcthms mrcthms force-pushed the revert-7811-revert-7290-mrcthms-bulk-actions branch from fd1e208 to 852b5ef Compare December 5, 2022 13:55
@mrcthms mrcthms requested a review from laurkim December 5, 2022 15:40
Copy link
Contributor

@laurkim laurkim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving previously reverted PR

@mrcthms
Copy link
Contributor Author

mrcthms commented Dec 5, 2022

/snapit

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

🫰✨ Thanks @mrcthms! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221205155950
yarn add @shopify/polaris-icons@0.0.0-snapshot-release-20221205155950
yarn add @shopify/polaris-migrator@0.0.0-snapshot-release-20221205155950
yarn add @shopify/polaris@0.0.0-snapshot-release-20221205155950
yarn add @shopify/stylelint-polaris@0.0.0-snapshot-release-20221205155950

@mrcthms
Copy link
Contributor Author

mrcthms commented Dec 5, 2022

/snapit

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

🫰✨ Thanks @mrcthms! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221205181116
yarn add @shopify/polaris-icons@0.0.0-snapshot-release-20221205181116
yarn add @shopify/polaris-migrator@0.0.0-snapshot-release-20221205181116
yarn add @shopify/polaris@0.0.0-snapshot-release-20221205181116
yarn add @shopify/stylelint-polaris@0.0.0-snapshot-release-20221205181116

@mrcthms
Copy link
Contributor Author

mrcthms commented Dec 5, 2022

/snapit

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

🫰✨ Thanks @mrcthms! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

yarn add @shopify/plugin-polaris@0.0.0-snapshot-release-20221205192832
yarn add @shopify/polaris-icons@0.0.0-snapshot-release-20221205192832
yarn add @shopify/polaris-migrator@0.0.0-snapshot-release-20221205192832
yarn add @shopify/polaris@0.0.0-snapshot-release-20221205192832
yarn add @shopify/stylelint-polaris@0.0.0-snapshot-release-20221205192832

@mrcthms mrcthms merged commit e475951 into main Dec 5, 2022
@mrcthms mrcthms deleted the revert-7811-revert-7290-mrcthms-bulk-actions branch December 5, 2022 19:40
mrcthms pushed a commit that referenced this pull request Dec 6, 2022
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @shopify/stylelint-polaris@5.0.0

### Major Changes

- [#7691](#7691)
[`38b2a00a6`](38b2a00)
Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - Stylelint
Polaris v5 release

## @shopify/polaris-icons@6.7.0

### Minor Changes

- [#7816](#7816)
[`afe77e584`](afe77e5)
Thanks [@allyshiasewdat](https://github.com/allyshiasewdat)! - Add
returns major icon

## @shopify/polaris-migrator@0.10.0

### Minor Changes

- [#7726](#7726)
[`22c4107b3`](22c4107)
Thanks [@qt314](https://github.com/qt314)! - Added migration to insert
disable comments for @shopify/stylelint-polaris

### Patch Changes

- [#7836](#7836)
[`77736370e`](7773637)
Thanks [@qt314](https://github.com/qt314)! - Decouple polaris migrator
test from stylelint config so it's easier to maintain

- Updated dependencies
\[[`38b2a00a6`](38b2a00)]:
    -   @shopify/stylelint-polaris@5.0.0

## @shopify/polaris@10.14.0

### Minor Changes

- [#7833](#7833)
[`e47595193`](e475951)
Thanks [@mrcthms](https://github.com/mrcthms)! - Separated BulkActions
and SelectAllActions for new sticky bulk actions experience


- [#7812](#7812)
[`e51d2c2d2`](e51d2c2)
Thanks [@chazdean](https://github.com/chazdean)! - Created `Divider`
component with guidance and examples

### Patch Changes

- [#7763](#7763)
[`28529baaf`](28529ba)
Thanks [@n-filatov](https://github.com/n-filatov)! - Update the Toast
component to a more compact layout

- Updated dependencies
\[[`afe77e584`](afe77e5)]:
    -   @shopify/polaris-icons@6.7.0

## @shopify/plugin-polaris@0.0.19

### Patch Changes

- Updated dependencies
\[[`22c4107b3`](22c4107),
[`77736370e`](7773637)]:
    -   @shopify/polaris-migrator@0.10.0

## polaris.shopify.com@0.27.0

### Minor Changes

- [#7812](#7812)
[`e51d2c2d2`](e51d2c2)
Thanks [@chazdean](https://github.com/chazdean)! - Created `Divider`
component with guidance and examples

### Patch Changes

- Updated dependencies
\[[`afe77e584`](afe77e5),
[`e47595193`](e475951),
[`28529baaf`](28529ba),
[`e51d2c2d2`](e51d2c2)]:
    -   @shopify/polaris-icons@6.7.0
    -   @shopify/polaris@10.14.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
jesstelford added a commit that referenced this pull request Jun 20, 2023
In #7833, small-screen/mobile
support was removed when `selectable=true` or `condensed=true`, but
styles weren't cleaned up.
gwyneplaine pushed a commit that referenced this pull request Jun 22, 2023
In #7833, small-screen/mobile
support was removed when `selectable=true` or `condensed=true`, but
styles weren't cleaned up.
gwyneplaine pushed a commit that referenced this pull request Jun 22, 2023
In #7833, small-screen/mobile
support was removed when `selectable=true` or `condensed=true`, but
styles weren't cleaned up.
juzser pushed a commit to juzser/polaris that referenced this pull request Jul 27, 2023
…#7833)

It's the revert of the revert 🫠

### WHY are these changes introduced?

Fixes https://github.com/Shopify/web/issues/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
juzser pushed a commit to juzser/polaris that referenced this pull request Jul 27, 2023
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @shopify/stylelint-polaris@5.0.0

### Major Changes

- [Shopify#7691](Shopify#7691)
[`38b2a00a6`](Shopify@38b2a00)
Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - Stylelint
Polaris v5 release

## @shopify/polaris-icons@6.7.0

### Minor Changes

- [Shopify#7816](Shopify#7816)
[`afe77e584`](Shopify@afe77e5)
Thanks [@allyshiasewdat](https://github.com/allyshiasewdat)! - Add
returns major icon

## @shopify/polaris-migrator@0.10.0

### Minor Changes

- [Shopify#7726](Shopify#7726)
[`22c4107b3`](Shopify@22c4107)
Thanks [@qt314](https://github.com/qt314)! - Added migration to insert
disable comments for @shopify/stylelint-polaris

### Patch Changes

- [Shopify#7836](Shopify#7836)
[`77736370e`](Shopify@7773637)
Thanks [@qt314](https://github.com/qt314)! - Decouple polaris migrator
test from stylelint config so it's easier to maintain

- Updated dependencies
\[[`38b2a00a6`](Shopify@38b2a00)]:
    -   @shopify/stylelint-polaris@5.0.0

## @shopify/polaris@10.14.0

### Minor Changes

- [Shopify#7833](Shopify#7833)
[`e47595193`](Shopify@e475951)
Thanks [@mrcthms](https://github.com/mrcthms)! - Separated BulkActions
and SelectAllActions for new sticky bulk actions experience


- [Shopify#7812](Shopify#7812)
[`e51d2c2d2`](Shopify@e51d2c2)
Thanks [@chazdean](https://github.com/chazdean)! - Created `Divider`
component with guidance and examples

### Patch Changes

- [Shopify#7763](Shopify#7763)
[`28529baaf`](Shopify@28529ba)
Thanks [@n-filatov](https://github.com/n-filatov)! - Update the Toast
component to a more compact layout

- Updated dependencies
\[[`afe77e584`](Shopify@afe77e5)]:
    -   @shopify/polaris-icons@6.7.0

## @shopify/plugin-polaris@0.0.19

### Patch Changes

- Updated dependencies
\[[`22c4107b3`](Shopify@22c4107),
[`77736370e`](Shopify@7773637)]:
    -   @shopify/polaris-migrator@0.10.0

## polaris.shopify.com@0.27.0

### Minor Changes

- [Shopify#7812](Shopify#7812)
[`e51d2c2d2`](Shopify@e51d2c2)
Thanks [@chazdean](https://github.com/chazdean)! - Created `Divider`
component with guidance and examples

### Patch Changes

- Updated dependencies
\[[`afe77e584`](Shopify@afe77e5),
[`e47595193`](Shopify@e475951),
[`28529baaf`](Shopify@28529ba),
[`e51d2c2d2`](Shopify@e51d2c2)]:
    -   @shopify/polaris-icons@6.7.0
    -   @shopify/polaris@10.14.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants