@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,150 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable } from "@ni/fast-element";
|
|
3
|
+
import { isHTMLElement } 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
|
+
* check if the item is a tree item
|
|
9
|
+
* @public
|
|
10
|
+
* @remarks
|
|
11
|
+
* determines if element is an HTMLElement and if it has the role treeitem
|
|
12
|
+
*/
|
|
13
|
+
export function isTreeItemElement(el) {
|
|
14
|
+
return isHTMLElement(el) && el.getAttribute("role") === "treeitem";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A Tree item Custom HTML Element.
|
|
18
|
+
*
|
|
19
|
+
* @slot start - Content which can be provided before the tree item content
|
|
20
|
+
* @slot end - Content which can be provided after the tree item content
|
|
21
|
+
* @slot - The default slot for tree item text content
|
|
22
|
+
* @slot item - The slot for tree items (fast tree items manage this assignment themselves)
|
|
23
|
+
* @slot expand-collapse-button - The expand/collapse button
|
|
24
|
+
* @csspart positioning-region - The element used to position the tree item content with exception of any child nodes
|
|
25
|
+
* @csspart content-region - The element containing the expand/collapse, start, and end slots
|
|
26
|
+
* @csspart items - The element wrapping any child items
|
|
27
|
+
* @csspart expand-collapse-button - The expand/collapse button
|
|
28
|
+
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
29
|
+
* @fires selected-change - Fires a custom 'selected-change' event when the selected state changes
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export class TreeItem extends FoundationElement {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
/**
|
|
37
|
+
* When true, the control will be appear expanded by user interaction.
|
|
38
|
+
* @public
|
|
39
|
+
* @remarks
|
|
40
|
+
* HTML Attribute: expanded
|
|
41
|
+
*/
|
|
42
|
+
this.expanded = false;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the item is focusable
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
this.focusable = false;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the tree is nested
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
this.isNestedItem = () => {
|
|
55
|
+
return isTreeItemElement(this.parentElement);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Handle expand button click
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
this.handleExpandCollapseButtonClick = (e) => {
|
|
63
|
+
if (!this.disabled && !e.defaultPrevented) {
|
|
64
|
+
this.expanded = !this.expanded;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Handle focus events
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
this.handleFocus = (e) => {
|
|
73
|
+
this.setAttribute("tabindex", "0");
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Handle blur events
|
|
77
|
+
*
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
this.handleBlur = (e) => {
|
|
81
|
+
this.setAttribute("tabindex", "-1");
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
expandedChanged() {
|
|
85
|
+
if (this.$fastController.isConnected) {
|
|
86
|
+
this.$emit("expanded-change", this);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
selectedChanged() {
|
|
90
|
+
if (this.$fastController.isConnected) {
|
|
91
|
+
this.$emit("selected-change", this);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
itemsChanged(oldValue, newValue) {
|
|
95
|
+
if (this.$fastController.isConnected) {
|
|
96
|
+
this.items.forEach((node) => {
|
|
97
|
+
if (isTreeItemElement(node)) {
|
|
98
|
+
// TODO: maybe not require it to be a TreeItem?
|
|
99
|
+
node.nested = true;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Places document focus on a tree item
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @param el - the element to focus
|
|
109
|
+
*/
|
|
110
|
+
static focusItem(el) {
|
|
111
|
+
el.focusable = true;
|
|
112
|
+
el.focus();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Gets number of children
|
|
116
|
+
*
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
childItemLength() {
|
|
120
|
+
const treeChildren = this.childItems.filter((item) => {
|
|
121
|
+
return isTreeItemElement(item);
|
|
122
|
+
});
|
|
123
|
+
return treeChildren ? treeChildren.length : 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
__decorate([
|
|
127
|
+
attr({ mode: "boolean" })
|
|
128
|
+
], TreeItem.prototype, "expanded", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
attr({ mode: "boolean" })
|
|
131
|
+
], TreeItem.prototype, "selected", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
attr({ mode: "boolean" })
|
|
134
|
+
], TreeItem.prototype, "disabled", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
observable
|
|
137
|
+
], TreeItem.prototype, "focusable", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
observable
|
|
140
|
+
], TreeItem.prototype, "childItems", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
observable
|
|
143
|
+
], TreeItem.prototype, "items", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
observable
|
|
146
|
+
], TreeItem.prototype, "nested", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
observable
|
|
149
|
+
], TreeItem.prototype, "renderCollapsedChildren", void 0);
|
|
150
|
+
applyMixins(TreeItem, StartEnd);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { children, elements, 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#(TreeItem:class)} component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const treeItemTemplate = (context, definition) => html `
|
|
8
|
+
<template
|
|
9
|
+
role="treeitem"
|
|
10
|
+
slot="${x => (x.isNestedItem() ? "item" : void 0)}"
|
|
11
|
+
tabindex="-1"
|
|
12
|
+
class="${x => (x.expanded ? "expanded" : "")} ${x => x.selected ? "selected" : ""} ${x => (x.nested ? "nested" : "")}
|
|
13
|
+
${x => (x.disabled ? "disabled" : "")}"
|
|
14
|
+
aria-expanded="${x => x.childItems && x.childItemLength() > 0 ? x.expanded : void 0}"
|
|
15
|
+
aria-selected="${x => x.selected}"
|
|
16
|
+
aria-disabled="${x => x.disabled}"
|
|
17
|
+
@focusin="${(x, c) => x.handleFocus(c.event)}"
|
|
18
|
+
@focusout="${(x, c) => x.handleBlur(c.event)}"
|
|
19
|
+
${children({
|
|
20
|
+
property: "childItems",
|
|
21
|
+
filter: elements(),
|
|
22
|
+
})}
|
|
23
|
+
>
|
|
24
|
+
<div class="positioning-region" part="positioning-region">
|
|
25
|
+
<div class="content-region" part="content-region">
|
|
26
|
+
${when(x => x.childItems && x.childItemLength() > 0, html `
|
|
27
|
+
<div
|
|
28
|
+
aria-hidden="true"
|
|
29
|
+
class="expand-collapse-button"
|
|
30
|
+
part="expand-collapse-button"
|
|
31
|
+
@click="${(x, c) => x.handleExpandCollapseButtonClick(c.event)}"
|
|
32
|
+
${ref("expandCollapseButton")}
|
|
33
|
+
>
|
|
34
|
+
<slot name="expand-collapse-glyph">
|
|
35
|
+
${definition.expandCollapseGlyph || ""}
|
|
36
|
+
</slot>
|
|
37
|
+
</div>
|
|
38
|
+
`)}
|
|
39
|
+
${startSlotTemplate(context, definition)}
|
|
40
|
+
<slot></slot>
|
|
41
|
+
${endSlotTemplate(context, definition)}
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
${when(x => x.childItems &&
|
|
45
|
+
x.childItemLength() > 0 &&
|
|
46
|
+
(x.expanded || x.renderCollapsedChildren), html `
|
|
47
|
+
<div role="group" class="items" part="items">
|
|
48
|
+
<slot name="item" ${slotted("items")}></slot>
|
|
49
|
+
</div>
|
|
50
|
+
`)}
|
|
51
|
+
</template>
|
|
52
|
+
`;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, DOM, observable } from "@ni/fast-element";
|
|
3
|
+
import { getDisplayedNodes, isHTMLElement, keyArrowDown, keyArrowLeft, keyArrowRight, keyArrowUp, keyEnd, keyEnter, keyHome, } from "@ni/fast-web-utilities";
|
|
4
|
+
import { isTreeItemElement, TreeItem } from "../tree-item/tree-item.js";
|
|
5
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
6
|
+
/**
|
|
7
|
+
* A Tree view Custom HTML Element.
|
|
8
|
+
* Implements the {@link https://w3c.github.io/aria-practices/#TreeView | ARIA TreeView }.
|
|
9
|
+
*
|
|
10
|
+
* @slot - The default slot for tree items
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export class TreeView extends FoundationElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
/**
|
|
18
|
+
* The tree item that is designated to be in the tab queue.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
this.currentFocused = null;
|
|
23
|
+
/**
|
|
24
|
+
* Handle focus events
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
this.handleFocus = (e) => {
|
|
29
|
+
if (this.slottedTreeItems.length < 1) {
|
|
30
|
+
// no child items, nothing to do
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (e.target === this) {
|
|
34
|
+
if (this.currentFocused === null) {
|
|
35
|
+
this.currentFocused = this.getValidFocusableItem();
|
|
36
|
+
}
|
|
37
|
+
if (this.currentFocused !== null) {
|
|
38
|
+
TreeItem.focusItem(this.currentFocused);
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (this.contains(e.target)) {
|
|
43
|
+
this.setAttribute("tabindex", "-1");
|
|
44
|
+
this.currentFocused = e.target;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Handle blur events
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
this.handleBlur = (e) => {
|
|
53
|
+
if (e.target instanceof HTMLElement &&
|
|
54
|
+
(e.relatedTarget === null || !this.contains(e.relatedTarget))) {
|
|
55
|
+
this.setAttribute("tabindex", "0");
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* KeyDown handler
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
this.handleKeyDown = (e) => {
|
|
64
|
+
if (e.defaultPrevented) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (this.slottedTreeItems.length < 1) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
const treeItems = this.getVisibleNodes();
|
|
71
|
+
switch (e.key) {
|
|
72
|
+
case keyHome:
|
|
73
|
+
if (treeItems.length) {
|
|
74
|
+
TreeItem.focusItem(treeItems[0]);
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
case keyEnd:
|
|
78
|
+
if (treeItems.length) {
|
|
79
|
+
TreeItem.focusItem(treeItems[treeItems.length - 1]);
|
|
80
|
+
}
|
|
81
|
+
return;
|
|
82
|
+
case keyArrowLeft:
|
|
83
|
+
if (e.target && this.isFocusableElement(e.target)) {
|
|
84
|
+
const item = e.target;
|
|
85
|
+
if (item instanceof TreeItem &&
|
|
86
|
+
item.childItemLength() > 0 &&
|
|
87
|
+
item.expanded) {
|
|
88
|
+
item.expanded = false;
|
|
89
|
+
}
|
|
90
|
+
else if (item instanceof TreeItem &&
|
|
91
|
+
item.parentElement instanceof TreeItem) {
|
|
92
|
+
TreeItem.focusItem(item.parentElement);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
case keyArrowRight:
|
|
97
|
+
if (e.target && this.isFocusableElement(e.target)) {
|
|
98
|
+
const item = e.target;
|
|
99
|
+
if (item instanceof TreeItem &&
|
|
100
|
+
item.childItemLength() > 0 &&
|
|
101
|
+
!item.expanded) {
|
|
102
|
+
item.expanded = true;
|
|
103
|
+
}
|
|
104
|
+
else if (item instanceof TreeItem && item.childItemLength() > 0) {
|
|
105
|
+
this.focusNextNode(1, e.target);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return;
|
|
109
|
+
case keyArrowDown:
|
|
110
|
+
if (e.target && this.isFocusableElement(e.target)) {
|
|
111
|
+
this.focusNextNode(1, e.target);
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
case keyArrowUp:
|
|
115
|
+
if (e.target && this.isFocusableElement(e.target)) {
|
|
116
|
+
this.focusNextNode(-1, e.target);
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
case keyEnter:
|
|
120
|
+
// In single-select trees where selection does not follow focus (see note below),
|
|
121
|
+
// the default action is typically to select the focused node.
|
|
122
|
+
this.handleClick(e);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
// don't prevent default if we took no action
|
|
126
|
+
return true;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Handles the selected-changed events bubbling up
|
|
130
|
+
* from child tree items
|
|
131
|
+
*
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
this.handleSelectedChange = (e) => {
|
|
135
|
+
if (e.defaultPrevented) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
const item = e.target;
|
|
142
|
+
if (item.selected) {
|
|
143
|
+
if (this.currentSelected && this.currentSelected !== item) {
|
|
144
|
+
this.currentSelected.selected = false;
|
|
145
|
+
}
|
|
146
|
+
// new selected item
|
|
147
|
+
this.currentSelected = item;
|
|
148
|
+
}
|
|
149
|
+
else if (!item.selected && this.currentSelected === item) {
|
|
150
|
+
// selected item deselected
|
|
151
|
+
this.currentSelected = null;
|
|
152
|
+
}
|
|
153
|
+
return;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Updates the tree view when slottedTreeItems changes
|
|
157
|
+
*/
|
|
158
|
+
this.setItems = () => {
|
|
159
|
+
// force single selection
|
|
160
|
+
// defaults to first one found
|
|
161
|
+
const selectedItem = this.treeView.querySelector("[aria-selected='true']");
|
|
162
|
+
this.currentSelected = selectedItem;
|
|
163
|
+
// invalidate the current focused item if it is no longer valid
|
|
164
|
+
if (this.currentFocused === null || !this.contains(this.currentFocused)) {
|
|
165
|
+
this.currentFocused = this.getValidFocusableItem();
|
|
166
|
+
}
|
|
167
|
+
// toggle properties on child elements
|
|
168
|
+
this.nested = this.checkForNestedItems();
|
|
169
|
+
const treeItems = this.getVisibleNodes();
|
|
170
|
+
treeItems.forEach(node => {
|
|
171
|
+
if (isTreeItemElement(node)) {
|
|
172
|
+
node.nested = this.nested;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* check if the item is focusable
|
|
178
|
+
*/
|
|
179
|
+
this.isFocusableElement = (el) => {
|
|
180
|
+
return isTreeItemElement(el);
|
|
181
|
+
};
|
|
182
|
+
this.isSelectedElement = (el) => {
|
|
183
|
+
return el.selected;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
slottedTreeItemsChanged() {
|
|
187
|
+
if (this.$fastController.isConnected) {
|
|
188
|
+
// update for slotted children change
|
|
189
|
+
this.setItems();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
connectedCallback() {
|
|
193
|
+
super.connectedCallback();
|
|
194
|
+
this.setAttribute("tabindex", "0");
|
|
195
|
+
DOM.queueUpdate(() => {
|
|
196
|
+
this.setItems();
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Handles click events bubbling up
|
|
201
|
+
*
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
handleClick(e) {
|
|
205
|
+
if (e.defaultPrevented) {
|
|
206
|
+
// handled, do nothing
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
|
|
210
|
+
// not a tree item, ignore
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
const item = e.target;
|
|
214
|
+
if (!item.disabled) {
|
|
215
|
+
item.selected = !item.selected;
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Move focus to a tree item based on its offset from the provided item
|
|
221
|
+
*/
|
|
222
|
+
focusNextNode(delta, item) {
|
|
223
|
+
const visibleNodes = this.getVisibleNodes();
|
|
224
|
+
if (!visibleNodes) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const focusItem = visibleNodes[visibleNodes.indexOf(item) + delta];
|
|
228
|
+
if (isHTMLElement(focusItem)) {
|
|
229
|
+
TreeItem.focusItem(focusItem);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* checks if there are any nested tree items
|
|
234
|
+
*/
|
|
235
|
+
getValidFocusableItem() {
|
|
236
|
+
const treeItems = this.getVisibleNodes();
|
|
237
|
+
// default to selected element if there is one
|
|
238
|
+
let focusIndex = treeItems.findIndex(this.isSelectedElement);
|
|
239
|
+
if (focusIndex === -1) {
|
|
240
|
+
// otherwise first focusable tree item
|
|
241
|
+
focusIndex = treeItems.findIndex(this.isFocusableElement);
|
|
242
|
+
}
|
|
243
|
+
if (focusIndex !== -1) {
|
|
244
|
+
return treeItems[focusIndex];
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* checks if there are any nested tree items
|
|
250
|
+
*/
|
|
251
|
+
checkForNestedItems() {
|
|
252
|
+
return this.slottedTreeItems.some((node) => {
|
|
253
|
+
return isTreeItemElement(node) && node.querySelector("[role='treeitem']");
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
getVisibleNodes() {
|
|
257
|
+
return getDisplayedNodes(this, "[role='treeitem']") || [];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
__decorate([
|
|
261
|
+
attr({ attribute: "render-collapsed-nodes" })
|
|
262
|
+
], TreeView.prototype, "renderCollapsedNodes", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
observable
|
|
265
|
+
], TreeView.prototype, "currentSelected", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
observable
|
|
268
|
+
], TreeView.prototype, "slottedTreeItems", void 0);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { html, ref, slotted } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* The template for the {@link @ni/fast-foundation#TreeView} component.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export const treeViewTemplate = (context, definition) => html `
|
|
7
|
+
<template
|
|
8
|
+
role="tree"
|
|
9
|
+
${ref("treeView")}
|
|
10
|
+
@keydown="${(x, c) => x.handleKeyDown(c.event)}"
|
|
11
|
+
@focusin="${(x, c) => x.handleFocus(c.event)}"
|
|
12
|
+
@focusout="${(x, c) => x.handleBlur(c.event)}"
|
|
13
|
+
@click="${(x, c) => x.handleClick(c.event)}"
|
|
14
|
+
@selected-change="${(x, c) => x.handleSelectedChange(c.event)}"
|
|
15
|
+
>
|
|
16
|
+
<slot ${slotted("slottedTreeItems")}></slot>
|
|
17
|
+
</template>
|
|
18
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AttributeConfiguration } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* Apply mixins to a constructor.
|
|
4
|
+
* Sourced from {@link https://www.typescriptlang.org/docs/handbook/mixins.html | TypeScript Documentation }.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export function applyMixins(derivedCtor, ...baseCtors) {
|
|
8
|
+
const derivedAttributes = AttributeConfiguration.locate(derivedCtor);
|
|
9
|
+
baseCtors.forEach(baseCtor => {
|
|
10
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
11
|
+
if (name !== "constructor") {
|
|
12
|
+
Object.defineProperty(derivedCtor.prototype, name,
|
|
13
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
14
|
+
Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const baseAttributes = AttributeConfiguration.locate(baseCtor);
|
|
18
|
+
baseAttributes.forEach(x => derivedAttributes.push(x));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { composedParent } from "./composed-parent.js";
|
|
2
|
+
/**
|
|
3
|
+
* Determines if the reference element contains the test element in a "composed" DOM tree that
|
|
4
|
+
* ignores shadow DOM boundaries.
|
|
5
|
+
*
|
|
6
|
+
* Returns true of the test element is a descendent of the reference, or exist in
|
|
7
|
+
* a shadow DOM that is a logical descendent of the reference. Otherwise returns false.
|
|
8
|
+
* @param reference - The element to test for containment against.
|
|
9
|
+
* @param test - The element being tested for containment.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export function composedContains(reference, test) {
|
|
14
|
+
let current = test;
|
|
15
|
+
while (current !== null) {
|
|
16
|
+
if (current === reference) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
current = composedParent(current);
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 function composedParent(element) {
|
|
11
|
+
const parentNode = element.parentElement;
|
|
12
|
+
if (parentNode) {
|
|
13
|
+
return parentNode;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const rootNode = element.getRootNode();
|
|
17
|
+
if (rootNode.host instanceof HTMLElement) {
|
|
18
|
+
// this is shadow-root
|
|
19
|
+
return rootNode.host;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 const getDirection = (rootNode) => {
|
|
8
|
+
const dirNode = rootNode.closest("[dir]");
|
|
9
|
+
return dirNode !== null && dirNode.dir === "rtl" ? Direction.rtl : Direction.ltr;
|
|
10
|
+
};
|
|
@@ -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,91 @@
|
|
|
1
|
+
import { $global } from "@ni/fast-element";
|
|
2
|
+
/**
|
|
3
|
+
* A service to batch intersection event callbacks so multiple elements can share a single observer
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export class IntersectionService {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.intersectionDetector = null;
|
|
10
|
+
this.observedElements = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* Request the position of a target element
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
this.requestPosition = (target, callback) => {
|
|
17
|
+
var _a;
|
|
18
|
+
if (this.intersectionDetector === null) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (this.observedElements.has(target)) {
|
|
22
|
+
(_a = this.observedElements.get(target)) === null || _a === void 0 ? void 0 : _a.push(callback);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.observedElements.set(target, [callback]);
|
|
26
|
+
this.intersectionDetector.observe(target);
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Cancel a position request
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
this.cancelRequestPosition = (target, callback) => {
|
|
34
|
+
const callbacks = this.observedElements.get(target);
|
|
35
|
+
if (callbacks !== undefined) {
|
|
36
|
+
const callBackIndex = callbacks.indexOf(callback);
|
|
37
|
+
if (callBackIndex !== -1) {
|
|
38
|
+
callbacks.splice(callBackIndex, 1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* initialize intersection detector
|
|
44
|
+
*/
|
|
45
|
+
this.initializeIntersectionDetector = () => {
|
|
46
|
+
if (!$global.IntersectionObserver) {
|
|
47
|
+
//intersection observer not supported
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.intersectionDetector = new IntersectionObserver(this.handleIntersection, {
|
|
51
|
+
root: null,
|
|
52
|
+
rootMargin: "0px",
|
|
53
|
+
threshold: [0, 1],
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Handle intersections
|
|
58
|
+
*/
|
|
59
|
+
this.handleIntersection = (entries) => {
|
|
60
|
+
if (this.intersectionDetector === null) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const pendingCallbacks = [];
|
|
64
|
+
const pendingCallbackParams = [];
|
|
65
|
+
// go through the entries to build a list of callbacks and params for each
|
|
66
|
+
entries.forEach((entry) => {
|
|
67
|
+
var _a;
|
|
68
|
+
// stop watching this element until we get new update requests for it
|
|
69
|
+
(_a = this.intersectionDetector) === null || _a === void 0 ? void 0 : _a.unobserve(entry.target);
|
|
70
|
+
const thisElementCallbacks = this.observedElements.get(entry.target);
|
|
71
|
+
if (thisElementCallbacks !== undefined) {
|
|
72
|
+
thisElementCallbacks.forEach((callback) => {
|
|
73
|
+
let targetCallbackIndex = pendingCallbacks.indexOf(callback);
|
|
74
|
+
if (targetCallbackIndex === -1) {
|
|
75
|
+
targetCallbackIndex = pendingCallbacks.length;
|
|
76
|
+
pendingCallbacks.push(callback);
|
|
77
|
+
pendingCallbackParams.push([]);
|
|
78
|
+
}
|
|
79
|
+
pendingCallbackParams[targetCallbackIndex].push(entry);
|
|
80
|
+
});
|
|
81
|
+
this.observedElements.delete(entry.target);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
// execute callbacks
|
|
85
|
+
pendingCallbacks.forEach((callback, index) => {
|
|
86
|
+
callback(pendingCallbackParams[index]);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
this.initializeIntersectionDetector();
|
|
90
|
+
}
|
|
91
|
+
}
|