@pine-ds/core 4.10.0 → 4.12.0
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/components/aria-references.js +1 -0
- package/components/attributes.js +1 -1
- package/components/index2.js +1 -1
- package/components/pds-alert.js +1 -1
- package/components/pds-avatar.js +1 -1
- package/components/pds-box2.js +1 -1
- package/components/pds-button2.js +1 -1
- package/components/pds-checkbox2.js +1 -1
- package/components/pds-chip2.js +1 -1
- package/components/pds-combobox.js +2 -2
- package/components/pds-copytext.js +1 -1
- package/components/pds-datepicker.js +1 -1
- package/components/pds-drawer-content.js +1 -1
- package/components/pds-drawer-footer.js +1 -1
- package/components/pds-drawer-header.js +1 -1
- package/components/pds-drawer.js +1 -1
- package/components/pds-dropdown-menu-item.js +1 -1
- package/components/pds-dropdown-menu-separator.js +1 -1
- package/components/pds-dropdown-menu.js +1 -1
- package/components/pds-filter.js +1 -1
- package/components/pds-image.js +1 -1
- package/components/pds-input2.js +1 -1
- package/components/pds-link2.js +1 -1
- package/components/pds-loader2.js +1 -1
- package/components/pds-modal-footer.js +1 -1
- package/components/pds-modal-header.js +1 -1
- package/components/pds-modal2.js +1 -1
- package/components/pds-multiselect.js +1 -1
- package/components/pds-popover.js +1 -1
- package/components/pds-progress.js +1 -1
- package/components/pds-radio-group.js +1 -1
- package/components/pds-radio.js +1 -1
- package/components/pds-select.js +1 -1
- package/components/pds-sortable-item.js +1 -1
- package/components/pds-sortable.js +2 -2
- package/components/pds-switch.js +1 -1
- package/components/pds-table-body.js +1 -1
- package/components/pds-table-cell2.js +1 -1
- package/components/pds-table-head-cell2.js +1 -1
- package/components/pds-table-head.js +1 -1
- package/components/pds-table-row.js +1 -1
- package/components/pds-table.js +1 -1
- package/components/pds-tabs.js +1 -1
- package/components/pds-text2.js +1 -1
- package/components/pds-textarea.js +1 -1
- package/components/pds-toast.js +1 -1
- package/components/pds-tooltip.js +1 -1
- package/components/sortable-label.js +1 -0
- package/components/truncation-tooltip.js +1 -1
- package/dist/cjs/aria-references-CUmqibnO.js +54 -0
- package/dist/cjs/{attributes-CW49XqaL.js → attributes-Cgbkw6gO.js} +3 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pds-alert.cjs.entry.js +2 -2
- package/dist/cjs/pds-avatar.cjs.entry.js +3 -2
- package/dist/cjs/pds-box.cjs.entry.js +4 -3
- package/dist/cjs/pds-button.cjs.entry.js +25 -45
- package/dist/cjs/pds-checkbox.cjs.entry.js +4 -4
- package/dist/cjs/pds-chip.cjs.entry.js +3 -3
- package/dist/cjs/pds-combobox.cjs.entry.js +246 -106
- package/dist/cjs/pds-copytext.cjs.entry.js +3 -3
- package/dist/cjs/pds-datepicker.cjs.entry.js +295 -82
- package/dist/cjs/pds-drawer-content.cjs.entry.js +1 -1
- package/dist/cjs/pds-drawer-footer.cjs.entry.js +1 -1
- package/dist/cjs/pds-drawer-header.cjs.entry.js +1 -1
- package/dist/cjs/pds-drawer.cjs.entry.js +5 -7
- package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +85 -49
- package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js +2 -2
- package/dist/cjs/pds-dropdown-menu.cjs.entry.js +83 -10
- package/dist/cjs/pds-filter.cjs.entry.js +24 -2
- package/dist/cjs/pds-image.cjs.entry.js +148 -6
- package/dist/cjs/pds-input.cjs.entry.js +4 -4
- package/dist/cjs/pds-link.cjs.entry.js +4 -5
- package/dist/cjs/pds-loader.cjs.entry.js +4 -3
- package/dist/cjs/pds-modal-footer.cjs.entry.js +1 -1
- package/dist/cjs/pds-modal-header.cjs.entry.js +1 -1
- package/dist/cjs/pds-modal.cjs.entry.js +9 -12
- package/dist/cjs/pds-multiselect.cjs.entry.js +64 -18
- package/dist/cjs/pds-popover.cjs.entry.js +8 -6
- package/dist/cjs/pds-progress.cjs.entry.js +3 -3
- package/dist/cjs/pds-radio-group.cjs.entry.js +4 -4
- package/dist/cjs/pds-radio.cjs.entry.js +6 -6
- package/dist/cjs/pds-row.cjs.entry.js +1 -1
- package/dist/cjs/pds-select.cjs.entry.js +2 -2
- package/dist/cjs/pds-sortable-item.cjs.entry.js +28 -5
- package/dist/cjs/pds-sortable.cjs.entry.js +356 -4
- package/dist/cjs/pds-switch.cjs.entry.js +92 -15
- package/dist/cjs/pds-tab.cjs.entry.js +1 -1
- package/dist/cjs/pds-table-body.cjs.entry.js +1 -1
- package/dist/cjs/pds-table-cell.cjs.entry.js +24 -5
- package/dist/cjs/pds-table-head-cell.cjs.entry.js +59 -11
- package/dist/cjs/pds-table-head.cjs.entry.js +1 -1
- package/dist/cjs/pds-table-row.cjs.entry.js +1 -1
- package/dist/cjs/pds-table.cjs.entry.js +260 -5
- package/dist/cjs/pds-tabpanel.cjs.entry.js +1 -1
- package/dist/cjs/pds-tabs.cjs.entry.js +3 -3
- package/dist/cjs/pds-text.cjs.entry.js +5 -3
- package/dist/cjs/pds-textarea.cjs.entry.js +8 -7
- package/dist/cjs/pds-toast.cjs.entry.js +8 -4
- package/dist/cjs/pds-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/pine-core.cjs.js +1 -1
- package/dist/cjs/sortable-label-DOcJrHvA.js +37 -0
- package/dist/cjs/{truncation-tooltip-Bikp7n9I.js → truncation-tooltip-CM5HgRHh.js} +69 -0
- package/dist/collection/components/pds-alert/pds-alert.css +0 -3
- package/dist/collection/components/pds-alert/pds-alert.js +3 -2
- package/dist/collection/components/pds-avatar/pds-avatar.js +7 -6
- package/dist/collection/components/pds-avatar/stories/pds-avatar.stories.js +1 -1
- package/dist/collection/components/pds-box/pds-box.css +1273 -1189
- package/dist/collection/components/pds-box/pds-box.js +180 -156
- package/dist/collection/components/pds-box/stories/pds-box.stories.js +79 -37
- package/dist/collection/components/pds-button/pds-button.js +26 -4
- package/dist/collection/components/pds-button/stories/pds-button.stories.js +25 -11
- package/dist/collection/components/pds-checkbox/pds-checkbox.js +10 -10
- package/dist/collection/components/pds-chip/pds-chip.js +3 -3
- package/dist/collection/components/pds-combobox/pds-combobox.css +162 -53
- package/dist/collection/components/pds-combobox/pds-combobox.js +261 -121
- package/dist/collection/components/pds-combobox/stories/pds-combobox.stories.js +35 -4
- package/dist/collection/components/pds-copytext/pds-copytext.js +2 -2
- package/dist/collection/components/pds-datepicker/date-utils.js +42 -0
- package/dist/collection/components/pds-datepicker/pds-datepicker.js +164 -65
- package/dist/collection/components/pds-datepicker/presets.js +42 -7
- package/dist/collection/components/pds-datepicker/stories/pds-datepicker.stories.js +11 -0
- package/dist/collection/components/pds-datepicker/value.js +76 -18
- package/dist/collection/components/pds-drawer/pds-drawer-content/pds-drawer-content.js +2 -5
- package/dist/collection/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.js +2 -1
- package/dist/collection/components/pds-drawer/pds-drawer-header/pds-drawer-header.js +2 -1
- package/dist/collection/components/pds-drawer/pds-drawer.js +8 -10
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.css +17 -8
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.js +95 -62
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.js +3 -3
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.css +2 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js +84 -9
- package/dist/collection/components/pds-dropdown-menu/stories/pds-dropdown-menu.stories.js +24 -1
- package/dist/collection/components/pds-filters/pds-filter/pds-filter.css +2 -1
- package/dist/collection/components/pds-filters/pds-filter/pds-filter.js +24 -7
- package/dist/collection/components/pds-image/image-interface.js +1 -0
- package/dist/collection/components/pds-image/pds-image.css +11 -0
- package/dist/collection/components/pds-image/pds-image.js +249 -8
- package/dist/collection/components/pds-image/stories/pds-image.stories.js +117 -1
- package/dist/collection/components/pds-input/pds-input.js +14 -9
- package/dist/collection/components/pds-link/pds-link.js +10 -14
- package/dist/collection/components/pds-link/stories/pds-link.stories.js +6 -2
- package/dist/collection/components/pds-loader/pds-loader.js +5 -4
- package/dist/collection/components/pds-modal/pds-modal-footer/pds-modal-footer.js +2 -1
- package/dist/collection/components/pds-modal/pds-modal-header/pds-modal-header.js +2 -1
- package/dist/collection/components/pds-modal/pds-modal.js +11 -13
- package/dist/collection/components/pds-modal/stories/pds-modal.stories.js +7 -7
- package/dist/collection/components/pds-multiselect/pds-multiselect.css +2 -2
- package/dist/collection/components/pds-multiselect/pds-multiselect.js +63 -18
- package/dist/collection/components/pds-popover/pds-popover.css +1 -1
- package/dist/collection/components/pds-popover/pds-popover.js +9 -7
- package/dist/collection/components/pds-progress/pds-progress.js +4 -4
- package/dist/collection/components/pds-radio/pds-radio.css +5 -1
- package/dist/collection/components/pds-radio/pds-radio.js +9 -9
- package/dist/collection/components/pds-radio/stories/pds-radio.stories.js +9 -9
- package/dist/collection/components/pds-radio-group/pds-radio-group.js +7 -7
- package/dist/collection/components/pds-radio-group/stories/pds-radio-group.stories.js +3 -3
- package/dist/collection/components/pds-row/stories/pds-row.stories.js +15 -14
- package/dist/collection/components/pds-select/pds-select.js +7 -4
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.css +38 -0
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.js +47 -5
- package/dist/collection/components/pds-sortable/pds-sortable.js +481 -5
- package/dist/collection/components/pds-sortable/sortable-label.js +33 -0
- package/dist/collection/components/pds-sortable/stories/pds-sortable.stories.js +27 -0
- package/dist/collection/components/pds-switch/pds-switch.js +114 -17
- package/dist/collection/components/pds-switch/stories/pds-switch.stories.js +79 -0
- package/dist/collection/components/pds-table/pds-table-body/pds-table-body.js +4 -1
- package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.js +47 -4
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js +6 -2
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.css +11 -0
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +98 -10
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js +5 -1
- package/dist/collection/components/pds-table/pds-table.css +8 -0
- package/dist/collection/components/pds-table/pds-table.js +295 -7
- package/dist/collection/components/pds-table/stories/pds-table.stories.js +131 -6
- package/dist/collection/components/pds-tabs/pds-tabs.js +3 -3
- package/dist/collection/components/pds-tabs/stories/pds-tabs.stories.js +1 -1
- package/dist/collection/components/pds-text/pds-text.js +5 -3
- package/dist/collection/components/pds-textarea/pds-textarea.js +16 -14
- package/dist/collection/components/pds-textarea/stories/pds-textarea.stories.js +2 -13
- package/dist/collection/components/pds-toast/pds-toast.css +4 -3
- package/dist/collection/components/pds-toast/pds-toast.js +9 -5
- package/dist/collection/components/pds-toast/stories/pds-toast.stories.js +2 -2
- package/dist/collection/components/pds-tooltip/pds-tooltip.css +2 -1
- package/dist/collection/components/pds-tooltip/stories/pds-tooltip.stories.js +17 -17
- package/dist/collection/utils/aria-references.js +9 -3
- package/dist/collection/utils/truncation-tooltip.js +67 -0
- package/dist/docs.json +1150 -371
- package/dist/esm/aria-references-CNn1lObg.js +50 -0
- package/dist/esm/{attributes-DkeVeN0g.js → attributes-CD8knu3a.js} +3 -0
- package/dist/esm/{index-DvN3tyZp.js → index-B0DXTeeV.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pds-accordion.entry.js +1 -1
- package/dist/esm/pds-alert.entry.js +2 -2
- package/dist/esm/pds-avatar.entry.js +4 -3
- package/dist/esm/pds-box.entry.js +4 -3
- package/dist/esm/pds-button.entry.js +24 -44
- package/dist/esm/pds-checkbox.entry.js +5 -5
- package/dist/esm/pds-chip.entry.js +4 -4
- package/dist/esm/pds-combobox.entry.js +246 -106
- package/dist/esm/pds-copytext.entry.js +4 -4
- package/dist/esm/pds-datepicker.entry.js +296 -83
- package/dist/esm/pds-drawer-content.entry.js +1 -1
- package/dist/esm/pds-drawer-footer.entry.js +1 -1
- package/dist/esm/pds-drawer-header.entry.js +1 -1
- package/dist/esm/pds-drawer.entry.js +5 -7
- package/dist/esm/pds-dropdown-menu-item.entry.js +85 -49
- package/dist/esm/pds-dropdown-menu-separator.entry.js +2 -2
- package/dist/esm/pds-dropdown-menu.entry.js +84 -11
- package/dist/esm/pds-filter.entry.js +25 -3
- package/dist/esm/pds-image.entry.js +149 -7
- package/dist/esm/pds-input.entry.js +5 -5
- package/dist/esm/pds-link.entry.js +5 -6
- package/dist/esm/pds-loader.entry.js +4 -3
- package/dist/esm/pds-modal-footer.entry.js +1 -1
- package/dist/esm/pds-modal-header.entry.js +1 -1
- package/dist/esm/pds-modal.entry.js +9 -12
- package/dist/esm/pds-multiselect.entry.js +65 -19
- package/dist/esm/pds-popover.entry.js +8 -6
- package/dist/esm/pds-progress.entry.js +3 -3
- package/dist/esm/pds-radio-group.entry.js +5 -5
- package/dist/esm/pds-radio.entry.js +7 -7
- package/dist/esm/pds-row.entry.js +1 -1
- package/dist/esm/pds-select.entry.js +3 -3
- package/dist/esm/pds-sortable-item.entry.js +29 -6
- package/dist/esm/pds-sortable.entry.js +357 -5
- package/dist/esm/pds-switch.entry.js +94 -17
- package/dist/esm/pds-tab.entry.js +1 -1
- package/dist/esm/pds-table-body.entry.js +1 -1
- package/dist/esm/pds-table-cell.entry.js +24 -5
- package/dist/esm/pds-table-head-cell.entry.js +60 -12
- package/dist/esm/pds-table-head.entry.js +1 -1
- package/dist/esm/pds-table-row.entry.js +1 -1
- package/dist/esm/pds-table.entry.js +261 -6
- package/dist/esm/pds-tabpanel.entry.js +1 -1
- package/dist/esm/pds-tabs.entry.js +3 -3
- package/dist/esm/pds-text.entry.js +5 -3
- package/dist/esm/pds-textarea.entry.js +9 -8
- package/dist/esm/pds-toast.entry.js +8 -4
- package/dist/esm/pds-tooltip.entry.js +1 -1
- package/dist/esm/pine-core.js +1 -1
- package/dist/esm/sortable-label-PItnzVVR.js +35 -0
- package/dist/esm/{truncation-tooltip-DBcPipr9.js → truncation-tooltip-CkIWm6Z-.js} +68 -1
- package/dist/esm-es5/aria-references-CNn1lObg.js +1 -0
- package/dist/esm-es5/{attributes-DkeVeN0g.js → attributes-CD8knu3a.js} +1 -1
- package/dist/esm-es5/{index-DvN3tyZp.js → index-B0DXTeeV.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/pds-accordion.entry.js +1 -1
- package/dist/esm-es5/pds-alert.entry.js +1 -1
- package/dist/esm-es5/pds-avatar.entry.js +1 -1
- package/dist/esm-es5/pds-box.entry.js +1 -1
- package/dist/esm-es5/pds-button.entry.js +1 -1
- package/dist/esm-es5/pds-checkbox.entry.js +1 -1
- package/dist/esm-es5/pds-chip.entry.js +1 -1
- package/dist/esm-es5/pds-combobox.entry.js +1 -1
- package/dist/esm-es5/pds-copytext.entry.js +1 -1
- package/dist/esm-es5/pds-datepicker.entry.js +1 -1
- package/dist/esm-es5/pds-drawer-content.entry.js +1 -1
- package/dist/esm-es5/pds-drawer-footer.entry.js +1 -1
- package/dist/esm-es5/pds-drawer-header.entry.js +1 -1
- package/dist/esm-es5/pds-drawer.entry.js +1 -1
- package/dist/esm-es5/pds-dropdown-menu-item.entry.js +1 -1
- package/dist/esm-es5/pds-dropdown-menu-separator.entry.js +1 -1
- package/dist/esm-es5/pds-dropdown-menu.entry.js +1 -1
- package/dist/esm-es5/pds-filter.entry.js +1 -1
- package/dist/esm-es5/pds-image.entry.js +1 -1
- package/dist/esm-es5/pds-input.entry.js +1 -1
- package/dist/esm-es5/pds-link.entry.js +1 -1
- package/dist/esm-es5/pds-loader.entry.js +1 -1
- package/dist/esm-es5/pds-modal-footer.entry.js +1 -1
- package/dist/esm-es5/pds-modal-header.entry.js +1 -1
- package/dist/esm-es5/pds-modal.entry.js +1 -1
- package/dist/esm-es5/pds-multiselect.entry.js +1 -1
- package/dist/esm-es5/pds-popover.entry.js +1 -1
- package/dist/esm-es5/pds-progress.entry.js +1 -1
- package/dist/esm-es5/pds-radio-group.entry.js +1 -1
- package/dist/esm-es5/pds-radio.entry.js +1 -1
- package/dist/esm-es5/pds-row.entry.js +1 -1
- package/dist/esm-es5/pds-select.entry.js +1 -1
- package/dist/esm-es5/pds-sortable-item.entry.js +1 -1
- package/dist/esm-es5/pds-sortable.entry.js +2 -2
- package/dist/esm-es5/pds-switch.entry.js +1 -1
- package/dist/esm-es5/pds-tab.entry.js +1 -1
- package/dist/esm-es5/pds-table-body.entry.js +1 -1
- package/dist/esm-es5/pds-table-cell.entry.js +1 -1
- package/dist/esm-es5/pds-table-head-cell.entry.js +1 -1
- package/dist/esm-es5/pds-table-head.entry.js +1 -1
- package/dist/esm-es5/pds-table-row.entry.js +1 -1
- package/dist/esm-es5/pds-table.entry.js +1 -1
- package/dist/esm-es5/pds-tabpanel.entry.js +1 -1
- package/dist/esm-es5/pds-tabs.entry.js +1 -1
- package/dist/esm-es5/pds-text.entry.js +1 -1
- package/dist/esm-es5/pds-textarea.entry.js +1 -1
- package/dist/esm-es5/pds-toast.entry.js +1 -1
- package/dist/esm-es5/pds-tooltip.entry.js +1 -1
- package/dist/esm-es5/pine-core.js +1 -1
- package/dist/esm-es5/sortable-label-PItnzVVR.js +1 -0
- package/dist/esm-es5/truncation-tooltip-CkIWm6Z-.js +1 -0
- package/dist/pine-core/{p-f834cb07.system.entry.js → p-00891b8d.system.entry.js} +1 -1
- package/dist/pine-core/{p-3f8bd3fb.system.entry.js → p-053ff8eb.system.entry.js} +1 -1
- package/dist/pine-core/p-08b9e3ad.entry.js +1 -0
- package/dist/pine-core/{p-4d98bc0c.system.entry.js → p-0a7570dd.system.entry.js} +1 -1
- package/dist/pine-core/{p-d018dc60.system.entry.js → p-0ac4262e.system.entry.js} +1 -1
- package/dist/pine-core/{p-89d38a82.system.entry.js → p-0e1b8bd1.system.entry.js} +1 -1
- package/dist/pine-core/{p-e1d1b5d8.entry.js → p-12fdc65f.entry.js} +1 -1
- package/dist/pine-core/{p-d48fe5a0.system.entry.js → p-16fceef6.system.entry.js} +1 -1
- package/dist/pine-core/p-1765a41b.system.entry.js +1 -0
- package/dist/pine-core/{p-a594c41f.entry.js → p-18524c25.entry.js} +1 -1
- package/dist/pine-core/p-1a013a5c.system.entry.js +1 -0
- package/dist/pine-core/{p-2b9622c1.system.entry.js → p-1ab52531.system.entry.js} +1 -1
- package/dist/pine-core/p-1c584a20.entry.js +1 -0
- package/dist/pine-core/p-1edef412.entry.js +1 -0
- package/dist/pine-core/{p-5946203c.entry.js → p-1f998e3e.entry.js} +1 -1
- package/dist/pine-core/{p-39e57657.entry.js → p-1fb1ca3d.entry.js} +1 -1
- package/dist/pine-core/p-2b6becc2.entry.js +1 -0
- package/dist/pine-core/p-2cc7c682.entry.js +1 -0
- package/dist/pine-core/{p-639acef8.system.entry.js → p-2ddcd845.system.entry.js} +1 -1
- package/dist/pine-core/{p-6a1aa8d3.entry.js → p-2f15e85f.entry.js} +1 -1
- package/dist/pine-core/{p-67f795d5.system.entry.js → p-33da254f.system.entry.js} +1 -1
- package/dist/pine-core/{p-c6a9e62c.system.entry.js → p-3fc9ef80.system.entry.js} +1 -1
- package/dist/pine-core/p-4125a4a6.system.entry.js +1 -0
- package/dist/pine-core/p-47df9e9f.system.entry.js +3 -0
- package/dist/pine-core/p-51680c9c.system.entry.js +1 -0
- package/dist/pine-core/p-55535481.system.entry.js +1 -0
- package/dist/pine-core/p-55a4659a.system.entry.js +1 -0
- package/dist/pine-core/{p-c5e1eb3c.system.entry.js → p-57af5c29.system.entry.js} +1 -1
- package/dist/pine-core/p-57edd301.system.entry.js +1 -0
- package/dist/pine-core/{p-bfa34194.entry.js → p-5d582798.entry.js} +1 -1
- package/dist/pine-core/p-5db87fda.system.entry.js +1 -0
- package/dist/pine-core/{p-19cf1d91.system.entry.js → p-5eb0c78c.system.entry.js} +1 -1
- package/dist/pine-core/{p-42f70f93.system.entry.js → p-6017afb5.system.entry.js} +1 -1
- package/dist/pine-core/{p-63f85859.system.entry.js → p-60e65fe0.system.entry.js} +1 -1
- package/dist/pine-core/{p-973c3ac0.entry.js → p-627a94da.entry.js} +1 -1
- package/dist/pine-core/{p-a9d96e22.entry.js → p-68328afc.entry.js} +1 -1
- package/dist/pine-core/{p-bd7dc317.system.entry.js → p-72668673.system.entry.js} +1 -1
- package/dist/pine-core/p-72ff5ad2.system.entry.js +1 -0
- package/dist/pine-core/p-736ea7dd.entry.js +7 -0
- package/dist/pine-core/p-765f4207.entry.js +1 -0
- package/dist/pine-core/{p-2a18852f.entry.js → p-77530cf2.entry.js} +1 -1
- package/dist/pine-core/p-77a22399.entry.js +1 -0
- package/dist/pine-core/p-783127bf.entry.js +1 -0
- package/dist/pine-core/{p-d9719e37.entry.js → p-82f7eed1.entry.js} +1 -1
- package/dist/pine-core/{p-124a0a24.entry.js → p-84d4ae26.entry.js} +1 -1
- package/dist/pine-core/p-8deeda07.entry.js +1 -0
- package/dist/pine-core/{p-849ec281.system.entry.js → p-8e17a6d8.system.entry.js} +1 -1
- package/dist/pine-core/p-8e7e7bba.entry.js +1 -0
- package/dist/pine-core/{p-e82f758f.system.entry.js → p-907c69e9.system.entry.js} +1 -1
- package/dist/pine-core/{p-1415c988.system.entry.js → p-90f83a5b.system.entry.js} +1 -1
- package/dist/pine-core/p-97145eee.system.entry.js +1 -0
- package/dist/pine-core/{p-a09c9c5e.system.entry.js → p-9d983e09.system.entry.js} +1 -1
- package/dist/pine-core/{p-1e3ef425.entry.js → p-9e005996.entry.js} +1 -1
- package/dist/pine-core/{p-DvN3tyZp.js → p-B0DXTeeV.js} +1 -1
- package/dist/pine-core/{p-CNXspDYs.system.js → p-BlJQebvG.system.js} +1 -1
- package/dist/pine-core/p-C35-349-.system.js +1 -0
- package/dist/pine-core/{p-vFsJv75D.system.js → p-CIe1DGXa.system.js} +1 -1
- package/dist/pine-core/p-CNn1lObg.js +1 -0
- package/dist/pine-core/p-CQJ44c6o.system.js +1 -0
- package/dist/pine-core/p-Dv9QBmIF.js +1 -0
- package/dist/pine-core/p-PItnzVVR.js +1 -0
- package/dist/pine-core/p-VPGVqK3P.system.js +1 -0
- package/dist/pine-core/p-XK45dzWR.system.js +1 -1
- package/dist/pine-core/p-a149af29.entry.js +1 -0
- package/dist/pine-core/p-a20d9eca.system.entry.js +1 -0
- package/dist/pine-core/{p-f6f4fd42.entry.js → p-a5782d99.entry.js} +1 -1
- package/dist/pine-core/p-a5e9c583.entry.js +1 -0
- package/dist/pine-core/{p-4d47023c.system.entry.js → p-a9eaf160.system.entry.js} +1 -1
- package/dist/pine-core/{p-143b33a6.entry.js → p-b00b07e3.entry.js} +1 -1
- package/dist/pine-core/{p-c7a53c4f.entry.js → p-b7b29392.entry.js} +1 -1
- package/dist/pine-core/p-b96bdff6.entry.js +1 -0
- package/dist/pine-core/{p-f71d71ca.entry.js → p-bbd9ab75.entry.js} +1 -1
- package/dist/pine-core/p-bdab6c9f.entry.js +1 -0
- package/dist/pine-core/p-biShcgLI.js +1 -0
- package/dist/pine-core/{p-548bce53.system.entry.js → p-c12b5cd7.system.entry.js} +1 -1
- package/dist/pine-core/p-c1dc7692.entry.js +1 -0
- package/dist/pine-core/p-c76d8b9e.system.entry.js +1 -0
- package/dist/pine-core/{p-590df41a.entry.js → p-c89ea2d3.entry.js} +1 -1
- package/dist/pine-core/{p-d920d759.system.entry.js → p-c9630934.system.entry.js} +1 -1
- package/dist/pine-core/{p-6f4ab1ea.system.entry.js → p-cb9227f6.system.entry.js} +1 -1
- package/dist/pine-core/p-ceef0eb1.entry.js +1 -0
- package/dist/pine-core/p-d1283e8d.entry.js +1 -0
- package/dist/pine-core/p-d676926d.system.entry.js +1 -0
- package/dist/pine-core/{p-61cfdbb2.entry.js → p-d7d7a4e1.entry.js} +1 -1
- package/dist/pine-core/p-d85d50cb.entry.js +1 -0
- package/dist/pine-core/p-daa802f1.entry.js +2 -0
- package/dist/pine-core/p-ddf4b9b5.system.entry.js +1 -0
- package/dist/pine-core/p-de3b319e.system.entry.js +8 -0
- package/dist/pine-core/{p-cb9baf78.system.entry.js → p-e00777da.system.entry.js} +1 -1
- package/dist/pine-core/p-e2541eeb.entry.js +1 -0
- package/dist/pine-core/{p-01f1cdaf.system.entry.js → p-e2a1a49a.system.entry.js} +1 -1
- package/dist/pine-core/p-e4ebea88.system.entry.js +1 -0
- package/dist/pine-core/{p-947582e1.entry.js → p-e554bd64.entry.js} +1 -1
- package/dist/pine-core/{p-dd7ded84.entry.js → p-e6427c87.entry.js} +1 -1
- package/dist/pine-core/{p-50ddadbf.entry.js → p-e72e8b8f.entry.js} +1 -1
- package/dist/pine-core/p-e92d0f0f.system.entry.js +1 -0
- package/dist/pine-core/{p-9b32727a.system.entry.js → p-eab165b9.system.entry.js} +1 -1
- package/dist/pine-core/p-eabc4bd8.entry.js +1 -0
- package/dist/pine-core/p-ef9f84f2.system.entry.js +1 -0
- package/dist/pine-core/{p-c9ae7964.entry.js → p-f026af73.entry.js} +1 -1
- package/dist/pine-core/{p-99530cb5.entry.js → p-f0509c8e.entry.js} +1 -1
- package/dist/pine-core/p-f1252e72.system.entry.js +1 -0
- package/dist/pine-core/p-f3496fd1.entry.js +1 -0
- package/dist/pine-core/{p-eecd9ad8.system.entry.js → p-f90f4be7.system.entry.js} +1 -1
- package/dist/pine-core/p-f9bdaadd.system.entry.js +1 -0
- package/dist/pine-core/{p-128c04e7.entry.js → p-fda791df.entry.js} +1 -1
- package/dist/pine-core/p-fea4296d.entry.js +1 -0
- package/dist/pine-core/pine-core.esm.js +1 -1
- package/dist/types/components/pds-alert/pds-alert.d.ts +2 -1
- package/dist/types/components/pds-avatar/pds-avatar.d.ts +5 -4
- package/dist/types/components/pds-box/pds-box.d.ts +68 -57
- package/dist/types/components/pds-button/pds-button.d.ts +14 -3
- package/dist/types/components/pds-checkbox/pds-checkbox.d.ts +15 -8
- package/dist/types/components/pds-chip/pds-chip.d.ts +2 -2
- package/dist/types/components/pds-combobox/pds-combobox.d.ts +48 -11
- package/dist/types/components/pds-copytext/pds-copytext.d.ts +3 -1
- package/dist/types/components/pds-datepicker/date-utils.d.ts +19 -0
- package/dist/types/components/pds-datepicker/datepicker-interface.d.ts +22 -5
- package/dist/types/components/pds-datepicker/pds-datepicker.d.ts +33 -7
- package/dist/types/components/pds-datepicker/presets.d.ts +3 -2
- package/dist/types/components/pds-datepicker/value.d.ts +14 -2
- package/dist/types/components/pds-drawer/pds-drawer-content/pds-drawer-content.d.ts +1 -4
- package/dist/types/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.d.ts +1 -0
- package/dist/types/components/pds-drawer/pds-drawer-header/pds-drawer-header.d.ts +1 -0
- package/dist/types/components/pds-drawer/pds-drawer.d.ts +4 -6
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.d.ts +20 -16
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.d.ts +1 -1
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu.d.ts +7 -0
- package/dist/types/components/pds-filters/pds-filter/pds-filter.d.ts +6 -5
- package/dist/types/components/pds-image/image-interface.d.ts +12 -0
- package/dist/types/components/pds-image/pds-image.d.ts +69 -9
- package/dist/types/components/pds-input/pds-input.d.ts +17 -7
- package/dist/types/components/pds-link/pds-link.d.ts +8 -8
- package/dist/types/components/pds-loader/pds-loader.d.ts +3 -2
- package/dist/types/components/pds-modal/pds-modal-footer/pds-modal-footer.d.ts +1 -0
- package/dist/types/components/pds-modal/pds-modal-header/pds-modal-header.d.ts +1 -0
- package/dist/types/components/pds-modal/pds-modal.d.ts +7 -9
- package/dist/types/components/pds-multiselect/pds-multiselect.d.ts +14 -8
- package/dist/types/components/pds-popover/pds-popover.d.ts +2 -2
- package/dist/types/components/pds-progress/pds-progress.d.ts +2 -2
- package/dist/types/components/pds-radio/pds-radio.d.ts +6 -5
- package/dist/types/components/pds-radio-group/pds-radio-group.d.ts +5 -4
- package/dist/types/components/pds-select/pds-select.d.ts +9 -3
- package/dist/types/components/pds-sortable/pds-sortable-item/pds-sortable-item.d.ts +8 -2
- package/dist/types/components/pds-sortable/pds-sortable.d.ts +82 -1
- package/dist/types/components/pds-sortable/sortable-label.d.ts +7 -0
- package/dist/types/components/pds-switch/pds-switch.d.ts +17 -2
- package/dist/types/components/pds-table/pds-table-body/pds-table-body.d.ts +3 -0
- package/dist/types/components/pds-table/pds-table-cell/pds-table-cell.d.ts +10 -0
- package/dist/types/components/pds-table/pds-table-head/pds-table-head.d.ts +5 -1
- package/dist/types/components/pds-table/pds-table-head-cell/pds-table-head-cell.d.ts +21 -0
- package/dist/types/components/pds-table/pds-table-row/pds-table-row.d.ts +4 -0
- package/dist/types/components/pds-table/pds-table.d.ts +76 -2
- package/dist/types/components/pds-tabs/pds-tabs.d.ts +1 -1
- package/dist/types/components/pds-textarea/pds-textarea.d.ts +15 -13
- package/dist/types/components/pds-toast/pds-toast.d.ts +5 -1
- package/dist/types/components.d.ts +505 -335
- package/dist/types/utils/aria-references.d.ts +4 -0
- package/dist/types/utils/truncation-tooltip.d.ts +39 -0
- package/dist/types/utils/types.d.ts +3 -0
- package/dist/vscode.html-data.json +350 -137
- package/hydrate/index.js +2054 -427
- package/hydrate/index.mjs +2054 -427
- package/package.json +3 -3
- package/readme.md +26 -55
- package/dist/esm-es5/truncation-tooltip-DBcPipr9.js +0 -1
- package/dist/pine-core/p-07323107.entry.js +0 -1
- package/dist/pine-core/p-08b8e941.entry.js +0 -1
- package/dist/pine-core/p-0b7b3fc2.system.entry.js +0 -3
- package/dist/pine-core/p-0d5f0ab5.system.entry.js +0 -1
- package/dist/pine-core/p-14dedf01.system.entry.js +0 -1
- package/dist/pine-core/p-1ca8d183.entry.js +0 -1
- package/dist/pine-core/p-1f62bb71.entry.js +0 -7
- package/dist/pine-core/p-2dd30d12.entry.js +0 -1
- package/dist/pine-core/p-35s7h-dk.js +0 -1
- package/dist/pine-core/p-3610cb3b.entry.js +0 -1
- package/dist/pine-core/p-39276663.entry.js +0 -1
- package/dist/pine-core/p-3a1dc752.system.entry.js +0 -1
- package/dist/pine-core/p-42d43c3f.system.entry.js +0 -1
- package/dist/pine-core/p-4a90b9c8.system.entry.js +0 -1
- package/dist/pine-core/p-4cfe922b.entry.js +0 -1
- package/dist/pine-core/p-5f181694.system.entry.js +0 -1
- package/dist/pine-core/p-60a30975.system.entry.js +0 -1
- package/dist/pine-core/p-62aa6a78.system.entry.js +0 -1
- package/dist/pine-core/p-64bcb378.entry.js +0 -1
- package/dist/pine-core/p-724baba3.system.entry.js +0 -1
- package/dist/pine-core/p-72659a0e.system.entry.js +0 -1
- package/dist/pine-core/p-8436cbfb.entry.js +0 -1
- package/dist/pine-core/p-8ade17ce.entry.js +0 -1
- package/dist/pine-core/p-8e7f75e6.entry.js +0 -1
- package/dist/pine-core/p-8fb520df.entry.js +0 -1
- package/dist/pine-core/p-92115e88.entry.js +0 -1
- package/dist/pine-core/p-94c9b7d1.system.entry.js +0 -1
- package/dist/pine-core/p-97356d4b.entry.js +0 -1
- package/dist/pine-core/p-97653e60.entry.js +0 -1
- package/dist/pine-core/p-97b73359.entry.js +0 -1
- package/dist/pine-core/p-BZVUD2on.js +0 -1
- package/dist/pine-core/p-Dj-z_ugg.system.js +0 -1
- package/dist/pine-core/p-ad5208a4.system.entry.js +0 -1
- package/dist/pine-core/p-afc2f165.entry.js +0 -1
- package/dist/pine-core/p-bcc378ba.system.entry.js +0 -8
- package/dist/pine-core/p-c8a0b562.system.entry.js +0 -1
- package/dist/pine-core/p-d47b2a6a.system.entry.js +0 -1
- package/dist/pine-core/p-d6f338e0.entry.js +0 -1
- package/dist/pine-core/p-da8b864a.entry.js +0 -2
- package/dist/pine-core/p-db7fb5a3.entry.js +0 -1
- package/dist/pine-core/p-de455073.system.entry.js +0 -1
- package/dist/pine-core/p-e3de6a1d.entry.js +0 -1
- package/dist/pine-core/p-e84fa9ed.entry.js +0 -1
- package/dist/pine-core/p-eb4f0daa.system.entry.js +0 -1
- package/dist/pine-core/p-eb56af4a.system.entry.js +0 -1
- package/dist/pine-core/p-ef0eba9b.system.entry.js +0 -1
- package/dist/pine-core/p-f11cce27.system.entry.js +0 -1
- package/dist/pine-core/p-f354dbac.entry.js +0 -1
|
@@ -141,6 +141,48 @@ function dateFormatter(locale, options) {
|
|
|
141
141
|
function formatDate(date, locale, options) {
|
|
142
142
|
return dateFormatter(locale, options).format(date);
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Month-day mode's year. A leap year, so February has its 29th; every date the mode holds is in it,
|
|
146
|
+
* and the value drops it (`--MM-DD`).
|
|
147
|
+
*/
|
|
148
|
+
const MONTH_DAY_YEAR = 2000;
|
|
149
|
+
const MONTH_DAY = /^--(\d{2})-(\d{2})$/;
|
|
150
|
+
/** The same month and day in month-day mode's year. */
|
|
151
|
+
function inMonthDayYear(date) {
|
|
152
|
+
return new Date(Date.UTC(MONTH_DAY_YEAR, date.getUTCMonth(), date.getUTCDate()));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Parses a month and day, `--MM-DD` (ISO 8601 without a year), to a date in month-day mode's year.
|
|
156
|
+
* A full `YYYY-MM-DD` reads as its month and day. `null` when it isn't a real month and day.
|
|
157
|
+
*/
|
|
158
|
+
function parseMonthDay(value) {
|
|
159
|
+
const text = (value !== null && value !== void 0 ? value : '').trim();
|
|
160
|
+
const match = MONTH_DAY.exec(text);
|
|
161
|
+
if (match)
|
|
162
|
+
return parseIsoDate(`${MONTH_DAY_YEAR}-${match[1]}-${match[2]}`);
|
|
163
|
+
const date = parseIsoDate(text);
|
|
164
|
+
return date && inMonthDayYear(date);
|
|
165
|
+
}
|
|
166
|
+
/** A date's month and day as `--MM-DD`. */
|
|
167
|
+
function toMonthDay(date) {
|
|
168
|
+
return `-${toIsoDate(date).slice(4)}`;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A month's days for month-day mode, which has no weekdays: rows of seven from the 1st, with the
|
|
172
|
+
* last row filled out with `null`.
|
|
173
|
+
*/
|
|
174
|
+
function monthDayRows(month) {
|
|
175
|
+
const cells = [];
|
|
176
|
+
for (let day = 1; day <= daysInMonth(MONTH_DAY_YEAR, month); day++) {
|
|
177
|
+
cells.push(new Date(Date.UTC(MONTH_DAY_YEAR, month, day)));
|
|
178
|
+
}
|
|
179
|
+
while (cells.length % 7 !== 0)
|
|
180
|
+
cells.push(null);
|
|
181
|
+
const rows = [];
|
|
182
|
+
for (let i = 0; i < cells.length; i += 7)
|
|
183
|
+
rows.push(cells.slice(i, i + 7));
|
|
184
|
+
return rows;
|
|
185
|
+
}
|
|
144
186
|
|
|
145
187
|
/**
|
|
146
188
|
* Where the open calendar lives: a `div` in `document.body`, or in the nearest `<dialog>` so it
|
|
@@ -295,12 +337,35 @@ function builtInPresetRange(key, now) {
|
|
|
295
337
|
return null;
|
|
296
338
|
}
|
|
297
339
|
}
|
|
340
|
+
const isWholeNumber = (value) => typeof value === 'number' && Number.isInteger(value);
|
|
341
|
+
/** A preset's offset range: whole days from today, a missing or `null` one being today. `null` if unusable. */
|
|
342
|
+
function offsetPresetRange(preset, now) {
|
|
343
|
+
const { startOffset, endOffset } = preset;
|
|
344
|
+
// Checked at runtime, as offsets often come from JSON, where a missing one is often written `null`.
|
|
345
|
+
if (startOffset == null && endOffset == null)
|
|
346
|
+
return null;
|
|
347
|
+
if (startOffset != null && !isWholeNumber(startOffset))
|
|
348
|
+
return null;
|
|
349
|
+
if (endOffset != null && !isWholeNumber(endOffset))
|
|
350
|
+
return null;
|
|
351
|
+
const start = addDays(now, startOffset !== null && startOffset !== void 0 ? startOffset : 0);
|
|
352
|
+
const end = addDays(now, endOffset !== null && endOffset !== void 0 ? endOffset : 0);
|
|
353
|
+
return start <= end ? [start, end] : null;
|
|
354
|
+
}
|
|
355
|
+
// The list is re-resolved on every read, so each warning is said once.
|
|
356
|
+
const warned = new Set();
|
|
357
|
+
function warnOnce(message) {
|
|
358
|
+
if (warned.has(message))
|
|
359
|
+
return;
|
|
360
|
+
warned.add(message);
|
|
361
|
+
console.warn(`PDS Datepicker: ${message}`);
|
|
362
|
+
}
|
|
298
363
|
/**
|
|
299
364
|
* Normalizes the `presets` prop: a comma-separated list of built-in keys, or an array of presets
|
|
300
|
-
* that may relabel a built-in
|
|
301
|
-
* resolve to no range are dropped.
|
|
365
|
+
* that may relabel a built-in or give their own range. Unusable entries are dropped with a warning.
|
|
302
366
|
*/
|
|
303
367
|
function resolvePresets(presets, now) {
|
|
368
|
+
var _a;
|
|
304
369
|
const entries = typeof presets === 'string'
|
|
305
370
|
? presets
|
|
306
371
|
.split(',')
|
|
@@ -314,14 +379,26 @@ function resolvePresets(presets, now) {
|
|
|
314
379
|
for (const preset of entries) {
|
|
315
380
|
// Presets often come from parsed JSON, so check types at runtime: a non-string label would
|
|
316
381
|
// otherwise reach the render as an object, which Stencil can turn into nodes.
|
|
317
|
-
if (!preset || typeof preset.key !== 'string')
|
|
382
|
+
if (!preset || typeof preset.key !== 'string') {
|
|
383
|
+
warnOnce('a preset with no string key was left out.');
|
|
318
384
|
continue;
|
|
385
|
+
}
|
|
319
386
|
const start = typeof preset.start === 'string' ? parseIsoDate(preset.start) : null;
|
|
320
387
|
const end = typeof preset.end === 'string' ? parseIsoDate(preset.end) : null;
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
388
|
+
// Fixed days, then offsets, then the built-in range.
|
|
389
|
+
const fixed = start !== null && end !== null && start <= end ? [start, end] : null;
|
|
390
|
+
const range = (_a = fixed !== null && fixed !== void 0 ? fixed : offsetPresetRange(preset, now)) !== null && _a !== void 0 ? _a : builtInPresetRange(preset.key, now);
|
|
391
|
+
// A blank label would leave the button unnamed.
|
|
392
|
+
const label = typeof preset.label === 'string' && preset.label.trim() !== '' ? preset.label : DEFAULT_LABELS[preset.key];
|
|
393
|
+
if (range === null) {
|
|
394
|
+
warnOnce(`preset "${preset.key}" has no usable range and was left out. Give it whole-day startOffset/endOffset or YYYY-MM-DD start/end, start first.`);
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (label === undefined) {
|
|
398
|
+
warnOnce(`preset "${preset.key}" has no label and was left out.`);
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
resolved.push({ key: preset.key, label, start: range[0], end: range[1] });
|
|
325
402
|
}
|
|
326
403
|
return resolved;
|
|
327
404
|
}
|
|
@@ -384,32 +461,50 @@ const wordsCache = new Map();
|
|
|
384
461
|
function localeWords(locale) {
|
|
385
462
|
let words = wordsCache.get(locale);
|
|
386
463
|
if (!words) {
|
|
387
|
-
const month = (style) => {
|
|
388
|
-
const format = new Intl.DateTimeFormat(locale, {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
464
|
+
const month = (style, withDay) => {
|
|
465
|
+
const format = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({ month: style }, (withDay ? { day: 'numeric' } : {})), { timeZone: 'UTC', calendar: 'gregory' }));
|
|
466
|
+
return Array.from({ length: 12 }, (_, m) => {
|
|
467
|
+
const date = new Date(Date.UTC(2023, m, 1));
|
|
468
|
+
if (!withDay)
|
|
469
|
+
return format.format(date);
|
|
470
|
+
const parts = format.formatToParts(date);
|
|
471
|
+
const index = parts.findIndex((part) => part.type === 'month');
|
|
472
|
+
if (index === -1)
|
|
473
|
+
return format.format(date);
|
|
474
|
+
// CJK locales split a counter word, as Japanese `月`, into its own literal right after the
|
|
475
|
+
// month; a literal with no space is that word, not the separator before the day.
|
|
476
|
+
const suffix = parts[index + 1];
|
|
477
|
+
return (suffix === null || suffix === void 0 ? void 0 : suffix.type) === 'literal' && !/\s/.test(suffix.value) ? parts[index].value + suffix.value : parts[index].value;
|
|
392
478
|
});
|
|
393
|
-
return Array.from({ length: 12 }, (_, m) => format.format(new Date(Date.UTC(2023, m, 1))));
|
|
394
479
|
};
|
|
395
480
|
const clock = clockFor(locale);
|
|
396
|
-
words = {
|
|
481
|
+
words = {
|
|
482
|
+
months: month('long', false),
|
|
483
|
+
shortMonths: month('short', false),
|
|
484
|
+
monthsWithDay: month('long', true),
|
|
485
|
+
shortMonthsWithDay: month('short', true),
|
|
486
|
+
am: clock.am,
|
|
487
|
+
pm: clock.pm,
|
|
488
|
+
};
|
|
397
489
|
wordsCache.set(locale, words);
|
|
398
490
|
}
|
|
399
491
|
return words;
|
|
400
492
|
}
|
|
493
|
+
/** Whether a format's tokens (see `tokensOnly`) have a day, so a month name should inflect for one. */
|
|
494
|
+
const hasDayToken = (tokens) => /D/.test(tokens);
|
|
401
495
|
/** Writes a date in a format of tokens (see `FORMAT_PARTS`), with month names and AM/PM in the locale. */
|
|
402
496
|
function formatWith(value, format, locale = 'en-US') {
|
|
403
497
|
var _a;
|
|
404
498
|
const words = localeWords(locale);
|
|
499
|
+
const withDay = hasDayToken(tokensOnly(format));
|
|
405
500
|
const [hours, minutes] = splitTime((_a = value.time) !== null && _a !== void 0 ? _a : '00:00');
|
|
406
501
|
const hour12 = hours % 12 || 12;
|
|
407
502
|
const month = value.date.getUTCMonth();
|
|
408
503
|
const period = hours < 12 ? words.am : words.pm;
|
|
409
504
|
const parts = {
|
|
410
505
|
YYYY: pad(value.date.getUTCFullYear(), 4),
|
|
411
|
-
MMMM: words.months[month],
|
|
412
|
-
MMM: words.shortMonths[month],
|
|
506
|
+
MMMM: withDay ? words.monthsWithDay[month] : words.months[month],
|
|
507
|
+
MMM: withDay ? words.shortMonthsWithDay[month] : words.shortMonths[month],
|
|
413
508
|
MM: pad(month + 1),
|
|
414
509
|
M: String(month + 1),
|
|
415
510
|
DD: pad(value.date.getUTCDate()),
|
|
@@ -431,17 +526,23 @@ const alternatives = (words) => `(${words.map(escapeRegExp).join('|')})`;
|
|
|
431
526
|
/**
|
|
432
527
|
* Reads typed text in a format of tokens, as written by `formatWith`. Leading zeros are optional,
|
|
433
528
|
* spaces are loose, and month names and AM/PM are matched without regard to case, in the locale or
|
|
434
|
-
* in English.
|
|
529
|
+
* in English. A format without `YYYY` reads into `year`, and without `year` it reads nothing.
|
|
530
|
+
* Returns `null` for anything that isn't a real date and time in that format.
|
|
435
531
|
*/
|
|
436
|
-
function parseWith(text, format, locale = 'en-US') {
|
|
532
|
+
function parseWith(text, format, locale = 'en-US', year) {
|
|
437
533
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
438
534
|
const words = localeWords(locale);
|
|
439
535
|
const english = localeWords('en-US');
|
|
536
|
+
const withDay = hasDayToken(tokensOnly(format));
|
|
537
|
+
const months = withDay ? words.monthsWithDay : words.months;
|
|
538
|
+
const shortMonths = withDay ? words.shortMonthsWithDay : words.shortMonths;
|
|
539
|
+
const englishMonths = withDay ? english.monthsWithDay : english.months;
|
|
540
|
+
const englishShortMonths = withDay ? english.shortMonthsWithDay : english.shortMonths;
|
|
440
541
|
const periods = [words.am, words.pm, english.am, english.pm];
|
|
441
542
|
const patterns = {
|
|
442
543
|
YYYY: '(\\d{4})',
|
|
443
|
-
MMMM: alternatives([...
|
|
444
|
-
MMM: alternatives([...
|
|
544
|
+
MMMM: alternatives([...months, ...englishMonths]),
|
|
545
|
+
MMM: alternatives([...shortMonths, ...englishShortMonths]),
|
|
445
546
|
MM: '(\\d{1,2})',
|
|
446
547
|
M: '(\\d{1,2})',
|
|
447
548
|
DD: '(\\d{1,2})',
|
|
@@ -488,7 +589,7 @@ function parseWith(text, format, locale = 'en-US') {
|
|
|
488
589
|
const monthIndex = (name, long) => {
|
|
489
590
|
if (name === undefined)
|
|
490
591
|
return undefined;
|
|
491
|
-
const lists = long ? [
|
|
592
|
+
const lists = long ? [months, englishMonths] : [shortMonths, englishShortMonths];
|
|
492
593
|
for (const list of lists) {
|
|
493
594
|
const index = list.findIndex((candidate) => candidate.toLowerCase() === name.toLowerCase());
|
|
494
595
|
if (index >= 0)
|
|
@@ -496,12 +597,12 @@ function parseWith(text, format, locale = 'en-US') {
|
|
|
496
597
|
}
|
|
497
598
|
return undefined;
|
|
498
599
|
};
|
|
499
|
-
const
|
|
600
|
+
const readYear = read.YYYY ? Number(read.YYYY) : year;
|
|
500
601
|
const month = (_b = (_a = monthIndex(read.MMMM, true)) !== null && _a !== void 0 ? _a : monthIndex(read.MMM, false)) !== null && _b !== void 0 ? _b : Number((_c = read.MM) !== null && _c !== void 0 ? _c : read.M);
|
|
501
602
|
const day = Number((_d = read.DD) !== null && _d !== void 0 ? _d : read.D);
|
|
502
|
-
if (
|
|
603
|
+
if (readYear === undefined || !month || !day)
|
|
503
604
|
return null;
|
|
504
|
-
const date = parseIsoDate(`${pad(
|
|
605
|
+
const date = parseIsoDate(`${pad(readYear, 4)}-${pad(month)}-${pad(day)}`);
|
|
505
606
|
if (!date)
|
|
506
607
|
return null;
|
|
507
608
|
const hourText = (_g = (_f = (_e = read.HH) !== null && _e !== void 0 ? _e : read.H) !== null && _f !== void 0 ? _f : read.hh) !== null && _g !== void 0 ? _g : read.h;
|
|
@@ -523,6 +624,40 @@ function parseFieldText(text, format = DEFAULT_FORMAT, locale = 'en-US') {
|
|
|
523
624
|
var _a;
|
|
524
625
|
return (_a = parseWith(text, format, locale)) !== null && _a !== void 0 ? _a : parseDateTime(text);
|
|
525
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* The locale's way of writing a month and day, as a format of tokens: `MMMM D` in English, `D MMMM`
|
|
629
|
+
* in French, `M月D日` in Japanese, or with `numeric`, `M/D` and `D/M`.
|
|
630
|
+
*/
|
|
631
|
+
function monthDayFormat(locale = 'en-US', month = 'long') {
|
|
632
|
+
const parts = dateFormatter(locale, { month, day: 'numeric' }).formatToParts(new Date(Date.UTC(MONTH_DAY_YEAR, 11, 31)));
|
|
633
|
+
return parts
|
|
634
|
+
.map((part) => {
|
|
635
|
+
// Some locales write even the long month in digits, as Japanese `12月31日`.
|
|
636
|
+
if (part.type === 'month')
|
|
637
|
+
return /^\d+$/.test(part.value) ? 'M' : 'MMMM';
|
|
638
|
+
if (part.type === 'day')
|
|
639
|
+
return 'D';
|
|
640
|
+
// Bracketed, spaces included, only when it has letters a token could be read from, as
|
|
641
|
+
// Spanish `D[ de ]MMMM`.
|
|
642
|
+
return /[A-Za-z]/.test(part.value) ? `[${part.value}]` : part.value;
|
|
643
|
+
})
|
|
644
|
+
.join('');
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Reads a typed month and day, into month-day mode's year: in the format, then as the locale writes
|
|
648
|
+
* it with a month name or in numbers, with the English order too, then as `--MM-DD` or a full ISO
|
|
649
|
+
* date, whose year is dropped.
|
|
650
|
+
*/
|
|
651
|
+
function parseMonthDayText(text, format, locale = 'en-US') {
|
|
652
|
+
const formats = [format, monthDayFormat(locale), monthDayFormat(locale, 'numeric'), 'MMMM D', 'D MMMM', 'MMM D', 'D MMM'];
|
|
653
|
+
for (const candidate of formats) {
|
|
654
|
+
const read = parseWith(text, candidate, locale, MONTH_DAY_YEAR);
|
|
655
|
+
if (read)
|
|
656
|
+
return { date: inMonthDayYear(read.date), time: null };
|
|
657
|
+
}
|
|
658
|
+
const date = parseMonthDay(text);
|
|
659
|
+
return date ? { date, time: null } : null;
|
|
660
|
+
}
|
|
526
661
|
/**
|
|
527
662
|
* Parses a typed range: two dates (with times, optionally) joined by a dash or `to` with spaces
|
|
528
663
|
* around it, as `2026-09-13 – 2026-10-13`, or by `/` when the format doesn't use slashes. The
|
|
@@ -577,6 +712,8 @@ function clockFor(locale) {
|
|
|
577
712
|
const pdsDatepickerCss = () => `:host{--pds-datepicker-day-size:var(--pine-dimension-500);--pds-datepicker-presets-width:200px;display:inline-block}:host([full-width]){display:block}pds-input{display:block}:host(.pds-datepicker--time) pds-input{min-width:220px}:host(.pds-datepicker--range) pds-input{min-width:260px}:host(.pds-datepicker--range.pds-datepicker--time) pds-input{min-width:min(380px, 100%)}.pds-datepicker__trigger,.pds-datepicker__clear{-ms-flex-align:center;align-items:center;background:transparent;border:0;border-radius:var(--pine-border-radius-sm);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;padding:var(--pine-dimension-2xs)}.pds-datepicker__trigger:hover:not(:disabled),.pds-datepicker__clear:hover:not(:disabled){background:var(--pine-color-background-muted);color:var(--pine-color-text-strong)}.pds-datepicker__trigger:focus-visible,.pds-datepicker__clear:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__trigger:disabled,.pds-datepicker__clear:disabled{color:var(--pine-color-text-disabled);cursor:not-allowed}.pds-datepicker__clear{-webkit-margin-end:var(--pine-dimension-2xs);margin-inline-end:var(--pine-dimension-2xs)}.pds-datepicker__nav{-ms-flex-align:center;align-items:center;background:var(--pine-color-secondary);border:var(--pine-border);border-radius:var(--pine-border-radius-full);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;height:var(--pine-dimension-400);-ms-flex-pack:center;justify-content:center;padding:0;width:var(--pine-dimension-400)}.pds-datepicker__nav:hover:not(:disabled){background:var(--pine-color-secondary-hover);border-color:var(--pine-color-border-hover)}.pds-datepicker__nav:focus-visible{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__nav:disabled{border-color:var(--pine-color-border-disabled);color:var(--pine-color-text-secondary-disabled);cursor:not-allowed}.pds-datepicker__nav:dir(rtl) pds-icon{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.pds-datepicker__dialog:focus{outline:none}.pds-datepicker__dialog{background:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-150);-webkit-box-shadow:var(--pine-box-shadow-200);box-shadow:var(--pine-box-shadow-200);-webkit-box-sizing:border-box;box-sizing:border-box;left:0;max-height:calc(100vh - var(--pine-dimension-sm));max-height:calc(100dvh - var(--pine-dimension-sm));max-width:calc(100vw - var(--pine-dimension-sm));overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain;padding:var(--pine-dimension-sm);pointer-events:auto;position:fixed;top:0;visibility:hidden;z-index:var(--pine-z-index-priority)}:host-context([data-theme=dark]) .pds-datepicker__dialog{border:var(--pine-border)}.pds-datepicker__header{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-webkit-margin-after:var(--pine-dimension-sm);margin-block-end:var(--pine-dimension-sm)}.pds-datepicker__nav-spacer{-ms-flex:none;flex:none;width:var(--pine-dimension-400)}.pds-datepicker__heading{color:var(--pine-color-text);font:var(--pine-typography-heading-5);font-weight:var(--pine-font-weight-semi-bold)}.pds-datepicker__grid{border-collapse:collapse;border-spacing:0}.pds-datepicker__weekday{color:var(--pine-color-text-muted);font:var(--pine-typography-body-sm);height:var(--pds-datepicker-day-size);padding:0;text-align:center;width:var(--pds-datepicker-day-size)}.pds-datepicker__day{border-radius:var(--pine-border-radius-full);color:var(--pine-color-text-secondary);cursor:pointer;font:var(--pine-typography-body);height:var(--pds-datepicker-day-size);padding:0;position:relative;text-align:center;-webkit-transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);width:var(--pds-datepicker-day-size)}.pds-datepicker__day:hover{background:var(--pine-color-background-muted)}.pds-datepicker__day:focus-visible{outline:var(--pine-outline-focus);outline-offset:calc(var(--pine-border-width-thick) * -1)}.pds-datepicker__day--empty{cursor:default;pointer-events:none}.pds-datepicker__day--today::after{background:var(--pine-color-primary);border-radius:var(--pine-border-radius-full);content:"";height:var(--pine-dimension-050);inset-block-end:var(--pine-dimension-050);inset-inline-start:50%;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:var(--pine-dimension-050)}.pds-datepicker__day--selected,.pds-datepicker__day--selected:hover{background:var(--pine-color-primary);color:var(--pine-color-text-primary)}.pds-datepicker__day--selected:focus-visible{outline-offset:var(--pine-border-width)}.pds-datepicker__day--range-start{border-end-end-radius:0;border-start-end-radius:0}.pds-datepicker__day--range-end{border-end-start-radius:0;border-start-start-radius:0}.pds-datepicker__day--range-start.pds-datepicker__day--row-end{border-end-end-radius:var(--pine-border-radius-full);border-start-end-radius:var(--pine-border-radius-full)}.pds-datepicker__day--range-end.pds-datepicker__day--row-start{border-end-start-radius:var(--pine-border-radius-full);border-start-start-radius:var(--pine-border-radius-full)}.pds-datepicker__day--selected.pds-datepicker__day--today::after{background:var(--pine-color-text-primary)}.pds-datepicker__day--in-range{border-radius:0}.pds-datepicker__day--in-range,.pds-datepicker__day--in-range:hover{background:var(--pine-color-background-muted);color:var(--pine-color-text-secondary)}.pds-datepicker__day--row-start{border-end-start-radius:var(--pine-border-radius-full);border-start-start-radius:var(--pine-border-radius-full)}.pds-datepicker__day--row-end{border-end-end-radius:var(--pine-border-radius-full);border-start-end-radius:var(--pine-border-radius-full)}.pds-datepicker__day--disabled,.pds-datepicker__day--disabled:hover{background:transparent;color:var(--pine-color-text-disabled);cursor:not-allowed;text-decoration:line-through}.pds-datepicker__day--in-range:hover{background:var(--pine-color-background-inset)}.pds-datepicker__dialog--range{display:-ms-flexbox;display:flex;padding:0}.pds-datepicker__panel{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:0}.pds-datepicker__dialog--range .pds-datepicker__panel{padding:var(--pine-dimension-sm)}.pds-datepicker__months{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--pine-dimension-lg)}.pds-datepicker__presets-column{-webkit-border-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-inline-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);-ms-flex:none;flex:none;position:relative;width:var(--pds-datepicker-presets-width)}.pds-datepicker__presets{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--pine-dimension-2xs);inset:0;list-style:none;margin:0;overflow-y:auto;padding:var(--pine-dimension-150);position:absolute}.pds-datepicker__preset{-ms-flex-align:center;align-items:center;background:transparent;border:0;border-radius:var(--pine-border-radius-md);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body);gap:var(--pine-dimension-xs);-ms-flex-pack:justify;justify-content:space-between;padding:var(--pine-dimension-xs) var(--pine-dimension-sm);text-align:start;-webkit-transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);width:100%}.pds-datepicker__preset:hover:not(:disabled){background:var(--pine-color-background-muted)}.pds-datepicker__preset:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__preset:disabled{color:var(--pine-color-text-disabled);cursor:not-allowed}.pds-datepicker__preset--selected{background:var(--pine-color-background-muted);color:var(--pine-color-text-active)}.pds-datepicker__footer{-ms-flex-align:center;align-items:center;background:var(--pine-color-background-overlay);-webkit-border-before:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-block-start:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--pine-dimension-xs);inset-block-end:calc(var(--pine-dimension-sm) * -1);-ms-flex-pack:end;justify-content:flex-end;margin-block:var(--pine-dimension-sm) calc(var(--pine-dimension-sm) * -1);padding-block:var(--pine-dimension-sm);position:-webkit-sticky;position:sticky}.pds-datepicker__selection{color:var(--pine-color-text-muted);font:var(--pine-typography-body-sm-medium);-webkit-margin-end:auto;margin-inline-end:auto}.pds-datepicker__dropdowns{display:-ms-flexbox;display:flex;gap:var(--pine-dimension-2xs)}.pds-datepicker__select-wrap{-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;position:relative}.pds-datepicker__heading-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-border-radius-md);color:var(--pine-color-text);cursor:pointer;field-sizing:content;font:var(--pine-typography-heading-5);font-weight:var(--pine-font-weight-semi-bold);padding-block:var(--pine-dimension-2xs);padding-inline:var(--pine-dimension-xs) calc(var(--pine-dimension-xs) + var(--pine-dimension-sm))}.pds-datepicker__heading-select:hover{background:var(--pine-color-background-muted)}.pds-datepicker__heading-select:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__select-caret{color:var(--pine-color-text-secondary);inset-inline-end:var(--pine-dimension-xs);pointer-events:none;position:absolute}.pds-datepicker__time{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--pine-dimension-xs);-ms-flex-pack:justify;justify-content:space-between;-webkit-margin-before:var(--pine-dimension-sm);margin-block-start:var(--pine-dimension-sm);padding-inline:var(--pine-dimension-xs)}.pds-datepicker__time-label{color:var(--pine-color-text-label);font:var(--pine-typography-body-medium)}.pds-datepicker__time-field{-ms-flex-align:center;align-items:center;background:var(--pine-color-background-container);border:var(--pine-border);border-radius:var(--pine-border-radius-md);display:-ms-inline-flexbox;display:inline-flex;min-height:var(--pine-dimension-400);padding-inline:var(--pine-dimension-2xs)}.pds-datepicker__time-field:hover{border-color:var(--pine-color-border-hover)}.pds-datepicker__time-field:focus-within{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__time-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-border-radius-sm);color:var(--pine-color-text-strong);cursor:pointer;font:var(--pine-typography-body);font-variant-numeric:tabular-nums;padding:var(--pine-dimension-2xs);text-align:center}.pds-datepicker__time-select:focus-visible{background:var(--pine-color-background-muted);outline:none}.pds-datepicker__time-select--period{-webkit-margin-start:var(--pine-dimension-2xs);margin-inline-start:var(--pine-dimension-2xs)}.pds-datepicker__time-separator{color:var(--pine-color-text-secondary)}:host-context([data-theme=dark]) select{color-scheme:dark}.pds-datepicker__action{background:var(--pine-color-secondary);border:var(--pine-border);border-radius:var(--pine-border-radius-full);color:var(--pine-color-text-secondary);cursor:pointer;font:var(--pine-typography-body-medium);padding:calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-sm)}.pds-datepicker__action:hover:not(:disabled){background:var(--pine-color-secondary-hover);border-color:var(--pine-color-border-hover)}.pds-datepicker__action:focus-visible{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__action:disabled{background:var(--pine-color-secondary-disabled);border-color:var(--pine-color-border-disabled);color:var(--pine-color-text-secondary-disabled);cursor:not-allowed}.pds-datepicker__action--primary{background:var(--pine-color-primary);border-color:var(--pine-color-primary);color:var(--pine-color-text-primary)}.pds-datepicker__action--primary:hover:not(:disabled){background:var(--pine-color-primary-hover);border-color:var(--pine-color-primary-hover)}.pds-datepicker__action--primary:disabled{background:var(--pine-color-primary-disabled);border-color:var(--pine-color-primary-disabled);color:var(--pine-color-text-primary-disabled)}@media (max-width: 600px){.pds-datepicker__dialog--range{-ms-flex-direction:column;flex-direction:column}.pds-datepicker__presets-column{-webkit-border-after:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-block-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);-webkit-border-end:0;border-inline-end:0;width:auto}.pds-datepicker__presets{-ms-flex-direction:row;flex-direction:row;overflow-x:auto;position:static}.pds-datepicker__preset{white-space:nowrap}.pds-datepicker__selection{-ms-flex-preferred-size:100%;flex-basis:100%}}.pds-datepicker__trigger,.pds-datepicker__clear,.pds-datepicker__nav,.pds-datepicker__weekday,.pds-datepicker__day,.pds-datepicker__preset,.pds-datepicker__action{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media (forced-colors: active){.pds-datepicker__day--selected,.pds-datepicker__day--selected:hover{background:Highlight;color:HighlightText;forced-color-adjust:none}.pds-datepicker__day--in-range,.pds-datepicker__day--in-range:hover{border-block:var(--pine-border-width-thin) solid Highlight}.pds-datepicker__day--today::after{background:CanvasText;forced-color-adjust:none}.pds-datepicker__day--selected.pds-datepicker__day--today::after{background:HighlightText}.pds-datepicker__day--disabled{color:GrayText}}.visually-hidden{border:0;clip:rect(0 0 0 0);-webkit-clip-path:polygon(0 0, 0 0, 0 0);clip-path:polygon(0 0, 0 0, 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}`;
|
|
578
713
|
|
|
579
714
|
const FULL_DATE = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
|
715
|
+
/** A day in month-day mode, which has no year and so no weekday. */
|
|
716
|
+
const MONTH_AND_DAY = { month: 'long', day: 'numeric' };
|
|
580
717
|
const DEFAULT_START_TIME = '00:00';
|
|
581
718
|
const DEFAULT_END_TIME = '23:59';
|
|
582
719
|
/** Ids for datepickers without a `component-id`, so their calendars' ids stay unique. */
|
|
@@ -655,8 +792,10 @@ const PdsDatepicker = class {
|
|
|
655
792
|
* in the locale), `MM` or `M` (month), `DD` or `D` (day), and with the time picker `HH` or `H`
|
|
656
793
|
* (24-hour), `hh` or `h` (12-hour), `mm` and `A` (AM/PM, in the locale), as `MM/DD/YYYY`,
|
|
657
794
|
* `MMM D, YYYY` or `D.M.YYYY h:mm A`. Put literal text in brackets, as `[Due] D/M/YYYY`. The value
|
|
658
|
-
* and the change event stay ISO (`YYYY-MM-DD`), whatever the format.
|
|
659
|
-
* accepted too.
|
|
795
|
+
* and the change event stay ISO (`YYYY-MM-DD`; `--MM-DD` with `month-day`), whatever the format.
|
|
796
|
+
* Typed ISO dates are always accepted too. With `month-day`, a format without `YYYY` is taken as a
|
|
797
|
+
* month-and-day format and used as given, rather than reordered for the locale; leave it unset to
|
|
798
|
+
* follow the locale instead.
|
|
660
799
|
*/
|
|
661
800
|
this.format = 'YYYY-MM-DD';
|
|
662
801
|
/**
|
|
@@ -689,6 +828,15 @@ const PdsDatepicker = class {
|
|
|
689
828
|
* Accessible label for the month dropdown, when `show-dropdowns` is set.
|
|
690
829
|
*/
|
|
691
830
|
this.monthLabel = 'Month';
|
|
831
|
+
/**
|
|
832
|
+
* Picks a month and day with no year, for a date that comes round every year, such as a birthday.
|
|
833
|
+
* The value is `--MM-DD` (ISO 8601 without a year), the field shows the date as the locale writes
|
|
834
|
+
* a month and day, and the calendar shows each month without a year or weekdays, with February
|
|
835
|
+
* always having its 29th. Turns off `range`, `time-picker`, `show-dropdowns`, `min` and `max`, and
|
|
836
|
+
* has no effect with `auto-apply`, `presets`, `first-day-of-week`, `min-date-message` or
|
|
837
|
+
* `max-date-message`, which all depend on them.
|
|
838
|
+
*/
|
|
839
|
+
this.monthDay = false;
|
|
692
840
|
/**
|
|
693
841
|
* Accessible label for the button that shows the next month.
|
|
694
842
|
*/
|
|
@@ -737,7 +885,9 @@ const PdsDatepicker = class {
|
|
|
737
885
|
this.triggerLabel = 'Choose date';
|
|
738
886
|
/**
|
|
739
887
|
* The selected date as `YYYY-MM-DD`, or in range mode the range as `YYYY-MM-DD/YYYY-MM-DD`; with
|
|
740
|
-
* the time picker, each date as `YYYY-MM-DDTHH:mm
|
|
888
|
+
* the time picker, each date as `YYYY-MM-DDTHH:mm`; with `month-day`, the month and day with no
|
|
889
|
+
* year, as `--MM-DD` (a full date is read too, as that month and day, and rewritten to it). An
|
|
890
|
+
* empty string when nothing is selected.
|
|
741
891
|
*/
|
|
742
892
|
this.value = '';
|
|
743
893
|
/**
|
|
@@ -928,17 +1078,17 @@ const PdsDatepicker = class {
|
|
|
928
1078
|
// The times before the typed text changed them, for a pick in the calendar to go back to.
|
|
929
1079
|
(_b = this.timesBeforeTyping) !== null && _b !== void 0 ? _b : (this.timesBeforeTyping = [startTime, endTime]);
|
|
930
1080
|
this.loadDraft(parts);
|
|
931
|
-
if (this.
|
|
1081
|
+
if (this.hasTime) {
|
|
932
1082
|
// A time picked in the calendar survives typing that doesn't change the time: text with no
|
|
933
1083
|
// time, as a date part-way typed, or with the time as committed.
|
|
934
1084
|
const format = this.resolvedFormat;
|
|
935
1085
|
const locale = this.resolvedLocale;
|
|
936
|
-
const typed = this.
|
|
1086
|
+
const typed = this.isRange ? parseRangeText(this.text, format, locale) : [parseFieldText(this.text, format, locale)];
|
|
937
1087
|
const committed = this.parsedValue();
|
|
938
1088
|
const keeps = (i) => { var _a, _b, _c; return !((_a = typed === null || typed === void 0 ? void 0 : typed[i]) === null || _a === void 0 ? void 0 : _a.time) || ((_b = typed[i]) === null || _b === void 0 ? void 0 : _b.time) === ((_c = committed === null || committed === void 0 ? void 0 : committed[i]) === null || _c === void 0 ? void 0 : _c.time); };
|
|
939
1089
|
if (keeps(0))
|
|
940
1090
|
this.startTime = startTime;
|
|
941
|
-
if (this.
|
|
1091
|
+
if (this.isRange && keeps(1))
|
|
942
1092
|
this.endTime = endTime;
|
|
943
1093
|
}
|
|
944
1094
|
this.showDate(parts[parts.length - 1].date);
|
|
@@ -1047,7 +1197,8 @@ const PdsDatepicker = class {
|
|
|
1047
1197
|
if (!active)
|
|
1048
1198
|
return;
|
|
1049
1199
|
const rtl = getComputedStyle(this.el).direction === 'rtl';
|
|
1050
|
-
|
|
1200
|
+
// Month-day mode's rows start on the 1st, not on a weekday.
|
|
1201
|
+
const column = this.monthDay ? (active.getUTCDate() - 1) % 7 : weekdayColumn(active, this.weekStart);
|
|
1051
1202
|
let next = null;
|
|
1052
1203
|
switch (event.key) {
|
|
1053
1204
|
case 'ArrowLeft':
|
|
@@ -1065,14 +1216,21 @@ const PdsDatepicker = class {
|
|
|
1065
1216
|
case 'Home':
|
|
1066
1217
|
next = addDays(active, -column);
|
|
1067
1218
|
break;
|
|
1068
|
-
case 'End':
|
|
1069
|
-
next
|
|
1219
|
+
case 'End': {
|
|
1220
|
+
// Month-day mode's rows don't carry into the next month, so End stops at the month's last day.
|
|
1221
|
+
const lastColumn = this.monthDay
|
|
1222
|
+
? Math.min(6, daysInMonth(active.getUTCFullYear(), active.getUTCMonth()) - active.getUTCDate() + column)
|
|
1223
|
+
: 6;
|
|
1224
|
+
next = addDays(active, lastColumn - column);
|
|
1070
1225
|
break;
|
|
1226
|
+
}
|
|
1071
1227
|
case 'PageUp':
|
|
1072
|
-
|
|
1228
|
+
// Month-day mode has no year to jump by, so Shift+PageUp stays put rather than passing
|
|
1229
|
+
// through a real, possibly non-leap year and clamping Feb 29 to the 28th.
|
|
1230
|
+
next = event.shiftKey && this.monthDay ? active : addMonths(active, event.shiftKey ? -12 : -1);
|
|
1073
1231
|
break;
|
|
1074
1232
|
case 'PageDown':
|
|
1075
|
-
next = addMonths(active, event.shiftKey ? 12 : 1);
|
|
1233
|
+
next = event.shiftKey && this.monthDay ? active : addMonths(active, event.shiftKey ? 12 : 1);
|
|
1076
1234
|
break;
|
|
1077
1235
|
case 'Enter':
|
|
1078
1236
|
case ' ':
|
|
@@ -1085,9 +1243,9 @@ const PdsDatepicker = class {
|
|
|
1085
1243
|
return;
|
|
1086
1244
|
}
|
|
1087
1245
|
event.preventDefault();
|
|
1088
|
-
const target = clampDate(next, this.minDate, this.maxDate);
|
|
1246
|
+
const target = clampDate(this.inView(next), this.minDate, this.maxDate);
|
|
1089
1247
|
this.showDate(target);
|
|
1090
|
-
if (this.
|
|
1248
|
+
if (this.isRange)
|
|
1091
1249
|
this.previewDate = toIsoDate(target);
|
|
1092
1250
|
this.focusActiveDay = true;
|
|
1093
1251
|
};
|
|
@@ -1098,7 +1256,7 @@ const PdsDatepicker = class {
|
|
|
1098
1256
|
this.pickDate(date);
|
|
1099
1257
|
};
|
|
1100
1258
|
this.onGridPointerOver = (event) => {
|
|
1101
|
-
if (!this.
|
|
1259
|
+
if (!this.isRange || !this.draftStart || this.draftEnd)
|
|
1102
1260
|
return;
|
|
1103
1261
|
const date = this.dayFromEvent(event);
|
|
1104
1262
|
const iso = date && toIsoDate(date);
|
|
@@ -1147,19 +1305,28 @@ const PdsDatepicker = class {
|
|
|
1147
1305
|
var _a;
|
|
1148
1306
|
this.text = this.fieldText();
|
|
1149
1307
|
this.textError = '';
|
|
1308
|
+
const parts = this.parsedValue();
|
|
1309
|
+
// A full date reads as its month and day; keep what's submitted in step with what's shown,
|
|
1310
|
+
// rather than passing through whichever spelling was set until the next pick rewrites it.
|
|
1311
|
+
if (this.monthDay && parts) {
|
|
1312
|
+
const normalized = this.dayValue(parts[0].date);
|
|
1313
|
+
if (this.value !== normalized)
|
|
1314
|
+
this.value = normalized;
|
|
1315
|
+
}
|
|
1150
1316
|
this.updateFormValue();
|
|
1151
1317
|
if (!this.isOpen)
|
|
1152
1318
|
return;
|
|
1153
|
-
const parts = this.parsedValue();
|
|
1154
1319
|
this.loadDraft(parts);
|
|
1155
|
-
const day = (_a = (parts && parts[parts.length - 1].date)) !== null && _a !== void 0 ? _a :
|
|
1320
|
+
const day = (_a = (parts && parts[parts.length - 1].date)) !== null && _a !== void 0 ? _a : this.now;
|
|
1156
1321
|
this.showDate(clampDate(day, this.minDate, this.maxDate), true);
|
|
1157
1322
|
}
|
|
1158
1323
|
requiredChanged() {
|
|
1159
1324
|
this.updateFormValue();
|
|
1160
1325
|
}
|
|
1161
1326
|
componentWillLoad() {
|
|
1162
|
-
|
|
1327
|
+
// Through the same path a later value/context change takes, so an initial full date in
|
|
1328
|
+
// month-day mode submits normalized too, not only after the first pick rewrites it.
|
|
1329
|
+
this.refreshFromValue();
|
|
1163
1330
|
}
|
|
1164
1331
|
connectedCallback() {
|
|
1165
1332
|
if (this.el.attachInternals && !this.internals) {
|
|
@@ -1209,10 +1376,30 @@ const PdsDatepicker = class {
|
|
|
1209
1376
|
return localeFirstDayOfWeek(this.resolvedLocale);
|
|
1210
1377
|
}
|
|
1211
1378
|
get minDate() {
|
|
1212
|
-
return parseIsoDate(this.min);
|
|
1379
|
+
return this.monthDay ? null : parseIsoDate(this.min);
|
|
1213
1380
|
}
|
|
1214
1381
|
get maxDate() {
|
|
1215
|
-
return parseIsoDate(this.max);
|
|
1382
|
+
return this.monthDay ? null : parseIsoDate(this.max);
|
|
1383
|
+
}
|
|
1384
|
+
/** Range mode, which month-day mode turns off. */
|
|
1385
|
+
get isRange() {
|
|
1386
|
+
return this.range && !this.monthDay;
|
|
1387
|
+
}
|
|
1388
|
+
/** The time picker, which month-day mode turns off. */
|
|
1389
|
+
get hasTime() {
|
|
1390
|
+
return this.timePicker && !this.monthDay;
|
|
1391
|
+
}
|
|
1392
|
+
/** Today, or in month-day mode today's month and day. */
|
|
1393
|
+
get now() {
|
|
1394
|
+
return this.monthDay ? inMonthDayYear(today()) : today();
|
|
1395
|
+
}
|
|
1396
|
+
/** In month-day mode, a date moved to the mode's year, as when the calendar wraps past December. */
|
|
1397
|
+
inView(date) {
|
|
1398
|
+
return this.monthDay ? inMonthDayYear(date) : date;
|
|
1399
|
+
}
|
|
1400
|
+
/** One day as the value holds it: `YYYY-MM-DD`, or `--MM-DD` in month-day mode. */
|
|
1401
|
+
dayValue(date) {
|
|
1402
|
+
return this.monthDay ? toMonthDay(date) : toIsoDate(date);
|
|
1216
1403
|
}
|
|
1217
1404
|
get isInteractive() {
|
|
1218
1405
|
return !this.disabled && !this.readonly;
|
|
@@ -1220,22 +1407,22 @@ const PdsDatepicker = class {
|
|
|
1220
1407
|
/** How many months the calendar shows side by side. */
|
|
1221
1408
|
get monthCount() {
|
|
1222
1409
|
const narrow = typeof window !== 'undefined' && window.innerWidth < TWO_MONTHS_MIN_WIDTH;
|
|
1223
|
-
return this.
|
|
1410
|
+
return this.isRange && !narrow ? 2 : 1;
|
|
1224
1411
|
}
|
|
1225
1412
|
/** Whether picks apply at once, without the footer: `auto-apply` in range mode, without times. */
|
|
1226
1413
|
get appliesOnPick() {
|
|
1227
|
-
return this.
|
|
1414
|
+
return this.isRange && this.autoApply && !this.hasTime;
|
|
1228
1415
|
}
|
|
1229
1416
|
/** Whether picks wait for Apply: for a range, unless it auto-applies, and for a date with a time. */
|
|
1230
1417
|
get hasFooter() {
|
|
1231
|
-
return (this.
|
|
1418
|
+
return (this.isRange || this.hasTime) && !this.appliesOnPick;
|
|
1232
1419
|
}
|
|
1233
1420
|
get resolvedPresets() {
|
|
1234
|
-
return this.
|
|
1421
|
+
return this.isRange ? resolvePresets(this.presets, today()) : [];
|
|
1235
1422
|
}
|
|
1236
1423
|
/** The committed value, parsed: one date, or a range's start and end. */
|
|
1237
1424
|
parsedValue(value = this.value) {
|
|
1238
|
-
if (this.
|
|
1425
|
+
if (this.isRange) {
|
|
1239
1426
|
const [start, end, extra] = (value !== null && value !== void 0 ? value : '').split('/');
|
|
1240
1427
|
const startValue = parseDateTime(start);
|
|
1241
1428
|
const endValue = parseDateTime(end);
|
|
@@ -1243,12 +1430,22 @@ const PdsDatepicker = class {
|
|
|
1243
1430
|
? [startValue, endValue]
|
|
1244
1431
|
: null;
|
|
1245
1432
|
}
|
|
1433
|
+
if (this.monthDay) {
|
|
1434
|
+
const date = parseMonthDay(value);
|
|
1435
|
+
return date ? [{ date, time: null }] : null;
|
|
1436
|
+
}
|
|
1246
1437
|
const single = parseDateTime(value);
|
|
1247
1438
|
return single ? [single] : null;
|
|
1248
1439
|
}
|
|
1249
1440
|
/** The format the field shows and reads, with a time when the time picker is on. */
|
|
1250
1441
|
get resolvedFormat() {
|
|
1251
|
-
|
|
1442
|
+
var _a, _b;
|
|
1443
|
+
if (this.monthDay) {
|
|
1444
|
+
// A format with a year is the default, or one for full dates: use the locale's month and day.
|
|
1445
|
+
const format = (_b = (_a = this.format) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
|
|
1446
|
+
return format !== '' && !/YYYY/.test(format.replace(/\[[^\]]*\]/g, '')) ? format : monthDayFormat(this.resolvedLocale);
|
|
1447
|
+
}
|
|
1448
|
+
return fieldFormat(this.format, this.hasTime, this.hasTime && clockFor(this.resolvedLocale).hour12);
|
|
1252
1449
|
}
|
|
1253
1450
|
/** What the field shows for the committed value. */
|
|
1254
1451
|
fieldText() {
|
|
@@ -1264,20 +1461,24 @@ const PdsDatepicker = class {
|
|
|
1264
1461
|
/** Drops a time the time picker doesn't show, or adds the default one it does. */
|
|
1265
1462
|
withTimePicker(value, fallback = DEFAULT_START_TIME) {
|
|
1266
1463
|
var _a;
|
|
1267
|
-
return { date: value.date, time: this.
|
|
1464
|
+
return { date: value.date, time: this.hasTime ? ((_a = value.time) !== null && _a !== void 0 ? _a : fallback) : null };
|
|
1268
1465
|
}
|
|
1269
1466
|
get fieldPlaceholder() {
|
|
1270
1467
|
if (this.placeholder)
|
|
1271
1468
|
return this.placeholder;
|
|
1469
|
+
// Month-day tokens, as `MMMM D`, don't read as a hint; an example date does.
|
|
1470
|
+
if (this.monthDay) {
|
|
1471
|
+
return formatWith({ date: parseMonthDay('--12-31'), time: null }, this.resolvedFormat, this.resolvedLocale);
|
|
1472
|
+
}
|
|
1272
1473
|
const one = this.resolvedFormat;
|
|
1273
|
-
return this.
|
|
1474
|
+
return this.isRange ? `${one}${RANGE_SEPARATOR}${one}` : one;
|
|
1274
1475
|
}
|
|
1275
1476
|
/** Loads the committed value into the draft the calendar edits. */
|
|
1276
1477
|
loadDraft(parts) {
|
|
1277
1478
|
var _a, _b;
|
|
1278
1479
|
const [start, end] = parts !== null && parts !== void 0 ? parts : [];
|
|
1279
1480
|
this.draftStart = start ? toIsoDate(start.date) : '';
|
|
1280
|
-
this.draftEnd = this.
|
|
1481
|
+
this.draftEnd = this.isRange && end ? toIsoDate(end.date) : '';
|
|
1281
1482
|
this.startTime = (_a = start === null || start === void 0 ? void 0 : start.time) !== null && _a !== void 0 ? _a : DEFAULT_START_TIME;
|
|
1282
1483
|
this.endTime = (_b = end === null || end === void 0 ? void 0 : end.time) !== null && _b !== void 0 ? _b : DEFAULT_END_TIME;
|
|
1283
1484
|
this.previewDate = '';
|
|
@@ -1293,7 +1494,7 @@ const PdsDatepicker = class {
|
|
|
1293
1494
|
const parts = this.parsedValue();
|
|
1294
1495
|
this.loadDraft(parts);
|
|
1295
1496
|
this.valueAtOpen = (_a = this.value) !== null && _a !== void 0 ? _a : '';
|
|
1296
|
-
const start = (_b = (parts && parts[parts.length - 1].date)) !== null && _b !== void 0 ? _b :
|
|
1497
|
+
const start = (_b = (parts && parts[parts.length - 1].date)) !== null && _b !== void 0 ? _b : this.now;
|
|
1297
1498
|
this.showDate(clampDate(start, this.minDate, this.maxDate), true);
|
|
1298
1499
|
this.focusActiveDay = focusDay;
|
|
1299
1500
|
this.isOpen = true;
|
|
@@ -1315,7 +1516,8 @@ const PdsDatepicker = class {
|
|
|
1315
1516
|
* Makes a day the active one and brings it into view. With two months, a day already on view
|
|
1316
1517
|
* doesn't move the view; `reset` lines the view up so the day is in the last month shown.
|
|
1317
1518
|
*/
|
|
1318
|
-
showDate(
|
|
1519
|
+
showDate(day, reset = false) {
|
|
1520
|
+
const date = this.inView(day);
|
|
1319
1521
|
const first = firstOfMonth(date);
|
|
1320
1522
|
const view = parseIsoDate(this.viewMonth);
|
|
1321
1523
|
const lastView = view && addMonths(view, this.monthCount - 1);
|
|
@@ -1333,15 +1535,15 @@ const PdsDatepicker = class {
|
|
|
1333
1535
|
// A pick in the calendar takes over from typed text, so dismissing afterwards commits nothing,
|
|
1334
1536
|
// as when nothing was typed.
|
|
1335
1537
|
this.dropTypedText();
|
|
1336
|
-
if (this.
|
|
1538
|
+
if (this.isRange) {
|
|
1337
1539
|
this.pickRangeDay(date);
|
|
1338
1540
|
}
|
|
1339
|
-
else if (this.
|
|
1541
|
+
else if (this.hasTime) {
|
|
1340
1542
|
this.draftStart = toIsoDate(date);
|
|
1341
1543
|
this.activeDate = this.draftStart;
|
|
1342
1544
|
}
|
|
1343
1545
|
else {
|
|
1344
|
-
this.commitValue(
|
|
1546
|
+
this.commitValue(this.dayValue(date));
|
|
1345
1547
|
this.closeCalendar(true);
|
|
1346
1548
|
}
|
|
1347
1549
|
}
|
|
@@ -1385,7 +1587,11 @@ const PdsDatepicker = class {
|
|
|
1385
1587
|
}
|
|
1386
1588
|
/** Commits one date, or a range with its start, end and matching preset. */
|
|
1387
1589
|
commitParts(parts) {
|
|
1388
|
-
if (
|
|
1590
|
+
if (this.monthDay) {
|
|
1591
|
+
this.commitValue(toMonthDay(parts[0].date));
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
if (!this.isRange) {
|
|
1389
1595
|
this.commitValue(toValueString(parts[0]));
|
|
1390
1596
|
return;
|
|
1391
1597
|
}
|
|
@@ -1400,7 +1606,7 @@ const PdsDatepicker = class {
|
|
|
1400
1606
|
if (!startDate)
|
|
1401
1607
|
return null;
|
|
1402
1608
|
const start = this.withTimePicker({ date: startDate, time: this.startTime });
|
|
1403
|
-
if (!this.
|
|
1609
|
+
if (!this.isRange)
|
|
1404
1610
|
return [start];
|
|
1405
1611
|
const end = this.withTimePicker({ date: (_a = parseIsoDate(this.draftEnd)) !== null && _a !== void 0 ? _a : startDate, time: this.endTime });
|
|
1406
1612
|
// An end time before the start time on the same day ends at the start.
|
|
@@ -1526,7 +1732,11 @@ const PdsDatepicker = class {
|
|
|
1526
1732
|
readText(text) {
|
|
1527
1733
|
const format = this.resolvedFormat;
|
|
1528
1734
|
const locale = this.resolvedLocale;
|
|
1529
|
-
const parts = this.
|
|
1735
|
+
const parts = this.monthDay
|
|
1736
|
+
? [parseMonthDayText(text, format, locale)]
|
|
1737
|
+
: this.isRange
|
|
1738
|
+
? parseRangeText(text, format, locale)
|
|
1739
|
+
: [parseFieldText(text, format, locale)];
|
|
1530
1740
|
if (!parts || parts.some((part) => !part))
|
|
1531
1741
|
return null;
|
|
1532
1742
|
return parts.map((part, i) => this.withTimePicker(part, i === 1 ? DEFAULT_END_TIME : DEFAULT_START_TIME));
|
|
@@ -1570,17 +1780,17 @@ const PdsDatepicker = class {
|
|
|
1570
1780
|
/** Whether the month before (`-1`) or after (`1`) the ones on view has a day in range. */
|
|
1571
1781
|
canShowMonth(direction) {
|
|
1572
1782
|
var _a;
|
|
1573
|
-
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a :
|
|
1783
|
+
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a : this.now;
|
|
1574
1784
|
if (direction < 0)
|
|
1575
1785
|
return !this.minDate || addDays(view, -1) >= this.minDate;
|
|
1576
1786
|
return !this.maxDate || addMonths(view, this.monthCount) <= this.maxDate;
|
|
1577
1787
|
}
|
|
1578
1788
|
showMonth(event, direction) {
|
|
1579
1789
|
var _a, _b;
|
|
1580
|
-
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a :
|
|
1581
|
-
const active = (_b = parseIsoDate(this.activeDate)) !== null && _b !== void 0 ? _b :
|
|
1582
|
-
this.viewMonth = toIsoDate(addMonths(view, direction));
|
|
1583
|
-
this.activeDate = toIsoDate(clampDate(addMonths(active, direction), this.minDate, this.maxDate));
|
|
1790
|
+
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a : this.now;
|
|
1791
|
+
const active = (_b = parseIsoDate(this.activeDate)) !== null && _b !== void 0 ? _b : this.now;
|
|
1792
|
+
this.viewMonth = toIsoDate(this.inView(addMonths(view, direction)));
|
|
1793
|
+
this.activeDate = toIsoDate(clampDate(this.inView(addMonths(active, direction)), this.minDate, this.maxDate));
|
|
1584
1794
|
if (this.canShowMonth(direction)) {
|
|
1585
1795
|
// Safari doesn't focus a clicked button; without this, focus falls to the page and Escape and
|
|
1586
1796
|
// the Tab trap stop working.
|
|
@@ -1702,7 +1912,7 @@ const PdsDatepicker = class {
|
|
|
1702
1912
|
const parts = this.parsedValue();
|
|
1703
1913
|
if (!parts)
|
|
1704
1914
|
return this.triggerLabel;
|
|
1705
|
-
const dates = parts.map((part) => formatDate(part.date, locale, FULL_DATE));
|
|
1915
|
+
const dates = parts.map((part) => formatDate(part.date, locale, this.monthDay ? MONTH_AND_DAY : FULL_DATE));
|
|
1706
1916
|
return `${this.triggerLabel}, ${dates.join(RANGE_SEPARATOR)}`;
|
|
1707
1917
|
}
|
|
1708
1918
|
/** The range to highlight: the chosen one, or the start to the previewed day while picking the end. */
|
|
@@ -1716,15 +1926,15 @@ const PdsDatepicker = class {
|
|
|
1716
1926
|
}
|
|
1717
1927
|
/** The day shown as selected: the draft, which opens as the committed day and follows typing. */
|
|
1718
1928
|
selectedDay() {
|
|
1719
|
-
if (this.
|
|
1929
|
+
if (this.isRange)
|
|
1720
1930
|
return null;
|
|
1721
1931
|
return parseIsoDate(this.draftStart);
|
|
1722
1932
|
}
|
|
1723
1933
|
renderMonthHeading(view, index$2, locale, headingId) {
|
|
1724
|
-
const heading = formatDate(view, locale, { month: 'long', year: 'numeric' });
|
|
1934
|
+
const heading = formatDate(view, locale, this.monthDay ? { month: 'long' } : { month: 'long', year: 'numeric' });
|
|
1725
1935
|
// Only the first month announces itself as it changes; two months move together.
|
|
1726
1936
|
const live = index$2 === 0 ? 'polite' : null;
|
|
1727
|
-
if (!this.showDropdowns) {
|
|
1937
|
+
if (!this.showDropdowns || this.monthDay) {
|
|
1728
1938
|
return (index.h("div", { class: "pds-datepicker__heading", id: headingId, "aria-live": live }, heading));
|
|
1729
1939
|
}
|
|
1730
1940
|
const year = view.getUTCFullYear();
|
|
@@ -1750,14 +1960,14 @@ const PdsDatepicker = class {
|
|
|
1750
1960
|
const min = this.minDate;
|
|
1751
1961
|
const max = this.maxDate;
|
|
1752
1962
|
const selected = this.selectedDay();
|
|
1753
|
-
const [rangeStart, rangeEnd] = this.
|
|
1754
|
-
const now =
|
|
1755
|
-
const fullDate = dateFormatter(locale, FULL_DATE);
|
|
1963
|
+
const [rangeStart, rangeEnd] = this.isRange ? this.highlightedRange() : [null, null];
|
|
1964
|
+
const now = this.now;
|
|
1965
|
+
const fullDate = dateFormatter(locale, this.monthDay ? MONTH_AND_DAY : FULL_DATE);
|
|
1756
1966
|
const dayNumber = dateFormatter(locale, { day: 'numeric' });
|
|
1757
1967
|
const headingId = `${this.baseId}-calendar-heading-${index$2}`;
|
|
1758
1968
|
const isFirst = index$2 === 0;
|
|
1759
1969
|
const isLast = index$2 === this.monthCount - 1;
|
|
1760
|
-
return (index.h("div", { class: "pds-datepicker__month" }, index.h("div", { class: "pds-datepicker__header" }, isFirst ? (index.h("button", { type: "button", class: "pds-datepicker__nav pds-datepicker__nav--previous", "aria-label": this.previousMonthLabel, disabled: !this.canShowMonth(-1), onClick: (event) => this.showMonth(event, -1) }, index.h("pds-icon", { icon: index$1.caretLeft, "aria-hidden": "true" }))) : (index.h("span", { class: "pds-datepicker__nav-spacer" })), this.renderMonthHeading(view, index$2, locale, headingId), isLast ? (index.h("button", { type: "button", class: "pds-datepicker__nav pds-datepicker__nav--next", "aria-label": this.nextMonthLabel, disabled: !this.canShowMonth(1), onClick: (event) => this.showMonth(event, 1) }, index.h("pds-icon", { icon: index$1.caretRight, "aria-hidden": "true" }))) : (index.h("span", { class: "pds-datepicker__nav-spacer" }))), index.h("table", { class: "pds-datepicker__grid", role: "grid", "aria-labelledby": headingId, "aria-multiselectable": this.
|
|
1970
|
+
return (index.h("div", { class: "pds-datepicker__month" }, index.h("div", { class: "pds-datepicker__header" }, isFirst ? (index.h("button", { type: "button", class: "pds-datepicker__nav pds-datepicker__nav--previous", "aria-label": this.previousMonthLabel, disabled: !this.canShowMonth(-1), onClick: (event) => this.showMonth(event, -1) }, index.h("pds-icon", { icon: index$1.caretLeft, "aria-hidden": "true" }))) : (index.h("span", { class: "pds-datepicker__nav-spacer" })), this.renderMonthHeading(view, index$2, locale, headingId), isLast ? (index.h("button", { type: "button", class: "pds-datepicker__nav pds-datepicker__nav--next", "aria-label": this.nextMonthLabel, disabled: !this.canShowMonth(1), onClick: (event) => this.showMonth(event, 1) }, index.h("pds-icon", { icon: index$1.caretRight, "aria-hidden": "true" }))) : (index.h("span", { class: "pds-datepicker__nav-spacer" }))), index.h("table", { class: "pds-datepicker__grid", role: "grid", "aria-labelledby": headingId, "aria-multiselectable": this.isRange ? 'true' : null, onKeyDown: this.onGridKeyDown, onClick: this.onGridClick, onPointerOver: this.onGridPointerOver }, !this.monthDay && (index.h("thead", null, index.h("tr", null, weekdayNames(locale, this.weekStart).map((name) => (index.h("th", { scope: "col", class: "pds-datepicker__weekday" }, index.h("span", { "aria-hidden": "true" }, name.short), index.h("span", { class: "visually-hidden" }, name.long))))))), index.h("tbody", null, (this.monthDay ? monthDayRows(month) : monthWeeks(year, month, this.weekStart)).map((week) => (index.h("tr", null, week.map((date, column) => {
|
|
1761
1971
|
if (!date)
|
|
1762
1972
|
return index.h("td", { class: "pds-datepicker__day pds-datepicker__day--empty" });
|
|
1763
1973
|
const iso = toIsoDate(date);
|
|
@@ -1779,14 +1989,14 @@ const PdsDatepicker = class {
|
|
|
1779
1989
|
'pds-datepicker__day--today': isToday,
|
|
1780
1990
|
'pds-datepicker__day--disabled': unavailable,
|
|
1781
1991
|
}, "data-date": iso, tabindex: iso === this.activeDate ? '0' : '-1', "aria-label": fullDate.format(date), "aria-selected": isSelected ? 'true' : null, "aria-current": isToday ? 'date' : null, "aria-disabled": unavailable ? 'true' : null }, dayNumberText(dayNumber, date)));
|
|
1782
|
-
})))))), this.
|
|
1992
|
+
})))))), this.hasTime && this.timesUnderMonth(index$2).map((which) => this.renderTime(which, locale))));
|
|
1783
1993
|
}
|
|
1784
1994
|
/**
|
|
1785
1995
|
* The time pickers under a month: the start time under the first and the end time under the
|
|
1786
1996
|
* second, or both under the one month a narrow range shows.
|
|
1787
1997
|
*/
|
|
1788
1998
|
timesUnderMonth(index) {
|
|
1789
|
-
if (!this.
|
|
1999
|
+
if (!this.isRange)
|
|
1790
2000
|
return ['start'];
|
|
1791
2001
|
if (this.monthCount === 1)
|
|
1792
2002
|
return ['start', 'end'];
|
|
@@ -1811,7 +2021,7 @@ const PdsDatepicker = class {
|
|
|
1811
2021
|
if (this.timesBeforeTyping)
|
|
1812
2022
|
this.timesBeforeTyping[which === 'start' ? 0 : 1] = time;
|
|
1813
2023
|
};
|
|
1814
|
-
const groupLabel = !this.
|
|
2024
|
+
const groupLabel = !this.isRange ? this.timeLabel : which === 'start' ? this.startTimeLabel : this.endTimeLabel;
|
|
1815
2025
|
const isPm = hours >= 12;
|
|
1816
2026
|
const hourOptions = clock.hour12 ? Array.from({ length: 12 }, (_, i) => i + 1) : Array.from({ length: 24 }, (_, i) => i);
|
|
1817
2027
|
const shownHour = clock.hour12 ? hours % 12 || 12 : hours;
|
|
@@ -1852,7 +2062,7 @@ const PdsDatepicker = class {
|
|
|
1852
2062
|
return '';
|
|
1853
2063
|
const format = this.resolvedFormat;
|
|
1854
2064
|
const locale = this.resolvedLocale;
|
|
1855
|
-
if (this.
|
|
2065
|
+
if (this.isRange && !this.draftEnd)
|
|
1856
2066
|
return `${toFieldText(parts[0], format, locale)}${RANGE_SEPARATOR}`;
|
|
1857
2067
|
return parts.map((part) => toFieldText(part, format, locale)).join(RANGE_SEPARATOR);
|
|
1858
2068
|
}
|
|
@@ -1863,25 +2073,25 @@ const PdsDatepicker = class {
|
|
|
1863
2073
|
}
|
|
1864
2074
|
renderCalendar(locale) {
|
|
1865
2075
|
var _a;
|
|
1866
|
-
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a :
|
|
2076
|
+
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a : this.now;
|
|
1867
2077
|
const months = Array.from({ length: this.monthCount }, (_, i) => addMonths(view, i));
|
|
1868
|
-
return (index.h("div", { class: { 'pds-datepicker__dialog': true, 'pds-datepicker__dialog--range': this.
|
|
2078
|
+
return (index.h("div", { class: { 'pds-datepicker__dialog': true, 'pds-datepicker__dialog--range': this.isRange }, id: `${this.baseId}-calendar`, role: "dialog",
|
|
1869
2079
|
// A click on a part that can't take focus, as the month heading, focuses the dialog
|
|
1870
2080
|
// rather than dropping focus to the page, which would report blur mid-selection.
|
|
1871
|
-
tabindex: "-1", "aria-labelledby": this.
|
|
2081
|
+
tabindex: "-1", "aria-labelledby": this.isRange ? null : `${this.baseId}-calendar-heading-0`, "aria-label": this.isRange ? this.label || this.triggerLabel : null, part: "calendar", ref: (el) => (this.dialogEl = el), onKeyDown: this.onDialogKeyDown, onFocusin: this.onCalendarFocusIn, onFocusout: this.onCalendarFocusOut }, this.isRange && this.renderPresets(), index.h("div", { class: "pds-datepicker__panel" }, index.h("div", { class: "pds-datepicker__months" }, months.map((month, index) => this.renderMonth(month, index, locale))), this.hasFooter && this.renderFooter(), this.appliesOnPick && (
|
|
1872
2082
|
// With no footer, still announce the start once it's picked, so it's clear an end comes next.
|
|
1873
2083
|
index.h("span", { class: "visually-hidden", "aria-live": "polite" }, this.selectionText())))));
|
|
1874
2084
|
}
|
|
1875
2085
|
render() {
|
|
1876
2086
|
const locale = this.resolvedLocale;
|
|
1877
|
-
return (index.h(index.Host, { key: '
|
|
2087
|
+
return (index.h(index.Host, { key: 'd40bce6136eca084b23d38d995010592bfd702bd', class: { 'pds-datepicker--range': this.isRange, 'pds-datepicker--time': this.hasTime }, "full-width": this.fullWidth ? 'true' : null, onFocusin: this.onHostFocusIn, onFocusout: this.onHostFocusOut }, index.h("pds-input", { key: 'a047df90ca3e013a2eeb1f88e8fb033b24754f0d', ref: (el) => (this.inputEl = el), componentId: this.baseId, label: this.label, hideLabel: this.hideLabel, helperMessage: this.helperMessage, errorMessage: this.errorMessage, invalid: this.invalid || !!this.textError || !!this.valueError(), disabled: this.disabled, readonly: this.readonly, required: this.required, placeholder: this.fieldPlaceholder, fullWidth: this.fullWidth, autocomplete: "off", value: this.text, onClick: this.onFieldClick, onPdsInput: this.onTextInput, onPdsChange: this.onTextChange, onPdsKeyDown: this.onTextKeyDown, onPdsFocus: this.stopInnerEvent, onPdsBlur: this.stopInnerEvent }, this.clearable && !!this.value && this.isInteractive && (index.h("button", {
|
|
1878
2088
|
// Keyed, as is the calendar button: when Clear appears after a pick, the focused
|
|
1879
2089
|
// calendar button must stay that button rather than be reused as Clear.
|
|
1880
2090
|
key: "clear", slot: "suffix", type: "button", class: "pds-datepicker__clear", ref: (el) => (this.clearEl = el), "aria-label": this.label ? `${this.clearLabel} ${this.label}` : this.clearLabel,
|
|
1881
2091
|
// Out of the tab order, as a native search field's clear button is: Tab from a field
|
|
1882
2092
|
// just emptied would land on it as the change removes it, dropping focus to the page.
|
|
1883
2093
|
tabindex: "-1", onMouseDown: this.onClearMouseDown, onClick: this.onClearClick
|
|
1884
|
-
}, index.h("pds-icon", { key: '
|
|
2094
|
+
}, index.h("pds-icon", { key: '934fc6303da1dca04cb073c5875a0f9fc286fdd1', icon: index$1.remove, "aria-hidden": "true" }))), index.h("button", { key: "trigger", slot: "suffix", type: "button", class: "pds-datepicker__trigger", ref: (el) => (this.triggerEl = el), "aria-label": this.triggerAccessibleName(locale), "aria-haspopup": "dialog", "aria-expanded": this.isOpen ? 'true' : 'false', disabled: !this.isInteractive, onClick: this.onTriggerClick, onKeyDown: this.onTriggerKeyDown }, index.h("pds-icon", { key: '75ab4fc79ce9f95e7ee6555763166d800a2f1135', icon: index$1.calendarSimple, "aria-hidden": "true" }))), this.isOpen && this.renderCalendar(locale)));
|
|
1885
2095
|
}
|
|
1886
2096
|
static get formAssociated() { return true; }
|
|
1887
2097
|
get el() { return index.getElement(this); }
|
|
@@ -1901,6 +2111,9 @@ const PdsDatepicker = class {
|
|
|
1901
2111
|
"range": [{
|
|
1902
2112
|
"contextChanged": 0
|
|
1903
2113
|
}],
|
|
2114
|
+
"monthDay": [{
|
|
2115
|
+
"contextChanged": 0
|
|
2116
|
+
}],
|
|
1904
2117
|
"min": [{
|
|
1905
2118
|
"contextChanged": 0
|
|
1906
2119
|
}],
|