@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,452 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, nullableNumberConverter, observable, } from "@ni/fast-element";
|
|
3
|
+
import { Direction, keyArrowDown, keyArrowLeft, keyArrowRight, keyArrowUp, keyEnd, keyHome, Orientation, } from "@ni/fast-web-utilities";
|
|
4
|
+
import { getDirection } from "../utilities/direction.js";
|
|
5
|
+
import { convertPixelToPercent } from "./slider-utilities.js";
|
|
6
|
+
import { FormAssociatedSlider } from "./slider.form-associated.js";
|
|
7
|
+
/**
|
|
8
|
+
* The selection modes of a {@link @ni/fast-foundation#(Slider:class)}.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const SliderMode = {
|
|
12
|
+
singleValue: "single-value",
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A Slider Custom HTML Element.
|
|
16
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#slider | ARIA slider }.
|
|
17
|
+
*
|
|
18
|
+
* @slot track - The track of the slider
|
|
19
|
+
* @slot track-start - The track-start visual indicator
|
|
20
|
+
* @slot thumb - The slider thumb
|
|
21
|
+
* @slot - The default slot for labels
|
|
22
|
+
* @csspart positioning-region - The region used to position the elements of the slider
|
|
23
|
+
* @csspart track-container - The region containing the track elements
|
|
24
|
+
* @csspart track-start - The element wrapping the track start slot
|
|
25
|
+
* @csspart thumb-container - The thumb container element which is programatically positioned
|
|
26
|
+
* @fires change - Fires a custom 'change' event when the slider value changes
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export class Slider extends FormAssociatedSlider {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
this.direction = Direction.ltr;
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
this.isDragging = false;
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
this.trackWidth = 0;
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
this.trackMinWidth = 0;
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
this.trackHeight = 0;
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
this.trackLeft = 0;
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
this.trackMinHeight = 0;
|
|
61
|
+
/**
|
|
62
|
+
* Custom function that generates a string for the component's "aria-valuetext" attribute based on the current value.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
this.valueTextFormatter = () => null;
|
|
67
|
+
/**
|
|
68
|
+
* The minimum allowed value.
|
|
69
|
+
*
|
|
70
|
+
* @defaultValue - 0
|
|
71
|
+
* @public
|
|
72
|
+
* @remarks
|
|
73
|
+
* HTML Attribute: min
|
|
74
|
+
*/
|
|
75
|
+
this.min = 0; // Map to proxy element.
|
|
76
|
+
/**
|
|
77
|
+
* The maximum allowed value.
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue - 10
|
|
80
|
+
* @public
|
|
81
|
+
* @remarks
|
|
82
|
+
* HTML Attribute: max
|
|
83
|
+
*/
|
|
84
|
+
this.max = 10; // Map to proxy element.
|
|
85
|
+
/**
|
|
86
|
+
* Value to increment or decrement via arrow keys, mouse click or drag.
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
* @remarks
|
|
90
|
+
* HTML Attribute: step
|
|
91
|
+
*/
|
|
92
|
+
this.step = 1; // Map to proxy element.
|
|
93
|
+
/**
|
|
94
|
+
* The orientation of the slider.
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
* @remarks
|
|
98
|
+
* HTML Attribute: orientation
|
|
99
|
+
*/
|
|
100
|
+
this.orientation = Orientation.horizontal;
|
|
101
|
+
/**
|
|
102
|
+
* The selection mode.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
* @remarks
|
|
106
|
+
* HTML Attribute: mode
|
|
107
|
+
*/
|
|
108
|
+
this.mode = SliderMode.singleValue;
|
|
109
|
+
this.keypressHandler = (e) => {
|
|
110
|
+
if (this.readOnly) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (e.key === keyHome) {
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
this.value = `${this.min}`;
|
|
116
|
+
}
|
|
117
|
+
else if (e.key === keyEnd) {
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
this.value = `${this.max}`;
|
|
120
|
+
}
|
|
121
|
+
else if (!e.shiftKey) {
|
|
122
|
+
switch (e.key) {
|
|
123
|
+
case keyArrowRight:
|
|
124
|
+
case keyArrowUp:
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
this.increment();
|
|
127
|
+
break;
|
|
128
|
+
case keyArrowLeft:
|
|
129
|
+
case keyArrowDown:
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
this.decrement();
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
this.setupTrackConstraints = () => {
|
|
137
|
+
const clientRect = this.track.getBoundingClientRect();
|
|
138
|
+
this.trackWidth = this.track.clientWidth;
|
|
139
|
+
this.trackMinWidth = this.track.clientLeft;
|
|
140
|
+
this.trackHeight = clientRect.bottom;
|
|
141
|
+
this.trackMinHeight = clientRect.top;
|
|
142
|
+
this.trackLeft = this.getBoundingClientRect().left;
|
|
143
|
+
if (this.trackWidth === 0) {
|
|
144
|
+
this.trackWidth = 1;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
this.setupListeners = (remove = false) => {
|
|
148
|
+
const eventAction = `${remove ? "remove" : "add"}EventListener`;
|
|
149
|
+
this[eventAction]("keydown", this.keypressHandler);
|
|
150
|
+
this[eventAction]("mousedown", this.handleMouseDown);
|
|
151
|
+
this.thumb[eventAction]("mousedown", this.handleThumbMouseDown, {
|
|
152
|
+
passive: true,
|
|
153
|
+
});
|
|
154
|
+
this.thumb[eventAction]("touchstart", this.handleThumbMouseDown, {
|
|
155
|
+
passive: true,
|
|
156
|
+
});
|
|
157
|
+
// removes handlers attached by mousedown handlers
|
|
158
|
+
if (remove) {
|
|
159
|
+
this.handleMouseDown(null);
|
|
160
|
+
this.handleThumbMouseDown(null);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @internal
|
|
165
|
+
*/
|
|
166
|
+
this.initialValue = "";
|
|
167
|
+
/**
|
|
168
|
+
* Handle mouse moves during a thumb drag operation
|
|
169
|
+
* If the event handler is null it removes the events
|
|
170
|
+
*/
|
|
171
|
+
this.handleThumbMouseDown = (event) => {
|
|
172
|
+
if (event) {
|
|
173
|
+
if (this.readOnly || this.disabled || event.defaultPrevented) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
event.target.focus();
|
|
177
|
+
}
|
|
178
|
+
const eventAction = `${event !== null ? "add" : "remove"}EventListener`;
|
|
179
|
+
window[eventAction]("mouseup", this.handleWindowMouseUp);
|
|
180
|
+
window[eventAction]("mousemove", this.handleMouseMove, { passive: true });
|
|
181
|
+
window[eventAction]("touchmove", this.handleMouseMove, { passive: true });
|
|
182
|
+
window[eventAction]("touchend", this.handleWindowMouseUp);
|
|
183
|
+
this.isDragging = event !== null;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Handle mouse moves during a thumb drag operation
|
|
187
|
+
*/
|
|
188
|
+
this.handleMouseMove = (e) => {
|
|
189
|
+
if (this.readOnly || this.disabled || e.defaultPrevented) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
// update the value based on current position
|
|
193
|
+
const sourceEvent = window.TouchEvent && e instanceof TouchEvent
|
|
194
|
+
? e.touches[0]
|
|
195
|
+
: e;
|
|
196
|
+
const eventValue = this.orientation === Orientation.horizontal
|
|
197
|
+
? sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft
|
|
198
|
+
: sourceEvent.pageY - document.documentElement.scrollTop;
|
|
199
|
+
this.value = `${this.calculateNewValue(eventValue)}`;
|
|
200
|
+
};
|
|
201
|
+
this.calculateNewValue = (rawValue) => {
|
|
202
|
+
// update the value based on current position
|
|
203
|
+
const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.horizontal
|
|
204
|
+
? this.trackMinWidth
|
|
205
|
+
: this.trackMinHeight, this.orientation === Orientation.horizontal
|
|
206
|
+
? this.trackWidth
|
|
207
|
+
: this.trackHeight, this.direction);
|
|
208
|
+
const newValue = (this.max - this.min) * newPosition + this.min;
|
|
209
|
+
return this.convertToConstrainedValue(newValue);
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Handle a window mouse up during a drag operation
|
|
213
|
+
*/
|
|
214
|
+
this.handleWindowMouseUp = (event) => {
|
|
215
|
+
this.stopDragging();
|
|
216
|
+
};
|
|
217
|
+
this.stopDragging = () => {
|
|
218
|
+
this.isDragging = false;
|
|
219
|
+
this.handleMouseDown(null);
|
|
220
|
+
this.handleThumbMouseDown(null);
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
*
|
|
224
|
+
* @param e - MouseEvent or null. If there is no event handler it will remove the events
|
|
225
|
+
*/
|
|
226
|
+
this.handleMouseDown = (e) => {
|
|
227
|
+
const eventAction = `${e !== null ? "add" : "remove"}EventListener`;
|
|
228
|
+
if (e === null || (!this.disabled && !this.readOnly)) {
|
|
229
|
+
window[eventAction]("mouseup", this.handleWindowMouseUp);
|
|
230
|
+
window.document[eventAction]("mouseleave", this.handleWindowMouseUp);
|
|
231
|
+
window[eventAction]("mousemove", this.handleMouseMove);
|
|
232
|
+
if (e) {
|
|
233
|
+
e.preventDefault();
|
|
234
|
+
this.setupTrackConstraints();
|
|
235
|
+
e.target.focus();
|
|
236
|
+
const controlValue = this.orientation === Orientation.horizontal
|
|
237
|
+
? e.pageX - document.documentElement.scrollLeft - this.trackLeft
|
|
238
|
+
: e.pageY - document.documentElement.scrollTop;
|
|
239
|
+
this.value = `${this.calculateNewValue(controlValue)}`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
this.convertToConstrainedValue = (value) => {
|
|
244
|
+
if (isNaN(value)) {
|
|
245
|
+
value = this.min;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* The following logic intends to overcome the issue with math in JavaScript with regards to floating point numbers.
|
|
249
|
+
* This is needed as the `step` may be an integer but could also be a float. To accomplish this the step is assumed to be a float
|
|
250
|
+
* and is converted to an integer by determining the number of decimal places it represent, multiplying it until it is an
|
|
251
|
+
* integer and then dividing it to get back to the correct number.
|
|
252
|
+
*/
|
|
253
|
+
let constrainedValue = value - this.min;
|
|
254
|
+
const roundedConstrainedValue = Math.round(constrainedValue / this.step);
|
|
255
|
+
const remainderValue = constrainedValue -
|
|
256
|
+
(roundedConstrainedValue * (this.stepMultiplier * this.step)) /
|
|
257
|
+
this.stepMultiplier;
|
|
258
|
+
constrainedValue =
|
|
259
|
+
remainderValue >= Number(this.step) / 2
|
|
260
|
+
? constrainedValue - remainderValue + Number(this.step)
|
|
261
|
+
: constrainedValue - remainderValue;
|
|
262
|
+
return constrainedValue + this.min;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
readOnlyChanged() {
|
|
266
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
267
|
+
this.proxy.readOnly = this.readOnly;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* The value property, typed as a number.
|
|
272
|
+
*
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
get valueAsNumber() {
|
|
276
|
+
return parseFloat(super.value);
|
|
277
|
+
}
|
|
278
|
+
set valueAsNumber(next) {
|
|
279
|
+
this.value = next.toString();
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
valueChanged(previous, next) {
|
|
285
|
+
super.valueChanged(previous, next);
|
|
286
|
+
if (this.$fastController.isConnected) {
|
|
287
|
+
this.setThumbPositionForOrientation(this.direction);
|
|
288
|
+
}
|
|
289
|
+
this.$emit("change");
|
|
290
|
+
}
|
|
291
|
+
minChanged() {
|
|
292
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
293
|
+
this.proxy.min = `${this.min}`;
|
|
294
|
+
}
|
|
295
|
+
this.validate();
|
|
296
|
+
}
|
|
297
|
+
maxChanged() {
|
|
298
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
299
|
+
this.proxy.max = `${this.max}`;
|
|
300
|
+
}
|
|
301
|
+
this.validate();
|
|
302
|
+
}
|
|
303
|
+
stepChanged() {
|
|
304
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
305
|
+
this.proxy.step = `${this.step}`;
|
|
306
|
+
}
|
|
307
|
+
this.updateStepMultiplier();
|
|
308
|
+
this.validate();
|
|
309
|
+
}
|
|
310
|
+
orientationChanged() {
|
|
311
|
+
if (this.$fastController.isConnected) {
|
|
312
|
+
this.setThumbPositionForOrientation(this.direction);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* @internal
|
|
317
|
+
*/
|
|
318
|
+
connectedCallback() {
|
|
319
|
+
super.connectedCallback();
|
|
320
|
+
this.proxy.setAttribute("type", "range");
|
|
321
|
+
this.direction = getDirection(this);
|
|
322
|
+
this.updateStepMultiplier();
|
|
323
|
+
this.setupTrackConstraints();
|
|
324
|
+
this.setupListeners();
|
|
325
|
+
this.setupDefaultValue();
|
|
326
|
+
this.setThumbPositionForOrientation(this.direction);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* @internal
|
|
330
|
+
*/
|
|
331
|
+
disconnectedCallback() {
|
|
332
|
+
this.setupListeners(true);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Increment the value by the step
|
|
336
|
+
*
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
increment() {
|
|
340
|
+
const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
|
|
341
|
+
? Number(this.value) + Number(this.step)
|
|
342
|
+
: Number(this.value) - Number(this.step);
|
|
343
|
+
const incrementedVal = this.convertToConstrainedValue(newVal);
|
|
344
|
+
const incrementedValString = incrementedVal < Number(this.max) ? `${incrementedVal}` : `${this.max}`;
|
|
345
|
+
this.value = incrementedValString;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Decrement the value by the step
|
|
349
|
+
*
|
|
350
|
+
* @public
|
|
351
|
+
*/
|
|
352
|
+
decrement() {
|
|
353
|
+
const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
|
|
354
|
+
? Number(this.value) - Number(this.step)
|
|
355
|
+
: Number(this.value) + Number(this.step);
|
|
356
|
+
const decrementedVal = this.convertToConstrainedValue(newVal);
|
|
357
|
+
const decrementedValString = decrementedVal > Number(this.min) ? `${decrementedVal}` : `${this.min}`;
|
|
358
|
+
this.value = decrementedValString;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Places the thumb based on the current value
|
|
362
|
+
*
|
|
363
|
+
* @public
|
|
364
|
+
* @param direction - writing mode
|
|
365
|
+
*/
|
|
366
|
+
setThumbPositionForOrientation(direction) {
|
|
367
|
+
const newPct = convertPixelToPercent(Number(this.value), Number(this.min), Number(this.max), direction);
|
|
368
|
+
const percentage = (1 - newPct) * 100;
|
|
369
|
+
if (this.orientation === Orientation.horizontal) {
|
|
370
|
+
this.position = this.isDragging
|
|
371
|
+
? `right: ${percentage}%; transition: none;`
|
|
372
|
+
: `right: ${percentage}%; transition: all 0.2s ease;`;
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
this.position = this.isDragging
|
|
376
|
+
? `bottom: ${percentage}%; transition: none;`
|
|
377
|
+
: `bottom: ${percentage}%; transition: all 0.2s ease;`;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Update the step multiplier used to ensure rounding errors from steps that
|
|
382
|
+
* are not whole numbers
|
|
383
|
+
*/
|
|
384
|
+
updateStepMultiplier() {
|
|
385
|
+
const stepString = this.step + "";
|
|
386
|
+
const decimalPlacesOfStep = !!(this.step % 1)
|
|
387
|
+
? stepString.length - stepString.indexOf(".") - 1
|
|
388
|
+
: 0;
|
|
389
|
+
this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
|
|
390
|
+
}
|
|
391
|
+
get midpoint() {
|
|
392
|
+
return `${this.convertToConstrainedValue((this.max + this.min) / 2)}`;
|
|
393
|
+
}
|
|
394
|
+
setupDefaultValue() {
|
|
395
|
+
if (typeof this.value === "string") {
|
|
396
|
+
if (this.value.length === 0) {
|
|
397
|
+
this.initialValue = this.midpoint;
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
const value = parseFloat(this.value);
|
|
401
|
+
if (!Number.isNaN(value) && (value < this.min || value > this.max)) {
|
|
402
|
+
this.value = this.midpoint;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
__decorate([
|
|
409
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
410
|
+
], Slider.prototype, "readOnly", void 0);
|
|
411
|
+
__decorate([
|
|
412
|
+
observable
|
|
413
|
+
], Slider.prototype, "direction", void 0);
|
|
414
|
+
__decorate([
|
|
415
|
+
observable
|
|
416
|
+
], Slider.prototype, "isDragging", void 0);
|
|
417
|
+
__decorate([
|
|
418
|
+
observable
|
|
419
|
+
], Slider.prototype, "position", void 0);
|
|
420
|
+
__decorate([
|
|
421
|
+
observable
|
|
422
|
+
], Slider.prototype, "trackWidth", void 0);
|
|
423
|
+
__decorate([
|
|
424
|
+
observable
|
|
425
|
+
], Slider.prototype, "trackMinWidth", void 0);
|
|
426
|
+
__decorate([
|
|
427
|
+
observable
|
|
428
|
+
], Slider.prototype, "trackHeight", void 0);
|
|
429
|
+
__decorate([
|
|
430
|
+
observable
|
|
431
|
+
], Slider.prototype, "trackLeft", void 0);
|
|
432
|
+
__decorate([
|
|
433
|
+
observable
|
|
434
|
+
], Slider.prototype, "trackMinHeight", void 0);
|
|
435
|
+
__decorate([
|
|
436
|
+
observable
|
|
437
|
+
], Slider.prototype, "valueTextFormatter", void 0);
|
|
438
|
+
__decorate([
|
|
439
|
+
attr({ converter: nullableNumberConverter })
|
|
440
|
+
], Slider.prototype, "min", void 0);
|
|
441
|
+
__decorate([
|
|
442
|
+
attr({ converter: nullableNumberConverter })
|
|
443
|
+
], Slider.prototype, "max", void 0);
|
|
444
|
+
__decorate([
|
|
445
|
+
attr({ converter: nullableNumberConverter })
|
|
446
|
+
], Slider.prototype, "step", void 0);
|
|
447
|
+
__decorate([
|
|
448
|
+
attr
|
|
449
|
+
], Slider.prototype, "orientation", void 0);
|
|
450
|
+
__decorate([
|
|
451
|
+
attr
|
|
452
|
+
], Slider.prototype, "mode", void 0);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { html, ref } from "@ni/fast-element";
|
|
2
|
+
import { Orientation } from "@ni/fast-web-utilities";
|
|
3
|
+
/**
|
|
4
|
+
* The template for the {@link @ni/fast-foundation#(Slider:class)} component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const sliderTemplate = (context, definition) => html `
|
|
8
|
+
<template
|
|
9
|
+
role="slider"
|
|
10
|
+
class="${x => (x.readOnly ? "readonly" : "")}
|
|
11
|
+
${x => x.orientation || Orientation.horizontal}"
|
|
12
|
+
tabindex="${x => (x.disabled ? null : 0)}"
|
|
13
|
+
aria-valuetext="${x => x.valueTextFormatter(x.value)}"
|
|
14
|
+
aria-valuenow="${x => x.value}"
|
|
15
|
+
aria-valuemin="${x => x.min}"
|
|
16
|
+
aria-valuemax="${x => x.max}"
|
|
17
|
+
aria-disabled="${x => (x.disabled ? true : void 0)}"
|
|
18
|
+
aria-readonly="${x => (x.readOnly ? true : void 0)}"
|
|
19
|
+
aria-orientation="${x => x.orientation}"
|
|
20
|
+
class="${x => x.orientation}"
|
|
21
|
+
>
|
|
22
|
+
<div part="positioning-region" class="positioning-region">
|
|
23
|
+
<div ${ref("track")} part="track-container" class="track">
|
|
24
|
+
<slot name="track"></slot>
|
|
25
|
+
<div part="track-start" class="track-start" style="${x => x.position}">
|
|
26
|
+
<slot name="track-start"></slot>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<slot></slot>
|
|
30
|
+
<div
|
|
31
|
+
${ref("thumb")}
|
|
32
|
+
part="thumb-container"
|
|
33
|
+
class="thumb-container"
|
|
34
|
+
style="${x => x.position}"
|
|
35
|
+
>
|
|
36
|
+
<slot name="thumb">${definition.thumb || ""}</slot>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
`;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, Observable, observable } from "@ni/fast-element";
|
|
3
|
+
import { Direction, Orientation } from "@ni/fast-web-utilities";
|
|
4
|
+
import { convertPixelToPercent } from "../slider/slider-utilities.js";
|
|
5
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
6
|
+
const defaultConfig = {
|
|
7
|
+
min: 0,
|
|
8
|
+
max: 0,
|
|
9
|
+
direction: Direction.ltr,
|
|
10
|
+
orientation: Orientation.horizontal,
|
|
11
|
+
disabled: false,
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A label element intended to be used with the {@link @ni/fast-foundation#(Slider:class)} component.
|
|
15
|
+
*
|
|
16
|
+
* @slot - The default slot for the label content
|
|
17
|
+
* @csspart root - The element wrapping the label mark and text
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export class SliderLabel extends FoundationElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
/**
|
|
25
|
+
* Hides the tick mark.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @remarks
|
|
29
|
+
* HTML Attribute: hide-mark
|
|
30
|
+
*/
|
|
31
|
+
this.hideMark = false;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
this.sliderDirection = Direction.ltr;
|
|
36
|
+
this.getSliderConfiguration = () => {
|
|
37
|
+
if (!this.isSliderConfig(this.parentNode)) {
|
|
38
|
+
this.sliderDirection = defaultConfig.direction || Direction.ltr;
|
|
39
|
+
this.sliderOrientation = defaultConfig.orientation || Orientation.horizontal;
|
|
40
|
+
this.sliderMaxPosition = defaultConfig.max;
|
|
41
|
+
this.sliderMinPosition = defaultConfig.min;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const parentSlider = this
|
|
45
|
+
.parentNode;
|
|
46
|
+
const { min, max, direction, orientation, disabled } = parentSlider;
|
|
47
|
+
if (disabled !== undefined) {
|
|
48
|
+
this.disabled = disabled;
|
|
49
|
+
}
|
|
50
|
+
this.sliderDirection = direction || Direction.ltr;
|
|
51
|
+
this.sliderOrientation = orientation || Orientation.horizontal;
|
|
52
|
+
this.sliderMaxPosition = max;
|
|
53
|
+
this.sliderMinPosition = min;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
this.positionAsStyle = () => {
|
|
57
|
+
const direction = this.sliderDirection
|
|
58
|
+
? this.sliderDirection
|
|
59
|
+
: Direction.ltr;
|
|
60
|
+
const pct = convertPixelToPercent(Number(this.position), Number(this.sliderMinPosition), Number(this.sliderMaxPosition));
|
|
61
|
+
let rightNum = Math.round((1 - pct) * 100);
|
|
62
|
+
let leftNum = Math.round(pct * 100);
|
|
63
|
+
if (Number.isNaN(leftNum) && Number.isNaN(rightNum)) {
|
|
64
|
+
rightNum = 50;
|
|
65
|
+
leftNum = 50;
|
|
66
|
+
}
|
|
67
|
+
if (this.sliderOrientation === Orientation.horizontal) {
|
|
68
|
+
return direction === Direction.rtl
|
|
69
|
+
? `right: ${leftNum}%; left: ${rightNum}%;`
|
|
70
|
+
: `left: ${leftNum}%; right: ${rightNum}%;`;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return `top: ${leftNum}%; bottom: ${rightNum}%;`;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
positionChanged() {
|
|
78
|
+
this.positionStyle = this.positionAsStyle();
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
sliderOrientationChanged() {
|
|
84
|
+
void 0;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
connectedCallback() {
|
|
90
|
+
super.connectedCallback();
|
|
91
|
+
this.getSliderConfiguration();
|
|
92
|
+
this.positionStyle = this.positionAsStyle();
|
|
93
|
+
this.notifier = Observable.getNotifier(this.parentNode);
|
|
94
|
+
this.notifier.subscribe(this, "orientation");
|
|
95
|
+
this.notifier.subscribe(this, "direction");
|
|
96
|
+
this.notifier.subscribe(this, "max");
|
|
97
|
+
this.notifier.subscribe(this, "min");
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
disconnectedCallback() {
|
|
103
|
+
super.disconnectedCallback();
|
|
104
|
+
this.notifier.unsubscribe(this, "orientation");
|
|
105
|
+
this.notifier.unsubscribe(this, "direction");
|
|
106
|
+
this.notifier.unsubscribe(this, "max");
|
|
107
|
+
this.notifier.unsubscribe(this, "min");
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
handleChange(source, propertyName) {
|
|
113
|
+
switch (propertyName) {
|
|
114
|
+
case "direction":
|
|
115
|
+
this.sliderDirection = source.direction;
|
|
116
|
+
break;
|
|
117
|
+
case "orientation":
|
|
118
|
+
this.sliderOrientation = source.orientation;
|
|
119
|
+
break;
|
|
120
|
+
case "max":
|
|
121
|
+
this.sliderMaxPosition = source.max;
|
|
122
|
+
break;
|
|
123
|
+
case "min":
|
|
124
|
+
this.sliderMinPosition = source.min;
|
|
125
|
+
break;
|
|
126
|
+
default:
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
this.positionStyle = this.positionAsStyle();
|
|
130
|
+
}
|
|
131
|
+
isSliderConfig(node) {
|
|
132
|
+
return node.max !== undefined && node.min !== undefined;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
__decorate([
|
|
136
|
+
observable
|
|
137
|
+
], SliderLabel.prototype, "positionStyle", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
attr
|
|
140
|
+
], SliderLabel.prototype, "position", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
attr({ attribute: "hide-mark", mode: "boolean" })
|
|
143
|
+
], SliderLabel.prototype, "hideMark", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
attr({ attribute: "disabled", mode: "boolean" })
|
|
146
|
+
], SliderLabel.prototype, "disabled", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
observable
|
|
149
|
+
], SliderLabel.prototype, "sliderOrientation", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
observable
|
|
152
|
+
], SliderLabel.prototype, "sliderMinPosition", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
observable
|
|
155
|
+
], SliderLabel.prototype, "sliderMaxPosition", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
observable
|
|
158
|
+
], SliderLabel.prototype, "sliderDirection", void 0);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { html, ref, when } from "@ni/fast-element";
|
|
2
|
+
import { Orientation } from "@ni/fast-web-utilities";
|
|
3
|
+
/**
|
|
4
|
+
* The template for the {@link @ni/fast-foundation#(SliderLabel:class)} component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const sliderLabelTemplate = (context, definition) => html `
|
|
8
|
+
<template
|
|
9
|
+
aria-disabled="${x => x.disabled}"
|
|
10
|
+
class="${x => x.sliderOrientation || Orientation.horizontal}
|
|
11
|
+
${x => (x.disabled ? "disabled" : "")}"
|
|
12
|
+
>
|
|
13
|
+
<div ${ref("root")} part="root" class="root" style="${x => x.positionStyle}">
|
|
14
|
+
<div class="container">
|
|
15
|
+
${when(x => !x.hideMark, html `
|
|
16
|
+
<div class="mark"></div>
|
|
17
|
+
`)}
|
|
18
|
+
<div class="label">
|
|
19
|
+
<slot></slot>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CheckableFormAssociated } from "../form-associated/form-associated.js";
|
|
2
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
3
|
+
class _Switch extends FoundationElement {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A form-associated base class for the {@link @ni/fast-foundation#(Switch:class)} component.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.proxy = document.createElement("input");
|
|
14
|
+
}
|
|
15
|
+
}
|