@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,251 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, DOM, observable } from "@ni/fast-element";
|
|
3
|
+
import { Direction, keyArrowLeft, keyArrowRight, keyEnter, keySpace, } from "@ni/fast-web-utilities";
|
|
4
|
+
import { FoundationElement, } from "../foundation-element/foundation-element.js";
|
|
5
|
+
import { StartEnd } from "../patterns/start-end.js";
|
|
6
|
+
import { getDirection } from "../utilities/direction.js";
|
|
7
|
+
import { applyMixins } from "../utilities/apply-mixins.js";
|
|
8
|
+
import { MenuItemRole, roleForMenuItem } from "./menu-item.options.js";
|
|
9
|
+
export { MenuItemRole, roleForMenuItem };
|
|
10
|
+
/**
|
|
11
|
+
* A Switch Custom HTML Element.
|
|
12
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
|
|
13
|
+
*
|
|
14
|
+
* @slot checked-indicator - The checked indicator
|
|
15
|
+
* @slot radio-indicator - The radio indicator
|
|
16
|
+
* @slot start - Content which can be provided before the menu item content
|
|
17
|
+
* @slot end - Content which can be provided after the menu item content
|
|
18
|
+
* @slot - The default slot for menu item content
|
|
19
|
+
* @slot expand-collapse-indicator - The expand/collapse indicator
|
|
20
|
+
* @slot submenu - Used to nest menu's within menu items
|
|
21
|
+
* @csspart input-container - The element representing the visual checked or radio indicator
|
|
22
|
+
* @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
|
|
23
|
+
* @csspart radio - The element wrapping the `menuitemradio` indicator
|
|
24
|
+
* @csspart content - The element wrapping the menu item content
|
|
25
|
+
* @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
|
|
26
|
+
* @csspart expand-collapse - The expand/collapse element
|
|
27
|
+
* @csspart submenu-region - The container for the submenu, used for positioning
|
|
28
|
+
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
29
|
+
* @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export class MenuItem extends FoundationElement {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
/**
|
|
37
|
+
* The role of the element.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
* @remarks
|
|
41
|
+
* HTML Attribute: role
|
|
42
|
+
*/
|
|
43
|
+
this.role = MenuItemRole.menuitem;
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
this.hasSubmenu = false;
|
|
48
|
+
/**
|
|
49
|
+
* Track current direction to pass to the anchored region
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
this.currentDirection = Direction.ltr;
|
|
54
|
+
this.focusSubmenuOnLoad = false;
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
this.handleMenuItemKeyDown = (e) => {
|
|
59
|
+
if (e.defaultPrevented) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
switch (e.key) {
|
|
63
|
+
case keyEnter:
|
|
64
|
+
case keySpace:
|
|
65
|
+
this.invoke();
|
|
66
|
+
return false;
|
|
67
|
+
case keyArrowRight:
|
|
68
|
+
//open/focus on submenu
|
|
69
|
+
this.expandAndFocus();
|
|
70
|
+
return false;
|
|
71
|
+
case keyArrowLeft:
|
|
72
|
+
//close submenu
|
|
73
|
+
if (this.expanded) {
|
|
74
|
+
this.expanded = false;
|
|
75
|
+
this.focus();
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
this.handleMenuItemClick = (e) => {
|
|
85
|
+
if (e.defaultPrevented || this.disabled) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
this.invoke();
|
|
89
|
+
return false;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
this.submenuLoaded = () => {
|
|
95
|
+
if (!this.focusSubmenuOnLoad) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.focusSubmenuOnLoad = false;
|
|
99
|
+
if (this.hasSubmenu) {
|
|
100
|
+
this.submenu.focus();
|
|
101
|
+
this.setAttribute("tabindex", "-1");
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
this.handleMouseOver = (e) => {
|
|
108
|
+
if (this.disabled || !this.hasSubmenu || this.expanded) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
this.expanded = true;
|
|
112
|
+
return false;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
this.handleMouseOut = (e) => {
|
|
118
|
+
if (!this.expanded || this.contains(document.activeElement)) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
this.expanded = false;
|
|
122
|
+
return false;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
this.expandAndFocus = () => {
|
|
128
|
+
if (!this.hasSubmenu) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.focusSubmenuOnLoad = true;
|
|
132
|
+
this.expanded = true;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
this.invoke = () => {
|
|
138
|
+
if (this.disabled) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
switch (this.role) {
|
|
142
|
+
case MenuItemRole.menuitemcheckbox:
|
|
143
|
+
this.checked = !this.checked;
|
|
144
|
+
break;
|
|
145
|
+
case MenuItemRole.menuitem:
|
|
146
|
+
// update submenu
|
|
147
|
+
this.updateSubmenu();
|
|
148
|
+
if (this.hasSubmenu) {
|
|
149
|
+
this.expandAndFocus();
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.$emit("change");
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case MenuItemRole.menuitemradio:
|
|
156
|
+
if (!this.checked) {
|
|
157
|
+
this.checked = true;
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Gets the submenu element if any
|
|
164
|
+
*
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
|
+
this.updateSubmenu = () => {
|
|
168
|
+
this.submenu = this.domChildren().find((element) => {
|
|
169
|
+
return element.getAttribute("role") === "menu";
|
|
170
|
+
});
|
|
171
|
+
this.hasSubmenu = this.submenu === undefined ? false : true;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
expandedChanged(oldValue) {
|
|
175
|
+
if (this.$fastController.isConnected) {
|
|
176
|
+
if (this.submenu === undefined) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (this.expanded === false) {
|
|
180
|
+
this.submenu.collapseExpandedItem();
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
this.currentDirection = getDirection(this);
|
|
184
|
+
}
|
|
185
|
+
this.$emit("expanded-change", this, { bubbles: false });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
checkedChanged(oldValue, newValue) {
|
|
189
|
+
if (this.$fastController.isConnected) {
|
|
190
|
+
this.$emit("change");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
196
|
+
connectedCallback() {
|
|
197
|
+
super.connectedCallback();
|
|
198
|
+
DOM.queueUpdate(() => {
|
|
199
|
+
this.updateSubmenu();
|
|
200
|
+
});
|
|
201
|
+
if (!this.startColumnCount) {
|
|
202
|
+
this.startColumnCount = 1;
|
|
203
|
+
}
|
|
204
|
+
this.observer = new MutationObserver(this.updateSubmenu);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
disconnectedCallback() {
|
|
210
|
+
super.disconnectedCallback();
|
|
211
|
+
this.submenu = undefined;
|
|
212
|
+
if (this.observer !== undefined) {
|
|
213
|
+
this.observer.disconnect();
|
|
214
|
+
this.observer = undefined;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* get an array of valid DOM children
|
|
219
|
+
*/
|
|
220
|
+
domChildren() {
|
|
221
|
+
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
__decorate([
|
|
225
|
+
attr({ mode: "boolean" })
|
|
226
|
+
], MenuItem.prototype, "disabled", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
attr({ mode: "boolean" })
|
|
229
|
+
], MenuItem.prototype, "expanded", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
observable
|
|
232
|
+
], MenuItem.prototype, "startColumnCount", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
attr
|
|
235
|
+
], MenuItem.prototype, "role", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
attr({ mode: "boolean" })
|
|
238
|
+
], MenuItem.prototype, "checked", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
observable
|
|
241
|
+
], MenuItem.prototype, "submenuRegion", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
observable
|
|
244
|
+
], MenuItem.prototype, "hasSubmenu", void 0);
|
|
245
|
+
__decorate([
|
|
246
|
+
observable
|
|
247
|
+
], MenuItem.prototype, "currentDirection", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
observable
|
|
250
|
+
], MenuItem.prototype, "submenu", void 0);
|
|
251
|
+
applyMixins(MenuItem, StartEnd);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu items roles.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export const MenuItemRole = {
|
|
6
|
+
/**
|
|
7
|
+
* The menu item has a "menuitem" role
|
|
8
|
+
*/
|
|
9
|
+
menuitem: "menuitem",
|
|
10
|
+
/**
|
|
11
|
+
* The menu item has a "menuitemcheckbox" role
|
|
12
|
+
*/
|
|
13
|
+
menuitemcheckbox: "menuitemcheckbox",
|
|
14
|
+
/**
|
|
15
|
+
* The menu item has a "menuitemradio" role
|
|
16
|
+
*/
|
|
17
|
+
menuitemradio: "menuitemradio",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export const roleForMenuItem = {
|
|
23
|
+
[MenuItemRole.menuitem]: "menuitem",
|
|
24
|
+
[MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
|
|
25
|
+
[MenuItemRole.menuitemradio]: "menuitemradio",
|
|
26
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { html, ref, when } from "@ni/fast-element";
|
|
2
|
+
import { AnchoredRegion } from "../anchored-region/anchored-region.js";
|
|
3
|
+
import { endSlotTemplate, startSlotTemplate } from "../patterns/start-end.js";
|
|
4
|
+
import { MenuItemRole } from "./menu-item.js";
|
|
5
|
+
/**
|
|
6
|
+
* Generates a template for the {@link @ni/fast-foundation#(MenuItem:class)} component using
|
|
7
|
+
* the provided prefix.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const menuItemTemplate = (context, definition) => html `
|
|
12
|
+
<template
|
|
13
|
+
role="${x => x.role}"
|
|
14
|
+
aria-haspopup="${x => (x.hasSubmenu ? "menu" : void 0)}"
|
|
15
|
+
aria-checked="${x => (x.role !== MenuItemRole.menuitem ? x.checked : void 0)}"
|
|
16
|
+
aria-disabled="${x => x.disabled}"
|
|
17
|
+
aria-expanded="${x => x.expanded}"
|
|
18
|
+
@keydown="${(x, c) => x.handleMenuItemKeyDown(c.event)}"
|
|
19
|
+
@click="${(x, c) => x.handleMenuItemClick(c.event)}"
|
|
20
|
+
@mouseover="${(x, c) => x.handleMouseOver(c.event)}"
|
|
21
|
+
@mouseout="${(x, c) => x.handleMouseOut(c.event)}"
|
|
22
|
+
class="${x => (x.disabled ? "disabled" : "")} ${x => x.expanded ? "expanded" : ""} ${x => `indent-${x.startColumnCount}`}"
|
|
23
|
+
>
|
|
24
|
+
${when(x => x.role === MenuItemRole.menuitemcheckbox, html `
|
|
25
|
+
<div part="input-container" class="input-container">
|
|
26
|
+
<span part="checkbox" class="checkbox">
|
|
27
|
+
<slot name="checkbox-indicator">
|
|
28
|
+
${definition.checkboxIndicator || ""}
|
|
29
|
+
</slot>
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
`)}
|
|
33
|
+
${when(x => x.role === MenuItemRole.menuitemradio, html `
|
|
34
|
+
<div part="input-container" class="input-container">
|
|
35
|
+
<span part="radio" class="radio">
|
|
36
|
+
<slot name="radio-indicator">
|
|
37
|
+
${definition.radioIndicator || ""}
|
|
38
|
+
</slot>
|
|
39
|
+
</span>
|
|
40
|
+
</div>
|
|
41
|
+
`)}
|
|
42
|
+
</div>
|
|
43
|
+
${startSlotTemplate(context, definition)}
|
|
44
|
+
<span class="content" part="content">
|
|
45
|
+
<slot></slot>
|
|
46
|
+
</span>
|
|
47
|
+
${endSlotTemplate(context, definition)}
|
|
48
|
+
${when(x => x.hasSubmenu, html `
|
|
49
|
+
<div
|
|
50
|
+
part="expand-collapse-glyph-container"
|
|
51
|
+
class="expand-collapse-glyph-container"
|
|
52
|
+
>
|
|
53
|
+
<span part="expand-collapse" class="expand-collapse">
|
|
54
|
+
<slot name="expand-collapse-indicator">
|
|
55
|
+
${definition.expandCollapseGlyph || ""}
|
|
56
|
+
</slot>
|
|
57
|
+
</span>
|
|
58
|
+
</div>
|
|
59
|
+
`)}
|
|
60
|
+
${when(x => x.expanded, html `
|
|
61
|
+
<${context.tagFor(AnchoredRegion)}
|
|
62
|
+
:anchorElement="${x => x}"
|
|
63
|
+
vertical-positioning-mode="dynamic"
|
|
64
|
+
vertical-default-position="bottom"
|
|
65
|
+
vertical-inset="true"
|
|
66
|
+
horizontal-positioning-mode="dynamic"
|
|
67
|
+
horizontal-default-position="end"
|
|
68
|
+
class="submenu-region"
|
|
69
|
+
dir="${x => x.currentDirection}"
|
|
70
|
+
@loaded="${x => x.submenuLoaded()}"
|
|
71
|
+
${ref("submenuRegion")}
|
|
72
|
+
part="submenu-region"
|
|
73
|
+
>
|
|
74
|
+
<slot name="submenu"></slot>
|
|
75
|
+
</${context.tagFor(AnchoredRegion)}>
|
|
76
|
+
`)}
|
|
77
|
+
</template>
|
|
78
|
+
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FormAssociated } from "../form-associated/form-associated.js";
|
|
2
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
3
|
+
class _NumberField extends FoundationElement {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A form-associated base class for the {@link @ni/fast-foundation#(NumberField:class)} component.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class FormAssociatedNumberField extends FormAssociated(_NumberField) {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.proxy = document.createElement("input");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, DOM, nullableNumberConverter, observable, } from "@ni/fast-element";
|
|
3
|
+
import { keyArrowDown, keyArrowUp } from "@ni/fast-web-utilities";
|
|
4
|
+
import { StartEnd } from "../patterns/start-end.js";
|
|
5
|
+
import { applyMixins } from "../utilities/apply-mixins.js";
|
|
6
|
+
import { DelegatesARIATextbox } from "../text-field/text-field.js";
|
|
7
|
+
import { FormAssociatedNumberField } from "./number-field.form-associated.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Number Field Custom HTML Element.
|
|
10
|
+
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number | <input type="number" /> element }.
|
|
11
|
+
*
|
|
12
|
+
* @slot start - Content which can be provided before the number field input
|
|
13
|
+
* @slot end - Content which can be provided after the number field input
|
|
14
|
+
* @slot - The default slot for the label
|
|
15
|
+
* @slot step-up-glyph - The glyph for the step up control
|
|
16
|
+
* @slot step-down-glyph - The glyph for the step down control
|
|
17
|
+
* @csspart label - The label
|
|
18
|
+
* @csspart root - The element wrapping the control, including start and end slots
|
|
19
|
+
* @csspart control - The element representing the input
|
|
20
|
+
* @csspart controls - The step up and step down controls
|
|
21
|
+
* @csspart step-up - The step up control
|
|
22
|
+
* @csspart step-down - The step down control
|
|
23
|
+
* @fires input - Fires a custom 'input' event when the value has changed
|
|
24
|
+
* @fires change - Fires a custom 'change' event when the value has changed
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export class NumberField extends FormAssociatedNumberField {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
/**
|
|
32
|
+
* When true, spin buttons will not be rendered
|
|
33
|
+
* @public
|
|
34
|
+
* @remarks
|
|
35
|
+
* HTML Attribute: autofocus
|
|
36
|
+
*/
|
|
37
|
+
this.hideStep = false;
|
|
38
|
+
/**
|
|
39
|
+
* Amount to increment or decrement the value by
|
|
40
|
+
* @public
|
|
41
|
+
* @remarks
|
|
42
|
+
* HTMLAttribute: step
|
|
43
|
+
*/
|
|
44
|
+
this.step = 1;
|
|
45
|
+
/**
|
|
46
|
+
* Flag to indicate that the value change is from the user input
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
this.isUserInput = false;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Ensures that the max is greater than the min and that the value
|
|
53
|
+
* is less than the max
|
|
54
|
+
* @param previous - the previous max value
|
|
55
|
+
* @param next - updated max value
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
maxChanged(previous, next) {
|
|
60
|
+
var _a;
|
|
61
|
+
this.max = Math.max(next, (_a = this.min) !== null && _a !== void 0 ? _a : next);
|
|
62
|
+
const min = Math.min(this.min, this.max);
|
|
63
|
+
if (this.min !== undefined && this.min !== min) {
|
|
64
|
+
this.min = min;
|
|
65
|
+
}
|
|
66
|
+
this.value = this.getValidValue(this.value);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Ensures that the min is less than the max and that the value
|
|
70
|
+
* is greater than the min
|
|
71
|
+
* @param previous - previous min value
|
|
72
|
+
* @param next - updated min value
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
minChanged(previous, next) {
|
|
77
|
+
var _a;
|
|
78
|
+
this.min = Math.min(next, (_a = this.max) !== null && _a !== void 0 ? _a : next);
|
|
79
|
+
const max = Math.max(this.min, this.max);
|
|
80
|
+
if (this.max !== undefined && this.max !== max) {
|
|
81
|
+
this.max = max;
|
|
82
|
+
}
|
|
83
|
+
this.value = this.getValidValue(this.value);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The value property, typed as a number.
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
get valueAsNumber() {
|
|
91
|
+
return parseFloat(super.value);
|
|
92
|
+
}
|
|
93
|
+
set valueAsNumber(next) {
|
|
94
|
+
this.value = next.toString();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Validates that the value is a number between the min and max
|
|
98
|
+
* @param previous - previous stored value
|
|
99
|
+
* @param next - value being updated
|
|
100
|
+
* @param updateControl - should the text field be updated with value, defaults to true
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
valueChanged(previous, next) {
|
|
104
|
+
this.value = this.getValidValue(next);
|
|
105
|
+
if (next !== this.value) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (this.control && !this.isUserInput) {
|
|
109
|
+
this.control.value = this.value;
|
|
110
|
+
}
|
|
111
|
+
super.valueChanged(previous, this.value);
|
|
112
|
+
if (previous !== undefined && !this.isUserInput) {
|
|
113
|
+
this.$emit("input");
|
|
114
|
+
this.$emit("change");
|
|
115
|
+
}
|
|
116
|
+
this.isUserInput = false;
|
|
117
|
+
}
|
|
118
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
119
|
+
validate() {
|
|
120
|
+
super.validate(this.control);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Sets the internal value to a valid number between the min and max properties
|
|
124
|
+
* @param value - user input
|
|
125
|
+
*
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
getValidValue(value) {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
let validValue = parseFloat(parseFloat(value).toPrecision(12));
|
|
131
|
+
if (isNaN(validValue)) {
|
|
132
|
+
validValue = "";
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
validValue = Math.min(validValue, (_a = this.max) !== null && _a !== void 0 ? _a : validValue);
|
|
136
|
+
validValue = Math.max(validValue, (_b = this.min) !== null && _b !== void 0 ? _b : validValue).toString();
|
|
137
|
+
}
|
|
138
|
+
return validValue;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Increments the value using the step value
|
|
142
|
+
*
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
stepUp() {
|
|
146
|
+
const value = parseFloat(this.value);
|
|
147
|
+
const stepUpValue = !isNaN(value)
|
|
148
|
+
? value + this.step
|
|
149
|
+
: this.min > 0
|
|
150
|
+
? this.min
|
|
151
|
+
: this.max < 0
|
|
152
|
+
? this.max
|
|
153
|
+
: !this.min
|
|
154
|
+
? this.step
|
|
155
|
+
: 0;
|
|
156
|
+
this.value = stepUpValue.toString();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Decrements the value using the step value
|
|
160
|
+
*
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
stepDown() {
|
|
164
|
+
const value = parseFloat(this.value);
|
|
165
|
+
const stepDownValue = !isNaN(value)
|
|
166
|
+
? value - this.step
|
|
167
|
+
: this.min > 0
|
|
168
|
+
? this.min
|
|
169
|
+
: this.max < 0
|
|
170
|
+
? this.max
|
|
171
|
+
: !this.min
|
|
172
|
+
? 0 - this.step
|
|
173
|
+
: 0;
|
|
174
|
+
this.value = stepDownValue.toString();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Sets up the initial state of the number field
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
connectedCallback() {
|
|
181
|
+
super.connectedCallback();
|
|
182
|
+
this.proxy.setAttribute("type", "number");
|
|
183
|
+
this.validate();
|
|
184
|
+
this.control.value = this.value;
|
|
185
|
+
if (this.autofocus) {
|
|
186
|
+
DOM.queueUpdate(() => {
|
|
187
|
+
this.focus();
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Selects all the text in the number field
|
|
193
|
+
*
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
196
|
+
select() {
|
|
197
|
+
this.control.select();
|
|
198
|
+
/**
|
|
199
|
+
* The select event does not permeate the shadow DOM boundary.
|
|
200
|
+
* This fn effectively proxies the select event,
|
|
201
|
+
* emitting a `select` event whenever the internal
|
|
202
|
+
* control emits a `select` event
|
|
203
|
+
*/
|
|
204
|
+
this.$emit("select");
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Handles the internal control's `input` event
|
|
208
|
+
* @internal
|
|
209
|
+
*/
|
|
210
|
+
handleTextInput() {
|
|
211
|
+
this.control.value = this.control.value.replace(/[^0-9\-+e.]/g, "");
|
|
212
|
+
this.isUserInput = true;
|
|
213
|
+
this.value = this.control.value;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Change event handler for inner control.
|
|
217
|
+
* @remarks
|
|
218
|
+
* "Change" events are not `composable` so they will not
|
|
219
|
+
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
220
|
+
* the change event, emitting a `change` event whenever the internal
|
|
221
|
+
* control emits a `change` event
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
handleChange() {
|
|
225
|
+
this.$emit("change");
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Handles the internal control's `keydown` event
|
|
229
|
+
* @internal
|
|
230
|
+
*/
|
|
231
|
+
handleKeyDown(e) {
|
|
232
|
+
const key = e.key;
|
|
233
|
+
switch (key) {
|
|
234
|
+
case keyArrowUp:
|
|
235
|
+
this.stepUp();
|
|
236
|
+
return false;
|
|
237
|
+
case keyArrowDown:
|
|
238
|
+
this.stepDown();
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Handles populating the input field with a validated value when
|
|
245
|
+
* leaving the input field.
|
|
246
|
+
* @internal
|
|
247
|
+
*/
|
|
248
|
+
handleBlur() {
|
|
249
|
+
this.control.value = this.value;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
__decorate([
|
|
253
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
254
|
+
], NumberField.prototype, "readOnly", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
attr({ mode: "boolean" })
|
|
257
|
+
], NumberField.prototype, "autofocus", void 0);
|
|
258
|
+
__decorate([
|
|
259
|
+
attr({ attribute: "hide-step", mode: "boolean" })
|
|
260
|
+
], NumberField.prototype, "hideStep", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
attr
|
|
263
|
+
], NumberField.prototype, "placeholder", void 0);
|
|
264
|
+
__decorate([
|
|
265
|
+
attr
|
|
266
|
+
], NumberField.prototype, "list", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
attr({ converter: nullableNumberConverter })
|
|
269
|
+
], NumberField.prototype, "maxlength", void 0);
|
|
270
|
+
__decorate([
|
|
271
|
+
attr({ converter: nullableNumberConverter })
|
|
272
|
+
], NumberField.prototype, "minlength", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
attr({ converter: nullableNumberConverter })
|
|
275
|
+
], NumberField.prototype, "size", void 0);
|
|
276
|
+
__decorate([
|
|
277
|
+
attr({ converter: nullableNumberConverter })
|
|
278
|
+
], NumberField.prototype, "step", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
attr({ converter: nullableNumberConverter })
|
|
281
|
+
], NumberField.prototype, "max", void 0);
|
|
282
|
+
__decorate([
|
|
283
|
+
attr({ converter: nullableNumberConverter })
|
|
284
|
+
], NumberField.prototype, "min", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
observable
|
|
287
|
+
], NumberField.prototype, "defaultSlottedNodes", void 0);
|
|
288
|
+
applyMixins(NumberField, StartEnd, DelegatesARIATextbox);
|