@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,200 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable, Observable } from "@ni/fast-element";
|
|
3
|
+
import { isHTMLElement } from "@ni/fast-web-utilities";
|
|
4
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
5
|
+
import { ARIAGlobalStatesAndProperties } from "../patterns/aria-global.js";
|
|
6
|
+
import { StartEnd } from "../patterns/start-end.js";
|
|
7
|
+
import { applyMixins } from "../utilities/apply-mixins.js";
|
|
8
|
+
/**
|
|
9
|
+
* Determines if the element is a {@link (ListboxOption:class)}
|
|
10
|
+
*
|
|
11
|
+
* @param element - the element to test.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export function isListboxOption(el) {
|
|
15
|
+
return (isHTMLElement(el) &&
|
|
16
|
+
(el.getAttribute("role") === "option" ||
|
|
17
|
+
el instanceof HTMLOptionElement));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* An Option Custom HTML Element.
|
|
21
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
|
|
22
|
+
*
|
|
23
|
+
* @slot start - Content which can be provided before the listbox option content
|
|
24
|
+
* @slot end - Content which can be provided after the listbox option content
|
|
25
|
+
* @slot - The default slot for listbox option content
|
|
26
|
+
* @csspart content - Wraps the listbox option content
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export class ListboxOption extends FoundationElement {
|
|
31
|
+
/**
|
|
32
|
+
* Updates the ariaChecked property when the checked property changes.
|
|
33
|
+
*
|
|
34
|
+
* @param prev - the previous checked value
|
|
35
|
+
* @param next - the current checked value
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
checkedChanged(prev, next) {
|
|
40
|
+
if (typeof next === "boolean") {
|
|
41
|
+
this.ariaChecked = next ? "true" : "false";
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.ariaChecked = null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Updates the proxy's text content when the default slot changes.
|
|
48
|
+
* @param prev - the previous content value
|
|
49
|
+
* @param next - the current content value
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
contentChanged(prev, next) {
|
|
54
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
55
|
+
this.proxy.textContent = this.textContent;
|
|
56
|
+
}
|
|
57
|
+
this.$emit("contentchange", null, { bubbles: true });
|
|
58
|
+
}
|
|
59
|
+
defaultSelectedChanged() {
|
|
60
|
+
if (!this.dirtySelected) {
|
|
61
|
+
this.selected = this.defaultSelected;
|
|
62
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
63
|
+
this.proxy.selected = this.defaultSelected;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
disabledChanged(prev, next) {
|
|
68
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
69
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
70
|
+
this.proxy.disabled = this.disabled;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
selectedAttributeChanged() {
|
|
74
|
+
this.defaultSelected = this.selectedAttribute;
|
|
75
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
76
|
+
this.proxy.defaultSelected = this.defaultSelected;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
selectedChanged() {
|
|
80
|
+
this.ariaSelected = this.selected ? "true" : "false";
|
|
81
|
+
if (!this.dirtySelected) {
|
|
82
|
+
this.dirtySelected = true;
|
|
83
|
+
}
|
|
84
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
85
|
+
this.proxy.selected = this.selected;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
initialValueChanged(previous, next) {
|
|
89
|
+
// If the value is clean and the component is connected to the DOM
|
|
90
|
+
// then set value equal to the attribute value.
|
|
91
|
+
if (!this.dirtyValue) {
|
|
92
|
+
this.value = this.initialValue;
|
|
93
|
+
this.dirtyValue = false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
get label() {
|
|
97
|
+
var _a;
|
|
98
|
+
return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
|
|
99
|
+
}
|
|
100
|
+
get text() {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
|
|
103
|
+
}
|
|
104
|
+
set value(next) {
|
|
105
|
+
const newValue = `${next !== null && next !== void 0 ? next : ""}`;
|
|
106
|
+
this._value = newValue;
|
|
107
|
+
this.dirtyValue = true;
|
|
108
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
109
|
+
this.proxy.value = newValue;
|
|
110
|
+
}
|
|
111
|
+
Observable.notify(this, "value");
|
|
112
|
+
}
|
|
113
|
+
get value() {
|
|
114
|
+
var _a;
|
|
115
|
+
Observable.track(this, "value");
|
|
116
|
+
return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
|
|
117
|
+
}
|
|
118
|
+
get form() {
|
|
119
|
+
return this.proxy ? this.proxy.form : null;
|
|
120
|
+
}
|
|
121
|
+
constructor(text, value, defaultSelected, selected) {
|
|
122
|
+
super();
|
|
123
|
+
/**
|
|
124
|
+
* The defaultSelected state of the option.
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
this.defaultSelected = false;
|
|
128
|
+
/**
|
|
129
|
+
* Tracks whether the "selected" property has been changed.
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
this.dirtySelected = false;
|
|
133
|
+
/**
|
|
134
|
+
* The checked state of the control.
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
this.selected = this.defaultSelected;
|
|
139
|
+
/**
|
|
140
|
+
* Track whether the value has been changed from the initial value
|
|
141
|
+
*/
|
|
142
|
+
this.dirtyValue = false;
|
|
143
|
+
if (text) {
|
|
144
|
+
this.textContent = text;
|
|
145
|
+
}
|
|
146
|
+
if (value) {
|
|
147
|
+
this.initialValue = value;
|
|
148
|
+
}
|
|
149
|
+
if (defaultSelected) {
|
|
150
|
+
this.defaultSelected = defaultSelected;
|
|
151
|
+
}
|
|
152
|
+
if (selected) {
|
|
153
|
+
this.selected = selected;
|
|
154
|
+
}
|
|
155
|
+
this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
|
|
156
|
+
this.proxy.disabled = this.disabled;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
__decorate([
|
|
160
|
+
observable
|
|
161
|
+
], ListboxOption.prototype, "checked", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
observable
|
|
164
|
+
], ListboxOption.prototype, "content", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
observable
|
|
167
|
+
], ListboxOption.prototype, "defaultSelected", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
attr({ mode: "boolean" })
|
|
170
|
+
], ListboxOption.prototype, "disabled", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
attr({ attribute: "selected", mode: "boolean" })
|
|
173
|
+
], ListboxOption.prototype, "selectedAttribute", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
observable
|
|
176
|
+
], ListboxOption.prototype, "selected", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
attr({ attribute: "value", mode: "fromView" })
|
|
179
|
+
], ListboxOption.prototype, "initialValue", void 0);
|
|
180
|
+
/**
|
|
181
|
+
* States and properties relating to the ARIA `option` role.
|
|
182
|
+
*
|
|
183
|
+
* @public
|
|
184
|
+
*/
|
|
185
|
+
export class DelegatesARIAListboxOption {
|
|
186
|
+
}
|
|
187
|
+
__decorate([
|
|
188
|
+
observable
|
|
189
|
+
], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
observable
|
|
192
|
+
], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
observable
|
|
195
|
+
], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
observable
|
|
198
|
+
], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
|
|
199
|
+
applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
|
|
200
|
+
applyMixins(ListboxOption, StartEnd, DelegatesARIAListboxOption);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { html, slotted } from "@ni/fast-element";
|
|
2
|
+
import { endSlotTemplate, startSlotTemplate } from "../patterns/start-end.js";
|
|
3
|
+
/**
|
|
4
|
+
* The template for the {@link @ni/fast-foundation#(ListboxOption:class)} component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const listboxOptionTemplate = (context, definition) => html `
|
|
8
|
+
<template
|
|
9
|
+
aria-checked="${x => x.ariaChecked}"
|
|
10
|
+
aria-disabled="${x => x.ariaDisabled}"
|
|
11
|
+
aria-posinset="${x => x.ariaPosInSet}"
|
|
12
|
+
aria-selected="${x => x.ariaSelected}"
|
|
13
|
+
aria-setsize="${x => x.ariaSetSize}"
|
|
14
|
+
class="${x => [x.checked && "checked", x.selected && "selected", x.disabled && "disabled"]
|
|
15
|
+
.filter(Boolean)
|
|
16
|
+
.join(" ")}"
|
|
17
|
+
role="option"
|
|
18
|
+
>
|
|
19
|
+
${startSlotTemplate(context, definition)}
|
|
20
|
+
<span class="content" part="content">
|
|
21
|
+
<slot ${slotted("content")}></slot>
|
|
22
|
+
</span>
|
|
23
|
+
${endSlotTemplate(context, definition)}
|
|
24
|
+
</template>
|
|
25
|
+
`;
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { DOM, observable } from "@ni/fast-element";
|
|
3
|
+
import { isHTMLElement, keyArrowDown, keyArrowUp, keyEnd, keyHome, } from "@ni/fast-web-utilities";
|
|
4
|
+
import { MenuItem, MenuItemRole, roleForMenuItem, } from "../menu-item/index.js";
|
|
5
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
6
|
+
/**
|
|
7
|
+
* A Menu Custom HTML Element.
|
|
8
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#menu | ARIA menu }.
|
|
9
|
+
*
|
|
10
|
+
* @slot - The default slot for the menu items
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export class Menu extends FoundationElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.expandedItem = null;
|
|
18
|
+
/**
|
|
19
|
+
* The index of the focusable element in the items array
|
|
20
|
+
* defaults to -1
|
|
21
|
+
*/
|
|
22
|
+
this.focusIndex = -1;
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
this.isNestedMenu = () => {
|
|
27
|
+
return (this.parentElement !== null &&
|
|
28
|
+
isHTMLElement(this.parentElement) &&
|
|
29
|
+
this.parentElement.getAttribute("role") === "menuitem");
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* if focus is moving out of the menu, reset to a stable initial state
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
this.handleFocusOut = (e) => {
|
|
36
|
+
if (!this.contains(e.relatedTarget) && this.menuItems !== undefined) {
|
|
37
|
+
this.collapseExpandedItem();
|
|
38
|
+
// find our first focusable element
|
|
39
|
+
const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
|
|
40
|
+
// set the current focus index's tabindex to -1
|
|
41
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
42
|
+
// set the first focusable element tabindex to 0
|
|
43
|
+
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
44
|
+
// set the focus index
|
|
45
|
+
this.focusIndex = focusIndex;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.handleItemFocus = (e) => {
|
|
49
|
+
const targetItem = e.target;
|
|
50
|
+
if (this.menuItems !== undefined &&
|
|
51
|
+
targetItem !== this.menuItems[this.focusIndex]) {
|
|
52
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
53
|
+
this.focusIndex = this.menuItems.indexOf(targetItem);
|
|
54
|
+
targetItem.setAttribute("tabindex", "0");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
this.handleExpandedChanged = (e) => {
|
|
58
|
+
if (e.defaultPrevented ||
|
|
59
|
+
e.target === null ||
|
|
60
|
+
this.menuItems === undefined ||
|
|
61
|
+
this.menuItems.indexOf(e.target) < 0) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
const changedItem = e.target;
|
|
66
|
+
// closing an expanded item without opening another
|
|
67
|
+
if (this.expandedItem !== null &&
|
|
68
|
+
changedItem === this.expandedItem &&
|
|
69
|
+
changedItem.expanded === false) {
|
|
70
|
+
this.expandedItem = null;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (changedItem.expanded) {
|
|
74
|
+
if (this.expandedItem !== null && this.expandedItem !== changedItem) {
|
|
75
|
+
this.expandedItem.expanded = false;
|
|
76
|
+
}
|
|
77
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
78
|
+
this.expandedItem = changedItem;
|
|
79
|
+
this.focusIndex = this.menuItems.indexOf(changedItem);
|
|
80
|
+
changedItem.setAttribute("tabindex", "0");
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
this.removeItemListeners = () => {
|
|
84
|
+
if (this.menuItems !== undefined) {
|
|
85
|
+
this.menuItems.forEach((item) => {
|
|
86
|
+
item.removeEventListener("expanded-change", this.handleExpandedChanged);
|
|
87
|
+
item.removeEventListener("focus", this.handleItemFocus);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
this.setItems = () => {
|
|
92
|
+
const newItems = this.domChildren();
|
|
93
|
+
this.removeItemListeners();
|
|
94
|
+
this.menuItems = newItems;
|
|
95
|
+
const menuItems = this.menuItems.filter(this.isMenuItemElement);
|
|
96
|
+
// if our focus index is not -1 we have items
|
|
97
|
+
if (menuItems.length) {
|
|
98
|
+
this.focusIndex = 0;
|
|
99
|
+
}
|
|
100
|
+
function elementIndent(el) {
|
|
101
|
+
const role = el.getAttribute("role");
|
|
102
|
+
const startSlot = el.querySelector("[slot=start]");
|
|
103
|
+
if (role !== MenuItemRole.menuitem && startSlot === null) {
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
else if (role === MenuItemRole.menuitem && startSlot !== null) {
|
|
107
|
+
return 1;
|
|
108
|
+
}
|
|
109
|
+
else if (role !== MenuItemRole.menuitem && startSlot !== null) {
|
|
110
|
+
return 2;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const indent = menuItems.reduce((accum, current) => {
|
|
117
|
+
const elementValue = elementIndent(current);
|
|
118
|
+
return accum > elementValue ? accum : elementValue;
|
|
119
|
+
}, 0);
|
|
120
|
+
menuItems.forEach((item, index) => {
|
|
121
|
+
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
122
|
+
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
123
|
+
item.addEventListener("focus", this.handleItemFocus);
|
|
124
|
+
if (item instanceof MenuItem || "startColumnCount" in item) {
|
|
125
|
+
item.startColumnCount = indent;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* handle change from child element
|
|
131
|
+
*/
|
|
132
|
+
this.changeHandler = (e) => {
|
|
133
|
+
if (this.menuItems === undefined) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const changedMenuItem = e.target;
|
|
137
|
+
const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
|
|
138
|
+
if (changeItemIndex === -1) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (changedMenuItem.role === "menuitemradio" &&
|
|
142
|
+
changedMenuItem.checked === true) {
|
|
143
|
+
for (let i = changeItemIndex - 1; i >= 0; --i) {
|
|
144
|
+
const item = this.menuItems[i];
|
|
145
|
+
const role = item.getAttribute("role");
|
|
146
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
147
|
+
item.checked = false;
|
|
148
|
+
}
|
|
149
|
+
if (role === "separator") {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const maxIndex = this.menuItems.length - 1;
|
|
154
|
+
for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
|
|
155
|
+
const item = this.menuItems[i];
|
|
156
|
+
const role = item.getAttribute("role");
|
|
157
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
158
|
+
item.checked = false;
|
|
159
|
+
}
|
|
160
|
+
if (role === "separator") {
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* check if the item is a menu item
|
|
168
|
+
*/
|
|
169
|
+
this.isMenuItemElement = (el) => {
|
|
170
|
+
return (isHTMLElement(el) &&
|
|
171
|
+
Menu.focusableElementRoles.hasOwnProperty(el.getAttribute("role")));
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* check if the item is focusable
|
|
175
|
+
*/
|
|
176
|
+
this.isFocusableElement = (el) => {
|
|
177
|
+
return this.isMenuItemElement(el);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
itemsChanged(oldValue, newValue) {
|
|
181
|
+
// only update children after the component is connected and
|
|
182
|
+
// the setItems has run on connectedCallback
|
|
183
|
+
// (menuItems is undefined until then)
|
|
184
|
+
if (this.$fastController.isConnected && this.menuItems !== undefined) {
|
|
185
|
+
this.setItems();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
connectedCallback() {
|
|
192
|
+
super.connectedCallback();
|
|
193
|
+
DOM.queueUpdate(() => {
|
|
194
|
+
// wait until children have had a chance to
|
|
195
|
+
// connect before setting/checking their props/attributes
|
|
196
|
+
this.setItems();
|
|
197
|
+
});
|
|
198
|
+
this.addEventListener("change", this.changeHandler);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @internal
|
|
202
|
+
*/
|
|
203
|
+
disconnectedCallback() {
|
|
204
|
+
super.disconnectedCallback();
|
|
205
|
+
this.removeItemListeners();
|
|
206
|
+
this.menuItems = undefined;
|
|
207
|
+
this.removeEventListener("change", this.changeHandler);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Focuses the first item in the menu.
|
|
211
|
+
*
|
|
212
|
+
* @public
|
|
213
|
+
*/
|
|
214
|
+
focus() {
|
|
215
|
+
this.setFocus(0, 1);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Collapses any expanded menu items.
|
|
219
|
+
*
|
|
220
|
+
* @public
|
|
221
|
+
*/
|
|
222
|
+
collapseExpandedItem() {
|
|
223
|
+
if (this.expandedItem !== null) {
|
|
224
|
+
this.expandedItem.expanded = false;
|
|
225
|
+
this.expandedItem = null;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* @internal
|
|
230
|
+
*/
|
|
231
|
+
handleMenuKeyDown(e) {
|
|
232
|
+
if (e.defaultPrevented || this.menuItems === undefined) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
switch (e.key) {
|
|
236
|
+
case keyArrowDown:
|
|
237
|
+
// go forward one index
|
|
238
|
+
this.setFocus(this.focusIndex + 1, 1);
|
|
239
|
+
return;
|
|
240
|
+
case keyArrowUp:
|
|
241
|
+
// go back one index
|
|
242
|
+
this.setFocus(this.focusIndex - 1, -1);
|
|
243
|
+
return;
|
|
244
|
+
case keyEnd:
|
|
245
|
+
// set focus on last item
|
|
246
|
+
this.setFocus(this.menuItems.length - 1, -1);
|
|
247
|
+
return;
|
|
248
|
+
case keyHome:
|
|
249
|
+
// set focus on first item
|
|
250
|
+
this.setFocus(0, 1);
|
|
251
|
+
return;
|
|
252
|
+
default:
|
|
253
|
+
// if we are not handling the event, do not prevent default
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* get an array of valid DOM children
|
|
259
|
+
*/
|
|
260
|
+
domChildren() {
|
|
261
|
+
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
262
|
+
}
|
|
263
|
+
setFocus(focusIndex, adjustment) {
|
|
264
|
+
if (this.menuItems === undefined) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
|
|
268
|
+
const child = this.menuItems[focusIndex];
|
|
269
|
+
if (this.isFocusableElement(child)) {
|
|
270
|
+
// change the previous index to -1
|
|
271
|
+
if (this.focusIndex > -1 &&
|
|
272
|
+
this.menuItems.length >= this.focusIndex - 1) {
|
|
273
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
274
|
+
}
|
|
275
|
+
// update the focus index
|
|
276
|
+
this.focusIndex = focusIndex;
|
|
277
|
+
// update the tabindex of next focusable element
|
|
278
|
+
child.setAttribute("tabindex", "0");
|
|
279
|
+
// focus the element
|
|
280
|
+
child.focus();
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
focusIndex += adjustment;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
Menu.focusableElementRoles = roleForMenuItem;
|
|
288
|
+
__decorate([
|
|
289
|
+
observable
|
|
290
|
+
], Menu.prototype, "items", void 0);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { html, slotted } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* The template for the {@link @ni/fast-foundation#Menu} component.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export const menuTemplate = (context, definition) => html `
|
|
7
|
+
<template
|
|
8
|
+
slot="${x => (x.slot ? x.slot : x.isNestedMenu() ? "submenu" : void 0)}"
|
|
9
|
+
role="menu"
|
|
10
|
+
@keydown="${(x, c) => x.handleMenuKeyDown(c.event)}"
|
|
11
|
+
@focusout="${(x, c) => x.handleFocusOut(c.event)}"
|
|
12
|
+
>
|
|
13
|
+
<slot ${slotted("items")}></slot>
|
|
14
|
+
</template>
|
|
15
|
+
`;
|