@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,464 @@
|
|
|
1
|
+
import { attr, booleanConverter, DOM, emptyArray, observable, } from "@ni/fast-element";
|
|
2
|
+
import { keyEnter } from "@ni/fast-web-utilities";
|
|
3
|
+
const proxySlotName = "form-associated-proxy";
|
|
4
|
+
const ElementInternalsKey = "ElementInternals";
|
|
5
|
+
/**
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export const supportsElementInternals = ElementInternalsKey in window &&
|
|
9
|
+
"setFormValue" in window[ElementInternalsKey].prototype;
|
|
10
|
+
const InternalsMap = new WeakMap();
|
|
11
|
+
/**
|
|
12
|
+
* Base function for providing Custom Element Form Association.
|
|
13
|
+
*
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export function FormAssociated(BaseCtor) {
|
|
17
|
+
const C = class extends BaseCtor {
|
|
18
|
+
/**
|
|
19
|
+
* Must evaluate to true to enable elementInternals.
|
|
20
|
+
* Feature detects API support and resolve respectively
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
static get formAssociated() {
|
|
25
|
+
return supportsElementInternals;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the validity state of the element
|
|
29
|
+
*
|
|
30
|
+
* @alpha
|
|
31
|
+
*/
|
|
32
|
+
get validity() {
|
|
33
|
+
return this.elementInternals
|
|
34
|
+
? this.elementInternals.validity
|
|
35
|
+
: this.proxy.validity;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Retrieve a reference to the associated form.
|
|
39
|
+
* Returns null if not associated to any form.
|
|
40
|
+
*
|
|
41
|
+
* @alpha
|
|
42
|
+
*/
|
|
43
|
+
get form() {
|
|
44
|
+
return this.elementInternals ? this.elementInternals.form : this.proxy.form;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Retrieve the localized validation message,
|
|
48
|
+
* or custom validation message if set.
|
|
49
|
+
*
|
|
50
|
+
* @alpha
|
|
51
|
+
*/
|
|
52
|
+
get validationMessage() {
|
|
53
|
+
return this.elementInternals
|
|
54
|
+
? this.elementInternals.validationMessage
|
|
55
|
+
: this.proxy.validationMessage;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether the element will be validated when the
|
|
59
|
+
* form is submitted
|
|
60
|
+
*/
|
|
61
|
+
get willValidate() {
|
|
62
|
+
return this.elementInternals
|
|
63
|
+
? this.elementInternals.willValidate
|
|
64
|
+
: this.proxy.willValidate;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A reference to all associated label elements
|
|
68
|
+
*/
|
|
69
|
+
get labels() {
|
|
70
|
+
if (this.elementInternals) {
|
|
71
|
+
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
72
|
+
}
|
|
73
|
+
else if (this.proxy instanceof HTMLElement &&
|
|
74
|
+
this.proxy.ownerDocument &&
|
|
75
|
+
this.id) {
|
|
76
|
+
// Labels associated by wrapping the element: <label><custom-element></custom-element></label>
|
|
77
|
+
const parentLabels = this.proxy.labels;
|
|
78
|
+
// Labels associated using the `for` attribute
|
|
79
|
+
const forLabels = Array.from(this.proxy.getRootNode().querySelectorAll(`[for='${this.id}']`));
|
|
80
|
+
const labels = parentLabels
|
|
81
|
+
? forLabels.concat(Array.from(parentLabels))
|
|
82
|
+
: forLabels;
|
|
83
|
+
return Object.freeze(labels);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
return emptyArray;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Invoked when the `value` property changes
|
|
91
|
+
* @param previous - the previous value
|
|
92
|
+
* @param next - the new value
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* If elements extending `FormAssociated` implement a `valueChanged` method
|
|
96
|
+
* They must be sure to invoke `super.valueChanged(previous, next)` to ensure
|
|
97
|
+
* proper functioning of `FormAssociated`
|
|
98
|
+
*/
|
|
99
|
+
valueChanged(previous, next) {
|
|
100
|
+
this.dirtyValue = true;
|
|
101
|
+
if (this.proxy instanceof HTMLElement) {
|
|
102
|
+
this.proxy.value = this.value;
|
|
103
|
+
}
|
|
104
|
+
this.currentValue = this.value;
|
|
105
|
+
this.setFormValue(this.value);
|
|
106
|
+
this.validate();
|
|
107
|
+
}
|
|
108
|
+
currentValueChanged() {
|
|
109
|
+
this.value = this.currentValue;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Invoked when the `initialValue` property changes
|
|
113
|
+
*
|
|
114
|
+
* @param previous - the previous value
|
|
115
|
+
* @param next - the new value
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* If elements extending `FormAssociated` implement a `initialValueChanged` method
|
|
119
|
+
* They must be sure to invoke `super.initialValueChanged(previous, next)` to ensure
|
|
120
|
+
* proper functioning of `FormAssociated`
|
|
121
|
+
*/
|
|
122
|
+
initialValueChanged(previous, next) {
|
|
123
|
+
// If the value is clean and the component is connected to the DOM
|
|
124
|
+
// then set value equal to the attribute value.
|
|
125
|
+
if (!this.dirtyValue) {
|
|
126
|
+
this.value = this.initialValue;
|
|
127
|
+
this.dirtyValue = false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Invoked when the `disabled` property changes
|
|
132
|
+
*
|
|
133
|
+
* @param previous - the previous value
|
|
134
|
+
* @param next - the new value
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* If elements extending `FormAssociated` implement a `disabledChanged` method
|
|
138
|
+
* They must be sure to invoke `super.disabledChanged(previous, next)` to ensure
|
|
139
|
+
* proper functioning of `FormAssociated`
|
|
140
|
+
*/
|
|
141
|
+
disabledChanged(previous, next) {
|
|
142
|
+
if (this.proxy instanceof HTMLElement) {
|
|
143
|
+
this.proxy.disabled = this.disabled;
|
|
144
|
+
}
|
|
145
|
+
DOM.queueUpdate(() => this.classList.toggle("disabled", this.disabled));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Invoked when the `name` property changes
|
|
149
|
+
*
|
|
150
|
+
* @param previous - the previous value
|
|
151
|
+
* @param next - the new value
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* If elements extending `FormAssociated` implement a `nameChanged` method
|
|
155
|
+
* They must be sure to invoke `super.nameChanged(previous, next)` to ensure
|
|
156
|
+
* proper functioning of `FormAssociated`
|
|
157
|
+
*/
|
|
158
|
+
nameChanged(previous, next) {
|
|
159
|
+
if (this.proxy instanceof HTMLElement) {
|
|
160
|
+
this.proxy.name = this.name;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Invoked when the `required` property changes
|
|
165
|
+
*
|
|
166
|
+
* @param previous - the previous value
|
|
167
|
+
* @param next - the new value
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* If elements extending `FormAssociated` implement a `requiredChanged` method
|
|
171
|
+
* They must be sure to invoke `super.requiredChanged(previous, next)` to ensure
|
|
172
|
+
* proper functioning of `FormAssociated`
|
|
173
|
+
*/
|
|
174
|
+
requiredChanged(prev, next) {
|
|
175
|
+
if (this.proxy instanceof HTMLElement) {
|
|
176
|
+
this.proxy.required = this.required;
|
|
177
|
+
}
|
|
178
|
+
DOM.queueUpdate(() => this.classList.toggle("required", this.required));
|
|
179
|
+
this.validate();
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The element internals object. Will only exist
|
|
183
|
+
* in browsers supporting the attachInternals API
|
|
184
|
+
*/
|
|
185
|
+
get elementInternals() {
|
|
186
|
+
if (!supportsElementInternals) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
let internals = InternalsMap.get(this);
|
|
190
|
+
if (!internals) {
|
|
191
|
+
internals = this.attachInternals();
|
|
192
|
+
InternalsMap.set(this, internals);
|
|
193
|
+
}
|
|
194
|
+
return internals;
|
|
195
|
+
}
|
|
196
|
+
constructor(...args) {
|
|
197
|
+
super(...args);
|
|
198
|
+
/**
|
|
199
|
+
* Track whether the value has been changed from the initial value
|
|
200
|
+
*/
|
|
201
|
+
this.dirtyValue = false;
|
|
202
|
+
/**
|
|
203
|
+
* Sets the element's disabled state. A disabled element will not be included during form submission.
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* HTML Attribute: disabled
|
|
207
|
+
*/
|
|
208
|
+
this.disabled = false;
|
|
209
|
+
/**
|
|
210
|
+
* These are events that are still fired by the proxy
|
|
211
|
+
* element based on user / programmatic interaction.
|
|
212
|
+
*
|
|
213
|
+
* The proxy implementation should be transparent to
|
|
214
|
+
* the app author, so block these events from emitting.
|
|
215
|
+
*/
|
|
216
|
+
this.proxyEventsToBlock = ["change", "click"];
|
|
217
|
+
this.proxyInitialized = false;
|
|
218
|
+
this.required = false;
|
|
219
|
+
this.initialValue = this.initialValue || "";
|
|
220
|
+
if (!this.elementInternals) {
|
|
221
|
+
// When elementInternals is not supported, formResetCallback is
|
|
222
|
+
// bound to an event listener, so ensure the handler's `this`
|
|
223
|
+
// context is correct.
|
|
224
|
+
this.formResetCallback = this.formResetCallback.bind(this);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
230
|
+
connectedCallback() {
|
|
231
|
+
super.connectedCallback();
|
|
232
|
+
this.addEventListener("keypress", this._keypressHandler);
|
|
233
|
+
if (!this.value) {
|
|
234
|
+
this.value = this.initialValue;
|
|
235
|
+
this.dirtyValue = false;
|
|
236
|
+
}
|
|
237
|
+
if (!this.elementInternals) {
|
|
238
|
+
this.attachProxy();
|
|
239
|
+
if (this.form) {
|
|
240
|
+
this.form.addEventListener("reset", this.formResetCallback);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
disconnectedCallback() {
|
|
248
|
+
super.disconnectedCallback();
|
|
249
|
+
this.proxyEventsToBlock.forEach(name => this.proxy.removeEventListener(name, this.stopPropagation));
|
|
250
|
+
if (!this.elementInternals && this.form) {
|
|
251
|
+
this.form.removeEventListener("reset", this.formResetCallback);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Return the current validity of the element.
|
|
256
|
+
*/
|
|
257
|
+
checkValidity() {
|
|
258
|
+
return this.elementInternals
|
|
259
|
+
? this.elementInternals.checkValidity()
|
|
260
|
+
: this.proxy.checkValidity();
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Return the current validity of the element.
|
|
264
|
+
* If false, fires an invalid event at the element.
|
|
265
|
+
*/
|
|
266
|
+
reportValidity() {
|
|
267
|
+
return this.elementInternals
|
|
268
|
+
? this.elementInternals.reportValidity()
|
|
269
|
+
: this.proxy.reportValidity();
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Set the validity of the control. In cases when the elementInternals object is not
|
|
273
|
+
* available (and the proxy element is used to report validity), this function will
|
|
274
|
+
* do nothing unless a message is provided, at which point the setCustomValidity method
|
|
275
|
+
* of the proxy element will be invoked with the provided message.
|
|
276
|
+
* @param flags - Validity flags
|
|
277
|
+
* @param message - Optional message to supply
|
|
278
|
+
* @param anchor - Optional element used by UA to display an interactive validation UI
|
|
279
|
+
*/
|
|
280
|
+
setValidity(flags, message, anchor) {
|
|
281
|
+
if (this.elementInternals) {
|
|
282
|
+
this.elementInternals.setValidity(flags, message, anchor);
|
|
283
|
+
}
|
|
284
|
+
else if (typeof message === "string") {
|
|
285
|
+
this.proxy.setCustomValidity(message);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Invoked when a connected component's form or fieldset has its disabled
|
|
290
|
+
* state changed.
|
|
291
|
+
* @param disabled - the disabled value of the form / fieldset
|
|
292
|
+
*/
|
|
293
|
+
formDisabledCallback(disabled) {
|
|
294
|
+
this.disabled = disabled;
|
|
295
|
+
}
|
|
296
|
+
formResetCallback() {
|
|
297
|
+
this.value = this.initialValue;
|
|
298
|
+
this.dirtyValue = false;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Attach the proxy element to the DOM
|
|
302
|
+
*/
|
|
303
|
+
attachProxy() {
|
|
304
|
+
var _a;
|
|
305
|
+
if (!this.proxyInitialized) {
|
|
306
|
+
this.proxyInitialized = true;
|
|
307
|
+
this.proxy.style.display = "none";
|
|
308
|
+
this.proxyEventsToBlock.forEach(name => this.proxy.addEventListener(name, this.stopPropagation));
|
|
309
|
+
// These are typically mapped to the proxy during
|
|
310
|
+
// property change callbacks, but during initialization
|
|
311
|
+
// on the initial call of the callback, the proxy is
|
|
312
|
+
// still undefined. We should find a better way to address this.
|
|
313
|
+
this.proxy.disabled = this.disabled;
|
|
314
|
+
this.proxy.required = this.required;
|
|
315
|
+
if (typeof this.name === "string") {
|
|
316
|
+
this.proxy.name = this.name;
|
|
317
|
+
}
|
|
318
|
+
if (typeof this.value === "string") {
|
|
319
|
+
this.proxy.value = this.value;
|
|
320
|
+
}
|
|
321
|
+
this.proxy.setAttribute("slot", proxySlotName);
|
|
322
|
+
this.proxySlot = document.createElement("slot");
|
|
323
|
+
this.proxySlot.setAttribute("name", proxySlotName);
|
|
324
|
+
}
|
|
325
|
+
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(this.proxySlot);
|
|
326
|
+
this.appendChild(this.proxy);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Detach the proxy element from the DOM
|
|
330
|
+
*/
|
|
331
|
+
detachProxy() {
|
|
332
|
+
var _a;
|
|
333
|
+
this.removeChild(this.proxy);
|
|
334
|
+
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeChild(this.proxySlot);
|
|
335
|
+
}
|
|
336
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
337
|
+
validate(anchor) {
|
|
338
|
+
if (this.proxy instanceof HTMLElement) {
|
|
339
|
+
this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Associates the provided value (and optional state) with the parent form.
|
|
344
|
+
* @param value - The value to set
|
|
345
|
+
* @param state - The state object provided to during session restores and when autofilling.
|
|
346
|
+
*/
|
|
347
|
+
setFormValue(value, state) {
|
|
348
|
+
if (this.elementInternals) {
|
|
349
|
+
this.elementInternals.setFormValue(value, state || value);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
_keypressHandler(e) {
|
|
353
|
+
switch (e.key) {
|
|
354
|
+
case keyEnter:
|
|
355
|
+
if (this.form instanceof HTMLFormElement) {
|
|
356
|
+
// Implicit submission
|
|
357
|
+
const defaultButton = this.form.querySelector("[type=submit]");
|
|
358
|
+
defaultButton === null || defaultButton === void 0 ? void 0 : defaultButton.click();
|
|
359
|
+
}
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Used to stop propagation of proxy element events
|
|
365
|
+
* @param e - Event object
|
|
366
|
+
*/
|
|
367
|
+
stopPropagation(e) {
|
|
368
|
+
e.stopPropagation();
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
attr({ mode: "boolean" })(C.prototype, "disabled");
|
|
372
|
+
attr({ mode: "fromView", attribute: "value" })(C.prototype, "initialValue");
|
|
373
|
+
attr({ attribute: "current-value" })(C.prototype, "currentValue");
|
|
374
|
+
attr(C.prototype, "name");
|
|
375
|
+
attr({ mode: "boolean" })(C.prototype, "required");
|
|
376
|
+
observable(C.prototype, "value");
|
|
377
|
+
return C;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* @alpha
|
|
381
|
+
*/
|
|
382
|
+
export function CheckableFormAssociated(BaseCtor) {
|
|
383
|
+
class C extends FormAssociated(BaseCtor) {
|
|
384
|
+
}
|
|
385
|
+
class D extends C {
|
|
386
|
+
checkedAttributeChanged() {
|
|
387
|
+
this.defaultChecked = this.checkedAttribute;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* @internal
|
|
391
|
+
*/
|
|
392
|
+
defaultCheckedChanged() {
|
|
393
|
+
if (!this.dirtyChecked) {
|
|
394
|
+
// Setting this.checked will cause us to enter a dirty state,
|
|
395
|
+
// but if we are clean when defaultChecked is changed, we want to stay
|
|
396
|
+
// in a clean state, so reset this.dirtyChecked
|
|
397
|
+
this.checked = this.defaultChecked;
|
|
398
|
+
this.dirtyChecked = false;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
checkedChanged(prev, next) {
|
|
402
|
+
if (!this.dirtyChecked) {
|
|
403
|
+
this.dirtyChecked = true;
|
|
404
|
+
}
|
|
405
|
+
this.currentChecked = this.checked;
|
|
406
|
+
this.updateForm();
|
|
407
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
408
|
+
this.proxy.checked = this.checked;
|
|
409
|
+
}
|
|
410
|
+
if (prev !== undefined) {
|
|
411
|
+
this.$emit("change");
|
|
412
|
+
}
|
|
413
|
+
this.validate();
|
|
414
|
+
}
|
|
415
|
+
currentCheckedChanged(prev, next) {
|
|
416
|
+
this.checked = this.currentChecked;
|
|
417
|
+
}
|
|
418
|
+
constructor(...args) {
|
|
419
|
+
super(args);
|
|
420
|
+
/**
|
|
421
|
+
* Tracks whether the "checked" property has been changed.
|
|
422
|
+
* This is necessary to provide consistent behavior with
|
|
423
|
+
* normal input checkboxes
|
|
424
|
+
*/
|
|
425
|
+
this.dirtyChecked = false;
|
|
426
|
+
/**
|
|
427
|
+
* Provides the default checkedness of the input element
|
|
428
|
+
* Passed down to proxy
|
|
429
|
+
*
|
|
430
|
+
* @public
|
|
431
|
+
* @remarks
|
|
432
|
+
* HTML Attribute: checked
|
|
433
|
+
*/
|
|
434
|
+
this.checkedAttribute = false;
|
|
435
|
+
/**
|
|
436
|
+
* The checked state of the control.
|
|
437
|
+
*
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
this.checked = false;
|
|
441
|
+
// Re-initialize dirtyChecked because initialization of other values
|
|
442
|
+
// causes it to become true
|
|
443
|
+
this.dirtyChecked = false;
|
|
444
|
+
}
|
|
445
|
+
updateForm() {
|
|
446
|
+
const value = this.checked ? this.value : null;
|
|
447
|
+
this.setFormValue(value, value);
|
|
448
|
+
}
|
|
449
|
+
connectedCallback() {
|
|
450
|
+
super.connectedCallback();
|
|
451
|
+
this.updateForm();
|
|
452
|
+
}
|
|
453
|
+
formResetCallback() {
|
|
454
|
+
super.formResetCallback();
|
|
455
|
+
this.checked = !!this.checkedAttribute;
|
|
456
|
+
this.dirtyChecked = false;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
attr({ attribute: "checked", mode: "boolean" })(D.prototype, "checkedAttribute");
|
|
460
|
+
attr({ attribute: "current-checked", converter: booleanConverter })(D.prototype, "currentChecked");
|
|
461
|
+
observable(D.prototype, "defaultChecked");
|
|
462
|
+
observable(D.prototype, "checked");
|
|
463
|
+
return D;
|
|
464
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./form-associated.js";
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { FASTElement, observable } from "@ni/fast-element";
|
|
3
|
+
import { ComponentPresentation, DefaultComponentPresentation, } from "../design-system/component-presentation.js";
|
|
4
|
+
/**
|
|
5
|
+
* Defines a foundation element class that:
|
|
6
|
+
* 1. Connects the element to its ComponentPresentation
|
|
7
|
+
* 2. Allows resolving the element template from the instance or ComponentPresentation
|
|
8
|
+
* 3. Allows resolving the element styles from the instance or ComponentPresentation
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export class FoundationElement extends FASTElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this._presentation = void 0;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A property which resolves the ComponentPresentation instance
|
|
19
|
+
* for the current component.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
get $presentation() {
|
|
23
|
+
if (this._presentation === void 0) {
|
|
24
|
+
this._presentation = ComponentPresentation.forTag(this.tagName, this);
|
|
25
|
+
}
|
|
26
|
+
return this._presentation;
|
|
27
|
+
}
|
|
28
|
+
templateChanged() {
|
|
29
|
+
if (this.template !== undefined) {
|
|
30
|
+
this.$fastController.template = this.template;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
stylesChanged() {
|
|
34
|
+
if (this.styles !== undefined) {
|
|
35
|
+
this.$fastController.styles = this.styles;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The connected callback for this FASTElement.
|
|
40
|
+
* @remarks
|
|
41
|
+
* This method is invoked by the platform whenever this FoundationElement
|
|
42
|
+
* becomes connected to the document.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
connectedCallback() {
|
|
46
|
+
if (this.$presentation !== null) {
|
|
47
|
+
this.$presentation.applyTo(this);
|
|
48
|
+
}
|
|
49
|
+
super.connectedCallback();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Defines an element registry function with a set of element definition defaults.
|
|
53
|
+
* @param elementDefinition - The definition of the element to create the registry
|
|
54
|
+
* function for.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
static compose(elementDefinition) {
|
|
58
|
+
return (overrideDefinition = {}) => new FoundationElementRegistry(this === FoundationElement
|
|
59
|
+
? class extends FoundationElement {
|
|
60
|
+
}
|
|
61
|
+
: this, elementDefinition, overrideDefinition);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__decorate([
|
|
65
|
+
observable
|
|
66
|
+
], FoundationElement.prototype, "template", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
observable
|
|
69
|
+
], FoundationElement.prototype, "styles", void 0);
|
|
70
|
+
function resolveOption(option, context, definition) {
|
|
71
|
+
if (typeof option === "function") {
|
|
72
|
+
return option(context, definition);
|
|
73
|
+
}
|
|
74
|
+
return option;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Registry capable of defining presentation properties for a DOM Container hierarchy.
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
82
|
+
export class FoundationElementRegistry {
|
|
83
|
+
constructor(type, elementDefinition, overrideDefinition) {
|
|
84
|
+
this.type = type;
|
|
85
|
+
this.elementDefinition = elementDefinition;
|
|
86
|
+
this.overrideDefinition = overrideDefinition;
|
|
87
|
+
this.definition = Object.assign(Object.assign({}, this.elementDefinition), this.overrideDefinition);
|
|
88
|
+
}
|
|
89
|
+
register(container, context) {
|
|
90
|
+
const definition = this.definition;
|
|
91
|
+
const overrideDefinition = this.overrideDefinition;
|
|
92
|
+
const prefix = definition.prefix || context.elementPrefix;
|
|
93
|
+
const name = `${prefix}-${definition.baseName}`;
|
|
94
|
+
context.tryDefineElement({
|
|
95
|
+
name,
|
|
96
|
+
type: this.type,
|
|
97
|
+
baseClass: this.elementDefinition.baseClass,
|
|
98
|
+
callback: x => {
|
|
99
|
+
const presentation = new DefaultComponentPresentation(resolveOption(definition.template, x, definition), resolveOption(definition.styles, x, definition));
|
|
100
|
+
x.definePresentation(presentation);
|
|
101
|
+
let shadowOptions = resolveOption(definition.shadowOptions, x, definition);
|
|
102
|
+
if (x.shadowRootMode) {
|
|
103
|
+
// If the design system has overridden the shadow root mode, we need special handling.
|
|
104
|
+
if (shadowOptions) {
|
|
105
|
+
// If there are shadow options present in the definition, then
|
|
106
|
+
// either the component itself has specified an option or the
|
|
107
|
+
// registry function has overridden it.
|
|
108
|
+
if (!overrideDefinition.shadowOptions) {
|
|
109
|
+
// There were shadow options provided by the component and not overridden by
|
|
110
|
+
// the registry.
|
|
111
|
+
shadowOptions.mode = x.shadowRootMode;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else if (shadowOptions !== null) {
|
|
115
|
+
// If the component author did not provide shadow options,
|
|
116
|
+
// and did not null them out (light dom opt-in) then they
|
|
117
|
+
// were relying on the FASTElement default. So, if the
|
|
118
|
+
// design system provides a mode, we need to create the options
|
|
119
|
+
// to override the default.
|
|
120
|
+
shadowOptions = { mode: x.shadowRootMode };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
x.defineElement({
|
|
124
|
+
elementOptions: resolveOption(definition.elementOptions, x, definition),
|
|
125
|
+
shadowOptions,
|
|
126
|
+
attributes: resolveOption(definition.attributes, x, definition),
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./foundation-element.js";
|