@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,99 @@
|
|
|
1
|
+
import { TreeItem } from "../tree-item/tree-item.js";
|
|
2
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
3
|
+
/**
|
|
4
|
+
* A Tree view Custom HTML Element.
|
|
5
|
+
* Implements the {@link https://w3c.github.io/aria-practices/#TreeView | ARIA TreeView }.
|
|
6
|
+
*
|
|
7
|
+
* @slot - The default slot for tree items
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare class TreeView extends FoundationElement {
|
|
12
|
+
/**
|
|
13
|
+
/**
|
|
14
|
+
* When true, the control will be appear expanded by user interaction.
|
|
15
|
+
* @public
|
|
16
|
+
* @remarks
|
|
17
|
+
* HTML Attribute: render-collapsed-nodes
|
|
18
|
+
*/
|
|
19
|
+
renderCollapsedNodes: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The currently selected tree item
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
currentSelected: HTMLElement | TreeItem | null;
|
|
25
|
+
/**
|
|
26
|
+
* Slotted children
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
slottedTreeItems: HTMLElement[];
|
|
31
|
+
private slottedTreeItemsChanged;
|
|
32
|
+
/**
|
|
33
|
+
* The tree item that is designated to be in the tab queue.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
currentFocused: HTMLElement | TreeItem | null;
|
|
38
|
+
/**
|
|
39
|
+
* Handle focus events
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
handleFocus: (e: FocusEvent) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Handle blur events
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
handleBlur: (e: FocusEvent) => void;
|
|
50
|
+
/**
|
|
51
|
+
* ref to the tree item
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
treeView: HTMLElement;
|
|
56
|
+
private nested;
|
|
57
|
+
connectedCallback(): void;
|
|
58
|
+
/**
|
|
59
|
+
* KeyDown handler
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
handleKeyDown: (e: KeyboardEvent) => boolean | void;
|
|
64
|
+
/**
|
|
65
|
+
* Handles click events bubbling up
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
handleClick(e: Event): boolean | void;
|
|
70
|
+
/**
|
|
71
|
+
* Handles the selected-changed events bubbling up
|
|
72
|
+
* from child tree items
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
handleSelectedChange: (e: Event) => boolean | void;
|
|
77
|
+
/**
|
|
78
|
+
* Move focus to a tree item based on its offset from the provided item
|
|
79
|
+
*/
|
|
80
|
+
private focusNextNode;
|
|
81
|
+
/**
|
|
82
|
+
* Updates the tree view when slottedTreeItems changes
|
|
83
|
+
*/
|
|
84
|
+
private setItems;
|
|
85
|
+
/**
|
|
86
|
+
* checks if there are any nested tree items
|
|
87
|
+
*/
|
|
88
|
+
private getValidFocusableItem;
|
|
89
|
+
/**
|
|
90
|
+
* checks if there are any nested tree items
|
|
91
|
+
*/
|
|
92
|
+
private checkForNestedItems;
|
|
93
|
+
/**
|
|
94
|
+
* check if the item is focusable
|
|
95
|
+
*/
|
|
96
|
+
private isFocusableElement;
|
|
97
|
+
private isSelectedElement;
|
|
98
|
+
private getVisibleNodes;
|
|
99
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ViewTemplate } from "@ni/fast-element";
|
|
2
|
+
import type { FoundationElementTemplate } from "../foundation-element/foundation-element.js";
|
|
3
|
+
import type { TreeView } from "./tree-view.js";
|
|
4
|
+
/**
|
|
5
|
+
* The template for the {@link @ni/fast-foundation#TreeView} component.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const treeViewTemplate: FoundationElementTemplate<ViewTemplate<TreeView>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if the reference element contains the test element in a "composed" DOM tree that
|
|
3
|
+
* ignores shadow DOM boundaries.
|
|
4
|
+
*
|
|
5
|
+
* Returns true of the test element is a descendent of the reference, or exist in
|
|
6
|
+
* a shadow DOM that is a logical descendent of the reference. Otherwise returns false.
|
|
7
|
+
* @param reference - The element to test for containment against.
|
|
8
|
+
* @param test - The element being tested for containment.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare function composedContains(reference: HTMLElement, test: HTMLElement): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the "composed parent" element of a node, ignoring DOM tree boundaries.
|
|
3
|
+
* When the parent of a node is a shadow-root, it will return the host
|
|
4
|
+
* element of the shadow root. Otherwise it will return the parent node or null if
|
|
5
|
+
* no parent node exists.
|
|
6
|
+
* @param element - The element for which to retrieve the composed parent
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare function composedParent<T extends HTMLElement>(element: T): HTMLElement | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Direction } from "@ni/fast-web-utilities";
|
|
2
|
+
/**
|
|
3
|
+
* a method to determine the current localization direction of the view
|
|
4
|
+
* @param rootNode - the HTMLElement to begin the query from, usually "this" when used in a component controller
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDirection: (rootNode: HTMLElement) => Direction;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./apply-mixins.js";
|
|
2
|
+
export * from "./composed-parent.js";
|
|
3
|
+
export { composedContains } from "./composed-contains.js";
|
|
4
|
+
export * from "./match-media-stylesheet-behavior.js";
|
|
5
|
+
export * from "./property-stylesheet-behavior.js";
|
|
6
|
+
export * from "./style/index.js";
|
|
7
|
+
export * from "./direction.js";
|
|
8
|
+
export * from "./whitespace-filter.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A service to batch intersection event callbacks so multiple elements can share a single observer
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class IntersectionService {
|
|
7
|
+
private intersectionDetector;
|
|
8
|
+
private observedElements;
|
|
9
|
+
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Request the position of a target element
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
requestPosition: (target: Element, callback: (entries: IntersectionObserverEntry[]) => void) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Cancel a position request
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
cancelRequestPosition: (target: Element, callback: any) => void;
|
|
22
|
+
/**
|
|
23
|
+
* initialize intersection detector
|
|
24
|
+
*/
|
|
25
|
+
private initializeIntersectionDetector;
|
|
26
|
+
/**
|
|
27
|
+
* Handle intersections
|
|
28
|
+
*/
|
|
29
|
+
private handleIntersection;
|
|
30
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Behavior, ElementStyles, FASTElement } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* An event listener fired by a {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList | MediaQueryList }.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type MediaQueryListListener = (this: MediaQueryList, ev?: MediaQueryListEvent) => void;
|
|
7
|
+
/**
|
|
8
|
+
* An abstract behavior to react to media queries. Implementations should implement
|
|
9
|
+
* the `constructListener` method to perform some action based on media query changes.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class MatchMediaBehavior implements Behavior {
|
|
14
|
+
/**
|
|
15
|
+
* The media query that the behavior operates on.
|
|
16
|
+
*/
|
|
17
|
+
readonly query: MediaQueryList;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param query - The media query to operate from.
|
|
21
|
+
*/
|
|
22
|
+
constructor(query: MediaQueryList);
|
|
23
|
+
/**
|
|
24
|
+
* Constructs a function that will be invoked with the MediaQueryList context
|
|
25
|
+
* @param source - the element the behavior is acting on.
|
|
26
|
+
*/
|
|
27
|
+
protected abstract constructListener(source: typeof FASTElement): MediaQueryListListener;
|
|
28
|
+
/**
|
|
29
|
+
* Binds the behavior to the element.
|
|
30
|
+
* @param source - The element for which the behavior is bound.
|
|
31
|
+
*/
|
|
32
|
+
bind(source: typeof FASTElement & HTMLElement): void;
|
|
33
|
+
/**
|
|
34
|
+
* Unbinds the behavior from the element.
|
|
35
|
+
* @param source - The element for which the behavior is unbinding.
|
|
36
|
+
*/
|
|
37
|
+
unbind(source: typeof FASTElement & HTMLElement): void;
|
|
38
|
+
/**
|
|
39
|
+
* The behavior needs to operate on element instances but elements might share a behavior instance.
|
|
40
|
+
* To ensure proper attachment / detachment per instance, we construct a listener for
|
|
41
|
+
* each bind invocation and cache the listeners by element reference.
|
|
42
|
+
*/
|
|
43
|
+
private listenerCache;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A behavior to add or remove a stylesheet from an element based on a media query. The behavior ensures that
|
|
47
|
+
* styles are applied while the a query matches the environment and that styles are not applied if the query does
|
|
48
|
+
* not match the environment.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export declare class MatchMediaStyleSheetBehavior extends MatchMediaBehavior {
|
|
53
|
+
/**
|
|
54
|
+
* The media query that the behavior operates on.
|
|
55
|
+
*/
|
|
56
|
+
readonly query: MediaQueryList;
|
|
57
|
+
/**
|
|
58
|
+
* The styles object to be managed by the behavior.
|
|
59
|
+
*/
|
|
60
|
+
readonly styles: ElementStyles;
|
|
61
|
+
/**
|
|
62
|
+
* Constructs a {@link MatchMediaStyleSheetBehavior} instance.
|
|
63
|
+
* @param query - The media query to operate from.
|
|
64
|
+
* @param styles - The styles to coordinate with the query.
|
|
65
|
+
*/
|
|
66
|
+
constructor(query: MediaQueryList, styles: ElementStyles);
|
|
67
|
+
/**
|
|
68
|
+
* Defines a function to construct {@link MatchMediaStyleSheetBehavior | MatchMediaStyleSheetBehaviors} for
|
|
69
|
+
* a provided query.
|
|
70
|
+
* @param query - The media query to operate from.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
* @example
|
|
74
|
+
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* import { css } from "@ni/fast-element";
|
|
77
|
+
* import { MatchMediaStyleSheetBehavior } from "@ni/fast-foundation";
|
|
78
|
+
*
|
|
79
|
+
* const landscapeBehavior = MatchMediaStyleSheetBehavior.with(
|
|
80
|
+
* window.matchMedia("(orientation: landscape)")
|
|
81
|
+
* );
|
|
82
|
+
* const styles = css`
|
|
83
|
+
* :host {
|
|
84
|
+
* width: 200px;
|
|
85
|
+
* height: 400px;
|
|
86
|
+
* }
|
|
87
|
+
* `
|
|
88
|
+
* .withBehaviors(landscapeBehavior(css`
|
|
89
|
+
* :host {
|
|
90
|
+
* width: 400px;
|
|
91
|
+
* height: 200px;
|
|
92
|
+
* }
|
|
93
|
+
* `))
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
static with(query: MediaQueryList): (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
|
|
97
|
+
/**
|
|
98
|
+
* Constructs a match-media listener for a provided element.
|
|
99
|
+
* @param source - the element for which to attach or detach styles.
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
protected constructListener(source: typeof FASTElement): MediaQueryListListener;
|
|
103
|
+
/**
|
|
104
|
+
* Unbinds the behavior from the element.
|
|
105
|
+
* @param source - The element for which the behavior is unbinding.
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
unbind(source: typeof FASTElement & HTMLElement): void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* This can be used to construct a behavior to apply a forced-colors only stylesheet.
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
export declare const forcedColorsStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
|
|
115
|
+
/**
|
|
116
|
+
* This can be used to construct a behavior to apply a prefers color scheme: dark only stylesheet.
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
export declare const darkModeStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
|
|
120
|
+
/**
|
|
121
|
+
* This can be used to construct a behavior to apply a prefers color scheme: light only stylesheet.
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export declare const lightModeStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Behavior, ElementStyles, FASTElement } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* A behavior to add or remove a stylesheet from an element based on a property. The behavior ensures that
|
|
4
|
+
* styles are applied while the property matches and that styles are not applied if the property does
|
|
5
|
+
* not match.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class PropertyStyleSheetBehavior implements Behavior {
|
|
10
|
+
private propertyName;
|
|
11
|
+
private value;
|
|
12
|
+
private styles;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a {@link PropertyStyleSheetBehavior} instance.
|
|
15
|
+
* @param propertyName - The property name to operate from.
|
|
16
|
+
* @param value - The property value to operate from.
|
|
17
|
+
* @param styles - The styles to coordinate with the property.
|
|
18
|
+
*/
|
|
19
|
+
constructor(propertyName: string, value: any, styles: ElementStyles);
|
|
20
|
+
/**
|
|
21
|
+
* Binds the behavior to the element.
|
|
22
|
+
* @param elementInstance - The element for which the property is applied.
|
|
23
|
+
*/
|
|
24
|
+
bind(elementInstance: FASTElement): void;
|
|
25
|
+
/**
|
|
26
|
+
* Unbinds the behavior from the element.
|
|
27
|
+
* @param source - The element for which the behavior is unbinding.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
unbind(source: typeof FASTElement & HTMLElement): void;
|
|
31
|
+
/**
|
|
32
|
+
* Change event for the provided element.
|
|
33
|
+
* @param source - the element for which to attach or detach styles.
|
|
34
|
+
* @param key - the key to lookup to know if the element already has the styles
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
handleChange(source: FASTElement, key: string): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export interface ContentRect {
|
|
3
|
+
height: number;
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
width: number;
|
|
7
|
+
}
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare const contentRect: (target: Element) => Readonly<ContentRect>;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare class ResizeObserverEntry {
|
|
12
|
+
readonly target: Element;
|
|
13
|
+
readonly contentRect: ContentRect;
|
|
14
|
+
constructor(target: Element);
|
|
15
|
+
}
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare class ResizeObserverClassDefinition {
|
|
18
|
+
constructor(callback: ResizeObserverCallback);
|
|
19
|
+
observe(target: Element): void;
|
|
20
|
+
unobserve(target: Element): void;
|
|
21
|
+
disconnect(): void;
|
|
22
|
+
}
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare type ResizeObserverCallback = (entries: ResizeObserverEntry[], observer: ResizeObserverClassDefinition) => void;
|
|
25
|
+
/** @internal */
|
|
26
|
+
export type ConstructibleResizeObserver = new (callback: ResizeObserverCallback) => ResizeObserverClassDefinition;
|
|
27
|
+
declare global {
|
|
28
|
+
interface WindowWithResizeObserver extends Window {
|
|
29
|
+
ResizeObserver: ConstructibleResizeObserver;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getRootActiveElement(element: Element): Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define all possible CSS display values.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export type CSSDisplayPropertyValue = "block" | "contents" | "flex" | "grid" | "inherit" | "initial" | "inline" | "inline-block" | "inline-flex" | "inline-grid" | "inline-table" | "list-item" | "none" | "run-in" | "table" | "table-caption" | "table-cell" | "table-column" | "table-column-group" | "table-footer-group" | "table-header-group" | "table-row" | "table-row-group";
|
|
6
|
+
/**
|
|
7
|
+
* A CSS fragment to set `display: none;` when the host is hidden using the [hidden] attribute.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare const hidden = ":host([hidden]){display:none}";
|
|
11
|
+
/**
|
|
12
|
+
* Applies a CSS display property.
|
|
13
|
+
* Also adds CSS rules to not display the element when the [hidden] attribute is applied to the element.
|
|
14
|
+
* @param display - The CSS display property value
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare function display(displayValue: CSSDisplayPropertyValue): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The string representing the focus selector to be used. Value
|
|
3
|
+
* will be "focus-visible" when https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
|
|
4
|
+
* is supported and "focus" when it is not.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const focusVisible: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* a method to filter out any whitespace _only_ nodes, to be used inside a template
|
|
3
|
+
* @param value - The Node that is being inspected
|
|
4
|
+
* @param index - The index of the node within the array
|
|
5
|
+
* @param array - The Node array that is being filtered
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare function whitespaceFilter(value: Node, index: number, array: Node[]): boolean;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable } from "@ni/fast-element";
|
|
3
|
+
import { keyArrowDown, keyArrowUp, keyEnd, keyHome, wrapInBounds, } from "@ni/fast-web-utilities";
|
|
4
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
5
|
+
import { AccordionItem } from "../accordion-item/accordion-item.js";
|
|
6
|
+
/**
|
|
7
|
+
* Expand mode for {@link Accordion}
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export const AccordionExpandMode = {
|
|
11
|
+
/**
|
|
12
|
+
* Designates only a single {@link @ni/fast-foundation#(AccordionItem:class) } can be open a time.
|
|
13
|
+
*/
|
|
14
|
+
single: "single",
|
|
15
|
+
/**
|
|
16
|
+
* Designates multiple {@link @ni/fast-foundation#(AccordionItem:class) | AccordionItems} can be open simultaneously.
|
|
17
|
+
*/
|
|
18
|
+
multi: "multi",
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* An Accordion Custom HTML Element
|
|
22
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-practices-1.1/#accordion | ARIA Accordion}.
|
|
23
|
+
*
|
|
24
|
+
* @fires change - Fires a custom 'change' event when the active item changes
|
|
25
|
+
* @csspart item - The slot for the accordion items
|
|
26
|
+
* @public
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Designed to be used with {@link @ni/fast-foundation#accordionTemplate} and {@link @ni/fast-foundation#(AccordionItem:class)}.
|
|
30
|
+
*/
|
|
31
|
+
export class Accordion extends FoundationElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/**
|
|
35
|
+
* Controls the expand mode of the Accordion, either allowing
|
|
36
|
+
* single or multiple item expansion.
|
|
37
|
+
* @public
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* HTML attribute: expand-mode
|
|
41
|
+
*/
|
|
42
|
+
this.expandmode = AccordionExpandMode.multi;
|
|
43
|
+
this.activeItemIndex = 0;
|
|
44
|
+
this.change = () => {
|
|
45
|
+
this.$emit("change", this.activeid);
|
|
46
|
+
};
|
|
47
|
+
this.setItems = () => {
|
|
48
|
+
var _a;
|
|
49
|
+
if (this.accordionItems.length === 0) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.accordionIds = this.getItemIds();
|
|
53
|
+
this.accordionItems.forEach((item, index) => {
|
|
54
|
+
if (item instanceof AccordionItem) {
|
|
55
|
+
item.addEventListener("change", this.activeItemChange);
|
|
56
|
+
if (this.isSingleExpandMode()) {
|
|
57
|
+
this.activeItemIndex !== index
|
|
58
|
+
? (item.expanded = false)
|
|
59
|
+
: (item.expanded = true);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const itemId = this.accordionIds[index];
|
|
63
|
+
item.setAttribute("id", typeof itemId !== "string" ? `accordion-${index + 1}` : itemId);
|
|
64
|
+
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
65
|
+
item.addEventListener("keydown", this.handleItemKeyDown);
|
|
66
|
+
item.addEventListener("focus", this.handleItemFocus);
|
|
67
|
+
});
|
|
68
|
+
if (this.isSingleExpandMode()) {
|
|
69
|
+
const expandedItem = (_a = this.findExpandedItem()) !== null && _a !== void 0 ? _a : this.accordionItems[0];
|
|
70
|
+
expandedItem.setAttribute("aria-disabled", "true");
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
this.removeItemListeners = (oldValue) => {
|
|
74
|
+
oldValue.forEach((item, index) => {
|
|
75
|
+
item.removeEventListener("change", this.activeItemChange);
|
|
76
|
+
item.removeEventListener("keydown", this.handleItemKeyDown);
|
|
77
|
+
item.removeEventListener("focus", this.handleItemFocus);
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
this.activeItemChange = (event) => {
|
|
81
|
+
if (event.defaultPrevented || event.target !== event.currentTarget) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
const selectedItem = event.target;
|
|
86
|
+
this.activeid = selectedItem.getAttribute("id");
|
|
87
|
+
if (this.isSingleExpandMode()) {
|
|
88
|
+
this.resetItems();
|
|
89
|
+
selectedItem.expanded = true;
|
|
90
|
+
selectedItem.setAttribute("aria-disabled", "true");
|
|
91
|
+
this.accordionItems.forEach((item) => {
|
|
92
|
+
if (!item.hasAttribute("disabled") && item.id !== this.activeid) {
|
|
93
|
+
item.removeAttribute("aria-disabled");
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
this.activeItemIndex = Array.from(this.accordionItems).indexOf(selectedItem);
|
|
98
|
+
this.change();
|
|
99
|
+
};
|
|
100
|
+
this.handleItemKeyDown = (event) => {
|
|
101
|
+
// only handle the keydown if the event target is the accordion item
|
|
102
|
+
// prevents arrow keys from moving focus to accordion headers when focus is on accordion item panel content
|
|
103
|
+
if (event.target !== event.currentTarget) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.accordionIds = this.getItemIds();
|
|
107
|
+
switch (event.key) {
|
|
108
|
+
case keyArrowUp:
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
this.adjust(-1);
|
|
111
|
+
break;
|
|
112
|
+
case keyArrowDown:
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
this.adjust(1);
|
|
115
|
+
break;
|
|
116
|
+
case keyHome:
|
|
117
|
+
this.activeItemIndex = 0;
|
|
118
|
+
this.focusItem();
|
|
119
|
+
break;
|
|
120
|
+
case keyEnd:
|
|
121
|
+
this.activeItemIndex = this.accordionItems.length - 1;
|
|
122
|
+
this.focusItem();
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
this.handleItemFocus = (event) => {
|
|
127
|
+
// update the active item index if the focus moves to an accordion item via a different method other than the up and down arrow key actions
|
|
128
|
+
// only do so if the focus is actually on the accordion item and not on any of its children
|
|
129
|
+
if (event.target === event.currentTarget) {
|
|
130
|
+
const focusedItem = event.target;
|
|
131
|
+
const focusedIndex = (this.activeItemIndex = Array.from(this.accordionItems).indexOf(focusedItem));
|
|
132
|
+
if (this.activeItemIndex !== focusedIndex && focusedIndex !== -1) {
|
|
133
|
+
this.activeItemIndex = focusedIndex;
|
|
134
|
+
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
|
+
accordionItemsChanged(oldValue, newValue) {
|
|
143
|
+
if (this.$fastController.isConnected) {
|
|
144
|
+
this.removeItemListeners(oldValue);
|
|
145
|
+
this.setItems();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
findExpandedItem() {
|
|
149
|
+
for (let item = 0; item < this.accordionItems.length; item++) {
|
|
150
|
+
if (this.accordionItems[item].getAttribute("expanded") === "true") {
|
|
151
|
+
return this.accordionItems[item];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
resetItems() {
|
|
157
|
+
this.accordionItems.forEach((item, index) => {
|
|
158
|
+
item.expanded = false;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
getItemIds() {
|
|
162
|
+
return this.accordionItems.map((accordionItem) => {
|
|
163
|
+
return accordionItem.getAttribute("id");
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
isSingleExpandMode() {
|
|
167
|
+
return this.expandmode === AccordionExpandMode.single;
|
|
168
|
+
}
|
|
169
|
+
adjust(adjustment) {
|
|
170
|
+
this.activeItemIndex = wrapInBounds(0, this.accordionItems.length - 1, this.activeItemIndex + adjustment);
|
|
171
|
+
this.focusItem();
|
|
172
|
+
}
|
|
173
|
+
focusItem() {
|
|
174
|
+
const element = this.accordionItems[this.activeItemIndex];
|
|
175
|
+
if (element instanceof AccordionItem) {
|
|
176
|
+
element.expandbutton.focus();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
__decorate([
|
|
181
|
+
attr({ attribute: "expand-mode" })
|
|
182
|
+
], Accordion.prototype, "expandmode", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
observable
|
|
185
|
+
], Accordion.prototype, "accordionItems", void 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { elements, html, slotted } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* The template for the {@link @ni/fast-foundation#Accordion} component.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export const accordionTemplate = (context, definition) => /* TODO: deprecate slot name `item` to only support default slot https://github.com/microsoft/fast/issues/5515 */ html `
|
|
7
|
+
<template>
|
|
8
|
+
<slot ${slotted({ property: "accordionItems", filter: elements() })}></slot>
|
|
9
|
+
<slot name="item" part="item" ${slotted("accordionItems")}></slot>
|
|
10
|
+
</template>
|
|
11
|
+
`;
|