-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[IndexProvider/Table] Migrate from web - take 2 #3646
Conversation
🟢 This pull request modifies 30 files and might impact 1 other files. Details:All files potentially affected (total: 1)📄
|
77811e6
to
99fc4b0
Compare
8146afe
to
95f685b
Compare
@@ -72,7 +72,7 @@ $loading-panel-height: rem(53px); | |||
|
|||
.LoadingPanelText { | |||
margin-left: rem(12px); | |||
color: var(--p-text-highlight, color('teal', 'dark')); | |||
color: var(--p-text, color('teal', 'darker')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to adjust colors to meet contrast requirements. We'll want to take a look at making --p-text-highlight
accessible.
Other accessibility tests are fixed in : #3651 |
.storybook/polaris-readme-loader.js
Outdated
@@ -138,8 +138,8 @@ import { | |||
Heading, | |||
Icon, | |||
Image, | |||
IndexProvider, | |||
IndexTable, | |||
UnstableIndexProvider as IndexProvider, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit adding unstable prefix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this being marked "unstable" again. What would it take for us to consider this stable and be confident in this being a v1 of the component? We have been running this in production now for quite some time, it seems like from a stability perspective we should be confident at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instability is regarding the API since we've never revisited it. I was hoping to take a look at it this week but didn't have the chance. I'm going on vacation but ill take a look when I'm back and see if we can resolve the API
.storybook/polaris-readme-loader.js
Outdated
@@ -194,7 +194,7 @@ import { | |||
UnstyledLink, | |||
VisuallyHidden, | |||
VideoThumbnail, | |||
useIndexResourceState, | |||
useIndexResourceStateUnstable as useIndexResourceState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used suffix for the hook - since hooks always start with use
as per convention
@@ -117,6 +117,28 @@ | |||
"Icon": { | |||
"backdropWarning": "The {color} icon doesn’t accept backdrops. The icon colors that have backdrops are: {colorsWithBackDrops}" | |||
}, | |||
"IndexProvider": { | |||
"defaultItemSingular": "Item", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poorly localized source string detected
List of problems detected:
- Key
Polaris.IndexProvider.defaultItemSingular
contains the wordsingular
. While this in itself is not an issue, it is a good indicator that you should be making use of the pluralization subkeysone
andother
instead (see String Externalization Guide).
Questions about these messages? Hop in the #help-i18n-and-translation Slack channel.
@@ -117,6 +117,28 @@ | |||
"Icon": { | |||
"backdropWarning": "The {color} icon doesn’t accept backdrops. The icon colors that have backdrops are: {colorsWithBackDrops}" | |||
}, | |||
"IndexProvider": { | |||
"defaultItemSingular": "Item", | |||
"defaultItemPlural": "Items", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poorly localized source string detected
List of problems detected:
- Key
Polaris.IndexProvider.defaultItemPlural
contains the wordplural
. While this in itself is not an issue, it is a good indicator that you should be making use of the pluralization subkeysone
andother
instead (see String Externalization Guide).
Questions about these messages? Hop in the #help-i18n-and-translation Slack channel.
.storybook/polaris-readme-loader.js
Outdated
@@ -138,8 +138,8 @@ import { | |||
Heading, | |||
Icon, | |||
Image, | |||
IndexProvider, | |||
IndexTable, | |||
UnstableIndexProvider as IndexProvider, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this being marked "unstable" again. What would it take for us to consider this stable and be confident in this being a v1 of the component? We have been running this in production now for quite some time, it seems like from a stability perspective we should be confident at this point.
|
||
### Simple small screen index table | ||
|
||
A small screen index table with simple items and no bulk actions, sorting, or filtering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if rather than having a separate example like this that looks strange when viewed on larger screens, we instead have one example that actually does the responsive switch between the views. I think that would be more helpful to consumers who are trying to wire this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alex-page @dfmcphee @translation-platform Hi guys! How is it going with this PR? |
@@ -7,6 +7,13 @@ configure({adapter: new Adapter()}); | |||
// Mocks for scrolling | |||
window.scroll = () => {}; | |||
|
|||
window.open = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a mock for window.open
); | ||
} | ||
|
||
const mockRenderRow = (item: any) => { | ||
return <Component {...item} key={item.id} />; | ||
}; | ||
|
||
const mockRenderCondensedRow = (item: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a second renderer to remove the console errors
@@ -41,13 +41,9 @@ describe('<Row />', () => { | |||
|
|||
it('renders a RowHoveredContext provider', () => { | |||
const row = mountWithTable( | |||
<table> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're already using mountWithTable
@dfmcphee I took a look at Checkbox, Row & Cell. Row didn't need any changes. For I briefly looked at IndexTable & IndexProvider. I removed What do you think? |
That all sounds great to me. I think combining makes sense, at least for consumers right now. It still would be nice to be able to have some of the index logic abstracted from the view for other types in the future (index grid for example). Could we keep the provider but have it automatically included in the table? |
Is this going to be in v6? |
Hi @GhostApps, this will not be bundled with v6. V6 primarily revolves around design language and accessibility standards (AODA). This change would possibly delay the v6 rollout. Ideally, we'll have this ready shortly after and ship it out in a minor version! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Component looks really good 👍
I noticed one issue with the horizontal scrollbar during 🎩
It looks like the scrollBarContentStyles
doesn't get an updated width when the window is resized. It causes a scrollbar even when it's not needed.
indexTableScrollBar.mov
tableElement.current && tableInitialized | ||
? { | ||
height: '1px', | ||
width: tableElement.current.offsetWidth - SCROLL_BAR_PADDING, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is tableElement.current.offsetWidth
supposed to change with every render when the browser is being resized?
It seems to stay the same and might be whats causing the scrollbar issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lhoffbeck Sounds like this might be what you noticed this morning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that looks exactly like what I was seeing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umar-k Should be fixed now - here's the commit
We still need 3 required languages to 🚢 however the estimate is that they'll come in over the weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎩 'd and looks good to me! 🎉
@AndrewMusgrave any chance you know when this will be released? I tried to play with it by pulling latest but couldn't get the playground or building for a consuming project to work so am having to wait for the next official Polaris release |
@GhostApps The Polaris team will have more context, but they usually draft a release ~2 weeks. The last one was 11 days ago so it shouldn't be to long until a release What error were you getting in the playground? Maybe we could sort that out. |
If you wanted to create an issue and ping me there I would have happy to answer (so everyone in this pull request doesn't get pinged 😄 ) |
* Initial migration * Fix differences between web & polaris * Remove local translations * Fix styles & add useIndexResourceSelection * Added more tests * Docs & fixes & polish * Fix errors * Improve loading constrast * Add unstable prefix * Rework Checkbox, Row & Cell API * Remove onMoreActionPopoverToggle * Change imports to remove circular deps & delete subrow * Convert indexprovider internals to hooks * Removed index provider export * Update docs to exclude indextable * Apply feedback * Fix errors & tighten types * Rebase with main & remove NDL * Add new known custom property * Add useIndexResourceSelection tests * Add more tests * More tests * Add tests and remove unused code * Finish adding test for all reachable code * Update locales/fi.json * Update locales/fr.json * Update locales/zh-TW.json * Update locales/pt-PT.json * Update locales/th.json * Update locales/ja.json * Update locales/da.json * Update locales/ko.json * Update locales/pl.json * Update locales/it.json * Update locales/zh-CN.json * Update locales/sv.json * Update locales/nb.json * Update locales/nl.json * Fix scrollbar issue * Add known custom property * Update locales/vi.json * Update locales/es.json * Update locales/pt-BR.json * Update locales/tr.json * Update locales/de.json * Update locales/cs.json Co-authored-by: translation-platform <35075727+translation-platform@users.noreply.github.com>
WHY are these changes introduced?
Feature requests: [#390, #3637]
As teams reach AODA they'll need to replace their resource list with headers, with a semantic table. This pull request is bringing the table from orders into Polaris in an unstable state so others can gain from its accessibility improvements and contribute to the stability of its API/name
Major hanges other than C+P
Notes
Accessibility tests are failing from the filter's component - going to address them in another pull request
WHAT is this pull request doing?
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:Screenies
Simple index table
Simple small screen index table
Index table with empty state
Index table with bulk actions
Index table with bulk actions across pages
Index table with loading state
IndexTable with filtering
IndexTable with all of its elements
Small screen IndexTablr with all of its elements