-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add locale support to theme provider and use in date-text column (#1410)
## 🤨 Rationale Fixes #1293 Part of #1014 Adding design token ("lang") for locale and honoring that token's value when formatting dates in the date-text column. ## 👩💻 Implementation - introduced "lang" design token with dynamic default that uses the page's `lang` property, if valid, otherwise uses "en-US" - new `DocumentElementLang` singleton watches page element's `lang` property - added `lang` property to theme provider which sets design token value - using design token value when creating formatter used by date-text column - added new validation flag to theme provider that is set when the locale is malformed - setting 'en-US' locale for all date-text unit tests (which they were already assuming) - added unit tests ## 🧪 Testing Unit tests pass (even when system locale is something other than 'en'). ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: mollykreis <[email protected]> Co-authored-by: Jesse Attas <[email protected]>
- Loading branch information
1 parent
c8119e8
commit 5e462b1
Showing
12 changed files
with
396 additions
and
25 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-components-df093e6a-7cba-46ed-8d5d-07670af90719.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Add locale support to theme provider and use in date-text column", | ||
"packageName": "@ni/nimble-components", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/nimble-components/src/theme-provider/tests/theme-provider.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Controls, DocsStory, Meta, Title } from '@storybook/blocks'; | ||
import { themeProvider } from './theme-provider.stories'; | ||
|
||
<Meta title="Tokens/Theme Provider" /> | ||
<Title>Theme Provider</Title> | ||
|
||
The theme provider element allows configuring certain token values for the contained HTML tree. | ||
|
||
<DocsStory of={themeProvider} expanded={false} /> | ||
<Controls of={themeProvider} sourceState="none" /> |
Oops, something went wrong.