Skip to content

Commit

Permalink
Merge pull request #5914 from veroglez/LPD-45714
Browse files Browse the repository at this point in the history
feat(@clayui/language-picker): LPD-45714 Add security margin
  • Loading branch information
matuzalemsteles authored Jan 22, 2025
2 parents 6d44f93 + 9eaf740 commit f5719b4
Show file tree
Hide file tree
Showing 7 changed files with 935 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/clay-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@clayui/button": "^3.116.0",
"@clayui/form": "^3.125.0",
"@clayui/icon": "^3.111.0",
"@clayui/label": "^3.111.0",
"@clayui/layout": "^3.111.0",
"@clayui/link": "^3.111.0",
"@clayui/loading-indicator": "^3.111.0",
Expand Down
1 change: 1 addition & 0 deletions packages/clay-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export {Picker, Option} from './picker';
export {FocusTrap} from './focus-trap';
export {Nav} from './nav';
export {Body, Cell, Head, Row, Table} from './table';
export {LanguagePicker} from './language-picker';

// Experimental components
export * as __EXPERIMENTAL_MENU from './drop-down';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`LanguagePicker renders 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Select a language, current language: English (United States)."
class="form-control form-control-select form-control-select-secondary"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-en-us"
role="presentation"
>
<use
href="/path/to/svg#en-us"
/>
</svg>
</span>
<span
class="inline-item-before"
>
en-US
</span>
</button>
</div>
`;

exports[`LanguagePicker renders a class name for the trigger 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Select a language, current language: English (United States)."
class="trigger-class form-control form-control-select form-control-select-secondary"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-en-us"
role="presentation"
>
<use
href="/path/to/svg#en-us"
/>
</svg>
</span>
<span
class="inline-item-before"
>
en-US
</span>
</button>
</div>
`;

exports[`LanguagePicker renders a small picker 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Select a language, current language: English (United States)."
class="form-control form-control-select form-control-select-secondary form-control-sm"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-en-us"
role="presentation"
>
<use
href="/path/to/svg#en-us"
/>
</svg>
</span>
<span
class="inline-item-before"
>
en-US
</span>
</button>
</div>
`;

exports[`LanguagePicker renders hidding the trigger text 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Select a language, current language: English (United States)."
class="form-control form-control-select form-control-select-secondary hidden-label"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-en-us"
role="presentation"
>
<use
href="/path/to/svg#en-us"
/>
</svg>
</span>
</button>
</div>
`;

exports[`LanguagePicker renders the picker with id 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Select a language, current language: English (United States)."
class="form-control form-control-select form-control-select-secondary"
id="pickerId"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-en-us"
role="presentation"
>
<use
href="/path/to/svg#en-us"
/>
</svg>
</span>
<span
class="inline-item-before"
>
en-US
</span>
</button>
</div>
`;

exports[`LanguagePicker renders with a default selected locale 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Select a language, current language: Spanish (Spain)."
class="trigger-class form-control form-control-select form-control-select-secondary"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-es-es"
role="presentation"
>
<use
href="/path/to/svg#es-es"
/>
</svg>
</span>
<span
class="inline-item-before"
>
es-ES
</span>
</button>
</div>
`;

exports[`LanguagePicker renders with a selected locale 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Select a language, current language: French (France)."
class="trigger-class form-control form-control-select form-control-select-secondary"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-fr-fr"
role="presentation"
>
<use
href="/path/to/svg#fr-fr"
/>
</svg>
</span>
<span
class="inline-item-before"
>
fr-FR
</span>
</button>
</div>
`;

exports[`LanguagePicker renders with custom labels 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Trigger Label"
class="form-control form-control-select form-control-select-secondary"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-en-us"
role="presentation"
>
<use
href="/path/to/svg#en-us"
/>
</svg>
</span>
<span
class="inline-item-before"
>
en-US
</span>
</button>
</div>
`;

exports[`LanguagePicker renders with translations 1`] = `
<div>
<button
aria-activedescendant=""
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Select a language, current language: English (United States)."
class="form-control form-control-select form-control-select-secondary"
role="combobox"
tabindex="0"
type="button"
>
<span
class="inline-item-before"
>
<svg
class="lexicon-icon lexicon-icon-en-us"
role="presentation"
>
<use
href="/path/to/svg#en-us"
/>
</svg>
</span>
<span
class="inline-item-before"
>
en-US
</span>
</button>
</div>
`;
Loading

0 comments on commit f5719b4

Please sign in to comment.