-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pix-ui): mutualized pix select list
- Loading branch information
1 parent
2de6073
commit 53c209f
Showing
3 changed files
with
96 additions
and
86 deletions.
There are no files selected for viewing
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,83 @@ | ||
<ul role="listbox" id={{@listId}} class="pix-select__options"> | ||
<li | ||
class="pix-select-options-category__option{{unless | ||
@value | ||
' pix-select-options-category__option--selected' | ||
}}{{unless @displayDefaultOption ' pix-select-options-category__option--hidden'}}" | ||
role="option" | ||
tabindex={{if @isDefaultOptionHidden "-1" "0"}} | ||
aria-selected={{if @value "false" "true"}} | ||
{{on "click" (fn @onChange @defaultOption)}} | ||
{{on-enter-action (fn @onChange @defaultOption)}} | ||
{{on-space-action (fn @onChange @defaultOption)}} | ||
> | ||
{{@placeholder}} | ||
</li> | ||
{{#if @results}} | ||
{{#if @displayCategory}} | ||
{{#each @results as |element index|}} | ||
<ul | ||
class="pix-select-options__category" | ||
role="group" | ||
aria-labelledby={{if @displayCategory (concat "cat-" @selectId "-" index)}} | ||
> | ||
{{#if @displayCategory}} | ||
<li | ||
class="pix-select-options-category__name" | ||
role="presentation" | ||
id={{concat "cat-" @selectId "-" index}} | ||
> | ||
{{element.category}} | ||
</li> | ||
{{/if}} | ||
|
||
{{#each element.options as |option|}} | ||
{{! template-lint-disable require-context-role }} | ||
{{!https://www.w3.org/WAI/ARIA/apg/example-index/listbox/listbox-grouped.html}} | ||
<li | ||
class="pix-select-options-category__option{{if | ||
(eq option.value @value) | ||
' pix-select-options-category__option--selected' | ||
}}" | ||
role="option" | ||
tabindex={{if @isExpanded "0" "-1"}} | ||
aria-selected={{if (eq option.value @value) "true" "false"}} | ||
{{on "click" (fn @onChange option)}} | ||
{{on-enter-action (fn @onChange option)}} | ||
{{on-space-action (fn @onChange option)}} | ||
> | ||
{{option.label}} | ||
|
||
{{#if (eq option.value @value)}} | ||
<PixIcon @name="check" role="presentation" /> | ||
{{/if}} | ||
</li> | ||
{{/each}} | ||
</ul> | ||
{{/each}} | ||
{{else}} | ||
{{#each @results as |option|}} | ||
<li | ||
class="pix-select-options-category__option{{if | ||
(eq option.value @value) | ||
' pix-select-options-category__option--selected' | ||
}}" | ||
role="option" | ||
tabindex={{if @isExpanded "0" "-1"}} | ||
aria-selected={{if (eq option.value @value) "true" "false"}} | ||
{{on "click" (fn @onChange option)}} | ||
{{on-enter-action (fn @onChange option)}} | ||
{{on-space-action (fn @onChange @defaultOption)}} | ||
> | ||
{{option.label}} | ||
|
||
{{#if (eq option.value @value)}} | ||
<PixIcon @name="check" role="presentation" /> | ||
{{/if}} | ||
</li> | ||
{{/each}} | ||
{{/if}} | ||
{{else}} | ||
<li class="pix-select__empty-search-message">{{@emptySearchMessage}}</li> | ||
{{/if}} | ||
</ul> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from '@1024pix/pix-ui/components/pix-select-list'; |