@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,280 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, nullableNumberConverter, } from "@ni/fast-element";
|
|
3
|
+
import { keyEnter } from "@ni/fast-web-utilities";
|
|
4
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
5
|
+
import { DateFormatter } from "./date-formatter.js";
|
|
6
|
+
/**
|
|
7
|
+
* Calendar component
|
|
8
|
+
*
|
|
9
|
+
* @slot - The default slot for calendar content
|
|
10
|
+
* @fires dateselected - Fires a custom 'dateselected' event when Enter is invoked via keyboard on a date
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export class Calendar extends FoundationElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
/**
|
|
18
|
+
* date formatter utitlity for getting localized strings
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
this.dateFormatter = new DateFormatter();
|
|
22
|
+
/**
|
|
23
|
+
* Readonly attribute for turning off data-grid
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
this.readonly = false;
|
|
27
|
+
/**
|
|
28
|
+
* String repesentation of the full locale including market, calendar type and numbering system
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
this.locale = "en-US";
|
|
32
|
+
/**
|
|
33
|
+
* Month to display
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
this.month = new Date().getMonth() + 1;
|
|
37
|
+
/**
|
|
38
|
+
* Year of the month to display
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
this.year = new Date().getFullYear();
|
|
42
|
+
/**
|
|
43
|
+
* Format style for the day
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
this.dayFormat = "numeric";
|
|
47
|
+
/**
|
|
48
|
+
* Format style for the week day labels
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
this.weekdayFormat = "short";
|
|
52
|
+
/**
|
|
53
|
+
* Format style for the month label
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
this.monthFormat = "long";
|
|
57
|
+
/**
|
|
58
|
+
* Format style for the year used in the title
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
this.yearFormat = "numeric";
|
|
62
|
+
/**
|
|
63
|
+
* Minimum number of weeks to show for the month
|
|
64
|
+
* This can be used to normalize the calendar view
|
|
65
|
+
* when changing or across multiple calendars
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
this.minWeeks = 0;
|
|
69
|
+
/**
|
|
70
|
+
* A list of dates that should be shown as disabled
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
this.disabledDates = "";
|
|
74
|
+
/**
|
|
75
|
+
* A list of dates that should be shown as highlighted
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
this.selectedDates = "";
|
|
79
|
+
/**
|
|
80
|
+
* The number of miliseconds in a day
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
this.oneDayInMs = 86400000;
|
|
84
|
+
}
|
|
85
|
+
localeChanged() {
|
|
86
|
+
this.dateFormatter.locale = this.locale;
|
|
87
|
+
}
|
|
88
|
+
dayFormatChanged() {
|
|
89
|
+
this.dateFormatter.dayFormat = this.dayFormat;
|
|
90
|
+
}
|
|
91
|
+
weekdayFormatChanged() {
|
|
92
|
+
this.dateFormatter.weekdayFormat = this.weekdayFormat;
|
|
93
|
+
}
|
|
94
|
+
monthFormatChanged() {
|
|
95
|
+
this.dateFormatter.monthFormat = this.monthFormat;
|
|
96
|
+
}
|
|
97
|
+
yearFormatChanged() {
|
|
98
|
+
this.dateFormatter.yearFormat = this.yearFormat;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Gets data needed to render about a calendar month as well as the previous and next months
|
|
102
|
+
* @param year - year of the calendar
|
|
103
|
+
* @param month - month of the calendar
|
|
104
|
+
* @returns - an object with data about the current and 2 surrounding months
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
getMonthInfo(month = this.month, year = this.year) {
|
|
108
|
+
const getFirstDay = (date) => new Date(date.getFullYear(), date.getMonth(), 1).getDay();
|
|
109
|
+
const getLength = (date) => {
|
|
110
|
+
const nextMonth = new Date(date.getFullYear(), date.getMonth() + 1, 1);
|
|
111
|
+
return new Date(nextMonth.getTime() - this.oneDayInMs).getDate();
|
|
112
|
+
};
|
|
113
|
+
const thisMonth = new Date(year, month - 1);
|
|
114
|
+
const nextMonth = new Date(year, month);
|
|
115
|
+
const previousMonth = new Date(year, month - 2);
|
|
116
|
+
return {
|
|
117
|
+
length: getLength(thisMonth),
|
|
118
|
+
month,
|
|
119
|
+
start: getFirstDay(thisMonth),
|
|
120
|
+
year,
|
|
121
|
+
previous: {
|
|
122
|
+
length: getLength(previousMonth),
|
|
123
|
+
month: previousMonth.getMonth() + 1,
|
|
124
|
+
start: getFirstDay(previousMonth),
|
|
125
|
+
year: previousMonth.getFullYear(),
|
|
126
|
+
},
|
|
127
|
+
next: {
|
|
128
|
+
length: getLength(nextMonth),
|
|
129
|
+
month: nextMonth.getMonth() + 1,
|
|
130
|
+
start: getFirstDay(nextMonth),
|
|
131
|
+
year: nextMonth.getFullYear(),
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A list of calendar days
|
|
137
|
+
* @param info - an object containing the information needed to render a calendar month
|
|
138
|
+
* @param minWeeks - minimum number of weeks to show
|
|
139
|
+
* @returns a list of days in a calendar month
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
getDays(info = this.getMonthInfo(), minWeeks = this.minWeeks) {
|
|
143
|
+
minWeeks = minWeeks > 10 ? 10 : minWeeks;
|
|
144
|
+
const { start, length, previous, next } = info;
|
|
145
|
+
const days = [];
|
|
146
|
+
let dayCount = 1 - start;
|
|
147
|
+
while (dayCount < length + 1 ||
|
|
148
|
+
days.length < minWeeks ||
|
|
149
|
+
days[days.length - 1].length % 7 !== 0) {
|
|
150
|
+
const { month, year } = dayCount < 1 ? previous : dayCount > length ? next : info;
|
|
151
|
+
const day = dayCount < 1
|
|
152
|
+
? previous.length + dayCount
|
|
153
|
+
: dayCount > length
|
|
154
|
+
? dayCount - length
|
|
155
|
+
: dayCount;
|
|
156
|
+
const dateString = `${month}-${day}-${year}`;
|
|
157
|
+
const disabled = this.dateInString(dateString, this.disabledDates);
|
|
158
|
+
const selected = this.dateInString(dateString, this.selectedDates);
|
|
159
|
+
const date = {
|
|
160
|
+
day,
|
|
161
|
+
month,
|
|
162
|
+
year,
|
|
163
|
+
disabled,
|
|
164
|
+
selected,
|
|
165
|
+
};
|
|
166
|
+
const target = days[days.length - 1];
|
|
167
|
+
if (days.length === 0 || target.length % 7 === 0) {
|
|
168
|
+
days.push([date]);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
target.push(date);
|
|
172
|
+
}
|
|
173
|
+
dayCount++;
|
|
174
|
+
}
|
|
175
|
+
return days;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* A helper function that checks if a date exists in a list of dates
|
|
179
|
+
* @param date - A date objec that includes the day, month and year
|
|
180
|
+
* @param datesString - a comma separated list of dates
|
|
181
|
+
* @returns - Returns true if it found the date in the list of dates
|
|
182
|
+
* @public
|
|
183
|
+
*/
|
|
184
|
+
dateInString(date, datesString) {
|
|
185
|
+
const dates = datesString.split(",").map(str => str.trim());
|
|
186
|
+
date =
|
|
187
|
+
typeof date === "string"
|
|
188
|
+
? date
|
|
189
|
+
: `${date.getMonth() + 1}-${date.getDate()}-${date.getFullYear()}`;
|
|
190
|
+
return dates.some(d => d === date);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Creates a class string for the day container
|
|
194
|
+
* @param date - date of the calendar cell
|
|
195
|
+
* @returns - string of class names
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
getDayClassNames(date, todayString) {
|
|
199
|
+
const { day, month, year, disabled, selected } = date;
|
|
200
|
+
const today = todayString === `${month}-${day}-${year}`;
|
|
201
|
+
const inactive = this.month !== month;
|
|
202
|
+
return [
|
|
203
|
+
"day",
|
|
204
|
+
today && "today",
|
|
205
|
+
inactive && "inactive",
|
|
206
|
+
disabled && "disabled",
|
|
207
|
+
selected && "selected",
|
|
208
|
+
]
|
|
209
|
+
.filter(Boolean)
|
|
210
|
+
.join(" ");
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Returns a list of weekday labels
|
|
214
|
+
* @returns An array of weekday text and full text if abbreviated
|
|
215
|
+
* @public
|
|
216
|
+
*/
|
|
217
|
+
getWeekdayText() {
|
|
218
|
+
const weekdayText = this.dateFormatter.getWeekdays().map(text => ({ text }));
|
|
219
|
+
if (this.weekdayFormat !== "long") {
|
|
220
|
+
const longText = this.dateFormatter.getWeekdays("long");
|
|
221
|
+
weekdayText.forEach((weekday, index) => {
|
|
222
|
+
weekday.abbr = longText[index];
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
return weekdayText;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Emits the "date-select" event with the day, month and year.
|
|
229
|
+
* @param date - Date cell
|
|
230
|
+
* @public
|
|
231
|
+
*/
|
|
232
|
+
handleDateSelect(event, day) {
|
|
233
|
+
event.preventDefault;
|
|
234
|
+
this.$emit("dateselected", day);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Handles keyboard events on a cell
|
|
238
|
+
* @param event - Keyboard event
|
|
239
|
+
* @param date - Date of the cell selected
|
|
240
|
+
*/
|
|
241
|
+
handleKeydown(event, date) {
|
|
242
|
+
if (event.key === keyEnter) {
|
|
243
|
+
this.handleDateSelect(event, date);
|
|
244
|
+
}
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
__decorate([
|
|
249
|
+
attr({ mode: "boolean" })
|
|
250
|
+
], Calendar.prototype, "readonly", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
attr
|
|
253
|
+
], Calendar.prototype, "locale", void 0);
|
|
254
|
+
__decorate([
|
|
255
|
+
attr({ converter: nullableNumberConverter })
|
|
256
|
+
], Calendar.prototype, "month", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
attr({ converter: nullableNumberConverter })
|
|
259
|
+
], Calendar.prototype, "year", void 0);
|
|
260
|
+
__decorate([
|
|
261
|
+
attr({ attribute: "day-format", mode: "fromView" })
|
|
262
|
+
], Calendar.prototype, "dayFormat", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
attr({ attribute: "weekday-format", mode: "fromView" })
|
|
265
|
+
], Calendar.prototype, "weekdayFormat", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
attr({ attribute: "month-format", mode: "fromView" })
|
|
268
|
+
], Calendar.prototype, "monthFormat", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
attr({ attribute: "year-format", mode: "fromView" })
|
|
271
|
+
], Calendar.prototype, "yearFormat", void 0);
|
|
272
|
+
__decorate([
|
|
273
|
+
attr({ attribute: "min-weeks", converter: nullableNumberConverter })
|
|
274
|
+
], Calendar.prototype, "minWeeks", void 0);
|
|
275
|
+
__decorate([
|
|
276
|
+
attr({ attribute: "disabled-dates" })
|
|
277
|
+
], Calendar.prototype, "disabledDates", void 0);
|
|
278
|
+
__decorate([
|
|
279
|
+
attr({ attribute: "selected-dates" })
|
|
280
|
+
], Calendar.prototype, "selectedDates", void 0);
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { html, repeat, when } from "@ni/fast-element";
|
|
2
|
+
import { endTemplate, startTemplate } from "../patterns/start-end.js";
|
|
3
|
+
import { DataGrid, DataGridCell, DataGridRow } from "../data-grid/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* A basic Calendar title template that includes the month and year
|
|
6
|
+
* @returns - A calendar title template
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export const CalendarTitleTemplate = html `
|
|
10
|
+
<div
|
|
11
|
+
class="title"
|
|
12
|
+
part="title"
|
|
13
|
+
aria-label="${(x) => x.dateFormatter.getDate(`${x.month}-2-${x.year}`, {
|
|
14
|
+
month: "long",
|
|
15
|
+
year: "numeric",
|
|
16
|
+
})}"
|
|
17
|
+
>
|
|
18
|
+
<span part="month">
|
|
19
|
+
${(x) => x.dateFormatter.getMonth(x.month)}
|
|
20
|
+
</span>
|
|
21
|
+
<span part="year">${(x) => x.dateFormatter.getYear(x.year)}</span>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
/**
|
|
25
|
+
* Calendar weekday label template
|
|
26
|
+
* @returns - The weekday labels template
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export const calendarWeekdayTemplate = context => {
|
|
30
|
+
const cellTag = context.tagFor(DataGridCell);
|
|
31
|
+
return html `
|
|
32
|
+
<${cellTag}
|
|
33
|
+
class="week-day"
|
|
34
|
+
part="week-day"
|
|
35
|
+
tabindex="-1"
|
|
36
|
+
grid-column="${(x, c) => c.index + 1}"
|
|
37
|
+
abbr="${x => x.abbr}"
|
|
38
|
+
>
|
|
39
|
+
${x => x.text}
|
|
40
|
+
</${cellTag}>
|
|
41
|
+
`;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A calendar day template
|
|
45
|
+
* @param context - Element definition context for getting the cell tag for calendar-cell
|
|
46
|
+
* @param todayString - A string representation for todays date
|
|
47
|
+
* @returns - A calendar cell template for a given date
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export const calendarCellTemplate = (context, todayString) => {
|
|
51
|
+
const cellTag = context.tagFor(DataGridCell);
|
|
52
|
+
return html `
|
|
53
|
+
<${cellTag}
|
|
54
|
+
class="${(x, c) => c.parentContext.parent.getDayClassNames(x, todayString)}"
|
|
55
|
+
part="day"
|
|
56
|
+
tabindex="-1"
|
|
57
|
+
role="gridcell"
|
|
58
|
+
grid-column="${(x, c) => c.index + 1}"
|
|
59
|
+
@click="${(x, c) => c.parentContext.parent.handleDateSelect(c.event, x)}"
|
|
60
|
+
@keydown="${(x, c) => c.parentContext.parent.handleKeydown(c.event, x)}"
|
|
61
|
+
aria-label="${(x, c) => c.parentContext.parent.dateFormatter.getDate(`${x.month}-${x.day}-${x.year}`, { month: "long", day: "numeric" })}"
|
|
62
|
+
>
|
|
63
|
+
<div
|
|
64
|
+
class="date"
|
|
65
|
+
part="${x => todayString === `${x.month}-${x.day}-${x.year}` ? "today" : "date"}"
|
|
66
|
+
>
|
|
67
|
+
${(x, c) => c.parentContext.parent.dateFormatter.getDay(x.day)}
|
|
68
|
+
</div>
|
|
69
|
+
<slot name="${x => x.month}-${x => x.day}-${x => x.year}"></slot>
|
|
70
|
+
</${cellTag}>
|
|
71
|
+
`;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param context - Element definition context for getting the cell tag for calendar-cell
|
|
76
|
+
* @param todayString - A string representation for todays date
|
|
77
|
+
* @returns - A template for a week of days
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export const calendarRowTemplate = (context, todayString) => {
|
|
81
|
+
const rowTag = context.tagFor(DataGridRow);
|
|
82
|
+
return html `
|
|
83
|
+
<${rowTag}
|
|
84
|
+
class="week"
|
|
85
|
+
part="week"
|
|
86
|
+
role="row"
|
|
87
|
+
role-type="default"
|
|
88
|
+
grid-template-columns="1fr 1fr 1fr 1fr 1fr 1fr 1fr"
|
|
89
|
+
>
|
|
90
|
+
${repeat(x => x, calendarCellTemplate(context, todayString), {
|
|
91
|
+
positioning: true,
|
|
92
|
+
})}
|
|
93
|
+
</${rowTag}>
|
|
94
|
+
`;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Interactive template using DataGrid
|
|
98
|
+
* @param context - The templates context
|
|
99
|
+
* @param todayString - string representation of todays date
|
|
100
|
+
* @returns - interactive calendar template
|
|
101
|
+
*
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
export const interactiveCalendarGridTemplate = (context, todayString) => {
|
|
105
|
+
const gridTag = context.tagFor(DataGrid);
|
|
106
|
+
const rowTag = context.tagFor(DataGridRow);
|
|
107
|
+
return html `
|
|
108
|
+
<${gridTag} class="days interact" part="days" generate-header="none">
|
|
109
|
+
<${rowTag}
|
|
110
|
+
class="week-days"
|
|
111
|
+
part="week-days"
|
|
112
|
+
role="row"
|
|
113
|
+
row-type="header"
|
|
114
|
+
grid-template-columns="1fr 1fr 1fr 1fr 1fr 1fr 1fr"
|
|
115
|
+
>
|
|
116
|
+
${repeat(x => x.getWeekdayText(), calendarWeekdayTemplate(context), {
|
|
117
|
+
positioning: true,
|
|
118
|
+
})}
|
|
119
|
+
</${rowTag}>
|
|
120
|
+
${repeat(x => x.getDays(), calendarRowTemplate(context, todayString))}
|
|
121
|
+
</${gridTag}>
|
|
122
|
+
`;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Non-interactive calendar template used for a readonly calendar
|
|
126
|
+
* @param todayString - string representation of todays date
|
|
127
|
+
* @returns - non-interactive calendar template
|
|
128
|
+
*
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
131
|
+
export const noninteractiveCalendarTemplate = (todayString) => {
|
|
132
|
+
return html `
|
|
133
|
+
<div class="days" part="days">
|
|
134
|
+
<div class="week-days" part="week-days">
|
|
135
|
+
${repeat(x => x.getWeekdayText(), html `
|
|
136
|
+
<div class="week-day" part="week-day" abbr="${x => x.abbr}">
|
|
137
|
+
${x => x.text}
|
|
138
|
+
</div>
|
|
139
|
+
`)}
|
|
140
|
+
</div>
|
|
141
|
+
${repeat(x => x.getDays(), html `
|
|
142
|
+
<div class="week">
|
|
143
|
+
${repeat(x => x, html `
|
|
144
|
+
<div
|
|
145
|
+
class="${(x, c) => c.parentContext.parent.getDayClassNames(x, todayString)}"
|
|
146
|
+
part="day"
|
|
147
|
+
aria-label="${(x, c) => c.parentContext.parent.dateFormatter.getDate(`${x.month}-${x.day}-${x.year}`, { month: "long", day: "numeric" })}"
|
|
148
|
+
>
|
|
149
|
+
<div
|
|
150
|
+
class="date"
|
|
151
|
+
part="${x => todayString ===
|
|
152
|
+
`${x.month}-${x.day}-${x.year}`
|
|
153
|
+
? "today"
|
|
154
|
+
: "date"}"
|
|
155
|
+
>
|
|
156
|
+
${(x, c) => c.parentContext.parent.dateFormatter.getDay(x.day)}
|
|
157
|
+
</div>
|
|
158
|
+
<slot
|
|
159
|
+
name="${x => x.month}-${x => x.day}-${x => x.year}"
|
|
160
|
+
></slot>
|
|
161
|
+
</div>
|
|
162
|
+
`)}
|
|
163
|
+
</div>
|
|
164
|
+
`)}
|
|
165
|
+
</div>
|
|
166
|
+
`;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* The template for the {@link @ni/fast-foundation#(Calendar:class)} component.
|
|
170
|
+
*
|
|
171
|
+
* @param context - Element definition context for getting the cell tag for calendar-cell
|
|
172
|
+
* @param definition - Foundation element definition
|
|
173
|
+
* @returns - a template for a calendar month
|
|
174
|
+
* @public
|
|
175
|
+
*/
|
|
176
|
+
export const calendarTemplate = (context, definition) => {
|
|
177
|
+
var _a;
|
|
178
|
+
const today = new Date();
|
|
179
|
+
const todayString = `${today.getMonth() + 1}-${today.getDate()}-${today.getFullYear()}`;
|
|
180
|
+
return html `
|
|
181
|
+
<template>
|
|
182
|
+
${startTemplate}
|
|
183
|
+
${definition.title instanceof Function
|
|
184
|
+
? definition.title(context, definition)
|
|
185
|
+
: (_a = definition.title) !== null && _a !== void 0 ? _a : ""}
|
|
186
|
+
<slot></slot>
|
|
187
|
+
${when(x => x.readonly, noninteractiveCalendarTemplate(todayString), interactiveCalendarGridTemplate(context, todayString))}
|
|
188
|
+
${endTemplate}
|
|
189
|
+
</template>
|
|
190
|
+
`;
|
|
191
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date formatting utility
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export class DateFormatter {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
/**
|
|
8
|
+
* Formatting for the day
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
this.dayFormat = "numeric";
|
|
12
|
+
/**
|
|
13
|
+
* Formatting for the weekday labels
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
this.weekdayFormat = "long";
|
|
17
|
+
/**
|
|
18
|
+
* Formatting for the month
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
this.monthFormat = "long";
|
|
22
|
+
/**
|
|
23
|
+
* Formatting for the year
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
this.yearFormat = "numeric";
|
|
27
|
+
/**
|
|
28
|
+
* Date used for formatting
|
|
29
|
+
*/
|
|
30
|
+
this.date = new Date();
|
|
31
|
+
/**
|
|
32
|
+
* Add properties on construction
|
|
33
|
+
*/
|
|
34
|
+
if (config) {
|
|
35
|
+
for (const key in config) {
|
|
36
|
+
const value = config[key];
|
|
37
|
+
if (key === "date") {
|
|
38
|
+
this.date = this.getDateObject(value);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this[key] = value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to make sure that the DateFormatter is working with an instance of Date
|
|
48
|
+
* @param date - The date as an object, string or Date insance
|
|
49
|
+
* @returns - A Date instance
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
getDateObject(date) {
|
|
53
|
+
if (typeof date === "string") {
|
|
54
|
+
const dates = date.split(/[/-]/);
|
|
55
|
+
if (dates.length < 3) {
|
|
56
|
+
return new Date();
|
|
57
|
+
}
|
|
58
|
+
return new Date(parseInt(dates[2], 10), parseInt(dates[0], 10) - 1, parseInt(dates[1], 10));
|
|
59
|
+
}
|
|
60
|
+
else if ("day" in date && "month" in date && "year" in date) {
|
|
61
|
+
const { day, month, year } = date;
|
|
62
|
+
return new Date(year, month - 1, day);
|
|
63
|
+
}
|
|
64
|
+
return date;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param date - a valide date as either a Date, string, objec or a DateFormatter
|
|
69
|
+
* @param format - The formatting for the string
|
|
70
|
+
* @param locale - locale data used for formatting
|
|
71
|
+
* @returns A localized string of the date provided
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
getDate(date = this.date, format = {
|
|
75
|
+
weekday: this.weekdayFormat,
|
|
76
|
+
month: this.monthFormat,
|
|
77
|
+
day: this.dayFormat,
|
|
78
|
+
year: this.yearFormat,
|
|
79
|
+
}, locale = this.locale) {
|
|
80
|
+
const dateObj = this.getDateObject(date);
|
|
81
|
+
if (!dateObj.getTime()) {
|
|
82
|
+
return "";
|
|
83
|
+
}
|
|
84
|
+
const optionsWithTimeZone = Object.assign({ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }, format);
|
|
85
|
+
return new Intl.DateTimeFormat(locale, optionsWithTimeZone).format(dateObj);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param day - Day to localize
|
|
90
|
+
* @param format - The formatting for the day
|
|
91
|
+
* @param locale - The locale data used for formatting
|
|
92
|
+
* @returns - A localized number for the day
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
getDay(day = this.date.getDate(), format = this.dayFormat, locale = this.locale) {
|
|
96
|
+
return this.getDate({ month: 1, day, year: 2020 }, { day: format }, locale);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @param month - The month to localize
|
|
101
|
+
* @param format - The formatting for the month
|
|
102
|
+
* @param locale - The locale data used for formatting
|
|
103
|
+
* @returns - A localized name of the month
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
getMonth(month = this.date.getMonth() + 1, format = this.monthFormat, locale = this.locale) {
|
|
107
|
+
return this.getDate({ month, day: 2, year: 2020 }, { month: format }, locale);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param year - The year to localize
|
|
112
|
+
* @param format - The formatting for the year
|
|
113
|
+
* @param locale - The locale data used for formatting
|
|
114
|
+
* @returns - A localized string for the year
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
getYear(year = this.date.getFullYear(), format = this.yearFormat, locale = this.locale) {
|
|
118
|
+
return this.getDate({ month: 2, day: 2, year }, { year: format }, locale);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* @param weekday - The number of the weekday, defaults to Sunday
|
|
123
|
+
* @param format - The formatting for the weekday label
|
|
124
|
+
* @param locale - The locale data used for formatting
|
|
125
|
+
* @returns - A formatted weekday label
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
getWeekday(weekday = 0, format = this.weekdayFormat, locale = this.locale) {
|
|
129
|
+
const date = `1-${weekday + 1}-2017`;
|
|
130
|
+
return this.getDate(date, { weekday: format }, locale);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param format - The formatting for the weekdays
|
|
135
|
+
* @param locale - The locale data used for formatting
|
|
136
|
+
* @returns - An array of the weekday labels
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
getWeekdays(format = this.weekdayFormat, locale = this.locale) {
|
|
140
|
+
return Array(7)
|
|
141
|
+
.fill(null)
|
|
142
|
+
.map((_, day) => this.getWeekday(day, format, locale));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CheckableFormAssociated } from "../form-associated/form-associated.js";
|
|
2
|
+
import { FoundationElement } from "../foundation-element/foundation-element.js";
|
|
3
|
+
class _Checkbox extends FoundationElement {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A form-associated base class for the {@link @ni/fast-foundation#(Checkbox:class)} component.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.proxy = document.createElement("input");
|
|
14
|
+
}
|
|
15
|
+
}
|