@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,79 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable } from "@ni/fast-element";
|
|
3
|
+
import { keyEnter, keySpace } from "@ni/fast-web-utilities";
|
|
4
|
+
import { FormAssociatedSwitch } from "./switch.form-associated.js";
|
|
5
|
+
/**
|
|
6
|
+
* A Switch Custom HTML Element.
|
|
7
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
|
|
8
|
+
*
|
|
9
|
+
* @slot - The deafult slot for the label
|
|
10
|
+
* @slot checked-message - The message when in a checked state
|
|
11
|
+
* @slot unchecked-message - The message when in an unchecked state
|
|
12
|
+
* @csspart label - The label
|
|
13
|
+
* @csspart switch - The element representing the switch, which wraps the indicator
|
|
14
|
+
* @csspart status-message - The wrapper for the status messages
|
|
15
|
+
* @csspart checked-message - The checked message
|
|
16
|
+
* @csspart unchecked-message - The unchecked message
|
|
17
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export class Switch extends FormAssociatedSwitch {
|
|
22
|
+
readOnlyChanged() {
|
|
23
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
24
|
+
this.proxy.readOnly = this.readOnly;
|
|
25
|
+
}
|
|
26
|
+
this.readOnly
|
|
27
|
+
? this.classList.add("readonly")
|
|
28
|
+
: this.classList.remove("readonly");
|
|
29
|
+
}
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
/**
|
|
33
|
+
* The element's value to be included in form submission when checked.
|
|
34
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
this.initialValue = "on";
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
this.keypressHandler = (e) => {
|
|
43
|
+
if (this.readOnly) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
switch (e.key) {
|
|
47
|
+
case keyEnter:
|
|
48
|
+
case keySpace:
|
|
49
|
+
this.checked = !this.checked;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
this.clickHandler = (e) => {
|
|
57
|
+
if (!this.disabled && !this.readOnly) {
|
|
58
|
+
this.checked = !this.checked;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
checkedChanged(prev, next) {
|
|
67
|
+
super.checkedChanged(prev, next);
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated - this behavior already exists in the template and should not exist in the class.
|
|
70
|
+
*/
|
|
71
|
+
this.checked ? this.classList.add("checked") : this.classList.remove("checked");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
__decorate([
|
|
75
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
76
|
+
], Switch.prototype, "readOnly", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
observable
|
|
79
|
+
], Switch.prototype, "defaultSlottedNodes", void 0);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { html, slotted } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* The template for the {@link @ni/fast-foundation#(Switch:class)} component.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export const switchTemplate = (context, definition) => html `
|
|
7
|
+
<template
|
|
8
|
+
role="switch"
|
|
9
|
+
aria-checked="${x => x.checked}"
|
|
10
|
+
aria-disabled="${x => x.disabled}"
|
|
11
|
+
aria-readonly="${x => x.readOnly}"
|
|
12
|
+
tabindex="${x => (x.disabled ? null : 0)}"
|
|
13
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
14
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
15
|
+
class="${x => (x.checked ? "checked" : "")}"
|
|
16
|
+
>
|
|
17
|
+
<label
|
|
18
|
+
part="label"
|
|
19
|
+
class="${x => x.defaultSlottedNodes && x.defaultSlottedNodes.length
|
|
20
|
+
? "label"
|
|
21
|
+
: "label label__hidden"}"
|
|
22
|
+
>
|
|
23
|
+
<slot ${slotted("defaultSlottedNodes")}></slot>
|
|
24
|
+
</label>
|
|
25
|
+
<div part="switch" class="switch">
|
|
26
|
+
<slot name="switch">${definition.switch || ""}</slot>
|
|
27
|
+
</div>
|
|
28
|
+
<span class="status-message" part="status-message">
|
|
29
|
+
<span class="checked-message" part="checked-message">
|
|
30
|
+
<slot name="checked-message"></slot>
|
|
31
|
+
</span>
|
|
32
|
+
<span class="unchecked-message" part="unchecked-message">
|
|
33
|
+
<slot name="unchecked-message"></slot>
|
|
34
|
+
</span>
|
|
35
|
+
</span>
|
|
36
|
+
</template>
|
|
37
|
+
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr } from "@ni/fast-element";
|
|
3
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
4
|
+
/**
|
|
5
|
+
* A Tab Component to be used with {@link @ni/fast-foundation#(Tabs:class)}
|
|
6
|
+
*
|
|
7
|
+
* @slot - The default slot for the tab content
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export class Tab extends FoundationElement {
|
|
12
|
+
}
|
|
13
|
+
__decorate([
|
|
14
|
+
attr({ mode: "boolean" })
|
|
15
|
+
], Tab.prototype, "disabled", void 0);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { html } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* The template for the {@link @ni/fast-foundation#Tab} component.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export const tabTemplate = (context, definition) => html `
|
|
7
|
+
<template slot="tab" role="tab" aria-disabled="${x => x.disabled}">
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</template>
|
|
10
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A TabPanel Component to be used with {@link @ni/fast-foundation#(Tabs:class)}
|
|
4
|
+
*
|
|
5
|
+
* @slot - The default slot for the tabpanel content
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export class TabPanel extends FoundationElement {
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { html } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* The template for the {@link @ni/fast-foundation#TabPanel} component.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export const tabPanelTemplate = (context, definition) => html `
|
|
7
|
+
<template slot="tabpanel" role="tabpanel">
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</template>
|
|
10
|
+
`;
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable } from "@ni/fast-element";
|
|
3
|
+
import { keyArrowDown, keyArrowLeft, keyArrowRight, keyArrowUp, keyEnd, keyHome, limit, uniqueId, } from "@ni/fast-web-utilities";
|
|
4
|
+
import { StartEnd } from "../patterns/start-end.js";
|
|
5
|
+
import { applyMixins } from "../utilities/apply-mixins.js";
|
|
6
|
+
import { FoundationElement, } from "../foundation-element/foundation-element.js";
|
|
7
|
+
/**
|
|
8
|
+
* The orientation of the {@link @ni/fast-foundation#(Tabs:class)} component
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const TabsOrientation = {
|
|
12
|
+
vertical: "vertical",
|
|
13
|
+
horizontal: "horizontal",
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A Tabs Custom HTML Element.
|
|
17
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#tablist | ARIA tablist }.
|
|
18
|
+
*
|
|
19
|
+
* @slot start - Content which can be provided before the tablist element
|
|
20
|
+
* @slot end - Content which can be provided after the tablist element
|
|
21
|
+
* @slot tab - The slot for tabs
|
|
22
|
+
* @slot tabpanel - The slot for tabpanels
|
|
23
|
+
* @csspart tablist - The element wrapping for the tabs
|
|
24
|
+
* @csspart tab - The tab slot
|
|
25
|
+
* @csspart activeIndicator - The visual indicator
|
|
26
|
+
* @csspart tabpanel - The tabpanel slot
|
|
27
|
+
* @fires change - Fires a custom 'change' event when a tab is clicked or during keyboard navigation
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export class Tabs extends FoundationElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/**
|
|
35
|
+
* The orientation
|
|
36
|
+
* @public
|
|
37
|
+
* @remarks
|
|
38
|
+
* HTML Attribute: orientation
|
|
39
|
+
*/
|
|
40
|
+
this.orientation = TabsOrientation.horizontal;
|
|
41
|
+
/**
|
|
42
|
+
* Whether or not to show the active indicator
|
|
43
|
+
* @public
|
|
44
|
+
* @remarks
|
|
45
|
+
* HTML Attribute: activeindicator
|
|
46
|
+
*/
|
|
47
|
+
this.activeindicator = true;
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
this.showActiveIndicator = true;
|
|
52
|
+
this.prevActiveTabIndex = 0;
|
|
53
|
+
this.activeTabIndex = 0;
|
|
54
|
+
this.ticking = false;
|
|
55
|
+
this.change = () => {
|
|
56
|
+
this.$emit("change", this.activetab);
|
|
57
|
+
};
|
|
58
|
+
this.isDisabledElement = (el) => {
|
|
59
|
+
return el.getAttribute("aria-disabled") === "true";
|
|
60
|
+
};
|
|
61
|
+
this.isHiddenElement = (el) => {
|
|
62
|
+
return el.hasAttribute("hidden");
|
|
63
|
+
};
|
|
64
|
+
this.isFocusableElement = (el) => {
|
|
65
|
+
return !this.isDisabledElement(el) && !this.isHiddenElement(el);
|
|
66
|
+
};
|
|
67
|
+
this.setTabs = () => {
|
|
68
|
+
const gridHorizontalProperty = "gridColumn";
|
|
69
|
+
const gridVerticalProperty = "gridRow";
|
|
70
|
+
const gridProperty = this.isHorizontal()
|
|
71
|
+
? gridHorizontalProperty
|
|
72
|
+
: gridVerticalProperty;
|
|
73
|
+
this.activeTabIndex = this.getActiveIndex();
|
|
74
|
+
this.showActiveIndicator = false;
|
|
75
|
+
this.tabs.forEach((tab, index) => {
|
|
76
|
+
if (tab.slot === "tab") {
|
|
77
|
+
const isActiveTab = this.activeTabIndex === index && this.isFocusableElement(tab);
|
|
78
|
+
if (this.activeindicator && this.isFocusableElement(tab)) {
|
|
79
|
+
this.showActiveIndicator = true;
|
|
80
|
+
}
|
|
81
|
+
const tabId = this.tabIds[index];
|
|
82
|
+
const tabpanelId = this.tabpanelIds[index];
|
|
83
|
+
tab.setAttribute("id", tabId);
|
|
84
|
+
tab.setAttribute("aria-selected", isActiveTab ? "true" : "false");
|
|
85
|
+
tab.setAttribute("aria-controls", tabpanelId);
|
|
86
|
+
tab.addEventListener("click", this.handleTabClick);
|
|
87
|
+
tab.addEventListener("keydown", this.handleTabKeyDown);
|
|
88
|
+
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
89
|
+
if (isActiveTab) {
|
|
90
|
+
this.activetab = tab;
|
|
91
|
+
this.activeid = tabId;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// If the original property isn't emptied out,
|
|
95
|
+
// the next set will morph into a grid-area style setting that is not what we want
|
|
96
|
+
tab.style[gridHorizontalProperty] = "";
|
|
97
|
+
tab.style[gridVerticalProperty] = "";
|
|
98
|
+
tab.style[gridProperty] = `${index + 1}`;
|
|
99
|
+
!this.isHorizontal()
|
|
100
|
+
? tab.classList.add("vertical")
|
|
101
|
+
: tab.classList.remove("vertical");
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
this.setTabPanels = () => {
|
|
105
|
+
this.tabpanels.forEach((tabpanel, index) => {
|
|
106
|
+
const tabId = this.tabIds[index];
|
|
107
|
+
const tabpanelId = this.tabpanelIds[index];
|
|
108
|
+
tabpanel.setAttribute("id", tabpanelId);
|
|
109
|
+
tabpanel.setAttribute("aria-labelledby", tabId);
|
|
110
|
+
this.activeTabIndex !== index
|
|
111
|
+
? tabpanel.setAttribute("hidden", "")
|
|
112
|
+
: tabpanel.removeAttribute("hidden");
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
this.handleTabClick = (event) => {
|
|
116
|
+
const selectedTab = event.currentTarget;
|
|
117
|
+
if (selectedTab.nodeType === 1 && this.isFocusableElement(selectedTab)) {
|
|
118
|
+
this.prevActiveTabIndex = this.activeTabIndex;
|
|
119
|
+
this.activeTabIndex = this.tabs.indexOf(selectedTab);
|
|
120
|
+
this.setComponent();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
this.handleTabKeyDown = (event) => {
|
|
124
|
+
if (this.isHorizontal()) {
|
|
125
|
+
switch (event.key) {
|
|
126
|
+
case keyArrowLeft:
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
this.adjustBackward(event);
|
|
129
|
+
break;
|
|
130
|
+
case keyArrowRight:
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
this.adjustForward(event);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
switch (event.key) {
|
|
138
|
+
case keyArrowUp:
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
this.adjustBackward(event);
|
|
141
|
+
break;
|
|
142
|
+
case keyArrowDown:
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
this.adjustForward(event);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
switch (event.key) {
|
|
149
|
+
case keyHome:
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
this.adjust(-this.activeTabIndex);
|
|
152
|
+
break;
|
|
153
|
+
case keyEnd:
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
this.adjustForward = (e) => {
|
|
160
|
+
const group = this.tabs;
|
|
161
|
+
let index = 0;
|
|
162
|
+
index = this.activetab ? group.indexOf(this.activetab) + 1 : 1;
|
|
163
|
+
if (index === group.length) {
|
|
164
|
+
index = 0;
|
|
165
|
+
}
|
|
166
|
+
while (index < group.length && group.length > 1) {
|
|
167
|
+
if (this.isFocusableElement(group[index])) {
|
|
168
|
+
this.moveToTabByIndex(group, index);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
else if (this.activetab && index === group.indexOf(this.activetab)) {
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
else if (index + 1 >= group.length) {
|
|
175
|
+
index = 0;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
index += 1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
this.adjustBackward = (e) => {
|
|
183
|
+
const group = this.tabs;
|
|
184
|
+
let index = 0;
|
|
185
|
+
index = this.activetab ? group.indexOf(this.activetab) - 1 : 0;
|
|
186
|
+
index = index < 0 ? group.length - 1 : index;
|
|
187
|
+
while (index >= 0 && group.length > 1) {
|
|
188
|
+
if (this.isFocusableElement(group[index])) {
|
|
189
|
+
this.moveToTabByIndex(group, index);
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
else if (index - 1 < 0) {
|
|
193
|
+
index = group.length - 1;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
index -= 1;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
this.moveToTabByIndex = (group, index) => {
|
|
201
|
+
const tab = group[index];
|
|
202
|
+
this.activetab = tab;
|
|
203
|
+
this.prevActiveTabIndex = this.activeTabIndex;
|
|
204
|
+
this.activeTabIndex = index;
|
|
205
|
+
tab.focus();
|
|
206
|
+
this.setComponent();
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
orientationChanged() {
|
|
213
|
+
if (this.$fastController.isConnected) {
|
|
214
|
+
this.setTabs();
|
|
215
|
+
this.setTabPanels();
|
|
216
|
+
this.handleActiveIndicatorPosition();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
activeidChanged(oldValue, newValue) {
|
|
223
|
+
if (this.$fastController.isConnected &&
|
|
224
|
+
this.tabs.length <= this.tabpanels.length) {
|
|
225
|
+
this.prevActiveTabIndex = this.tabs.findIndex((item) => item.id === oldValue);
|
|
226
|
+
this.setTabs();
|
|
227
|
+
this.setTabPanels();
|
|
228
|
+
this.handleActiveIndicatorPosition();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* @internal
|
|
233
|
+
*/
|
|
234
|
+
tabsChanged() {
|
|
235
|
+
if (this.$fastController.isConnected &&
|
|
236
|
+
this.tabs.length <= this.tabpanels.length) {
|
|
237
|
+
this.tabIds = this.getTabIds();
|
|
238
|
+
this.tabpanelIds = this.getTabPanelIds();
|
|
239
|
+
this.setTabs();
|
|
240
|
+
this.setTabPanels();
|
|
241
|
+
this.handleActiveIndicatorPosition();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
tabpanelsChanged() {
|
|
248
|
+
if (this.$fastController.isConnected &&
|
|
249
|
+
this.tabpanels.length <= this.tabs.length) {
|
|
250
|
+
this.tabIds = this.getTabIds();
|
|
251
|
+
this.tabpanelIds = this.getTabPanelIds();
|
|
252
|
+
this.setTabs();
|
|
253
|
+
this.setTabPanels();
|
|
254
|
+
this.handleActiveIndicatorPosition();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
getActiveIndex() {
|
|
258
|
+
const id = this.activeid;
|
|
259
|
+
if (id !== undefined) {
|
|
260
|
+
return this.tabIds.indexOf(this.activeid) === -1
|
|
261
|
+
? 0
|
|
262
|
+
: this.tabIds.indexOf(this.activeid);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
return 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
getTabIds() {
|
|
269
|
+
return this.tabs.map((tab) => {
|
|
270
|
+
var _a;
|
|
271
|
+
return (_a = tab.getAttribute("id")) !== null && _a !== void 0 ? _a : `tab-${uniqueId()}`;
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
getTabPanelIds() {
|
|
275
|
+
return this.tabpanels.map((tabPanel) => {
|
|
276
|
+
var _a;
|
|
277
|
+
return (_a = tabPanel.getAttribute("id")) !== null && _a !== void 0 ? _a : `panel-${uniqueId()}`;
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
setComponent() {
|
|
281
|
+
if (this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
282
|
+
this.activeid = this.tabIds[this.activeTabIndex];
|
|
283
|
+
this.focusTab();
|
|
284
|
+
this.change();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
isHorizontal() {
|
|
288
|
+
return this.orientation === TabsOrientation.horizontal;
|
|
289
|
+
}
|
|
290
|
+
handleActiveIndicatorPosition() {
|
|
291
|
+
// Ignore if we click twice on the same tab
|
|
292
|
+
if (this.showActiveIndicator &&
|
|
293
|
+
this.activeindicator &&
|
|
294
|
+
this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
295
|
+
if (this.ticking) {
|
|
296
|
+
this.ticking = false;
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
this.ticking = true;
|
|
300
|
+
this.animateActiveIndicator();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
animateActiveIndicator() {
|
|
305
|
+
this.ticking = true;
|
|
306
|
+
const gridProperty = this.isHorizontal() ? "gridColumn" : "gridRow";
|
|
307
|
+
const translateProperty = this.isHorizontal()
|
|
308
|
+
? "translateX"
|
|
309
|
+
: "translateY";
|
|
310
|
+
const offsetProperty = this.isHorizontal() ? "offsetLeft" : "offsetTop";
|
|
311
|
+
const prev = this.activeIndicatorRef[offsetProperty];
|
|
312
|
+
this.activeIndicatorRef.style[gridProperty] = `${this.activeTabIndex + 1}`;
|
|
313
|
+
const next = this.activeIndicatorRef[offsetProperty];
|
|
314
|
+
this.activeIndicatorRef.style[gridProperty] = `${this.prevActiveTabIndex + 1}`;
|
|
315
|
+
const dif = next - prev;
|
|
316
|
+
this.activeIndicatorRef.style.transform = `${translateProperty}(${dif}px)`;
|
|
317
|
+
this.activeIndicatorRef.classList.add("activeIndicatorTransition");
|
|
318
|
+
this.activeIndicatorRef.addEventListener("transitionend", () => {
|
|
319
|
+
this.ticking = false;
|
|
320
|
+
this.activeIndicatorRef.style[gridProperty] = `${this.activeTabIndex + 1}`;
|
|
321
|
+
this.activeIndicatorRef.style.transform = `${translateProperty}(0px)`;
|
|
322
|
+
this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* The adjust method for FASTTabs
|
|
327
|
+
* @public
|
|
328
|
+
* @remarks
|
|
329
|
+
* This method allows the active index to be adjusted by numerical increments
|
|
330
|
+
*/
|
|
331
|
+
adjust(adjustment) {
|
|
332
|
+
const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
|
|
333
|
+
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
334
|
+
const nextTabIndex = limit(0, focusableTabs.length - 1, currentActiveTabIndex + adjustment);
|
|
335
|
+
// the index of the next focusable tab within the context of all available tabs
|
|
336
|
+
const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
|
|
337
|
+
if (nextIndex > -1) {
|
|
338
|
+
this.moveToTabByIndex(this.tabs, nextIndex);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
focusTab() {
|
|
342
|
+
this.tabs[this.activeTabIndex].focus();
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* @internal
|
|
346
|
+
*/
|
|
347
|
+
connectedCallback() {
|
|
348
|
+
super.connectedCallback();
|
|
349
|
+
this.tabIds = this.getTabIds();
|
|
350
|
+
this.tabpanelIds = this.getTabPanelIds();
|
|
351
|
+
this.activeTabIndex = this.getActiveIndex();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
__decorate([
|
|
355
|
+
attr
|
|
356
|
+
], Tabs.prototype, "orientation", void 0);
|
|
357
|
+
__decorate([
|
|
358
|
+
attr
|
|
359
|
+
], Tabs.prototype, "activeid", void 0);
|
|
360
|
+
__decorate([
|
|
361
|
+
observable
|
|
362
|
+
], Tabs.prototype, "tabs", void 0);
|
|
363
|
+
__decorate([
|
|
364
|
+
observable
|
|
365
|
+
], Tabs.prototype, "tabpanels", void 0);
|
|
366
|
+
__decorate([
|
|
367
|
+
attr({ mode: "boolean" })
|
|
368
|
+
], Tabs.prototype, "activeindicator", void 0);
|
|
369
|
+
__decorate([
|
|
370
|
+
observable
|
|
371
|
+
], Tabs.prototype, "activeIndicatorRef", void 0);
|
|
372
|
+
__decorate([
|
|
373
|
+
observable
|
|
374
|
+
], Tabs.prototype, "showActiveIndicator", void 0);
|
|
375
|
+
applyMixins(Tabs, StartEnd);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { html, ref, slotted, when } from "@ni/fast-element";
|
|
2
|
+
import { endSlotTemplate, startSlotTemplate } from "../patterns/start-end.js";
|
|
3
|
+
/**
|
|
4
|
+
* The template for the {@link @ni/fast-foundation#(Tabs:class)} component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const tabsTemplate = (context, definition) => html `
|
|
8
|
+
<template class="${x => x.orientation}">
|
|
9
|
+
${startSlotTemplate(context, definition)}
|
|
10
|
+
<div class="tablist" part="tablist" role="tablist">
|
|
11
|
+
<slot class="tab" name="tab" part="tab" ${slotted("tabs")}></slot>
|
|
12
|
+
|
|
13
|
+
${when(x => x.showActiveIndicator, html `
|
|
14
|
+
<div
|
|
15
|
+
${ref("activeIndicatorRef")}
|
|
16
|
+
class="activeIndicator"
|
|
17
|
+
part="activeIndicator"
|
|
18
|
+
></div>
|
|
19
|
+
`)}
|
|
20
|
+
</div>
|
|
21
|
+
${endSlotTemplate(context, definition)}
|
|
22
|
+
<div class="tabpanel" part="tabpanel">
|
|
23
|
+
<slot name="tabpanel" ${slotted("tabpanels")}></slot>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
`;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { defaultExecutionContext, ViewTemplate, } from "@ni/fast-element";
|
|
3
|
+
import { DesignSystem } from "../design-system/index.js";
|
|
4
|
+
function findElement(view) {
|
|
5
|
+
let current = view.firstChild;
|
|
6
|
+
while (current !== null && current.nodeType !== 1) {
|
|
7
|
+
current = current.nextSibling;
|
|
8
|
+
}
|
|
9
|
+
return current;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a random, unique name suitable for use as a Custom Element name.
|
|
13
|
+
*/
|
|
14
|
+
export function uniqueElementName() {
|
|
15
|
+
return `fast-unique-${Math.random().toString(36).substring(7)}`;
|
|
16
|
+
}
|
|
17
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
18
|
+
function isElementRegistry(obj) {
|
|
19
|
+
return typeof obj.register === "function";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a test fixture suitable for testing custom elements, templates, and bindings.
|
|
23
|
+
* @param templateNameOrRegistry An HTML template or single element name to create the fixture for.
|
|
24
|
+
* @param options Enables customizing fixture creation behavior.
|
|
25
|
+
* @remarks
|
|
26
|
+
* Yields control to the caller one Microtask later, in order to
|
|
27
|
+
* ensure that the DOM has settled.
|
|
28
|
+
*/
|
|
29
|
+
export function fixture(templateNameOrRegistry, options = {}) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const document = options.document || globalThis.document;
|
|
32
|
+
const parent = options.parent || document.createElement("div");
|
|
33
|
+
const source = options.source || {};
|
|
34
|
+
const context = options.context || defaultExecutionContext;
|
|
35
|
+
if (typeof templateNameOrRegistry === "string") {
|
|
36
|
+
const html = `<${templateNameOrRegistry}></${templateNameOrRegistry}>`;
|
|
37
|
+
templateNameOrRegistry = new ViewTemplate(html, []);
|
|
38
|
+
}
|
|
39
|
+
else if (isElementRegistry(templateNameOrRegistry)) {
|
|
40
|
+
templateNameOrRegistry = [templateNameOrRegistry];
|
|
41
|
+
}
|
|
42
|
+
if (Array.isArray(templateNameOrRegistry)) {
|
|
43
|
+
const first = templateNameOrRegistry[0];
|
|
44
|
+
const ds = options.designSystem || DesignSystem.getOrCreate(parent);
|
|
45
|
+
let prefix = "";
|
|
46
|
+
ds.register(templateNameOrRegistry, {
|
|
47
|
+
register(container, context) {
|
|
48
|
+
prefix = context.elementPrefix;
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const elementName = `${prefix}-${first.definition.baseName}`;
|
|
52
|
+
const html = `<${elementName}></${elementName}>`;
|
|
53
|
+
templateNameOrRegistry = new ViewTemplate(html, []);
|
|
54
|
+
}
|
|
55
|
+
const view = templateNameOrRegistry.create();
|
|
56
|
+
const element = findElement(view);
|
|
57
|
+
let isConnected = false;
|
|
58
|
+
view.bind(source, context);
|
|
59
|
+
view.appendTo(parent);
|
|
60
|
+
customElements.upgrade(parent);
|
|
61
|
+
// Hook into the Microtask Queue to ensure the DOM is settled
|
|
62
|
+
// before yielding control to the caller.
|
|
63
|
+
yield Promise.resolve();
|
|
64
|
+
const connect = () => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
if (isConnected) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
isConnected = true;
|
|
69
|
+
document.body.appendChild(parent);
|
|
70
|
+
yield Promise.resolve();
|
|
71
|
+
});
|
|
72
|
+
const disconnect = () => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
if (!isConnected) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
isConnected = false;
|
|
77
|
+
document.body.removeChild(parent);
|
|
78
|
+
yield Promise.resolve();
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
document,
|
|
82
|
+
template: templateNameOrRegistry,
|
|
83
|
+
view,
|
|
84
|
+
parent,
|
|
85
|
+
element,
|
|
86
|
+
connect,
|
|
87
|
+
disconnect,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
/**
|
|
3
|
+
* Timeout for use in async tets.
|
|
4
|
+
*/
|
|
5
|
+
export function timeout(timeout = 0) {
|
|
6
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
window.setTimeout(() => {
|
|
9
|
+
resolve(void 0);
|
|
10
|
+
}, timeout);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
}
|