Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9a451f4
introduce a SubHeader component for the IndexTable
m4thieulavoie Jun 8, 2023
86147bd
fix a11y ci
m4thieulavoie Jun 15, 2023
c454a91
[IndexTable] Add selection handling for subheader rows
chloerice Jun 22, 2023
23043c8
[IndextTable] Fix type errors in stories
chloerice Jun 22, 2023
9f12023
[IndexTable] Update With subheader style guide example
chloerice Jun 22, 2023
ba11147
[IndexTable] Move subheader styles to co-locate with the rest of the …
chloerice Jun 23, 2023
1e4cbf6
[IndexTable] Add experimental subheader styles
chloerice Jun 23, 2023
ba6a079
[IndexTable] Add tests for subheader functionality
chloerice Jun 24, 2023
9d48799
[IndexTable] Add documentation for the subheader feature support
chloerice Jun 24, 2023
03313b4
Only add headers to relevant cells
chloerice Jun 26, 2023
00f9fd8
A11y fixes for heading cell id and association
chloerice Jun 27, 2023
357dbfd
revert rebase conflict resolution error
chloerice Jun 29, 2023
bb86a2f
Fix row checkbox unique id
chloerice Jun 30, 2023
7680c9a
[IndexTable][Checkbox] Add accessibilityLabel test
chloerice Jul 7, 2023
84104b4
[IndexTable] Remove interaction states from subheader rows
chloerice Jul 7, 2023
f5d2e22
[IndexTable] Add heading level border to subheader rows
chloerice Jul 9, 2023
1e0a8f9
[IndexTable] Use default cursor for subheader rows
chloerice Jul 9, 2023
ac31945
[IndexTable][Storybook] Disable subheader rows if all associated rows…
chloerice Jul 20, 2023
9c3da78
[IndexTable] Prevent selection on click of subheader rows
chloerice Jul 20, 2023
aef3026
[IndexTable][Row] Update test coverage for subheader row interaction …
chloerice Aug 5, 2023
a28d26c
[IndexTable] Detach range selection UX from subheader UI to broaden s…
chloerice Sep 13, 2023
d59a30d
Update props table to reflect updated API changes
chloerice Sep 19, 2023
97b405f
Update .changeset/lovely-rings-enjoy.md to fully describe the API cha…
chloerice Sep 19, 2023
fca3a5c
Ensure selection of indeterminate subheader row behaves like indeterm…
chloerice Sep 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/lovely-rings-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@shopify/polaris': minor
'polaris.shopify.com': patch
---

IndexTable subheader support updates:
- `IndexTable.Row`
- Added the `header` prop to apply subheader styles
- Added `indeterminate` value to `selected` prop
- Added `selectionRange` prop to specify which rows in the range are selected when the row is selected
- Added `rowType` prop to indicate the relationship or role of the row's contents (`data` or `subheader`)
- `IndexTable.Cell`
- Added the `header` prop to apply subheader styles
- Added `as` prop to set as a `th` if it is serving as a subheading
- Added `colSpan` prop to specify the number of the columns that the cell element should extend
- Added `scope` prop to indicate which cells the `th` element relates
- See the [With subheaders](https://polaris.shopify.com/components/tables/index-table) example on polaris.shopify.com for how to properly configure.
112 changes: 100 additions & 12 deletions polaris-react/src/components/IndexTable/IndexTable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,14 @@ $loading-panel-height: 53px;
}

// This is to bust specificity with .Table-scrolling and TableCell:first-child or TableCell:first-child + TableCell bg color above.
#{$se23} & .TableRow-subdued {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-compound-selectors -- se23 overrides
.TableCell-first,
.TableCell-first + .TableCell {
background-color: var(--p-color-bg-subdued);
#{$se23} & {
// stylelint-disable-next-line selector-max-combinators -- se23 overrides
.TableRow-subdued {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-compound-selectors -- se23 overrides
.TableCell-first,
.TableCell-first + .TableCell {
background-color: var(--p-color-bg-subdued);
}
}
}

Expand Down Expand Up @@ -220,19 +223,65 @@ $loading-panel-height: 53px;
.TableCell-first,
.TableCell-first + .TableCell {
background-color: var(--p-color-bg-subdued);

#{$se23} & {
color: var(--p-color-text-subdued);
}
}
}

