Skip to content

Commit

Permalink
fix(theme): stop language resolution propagation and demo using local…
Browse files Browse the repository at this point in the history
… languages
  • Loading branch information
Westbrook authored and hunterloftis committed Mar 29, 2023
1 parent e878d2e commit 6b81391
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/number-field/stories/number-field.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,31 @@ decimals.args = {
value: 19.274,
};

export const germanDecimals = (args: StoryArgs): TemplateResult => {
return html`
<sp-field-label for="decimals">
Enter a number with visible decimals
</sp-field-label>
<sp-theme lang="de">
<sp-number-field
id="decimals"
style="width: 200px"
...=${spreadProps(args)}
@change=${args.onChange}
.formatOptions=${{
signDisplay: 'exceptZero',
minimumFractionDigits: 1,
maximumFractionDigits: 2,
} as unknown as Intl.NumberFormatOptions}
></sp-number-field>
</sp-theme>
`;
};

germanDecimals.args = {
value: 19.274,
};

export const percents = (args: StoryArgs = {}): TemplateResult => {
return html`
<sp-field-label for="percents">Enter a percentage</sp-field-label>
Expand Down
1 change: 1 addition & 0 deletions tools/theme/src/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ export class Theme extends HTMLElement implements ThemeKindProvider {
}

private _handleContextPresence(event: CustomEvent<ProvideLang>): void {
event.stopPropagation();
const target = event.composedPath()[0] as HTMLElement;
if (this._contextConsumers.has(target)) {
return;
Expand Down

0 comments on commit 6b81391

Please sign in to comment.