@ukic/canary-web-components 2.0.0-canary.10 → 2.0.0-canary.12
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/{helpers-7a069459.js → helpers-b525d45a.js} +2 -7
- package/dist/cjs/helpers-b525d45a.js.map +1 -0
- package/dist/cjs/{helpers-f75cf7cf.js → helpers-c4444a7e.js} +48 -94
- package/dist/cjs/helpers-c4444a7e.js.map +1 -0
- 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 +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 +2 -8
- 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 +1 -1
- package/dist/cjs/ic-data-row.cjs.entry.js +1 -1
- package/dist/cjs/ic-data-table-title-bar.cjs.entry.js +57 -0
- package/dist/cjs/ic-data-table-title-bar.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-data-table.cjs.entry.js +308 -43
- package/dist/cjs/ic-data-table.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ic-divider.cjs.entry.js +1 -1
- package/dist/cjs/{ic-pagination-bar.cjs.entry.js → ic-empty-state_2.cjs.entry.js} +34 -4
- package/dist/cjs/ic-empty-state_2.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-menu.cjs.entry.js → ic-input-component-container_3.cjs.entry.js} +69 -5
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-input-label_2.cjs.entry.js +86 -0
- package/dist/cjs/ic-input-label_2.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-link.cjs.entry.js +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-navigation-button.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-group.cjs.entry.js +13 -16
- package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js +32 -28
- 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-pagination_4.cjs.entry.js +5 -5
- 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 +1 -1
- package/dist/cjs/ic-radio-option.cjs.entry.js +1 -1
- package/dist/cjs/ic-search-bar.cjs.entry.js +1 -1
- package/dist/cjs/ic-select-with-multi.cjs.entry.js +19 -6
- package/dist/cjs/ic-select-with-multi.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-side-navigation.cjs.entry.js +1 -1
- package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
- package/dist/cjs/ic-step.cjs.entry.js +1 -1
- package/dist/cjs/ic-stepper.cjs.entry.js +1 -1
- package/dist/cjs/ic-switch.cjs.entry.js +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 +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 +60 -46
- package/dist/cjs/ic-top-navigation.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-typography.cjs.entry.js +35 -11
- package/dist/cjs/ic-typography.cjs.entry.js.map +1 -1
- package/dist/cjs/index-4cf27b16.js +10 -18
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -2
- package/dist/collection/components/ic-data-table/ic-data-table.css +82 -7
- package/dist/collection/components/ic-data-table/ic-data-table.js +535 -44
- 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 +386 -11
- 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.e2e.js +217 -0
- package/dist/collection/components/ic-data-table/test/basic/ic-data-table.e2e.js.map +1 -0
- package/dist/collection/components/ic-data-table/test/basic/ic-data-table.spec.js +319 -0
- package/dist/collection/components/ic-data-table/test/basic/ic-data-table.spec.js.map +1 -1
- package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.css +87 -0
- package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js +160 -0
- package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js.map +1 -0
- package/dist/collection/components/{ic-date-picker/test/a11y/ic-date-picker.test.a11y.js → ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.js} +3 -5
- package/dist/collection/components/ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.js.map +1 -0
- package/dist/collection/components/ic-data-table-title-bar/test/basic/ic-data-table-title-bar.spec.js +70 -0
- package/dist/collection/components/ic-data-table-title-bar/test/basic/ic-data-table-title-bar.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 +0 -55
- package/dist/collection/utils/constants.js.map +1 -1
- package/dist/collection/utils/helpers.js +43 -259
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/collection/utils/types.js +0 -45
- package/dist/collection/utils/types.js.map +1 -1
- package/dist/components/helpers.js +2 -7
- package/dist/components/helpers.js.map +1 -1
- package/dist/components/helpers2.js +45 -91
- package/dist/components/helpers2.js.map +1 -1
- package/dist/components/ic-button2.js +3 -11
- 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 +1 -1
- package/dist/components/{ic-date-input.d.ts → ic-data-table-title-bar.d.ts} +4 -4
- package/dist/components/ic-data-table-title-bar.js +136 -0
- package/dist/components/ic-data-table-title-bar.js.map +1 -0
- package/dist/components/ic-data-table.js +334 -49
- package/dist/components/ic-data-table.js.map +1 -1
- package/dist/components/ic-empty-state.js +1 -57
- package/dist/components/ic-empty-state.js.map +1 -1
- package/dist/{esm/ic-empty-state.entry.js → components/ic-empty-state2.js} +38 -11
- package/dist/components/ic-empty-state2.js.map +1 -0
- 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 +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 +1 -1
- package/dist/components/ic-navigation-group.js +12 -15
- package/dist/components/ic-navigation-group.js.map +1 -1
- package/dist/components/ic-navigation-item.js +32 -28
- 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 +1 -1
- package/dist/components/ic-radio-option.js +1 -1
- package/dist/components/ic-search-bar.js +1 -1
- package/dist/components/ic-select-with-multi.js +14 -1
- package/dist/components/ic-select-with-multi.js.map +1 -1
- package/dist/components/ic-select2.js +1 -1
- package/dist/components/ic-switch.js +1 -1
- package/dist/components/ic-tab.js +1 -1
- package/dist/components/ic-text-field2.js +1 -1
- package/dist/components/ic-toggle-button.js +1 -1
- package/dist/components/ic-top-navigation.js +61 -47
- package/dist/components/ic-top-navigation.js.map +1 -1
- package/dist/components/ic-typography2.js +38 -12
- 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-8ea47d42.entry.js → p-045359e1.entry.js} +2 -2
- package/dist/core/{p-3745da83.entry.js → p-10fb4c46.entry.js} +2 -2
- package/dist/core/p-169bfa51.entry.js +2 -0
- package/dist/core/p-169bfa51.entry.js.map +1 -0
- package/dist/core/{p-2e2e0099.entry.js → p-1ca332ca.entry.js} +2 -2
- package/dist/core/p-1e91f540.entry.js +2 -0
- package/dist/core/p-1e91f540.entry.js.map +1 -0
- package/dist/core/{p-d4fdd8c1.entry.js → p-204ace96.entry.js} +2 -2
- package/dist/core/{p-5fe96107.entry.js → p-2eac7dcc.entry.js} +2 -2
- package/dist/core/p-347e8dab.entry.js +2 -0
- package/dist/core/p-347e8dab.entry.js.map +1 -0
- package/dist/core/p-3803a5b5.entry.js +2 -0
- package/dist/core/p-3803a5b5.entry.js.map +1 -0
- package/dist/core/{p-36508aad.entry.js → p-4753bac8.entry.js} +2 -2
- package/dist/core/{p-4f1ffa39.entry.js → p-4baa0916.entry.js} +2 -2
- package/dist/core/{p-776671cf.entry.js → p-4f413fc0.entry.js} +2 -2
- package/dist/core/p-5171169f.entry.js +2 -0
- package/dist/core/p-5171169f.entry.js.map +1 -0
- package/dist/core/{p-9d540656.entry.js → p-595be57d.entry.js} +2 -2
- package/dist/core/{p-7cecf5d5.entry.js → p-5ae93c16.entry.js} +2 -2
- package/dist/core/{p-1ce75941.entry.js → p-5e0c830b.entry.js} +2 -2
- package/dist/core/p-5ee4319c.entry.js +2 -0
- package/dist/core/p-5ee4319c.entry.js.map +1 -0
- package/dist/core/p-5f4e96ec.entry.js +2 -0
- package/dist/core/p-5f4e96ec.entry.js.map +1 -0
- package/dist/core/{p-e74f1d09.entry.js → p-624d4f5f.entry.js} +2 -2
- package/dist/core/{p-9d01a7ad.entry.js → p-6933f8e9.entry.js} +2 -2
- package/dist/core/{p-5e2e6c3b.entry.js → p-6c3044b6.entry.js} +2 -2
- package/dist/core/p-7267fe19.entry.js +2 -0
- package/dist/core/p-7267fe19.entry.js.map +1 -0
- package/dist/core/{p-6690bc04.entry.js → p-75dac3d1.entry.js} +2 -2
- package/dist/core/{p-85609bdd.entry.js → p-7ef8d616.entry.js} +2 -2
- package/dist/core/{p-a0f9b259.entry.js → p-81ddc39d.entry.js} +2 -2
- package/dist/core/{p-a6447b13.entry.js → p-869954a2.entry.js} +2 -2
- package/dist/core/{p-47ac6838.entry.js → p-88d54b72.entry.js} +2 -2
- package/dist/core/{p-06ae5bec.entry.js → p-8b08d8fe.entry.js} +2 -2
- package/dist/core/{p-ca8cbd6a.entry.js → p-917c5721.entry.js} +2 -2
- package/dist/core/p-942282cd.entry.js +2 -0
- package/dist/core/p-942282cd.entry.js.map +1 -0
- package/dist/core/p-96b3e7e2.js +2 -0
- package/dist/core/p-96b3e7e2.js.map +1 -0
- package/dist/core/p-9caf19eb.js +2 -0
- package/dist/core/p-9caf19eb.js.map +1 -0
- package/dist/core/{p-76d26018.entry.js → p-a0f8efb2.entry.js} +2 -2
- package/dist/core/{p-a42c2f37.entry.js → p-a31031a5.entry.js} +2 -2
- package/dist/core/{p-b306cbc8.entry.js → p-a434c3d4.entry.js} +2 -2
- package/dist/core/{p-86012178.entry.js → p-a43c12cd.entry.js} +2 -2
- package/dist/core/{p-8c90110a.entry.js → p-a50c3b9e.entry.js} +2 -2
- package/dist/core/p-aac4185b.entry.js +2 -0
- package/dist/core/p-aac4185b.entry.js.map +1 -0
- package/dist/core/{p-1b7d426b.entry.js → p-ab09986c.entry.js} +2 -2
- package/dist/core/{p-9e3178e8.entry.js → p-b6639e4a.entry.js} +2 -2
- package/dist/core/{p-9e3178e8.entry.js.map → p-b6639e4a.entry.js.map} +1 -1
- package/dist/core/{p-62e22508.entry.js → p-b82dcc29.entry.js} +2 -2
- package/dist/core/{p-d5c99ec3.entry.js → p-ba86928c.entry.js} +2 -2
- package/dist/core/{p-d3856ed3.entry.js → p-c34848da.entry.js} +2 -2
- package/dist/core/{p-98448bdb.entry.js → p-d8469ac0.entry.js} +2 -2
- package/dist/core/{p-1832f4b5.entry.js → p-db9c03c0.entry.js} +2 -2
- package/dist/core/{p-ae422058.entry.js → p-e3997d60.entry.js} +2 -2
- package/dist/core/{p-982a6e88.entry.js → p-e834344e.entry.js} +2 -2
- package/dist/core/p-f14454b1.entry.js +2 -0
- package/dist/core/{p-f55ad6ae.entry.js.map → p-f14454b1.entry.js.map} +1 -1
- package/dist/core/{p-c7820c23.entry.js → p-f3c840cd.entry.js} +2 -2
- package/dist/core/p-f6888309.entry.js +2 -0
- package/dist/core/p-f6888309.entry.js.map +1 -0
- package/dist/core/p-f74a8752.entry.js +2 -0
- package/dist/core/p-f74a8752.entry.js.map +1 -0
- package/dist/core/{p-5759d771.entry.js → p-f7a14c01.entry.js} +2 -2
- package/dist/core/{p-0939ce92.entry.js → p-f843da01.entry.js} +2 -2
- package/dist/core/{p-e84b0310.entry.js → p-fc5611e2.entry.js} +2 -2
- package/dist/esm/core.js +1 -1
- package/dist/esm/{helpers-7aa21b0a.js → helpers-12b4266a.js} +2 -7
- package/dist/esm/helpers-12b4266a.js.map +1 -0
- package/dist/esm/{helpers-f328a7b6.js → helpers-1f07eb61.js} +46 -92
- package/dist/esm/helpers-1f07eb61.js.map +1 -0
- 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 +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 +2 -8
- 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 +1 -1
- package/dist/esm/ic-data-row.entry.js +1 -1
- package/dist/esm/ic-data-table-title-bar.entry.js +53 -0
- package/dist/esm/ic-data-table-title-bar.entry.js.map +1 -0
- package/dist/esm/ic-data-table.entry.js +309 -44
- package/dist/esm/ic-data-table.entry.js.map +1 -1
- package/dist/esm/ic-dialog.entry.js +1 -1
- package/dist/esm/ic-divider.entry.js +1 -1
- package/dist/esm/{ic-pagination-bar.entry.js → ic-empty-state_2.entry.js} +34 -5
- package/dist/esm/ic-empty-state_2.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-menu.entry.js → ic-input-component-container_3.entry.js} +69 -7
- package/dist/esm/ic-input-component-container_3.entry.js.map +1 -0
- package/dist/esm/ic-input-label_2.entry.js +81 -0
- package/dist/esm/ic-input-label_2.entry.js.map +1 -0
- package/dist/esm/ic-link.entry.js +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-navigation-button.entry.js +1 -1
- package/dist/esm/ic-navigation-group.entry.js +13 -16
- package/dist/esm/ic-navigation-group.entry.js.map +1 -1
- package/dist/esm/ic-navigation-item.entry.js +32 -28
- 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-pagination_4.entry.js +5 -5
- 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 +1 -1
- package/dist/esm/ic-radio-option.entry.js +1 -1
- package/dist/esm/ic-search-bar.entry.js +1 -1
- package/dist/esm/ic-select-with-multi.entry.js +14 -1
- package/dist/esm/ic-select-with-multi.entry.js.map +1 -1
- package/dist/esm/ic-side-navigation.entry.js +1 -1
- package/dist/esm/ic-status-tag.entry.js +1 -1
- package/dist/esm/ic-step.entry.js +1 -1
- package/dist/esm/ic-stepper.entry.js +1 -1
- package/dist/esm/ic-switch.entry.js +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 +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 +60 -46
- package/dist/esm/ic-top-navigation.entry.js.map +1 -1
- package/dist/esm/ic-typography.entry.js +36 -12
- package/dist/esm/ic-typography.entry.js.map +1 -1
- package/dist/esm/index-93509377.js +10 -18
- 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 +96 -1
- package/dist/types/components/ic-data-table/ic-data-table.types.d.ts +11 -0
- package/dist/types/components/ic-data-table/story-data.d.ts +99 -0
- package/dist/types/components/ic-data-table-title-bar/ic-data-table-title-bar.d.ts +36 -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 +141 -389
- package/dist/types/utils/constants.d.ts +0 -37
- package/dist/types/utils/helpers.d.ts +16 -83
- package/dist/types/utils/types.d.ts +1 -92
- package/hydrate/index.js +945 -2932
- package/package.json +3 -4
- package/dist/cjs/date-helpers-c9551119.js +0 -150
- package/dist/cjs/date-helpers-c9551119.js.map +0 -1
- package/dist/cjs/helpers-7a069459.js.map +0 -1
- package/dist/cjs/helpers-f75cf7cf.js.map +0 -1
- package/dist/cjs/ic-date-input.cjs.entry.js +0 -1073
- package/dist/cjs/ic-date-input.cjs.entry.js.map +0 -1
- package/dist/cjs/ic-date-picker.cjs.entry.js +0 -1050
- package/dist/cjs/ic-date-picker.cjs.entry.js.map +0 -1
- package/dist/cjs/ic-empty-state.cjs.entry.js +0 -38
- package/dist/cjs/ic-empty-state.cjs.entry.js.map +0 -1
- package/dist/cjs/ic-input-component-container_4.cjs.entry.js +0 -150
- package/dist/cjs/ic-input-component-container_4.cjs.entry.js.map +0 -1
- package/dist/cjs/ic-menu.cjs.entry.js.map +0 -1
- package/dist/cjs/ic-pagination-bar.cjs.entry.js.map +0 -1
- package/dist/collection/assets/calendar.svg +0 -3
- package/dist/collection/components/ic-date-input/ic-date-input.css +0 -560
- package/dist/collection/components/ic-date-input/ic-date-input.js +0 -1668
- package/dist/collection/components/ic-date-input/ic-date-input.js.map +0 -1
- package/dist/collection/components/ic-date-input/story-data.js +0 -28
- package/dist/collection/components/ic-date-input/story-data.js.map +0 -1
- package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js +0 -1156
- package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js.map +0 -1
- package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js +0 -42
- package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js.map +0 -1
- package/dist/collection/components/ic-date-picker/ic-date-picker.css +0 -878
- package/dist/collection/components/ic-date-picker/ic-date-picker.js +0 -1506
- package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +0 -1
- package/dist/collection/components/ic-date-picker/ic-day-button.js +0 -36
- 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/collection/components/ic-date-picker/story-data.js +0 -147
- package/dist/collection/components/ic-date-picker/story-data.js.map +0 -1
- package/dist/collection/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.js.map +0 -1
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js +0 -207
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js.map +0 -1
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js +0 -962
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js.map +0 -1
- package/dist/collection/utils/date-helpers.js +0 -133
- package/dist/collection/utils/date-helpers.js.map +0 -1
- package/dist/components/ic-date-input.js +0 -8
- package/dist/components/ic-date-input.js.map +0 -1
- package/dist/components/ic-date-input2.js +0 -1301
- package/dist/components/ic-date-input2.js.map +0 -1
- package/dist/components/ic-date-picker.d.ts +0 -11
- package/dist/components/ic-date-picker.js +0 -1171
- package/dist/components/ic-date-picker.js.map +0 -1
- package/dist/core/p-16f67397.entry.js +0 -2
- package/dist/core/p-16f67397.entry.js.map +0 -1
- package/dist/core/p-2c1fecb9.entry.js +0 -2
- package/dist/core/p-2c1fecb9.entry.js.map +0 -1
- package/dist/core/p-33679c06.entry.js +0 -2
- package/dist/core/p-33679c06.entry.js.map +0 -1
- package/dist/core/p-33dd24eb.js +0 -2
- package/dist/core/p-33dd24eb.js.map +0 -1
- package/dist/core/p-5392bca0.entry.js +0 -2
- package/dist/core/p-5392bca0.entry.js.map +0 -1
- package/dist/core/p-550a5674.entry.js +0 -2
- package/dist/core/p-550a5674.entry.js.map +0 -1
- package/dist/core/p-6c0e2ceb.entry.js +0 -2
- package/dist/core/p-6c0e2ceb.entry.js.map +0 -1
- package/dist/core/p-8ab12a15.entry.js +0 -2
- package/dist/core/p-8ab12a15.entry.js.map +0 -1
- package/dist/core/p-aabab75f.entry.js +0 -2
- package/dist/core/p-aabab75f.entry.js.map +0 -1
- package/dist/core/p-c7590421.entry.js +0 -2
- package/dist/core/p-c7590421.entry.js.map +0 -1
- package/dist/core/p-caf857de.entry.js +0 -2
- package/dist/core/p-caf857de.entry.js.map +0 -1
- package/dist/core/p-cd799087.js +0 -2
- package/dist/core/p-cd799087.js.map +0 -1
- package/dist/core/p-d32692e2.entry.js +0 -2
- package/dist/core/p-d32692e2.entry.js.map +0 -1
- package/dist/core/p-d35c7c18.js +0 -2
- package/dist/core/p-d35c7c18.js.map +0 -1
- package/dist/core/p-e189f1d0.entry.js +0 -2
- package/dist/core/p-e189f1d0.entry.js.map +0 -1
- package/dist/core/p-e5d76564.entry.js +0 -2
- package/dist/core/p-e5d76564.entry.js.map +0 -1
- package/dist/core/p-f55ad6ae.entry.js +0 -2
- package/dist/core/p-f91527a0.entry.js +0 -2
- package/dist/core/p-f91527a0.entry.js.map +0 -1
- package/dist/esm/date-helpers-0e5e32a7.js +0 -136
- package/dist/esm/date-helpers-0e5e32a7.js.map +0 -1
- package/dist/esm/helpers-7aa21b0a.js.map +0 -1
- package/dist/esm/helpers-f328a7b6.js.map +0 -1
- package/dist/esm/ic-date-input.entry.js +0 -1069
- package/dist/esm/ic-date-input.entry.js.map +0 -1
- package/dist/esm/ic-date-picker.entry.js +0 -1046
- package/dist/esm/ic-date-picker.entry.js.map +0 -1
- package/dist/esm/ic-empty-state.entry.js.map +0 -1
- package/dist/esm/ic-input-component-container_4.entry.js +0 -143
- package/dist/esm/ic-input-component-container_4.entry.js.map +0 -1
- package/dist/esm/ic-menu.entry.js.map +0 -1
- package/dist/esm/ic-pagination-bar.entry.js.map +0 -1
- package/dist/types/components/ic-date-input/ic-date-input.d.ts +0 -242
- package/dist/types/components/ic-date-input/story-data.d.ts +0 -1
- package/dist/types/components/ic-date-input/test/helpers/ic-date-input.d.ts +0 -23
- package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +0 -251
- package/dist/types/components/ic-date-picker/ic-day-button.d.ts +0 -16
- package/dist/types/components/ic-date-picker/ic-month-picker.d.ts +0 -14
- package/dist/types/components/ic-date-picker/ic-year-picker.d.ts +0 -16
- package/dist/types/components/ic-date-picker/story-data.d.ts +0 -22
- package/dist/types/utils/date-helpers.d.ts +0 -22
- /package/dist/core/{p-8ea47d42.entry.js.map → p-045359e1.entry.js.map} +0 -0
- /package/dist/core/{p-3745da83.entry.js.map → p-10fb4c46.entry.js.map} +0 -0
- /package/dist/core/{p-2e2e0099.entry.js.map → p-1ca332ca.entry.js.map} +0 -0
- /package/dist/core/{p-d4fdd8c1.entry.js.map → p-204ace96.entry.js.map} +0 -0
- /package/dist/core/{p-5fe96107.entry.js.map → p-2eac7dcc.entry.js.map} +0 -0
- /package/dist/core/{p-36508aad.entry.js.map → p-4753bac8.entry.js.map} +0 -0
- /package/dist/core/{p-4f1ffa39.entry.js.map → p-4baa0916.entry.js.map} +0 -0
- /package/dist/core/{p-776671cf.entry.js.map → p-4f413fc0.entry.js.map} +0 -0
- /package/dist/core/{p-9d540656.entry.js.map → p-595be57d.entry.js.map} +0 -0
- /package/dist/core/{p-7cecf5d5.entry.js.map → p-5ae93c16.entry.js.map} +0 -0
- /package/dist/core/{p-1ce75941.entry.js.map → p-5e0c830b.entry.js.map} +0 -0
- /package/dist/core/{p-e74f1d09.entry.js.map → p-624d4f5f.entry.js.map} +0 -0
- /package/dist/core/{p-9d01a7ad.entry.js.map → p-6933f8e9.entry.js.map} +0 -0
- /package/dist/core/{p-5e2e6c3b.entry.js.map → p-6c3044b6.entry.js.map} +0 -0
- /package/dist/core/{p-6690bc04.entry.js.map → p-75dac3d1.entry.js.map} +0 -0
- /package/dist/core/{p-85609bdd.entry.js.map → p-7ef8d616.entry.js.map} +0 -0
- /package/dist/core/{p-a0f9b259.entry.js.map → p-81ddc39d.entry.js.map} +0 -0
- /package/dist/core/{p-a6447b13.entry.js.map → p-869954a2.entry.js.map} +0 -0
- /package/dist/core/{p-47ac6838.entry.js.map → p-88d54b72.entry.js.map} +0 -0
- /package/dist/core/{p-06ae5bec.entry.js.map → p-8b08d8fe.entry.js.map} +0 -0
- /package/dist/core/{p-ca8cbd6a.entry.js.map → p-917c5721.entry.js.map} +0 -0
- /package/dist/core/{p-76d26018.entry.js.map → p-a0f8efb2.entry.js.map} +0 -0
- /package/dist/core/{p-a42c2f37.entry.js.map → p-a31031a5.entry.js.map} +0 -0
- /package/dist/core/{p-b306cbc8.entry.js.map → p-a434c3d4.entry.js.map} +0 -0
- /package/dist/core/{p-86012178.entry.js.map → p-a43c12cd.entry.js.map} +0 -0
- /package/dist/core/{p-8c90110a.entry.js.map → p-a50c3b9e.entry.js.map} +0 -0
- /package/dist/core/{p-1b7d426b.entry.js.map → p-ab09986c.entry.js.map} +0 -0
- /package/dist/core/{p-62e22508.entry.js.map → p-b82dcc29.entry.js.map} +0 -0
- /package/dist/core/{p-d5c99ec3.entry.js.map → p-ba86928c.entry.js.map} +0 -0
- /package/dist/core/{p-d3856ed3.entry.js.map → p-c34848da.entry.js.map} +0 -0
- /package/dist/core/{p-98448bdb.entry.js.map → p-d8469ac0.entry.js.map} +0 -0
- /package/dist/core/{p-1832f4b5.entry.js.map → p-db9c03c0.entry.js.map} +0 -0
- /package/dist/core/{p-ae422058.entry.js.map → p-e3997d60.entry.js.map} +0 -0
- /package/dist/core/{p-982a6e88.entry.js.map → p-e834344e.entry.js.map} +0 -0
- /package/dist/core/{p-c7820c23.entry.js.map → p-f3c840cd.entry.js.map} +0 -0
- /package/dist/core/{p-5759d771.entry.js.map → p-f7a14c01.entry.js.map} +0 -0
- /package/dist/core/{p-0939ce92.entry.js.map → p-f843da01.entry.js.map} +0 -0
- /package/dist/core/{p-e84b0310.entry.js.map → p-fc5611e2.entry.js.map} +0 -0
- /package/dist/types/components/{ic-date-picker/test/a11y/ic-date-picker.test.a11y.d.ts → ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.d.ts} +0 -0
@@ -1,1301 +0,0 @@
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import { i as isEmptyString, s as stringEnumToArray, g as getInputDescribedByText, r as removeFormResetListener, a as addFormResetListener, o as onComponentRequiredPropUndefined, b as isNumeric, I as IcInformationStatus, d as renderHiddenInput, e as IcThemeForegroundEnum, f as IcDayNames, h as IcDateInputMonths } from './helpers2.js';
|
3
|
-
import { d as defineCustomElement$8 } from './ic-button2.js';
|
4
|
-
import { d as defineCustomElement$7 } from './ic-input-component-container2.js';
|
5
|
-
import { d as defineCustomElement$6 } from './ic-input-container2.js';
|
6
|
-
import { d as defineCustomElement$5 } from './ic-input-label2.js';
|
7
|
-
import { d as defineCustomElement$4 } from './ic-input-validation2.js';
|
8
|
-
import { d as defineCustomElement$3 } from './ic-loading-indicator2.js';
|
9
|
-
import { d as defineCustomElement$2 } from './ic-tooltip2.js';
|
10
|
-
import { d as defineCustomElement$1 } from './ic-typography2.js';
|
11
|
-
|
12
|
-
const isMonthFirstFormat = (dateString) => {
|
13
|
-
const monthFirstFormat = /^(0[1-9]|1[0-2])(\/|-)(0[1-9]|[12][0-9]|3[01])(\/|-)\d{4}$/;
|
14
|
-
return monthFirstFormat.test(dateString);
|
15
|
-
};
|
16
|
-
const isDayFirstFormat = (dateString) => {
|
17
|
-
const dayFirstFormat = /^(0[1-9]|[12][0-9]|3[01])(\/|-)(0[1-9]|1[0-2])(\/|-)\d{4}$/;
|
18
|
-
return dayFirstFormat.test(dateString);
|
19
|
-
};
|
20
|
-
const createDate = (date, dateFormat) => {
|
21
|
-
let newDate;
|
22
|
-
if (isDateOrEpoch(date)) {
|
23
|
-
newDate = typeof date === "string" ? new Date(date) : date;
|
24
|
-
}
|
25
|
-
else if (typeof date === "string") {
|
26
|
-
const dateArray = splitStringDate(date, dateFormat);
|
27
|
-
const year = Number(dateArray[0]);
|
28
|
-
const month = Number(dateArray[1]) - 1;
|
29
|
-
const day = Number(dateArray[2]);
|
30
|
-
newDate = new Date(year, month, day);
|
31
|
-
}
|
32
|
-
return newDate;
|
33
|
-
};
|
34
|
-
const isDateOrEpoch = (date) => {
|
35
|
-
return date instanceof Date || !isNaN(+new Date(+date));
|
36
|
-
};
|
37
|
-
const extractDateFromZuluDateTime = (zuluDateTime) => zuluDateTime.slice(0, zuluDateTime.indexOf("T"));
|
38
|
-
const splitStringDate = (date, dateFormat) => {
|
39
|
-
// returns an array where item 1 is year, item 2 is month, item 3 is day
|
40
|
-
if (date.includes("T") && date.includes("Z")) {
|
41
|
-
const nextDate = extractDateFromZuluDateTime(date);
|
42
|
-
return nextDate.split("-");
|
43
|
-
}
|
44
|
-
let newDate = [];
|
45
|
-
const dateWithSlashes = date.replace(/-/g, "/");
|
46
|
-
if (dateWithSlashes.split("/").length > 1) {
|
47
|
-
const dateParts = dateWithSlashes.split("/");
|
48
|
-
// pad any values to 2 characters
|
49
|
-
dateParts.forEach((d, i) => {
|
50
|
-
if (d.length === 1) {
|
51
|
-
dateParts[i] = convertToDoubleDigits(d);
|
52
|
-
}
|
53
|
-
});
|
54
|
-
if (dateParts[0].length === 4) {
|
55
|
-
newDate = [dateParts[0], dateParts[1], dateParts[2]];
|
56
|
-
}
|
57
|
-
else {
|
58
|
-
const newDateStr = dateParts.join("/");
|
59
|
-
const validDayFirst = isDayFirstFormat(newDateStr);
|
60
|
-
const validMonthFirst = isMonthFirstFormat(newDateStr);
|
61
|
-
if (validDayFirst && validMonthFirst) {
|
62
|
-
if (dateFormat.charAt(0) === "M") {
|
63
|
-
newDate = [dateParts[2], dateParts[0], dateParts[1]];
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
newDate = [dateParts[2], dateParts[1], dateParts[0]];
|
67
|
-
}
|
68
|
-
}
|
69
|
-
else if (validMonthFirst) {
|
70
|
-
newDate = [dateParts[2], dateParts[0], dateParts[1]];
|
71
|
-
}
|
72
|
-
else {
|
73
|
-
newDate = [dateParts[2], dateParts[1], dateParts[0]];
|
74
|
-
}
|
75
|
-
}
|
76
|
-
}
|
77
|
-
return newDate;
|
78
|
-
};
|
79
|
-
const convertToDoubleDigits = (value) => {
|
80
|
-
if (+value < 10) {
|
81
|
-
return `0${value}`;
|
82
|
-
}
|
83
|
-
return value.toString();
|
84
|
-
};
|
85
|
-
const getWeekStart = (date, startDay) => {
|
86
|
-
const tmpDate = new Date(date);
|
87
|
-
const day = tmpDate.getDay();
|
88
|
-
const diff = (day < startDay ? 7 : 0) + day - startDay;
|
89
|
-
tmpDate.setDate(tmpDate.getDate() - diff);
|
90
|
-
return tmpDate;
|
91
|
-
};
|
92
|
-
const getWeekEnd = (date, startDay) => {
|
93
|
-
const d = new Date(date);
|
94
|
-
const day = d.getDay();
|
95
|
-
const diff = (day < startDay ? -7 : 0) + 6 - (day - startDay);
|
96
|
-
d.setDate(d.getDate() + diff);
|
97
|
-
return d;
|
98
|
-
};
|
99
|
-
const getMonthStart = (date) => {
|
100
|
-
return new Date(date.getFullYear(), date.getMonth(), 1);
|
101
|
-
};
|
102
|
-
const getMonthEnd = (date) => {
|
103
|
-
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
104
|
-
};
|
105
|
-
/**
|
106
|
-
* Compare if two dates are equal exactly equal
|
107
|
-
*/
|
108
|
-
const dateMatches = (a, b) => {
|
109
|
-
if (a === null || b === null) {
|
110
|
-
return false;
|
111
|
-
}
|
112
|
-
return (a.getFullYear() === b.getFullYear() &&
|
113
|
-
a.getMonth() === b.getMonth() &&
|
114
|
-
a.getDate() === b.getDate());
|
115
|
-
};
|
116
|
-
const clampDate = (date, min, max) => {
|
117
|
-
const time = date.getTime();
|
118
|
-
if (min !== null && time < min.getTime()) {
|
119
|
-
return min;
|
120
|
-
}
|
121
|
-
if (max !== null && time > max.getTime()) {
|
122
|
-
return max;
|
123
|
-
}
|
124
|
-
return date;
|
125
|
-
};
|
126
|
-
/**
|
127
|
-
* Compare if date is within specified range
|
128
|
-
*/
|
129
|
-
const dateInRange = (date, min, max) => {
|
130
|
-
return clampDate(date, min, max) === date;
|
131
|
-
};
|
132
|
-
const yearInRange = (year, min, max) => {
|
133
|
-
let allowed = true;
|
134
|
-
if (year !== null) {
|
135
|
-
if (min !== null && year < min.getFullYear()) {
|
136
|
-
allowed = false;
|
137
|
-
}
|
138
|
-
if (allowed && max !== null && year > max.getFullYear()) {
|
139
|
-
allowed = false;
|
140
|
-
}
|
141
|
-
}
|
142
|
-
return allowed;
|
143
|
-
};
|
144
|
-
|
145
|
-
const Clear = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
146
|
-
<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"/>
|
147
|
-
</svg>
|
148
|
-
`;
|
149
|
-
|
150
|
-
const Calendar = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
151
|
-
<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"/>
|
152
|
-
</svg>`;
|
153
|
-
|
154
|
-
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)}.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)}";
|
155
|
-
|
156
|
-
let inputIds = 0;
|
157
|
-
const DateInput = /*@__PURE__*/ proxyCustomElement(class DateInput extends HTMLElement {
|
158
|
-
constructor() {
|
159
|
-
super();
|
160
|
-
this.__registerHost();
|
161
|
-
this.__attachShadow();
|
162
|
-
this.calendarButtonClicked = createEvent(this, "calendarButtonClicked", 7);
|
163
|
-
this.icBlur = createEvent(this, "icBlur", 7);
|
164
|
-
this.icChange = createEvent(this, "icChange", 7);
|
165
|
-
this.icFocus = createEvent(this, "icFocus", 7);
|
166
|
-
this.ARIA_INVALID = "aria-invalid";
|
167
|
-
this.ARIA_LABEL = "aria-label";
|
168
|
-
this.ARIA_LABELLED_BY = "aria-labelledby";
|
169
|
-
this.EVENT_OBJECT_STRING = "[object Event]";
|
170
|
-
this.FIT_TO_VALUE = "fit-to-value";
|
171
|
-
this.initialValue = this.value;
|
172
|
-
this.INPUT_EVENT_OBJECT_STRING = "[object InputEvent]";
|
173
|
-
this.inputsInOrder = [];
|
174
|
-
this.isAfterMax = false;
|
175
|
-
this.isBeforeMin = false;
|
176
|
-
this.isDateSetFromKeyboardEvent = false;
|
177
|
-
this.isDisabledDate = false;
|
178
|
-
this.isValidDay = true;
|
179
|
-
this.isValidMonth = true;
|
180
|
-
this.isValidDate = true;
|
181
|
-
this.isZuluTime = false;
|
182
|
-
this.KEYBOARD_EVENT_OBJECT_STRING = "[object KeyboardEvent]";
|
183
|
-
this.MAX_DAY = 31;
|
184
|
-
this.MAX_MONTH = 12;
|
185
|
-
this.previousSelectedDate = null;
|
186
|
-
this.selectedDate = null;
|
187
|
-
this.setInputPasteValue = (input, pastedValue) => {
|
188
|
-
const inputEl = input;
|
189
|
-
inputEl.value = pastedValue;
|
190
|
-
inputEl.classList.add(this.FIT_TO_VALUE);
|
191
|
-
};
|
192
|
-
this.checkSingleCopiedValueIsValid = (input, pastedValue) => {
|
193
|
-
let isValid = false;
|
194
|
-
const value = Number(pastedValue);
|
195
|
-
switch (input) {
|
196
|
-
case this.dayInputEl:
|
197
|
-
isValid = value >= 1 && value <= this.MAX_DAY;
|
198
|
-
break;
|
199
|
-
case this.monthInputEl:
|
200
|
-
isValid = value >= 1 && value <= this.MAX_MONTH;
|
201
|
-
break;
|
202
|
-
case this.yearInputEl:
|
203
|
-
isValid = true;
|
204
|
-
break;
|
205
|
-
default:
|
206
|
-
isValid = false;
|
207
|
-
break;
|
208
|
-
}
|
209
|
-
return isValid;
|
210
|
-
};
|
211
|
-
/**
|
212
|
-
* Using Object.prototype.string to determine type if event from user
|
213
|
-
* @param event - event object used to differentiate keyboard, generic or input event
|
214
|
-
* @returns boolean
|
215
|
-
*/
|
216
|
-
this.isKeyboardOrEvent = (event) => {
|
217
|
-
return (Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||
|
218
|
-
Object.prototype.toString.call(event) ===
|
219
|
-
this.KEYBOARD_EVENT_OBJECT_STRING);
|
220
|
-
};
|
221
|
-
this.setDateValidity = () => {
|
222
|
-
if (!isEmptyString(this.day)) {
|
223
|
-
this.isValidDay = +this.day > this.MAX_DAY ? false : true;
|
224
|
-
}
|
225
|
-
else {
|
226
|
-
this.isValidDay = true;
|
227
|
-
}
|
228
|
-
if (!isEmptyString(this.month)) {
|
229
|
-
this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;
|
230
|
-
}
|
231
|
-
else {
|
232
|
-
this.isValidMonth = true;
|
233
|
-
}
|
234
|
-
};
|
235
|
-
this.handleInput = (event) => {
|
236
|
-
const inputEvent = event;
|
237
|
-
const input = event.target;
|
238
|
-
if (input !== this.yearInputEl) {
|
239
|
-
// Only auto-format if input event is not a character being deleted
|
240
|
-
// and not as user is changing value using up / down keys
|
241
|
-
if (inputEvent.inputType !== "deleteContentBackward" &&
|
242
|
-
!this.preventAutoFormatting) {
|
243
|
-
if (input.value.length === 1 &&
|
244
|
-
((input === this.dayInputEl && +input.value >= 4) ||
|
245
|
-
(input === this.monthInputEl && +input.value >= 2)) &&
|
246
|
-
+input.value <= 9) {
|
247
|
-
this.setInputValue(input);
|
248
|
-
this.notifyScreenReader(input, event);
|
249
|
-
this.moveToNextInput(input);
|
250
|
-
}
|
251
|
-
if (input.value.length === 2) {
|
252
|
-
if (+input.value === 0) {
|
253
|
-
input.value = "01";
|
254
|
-
}
|
255
|
-
this.setInputValue(input);
|
256
|
-
this.setPreventInput(input, true);
|
257
|
-
this.notifyScreenReader(input, event);
|
258
|
-
this.moveToNextInput(input);
|
259
|
-
}
|
260
|
-
else {
|
261
|
-
this.setPreventInput(input, false);
|
262
|
-
}
|
263
|
-
}
|
264
|
-
else if (this.preventAutoFormatting) {
|
265
|
-
/**
|
266
|
-
* Using arrow keys prevents auto formatting so need to deal with
|
267
|
-
* switching from arrow keys to inputting numbers
|
268
|
-
**/
|
269
|
-
if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {
|
270
|
-
this.setInputValue(input);
|
271
|
-
this.setPreventInput(input, true);
|
272
|
-
this.moveToNextInput(input);
|
273
|
-
}
|
274
|
-
else {
|
275
|
-
this.setInputValue(input);
|
276
|
-
}
|
277
|
-
}
|
278
|
-
if (input.value.length !== 2) {
|
279
|
-
this.setPreventInput(input, false);
|
280
|
-
}
|
281
|
-
}
|
282
|
-
else {
|
283
|
-
if (input.value.length === 4) {
|
284
|
-
this.setInputValue(input);
|
285
|
-
if (Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING) {
|
286
|
-
this.moveToNextInput(input);
|
287
|
-
}
|
288
|
-
this.setPreventInput(input, true);
|
289
|
-
}
|
290
|
-
else {
|
291
|
-
this.setInputValue(input, true);
|
292
|
-
this.setPreventInput(input, false);
|
293
|
-
}
|
294
|
-
}
|
295
|
-
// Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year
|
296
|
-
this.setFitToValueStyling(input);
|
297
|
-
if (input.value.length === 0) {
|
298
|
-
this.setInputValue(input, true);
|
299
|
-
this.setValidationMessage();
|
300
|
-
}
|
301
|
-
this.notifyScreenReader(input, event);
|
302
|
-
};
|
303
|
-
this.handleKeyDown = (event, isInputPrevented) => {
|
304
|
-
const input = event.target;
|
305
|
-
const eventKey = event.key.toLowerCase();
|
306
|
-
// Regex required due to FF allowing all characters as values for number text field.
|
307
|
-
const regex = /-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;
|
308
|
-
if (!regex.test(eventKey) &&
|
309
|
-
!((event.ctrlKey || event.metaKey) &&
|
310
|
-
(eventKey === "v" || eventKey === "c"))) {
|
311
|
-
event.preventDefault();
|
312
|
-
}
|
313
|
-
switch (eventKey) {
|
314
|
-
case "/":
|
315
|
-
case "-":
|
316
|
-
case ".":
|
317
|
-
event.preventDefault();
|
318
|
-
this.setPasteInvalidText();
|
319
|
-
this.moveToNextInput(input);
|
320
|
-
break;
|
321
|
-
case "arrowright":
|
322
|
-
case "arrowleft":
|
323
|
-
event.preventDefault();
|
324
|
-
this.handleLeftRightArrowKeyPress(input, eventKey);
|
325
|
-
break;
|
326
|
-
case "arrowup":
|
327
|
-
case "arrowdown":
|
328
|
-
this.preventAutoFormatting = true;
|
329
|
-
this.handleUpDownArrowKeyPress(input, event);
|
330
|
-
break;
|
331
|
-
}
|
332
|
-
this.preventInput(event, isInputPrevented);
|
333
|
-
this.isDateSetFromKeyboardEvent = true;
|
334
|
-
};
|
335
|
-
this.handleFocus = (event) => {
|
336
|
-
// Highlight / select all characters in input for easy replacement
|
337
|
-
const input = event.target;
|
338
|
-
input.select();
|
339
|
-
};
|
340
|
-
this.handleBlur = (event) => {
|
341
|
-
const input = event.target;
|
342
|
-
this.setPasteInvalidText();
|
343
|
-
this.autocompleteInput(input);
|
344
|
-
};
|
345
|
-
this.handleLeftRightArrowKeyPress = (input, key) => {
|
346
|
-
if (key === "arrowright") {
|
347
|
-
this.moveToNextInput(input);
|
348
|
-
}
|
349
|
-
else {
|
350
|
-
this.moveToPreviousInput(input);
|
351
|
-
}
|
352
|
-
this.setPasteInvalidText();
|
353
|
-
};
|
354
|
-
this.notifyScreenReaderSelectedDate = () => {
|
355
|
-
const dayNames = stringEnumToArray(IcDayNames);
|
356
|
-
const months = stringEnumToArray(IcDateInputMonths);
|
357
|
-
this.selectedDateInfoEl.textContent = `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`;
|
358
|
-
};
|
359
|
-
this.handleUpDownArrowKeyPress = (input, event) => {
|
360
|
-
const minValue = input === this.yearInputEl ? 0 : 1;
|
361
|
-
let maxValue;
|
362
|
-
switch (input) {
|
363
|
-
case this.dayInputEl:
|
364
|
-
maxValue = this.MAX_DAY;
|
365
|
-
break;
|
366
|
-
case this.monthInputEl:
|
367
|
-
maxValue = this.MAX_MONTH;
|
368
|
-
break;
|
369
|
-
case this.yearInputEl:
|
370
|
-
maxValue = 9999;
|
371
|
-
}
|
372
|
-
// Make value loop round when min / max reached
|
373
|
-
if (input === null || input === void 0 ? void 0 : input.value) {
|
374
|
-
if (event.key === "ArrowUp") {
|
375
|
-
if (+input.value === maxValue) {
|
376
|
-
event.preventDefault();
|
377
|
-
input.value = `0${minValue}`;
|
378
|
-
}
|
379
|
-
else {
|
380
|
-
input.value =
|
381
|
-
+input.value + 1 < 10
|
382
|
-
? `0${+input.value + 1}`
|
383
|
-
: (+input.value + 1).toString();
|
384
|
-
}
|
385
|
-
this.notifyScreenReader(input, event);
|
386
|
-
}
|
387
|
-
if (event.key === "ArrowDown") {
|
388
|
-
if (+input.value === minValue) {
|
389
|
-
event.preventDefault();
|
390
|
-
input.value = maxValue.toString();
|
391
|
-
}
|
392
|
-
else {
|
393
|
-
input.value =
|
394
|
-
+input.value - 1 < 10
|
395
|
-
? `0${+input.value - 1}`
|
396
|
-
: (+input.value - 1).toString();
|
397
|
-
}
|
398
|
-
this.notifyScreenReader(input, event);
|
399
|
-
}
|
400
|
-
}
|
401
|
-
else {
|
402
|
-
if (event.key === "ArrowDown") {
|
403
|
-
event.preventDefault();
|
404
|
-
if (input === this.yearInputEl) {
|
405
|
-
input.value = new Date().getFullYear().toString();
|
406
|
-
}
|
407
|
-
else {
|
408
|
-
input.value = maxValue.toString();
|
409
|
-
}
|
410
|
-
this.notifyScreenReader(input, event);
|
411
|
-
}
|
412
|
-
else if (event.key === "ArrowUp") {
|
413
|
-
event.preventDefault();
|
414
|
-
if (input === this.yearInputEl) {
|
415
|
-
input.value = new Date().getFullYear().toString();
|
416
|
-
}
|
417
|
-
else {
|
418
|
-
input.value = `0${minValue}`;
|
419
|
-
}
|
420
|
-
this.notifyScreenReader(input, event);
|
421
|
-
}
|
422
|
-
}
|
423
|
-
this.setInputValue(input);
|
424
|
-
this.setFitToValueStyling(input);
|
425
|
-
};
|
426
|
-
this.handleDateChange = (force) => {
|
427
|
-
// Prevent icChange being emitted when each individual input is changed
|
428
|
-
// This method is used within componentWillUpdate instead of using @Watch('value');
|
429
|
-
if (force || !dateMatches(this.selectedDate, this.previousSelectedDate)) {
|
430
|
-
if (this.value) {
|
431
|
-
this.inputsInOrder.forEach((input) => {
|
432
|
-
input.classList.add(this.FIT_TO_VALUE);
|
433
|
-
});
|
434
|
-
}
|
435
|
-
if (this.day && this.month && this.year && this.invalidDateText === "") {
|
436
|
-
this.setValueAndEmitChange(this.selectedDate);
|
437
|
-
this.notifyScreenReaderSelectedDate();
|
438
|
-
}
|
439
|
-
else if (!(this.selectedDate === null && this.previousSelectedDate === null)) {
|
440
|
-
this.setValueAndEmitChange(null);
|
441
|
-
this.selectedDateInfoEl.textContent = "";
|
442
|
-
}
|
443
|
-
this.previousSelectedDate = this.selectedDate;
|
444
|
-
if (!this.isDateSetFromKeyboardEvent) {
|
445
|
-
this.updateInputValues(this.day, this.month, this.year);
|
446
|
-
}
|
447
|
-
}
|
448
|
-
};
|
449
|
-
this.slicePastedDate = (valueLength, datePart) => {
|
450
|
-
return datePart.length > valueLength
|
451
|
-
? datePart.slice(0, valueLength)
|
452
|
-
: datePart;
|
453
|
-
};
|
454
|
-
this.isPastedStringDateValid = (value) => {
|
455
|
-
if (/\d+-\d+-\d+$/.test(value) ||
|
456
|
-
/\d+\/\d+\/\d+/.test(value) ||
|
457
|
-
/\d+\.\d+\.\d+/.test(value)) {
|
458
|
-
return true;
|
459
|
-
}
|
460
|
-
if (/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(value)) {
|
461
|
-
this.isZuluTime = true;
|
462
|
-
return true;
|
463
|
-
}
|
464
|
-
return false;
|
465
|
-
};
|
466
|
-
// Set value of each input to value of pasted date part
|
467
|
-
// Allows formats separated by '-' or '/'
|
468
|
-
this.handlePaste = (event) => {
|
469
|
-
event.preventDefault();
|
470
|
-
const pastedValue = event.clipboardData.getData("Text");
|
471
|
-
const isValidDate = this.isPastedStringDateValid(pastedValue);
|
472
|
-
this.setPastedValueAndValidation(isValidDate, pastedValue, event);
|
473
|
-
};
|
474
|
-
this.setDate = (date) => {
|
475
|
-
if (date === null || date === "" || date === undefined) {
|
476
|
-
this.day = null;
|
477
|
-
this.month = null;
|
478
|
-
this.year = null;
|
479
|
-
this.inputsInOrder.forEach((input) => {
|
480
|
-
input.classList.remove(this.FIT_TO_VALUE);
|
481
|
-
this.setPreventInput(input, false);
|
482
|
-
});
|
483
|
-
this.handleDateChange(true);
|
484
|
-
}
|
485
|
-
else {
|
486
|
-
if (isDateOrEpoch(date)) {
|
487
|
-
let newDate;
|
488
|
-
if (typeof date === "string") {
|
489
|
-
// Checking if epoch date time
|
490
|
-
newDate = new Date(+date);
|
491
|
-
}
|
492
|
-
else {
|
493
|
-
newDate = date;
|
494
|
-
}
|
495
|
-
this.day = convertToDoubleDigits(newDate.getDate());
|
496
|
-
this.month = convertToDoubleDigits(newDate.getMonth() + 1);
|
497
|
-
this.year = newDate.getFullYear().toString();
|
498
|
-
}
|
499
|
-
else if (typeof date === "string") {
|
500
|
-
const defaultDateArray = splitStringDate(date, this.dateFormat);
|
501
|
-
this.year = defaultDateArray[0];
|
502
|
-
this.month = defaultDateArray[1];
|
503
|
-
this.day = defaultDateArray[2];
|
504
|
-
}
|
505
|
-
}
|
506
|
-
this.setValidationMessage();
|
507
|
-
};
|
508
|
-
this.formatMinMax = (date) => {
|
509
|
-
let formattedDate;
|
510
|
-
const day = convertToDoubleDigits(date.getDate());
|
511
|
-
const month = convertToDoubleDigits(date.getMonth() + 1);
|
512
|
-
const year = date.getFullYear();
|
513
|
-
switch (this.dateFormat) {
|
514
|
-
case "DD/MM/YYYY":
|
515
|
-
formattedDate = `${day}/${month}/${year}`;
|
516
|
-
break;
|
517
|
-
case "MM/DD/YYYY":
|
518
|
-
formattedDate = `${month}/${day}/${year}`;
|
519
|
-
break;
|
520
|
-
case "YYYY/MM/DD":
|
521
|
-
formattedDate = `${year}/${month}/${day}`;
|
522
|
-
break;
|
523
|
-
}
|
524
|
-
return formattedDate;
|
525
|
-
};
|
526
|
-
this.updateInputValues = (day, month, year) => {
|
527
|
-
this.dayInputEl.value = day;
|
528
|
-
this.monthInputEl.value = month;
|
529
|
-
this.yearInputEl.value = year;
|
530
|
-
};
|
531
|
-
// Set value in state based on input
|
532
|
-
this.setInputValue = (input, clear = false) => {
|
533
|
-
const newValue = clear ? "" : input.value;
|
534
|
-
switch (input) {
|
535
|
-
case this.dayInputEl:
|
536
|
-
this.day = newValue;
|
537
|
-
break;
|
538
|
-
case this.monthInputEl:
|
539
|
-
this.month = newValue;
|
540
|
-
break;
|
541
|
-
case this.yearInputEl:
|
542
|
-
if (this.year !== newValue) {
|
543
|
-
this.year = newValue;
|
544
|
-
}
|
545
|
-
}
|
546
|
-
this.setValidationMessage();
|
547
|
-
};
|
548
|
-
this.setValidationMessage = () => {
|
549
|
-
this.setDateValidity();
|
550
|
-
if (!isEmptyString(this.day) &&
|
551
|
-
!isEmptyString(this.month) &&
|
552
|
-
!isEmptyString(this.year)) {
|
553
|
-
// Check whether date actually exists
|
554
|
-
// (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)
|
555
|
-
this.selectedDate = this.convertToDate(this.year, this.month, this.day);
|
556
|
-
this.isValidDate =
|
557
|
-
+this.selectedDate !== 0 && this.selectedDate.getDate() == +this.day;
|
558
|
-
this.isDisabledDate = this.isSelectedDateDisabled();
|
559
|
-
if (!this.isValidDate || this.isDisabledDate) {
|
560
|
-
this.inputsInOrder.forEach((input) => input.setAttribute(this.ARIA_INVALID, "true"));
|
561
|
-
}
|
562
|
-
else {
|
563
|
-
this.inputsInOrder.forEach((input) => input.removeAttribute(this.ARIA_INVALID));
|
564
|
-
}
|
565
|
-
}
|
566
|
-
else {
|
567
|
-
this.selectedDate = null;
|
568
|
-
}
|
569
|
-
if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {
|
570
|
-
this.invalidDateText = "Please enter a valid date.";
|
571
|
-
}
|
572
|
-
else if (this.isDisabledDate && this.selectedDate !== null) {
|
573
|
-
if (this.isBeforeMin) {
|
574
|
-
if (this.disablePast) {
|
575
|
-
this.invalidDateText = this.disablePastMessage;
|
576
|
-
}
|
577
|
-
else {
|
578
|
-
this.invalidDateText = `Please enter a date after ${this.formatMinMax(this.minDate)}.`;
|
579
|
-
}
|
580
|
-
}
|
581
|
-
else if (this.isAfterMax) {
|
582
|
-
if (this.disableFuture) {
|
583
|
-
this.invalidDateText = this.disableFutureMessage;
|
584
|
-
}
|
585
|
-
else {
|
586
|
-
this.invalidDateText = `Please enter a date before ${this.formatMinMax(this.maxDate)}.`;
|
587
|
-
}
|
588
|
-
}
|
589
|
-
else if (this.disableDays.length !== 0) {
|
590
|
-
this.invalidDateText = this.disableDaysMessage;
|
591
|
-
}
|
592
|
-
else {
|
593
|
-
if (this.disablePast) {
|
594
|
-
this.invalidDateText = this.disablePastMessage;
|
595
|
-
}
|
596
|
-
if (this.disableFuture) {
|
597
|
-
this.invalidDateText = this.disableFutureMessage;
|
598
|
-
}
|
599
|
-
}
|
600
|
-
}
|
601
|
-
else {
|
602
|
-
this.invalidDateText = "";
|
603
|
-
}
|
604
|
-
};
|
605
|
-
// Set refs to the input elements in the order they are displayed (based on the dateFormat)
|
606
|
-
this.setInputsInOrder = () => {
|
607
|
-
const inputs = this.el.shadowRoot.querySelectorAll("input");
|
608
|
-
inputs.forEach((input) => this.inputsInOrder.push(input));
|
609
|
-
};
|
610
|
-
// Includes text usually added using aria-describedby
|
611
|
-
// (which doesn't work on input component container)
|
612
|
-
this.setAriaLabelledBy = () => {
|
613
|
-
var _a;
|
614
|
-
if (this.disabled &&
|
615
|
-
!isEmptyString((_a = this.inputCompContainerEl) === null || _a === void 0 ? void 0 : _a.getAttribute(this.ARIA_LABELLED_BY))) {
|
616
|
-
this.removeAriaLabelledBy();
|
617
|
-
return;
|
618
|
-
}
|
619
|
-
if (this.disabled) {
|
620
|
-
return;
|
621
|
-
}
|
622
|
-
const labelEl = this.el.shadowRoot.querySelector("label");
|
623
|
-
const labelId = `${this.inputId}-label`;
|
624
|
-
if (labelEl !== null && labelEl !== undefined) {
|
625
|
-
labelEl.id = labelId;
|
626
|
-
const hasValidation = (!isEmptyString(this.validationStatus) &&
|
627
|
-
!isEmptyString(this.validationText)) ||
|
628
|
-
!isEmptyString(this.invalidDateText);
|
629
|
-
const labelledBy = `${labelId} ${this.screenReaderInfoId} ${getInputDescribedByText(this.inputId, this.helperText !== "" && this.helperText !== this.defaultHelperText, hasValidation)} ${this.selectedDate ? this.selectedDateInfoId : ""} ${this.assistiveHintId}`;
|
630
|
-
this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);
|
631
|
-
}
|
632
|
-
};
|
633
|
-
// Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)
|
634
|
-
this.setPreventInput = (input, isPrevented) => {
|
635
|
-
switch (input) {
|
636
|
-
case this.dayInputEl:
|
637
|
-
this.preventDayInput = isPrevented;
|
638
|
-
break;
|
639
|
-
case this.monthInputEl:
|
640
|
-
this.preventMonthInput = isPrevented;
|
641
|
-
break;
|
642
|
-
case this.yearInputEl:
|
643
|
-
this.preventYearInput = isPrevented;
|
644
|
-
}
|
645
|
-
};
|
646
|
-
// Get input based on letter representing each date part ("D", "M" or "Y")
|
647
|
-
// (retrieved from dateFormat)
|
648
|
-
this.getInputFromDatePart = (datePart) => {
|
649
|
-
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) }));
|
650
|
-
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) }));
|
651
|
-
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) }));
|
652
|
-
let input;
|
653
|
-
switch (datePart) {
|
654
|
-
case "D":
|
655
|
-
input = dayInput;
|
656
|
-
break;
|
657
|
-
case "M":
|
658
|
-
input = monthInput;
|
659
|
-
break;
|
660
|
-
case "Y":
|
661
|
-
input = yearInput;
|
662
|
-
}
|
663
|
-
return input;
|
664
|
-
};
|
665
|
-
// Get input elements in order of chosen date format
|
666
|
-
this.getInputsInOrder = () => {
|
667
|
-
const dateParts = this.dateFormat.split("/");
|
668
|
-
const inputsInOrder = [];
|
669
|
-
dateParts.forEach((part) => {
|
670
|
-
inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));
|
671
|
-
});
|
672
|
-
return inputsInOrder;
|
673
|
-
};
|
674
|
-
// To add to the end of assistive hint to make it clearer that each date part has its own input
|
675
|
-
// that can be changed individually
|
676
|
-
this.getDescOfInputsOrder = () => {
|
677
|
-
let description;
|
678
|
-
switch (this.dateFormat) {
|
679
|
-
case "DD/MM/YYYY":
|
680
|
-
description = "day, month, and year";
|
681
|
-
break;
|
682
|
-
case "MM/DD/YYYY":
|
683
|
-
description = "month, day, and year";
|
684
|
-
break;
|
685
|
-
case "YYYY/MM/DD":
|
686
|
-
description = "year, month, and day";
|
687
|
-
}
|
688
|
-
return description;
|
689
|
-
};
|
690
|
-
// Add 'required' or 'invalid data' to span used in aria-labelledby
|
691
|
-
// Many ARIA attributes aren't read out by screen reader when on the input component container
|
692
|
-
this.getScreenReaderInfo = (validationStatus) => {
|
693
|
-
let inputDescriptors = "";
|
694
|
-
if (this.required) {
|
695
|
-
inputDescriptors += "required";
|
696
|
-
}
|
697
|
-
if (validationStatus === IcInformationStatus.Error) {
|
698
|
-
inputDescriptors += " invalid data";
|
699
|
-
}
|
700
|
-
return inputDescriptors === "" ? "" : inputDescriptors + ", ";
|
701
|
-
};
|
702
|
-
// Prevent non-number characters being entered
|
703
|
-
// ('e' or '.' - which are usually allowed in <input type="number">)
|
704
|
-
// And limit the number of characters within each field (2 for day / month, 4 for year)
|
705
|
-
// (because 'maxlength' doesn't work on <input type="number">)
|
706
|
-
this.preventInput = (event, isInputPrevented) => {
|
707
|
-
const key = event.key;
|
708
|
-
const input = event.target;
|
709
|
-
let selectedString;
|
710
|
-
if (input) {
|
711
|
-
selectedString = input.value.substring(input.selectionStart, input.selectionEnd);
|
712
|
-
}
|
713
|
-
if (key === "e" ||
|
714
|
-
key === "." ||
|
715
|
-
key === "-" ||
|
716
|
-
(event.key >= "0" &&
|
717
|
-
event.key <= "9" &&
|
718
|
-
isInputPrevented &&
|
719
|
-
!selectedString)) {
|
720
|
-
event.preventDefault();
|
721
|
-
}
|
722
|
-
};
|
723
|
-
// Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day
|
724
|
-
// Consider using dateClamp and inDateRange
|
725
|
-
this.isSelectedDateDisabled = () => {
|
726
|
-
const currentDate = new Date();
|
727
|
-
this.isAfterMax = false;
|
728
|
-
this.isBeforeMin = false;
|
729
|
-
let disabled = false;
|
730
|
-
const isNotToday = this.selectedDate.toDateString() !== currentDate.toDateString();
|
731
|
-
if (this.minDate && this.selectedDate < this.minDate && isNotToday) {
|
732
|
-
this.isBeforeMin = true;
|
733
|
-
disabled = true;
|
734
|
-
}
|
735
|
-
if (this.maxDate && this.selectedDate > this.maxDate && isNotToday) {
|
736
|
-
this.isAfterMax = true;
|
737
|
-
disabled = true;
|
738
|
-
}
|
739
|
-
if (this.disableDays.includes(this.selectedDate.getDay())) {
|
740
|
-
disabled = true;
|
741
|
-
}
|
742
|
-
if (((this.disablePast && this.selectedDate < currentDate) ||
|
743
|
-
(this.disableFuture && this.selectedDate > currentDate)) &&
|
744
|
-
isNotToday) {
|
745
|
-
disabled = true;
|
746
|
-
}
|
747
|
-
return disabled;
|
748
|
-
};
|
749
|
-
this.moveToNextInput = (currentInput) => {
|
750
|
-
const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
|
751
|
-
const nextInput = this.inputsInOrder[currentInputPos + 1];
|
752
|
-
this.preventAutoFormatting = false;
|
753
|
-
if (nextInput) {
|
754
|
-
nextInput.focus();
|
755
|
-
}
|
756
|
-
};
|
757
|
-
this.moveToPreviousInput = (currentInput) => {
|
758
|
-
const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
|
759
|
-
this.preventAutoFormatting = false;
|
760
|
-
if (this.inputsInOrder[currentInputPos - 1]) {
|
761
|
-
this.inputsInOrder[currentInputPos - 1].focus();
|
762
|
-
}
|
763
|
-
};
|
764
|
-
this.autocompleteInput = (input) => {
|
765
|
-
if (input === this.yearInputEl) {
|
766
|
-
this.autocompleteYear();
|
767
|
-
}
|
768
|
-
else {
|
769
|
-
const inputValue = input.value;
|
770
|
-
// Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)
|
771
|
-
if (inputValue.length === 1) {
|
772
|
-
if (+inputValue === 0) {
|
773
|
-
input.value = "01";
|
774
|
-
}
|
775
|
-
else {
|
776
|
-
input.value = `0${inputValue}`;
|
777
|
-
}
|
778
|
-
}
|
779
|
-
}
|
780
|
-
if (input.value) {
|
781
|
-
this.setInputValue(input);
|
782
|
-
}
|
783
|
-
};
|
784
|
-
// Autocomplete year as current millennium when fewer than 4 characters entered
|
785
|
-
this.autocompleteYear = () => {
|
786
|
-
const inputValue = this.yearInputEl.value;
|
787
|
-
const yearNumbers = ["2", "0", "0"];
|
788
|
-
let autocompletedInput = "";
|
789
|
-
if (inputValue) {
|
790
|
-
yearNumbers.forEach((number, index) => {
|
791
|
-
if (inputValue.length + index <= 3) {
|
792
|
-
autocompletedInput += number;
|
793
|
-
}
|
794
|
-
});
|
795
|
-
this.yearInputEl.value = `${autocompletedInput}${inputValue}`;
|
796
|
-
}
|
797
|
-
};
|
798
|
-
this.convertToDate = (year, month, day) => {
|
799
|
-
if (!isEmptyString(year) && !isEmptyString(month) && !isEmptyString(day)) {
|
800
|
-
return new Date(+year, +month - 1, +day);
|
801
|
-
}
|
802
|
-
else {
|
803
|
-
return null;
|
804
|
-
}
|
805
|
-
};
|
806
|
-
this.handleHostBlur = () => {
|
807
|
-
this.removeLabelledBy = false;
|
808
|
-
this.icBlur.emit({ value: this.selectedDate });
|
809
|
-
};
|
810
|
-
this.handleHostFocus = () => {
|
811
|
-
if (this.el.shadowRoot.activeElement.id.match(/(day|month|year)-input$/)) {
|
812
|
-
this.removeLabelledBy = false;
|
813
|
-
}
|
814
|
-
else {
|
815
|
-
this.removeLabelledBy = true;
|
816
|
-
}
|
817
|
-
this.icFocus.emit({ value: this.selectedDate });
|
818
|
-
};
|
819
|
-
this.handleFormReset = () => {
|
820
|
-
// Get the initial value and populate day, month and year again.
|
821
|
-
this.setDate(this.initialValue);
|
822
|
-
this.setValidationMessage();
|
823
|
-
this.handleDateChange(false);
|
824
|
-
};
|
825
|
-
this.getAriaLabel = (input) => {
|
826
|
-
return input.getAttribute(this.ARIA_LABEL);
|
827
|
-
};
|
828
|
-
this.notifyScreenReaderArrowKeys = (input) => {
|
829
|
-
const liveRegion = this.el.shadowRoot.querySelector("#live-region");
|
830
|
-
let announcement = "";
|
831
|
-
const ariaLabel = this.getAriaLabel(input);
|
832
|
-
if (liveRegion && input.value) {
|
833
|
-
if (input === this.monthInputEl &&
|
834
|
-
!!IcDateInputMonths[+input.value - 1]) {
|
835
|
-
announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
|
836
|
-
}
|
837
|
-
if (input === this.dayInputEl || input === this.yearInputEl) {
|
838
|
-
announcement = `${input.value}, ${ariaLabel}`;
|
839
|
-
}
|
840
|
-
liveRegion.textContent = announcement;
|
841
|
-
}
|
842
|
-
};
|
843
|
-
this.notifyScreenReaderInput = (input, liveRegion) => {
|
844
|
-
let announcement = "";
|
845
|
-
const ariaLabel = this.getAriaLabel(input);
|
846
|
-
if (input === this.dayInputEl || input === this.monthInputEl) {
|
847
|
-
if (input.value.length === 2) {
|
848
|
-
if (input === this.monthInputEl &&
|
849
|
-
!!IcDateInputMonths[+input.value - 1] &&
|
850
|
-
this.isValidMonth) {
|
851
|
-
announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
|
852
|
-
}
|
853
|
-
if (input === this.dayInputEl && this.isValidDay) {
|
854
|
-
announcement = `${input.value}, ${ariaLabel}`;
|
855
|
-
}
|
856
|
-
}
|
857
|
-
else {
|
858
|
-
announcement = "";
|
859
|
-
}
|
860
|
-
}
|
861
|
-
else {
|
862
|
-
if (input.value.length === 4) {
|
863
|
-
announcement = `${input.value}, ${ariaLabel}`;
|
864
|
-
}
|
865
|
-
else {
|
866
|
-
announcement = "";
|
867
|
-
}
|
868
|
-
}
|
869
|
-
liveRegion.textContent = announcement;
|
870
|
-
};
|
871
|
-
this.setFitToValueStyling = (input) => {
|
872
|
-
if (input.value) {
|
873
|
-
input.classList.add(this.FIT_TO_VALUE);
|
874
|
-
}
|
875
|
-
else {
|
876
|
-
input.classList.remove(this.FIT_TO_VALUE);
|
877
|
-
}
|
878
|
-
};
|
879
|
-
this.setAriaInvalid = (validDay, validMonth, validDate, disabledDate) => {
|
880
|
-
if (this.inputsInOrder.length) {
|
881
|
-
this.inputsInOrder.forEach((input) => {
|
882
|
-
input.removeAttribute(this.ARIA_INVALID);
|
883
|
-
});
|
884
|
-
if (!validDay) {
|
885
|
-
this.dayInputEl.setAttribute(this.ARIA_INVALID, "true");
|
886
|
-
}
|
887
|
-
if (!validMonth) {
|
888
|
-
this.monthInputEl.setAttribute(this.ARIA_INVALID, "true");
|
889
|
-
}
|
890
|
-
if (!validDate || disabledDate) {
|
891
|
-
this.inputsInOrder.forEach((input) => {
|
892
|
-
input.setAttribute(this.ARIA_INVALID, "true");
|
893
|
-
});
|
894
|
-
}
|
895
|
-
}
|
896
|
-
};
|
897
|
-
this.handleClear = () => {
|
898
|
-
this.inputsInOrder.forEach((input) => {
|
899
|
-
input.classList.remove(this.FIT_TO_VALUE);
|
900
|
-
this.setInputValue(input, true);
|
901
|
-
this.setPreventInput(input, false);
|
902
|
-
});
|
903
|
-
this.isDateSetFromKeyboardEvent = false;
|
904
|
-
this.setValidationMessage();
|
905
|
-
this.handleDateChange(true);
|
906
|
-
this.inputsInOrder[0].focus();
|
907
|
-
};
|
908
|
-
this.handleCalendarOpen = (ev) => {
|
909
|
-
ev.stopImmediatePropagation();
|
910
|
-
this.calendarButtonEl.shadowRoot
|
911
|
-
.querySelector("ic-tooltip")
|
912
|
-
.displayTooltip(false);
|
913
|
-
this.calendarButtonClicked.emit({ value: this.selectedDate });
|
914
|
-
this.calendarButtonEl.shadowRoot
|
915
|
-
.querySelector("ic-tooltip")
|
916
|
-
.displayTooltip(false);
|
917
|
-
this.isDateSetFromKeyboardEvent = false;
|
918
|
-
};
|
919
|
-
this.setValueAndEmitChange = (value) => {
|
920
|
-
if (!dateMatches(new Date(this.value), value)) {
|
921
|
-
this.icChange.emit({ value: value });
|
922
|
-
this.value = value;
|
923
|
-
}
|
924
|
-
};
|
925
|
-
this.handleCalendarFocus = () => {
|
926
|
-
this.calendarFocused = true;
|
927
|
-
};
|
928
|
-
this.handleCalendarBlur = () => {
|
929
|
-
this.calendarFocused = false;
|
930
|
-
};
|
931
|
-
this.handleClearFocus = () => {
|
932
|
-
this.removeLabelledBy = true;
|
933
|
-
this.clearButtonFocused = true;
|
934
|
-
};
|
935
|
-
this.handleClearBlur = (ev) => {
|
936
|
-
var _a;
|
937
|
-
this.clearButtonFocused = false;
|
938
|
-
if ((_a = ev.relatedTarget) === null || _a === void 0 ? void 0 : _a.id.match(/(day|year)-input$/)) {
|
939
|
-
this.removeLabelledBy = false;
|
940
|
-
return;
|
941
|
-
}
|
942
|
-
this.removeLabelledBy = true;
|
943
|
-
};
|
944
|
-
this.day = "";
|
945
|
-
this.invalidDateText = undefined;
|
946
|
-
this.maxDate = undefined;
|
947
|
-
this.minDate = undefined;
|
948
|
-
this.month = "";
|
949
|
-
this.year = "";
|
950
|
-
this.calendarFocused = false;
|
951
|
-
this.clearButtonFocused = false;
|
952
|
-
this.removeLabelledBy = false;
|
953
|
-
this.dateFormat = "DD/MM/YYYY";
|
954
|
-
this.disabled = false;
|
955
|
-
this.disableDays = [];
|
956
|
-
this.disableDaysMessage = "The date you have selected is on a day of the week that is not allowed. Please select another date.";
|
957
|
-
this.disableFuture = false;
|
958
|
-
this.disableFutureMessage = "Dates in the future are not allowed. Please select a date in the past.";
|
959
|
-
this.disablePast = false;
|
960
|
-
this.disablePastMessage = "Dates in the past are not allowed. Please select a date in the future.";
|
961
|
-
this.helperText = undefined;
|
962
|
-
this.inputId = `ic-date-input-${inputIds++}`;
|
963
|
-
this.label = undefined;
|
964
|
-
this.max = "";
|
965
|
-
this.min = "";
|
966
|
-
this.name = this.inputId;
|
967
|
-
this.required = false;
|
968
|
-
this.showCalendarButton = false;
|
969
|
-
this.showClearButton = true;
|
970
|
-
this.size = "default";
|
971
|
-
this.value = "";
|
972
|
-
this.validationStatus = "";
|
973
|
-
this.validationText = "";
|
974
|
-
}
|
975
|
-
watchMaxHandler() {
|
976
|
-
if (this.disableFuture) {
|
977
|
-
this.maxDate = new Date();
|
978
|
-
}
|
979
|
-
else {
|
980
|
-
this.maxDate = createDate(this.max, this.dateFormat);
|
981
|
-
}
|
982
|
-
}
|
983
|
-
watchMinHandler() {
|
984
|
-
if (this.disablePast) {
|
985
|
-
this.minDate = new Date();
|
986
|
-
}
|
987
|
-
else {
|
988
|
-
this.minDate = createDate(this.min, this.dateFormat);
|
989
|
-
}
|
990
|
-
}
|
991
|
-
disconnectedCallback() {
|
992
|
-
removeFormResetListener(this.el, this.handleFormReset);
|
993
|
-
}
|
994
|
-
componentWillLoad() {
|
995
|
-
this.defaultHelperText = `Use format ${this.dateFormat}`;
|
996
|
-
if (isEmptyString(this.helperText)) {
|
997
|
-
this.helperText = this.defaultHelperText;
|
998
|
-
}
|
999
|
-
this.watchMinHandler();
|
1000
|
-
this.watchMaxHandler();
|
1001
|
-
if (this.value) {
|
1002
|
-
this.setDate(this.value);
|
1003
|
-
}
|
1004
|
-
this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;
|
1005
|
-
this.assistiveHintId = `${this.inputId}-assistive-hint`;
|
1006
|
-
this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
|
1007
|
-
addFormResetListener(this.el, this.handleFormReset);
|
1008
|
-
}
|
1009
|
-
componentDidLoad() {
|
1010
|
-
this.setInputsInOrder();
|
1011
|
-
onComponentRequiredPropUndefined([{ prop: this.label, propName: "label" }], "Date Input");
|
1012
|
-
if (this.value) {
|
1013
|
-
this.updateInputValues(this.day, this.month, this.year);
|
1014
|
-
this.inputsInOrder.forEach((input) => {
|
1015
|
-
input.classList.add(this.FIT_TO_VALUE);
|
1016
|
-
});
|
1017
|
-
}
|
1018
|
-
this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
|
1019
|
-
if (this.value) {
|
1020
|
-
this.notifyScreenReaderSelectedDate();
|
1021
|
-
}
|
1022
|
-
this.inputsInOrder.forEach((input) => {
|
1023
|
-
input.addEventListener("input", this.handleInput);
|
1024
|
-
input.addEventListener("focus", this.handleFocus);
|
1025
|
-
input.addEventListener("blur", this.handleBlur);
|
1026
|
-
});
|
1027
|
-
// Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)
|
1028
|
-
// Needed because label is included in 'aria-labelledby' instead of using 'aria-label'
|
1029
|
-
const labelEl = this.el.shadowRoot.querySelector("label");
|
1030
|
-
if (this.required) {
|
1031
|
-
const asteriskSpan = document.createElement("span");
|
1032
|
-
asteriskSpan.setAttribute("aria-hidden", "true");
|
1033
|
-
asteriskSpan.textContent = " *";
|
1034
|
-
labelEl === null || labelEl === void 0 ? void 0 : labelEl.appendChild(asteriskSpan);
|
1035
|
-
}
|
1036
|
-
}
|
1037
|
-
componentWillUpdate() {
|
1038
|
-
if (!this.isDateSetFromKeyboardEvent) {
|
1039
|
-
this.setDate(this.value);
|
1040
|
-
}
|
1041
|
-
this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
|
1042
|
-
this.handleDateChange(false);
|
1043
|
-
this.isDateSetFromKeyboardEvent = false;
|
1044
|
-
}
|
1045
|
-
componentDidRender() {
|
1046
|
-
if (this.removeLabelledBy) {
|
1047
|
-
this.removeAriaLabelledBy();
|
1048
|
-
return;
|
1049
|
-
}
|
1050
|
-
this.setAriaLabelledBy();
|
1051
|
-
}
|
1052
|
-
/**
|
1053
|
-
* Returns the value as a Date object
|
1054
|
-
* @returns Date
|
1055
|
-
*/
|
1056
|
-
async getDate() {
|
1057
|
-
return this.selectedDate;
|
1058
|
-
}
|
1059
|
-
/**
|
1060
|
-
* @internal Sets focus on the calendar button.
|
1061
|
-
*/
|
1062
|
-
async setCalendarFocus() {
|
1063
|
-
if (this.calendarButtonEl) {
|
1064
|
-
this.calendarButtonEl.focus();
|
1065
|
-
}
|
1066
|
-
}
|
1067
|
-
/**
|
1068
|
-
* @internal Used to pass disabledDays from parent component.
|
1069
|
-
*/
|
1070
|
-
async setDisableDays(days) {
|
1071
|
-
this.disableDays = days;
|
1072
|
-
}
|
1073
|
-
removeAriaLabelledBy() {
|
1074
|
-
this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);
|
1075
|
-
}
|
1076
|
-
setPastedValueAndValidation(isValidDate, pastedValue, event) {
|
1077
|
-
switch (true) {
|
1078
|
-
case isValidDate: {
|
1079
|
-
const nextParsedValue = this.isZuluTime
|
1080
|
-
? extractDateFromZuluDateTime(pastedValue)
|
1081
|
-
: pastedValue;
|
1082
|
-
const dateParts = nextParsedValue.split(/-|\/|\./);
|
1083
|
-
this.inputsInOrder.forEach((input, index) => {
|
1084
|
-
input.classList.add(this.FIT_TO_VALUE);
|
1085
|
-
if (this.isZuluTime) {
|
1086
|
-
this.pasteZuluDateTime(dateParts, index);
|
1087
|
-
}
|
1088
|
-
else {
|
1089
|
-
let dateValue;
|
1090
|
-
if (input === this.dayInputEl || input === this.monthInputEl) {
|
1091
|
-
dateValue = this.slicePastedDate(2, dateParts[index]);
|
1092
|
-
}
|
1093
|
-
else {
|
1094
|
-
dateValue = this.slicePastedDate(4, dateParts[index]);
|
1095
|
-
}
|
1096
|
-
input.value = dateValue;
|
1097
|
-
this.setInputValue(input);
|
1098
|
-
this.autocompleteInput(input);
|
1099
|
-
}
|
1100
|
-
});
|
1101
|
-
this.isZuluTime = false;
|
1102
|
-
break;
|
1103
|
-
}
|
1104
|
-
case (pastedValue.length === 1 ||
|
1105
|
-
pastedValue.length === 2 ||
|
1106
|
-
pastedValue.length === 4) &&
|
1107
|
-
isNumeric(pastedValue):
|
1108
|
-
if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {
|
1109
|
-
// Check if copied value can be pasted into input
|
1110
|
-
this.setInputPasteValue(event.target, pastedValue);
|
1111
|
-
this.setInputValue(event.target);
|
1112
|
-
}
|
1113
|
-
else {
|
1114
|
-
this.displayPastedValidation(event);
|
1115
|
-
}
|
1116
|
-
break;
|
1117
|
-
case pastedValue.length === 3 && isNumeric(pastedValue):
|
1118
|
-
if (event.target !== this.yearInputEl) {
|
1119
|
-
this.displayPastedValidation(event);
|
1120
|
-
}
|
1121
|
-
else {
|
1122
|
-
this.setInputPasteValue(event.target, pastedValue);
|
1123
|
-
this.setInputValue(event.target);
|
1124
|
-
}
|
1125
|
-
break;
|
1126
|
-
case pastedValue.length >= 5 && isNumeric(pastedValue):
|
1127
|
-
this.displayPastedValidation(event);
|
1128
|
-
}
|
1129
|
-
}
|
1130
|
-
pasteZuluDateTime(dateParts, index) {
|
1131
|
-
// ['YYYY', 'MM', 'DD']
|
1132
|
-
if (index === 0) {
|
1133
|
-
const dateValue = this.slicePastedDate(4, dateParts[index]);
|
1134
|
-
this.yearInputEl.value = dateValue;
|
1135
|
-
this.setInputValue(this.yearInputEl);
|
1136
|
-
}
|
1137
|
-
else if (index === 1) {
|
1138
|
-
// The month value is the second item in the array
|
1139
|
-
const dateValue = this.slicePastedDate(2, dateParts[index]);
|
1140
|
-
this.monthInputEl.value = dateValue;
|
1141
|
-
this.setInputValue(this.monthInputEl);
|
1142
|
-
}
|
1143
|
-
else {
|
1144
|
-
const dateValue = this.slicePastedDate(2, dateParts[index]);
|
1145
|
-
this.dayInputEl.value = dateValue;
|
1146
|
-
this.setInputValue(this.dayInputEl);
|
1147
|
-
}
|
1148
|
-
}
|
1149
|
-
displayPastedValidation(event) {
|
1150
|
-
var _a;
|
1151
|
-
if (((_a = this.invalidDateText) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
1152
|
-
this.previousInvalidDateTest = this.invalidDateText;
|
1153
|
-
}
|
1154
|
-
this.invalidDateText = `Please paste a valid ${this.getAriaLabel(event.target)}`;
|
1155
|
-
this.validationStatus = IcInformationStatus.Error;
|
1156
|
-
this.isPasteValidationDisplayed = true;
|
1157
|
-
}
|
1158
|
-
setPasteInvalidText() {
|
1159
|
-
var _a;
|
1160
|
-
if (this.isPasteValidationDisplayed) {
|
1161
|
-
this.invalidDateText = (_a = this.previousInvalidDateTest) !== null && _a !== void 0 ? _a : "";
|
1162
|
-
this.isPasteValidationDisplayed = false;
|
1163
|
-
// This is to prevent setDate from triggering within componentWillUpdate
|
1164
|
-
this.isDateSetFromKeyboardEvent = true;
|
1165
|
-
}
|
1166
|
-
}
|
1167
|
-
notifyScreenReader(input, event) {
|
1168
|
-
const liveRegion = this.el.shadowRoot.querySelector("#live-region");
|
1169
|
-
if (liveRegion) {
|
1170
|
-
if (this.isKeyboardOrEvent(event)) {
|
1171
|
-
this.notifyScreenReaderArrowKeys(input);
|
1172
|
-
}
|
1173
|
-
else if (Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING) {
|
1174
|
-
this.notifyScreenReaderInput(input, liveRegion);
|
1175
|
-
}
|
1176
|
-
}
|
1177
|
-
}
|
1178
|
-
render() {
|
1179
|
-
const { inputId, label, disabled, helperText, showClearButton, showCalendarButton, size, } = this;
|
1180
|
-
const hasCustomValidation = !isEmptyString(this.validationStatus) &&
|
1181
|
-
!isEmptyString(this.validationText);
|
1182
|
-
const validationStatus = hasCustomValidation
|
1183
|
-
? this.validationStatus
|
1184
|
-
: !isEmptyString(this.invalidDateText)
|
1185
|
-
? IcInformationStatus.Error
|
1186
|
-
: "";
|
1187
|
-
const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;
|
1188
|
-
renderHiddenInput(true, this.el, this.name, this.convertToDate(this.year, this.month, this.day), this.disabled);
|
1189
|
-
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: {
|
1190
|
-
["clear-button"]: true,
|
1191
|
-
["hidden"]: isEmptyString(this.day) &&
|
1192
|
-
isEmptyString(this.month) &&
|
1193
|
-
isEmptyString(this.year),
|
1194
|
-
}, disabled: this.disabled, innerHTML: Clear, onClick: this.handleClear, onFocus: this.handleClearFocus, onBlur: this.handleClearBlur, variant: "icon", appearance: this.clearButtonFocused
|
1195
|
-
? IcThemeForegroundEnum.Light
|
1196
|
-
: 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
|
1197
|
-
? IcThemeForegroundEnum.Light
|
1198
|
-
: 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 })))));
|
1199
|
-
}
|
1200
|
-
static get delegatesFocus() { return true; }
|
1201
|
-
get el() { return this; }
|
1202
|
-
static get watchers() { return {
|
1203
|
-
"max": ["watchMaxHandler"],
|
1204
|
-
"min": ["watchMinHandler"]
|
1205
|
-
}; }
|
1206
|
-
static get style() { return icDateInputCss; }
|
1207
|
-
}, [17, "ic-date-input", {
|
1208
|
-
"dateFormat": [1, "date-format"],
|
1209
|
-
"disabled": [4],
|
1210
|
-
"disableDays": [1040],
|
1211
|
-
"disableDaysMessage": [1, "disable-days-message"],
|
1212
|
-
"disableFuture": [4, "disable-future"],
|
1213
|
-
"disableFutureMessage": [1, "disable-future-message"],
|
1214
|
-
"disablePast": [4, "disable-past"],
|
1215
|
-
"disablePastMessage": [1, "disable-past-message"],
|
1216
|
-
"helperText": [1025, "helper-text"],
|
1217
|
-
"inputId": [1, "input-id"],
|
1218
|
-
"label": [1],
|
1219
|
-
"max": [1],
|
1220
|
-
"min": [1],
|
1221
|
-
"name": [1],
|
1222
|
-
"required": [4],
|
1223
|
-
"showCalendarButton": [4, "show-calendar-button"],
|
1224
|
-
"showClearButton": [4, "show-clear-button"],
|
1225
|
-
"size": [1],
|
1226
|
-
"value": [1025],
|
1227
|
-
"validationStatus": [1025, "validation-status"],
|
1228
|
-
"validationText": [1, "validation-text"],
|
1229
|
-
"day": [32],
|
1230
|
-
"invalidDateText": [32],
|
1231
|
-
"maxDate": [32],
|
1232
|
-
"minDate": [32],
|
1233
|
-
"month": [32],
|
1234
|
-
"year": [32],
|
1235
|
-
"calendarFocused": [32],
|
1236
|
-
"clearButtonFocused": [32],
|
1237
|
-
"removeLabelledBy": [32],
|
1238
|
-
"getDate": [64],
|
1239
|
-
"setCalendarFocus": [64],
|
1240
|
-
"setDisableDays": [64]
|
1241
|
-
}, undefined, {
|
1242
|
-
"max": ["watchMaxHandler"],
|
1243
|
-
"min": ["watchMinHandler"]
|
1244
|
-
}]);
|
1245
|
-
function defineCustomElement() {
|
1246
|
-
if (typeof customElements === "undefined") {
|
1247
|
-
return;
|
1248
|
-
}
|
1249
|
-
const components = ["ic-date-input", "ic-button", "ic-input-component-container", "ic-input-container", "ic-input-label", "ic-input-validation", "ic-loading-indicator", "ic-tooltip", "ic-typography"];
|
1250
|
-
components.forEach(tagName => { switch (tagName) {
|
1251
|
-
case "ic-date-input":
|
1252
|
-
if (!customElements.get(tagName)) {
|
1253
|
-
customElements.define(tagName, DateInput);
|
1254
|
-
}
|
1255
|
-
break;
|
1256
|
-
case "ic-button":
|
1257
|
-
if (!customElements.get(tagName)) {
|
1258
|
-
defineCustomElement$8();
|
1259
|
-
}
|
1260
|
-
break;
|
1261
|
-
case "ic-input-component-container":
|
1262
|
-
if (!customElements.get(tagName)) {
|
1263
|
-
defineCustomElement$7();
|
1264
|
-
}
|
1265
|
-
break;
|
1266
|
-
case "ic-input-container":
|
1267
|
-
if (!customElements.get(tagName)) {
|
1268
|
-
defineCustomElement$6();
|
1269
|
-
}
|
1270
|
-
break;
|
1271
|
-
case "ic-input-label":
|
1272
|
-
if (!customElements.get(tagName)) {
|
1273
|
-
defineCustomElement$5();
|
1274
|
-
}
|
1275
|
-
break;
|
1276
|
-
case "ic-input-validation":
|
1277
|
-
if (!customElements.get(tagName)) {
|
1278
|
-
defineCustomElement$4();
|
1279
|
-
}
|
1280
|
-
break;
|
1281
|
-
case "ic-loading-indicator":
|
1282
|
-
if (!customElements.get(tagName)) {
|
1283
|
-
defineCustomElement$3();
|
1284
|
-
}
|
1285
|
-
break;
|
1286
|
-
case "ic-tooltip":
|
1287
|
-
if (!customElements.get(tagName)) {
|
1288
|
-
defineCustomElement$2();
|
1289
|
-
}
|
1290
|
-
break;
|
1291
|
-
case "ic-typography":
|
1292
|
-
if (!customElements.get(tagName)) {
|
1293
|
-
defineCustomElement$1();
|
1294
|
-
}
|
1295
|
-
break;
|
1296
|
-
} });
|
1297
|
-
}
|
1298
|
-
|
1299
|
-
export { DateInput as D, dateInRange as a, getMonthStart as b, dateMatches as c, defineCustomElement as d, getWeekStart as e, getWeekEnd as f, getMonthEnd as g, clampDate as h, createDate as i, yearInRange as y };
|
1300
|
-
|
1301
|
-
//# sourceMappingURL=ic-date-input2.js.map
|