@ni/fast-foundation 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/dts/accordion/accordion.d.ts +65 -0
- package/dist/dts/accordion/accordion.template.d.ts +8 -0
- package/dist/dts/accordion/index.d.ts +2 -0
- package/dist/dts/accordion-item/accordion-item.d.ts +76 -0
- package/dist/dts/accordion-item/accordion-item.template.d.ts +8 -0
- package/dist/dts/accordion-item/index.d.ts +2 -0
- package/dist/dts/anchor/anchor.d.ts +128 -0
- package/dist/dts/anchor/anchor.template.d.ts +8 -0
- package/dist/dts/anchor/index.d.ts +2 -0
- package/dist/dts/anchored-region/anchored-region-config.d.ts +117 -0
- package/dist/dts/anchored-region/anchored-region.d.ts +389 -0
- package/dist/dts/anchored-region/anchored-region.template.d.ts +8 -0
- package/dist/dts/anchored-region/index.d.ts +3 -0
- package/dist/dts/avatar/avatar.d.ts +62 -0
- package/dist/dts/avatar/avatar.template.d.ts +8 -0
- package/dist/dts/avatar/index.d.ts +2 -0
- package/dist/dts/badge/badge.d.ts +36 -0
- package/dist/dts/badge/badge.template.d.ts +8 -0
- package/dist/dts/badge/index.d.ts +2 -0
- package/dist/dts/breadcrumb/breadcrumb.d.ts +27 -0
- package/dist/dts/breadcrumb/breadcrumb.template.d.ts +8 -0
- package/dist/dts/breadcrumb/index.d.ts +2 -0
- package/dist/dts/breadcrumb-item/breadcrumb-item.d.ts +36 -0
- package/dist/dts/breadcrumb-item/breadcrumb-item.template.d.ts +8 -0
- package/dist/dts/breadcrumb-item/index.d.ts +2 -0
- package/dist/dts/button/button.d.ts +167 -0
- package/dist/dts/button/button.form-associated.d.ts +16 -0
- package/dist/dts/button/button.template.d.ts +8 -0
- package/dist/dts/button/index.d.ts +2 -0
- package/dist/dts/calendar/calendar.d.ts +178 -0
- package/dist/dts/calendar/calendar.template.d.ts +58 -0
- package/dist/dts/calendar/date-formatter.d.ts +124 -0
- package/dist/dts/calendar/index.d.ts +3 -0
- package/dist/dts/card/card.d.ts +10 -0
- package/dist/dts/card/card.template.d.ts +8 -0
- package/dist/dts/card/index.d.ts +2 -0
- package/dist/dts/checkbox/checkbox.d.ts +58 -0
- package/dist/dts/checkbox/checkbox.form-associated.d.ts +16 -0
- package/dist/dts/checkbox/checkbox.template.d.ts +8 -0
- package/dist/dts/checkbox/index.d.ts +2 -0
- package/dist/dts/combobox/combobox.d.ts +341 -0
- package/dist/dts/combobox/combobox.form-associated.d.ts +16 -0
- package/dist/dts/combobox/combobox.options.d.ts +15 -0
- package/dist/dts/combobox/combobox.template.d.ts +8 -0
- package/dist/dts/combobox/index.d.ts +3 -0
- package/dist/dts/data-grid/data-grid-cell.d.ts +62 -0
- package/dist/dts/data-grid/data-grid-cell.template.d.ts +9 -0
- package/dist/dts/data-grid/data-grid-row.d.ts +119 -0
- package/dist/dts/data-grid/data-grid-row.template.d.ts +10 -0
- package/dist/dts/data-grid/data-grid.d.ts +218 -0
- package/dist/dts/data-grid/data-grid.options.d.ts +49 -0
- package/dist/dts/data-grid/data-grid.template.d.ts +10 -0
- package/dist/dts/data-grid/index.d.ts +6 -0
- package/dist/dts/design-system/component-presentation.d.ts +66 -0
- package/dist/dts/design-system/design-system.d.ts +104 -0
- package/dist/dts/design-system/index.d.ts +3 -0
- package/dist/dts/design-system/registration-context.d.ts +106 -0
- package/dist/dts/design-token/custom-property-manager.d.ts +35 -0
- package/dist/dts/design-token/design-token.d.ts +139 -0
- package/dist/dts/design-token/interfaces.d.ts +31 -0
- package/dist/dts/di/di.d.ts +858 -0
- package/dist/dts/di/index.d.ts +1 -0
- package/dist/dts/dialog/dialog.d.ts +153 -0
- package/dist/dts/dialog/dialog.template.d.ts +8 -0
- package/dist/dts/dialog/index.d.ts +2 -0
- package/dist/dts/directives/reflect-attributes.d.ts +18 -0
- package/dist/dts/disclosure/disclosure.d.ts +59 -0
- package/dist/dts/disclosure/disclosure.template.d.ts +8 -0
- package/dist/dts/disclosure/index.d.ts +2 -0
- package/dist/dts/divider/divider.d.ts +28 -0
- package/dist/dts/divider/divider.options.d.ts +19 -0
- package/dist/dts/divider/divider.template.d.ts +8 -0
- package/dist/dts/divider/index.d.ts +2 -0
- package/dist/dts/flipper/flipper.d.ts +57 -0
- package/dist/dts/flipper/flipper.options.d.ts +13 -0
- package/dist/dts/flipper/flipper.template.d.ts +8 -0
- package/dist/dts/flipper/index.d.ts +2 -0
- package/dist/dts/form-associated/form-associated.d.ts +177 -0
- package/dist/dts/form-associated/index.d.ts +1 -0
- package/dist/dts/foundation-element/foundation-element.d.ts +120 -0
- package/dist/dts/foundation-element/index.d.ts +1 -0
- package/dist/dts/horizontal-scroll/horizontal-scroll.d.ts +242 -0
- package/dist/dts/horizontal-scroll/horizontal-scroll.template.d.ts +7 -0
- package/dist/dts/horizontal-scroll/index.d.ts +2 -0
- package/dist/dts/index-rollup.d.ts +2 -0
- package/dist/dts/index.d.ts +53 -0
- package/dist/dts/interfaces.d.ts +4 -0
- package/dist/dts/listbox/index.d.ts +3 -0
- package/dist/dts/listbox/listbox.d.ts +314 -0
- package/dist/dts/listbox/listbox.element.d.ts +223 -0
- package/dist/dts/listbox/listbox.template.d.ts +8 -0
- package/dist/dts/listbox-option/index.d.ts +2 -0
- package/dist/dts/listbox-option/listbox-option.d.ts +176 -0
- package/dist/dts/listbox-option/listbox-option.template.d.ts +8 -0
- package/dist/dts/menu/index.d.ts +2 -0
- package/dist/dts/menu/menu.d.ts +78 -0
- package/dist/dts/menu/menu.template.d.ts +8 -0
- package/dist/dts/menu-item/index.d.ts +2 -0
- package/dist/dts/menu-item/menu-item.d.ts +160 -0
- package/dist/dts/menu-item/menu-item.options.d.ts +29 -0
- package/dist/dts/menu-item/menu-item.template.d.ts +10 -0
- package/dist/dts/number-field/index.d.ts +2 -0
- package/dist/dts/number-field/number-field.d.ts +227 -0
- package/dist/dts/number-field/number-field.form-associated.d.ts +16 -0
- package/dist/dts/number-field/number-field.template.d.ts +8 -0
- package/dist/dts/patterns/aria-global.d.ts +189 -0
- package/dist/dts/patterns/index.d.ts +2 -0
- package/dist/dts/patterns/start-end.d.ts +65 -0
- package/dist/dts/picker/index.d.ts +10 -0
- package/dist/dts/picker/picker-list-item.d.ts +38 -0
- package/dist/dts/picker/picker-list-item.template.d.ts +8 -0
- package/dist/dts/picker/picker-list.d.ts +8 -0
- package/dist/dts/picker/picker-list.template.d.ts +8 -0
- package/dist/dts/picker/picker-menu-option.d.ts +37 -0
- package/dist/dts/picker/picker-menu-option.template.d.ts +8 -0
- package/dist/dts/picker/picker-menu.d.ts +46 -0
- package/dist/dts/picker/picker-menu.template.d.ts +8 -0
- package/dist/dts/picker/picker.d.ts +390 -0
- package/dist/dts/picker/picker.form-associated.d.ts +16 -0
- package/dist/dts/picker/picker.template.d.ts +8 -0
- package/dist/dts/progress/base-progress.d.ts +71 -0
- package/dist/dts/progress/index.d.ts +2 -0
- package/dist/dts/progress/progress.template.d.ts +8 -0
- package/dist/dts/progress-ring/index.d.ts +1 -0
- package/dist/dts/progress-ring/progress-ring.template.d.ts +8 -0
- package/dist/dts/radio/index.d.ts +2 -0
- package/dist/dts/radio/radio.d.ts +70 -0
- package/dist/dts/radio/radio.form-associated.d.ts +16 -0
- package/dist/dts/radio/radio.template.d.ts +8 -0
- package/dist/dts/radio-group/index.d.ts +2 -0
- package/dist/dts/radio-group/radio-group.d.ts +101 -0
- package/dist/dts/radio-group/radio-group.template.d.ts +8 -0
- package/dist/dts/search/index.d.ts +2 -0
- package/dist/dts/search/search.d.ts +162 -0
- package/dist/dts/search/search.form-associated.d.ts +16 -0
- package/dist/dts/search/search.template.d.ts +8 -0
- package/dist/dts/select/index.d.ts +3 -0
- package/dist/dts/select/select.d.ts +289 -0
- package/dist/dts/select/select.form-associated.d.ts +16 -0
- package/dist/dts/select/select.options.d.ts +13 -0
- package/dist/dts/select/select.template.d.ts +8 -0
- package/dist/dts/skeleton/index.d.ts +2 -0
- package/dist/dts/skeleton/skeleton.d.ts +47 -0
- package/dist/dts/skeleton/skeleton.template.d.ts +8 -0
- package/dist/dts/slider/index.d.ts +2 -0
- package/dist/dts/slider/slider-utilities.d.ts +5 -0
- package/dist/dts/slider/slider.d.ts +230 -0
- package/dist/dts/slider/slider.form-associated.d.ts +16 -0
- package/dist/dts/slider/slider.template.d.ts +8 -0
- package/dist/dts/slider-label/index.d.ts +2 -0
- package/dist/dts/slider-label/slider-label.d.ts +81 -0
- package/dist/dts/slider-label/slider-label.template.d.ts +8 -0
- package/dist/dts/switch/index.d.ts +2 -0
- package/dist/dts/switch/switch.d.ts +60 -0
- package/dist/dts/switch/switch.form-associated.d.ts +16 -0
- package/dist/dts/switch/switch.template.d.ts +8 -0
- package/dist/dts/tab/index.d.ts +2 -0
- package/dist/dts/tab/tab.d.ts +17 -0
- package/dist/dts/tab/tab.template.d.ts +8 -0
- package/dist/dts/tab-panel/index.d.ts +2 -0
- package/dist/dts/tab-panel/tab-panel.d.ts +10 -0
- package/dist/dts/tab-panel/tab-panel.template.d.ts +8 -0
- package/dist/dts/tabs/index.d.ts +2 -0
- package/dist/dts/tabs/tabs.d.ts +140 -0
- package/dist/dts/tabs/tabs.template.d.ts +8 -0
- package/dist/dts/test-utilities/fixture.d.ts +89 -0
- package/dist/dts/test-utilities/timeout.d.ts +4 -0
- package/dist/dts/text-area/index.d.ts +2 -0
- package/dist/dts/text-area/text-area.d.ts +149 -0
- package/dist/dts/text-area/text-area.form-associated.d.ts +16 -0
- package/dist/dts/text-area/text-area.options.d.ts +27 -0
- package/dist/dts/text-area/text-area.template.d.ts +8 -0
- package/dist/dts/text-field/index.d.ts +2 -0
- package/dist/dts/text-field/text-field.d.ts +166 -0
- package/dist/dts/text-field/text-field.form-associated.d.ts +16 -0
- package/dist/dts/text-field/text-field.options.d.ts +31 -0
- package/dist/dts/text-field/text-field.template.d.ts +8 -0
- package/dist/dts/toolbar/index.d.ts +2 -0
- package/dist/dts/toolbar/toolbar.d.ts +167 -0
- package/dist/dts/toolbar/toolbar.template.d.ts +9 -0
- package/dist/dts/tooltip/index.d.ts +2 -0
- package/dist/dts/tooltip/tooltip.d.ts +239 -0
- package/dist/dts/tooltip/tooltip.options.d.ts +69 -0
- package/dist/dts/tooltip/tooltip.template.d.ts +8 -0
- package/dist/dts/tree-item/index.d.ts +2 -0
- package/dist/dts/tree-item/tree-item.d.ts +141 -0
- package/dist/dts/tree-item/tree-item.template.d.ts +8 -0
- package/dist/dts/tree-view/index.d.ts +2 -0
- package/dist/dts/tree-view/tree-view.d.ts +99 -0
- package/dist/dts/tree-view/tree-view.template.d.ts +8 -0
- package/dist/dts/utilities/apply-mixins.d.ts +6 -0
- package/dist/dts/utilities/composed-contains.d.ts +12 -0
- package/dist/dts/utilities/composed-parent.d.ts +10 -0
- package/dist/dts/utilities/direction.d.ts +7 -0
- package/dist/dts/utilities/index.d.ts +8 -0
- package/dist/dts/utilities/intersection-service.d.ts +30 -0
- package/dist/dts/utilities/match-media-stylesheet-behavior.d.ts +124 -0
- package/dist/dts/utilities/property-stylesheet-behavior.d.ts +38 -0
- package/dist/dts/utilities/resize-observer.d.ts +31 -0
- package/dist/dts/utilities/root-active-element.d.ts +1 -0
- package/dist/dts/utilities/style/disabled.d.ts +5 -0
- package/dist/dts/utilities/style/display.d.ts +17 -0
- package/dist/dts/utilities/style/focus.d.ts +8 -0
- package/dist/dts/utilities/style/index.d.ts +3 -0
- package/dist/dts/utilities/whitespace-filter.d.ts +9 -0
- package/dist/esm/accordion/accordion.js +185 -0
- package/dist/esm/accordion/accordion.template.js +11 -0
- package/dist/esm/accordion/index.js +2 -0
- package/dist/esm/accordion-item/accordion-item.js +72 -0
- package/dist/esm/accordion-item/accordion-item.template.js +49 -0
- package/dist/esm/accordion-item/index.js +2 -0
- package/dist/esm/anchor/anchor.js +85 -0
- package/dist/esm/anchor/anchor.template.js +47 -0
- package/dist/esm/anchor/index.js +2 -0
- package/dist/esm/anchored-region/anchored-region-config.js +59 -0
- package/dist/esm/anchored-region/anchored-region.js +964 -0
- package/dist/esm/anchored-region/anchored-region.template.js +12 -0
- package/dist/esm/anchored-region/index.js +3 -0
- package/dist/esm/avatar/avatar.js +39 -0
- package/dist/esm/avatar/avatar.template.js +23 -0
- package/dist/esm/avatar/index.js +2 -0
- package/dist/esm/badge/badge.js +40 -0
- package/dist/esm/badge/badge.template.js +12 -0
- package/dist/esm/badge/index.js +2 -0
- package/dist/esm/breadcrumb/breadcrumb.js +70 -0
- package/dist/esm/breadcrumb/breadcrumb.template.js +14 -0
- package/dist/esm/breadcrumb/index.js +2 -0
- package/dist/esm/breadcrumb-item/breadcrumb-item.js +23 -0
- package/dist/esm/breadcrumb-item/breadcrumb-item.template.js +24 -0
- package/dist/esm/breadcrumb-item/index.js +2 -0
- package/dist/esm/button/button.form-associated.js +15 -0
- package/dist/esm/button/button.js +183 -0
- package/dist/esm/button/button.template.js +51 -0
- package/dist/esm/button/index.js +2 -0
- package/dist/esm/calendar/calendar.js +280 -0
- package/dist/esm/calendar/calendar.template.js +191 -0
- package/dist/esm/calendar/date-formatter.js +144 -0
- package/dist/esm/calendar/index.js +3 -0
- package/dist/esm/card/card.js +10 -0
- package/dist/esm/card/card.template.js +8 -0
- package/dist/esm/card/index.js +2 -0
- package/dist/esm/checkbox/checkbox.form-associated.js +15 -0
- package/dist/esm/checkbox/checkbox.js +75 -0
- package/dist/esm/checkbox/checkbox.template.js +35 -0
- package/dist/esm/checkbox/index.js +2 -0
- package/dist/esm/combobox/combobox.form-associated.js +15 -0
- package/dist/esm/combobox/combobox.js +587 -0
- package/dist/esm/combobox/combobox.options.js +10 -0
- package/dist/esm/combobox/combobox.template.js +66 -0
- package/dist/esm/combobox/index.js +3 -0
- package/dist/esm/data-grid/data-grid-cell.js +229 -0
- package/dist/esm/data-grid/data-grid-cell.template.js +23 -0
- package/dist/esm/data-grid/data-grid-row.js +203 -0
- package/dist/esm/data-grid/data-grid-row.template.js +47 -0
- package/dist/esm/data-grid/data-grid.js +440 -0
- package/dist/esm/data-grid/data-grid.options.js +31 -0
- package/dist/esm/data-grid/data-grid.template.js +36 -0
- package/dist/esm/data-grid/index.js +6 -0
- package/dist/esm/design-system/component-presentation.js +86 -0
- package/dist/esm/design-system/design-system.js +207 -0
- package/dist/esm/design-system/index.js +3 -0
- package/dist/esm/design-system/registration-context.js +1 -0
- package/dist/esm/design-token/custom-property-manager.js +216 -0
- package/dist/esm/design-token/design-token.js +657 -0
- package/dist/esm/design-token/interfaces.js +1 -0
- package/dist/esm/di/di.js +1341 -0
- package/dist/esm/di/index.js +1 -0
- package/dist/esm/dialog/dialog.js +280 -0
- package/dist/esm/dialog/dialog.template.js +30 -0
- package/dist/esm/dialog/index.js +2 -0
- package/dist/esm/directives/reflect-attributes.js +88 -0
- package/dist/esm/disclosure/disclosure.js +72 -0
- package/dist/esm/disclosure/disclosure.template.js +20 -0
- package/dist/esm/disclosure/index.js +2 -0
- package/dist/esm/divider/divider.js +39 -0
- package/dist/esm/divider/divider.options.js +14 -0
- package/dist/esm/divider/divider.template.js +8 -0
- package/dist/esm/divider/index.js +2 -0
- package/dist/esm/flipper/flipper.js +65 -0
- package/dist/esm/flipper/flipper.options.js +8 -0
- package/dist/esm/flipper/flipper.template.js +30 -0
- package/dist/esm/flipper/index.js +2 -0
- package/dist/esm/form-associated/form-associated.js +464 -0
- package/dist/esm/form-associated/index.js +1 -0
- package/dist/esm/foundation-element/foundation-element.js +132 -0
- package/dist/esm/foundation-element/index.js +1 -0
- package/dist/esm/horizontal-scroll/horizontal-scroll.js +380 -0
- package/dist/esm/horizontal-scroll/horizontal-scroll.template.js +62 -0
- package/dist/esm/horizontal-scroll/index.js +2 -0
- package/dist/esm/index-rollup.js +2 -0
- package/dist/esm/index.js +54 -0
- package/dist/esm/interfaces.js +1 -0
- package/dist/esm/listbox/index.js +3 -0
- package/dist/esm/listbox/listbox.element.js +448 -0
- package/dist/esm/listbox/listbox.js +528 -0
- package/dist/esm/listbox/listbox.template.js +27 -0
- package/dist/esm/listbox-option/index.js +2 -0
- package/dist/esm/listbox-option/listbox-option.js +200 -0
- package/dist/esm/listbox-option/listbox-option.template.js +25 -0
- package/dist/esm/menu/index.js +2 -0
- package/dist/esm/menu/menu.js +290 -0
- package/dist/esm/menu/menu.template.js +15 -0
- package/dist/esm/menu-item/index.js +2 -0
- package/dist/esm/menu-item/menu-item.js +251 -0
- package/dist/esm/menu-item/menu-item.options.js +26 -0
- package/dist/esm/menu-item/menu-item.template.js +78 -0
- package/dist/esm/number-field/index.js +2 -0
- package/dist/esm/number-field/number-field.form-associated.js +15 -0
- package/dist/esm/number-field/number-field.js +288 -0
- package/dist/esm/number-field/number-field.template.js +84 -0
- package/dist/esm/patterns/aria-global.js +70 -0
- package/dist/esm/patterns/index.js +2 -0
- package/dist/esm/patterns/start-end.js +84 -0
- package/dist/esm/picker/index.js +10 -0
- package/dist/esm/picker/picker-list-item.js +71 -0
- package/dist/esm/picker/picker-list-item.template.js +17 -0
- package/dist/esm/picker/picker-list.js +8 -0
- package/dist/esm/picker/picker-list.template.js +13 -0
- package/dist/esm/picker/picker-menu-option.js +61 -0
- package/dist/esm/picker/picker-menu-option.template.js +16 -0
- package/dist/esm/picker/picker-menu.js +59 -0
- package/dist/esm/picker/picker-menu.template.js +29 -0
- package/dist/esm/picker/picker.form-associated.js +15 -0
- package/dist/esm/picker/picker.js +759 -0
- package/dist/esm/picker/picker.template.js +97 -0
- package/dist/esm/progress/base-progress.js +69 -0
- package/dist/esm/progress/index.js +2 -0
- package/dist/esm/progress/progress.template.js +31 -0
- package/dist/esm/progress-ring/index.js +1 -0
- package/dist/esm/progress-ring/progress-ring.template.js +45 -0
- package/dist/esm/radio/index.js +2 -0
- package/dist/esm/radio/radio.form-associated.js +15 -0
- package/dist/esm/radio/radio.js +108 -0
- package/dist/esm/radio/radio.template.js +31 -0
- package/dist/esm/radio-group/index.js +2 -0
- package/dist/esm/radio-group/radio-group.js +390 -0
- package/dist/esm/radio-group/radio-group.template.js +29 -0
- package/dist/esm/search/index.js +2 -0
- package/dist/esm/search/search.form-associated.js +15 -0
- package/dist/esm/search/search.js +157 -0
- package/dist/esm/search/search.template.js +93 -0
- package/dist/esm/select/index.js +3 -0
- package/dist/esm/select/select.form-associated.js +15 -0
- package/dist/esm/select/select.js +490 -0
- package/dist/esm/select/select.options.js +8 -0
- package/dist/esm/select/select.template.js +72 -0
- package/dist/esm/skeleton/index.js +2 -0
- package/dist/esm/skeleton/skeleton.js +35 -0
- package/dist/esm/skeleton/skeleton.template.js +20 -0
- package/dist/esm/slider/index.js +2 -0
- package/dist/esm/slider/slider-utilities.js +11 -0
- package/dist/esm/slider/slider.form-associated.js +15 -0
- package/dist/esm/slider/slider.js +452 -0
- package/dist/esm/slider/slider.template.js +40 -0
- package/dist/esm/slider-label/index.js +2 -0
- package/dist/esm/slider-label/slider-label.js +158 -0
- package/dist/esm/slider-label/slider-label.template.js +24 -0
- package/dist/esm/switch/index.js +2 -0
- package/dist/esm/switch/switch.form-associated.js +15 -0
- package/dist/esm/switch/switch.js +79 -0
- package/dist/esm/switch/switch.template.js +37 -0
- package/dist/esm/tab/index.js +2 -0
- package/dist/esm/tab/tab.js +15 -0
- package/dist/esm/tab/tab.template.js +10 -0
- package/dist/esm/tab-panel/index.js +2 -0
- package/dist/esm/tab-panel/tab-panel.js +10 -0
- package/dist/esm/tab-panel/tab-panel.template.js +10 -0
- package/dist/esm/tabs/index.js +2 -0
- package/dist/esm/tabs/tabs.js +375 -0
- package/dist/esm/tabs/tabs.template.js +26 -0
- package/dist/esm/test-utilities/fixture.js +90 -0
- package/dist/esm/test-utilities/timeout.js +13 -0
- package/dist/esm/text-area/index.js +2 -0
- package/dist/esm/text-area/text-area.form-associated.js +15 -0
- package/dist/esm/text-area/text-area.js +146 -0
- package/dist/esm/text-area/text-area.options.js +22 -0
- package/dist/esm/text-area/text-area.template.js +64 -0
- package/dist/esm/text-field/index.js +2 -0
- package/dist/esm/text-field/text-field.form-associated.js +15 -0
- package/dist/esm/text-field/text-field.js +183 -0
- package/dist/esm/text-field/text-field.options.js +26 -0
- package/dist/esm/text-field/text-field.template.js +70 -0
- package/dist/esm/toolbar/index.js +2 -0
- package/dist/esm/toolbar/toolbar.js +271 -0
- package/dist/esm/toolbar/toolbar.template.js +37 -0
- package/dist/esm/tooltip/index.js +2 -0
- package/dist/esm/tooltip/tooltip.js +512 -0
- package/dist/esm/tooltip/tooltip.options.js +63 -0
- package/dist/esm/tooltip/tooltip.template.js +32 -0
- package/dist/esm/tree-item/index.js +2 -0
- package/dist/esm/tree-item/tree-item.js +150 -0
- package/dist/esm/tree-item/tree-item.template.js +52 -0
- package/dist/esm/tree-view/index.js +2 -0
- package/dist/esm/tree-view/tree-view.js +268 -0
- package/dist/esm/tree-view/tree-view.template.js +18 -0
- package/dist/esm/utilities/apply-mixins.js +20 -0
- package/dist/esm/utilities/composed-contains.js +22 -0
- package/dist/esm/utilities/composed-parent.js +23 -0
- package/dist/esm/utilities/direction.js +10 -0
- package/dist/esm/utilities/index.js +8 -0
- package/dist/esm/utilities/intersection-service.js +91 -0
- package/dist/esm/utilities/match-media-stylesheet-behavior.js +140 -0
- package/dist/esm/utilities/property-stylesheet-behavior.js +52 -0
- package/dist/esm/utilities/resize-observer.js +5 -0
- package/dist/esm/utilities/root-active-element.js +8 -0
- package/dist/esm/utilities/style/disabled.js +5 -0
- package/dist/esm/utilities/style/display.js +14 -0
- package/dist/esm/utilities/style/focus.js +9 -0
- package/dist/esm/utilities/style/index.js +3 -0
- package/dist/esm/utilities/whitespace-filter.js +13 -0
- package/dist/fast-foundation.d.ts +9744 -0
- package/dist/fast-foundation.js +19097 -0
- package/dist/fast-foundation.min.js +19 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +101 -0
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable, Observable } from "@ni/fast-element";
|
|
3
|
+
import { findLastIndex, keyArrowDown, keyArrowUp, keyEnd, keyEnter, keyEscape, keyHome, keySpace, keyTab, uniqueId, } from "@ni/fast-web-utilities";
|
|
4
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
5
|
+
import { isListboxOption } from "../listbox-option/listbox-option.js";
|
|
6
|
+
import { ARIAGlobalStatesAndProperties } from "../patterns/aria-global.js";
|
|
7
|
+
import { applyMixins } from "../utilities/apply-mixins.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Listbox Custom HTML Element.
|
|
10
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#listbox | ARIA listbox }.
|
|
11
|
+
*
|
|
12
|
+
* @slot - The default slot for the listbox options
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export class Listbox extends FoundationElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
/**
|
|
20
|
+
* The internal unfiltered list of selectable options.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
this._options = [];
|
|
25
|
+
/**
|
|
26
|
+
* The index of the selected option.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
this.selectedIndex = -1;
|
|
31
|
+
/**
|
|
32
|
+
* A collection of the selected options.
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
this.selectedOptions = [];
|
|
37
|
+
/**
|
|
38
|
+
* A standard `click` event creates a `focus` event before firing, so a
|
|
39
|
+
* `mousedown` event is used to skip that initial focus.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
this.shouldSkipFocus = false;
|
|
44
|
+
/**
|
|
45
|
+
* The current typeahead buffer string.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
this.typeaheadBuffer = "";
|
|
50
|
+
/**
|
|
51
|
+
* Flag for the typeahead timeout expiration.
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
this.typeaheadExpired = true;
|
|
56
|
+
/**
|
|
57
|
+
* The timeout ID for the typeahead handler.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
this.typeaheadTimeout = -1;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The first selected option.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
get firstSelectedOption() {
|
|
69
|
+
var _a;
|
|
70
|
+
return (_a = this.selectedOptions[0]) !== null && _a !== void 0 ? _a : null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns true if there is one or more selectable option.
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
get hasSelectableOptions() {
|
|
78
|
+
return this.options.length > 0 && !this.options.every(o => o.disabled);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The number of options.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
get length() {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The list of options.
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
get options() {
|
|
95
|
+
Observable.track(this, "options");
|
|
96
|
+
return this._options;
|
|
97
|
+
}
|
|
98
|
+
set options(value) {
|
|
99
|
+
this._options = value;
|
|
100
|
+
Observable.notify(this, "options");
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Flag for the typeahead timeout expiration.
|
|
104
|
+
*
|
|
105
|
+
* @deprecated use `Listbox.typeaheadExpired`
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
get typeAheadExpired() {
|
|
109
|
+
return this.typeaheadExpired;
|
|
110
|
+
}
|
|
111
|
+
set typeAheadExpired(value) {
|
|
112
|
+
this.typeaheadExpired = value;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Handle click events for listbox options.
|
|
116
|
+
*
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
clickHandler(e) {
|
|
120
|
+
const captured = e.target.closest(`option,[role=option]`);
|
|
121
|
+
if (captured && !captured.disabled) {
|
|
122
|
+
this.selectedIndex = this.options.indexOf(captured);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Ensures that the provided option is focused and scrolled into view.
|
|
128
|
+
*
|
|
129
|
+
* @param optionToFocus - The option to focus
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
focusAndScrollOptionIntoView(optionToFocus = this.firstSelectedOption) {
|
|
133
|
+
// To ensure that the browser handles both `focus()` and `scrollIntoView()`, the
|
|
134
|
+
// timing here needs to guarantee that they happen on different frames. Since this
|
|
135
|
+
// function is typically called from the `openChanged` observer, `DOM.queueUpdate`
|
|
136
|
+
// causes the calls to be grouped into the same frame. To prevent this,
|
|
137
|
+
// `requestAnimationFrame` is used instead of `DOM.queueUpdate`.
|
|
138
|
+
if (this.contains(document.activeElement) && optionToFocus !== null) {
|
|
139
|
+
optionToFocus.focus();
|
|
140
|
+
requestAnimationFrame(() => {
|
|
141
|
+
optionToFocus.scrollIntoView({ block: "nearest" });
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Handles `focusin` actions for the component. When the component receives focus,
|
|
147
|
+
* the list of selected options is refreshed and the first selected option is scrolled
|
|
148
|
+
* into view.
|
|
149
|
+
*
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
focusinHandler(e) {
|
|
153
|
+
if (!this.shouldSkipFocus && e.target === e.currentTarget) {
|
|
154
|
+
this.setSelectedOptions();
|
|
155
|
+
this.focusAndScrollOptionIntoView();
|
|
156
|
+
}
|
|
157
|
+
this.shouldSkipFocus = false;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Returns the options which match the current typeahead buffer.
|
|
161
|
+
*
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
getTypeaheadMatches() {
|
|
165
|
+
const pattern = this.typeaheadBuffer.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
|
166
|
+
const re = new RegExp(`^${pattern}`, "gi");
|
|
167
|
+
return this.options.filter((o) => o.text.trim().match(re));
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Determines the index of the next option which is selectable, if any.
|
|
171
|
+
*
|
|
172
|
+
* @param prev - the previous selected index
|
|
173
|
+
* @param next - the next index to select
|
|
174
|
+
*
|
|
175
|
+
* @internal
|
|
176
|
+
*/
|
|
177
|
+
getSelectableIndex(prev = this.selectedIndex, next) {
|
|
178
|
+
const direction = prev > next ? -1 : prev < next ? 1 : 0;
|
|
179
|
+
const potentialDirection = prev + direction;
|
|
180
|
+
let nextSelectableOption = null;
|
|
181
|
+
switch (direction) {
|
|
182
|
+
case -1: {
|
|
183
|
+
nextSelectableOption = this.options.reduceRight((nextSelectableOption, thisOption, index) => !nextSelectableOption &&
|
|
184
|
+
!thisOption.disabled &&
|
|
185
|
+
index < potentialDirection
|
|
186
|
+
? thisOption
|
|
187
|
+
: nextSelectableOption, nextSelectableOption);
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
case 1: {
|
|
191
|
+
nextSelectableOption = this.options.reduce((nextSelectableOption, thisOption, index) => !nextSelectableOption &&
|
|
192
|
+
!thisOption.disabled &&
|
|
193
|
+
index > potentialDirection
|
|
194
|
+
? thisOption
|
|
195
|
+
: nextSelectableOption, nextSelectableOption);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return this.options.indexOf(nextSelectableOption);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Handles external changes to child options.
|
|
203
|
+
*
|
|
204
|
+
* @param source - the source object
|
|
205
|
+
* @param propertyName - the property
|
|
206
|
+
*
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
handleChange(source, propertyName) {
|
|
210
|
+
switch (propertyName) {
|
|
211
|
+
case "selected": {
|
|
212
|
+
if (Listbox.slottedOptionFilter(source)) {
|
|
213
|
+
this.selectedIndex = this.options.indexOf(source);
|
|
214
|
+
}
|
|
215
|
+
this.setSelectedOptions();
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Moves focus to an option whose label matches characters typed by the user.
|
|
222
|
+
* Consecutive keystrokes are batched into a buffer of search text used
|
|
223
|
+
* to match against the set of options. If `TYPE_AHEAD_TIMEOUT_MS` passes
|
|
224
|
+
* between consecutive keystrokes, the search restarts.
|
|
225
|
+
*
|
|
226
|
+
* @param key - the key to be evaluated
|
|
227
|
+
*
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
230
|
+
handleTypeAhead(key) {
|
|
231
|
+
if (this.typeaheadTimeout) {
|
|
232
|
+
window.clearTimeout(this.typeaheadTimeout);
|
|
233
|
+
}
|
|
234
|
+
this.typeaheadTimeout = window.setTimeout(() => (this.typeaheadExpired = true), Listbox.TYPE_AHEAD_TIMEOUT_MS);
|
|
235
|
+
if (key.length > 1) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this.typeaheadBuffer = `${this.typeaheadExpired ? "" : this.typeaheadBuffer}${key}`;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Handles `keydown` actions for listbox navigation and typeahead.
|
|
242
|
+
*
|
|
243
|
+
* @internal
|
|
244
|
+
*/
|
|
245
|
+
keydownHandler(e) {
|
|
246
|
+
if (this.disabled) {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
this.shouldSkipFocus = false;
|
|
250
|
+
const key = e.key;
|
|
251
|
+
switch (key) {
|
|
252
|
+
// Select the first available option
|
|
253
|
+
case keyHome: {
|
|
254
|
+
if (!e.shiftKey) {
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
this.selectFirstOption();
|
|
257
|
+
}
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
// Select the next selectable option
|
|
261
|
+
case keyArrowDown: {
|
|
262
|
+
if (!e.shiftKey) {
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
this.selectNextOption();
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
// Select the previous selectable option
|
|
269
|
+
case keyArrowUp: {
|
|
270
|
+
if (!e.shiftKey) {
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
this.selectPreviousOption();
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
// Select the last available option
|
|
277
|
+
case keyEnd: {
|
|
278
|
+
e.preventDefault();
|
|
279
|
+
this.selectLastOption();
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case keyTab: {
|
|
283
|
+
this.focusAndScrollOptionIntoView();
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
case keyEnter:
|
|
287
|
+
case keyEscape: {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
case keySpace: {
|
|
291
|
+
if (this.typeaheadExpired) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// Send key to Typeahead handler
|
|
296
|
+
default: {
|
|
297
|
+
if (key.length === 1) {
|
|
298
|
+
this.handleTypeAhead(`${key}`);
|
|
299
|
+
}
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Prevents `focusin` events from firing before `click` events when the
|
|
306
|
+
* element is unfocused.
|
|
307
|
+
*
|
|
308
|
+
* @internal
|
|
309
|
+
*/
|
|
310
|
+
mousedownHandler(e) {
|
|
311
|
+
this.shouldSkipFocus = !this.contains(document.activeElement);
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Switches between single-selection and multi-selection mode.
|
|
316
|
+
*
|
|
317
|
+
* @param prev - the previous value of the `multiple` attribute
|
|
318
|
+
* @param next - the next value of the `multiple` attribute
|
|
319
|
+
*
|
|
320
|
+
* @internal
|
|
321
|
+
*/
|
|
322
|
+
multipleChanged(prev, next) {
|
|
323
|
+
this.ariaMultiSelectable = next ? "true" : null;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Updates the list of selected options when the `selectedIndex` changes.
|
|
327
|
+
*
|
|
328
|
+
* @param prev - the previous selected index value
|
|
329
|
+
* @param next - the current selected index value
|
|
330
|
+
*
|
|
331
|
+
* @internal
|
|
332
|
+
*/
|
|
333
|
+
selectedIndexChanged(prev, next) {
|
|
334
|
+
var _a;
|
|
335
|
+
if (!this.hasSelectableOptions) {
|
|
336
|
+
this.selectedIndex = -1;
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (((_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.disabled) && typeof prev === "number") {
|
|
340
|
+
const selectableIndex = this.getSelectableIndex(prev, next);
|
|
341
|
+
const newNext = selectableIndex > -1 ? selectableIndex : prev;
|
|
342
|
+
this.selectedIndex = newNext;
|
|
343
|
+
if (next === newNext) {
|
|
344
|
+
this.selectedIndexChanged(next, newNext);
|
|
345
|
+
}
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
this.setSelectedOptions();
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Updates the selectedness of each option when the list of selected options changes.
|
|
352
|
+
*
|
|
353
|
+
* @param prev - the previous list of selected options
|
|
354
|
+
* @param next - the current list of selected options
|
|
355
|
+
*
|
|
356
|
+
* @internal
|
|
357
|
+
*/
|
|
358
|
+
selectedOptionsChanged(prev, next) {
|
|
359
|
+
var _a;
|
|
360
|
+
const filteredNext = next.filter(Listbox.slottedOptionFilter);
|
|
361
|
+
(_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach(o => {
|
|
362
|
+
const notifier = Observable.getNotifier(o);
|
|
363
|
+
notifier.unsubscribe(this, "selected");
|
|
364
|
+
o.selected = filteredNext.includes(o);
|
|
365
|
+
notifier.subscribe(this, "selected");
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Moves focus to the first selectable option.
|
|
370
|
+
*
|
|
371
|
+
* @public
|
|
372
|
+
*/
|
|
373
|
+
selectFirstOption() {
|
|
374
|
+
var _a, _b;
|
|
375
|
+
if (!this.disabled) {
|
|
376
|
+
this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(o => !o.disabled)) !== null && _b !== void 0 ? _b : -1;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Moves focus to the last selectable option.
|
|
381
|
+
*
|
|
382
|
+
* @internal
|
|
383
|
+
*/
|
|
384
|
+
selectLastOption() {
|
|
385
|
+
if (!this.disabled) {
|
|
386
|
+
this.selectedIndex = findLastIndex(this.options, o => !o.disabled);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Moves focus to the next selectable option.
|
|
391
|
+
*
|
|
392
|
+
* @internal
|
|
393
|
+
*/
|
|
394
|
+
selectNextOption() {
|
|
395
|
+
if (!this.disabled && this.selectedIndex < this.options.length - 1) {
|
|
396
|
+
this.selectedIndex += 1;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Moves focus to the previous selectable option.
|
|
401
|
+
*
|
|
402
|
+
* @internal
|
|
403
|
+
*/
|
|
404
|
+
selectPreviousOption() {
|
|
405
|
+
if (!this.disabled && this.selectedIndex > 0) {
|
|
406
|
+
this.selectedIndex = this.selectedIndex - 1;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Updates the selected index to match the first selected option.
|
|
411
|
+
*
|
|
412
|
+
* @internal
|
|
413
|
+
*/
|
|
414
|
+
setDefaultSelectedOption() {
|
|
415
|
+
var _a, _b;
|
|
416
|
+
this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(el => el.defaultSelected)) !== null && _b !== void 0 ? _b : -1;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Sets an option as selected and gives it focus.
|
|
420
|
+
*
|
|
421
|
+
* @public
|
|
422
|
+
*/
|
|
423
|
+
setSelectedOptions() {
|
|
424
|
+
var _a, _b, _c;
|
|
425
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) {
|
|
426
|
+
this.selectedOptions = [this.options[this.selectedIndex]];
|
|
427
|
+
this.ariaActiveDescendant = (_c = (_b = this.firstSelectedOption) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : "";
|
|
428
|
+
this.focusAndScrollOptionIntoView();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Updates the list of options and resets the selected option when the slotted option content changes.
|
|
433
|
+
*
|
|
434
|
+
* @param prev - the previous list of slotted options
|
|
435
|
+
* @param next - the current list of slotted options
|
|
436
|
+
*
|
|
437
|
+
* @internal
|
|
438
|
+
*/
|
|
439
|
+
slottedOptionsChanged(prev, next) {
|
|
440
|
+
this.options = next.reduce((options, item) => {
|
|
441
|
+
if (isListboxOption(item)) {
|
|
442
|
+
options.push(item);
|
|
443
|
+
}
|
|
444
|
+
return options;
|
|
445
|
+
}, []);
|
|
446
|
+
const setSize = `${this.options.length}`;
|
|
447
|
+
this.options.forEach((option, index) => {
|
|
448
|
+
if (!option.id) {
|
|
449
|
+
option.id = uniqueId("option-");
|
|
450
|
+
}
|
|
451
|
+
option.ariaPosInSet = `${index + 1}`;
|
|
452
|
+
option.ariaSetSize = setSize;
|
|
453
|
+
});
|
|
454
|
+
if (this.$fastController.isConnected) {
|
|
455
|
+
this.setSelectedOptions();
|
|
456
|
+
this.setDefaultSelectedOption();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Updates the filtered list of options when the typeahead buffer changes.
|
|
461
|
+
*
|
|
462
|
+
* @param prev - the previous typeahead buffer value
|
|
463
|
+
* @param next - the current typeahead buffer value
|
|
464
|
+
*
|
|
465
|
+
* @internal
|
|
466
|
+
*/
|
|
467
|
+
typeaheadBufferChanged(prev, next) {
|
|
468
|
+
if (this.$fastController.isConnected) {
|
|
469
|
+
const typeaheadMatches = this.getTypeaheadMatches();
|
|
470
|
+
if (typeaheadMatches.length) {
|
|
471
|
+
const selectedIndex = this.options.indexOf(typeaheadMatches[0]);
|
|
472
|
+
if (selectedIndex > -1) {
|
|
473
|
+
this.selectedIndex = selectedIndex;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
this.typeaheadExpired = false;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* A static filter to include only selectable options.
|
|
482
|
+
*
|
|
483
|
+
* @param n - element to filter
|
|
484
|
+
* @public
|
|
485
|
+
*/
|
|
486
|
+
Listbox.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
|
|
487
|
+
/**
|
|
488
|
+
* Typeahead timeout in milliseconds.
|
|
489
|
+
*
|
|
490
|
+
* @internal
|
|
491
|
+
*/
|
|
492
|
+
Listbox.TYPE_AHEAD_TIMEOUT_MS = 1000;
|
|
493
|
+
__decorate([
|
|
494
|
+
attr({ mode: "boolean" })
|
|
495
|
+
], Listbox.prototype, "disabled", void 0);
|
|
496
|
+
__decorate([
|
|
497
|
+
observable
|
|
498
|
+
], Listbox.prototype, "selectedIndex", void 0);
|
|
499
|
+
__decorate([
|
|
500
|
+
observable
|
|
501
|
+
], Listbox.prototype, "selectedOptions", void 0);
|
|
502
|
+
__decorate([
|
|
503
|
+
observable
|
|
504
|
+
], Listbox.prototype, "slottedOptions", void 0);
|
|
505
|
+
__decorate([
|
|
506
|
+
observable
|
|
507
|
+
], Listbox.prototype, "typeaheadBuffer", void 0);
|
|
508
|
+
/**
|
|
509
|
+
* Includes ARIA states and properties relating to the ARIA listbox role
|
|
510
|
+
*
|
|
511
|
+
* @public
|
|
512
|
+
*/
|
|
513
|
+
export class DelegatesARIAListbox {
|
|
514
|
+
}
|
|
515
|
+
__decorate([
|
|
516
|
+
observable
|
|
517
|
+
], DelegatesARIAListbox.prototype, "ariaActiveDescendant", void 0);
|
|
518
|
+
__decorate([
|
|
519
|
+
observable
|
|
520
|
+
], DelegatesARIAListbox.prototype, "ariaDisabled", void 0);
|
|
521
|
+
__decorate([
|
|
522
|
+
observable
|
|
523
|
+
], DelegatesARIAListbox.prototype, "ariaExpanded", void 0);
|
|
524
|
+
__decorate([
|
|
525
|
+
observable
|
|
526
|
+
], DelegatesARIAListbox.prototype, "ariaMultiSelectable", void 0);
|
|
527
|
+
applyMixins(DelegatesARIAListbox, ARIAGlobalStatesAndProperties);
|
|
528
|
+
applyMixins(Listbox, DelegatesARIAListbox);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { html, slotted } from "@ni/fast-element";
|
|
2
|
+
import { ListboxElement } from "./listbox.element.js";
|
|
3
|
+
/**
|
|
4
|
+
* The template for the {@link @ni/fast-foundation#(Listbox:class)} component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const listboxTemplate = (context, definition) => html `
|
|
8
|
+
<template
|
|
9
|
+
aria-activedescendant="${x => x.ariaActiveDescendant}"
|
|
10
|
+
aria-multiselectable="${x => x.ariaMultiSelectable}"
|
|
11
|
+
class="listbox"
|
|
12
|
+
role="listbox"
|
|
13
|
+
tabindex="${x => (!x.disabled ? "0" : null)}"
|
|
14
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
15
|
+
@focusin="${(x, c) => x.focusinHandler(c.event)}"
|
|
16
|
+
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
17
|
+
@mousedown="${(x, c) => x.mousedownHandler(c.event)}"
|
|
18
|
+
>
|
|
19
|
+
<slot
|
|
20
|
+
${slotted({
|
|
21
|
+
filter: ListboxElement.slottedOptionFilter,
|
|
22
|
+
flatten: true,
|
|
23
|
+
property: "slottedOptions",
|
|
24
|
+
})}
|
|
25
|
+
></slot>
|
|
26
|
+
</template>
|
|
27
|
+
`;
|