@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,587 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, DOM, Observable, observable } from "@ni/fast-element";
|
|
3
|
+
import { limit, uniqueId } from "@ni/fast-web-utilities";
|
|
4
|
+
import { DelegatesARIAListbox } from "../listbox/listbox.js";
|
|
5
|
+
import { StartEnd } from "../patterns/start-end.js";
|
|
6
|
+
import { SelectPosition } from "../select/select.options.js";
|
|
7
|
+
import { applyMixins } from "../utilities/apply-mixins.js";
|
|
8
|
+
import { FormAssociatedCombobox } from "./combobox.form-associated.js";
|
|
9
|
+
import { ComboboxAutocomplete } from "./combobox.options.js";
|
|
10
|
+
/**
|
|
11
|
+
* A Combobox Custom HTML Element.
|
|
12
|
+
* Implements the {@link https://w3c.github.io/aria-practices/#combobox | ARIA combobox }.
|
|
13
|
+
*
|
|
14
|
+
* @slot start - Content which can be provided before the input
|
|
15
|
+
* @slot end - Content which can be provided after the input
|
|
16
|
+
* @slot control - Used to replace the input element representing the combobox
|
|
17
|
+
* @slot indicator - The visual indicator representing the expanded state
|
|
18
|
+
* @slot - The default slot for the options
|
|
19
|
+
* @csspart control - The wrapper element containing the input area, including start and end
|
|
20
|
+
* @csspart selected-value - The input element representing the selected value
|
|
21
|
+
* @csspart indicator - The element wrapping the indicator slot
|
|
22
|
+
* @csspart listbox - The wrapper for the listbox slotted options
|
|
23
|
+
* @fires change - Fires a custom 'change' event when the value updates
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export class Combobox extends FormAssociatedCombobox {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
/**
|
|
31
|
+
* The internal value property.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
this._value = "";
|
|
36
|
+
/**
|
|
37
|
+
* The collection of currently filtered options.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
this.filteredOptions = [];
|
|
42
|
+
/**
|
|
43
|
+
* The current filter value.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
this.filter = "";
|
|
48
|
+
/**
|
|
49
|
+
* The initial state of the position attribute.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
this.forcedPosition = false;
|
|
54
|
+
/**
|
|
55
|
+
* The unique id for the internal listbox element.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
this.listboxId = uniqueId("listbox-");
|
|
60
|
+
/**
|
|
61
|
+
* The max height for the listbox when opened.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
this.maxHeight = 0;
|
|
66
|
+
/**
|
|
67
|
+
* The open attribute.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
* @remarks
|
|
71
|
+
* HTML Attribute: open
|
|
72
|
+
*/
|
|
73
|
+
this.open = false;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Reset the element to its first selectable option when its parent form is reset.
|
|
77
|
+
*
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
formResetCallback() {
|
|
81
|
+
super.formResetCallback();
|
|
82
|
+
this.setDefaultSelectedOption();
|
|
83
|
+
this.updateValue();
|
|
84
|
+
}
|
|
85
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
86
|
+
validate() {
|
|
87
|
+
super.validate(this.control);
|
|
88
|
+
}
|
|
89
|
+
get isAutocompleteInline() {
|
|
90
|
+
return (this.autocomplete === ComboboxAutocomplete.inline || this.isAutocompleteBoth);
|
|
91
|
+
}
|
|
92
|
+
get isAutocompleteList() {
|
|
93
|
+
return this.autocomplete === ComboboxAutocomplete.list || this.isAutocompleteBoth;
|
|
94
|
+
}
|
|
95
|
+
get isAutocompleteBoth() {
|
|
96
|
+
return this.autocomplete === ComboboxAutocomplete.both;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Sets focus and synchronize ARIA attributes when the open property changes.
|
|
100
|
+
*
|
|
101
|
+
* @param prev - the previous open value
|
|
102
|
+
* @param next - the current open value
|
|
103
|
+
*
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
openChanged() {
|
|
107
|
+
if (this.open) {
|
|
108
|
+
this.ariaControls = this.listboxId;
|
|
109
|
+
this.ariaExpanded = "true";
|
|
110
|
+
this.setPositioning();
|
|
111
|
+
this.focusAndScrollOptionIntoView();
|
|
112
|
+
// focus is directed to the element when `open` is changed programmatically
|
|
113
|
+
DOM.queueUpdate(() => this.focus());
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this.ariaControls = "";
|
|
117
|
+
this.ariaExpanded = "false";
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The list of options.
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
* @remarks
|
|
124
|
+
* Overrides `Listbox.options`.
|
|
125
|
+
*/
|
|
126
|
+
get options() {
|
|
127
|
+
Observable.track(this, "options");
|
|
128
|
+
return this.filteredOptions.length ? this.filteredOptions : this._options;
|
|
129
|
+
}
|
|
130
|
+
set options(value) {
|
|
131
|
+
this._options = value;
|
|
132
|
+
Observable.notify(this, "options");
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Updates the placeholder on the proxy element.
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
placeholderChanged() {
|
|
139
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
140
|
+
this.proxy.placeholder = this.placeholder;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
positionChanged(prev, next) {
|
|
144
|
+
this.positionAttribute = next;
|
|
145
|
+
this.setPositioning();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The value property.
|
|
149
|
+
*
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
get value() {
|
|
153
|
+
Observable.track(this, "value");
|
|
154
|
+
return this._value;
|
|
155
|
+
}
|
|
156
|
+
set value(next) {
|
|
157
|
+
var _a, _b, _c;
|
|
158
|
+
const prev = `${this._value}`;
|
|
159
|
+
if (this.$fastController.isConnected && this.options) {
|
|
160
|
+
const selectedIndex = this.options.findIndex(el => el.text.toLowerCase() === next.toLowerCase());
|
|
161
|
+
const prevSelectedValue = (_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
|
|
162
|
+
const nextSelectedValue = (_b = this.options[selectedIndex]) === null || _b === void 0 ? void 0 : _b.text;
|
|
163
|
+
this.selectedIndex =
|
|
164
|
+
prevSelectedValue !== nextSelectedValue
|
|
165
|
+
? selectedIndex
|
|
166
|
+
: this.selectedIndex;
|
|
167
|
+
next = ((_c = this.firstSelectedOption) === null || _c === void 0 ? void 0 : _c.text) || next;
|
|
168
|
+
}
|
|
169
|
+
if (prev !== next) {
|
|
170
|
+
this._value = next;
|
|
171
|
+
super.valueChanged(prev, next);
|
|
172
|
+
Observable.notify(this, "value");
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Handle opening and closing the listbox when the combobox is clicked.
|
|
177
|
+
*
|
|
178
|
+
* @param e - the mouse event
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
181
|
+
clickHandler(e) {
|
|
182
|
+
const captured = e.target.closest(`option,[role=option]`);
|
|
183
|
+
if (this.disabled || (captured === null || captured === void 0 ? void 0 : captured.disabled)) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (this.open) {
|
|
187
|
+
if (e.composedPath()[0] === this.control) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (captured) {
|
|
191
|
+
this.selectedOptions = [captured];
|
|
192
|
+
this.control.value = captured.text;
|
|
193
|
+
this.clearSelectionRange();
|
|
194
|
+
this.updateValue(true);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
this.open = !this.open;
|
|
198
|
+
if (this.open) {
|
|
199
|
+
this.control.focus();
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
connectedCallback() {
|
|
204
|
+
super.connectedCallback();
|
|
205
|
+
this.forcedPosition = !!this.positionAttribute;
|
|
206
|
+
if (this.value) {
|
|
207
|
+
this.initialValue = this.value;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
212
|
+
*
|
|
213
|
+
* @param prev - The previous disabled value
|
|
214
|
+
* @param next - The next disabled value
|
|
215
|
+
*
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
218
|
+
disabledChanged(prev, next) {
|
|
219
|
+
if (super.disabledChanged) {
|
|
220
|
+
super.disabledChanged(prev, next);
|
|
221
|
+
}
|
|
222
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Filter available options by text value.
|
|
226
|
+
*
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
229
|
+
filterOptions() {
|
|
230
|
+
if (!this.autocomplete || this.autocomplete === ComboboxAutocomplete.none) {
|
|
231
|
+
this.filter = "";
|
|
232
|
+
}
|
|
233
|
+
const filter = this.filter.toLowerCase();
|
|
234
|
+
this.filteredOptions = this._options.filter(o => o.text.toLowerCase().startsWith(this.filter.toLowerCase()));
|
|
235
|
+
if (this.isAutocompleteList) {
|
|
236
|
+
if (!this.filteredOptions.length && !filter) {
|
|
237
|
+
this.filteredOptions = this._options;
|
|
238
|
+
}
|
|
239
|
+
this._options.forEach(o => {
|
|
240
|
+
o.hidden = !this.filteredOptions.includes(o);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Focus the control and scroll the first selected option into view.
|
|
246
|
+
*
|
|
247
|
+
* @internal
|
|
248
|
+
* @remarks
|
|
249
|
+
* Overrides: `Listbox.focusAndScrollOptionIntoView`
|
|
250
|
+
*/
|
|
251
|
+
focusAndScrollOptionIntoView() {
|
|
252
|
+
if (this.contains(document.activeElement)) {
|
|
253
|
+
this.control.focus();
|
|
254
|
+
if (this.firstSelectedOption) {
|
|
255
|
+
requestAnimationFrame(() => {
|
|
256
|
+
var _a;
|
|
257
|
+
(_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Handle focus state when the element or its children lose focus.
|
|
264
|
+
*
|
|
265
|
+
* @param e - The focus event
|
|
266
|
+
* @internal
|
|
267
|
+
*/
|
|
268
|
+
focusoutHandler(e) {
|
|
269
|
+
this.syncValue();
|
|
270
|
+
if (!this.open) {
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
const focusTarget = e.relatedTarget;
|
|
274
|
+
if (this.isSameNode(focusTarget)) {
|
|
275
|
+
this.focus();
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (!this.options || !this.options.includes(focusTarget)) {
|
|
279
|
+
this.open = false;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Handle content changes on the control input.
|
|
284
|
+
*
|
|
285
|
+
* @param e - the input event
|
|
286
|
+
* @internal
|
|
287
|
+
*/
|
|
288
|
+
inputHandler(e) {
|
|
289
|
+
this.filter = this.control.value;
|
|
290
|
+
this.filterOptions();
|
|
291
|
+
if (!this.isAutocompleteInline) {
|
|
292
|
+
this.selectedIndex = this.options
|
|
293
|
+
.map(option => option.text)
|
|
294
|
+
.indexOf(this.control.value);
|
|
295
|
+
}
|
|
296
|
+
if (e.inputType.includes("deleteContent") || !this.filter.length) {
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
if (this.isAutocompleteList && !this.open) {
|
|
300
|
+
this.open = true;
|
|
301
|
+
}
|
|
302
|
+
if (this.isAutocompleteInline) {
|
|
303
|
+
if (this.filteredOptions.length) {
|
|
304
|
+
this.selectedOptions = [this.filteredOptions[0]];
|
|
305
|
+
this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
|
|
306
|
+
this.setInlineSelection();
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
this.selectedIndex = -1;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Handle keydown actions for listbox navigation.
|
|
316
|
+
*
|
|
317
|
+
* @param e - the keyboard event
|
|
318
|
+
* @internal
|
|
319
|
+
*/
|
|
320
|
+
keydownHandler(e) {
|
|
321
|
+
const key = e.key;
|
|
322
|
+
if (e.ctrlKey || e.shiftKey) {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
switch (key) {
|
|
326
|
+
case "Enter": {
|
|
327
|
+
this.syncValue();
|
|
328
|
+
if (this.isAutocompleteInline) {
|
|
329
|
+
this.filter = this.value;
|
|
330
|
+
}
|
|
331
|
+
this.open = false;
|
|
332
|
+
this.clearSelectionRange();
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
case "Escape": {
|
|
336
|
+
if (!this.isAutocompleteInline) {
|
|
337
|
+
this.selectedIndex = -1;
|
|
338
|
+
}
|
|
339
|
+
if (this.open) {
|
|
340
|
+
this.open = false;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
this.value = "";
|
|
344
|
+
this.control.value = "";
|
|
345
|
+
this.filter = "";
|
|
346
|
+
this.filterOptions();
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
case "Tab": {
|
|
350
|
+
this.setInputToSelection();
|
|
351
|
+
if (!this.open) {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
e.preventDefault();
|
|
355
|
+
this.open = false;
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
case "ArrowUp":
|
|
359
|
+
case "ArrowDown": {
|
|
360
|
+
this.filterOptions();
|
|
361
|
+
if (!this.open) {
|
|
362
|
+
this.open = true;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
if (this.filteredOptions.length > 0) {
|
|
366
|
+
super.keydownHandler(e);
|
|
367
|
+
}
|
|
368
|
+
if (this.isAutocompleteInline) {
|
|
369
|
+
this.setInlineSelection();
|
|
370
|
+
}
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
default: {
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Handle keyup actions for value input and text field manipulations.
|
|
380
|
+
*
|
|
381
|
+
* @param e - the keyboard event
|
|
382
|
+
* @internal
|
|
383
|
+
*/
|
|
384
|
+
keyupHandler(e) {
|
|
385
|
+
const key = e.key;
|
|
386
|
+
switch (key) {
|
|
387
|
+
case "ArrowLeft":
|
|
388
|
+
case "ArrowRight":
|
|
389
|
+
case "Backspace":
|
|
390
|
+
case "Delete":
|
|
391
|
+
case "Home":
|
|
392
|
+
case "End": {
|
|
393
|
+
this.filter = this.control.value;
|
|
394
|
+
this.selectedIndex = -1;
|
|
395
|
+
this.filterOptions();
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Ensure that the selectedIndex is within the current allowable filtered range.
|
|
402
|
+
*
|
|
403
|
+
* @param prev - the previous selected index value
|
|
404
|
+
* @param next - the current selected index value
|
|
405
|
+
*
|
|
406
|
+
* @internal
|
|
407
|
+
*/
|
|
408
|
+
selectedIndexChanged(prev, next) {
|
|
409
|
+
if (this.$fastController.isConnected) {
|
|
410
|
+
next = limit(-1, this.options.length - 1, next);
|
|
411
|
+
// we only want to call the super method when the selectedIndex is in range
|
|
412
|
+
if (next !== this.selectedIndex) {
|
|
413
|
+
this.selectedIndex = next;
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
super.selectedIndexChanged(prev, next);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Move focus to the previous selectable option.
|
|
421
|
+
*
|
|
422
|
+
* @internal
|
|
423
|
+
* @remarks
|
|
424
|
+
* Overrides `Listbox.selectPreviousOption`
|
|
425
|
+
*/
|
|
426
|
+
selectPreviousOption() {
|
|
427
|
+
if (!this.disabled && this.selectedIndex >= 0) {
|
|
428
|
+
this.selectedIndex = this.selectedIndex - 1;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Set the default selected options at initialization or reset.
|
|
433
|
+
*
|
|
434
|
+
* @internal
|
|
435
|
+
* @remarks
|
|
436
|
+
* Overrides `Listbox.setDefaultSelectedOption`
|
|
437
|
+
*/
|
|
438
|
+
setDefaultSelectedOption() {
|
|
439
|
+
if (this.$fastController.isConnected && this.options) {
|
|
440
|
+
const selectedIndex = this.options.findIndex(el => el.getAttribute("selected") !== null || el.selected);
|
|
441
|
+
this.selectedIndex = selectedIndex;
|
|
442
|
+
if (!this.dirtyValue && this.firstSelectedOption) {
|
|
443
|
+
this.value = this.firstSelectedOption.text;
|
|
444
|
+
}
|
|
445
|
+
this.setSelectedOptions();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Focus and set the content of the control based on the first selected option.
|
|
450
|
+
*
|
|
451
|
+
* @internal
|
|
452
|
+
*/
|
|
453
|
+
setInputToSelection() {
|
|
454
|
+
if (this.firstSelectedOption) {
|
|
455
|
+
this.control.value = this.firstSelectedOption.text;
|
|
456
|
+
this.control.focus();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Focus, set and select the content of the control based on the first selected option.
|
|
461
|
+
*
|
|
462
|
+
* @internal
|
|
463
|
+
*/
|
|
464
|
+
setInlineSelection() {
|
|
465
|
+
if (this.firstSelectedOption) {
|
|
466
|
+
this.setInputToSelection();
|
|
467
|
+
this.control.setSelectionRange(this.filter.length, this.control.value.length, "backward");
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Determines if a value update should involve emitting a change event, then updates the value.
|
|
472
|
+
*
|
|
473
|
+
* @internal
|
|
474
|
+
*/
|
|
475
|
+
syncValue() {
|
|
476
|
+
var _a;
|
|
477
|
+
const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
|
|
478
|
+
this.updateValue(this.value !== newValue);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Calculate and apply listbox positioning based on available viewport space.
|
|
482
|
+
*
|
|
483
|
+
* @param force - direction to force the listbox to display
|
|
484
|
+
* @public
|
|
485
|
+
*/
|
|
486
|
+
setPositioning() {
|
|
487
|
+
const currentBox = this.getBoundingClientRect();
|
|
488
|
+
const viewportHeight = window.innerHeight;
|
|
489
|
+
const availableBottom = viewportHeight - currentBox.bottom;
|
|
490
|
+
this.position = this.forcedPosition
|
|
491
|
+
? this.positionAttribute
|
|
492
|
+
: currentBox.top > availableBottom
|
|
493
|
+
? SelectPosition.above
|
|
494
|
+
: SelectPosition.below;
|
|
495
|
+
this.positionAttribute = this.forcedPosition
|
|
496
|
+
? this.positionAttribute
|
|
497
|
+
: this.position;
|
|
498
|
+
this.maxHeight =
|
|
499
|
+
this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Ensure that the entire list of options is used when setting the selected property.
|
|
503
|
+
*
|
|
504
|
+
* @param prev - the previous list of selected options
|
|
505
|
+
* @param next - the current list of selected options
|
|
506
|
+
*
|
|
507
|
+
* @internal
|
|
508
|
+
* @remarks
|
|
509
|
+
* Overrides: `Listbox.selectedOptionsChanged`
|
|
510
|
+
*/
|
|
511
|
+
selectedOptionsChanged(prev, next) {
|
|
512
|
+
if (this.$fastController.isConnected) {
|
|
513
|
+
this._options.forEach(o => {
|
|
514
|
+
o.selected = next.includes(o);
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Synchronize the form-associated proxy and update the value property of the element.
|
|
520
|
+
*
|
|
521
|
+
* @param prev - the previous collection of slotted option elements
|
|
522
|
+
* @param next - the next collection of slotted option elements
|
|
523
|
+
*
|
|
524
|
+
* @internal
|
|
525
|
+
*/
|
|
526
|
+
slottedOptionsChanged(prev, next) {
|
|
527
|
+
super.slottedOptionsChanged(prev, next);
|
|
528
|
+
this.updateValue();
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Sets the value and to match the first selected option.
|
|
532
|
+
*
|
|
533
|
+
* @param shouldEmit - if true, the change event will be emitted
|
|
534
|
+
*
|
|
535
|
+
* @internal
|
|
536
|
+
*/
|
|
537
|
+
updateValue(shouldEmit) {
|
|
538
|
+
var _a;
|
|
539
|
+
if (this.$fastController.isConnected) {
|
|
540
|
+
this.value = ((_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) || this.control.value;
|
|
541
|
+
this.control.value = this.value;
|
|
542
|
+
}
|
|
543
|
+
if (shouldEmit) {
|
|
544
|
+
this.$emit("change");
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* @internal
|
|
549
|
+
*/
|
|
550
|
+
clearSelectionRange() {
|
|
551
|
+
const controlValueLength = this.control.value.length;
|
|
552
|
+
this.control.setSelectionRange(controlValueLength, controlValueLength);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
__decorate([
|
|
556
|
+
attr({ attribute: "autocomplete", mode: "fromView" })
|
|
557
|
+
], Combobox.prototype, "autocomplete", void 0);
|
|
558
|
+
__decorate([
|
|
559
|
+
observable
|
|
560
|
+
], Combobox.prototype, "maxHeight", void 0);
|
|
561
|
+
__decorate([
|
|
562
|
+
attr({ attribute: "open", mode: "boolean" })
|
|
563
|
+
], Combobox.prototype, "open", void 0);
|
|
564
|
+
__decorate([
|
|
565
|
+
attr
|
|
566
|
+
], Combobox.prototype, "placeholder", void 0);
|
|
567
|
+
__decorate([
|
|
568
|
+
attr({ attribute: "position" })
|
|
569
|
+
], Combobox.prototype, "positionAttribute", void 0);
|
|
570
|
+
__decorate([
|
|
571
|
+
observable
|
|
572
|
+
], Combobox.prototype, "position", void 0);
|
|
573
|
+
/**
|
|
574
|
+
* Includes ARIA states and properties relating to the ARIA combobox role.
|
|
575
|
+
*
|
|
576
|
+
* @public
|
|
577
|
+
*/
|
|
578
|
+
export class DelegatesARIACombobox {
|
|
579
|
+
}
|
|
580
|
+
__decorate([
|
|
581
|
+
observable
|
|
582
|
+
], DelegatesARIACombobox.prototype, "ariaAutoComplete", void 0);
|
|
583
|
+
__decorate([
|
|
584
|
+
observable
|
|
585
|
+
], DelegatesARIACombobox.prototype, "ariaControls", void 0);
|
|
586
|
+
applyMixins(DelegatesARIACombobox, DelegatesARIAListbox);
|
|
587
|
+
applyMixins(Combobox, StartEnd, DelegatesARIACombobox);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { html, ref, slotted } from "@ni/fast-element";
|
|
2
|
+
import { Listbox } from "../listbox/listbox.js";
|
|
3
|
+
import { endSlotTemplate, startSlotTemplate } from "../patterns/start-end.js";
|
|
4
|
+
/**
|
|
5
|
+
* The template for the {@link @ni/fast-foundation#(Combobox:class)} component.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export const comboboxTemplate = (context, definition) => html `
|
|
9
|
+
<template
|
|
10
|
+
aria-disabled="${x => x.ariaDisabled}"
|
|
11
|
+
autocomplete="${x => x.autocomplete}"
|
|
12
|
+
class="${x => (x.open ? "open" : "")} ${x => x.disabled ? "disabled" : ""} ${x => x.position}"
|
|
13
|
+
?open="${x => x.open}"
|
|
14
|
+
tabindex="${x => (!x.disabled ? "0" : null)}"
|
|
15
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
16
|
+
@focusout="${(x, c) => x.focusoutHandler(c.event)}"
|
|
17
|
+
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
18
|
+
>
|
|
19
|
+
<div class="control" part="control">
|
|
20
|
+
${startSlotTemplate(context, definition)}
|
|
21
|
+
<slot name="control">
|
|
22
|
+
<input
|
|
23
|
+
aria-activedescendant="${x => x.open ? x.ariaActiveDescendant : null}"
|
|
24
|
+
aria-autocomplete="${x => x.ariaAutoComplete}"
|
|
25
|
+
aria-controls="${x => x.ariaControls}"
|
|
26
|
+
aria-disabled="${x => x.ariaDisabled}"
|
|
27
|
+
aria-expanded="${x => x.ariaExpanded}"
|
|
28
|
+
aria-haspopup="listbox"
|
|
29
|
+
class="selected-value"
|
|
30
|
+
part="selected-value"
|
|
31
|
+
placeholder="${x => x.placeholder}"
|
|
32
|
+
role="combobox"
|
|
33
|
+
type="text"
|
|
34
|
+
?disabled="${x => x.disabled}"
|
|
35
|
+
:value="${x => x.value}"
|
|
36
|
+
@input="${(x, c) => x.inputHandler(c.event)}"
|
|
37
|
+
@keyup="${(x, c) => x.keyupHandler(c.event)}"
|
|
38
|
+
${ref("control")}
|
|
39
|
+
/>
|
|
40
|
+
<div class="indicator" part="indicator" aria-hidden="true">
|
|
41
|
+
<slot name="indicator">
|
|
42
|
+
${definition.indicator || ""}
|
|
43
|
+
</slot>
|
|
44
|
+
</div>
|
|
45
|
+
</slot>
|
|
46
|
+
${endSlotTemplate(context, definition)}
|
|
47
|
+
</div>
|
|
48
|
+
<div
|
|
49
|
+
class="listbox"
|
|
50
|
+
id="${x => x.listboxId}"
|
|
51
|
+
part="listbox"
|
|
52
|
+
role="listbox"
|
|
53
|
+
?disabled="${x => x.disabled}"
|
|
54
|
+
?hidden="${x => !x.open}"
|
|
55
|
+
${ref("listbox")}
|
|
56
|
+
>
|
|
57
|
+
<slot
|
|
58
|
+
${slotted({
|
|
59
|
+
filter: Listbox.slottedOptionFilter,
|
|
60
|
+
flatten: true,
|
|
61
|
+
property: "slottedOptions",
|
|
62
|
+
})}
|
|
63
|
+
></slot>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
`;
|