&.TableRow-hovered {
&.TableRow-subheader {
cursor: default;
// stylelint-disable-next-line selector-max-combinators, selector-max-class, selector-max-specificity -- generated by polaris-migrator DO NOT COPY
&,
.TableCell:first-child,
.TableCell-first,
.TableCell-first + .TableCell,
.TableCell:last-child {
color: var(--p-color-text-subdued);
font-weight: var(--p-font-weight-medium);
font-size: var(--p-font-size-75);
background-color: var(--p-color-bg-subdued);
border-top: var(--p-border-width-1) solid var(--p-color-border);
border-bottom: var(--p-border-width-1) solid var(--p-color-border);
}

#{$se23} & {
/* stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-compound-selectors -- generated by polaris-migrator DO NOT COPY */
&,
.TableCell:first-child,
.TableCell-first,
.TableCell-first + .TableCell,
.TableCell:last-child {
background-color: var(--p-color-bg-subdued);
border-color: var(--p-color-border);
}
}
}

&.TableRow-hovered:not(.TableRow-disabled) {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity -- generated by polaris-migrator DO NOT COPY
&,
.TableCell-first,
.TableCell-first + .TableCell {
background-color: var(--p-color-bg-hover);
}

// stylelint-disable-next-line selector-max-class, selector-max-specificity -- generated by polaris-migrator DO NOT COPY
&.TableRow-subheader {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity -- generated by polaris-migrator DO NOT COPY
&,
.TableCell:first-child,
.TableCell-first,
.TableCell-first + .TableCell,
.TableCell:last-child {
background-color: var(--p-color-bg-subdued);

#{$se23} & {
background-color: var(--p-color-bg-subdued);
}
}
}
}

&.TableRow-selected {
Expand All @@ -248,11 +297,27 @@ $loading-panel-height: 53px;
background-color: var(--p-color-bg-primary-subdued-selected);
}
}

/* stylelint-disable-next-line selector-max-class -- generated by polaris-migrator DO NOT COPY */
&.TableRow-subheader {
/* stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity -- generated by polaris-migrator DO NOT COPY */
&,
.TableCell:first-child,
.TableCell-first,
.TableCell-first + .TableCell,
.TableCell:last-child {
background-color: var(--p-color-bg-subdued);

#{$se23} & {
background-color: var(--p-color-bg-subdued);
}
}
}
}

// stylelint-disable-next-line no-duplicate-selectors -- se23 temporary styles
#{$se23} & {
&.TableRow-hovered {
&.TableRow-hovered:not(.TableRow-disabled) {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-compound-selectors -- se23 temporary styles
&,
.TableCell-first,
Expand Down Expand Up @@ -299,7 +364,7 @@ $loading-panel-height: 53px;
}
}

// stylelint-disable-next-line selector-max-class -- generated by polaris-migrator DO NOT COPY
/* stylelint-disable-next-line selector-max-class -- generated by polaris-migrator DO NOT COPY */
&.TableRow-hovered.TableRow-selected {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity -- generated by polaris-migrator DO NOT COPY
&,
Expand All @@ -313,6 +378,18 @@ $loading-panel-height: 53px;
background-color: var(--p-color-bg-primary-subdued-hover);
}
}

/* stylelint-disable-next-line selector-max-class, selector-max-specificity -- generated by polaris-migrator DO NOT COPY */
&.TableRow-subheader {
/* stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity -- generated by polaris-migrator DO NOT COPY */
&,
.TableCell:first-child,
.TableCell-first,
.TableCell-first + .TableCell,
.TableCell:last-child {
background-color: var(--p-color-bg-subdued);
}
}
}
}

Expand Down Expand Up @@ -757,7 +834,17 @@ $loading-panel-height: 53px;
}
}
}

#{$se23} & {
/* stylelint-disable-next-line selector-max-combinators -- generated by polaris-migrator DO NOT COPY */
.TableCell,
.TableHeading {
/* stylelint-disable-next-line selector-max-combinators -- generated by polaris-migrator DO NOT COPY */
&:first-child {
padding-left: var(--p-space-3);
}
}

// This is to bust specificity with Table-unselectable and TableCel:first-child bg color above.
// stylelint-disable-next-line selector-max-combinators -- se23 override
.TableRow-subdued:not(.TableRow-hovered) {
Expand Down Expand Up @@ -838,6 +925,7 @@ $loading-panel-height: 53px;
.statusSubdued {
.TableCell:last-child {
background-color: var(--p-color-bg-subdued);

#{$se23} & {
color: var(--p-color-text-subdued);
}
Expand All @@ -860,11 +948,11 @@ $loading-panel-height: 53px;
}
}

#{$se23} & .TableRow-selected.TableRow-subdued {
color: var(--p-color-text-subdued);
}

#{$se23} & {
.TableRow-selected.TableRow-subdued {
color: var(--p-color-text-subdued);
}

.TableRow-hovered {
// stylelint-disable-next-line selector-max-compound-selectors -- se23 temporary styles
.TableCell:last-child {
Expand Down
Loading