@duetds/components 6.0.2 → 6.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hydrate/index.js +51 -41
- package/lib/cjs/duet-action-button.cjs.entry.js +3 -3
- package/lib/cjs/duet-alert.cjs.entry.js +1 -1
- package/lib/cjs/duet-badge.cjs.entry.js +1 -1
- package/lib/cjs/duet-breadcrumb.cjs.entry.js +1 -1
- package/lib/cjs/duet-breadcrumbs.cjs.entry.js +1 -1
- package/lib/cjs/duet-button_2.cjs.entry.js +3 -3
- package/lib/cjs/duet-caption_4.cjs.entry.js +3 -3
- package/lib/cjs/duet-card.cjs.entry.js +6 -5
- package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
- package/lib/cjs/duet-choice_2.cjs.entry.js +4 -4
- package/lib/cjs/duet-collapsible.cjs.entry.js +2 -2
- package/lib/cjs/duet-combobox.cjs.entry.js +1 -1
- package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
- package/lib/cjs/duet-date-picker.cjs.entry.js +2 -2
- package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-editable-table_3.cjs.entry.js +17 -14
- package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
- package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
- package/lib/cjs/duet-footer.cjs.entry.js +1 -1
- package/lib/cjs/duet-grid_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-header_2.cjs.entry.js +3 -3
- package/lib/cjs/duet-hero.cjs.entry.js +1 -1
- package/lib/cjs/duet-icon.cjs.entry.js +3 -3
- package/lib/cjs/duet-input_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-layout.cjs.entry.js +1 -1
- package/lib/cjs/duet-list_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-modal.cjs.entry.js +2 -2
- package/lib/cjs/duet-notification_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-number-input.cjs.entry.js +1 -1
- package/lib/cjs/duet-pagination_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-progress.cjs.entry.js +1 -1
- package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-range-slider.cjs.entry.js +2 -2
- package/lib/cjs/duet-scrollable_3.cjs.entry.js +1 -1
- package/lib/cjs/duet-select.cjs.entry.js +1 -1
- package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
- package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
- package/lib/cjs/duet-tooltip.cjs.entry.js +1 -1
- package/lib/cjs/duet-tray.cjs.entry.js +2 -2
- package/lib/cjs/duet-upload-aria-status.cjs.entry.js +1 -1
- package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +1 -1
- package/lib/cjs/{focus-utils-8089a1a8.js → focus-utils-8a615003.js} +1 -1
- package/lib/cjs/{index-9d0e33db.js → index-d106d801.js} +1 -1
- package/lib/cjs/loader.cjs.js +1 -1
- package/lib/cjs/{token-utils-fef5b4eb.js → token-utils-f6e2f4ef.js} +1 -1
- package/lib/cjs/{tokens-29450bcb.js → tokens-4c69b122.js} +18 -15
- package/lib/cjs/{tokens.module-ef598645.js → tokens.module-1bb2d45e.js} +12 -10
- package/lib/collection/components/duet-card/duet-card.js +4 -2
- package/lib/collection/components/duet-choice/duet-choice.js +1 -1
- package/lib/collection/components/duet-choice-group/duet-choice-group.js +1 -1
- package/lib/collection/components/duet-upload/duet-upload.js +18 -15
- package/lib/dist-custom-elements/duet-action-button.d.ts +11 -0
- package/lib/dist-custom-elements/duet-action-button.js +9 -0
- package/lib/dist-custom-elements/duet-alert.d.ts +11 -0
- package/lib/dist-custom-elements/duet-alert.js +9 -0
- package/lib/dist-custom-elements/duet-badge.d.ts +11 -0
- package/lib/dist-custom-elements/duet-badge.js +9 -0
- package/lib/dist-custom-elements/duet-breadcrumb.d.ts +11 -0
- package/lib/dist-custom-elements/duet-breadcrumb.js +73 -0
- package/lib/dist-custom-elements/duet-breadcrumbs.d.ts +11 -0
- package/lib/dist-custom-elements/duet-breadcrumbs.js +90 -0
- package/lib/dist-custom-elements/duet-button.d.ts +11 -0
- package/lib/dist-custom-elements/duet-button.js +9 -0
- package/lib/dist-custom-elements/duet-caption.d.ts +11 -0
- package/lib/dist-custom-elements/duet-caption.js +9 -0
- package/lib/dist-custom-elements/duet-card.d.ts +11 -0
- package/lib/dist-custom-elements/duet-card.js +190 -0
- package/lib/dist-custom-elements/duet-checkbox.d.ts +11 -0
- package/lib/dist-custom-elements/duet-checkbox.js +163 -0
- package/lib/dist-custom-elements/duet-choice-group.d.ts +11 -0
- package/lib/dist-custom-elements/duet-choice-group.js +226 -0
- package/lib/dist-custom-elements/duet-choice.d.ts +11 -0
- package/lib/dist-custom-elements/duet-choice.js +390 -0
- package/lib/dist-custom-elements/duet-collapsible.d.ts +11 -0
- package/lib/dist-custom-elements/duet-collapsible.js +170 -0
- package/lib/dist-custom-elements/duet-combobox.d.ts +11 -0
- package/lib/dist-custom-elements/duet-combobox.js +432 -0
- package/lib/dist-custom-elements/duet-cookie-consent.d.ts +11 -0
- package/lib/dist-custom-elements/duet-cookie-consent.js +94 -0
- package/lib/dist-custom-elements/duet-date-picker.d.ts +11 -0
- package/lib/dist-custom-elements/duet-date-picker.js +906 -0
- package/lib/dist-custom-elements/duet-divider.d.ts +11 -0
- package/lib/dist-custom-elements/duet-divider.js +9 -0
- package/lib/dist-custom-elements/duet-editable-table.d.ts +11 -0
- package/lib/dist-custom-elements/duet-editable-table.js +9 -0
- package/lib/dist-custom-elements/duet-empty-state.d.ts +11 -0
- package/lib/dist-custom-elements/duet-empty-state.js +9 -0
- package/lib/dist-custom-elements/duet-fieldset.d.ts +11 -0
- package/lib/dist-custom-elements/duet-fieldset.js +9 -0
- package/lib/dist-custom-elements/duet-footer.d.ts +11 -0
- package/lib/dist-custom-elements/duet-footer.js +199 -0
- package/lib/dist-custom-elements/duet-grid-item.d.ts +11 -0
- package/lib/dist-custom-elements/duet-grid-item.js +9 -0
- package/lib/dist-custom-elements/duet-grid.d.ts +11 -0
- package/lib/dist-custom-elements/duet-grid.js +9 -0
- package/lib/dist-custom-elements/duet-header.d.ts +11 -0
- package/lib/dist-custom-elements/duet-header.js +764 -0
- package/lib/dist-custom-elements/duet-heading.d.ts +11 -0
- package/lib/dist-custom-elements/duet-heading.js +9 -0
- package/lib/dist-custom-elements/duet-hero.d.ts +11 -0
- package/lib/dist-custom-elements/duet-hero.js +314 -0
- package/lib/dist-custom-elements/duet-icon.d.ts +11 -0
- package/lib/dist-custom-elements/duet-icon.js +9 -0
- package/lib/dist-custom-elements/duet-input.d.ts +11 -0
- package/lib/dist-custom-elements/duet-input.js +9 -0
- package/lib/dist-custom-elements/duet-label.d.ts +11 -0
- package/lib/dist-custom-elements/duet-label.js +9 -0
- package/lib/dist-custom-elements/duet-layout.d.ts +11 -0
- package/lib/dist-custom-elements/duet-layout.js +107 -0
- package/lib/dist-custom-elements/duet-link.d.ts +11 -0
- package/lib/dist-custom-elements/duet-link.js +9 -0
- package/lib/dist-custom-elements/duet-list-item.d.ts +11 -0
- package/lib/dist-custom-elements/duet-list-item.js +9 -0
- package/lib/dist-custom-elements/duet-list.d.ts +11 -0
- package/lib/dist-custom-elements/duet-list.js +9 -0
- package/lib/dist-custom-elements/duet-logo.d.ts +11 -0
- package/lib/dist-custom-elements/duet-logo.js +9 -0
- package/lib/dist-custom-elements/duet-modal.d.ts +11 -0
- package/lib/dist-custom-elements/duet-modal.js +331 -0
- package/lib/dist-custom-elements/duet-notification-drawer.d.ts +11 -0
- package/lib/dist-custom-elements/duet-notification-drawer.js +194 -0
- package/lib/dist-custom-elements/duet-notification.d.ts +11 -0
- package/lib/dist-custom-elements/duet-notification.js +114 -0
- package/lib/dist-custom-elements/duet-number-input.d.ts +11 -0
- package/lib/dist-custom-elements/duet-number-input.js +516 -0
- package/lib/dist-custom-elements/duet-pagination.d.ts +11 -0
- package/lib/dist-custom-elements/duet-pagination.js +396 -0
- package/lib/dist-custom-elements/duet-paragraph.d.ts +11 -0
- package/lib/dist-custom-elements/duet-paragraph.js +9 -0
- package/lib/dist-custom-elements/duet-progress.d.ts +11 -0
- package/lib/dist-custom-elements/duet-progress.js +9 -0
- package/lib/dist-custom-elements/duet-radio-group.d.ts +11 -0
- package/lib/dist-custom-elements/duet-radio-group.js +216 -0
- package/lib/dist-custom-elements/duet-radio.d.ts +11 -0
- package/lib/dist-custom-elements/duet-radio.js +167 -0
- package/lib/dist-custom-elements/duet-range-slider.d.ts +11 -0
- package/lib/dist-custom-elements/duet-range-slider.js +209 -0
- package/lib/dist-custom-elements/duet-range-stepper.d.ts +11 -0
- package/lib/dist-custom-elements/duet-range-stepper.js +225 -0
- package/lib/dist-custom-elements/duet-scrollable.d.ts +11 -0
- package/lib/dist-custom-elements/duet-scrollable.js +9 -0
- package/lib/dist-custom-elements/duet-select.d.ts +11 -0
- package/lib/dist-custom-elements/duet-select.js +9 -0
- package/lib/dist-custom-elements/duet-spacer.d.ts +11 -0
- package/lib/dist-custom-elements/duet-spacer.js +9 -0
- package/lib/dist-custom-elements/duet-spinner.d.ts +11 -0
- package/lib/dist-custom-elements/duet-spinner.js +9 -0
- package/lib/dist-custom-elements/duet-step.d.ts +11 -0
- package/lib/dist-custom-elements/duet-step.js +150 -0
- package/lib/dist-custom-elements/duet-stepper.d.ts +11 -0
- package/lib/dist-custom-elements/duet-stepper.js +164 -0
- package/lib/dist-custom-elements/duet-tab-group.d.ts +11 -0
- package/lib/dist-custom-elements/duet-tab-group.js +301 -0
- package/lib/dist-custom-elements/duet-tab.d.ts +11 -0
- package/lib/dist-custom-elements/duet-tab.js +59 -0
- package/lib/dist-custom-elements/duet-table.d.ts +11 -0
- package/lib/dist-custom-elements/duet-table.js +9 -0
- package/lib/dist-custom-elements/duet-textarea.d.ts +11 -0
- package/lib/dist-custom-elements/duet-textarea.js +297 -0
- package/lib/dist-custom-elements/duet-toggle.d.ts +11 -0
- package/lib/dist-custom-elements/duet-toggle.js +150 -0
- package/lib/dist-custom-elements/duet-tooltip.d.ts +11 -0
- package/lib/dist-custom-elements/duet-tooltip.js +9 -0
- package/lib/dist-custom-elements/duet-tray.d.ts +11 -0
- package/lib/dist-custom-elements/duet-tray.js +175 -0
- package/lib/dist-custom-elements/duet-upload-aria-status.d.ts +11 -0
- package/lib/dist-custom-elements/duet-upload-aria-status.js +9 -0
- package/lib/dist-custom-elements/duet-upload.d.ts +11 -0
- package/lib/dist-custom-elements/duet-upload.js +1514 -0
- package/lib/dist-custom-elements/duet-visually-hidden.d.ts +11 -0
- package/lib/dist-custom-elements/duet-visually-hidden.js +9 -0
- package/lib/dist-custom-elements/index.d.ts +26 -0
- package/lib/dist-custom-elements/index.js +37 -0
- package/lib/dist-custom-elements/p-01de0640.js +37 -0
- package/lib/{esm/tokens-8ff8c570.js → dist-custom-elements/p-02305a1e.js} +18 -15
- package/lib/dist-custom-elements/p-08cfe544.js +125 -0
- package/lib/dist-custom-elements/p-09ed1ffa.js +160 -0
- package/lib/dist-custom-elements/p-0a928609.js +241 -0
- package/lib/dist-custom-elements/p-0b3f675e.js +47 -0
- package/lib/{esm/focus-utils-9e76623d.js → dist-custom-elements/p-0b8f16f1.js} +1 -1
- package/lib/dist-custom-elements/p-115c79b6.js +6 -0
- package/lib/dist-custom-elements/p-12721178.js +57 -0
- package/lib/dist-custom-elements/p-14dcd82b.js +133 -0
- package/lib/dist-custom-elements/p-16d518fd.js +66 -0
- package/lib/dist-custom-elements/p-213ef84c.js +87 -0
- package/lib/dist-custom-elements/p-266411cf.js +307 -0
- package/lib/dist-custom-elements/p-3d987b87.js +75 -0
- package/lib/dist-custom-elements/p-3fc2d124.js +1666 -0
- package/lib/dist-custom-elements/p-4717744e.js +110 -0
- package/lib/dist-custom-elements/p-4ebf1618.js +13 -0
- package/lib/dist-custom-elements/p-56118313.js +53 -0
- package/lib/dist-custom-elements/p-565779f5.js +199 -0
- package/lib/dist-custom-elements/p-5a9d75e1.js +55 -0
- package/lib/dist-custom-elements/p-65d3ead5.js +428 -0
- package/lib/dist-custom-elements/p-6886544b.js +129 -0
- package/lib/dist-custom-elements/p-6e74e660.js +275 -0
- package/lib/dist-custom-elements/p-704245ef.js +9 -0
- package/lib/dist-custom-elements/p-76f00bd5.js +10 -0
- package/lib/dist-custom-elements/p-7739604d.js +214 -0
- package/lib/dist-custom-elements/p-81c9b244.js +65 -0
- package/lib/{esm/token-utils-df78f4d8.js → dist-custom-elements/p-86faf728.js} +1 -1
- package/lib/dist-custom-elements/p-88511d7a.js +275 -0
- package/lib/dist-custom-elements/p-9c732bb9.js +193 -0
- package/lib/dist-custom-elements/p-acdba2db.js +114 -0
- package/lib/dist-custom-elements/p-b08e57cf.js +37 -0
- package/lib/dist-custom-elements/p-b9058029.js +138 -0
- package/lib/dist-custom-elements/p-bd4b92c4.js +86 -0
- package/lib/dist-custom-elements/p-bd779757.js +184 -0
- package/lib/dist-custom-elements/p-c1325e35.js +11 -0
- package/lib/dist-custom-elements/p-c70f3ccb.js +70 -0
- package/lib/dist-custom-elements/p-d004da5f.js +6 -0
- package/lib/dist-custom-elements/p-d4c234ed.js +390 -0
- package/lib/dist-custom-elements/p-d8549efe.js +20 -0
- package/lib/dist-custom-elements/p-d96debb6.js +287 -0
- package/lib/dist-custom-elements/p-da03a443.js +154 -0
- package/lib/dist-custom-elements/p-e294c0fb.js +341 -0
- package/lib/dist-custom-elements/p-e4d5fbc0.js +87 -0
- package/lib/dist-custom-elements/p-e5c8a58f.js +71 -0
- package/lib/dist-custom-elements/p-ede854e1.js +92 -0
- package/lib/dist-custom-elements/p-ef8eff22.js +64 -0
- package/lib/dist-custom-elements/p-f11208c3.js +6 -0
- package/lib/dist-custom-elements/p-f7db7c40.js +98 -0
- package/lib/dist-custom-elements/p-fc5362e7.js +61 -0
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/{p-9ed4eac7.system.entry.js → p-01c551f1.system.entry.js} +1 -1
- package/lib/duet/p-02305a1e.js +4 -0
- package/lib/duet/{p-f51969f5.entry.js → p-033bfa67.entry.js} +1 -1
- package/lib/duet/{p-86a3b203.system.entry.js → p-07a850a5.system.entry.js} +1 -1
- package/lib/duet/{p-211e59a0.system.entry.js → p-09e2ff96.system.entry.js} +1 -1
- package/lib/duet/{p-07f83b14.entry.js → p-0b74af40.entry.js} +1 -1
- package/lib/duet/{p-0c59905a.entry.js → p-0c2a51ac.entry.js} +1 -1
- package/lib/duet/{p-e56705ac.system.entry.js → p-0c9f0b8a.system.entry.js} +2 -2
- package/lib/duet/{p-4af6e3b1.entry.js → p-0d96924d.entry.js} +1 -1
- package/lib/duet/{p-67a78cbe.system.entry.js → p-0e48bca9.system.entry.js} +1 -1
- package/lib/duet/{p-82abc212.system.entry.js → p-0e98f667.system.entry.js} +1 -1
- package/lib/duet/{p-f5a06ff6.system.js → p-1999f503.system.js} +1 -1
- package/lib/duet/{p-e3a6351b.system.entry.js → p-1a41550e.system.entry.js} +1 -1
- package/lib/duet/{p-4d6b341d.system.entry.js → p-1bd57792.system.entry.js} +1 -1
- package/lib/duet/{p-567cab28.system.entry.js → p-1e0d7680.system.entry.js} +1 -1
- package/lib/duet/{p-921085f6.system.entry.js → p-1ebd7945.system.entry.js} +1 -1
- package/lib/duet/p-1fc60a60.system.js +4 -0
- package/lib/duet/{p-f416e108.entry.js → p-21662682.entry.js} +1 -1
- package/lib/duet/{p-2eea39f3.entry.js → p-23943f39.entry.js} +1 -1
- package/lib/duet/{p-9a3826e8.system.entry.js → p-23a8fa64.system.entry.js} +1 -1
- package/lib/duet/{p-902552a7.system.entry.js → p-264a0e0c.system.entry.js} +1 -1
- package/lib/duet/{p-5f407bd1.entry.js → p-27f72e70.entry.js} +1 -1
- package/lib/duet/{p-3c80d2fc.entry.js → p-2a3b1a2e.entry.js} +1 -1
- package/lib/duet/{p-6c022105.system.entry.js → p-2b320481.system.entry.js} +1 -1
- package/lib/duet/p-32f7178a.system.js +4 -0
- package/lib/duet/{p-196b2664.entry.js → p-3620ded5.entry.js} +1 -1
- package/lib/duet/{p-7d43d67b.entry.js → p-3904232a.entry.js} +1 -1
- package/lib/duet/{p-c89b1c28.entry.js → p-3b173cbd.entry.js} +1 -1
- package/lib/duet/{p-a9a9d22b.system.entry.js → p-430acad4.system.entry.js} +1 -1
- package/lib/duet/{p-5bde4aed.system.entry.js → p-4463946b.system.entry.js} +1 -1
- package/lib/duet/{p-cb1f9512.system.entry.js → p-44e9b1c8.system.entry.js} +1 -1
- package/lib/duet/p-49ce11a1.entry.js +4 -0
- package/lib/duet/{p-5d286e53.system.entry.js → p-4d6feeb5.system.entry.js} +1 -1
- package/lib/duet/{p-b4e8f605.system.entry.js → p-4d767c61.system.entry.js} +1 -1
- package/lib/duet/{p-94d496e1.system.entry.js → p-4f1fe415.system.entry.js} +1 -1
- package/lib/duet/{p-de3c0f4d.js → p-532e9db7.js} +1 -1
- package/lib/duet/{p-0250c7b7.system.entry.js → p-55fd512b.system.entry.js} +1 -1
- package/lib/duet/{p-398a79a0.js → p-588be556.js} +1 -1
- package/lib/duet/{p-f8a52ab0.entry.js → p-5af6d9e2.entry.js} +1 -1
- package/lib/duet/{p-626a5916.entry.js → p-5e1d64d8.entry.js} +1 -1
- package/lib/duet/{p-422c0465.system.entry.js → p-5f6452ce.system.entry.js} +1 -1
- package/lib/duet/{p-b57a4b2d.system.entry.js → p-60e29f52.system.entry.js} +1 -1
- package/lib/duet/{p-29157f26.system.entry.js → p-613c4099.system.entry.js} +1 -1
- package/lib/duet/{p-f0e4f685.system.entry.js → p-61444a3d.system.entry.js} +1 -1
- package/lib/duet/{p-9ef03ba6.js → p-6aca8584.js} +1 -1
- package/lib/duet/{p-0c83d107.system.entry.js → p-6e5f2016.system.entry.js} +1 -1
- package/lib/duet/{p-0930ce38.system.entry.js → p-6f93638a.system.entry.js} +1 -1
- package/lib/duet/{p-bc23dcde.entry.js → p-71105750.entry.js} +1 -1
- package/lib/duet/{p-3bbfe384.entry.js → p-73c6e5fb.entry.js} +1 -1
- package/lib/duet/{p-af3a016a.system.entry.js → p-751f6957.system.entry.js} +1 -1
- package/lib/duet/{p-920f9ff2.system.js → p-77600ed7.system.js} +1 -1
- package/lib/duet/{p-32883741.system.entry.js → p-77ca874f.system.entry.js} +1 -1
- package/lib/duet/{p-4427f4b2.entry.js → p-787f9eba.entry.js} +1 -1
- package/lib/duet/{p-8a91c7bb.system.entry.js → p-7ad2cb10.system.entry.js} +1 -1
- package/lib/duet/p-7de4d97d.entry.js +4 -0
- package/lib/duet/{p-20b5e96b.system.entry.js → p-8107aeb5.system.entry.js} +1 -1
- package/lib/duet/{p-a687eeaa.system.entry.js → p-86cb85b9.system.entry.js} +1 -1
- package/lib/duet/{p-d644302f.js → p-875ae637.js} +1 -1
- package/lib/duet/{p-39e1c6da.system.entry.js → p-8aafa8e7.system.entry.js} +1 -1
- package/lib/duet/{p-8bcd7936.entry.js → p-8b09a46f.entry.js} +1 -1
- package/lib/duet/{p-9059b7e3.entry.js → p-8c08e7ba.entry.js} +1 -1
- package/lib/duet/p-8e8f8b29.entry.js +4 -0
- package/lib/duet/{p-012e33e8.entry.js → p-9094fcf8.entry.js} +1 -1
- package/lib/duet/{p-2ebf682d.entry.js → p-988a781d.entry.js} +1 -1
- package/lib/duet/{p-194f22b3.system.entry.js → p-a395d4bc.system.entry.js} +1 -1
- package/lib/duet/{p-3f1c98d0.entry.js → p-a585113b.entry.js} +1 -1
- package/lib/duet/{p-e233e6ed.entry.js → p-aa8973fc.entry.js} +1 -1
- package/lib/duet/{p-b014fdca.entry.js → p-ab7f4070.entry.js} +1 -1
- package/lib/duet/{p-278340d9.system.entry.js → p-ab89d948.system.entry.js} +1 -1
- package/lib/duet/{p-14a2d6f2.entry.js → p-aef02083.entry.js} +1 -1
- package/lib/duet/{p-24978396.entry.js → p-afdc57da.entry.js} +1 -1
- package/lib/duet/{p-a124d4a0.entry.js → p-b2abaa9e.entry.js} +1 -1
- package/lib/duet/{p-68419f1e.entry.js → p-b55e55b5.entry.js} +1 -1
- package/lib/duet/{p-007d0250.system.entry.js → p-bbc91480.system.entry.js} +1 -1
- package/lib/duet/{p-ecc8ec3e.entry.js → p-bbe1a2cd.entry.js} +1 -1
- package/lib/duet/{p-9bd36dc0.system.entry.js → p-bd3c926c.system.entry.js} +1 -1
- package/lib/duet/{p-3feb442e.system.entry.js → p-bec16aea.system.entry.js} +1 -1
- package/lib/duet/p-bf59e11d.entry.js +4 -0
- package/lib/duet/{p-d5ef1959.system.entry.js → p-c4217626.system.entry.js} +1 -1
- package/lib/duet/{p-e1a1e52d.system.entry.js → p-c5f6ea62.system.entry.js} +1 -1
- package/lib/duet/{p-6ebb40da.entry.js → p-c6d05091.entry.js} +1 -1
- package/lib/duet/{p-c3d3f68d.system.entry.js → p-c73a591d.system.entry.js} +1 -1
- package/lib/duet/{p-35eaa5a8.entry.js → p-c863a0d1.entry.js} +1 -1
- package/lib/duet/{p-33300690.entry.js → p-c986532d.entry.js} +1 -1
- package/lib/duet/{p-b43a8c7a.entry.js → p-caa49454.entry.js} +1 -1
- package/lib/duet/{p-ddf8a652.system.entry.js → p-ccb0de84.system.entry.js} +1 -1
- package/lib/duet/{p-18cc5627.system.js → p-d209191d.system.js} +1 -1
- package/lib/duet/{p-4f235805.entry.js → p-defba7cd.entry.js} +1 -1
- package/lib/duet/{p-b9e9ac80.system.js → p-df785776.system.js} +1 -1
- package/lib/duet/{p-ea60602a.entry.js → p-e9862947.entry.js} +1 -1
- package/lib/duet/{p-b9b19fe9.entry.js → p-eb74c96e.entry.js} +1 -1
- package/lib/duet/{p-f96da661.entry.js → p-ece47184.entry.js} +1 -1
- package/lib/duet/{p-178e0ae7.entry.js → p-f09f968c.entry.js} +1 -1
- package/lib/duet/{p-2171d336.entry.js → p-f97776be.entry.js} +1 -1
- package/lib/duet/{p-1c0fdc62.system.entry.js → p-fe8fc877.system.entry.js} +1 -1
- package/lib/esm/duet-action-button.entry.js +3 -3
- package/lib/esm/duet-alert.entry.js +1 -1
- package/lib/esm/duet-badge.entry.js +1 -1
- package/lib/esm/duet-breadcrumb.entry.js +1 -1
- package/lib/esm/duet-breadcrumbs.entry.js +1 -1
- package/lib/esm/duet-button_2.entry.js +3 -3
- package/lib/esm/duet-caption_4.entry.js +3 -3
- package/lib/esm/duet-card.entry.js +6 -5
- package/lib/esm/duet-checkbox.entry.js +1 -1
- package/lib/esm/duet-choice_2.entry.js +4 -4
- package/lib/esm/duet-collapsible.entry.js +2 -2
- package/lib/esm/duet-combobox.entry.js +1 -1
- package/lib/esm/duet-cookie-consent.entry.js +1 -1
- package/lib/esm/duet-date-picker.entry.js +2 -2
- package/lib/esm/duet-divider_2.entry.js +1 -1
- package/lib/esm/duet-editable-table_3.entry.js +17 -14
- package/lib/esm/duet-empty-state.entry.js +1 -1
- package/lib/esm/duet-fieldset.entry.js +1 -1
- package/lib/esm/duet-footer.entry.js +1 -1
- package/lib/esm/duet-grid_2.entry.js +2 -2
- package/lib/esm/duet-header_2.entry.js +3 -3
- package/lib/esm/duet-hero.entry.js +1 -1
- package/lib/esm/duet-icon.entry.js +3 -3
- package/lib/esm/duet-input_2.entry.js +1 -1
- package/lib/esm/duet-layout.entry.js +1 -1
- package/lib/esm/duet-list_2.entry.js +1 -1
- package/lib/esm/duet-modal.entry.js +2 -2
- package/lib/esm/duet-notification_2.entry.js +1 -1
- package/lib/esm/duet-number-input.entry.js +1 -1
- package/lib/esm/duet-pagination_2.entry.js +1 -1
- package/lib/esm/duet-progress.entry.js +1 -1
- package/lib/esm/duet-radio_2.entry.js +1 -1
- package/lib/esm/duet-range-slider.entry.js +2 -2
- package/lib/esm/duet-scrollable_3.entry.js +1 -1
- package/lib/esm/duet-select.entry.js +1 -1
- package/lib/esm/duet-step_2.entry.js +1 -1
- package/lib/esm/duet-textarea.entry.js +1 -1
- package/lib/esm/duet-toggle.entry.js +1 -1
- package/lib/esm/duet-tooltip.entry.js +1 -1
- package/lib/esm/duet-tray.entry.js +2 -2
- package/lib/esm/duet-upload-aria-status.entry.js +1 -1
- package/lib/esm/duet-visually-hidden.entry.js +1 -1
- package/lib/esm/duet.js +1 -1
- package/lib/esm/focus-utils-236f580e.js +18 -0
- package/lib/esm/{index-0d0e51b6.js → index-b601aac1.js} +1 -1
- package/lib/esm/loader.js +1 -1
- package/lib/esm/token-utils-ebf797ab.js +92 -0
- package/lib/esm/tokens-b9d87fda.js +459 -0
- package/lib/esm/{tokens.module-f4572ed7.js → tokens.module-385c4cf8.js} +12 -10
- package/lib/esm-es5/duet-action-button.entry.js +1 -1
- package/lib/esm-es5/duet-alert.entry.js +1 -1
- package/lib/esm-es5/duet-badge.entry.js +1 -1
- package/lib/esm-es5/duet-breadcrumb.entry.js +1 -1
- package/lib/esm-es5/duet-breadcrumbs.entry.js +1 -1
- package/lib/esm-es5/duet-button_2.entry.js +1 -1
- package/lib/esm-es5/duet-caption_4.entry.js +1 -1
- package/lib/esm-es5/duet-card.entry.js +1 -1
- package/lib/esm-es5/duet-checkbox.entry.js +1 -1
- package/lib/esm-es5/duet-choice_2.entry.js +1 -1
- package/lib/esm-es5/duet-collapsible.entry.js +2 -2
- package/lib/esm-es5/duet-combobox.entry.js +1 -1
- package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
- package/lib/esm-es5/duet-date-picker.entry.js +1 -1
- package/lib/esm-es5/duet-divider_2.entry.js +1 -1
- package/lib/esm-es5/duet-editable-table_3.entry.js +1 -1
- package/lib/esm-es5/duet-empty-state.entry.js +1 -1
- package/lib/esm-es5/duet-fieldset.entry.js +1 -1
- package/lib/esm-es5/duet-footer.entry.js +1 -1
- package/lib/esm-es5/duet-grid_2.entry.js +1 -1
- package/lib/esm-es5/duet-header_2.entry.js +1 -1
- package/lib/esm-es5/duet-hero.entry.js +1 -1
- package/lib/esm-es5/duet-icon.entry.js +1 -1
- package/lib/esm-es5/duet-input_2.entry.js +1 -1
- package/lib/esm-es5/duet-layout.entry.js +1 -1
- package/lib/esm-es5/duet-list_2.entry.js +1 -1
- package/lib/esm-es5/duet-modal.entry.js +1 -1
- package/lib/esm-es5/duet-notification_2.entry.js +1 -1
- package/lib/esm-es5/duet-number-input.entry.js +1 -1
- package/lib/esm-es5/duet-pagination_2.entry.js +1 -1
- package/lib/esm-es5/duet-progress.entry.js +1 -1
- package/lib/esm-es5/duet-radio_2.entry.js +1 -1
- package/lib/esm-es5/duet-range-slider.entry.js +1 -1
- package/lib/esm-es5/duet-scrollable_3.entry.js +1 -1
- package/lib/esm-es5/duet-select.entry.js +1 -1
- package/lib/esm-es5/duet-step_2.entry.js +1 -1
- package/lib/esm-es5/duet-textarea.entry.js +2 -2
- package/lib/esm-es5/duet-toggle.entry.js +1 -1
- package/lib/esm-es5/duet-tooltip.entry.js +1 -1
- package/lib/esm-es5/duet-tray.entry.js +1 -1
- package/lib/esm-es5/duet-upload-aria-status.entry.js +1 -1
- package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
- package/lib/esm-es5/duet.js +1 -1
- package/lib/esm-es5/focus-utils-236f580e.js +4 -0
- package/lib/esm-es5/{index-0d0e51b6.js → index-b601aac1.js} +1 -1
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/{token-utils-df78f4d8.js → token-utils-ebf797ab.js} +1 -1
- package/lib/esm-es5/tokens-b9d87fda.js +4 -0
- package/lib/esm-es5/{tokens.module-f4572ed7.js → tokens.module-385c4cf8.js} +1 -1
- package/lib/types/components/duet-card/duet-card.d.ts +2 -0
- package/lib/types/components/duet-upload/duet-upload.d.ts +8 -8
- package/lib/types/components.d.ts +4 -4
- package/package.json +5 -5
- package/lib/custom-elements-bundle/index.d.ts +0 -399
- package/lib/custom-elements-bundle/index.js +0 -14109
- package/lib/duet/p-16d21cef.entry.js +0 -4
- package/lib/duet/p-6002f3d2.system.js +0 -4
- package/lib/duet/p-79817456.entry.js +0 -4
- package/lib/duet/p-835f4429.entry.js +0 -4
- package/lib/duet/p-a93a04b9.system.js +0 -4
- package/lib/duet/p-b6ef2e72.entry.js +0 -4
- package/lib/duet/p-d1746325.js +0 -4
- package/lib/esm-es5/focus-utils-9e76623d.js +0 -4
- package/lib/esm-es5/tokens-8ff8c570.js +0 -4
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import { p as proxyCustomElement, H, c as createEvent, h as h$1, b as Host } from './p-3fc2d124.js';
|
|
5
|
+
import { i as inheritGlobalTheme } from './p-4ebf1618.js';
|
|
6
|
+
import { c as createID } from './p-c1325e35.js';
|
|
7
|
+
import { F as FocusGuard } from './p-0b8f16f1.js';
|
|
8
|
+
import { a as getLanguage, g as getLocaleString } from './p-ede854e1.js';
|
|
9
|
+
import { h } from './p-b9058029.js';
|
|
10
|
+
import { d as defineCustomElement$8 } from './p-0a928609.js';
|
|
11
|
+
import { d as defineCustomElement$7 } from './p-e5c8a58f.js';
|
|
12
|
+
import { d as defineCustomElement$6 } from './p-7739604d.js';
|
|
13
|
+
import { d as defineCustomElement$5 } from './p-65d3ead5.js';
|
|
14
|
+
import { d as defineCustomElement$4 } from './p-16d518fd.js';
|
|
15
|
+
import { d as defineCustomElement$3 } from './p-88511d7a.js';
|
|
16
|
+
import { d as defineCustomElement$2 } from './p-b08e57cf.js';
|
|
17
|
+
|
|
18
|
+
const formatOptionsShort = { day: "numeric", month: "long" };
|
|
19
|
+
const formatOptionsLong = { day: "numeric", month: "long", year: "numeric" };
|
|
20
|
+
const i18n = {
|
|
21
|
+
fi: {
|
|
22
|
+
buttonLabel: "Valitse päivämäärä",
|
|
23
|
+
prevMonthLabel: "Edellinen kuukausi",
|
|
24
|
+
nextMonthLabel: "Seuraava kuukausi",
|
|
25
|
+
monthSelectLabel: "Kuukausi",
|
|
26
|
+
yearSelectLabel: "Vuosi",
|
|
27
|
+
closeLabel: "Sulje ikkuna",
|
|
28
|
+
selected: "Valittu päivämäärä on",
|
|
29
|
+
keyboardInstruction: "Voit navigoida päivämääriä nuolinäppäimillä",
|
|
30
|
+
dayLabels: ["Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai", "Sunnuntai"],
|
|
31
|
+
monthLabels: [
|
|
32
|
+
"Tammikuu",
|
|
33
|
+
"Helmikuu",
|
|
34
|
+
"Maaliskuu",
|
|
35
|
+
"Huhtikuu",
|
|
36
|
+
"Toukokuu",
|
|
37
|
+
"Kesäkuu",
|
|
38
|
+
"Heinäkuu",
|
|
39
|
+
"Elokuu",
|
|
40
|
+
"Syyskuu",
|
|
41
|
+
"Lokakuu",
|
|
42
|
+
"Marraskuu",
|
|
43
|
+
"Joulukuu",
|
|
44
|
+
],
|
|
45
|
+
monthLabelsShort: [
|
|
46
|
+
"Tammi",
|
|
47
|
+
"Helmi",
|
|
48
|
+
"Maalis",
|
|
49
|
+
"Huhti",
|
|
50
|
+
"Touko",
|
|
51
|
+
"Kesä",
|
|
52
|
+
"Heinä",
|
|
53
|
+
"Elo",
|
|
54
|
+
"Syys",
|
|
55
|
+
"Loka",
|
|
56
|
+
"Marras",
|
|
57
|
+
"Joulu",
|
|
58
|
+
],
|
|
59
|
+
formatterShort: new Intl.DateTimeFormat("fi-FI", formatOptionsShort),
|
|
60
|
+
formatterLong: new Intl.DateTimeFormat("fi-FI", formatOptionsLong),
|
|
61
|
+
},
|
|
62
|
+
en: {
|
|
63
|
+
buttonLabel: "Choose date",
|
|
64
|
+
prevMonthLabel: "Previous month",
|
|
65
|
+
nextMonthLabel: "Next month",
|
|
66
|
+
monthSelectLabel: "Month",
|
|
67
|
+
yearSelectLabel: "Year",
|
|
68
|
+
closeLabel: "Close window",
|
|
69
|
+
selected: "Selected date is",
|
|
70
|
+
keyboardInstruction: "You can use arrow keys to navigate dates",
|
|
71
|
+
dayLabels: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
|
|
72
|
+
monthLabels: [
|
|
73
|
+
"January",
|
|
74
|
+
"February",
|
|
75
|
+
"March",
|
|
76
|
+
"April",
|
|
77
|
+
"May",
|
|
78
|
+
"June",
|
|
79
|
+
"July",
|
|
80
|
+
"August",
|
|
81
|
+
"September",
|
|
82
|
+
"October",
|
|
83
|
+
"November",
|
|
84
|
+
"December",
|
|
85
|
+
],
|
|
86
|
+
monthLabelsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
|
87
|
+
formatterShort: new Intl.DateTimeFormat("en-GB", formatOptionsShort),
|
|
88
|
+
formatterLong: new Intl.DateTimeFormat("en-GB", formatOptionsLong),
|
|
89
|
+
},
|
|
90
|
+
sv: {
|
|
91
|
+
buttonLabel: "Välj datum",
|
|
92
|
+
prevMonthLabel: "Föregående månad",
|
|
93
|
+
nextMonthLabel: "Nästa månad",
|
|
94
|
+
monthSelectLabel: "Månad",
|
|
95
|
+
yearSelectLabel: "År",
|
|
96
|
+
closeLabel: "Stäng fönstret",
|
|
97
|
+
selected: "Valt datum är",
|
|
98
|
+
keyboardInstruction: "Använd piltangenterna för att navigera i kalender",
|
|
99
|
+
dayLabels: ["Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag", "Söndag"],
|
|
100
|
+
monthLabels: [
|
|
101
|
+
"Januari",
|
|
102
|
+
"Februari",
|
|
103
|
+
"Mars",
|
|
104
|
+
"April",
|
|
105
|
+
"Maj",
|
|
106
|
+
"Juni",
|
|
107
|
+
"Juli",
|
|
108
|
+
"Augusti",
|
|
109
|
+
"September",
|
|
110
|
+
"Oktober",
|
|
111
|
+
"November",
|
|
112
|
+
"December",
|
|
113
|
+
],
|
|
114
|
+
monthLabelsShort: ["Jan", "Feb", "Mars", "April", "Maj", "Juni", "Juli", "Aug", "Sep", "Okt", "Nov", "Dec"],
|
|
115
|
+
formatterShort: new Intl.DateTimeFormat("sv-SE", formatOptionsShort),
|
|
116
|
+
formatterLong: new Intl.DateTimeFormat("sv-SE", formatOptionsLong),
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
var formDate={"title":"form-date","tags":"form date calendar date picker","svg":"<svg fill=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\"><path d=\"M2.25 24A2.252 2.252 0 0 1 0 21.75V5.25A2.252 2.252 0 0 1 2.25 3H6V.75a.75.75 0 0 1 1.5 0V3h9V.75a.75.75 0 0 1 1.5 0V3h3.75A2.252 2.252 0 0 1 24 5.25v16.5A2.252 2.252 0 0 1 21.75 24zm-.75-2.25c0 .414.336.75.75.75h19.5a.75.75 0 0 0 .75-.75V10.5h-21zM22.5 9V5.25a.75.75 0 0 0-.75-.75H18V6a.75.75 0 0 1-1.5 0V4.5h-9V6A.75.75 0 0 1 6 6V4.5H2.25a.75.75 0 0 0-.75.75V9z\"/><circle cx=\"5.625\" cy=\"13.875\" r=\"1.125\"/><circle cx=\"5.625\" cy=\"19.125\" r=\"1.125\"/><circle cx=\"12\" cy=\"13.875\" r=\"1.125\"/><circle cx=\"12\" cy=\"19.125\" r=\"1.125\"/><circle cx=\"18.375\" cy=\"13.875\" r=\"1.125\"/><path d=\"M18.375 20.25c-.62 0-1.125-.505-1.125-1.125a1.127 1.127 0 0 1 1.171-1.122l.027.003a1.118 1.118 0 0 1 1.052 1.12c0 .619-.505 1.124-1.125 1.124z\"/></svg>"};
|
|
121
|
+
|
|
122
|
+
const DatePickerInput = ({ onClick, placeholder, name, inputLabel, value, valueAsDate, formattedValue, language, identifier, theme, disabled, error, role, required, tooltip, tooltipDirection, labelHidden, buttonRef, inputRef, onInput, onBlur, onFocus, accessibleActiveDescendant, accessibleControls, accessibleOwns, accessibleDescribedBy, echoPlaceholder, caption, }) => {
|
|
123
|
+
const { buttonLabel, selected, formatterLong } = i18n[language];
|
|
124
|
+
return (h("div", { class: {
|
|
125
|
+
"duet-theme-turva": theme === "turva",
|
|
126
|
+
"duet-date-input": true,
|
|
127
|
+
} },
|
|
128
|
+
h("duet-input", { label: inputLabel, value: formattedValue, placeholder: placeholder, id: identifier, disabled: disabled, theme: theme, error: error, role: role, required: required, tooltip: tooltip, tooltipDirection: tooltipDirection, margin: "none", component: "date", labelHidden: labelHidden, accessibleAutocomplete: "none", onDuetInput: onInput, onDuetFocus: onFocus, onDuetBlur: onBlur, autoComplete: "off", disallowPattern: "[^0-9\\.\\-\\/]", expand: true, ref: inputRef, accessibleActiveDescendant: accessibleActiveDescendant, accessibleControls: accessibleControls, accessibleOwns: accessibleOwns, accessibleDescribedBy: accessibleDescribedBy, echoPlaceholder: echoPlaceholder, caption: caption },
|
|
129
|
+
h("button", { class: { "duet-date-button": true, "duet-no-label": labelHidden }, onClick: onClick, disabled: disabled, ref: buttonRef, type: "button" },
|
|
130
|
+
h("duet-icon", { icon: formDate.svg, margin: "none", size: "small", color: "currentColor" }),
|
|
131
|
+
h("duet-visually-hidden", null,
|
|
132
|
+
buttonLabel,
|
|
133
|
+
valueAsDate && (h("span", null,
|
|
134
|
+
", ",
|
|
135
|
+
selected,
|
|
136
|
+
" ",
|
|
137
|
+
formatterLong.format(valueAsDate)))))),
|
|
138
|
+
h("input", { type: "hidden", name: name, value: value })));
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const DATE_FORMAT = /^(\d{1,2})[\.\-\/](\d{1,2})[\.\-\/](\d{4})$/;
|
|
142
|
+
const ISO_DATE_FORMAT = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
143
|
+
const DATE_OUTPUT_FORMAT = "dd.mm.yyyy";
|
|
144
|
+
const DATE_ISO_OUTPUT_FORMAT = "YYYY-MM-DD";
|
|
145
|
+
function createDate(year, month, day) {
|
|
146
|
+
var dayInt = parseInt(day, 10);
|
|
147
|
+
var monthInt = parseInt(month, 10);
|
|
148
|
+
var yearInt = parseInt(year, 10);
|
|
149
|
+
const isValid = Number.isInteger(yearInt) && // all parts should be integers
|
|
150
|
+
Number.isInteger(monthInt) &&
|
|
151
|
+
Number.isInteger(dayInt) &&
|
|
152
|
+
monthInt > 0 && // month must be 1-12
|
|
153
|
+
monthInt <= 12 &&
|
|
154
|
+
dayInt > 0 && // day must be 1-31
|
|
155
|
+
dayInt <= 31 &&
|
|
156
|
+
yearInt > 0;
|
|
157
|
+
if (isValid) {
|
|
158
|
+
return new Date(yearInt, monthInt - 1, dayInt);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @param value date string in format dd.mm.yyyy
|
|
163
|
+
*/
|
|
164
|
+
function parseDate(value) {
|
|
165
|
+
if (!value) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const matches = value.match(DATE_FORMAT);
|
|
169
|
+
if (matches) {
|
|
170
|
+
return createDate(matches[3], matches[2], matches[1]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @param value date string in ISO format YYYY-MM-DD
|
|
175
|
+
*/
|
|
176
|
+
function parseISODate(value) {
|
|
177
|
+
if (!value) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const matches = value.match(ISO_DATE_FORMAT);
|
|
181
|
+
if (matches) {
|
|
182
|
+
return createDate(matches[1], matches[2], matches[3]);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @param date the date to format as a Date
|
|
187
|
+
* @param format the format string eg. "dd.mm.yyyy", "YYYY-MM-DD"
|
|
188
|
+
*/
|
|
189
|
+
function formatDate(date, format) {
|
|
190
|
+
if (!date) {
|
|
191
|
+
return "";
|
|
192
|
+
}
|
|
193
|
+
var d = date.getDate().toString(10);
|
|
194
|
+
var m = (date.getMonth() + 1).toString(10);
|
|
195
|
+
var y = date.getFullYear().toString(10);
|
|
196
|
+
// days are not zero-indexed, so pad if less than 10
|
|
197
|
+
if (date.getDate() < 10) {
|
|
198
|
+
d = `0${d}`;
|
|
199
|
+
}
|
|
200
|
+
// months *are* zero-indexed, pad if less than 9!
|
|
201
|
+
if (date.getMonth() < 9) {
|
|
202
|
+
m = `0${m}`;
|
|
203
|
+
}
|
|
204
|
+
return format.replace(/MM/i, m).replace(/YYYY/i, y).replace(/DD/i, d);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* print date in format dd.mm.yyyy
|
|
208
|
+
* @param date
|
|
209
|
+
*/
|
|
210
|
+
function printDate(date) {
|
|
211
|
+
return formatDate(date, DATE_OUTPUT_FORMAT);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* print date in format YYYY-MM-DD
|
|
215
|
+
* @param date
|
|
216
|
+
*/
|
|
217
|
+
function printISODate(date) {
|
|
218
|
+
return formatDate(date, DATE_ISO_OUTPUT_FORMAT);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Compare if two dates are equal in terms of day, month, and year
|
|
222
|
+
*/
|
|
223
|
+
function isEqual(a, b) {
|
|
224
|
+
if (a == null || b == null) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
228
|
+
}
|
|
229
|
+
function addDays(date, days) {
|
|
230
|
+
var d = new Date(date);
|
|
231
|
+
d.setDate(d.getDate() + days);
|
|
232
|
+
return d;
|
|
233
|
+
}
|
|
234
|
+
function startOfWeek(date, firstDayOfWeek = 1) {
|
|
235
|
+
var d = new Date(date);
|
|
236
|
+
var day = d.getDay();
|
|
237
|
+
var diff = (day < firstDayOfWeek ? 7 : 0) + day - firstDayOfWeek;
|
|
238
|
+
d.setDate(d.getDate() - diff);
|
|
239
|
+
return d;
|
|
240
|
+
}
|
|
241
|
+
function endOfWeek(date, firstDayOfWeek = 1) {
|
|
242
|
+
var d = new Date(date);
|
|
243
|
+
var day = d.getDay();
|
|
244
|
+
var diff = (day < firstDayOfWeek ? -7 : 0) + 6 - (day - firstDayOfWeek);
|
|
245
|
+
d.setDate(d.getDate() + diff);
|
|
246
|
+
return d;
|
|
247
|
+
}
|
|
248
|
+
function startOfMonth(date) {
|
|
249
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
250
|
+
}
|
|
251
|
+
function endOfMonth(date) {
|
|
252
|
+
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
253
|
+
}
|
|
254
|
+
function setMonth(date, month) {
|
|
255
|
+
const d = new Date(date);
|
|
256
|
+
d.setMonth(month);
|
|
257
|
+
return d;
|
|
258
|
+
}
|
|
259
|
+
function setYear(date, year) {
|
|
260
|
+
const d = new Date(date);
|
|
261
|
+
d.setFullYear(year);
|
|
262
|
+
return d;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Check if date is within a min and max
|
|
266
|
+
*/
|
|
267
|
+
function inRange(date, min, max) {
|
|
268
|
+
return clamp(date, min, max) === date;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Ensures date is within range, returns min or max if out of bounds
|
|
272
|
+
*/
|
|
273
|
+
function clamp(date, min, max) {
|
|
274
|
+
const time = date.getTime();
|
|
275
|
+
if (min && min instanceof Date && time < min.getTime()) {
|
|
276
|
+
return min;
|
|
277
|
+
}
|
|
278
|
+
if (max && max instanceof Date && time > max.getTime()) {
|
|
279
|
+
return max;
|
|
280
|
+
}
|
|
281
|
+
return date;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* given start and end date, return an (inclusive) array of all dates in between
|
|
285
|
+
* @param start
|
|
286
|
+
* @param end
|
|
287
|
+
*/
|
|
288
|
+
function getDaysInRange(start, end) {
|
|
289
|
+
const days = [];
|
|
290
|
+
let current = start;
|
|
291
|
+
while (!isEqual(current, end)) {
|
|
292
|
+
days.push(current);
|
|
293
|
+
current = addDays(current, 1);
|
|
294
|
+
}
|
|
295
|
+
days.push(current);
|
|
296
|
+
return days;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* given a date, return an array of dates from a calendar perspective
|
|
300
|
+
* @param date
|
|
301
|
+
* @param firstDayOfWeek
|
|
302
|
+
*/
|
|
303
|
+
function getViewOfMonth(date, firstDayOfWeek = 1) {
|
|
304
|
+
const start = startOfWeek(startOfMonth(date), firstDayOfWeek);
|
|
305
|
+
const end = endOfWeek(endOfMonth(date), firstDayOfWeek);
|
|
306
|
+
return getDaysInRange(start, end);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const DatePickerDay = ({ focusedDay, today, day, language, onDaySelect, onKeyboardNavigation, ref, inRange, isSelected, }) => {
|
|
310
|
+
const isToday = isEqual(day, today);
|
|
311
|
+
const isFocused = isEqual(day, focusedDay);
|
|
312
|
+
const isDisabled = day.getMonth() !== focusedDay.getMonth();
|
|
313
|
+
const isOutsideRange = !inRange;
|
|
314
|
+
const { formatterShort } = i18n[language];
|
|
315
|
+
function handleClick(e) {
|
|
316
|
+
onDaySelect(e, day);
|
|
317
|
+
}
|
|
318
|
+
return (h("button", { class: { "duet-date-table-button": true, outside: isOutsideRange, disabled: isDisabled, today: isToday }, tabIndex: isFocused ? 0 : -1, onClick: handleClick, onKeyDown: onKeyboardNavigation, "aria-disabled": isOutsideRange || isDisabled, "aria-pressed": isSelected ? "true" : "false", type: "button", ref: ref },
|
|
319
|
+
h("span", { "aria-hidden": "true" }, day.getDate()),
|
|
320
|
+
h("duet-visually-hidden", null, formatterShort.format(day))));
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Creates an array representing an inclusive numeric range.
|
|
325
|
+
* `from` must be less than `to`
|
|
326
|
+
* @param from
|
|
327
|
+
* @param to
|
|
328
|
+
*/
|
|
329
|
+
function range(from, to) {
|
|
330
|
+
var result = [];
|
|
331
|
+
for (var i = from; i <= to; i++) {
|
|
332
|
+
result.push(i);
|
|
333
|
+
}
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Splits an array into smaller arrays of given chunk size
|
|
338
|
+
* @param array
|
|
339
|
+
* @param chunkSize
|
|
340
|
+
*/
|
|
341
|
+
function chunk(array, chunkSize) {
|
|
342
|
+
const result = [];
|
|
343
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
|
344
|
+
result.push(array.slice(i, i + chunkSize));
|
|
345
|
+
}
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
function parseShortcut(str) {
|
|
349
|
+
var _a;
|
|
350
|
+
const press = str.trim().split("+");
|
|
351
|
+
const key = press.pop();
|
|
352
|
+
return [((_a = press[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "shift", key];
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Creates a keyboard event handler for handling keyboard shortcuts.
|
|
356
|
+
* It currently only handles shift key as a modifier.
|
|
357
|
+
* @param shortcuts a hash where keys are keyboard shortcuts, and values are handlers for those shortcuts
|
|
358
|
+
* @example
|
|
359
|
+
* element.addEventListener("keydown", createShortcuts({
|
|
360
|
+
* "PageDown": () => this.addMonths(1)
|
|
361
|
+
* "Shift+PageDown": () => this.addYears(1)
|
|
362
|
+
* }))
|
|
363
|
+
*/
|
|
364
|
+
function createShortcuts(shortcuts) {
|
|
365
|
+
const keyBindings = Object.keys(shortcuts).map(key => [parseShortcut(key), shortcuts[key]]);
|
|
366
|
+
return function handleShortcuts(event) {
|
|
367
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
// we need to check both event.code and event.key
|
|
371
|
+
// for browser support back to IE11
|
|
372
|
+
const shortcut = keyBindings.find(([[shift, key]]) => {
|
|
373
|
+
return (key.toUpperCase() === event.key.toUpperCase() || key === event.code) && shift === event.shiftKey;
|
|
374
|
+
});
|
|
375
|
+
if (shortcut) {
|
|
376
|
+
shortcut[1](event);
|
|
377
|
+
event.preventDefault();
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const DatePickerMonth = ({ selectedDate, focusedDate, labelledById, theme, language, min, max, onDateSelect, onKeyboardNavigation, focusedDayRef, onFocusEnter, onFocusExit, }) => {
|
|
383
|
+
const { dayLabels } = i18n[language];
|
|
384
|
+
const today = new Date();
|
|
385
|
+
const days = getViewOfMonth(focusedDate);
|
|
386
|
+
function handleFocusOut(e) {
|
|
387
|
+
const table = e.currentTarget;
|
|
388
|
+
const relatedTarget = e.relatedTarget;
|
|
389
|
+
if (relatedTarget && !table.contains(relatedTarget)) {
|
|
390
|
+
onFocusExit(e);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return (h("table", { class: { "duet-date-table": true, "duet-theme-turva": theme === "turva" }, "aria-labelledby": labelledById,
|
|
394
|
+
// @ts-ignore
|
|
395
|
+
onFocusin: onFocusEnter, onFocusout: handleFocusOut },
|
|
396
|
+
h("thead", null,
|
|
397
|
+
h("tr", null, dayLabels.map(label => (h("th", { scope: "col" },
|
|
398
|
+
h("span", { "aria-hidden": "true" }, label.substr(0, 2)),
|
|
399
|
+
h("duet-visually-hidden", null, label)))))),
|
|
400
|
+
h("tbody", null, chunk(days, 7).map(week => (h("tr", { class: "duet-date-table-row" }, week.map(day => (h("td", { class: "duet-date-table-cell" },
|
|
401
|
+
h(DatePickerDay, { day: day, today: today, language: language, focusedDay: focusedDate, inRange: inRange(day, min, max), isSelected: isEqual(day, selectedDate), onDaySelect: onDateSelect, onKeyboardNavigation: onKeyboardNavigation, ref: el => {
|
|
402
|
+
if (el && isEqual(day, focusedDate)) {
|
|
403
|
+
focusedDayRef(el);
|
|
404
|
+
}
|
|
405
|
+
} }))))))))));
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const duetDatePickerCss = "*.sc-duet-date-picker,*.sc-duet-date-picker::after,*.sc-duet-date-picker::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.sc-duet-date-picker-h{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-right:16px !important;margin-bottom:12px !important;position:relative;display:inline-flex;width:100%;min-width:calc(33.333% - 8px);max-width:100%;text-align:left;vertical-align:top}.sc-duet-date-picker-h:last-child,.sc-duet-date-picker-h:last-of-type{margin-right:0 !important}@media (min-width: 36em){.sc-duet-date-picker-h{width:calc(50% - 16px - 3px)}}.duet-expand.sc-duet-date-picker-h{width:100% !important}.duet-m-0.sc-duet-date-picker-h{margin:0 !important}.duet-date.sc-duet-date-picker{position:relative;width:100%}.duet-date.sc-duet-date-picker button.sc-duet-date-picker,.duet-date-dialog.sc-duet-date-picker button.sc-duet-date-picker{max-width:initial !important;min-height:initial !important;padding:0 !important;margin:0 !important;transition:initial}.duet-date-button.sc-duet-date-picker{-webkit-user-select:none;user-select:none;position:absolute;top:1px;right:1px;z-index:200;display:flex;align-items:center;justify-content:center;width:48px;height:calc(100% - 2px);color:#00294d;cursor:pointer;background:transparent !important;border-left:1px solid #cfd2d4 !important;border-radius:0 4px 4px 0 !important}.duet-theme-turva.sc-duet-date-picker .duet-date-button.sc-duet-date-picker{color:#171c3a;border-color:#cfcfd1}.duet-date-button.sc-duet-date-picker::before{position:absolute;top:0;left:-6px;width:6px;height:100%;content:\"\";background:linear-gradient(to left, rgba(207, 210, 212, 0.2) 0%, rgba(207, 210, 212, 0.2) 1px, rgba(207, 210, 212, 0.1) 1px, rgba(207, 210, 212, 0) 100%)}.duet-date-button.sc-duet-date-picker:disabled{pointer-events:none;cursor:default;background:#f5f8fa !important;border:0 !important}.duet-theme-turva.sc-duet-date-picker .duet-date-button.sc-duet-date-picker:disabled{background:#f5f5f7 !important}.duet-date-button.sc-duet-date-picker:disabled::before{display:none}.duet-date-button.sc-duet-date-picker:disabled duet-icon.sc-duet-date-picker{opacity:0.4}.duet-date-button.sc-duet-date-picker duet-icon.sc-duet-date-picker{transform:translateY(-1px)}.duet-date-button.sc-duet-date-picker:active duet-icon.sc-duet-date-picker{transform:translateY(0)}.duet-date-button.sc-duet-date-picker:focus{color:#0077b3;border-color:transparent;outline:0;box-shadow:0 0 0 2px #0077b3}.duet-theme-turva.sc-duet-date-picker .duet-date-button.sc-duet-date-picker:focus{color:#171c3a;box-shadow:0 0 0 2px #171c3a}.duet-date-dialog.sc-duet-date-picker{position:absolute;top:100%;left:0;z-index:900;display:flex;width:100%;visibility:hidden;opacity:0;transition:transform 300ms ease, opacity 300ms ease, visibility 300ms ease;transform:scale(0.96) translateZ(0) translateY(-20px);transform-origin:top right}@media (min-width: 36em){.duet-date-dialog.left.sc-duet-date-picker{right:0;left:auto;width:auto}}@media (max-width: 35.9375em){.duet-date-dialog.sc-duet-date-picker{position:fixed;top:0;right:0;bottom:0;background:rgba(0, 41, 77, 0.75);transition:opacity 400ms ease, visibility 400ms ease;transform:translateZ(0);transform-origin:bottom center}.duet-date-dialog.duet-theme-turva.sc-duet-date-picker{background:rgba(23, 28, 58, 0.75)}}.duet-date-dialog.active.sc-duet-date-picker{visibility:visible;opacity:1;transition-property:transform, opacity;transform:scale(1.0001) translateZ(0) translateY(0)}@media (min-width: 36em){.duet-date-dialog.error.sc-duet-date-picker{top:calc(100% - 28px);margin-top:4px}}.duet-date-dialog-wrapper.sc-duet-date-picker{position:relative;z-index:600;width:100%;min-width:290px;max-width:310px;padding:16px 16px 20px;margin-top:8px;margin-left:auto;background:white;border:1px solid #e1e3e6;border-radius:4px;box-shadow:0 4px 10px 0 rgba(0, 41, 77, 0.15);transform:none}.duet-theme-turva.sc-duet-date-picker .duet-date-dialog-wrapper.sc-duet-date-picker{border-color:#e4e4e6}@media (max-width: 35.9375em){.duet-date-dialog-wrapper.sc-duet-date-picker{position:absolute;bottom:0;left:0;z-index:900;max-width:none;min-height:25em;padding:0 8% 20px;margin:0;visibility:hidden;border:0;border-radius:0;border-top-left-radius:4px;border-top-right-radius:4px;opacity:0;transition:transform 400ms ease, opacity 400ms ease, visibility 400ms ease;transform:translateZ(0) translateY(100%)}.active.sc-duet-date-picker .duet-date-dialog-wrapper.sc-duet-date-picker{visibility:visible;opacity:1;transition-property:transform, opacity;transform:translateZ(0) translateY(0)}}.duet-date-table.sc-duet-date-picker{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;font-weight:400;line-height:1.25;color:#00294d;text-align:center;border-spacing:0;border-collapse:collapse}.duet-date-table.duet-theme-turva.sc-duet-date-picker{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#171c3a}.duet-date-table.sc-duet-date-picker th.sc-duet-date-picker{padding-bottom:8px;font-size:0.75rem;font-weight:600;line-height:1.25;text-decoration:none;text-transform:uppercase;letter-spacing:1px}.duet-date-table.sc-duet-date-picker .duet-date-table-cell.sc-duet-date-picker{text-align:center}.duet-date-table-button.sc-duet-date-picker{position:relative;z-index:100;display:inline-block !important;width:36.9230769231px !important;height:36.9230769231px !important;min-height:initial !important;padding:0 !important;margin:0 !important;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0.875rem;font-weight:400;font-variant-numeric:tabular-nums;line-height:1.25 !important;color:#00294d !important;text-align:center;vertical-align:initial !important;cursor:pointer;background:transparent !important;border-radius:50% !important;transition:initial !important}.duet-theme-turva.sc-duet-date-picker .duet-date-table-button.sc-duet-date-picker{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;color:#171c3a !important}.duet-date-table-button.sc-duet-date-picker:hover{background:#e6f2f8 !important}.duet-theme-turva.sc-duet-date-picker .duet-date-table-button.sc-duet-date-picker:hover{background:#f9e6ea !important}.duet-date-table-button.today.sc-duet-date-picker{z-index:200;color:#004d80 !important;background:#f3f9fc !important;box-shadow:0 0 0 1px #0077b3 !important}.duet-theme-turva.sc-duet-date-picker .duet-date-table-button.today.sc-duet-date-picker{color:#940925 !important;background:#fcf3f4 !important;box-shadow:0 0 0 1px #c60c30 !important}.duet-date-table-button[aria-pressed=true].sc-duet-date-picker,.duet-date-table-button.sc-duet-date-picker:focus{color:white !important;background:#0077b3 !important;outline:0}.duet-theme-turva.sc-duet-date-picker .duet-date-table-button[aria-pressed=true].sc-duet-date-picker,.duet-theme-turva.sc-duet-date-picker .duet-date-table-button.sc-duet-date-picker:focus{color:white !important;background:#c60c30 !important}.duet-date-table-button.sc-duet-date-picker:active{z-index:200;color:white !important;background:#0077b3 !important;box-shadow:0 0 5px #0077b3 !important}.duet-theme-turva.sc-duet-date-picker .duet-date-table-button.sc-duet-date-picker:active{color:white !important;background:#c60c30 !important;box-shadow:0 0 5px #c60c30 !important}.duet-date-table-button.sc-duet-date-picker:focus{z-index:200;box-shadow:0 0 5px #0077b3 !important}.duet-theme-turva.sc-duet-date-picker .duet-date-table-button.sc-duet-date-picker:focus{box-shadow:0 0 5px #c60c30 !important}.duet-date-table-button.disabled.sc-duet-date-picker{color:#909599 !important;cursor:default;background:transparent !important;box-shadow:none !important}.duet-theme-turva.sc-duet-date-picker .duet-date-table-button.disabled.sc-duet-date-picker{color:#747475 !important;background:transparent !important;box-shadow:none !important}.duet-date-table-button.outside.sc-duet-date-picker{color:#909599 !important;pointer-events:none;cursor:default;background:#f5f8fa !important;box-shadow:none;opacity:0.75}.duet-theme-turva.sc-duet-date-picker .duet-date-table-button.outside.sc-duet-date-picker{color:#747475;background:#f5f5f7;box-shadow:none}.duet-date-dialog-header.sc-duet-date-picker{margin-bottom:16px !important;display:flex;align-items:center;justify-content:space-between;width:100%}.duet-date-dialog-buttons.sc-duet-date-picker{white-space:nowrap}.duet-date-dialog-buttons.sc-duet-date-picker .sc-duet-date-picker::part(button){border:0}.duet-date-dialog-select.sc-duet-date-picker{position:relative;display:inline-flex;margin-top:4px}.duet-date-dialog-select.sc-duet-date-picker .duet-date-dialog-select-label.sc-duet-date-picker{position:relative;z-index:1;display:flex;align-items:center;width:100%;padding:0 8px;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1.25rem;font-weight:600;line-height:1.25;color:#00294d;pointer-events:none;border-radius:4px}.duet-theme-turva.sc-duet-date-picker .duet-date-dialog-select.sc-duet-date-picker .duet-date-dialog-select-label.sc-duet-date-picker{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#171c3a}.duet-date-dialog-select.sc-duet-date-picker span.sc-duet-date-picker{margin-right:4px}.duet-date-dialog-select.sc-duet-date-picker select.sc-duet-date-picker{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;font-size:1rem;cursor:pointer;opacity:0}.duet-date-dialog-select.sc-duet-date-picker select.sc-duet-date-picker:focus+.duet-date-dialog-select-label.sc-duet-date-picker{box-shadow:0 0 0 2px #0077b3}.duet-theme-turva.sc-duet-date-picker .duet-date-dialog-select.sc-duet-date-picker select.sc-duet-date-picker:focus+.duet-date-dialog-select-label.sc-duet-date-picker{box-shadow:0 0 0 2px #171c3a}.duet-date-dialog-mobile-header.sc-duet-date-picker{position:relative;display:flex;align-items:center;justify-content:space-between;width:120%;padding:12px 20px;margin-bottom:20px;margin-left:-10%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom:1px solid #cfd2d4}@media (min-width: 36em){.duet-date-dialog-mobile-header.sc-duet-date-picker{position:absolute;top:-8px;right:-8px;width:auto;padding:0;margin:0;overflow:visible;border:0}}.duet-theme-turva.sc-duet-date-picker .duet-date-dialog-mobile-header.sc-duet-date-picker{border-color:#cfcfd1}.duet-date-dialog-mobile-header.sc-duet-date-picker duet-label.sc-duet-date-picker{display:inline-block;max-width:84%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media (min-width: 36em){.duet-date-dialog-mobile-header.sc-duet-date-picker duet-label.sc-duet-date-picker{display:none}}.duet-date-picker-close.sc-duet-date-picker{display:flex;align-items:center;justify-content:center;width:24px;height:24px !important;padding:0 !important;color:#00294d !important;cursor:pointer;background:#f5f8fa !important;border-radius:50%;-webkit-appearance:none;appearance:none}@media (min-width: 36em){.duet-date-picker-close.sc-duet-date-picker{opacity:0}}.duet-theme-turva.sc-duet-date-picker .duet-date-picker-close.sc-duet-date-picker{background:#f5f5f7 !important}.duet-date-picker-close.sc-duet-date-picker:hover{background:#f5f8fa !important}.duet-theme-turva.sc-duet-date-picker .duet-date-picker-close.sc-duet-date-picker:hover{background:#f5f5f7 !important}.duet-date-picker-close.sc-duet-date-picker:focus{outline:none;box-shadow:0 0 0 2px #0077b3}@media (min-width: 36em){.duet-date-picker-close.sc-duet-date-picker:focus{opacity:1}}.duet-theme-turva.sc-duet-date-picker .duet-date-picker-close.sc-duet-date-picker:focus{box-shadow:0 0 0 2px #171c3a}";
|
|
409
|
+
|
|
410
|
+
const DuetDatePicker$1 = /*@__PURE__*/ proxyCustomElement(class extends H {
|
|
411
|
+
constructor() {
|
|
412
|
+
super();
|
|
413
|
+
this.__registerHost();
|
|
414
|
+
this.duetChange = createEvent(this, "duetChange", 7);
|
|
415
|
+
this.duetBlur = createEvent(this, "duetBlur", 7);
|
|
416
|
+
this.duetFocus = createEvent(this, "duetFocus", 7);
|
|
417
|
+
this.monthSelectId = createID("DuetDatePicker");
|
|
418
|
+
this.yearSelectId = createID("DuetDatePicker");
|
|
419
|
+
this.dialogLabelId = createID("DuetDatePicker");
|
|
420
|
+
this.initialTouchX = null;
|
|
421
|
+
this.initialTouchY = null;
|
|
422
|
+
this.focusTarget = null;
|
|
423
|
+
this.open = false;
|
|
424
|
+
this.focusedDay = new Date();
|
|
425
|
+
this.inputValue = "";
|
|
426
|
+
/**
|
|
427
|
+
* Theme of the component.
|
|
428
|
+
*/
|
|
429
|
+
this.theme = "";
|
|
430
|
+
/**
|
|
431
|
+
* Expands the date picker input to fill 100% of the container width.
|
|
432
|
+
*/
|
|
433
|
+
this.expand = false;
|
|
434
|
+
/**
|
|
435
|
+
* Name of the date picker input.
|
|
436
|
+
*/
|
|
437
|
+
this.name = "";
|
|
438
|
+
/**
|
|
439
|
+
* Adds a unique identifier for the date picker input.
|
|
440
|
+
*/
|
|
441
|
+
this.identifier = "";
|
|
442
|
+
/**
|
|
443
|
+
* Label for the date picker input.
|
|
444
|
+
*/
|
|
445
|
+
this.label = "";
|
|
446
|
+
/**
|
|
447
|
+
* Controls the margin of the component.
|
|
448
|
+
*/
|
|
449
|
+
this.margin = "auto";
|
|
450
|
+
/**
|
|
451
|
+
* The currently active language. This setting changes the month/year/day.
|
|
452
|
+
* names and button labels as well as all screen reader labels.
|
|
453
|
+
* @deprecated this is now handled via the html lang tag, and is no longer used - kept to avoid breaking changes and ease unit testing.
|
|
454
|
+
* @default "fi"
|
|
455
|
+
*/
|
|
456
|
+
this.language = getLanguage();
|
|
457
|
+
/**
|
|
458
|
+
* Placeholder defaults.
|
|
459
|
+
* @default { fi: "pp.kk.vvvv", en: "dd.mm.yyyy", sv: "dd.mm.åååå" }
|
|
460
|
+
*/
|
|
461
|
+
this.placeholderDefaults = {
|
|
462
|
+
fi: "pp.kk.vvvv",
|
|
463
|
+
en: "dd.mm.yyyy",
|
|
464
|
+
sv: "dd.mm.åååå",
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Hint text to display before the user types into the date picker input.
|
|
468
|
+
* @default { fi: "pp.kk.vvvv", en: "dd.mm.yyyy", sv: "dd.mm.åååå" }
|
|
469
|
+
*/
|
|
470
|
+
this.placeholder = getLocaleString(this.placeholderDefaults, this.language);
|
|
471
|
+
/**
|
|
472
|
+
* If form input field has a placeholder text, and user types anything (causing the text to dissapear),
|
|
473
|
+
* settings this to true will "echo" it into the caption slot - this option will be false by default for the next few versions, but will eventually be true by default (scheduled for 4.30.0)
|
|
474
|
+
*/
|
|
475
|
+
this.echoPlaceholder = false;
|
|
476
|
+
/**
|
|
477
|
+
* Makes the date picker input component disabled. This prevents users from being able to
|
|
478
|
+
* interact with the input, and conveys its inactive state to assistive technologies.
|
|
479
|
+
*/
|
|
480
|
+
this.disabled = false;
|
|
481
|
+
/**
|
|
482
|
+
* Display the date picker input in error state along with an error message.
|
|
483
|
+
*/
|
|
484
|
+
this.error = "";
|
|
485
|
+
/**
|
|
486
|
+
* Visually hide the label, but still show it to screen readers.
|
|
487
|
+
*/
|
|
488
|
+
this.labelHidden = false;
|
|
489
|
+
/**
|
|
490
|
+
* Set whether the input is required or not. Please note that this is necessary for
|
|
491
|
+
* accessible inputs when the user is required to fill them. When using this property
|
|
492
|
+
* you need to also set “novalidate” attribute to your form element to prevent
|
|
493
|
+
* browser from displaying its own validation errors.
|
|
494
|
+
*/
|
|
495
|
+
this.required = false;
|
|
496
|
+
/**
|
|
497
|
+
* Forces the opening direction of the calendar modal to be always left or right.
|
|
498
|
+
* This setting can be useful when the input is smaller than the opening date picker
|
|
499
|
+
* would be as by default the picker always opens towards right.
|
|
500
|
+
*/
|
|
501
|
+
this.direction = "right";
|
|
502
|
+
/**
|
|
503
|
+
* Tooltip to display next to the label of the date picker input.
|
|
504
|
+
*/
|
|
505
|
+
this.tooltip = "";
|
|
506
|
+
/**
|
|
507
|
+
* With direction setting you can force the tooltip to always open towards left
|
|
508
|
+
* or right instead of automatically determining the direction.
|
|
509
|
+
*/
|
|
510
|
+
this.tooltipDirection = "auto";
|
|
511
|
+
/**
|
|
512
|
+
* Date value. Must be in IS0-8601 format: YYYY-MM-DD
|
|
513
|
+
*/
|
|
514
|
+
this.value = "";
|
|
515
|
+
/**
|
|
516
|
+
* Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.
|
|
517
|
+
* This setting can be used alone or together with the max property.
|
|
518
|
+
*/
|
|
519
|
+
this.min = "";
|
|
520
|
+
/**
|
|
521
|
+
* Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.
|
|
522
|
+
* This setting can be used alone or together with the min property.
|
|
523
|
+
*/
|
|
524
|
+
this.max = "";
|
|
525
|
+
/**
|
|
526
|
+
* Increment to add to years, defaults to 10 for simplicity, if you need a larger selectionspace you can set it to 100
|
|
527
|
+
*/
|
|
528
|
+
this.incrementYears = 10;
|
|
529
|
+
this.enableActiveFocus = () => {
|
|
530
|
+
this.focusTarget = "day-button";
|
|
531
|
+
};
|
|
532
|
+
this.disableActiveFocus = () => {
|
|
533
|
+
this.focusTarget = null;
|
|
534
|
+
};
|
|
535
|
+
this.toggleOpen = (e) => {
|
|
536
|
+
e.preventDefault();
|
|
537
|
+
this.open ? this.hide(false) : this.show();
|
|
538
|
+
};
|
|
539
|
+
this.handleBlur = (event) => {
|
|
540
|
+
event.stopPropagation();
|
|
541
|
+
this.duetBlur.emit({
|
|
542
|
+
component: "duet-date-picker",
|
|
543
|
+
});
|
|
544
|
+
};
|
|
545
|
+
this.handleFocus = (event) => {
|
|
546
|
+
event.stopPropagation();
|
|
547
|
+
this.duetFocus.emit({
|
|
548
|
+
component: "duet-date-picker",
|
|
549
|
+
});
|
|
550
|
+
};
|
|
551
|
+
this.handleTouchStart = (event) => {
|
|
552
|
+
const touch = event.changedTouches[0];
|
|
553
|
+
this.initialTouchX = touch.pageX;
|
|
554
|
+
this.initialTouchY = touch.pageY;
|
|
555
|
+
};
|
|
556
|
+
this.handleTouchMove = (event) => {
|
|
557
|
+
event.preventDefault();
|
|
558
|
+
};
|
|
559
|
+
this.handleTouchEnd = (event) => {
|
|
560
|
+
const touch = event.changedTouches[0];
|
|
561
|
+
const distX = touch.pageX - this.initialTouchX; // get horizontal dist traveled
|
|
562
|
+
const distY = touch.pageY - this.initialTouchY; // get vertical dist traveled
|
|
563
|
+
const threshold = 70;
|
|
564
|
+
const isHorizontalSwipe = Math.abs(distX) >= threshold && Math.abs(distY) <= threshold;
|
|
565
|
+
const isDownwardsSwipe = Math.abs(distY) >= threshold && Math.abs(distX) <= threshold && distY > 0;
|
|
566
|
+
if (isHorizontalSwipe) {
|
|
567
|
+
this.addMonths(distX < 0 ? 1 : -1);
|
|
568
|
+
}
|
|
569
|
+
else if (isDownwardsSwipe) {
|
|
570
|
+
this.hide();
|
|
571
|
+
event.preventDefault();
|
|
572
|
+
}
|
|
573
|
+
this.initialTouchY = null;
|
|
574
|
+
this.initialTouchX = null;
|
|
575
|
+
};
|
|
576
|
+
this.handleNextMonthClick = (event) => {
|
|
577
|
+
event.preventDefault();
|
|
578
|
+
this.addMonths(1);
|
|
579
|
+
};
|
|
580
|
+
this.handlePreviousMonthClick = (event) => {
|
|
581
|
+
event.preventDefault();
|
|
582
|
+
this.addMonths(-1);
|
|
583
|
+
};
|
|
584
|
+
this.handleEscKey = createShortcuts({
|
|
585
|
+
Escape: () => this.hide(),
|
|
586
|
+
Esc: () => this.hide(), // IE-specific
|
|
587
|
+
});
|
|
588
|
+
this.handleKeyboardNavigation = createShortcuts({
|
|
589
|
+
ArrowRight: () => this.addDays(1),
|
|
590
|
+
Right: () => this.addDays(1),
|
|
591
|
+
ArrowLeft: () => this.addDays(-1),
|
|
592
|
+
Left: () => this.addDays(-1),
|
|
593
|
+
ArrowDown: () => this.addDays(7),
|
|
594
|
+
Down: () => this.addDays(7),
|
|
595
|
+
ArrowUp: () => this.addDays(-7),
|
|
596
|
+
Up: () => this.addDays(-7),
|
|
597
|
+
Home: () => this.startOfWeek(),
|
|
598
|
+
End: () => this.endOfWeek(),
|
|
599
|
+
PageUp: () => this.addMonths(-1),
|
|
600
|
+
PageDown: () => this.addMonths(1),
|
|
601
|
+
"Shift+PageUp": () => this.addYears(-1),
|
|
602
|
+
"Shift+PageDown": () => this.addYears(1),
|
|
603
|
+
});
|
|
604
|
+
this.handleDaySelect = (_event, day) => {
|
|
605
|
+
const min = parseISODate(this.min);
|
|
606
|
+
const max = parseISODate(this.max);
|
|
607
|
+
this.determineValidity(day);
|
|
608
|
+
if (inRange(day, min, max)) {
|
|
609
|
+
this.setValue(day);
|
|
610
|
+
this.hide();
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
this.handleMonthSelect = e => {
|
|
614
|
+
this.setMonth(parseInt(e.target.value, 10));
|
|
615
|
+
};
|
|
616
|
+
this.handleYearSelect = e => {
|
|
617
|
+
this.setYear(parseInt(e.target.value, 10));
|
|
618
|
+
};
|
|
619
|
+
this.handleInputChange = (e) => {
|
|
620
|
+
this.inputValue = e.detail.value;
|
|
621
|
+
const parsed = parseDate(this.inputValue);
|
|
622
|
+
this.determineValidity(parsed);
|
|
623
|
+
if (parsed || this.inputValue === "") {
|
|
624
|
+
this.setValue(parsed);
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
updateValidity() {
|
|
629
|
+
this.determineValidity(parseISODate(this.value));
|
|
630
|
+
}
|
|
631
|
+
updateInternalValue() {
|
|
632
|
+
const parsedValue = parseISODate(this.value);
|
|
633
|
+
const parsedInputValue = parseDate(this.inputValue);
|
|
634
|
+
// an invalid or empty value should clear the input
|
|
635
|
+
if (!parsedValue) {
|
|
636
|
+
this.inputValue = "";
|
|
637
|
+
}
|
|
638
|
+
// but otherwise only update user's input if the new value is different to user's input
|
|
639
|
+
else if (!isEqual(parsedValue, parsedInputValue)) {
|
|
640
|
+
this.inputValue = printDate(parsedValue);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Component lifecycle events.
|
|
645
|
+
*/
|
|
646
|
+
componentWillLoad() {
|
|
647
|
+
inheritGlobalTheme(this);
|
|
648
|
+
this.determineValidity(parseISODate(this.value));
|
|
649
|
+
this.updateInternalValue();
|
|
650
|
+
}
|
|
651
|
+
componentDidUpdate() {
|
|
652
|
+
// we want to run this code _after_ render
|
|
653
|
+
// to ensure all elements are visible (and thus focusable)
|
|
654
|
+
// hence using componentDidUpdate
|
|
655
|
+
switch (this.focusTarget) {
|
|
656
|
+
case "toggle-button":
|
|
657
|
+
this.datePickerButton.focus();
|
|
658
|
+
this.focusTarget = null;
|
|
659
|
+
break;
|
|
660
|
+
case "day-button":
|
|
661
|
+
// we don't clear focusTarget here since this is cleared
|
|
662
|
+
// already when focus is moved out of calendar table
|
|
663
|
+
this.focusedDayNode.focus();
|
|
664
|
+
break;
|
|
665
|
+
case "month-select":
|
|
666
|
+
this.monthSelectNode.focus();
|
|
667
|
+
this.focusTarget = null;
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Sets focus on the date picker's input. Use this method instead of the global `focus()`.
|
|
673
|
+
*/
|
|
674
|
+
async setFocus(options) {
|
|
675
|
+
this.datePickerInput.setFocus(options);
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Show the calendar modal, moving focus to the calendar inside.
|
|
679
|
+
*/
|
|
680
|
+
async show() {
|
|
681
|
+
this.open = true;
|
|
682
|
+
this.focusTarget = "month-select";
|
|
683
|
+
this.setFocusedDay(parseISODate(this.value) || new Date());
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Hide the calendar modal. Set `moveFocusToButton` to false to prevent focus
|
|
687
|
+
* returning to the date picker's button. Default is true.
|
|
688
|
+
*/
|
|
689
|
+
async hide(moveFocusToButton = true) {
|
|
690
|
+
this.open = false;
|
|
691
|
+
if (moveFocusToButton) {
|
|
692
|
+
this.focusTarget = "toggle-button";
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
addDays(days) {
|
|
696
|
+
this.setFocusedDay(addDays(this.focusedDay, days));
|
|
697
|
+
}
|
|
698
|
+
addMonths(months) {
|
|
699
|
+
this.setMonth(this.focusedDay.getMonth() + months);
|
|
700
|
+
}
|
|
701
|
+
addYears(years) {
|
|
702
|
+
this.setYear(this.focusedDay.getFullYear() + years);
|
|
703
|
+
}
|
|
704
|
+
startOfWeek() {
|
|
705
|
+
this.setFocusedDay(startOfWeek(this.focusedDay));
|
|
706
|
+
}
|
|
707
|
+
endOfWeek() {
|
|
708
|
+
this.setFocusedDay(endOfWeek(this.focusedDay));
|
|
709
|
+
}
|
|
710
|
+
setMonth(month) {
|
|
711
|
+
const min = setMonth(startOfMonth(this.focusedDay), month);
|
|
712
|
+
const max = endOfMonth(min);
|
|
713
|
+
const date = setMonth(this.focusedDay, month);
|
|
714
|
+
this.setFocusedDay(clamp(date, min, max));
|
|
715
|
+
}
|
|
716
|
+
setYear(year) {
|
|
717
|
+
const min = setYear(startOfMonth(this.focusedDay), year);
|
|
718
|
+
const max = endOfMonth(min);
|
|
719
|
+
const date = setYear(this.focusedDay, year);
|
|
720
|
+
this.setFocusedDay(clamp(date, min, max));
|
|
721
|
+
}
|
|
722
|
+
setFocusedDay(day) {
|
|
723
|
+
this.focusedDay = clamp(day, parseISODate(this.min), parseISODate(this.max));
|
|
724
|
+
}
|
|
725
|
+
determineValidity(date) {
|
|
726
|
+
var _a, _b;
|
|
727
|
+
const inputValue = (_b = (_a = this.datePickerInput) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
|
728
|
+
const badInput = inputValue !== "" && date == null;
|
|
729
|
+
const valueMissing = this.required && date == null;
|
|
730
|
+
const rangeOverflow = date ? !inRange(date, null, parseISODate(this.max)) : false;
|
|
731
|
+
const rangeUnderflow = date ? !inRange(date, parseISODate(this.min)) : false;
|
|
732
|
+
this.validity = {
|
|
733
|
+
patternMismatch: false,
|
|
734
|
+
customError: false,
|
|
735
|
+
stepMismatch: false,
|
|
736
|
+
tooLong: false,
|
|
737
|
+
tooShort: false,
|
|
738
|
+
typeMismatch: false,
|
|
739
|
+
valueMissing,
|
|
740
|
+
badInput,
|
|
741
|
+
rangeUnderflow,
|
|
742
|
+
rangeOverflow,
|
|
743
|
+
valid: !(valueMissing || badInput || rangeUnderflow || rangeOverflow),
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
setValue(date) {
|
|
747
|
+
const newValue = printISODate(date);
|
|
748
|
+
if (newValue === this.value) {
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
this.value = newValue;
|
|
752
|
+
this.duetChange.emit({
|
|
753
|
+
component: "duet-date-picker",
|
|
754
|
+
value: this.value,
|
|
755
|
+
valueAsDate: date,
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
handleDocumentClick(e) {
|
|
759
|
+
if (!this.open) {
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
// the dialog and the button aren't considered clicks outside.
|
|
763
|
+
// dialog for obvious reasons, but the button needs to be skipped
|
|
764
|
+
// so that two things are possible:
|
|
765
|
+
//
|
|
766
|
+
// a) clicking again on the button when dialog is open should close the modal.
|
|
767
|
+
// without skipping the button here, we would see a click outside
|
|
768
|
+
// _and_ a click on the button, so the `open` state goes
|
|
769
|
+
// open -> close (click outside) -> open (click button)
|
|
770
|
+
//
|
|
771
|
+
// b) clicking another date picker's button should close the current calendar
|
|
772
|
+
// and open the new one. this means we can't stopPropagation() on the button itself
|
|
773
|
+
const isClickOutside = e
|
|
774
|
+
.composedPath()
|
|
775
|
+
.every(node => node !== this.dialogWrapperNode && node !== this.datePickerButton);
|
|
776
|
+
if (isClickOutside) {
|
|
777
|
+
this.hide(false);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* render() function
|
|
782
|
+
* Always the last one in the class.
|
|
783
|
+
*/
|
|
784
|
+
render() {
|
|
785
|
+
const valueAsDate = parseISODate(this.value);
|
|
786
|
+
const selectedYear = (valueAsDate || this.focusedDay).getFullYear();
|
|
787
|
+
const focusedMonth = this.focusedDay.getMonth();
|
|
788
|
+
const focusedYear = this.focusedDay.getFullYear();
|
|
789
|
+
const text = i18n[this.language];
|
|
790
|
+
const minDate = parseISODate(this.min);
|
|
791
|
+
const maxDate = parseISODate(this.max);
|
|
792
|
+
const prevMonthDisabled = minDate != null && minDate.getMonth() === focusedMonth && minDate.getFullYear() === focusedYear;
|
|
793
|
+
const nextMonthDisabled = maxDate != null && maxDate.getMonth() === focusedMonth && maxDate.getFullYear() === focusedYear;
|
|
794
|
+
let minYear = selectedYear - this.incrementYears;
|
|
795
|
+
let maxYear = selectedYear + this.incrementYears;
|
|
796
|
+
if (minDate) {
|
|
797
|
+
minYear = Math.max(minYear, minDate.getFullYear());
|
|
798
|
+
}
|
|
799
|
+
if (maxDate) {
|
|
800
|
+
maxYear = Math.min(maxYear, maxDate.getFullYear());
|
|
801
|
+
}
|
|
802
|
+
return (h$1(Host, { class: { "duet-expand": this.expand, "duet-m-0": this.margin === "none" } }, h$1("div", { class: "duet-date" }, h$1(DatePickerInput, { value: this.value, valueAsDate: valueAsDate, formattedValue: this.inputValue, language: this.language, onInput: this.handleInputChange, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.toggleOpen, name: this.name, disabled: this.disabled, error: this.error, role: this.role, required: this.required, theme: this.theme, tooltip: this.tooltip, tooltipDirection: this.tooltipDirection, labelHidden: this.labelHidden, placeholder: this.placeholder, inputLabel: this.label, identifier: this.identifier, buttonRef: element => (this.datePickerButton = element), inputRef: element => (this.datePickerInput = element), accessibleActiveDescendant: this.accessibleActiveDescendant, accessibleControls: this.accessibleControls, accessibleOwns: this.accessibleOwns, accessibleDescribedBy: this.accessibleDescribedBy, echoPlaceholder: this.echoPlaceholder, caption: this.caption })), h$1("div", { class: {
|
|
803
|
+
"duet-theme-turva": this.theme === "turva",
|
|
804
|
+
"duet-date-dialog": true,
|
|
805
|
+
left: this.direction === "left",
|
|
806
|
+
error: !!this.error,
|
|
807
|
+
active: this.open,
|
|
808
|
+
}, role: "dialog", "aria-modal": "true", "aria-hidden": this.open ? "false" : "true", "aria-labelledby": this.dialogLabelId, onTouchMove: this.handleTouchMove, onTouchStart: this.handleTouchStart, onTouchEnd: this.handleTouchEnd }, h$1(FocusGuard, { moveFocusTo: this.focusedDayNode }), h$1("div", { class: "duet-date-dialog-wrapper", onKeyDown: this.handleEscKey, ref: element => (this.dialogWrapperNode = element) }, h$1("duet-visually-hidden", { "aria-live": "polite" }, text.keyboardInstruction), h$1("div", { class: "duet-date-dialog-mobile-header" }, h$1("duet-label", { margin: "none" }, this.label), h$1("button", { class: "duet-date-picker-close", ref: element => (this.closeButtonNode = element), onClick: () => this.hide(), type: "button" }, h$1("duet-icon", { name: "navigation-close-small", margin: "none", color: "currentColor", size: "xx-small" }), h$1("duet-visually-hidden", null, text.closeLabel))), h$1("div", { class: "duet-date-dialog-header" }, h$1("div", { class: "duet-date-dialog-dropdowns" }, h$1("duet-visually-hidden", null, h$1("h2", { id: this.dialogLabelId, "aria-live": "polite", "aria-atomic": "true" }, text.monthLabels[focusedMonth], " ", this.focusedDay.getFullYear())), h$1("duet-visually-hidden", null, h$1("label", { htmlFor: this.monthSelectId }, text.monthSelectLabel)), h$1("div", { class: "duet-date-dialog-select" }, h$1("select", { id: this.monthSelectId, class: "duet-date-month-select", ref: element => (this.monthSelectNode = element), onChange: this.handleMonthSelect }, text.monthLabels.map((month, i) => (h$1("option", { key: month, value: i, selected: i === focusedMonth, disabled: !inRange(new Date(focusedYear, i, 1), minDate ? startOfMonth(minDate) : null, maxDate ? endOfMonth(maxDate) : null) }, month)))), h$1("div", { class: "duet-date-dialog-select-label", "aria-hidden": "true" }, h$1("span", null, text.monthLabelsShort[focusedMonth]), h$1("duet-icon", { name: "action-arrow-down-small", color: "currentColor", margin: "none", size: "xxx-small" }))), h$1("duet-visually-hidden", null, h$1("label", { htmlFor: this.yearSelectId }, text.yearSelectLabel)), h$1("div", { class: "duet-date-dialog-select" }, h$1("select", { id: this.yearSelectId, class: "duet-date-year-select", onChange: this.handleYearSelect }, range(minYear, maxYear).map(year => (h$1("option", { key: year, selected: year === focusedYear }, year)))), h$1("div", { class: "duet-date-dialog-select-label", "aria-hidden": "true" }, h$1("span", null, this.focusedDay.getFullYear()), h$1("duet-icon", { name: "action-arrow-down-small", color: "currentColor", margin: "none", size: "xxx-small" })))), h$1("div", { class: "duet-date-dialog-buttons" }, h$1("duet-action-button", { class: "duet-date-dialog-prev", onClick: this.handlePreviousMonthClick, disabled: prevMonthDisabled, "icon-name": "action-arrow-left-small" }, text.prevMonthLabel), h$1("duet-action-button", { class: "duet-date-dialog-next", onClick: this.handleNextMonthClick, disabled: nextMonthDisabled, "icon-name": "action-arrow-right-small" }, text.nextMonthLabel))), h$1(DatePickerMonth, { selectedDate: valueAsDate, focusedDate: this.focusedDay, onDateSelect: this.handleDaySelect, onKeyboardNavigation: this.handleKeyboardNavigation, labelledById: this.dialogLabelId, language: this.language, theme: this.theme, min: minDate, max: maxDate, focusedDayRef: element => (this.focusedDayNode = element), onFocusEnter: this.enableActiveFocus, onFocusExit: this.disableActiveFocus })), h$1(FocusGuard, { moveFocusTo: this.closeButtonNode }))));
|
|
809
|
+
}
|
|
810
|
+
get element() { return this; }
|
|
811
|
+
static get watchers() { return {
|
|
812
|
+
"min": ["updateValidity"],
|
|
813
|
+
"max": ["updateValidity"],
|
|
814
|
+
"value": ["updateValidity", "updateInternalValue"],
|
|
815
|
+
"required": ["updateValidity"]
|
|
816
|
+
}; }
|
|
817
|
+
static get style() { return duetDatePickerCss; }
|
|
818
|
+
}, [2, "duet-date-picker", {
|
|
819
|
+
"theme": [1025],
|
|
820
|
+
"expand": [4],
|
|
821
|
+
"name": [1],
|
|
822
|
+
"identifier": [1],
|
|
823
|
+
"label": [1],
|
|
824
|
+
"caption": [1],
|
|
825
|
+
"margin": [1],
|
|
826
|
+
"language": [1],
|
|
827
|
+
"placeholderDefaults": [1, "placeholder-default"],
|
|
828
|
+
"placeholder": [1],
|
|
829
|
+
"echoPlaceholder": [1540, "echo-placeholder"],
|
|
830
|
+
"disabled": [516],
|
|
831
|
+
"error": [1],
|
|
832
|
+
"labelHidden": [4, "label-hidden"],
|
|
833
|
+
"role": [1],
|
|
834
|
+
"accessibleActiveDescendant": [1, "accessible-active-descendant"],
|
|
835
|
+
"accessibleControls": [1, "accessible-controls"],
|
|
836
|
+
"accessibleOwns": [1, "accessible-owns"],
|
|
837
|
+
"accessibleDescribedBy": [1, "accessible-described-by"],
|
|
838
|
+
"required": [4],
|
|
839
|
+
"direction": [1],
|
|
840
|
+
"tooltip": [1],
|
|
841
|
+
"tooltipDirection": [1, "tooltip-direction"],
|
|
842
|
+
"value": [1537],
|
|
843
|
+
"min": [1],
|
|
844
|
+
"max": [1],
|
|
845
|
+
"incrementYears": [2, "increment"],
|
|
846
|
+
"validity": [1040],
|
|
847
|
+
"open": [32],
|
|
848
|
+
"focusedDay": [32],
|
|
849
|
+
"inputValue": [32],
|
|
850
|
+
"setFocus": [64],
|
|
851
|
+
"show": [64],
|
|
852
|
+
"hide": [64]
|
|
853
|
+
}, [[4, "click", "handleDocumentClick"]]]);
|
|
854
|
+
function defineCustomElement$1() {
|
|
855
|
+
if (typeof customElements === "undefined") {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
const components = ["duet-date-picker", "duet-action-button", "duet-caption", "duet-icon", "duet-input", "duet-label", "duet-tooltip", "duet-visually-hidden"];
|
|
859
|
+
components.forEach(tagName => { switch (tagName) {
|
|
860
|
+
case "duet-date-picker":
|
|
861
|
+
if (!customElements.get(tagName)) {
|
|
862
|
+
customElements.define(tagName, DuetDatePicker$1);
|
|
863
|
+
}
|
|
864
|
+
break;
|
|
865
|
+
case "duet-action-button":
|
|
866
|
+
if (!customElements.get(tagName)) {
|
|
867
|
+
defineCustomElement$8();
|
|
868
|
+
}
|
|
869
|
+
break;
|
|
870
|
+
case "duet-caption":
|
|
871
|
+
if (!customElements.get(tagName)) {
|
|
872
|
+
defineCustomElement$7();
|
|
873
|
+
}
|
|
874
|
+
break;
|
|
875
|
+
case "duet-icon":
|
|
876
|
+
if (!customElements.get(tagName)) {
|
|
877
|
+
defineCustomElement$6();
|
|
878
|
+
}
|
|
879
|
+
break;
|
|
880
|
+
case "duet-input":
|
|
881
|
+
if (!customElements.get(tagName)) {
|
|
882
|
+
defineCustomElement$5();
|
|
883
|
+
}
|
|
884
|
+
break;
|
|
885
|
+
case "duet-label":
|
|
886
|
+
if (!customElements.get(tagName)) {
|
|
887
|
+
defineCustomElement$4();
|
|
888
|
+
}
|
|
889
|
+
break;
|
|
890
|
+
case "duet-tooltip":
|
|
891
|
+
if (!customElements.get(tagName)) {
|
|
892
|
+
defineCustomElement$3();
|
|
893
|
+
}
|
|
894
|
+
break;
|
|
895
|
+
case "duet-visually-hidden":
|
|
896
|
+
if (!customElements.get(tagName)) {
|
|
897
|
+
defineCustomElement$2();
|
|
898
|
+
}
|
|
899
|
+
break;
|
|
900
|
+
} });
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
const DuetDatePicker = DuetDatePicker$1;
|
|
904
|
+
const defineCustomElement = defineCustomElement$1;
|
|
905
|
+
|
|
906
|
+
export { DuetDatePicker, defineCustomElement };
|