@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,759 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, DOM, html, observable, ref, RepeatDirective, } from "@ni/fast-element";
|
|
3
|
+
import { keyArrowDown, keyArrowLeft, keyArrowRight, keyArrowUp, keyBackspace, keyDelete, keyEnter, keyEscape, uniqueId, } from "@ni/fast-web-utilities";
|
|
4
|
+
import { FlyoutPosBottom, FlyoutPosBottomFill, FlyoutPosTallest, FlyoutPosTallestFill, FlyoutPosTop, FlyoutPosTopFill, } from "../anchored-region/index.js";
|
|
5
|
+
import { PickerMenuOption } from "./picker-menu-option.js";
|
|
6
|
+
import { PickerListItem } from "./picker-list-item.js";
|
|
7
|
+
import { FormAssociatedPicker } from "./picker.form-associated.js";
|
|
8
|
+
const pickerInputTemplate = html `
|
|
9
|
+
<input
|
|
10
|
+
slot="input-region"
|
|
11
|
+
role="combobox"
|
|
12
|
+
type="text"
|
|
13
|
+
autocapitalize="off"
|
|
14
|
+
autocomplete="off"
|
|
15
|
+
haspopup="list"
|
|
16
|
+
aria-label="${x => x.label}"
|
|
17
|
+
aria-labelledby="${x => x.labelledBy}"
|
|
18
|
+
placeholder="${x => x.placeholder}"
|
|
19
|
+
${ref("inputElement")}
|
|
20
|
+
></input>
|
|
21
|
+
`;
|
|
22
|
+
/**
|
|
23
|
+
* A Picker Custom HTML Element. This is an early "alpha" version of the component.
|
|
24
|
+
* Developers should expect the api to evolve, breaking changes are possible.
|
|
25
|
+
*
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export class Picker extends FormAssociatedPicker {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
/**
|
|
32
|
+
* Currently selected items. Comma delineated string ie. "apples,oranges".
|
|
33
|
+
*
|
|
34
|
+
* @alpha
|
|
35
|
+
* @remarks
|
|
36
|
+
* HTML Attribute: selection
|
|
37
|
+
*/
|
|
38
|
+
this.selection = "";
|
|
39
|
+
/**
|
|
40
|
+
* Whether the component should remove an option from the list when it is in the selection
|
|
41
|
+
*
|
|
42
|
+
* @alpha
|
|
43
|
+
* @remarks
|
|
44
|
+
* HTML Attribute: filter-selected
|
|
45
|
+
*/
|
|
46
|
+
this.filterSelected = true;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the component should remove options based on the current query
|
|
49
|
+
*
|
|
50
|
+
* @alpha
|
|
51
|
+
* @remarks
|
|
52
|
+
* HTML Attribute: filter-query
|
|
53
|
+
*/
|
|
54
|
+
this.filterQuery = true;
|
|
55
|
+
/**
|
|
56
|
+
* The text to present to assistive technolgies when no suggestions are available.
|
|
57
|
+
*
|
|
58
|
+
* @alpha
|
|
59
|
+
* @remarks
|
|
60
|
+
* HTML Attribute: no-suggestions-text
|
|
61
|
+
*/
|
|
62
|
+
this.noSuggestionsText = "No suggestions available";
|
|
63
|
+
/**
|
|
64
|
+
* The text to present to assistive technolgies when suggestions are available.
|
|
65
|
+
*
|
|
66
|
+
* @alpha
|
|
67
|
+
* @remarks
|
|
68
|
+
* HTML Attribute: suggestions-available-text
|
|
69
|
+
*/
|
|
70
|
+
this.suggestionsAvailableText = "Suggestions available";
|
|
71
|
+
/**
|
|
72
|
+
* The text to present to assistive technologies when suggestions are loading.
|
|
73
|
+
*
|
|
74
|
+
* @alpha
|
|
75
|
+
* @remarks
|
|
76
|
+
* HTML Attribute: loading-text
|
|
77
|
+
*/
|
|
78
|
+
this.loadingText = "Loading suggestions";
|
|
79
|
+
/**
|
|
80
|
+
* Controls menu placement
|
|
81
|
+
*
|
|
82
|
+
* @alpha
|
|
83
|
+
* @remarks
|
|
84
|
+
* HTML Attribute: menu-placement
|
|
85
|
+
*/
|
|
86
|
+
this.menuPlacement = "bottom-fill";
|
|
87
|
+
/**
|
|
88
|
+
* Whether to display a loading state if the menu is opened.
|
|
89
|
+
*
|
|
90
|
+
* @alpha
|
|
91
|
+
*/
|
|
92
|
+
this.showLoading = false;
|
|
93
|
+
/**
|
|
94
|
+
* Current list of options in array form
|
|
95
|
+
*
|
|
96
|
+
* @alpha
|
|
97
|
+
*/
|
|
98
|
+
this.optionsList = [];
|
|
99
|
+
/**
|
|
100
|
+
* Current list of filtered options in array form
|
|
101
|
+
*
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
this.filteredOptionsList = [];
|
|
105
|
+
/**
|
|
106
|
+
* Indicates if the flyout menu is open or not
|
|
107
|
+
*
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
this.flyoutOpen = false;
|
|
111
|
+
/**
|
|
112
|
+
* Index of currently active menu option
|
|
113
|
+
*
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
this.menuFocusIndex = -1;
|
|
117
|
+
/**
|
|
118
|
+
* Internal flag to indicate no options available display should be shown.
|
|
119
|
+
*
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
this.showNoOptions = false;
|
|
123
|
+
/**
|
|
124
|
+
*
|
|
125
|
+
*
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
this.selectedItems = [];
|
|
129
|
+
this.inputElementView = null;
|
|
130
|
+
/**
|
|
131
|
+
* Handle input event from input element
|
|
132
|
+
*/
|
|
133
|
+
this.handleTextInput = (e) => {
|
|
134
|
+
this.query = this.inputElement.value;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Handle click event from input element
|
|
138
|
+
*/
|
|
139
|
+
this.handleInputClick = (e) => {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
this.toggleFlyout(true);
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Sets properties on the anchored region once it is instanciated.
|
|
145
|
+
*/
|
|
146
|
+
this.setRegionProps = () => {
|
|
147
|
+
if (!this.flyoutOpen) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (this.region === null || this.region === undefined) {
|
|
151
|
+
// TODO: limit this
|
|
152
|
+
DOM.queueUpdate(this.setRegionProps);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.region.anchorElement = this.inputElement;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* matches menu placement values with the associated menu config
|
|
159
|
+
*/
|
|
160
|
+
this.configLookup = {
|
|
161
|
+
top: FlyoutPosTop,
|
|
162
|
+
bottom: FlyoutPosBottom,
|
|
163
|
+
tallest: FlyoutPosTallest,
|
|
164
|
+
"top-fill": FlyoutPosTopFill,
|
|
165
|
+
"bottom-fill": FlyoutPosBottomFill,
|
|
166
|
+
"tallest-fill": FlyoutPosTallestFill,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
selectionChanged() {
|
|
170
|
+
if (this.$fastController.isConnected) {
|
|
171
|
+
this.handleSelectionChange();
|
|
172
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
173
|
+
this.proxy.value = this.selection;
|
|
174
|
+
this.validate();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
optionsChanged() {
|
|
179
|
+
this.optionsList = this.options
|
|
180
|
+
.split(",")
|
|
181
|
+
.map(opt => opt.trim())
|
|
182
|
+
.filter(opt => opt !== "");
|
|
183
|
+
}
|
|
184
|
+
menuPlacementChanged() {
|
|
185
|
+
if (this.$fastController.isConnected) {
|
|
186
|
+
this.updateMenuConfig();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
showLoadingChanged() {
|
|
190
|
+
if (this.$fastController.isConnected) {
|
|
191
|
+
DOM.queueUpdate(() => {
|
|
192
|
+
this.setFocusedOption(0);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
listItemTemplateChanged() {
|
|
197
|
+
this.updateListItemTemplate();
|
|
198
|
+
}
|
|
199
|
+
defaultListItemTemplateChanged() {
|
|
200
|
+
this.updateListItemTemplate();
|
|
201
|
+
}
|
|
202
|
+
menuOptionTemplateChanged() {
|
|
203
|
+
this.updateOptionTemplate();
|
|
204
|
+
}
|
|
205
|
+
defaultMenuOptionTemplateChanged() {
|
|
206
|
+
this.updateOptionTemplate();
|
|
207
|
+
}
|
|
208
|
+
optionsListChanged() {
|
|
209
|
+
this.updateFilteredOptions();
|
|
210
|
+
}
|
|
211
|
+
queryChanged() {
|
|
212
|
+
if (this.$fastController.isConnected) {
|
|
213
|
+
if (this.inputElement.value !== this.query) {
|
|
214
|
+
this.inputElement.value = this.query;
|
|
215
|
+
}
|
|
216
|
+
this.updateFilteredOptions();
|
|
217
|
+
this.$emit("querychange", { bubbles: false });
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
filteredOptionsListChanged() {
|
|
221
|
+
if (this.$fastController.isConnected) {
|
|
222
|
+
this.showNoOptions =
|
|
223
|
+
this.filteredOptionsList.length === 0 &&
|
|
224
|
+
this.menuElement.querySelectorAll('[role="listitem"]').length === 0;
|
|
225
|
+
this.setFocusedOption(this.showNoOptions ? -1 : 0);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
flyoutOpenChanged() {
|
|
229
|
+
if (this.flyoutOpen) {
|
|
230
|
+
DOM.queueUpdate(this.setRegionProps);
|
|
231
|
+
this.$emit("menuopening", { bubbles: false });
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
this.$emit("menuclosing", { bubbles: false });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
showNoOptionsChanged() {
|
|
238
|
+
if (this.$fastController.isConnected) {
|
|
239
|
+
DOM.queueUpdate(() => {
|
|
240
|
+
this.setFocusedOption(0);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
connectedCallback() {
|
|
248
|
+
super.connectedCallback();
|
|
249
|
+
this.listElement = document.createElement(this.selectedListTag);
|
|
250
|
+
this.appendChild(this.listElement);
|
|
251
|
+
this.itemsPlaceholderElement = document.createComment("");
|
|
252
|
+
this.listElement.append(this.itemsPlaceholderElement);
|
|
253
|
+
this.inputElementView = pickerInputTemplate.render(this, this.listElement);
|
|
254
|
+
const match = this.menuTag.toUpperCase();
|
|
255
|
+
this.menuElement = Array.from(this.children).find((element) => {
|
|
256
|
+
return element.tagName === match;
|
|
257
|
+
});
|
|
258
|
+
if (this.menuElement === undefined) {
|
|
259
|
+
this.menuElement = document.createElement(this.menuTag);
|
|
260
|
+
this.appendChild(this.menuElement);
|
|
261
|
+
}
|
|
262
|
+
if (this.menuElement.id === "") {
|
|
263
|
+
this.menuElement.id = uniqueId("listbox-");
|
|
264
|
+
}
|
|
265
|
+
this.menuId = this.menuElement.id;
|
|
266
|
+
this.optionsPlaceholder = document.createComment("");
|
|
267
|
+
this.menuElement.append(this.optionsPlaceholder);
|
|
268
|
+
this.updateMenuConfig();
|
|
269
|
+
DOM.queueUpdate(() => this.initialize());
|
|
270
|
+
}
|
|
271
|
+
disconnectedCallback() {
|
|
272
|
+
super.disconnectedCallback();
|
|
273
|
+
this.toggleFlyout(false);
|
|
274
|
+
this.inputElement.removeEventListener("input", this.handleTextInput);
|
|
275
|
+
this.inputElement.removeEventListener("click", this.handleInputClick);
|
|
276
|
+
if (this.inputElementView !== null) {
|
|
277
|
+
this.inputElementView.dispose();
|
|
278
|
+
this.inputElementView = null;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Move focus to the input element
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
focus() {
|
|
286
|
+
this.inputElement.focus();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Initialize the component. This is delayed a frame to ensure children are connected as well.
|
|
290
|
+
*/
|
|
291
|
+
initialize() {
|
|
292
|
+
this.updateListItemTemplate();
|
|
293
|
+
this.updateOptionTemplate();
|
|
294
|
+
this.itemsRepeatBehavior = new RepeatDirective(x => x.selectedItems, x => x.activeListItemTemplate, { positioning: true }).createBehavior(this.itemsPlaceholderElement);
|
|
295
|
+
this.inputElement.addEventListener("input", this.handleTextInput);
|
|
296
|
+
this.inputElement.addEventListener("click", this.handleInputClick);
|
|
297
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
298
|
+
this.$fastController.addBehaviors([this.itemsRepeatBehavior]);
|
|
299
|
+
this.menuElement.suggestionsAvailableText = this.suggestionsAvailableText;
|
|
300
|
+
this.menuElement.addEventListener("optionsupdated", this.handleMenuOptionsUpdated);
|
|
301
|
+
this.optionsRepeatBehavior = new RepeatDirective(x => x.filteredOptionsList, x => x.activeMenuOptionTemplate, { positioning: true }).createBehavior(this.optionsPlaceholder);
|
|
302
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
303
|
+
this.$fastController.addBehaviors([this.optionsRepeatBehavior]);
|
|
304
|
+
this.handleSelectionChange();
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Toggles the menu flyout
|
|
308
|
+
*/
|
|
309
|
+
toggleFlyout(open) {
|
|
310
|
+
if (this.flyoutOpen === open) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (open && document.activeElement === this.inputElement) {
|
|
314
|
+
this.flyoutOpen = open;
|
|
315
|
+
DOM.queueUpdate(() => {
|
|
316
|
+
if (this.menuElement !== undefined) {
|
|
317
|
+
this.setFocusedOption(0);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
this.disableMenu();
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
this.flyoutOpen = false;
|
|
326
|
+
this.disableMenu();
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Handle the menu options updated event from the child menu
|
|
331
|
+
*/
|
|
332
|
+
handleMenuOptionsUpdated(e) {
|
|
333
|
+
e.preventDefault();
|
|
334
|
+
if (this.flyoutOpen) {
|
|
335
|
+
this.setFocusedOption(0);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Handle key down events.
|
|
340
|
+
*/
|
|
341
|
+
handleKeyDown(e) {
|
|
342
|
+
if (e.defaultPrevented) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
switch (e.key) {
|
|
346
|
+
// TODO: what should "home" and "end" keys do, exactly?
|
|
347
|
+
//
|
|
348
|
+
// case keyHome: {
|
|
349
|
+
// if (!this.flyoutOpen) {
|
|
350
|
+
// this.toggleFlyout(true);
|
|
351
|
+
// } else {
|
|
352
|
+
// if (this.menuElement.optionElements.length > 0) {
|
|
353
|
+
// this.setFocusedOption(0);
|
|
354
|
+
// }
|
|
355
|
+
// }
|
|
356
|
+
// return false;
|
|
357
|
+
// }
|
|
358
|
+
// case keyEnd: {
|
|
359
|
+
// if (!this.flyoutOpen) {
|
|
360
|
+
// this.toggleFlyout(true);
|
|
361
|
+
// } else {
|
|
362
|
+
// if (this.menuElement.optionElements.length > 0) {
|
|
363
|
+
// this.toggleFlyout(true);
|
|
364
|
+
// this.setFocusedOption(this.menuElement.optionElements.length - 1);
|
|
365
|
+
// }
|
|
366
|
+
// }
|
|
367
|
+
// return false;
|
|
368
|
+
// }
|
|
369
|
+
case keyArrowDown: {
|
|
370
|
+
if (!this.flyoutOpen) {
|
|
371
|
+
this.toggleFlyout(true);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
const nextFocusOptionIndex = this.flyoutOpen
|
|
375
|
+
? Math.min(this.menuFocusIndex + 1, this.menuElement.optionElements.length - 1)
|
|
376
|
+
: 0;
|
|
377
|
+
this.setFocusedOption(nextFocusOptionIndex);
|
|
378
|
+
}
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
case keyArrowUp: {
|
|
382
|
+
if (!this.flyoutOpen) {
|
|
383
|
+
this.toggleFlyout(true);
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
const previousFocusOptionIndex = this.flyoutOpen
|
|
387
|
+
? Math.max(this.menuFocusIndex - 1, 0)
|
|
388
|
+
: 0;
|
|
389
|
+
this.setFocusedOption(previousFocusOptionIndex);
|
|
390
|
+
}
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
case keyEscape: {
|
|
394
|
+
this.toggleFlyout(false);
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
case keyEnter: {
|
|
398
|
+
if (this.menuFocusIndex !== -1 &&
|
|
399
|
+
this.menuElement.optionElements.length > this.menuFocusIndex) {
|
|
400
|
+
this.menuElement.optionElements[this.menuFocusIndex].click();
|
|
401
|
+
}
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
case keyArrowRight: {
|
|
405
|
+
if (document.activeElement !== this.inputElement) {
|
|
406
|
+
this.incrementFocusedItem(1);
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
// don't block if arrow keys moving caret in input element
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
case keyArrowLeft: {
|
|
413
|
+
if (this.inputElement.selectionStart === 0) {
|
|
414
|
+
this.incrementFocusedItem(-1);
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
// don't block if arrow keys moving caret in input element
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
case keyDelete:
|
|
421
|
+
case keyBackspace: {
|
|
422
|
+
if (document.activeElement === null) {
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
if (document.activeElement === this.inputElement) {
|
|
426
|
+
if (this.inputElement.selectionStart === 0) {
|
|
427
|
+
this.selection = this.selectedItems
|
|
428
|
+
.slice(0, this.selectedItems.length - 1)
|
|
429
|
+
.toString();
|
|
430
|
+
this.toggleFlyout(false);
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
// let text deletion proceed
|
|
434
|
+
return true;
|
|
435
|
+
}
|
|
436
|
+
const selectedItems = Array.from(this.listElement.children);
|
|
437
|
+
const currentFocusedItemIndex = selectedItems.indexOf(document.activeElement);
|
|
438
|
+
if (currentFocusedItemIndex > -1) {
|
|
439
|
+
// delete currently focused item
|
|
440
|
+
this.selection = this.selectedItems
|
|
441
|
+
.splice(currentFocusedItemIndex, 1)
|
|
442
|
+
.toString();
|
|
443
|
+
DOM.queueUpdate(() => {
|
|
444
|
+
selectedItems[Math.min(selectedItems.length, currentFocusedItemIndex)].focus();
|
|
445
|
+
});
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
this.toggleFlyout(true);
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Handle focus in events.
|
|
456
|
+
*/
|
|
457
|
+
handleFocusIn(e) {
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Handle focus out events.
|
|
462
|
+
*/
|
|
463
|
+
handleFocusOut(e) {
|
|
464
|
+
if (this.menuElement === undefined ||
|
|
465
|
+
!this.menuElement.contains(e.relatedTarget)) {
|
|
466
|
+
this.toggleFlyout(false);
|
|
467
|
+
}
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* The list of selected items has changed
|
|
472
|
+
*/
|
|
473
|
+
handleSelectionChange() {
|
|
474
|
+
if (this.selectedItems.toString() === this.selection) {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
this.selectedItems = this.selection === "" ? [] : this.selection.split(",");
|
|
478
|
+
this.updateFilteredOptions();
|
|
479
|
+
DOM.queueUpdate(() => {
|
|
480
|
+
this.checkMaxItems();
|
|
481
|
+
});
|
|
482
|
+
this.$emit("selectionchange", { bubbles: false });
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Anchored region is loaded, menu and options exist in the DOM.
|
|
486
|
+
*/
|
|
487
|
+
handleRegionLoaded(e) {
|
|
488
|
+
DOM.queueUpdate(() => {
|
|
489
|
+
this.setFocusedOption(0);
|
|
490
|
+
this.$emit("menuloaded", { bubbles: false });
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Checks if the maximum number of items has been chosen and updates the ui.
|
|
495
|
+
*/
|
|
496
|
+
checkMaxItems() {
|
|
497
|
+
if (this.inputElement === undefined) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
if (this.maxSelected !== undefined &&
|
|
501
|
+
this.selectedItems.length >= this.maxSelected) {
|
|
502
|
+
if (document.activeElement === this.inputElement) {
|
|
503
|
+
const selectedItemInstances = Array.from(this.listElement.querySelectorAll("[role='listitem']"));
|
|
504
|
+
selectedItemInstances[selectedItemInstances.length - 1].focus();
|
|
505
|
+
}
|
|
506
|
+
this.inputElement.hidden = true;
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
this.inputElement.hidden = false;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* A list item has been invoked.
|
|
514
|
+
*/
|
|
515
|
+
handleItemInvoke(e) {
|
|
516
|
+
if (e.defaultPrevented) {
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
519
|
+
if (e.target instanceof PickerListItem) {
|
|
520
|
+
const listItems = Array.from(this.listElement.querySelectorAll("[role='listitem']"));
|
|
521
|
+
const itemIndex = listItems.indexOf(e.target);
|
|
522
|
+
if (itemIndex !== -1) {
|
|
523
|
+
const newSelection = this.selectedItems.slice();
|
|
524
|
+
newSelection.splice(itemIndex, 1);
|
|
525
|
+
this.selection = newSelection.toString();
|
|
526
|
+
DOM.queueUpdate(() => this.incrementFocusedItem(0));
|
|
527
|
+
}
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
return true;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* A menu option has been invoked.
|
|
534
|
+
*/
|
|
535
|
+
handleOptionInvoke(e) {
|
|
536
|
+
if (e.defaultPrevented) {
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
if (e.target instanceof PickerMenuOption) {
|
|
540
|
+
if (e.target.value !== undefined) {
|
|
541
|
+
this.selection = `${this.selection}${this.selection === "" ? "" : ","}${e.target.value}`;
|
|
542
|
+
}
|
|
543
|
+
this.inputElement.value = "";
|
|
544
|
+
this.query = "";
|
|
545
|
+
this.inputElement.focus();
|
|
546
|
+
this.toggleFlyout(false);
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
// const value: string = (e.target as PickerMenuOption).value;
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Increments the focused list item by the specified amount
|
|
554
|
+
*/
|
|
555
|
+
incrementFocusedItem(increment) {
|
|
556
|
+
if (this.selectedItems.length === 0) {
|
|
557
|
+
this.inputElement.focus();
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
const selectedItemsAsElements = Array.from(this.listElement.querySelectorAll("[role='listitem']"));
|
|
561
|
+
if (document.activeElement !== null) {
|
|
562
|
+
let currentFocusedItemIndex = selectedItemsAsElements.indexOf(document.activeElement);
|
|
563
|
+
if (currentFocusedItemIndex === -1) {
|
|
564
|
+
// use the input element
|
|
565
|
+
currentFocusedItemIndex = selectedItemsAsElements.length;
|
|
566
|
+
}
|
|
567
|
+
const newFocusedItemIndex = Math.min(selectedItemsAsElements.length, Math.max(0, currentFocusedItemIndex + increment));
|
|
568
|
+
if (newFocusedItemIndex === selectedItemsAsElements.length) {
|
|
569
|
+
if (this.maxSelected !== undefined &&
|
|
570
|
+
this.selectedItems.length >= this.maxSelected) {
|
|
571
|
+
selectedItemsAsElements[newFocusedItemIndex - 1].focus();
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
this.inputElement.focus();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
selectedItemsAsElements[newFocusedItemIndex].focus();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Disables the menu. Note that the menu can be open, just doens't have any valid options on display.
|
|
584
|
+
*/
|
|
585
|
+
disableMenu() {
|
|
586
|
+
var _a, _b, _c;
|
|
587
|
+
this.menuFocusIndex = -1;
|
|
588
|
+
this.menuFocusOptionId = undefined;
|
|
589
|
+
(_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.removeAttribute("aria-activedescendant");
|
|
590
|
+
(_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.removeAttribute("aria-owns");
|
|
591
|
+
(_c = this.inputElement) === null || _c === void 0 ? void 0 : _c.removeAttribute("aria-expanded");
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Sets the currently focused menu option by index
|
|
595
|
+
*/
|
|
596
|
+
setFocusedOption(optionIndex) {
|
|
597
|
+
if (!this.flyoutOpen ||
|
|
598
|
+
optionIndex === -1 ||
|
|
599
|
+
this.showNoOptions ||
|
|
600
|
+
this.showLoading) {
|
|
601
|
+
this.disableMenu();
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (this.menuElement.optionElements.length === 0) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
this.menuElement.optionElements.forEach((element) => {
|
|
608
|
+
element.setAttribute("aria-selected", "false");
|
|
609
|
+
});
|
|
610
|
+
this.menuFocusIndex = optionIndex;
|
|
611
|
+
if (this.menuFocusIndex > this.menuElement.optionElements.length - 1) {
|
|
612
|
+
this.menuFocusIndex = this.menuElement.optionElements.length - 1;
|
|
613
|
+
}
|
|
614
|
+
this.menuFocusOptionId = this.menuElement.optionElements[this.menuFocusIndex].id;
|
|
615
|
+
this.inputElement.setAttribute("aria-owns", this.menuId);
|
|
616
|
+
this.inputElement.setAttribute("aria-expanded", "true");
|
|
617
|
+
this.inputElement.setAttribute("aria-activedescendant", this.menuFocusOptionId);
|
|
618
|
+
const focusedOption = this.menuElement.optionElements[this.menuFocusIndex];
|
|
619
|
+
focusedOption.setAttribute("aria-selected", "true");
|
|
620
|
+
this.menuElement.scrollTo(0, focusedOption.offsetTop);
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Updates the template used for the list item repeat behavior
|
|
624
|
+
*/
|
|
625
|
+
updateListItemTemplate() {
|
|
626
|
+
var _a;
|
|
627
|
+
this.activeListItemTemplate =
|
|
628
|
+
(_a = this.listItemTemplate) !== null && _a !== void 0 ? _a : this.defaultListItemTemplate;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Updates the template used for the menu option repeat behavior
|
|
632
|
+
*/
|
|
633
|
+
updateOptionTemplate() {
|
|
634
|
+
var _a;
|
|
635
|
+
this.activeMenuOptionTemplate =
|
|
636
|
+
(_a = this.menuOptionTemplate) !== null && _a !== void 0 ? _a : this.defaultMenuOptionTemplate;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Updates the filtered options array
|
|
640
|
+
*/
|
|
641
|
+
updateFilteredOptions() {
|
|
642
|
+
this.filteredOptionsList = this.optionsList.slice(0);
|
|
643
|
+
if (this.filterSelected) {
|
|
644
|
+
this.filteredOptionsList = this.filteredOptionsList.filter(el => this.selectedItems.indexOf(el) === -1);
|
|
645
|
+
}
|
|
646
|
+
if (this.filterQuery && this.query !== "" && this.query !== undefined) {
|
|
647
|
+
this.filteredOptionsList = this.filteredOptionsList.filter(el => el.indexOf(this.query) !== -1);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Updates the menu configuration
|
|
652
|
+
*/
|
|
653
|
+
updateMenuConfig() {
|
|
654
|
+
let newConfig = this.configLookup[this.menuPlacement];
|
|
655
|
+
if (newConfig === null) {
|
|
656
|
+
newConfig = FlyoutPosBottomFill;
|
|
657
|
+
}
|
|
658
|
+
this.menuConfig = Object.assign(Object.assign({}, newConfig), { autoUpdateMode: "auto", fixedPlacement: true, horizontalViewportLock: false, verticalViewportLock: false });
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
__decorate([
|
|
662
|
+
attr({ attribute: "selection" })
|
|
663
|
+
], Picker.prototype, "selection", void 0);
|
|
664
|
+
__decorate([
|
|
665
|
+
attr({ attribute: "options" })
|
|
666
|
+
], Picker.prototype, "options", void 0);
|
|
667
|
+
__decorate([
|
|
668
|
+
attr({ attribute: "filter-selected", mode: "boolean" })
|
|
669
|
+
], Picker.prototype, "filterSelected", void 0);
|
|
670
|
+
__decorate([
|
|
671
|
+
attr({ attribute: "filter-query", mode: "boolean" })
|
|
672
|
+
], Picker.prototype, "filterQuery", void 0);
|
|
673
|
+
__decorate([
|
|
674
|
+
attr({ attribute: "max-selected" })
|
|
675
|
+
], Picker.prototype, "maxSelected", void 0);
|
|
676
|
+
__decorate([
|
|
677
|
+
attr({ attribute: "no-suggestions-text" })
|
|
678
|
+
], Picker.prototype, "noSuggestionsText", void 0);
|
|
679
|
+
__decorate([
|
|
680
|
+
attr({ attribute: "suggestions-available-text" })
|
|
681
|
+
], Picker.prototype, "suggestionsAvailableText", void 0);
|
|
682
|
+
__decorate([
|
|
683
|
+
attr({ attribute: "loading-text" })
|
|
684
|
+
], Picker.prototype, "loadingText", void 0);
|
|
685
|
+
__decorate([
|
|
686
|
+
attr({ attribute: "label" })
|
|
687
|
+
], Picker.prototype, "label", void 0);
|
|
688
|
+
__decorate([
|
|
689
|
+
attr({ attribute: "labelledby" })
|
|
690
|
+
], Picker.prototype, "labelledBy", void 0);
|
|
691
|
+
__decorate([
|
|
692
|
+
attr({ attribute: "placeholder" })
|
|
693
|
+
], Picker.prototype, "placeholder", void 0);
|
|
694
|
+
__decorate([
|
|
695
|
+
attr({ attribute: "menu-placement" })
|
|
696
|
+
], Picker.prototype, "menuPlacement", void 0);
|
|
697
|
+
__decorate([
|
|
698
|
+
observable
|
|
699
|
+
], Picker.prototype, "showLoading", void 0);
|
|
700
|
+
__decorate([
|
|
701
|
+
observable
|
|
702
|
+
], Picker.prototype, "listItemTemplate", void 0);
|
|
703
|
+
__decorate([
|
|
704
|
+
observable
|
|
705
|
+
], Picker.prototype, "defaultListItemTemplate", void 0);
|
|
706
|
+
__decorate([
|
|
707
|
+
observable
|
|
708
|
+
], Picker.prototype, "activeListItemTemplate", void 0);
|
|
709
|
+
__decorate([
|
|
710
|
+
observable
|
|
711
|
+
], Picker.prototype, "menuOptionTemplate", void 0);
|
|
712
|
+
__decorate([
|
|
713
|
+
observable
|
|
714
|
+
], Picker.prototype, "defaultMenuOptionTemplate", void 0);
|
|
715
|
+
__decorate([
|
|
716
|
+
observable
|
|
717
|
+
], Picker.prototype, "activeMenuOptionTemplate", void 0);
|
|
718
|
+
__decorate([
|
|
719
|
+
observable
|
|
720
|
+
], Picker.prototype, "listItemContentsTemplate", void 0);
|
|
721
|
+
__decorate([
|
|
722
|
+
observable
|
|
723
|
+
], Picker.prototype, "menuOptionContentsTemplate", void 0);
|
|
724
|
+
__decorate([
|
|
725
|
+
observable
|
|
726
|
+
], Picker.prototype, "optionsList", void 0);
|
|
727
|
+
__decorate([
|
|
728
|
+
observable
|
|
729
|
+
], Picker.prototype, "query", void 0);
|
|
730
|
+
__decorate([
|
|
731
|
+
observable
|
|
732
|
+
], Picker.prototype, "filteredOptionsList", void 0);
|
|
733
|
+
__decorate([
|
|
734
|
+
observable
|
|
735
|
+
], Picker.prototype, "flyoutOpen", void 0);
|
|
736
|
+
__decorate([
|
|
737
|
+
observable
|
|
738
|
+
], Picker.prototype, "menuId", void 0);
|
|
739
|
+
__decorate([
|
|
740
|
+
observable
|
|
741
|
+
], Picker.prototype, "selectedListTag", void 0);
|
|
742
|
+
__decorate([
|
|
743
|
+
observable
|
|
744
|
+
], Picker.prototype, "menuTag", void 0);
|
|
745
|
+
__decorate([
|
|
746
|
+
observable
|
|
747
|
+
], Picker.prototype, "menuFocusIndex", void 0);
|
|
748
|
+
__decorate([
|
|
749
|
+
observable
|
|
750
|
+
], Picker.prototype, "menuFocusOptionId", void 0);
|
|
751
|
+
__decorate([
|
|
752
|
+
observable
|
|
753
|
+
], Picker.prototype, "showNoOptions", void 0);
|
|
754
|
+
__decorate([
|
|
755
|
+
observable
|
|
756
|
+
], Picker.prototype, "menuConfig", void 0);
|
|
757
|
+
__decorate([
|
|
758
|
+
observable
|
|
759
|
+
], Picker.prototype, "selectedItems", void 0);
|