@ukic/canary-web-components 2.0.0-canary.12 → 2.0.0-canary.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/date-helpers-c9551119.js +150 -0
- package/dist/cjs/date-helpers-c9551119.js.map +1 -0
- package/dist/cjs/{helpers-b525d45a.js → helpers-6d736902.js} +27 -4
- package/dist/cjs/helpers-6d736902.js.map +1 -0
- package/dist/cjs/{helpers-c4444a7e.js → helpers-f75cf7cf.js} +94 -48
- package/dist/cjs/helpers-f75cf7cf.js.map +1 -0
- package/dist/cjs/ic-accordion-group.cjs.entry.js +11 -2
- package/dist/cjs/ic-accordion-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ic-alert.cjs.entry.js +1 -1
- package/dist/cjs/ic-back-to-top.cjs.entry.js +1 -1
- package/dist/cjs/ic-badge.cjs.entry.js +18 -17
- package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js +41 -86
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-card.cjs.entry.js +1 -1
- package/dist/cjs/ic-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ic-chip.cjs.entry.js +25 -2
- package/dist/cjs/ic-chip.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-data-row.cjs.entry.js +1 -1
- package/dist/cjs/ic-data-table.cjs.entry.js +43 -308
- package/dist/cjs/ic-data-table.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-date-input.cjs.entry.js +1108 -0
- package/dist/cjs/ic-date-input.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-date-picker.cjs.entry.js +1053 -0
- package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-dialog.cjs.entry.js +14 -4
- package/dist/cjs/ic-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-divider.cjs.entry.js +1 -1
- package/dist/cjs/ic-empty-state.cjs.entry.js +38 -0
- package/dist/cjs/ic-empty-state.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer.cjs.entry.js +1 -1
- package/dist/cjs/ic-hero.cjs.entry.js +1 -1
- package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
- package/dist/cjs/ic-input-component-container_4.cjs.entry.js +150 -0
- package/dist/cjs/ic-input-component-container_4.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-link.cjs.entry.js +33 -15
- 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-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-with-multi.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-with-multi.cjs.entry.js.map +1 -1
- package/dist/cjs/{ic-input-component-container_3.cjs.entry.js → ic-menu.cjs.entry.js} +5 -69
- package/dist/cjs/ic-menu.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-navigation-button.cjs.entry.js +26 -5
- package/dist/cjs/ic-navigation-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-group.cjs.entry.js +16 -13
- package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js +29 -33
- package/dist/cjs/ic-navigation-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
- package/dist/cjs/ic-page-header.cjs.entry.js +1 -1
- package/dist/cjs/{ic-empty-state_2.cjs.entry.js → ic-pagination-bar.cjs.entry.js} +4 -34
- package/dist/cjs/ic-pagination-bar.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-pagination_4.cjs.entry.js +53 -16
- package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-popover-menu.cjs.entry.js +1 -1
- package/dist/cjs/ic-radio-group.cjs.entry.js +40 -26
- package/dist/cjs/ic-radio-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-radio-option.cjs.entry.js +9 -4
- package/dist/cjs/ic-radio-option.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-search-bar.cjs.entry.js +1 -1
- package/dist/cjs/ic-select-with-multi.cjs.entry.js +6 -19
- package/dist/cjs/ic-select-with-multi.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-side-navigation.cjs.entry.js +2 -2
- package/dist/cjs/ic-side-navigation.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
- package/dist/cjs/ic-step.cjs.entry.js +5 -2
- package/dist/cjs/ic-step.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-stepper.cjs.entry.js +2 -1
- package/dist/cjs/ic-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-switch.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-context.cjs.entry.js +18 -2
- package/dist/cjs/ic-tab-context.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab.cjs.entry.js +1 -1
- package/dist/cjs/ic-theme.cjs.entry.js +3 -10
- package/dist/cjs/ic-theme.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toast.cjs.entry.js +1 -1
- package/dist/cjs/ic-toggle-button.cjs.entry.js +1 -1
- package/dist/cjs/ic-top-navigation.cjs.entry.js +46 -60
- package/dist/cjs/ic-top-navigation.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-typography.cjs.entry.js +11 -35
- package/dist/cjs/ic-typography.cjs.entry.js.map +1 -1
- package/dist/cjs/index-4cf27b16.js +18 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/assets/calendar.svg +3 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/ic-data-table/ic-data-table.css +7 -82
- package/dist/collection/components/ic-data-table/ic-data-table.js +44 -535
- package/dist/collection/components/ic-data-table/ic-data-table.js.map +1 -1
- package/dist/collection/components/ic-data-table/ic-data-table.types.js.map +1 -1
- package/dist/collection/components/ic-data-table/story-data.js +11 -386
- package/dist/collection/components/ic-data-table/story-data.js.map +1 -1
- package/dist/collection/components/ic-data-table/test/basic/ic-data-table.spec.js +0 -319
- package/dist/collection/components/ic-data-table/test/basic/ic-data-table.spec.js.map +1 -1
- package/dist/collection/components/ic-date-input/ic-date-input.css +560 -0
- package/dist/collection/components/ic-date-input/ic-date-input.js +1737 -0
- package/dist/collection/components/ic-date-input/ic-date-input.js.map +1 -0
- package/dist/collection/components/ic-date-input/story-data.js +28 -0
- package/dist/collection/components/ic-date-input/story-data.js.map +1 -0
- package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js +1142 -0
- package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js.map +1 -0
- package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js +42 -0
- package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js.map +1 -0
- package/dist/collection/components/ic-date-picker/ic-date-picker.css +878 -0
- package/dist/collection/components/ic-date-picker/ic-date-picker.js +1512 -0
- package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -0
- package/dist/collection/components/ic-date-picker/ic-day-button.js +36 -0
- package/dist/collection/components/ic-date-picker/ic-day-button.js.map +1 -0
- package/dist/collection/components/ic-date-picker/ic-month-picker.js +29 -0
- package/dist/collection/components/ic-date-picker/ic-month-picker.js.map +1 -0
- package/dist/collection/components/ic-date-picker/ic-year-picker.js +39 -0
- package/dist/collection/components/ic-date-picker/ic-year-picker.js.map +1 -0
- package/dist/collection/components/ic-date-picker/story-data.js +148 -0
- package/dist/collection/components/ic-date-picker/story-data.js.map +1 -0
- package/dist/collection/components/{ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.js → ic-date-picker/test/a11y/ic-date-picker.test.a11y.js} +5 -3
- package/dist/collection/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.js.map +1 -0
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js +207 -0
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js.map +1 -0
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js +991 -0
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js.map +1 -0
- package/dist/collection/components/ic-menu-with-multi/ic-menu.js +2 -2
- package/dist/collection/components/ic-menu-with-multi/ic-menu.js.map +1 -1
- package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js +1 -1
- package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js.map +1 -1
- package/dist/collection/components/ic-select-with-multi/ic-select.js +2 -2
- package/dist/collection/components/ic-select-with-multi/ic-select.js.map +1 -1
- package/dist/collection/utils/constants.js +55 -0
- package/dist/collection/utils/constants.js.map +1 -1
- package/dist/collection/utils/date-helpers.js +133 -0
- package/dist/collection/utils/date-helpers.js.map +1 -0
- package/dist/collection/utils/helpers.js +272 -42
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/collection/utils/types.js +45 -0
- package/dist/collection/utils/types.js.map +1 -1
- package/dist/components/helpers.js +26 -3
- package/dist/components/helpers.js.map +1 -1
- package/dist/components/helpers2.js +91 -45
- package/dist/components/helpers2.js.map +1 -1
- package/dist/components/ic-accordion-group.js +14 -4
- package/dist/components/ic-accordion-group.js.map +1 -1
- package/dist/components/ic-badge.js +18 -17
- package/dist/components/ic-badge.js.map +1 -1
- package/dist/components/ic-button2.js +43 -86
- package/dist/components/ic-button2.js.map +1 -1
- package/dist/components/ic-card.js +1 -1
- package/dist/components/ic-checkbox-group.js +1 -1
- package/dist/components/ic-checkbox.js +1 -1
- package/dist/components/ic-chip.js +29 -3
- package/dist/components/ic-chip.js.map +1 -1
- package/dist/components/ic-data-table.js +49 -334
- package/dist/components/ic-data-table.js.map +1 -1
- package/dist/components/{ic-data-table-title-bar.d.ts → ic-date-input.d.ts} +4 -4
- package/dist/components/ic-date-input.js +8 -0
- package/dist/components/ic-date-input.js.map +1 -0
- package/dist/components/ic-date-input2.js +1340 -0
- package/dist/components/ic-date-input2.js.map +1 -0
- package/dist/components/ic-date-picker.d.ts +11 -0
- package/dist/components/ic-date-picker.js +1175 -0
- package/dist/components/ic-date-picker.js.map +1 -0
- package/dist/components/ic-dialog.js +13 -3
- package/dist/components/ic-dialog.js.map +1 -1
- package/dist/components/ic-empty-state.js +57 -1
- package/dist/components/ic-empty-state.js.map +1 -1
- package/dist/components/ic-input-component-container2.js +1 -1
- package/dist/components/ic-input-component-container2.js.map +1 -1
- package/dist/components/ic-link2.js +34 -16
- package/dist/components/ic-link2.js.map +1 -1
- package/dist/components/ic-loading-indicator2.js +1 -1
- package/dist/components/ic-loading-indicator2.js.map +1 -1
- package/dist/components/ic-menu-item2.js +1 -1
- package/dist/components/ic-menu2.js +2 -2
- package/dist/components/ic-menu2.js.map +1 -1
- package/dist/components/ic-menu3.js +1 -1
- package/dist/components/ic-menu3.js.map +1 -1
- package/dist/components/ic-navigation-button.js +26 -5
- package/dist/components/ic-navigation-button.js.map +1 -1
- package/dist/components/ic-navigation-group.js +15 -12
- package/dist/components/ic-navigation-group.js.map +1 -1
- package/dist/components/ic-navigation-item.js +29 -33
- package/dist/components/ic-navigation-item.js.map +1 -1
- package/dist/components/ic-pagination-bar2.js +1 -1
- package/dist/components/ic-pagination-bar2.js.map +1 -1
- package/dist/components/ic-pagination-item2.js +1 -1
- package/dist/components/ic-pagination2.js +5 -5
- package/dist/components/ic-pagination2.js.map +1 -1
- package/dist/components/ic-radio-group.js +40 -26
- package/dist/components/ic-radio-group.js.map +1 -1
- package/dist/components/ic-radio-option.js +11 -5
- package/dist/components/ic-radio-option.js.map +1 -1
- package/dist/components/ic-search-bar.js +1 -1
- package/dist/components/ic-select-with-multi.js +1 -14
- package/dist/components/ic-select-with-multi.js.map +1 -1
- package/dist/components/ic-select2.js +25 -7
- package/dist/components/ic-select2.js.map +1 -1
- package/dist/components/ic-side-navigation.js +1 -1
- package/dist/components/ic-side-navigation.js.map +1 -1
- package/dist/components/ic-step.js +4 -1
- package/dist/components/ic-step.js.map +1 -1
- package/dist/components/ic-stepper.js +2 -0
- package/dist/components/ic-stepper.js.map +1 -1
- package/dist/components/ic-switch.js +1 -1
- package/dist/components/ic-tab-context.js +18 -2
- package/dist/components/ic-tab-context.js.map +1 -1
- package/dist/components/ic-tab.js +1 -1
- package/dist/components/ic-text-field2.js +27 -8
- package/dist/components/ic-text-field2.js.map +1 -1
- package/dist/components/ic-theme.js +3 -10
- package/dist/components/ic-theme.js.map +1 -1
- package/dist/components/ic-toggle-button.js +1 -1
- package/dist/components/ic-top-navigation.js +47 -61
- package/dist/components/ic-top-navigation.js.map +1 -1
- package/dist/components/ic-typography2.js +12 -38
- package/dist/components/ic-typography2.js.map +1 -1
- package/dist/core/core.css +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-869954a2.entry.js → p-00bd7919.entry.js} +2 -2
- package/dist/core/p-00c5639e.entry.js +2 -0
- package/dist/core/{p-db9c03c0.entry.js.map → p-00c5639e.entry.js.map} +1 -1
- package/dist/core/p-06c27edb.entry.js +2 -0
- package/dist/core/p-06c27edb.entry.js.map +1 -0
- package/dist/core/{p-a0f8efb2.entry.js → p-0af27517.entry.js} +2 -2
- package/dist/core/p-0af27517.entry.js.map +1 -0
- package/dist/core/p-162f3e36.entry.js +2 -0
- package/dist/core/{p-624d4f5f.entry.js.map → p-162f3e36.entry.js.map} +1 -1
- package/dist/core/p-19c1e271.entry.js +2 -0
- package/dist/core/p-19c1e271.entry.js.map +1 -0
- package/dist/core/{p-a50c3b9e.entry.js → p-1a91e842.entry.js} +2 -2
- package/dist/core/{p-76915584.entry.js → p-1c3bd46d.entry.js} +2 -2
- package/dist/core/p-1c3bd46d.entry.js.map +1 -0
- package/dist/core/p-2c9d6334.entry.js +2 -0
- package/dist/core/p-2c9d6334.entry.js.map +1 -0
- package/dist/core/p-33dd24eb.js +2 -0
- package/dist/core/p-33dd24eb.js.map +1 -0
- package/dist/core/p-3dcc61cc.entry.js +2 -0
- package/dist/core/p-3dcc61cc.entry.js.map +1 -0
- package/dist/core/p-3e9a8977.entry.js +2 -0
- package/dist/core/{p-595be57d.entry.js.map → p-3e9a8977.entry.js.map} +1 -1
- package/dist/core/{p-f3c840cd.entry.js → p-41b682dc.entry.js} +2 -2
- package/dist/core/p-494c3cbe.entry.js +2 -0
- package/dist/core/p-494c3cbe.entry.js.map +1 -0
- package/dist/core/p-4ad3012a.entry.js +2 -0
- package/dist/core/p-4ad3012a.entry.js.map +1 -0
- package/dist/core/p-4bd13376.entry.js +2 -0
- package/dist/core/p-4bd13376.entry.js.map +1 -0
- package/dist/core/p-4fd58768.entry.js +2 -0
- package/dist/core/p-4fd58768.entry.js.map +1 -0
- package/dist/core/{p-8b08d8fe.entry.js → p-6dce8e88.entry.js} +2 -2
- package/dist/core/{p-1ca332ca.entry.js → p-6eb58b0a.entry.js} +2 -2
- package/dist/core/p-730f058b.entry.js +2 -0
- package/dist/core/p-730f058b.entry.js.map +1 -0
- package/dist/core/p-7f53d1be.entry.js +2 -0
- package/dist/core/p-7f53d1be.entry.js.map +1 -0
- package/dist/core/{p-5ae93c16.entry.js → p-7fda2f94.entry.js} +2 -2
- package/dist/core/p-843bdaae.entry.js +2 -0
- package/dist/core/p-843bdaae.entry.js.map +1 -0
- package/dist/core/p-849f43c3.entry.js +2 -0
- package/dist/core/p-849f43c3.entry.js.map +1 -0
- package/dist/core/{p-c34848da.entry.js → p-8b1f9648.entry.js} +2 -2
- package/dist/core/{p-a434c3d4.entry.js → p-8b820365.entry.js} +2 -2
- package/dist/core/p-940de102.entry.js +2 -0
- package/dist/core/p-940de102.entry.js.map +1 -0
- package/dist/core/{p-2eac7dcc.entry.js → p-946625a3.entry.js} +2 -2
- package/dist/core/{p-7ef8d616.entry.js → p-9528b29e.entry.js} +2 -2
- package/dist/core/{p-a43c12cd.entry.js → p-9567c117.entry.js} +2 -2
- package/dist/core/{p-b82dcc29.entry.js → p-957de939.entry.js} +2 -2
- package/dist/core/{p-045359e1.entry.js → p-99bf38e3.entry.js} +2 -2
- package/dist/core/{p-81ddc39d.entry.js → p-9d8883d7.entry.js} +2 -2
- package/dist/core/{p-b6639e4a.entry.js → p-9e3178e8.entry.js} +2 -2
- package/dist/core/{p-b6639e4a.entry.js.map → p-9e3178e8.entry.js.map} +1 -1
- package/dist/core/p-a05755b1.entry.js +2 -0
- package/dist/core/p-a05755b1.entry.js.map +1 -0
- package/dist/core/{p-e834344e.entry.js → p-a1556d97.entry.js} +2 -2
- package/dist/core/{p-f843da01.entry.js → p-a2dc10d8.entry.js} +2 -2
- package/dist/core/{p-ab09986c.entry.js → p-a8c15117.entry.js} +2 -2
- package/dist/core/p-aabab75f.entry.js +2 -0
- package/dist/core/p-aabab75f.entry.js.map +1 -0
- package/dist/core/{p-f7a14c01.entry.js → p-c14a897d.entry.js} +2 -2
- package/dist/core/p-c621d6b0.entry.js +2 -0
- package/dist/core/p-c621d6b0.entry.js.map +1 -0
- package/dist/core/p-c7590421.entry.js +2 -0
- package/dist/core/p-c7590421.entry.js.map +1 -0
- package/dist/core/p-c953edb9.entry.js +2 -0
- package/dist/core/p-c953edb9.entry.js.map +1 -0
- package/dist/core/p-cca482e2.entry.js +2 -0
- package/dist/core/p-cca482e2.entry.js.map +1 -0
- package/dist/core/p-cd799087.js +2 -0
- package/dist/core/p-cd799087.js.map +1 -0
- package/dist/core/{p-e3997d60.entry.js → p-d2d63a61.entry.js} +2 -2
- package/dist/core/p-d32d331b.entry.js +2 -0
- package/dist/core/p-d32d331b.entry.js.map +1 -0
- package/dist/core/{p-4f413fc0.entry.js → p-db3a35fb.entry.js} +2 -2
- package/dist/core/p-dc5e1f8f.entry.js +2 -0
- package/dist/core/{p-6933f8e9.entry.js.map → p-dc5e1f8f.entry.js.map} +1 -1
- package/dist/core/{p-204ace96.entry.js → p-e16f73ba.entry.js} +2 -2
- package/dist/core/p-e189f1d0.entry.js +2 -0
- package/dist/core/p-e189f1d0.entry.js.map +1 -0
- package/dist/core/{p-917c5721.entry.js → p-e1963c78.entry.js} +2 -2
- package/dist/core/p-e1963c78.entry.js.map +1 -0
- package/dist/core/{p-f14454b1.entry.js → p-e8151d13.entry.js} +2 -2
- package/dist/core/p-ee765ad5.js +2 -0
- package/dist/core/p-ee765ad5.js.map +1 -0
- package/dist/core/{p-fc5611e2.entry.js → p-f2147136.entry.js} +2 -2
- package/dist/core/p-f2147136.entry.js.map +1 -0
- package/dist/core/{p-5e0c830b.entry.js → p-f8f36680.entry.js} +2 -2
- package/dist/core/{p-5e0c830b.entry.js.map → p-f8f36680.entry.js.map} +1 -1
- package/dist/core/p-fca46bd9.entry.js +2 -0
- package/dist/core/p-fca46bd9.entry.js.map +1 -0
- package/dist/core/{p-a31031a5.entry.js → p-ff3a01f3.entry.js} +2 -2
- package/dist/core/{p-75dac3d1.entry.js → p-ff6f1e3a.entry.js} +2 -2
- package/dist/esm/core.js +1 -1
- package/dist/esm/date-helpers-0e5e32a7.js +136 -0
- package/dist/esm/date-helpers-0e5e32a7.js.map +1 -0
- package/dist/esm/{helpers-12b4266a.js → helpers-c34e4042.js} +27 -4
- package/dist/esm/helpers-c34e4042.js.map +1 -0
- package/dist/esm/{helpers-1f07eb61.js → helpers-f328a7b6.js} +92 -46
- package/dist/esm/helpers-f328a7b6.js.map +1 -0
- package/dist/esm/ic-accordion-group.entry.js +11 -2
- package/dist/esm/ic-accordion-group.entry.js.map +1 -1
- package/dist/esm/ic-accordion.entry.js +1 -1
- package/dist/esm/ic-alert.entry.js +1 -1
- package/dist/esm/ic-back-to-top.entry.js +1 -1
- package/dist/esm/ic-badge.entry.js +18 -17
- package/dist/esm/ic-badge.entry.js.map +1 -1
- package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
- package/dist/esm/ic-breadcrumb.entry.js +1 -1
- package/dist/esm/ic-button_3.entry.js +41 -86
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-card.entry.js +1 -1
- package/dist/esm/ic-checkbox-group.entry.js +1 -1
- package/dist/esm/ic-checkbox.entry.js +1 -1
- package/dist/esm/ic-chip.entry.js +25 -2
- package/dist/esm/ic-chip.entry.js.map +1 -1
- package/dist/esm/ic-data-row.entry.js +1 -1
- package/dist/esm/ic-data-table.entry.js +44 -309
- package/dist/esm/ic-data-table.entry.js.map +1 -1
- package/dist/esm/ic-date-input.entry.js +1104 -0
- package/dist/esm/ic-date-input.entry.js.map +1 -0
- package/dist/esm/ic-date-picker.entry.js +1049 -0
- package/dist/esm/ic-date-picker.entry.js.map +1 -0
- package/dist/esm/ic-dialog.entry.js +14 -4
- package/dist/esm/ic-dialog.entry.js.map +1 -1
- package/dist/esm/ic-divider.entry.js +1 -1
- package/dist/{components/ic-empty-state2.js → esm/ic-empty-state.entry.js} +11 -38
- package/dist/esm/ic-empty-state.entry.js.map +1 -0
- package/dist/esm/ic-footer-link-group.entry.js +1 -1
- package/dist/esm/ic-footer-link.entry.js +1 -1
- package/dist/esm/ic-footer.entry.js +1 -1
- package/dist/esm/ic-hero.entry.js +1 -1
- package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
- package/dist/esm/ic-input-component-container_4.entry.js +143 -0
- package/dist/esm/ic-input-component-container_4.entry.js.map +1 -0
- package/dist/esm/ic-link.entry.js +34 -16
- 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-item.entry.js +1 -1
- package/dist/esm/ic-menu-with-multi.entry.js +1 -1
- package/dist/esm/ic-menu-with-multi.entry.js.map +1 -1
- package/dist/esm/{ic-input-component-container_3.entry.js → ic-menu.entry.js} +7 -69
- package/dist/esm/ic-menu.entry.js.map +1 -0
- package/dist/esm/ic-navigation-button.entry.js +27 -6
- package/dist/esm/ic-navigation-button.entry.js.map +1 -1
- package/dist/esm/ic-navigation-group.entry.js +16 -13
- package/dist/esm/ic-navigation-group.entry.js.map +1 -1
- package/dist/esm/ic-navigation-item.entry.js +29 -33
- package/dist/esm/ic-navigation-item.entry.js.map +1 -1
- package/dist/esm/ic-navigation-menu.entry.js +1 -1
- package/dist/esm/ic-page-header.entry.js +1 -1
- package/dist/esm/{ic-empty-state_2.entry.js → ic-pagination-bar.entry.js} +5 -34
- package/dist/esm/ic-pagination-bar.entry.js.map +1 -0
- package/dist/esm/ic-pagination_4.entry.js +54 -17
- package/dist/esm/ic-pagination_4.entry.js.map +1 -1
- package/dist/esm/ic-popover-menu.entry.js +1 -1
- package/dist/esm/ic-radio-group.entry.js +40 -26
- package/dist/esm/ic-radio-group.entry.js.map +1 -1
- package/dist/esm/ic-radio-option.entry.js +9 -4
- package/dist/esm/ic-radio-option.entry.js.map +1 -1
- package/dist/esm/ic-search-bar.entry.js +1 -1
- package/dist/esm/ic-select-with-multi.entry.js +1 -14
- package/dist/esm/ic-select-with-multi.entry.js.map +1 -1
- package/dist/esm/ic-side-navigation.entry.js +2 -2
- package/dist/esm/ic-side-navigation.entry.js.map +1 -1
- package/dist/esm/ic-status-tag.entry.js +1 -1
- package/dist/esm/ic-step.entry.js +5 -2
- package/dist/esm/ic-step.entry.js.map +1 -1
- package/dist/esm/ic-stepper.entry.js +2 -1
- package/dist/esm/ic-stepper.entry.js.map +1 -1
- package/dist/esm/ic-switch.entry.js +1 -1
- package/dist/esm/ic-tab-context.entry.js +18 -2
- package/dist/esm/ic-tab-context.entry.js.map +1 -1
- package/dist/esm/ic-tab-group.entry.js +1 -1
- package/dist/esm/ic-tab-panel.entry.js +1 -1
- package/dist/esm/ic-tab.entry.js +1 -1
- package/dist/esm/ic-theme.entry.js +3 -10
- package/dist/esm/ic-theme.entry.js.map +1 -1
- package/dist/esm/ic-toast.entry.js +1 -1
- package/dist/esm/ic-toggle-button.entry.js +1 -1
- package/dist/esm/ic-top-navigation.entry.js +46 -60
- package/dist/esm/ic-top-navigation.entry.js.map +1 -1
- package/dist/esm/ic-typography.entry.js +12 -36
- package/dist/esm/ic-typography.entry.js.map +1 -1
- package/dist/esm/index-93509377.js +18 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/types/components/ic-data-table/ic-data-table.d.ts +1 -96
- package/dist/types/components/ic-data-table/ic-data-table.types.d.ts +0 -11
- package/dist/types/components/ic-data-table/story-data.d.ts +0 -99
- package/dist/types/components/ic-date-input/ic-date-input.d.ts +251 -0
- package/dist/types/components/ic-date-input/story-data.d.ts +1 -0
- package/dist/types/components/ic-date-input/test/helpers/ic-date-input.d.ts +23 -0
- package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +231 -0
- package/dist/types/components/ic-date-picker/ic-day-button.d.ts +16 -0
- package/dist/types/components/ic-date-picker/ic-month-picker.d.ts +14 -0
- package/dist/types/components/ic-date-picker/ic-year-picker.d.ts +16 -0
- package/dist/types/components/ic-date-picker/story-data.d.ts +22 -0
- package/dist/types/components/ic-menu-with-multi/ic-menu.d.ts +2 -2
- package/dist/types/components/ic-select-with-multi/ic-select.d.ts +2 -2
- package/dist/types/components.d.ts +390 -141
- package/dist/types/utils/constants.d.ts +37 -0
- package/dist/types/utils/date-helpers.d.ts +22 -0
- package/dist/types/utils/helpers.d.ts +84 -16
- package/dist/types/utils/types.d.ts +92 -1
- package/hydrate/index.js +3275 -1148
- package/package.json +4 -3
- package/dist/cjs/helpers-b525d45a.js.map +0 -1
- package/dist/cjs/helpers-c4444a7e.js.map +0 -1
- package/dist/cjs/ic-data-table-title-bar.cjs.entry.js +0 -57
- package/dist/cjs/ic-data-table-title-bar.cjs.entry.js.map +0 -1
- package/dist/cjs/ic-empty-state_2.cjs.entry.js.map +0 -1
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +0 -1
- package/dist/cjs/ic-input-label_2.cjs.entry.js +0 -86
- package/dist/cjs/ic-input-label_2.cjs.entry.js.map +0 -1
- package/dist/collection/components/ic-data-table/test/basic/ic-data-table.e2e.js +0 -217
- package/dist/collection/components/ic-data-table/test/basic/ic-data-table.e2e.js.map +0 -1
- package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.css +0 -87
- package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js +0 -160
- package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js.map +0 -1
- package/dist/collection/components/ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.js.map +0 -1
- package/dist/collection/components/ic-data-table-title-bar/test/basic/ic-data-table-title-bar.spec.js +0 -70
- package/dist/collection/components/ic-data-table-title-bar/test/basic/ic-data-table-title-bar.spec.js.map +0 -1
- package/dist/components/ic-data-table-title-bar.js +0 -136
- package/dist/components/ic-data-table-title-bar.js.map +0 -1
- package/dist/components/ic-empty-state2.js.map +0 -1
- package/dist/core/p-10fb4c46.entry.js +0 -2
- package/dist/core/p-10fb4c46.entry.js.map +0 -1
- package/dist/core/p-169bfa51.entry.js +0 -2
- package/dist/core/p-169bfa51.entry.js.map +0 -1
- package/dist/core/p-1e91f540.entry.js +0 -2
- package/dist/core/p-1e91f540.entry.js.map +0 -1
- package/dist/core/p-347e8dab.entry.js +0 -2
- package/dist/core/p-347e8dab.entry.js.map +0 -1
- package/dist/core/p-3803a5b5.entry.js +0 -2
- package/dist/core/p-3803a5b5.entry.js.map +0 -1
- package/dist/core/p-4753bac8.entry.js +0 -2
- package/dist/core/p-4753bac8.entry.js.map +0 -1
- package/dist/core/p-4baa0916.entry.js +0 -2
- package/dist/core/p-4baa0916.entry.js.map +0 -1
- package/dist/core/p-5171169f.entry.js +0 -2
- package/dist/core/p-5171169f.entry.js.map +0 -1
- package/dist/core/p-595be57d.entry.js +0 -2
- package/dist/core/p-5ee4319c.entry.js +0 -2
- package/dist/core/p-5ee4319c.entry.js.map +0 -1
- package/dist/core/p-5f4e96ec.entry.js +0 -2
- package/dist/core/p-5f4e96ec.entry.js.map +0 -1
- package/dist/core/p-624d4f5f.entry.js +0 -2
- package/dist/core/p-6933f8e9.entry.js +0 -2
- package/dist/core/p-6c3044b6.entry.js +0 -2
- package/dist/core/p-6c3044b6.entry.js.map +0 -1
- package/dist/core/p-7267fe19.entry.js +0 -2
- package/dist/core/p-7267fe19.entry.js.map +0 -1
- package/dist/core/p-76915584.entry.js.map +0 -1
- package/dist/core/p-88d54b72.entry.js +0 -2
- package/dist/core/p-88d54b72.entry.js.map +0 -1
- package/dist/core/p-917c5721.entry.js.map +0 -1
- package/dist/core/p-942282cd.entry.js +0 -2
- package/dist/core/p-942282cd.entry.js.map +0 -1
- package/dist/core/p-96b3e7e2.js +0 -2
- package/dist/core/p-96b3e7e2.js.map +0 -1
- package/dist/core/p-9caf19eb.js +0 -2
- package/dist/core/p-9caf19eb.js.map +0 -1
- package/dist/core/p-a0f8efb2.entry.js.map +0 -1
- package/dist/core/p-aac4185b.entry.js +0 -2
- package/dist/core/p-aac4185b.entry.js.map +0 -1
- package/dist/core/p-b2aa3d7c.entry.js +0 -2
- package/dist/core/p-b2aa3d7c.entry.js.map +0 -1
- package/dist/core/p-ba86928c.entry.js +0 -2
- package/dist/core/p-ba86928c.entry.js.map +0 -1
- package/dist/core/p-d8469ac0.entry.js +0 -2
- package/dist/core/p-d8469ac0.entry.js.map +0 -1
- package/dist/core/p-db9c03c0.entry.js +0 -2
- package/dist/core/p-f6888309.entry.js +0 -2
- package/dist/core/p-f6888309.entry.js.map +0 -1
- package/dist/core/p-f74a8752.entry.js +0 -2
- package/dist/core/p-f74a8752.entry.js.map +0 -1
- package/dist/core/p-fc5611e2.entry.js.map +0 -1
- package/dist/esm/helpers-12b4266a.js.map +0 -1
- package/dist/esm/helpers-1f07eb61.js.map +0 -1
- package/dist/esm/ic-data-table-title-bar.entry.js +0 -53
- package/dist/esm/ic-data-table-title-bar.entry.js.map +0 -1
- package/dist/esm/ic-empty-state_2.entry.js.map +0 -1
- package/dist/esm/ic-input-component-container_3.entry.js.map +0 -1
- package/dist/esm/ic-input-label_2.entry.js +0 -81
- package/dist/esm/ic-input-label_2.entry.js.map +0 -1
- package/dist/types/components/ic-data-table-title-bar/ic-data-table-title-bar.d.ts +0 -36
- /package/dist/core/{p-869954a2.entry.js.map → p-00bd7919.entry.js.map} +0 -0
- /package/dist/core/{p-a50c3b9e.entry.js.map → p-1a91e842.entry.js.map} +0 -0
- /package/dist/core/{p-f3c840cd.entry.js.map → p-41b682dc.entry.js.map} +0 -0
- /package/dist/core/{p-8b08d8fe.entry.js.map → p-6dce8e88.entry.js.map} +0 -0
- /package/dist/core/{p-1ca332ca.entry.js.map → p-6eb58b0a.entry.js.map} +0 -0
- /package/dist/core/{p-5ae93c16.entry.js.map → p-7fda2f94.entry.js.map} +0 -0
- /package/dist/core/{p-c34848da.entry.js.map → p-8b1f9648.entry.js.map} +0 -0
- /package/dist/core/{p-a434c3d4.entry.js.map → p-8b820365.entry.js.map} +0 -0
- /package/dist/core/{p-2eac7dcc.entry.js.map → p-946625a3.entry.js.map} +0 -0
- /package/dist/core/{p-7ef8d616.entry.js.map → p-9528b29e.entry.js.map} +0 -0
- /package/dist/core/{p-a43c12cd.entry.js.map → p-9567c117.entry.js.map} +0 -0
- /package/dist/core/{p-b82dcc29.entry.js.map → p-957de939.entry.js.map} +0 -0
- /package/dist/core/{p-045359e1.entry.js.map → p-99bf38e3.entry.js.map} +0 -0
- /package/dist/core/{p-81ddc39d.entry.js.map → p-9d8883d7.entry.js.map} +0 -0
- /package/dist/core/{p-e834344e.entry.js.map → p-a1556d97.entry.js.map} +0 -0
- /package/dist/core/{p-f843da01.entry.js.map → p-a2dc10d8.entry.js.map} +0 -0
- /package/dist/core/{p-ab09986c.entry.js.map → p-a8c15117.entry.js.map} +0 -0
- /package/dist/core/{p-f7a14c01.entry.js.map → p-c14a897d.entry.js.map} +0 -0
- /package/dist/core/{p-e3997d60.entry.js.map → p-d2d63a61.entry.js.map} +0 -0
- /package/dist/core/{p-4f413fc0.entry.js.map → p-db3a35fb.entry.js.map} +0 -0
- /package/dist/core/{p-204ace96.entry.js.map → p-e16f73ba.entry.js.map} +0 -0
- /package/dist/core/{p-f14454b1.entry.js.map → p-e8151d13.entry.js.map} +0 -0
- /package/dist/core/{p-a31031a5.entry.js.map → p-ff3a01f3.entry.js.map} +0 -0
- /package/dist/core/{p-75dac3d1.entry.js.map → p-ff6f1e3a.entry.js.map} +0 -0
- /package/dist/types/components/{ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.d.ts → ic-date-picker/test/a11y/ic-date-picker.test.a11y.d.ts} +0 -0
@@ -0,0 +1,1104 @@
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-93509377.js';
|
2
|
+
import { q as isEmptyString, s as stringEnumToArray, k as getInputDescribedByText, r as removeFormResetListener, h as addFormResetListener, o as onComponentRequiredPropUndefined, t as isNumeric, p as IcInformationStatus, j as renderHiddenInput, m as IcThemeForegroundEnum, I as IcDayNames, a as IcDateInputMonths } from './helpers-f328a7b6.js';
|
3
|
+
import { b as dateMatches, i as isDateOrEpoch, j as convertToDoubleDigits, s as splitStringDate, h as createDate, k as extractDateFromZuluDateTime } from './date-helpers-0e5e32a7.js';
|
4
|
+
|
5
|
+
const Clear = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
6
|
+
<path d="M15.8327 5.34199L14.6577 4.16699L9.99935 8.82533L5.34102 4.16699L4.16602 5.34199L8.82435 10.0003L4.16602 14.6587L5.34102 15.8337L9.99935 11.1753L14.6577 15.8337L15.8327 14.6587L11.1743 10.0003L15.8327 5.34199Z" fill="currentColor"/>
|
7
|
+
</svg>
|
8
|
+
`;
|
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}input{border:0;height:100%;padding:0;outline:none;background:none;-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none}ic-input-component-container{cursor:text}ic-input-component-container,ic-input-component-container:hover{color:var(--ic-color-tertiary-text)}ic-input-component-container .focus-indicator{padding:var(--ic-space-xxxs) var(--ic-space-xs);align-items:center}.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-focus-blue) !important;box-shadow:inset 0 0 0 0.125rem var(--ic-focus-glow) !important;border-radius:0.25rem}.clear-button:focus,.calendar-button:focus,.clear-button:active *,.calendar-button:active *{fill:var(--ic-architectural-white)}.divider{margin:0 var(--ic-space-xxs);width:var(--ic-space-1px);background-color:var(--ic-architectural-400);border-radius:var(--ic-space-1px)}.divider.small{height:var(--ic-space-md)}.divider.default{height:calc(var(--ic-space-sm) + var(--ic-space-xs))}.divider.large{height:var(--ic-space-lg)}";
|
15
|
+
|
16
|
+
let inputIds = 0;
|
17
|
+
const DateInput = class {
|
18
|
+
constructor(hostRef) {
|
19
|
+
registerInstance(this, hostRef);
|
20
|
+
this.calendarButtonClicked = createEvent(this, "calendarButtonClicked", 7);
|
21
|
+
this.icBlur = createEvent(this, "icBlur", 7);
|
22
|
+
this.icChange = createEvent(this, "icChange", 7);
|
23
|
+
this.icFocus = createEvent(this, "icFocus", 7);
|
24
|
+
this.ARIA_INVALID = "aria-invalid";
|
25
|
+
this.ARIA_LABEL = "aria-label";
|
26
|
+
this.ARIA_LABELLED_BY = "aria-labelledby";
|
27
|
+
this.EVENT_OBJECT_STRING = "[object Event]";
|
28
|
+
this.FIT_TO_VALUE = "fit-to-value";
|
29
|
+
this.initialValue = this.value;
|
30
|
+
this.INPUT_EVENT_OBJECT_STRING = "[object InputEvent]";
|
31
|
+
this.inputsInOrder = [];
|
32
|
+
this.isAfterMax = false;
|
33
|
+
this.isBeforeMin = false;
|
34
|
+
this.isDateSetFromKeyboardEvent = false;
|
35
|
+
this.isDisabledDate = false;
|
36
|
+
this.isValidDay = true;
|
37
|
+
this.isValidMonth = true;
|
38
|
+
this.isValidDate = true;
|
39
|
+
this.isZuluTime = false;
|
40
|
+
this.KEYBOARD_EVENT_OBJECT_STRING = "[object KeyboardEvent]";
|
41
|
+
this.MAX_DAY = 31;
|
42
|
+
this.MAX_MONTH = 12;
|
43
|
+
this.previousEmittedDate = undefined;
|
44
|
+
this.previousSelectedDate = null;
|
45
|
+
this.selectedDate = null;
|
46
|
+
this.setInputPasteValue = (input, pastedValue) => {
|
47
|
+
const inputEl = input;
|
48
|
+
inputEl.value = pastedValue;
|
49
|
+
inputEl.classList.add(this.FIT_TO_VALUE);
|
50
|
+
};
|
51
|
+
this.checkSingleCopiedValueIsValid = (input, pastedValue) => {
|
52
|
+
let isValid = false;
|
53
|
+
const value = Number(pastedValue);
|
54
|
+
switch (input) {
|
55
|
+
case this.dayInputEl:
|
56
|
+
isValid = value >= 1 && value <= this.MAX_DAY;
|
57
|
+
break;
|
58
|
+
case this.monthInputEl:
|
59
|
+
isValid = value >= 1 && value <= this.MAX_MONTH;
|
60
|
+
break;
|
61
|
+
case this.yearInputEl:
|
62
|
+
isValid = true;
|
63
|
+
break;
|
64
|
+
default:
|
65
|
+
isValid = false;
|
66
|
+
break;
|
67
|
+
}
|
68
|
+
return isValid;
|
69
|
+
};
|
70
|
+
/**
|
71
|
+
* Using Object.prototype.string to determine type if event from user
|
72
|
+
* @param event - event object used to differentiate keyboard, generic or input event
|
73
|
+
* @returns boolean
|
74
|
+
*/
|
75
|
+
this.isKeyboardOrEvent = (event) => {
|
76
|
+
return (Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||
|
77
|
+
Object.prototype.toString.call(event) ===
|
78
|
+
this.KEYBOARD_EVENT_OBJECT_STRING);
|
79
|
+
};
|
80
|
+
this.setDateValidity = () => {
|
81
|
+
if (!isEmptyString(this.day)) {
|
82
|
+
this.isValidDay = +this.day > this.MAX_DAY ? false : true;
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
this.isValidDay = true;
|
86
|
+
}
|
87
|
+
if (!isEmptyString(this.month)) {
|
88
|
+
this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
this.isValidMonth = true;
|
92
|
+
}
|
93
|
+
};
|
94
|
+
this.handleInput = (event) => {
|
95
|
+
const inputEvent = event;
|
96
|
+
const input = event.target;
|
97
|
+
if (input !== this.yearInputEl) {
|
98
|
+
// Only auto-format if input event is not a character being deleted
|
99
|
+
// and not as user is changing value using up / down keys
|
100
|
+
if (inputEvent.inputType !== "deleteContentBackward" &&
|
101
|
+
!this.preventAutoFormatting) {
|
102
|
+
if (input.value.length === 1 &&
|
103
|
+
((input === this.dayInputEl && +input.value >= 4) ||
|
104
|
+
(input === this.monthInputEl && +input.value >= 2)) &&
|
105
|
+
+input.value <= 9) {
|
106
|
+
this.setInputValue(input);
|
107
|
+
this.notifyScreenReader(input, event);
|
108
|
+
this.moveToNextInput(input);
|
109
|
+
}
|
110
|
+
if (input.value.length === 2) {
|
111
|
+
if (+input.value === 0) {
|
112
|
+
input.value = "01";
|
113
|
+
}
|
114
|
+
this.setInputValue(input);
|
115
|
+
this.setPreventInput(input, true);
|
116
|
+
this.notifyScreenReader(input, event);
|
117
|
+
this.moveToNextInput(input);
|
118
|
+
}
|
119
|
+
else {
|
120
|
+
this.setPreventInput(input, false);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
else if (this.preventAutoFormatting) {
|
124
|
+
/**
|
125
|
+
* Using arrow keys prevents auto formatting so need to deal with
|
126
|
+
* switching from arrow keys to inputting numbers
|
127
|
+
**/
|
128
|
+
if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {
|
129
|
+
this.setInputValue(input);
|
130
|
+
this.setPreventInput(input, true);
|
131
|
+
this.moveToNextInput(input);
|
132
|
+
}
|
133
|
+
else {
|
134
|
+
this.setInputValue(input);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
if (input.value.length !== 2) {
|
138
|
+
this.setPreventInput(input, false);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
else {
|
142
|
+
if (input.value.length === 4) {
|
143
|
+
this.setInputValue(input);
|
144
|
+
if (Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING) {
|
145
|
+
this.moveToNextInput(input);
|
146
|
+
}
|
147
|
+
this.setPreventInput(input, true);
|
148
|
+
}
|
149
|
+
else {
|
150
|
+
this.setInputValue(input, true);
|
151
|
+
this.setPreventInput(input, false);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
// Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year
|
155
|
+
this.setFitToValueStyling(input);
|
156
|
+
if (input.value.length === 0) {
|
157
|
+
this.setInputValue(input, true);
|
158
|
+
this.setValidationMessage();
|
159
|
+
}
|
160
|
+
this.notifyScreenReader(input, event);
|
161
|
+
};
|
162
|
+
this.handleKeyDown = (event, isInputPrevented) => {
|
163
|
+
const input = event.target;
|
164
|
+
const eventKey = event.key.toLowerCase();
|
165
|
+
// Regex required due to FF allowing all characters as values for number text field.
|
166
|
+
const regex = /-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;
|
167
|
+
if (!regex.test(eventKey) &&
|
168
|
+
!((event.ctrlKey || event.metaKey) &&
|
169
|
+
(eventKey === "v" || eventKey === "c"))) {
|
170
|
+
event.preventDefault();
|
171
|
+
}
|
172
|
+
switch (eventKey) {
|
173
|
+
case "/":
|
174
|
+
case "-":
|
175
|
+
case ".":
|
176
|
+
event.preventDefault();
|
177
|
+
this.setPasteInvalidText();
|
178
|
+
this.moveToNextInput(input);
|
179
|
+
break;
|
180
|
+
case "arrowright":
|
181
|
+
case "arrowleft":
|
182
|
+
event.preventDefault();
|
183
|
+
this.handleLeftRightArrowKeyPress(input, eventKey);
|
184
|
+
break;
|
185
|
+
case "arrowup":
|
186
|
+
case "arrowdown":
|
187
|
+
this.preventAutoFormatting = true;
|
188
|
+
this.handleUpDownArrowKeyPress(input, event);
|
189
|
+
break;
|
190
|
+
}
|
191
|
+
this.preventInput(event, isInputPrevented);
|
192
|
+
this.isDateSetFromKeyboardEvent = true;
|
193
|
+
};
|
194
|
+
this.handleFocus = (event) => {
|
195
|
+
// Highlight / select all characters in input for easy replacement
|
196
|
+
const input = event.target;
|
197
|
+
input.select();
|
198
|
+
};
|
199
|
+
this.handleBlur = (event) => {
|
200
|
+
const input = event.target;
|
201
|
+
this.setPasteInvalidText();
|
202
|
+
this.autocompleteInput(input);
|
203
|
+
};
|
204
|
+
this.handleLeftRightArrowKeyPress = (input, key) => {
|
205
|
+
if (key === "arrowright") {
|
206
|
+
this.moveToNextInput(input);
|
207
|
+
}
|
208
|
+
else {
|
209
|
+
this.moveToPreviousInput(input);
|
210
|
+
}
|
211
|
+
this.setPasteInvalidText();
|
212
|
+
};
|
213
|
+
this.notifyScreenReaderSelectedDate = () => {
|
214
|
+
const dayNames = stringEnumToArray(IcDayNames);
|
215
|
+
const months = stringEnumToArray(IcDateInputMonths);
|
216
|
+
this.selectedDateInfoEl.textContent = `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`;
|
217
|
+
};
|
218
|
+
this.handleUpDownArrowKeyPress = (input, event) => {
|
219
|
+
const minValue = input === this.yearInputEl ? 0 : 1;
|
220
|
+
let maxValue;
|
221
|
+
switch (input) {
|
222
|
+
case this.dayInputEl:
|
223
|
+
maxValue = this.MAX_DAY;
|
224
|
+
break;
|
225
|
+
case this.monthInputEl:
|
226
|
+
maxValue = this.MAX_MONTH;
|
227
|
+
break;
|
228
|
+
case this.yearInputEl:
|
229
|
+
maxValue = 9999;
|
230
|
+
}
|
231
|
+
// Make value loop round when min / max reached
|
232
|
+
if (input === null || input === void 0 ? void 0 : input.value) {
|
233
|
+
if (event.key === "ArrowUp") {
|
234
|
+
if (+input.value === maxValue) {
|
235
|
+
event.preventDefault();
|
236
|
+
input.value = `0${minValue}`;
|
237
|
+
}
|
238
|
+
else {
|
239
|
+
input.value =
|
240
|
+
+input.value + 1 < 10
|
241
|
+
? `0${+input.value + 1}`
|
242
|
+
: (+input.value + 1).toString();
|
243
|
+
}
|
244
|
+
this.notifyScreenReader(input, event);
|
245
|
+
}
|
246
|
+
if (event.key === "ArrowDown") {
|
247
|
+
if (+input.value === minValue) {
|
248
|
+
event.preventDefault();
|
249
|
+
input.value = maxValue.toString();
|
250
|
+
}
|
251
|
+
else {
|
252
|
+
input.value =
|
253
|
+
+input.value - 1 < 10
|
254
|
+
? `0${+input.value - 1}`
|
255
|
+
: (+input.value - 1).toString();
|
256
|
+
}
|
257
|
+
this.notifyScreenReader(input, event);
|
258
|
+
}
|
259
|
+
}
|
260
|
+
else {
|
261
|
+
if (event.key === "ArrowDown") {
|
262
|
+
event.preventDefault();
|
263
|
+
if (input === this.yearInputEl) {
|
264
|
+
input.value = new Date().getFullYear().toString();
|
265
|
+
}
|
266
|
+
else {
|
267
|
+
input.value = maxValue.toString();
|
268
|
+
}
|
269
|
+
this.notifyScreenReader(input, event);
|
270
|
+
}
|
271
|
+
else if (event.key === "ArrowUp") {
|
272
|
+
event.preventDefault();
|
273
|
+
if (input === this.yearInputEl) {
|
274
|
+
input.value = new Date().getFullYear().toString();
|
275
|
+
}
|
276
|
+
else {
|
277
|
+
input.value = `0${minValue}`;
|
278
|
+
}
|
279
|
+
this.notifyScreenReader(input, event);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
this.setInputValue(input);
|
283
|
+
this.setFitToValueStyling(input);
|
284
|
+
};
|
285
|
+
this.handleDateChange = (force) => {
|
286
|
+
// Prevent icChange being emitted when each individual input is changed
|
287
|
+
// This method is used within componentWillUpdate instead of using @Watch('value');
|
288
|
+
if (force || !dateMatches(this.selectedDate, this.previousSelectedDate)) {
|
289
|
+
if (this.value) {
|
290
|
+
this.inputsInOrder.forEach((input) => {
|
291
|
+
input.classList.add(this.FIT_TO_VALUE);
|
292
|
+
});
|
293
|
+
}
|
294
|
+
if (this.day && this.month && this.year && this.invalidDateText === "") {
|
295
|
+
this.setValueAndEmitChange(this.selectedDate);
|
296
|
+
this.notifyScreenReaderSelectedDate();
|
297
|
+
}
|
298
|
+
else if (!(this.selectedDate === null && this.previousSelectedDate === null)) {
|
299
|
+
this.setValueAndEmitChange(null);
|
300
|
+
this.selectedDateInfoEl.textContent = "";
|
301
|
+
}
|
302
|
+
this.previousSelectedDate = this.selectedDate;
|
303
|
+
if (!this.isDateSetFromKeyboardEvent) {
|
304
|
+
this.updateInputValues(this.day, this.month, this.year);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
};
|
308
|
+
this.slicePastedDate = (valueLength, datePart) => {
|
309
|
+
return datePart.length > valueLength
|
310
|
+
? datePart.slice(0, valueLength)
|
311
|
+
: datePart;
|
312
|
+
};
|
313
|
+
this.isPastedStringDateValid = (value) => {
|
314
|
+
if (/\d+-\d+-\d+$/.test(value) ||
|
315
|
+
/\d+\/\d+\/\d+/.test(value) ||
|
316
|
+
/\d+\.\d+\.\d+/.test(value)) {
|
317
|
+
return true;
|
318
|
+
}
|
319
|
+
if (/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(value)) {
|
320
|
+
this.isZuluTime = true;
|
321
|
+
return true;
|
322
|
+
}
|
323
|
+
return false;
|
324
|
+
};
|
325
|
+
// Set value of each input to value of pasted date part
|
326
|
+
// Allows formats separated by '-' or '/'
|
327
|
+
this.handlePaste = (event) => {
|
328
|
+
event.preventDefault();
|
329
|
+
const pastedValue = event.clipboardData.getData("Text");
|
330
|
+
const isValidDate = this.isPastedStringDateValid(pastedValue);
|
331
|
+
this.setPastedValueAndValidation(isValidDate, pastedValue, event);
|
332
|
+
};
|
333
|
+
this.setDate = (date) => {
|
334
|
+
if (date === null || date === "" || date === undefined) {
|
335
|
+
this.day = null;
|
336
|
+
this.month = null;
|
337
|
+
this.year = null;
|
338
|
+
this.inputsInOrder.forEach((input) => {
|
339
|
+
input.classList.remove(this.FIT_TO_VALUE);
|
340
|
+
this.setPreventInput(input, false);
|
341
|
+
});
|
342
|
+
this.handleDateChange(true);
|
343
|
+
}
|
344
|
+
else {
|
345
|
+
if (isDateOrEpoch(date)) {
|
346
|
+
let newDate;
|
347
|
+
if (typeof date === "string") {
|
348
|
+
// Checking if epoch date time
|
349
|
+
newDate = new Date(+date);
|
350
|
+
}
|
351
|
+
else {
|
352
|
+
newDate = date;
|
353
|
+
}
|
354
|
+
this.day = convertToDoubleDigits(newDate.getDate());
|
355
|
+
this.month = convertToDoubleDigits(newDate.getMonth() + 1);
|
356
|
+
this.year = newDate.getFullYear().toString();
|
357
|
+
}
|
358
|
+
else if (typeof date === "string") {
|
359
|
+
const defaultDateArray = splitStringDate(date, this.dateFormat);
|
360
|
+
this.year = defaultDateArray[0];
|
361
|
+
this.month = defaultDateArray[1];
|
362
|
+
this.day = defaultDateArray[2];
|
363
|
+
}
|
364
|
+
}
|
365
|
+
this.setValidationMessage();
|
366
|
+
};
|
367
|
+
this.formatMinMax = (date) => {
|
368
|
+
let formattedDate;
|
369
|
+
const day = convertToDoubleDigits(date.getDate());
|
370
|
+
const month = convertToDoubleDigits(date.getMonth() + 1);
|
371
|
+
const year = date.getFullYear();
|
372
|
+
switch (this.dateFormat) {
|
373
|
+
case "DD/MM/YYYY":
|
374
|
+
formattedDate = `${day}/${month}/${year}`;
|
375
|
+
break;
|
376
|
+
case "MM/DD/YYYY":
|
377
|
+
formattedDate = `${month}/${day}/${year}`;
|
378
|
+
break;
|
379
|
+
case "YYYY/MM/DD":
|
380
|
+
formattedDate = `${year}/${month}/${day}`;
|
381
|
+
break;
|
382
|
+
}
|
383
|
+
return formattedDate;
|
384
|
+
};
|
385
|
+
this.updateInputValues = (day, month, year) => {
|
386
|
+
this.dayInputEl.value = day;
|
387
|
+
this.monthInputEl.value = month;
|
388
|
+
this.yearInputEl.value = year;
|
389
|
+
};
|
390
|
+
// Set value in state based on input
|
391
|
+
this.setInputValue = (input, clear = false) => {
|
392
|
+
const newValue = clear ? "" : input.value;
|
393
|
+
switch (input) {
|
394
|
+
case this.dayInputEl:
|
395
|
+
this.day = newValue;
|
396
|
+
break;
|
397
|
+
case this.monthInputEl:
|
398
|
+
this.month = newValue;
|
399
|
+
break;
|
400
|
+
case this.yearInputEl:
|
401
|
+
if (this.year !== newValue) {
|
402
|
+
this.year = newValue;
|
403
|
+
}
|
404
|
+
}
|
405
|
+
this.setValidationMessage();
|
406
|
+
};
|
407
|
+
this.setValidationMessage = () => {
|
408
|
+
this.setDateValidity();
|
409
|
+
if (!isEmptyString(this.day) &&
|
410
|
+
!isEmptyString(this.month) &&
|
411
|
+
!isEmptyString(this.year)) {
|
412
|
+
// Check whether date actually exists
|
413
|
+
// (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)
|
414
|
+
this.selectedDate = this.convertToDate(this.year, this.month, this.day);
|
415
|
+
this.isValidDate =
|
416
|
+
+this.selectedDate !== 0 && this.selectedDate.getDate() == +this.day;
|
417
|
+
this.isDisabledDate = this.isSelectedDateDisabled();
|
418
|
+
if (!this.isValidDate || this.isDisabledDate) {
|
419
|
+
this.inputsInOrder.forEach((input) => input.setAttribute(this.ARIA_INVALID, "true"));
|
420
|
+
}
|
421
|
+
else {
|
422
|
+
this.inputsInOrder.forEach((input) => input.removeAttribute(this.ARIA_INVALID));
|
423
|
+
}
|
424
|
+
}
|
425
|
+
else {
|
426
|
+
this.selectedDate = null;
|
427
|
+
}
|
428
|
+
if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {
|
429
|
+
this.invalidDateText = "Please enter a valid date.";
|
430
|
+
}
|
431
|
+
else if (this.isDisabledDate && this.selectedDate !== null) {
|
432
|
+
if (this.isBeforeMin) {
|
433
|
+
if (this.disablePast) {
|
434
|
+
this.invalidDateText = this.disablePastMessage;
|
435
|
+
}
|
436
|
+
else {
|
437
|
+
this.invalidDateText = `Please enter a date after ${this.formatMinMax(this.minDate)}.`;
|
438
|
+
}
|
439
|
+
}
|
440
|
+
else if (this.isAfterMax) {
|
441
|
+
if (this.disableFuture) {
|
442
|
+
this.invalidDateText = this.disableFutureMessage;
|
443
|
+
}
|
444
|
+
else {
|
445
|
+
this.invalidDateText = `Please enter a date before ${this.formatMinMax(this.maxDate)}.`;
|
446
|
+
}
|
447
|
+
}
|
448
|
+
else if (this.disableDays.length !== 0) {
|
449
|
+
this.invalidDateText = this.disableDaysMessage;
|
450
|
+
}
|
451
|
+
else {
|
452
|
+
if (this.disablePast) {
|
453
|
+
this.invalidDateText = this.disablePastMessage;
|
454
|
+
}
|
455
|
+
if (this.disableFuture) {
|
456
|
+
this.invalidDateText = this.disableFutureMessage;
|
457
|
+
}
|
458
|
+
}
|
459
|
+
}
|
460
|
+
else {
|
461
|
+
this.invalidDateText = "";
|
462
|
+
}
|
463
|
+
};
|
464
|
+
// Set refs to the input elements in the order they are displayed (based on the dateFormat)
|
465
|
+
this.setInputsInOrder = () => {
|
466
|
+
const inputs = this.el.shadowRoot.querySelectorAll("input");
|
467
|
+
inputs.forEach((input) => this.inputsInOrder.push(input));
|
468
|
+
};
|
469
|
+
// Includes text usually added using aria-describedby
|
470
|
+
// (which doesn't work on input component container)
|
471
|
+
this.setAriaLabelledBy = () => {
|
472
|
+
var _a;
|
473
|
+
if (this.disabled &&
|
474
|
+
!isEmptyString((_a = this.inputCompContainerEl) === null || _a === void 0 ? void 0 : _a.getAttribute(this.ARIA_LABELLED_BY))) {
|
475
|
+
this.removeAriaLabelledBy();
|
476
|
+
return;
|
477
|
+
}
|
478
|
+
if (this.disabled) {
|
479
|
+
return;
|
480
|
+
}
|
481
|
+
const labelEl = this.el.shadowRoot.querySelector("label");
|
482
|
+
const labelId = `${this.inputId}-label`;
|
483
|
+
if (labelEl !== null && labelEl !== undefined) {
|
484
|
+
labelEl.id = labelId;
|
485
|
+
const hasValidation = (!isEmptyString(this.validationStatus) &&
|
486
|
+
!isEmptyString(this.validationText)) ||
|
487
|
+
!isEmptyString(this.invalidDateText);
|
488
|
+
const labelledBy = `${labelId} ${this.screenReaderInfoId} ${getInputDescribedByText(this.inputId, this.helperText !== "" && this.helperText !== this.defaultHelperText, hasValidation)} ${this.selectedDate ? this.selectedDateInfoId : ""} ${this.assistiveHintId}`;
|
489
|
+
this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);
|
490
|
+
}
|
491
|
+
};
|
492
|
+
// Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)
|
493
|
+
this.setPreventInput = (input, isPrevented) => {
|
494
|
+
switch (input) {
|
495
|
+
case this.dayInputEl:
|
496
|
+
this.preventDayInput = isPrevented;
|
497
|
+
break;
|
498
|
+
case this.monthInputEl:
|
499
|
+
this.preventMonthInput = isPrevented;
|
500
|
+
break;
|
501
|
+
case this.yearInputEl:
|
502
|
+
this.preventYearInput = isPrevented;
|
503
|
+
}
|
504
|
+
};
|
505
|
+
// Get input based on letter representing each date part ("D", "M" or "Y")
|
506
|
+
// (retrieved from dateFormat)
|
507
|
+
this.getInputFromDatePart = (datePart) => {
|
508
|
+
const dayInput = (h("input", { class: "day-input", id: "day-input", ref: (el) => (this.dayInputEl = el), "aria-label": "day", placeholder: "DD", disabled: this.disabled, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventDayInput) }));
|
509
|
+
const monthInput = (h("input", { id: "month-input", class: "month-input", ref: (el) => (this.monthInputEl = el), "aria-label": "month", placeholder: "MM", disabled: this.disabled, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventMonthInput) }));
|
510
|
+
const yearInput = (h("input", { id: "year-input", class: "year-input", ref: (el) => (this.yearInputEl = el), "aria-label": "year", placeholder: "YYYY", maxLength: 4, disabled: this.disabled, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventYearInput) }));
|
511
|
+
let input;
|
512
|
+
switch (datePart) {
|
513
|
+
case "D":
|
514
|
+
input = dayInput;
|
515
|
+
break;
|
516
|
+
case "M":
|
517
|
+
input = monthInput;
|
518
|
+
break;
|
519
|
+
case "Y":
|
520
|
+
input = yearInput;
|
521
|
+
}
|
522
|
+
return input;
|
523
|
+
};
|
524
|
+
// Get input elements in order of chosen date format
|
525
|
+
this.getInputsInOrder = () => {
|
526
|
+
const dateParts = this.dateFormat.split("/");
|
527
|
+
const inputsInOrder = [];
|
528
|
+
dateParts.forEach((part) => {
|
529
|
+
inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));
|
530
|
+
});
|
531
|
+
return inputsInOrder;
|
532
|
+
};
|
533
|
+
// To add to the end of assistive hint to make it clearer that each date part has its own input
|
534
|
+
// that can be changed individually
|
535
|
+
this.getDescOfInputsOrder = () => {
|
536
|
+
let description;
|
537
|
+
switch (this.dateFormat) {
|
538
|
+
case "DD/MM/YYYY":
|
539
|
+
description = "day, month, and year";
|
540
|
+
break;
|
541
|
+
case "MM/DD/YYYY":
|
542
|
+
description = "month, day, and year";
|
543
|
+
break;
|
544
|
+
case "YYYY/MM/DD":
|
545
|
+
description = "year, month, and day";
|
546
|
+
}
|
547
|
+
return description;
|
548
|
+
};
|
549
|
+
// Add 'required' or 'invalid data' to span used in aria-labelledby
|
550
|
+
// Many ARIA attributes aren't read out by screen reader when on the input component container
|
551
|
+
this.getScreenReaderInfo = (validationStatus) => {
|
552
|
+
let inputDescriptors = "";
|
553
|
+
if (this.required) {
|
554
|
+
inputDescriptors += "required";
|
555
|
+
}
|
556
|
+
if (validationStatus === IcInformationStatus.Error) {
|
557
|
+
inputDescriptors += " invalid data";
|
558
|
+
}
|
559
|
+
return inputDescriptors === "" ? "" : inputDescriptors + ", ";
|
560
|
+
};
|
561
|
+
// Prevent non-number characters being entered
|
562
|
+
// ('e' or '.' - which are usually allowed in <input type="number">)
|
563
|
+
// And limit the number of characters within each field (2 for day / month, 4 for year)
|
564
|
+
// (because 'maxlength' doesn't work on <input type="number">)
|
565
|
+
this.preventInput = (event, isInputPrevented) => {
|
566
|
+
const key = event.key;
|
567
|
+
const input = event.target;
|
568
|
+
let selectedString;
|
569
|
+
if (input) {
|
570
|
+
selectedString = input.value.substring(input.selectionStart, input.selectionEnd);
|
571
|
+
}
|
572
|
+
if (key === "e" ||
|
573
|
+
key === "." ||
|
574
|
+
key === "-" ||
|
575
|
+
(event.key >= "0" &&
|
576
|
+
event.key <= "9" &&
|
577
|
+
isInputPrevented &&
|
578
|
+
!selectedString)) {
|
579
|
+
event.preventDefault();
|
580
|
+
}
|
581
|
+
};
|
582
|
+
// Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day
|
583
|
+
// Consider using dateClamp and inDateRange
|
584
|
+
this.isSelectedDateDisabled = () => {
|
585
|
+
const currentDate = new Date();
|
586
|
+
this.isAfterMax = false;
|
587
|
+
this.isBeforeMin = false;
|
588
|
+
let disabled = false;
|
589
|
+
const isNotToday = this.selectedDate.toDateString() !== currentDate.toDateString();
|
590
|
+
if (this.minDate && this.selectedDate < this.minDate && isNotToday) {
|
591
|
+
this.isBeforeMin = true;
|
592
|
+
disabled = true;
|
593
|
+
}
|
594
|
+
if (this.maxDate && this.selectedDate > this.maxDate && isNotToday) {
|
595
|
+
this.isAfterMax = true;
|
596
|
+
disabled = true;
|
597
|
+
}
|
598
|
+
if (this.disableDays.includes(this.selectedDate.getDay())) {
|
599
|
+
disabled = true;
|
600
|
+
}
|
601
|
+
if (((this.disablePast && this.selectedDate < currentDate) ||
|
602
|
+
(this.disableFuture && this.selectedDate > currentDate)) &&
|
603
|
+
isNotToday) {
|
604
|
+
disabled = true;
|
605
|
+
}
|
606
|
+
return disabled;
|
607
|
+
};
|
608
|
+
this.moveToNextInput = (currentInput) => {
|
609
|
+
const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
|
610
|
+
const nextInput = this.inputsInOrder[currentInputPos + 1];
|
611
|
+
this.preventAutoFormatting = false;
|
612
|
+
if (nextInput) {
|
613
|
+
nextInput.focus();
|
614
|
+
}
|
615
|
+
};
|
616
|
+
this.moveToPreviousInput = (currentInput) => {
|
617
|
+
const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
|
618
|
+
this.preventAutoFormatting = false;
|
619
|
+
if (this.inputsInOrder[currentInputPos - 1]) {
|
620
|
+
this.inputsInOrder[currentInputPos - 1].focus();
|
621
|
+
}
|
622
|
+
};
|
623
|
+
this.autocompleteInput = (input) => {
|
624
|
+
if (input === this.yearInputEl) {
|
625
|
+
this.autocompleteYear();
|
626
|
+
}
|
627
|
+
else {
|
628
|
+
const inputValue = input.value;
|
629
|
+
// Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)
|
630
|
+
if (inputValue.length === 1) {
|
631
|
+
if (+inputValue === 0) {
|
632
|
+
input.value = "01";
|
633
|
+
}
|
634
|
+
else {
|
635
|
+
input.value = `0${inputValue}`;
|
636
|
+
}
|
637
|
+
}
|
638
|
+
}
|
639
|
+
if (input.value) {
|
640
|
+
this.setInputValue(input);
|
641
|
+
}
|
642
|
+
};
|
643
|
+
// Autocomplete year as current millennium when fewer than 4 characters entered
|
644
|
+
this.autocompleteYear = () => {
|
645
|
+
const inputValue = this.yearInputEl.value;
|
646
|
+
const yearNumbers = ["2", "0", "0"];
|
647
|
+
let autocompletedInput = "";
|
648
|
+
if (inputValue) {
|
649
|
+
yearNumbers.forEach((number, index) => {
|
650
|
+
if (inputValue.length + index <= 3) {
|
651
|
+
autocompletedInput += number;
|
652
|
+
}
|
653
|
+
});
|
654
|
+
this.yearInputEl.value = `${autocompletedInput}${inputValue}`;
|
655
|
+
}
|
656
|
+
};
|
657
|
+
this.convertToDate = (year, month, day) => {
|
658
|
+
if (!isEmptyString(year) && !isEmptyString(month) && !isEmptyString(day)) {
|
659
|
+
return new Date(+year, +month - 1, +day);
|
660
|
+
}
|
661
|
+
else {
|
662
|
+
return null;
|
663
|
+
}
|
664
|
+
};
|
665
|
+
this.handleHostBlur = () => {
|
666
|
+
this.removeLabelledBy = false;
|
667
|
+
this.icBlur.emit({ value: this.selectedDate });
|
668
|
+
};
|
669
|
+
this.handleHostFocus = () => {
|
670
|
+
var _a;
|
671
|
+
if ((_a = this.el.shadowRoot.activeElement) === null || _a === void 0 ? void 0 : _a.id.match(/(day|month|year)-input$/)) {
|
672
|
+
this.removeLabelledBy = false;
|
673
|
+
}
|
674
|
+
else {
|
675
|
+
this.removeLabelledBy = true;
|
676
|
+
}
|
677
|
+
this.icFocus.emit({ value: this.selectedDate });
|
678
|
+
};
|
679
|
+
this.handleFormReset = () => {
|
680
|
+
// Get the initial value and populate day, month and year again.
|
681
|
+
this.setDate(this.initialValue);
|
682
|
+
this.setValidationMessage();
|
683
|
+
this.handleDateChange(false);
|
684
|
+
};
|
685
|
+
this.getAriaLabel = (input) => {
|
686
|
+
return input.getAttribute(this.ARIA_LABEL);
|
687
|
+
};
|
688
|
+
this.notifyScreenReaderArrowKeys = (input) => {
|
689
|
+
const liveRegion = this.el.shadowRoot.querySelector("#live-region");
|
690
|
+
let announcement = "";
|
691
|
+
const ariaLabel = this.getAriaLabel(input);
|
692
|
+
if (liveRegion && input.value) {
|
693
|
+
if (input === this.monthInputEl &&
|
694
|
+
!!IcDateInputMonths[+input.value - 1]) {
|
695
|
+
announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
|
696
|
+
}
|
697
|
+
if (input === this.dayInputEl || input === this.yearInputEl) {
|
698
|
+
announcement = `${input.value}, ${ariaLabel}`;
|
699
|
+
}
|
700
|
+
liveRegion.textContent = announcement;
|
701
|
+
}
|
702
|
+
};
|
703
|
+
this.notifyScreenReaderInput = (input, liveRegion) => {
|
704
|
+
let announcement = "";
|
705
|
+
const ariaLabel = this.getAriaLabel(input);
|
706
|
+
if (input === this.dayInputEl || input === this.monthInputEl) {
|
707
|
+
if (input.value.length === 2) {
|
708
|
+
if (input === this.monthInputEl &&
|
709
|
+
!!IcDateInputMonths[+input.value - 1] &&
|
710
|
+
this.isValidMonth) {
|
711
|
+
announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
|
712
|
+
}
|
713
|
+
if (input === this.dayInputEl && this.isValidDay) {
|
714
|
+
announcement = `${input.value}, ${ariaLabel}`;
|
715
|
+
}
|
716
|
+
}
|
717
|
+
else {
|
718
|
+
announcement = "";
|
719
|
+
}
|
720
|
+
}
|
721
|
+
else {
|
722
|
+
if (input.value.length === 4) {
|
723
|
+
announcement = `${input.value}, ${ariaLabel}`;
|
724
|
+
}
|
725
|
+
else {
|
726
|
+
announcement = "";
|
727
|
+
}
|
728
|
+
}
|
729
|
+
liveRegion.textContent = announcement;
|
730
|
+
};
|
731
|
+
this.setFitToValueStyling = (input) => {
|
732
|
+
if (input.value) {
|
733
|
+
input.classList.add(this.FIT_TO_VALUE);
|
734
|
+
}
|
735
|
+
else {
|
736
|
+
input.classList.remove(this.FIT_TO_VALUE);
|
737
|
+
}
|
738
|
+
};
|
739
|
+
this.setAriaInvalid = (validDay, validMonth, validDate, disabledDate) => {
|
740
|
+
if (this.inputsInOrder.length) {
|
741
|
+
this.inputsInOrder.forEach((input) => {
|
742
|
+
input.removeAttribute(this.ARIA_INVALID);
|
743
|
+
});
|
744
|
+
if (!validDay) {
|
745
|
+
this.dayInputEl.setAttribute(this.ARIA_INVALID, "true");
|
746
|
+
}
|
747
|
+
if (!validMonth) {
|
748
|
+
this.monthInputEl.setAttribute(this.ARIA_INVALID, "true");
|
749
|
+
}
|
750
|
+
if (!validDate || disabledDate) {
|
751
|
+
this.inputsInOrder.forEach((input) => {
|
752
|
+
input.setAttribute(this.ARIA_INVALID, "true");
|
753
|
+
});
|
754
|
+
}
|
755
|
+
}
|
756
|
+
};
|
757
|
+
this.handleClear = () => {
|
758
|
+
this.inputsInOrder.forEach((input) => {
|
759
|
+
input.classList.remove(this.FIT_TO_VALUE);
|
760
|
+
this.setInputValue(input, true);
|
761
|
+
this.setPreventInput(input, false);
|
762
|
+
});
|
763
|
+
this.isDateSetFromKeyboardEvent = false;
|
764
|
+
this.setValidationMessage();
|
765
|
+
this.handleDateChange(true);
|
766
|
+
this.inputsInOrder[0].focus();
|
767
|
+
};
|
768
|
+
this.handleCalendarOpen = (ev) => {
|
769
|
+
var _a, _b;
|
770
|
+
ev.stopImmediatePropagation();
|
771
|
+
(_a = this.calendarButtonEl) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector("ic-tooltip").displayTooltip(false);
|
772
|
+
this.calendarButtonClicked.emit({ value: this.selectedDate });
|
773
|
+
(_b = this.calendarButtonEl) === null || _b === void 0 ? void 0 : _b.shadowRoot.querySelector("ic-tooltip").displayTooltip(false);
|
774
|
+
this.isDateSetFromKeyboardEvent = false;
|
775
|
+
};
|
776
|
+
this.setValueAndEmitChange = (value) => {
|
777
|
+
if (!dateMatches(new Date(this.value), value)) {
|
778
|
+
this.emitIcChange(value);
|
779
|
+
this.value = value;
|
780
|
+
}
|
781
|
+
};
|
782
|
+
this.handleCalendarFocus = () => {
|
783
|
+
this.calendarFocused = true;
|
784
|
+
};
|
785
|
+
this.handleCalendarBlur = () => {
|
786
|
+
this.calendarFocused = false;
|
787
|
+
};
|
788
|
+
this.handleClearFocus = () => {
|
789
|
+
this.removeLabelledBy = true;
|
790
|
+
this.clearButtonFocused = true;
|
791
|
+
};
|
792
|
+
this.handleClearBlur = (ev) => {
|
793
|
+
var _a;
|
794
|
+
this.clearButtonFocused = false;
|
795
|
+
if ((_a = ev.relatedTarget) === null || _a === void 0 ? void 0 : _a.id.match(/(day|year)-input$/)) {
|
796
|
+
this.removeLabelledBy = false;
|
797
|
+
return;
|
798
|
+
}
|
799
|
+
this.removeLabelledBy = true;
|
800
|
+
};
|
801
|
+
this.emitIcChange = (d) => {
|
802
|
+
if (!(d === null && this.previousEmittedDate === null) &&
|
803
|
+
!dateMatches(d, this.previousEmittedDate)) {
|
804
|
+
this.previousEmittedDate = d;
|
805
|
+
this.icChange.emit({ value: d });
|
806
|
+
}
|
807
|
+
};
|
808
|
+
this.day = "";
|
809
|
+
this.invalidDateText = undefined;
|
810
|
+
this.maxDate = undefined;
|
811
|
+
this.minDate = undefined;
|
812
|
+
this.month = "";
|
813
|
+
this.year = "";
|
814
|
+
this.calendarFocused = false;
|
815
|
+
this.clearButtonFocused = false;
|
816
|
+
this.removeLabelledBy = false;
|
817
|
+
this.dateFormat = "DD/MM/YYYY";
|
818
|
+
this.disabled = false;
|
819
|
+
this.disableDays = [];
|
820
|
+
this.disableDaysMessage = "The date you have selected is on a day of the week that is not allowed. Please select another date.";
|
821
|
+
this.disableFuture = false;
|
822
|
+
this.disableFutureMessage = "Dates in the future are not allowed. Please select a date in the past.";
|
823
|
+
this.disablePast = false;
|
824
|
+
this.disablePastMessage = "Dates in the past are not allowed. Please select a date in the future.";
|
825
|
+
this.helperText = undefined;
|
826
|
+
this.inputId = `ic-date-input-${inputIds++}`;
|
827
|
+
this.label = undefined;
|
828
|
+
this.max = "";
|
829
|
+
this.min = "";
|
830
|
+
this.name = this.inputId;
|
831
|
+
this.required = false;
|
832
|
+
this.showCalendarButton = false;
|
833
|
+
this.showClearButton = true;
|
834
|
+
this.size = "default";
|
835
|
+
this.value = "";
|
836
|
+
this.validationStatus = "";
|
837
|
+
this.validationText = "";
|
838
|
+
}
|
839
|
+
watchDisableFutureHandler() {
|
840
|
+
this.watchMaxHandler();
|
841
|
+
}
|
842
|
+
watchDisablePastHandler() {
|
843
|
+
this.watchMinHandler();
|
844
|
+
}
|
845
|
+
watchMaxHandler() {
|
846
|
+
if (this.disableFuture) {
|
847
|
+
this.maxDate = new Date();
|
848
|
+
}
|
849
|
+
else {
|
850
|
+
this.maxDate = createDate(this.max, this.dateFormat);
|
851
|
+
}
|
852
|
+
}
|
853
|
+
watchMinHandler() {
|
854
|
+
if (this.disablePast) {
|
855
|
+
this.minDate = new Date();
|
856
|
+
}
|
857
|
+
else {
|
858
|
+
this.minDate = createDate(this.min, this.dateFormat);
|
859
|
+
}
|
860
|
+
}
|
861
|
+
watchRequiredHandler() {
|
862
|
+
// Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)
|
863
|
+
// Needed because label is included in 'aria-labelledby' instead of using 'aria-label'
|
864
|
+
const labelEl = this.el.shadowRoot.querySelector("label");
|
865
|
+
if (this.required) {
|
866
|
+
const asteriskSpan = document.createElement("span");
|
867
|
+
asteriskSpan.setAttribute("id", "asterisk-span");
|
868
|
+
asteriskSpan.setAttribute("aria-hidden", "true");
|
869
|
+
asteriskSpan.textContent = " *";
|
870
|
+
labelEl === null || labelEl === void 0 ? void 0 : labelEl.appendChild(asteriskSpan);
|
871
|
+
}
|
872
|
+
else {
|
873
|
+
const asteriskSpan = this.el.shadowRoot.querySelector("#asterisk-span");
|
874
|
+
if (asteriskSpan) {
|
875
|
+
asteriskSpan.remove();
|
876
|
+
}
|
877
|
+
}
|
878
|
+
}
|
879
|
+
disconnectedCallback() {
|
880
|
+
removeFormResetListener(this.el, this.handleFormReset);
|
881
|
+
}
|
882
|
+
componentWillLoad() {
|
883
|
+
this.defaultHelperText = `Use format ${this.dateFormat}`;
|
884
|
+
if (isEmptyString(this.helperText))
|
885
|
+
this.helperText = this.defaultHelperText;
|
886
|
+
this.watchMinHandler();
|
887
|
+
this.watchMaxHandler();
|
888
|
+
if (this.value) {
|
889
|
+
this.setDate(this.value);
|
890
|
+
this.previousEmittedDate = this.selectedDate;
|
891
|
+
}
|
892
|
+
else {
|
893
|
+
this.previousEmittedDate = null;
|
894
|
+
}
|
895
|
+
this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;
|
896
|
+
this.assistiveHintId = `${this.inputId}-assistive-hint`;
|
897
|
+
this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
|
898
|
+
addFormResetListener(this.el, this.handleFormReset);
|
899
|
+
}
|
900
|
+
componentDidLoad() {
|
901
|
+
this.setInputsInOrder();
|
902
|
+
onComponentRequiredPropUndefined([{ prop: this.label, propName: "label" }], "Date Input");
|
903
|
+
if (this.value) {
|
904
|
+
this.updateInputValues(this.day, this.month, this.year);
|
905
|
+
this.inputsInOrder.forEach((input) => {
|
906
|
+
input.classList.add(this.FIT_TO_VALUE);
|
907
|
+
});
|
908
|
+
}
|
909
|
+
this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
|
910
|
+
if (this.value) {
|
911
|
+
this.notifyScreenReaderSelectedDate();
|
912
|
+
}
|
913
|
+
this.inputsInOrder.forEach((input) => {
|
914
|
+
input.addEventListener("input", this.handleInput);
|
915
|
+
input.addEventListener("focus", this.handleFocus);
|
916
|
+
input.addEventListener("blur", this.handleBlur);
|
917
|
+
});
|
918
|
+
this.watchRequiredHandler();
|
919
|
+
}
|
920
|
+
componentWillUpdate() {
|
921
|
+
if (isEmptyString(this.helperText))
|
922
|
+
this.helperText = this.defaultHelperText;
|
923
|
+
if (!this.isDateSetFromKeyboardEvent)
|
924
|
+
this.setDate(this.value);
|
925
|
+
this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
|
926
|
+
this.handleDateChange(false);
|
927
|
+
this.isDateSetFromKeyboardEvent = false;
|
928
|
+
}
|
929
|
+
componentDidRender() {
|
930
|
+
if (this.removeLabelledBy) {
|
931
|
+
this.removeAriaLabelledBy();
|
932
|
+
return;
|
933
|
+
}
|
934
|
+
this.setAriaLabelledBy();
|
935
|
+
}
|
936
|
+
/**
|
937
|
+
* Returns the value as a Date object
|
938
|
+
* @returns Date
|
939
|
+
*/
|
940
|
+
async getDate() {
|
941
|
+
return this.selectedDate;
|
942
|
+
}
|
943
|
+
/**
|
944
|
+
* @internal Sets focus on the calendar button.
|
945
|
+
*/
|
946
|
+
async setCalendarFocus() {
|
947
|
+
if (this.calendarButtonEl) {
|
948
|
+
this.calendarButtonEl.focus();
|
949
|
+
}
|
950
|
+
}
|
951
|
+
/**
|
952
|
+
* @internal Used to pass disabledDays from parent component.
|
953
|
+
*/
|
954
|
+
async setDisableDays(days) {
|
955
|
+
this.disableDays = days;
|
956
|
+
}
|
957
|
+
/**
|
958
|
+
* @internal Used to enable other components to invoke an IcChange event from the input.
|
959
|
+
*/
|
960
|
+
async triggerIcChange(d) {
|
961
|
+
this.emitIcChange(d);
|
962
|
+
}
|
963
|
+
removeAriaLabelledBy() {
|
964
|
+
this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);
|
965
|
+
}
|
966
|
+
setPastedValueAndValidation(isValidDate, pastedValue, event) {
|
967
|
+
switch (true) {
|
968
|
+
case isValidDate: {
|
969
|
+
const nextParsedValue = this.isZuluTime
|
970
|
+
? extractDateFromZuluDateTime(pastedValue)
|
971
|
+
: pastedValue;
|
972
|
+
const dateParts = nextParsedValue.split(/-|\/|\./);
|
973
|
+
this.inputsInOrder.forEach((input, index) => {
|
974
|
+
input.classList.add(this.FIT_TO_VALUE);
|
975
|
+
if (this.isZuluTime) {
|
976
|
+
this.pasteZuluDateTime(dateParts, index);
|
977
|
+
}
|
978
|
+
else {
|
979
|
+
let dateValue;
|
980
|
+
if (input === this.dayInputEl || input === this.monthInputEl) {
|
981
|
+
dateValue = this.slicePastedDate(2, dateParts[index]);
|
982
|
+
}
|
983
|
+
else {
|
984
|
+
dateValue = this.slicePastedDate(4, dateParts[index]);
|
985
|
+
}
|
986
|
+
input.value = dateValue;
|
987
|
+
this.setInputValue(input);
|
988
|
+
this.autocompleteInput(input);
|
989
|
+
}
|
990
|
+
});
|
991
|
+
this.isZuluTime = false;
|
992
|
+
break;
|
993
|
+
}
|
994
|
+
case (pastedValue.length === 1 ||
|
995
|
+
pastedValue.length === 2 ||
|
996
|
+
pastedValue.length === 4) &&
|
997
|
+
isNumeric(pastedValue):
|
998
|
+
if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {
|
999
|
+
// Check if copied value can be pasted into input
|
1000
|
+
this.setInputPasteValue(event.target, pastedValue);
|
1001
|
+
this.setInputValue(event.target);
|
1002
|
+
}
|
1003
|
+
else {
|
1004
|
+
this.displayPastedValidation(event);
|
1005
|
+
}
|
1006
|
+
break;
|
1007
|
+
case pastedValue.length === 3 && isNumeric(pastedValue):
|
1008
|
+
if (event.target !== this.yearInputEl) {
|
1009
|
+
this.displayPastedValidation(event);
|
1010
|
+
}
|
1011
|
+
else {
|
1012
|
+
this.setInputPasteValue(event.target, pastedValue);
|
1013
|
+
this.setInputValue(event.target);
|
1014
|
+
}
|
1015
|
+
break;
|
1016
|
+
case pastedValue.length >= 5 && isNumeric(pastedValue):
|
1017
|
+
this.displayPastedValidation(event);
|
1018
|
+
}
|
1019
|
+
}
|
1020
|
+
pasteZuluDateTime(dateParts, index) {
|
1021
|
+
// ['YYYY', 'MM', 'DD']
|
1022
|
+
if (index === 0) {
|
1023
|
+
const dateValue = this.slicePastedDate(4, dateParts[index]);
|
1024
|
+
this.yearInputEl.value = dateValue;
|
1025
|
+
this.setInputValue(this.yearInputEl);
|
1026
|
+
}
|
1027
|
+
else if (index === 1) {
|
1028
|
+
// The month value is the second item in the array
|
1029
|
+
const dateValue = this.slicePastedDate(2, dateParts[index]);
|
1030
|
+
this.monthInputEl.value = dateValue;
|
1031
|
+
this.setInputValue(this.monthInputEl);
|
1032
|
+
}
|
1033
|
+
else {
|
1034
|
+
const dateValue = this.slicePastedDate(2, dateParts[index]);
|
1035
|
+
this.dayInputEl.value = dateValue;
|
1036
|
+
this.setInputValue(this.dayInputEl);
|
1037
|
+
}
|
1038
|
+
}
|
1039
|
+
displayPastedValidation(event) {
|
1040
|
+
var _a;
|
1041
|
+
if (((_a = this.invalidDateText) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
1042
|
+
this.previousInvalidDateTest = this.invalidDateText;
|
1043
|
+
}
|
1044
|
+
this.invalidDateText = `Please paste a valid ${this.getAriaLabel(event.target)}`;
|
1045
|
+
this.validationStatus = IcInformationStatus.Error;
|
1046
|
+
this.isPasteValidationDisplayed = true;
|
1047
|
+
}
|
1048
|
+
setPasteInvalidText() {
|
1049
|
+
var _a;
|
1050
|
+
if (this.isPasteValidationDisplayed) {
|
1051
|
+
this.invalidDateText = (_a = this.previousInvalidDateTest) !== null && _a !== void 0 ? _a : "";
|
1052
|
+
this.isPasteValidationDisplayed = false;
|
1053
|
+
// This is to prevent setDate from triggering within componentWillUpdate
|
1054
|
+
this.isDateSetFromKeyboardEvent = true;
|
1055
|
+
}
|
1056
|
+
}
|
1057
|
+
notifyScreenReader(input, event) {
|
1058
|
+
const liveRegion = this.el.shadowRoot.querySelector("#live-region");
|
1059
|
+
if (liveRegion) {
|
1060
|
+
if (this.isKeyboardOrEvent(event)) {
|
1061
|
+
this.notifyScreenReaderArrowKeys(input);
|
1062
|
+
}
|
1063
|
+
else if (Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING) {
|
1064
|
+
this.notifyScreenReaderInput(input, liveRegion);
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
render() {
|
1069
|
+
const { inputId, label, disabled, helperText, showClearButton, showCalendarButton, size, } = this;
|
1070
|
+
const hasCustomValidation = !isEmptyString(this.validationStatus) &&
|
1071
|
+
!isEmptyString(this.validationText);
|
1072
|
+
const validationStatus = hasCustomValidation
|
1073
|
+
? this.validationStatus
|
1074
|
+
: !isEmptyString(this.invalidDateText)
|
1075
|
+
? IcInformationStatus.Error
|
1076
|
+
: "";
|
1077
|
+
const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;
|
1078
|
+
renderHiddenInput(true, this.el, this.name, this.convertToDate(this.year, this.month, this.day), this.disabled);
|
1079
|
+
return (h(Host, { onBlur: this.handleHostBlur, onFocus: this.handleHostFocus }, h("ic-input-container", { disabled: disabled }, h("ic-input-label", { for: inputId, label: label, helperText: helperText, disabled: disabled }), h("span", { id: this.screenReaderInfoId, class: "sr-only", "aria-hidden": "true" }, this.getScreenReaderInfo(validationStatus), `${this.defaultHelperText}.`), h("span", { id: this.assistiveHintId, class: "sr-only", "aria-hidden": "true" }, assistiveHint), h("span", { id: "live-region", "aria-live": "assertive", class: "sr-only" }), h("ic-input-component-container", { id: inputId, ref: (el) => (this.inputCompContainerEl = el), disabled: disabled, validationStatus: validationStatus, size: size, role: "group" }, h("div", { class: "input-container" }, h("div", { class: "date-inputs" }, this.getInputsInOrder()[0], "/", this.getInputsInOrder()[1], "/", this.getInputsInOrder()[2]), h("div", { class: "action-buttons" }, showClearButton && (h("ic-button", { id: "clear-button", "aria-label": "Clear input", class: {
|
1080
|
+
["clear-button"]: true,
|
1081
|
+
["hidden"]: isEmptyString(this.day) &&
|
1082
|
+
isEmptyString(this.month) &&
|
1083
|
+
isEmptyString(this.year),
|
1084
|
+
}, disabled: this.disabled, innerHTML: Clear, onClick: this.handleClear, onFocus: this.handleClearFocus, onBlur: this.handleClearBlur, variant: "icon", appearance: this.clearButtonFocused
|
1085
|
+
? IcThemeForegroundEnum.Light
|
1086
|
+
: IcThemeForegroundEnum.Dark, size: size })), showCalendarButton && (h("div", { class: "show-calendar-button-wrapper" }, h("div", { class: { divider: true, [size]: true } }), h("ic-button", { 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", size: size, onFocus: this.handleCalendarFocus, onBlur: this.handleCalendarBlur, appearance: this.calendarFocused
|
1087
|
+
? IcThemeForegroundEnum.Light
|
1088
|
+
: IcThemeForegroundEnum.Default })))))), h("span", { id: this.selectedDateInfoId, class: "sr-only", "aria-live": "polite" }, h("span", { ref: (el) => (this.selectedDateInfoEl = el), role: "status" })), (hasCustomValidation || !isEmptyString(this.invalidDateText)) && (h("ic-input-validation", { status: validationStatus, message: hasCustomValidation ? this.validationText : this.invalidDateText, for: inputId })))));
|
1089
|
+
}
|
1090
|
+
static get delegatesFocus() { return true; }
|
1091
|
+
get el() { return getElement(this); }
|
1092
|
+
static get watchers() { return {
|
1093
|
+
"disableFuture": ["watchDisableFutureHandler"],
|
1094
|
+
"disablePast": ["watchDisablePastHandler"],
|
1095
|
+
"max": ["watchMaxHandler"],
|
1096
|
+
"min": ["watchMinHandler"],
|
1097
|
+
"required": ["watchRequiredHandler"]
|
1098
|
+
}; }
|
1099
|
+
};
|
1100
|
+
DateInput.style = icDateInputCss;
|
1101
|
+
|
1102
|
+
export { DateInput as ic_date_input };
|
1103
|
+
|
1104
|
+
//# sourceMappingURL=ic-date-input.entry.js.map
|