@ukic/canary-web-components 3.0.0-canary.30 → 3.0.0-canary.31
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/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/date-helpers-d7ee7b45.js.map +1 -1
- package/dist/cjs/{helpers-da852478.js → helpers-6f4b406b.js} +20 -20
- package/dist/cjs/helpers-6f4b406b.js.map +1 -0
- package/dist/cjs/ic-button_3.cjs.entry.js +5 -5
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-calendar_2.cjs.entry.js +2354 -0
- package/dist/cjs/ic-calendar_2.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-card-horizontal.cjs.entry.js +6 -6
- package/dist/cjs/ic-card-horizontal.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-checkbox-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-checkbox-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-checkbox_3.cjs.entry.js +39 -16
- package/dist/cjs/ic-checkbox_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-data-list.cjs.entry.js +2 -2
- package/dist/cjs/ic-data-list.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-data-row.cjs.entry.js +2 -2
- package/dist/cjs/ic-data-row.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-data-table-title-bar.cjs.entry.js +4 -4
- package/dist/cjs/ic-data-table.cjs.entry.js +8 -8
- package/dist/cjs/ic-date-picker.cjs.entry.js +98 -854
- package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ic-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-footer-link.cjs.entry.js +2 -2
- package/dist/cjs/ic-footer-link.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-hero.cjs.entry.js +11 -6
- package/dist/cjs/ic-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +5 -5
- package/dist/cjs/ic-horizontal-scroll.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-input-component-container_4.cjs.entry.js +10 -10
- package/dist/cjs/ic-input-component-container_4.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-layout-grid-item.cjs.entry.js +2 -2
- package/dist/cjs/ic-layout-grid-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-layout-grid.cjs.entry.js +2 -2
- package/dist/cjs/ic-layout-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-link.cjs.entry.js +1 -1
- package/dist/cjs/ic-link.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-menu.cjs.entry.js +3 -3
- package/dist/cjs/ic-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-menu.cjs.entry.js +4 -4
- package/dist/cjs/ic-navigation-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-page-header.cjs.entry.js +6 -6
- package/dist/cjs/ic-page-header.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-pagination_4.cjs.entry.js +18 -18
- package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-popover-menu.cjs.entry.js +4 -4
- package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-radio-group.cjs.entry.js +4 -4
- package/dist/cjs/ic-radio-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-radio-option.cjs.entry.js +4 -4
- package/dist/cjs/ic-radio-option.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-search-bar.cjs.entry.js +9 -9
- package/dist/cjs/ic-search-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-section-container.cjs.entry.js +2 -2
- package/dist/cjs/ic-section-container.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-side-navigation.cjs.entry.js +4 -4
- package/dist/cjs/ic-side-navigation.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/ic-skeleton.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-skip-link.cjs.entry.js +2 -2
- package/dist/cjs/ic-skip-link.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-status-tag.cjs.entry.js +2 -2
- package/dist/cjs/ic-status-tag.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-step.cjs.entry.js +13 -13
- package/dist/cjs/ic-step.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-stepper.cjs.entry.js +2 -2
- package/dist/cjs/ic-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-switch.cjs.entry.js +4 -4
- package/dist/cjs/ic-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-tab-context.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-context.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-tab-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/ic-tab-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-table-of-contents.cjs.entry.js +4 -4
- package/dist/cjs/ic-theme.cjs.entry.js +1 -1
- package/dist/cjs/ic-theme.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-time-input.cjs.entry.js +5 -5
- package/dist/cjs/ic-time-input.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toast-region.cjs.entry.js +1 -1
- package/dist/cjs/ic-toast-region.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toast.cjs.entry.js +4 -4
- package/dist/cjs/ic-toast.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toggle-button-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-toggle-button-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toggle-button.cjs.entry.js +2 -2
- package/dist/cjs/ic-toggle-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-tree-item.cjs.entry.js +3 -3
- package/dist/cjs/ic-tree-view.cjs.entry.js +4 -4
- package/dist/cjs/index-d337cd8a.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ic-calendar/ic-calendar.css +910 -0
- package/dist/collection/components/ic-calendar/ic-calendar.js +1542 -0
- package/dist/collection/components/ic-calendar/ic-calendar.js.map +1 -0
- package/dist/collection/components/ic-calendar/ic-calendar.stories.js +295 -0
- package/dist/collection/components/ic-calendar/ic-calendar.stories.js.map +1 -0
- package/dist/collection/components/ic-calendar/ic-day-button.js.map +1 -0
- package/dist/collection/components/ic-calendar/ic-month-picker.js +35 -0
- package/dist/collection/components/ic-calendar/ic-month-picker.js.map +1 -0
- package/dist/collection/components/ic-calendar/ic-year-picker.js +57 -0
- package/dist/collection/components/ic-calendar/ic-year-picker.js.map +1 -0
- package/dist/collection/components/ic-calendar/test/a11y/ic-calendar.test.a11y.js +13 -0
- package/dist/collection/components/ic-calendar/test/a11y/ic-calendar.test.a11y.js.map +1 -0
- package/dist/collection/components/ic-card-horizontal/ic-card-horizontal.js +6 -6
- package/dist/collection/components/ic-card-horizontal/ic-card-horizontal.js.map +1 -1
- package/dist/collection/components/ic-data-table/ic-data-table.js +7 -7
- package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js +3 -3
- package/dist/collection/components/ic-date-input/ic-date-input.js +8 -7
- package/dist/collection/components/ic-date-input/ic-date-input.js.map +1 -1
- package/dist/collection/components/ic-date-picker/ic-date-picker.css +7 -405
- package/dist/collection/components/ic-date-picker/ic-date-picker.js +145 -802
- package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -1
- package/dist/collection/components/ic-date-picker/ic-date-picker.stories.js +110 -0
- package/dist/collection/components/ic-date-picker/ic-date-picker.stories.js.map +1 -1
- package/dist/collection/components/ic-date-picker/story-data.js +5 -1
- package/dist/collection/components/ic-date-picker/story-data.js.map +1 -1
- package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js +7 -7
- package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js.map +1 -1
- package/dist/collection/components/ic-table-of-contents/ic-table-of-contents.js +3 -3
- package/dist/collection/components/ic-time-input/ic-time-input.js +9 -8
- package/dist/collection/components/ic-time-input/ic-time-input.js.map +1 -1
- package/dist/collection/components/ic-tree-item/ic-tree-item.js +2 -2
- package/dist/collection/components/ic-tree-view/ic-tree-view.js +3 -3
- package/dist/collection/utils/date-helpers.js +3 -0
- package/dist/collection/utils/date-helpers.js.map +1 -1
- package/dist/collection/utils/types.js.map +1 -1
- package/dist/{esm/date-helpers-2b531c8c.js → components/date-helpers.js} +2 -2
- package/dist/components/date-helpers.js.map +1 -0
- package/dist/components/helpers2.js +20 -20
- package/dist/components/helpers2.js.map +1 -1
- package/dist/components/ic-calendar.d.ts +11 -0
- package/dist/components/ic-calendar.js +8 -0
- package/dist/components/ic-calendar.js.map +1 -0
- package/dist/components/ic-calendar2.js +1235 -0
- package/dist/components/ic-calendar2.js.map +1 -0
- package/dist/components/ic-card-horizontal.js +6 -6
- package/dist/components/ic-card-horizontal.js.map +1 -1
- package/dist/components/ic-checkbox-group.js +2 -2
- package/dist/components/ic-checkbox-group.js.map +1 -1
- package/dist/components/ic-checkbox2.js +31 -8
- package/dist/components/ic-checkbox2.js.map +1 -1
- package/dist/components/ic-data-list.js +2 -2
- package/dist/components/ic-data-list.js.map +1 -1
- package/dist/components/ic-data-row.js +2 -2
- package/dist/components/ic-data-row.js.map +1 -1
- package/dist/components/ic-data-table-title-bar.js +3 -3
- package/dist/components/ic-data-table.js +8 -8
- package/dist/components/ic-date-input2.js +6 -88
- package/dist/components/ic-date-input2.js.map +1 -1
- package/dist/components/ic-date-picker.js +113 -880
- package/dist/components/ic-date-picker.js.map +1 -1
- package/dist/components/ic-dialog.js +1 -1
- package/dist/components/ic-dialog.js.map +1 -1
- package/dist/components/ic-empty-state2.js +2 -2
- package/dist/components/ic-empty-state2.js.map +1 -1
- package/dist/components/ic-footer-link.js +2 -2
- package/dist/components/ic-footer-link.js.map +1 -1
- package/dist/components/ic-hero.js +12 -6
- package/dist/components/ic-hero.js.map +1 -1
- package/dist/components/ic-horizontal-scroll2.js +5 -5
- package/dist/components/ic-horizontal-scroll2.js.map +1 -1
- package/dist/components/ic-input-component-container2.js +3 -3
- package/dist/components/ic-input-component-container2.js.map +1 -1
- package/dist/components/ic-input-container2.js +2 -2
- package/dist/components/ic-input-container2.js.map +1 -1
- package/dist/components/ic-input-label2.js +2 -2
- package/dist/components/ic-input-label2.js.map +1 -1
- package/dist/components/ic-input-validation2.js +3 -3
- package/dist/components/ic-input-validation2.js.map +1 -1
- package/dist/components/ic-layout-grid-item.js +2 -2
- package/dist/components/ic-layout-grid-item.js.map +1 -1
- package/dist/components/ic-layout-grid.js +2 -2
- package/dist/components/ic-layout-grid.js.map +1 -1
- package/dist/components/ic-link2.js +1 -1
- package/dist/components/ic-link2.js.map +1 -1
- package/dist/components/ic-loading-indicator2.js +5 -5
- package/dist/components/ic-loading-indicator2.js.map +1 -1
- package/dist/components/ic-menu-group.js +1 -1
- package/dist/components/ic-menu-group.js.map +1 -1
- package/dist/components/ic-menu2.js +3 -3
- package/dist/components/ic-menu2.js.map +1 -1
- package/dist/components/ic-navigation-group.js +1 -1
- package/dist/components/ic-navigation-group.js.map +1 -1
- package/dist/components/ic-navigation-menu2.js +4 -4
- package/dist/components/ic-navigation-menu2.js.map +1 -1
- package/dist/components/ic-page-header.js +6 -6
- package/dist/components/ic-page-header.js.map +1 -1
- package/dist/components/ic-pagination-bar2.js +6 -6
- package/dist/components/ic-pagination-bar2.js.map +1 -1
- package/dist/components/ic-pagination-item2.js +1 -1
- package/dist/components/ic-pagination-item2.js.map +1 -1
- package/dist/components/ic-pagination2.js +4 -4
- package/dist/components/ic-pagination2.js.map +1 -1
- package/dist/components/ic-popover-menu.js +4 -4
- package/dist/components/ic-popover-menu.js.map +1 -1
- package/dist/components/ic-radio-group.js +4 -4
- package/dist/components/ic-radio-group.js.map +1 -1
- package/dist/components/ic-radio-option.js +4 -4
- package/dist/components/ic-radio-option.js.map +1 -1
- package/dist/components/ic-search-bar.js +9 -9
- package/dist/components/ic-search-bar.js.map +1 -1
- package/dist/components/ic-section-container2.js +2 -2
- package/dist/components/ic-section-container2.js.map +1 -1
- package/dist/components/ic-select2.js +7 -7
- package/dist/components/ic-select2.js.map +1 -1
- package/dist/components/ic-side-navigation.js +4 -4
- package/dist/components/ic-side-navigation.js.map +1 -1
- package/dist/components/ic-skeleton.js +2 -2
- package/dist/components/ic-skeleton.js.map +1 -1
- package/dist/components/ic-skip-link.js +2 -2
- package/dist/components/ic-skip-link.js.map +1 -1
- package/dist/components/ic-status-tag.js +2 -2
- package/dist/components/ic-status-tag.js.map +1 -1
- package/dist/components/ic-step.js +13 -13
- package/dist/components/ic-step.js.map +1 -1
- package/dist/components/ic-stepper.js +2 -2
- package/dist/components/ic-stepper.js.map +1 -1
- package/dist/components/ic-switch.js +4 -4
- package/dist/components/ic-switch.js.map +1 -1
- package/dist/components/ic-tab-context.js +1 -1
- package/dist/components/ic-tab-context.js.map +1 -1
- package/dist/components/ic-tab-group.js +2 -2
- package/dist/components/ic-tab-group.js.map +1 -1
- package/dist/components/ic-tab-panel.js +2 -2
- package/dist/components/ic-tab-panel.js.map +1 -1
- package/dist/components/ic-table-of-contents.js +3 -3
- package/dist/components/ic-text-field2.js +6 -6
- package/dist/components/ic-text-field2.js.map +1 -1
- package/dist/components/ic-theme.js +1 -1
- package/dist/components/ic-theme.js.map +1 -1
- package/dist/components/ic-time-input.js +5 -5
- package/dist/components/ic-time-input.js.map +1 -1
- package/dist/components/ic-toast-region.js +1 -1
- package/dist/components/ic-toast-region.js.map +1 -1
- package/dist/components/ic-toast.js +4 -4
- package/dist/components/ic-toast.js.map +1 -1
- package/dist/components/ic-toggle-button-group.js +2 -2
- package/dist/components/ic-toggle-button-group.js.map +1 -1
- package/dist/components/ic-toggle-button.js +2 -2
- package/dist/components/ic-toggle-button.js.map +1 -1
- package/dist/components/ic-tree-item.js +3 -3
- package/dist/components/ic-tree-view.js +4 -4
- package/dist/core/core.css +21 -9
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-9fade6ad.entry.js → p-0043b019.entry.js} +2 -2
- package/dist/core/{p-9fade6ad.entry.js.map → p-0043b019.entry.js.map} +1 -1
- package/dist/core/{p-889bb8db.entry.js → p-04cb17d7.entry.js} +2 -2
- package/dist/core/{p-889bb8db.entry.js.map → p-04cb17d7.entry.js.map} +1 -1
- package/dist/core/{p-5ef453b6.entry.js → p-15c05eb8.entry.js} +2 -2
- package/dist/core/{p-5ef453b6.entry.js.map → p-15c05eb8.entry.js.map} +1 -1
- package/dist/core/p-1a976789.entry.js +2 -0
- package/dist/core/p-1a976789.entry.js.map +1 -0
- package/dist/core/{p-1be092cc.entry.js → p-2188b483.entry.js} +2 -2
- package/dist/core/{p-1be092cc.entry.js.map → p-2188b483.entry.js.map} +1 -1
- package/dist/core/{p-8c94541e.entry.js → p-24bac55f.entry.js} +2 -2
- package/dist/core/{p-8c94541e.entry.js.map → p-24bac55f.entry.js.map} +1 -1
- package/dist/core/{p-7f304d85.entry.js → p-2646a629.entry.js} +2 -2
- package/dist/core/{p-7f304d85.entry.js.map → p-2646a629.entry.js.map} +1 -1
- package/dist/core/{p-5cf704e3.entry.js → p-319e3d5b.entry.js} +2 -2
- package/dist/core/{p-5cf704e3.entry.js.map → p-319e3d5b.entry.js.map} +1 -1
- package/dist/core/{p-9e200827.entry.js → p-31f3fb15.entry.js} +2 -2
- package/dist/core/{p-9e200827.entry.js.map → p-31f3fb15.entry.js.map} +1 -1
- package/dist/core/{p-fd64c0e5.entry.js → p-3891ce53.entry.js} +2 -2
- package/dist/core/{p-fd64c0e5.entry.js.map → p-3891ce53.entry.js.map} +1 -1
- package/dist/core/{p-fad44bc8.entry.js → p-3ba2b455.entry.js} +2 -2
- package/dist/core/{p-fad44bc8.entry.js.map → p-3ba2b455.entry.js.map} +1 -1
- package/dist/core/{p-df220b91.entry.js → p-3ef2e98d.entry.js} +2 -2
- package/dist/core/{p-03ae0bc3.entry.js → p-41def410.entry.js} +2 -2
- package/dist/core/{p-03ae0bc3.entry.js.map → p-41def410.entry.js.map} +1 -1
- package/dist/core/p-4b188516.entry.js +2 -0
- package/dist/core/p-4b188516.entry.js.map +1 -0
- package/dist/core/{p-93e1ba0a.entry.js → p-5254a078.entry.js} +2 -2
- package/dist/core/{p-93e1ba0a.entry.js.map → p-5254a078.entry.js.map} +1 -1
- package/dist/core/{p-9c2e9189.entry.js → p-53740194.entry.js} +2 -2
- package/dist/core/{p-9c2e9189.entry.js.map → p-53740194.entry.js.map} +1 -1
- package/dist/core/{p-e380a54e.entry.js → p-5a4344cb.entry.js} +2 -2
- package/dist/core/{p-e380a54e.entry.js.map → p-5a4344cb.entry.js.map} +1 -1
- package/dist/core/p-5b32aaf3.entry.js +2 -0
- package/dist/core/p-5b32aaf3.entry.js.map +1 -0
- package/dist/core/{p-d8200098.entry.js → p-67c3985d.entry.js} +2 -2
- package/dist/core/{p-d8200098.entry.js.map → p-67c3985d.entry.js.map} +1 -1
- package/dist/core/{p-982a173d.entry.js → p-7332320d.entry.js} +2 -2
- package/dist/core/{p-982a173d.entry.js.map → p-7332320d.entry.js.map} +1 -1
- package/dist/core/{p-bc441e4c.js → p-75c3b882.js} +2 -2
- package/dist/core/{p-bc441e4c.js.map → p-75c3b882.js.map} +1 -1
- package/dist/core/{p-b88db5e3.entry.js → p-7a0f62c2.entry.js} +2 -2
- package/dist/core/{p-b88db5e3.entry.js.map → p-7a0f62c2.entry.js.map} +1 -1
- package/dist/core/p-81f12581.entry.js +2 -0
- package/dist/core/p-81f12581.entry.js.map +1 -0
- package/dist/core/{p-193afb53.entry.js → p-847cbb16.entry.js} +2 -2
- package/dist/core/{p-193afb53.entry.js.map → p-847cbb16.entry.js.map} +1 -1
- package/dist/core/{p-f3ccaa0b.entry.js → p-8e592393.entry.js} +2 -2
- package/dist/core/{p-f3ccaa0b.entry.js.map → p-8e592393.entry.js.map} +1 -1
- package/dist/core/p-9044539c.entry.js +2 -0
- package/dist/core/p-9044539c.entry.js.map +1 -0
- package/dist/core/{p-f4e7cae6.entry.js → p-90611726.entry.js} +2 -2
- package/dist/core/{p-f4e7cae6.entry.js.map → p-90611726.entry.js.map} +1 -1
- package/dist/core/{p-b00efb15.entry.js → p-9674b63f.entry.js} +2 -2
- package/dist/core/{p-b00efb15.entry.js.map → p-9674b63f.entry.js.map} +1 -1
- package/dist/core/{p-a27e1cee.entry.js → p-9a95f428.entry.js} +2 -2
- package/dist/core/{p-a27e1cee.entry.js.map → p-9a95f428.entry.js.map} +1 -1
- package/dist/core/{p-fb43abd6.entry.js → p-9ca147f3.entry.js} +2 -2
- package/dist/core/{p-fb43abd6.entry.js.map → p-9ca147f3.entry.js.map} +1 -1
- package/dist/core/{p-a8cc28a6.entry.js → p-9f76eed6.entry.js} +2 -2
- package/dist/core/{p-035dbee0.entry.js → p-a1448064.entry.js} +2 -2
- package/dist/core/{p-035dbee0.entry.js.map → p-a1448064.entry.js.map} +1 -1
- package/dist/core/{p-9ce9d39a.entry.js → p-a237af88.entry.js} +2 -2
- package/dist/core/{p-9ce9d39a.entry.js.map → p-a237af88.entry.js.map} +1 -1
- package/dist/core/{p-09c31ac6.entry.js → p-adde6c66.entry.js} +2 -2
- package/dist/core/{p-09c31ac6.entry.js.map → p-adde6c66.entry.js.map} +1 -1
- package/dist/core/{p-72b7051a.entry.js → p-af821831.entry.js} +2 -2
- package/dist/core/{p-72b7051a.entry.js.map → p-af821831.entry.js.map} +1 -1
- package/dist/core/{p-12e8dcdd.entry.js → p-afedcfdb.entry.js} +2 -2
- package/dist/core/{p-12e8dcdd.entry.js.map → p-afedcfdb.entry.js.map} +1 -1
- package/dist/core/{p-f098e531.entry.js → p-b4a2f6fa.entry.js} +2 -2
- package/dist/core/{p-f098e531.entry.js.map → p-b4a2f6fa.entry.js.map} +1 -1
- package/dist/core/p-b4bfaf8f.entry.js +2 -0
- package/dist/core/p-b4bfaf8f.entry.js.map +1 -0
- package/dist/core/{p-ea1de762.entry.js → p-b80b08ae.entry.js} +2 -2
- package/dist/core/p-b80b08ae.entry.js.map +1 -0
- package/dist/core/{p-7bf9bbde.entry.js → p-ba21f477.entry.js} +2 -2
- package/dist/core/{p-7bf9bbde.entry.js.map → p-ba21f477.entry.js.map} +1 -1
- package/dist/core/{p-63203e59.entry.js → p-ba75ed34.entry.js} +2 -2
- package/dist/core/{p-63203e59.entry.js.map → p-ba75ed34.entry.js.map} +1 -1
- package/dist/core/{p-15a81f32.entry.js → p-bd9a76d8.entry.js} +2 -2
- package/dist/core/{p-15a81f32.entry.js.map → p-bd9a76d8.entry.js.map} +1 -1
- package/dist/core/{p-10950727.entry.js → p-c3eddb99.entry.js} +2 -2
- package/dist/core/{p-10950727.entry.js.map → p-c3eddb99.entry.js.map} +1 -1
- package/dist/core/{p-a99ad459.entry.js → p-c5d65718.entry.js} +2 -2
- package/dist/core/{p-a99ad459.entry.js.map → p-c5d65718.entry.js.map} +1 -1
- package/dist/core/{p-eb958cc8.entry.js → p-c6c87e58.entry.js} +2 -2
- package/dist/core/{p-eb958cc8.entry.js.map → p-c6c87e58.entry.js.map} +1 -1
- package/dist/core/{p-c8ce7d60.entry.js → p-e00e67ff.entry.js} +2 -2
- package/dist/core/{p-c8ce7d60.entry.js.map → p-e00e67ff.entry.js.map} +1 -1
- package/dist/core/{p-069e758b.entry.js → p-e1920777.entry.js} +2 -2
- package/dist/core/{p-92936b49.entry.js → p-ef5b6622.entry.js} +2 -2
- package/dist/core/{p-0f22f41e.js → p-f48ce5f6.js} +2 -2
- package/dist/core/p-f48ce5f6.js.map +1 -0
- package/dist/core/{p-1ca62941.entry.js → p-f5cea10d.entry.js} +2 -2
- package/dist/esm/core.js +1 -1
- package/dist/esm/date-helpers-5723de08.js +86 -0
- package/dist/esm/{date-helpers-2b531c8c.js.map → date-helpers-5723de08.js.map} +1 -1
- package/dist/esm/{helpers-89cb996d.js → helpers-9f228880.js} +21 -21
- package/dist/esm/helpers-9f228880.js.map +1 -0
- package/dist/esm/ic-button_3.entry.js +5 -5
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-calendar_2.entry.js +2349 -0
- package/dist/esm/ic-calendar_2.entry.js.map +1 -0
- package/dist/esm/ic-card-horizontal.entry.js +6 -6
- package/dist/esm/ic-card-horizontal.entry.js.map +1 -1
- package/dist/esm/ic-checkbox-group.entry.js +2 -2
- package/dist/esm/ic-checkbox-group.entry.js.map +1 -1
- package/dist/esm/ic-checkbox_3.entry.js +39 -16
- package/dist/esm/ic-checkbox_3.entry.js.map +1 -1
- package/dist/esm/ic-data-list.entry.js +2 -2
- package/dist/esm/ic-data-list.entry.js.map +1 -1
- package/dist/esm/ic-data-row.entry.js +2 -2
- package/dist/esm/ic-data-row.entry.js.map +1 -1
- package/dist/esm/ic-data-table-title-bar.entry.js +4 -4
- package/dist/esm/ic-data-table.entry.js +8 -8
- package/dist/esm/ic-date-picker.entry.js +100 -856
- package/dist/esm/ic-date-picker.entry.js.map +1 -1
- package/dist/esm/ic-dialog.entry.js +1 -1
- package/dist/esm/ic-dialog.entry.js.map +1 -1
- package/dist/esm/ic-footer-link.entry.js +2 -2
- package/dist/esm/ic-footer-link.entry.js.map +1 -1
- package/dist/esm/ic-hero.entry.js +11 -6
- package/dist/esm/ic-hero.entry.js.map +1 -1
- package/dist/esm/ic-horizontal-scroll.entry.js +5 -5
- package/dist/esm/ic-horizontal-scroll.entry.js.map +1 -1
- package/dist/esm/ic-input-component-container_4.entry.js +10 -10
- package/dist/esm/ic-input-component-container_4.entry.js.map +1 -1
- package/dist/esm/ic-layout-grid-item.entry.js +2 -2
- package/dist/esm/ic-layout-grid-item.entry.js.map +1 -1
- package/dist/esm/ic-layout-grid.entry.js +2 -2
- package/dist/esm/ic-layout-grid.entry.js.map +1 -1
- package/dist/esm/ic-link.entry.js +1 -1
- package/dist/esm/ic-link.entry.js.map +1 -1
- package/dist/esm/ic-menu-group.entry.js +1 -1
- package/dist/esm/ic-menu-group.entry.js.map +1 -1
- package/dist/esm/ic-menu.entry.js +3 -3
- package/dist/esm/ic-menu.entry.js.map +1 -1
- package/dist/esm/ic-navigation-group.entry.js +1 -1
- package/dist/esm/ic-navigation-group.entry.js.map +1 -1
- package/dist/esm/ic-navigation-menu.entry.js +4 -4
- package/dist/esm/ic-navigation-menu.entry.js.map +1 -1
- package/dist/esm/ic-page-header.entry.js +6 -6
- package/dist/esm/ic-page-header.entry.js.map +1 -1
- package/dist/esm/ic-pagination_4.entry.js +18 -18
- package/dist/esm/ic-pagination_4.entry.js.map +1 -1
- package/dist/esm/ic-popover-menu.entry.js +4 -4
- package/dist/esm/ic-popover-menu.entry.js.map +1 -1
- package/dist/esm/ic-radio-group.entry.js +4 -4
- package/dist/esm/ic-radio-group.entry.js.map +1 -1
- package/dist/esm/ic-radio-option.entry.js +4 -4
- package/dist/esm/ic-radio-option.entry.js.map +1 -1
- package/dist/esm/ic-search-bar.entry.js +9 -9
- package/dist/esm/ic-search-bar.entry.js.map +1 -1
- package/dist/esm/ic-section-container.entry.js +2 -2
- package/dist/esm/ic-section-container.entry.js.map +1 -1
- package/dist/esm/ic-side-navigation.entry.js +4 -4
- package/dist/esm/ic-side-navigation.entry.js.map +1 -1
- package/dist/esm/ic-skeleton.entry.js +2 -2
- package/dist/esm/ic-skeleton.entry.js.map +1 -1
- package/dist/esm/ic-skip-link.entry.js +2 -2
- package/dist/esm/ic-skip-link.entry.js.map +1 -1
- package/dist/esm/ic-status-tag.entry.js +2 -2
- package/dist/esm/ic-status-tag.entry.js.map +1 -1
- package/dist/esm/ic-step.entry.js +13 -13
- package/dist/esm/ic-step.entry.js.map +1 -1
- package/dist/esm/ic-stepper.entry.js +2 -2
- package/dist/esm/ic-stepper.entry.js.map +1 -1
- package/dist/esm/ic-switch.entry.js +4 -4
- package/dist/esm/ic-switch.entry.js.map +1 -1
- package/dist/esm/ic-tab-context.entry.js +1 -1
- package/dist/esm/ic-tab-context.entry.js.map +1 -1
- package/dist/esm/ic-tab-group.entry.js +2 -2
- package/dist/esm/ic-tab-group.entry.js.map +1 -1
- package/dist/esm/ic-tab-panel.entry.js +2 -2
- package/dist/esm/ic-tab-panel.entry.js.map +1 -1
- package/dist/esm/ic-table-of-contents.entry.js +4 -4
- package/dist/esm/ic-theme.entry.js +1 -1
- package/dist/esm/ic-theme.entry.js.map +1 -1
- package/dist/esm/ic-time-input.entry.js +5 -5
- package/dist/esm/ic-time-input.entry.js.map +1 -1
- package/dist/esm/ic-toast-region.entry.js +1 -1
- package/dist/esm/ic-toast-region.entry.js.map +1 -1
- package/dist/esm/ic-toast.entry.js +4 -4
- package/dist/esm/ic-toast.entry.js.map +1 -1
- package/dist/esm/ic-toggle-button-group.entry.js +2 -2
- package/dist/esm/ic-toggle-button-group.entry.js.map +1 -1
- package/dist/esm/ic-toggle-button.entry.js +2 -2
- package/dist/esm/ic-toggle-button.entry.js.map +1 -1
- package/dist/esm/ic-tree-item.entry.js +3 -3
- package/dist/esm/ic-tree-view.entry.js +4 -4
- package/dist/esm/index-a7a720e7.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-calendar/ic-calendar.d.ts +216 -0
- package/dist/types/components/ic-calendar/ic-calendar.stories.d.ts +151 -0
- package/dist/types/components/ic-calendar/test/a11y/ic-calendar.test.a11y.d.ts +1 -0
- package/dist/types/components/ic-card-horizontal/ic-card-horizontal.d.ts +1 -2
- package/dist/types/components/ic-date-input/ic-date-input.d.ts +2 -2
- package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +22 -105
- package/dist/types/components/ic-date-picker/ic-date-picker.stories.d.ts +81 -0
- package/dist/types/components/ic-pagination-bar/ic-pagination-bar.d.ts +1 -1
- package/dist/types/components/ic-time-input/ic-time-input.d.ts +2 -2
- package/dist/types/components.d.ts +213 -14
- package/dist/types/utils/date-helpers.d.ts +1 -0
- package/dist/types/utils/types.d.ts +1 -0
- package/hydrate/index.js +2085 -1639
- package/hydrate/index.mjs +2085 -1639
- package/package.json +3 -3
- package/dist/cjs/helpers-da852478.js.map +0 -1
- package/dist/cjs/ic-date-input.cjs.entry.js +0 -1214
- package/dist/cjs/ic-date-input.cjs.entry.js.map +0 -1
- package/dist/collection/components/ic-date-picker/ic-day-button.js.map +0 -1
- package/dist/collection/components/ic-date-picker/ic-month-picker.js +0 -29
- package/dist/collection/components/ic-date-picker/ic-month-picker.js.map +0 -1
- package/dist/collection/components/ic-date-picker/ic-year-picker.js +0 -39
- package/dist/collection/components/ic-date-picker/ic-year-picker.js.map +0 -1
- package/dist/core/p-0f22f41e.js.map +0 -1
- package/dist/core/p-13c8859b.entry.js +0 -2
- package/dist/core/p-13c8859b.entry.js.map +0 -1
- package/dist/core/p-2528ecec.entry.js +0 -2
- package/dist/core/p-2528ecec.entry.js.map +0 -1
- package/dist/core/p-402870f7.entry.js +0 -2
- package/dist/core/p-402870f7.entry.js.map +0 -1
- package/dist/core/p-bd8c2e24.entry.js +0 -2
- package/dist/core/p-bd8c2e24.entry.js.map +0 -1
- package/dist/core/p-c0d4db72.entry.js +0 -2
- package/dist/core/p-c0d4db72.entry.js.map +0 -1
- package/dist/core/p-ea1de762.entry.js.map +0 -1
- package/dist/core/p-f16c4210.entry.js +0 -2
- package/dist/core/p-f16c4210.entry.js.map +0 -1
- package/dist/esm/helpers-89cb996d.js.map +0 -1
- package/dist/esm/ic-date-input.entry.js +0 -1210
- package/dist/esm/ic-date-input.entry.js.map +0 -1
- /package/dist/collection/components/{ic-date-picker → ic-calendar}/ic-day-button.js +0 -0
- /package/dist/core/{p-df220b91.entry.js.map → p-3ef2e98d.entry.js.map} +0 -0
- /package/dist/core/{p-a8cc28a6.entry.js.map → p-9f76eed6.entry.js.map} +0 -0
- /package/dist/core/{p-069e758b.entry.js.map → p-e1920777.entry.js.map} +0 -0
- /package/dist/core/{p-92936b49.entry.js.map → p-ef5b6622.entry.js.map} +0 -0
- /package/dist/core/{p-1ca62941.entry.js.map → p-f5cea10d.entry.js.map} +0 -0
- /package/dist/types/components/{ic-date-picker → ic-calendar}/ic-day-button.d.ts +0 -0
- /package/dist/types/components/{ic-date-picker → ic-calendar}/ic-month-picker.d.ts +0 -0
- /package/dist/types/components/{ic-date-picker → ic-calendar}/ic-year-picker.d.ts +0 -0
|
@@ -1,1214 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-d337cd8a.js');
|
|
6
|
-
const helpers = require('./helpers-da852478.js');
|
|
7
|
-
const dateHelpers = require('./date-helpers-d7ee7b45.js');
|
|
8
|
-
const clearIcon = require('./clear-icon-547aa9b9.js');
|
|
9
|
-
|
|
10
|
-
const Calendar = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
11
|
-
<path d="M16.6667 2.50004H15.8334V0.833374H14.1667V2.50004H5.83342V0.833374H4.16675V2.50004H3.33341C2.41675 2.50004 1.66675 3.25004 1.66675 4.16671V17.5C1.66675 18.4167 2.41675 19.1667 3.33341 19.1667H16.6667C17.5834 19.1667 18.3334 18.4167 18.3334 17.5V4.16671C18.3334 3.25004 17.5834 2.50004 16.6667 2.50004ZM16.6667 17.5H3.33341V6.66671H16.6667V17.5Z" fill="currentColor"/>
|
|
12
|
-
</svg>`;
|
|
13
|
-
|
|
14
|
-
const icDateInputCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=\"button\"],[type=\"reset\"],[type=\"submit\"]{-webkit-appearance:button}button::-moz-focus-inner,[type=\"button\"]::-moz-focus-inner,[type=\"reset\"]::-moz-focus-inner,[type=\"submit\"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=\"button\"]:-moz-focusring,[type=\"reset\"]:-moz-focusring,[type=\"submit\"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=\"checkbox\"],[type=\"radio\"]{box-sizing:border-box;padding:0;}[type=\"number\"]::-webkit-inner-spin-button,[type=\"number\"]::-webkit-outer-spin-button{height:auto}[type=\"search\"]{-webkit-appearance:textfield;outline-offset:-2px;}[type=\"search\"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}:host{--ic-input-label-helpertext-padding:var(--ic-space-xs);--input-bg-color:var(--ic-date-input-bg);--ic-input-label-text-color:var(--ic-date-input-label);--ic-input-label-helper-text-color:var(--ic-date-input-subtitle);--border-color:var(--ic-date-input-border);--border-color-disabled:var(--ic-date-input-border-disabled);--border-color-hover:var(--ic-date-input-border-default-hover);--border-color-pressed:var(--ic-date-input-border-default-pressed);--border-error-color:var(--ic-date-input-border-error);--border-error-color-hover:var(--ic-date-input-border-error-hover);--border-error-color-pressed:var(--ic-date-input-border-error-pressed);--border-success-color:var(--ic-date-input-border-success);--border-success-color-hover:var(--ic-date-input-border-success-hover);--border-success-color-pressed:var(--ic-date-input-border-success-pressed);--border-warning-color:var(--ic-date-input-border-warning);--border-warning-color-hover:var(--ic-date-input-border-warning-hover);--border-warning-color-pressed:var(--ic-date-input-border-warning-pressed)}:host(.ic-date-input-disabled){--ic-input-label-text-color:var(--ic-date-input-label-disabled);--ic-input-label-helper-text-color:var(--ic-date-input-subtitle-disabled)}input{border:0;height:100%;padding:0;outline:none;background:none;-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield;color:var(--ic-date-input-text-filled);caret-color:var(--ic-date-input-typing-cursor)}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none}input:-webkit-autofill{box-shadow:0 0 0 var(--ic-space-sm) var(--ic-color-background-primary) inset;-webkit-text-fill-color:var(--ic-date-input-text-filled) !important}input::-moz-placeholder{color:var(--ic-date-input-text-placeholder)}input::placeholder{color:var(--ic-date-input-text-placeholder)}ic-input-component-container{cursor:text}ic-input-component-container .focus-indicator{padding:var(--ic-space-xxxs) var(--ic-space-xs);align-items:center}.date-inputs{color:var(--ic-date-input-text-placeholder)}.day-input{width:1.438rem}.month-input{width:1.813rem}.year-input,.year-input.fit-to-value{width:2.313rem}.fit-to-value{width:1.25rem}.sr-only{position:absolute;left:-9999px}.input-container{width:100%;display:flex;justify-content:space-between;align-items:center;position:relative}.action-buttons{display:flex;align-items:center}.show-calendar-button-wrapper{display:flex;justify-content:center;align-items:center}.clear-button,.calendar-button{border-radius:var(--ic-border-radius);transition:box-shadow var(--ic-easing-transition),\n border-radius var(--ic-easing-transition);margin:0}.clear-button.hidden{display:none}.clear-button:focus,.calendar-button:focus,.clear-button:active,.calendar-button:active{background-color:var(--ic-color-focus-inner) !important;box-shadow:inset 0 0 0 0.125rem var(--ic-color-focus-outer) !important;border-radius:0.25rem}.calendar-button:focus,.calendar-button:active{--ic-button-tertiary-text-active:var(--ic-atoms-input-clear-button-focus);--ic-button-tertiary-text-hover-active:var(\n --ic-atoms-input-clear-button-focus\n );--ic-button-tertiary-text-pressed-active:var(\n --ic-atoms-input-clear-button-focus\n )}.clear-button:focus,.calendar-button:focus,.clear-button:active *,.calendar-button:active *{fill:var(--ic-atoms-input-clear-button-focus)}.clear-button svg{color:var(--ic-date-input-clear-icon)}.clear-button:focus svg{color:var(--ic-atoms-input-clear-button-focus)}.divider{margin:0 var(--ic-space-xxs);width:var(--ic-space-1px);background-color:var(--ic-atoms-input-divider);border-radius:var(--ic-space-1px)}.divider.small{height:var(--ic-space-md)}.divider.medium{height:calc(var(--ic-space-sm) + var(--ic-space-xs))}.divider.large{height:var(--ic-space-lg)}ic-input-validation{--ic-input-validation-status-text-color:var(--ic-date-input-status-text);--ic-input-validation-error:var(--ic-date-input-icon-error);--ic-input-validation-warning-icon-color:var(--ic-date-input-icon-warning);--ic-input-validation-success-icon-color:var(--ic-date-input-icon-success)}@media (forced-colors: active){.clear-button svg{color:currentcolor}}";
|
|
15
|
-
const IcDateInputStyle0 = icDateInputCss;
|
|
16
|
-
|
|
17
|
-
let inputIds = 0;
|
|
18
|
-
const DateInput = class {
|
|
19
|
-
constructor(hostRef) {
|
|
20
|
-
index.registerInstance(this, hostRef);
|
|
21
|
-
this.calendarButtonClicked = index.createEvent(this, "calendarButtonClicked", 7);
|
|
22
|
-
this.icBlur = index.createEvent(this, "icBlur", 7);
|
|
23
|
-
this.icChange = index.createEvent(this, "icChange", 7);
|
|
24
|
-
this.icFocus = index.createEvent(this, "icFocus", 7);
|
|
25
|
-
this.DEFAULT_DATE_FORMAT = "DD/MM/YYYY";
|
|
26
|
-
this.ARIA_INVALID = "aria-invalid";
|
|
27
|
-
this.ARIA_LABEL = "aria-label";
|
|
28
|
-
this.ARIA_LABELLED_BY = "aria-labelledby";
|
|
29
|
-
this.EVENT_OBJECT_STRING = "[object Event]";
|
|
30
|
-
this.FIT_TO_VALUE = "fit-to-value";
|
|
31
|
-
this.initialValue = this.value;
|
|
32
|
-
this.INPUT_EVENT_OBJECT_STRING = "[object InputEvent]";
|
|
33
|
-
this.inputsInOrder = [];
|
|
34
|
-
this.isAfterMax = false;
|
|
35
|
-
this.isBeforeMin = false;
|
|
36
|
-
this.preventInputsUpdating = false;
|
|
37
|
-
this.isDisabledDate = false;
|
|
38
|
-
this.isValidDay = true;
|
|
39
|
-
this.isValidMonth = true;
|
|
40
|
-
this.isValidDate = true;
|
|
41
|
-
this.isZuluTime = false;
|
|
42
|
-
this.KEYBOARD_EVENT_OBJECT_STRING = "[object KeyboardEvent]";
|
|
43
|
-
this.MAX_DAY = 31;
|
|
44
|
-
this.MAX_MONTH = 12;
|
|
45
|
-
this.previousSelectedDate = null;
|
|
46
|
-
this.selectedDate = null;
|
|
47
|
-
this.externalSetDate = false;
|
|
48
|
-
this.clearInput = false;
|
|
49
|
-
this.calendarIsOpen = false;
|
|
50
|
-
this.calendarFocused = false;
|
|
51
|
-
this.clearButtonFocused = false;
|
|
52
|
-
this.removeLabelledBy = false;
|
|
53
|
-
this.day = "";
|
|
54
|
-
this.month = "";
|
|
55
|
-
this.year = "";
|
|
56
|
-
/**
|
|
57
|
-
* The format in which the date will be displayed.
|
|
58
|
-
*/
|
|
59
|
-
this.dateFormat = this.DEFAULT_DATE_FORMAT;
|
|
60
|
-
/**
|
|
61
|
-
* If `true`, every individual input field completed will emit an icChange event.
|
|
62
|
-
*/
|
|
63
|
-
this.emitDatePartChange = false;
|
|
64
|
-
/**
|
|
65
|
-
* If `true`, the disabled state will be set.
|
|
66
|
-
*/
|
|
67
|
-
this.disabled = false;
|
|
68
|
-
/**
|
|
69
|
-
* The days of the week to disable.
|
|
70
|
-
*/
|
|
71
|
-
this.disableDays = [];
|
|
72
|
-
/**
|
|
73
|
-
* The text to display as the validation message when `disableDays` is set and a disabled date is entered.
|
|
74
|
-
*/
|
|
75
|
-
this.disableDaysMessage = "The date you have selected is on a day of the week that is not allowed. Please select another date.";
|
|
76
|
-
/**
|
|
77
|
-
* If `true`, dates in the future are not allowed. A validation message will appear if a date in the future is entered.
|
|
78
|
-
*/
|
|
79
|
-
this.disableFuture = false;
|
|
80
|
-
/**
|
|
81
|
-
* The text to display as the validation message when `disableFuture` is true and a date in the future is entered.
|
|
82
|
-
*/
|
|
83
|
-
this.disableFutureMessage = "Dates in the future are not allowed. Please select a date in the past.";
|
|
84
|
-
/**
|
|
85
|
-
* If `true`, dates in the past are not allowed. A validation message will appear if a date in the past is entered.
|
|
86
|
-
*/
|
|
87
|
-
this.disablePast = false;
|
|
88
|
-
/**
|
|
89
|
-
* The text to display as the validation message when `disablePast` is true and a date in the past is entered.
|
|
90
|
-
*/
|
|
91
|
-
this.disablePastMessage = "Dates in the past are not allowed. Please select a date in the future.";
|
|
92
|
-
/**
|
|
93
|
-
* If `true`, the helper text will be visually hidden, but still read out by screenreaders.
|
|
94
|
-
*/
|
|
95
|
-
this.hideHelperText = false;
|
|
96
|
-
/**
|
|
97
|
-
* If `true`, the label will be visually hidden, but will still be read out by screen readers.
|
|
98
|
-
*/
|
|
99
|
-
this.hideLabel = false;
|
|
100
|
-
/**
|
|
101
|
-
* The ID for the input.
|
|
102
|
-
*/
|
|
103
|
-
this.inputId = `ic-date-input-${inputIds++}`;
|
|
104
|
-
/**
|
|
105
|
-
* The text to display as the validation message when an invalid date is entered.
|
|
106
|
-
*/
|
|
107
|
-
this.invalidDateMessage = "Please enter a valid date.";
|
|
108
|
-
/**
|
|
109
|
-
* The latest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
|
|
110
|
-
* The value of this prop is ignored if `disableFuture` is set to `true`.
|
|
111
|
-
*/
|
|
112
|
-
this.max = "";
|
|
113
|
-
/**
|
|
114
|
-
* The earliest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
|
|
115
|
-
* The value of this prop is ignored if `disablePast` is set to `true`.
|
|
116
|
-
*/
|
|
117
|
-
this.min = "";
|
|
118
|
-
/**
|
|
119
|
-
* The name of the control, which is submitted with the form data.
|
|
120
|
-
*/
|
|
121
|
-
this.name = this.inputId;
|
|
122
|
-
/**
|
|
123
|
-
* If `true`, the input will require a value.
|
|
124
|
-
*/
|
|
125
|
-
this.required = false;
|
|
126
|
-
/**
|
|
127
|
-
* @internal If `true`, a button which displays the calendar view when clicked will be displayed.
|
|
128
|
-
*/
|
|
129
|
-
this.showCalendarButton = false;
|
|
130
|
-
/**
|
|
131
|
-
* If `true`, a button which clears the date input when clicked will be displayed.
|
|
132
|
-
*/
|
|
133
|
-
this.showClearButton = true;
|
|
134
|
-
/**
|
|
135
|
-
* The size of the date input to be displayed.
|
|
136
|
-
*/
|
|
137
|
-
this.size = "medium";
|
|
138
|
-
/**
|
|
139
|
-
* Sets the date picker to the dark or light theme colors. "inherit" will set the color based on the system settings or ic-theme component.
|
|
140
|
-
*/
|
|
141
|
-
this.theme = "inherit";
|
|
142
|
-
/**
|
|
143
|
-
* The value of the date input. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
|
|
144
|
-
*/
|
|
145
|
-
this.value = "";
|
|
146
|
-
/**
|
|
147
|
-
* The value of the `aria-live` attribute on the validation message.
|
|
148
|
-
*/
|
|
149
|
-
this.validationAriaLive = "polite";
|
|
150
|
-
/**
|
|
151
|
-
* The validation status - e.g. 'error' | 'warning' | 'success'. This will override the built-in date validation.
|
|
152
|
-
*/
|
|
153
|
-
this.validationStatus = "";
|
|
154
|
-
/**
|
|
155
|
-
* The text to display as the validation message. This will override the built-in date validation.
|
|
156
|
-
*/
|
|
157
|
-
this.validationText = "";
|
|
158
|
-
this.setInputPasteValue = (input, pastedValue) => {
|
|
159
|
-
if (input) {
|
|
160
|
-
const inputEl = input;
|
|
161
|
-
inputEl.value = pastedValue;
|
|
162
|
-
inputEl.classList.add(this.FIT_TO_VALUE);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
this.checkSingleCopiedValueIsValid = (input, pastedValue) => {
|
|
166
|
-
let isValid = false;
|
|
167
|
-
const value = Number(pastedValue);
|
|
168
|
-
switch (input) {
|
|
169
|
-
case this.dayInputEl:
|
|
170
|
-
isValid = value >= 1 && value <= this.MAX_DAY;
|
|
171
|
-
break;
|
|
172
|
-
case this.monthInputEl:
|
|
173
|
-
isValid = value >= 1 && value <= this.MAX_MONTH;
|
|
174
|
-
break;
|
|
175
|
-
case this.yearInputEl:
|
|
176
|
-
isValid = true;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
return isValid;
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* Using Object.prototype.string to determine type if event from user
|
|
183
|
-
* @param event - event object used to differentiate keyboard, generic or input event
|
|
184
|
-
* @returns boolean
|
|
185
|
-
*/
|
|
186
|
-
this.isKeyboardOrEvent = (event) => {
|
|
187
|
-
return (Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||
|
|
188
|
-
Object.prototype.toString.call(event) ===
|
|
189
|
-
this.KEYBOARD_EVENT_OBJECT_STRING);
|
|
190
|
-
};
|
|
191
|
-
this.setDateValidity = () => {
|
|
192
|
-
if (!helpers.isEmptyString(this.day)) {
|
|
193
|
-
this.isValidDay = +this.day > this.MAX_DAY ? false : true;
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
this.isValidDay = true;
|
|
197
|
-
}
|
|
198
|
-
if (!helpers.isEmptyString(this.month)) {
|
|
199
|
-
this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
this.isValidMonth = true;
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
this.handleInput = (event) => {
|
|
206
|
-
const inputEvent = event;
|
|
207
|
-
const input = event.target;
|
|
208
|
-
if (input !== this.yearInputEl) {
|
|
209
|
-
// Only auto-format if input event is not a character being deleted
|
|
210
|
-
// and not as user is changing value using up / down keys
|
|
211
|
-
if (inputEvent.inputType !== "deleteContentBackward" &&
|
|
212
|
-
!this.preventAutoFormatting) {
|
|
213
|
-
if (input.value.length === 1 &&
|
|
214
|
-
((input === this.dayInputEl && +input.value >= 4) ||
|
|
215
|
-
(input === this.monthInputEl && +input.value >= 2)) &&
|
|
216
|
-
+input.value <= 9) {
|
|
217
|
-
this.setInputValue(input);
|
|
218
|
-
this.notifyScreenReader(input, event);
|
|
219
|
-
this.moveToNextInput(input);
|
|
220
|
-
}
|
|
221
|
-
if (input.value.length === 2) {
|
|
222
|
-
if (+input.value === 0) {
|
|
223
|
-
input.value = "01";
|
|
224
|
-
}
|
|
225
|
-
this.setInputValue(input);
|
|
226
|
-
this.setPreventInput(input, true);
|
|
227
|
-
this.notifyScreenReader(input, event);
|
|
228
|
-
this.moveToNextInput(input);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
this.setPreventInput(input, false);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
else if (this.preventAutoFormatting) {
|
|
235
|
-
/**
|
|
236
|
-
* Using arrow keys prevents auto formatting so need to deal with
|
|
237
|
-
* switching from arrow keys to inputting numbers
|
|
238
|
-
**/
|
|
239
|
-
if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {
|
|
240
|
-
this.setInputValue(input);
|
|
241
|
-
this.setPreventInput(input, true);
|
|
242
|
-
this.moveToNextInput(input);
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
this.setInputValue(input);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
if (input.value.length !== 2) {
|
|
249
|
-
this.setPreventInput(input, false);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
if (input.value.length === 4) {
|
|
254
|
-
this.setInputValue(input);
|
|
255
|
-
if (Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING) {
|
|
256
|
-
this.moveToNextInput(input);
|
|
257
|
-
}
|
|
258
|
-
this.setPreventInput(input, true);
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
this.setPreventInput(input, false);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
// Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year
|
|
265
|
-
this.setFitToValueStyling(input);
|
|
266
|
-
if (input.value.length === 0) {
|
|
267
|
-
this.setInputValue(input, true);
|
|
268
|
-
this.setValidationMessage();
|
|
269
|
-
}
|
|
270
|
-
this.notifyScreenReader(input, event);
|
|
271
|
-
};
|
|
272
|
-
this.handleKeyDown = (event, isInputPrevented) => {
|
|
273
|
-
var _a;
|
|
274
|
-
const input = event.target;
|
|
275
|
-
const eventKey = (_a = event.key) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
276
|
-
// Regex required due to FF allowing all characters as values for number text field.
|
|
277
|
-
const regex = /-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;
|
|
278
|
-
if (!regex.test(eventKey) &&
|
|
279
|
-
!((event.ctrlKey || event.metaKey) &&
|
|
280
|
-
(eventKey === "v" || eventKey === "c"))) {
|
|
281
|
-
event.preventDefault();
|
|
282
|
-
}
|
|
283
|
-
switch (eventKey) {
|
|
284
|
-
case "/":
|
|
285
|
-
case "-":
|
|
286
|
-
case ".":
|
|
287
|
-
event.preventDefault();
|
|
288
|
-
this.setPasteInvalidText();
|
|
289
|
-
this.moveToNextInput(input);
|
|
290
|
-
break;
|
|
291
|
-
case "arrowright":
|
|
292
|
-
case "arrowleft":
|
|
293
|
-
event.preventDefault();
|
|
294
|
-
this.handleLeftRightArrowKeyPress(input, eventKey);
|
|
295
|
-
break;
|
|
296
|
-
case "arrowup":
|
|
297
|
-
case "arrowdown":
|
|
298
|
-
this.preventAutoFormatting = true;
|
|
299
|
-
this.handleUpDownArrowKeyPress(input, event);
|
|
300
|
-
break;
|
|
301
|
-
case "backspace":
|
|
302
|
-
if (input.value.length === 0) {
|
|
303
|
-
event.preventDefault();
|
|
304
|
-
this.moveToPreviousInput(input);
|
|
305
|
-
}
|
|
306
|
-
break;
|
|
307
|
-
}
|
|
308
|
-
this.preventInput(event, isInputPrevented);
|
|
309
|
-
this.preventInputsUpdating = true;
|
|
310
|
-
};
|
|
311
|
-
this.handleFocus = (event) => {
|
|
312
|
-
// Highlight / select all characters in input for easy replacement
|
|
313
|
-
const input = event.target;
|
|
314
|
-
input.select();
|
|
315
|
-
};
|
|
316
|
-
this.handleBlur = (event) => {
|
|
317
|
-
const input = event.target;
|
|
318
|
-
if (input) {
|
|
319
|
-
this.setPasteInvalidText();
|
|
320
|
-
this.autocompleteInput(input);
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
this.handleLeftRightArrowKeyPress = (input, key) => {
|
|
324
|
-
if (key === "arrowright") {
|
|
325
|
-
this.moveToNextInput(input);
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
this.moveToPreviousInput(input);
|
|
329
|
-
}
|
|
330
|
-
this.setPasteInvalidText();
|
|
331
|
-
};
|
|
332
|
-
this.notifyScreenReaderSelectedDate = () => {
|
|
333
|
-
if (this.selectedDate && this.selectedDateInfoEl) {
|
|
334
|
-
const dayNames = helpers.stringEnumToArray(helpers.IcDayNames);
|
|
335
|
-
const months = helpers.stringEnumToArray(helpers.IcDateInputMonths);
|
|
336
|
-
this.selectedDateInfoEl.textContent = `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
this.handleUpDownArrowKeyPress = (input, event) => {
|
|
340
|
-
const minValue = input === this.yearInputEl ? 0 : 1;
|
|
341
|
-
let maxValue = 9999;
|
|
342
|
-
switch (input) {
|
|
343
|
-
case this.dayInputEl:
|
|
344
|
-
maxValue = this.MAX_DAY;
|
|
345
|
-
break;
|
|
346
|
-
case this.monthInputEl:
|
|
347
|
-
maxValue = this.MAX_MONTH;
|
|
348
|
-
break;
|
|
349
|
-
case this.yearInputEl:
|
|
350
|
-
maxValue = 9999;
|
|
351
|
-
}
|
|
352
|
-
// Make value loop round when min / max reached
|
|
353
|
-
if (input === null || input === void 0 ? void 0 : input.value) {
|
|
354
|
-
if (event.key === "ArrowUp") {
|
|
355
|
-
if (+input.value === maxValue) {
|
|
356
|
-
event.preventDefault();
|
|
357
|
-
input.value = `0${minValue}`;
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
input.value =
|
|
361
|
-
+input.value + 1 < 10
|
|
362
|
-
? `0${+input.value + 1}`
|
|
363
|
-
: (+input.value + 1).toString();
|
|
364
|
-
}
|
|
365
|
-
this.notifyScreenReader(input, event);
|
|
366
|
-
}
|
|
367
|
-
if (event.key === "ArrowDown") {
|
|
368
|
-
if (+input.value === minValue) {
|
|
369
|
-
event.preventDefault();
|
|
370
|
-
input.value = maxValue.toString();
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
input.value =
|
|
374
|
-
+input.value - 1 < 10
|
|
375
|
-
? `0${+input.value - 1}`
|
|
376
|
-
: (+input.value - 1).toString();
|
|
377
|
-
}
|
|
378
|
-
this.notifyScreenReader(input, event);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
if (event.key === "ArrowDown") {
|
|
383
|
-
event.preventDefault();
|
|
384
|
-
input.value =
|
|
385
|
-
input === this.yearInputEl
|
|
386
|
-
? new Date().getFullYear().toString()
|
|
387
|
-
: maxValue.toString();
|
|
388
|
-
this.notifyScreenReader(input, event);
|
|
389
|
-
}
|
|
390
|
-
else if (event.key === "ArrowUp") {
|
|
391
|
-
event.preventDefault();
|
|
392
|
-
input.value =
|
|
393
|
-
input === this.yearInputEl
|
|
394
|
-
? new Date().getFullYear().toString()
|
|
395
|
-
: `0${minValue}`;
|
|
396
|
-
this.notifyScreenReader(input, event);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
this.setInputValue(input);
|
|
400
|
-
this.setFitToValueStyling(input);
|
|
401
|
-
};
|
|
402
|
-
this.handleDateChange = (force) => {
|
|
403
|
-
// Prevent icChange being emitted when each individual input is changed
|
|
404
|
-
// This method is used within componentWillUpdate instead of using @Watch('value');
|
|
405
|
-
if (force || !dateHelpers.dateMatches(this.selectedDate, this.previousSelectedDate)) {
|
|
406
|
-
if (this.value) {
|
|
407
|
-
this.inputsInOrder.forEach((input) => {
|
|
408
|
-
input.classList.add(this.FIT_TO_VALUE);
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
if (this.day && this.month && this.year && this.invalidDateText === "") {
|
|
412
|
-
this.setValueAndEmitChange(this.selectedDate);
|
|
413
|
-
this.notifyScreenReaderSelectedDate();
|
|
414
|
-
}
|
|
415
|
-
else if (!(this.selectedDate === null && this.previousSelectedDate === null) &&
|
|
416
|
-
this.selectedDateInfoEl) {
|
|
417
|
-
this.setValueAndEmitChange(null);
|
|
418
|
-
this.selectedDateInfoEl.textContent = "";
|
|
419
|
-
}
|
|
420
|
-
this.previousSelectedDate = this.selectedDate;
|
|
421
|
-
if (!this.preventInputsUpdating) {
|
|
422
|
-
this.updateInputValues(this.day, this.month, this.year);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
this.slicePastedDate = (valueLength, datePart) => {
|
|
427
|
-
return datePart.length > valueLength
|
|
428
|
-
? datePart.slice(0, valueLength)
|
|
429
|
-
: datePart;
|
|
430
|
-
};
|
|
431
|
-
this.isPastedStringDateValid = (value) => {
|
|
432
|
-
if (/\d+-\d+-\d+$/.test(value) ||
|
|
433
|
-
/\d+\/\d+\/\d+/.test(value) ||
|
|
434
|
-
/\d+\.\d+\.\d+/.test(value)) {
|
|
435
|
-
return true;
|
|
436
|
-
}
|
|
437
|
-
if (/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(value)) {
|
|
438
|
-
this.isZuluTime = true;
|
|
439
|
-
return true;
|
|
440
|
-
}
|
|
441
|
-
return false;
|
|
442
|
-
};
|
|
443
|
-
// Set value of each input to value of pasted date part
|
|
444
|
-
// Allows formats separated by '-' or '/'
|
|
445
|
-
this.handlePaste = (event) => {
|
|
446
|
-
var _a;
|
|
447
|
-
event.preventDefault();
|
|
448
|
-
const pastedValue = ((_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("Text")) || "";
|
|
449
|
-
const isValidDate = this.isPastedStringDateValid(pastedValue);
|
|
450
|
-
this.setPastedValueAndValidation(isValidDate, pastedValue, event);
|
|
451
|
-
};
|
|
452
|
-
this.setDate = (date) => {
|
|
453
|
-
if (date === null || date === "" || date === undefined) {
|
|
454
|
-
if (this.day)
|
|
455
|
-
this.day = "";
|
|
456
|
-
if (this.month)
|
|
457
|
-
this.month = "";
|
|
458
|
-
if (this.year)
|
|
459
|
-
this.year = "";
|
|
460
|
-
this.inputsInOrder.forEach((input) => {
|
|
461
|
-
input.classList.remove(this.FIT_TO_VALUE);
|
|
462
|
-
this.setPreventInput(input, false);
|
|
463
|
-
});
|
|
464
|
-
this.handleDateChange(true);
|
|
465
|
-
}
|
|
466
|
-
else {
|
|
467
|
-
if (dateHelpers.isDateOrEpoch(date)) {
|
|
468
|
-
let newDate;
|
|
469
|
-
if (typeof date === "string") {
|
|
470
|
-
// Checking if epoch date time
|
|
471
|
-
newDate = new Date(+date);
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
newDate = date;
|
|
475
|
-
}
|
|
476
|
-
this.day = dateHelpers.convertToDoubleDigits(newDate.getDate());
|
|
477
|
-
this.month = dateHelpers.convertToDoubleDigits(newDate.getMonth() + 1);
|
|
478
|
-
this.year = newDate.getFullYear().toString();
|
|
479
|
-
}
|
|
480
|
-
else if (typeof date === "string") {
|
|
481
|
-
const defaultDateArray = dateHelpers.splitStringDate(date, this.dateFormat);
|
|
482
|
-
this.selectedDate = new Date(Number(defaultDateArray[0]), Number(defaultDateArray[1]) - 1, Number(defaultDateArray[2]));
|
|
483
|
-
this.year = defaultDateArray[0];
|
|
484
|
-
this.month = defaultDateArray[1];
|
|
485
|
-
this.day = defaultDateArray[2];
|
|
486
|
-
this.setValueAndEmitChange(this.selectedDate);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
this.setValidationMessage();
|
|
490
|
-
};
|
|
491
|
-
this.formatMinMax = (date) => {
|
|
492
|
-
let formattedDate;
|
|
493
|
-
const day = dateHelpers.convertToDoubleDigits(date.getDate());
|
|
494
|
-
const month = dateHelpers.convertToDoubleDigits(date.getMonth() + 1);
|
|
495
|
-
const year = date.getFullYear();
|
|
496
|
-
switch (this.dateFormat) {
|
|
497
|
-
case this.DEFAULT_DATE_FORMAT:
|
|
498
|
-
formattedDate = `${day}/${month}/${year}`;
|
|
499
|
-
break;
|
|
500
|
-
case "MM/DD/YYYY":
|
|
501
|
-
formattedDate = `${month}/${day}/${year}`;
|
|
502
|
-
break;
|
|
503
|
-
case "YYYY/MM/DD":
|
|
504
|
-
formattedDate = `${year}/${month}/${day}`;
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
return formattedDate;
|
|
508
|
-
};
|
|
509
|
-
this.updateInputValues = (day, month, year) => {
|
|
510
|
-
if (this.dayInputEl && this.monthInputEl && this.yearInputEl) {
|
|
511
|
-
this.dayInputEl.value = day;
|
|
512
|
-
this.monthInputEl.value = month;
|
|
513
|
-
this.yearInputEl.value = year;
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
// Set value in state based on input
|
|
517
|
-
this.setInputValue = (input, clear = false) => {
|
|
518
|
-
const newValue = clear ? "" : input.value;
|
|
519
|
-
switch (input) {
|
|
520
|
-
case this.dayInputEl:
|
|
521
|
-
this.day = newValue;
|
|
522
|
-
break;
|
|
523
|
-
case this.monthInputEl:
|
|
524
|
-
this.month = newValue;
|
|
525
|
-
break;
|
|
526
|
-
case this.yearInputEl:
|
|
527
|
-
if (this.year !== newValue) {
|
|
528
|
-
this.year = newValue;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
this.setValidationMessage();
|
|
532
|
-
};
|
|
533
|
-
this.setValidationMessage = () => {
|
|
534
|
-
this.setDateValidity();
|
|
535
|
-
if (!helpers.isEmptyString(this.day) &&
|
|
536
|
-
!helpers.isEmptyString(this.month) &&
|
|
537
|
-
!helpers.isEmptyString(this.year)) {
|
|
538
|
-
// Check whether date actually exists
|
|
539
|
-
// (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)
|
|
540
|
-
this.selectedDate = this.convertToDate(this.year, this.month, this.day);
|
|
541
|
-
this.isValidDate =
|
|
542
|
-
!!this.selectedDate && this.selectedDate.getDate() == +this.day;
|
|
543
|
-
this.isDisabledDate = this.isSelectedDateDisabled();
|
|
544
|
-
if (!this.isValidDate || this.isDisabledDate) {
|
|
545
|
-
this.inputsInOrder.forEach((input) => input.setAttribute(this.ARIA_INVALID, "true"));
|
|
546
|
-
}
|
|
547
|
-
else {
|
|
548
|
-
this.inputsInOrder.forEach((input) => input.removeAttribute(this.ARIA_INVALID));
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
else {
|
|
552
|
-
this.selectedDate = null;
|
|
553
|
-
}
|
|
554
|
-
if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {
|
|
555
|
-
this.invalidDateText = this.invalidDateMessage;
|
|
556
|
-
}
|
|
557
|
-
else if (this.isDisabledDate && this.selectedDate !== null) {
|
|
558
|
-
if (this.isBeforeMin) {
|
|
559
|
-
if (this.disablePast) {
|
|
560
|
-
this.invalidDateText = this.disablePastMessage;
|
|
561
|
-
}
|
|
562
|
-
else {
|
|
563
|
-
this.invalidDateText = `Please enter a date after ${this.formatMinMax(this.minDate)}.`;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
else if (this.isAfterMax) {
|
|
567
|
-
if (this.disableFuture) {
|
|
568
|
-
this.invalidDateText = this.disableFutureMessage;
|
|
569
|
-
}
|
|
570
|
-
else {
|
|
571
|
-
this.invalidDateText = `Please enter a date before ${this.formatMinMax(this.maxDate)}.`;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
else if (this.disableDays.length !== 0) {
|
|
575
|
-
this.invalidDateText = this.disableDaysMessage;
|
|
576
|
-
}
|
|
577
|
-
else {
|
|
578
|
-
if (this.disablePast) {
|
|
579
|
-
this.invalidDateText = this.disablePastMessage;
|
|
580
|
-
}
|
|
581
|
-
if (this.disableFuture) {
|
|
582
|
-
this.invalidDateText = this.disableFutureMessage;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
this.invalidDateText = "";
|
|
588
|
-
}
|
|
589
|
-
};
|
|
590
|
-
// Set refs to the input elements in the order they are displayed (based on the dateFormat)
|
|
591
|
-
this.setInputsInOrder = () => {
|
|
592
|
-
var _a;
|
|
593
|
-
(_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("input").forEach((input) => this.inputsInOrder.push(input));
|
|
594
|
-
};
|
|
595
|
-
// Includes text usually added using aria-describedby
|
|
596
|
-
// (which doesn't work on input component container)
|
|
597
|
-
this.setAriaLabelledBy = () => {
|
|
598
|
-
var _a, _b, _c;
|
|
599
|
-
if (this.disabled &&
|
|
600
|
-
!helpers.isEmptyString((_a = this.inputCompContainerEl) === null || _a === void 0 ? void 0 : _a.getAttribute(this.ARIA_LABELLED_BY))) {
|
|
601
|
-
this.removeAriaLabelledBy();
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
if (this.disabled) {
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
const labelEl = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("label");
|
|
608
|
-
const labelId = `${this.inputId}-label`;
|
|
609
|
-
if (labelEl !== null && labelEl !== undefined) {
|
|
610
|
-
labelEl.id = labelId;
|
|
611
|
-
}
|
|
612
|
-
const hasValidation = !helpers.isEmptyString(this.validationStatus) ||
|
|
613
|
-
!helpers.isEmptyString(this.invalidDateText);
|
|
614
|
-
const labelledBy = `${(_c = labelEl === null || labelEl === void 0 ? void 0 : labelEl.id) !== null && _c !== void 0 ? _c : ""} ${this.screenReaderInfoId} ${helpers.getInputDescribedByText(this.el, this.inputId, this.helperText !== "" && this.helperText !== this.defaultHelperText, hasValidation)} ${this.selectedDate ? this.selectedDateInfoId : ""} ${this.assistiveHintId}`;
|
|
615
|
-
this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);
|
|
616
|
-
};
|
|
617
|
-
// Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)
|
|
618
|
-
this.setPreventInput = (input, isPrevented) => {
|
|
619
|
-
switch (input) {
|
|
620
|
-
case this.dayInputEl:
|
|
621
|
-
this.preventDayInput = isPrevented;
|
|
622
|
-
break;
|
|
623
|
-
case this.monthInputEl:
|
|
624
|
-
this.preventMonthInput = isPrevented;
|
|
625
|
-
break;
|
|
626
|
-
case this.yearInputEl:
|
|
627
|
-
this.preventYearInput = isPrevented;
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
// Get input based on letter representing each date part ("D", "M" or "Y")
|
|
631
|
-
// (retrieved from dateFormat)
|
|
632
|
-
this.getInputFromDatePart = (datePart) => {
|
|
633
|
-
const dayInput = (index.h("input", { class: "day-input", id: "day-input", ref: (el) => (this.dayInputEl = el), "aria-label": "day", placeholder: "DD", disabled: this.disabled, "aria-required": `${this.required}`, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventDayInput) }));
|
|
634
|
-
const monthInput = (index.h("input", { id: "month-input", class: "month-input", ref: (el) => (this.monthInputEl = el), "aria-label": "month", placeholder: "MM", disabled: this.disabled, "aria-required": `${this.required}`, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventMonthInput) }));
|
|
635
|
-
const yearInput = (index.h("input", { id: "year-input", class: "year-input", ref: (el) => (this.yearInputEl = el), "aria-label": "year", placeholder: "YYYY", maxLength: 4, disabled: this.disabled, "aria-required": `${this.required}`, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventYearInput) }));
|
|
636
|
-
let input;
|
|
637
|
-
switch (datePart) {
|
|
638
|
-
case "D":
|
|
639
|
-
input = dayInput;
|
|
640
|
-
break;
|
|
641
|
-
case "M":
|
|
642
|
-
input = monthInput;
|
|
643
|
-
break;
|
|
644
|
-
case "Y":
|
|
645
|
-
input = yearInput;
|
|
646
|
-
}
|
|
647
|
-
return input;
|
|
648
|
-
};
|
|
649
|
-
// Get input elements in order of chosen date format
|
|
650
|
-
this.getInputsInOrder = () => {
|
|
651
|
-
const dateParts = this.dateFormat.split("/");
|
|
652
|
-
const inputsInOrder = [];
|
|
653
|
-
dateParts.forEach((part) => {
|
|
654
|
-
inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));
|
|
655
|
-
});
|
|
656
|
-
return inputsInOrder;
|
|
657
|
-
};
|
|
658
|
-
// To add to the end of assistive hint to make it clearer that each date part has its own input
|
|
659
|
-
// that can be changed individually
|
|
660
|
-
this.getDescOfInputsOrder = () => {
|
|
661
|
-
let description;
|
|
662
|
-
switch (this.dateFormat) {
|
|
663
|
-
case this.DEFAULT_DATE_FORMAT:
|
|
664
|
-
description = "day, month, and year";
|
|
665
|
-
break;
|
|
666
|
-
case "MM/DD/YYYY":
|
|
667
|
-
description = "month, day, and year";
|
|
668
|
-
break;
|
|
669
|
-
case "YYYY/MM/DD":
|
|
670
|
-
description = "year, month, and day";
|
|
671
|
-
}
|
|
672
|
-
return description;
|
|
673
|
-
};
|
|
674
|
-
// Add 'required' or 'invalid data' to span used in aria-labelledby
|
|
675
|
-
// Many ARIA attributes aren't read out by screen reader when on the input component container
|
|
676
|
-
this.getScreenReaderInfo = (validationStatus) => {
|
|
677
|
-
let inputDescriptors = "";
|
|
678
|
-
if (this.required) {
|
|
679
|
-
inputDescriptors += "required";
|
|
680
|
-
}
|
|
681
|
-
if (validationStatus === helpers.IcInformationStatus.Error) {
|
|
682
|
-
inputDescriptors += " invalid data";
|
|
683
|
-
}
|
|
684
|
-
return inputDescriptors === "" ? "" : inputDescriptors + ", ";
|
|
685
|
-
};
|
|
686
|
-
// Prevent non-number characters being entered
|
|
687
|
-
// ('e' or '.' - which are usually allowed in <input type="number">)
|
|
688
|
-
// And limit the number of characters within each field (2 for day / month, 4 for year)
|
|
689
|
-
// (because 'maxlength' doesn't work on <input type="number">)
|
|
690
|
-
this.preventInput = (event, isInputPrevented) => {
|
|
691
|
-
const key = event.key;
|
|
692
|
-
const input = event.target;
|
|
693
|
-
let selectedString;
|
|
694
|
-
if (input) {
|
|
695
|
-
selectedString = input.value.substring(input.selectionStart || 0, input.selectionEnd || undefined);
|
|
696
|
-
}
|
|
697
|
-
if (key === "e" ||
|
|
698
|
-
key === "." ||
|
|
699
|
-
key === "-" ||
|
|
700
|
-
(event.key >= "0" &&
|
|
701
|
-
event.key <= "9" &&
|
|
702
|
-
isInputPrevented &&
|
|
703
|
-
!selectedString)) {
|
|
704
|
-
event.preventDefault();
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
|
-
/**
|
|
708
|
-
* Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day
|
|
709
|
-
* Consider using dateClamp and inDateRange
|
|
710
|
-
* @returns `boolean`
|
|
711
|
-
*/
|
|
712
|
-
this.isSelectedDateDisabled = () => {
|
|
713
|
-
if (!this.selectedDate)
|
|
714
|
-
return false;
|
|
715
|
-
const currentDate = new Date();
|
|
716
|
-
const isNotToday = this.selectedDate.toDateString() !== currentDate.toDateString();
|
|
717
|
-
this.isAfterMax =
|
|
718
|
-
this.maxDate && this.selectedDate > this.maxDate && isNotToday;
|
|
719
|
-
this.isBeforeMin =
|
|
720
|
-
this.minDate && this.selectedDate < this.minDate && isNotToday;
|
|
721
|
-
return (this.isAfterMax ||
|
|
722
|
-
this.isBeforeMin ||
|
|
723
|
-
this.disableDays.includes(this.selectedDate.getDay()) ||
|
|
724
|
-
(((!!this.disablePast && this.selectedDate < currentDate) ||
|
|
725
|
-
(!!this.disableFuture && this.selectedDate > currentDate)) &&
|
|
726
|
-
isNotToday));
|
|
727
|
-
};
|
|
728
|
-
this.moveToNextInput = (currentInput) => {
|
|
729
|
-
var _a;
|
|
730
|
-
this.preventAutoFormatting = false;
|
|
731
|
-
(_a = this.inputsInOrder[this.inputsInOrder.findIndex((input) => input === currentInput) + 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
732
|
-
};
|
|
733
|
-
this.moveToPreviousInput = (currentInput) => {
|
|
734
|
-
var _a;
|
|
735
|
-
this.preventAutoFormatting = false;
|
|
736
|
-
(_a = this.inputsInOrder[this.inputsInOrder.findIndex((input) => input === currentInput) - 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
737
|
-
};
|
|
738
|
-
this.autocompleteInput = (input) => {
|
|
739
|
-
const inputValue = input.value;
|
|
740
|
-
if (this.yearInputEl && input === this.yearInputEl) {
|
|
741
|
-
// Autocomplete year as current millennium when fewer than 4 characters entered
|
|
742
|
-
const yearNumbers = ["2", "0", "0"];
|
|
743
|
-
let autocompletedInput = "";
|
|
744
|
-
if (inputValue) {
|
|
745
|
-
yearNumbers.forEach((number, index) => {
|
|
746
|
-
if (inputValue.length + index <= 3) {
|
|
747
|
-
autocompletedInput += number;
|
|
748
|
-
}
|
|
749
|
-
});
|
|
750
|
-
this.yearInputEl.value = `${autocompletedInput}${inputValue}`;
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
else if (inputValue.length === 1) {
|
|
754
|
-
// Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)
|
|
755
|
-
input.value = +inputValue === 0 ? "01" : `0${inputValue}`;
|
|
756
|
-
}
|
|
757
|
-
if (input.value) {
|
|
758
|
-
this.setInputValue(input);
|
|
759
|
-
}
|
|
760
|
-
};
|
|
761
|
-
this.convertToDate = (year, month, day) => {
|
|
762
|
-
if (!helpers.isEmptyString(year) && !helpers.isEmptyString(month) && !helpers.isEmptyString(day)) {
|
|
763
|
-
return new Date(+year, +month - 1, +day);
|
|
764
|
-
}
|
|
765
|
-
else {
|
|
766
|
-
return null;
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
this.handleHostBlur = () => {
|
|
770
|
-
this.removeLabelledBy = false;
|
|
771
|
-
this.icBlur.emit({ value: this.selectedDate });
|
|
772
|
-
};
|
|
773
|
-
this.handleHostFocus = () => {
|
|
774
|
-
var _a, _b;
|
|
775
|
-
if ((_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) === null || _b === void 0 ? void 0 : _b.id.match(/(day|month|year)-input$/)) {
|
|
776
|
-
this.removeLabelledBy = false;
|
|
777
|
-
}
|
|
778
|
-
else {
|
|
779
|
-
this.removeLabelledBy = true;
|
|
780
|
-
}
|
|
781
|
-
this.icFocus.emit({ value: this.selectedDate });
|
|
782
|
-
};
|
|
783
|
-
this.handleFormReset = () => {
|
|
784
|
-
// Get the initial value and populate day, month and year again.
|
|
785
|
-
this.setDate(this.initialValue);
|
|
786
|
-
this.setValidationMessage();
|
|
787
|
-
this.handleDateChange(false);
|
|
788
|
-
};
|
|
789
|
-
this.getAriaLabel = (input) => input.getAttribute(this.ARIA_LABEL);
|
|
790
|
-
this.notifyScreenReaderArrowKeys = (input) => {
|
|
791
|
-
var _a;
|
|
792
|
-
const liveRegion = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("#live-region");
|
|
793
|
-
const ariaLabel = this.getAriaLabel(input);
|
|
794
|
-
if (liveRegion && input.value && ariaLabel) {
|
|
795
|
-
let announcement = "";
|
|
796
|
-
if (input === this.monthInputEl &&
|
|
797
|
-
!!helpers.IcDateInputMonths[+input.value - 1]) {
|
|
798
|
-
announcement = `${input.value} - ${helpers.IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
|
|
799
|
-
}
|
|
800
|
-
if (input === this.dayInputEl || input === this.yearInputEl) {
|
|
801
|
-
announcement = `${input.value}, ${ariaLabel}`;
|
|
802
|
-
}
|
|
803
|
-
liveRegion.textContent = announcement;
|
|
804
|
-
}
|
|
805
|
-
};
|
|
806
|
-
this.notifyScreenReaderInput = (input, liveRegion) => {
|
|
807
|
-
const ariaLabel = this.getAriaLabel(input);
|
|
808
|
-
const value = input.value;
|
|
809
|
-
if (ariaLabel && value) {
|
|
810
|
-
let announcement = "";
|
|
811
|
-
const monthValue = helpers.IcDateInputMonths[+value - 1];
|
|
812
|
-
if (input === this.monthInputEl &&
|
|
813
|
-
!!monthValue &&
|
|
814
|
-
this.isValidMonth &&
|
|
815
|
-
value.length === 2) {
|
|
816
|
-
announcement = `${value} - ${monthValue}`;
|
|
817
|
-
}
|
|
818
|
-
else if ((input === this.dayInputEl && this.isValidDay && value.length === 2) ||
|
|
819
|
-
(input === this.yearInputEl && value.length === 4)) {
|
|
820
|
-
announcement = value;
|
|
821
|
-
}
|
|
822
|
-
liveRegion.textContent = `${announcement}, ${ariaLabel}`;
|
|
823
|
-
}
|
|
824
|
-
};
|
|
825
|
-
this.setFitToValueStyling = (input) => {
|
|
826
|
-
if (input.value) {
|
|
827
|
-
input.classList.add(this.FIT_TO_VALUE);
|
|
828
|
-
}
|
|
829
|
-
else {
|
|
830
|
-
input.classList.remove(this.FIT_TO_VALUE);
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
this.setAriaInvalid = (validDay, validMonth, validDate, disabledDate) => {
|
|
834
|
-
var _a, _b;
|
|
835
|
-
if (this.inputsInOrder.length) {
|
|
836
|
-
this.inputsInOrder.forEach((input) => {
|
|
837
|
-
input.removeAttribute(this.ARIA_INVALID);
|
|
838
|
-
});
|
|
839
|
-
if (!validDay) {
|
|
840
|
-
(_a = this.dayInputEl) === null || _a === void 0 ? void 0 : _a.setAttribute(this.ARIA_INVALID, "true");
|
|
841
|
-
}
|
|
842
|
-
if (!validMonth) {
|
|
843
|
-
(_b = this.monthInputEl) === null || _b === void 0 ? void 0 : _b.setAttribute(this.ARIA_INVALID, "true");
|
|
844
|
-
}
|
|
845
|
-
if (!validDate || disabledDate) {
|
|
846
|
-
this.inputsInOrder.forEach((input) => {
|
|
847
|
-
input.setAttribute(this.ARIA_INVALID, "true");
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
this.handleClear = () => {
|
|
853
|
-
this.clearInput = true;
|
|
854
|
-
this.inputsInOrder.forEach((input) => {
|
|
855
|
-
input.classList.remove(this.FIT_TO_VALUE);
|
|
856
|
-
this.setInputValue(input, true);
|
|
857
|
-
this.setPreventInput(input, false);
|
|
858
|
-
});
|
|
859
|
-
this.clearInput = false;
|
|
860
|
-
this.preventInputsUpdating = false;
|
|
861
|
-
this.setValidationMessage();
|
|
862
|
-
this.handleDateChange(true);
|
|
863
|
-
this.inputsInOrder[0].focus();
|
|
864
|
-
};
|
|
865
|
-
this.handleCalendarOpen = (ev) => {
|
|
866
|
-
var _a, _b, _c, _d, _e, _f;
|
|
867
|
-
ev.stopImmediatePropagation();
|
|
868
|
-
(_c = (_b = (_a = this.calendarButtonEl) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("ic-tooltip")) === null || _c === void 0 ? void 0 : _c.displayTooltip(false);
|
|
869
|
-
this.calendarButtonClicked.emit({ value: this.selectedDate });
|
|
870
|
-
(_f = (_e = (_d = this.calendarButtonEl) === null || _d === void 0 ? void 0 : _d.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector("ic-tooltip")) === null || _f === void 0 ? void 0 : _f.displayTooltip(false);
|
|
871
|
-
this.preventInputsUpdating = false;
|
|
872
|
-
this.calendarIsOpen = true;
|
|
873
|
-
};
|
|
874
|
-
this.setValueAndEmitChange = (value) => {
|
|
875
|
-
if (!dateHelpers.dateMatches(this.value ? new Date(this.value) : null, value)) {
|
|
876
|
-
this.emitIcChange(value);
|
|
877
|
-
this.value = value;
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
this.handleCalendarFocus = () => {
|
|
881
|
-
this.calendarFocused = true;
|
|
882
|
-
if (this.calendarIsOpen) {
|
|
883
|
-
// focus event triggered by closing calendar dialog so inputs should update
|
|
884
|
-
this.preventInputsUpdating = false;
|
|
885
|
-
this.calendarIsOpen = false;
|
|
886
|
-
}
|
|
887
|
-
else {
|
|
888
|
-
this.preventInputsUpdating = true;
|
|
889
|
-
}
|
|
890
|
-
};
|
|
891
|
-
this.handleCalendarBlur = () => {
|
|
892
|
-
this.calendarFocused = false;
|
|
893
|
-
this.preventInputsUpdating = true;
|
|
894
|
-
};
|
|
895
|
-
this.handleClearFocus = () => {
|
|
896
|
-
this.removeLabelledBy = true;
|
|
897
|
-
this.preventInputsUpdating = true;
|
|
898
|
-
this.clearButtonFocused = true;
|
|
899
|
-
};
|
|
900
|
-
this.handleClearBlur = (ev) => {
|
|
901
|
-
var _a;
|
|
902
|
-
this.clearButtonFocused = false;
|
|
903
|
-
this.preventInputsUpdating = true;
|
|
904
|
-
if ((_a = ev.relatedTarget) === null || _a === void 0 ? void 0 : _a.id.match(/(day|year)-input$/)) {
|
|
905
|
-
this.removeLabelledBy = false;
|
|
906
|
-
return;
|
|
907
|
-
}
|
|
908
|
-
this.removeLabelledBy = true;
|
|
909
|
-
};
|
|
910
|
-
this.emitIcChange = (d) => {
|
|
911
|
-
this.selectedDate = d;
|
|
912
|
-
if (!dateHelpers.dateMatches(this.selectedDate, d) ||
|
|
913
|
-
this.day !== null ||
|
|
914
|
-
this.month !== null ||
|
|
915
|
-
this.year !== null) {
|
|
916
|
-
let UTCDate = null;
|
|
917
|
-
if (d !== null) {
|
|
918
|
-
UTCDate = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
|
|
919
|
-
}
|
|
920
|
-
this.icChange.emit({
|
|
921
|
-
value: d,
|
|
922
|
-
dateObject: {
|
|
923
|
-
day: this.day === "" ? null : this.day,
|
|
924
|
-
month: this.month === "" ? null : this.month,
|
|
925
|
-
year: this.year === "" ? null : this.year,
|
|
926
|
-
},
|
|
927
|
-
utcValue: UTCDate,
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
watchInputHandler() {
|
|
933
|
-
if (this.emitDatePartChange &&
|
|
934
|
-
!this.externalSetDate &&
|
|
935
|
-
!this.clearInput &&
|
|
936
|
-
!(this.day && this.month && this.year) &&
|
|
937
|
-
this.selectedDate === null) {
|
|
938
|
-
this.emitIcChange(this.selectedDate);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
watchDisabledHandler() {
|
|
942
|
-
helpers.removeDisabledFalse(this.disabled, this.el);
|
|
943
|
-
}
|
|
944
|
-
watchDisableFutureHandler() {
|
|
945
|
-
this.watchMaxHandler();
|
|
946
|
-
}
|
|
947
|
-
watchDisablePastHandler() {
|
|
948
|
-
this.watchMinHandler();
|
|
949
|
-
}
|
|
950
|
-
watchMaxHandler() {
|
|
951
|
-
if (this.disableFuture) {
|
|
952
|
-
this.maxDate = new Date();
|
|
953
|
-
}
|
|
954
|
-
else {
|
|
955
|
-
this.maxDate = dateHelpers.createDate(this.max, this.dateFormat);
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
watchMinHandler() {
|
|
959
|
-
if (this.disablePast) {
|
|
960
|
-
this.minDate = new Date();
|
|
961
|
-
}
|
|
962
|
-
else {
|
|
963
|
-
this.minDate = dateHelpers.createDate(this.min, this.dateFormat);
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
watchRequiredHandler() {
|
|
967
|
-
var _a, _b;
|
|
968
|
-
// Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)
|
|
969
|
-
// Needed because label is included in 'aria-labelledby' instead of using 'aria-label'
|
|
970
|
-
const labelEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("label");
|
|
971
|
-
if (this.required) {
|
|
972
|
-
const asteriskSpan = document.createElement("span");
|
|
973
|
-
asteriskSpan.setAttribute("id", "asterisk-span");
|
|
974
|
-
asteriskSpan.setAttribute("aria-hidden", "true");
|
|
975
|
-
asteriskSpan.textContent = " *";
|
|
976
|
-
labelEl === null || labelEl === void 0 ? void 0 : labelEl.appendChild(asteriskSpan);
|
|
977
|
-
}
|
|
978
|
-
else {
|
|
979
|
-
const asteriskSpan = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("#asterisk-span");
|
|
980
|
-
if (asteriskSpan) {
|
|
981
|
-
asteriskSpan.remove();
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
disconnectedCallback() {
|
|
986
|
-
helpers.removeFormResetListener(this.el, this.handleFormReset);
|
|
987
|
-
}
|
|
988
|
-
componentWillLoad() {
|
|
989
|
-
this.defaultHelperText = `Use format ${this.dateFormat}`;
|
|
990
|
-
if (helpers.isEmptyString(this.helperText))
|
|
991
|
-
this.helperText = this.defaultHelperText;
|
|
992
|
-
this.watchMinHandler();
|
|
993
|
-
this.watchMaxHandler();
|
|
994
|
-
if (this.value) {
|
|
995
|
-
this.externalSetDate = true;
|
|
996
|
-
this.setDate(this.value);
|
|
997
|
-
}
|
|
998
|
-
this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;
|
|
999
|
-
this.assistiveHintId = `${this.inputId}-assistive-hint`;
|
|
1000
|
-
this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
|
|
1001
|
-
helpers.addFormResetListener(this.el, this.handleFormReset);
|
|
1002
|
-
helpers.removeDisabledFalse(this.disabled, this.el);
|
|
1003
|
-
}
|
|
1004
|
-
componentDidLoad() {
|
|
1005
|
-
this.setInputsInOrder();
|
|
1006
|
-
helpers.onComponentRequiredPropUndefined([{ prop: this.label, propName: "label" }], "Date Input");
|
|
1007
|
-
if (this.value) {
|
|
1008
|
-
this.updateInputValues(this.day, this.month, this.year);
|
|
1009
|
-
this.inputsInOrder.forEach((input) => {
|
|
1010
|
-
input.classList.add(this.FIT_TO_VALUE);
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
|
|
1014
|
-
if (this.value) {
|
|
1015
|
-
this.notifyScreenReaderSelectedDate();
|
|
1016
|
-
}
|
|
1017
|
-
this.inputsInOrder.forEach((input) => {
|
|
1018
|
-
input.addEventListener("input", this.handleInput);
|
|
1019
|
-
input.addEventListener("focus", this.handleFocus);
|
|
1020
|
-
input.addEventListener("blur", this.handleBlur);
|
|
1021
|
-
});
|
|
1022
|
-
this.watchRequiredHandler();
|
|
1023
|
-
}
|
|
1024
|
-
componentWillUpdate() {
|
|
1025
|
-
if (helpers.isEmptyString(this.helperText))
|
|
1026
|
-
this.helperText = this.defaultHelperText;
|
|
1027
|
-
if (!this.preventInputsUpdating)
|
|
1028
|
-
this.setDate(this.value);
|
|
1029
|
-
this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
|
|
1030
|
-
this.handleDateChange(false);
|
|
1031
|
-
this.preventInputsUpdating = false;
|
|
1032
|
-
}
|
|
1033
|
-
componentDidRender() {
|
|
1034
|
-
if (this.removeLabelledBy) {
|
|
1035
|
-
this.removeAriaLabelledBy();
|
|
1036
|
-
return;
|
|
1037
|
-
}
|
|
1038
|
-
this.setAriaLabelledBy();
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Returns the value as a Date object
|
|
1042
|
-
* @returns Date
|
|
1043
|
-
*/
|
|
1044
|
-
async getDate() {
|
|
1045
|
-
return this.selectedDate;
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* @internal Sets focus on the calendar button.
|
|
1049
|
-
*/
|
|
1050
|
-
async setCalendarFocus() {
|
|
1051
|
-
if (this.calendarButtonEl) {
|
|
1052
|
-
this.calendarButtonEl.focus();
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
/**
|
|
1056
|
-
* @internal Used to pass disabledDays from parent component.
|
|
1057
|
-
*/
|
|
1058
|
-
async setDisableDays(days) {
|
|
1059
|
-
this.disableDays = days;
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* @internal Used to enable other components to invoke an IcChange event from the input.
|
|
1063
|
-
*/
|
|
1064
|
-
async triggerIcChange(d) {
|
|
1065
|
-
this.externalSetDate = true;
|
|
1066
|
-
this.setDate(d);
|
|
1067
|
-
this.emitIcChange(d);
|
|
1068
|
-
this.externalSetDate = false;
|
|
1069
|
-
}
|
|
1070
|
-
removeAriaLabelledBy() {
|
|
1071
|
-
this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);
|
|
1072
|
-
}
|
|
1073
|
-
setPastedValueAndValidation(isValidDate, pastedValue, event) {
|
|
1074
|
-
switch (true) {
|
|
1075
|
-
case isValidDate: {
|
|
1076
|
-
const nextParsedValue = this.isZuluTime
|
|
1077
|
-
? dateHelpers.extractDateFromZuluDateTime(pastedValue)
|
|
1078
|
-
: pastedValue;
|
|
1079
|
-
const dateParts = nextParsedValue.split(/-|\/|\./);
|
|
1080
|
-
this.inputsInOrder.forEach((input, index) => {
|
|
1081
|
-
input.classList.add(this.FIT_TO_VALUE);
|
|
1082
|
-
if (this.isZuluTime) {
|
|
1083
|
-
this.pasteZuluDateTime(dateParts, index);
|
|
1084
|
-
}
|
|
1085
|
-
else {
|
|
1086
|
-
let dateValue;
|
|
1087
|
-
if (input === this.dayInputEl || input === this.monthInputEl) {
|
|
1088
|
-
dateValue = this.slicePastedDate(2, dateParts[index]);
|
|
1089
|
-
}
|
|
1090
|
-
else {
|
|
1091
|
-
dateValue = this.slicePastedDate(4, dateParts[index]);
|
|
1092
|
-
}
|
|
1093
|
-
input.value = dateValue;
|
|
1094
|
-
this.setInputValue(input);
|
|
1095
|
-
this.autocompleteInput(input);
|
|
1096
|
-
}
|
|
1097
|
-
});
|
|
1098
|
-
this.isZuluTime = false;
|
|
1099
|
-
break;
|
|
1100
|
-
}
|
|
1101
|
-
case (pastedValue.length === 1 ||
|
|
1102
|
-
pastedValue.length === 2 ||
|
|
1103
|
-
pastedValue.length === 4) &&
|
|
1104
|
-
helpers.isNumeric(pastedValue):
|
|
1105
|
-
if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {
|
|
1106
|
-
// Check if copied value can be pasted into input
|
|
1107
|
-
this.setInputPasteValue(event.target, pastedValue);
|
|
1108
|
-
this.setInputValue(event.target);
|
|
1109
|
-
}
|
|
1110
|
-
else {
|
|
1111
|
-
this.displayPastedValidation(event);
|
|
1112
|
-
}
|
|
1113
|
-
break;
|
|
1114
|
-
case pastedValue.length === 3 && helpers.isNumeric(pastedValue):
|
|
1115
|
-
if (event.target !== this.yearInputEl) {
|
|
1116
|
-
this.displayPastedValidation(event);
|
|
1117
|
-
}
|
|
1118
|
-
else {
|
|
1119
|
-
this.setInputPasteValue(event.target, pastedValue);
|
|
1120
|
-
this.setInputValue(event.target);
|
|
1121
|
-
}
|
|
1122
|
-
break;
|
|
1123
|
-
case pastedValue.length >= 5 && helpers.isNumeric(pastedValue):
|
|
1124
|
-
this.displayPastedValidation(event);
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
pasteZuluDateTime(dateParts, index) {
|
|
1128
|
-
// ['YYYY', 'MM', 'DD']
|
|
1129
|
-
if (index === 0 && this.yearInputEl) {
|
|
1130
|
-
const dateValue = this.slicePastedDate(4, dateParts[index]);
|
|
1131
|
-
this.yearInputEl.value = dateValue;
|
|
1132
|
-
this.setInputValue(this.yearInputEl);
|
|
1133
|
-
}
|
|
1134
|
-
else if (index === 1 && this.monthInputEl) {
|
|
1135
|
-
// The month value is the second item in the array
|
|
1136
|
-
const dateValue = this.slicePastedDate(2, dateParts[index]);
|
|
1137
|
-
this.monthInputEl.value = dateValue;
|
|
1138
|
-
this.setInputValue(this.monthInputEl);
|
|
1139
|
-
}
|
|
1140
|
-
else if (this.dayInputEl) {
|
|
1141
|
-
const dateValue = this.slicePastedDate(2, dateParts[index]);
|
|
1142
|
-
this.dayInputEl.value = dateValue;
|
|
1143
|
-
this.setInputValue(this.dayInputEl);
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
displayPastedValidation(event) {
|
|
1147
|
-
var _a;
|
|
1148
|
-
if (((_a = this.invalidDateText) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1149
|
-
this.previousInvalidDateTest = this.invalidDateText;
|
|
1150
|
-
}
|
|
1151
|
-
this.invalidDateText = `Please paste a valid ${this.getAriaLabel(event.target)}`;
|
|
1152
|
-
this.validationStatus = helpers.IcInformationStatus.Error;
|
|
1153
|
-
this.isPasteValidationDisplayed = true;
|
|
1154
|
-
}
|
|
1155
|
-
setPasteInvalidText() {
|
|
1156
|
-
var _a;
|
|
1157
|
-
if (this.isPasteValidationDisplayed) {
|
|
1158
|
-
this.invalidDateText = (_a = this.previousInvalidDateTest) !== null && _a !== void 0 ? _a : "";
|
|
1159
|
-
this.isPasteValidationDisplayed = false;
|
|
1160
|
-
// This is to prevent setDate from triggering within componentWillUpdate
|
|
1161
|
-
this.preventInputsUpdating = true;
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
notifyScreenReader(input, event) {
|
|
1165
|
-
var _a;
|
|
1166
|
-
const liveRegion = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("#live-region");
|
|
1167
|
-
if (liveRegion) {
|
|
1168
|
-
if (this.isKeyboardOrEvent(event)) {
|
|
1169
|
-
this.notifyScreenReaderArrowKeys(input);
|
|
1170
|
-
}
|
|
1171
|
-
else if (Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING) {
|
|
1172
|
-
this.notifyScreenReaderInput(input, liveRegion);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
render() {
|
|
1177
|
-
const { inputId, label, disabled, helperText, hideHelperText, hideLabel, showClearButton, showCalendarButton, size, theme, validationAriaLive, } = this;
|
|
1178
|
-
const hasCustomValidation = !helpers.isEmptyString(this.validationStatus);
|
|
1179
|
-
const validationStatus = hasCustomValidation
|
|
1180
|
-
? this.validationStatus
|
|
1181
|
-
: !helpers.isEmptyString(this.invalidDateText)
|
|
1182
|
-
? helpers.IcInformationStatus.Error
|
|
1183
|
-
: "";
|
|
1184
|
-
const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;
|
|
1185
|
-
helpers.renderHiddenInput(true, this.el, this.name, this.convertToDate(this.year, this.month, this.day), this.disabled);
|
|
1186
|
-
return (index.h(index.Host, { key: 'c076a1712793e36c9fd904692d64f44297a41d58', class: {
|
|
1187
|
-
[`ic-theme-${theme}`]: theme !== "inherit",
|
|
1188
|
-
[`ic-date-input-disabled`]: disabled,
|
|
1189
|
-
}, onBlur: this.handleHostBlur, onFocus: this.handleHostFocus }, index.h("ic-input-container", { key: 'a706d073ade2f587fe661e8eedd533fcac2eb8d2', disabled: disabled }, !(hideLabel && hideHelperText) && (index.h("ic-input-label", { key: '2df45206bb1dec22719805dd75419d99ce0321dd', for: inputId, label: label, hideLabel: hideLabel, helperText: !hideHelperText ? helperText : "", disabled: disabled }, index.h("slot", { key: '8f5458681b9ea085c67ff7c1022f5512181dd37a', name: "helper-text", slot: "helper-text" }))), index.h("span", { key: 'cc1ced7c0cf7e46b0792ad06995b15273126c040', id: this.screenReaderInfoId, class: "sr-only", "aria-hidden": "true" }, this.getScreenReaderInfo(validationStatus), hideLabel && `${label}\n`, hideHelperText && `${helperText}\n`, `${this.defaultHelperText}.`), index.h("span", { key: '53cc25e4eccf56a7a64a7b28d207c98e78abeec7', id: this.assistiveHintId, class: "sr-only", "aria-hidden": "true" }, assistiveHint), index.h("span", { key: '652f13800a903a2f92451abe2abfbbf63f72fd73', id: "live-region", "aria-live": "assertive", class: "sr-only" }), index.h("ic-input-component-container", { key: 'e2ec60bbf7e7f39e79de567ef30642f0e175b1c6', id: inputId, ref: (el) => (this.inputCompContainerEl = el), disabled: disabled, validationStatus: validationStatus, size: size, role: "group", class: { [`ic-theme-${theme}`]: theme !== "inherit" } }, index.h("div", { key: '891bb0f4b524a7dae73ea3eacbaacd460ceab542', class: "input-container" }, index.h("div", { key: '476965e1b07bc962741ffe0f74661d6e4631d576', class: "date-inputs" }, this.getInputsInOrder()[0], "/", this.getInputsInOrder()[1], "/", this.getInputsInOrder()[2]), index.h("div", { key: '752c0fd5df110547b8161b1cde61edb690c6c7fa', class: "action-buttons" }, showClearButton && (index.h("ic-button", { key: 'cf5c9fe8b8348071a764c57df98ed7d217674735', id: "clear-button", "aria-label": "Clear input", class: {
|
|
1190
|
-
["clear-button"]: true,
|
|
1191
|
-
["hidden"]: helpers.isEmptyString(this.day) &&
|
|
1192
|
-
helpers.isEmptyString(this.month) &&
|
|
1193
|
-
helpers.isEmptyString(this.year),
|
|
1194
|
-
}, disabled: this.disabled, innerHTML: clearIcon.Clear, onClick: this.handleClear, onFocus: this.handleClearFocus, onBlur: this.handleClearBlur, variant: "icon-tertiary", theme: this.clearButtonFocused ? "light" : "dark", size: size })), showCalendarButton && (index.h("div", { key: '6e018c3cfb028691aa57c88df2f7d29e0adb1f78', class: "show-calendar-button-wrapper" }, index.h("div", { key: 'dcd83751b62337a77a4471489c7ba38d43cd45a6', class: { divider: true, [size]: true } }), index.h("ic-button", { key: '5b917499227bc7e7c1d3dd5b01f0040f10c7adc1', id: "calendar-button", ref: (el) => (this.calendarButtonEl = el), "aria-label": "Display calendar", "aria-haspopup": "dialog", class: "calendar-button", disabled: this.disabled, innerHTML: Calendar, onClick: this.handleCalendarOpen, variant: "icon-tertiary", size: size, onFocus: this.handleCalendarFocus, onBlur: this.handleCalendarBlur, theme: this.calendarFocused ? "light" : "dark" })))))), index.h("span", { key: 'a1d4b4da8df73e766ba1096f193142a95af941d8', id: this.selectedDateInfoId, class: "sr-only", "aria-live": "polite" }, index.h("span", { key: '92e0f6e22dca3f9c5f0f05dcf1a6e5fa43e2e05a', ref: (el) => (this.selectedDateInfoEl = el), role: "status" })), index.h("ic-input-validation", { key: '3d38e48eb14e60ad40639bb7ee44a1307585c4e3', status: validationStatus, message: hasCustomValidation ? this.validationText : this.invalidDateText, for: inputId, ariaLiveMode: validationAriaLive }))));
|
|
1195
|
-
}
|
|
1196
|
-
static get delegatesFocus() { return true; }
|
|
1197
|
-
get el() { return index.getElement(this); }
|
|
1198
|
-
static get watchers() { return {
|
|
1199
|
-
"day": ["watchInputHandler"],
|
|
1200
|
-
"month": ["watchInputHandler"],
|
|
1201
|
-
"year": ["watchInputHandler"],
|
|
1202
|
-
"disabled": ["watchDisabledHandler"],
|
|
1203
|
-
"disableFuture": ["watchDisableFutureHandler"],
|
|
1204
|
-
"disablePast": ["watchDisablePastHandler"],
|
|
1205
|
-
"max": ["watchMaxHandler"],
|
|
1206
|
-
"min": ["watchMinHandler"],
|
|
1207
|
-
"required": ["watchRequiredHandler"]
|
|
1208
|
-
}; }
|
|
1209
|
-
};
|
|
1210
|
-
DateInput.style = IcDateInputStyle0;
|
|
1211
|
-
|
|
1212
|
-
exports.ic_date_input = DateInput;
|
|
1213
|
-
|
|
1214
|
-
//# sourceMappingURL=ic-date-input.cjs.entry.js.map
|