@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-4_RRPJTO.js';
|
|
2
2
|
import { a as autoUpdate, c as computePosition, o as offset, f as flip, b as size, s as shift, h as hide } from './floating-ui.dom-Cuc0DYlm.js';
|
|
3
|
-
import {
|
|
3
|
+
import { g as caretDown, j as caretLeft, k as caretRight, m as check, r as remove, n as calendarSimple } from './index-B0DXTeeV.js';
|
|
4
4
|
import { i as isSpecTest } from './form-BuRbS7Hp.js';
|
|
5
5
|
import { r as resolveLocale, f as formatMessage } from './i18n-format-BJgZHCWe.js';
|
|
6
6
|
import { a as closest } from './closest-DHPzKMVS.js';
|
|
@@ -139,6 +139,48 @@ function dateFormatter(locale, options) {
|
|
|
139
139
|
function formatDate(date, locale, options) {
|
|
140
140
|
return dateFormatter(locale, options).format(date);
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Month-day mode's year. A leap year, so February has its 29th; every date the mode holds is in it,
|
|
144
|
+
* and the value drops it (`--MM-DD`).
|
|
145
|
+
*/
|
|
146
|
+
const MONTH_DAY_YEAR = 2000;
|
|
147
|
+
const MONTH_DAY = /^--(\d{2})-(\d{2})$/;
|
|
148
|
+
/** The same month and day in month-day mode's year. */
|
|
149
|
+
function inMonthDayYear(date) {
|
|
150
|
+
return new Date(Date.UTC(MONTH_DAY_YEAR, date.getUTCMonth(), date.getUTCDate()));
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Parses a month and day, `--MM-DD` (ISO 8601 without a year), to a date in month-day mode's year.
|
|
154
|
+
* A full `YYYY-MM-DD` reads as its month and day. `null` when it isn't a real month and day.
|
|
155
|
+
*/
|
|
156
|
+
function parseMonthDay(value) {
|
|
157
|
+
const text = (value !== null && value !== void 0 ? value : '').trim();
|
|
158
|
+
const match = MONTH_DAY.exec(text);
|
|
159
|
+
if (match)
|
|
160
|
+
return parseIsoDate(`${MONTH_DAY_YEAR}-${match[1]}-${match[2]}`);
|
|
161
|
+
const date = parseIsoDate(text);
|
|
162
|
+
return date && inMonthDayYear(date);
|
|
163
|
+
}
|
|
164
|
+
/** A date's month and day as `--MM-DD`. */
|
|
165
|
+
function toMonthDay(date) {
|
|
166
|
+
return `-${toIsoDate(date).slice(4)}`;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A month's days for month-day mode, which has no weekdays: rows of seven from the 1st, with the
|
|
170
|
+
* last row filled out with `null`.
|
|
171
|
+
*/
|
|
172
|
+
function monthDayRows(month) {
|
|
173
|
+
const cells = [];
|
|
174
|
+
for (let day = 1; day <= daysInMonth(MONTH_DAY_YEAR, month); day++) {
|
|
175
|
+
cells.push(new Date(Date.UTC(MONTH_DAY_YEAR, month, day)));
|
|
176
|
+
}
|
|
177
|
+
while (cells.length % 7 !== 0)
|
|
178
|
+
cells.push(null);
|
|
179
|
+
const rows = [];
|
|
180
|
+
for (let i = 0; i < cells.length; i += 7)
|
|
181
|
+
rows.push(cells.slice(i, i + 7));
|
|
182
|
+
return rows;
|
|
183
|
+
}
|
|
142
184
|
|
|
143
185
|
/**
|
|
144
186
|
* Where the open calendar lives: a `div` in `document.body`, or in the nearest `<dialog>` so it
|
|
@@ -293,12 +335,35 @@ function builtInPresetRange(key, now) {
|
|
|
293
335
|
return null;
|
|
294
336
|
}
|
|
295
337
|
}
|
|
338
|
+
const isWholeNumber = (value) => typeof value === 'number' && Number.isInteger(value);
|
|
339
|
+
/** A preset's offset range: whole days from today, a missing or `null` one being today. `null` if unusable. */
|
|
340
|
+
function offsetPresetRange(preset, now) {
|
|
341
|
+
const { startOffset, endOffset } = preset;
|
|
342
|
+
// Checked at runtime, as offsets often come from JSON, where a missing one is often written `null`.
|
|
343
|
+
if (startOffset == null && endOffset == null)
|
|
344
|
+
return null;
|
|
345
|
+
if (startOffset != null && !isWholeNumber(startOffset))
|
|
346
|
+
return null;
|
|
347
|
+
if (endOffset != null && !isWholeNumber(endOffset))
|
|
348
|
+
return null;
|
|
349
|
+
const start = addDays(now, startOffset !== null && startOffset !== void 0 ? startOffset : 0);
|
|
350
|
+
const end = addDays(now, endOffset !== null && endOffset !== void 0 ? endOffset : 0);
|
|
351
|
+
return start <= end ? [start, end] : null;
|
|
352
|
+
}
|
|
353
|
+
// The list is re-resolved on every read, so each warning is said once.
|
|
354
|
+
const warned = new Set();
|
|
355
|
+
function warnOnce(message) {
|
|
356
|
+
if (warned.has(message))
|
|
357
|
+
return;
|
|
358
|
+
warned.add(message);
|
|
359
|
+
console.warn(`PDS Datepicker: ${message}`);
|
|
360
|
+
}
|
|
296
361
|
/**
|
|
297
362
|
* Normalizes the `presets` prop: a comma-separated list of built-in keys, or an array of presets
|
|
298
|
-
* that may relabel a built-in
|
|
299
|
-
* resolve to no range are dropped.
|
|
363
|
+
* that may relabel a built-in or give their own range. Unusable entries are dropped with a warning.
|
|
300
364
|
*/
|
|
301
365
|
function resolvePresets(presets, now) {
|
|
366
|
+
var _a;
|
|
302
367
|
const entries = typeof presets === 'string'
|
|
303
368
|
? presets
|
|
304
369
|
.split(',')
|
|
@@ -312,14 +377,26 @@ function resolvePresets(presets, now) {
|
|
|
312
377
|
for (const preset of entries) {
|
|
313
378
|
// Presets often come from parsed JSON, so check types at runtime: a non-string label would
|
|
314
379
|
// otherwise reach the render as an object, which Stencil can turn into nodes.
|
|
315
|
-
if (!preset || typeof preset.key !== 'string')
|
|
380
|
+
if (!preset || typeof preset.key !== 'string') {
|
|
381
|
+
warnOnce('a preset with no string key was left out.');
|
|
316
382
|
continue;
|
|
383
|
+
}
|
|
317
384
|
const start = typeof preset.start === 'string' ? parseIsoDate(preset.start) : null;
|
|
318
385
|
const end = typeof preset.end === 'string' ? parseIsoDate(preset.end) : null;
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
386
|
+
// Fixed days, then offsets, then the built-in range.
|
|
387
|
+
const fixed = start !== null && end !== null && start <= end ? [start, end] : null;
|
|
388
|
+
const range = (_a = fixed !== null && fixed !== void 0 ? fixed : offsetPresetRange(preset, now)) !== null && _a !== void 0 ? _a : builtInPresetRange(preset.key, now);
|
|
389
|
+
// A blank label would leave the button unnamed.
|
|
390
|
+
const label = typeof preset.label === 'string' && preset.label.trim() !== '' ? preset.label : DEFAULT_LABELS[preset.key];
|
|
391
|
+
if (range === null) {
|
|
392
|
+
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.`);
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (label === undefined) {
|
|
396
|
+
warnOnce(`preset "${preset.key}" has no label and was left out.`);
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
resolved.push({ key: preset.key, label, start: range[0], end: range[1] });
|
|
323
400
|
}
|
|
324
401
|
return resolved;
|
|
325
402
|
}
|
|
@@ -382,32 +459,50 @@ const wordsCache = new Map();
|
|
|
382
459
|
function localeWords(locale) {
|
|
383
460
|
let words = wordsCache.get(locale);
|
|
384
461
|
if (!words) {
|
|
385
|
-
const month = (style) => {
|
|
386
|
-
const format = new Intl.DateTimeFormat(locale, {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
462
|
+
const month = (style, withDay) => {
|
|
463
|
+
const format = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({ month: style }, (withDay ? { day: 'numeric' } : {})), { timeZone: 'UTC', calendar: 'gregory' }));
|
|
464
|
+
return Array.from({ length: 12 }, (_, m) => {
|
|
465
|
+
const date = new Date(Date.UTC(2023, m, 1));
|
|
466
|
+
if (!withDay)
|
|
467
|
+
return format.format(date);
|
|
468
|
+
const parts = format.formatToParts(date);
|
|
469
|
+
const index = parts.findIndex((part) => part.type === 'month');
|
|
470
|
+
if (index === -1)
|
|
471
|
+
return format.format(date);
|
|
472
|
+
// CJK locales split a counter word, as Japanese `月`, into its own literal right after the
|
|
473
|
+
// month; a literal with no space is that word, not the separator before the day.
|
|
474
|
+
const suffix = parts[index + 1];
|
|
475
|
+
return (suffix === null || suffix === void 0 ? void 0 : suffix.type) === 'literal' && !/\s/.test(suffix.value) ? parts[index].value + suffix.value : parts[index].value;
|
|
390
476
|
});
|
|
391
|
-
return Array.from({ length: 12 }, (_, m) => format.format(new Date(Date.UTC(2023, m, 1))));
|
|
392
477
|
};
|
|
393
478
|
const clock = clockFor(locale);
|
|
394
|
-
words = {
|
|
479
|
+
words = {
|
|
480
|
+
months: month('long', false),
|
|
481
|
+
shortMonths: month('short', false),
|
|
482
|
+
monthsWithDay: month('long', true),
|
|
483
|
+
shortMonthsWithDay: month('short', true),
|
|
484
|
+
am: clock.am,
|
|
485
|
+
pm: clock.pm,
|
|
486
|
+
};
|
|
395
487
|
wordsCache.set(locale, words);
|
|
396
488
|
}
|
|
397
489
|
return words;
|
|
398
490
|
}
|
|
491
|
+
/** Whether a format's tokens (see `tokensOnly`) have a day, so a month name should inflect for one. */
|
|
492
|
+
const hasDayToken = (tokens) => /D/.test(tokens);
|
|
399
493
|
/** Writes a date in a format of tokens (see `FORMAT_PARTS`), with month names and AM/PM in the locale. */
|
|
400
494
|
function formatWith(value, format, locale = 'en-US') {
|
|
401
495
|
var _a;
|
|
402
496
|
const words = localeWords(locale);
|
|
497
|
+
const withDay = hasDayToken(tokensOnly(format));
|
|
403
498
|
const [hours, minutes] = splitTime((_a = value.time) !== null && _a !== void 0 ? _a : '00:00');
|
|
404
499
|
const hour12 = hours % 12 || 12;
|
|
405
500
|
const month = value.date.getUTCMonth();
|
|
406
501
|
const period = hours < 12 ? words.am : words.pm;
|
|
407
502
|
const parts = {
|
|
408
503
|
YYYY: pad(value.date.getUTCFullYear(), 4),
|
|
409
|
-
MMMM: words.months[month],
|
|
410
|
-
MMM: words.shortMonths[month],
|
|
504
|
+
MMMM: withDay ? words.monthsWithDay[month] : words.months[month],
|
|
505
|
+
MMM: withDay ? words.shortMonthsWithDay[month] : words.shortMonths[month],
|
|
411
506
|
MM: pad(month + 1),
|
|
412
507
|
M: String(month + 1),
|
|
413
508
|
DD: pad(value.date.getUTCDate()),
|
|
@@ -429,17 +524,23 @@ const alternatives = (words) => `(${words.map(escapeRegExp).join('|')})`;
|
|
|
429
524
|
/**
|
|
430
525
|
* Reads typed text in a format of tokens, as written by `formatWith`. Leading zeros are optional,
|
|
431
526
|
* spaces are loose, and month names and AM/PM are matched without regard to case, in the locale or
|
|
432
|
-
* in English.
|
|
527
|
+
* in English. A format without `YYYY` reads into `year`, and without `year` it reads nothing.
|
|
528
|
+
* Returns `null` for anything that isn't a real date and time in that format.
|
|
433
529
|
*/
|
|
434
|
-
function parseWith(text, format, locale = 'en-US') {
|
|
530
|
+
function parseWith(text, format, locale = 'en-US', year) {
|
|
435
531
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
436
532
|
const words = localeWords(locale);
|
|
437
533
|
const english = localeWords('en-US');
|
|
534
|
+
const withDay = hasDayToken(tokensOnly(format));
|
|
535
|
+
const months = withDay ? words.monthsWithDay : words.months;
|
|
536
|
+
const shortMonths = withDay ? words.shortMonthsWithDay : words.shortMonths;
|
|
537
|
+
const englishMonths = withDay ? english.monthsWithDay : english.months;
|
|
538
|
+
const englishShortMonths = withDay ? english.shortMonthsWithDay : english.shortMonths;
|
|
438
539
|
const periods = [words.am, words.pm, english.am, english.pm];
|
|
439
540
|
const patterns = {
|
|
440
541
|
YYYY: '(\\d{4})',
|
|
441
|
-
MMMM: alternatives([...
|
|
442
|
-
MMM: alternatives([...
|
|
542
|
+
MMMM: alternatives([...months, ...englishMonths]),
|
|
543
|
+
MMM: alternatives([...shortMonths, ...englishShortMonths]),
|
|
443
544
|
MM: '(\\d{1,2})',
|
|
444
545
|
M: '(\\d{1,2})',
|
|
445
546
|
DD: '(\\d{1,2})',
|
|
@@ -486,7 +587,7 @@ function parseWith(text, format, locale = 'en-US') {
|
|
|
486
587
|
const monthIndex = (name, long) => {
|
|
487
588
|
if (name === undefined)
|
|
488
589
|
return undefined;
|
|
489
|
-
const lists = long ? [
|
|
590
|
+
const lists = long ? [months, englishMonths] : [shortMonths, englishShortMonths];
|
|
490
591
|
for (const list of lists) {
|
|
491
592
|
const index = list.findIndex((candidate) => candidate.toLowerCase() === name.toLowerCase());
|
|
492
593
|
if (index >= 0)
|
|
@@ -494,12 +595,12 @@ function parseWith(text, format, locale = 'en-US') {
|
|
|
494
595
|
}
|
|
495
596
|
return undefined;
|
|
496
597
|
};
|
|
497
|
-
const
|
|
598
|
+
const readYear = read.YYYY ? Number(read.YYYY) : year;
|
|
498
599
|
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);
|
|
499
600
|
const day = Number((_d = read.DD) !== null && _d !== void 0 ? _d : read.D);
|
|
500
|
-
if (
|
|
601
|
+
if (readYear === undefined || !month || !day)
|
|
501
602
|
return null;
|
|
502
|
-
const date = parseIsoDate(`${pad(
|
|
603
|
+
const date = parseIsoDate(`${pad(readYear, 4)}-${pad(month)}-${pad(day)}`);
|
|
503
604
|
if (!date)
|
|
504
605
|
return null;
|
|
505
606
|
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;
|
|
@@ -521,6 +622,40 @@ function parseFieldText(text, format = DEFAULT_FORMAT, locale = 'en-US') {
|
|
|
521
622
|
var _a;
|
|
522
623
|
return (_a = parseWith(text, format, locale)) !== null && _a !== void 0 ? _a : parseDateTime(text);
|
|
523
624
|
}
|
|
625
|
+
/**
|
|
626
|
+
* The locale's way of writing a month and day, as a format of tokens: `MMMM D` in English, `D MMMM`
|
|
627
|
+
* in French, `M月D日` in Japanese, or with `numeric`, `M/D` and `D/M`.
|
|
628
|
+
*/
|
|
629
|
+
function monthDayFormat(locale = 'en-US', month = 'long') {
|
|
630
|
+
const parts = dateFormatter(locale, { month, day: 'numeric' }).formatToParts(new Date(Date.UTC(MONTH_DAY_YEAR, 11, 31)));
|
|
631
|
+
return parts
|
|
632
|
+
.map((part) => {
|
|
633
|
+
// Some locales write even the long month in digits, as Japanese `12月31日`.
|
|
634
|
+
if (part.type === 'month')
|
|
635
|
+
return /^\d+$/.test(part.value) ? 'M' : 'MMMM';
|
|
636
|
+
if (part.type === 'day')
|
|
637
|
+
return 'D';
|
|
638
|
+
// Bracketed, spaces included, only when it has letters a token could be read from, as
|
|
639
|
+
// Spanish `D[ de ]MMMM`.
|
|
640
|
+
return /[A-Za-z]/.test(part.value) ? `[${part.value}]` : part.value;
|
|
641
|
+
})
|
|
642
|
+
.join('');
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Reads a typed month and day, into month-day mode's year: in the format, then as the locale writes
|
|
646
|
+
* it with a month name or in numbers, with the English order too, then as `--MM-DD` or a full ISO
|
|
647
|
+
* date, whose year is dropped.
|
|
648
|
+
*/
|
|
649
|
+
function parseMonthDayText(text, format, locale = 'en-US') {
|
|
650
|
+
const formats = [format, monthDayFormat(locale), monthDayFormat(locale, 'numeric'), 'MMMM D', 'D MMMM', 'MMM D', 'D MMM'];
|
|
651
|
+
for (const candidate of formats) {
|
|
652
|
+
const read = parseWith(text, candidate, locale, MONTH_DAY_YEAR);
|
|
653
|
+
if (read)
|
|
654
|
+
return { date: inMonthDayYear(read.date), time: null };
|
|
655
|
+
}
|
|
656
|
+
const date = parseMonthDay(text);
|
|
657
|
+
return date ? { date, time: null } : null;
|
|
658
|
+
}
|
|
524
659
|
/**
|
|
525
660
|
* Parses a typed range: two dates (with times, optionally) joined by a dash or `to` with spaces
|
|
526
661
|
* around it, as `2026-09-13 – 2026-10-13`, or by `/` when the format doesn't use slashes. The
|
|
@@ -575,6 +710,8 @@ function clockFor(locale) {
|
|
|
575
710
|
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}`;
|
|
576
711
|
|
|
577
712
|
const FULL_DATE = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
|
713
|
+
/** A day in month-day mode, which has no year and so no weekday. */
|
|
714
|
+
const MONTH_AND_DAY = { month: 'long', day: 'numeric' };
|
|
578
715
|
const DEFAULT_START_TIME = '00:00';
|
|
579
716
|
const DEFAULT_END_TIME = '23:59';
|
|
580
717
|
/** Ids for datepickers without a `component-id`, so their calendars' ids stay unique. */
|
|
@@ -653,8 +790,10 @@ const PdsDatepicker = class {
|
|
|
653
790
|
* in the locale), `MM` or `M` (month), `DD` or `D` (day), and with the time picker `HH` or `H`
|
|
654
791
|
* (24-hour), `hh` or `h` (12-hour), `mm` and `A` (AM/PM, in the locale), as `MM/DD/YYYY`,
|
|
655
792
|
* `MMM D, YYYY` or `D.M.YYYY h:mm A`. Put literal text in brackets, as `[Due] D/M/YYYY`. The value
|
|
656
|
-
* and the change event stay ISO (`YYYY-MM-DD`), whatever the format.
|
|
657
|
-
* accepted too.
|
|
793
|
+
* and the change event stay ISO (`YYYY-MM-DD`; `--MM-DD` with `month-day`), whatever the format.
|
|
794
|
+
* Typed ISO dates are always accepted too. With `month-day`, a format without `YYYY` is taken as a
|
|
795
|
+
* month-and-day format and used as given, rather than reordered for the locale; leave it unset to
|
|
796
|
+
* follow the locale instead.
|
|
658
797
|
*/
|
|
659
798
|
this.format = 'YYYY-MM-DD';
|
|
660
799
|
/**
|
|
@@ -687,6 +826,15 @@ const PdsDatepicker = class {
|
|
|
687
826
|
* Accessible label for the month dropdown, when `show-dropdowns` is set.
|
|
688
827
|
*/
|
|
689
828
|
this.monthLabel = 'Month';
|
|
829
|
+
/**
|
|
830
|
+
* Picks a month and day with no year, for a date that comes round every year, such as a birthday.
|
|
831
|
+
* The value is `--MM-DD` (ISO 8601 without a year), the field shows the date as the locale writes
|
|
832
|
+
* a month and day, and the calendar shows each month without a year or weekdays, with February
|
|
833
|
+
* always having its 29th. Turns off `range`, `time-picker`, `show-dropdowns`, `min` and `max`, and
|
|
834
|
+
* has no effect with `auto-apply`, `presets`, `first-day-of-week`, `min-date-message` or
|
|
835
|
+
* `max-date-message`, which all depend on them.
|
|
836
|
+
*/
|
|
837
|
+
this.monthDay = false;
|
|
690
838
|
/**
|
|
691
839
|
* Accessible label for the button that shows the next month.
|
|
692
840
|
*/
|
|
@@ -735,7 +883,9 @@ const PdsDatepicker = class {
|
|
|
735
883
|
this.triggerLabel = 'Choose date';
|
|
736
884
|
/**
|
|
737
885
|
* The selected date as `YYYY-MM-DD`, or in range mode the range as `YYYY-MM-DD/YYYY-MM-DD`; with
|
|
738
|
-
* the time picker, each date as `YYYY-MM-DDTHH:mm
|
|
886
|
+
* the time picker, each date as `YYYY-MM-DDTHH:mm`; with `month-day`, the month and day with no
|
|
887
|
+
* year, as `--MM-DD` (a full date is read too, as that month and day, and rewritten to it). An
|
|
888
|
+
* empty string when nothing is selected.
|
|
739
889
|
*/
|
|
740
890
|
this.value = '';
|
|
741
891
|
/**
|
|
@@ -926,17 +1076,17 @@ const PdsDatepicker = class {
|
|
|
926
1076
|
// The times before the typed text changed them, for a pick in the calendar to go back to.
|
|
927
1077
|
(_b = this.timesBeforeTyping) !== null && _b !== void 0 ? _b : (this.timesBeforeTyping = [startTime, endTime]);
|
|
928
1078
|
this.loadDraft(parts);
|
|
929
|
-
if (this.
|
|
1079
|
+
if (this.hasTime) {
|
|
930
1080
|
// A time picked in the calendar survives typing that doesn't change the time: text with no
|
|
931
1081
|
// time, as a date part-way typed, or with the time as committed.
|
|
932
1082
|
const format = this.resolvedFormat;
|
|
933
1083
|
const locale = this.resolvedLocale;
|
|
934
|
-
const typed = this.
|
|
1084
|
+
const typed = this.isRange ? parseRangeText(this.text, format, locale) : [parseFieldText(this.text, format, locale)];
|
|
935
1085
|
const committed = this.parsedValue();
|
|
936
1086
|
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); };
|
|
937
1087
|
if (keeps(0))
|
|
938
1088
|
this.startTime = startTime;
|
|
939
|
-
if (this.
|
|
1089
|
+
if (this.isRange && keeps(1))
|
|
940
1090
|
this.endTime = endTime;
|
|
941
1091
|
}
|
|
942
1092
|
this.showDate(parts[parts.length - 1].date);
|
|
@@ -1045,7 +1195,8 @@ const PdsDatepicker = class {
|
|
|
1045
1195
|
if (!active)
|
|
1046
1196
|
return;
|
|
1047
1197
|
const rtl = getComputedStyle(this.el).direction === 'rtl';
|
|
1048
|
-
|
|
1198
|
+
// Month-day mode's rows start on the 1st, not on a weekday.
|
|
1199
|
+
const column = this.monthDay ? (active.getUTCDate() - 1) % 7 : weekdayColumn(active, this.weekStart);
|
|
1049
1200
|
let next = null;
|
|
1050
1201
|
switch (event.key) {
|
|
1051
1202
|
case 'ArrowLeft':
|
|
@@ -1063,14 +1214,21 @@ const PdsDatepicker = class {
|
|
|
1063
1214
|
case 'Home':
|
|
1064
1215
|
next = addDays(active, -column);
|
|
1065
1216
|
break;
|
|
1066
|
-
case 'End':
|
|
1067
|
-
next
|
|
1217
|
+
case 'End': {
|
|
1218
|
+
// Month-day mode's rows don't carry into the next month, so End stops at the month's last day.
|
|
1219
|
+
const lastColumn = this.monthDay
|
|
1220
|
+
? Math.min(6, daysInMonth(active.getUTCFullYear(), active.getUTCMonth()) - active.getUTCDate() + column)
|
|
1221
|
+
: 6;
|
|
1222
|
+
next = addDays(active, lastColumn - column);
|
|
1068
1223
|
break;
|
|
1224
|
+
}
|
|
1069
1225
|
case 'PageUp':
|
|
1070
|
-
|
|
1226
|
+
// Month-day mode has no year to jump by, so Shift+PageUp stays put rather than passing
|
|
1227
|
+
// through a real, possibly non-leap year and clamping Feb 29 to the 28th.
|
|
1228
|
+
next = event.shiftKey && this.monthDay ? active : addMonths(active, event.shiftKey ? -12 : -1);
|
|
1071
1229
|
break;
|
|
1072
1230
|
case 'PageDown':
|
|
1073
|
-
next = addMonths(active, event.shiftKey ? 12 : 1);
|
|
1231
|
+
next = event.shiftKey && this.monthDay ? active : addMonths(active, event.shiftKey ? 12 : 1);
|
|
1074
1232
|
break;
|
|
1075
1233
|
case 'Enter':
|
|
1076
1234
|
case ' ':
|
|
@@ -1083,9 +1241,9 @@ const PdsDatepicker = class {
|
|
|
1083
1241
|
return;
|
|
1084
1242
|
}
|
|
1085
1243
|
event.preventDefault();
|
|
1086
|
-
const target = clampDate(next, this.minDate, this.maxDate);
|
|
1244
|
+
const target = clampDate(this.inView(next), this.minDate, this.maxDate);
|
|
1087
1245
|
this.showDate(target);
|
|
1088
|
-
if (this.
|
|
1246
|
+
if (this.isRange)
|
|
1089
1247
|
this.previewDate = toIsoDate(target);
|
|
1090
1248
|
this.focusActiveDay = true;
|
|
1091
1249
|
};
|
|
@@ -1096,7 +1254,7 @@ const PdsDatepicker = class {
|
|
|
1096
1254
|
this.pickDate(date);
|
|
1097
1255
|
};
|
|
1098
1256
|
this.onGridPointerOver = (event) => {
|
|
1099
|
-
if (!this.
|
|
1257
|
+
if (!this.isRange || !this.draftStart || this.draftEnd)
|
|
1100
1258
|
return;
|
|
1101
1259
|
const date = this.dayFromEvent(event);
|
|
1102
1260
|
const iso = date && toIsoDate(date);
|
|
@@ -1145,19 +1303,28 @@ const PdsDatepicker = class {
|
|
|
1145
1303
|
var _a;
|
|
1146
1304
|
this.text = this.fieldText();
|
|
1147
1305
|
this.textError = '';
|
|
1306
|
+
const parts = this.parsedValue();
|
|
1307
|
+
// A full date reads as its month and day; keep what's submitted in step with what's shown,
|
|
1308
|
+
// rather than passing through whichever spelling was set until the next pick rewrites it.
|
|
1309
|
+
if (this.monthDay && parts) {
|
|
1310
|
+
const normalized = this.dayValue(parts[0].date);
|
|
1311
|
+
if (this.value !== normalized)
|
|
1312
|
+
this.value = normalized;
|
|
1313
|
+
}
|
|
1148
1314
|
this.updateFormValue();
|
|
1149
1315
|
if (!this.isOpen)
|
|
1150
1316
|
return;
|
|
1151
|
-
const parts = this.parsedValue();
|
|
1152
1317
|
this.loadDraft(parts);
|
|
1153
|
-
const day = (_a = (parts && parts[parts.length - 1].date)) !== null && _a !== void 0 ? _a :
|
|
1318
|
+
const day = (_a = (parts && parts[parts.length - 1].date)) !== null && _a !== void 0 ? _a : this.now;
|
|
1154
1319
|
this.showDate(clampDate(day, this.minDate, this.maxDate), true);
|
|
1155
1320
|
}
|
|
1156
1321
|
requiredChanged() {
|
|
1157
1322
|
this.updateFormValue();
|
|
1158
1323
|
}
|
|
1159
1324
|
componentWillLoad() {
|
|
1160
|
-
|
|
1325
|
+
// Through the same path a later value/context change takes, so an initial full date in
|
|
1326
|
+
// month-day mode submits normalized too, not only after the first pick rewrites it.
|
|
1327
|
+
this.refreshFromValue();
|
|
1161
1328
|
}
|
|
1162
1329
|
connectedCallback() {
|
|
1163
1330
|
if (this.el.attachInternals && !this.internals) {
|
|
@@ -1207,10 +1374,30 @@ const PdsDatepicker = class {
|
|
|
1207
1374
|
return localeFirstDayOfWeek(this.resolvedLocale);
|
|
1208
1375
|
}
|
|
1209
1376
|
get minDate() {
|
|
1210
|
-
return parseIsoDate(this.min);
|
|
1377
|
+
return this.monthDay ? null : parseIsoDate(this.min);
|
|
1211
1378
|
}
|
|
1212
1379
|
get maxDate() {
|
|
1213
|
-
return parseIsoDate(this.max);
|
|
1380
|
+
return this.monthDay ? null : parseIsoDate(this.max);
|
|
1381
|
+
}
|
|
1382
|
+
/** Range mode, which month-day mode turns off. */
|
|
1383
|
+
get isRange() {
|
|
1384
|
+
return this.range && !this.monthDay;
|
|
1385
|
+
}
|
|
1386
|
+
/** The time picker, which month-day mode turns off. */
|
|
1387
|
+
get hasTime() {
|
|
1388
|
+
return this.timePicker && !this.monthDay;
|
|
1389
|
+
}
|
|
1390
|
+
/** Today, or in month-day mode today's month and day. */
|
|
1391
|
+
get now() {
|
|
1392
|
+
return this.monthDay ? inMonthDayYear(today()) : today();
|
|
1393
|
+
}
|
|
1394
|
+
/** In month-day mode, a date moved to the mode's year, as when the calendar wraps past December. */
|
|
1395
|
+
inView(date) {
|
|
1396
|
+
return this.monthDay ? inMonthDayYear(date) : date;
|
|
1397
|
+
}
|
|
1398
|
+
/** One day as the value holds it: `YYYY-MM-DD`, or `--MM-DD` in month-day mode. */
|
|
1399
|
+
dayValue(date) {
|
|
1400
|
+
return this.monthDay ? toMonthDay(date) : toIsoDate(date);
|
|
1214
1401
|
}
|
|
1215
1402
|
get isInteractive() {
|
|
1216
1403
|
return !this.disabled && !this.readonly;
|
|
@@ -1218,22 +1405,22 @@ const PdsDatepicker = class {
|
|
|
1218
1405
|
/** How many months the calendar shows side by side. */
|
|
1219
1406
|
get monthCount() {
|
|
1220
1407
|
const narrow = typeof window !== 'undefined' && window.innerWidth < TWO_MONTHS_MIN_WIDTH;
|
|
1221
|
-
return this.
|
|
1408
|
+
return this.isRange && !narrow ? 2 : 1;
|
|
1222
1409
|
}
|
|
1223
1410
|
/** Whether picks apply at once, without the footer: `auto-apply` in range mode, without times. */
|
|
1224
1411
|
get appliesOnPick() {
|
|
1225
|
-
return this.
|
|
1412
|
+
return this.isRange && this.autoApply && !this.hasTime;
|
|
1226
1413
|
}
|
|
1227
1414
|
/** Whether picks wait for Apply: for a range, unless it auto-applies, and for a date with a time. */
|
|
1228
1415
|
get hasFooter() {
|
|
1229
|
-
return (this.
|
|
1416
|
+
return (this.isRange || this.hasTime) && !this.appliesOnPick;
|
|
1230
1417
|
}
|
|
1231
1418
|
get resolvedPresets() {
|
|
1232
|
-
return this.
|
|
1419
|
+
return this.isRange ? resolvePresets(this.presets, today()) : [];
|
|
1233
1420
|
}
|
|
1234
1421
|
/** The committed value, parsed: one date, or a range's start and end. */
|
|
1235
1422
|
parsedValue(value = this.value) {
|
|
1236
|
-
if (this.
|
|
1423
|
+
if (this.isRange) {
|
|
1237
1424
|
const [start, end, extra] = (value !== null && value !== void 0 ? value : '').split('/');
|
|
1238
1425
|
const startValue = parseDateTime(start);
|
|
1239
1426
|
const endValue = parseDateTime(end);
|
|
@@ -1241,12 +1428,22 @@ const PdsDatepicker = class {
|
|
|
1241
1428
|
? [startValue, endValue]
|
|
1242
1429
|
: null;
|
|
1243
1430
|
}
|
|
1431
|
+
if (this.monthDay) {
|
|
1432
|
+
const date = parseMonthDay(value);
|
|
1433
|
+
return date ? [{ date, time: null }] : null;
|
|
1434
|
+
}
|
|
1244
1435
|
const single = parseDateTime(value);
|
|
1245
1436
|
return single ? [single] : null;
|
|
1246
1437
|
}
|
|
1247
1438
|
/** The format the field shows and reads, with a time when the time picker is on. */
|
|
1248
1439
|
get resolvedFormat() {
|
|
1249
|
-
|
|
1440
|
+
var _a, _b;
|
|
1441
|
+
if (this.monthDay) {
|
|
1442
|
+
// A format with a year is the default, or one for full dates: use the locale's month and day.
|
|
1443
|
+
const format = (_b = (_a = this.format) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
|
|
1444
|
+
return format !== '' && !/YYYY/.test(format.replace(/\[[^\]]*\]/g, '')) ? format : monthDayFormat(this.resolvedLocale);
|
|
1445
|
+
}
|
|
1446
|
+
return fieldFormat(this.format, this.hasTime, this.hasTime && clockFor(this.resolvedLocale).hour12);
|
|
1250
1447
|
}
|
|
1251
1448
|
/** What the field shows for the committed value. */
|
|
1252
1449
|
fieldText() {
|
|
@@ -1262,20 +1459,24 @@ const PdsDatepicker = class {
|
|
|
1262
1459
|
/** Drops a time the time picker doesn't show, or adds the default one it does. */
|
|
1263
1460
|
withTimePicker(value, fallback = DEFAULT_START_TIME) {
|
|
1264
1461
|
var _a;
|
|
1265
|
-
return { date: value.date, time: this.
|
|
1462
|
+
return { date: value.date, time: this.hasTime ? ((_a = value.time) !== null && _a !== void 0 ? _a : fallback) : null };
|
|
1266
1463
|
}
|
|
1267
1464
|
get fieldPlaceholder() {
|
|
1268
1465
|
if (this.placeholder)
|
|
1269
1466
|
return this.placeholder;
|
|
1467
|
+
// Month-day tokens, as `MMMM D`, don't read as a hint; an example date does.
|
|
1468
|
+
if (this.monthDay) {
|
|
1469
|
+
return formatWith({ date: parseMonthDay('--12-31'), time: null }, this.resolvedFormat, this.resolvedLocale);
|
|
1470
|
+
}
|
|
1270
1471
|
const one = this.resolvedFormat;
|
|
1271
|
-
return this.
|
|
1472
|
+
return this.isRange ? `${one}${RANGE_SEPARATOR}${one}` : one;
|
|
1272
1473
|
}
|
|
1273
1474
|
/** Loads the committed value into the draft the calendar edits. */
|
|
1274
1475
|
loadDraft(parts) {
|
|
1275
1476
|
var _a, _b;
|
|
1276
1477
|
const [start, end] = parts !== null && parts !== void 0 ? parts : [];
|
|
1277
1478
|
this.draftStart = start ? toIsoDate(start.date) : '';
|
|
1278
|
-
this.draftEnd = this.
|
|
1479
|
+
this.draftEnd = this.isRange && end ? toIsoDate(end.date) : '';
|
|
1279
1480
|
this.startTime = (_a = start === null || start === void 0 ? void 0 : start.time) !== null && _a !== void 0 ? _a : DEFAULT_START_TIME;
|
|
1280
1481
|
this.endTime = (_b = end === null || end === void 0 ? void 0 : end.time) !== null && _b !== void 0 ? _b : DEFAULT_END_TIME;
|
|
1281
1482
|
this.previewDate = '';
|
|
@@ -1291,7 +1492,7 @@ const PdsDatepicker = class {
|
|
|
1291
1492
|
const parts = this.parsedValue();
|
|
1292
1493
|
this.loadDraft(parts);
|
|
1293
1494
|
this.valueAtOpen = (_a = this.value) !== null && _a !== void 0 ? _a : '';
|
|
1294
|
-
const start = (_b = (parts && parts[parts.length - 1].date)) !== null && _b !== void 0 ? _b :
|
|
1495
|
+
const start = (_b = (parts && parts[parts.length - 1].date)) !== null && _b !== void 0 ? _b : this.now;
|
|
1295
1496
|
this.showDate(clampDate(start, this.minDate, this.maxDate), true);
|
|
1296
1497
|
this.focusActiveDay = focusDay;
|
|
1297
1498
|
this.isOpen = true;
|
|
@@ -1313,7 +1514,8 @@ const PdsDatepicker = class {
|
|
|
1313
1514
|
* Makes a day the active one and brings it into view. With two months, a day already on view
|
|
1314
1515
|
* doesn't move the view; `reset` lines the view up so the day is in the last month shown.
|
|
1315
1516
|
*/
|
|
1316
|
-
showDate(
|
|
1517
|
+
showDate(day, reset = false) {
|
|
1518
|
+
const date = this.inView(day);
|
|
1317
1519
|
const first = firstOfMonth(date);
|
|
1318
1520
|
const view = parseIsoDate(this.viewMonth);
|
|
1319
1521
|
const lastView = view && addMonths(view, this.monthCount - 1);
|
|
@@ -1331,15 +1533,15 @@ const PdsDatepicker = class {
|
|
|
1331
1533
|
// A pick in the calendar takes over from typed text, so dismissing afterwards commits nothing,
|
|
1332
1534
|
// as when nothing was typed.
|
|
1333
1535
|
this.dropTypedText();
|
|
1334
|
-
if (this.
|
|
1536
|
+
if (this.isRange) {
|
|
1335
1537
|
this.pickRangeDay(date);
|
|
1336
1538
|
}
|
|
1337
|
-
else if (this.
|
|
1539
|
+
else if (this.hasTime) {
|
|
1338
1540
|
this.draftStart = toIsoDate(date);
|
|
1339
1541
|
this.activeDate = this.draftStart;
|
|
1340
1542
|
}
|
|
1341
1543
|
else {
|
|
1342
|
-
this.commitValue(
|
|
1544
|
+
this.commitValue(this.dayValue(date));
|
|
1343
1545
|
this.closeCalendar(true);
|
|
1344
1546
|
}
|
|
1345
1547
|
}
|
|
@@ -1383,7 +1585,11 @@ const PdsDatepicker = class {
|
|
|
1383
1585
|
}
|
|
1384
1586
|
/** Commits one date, or a range with its start, end and matching preset. */
|
|
1385
1587
|
commitParts(parts) {
|
|
1386
|
-
if (
|
|
1588
|
+
if (this.monthDay) {
|
|
1589
|
+
this.commitValue(toMonthDay(parts[0].date));
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
if (!this.isRange) {
|
|
1387
1593
|
this.commitValue(toValueString(parts[0]));
|
|
1388
1594
|
return;
|
|
1389
1595
|
}
|
|
@@ -1398,7 +1604,7 @@ const PdsDatepicker = class {
|
|
|
1398
1604
|
if (!startDate)
|
|
1399
1605
|
return null;
|
|
1400
1606
|
const start = this.withTimePicker({ date: startDate, time: this.startTime });
|
|
1401
|
-
if (!this.
|
|
1607
|
+
if (!this.isRange)
|
|
1402
1608
|
return [start];
|
|
1403
1609
|
const end = this.withTimePicker({ date: (_a = parseIsoDate(this.draftEnd)) !== null && _a !== void 0 ? _a : startDate, time: this.endTime });
|
|
1404
1610
|
// An end time before the start time on the same day ends at the start.
|
|
@@ -1524,7 +1730,11 @@ const PdsDatepicker = class {
|
|
|
1524
1730
|
readText(text) {
|
|
1525
1731
|
const format = this.resolvedFormat;
|
|
1526
1732
|
const locale = this.resolvedLocale;
|
|
1527
|
-
const parts = this.
|
|
1733
|
+
const parts = this.monthDay
|
|
1734
|
+
? [parseMonthDayText(text, format, locale)]
|
|
1735
|
+
: this.isRange
|
|
1736
|
+
? parseRangeText(text, format, locale)
|
|
1737
|
+
: [parseFieldText(text, format, locale)];
|
|
1528
1738
|
if (!parts || parts.some((part) => !part))
|
|
1529
1739
|
return null;
|
|
1530
1740
|
return parts.map((part, i) => this.withTimePicker(part, i === 1 ? DEFAULT_END_TIME : DEFAULT_START_TIME));
|
|
@@ -1568,17 +1778,17 @@ const PdsDatepicker = class {
|
|
|
1568
1778
|
/** Whether the month before (`-1`) or after (`1`) the ones on view has a day in range. */
|
|
1569
1779
|
canShowMonth(direction) {
|
|
1570
1780
|
var _a;
|
|
1571
|
-
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a :
|
|
1781
|
+
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a : this.now;
|
|
1572
1782
|
if (direction < 0)
|
|
1573
1783
|
return !this.minDate || addDays(view, -1) >= this.minDate;
|
|
1574
1784
|
return !this.maxDate || addMonths(view, this.monthCount) <= this.maxDate;
|
|
1575
1785
|
}
|
|
1576
1786
|
showMonth(event, direction) {
|
|
1577
1787
|
var _a, _b;
|
|
1578
|
-
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a :
|
|
1579
|
-
const active = (_b = parseIsoDate(this.activeDate)) !== null && _b !== void 0 ? _b :
|
|
1580
|
-
this.viewMonth = toIsoDate(addMonths(view, direction));
|
|
1581
|
-
this.activeDate = toIsoDate(clampDate(addMonths(active, direction), this.minDate, this.maxDate));
|
|
1788
|
+
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a : this.now;
|
|
1789
|
+
const active = (_b = parseIsoDate(this.activeDate)) !== null && _b !== void 0 ? _b : this.now;
|
|
1790
|
+
this.viewMonth = toIsoDate(this.inView(addMonths(view, direction)));
|
|
1791
|
+
this.activeDate = toIsoDate(clampDate(this.inView(addMonths(active, direction)), this.minDate, this.maxDate));
|
|
1582
1792
|
if (this.canShowMonth(direction)) {
|
|
1583
1793
|
// Safari doesn't focus a clicked button; without this, focus falls to the page and Escape and
|
|
1584
1794
|
// the Tab trap stop working.
|
|
@@ -1700,7 +1910,7 @@ const PdsDatepicker = class {
|
|
|
1700
1910
|
const parts = this.parsedValue();
|
|
1701
1911
|
if (!parts)
|
|
1702
1912
|
return this.triggerLabel;
|
|
1703
|
-
const dates = parts.map((part) => formatDate(part.date, locale, FULL_DATE));
|
|
1913
|
+
const dates = parts.map((part) => formatDate(part.date, locale, this.monthDay ? MONTH_AND_DAY : FULL_DATE));
|
|
1704
1914
|
return `${this.triggerLabel}, ${dates.join(RANGE_SEPARATOR)}`;
|
|
1705
1915
|
}
|
|
1706
1916
|
/** The range to highlight: the chosen one, or the start to the previewed day while picking the end. */
|
|
@@ -1714,15 +1924,15 @@ const PdsDatepicker = class {
|
|
|
1714
1924
|
}
|
|
1715
1925
|
/** The day shown as selected: the draft, which opens as the committed day and follows typing. */
|
|
1716
1926
|
selectedDay() {
|
|
1717
|
-
if (this.
|
|
1927
|
+
if (this.isRange)
|
|
1718
1928
|
return null;
|
|
1719
1929
|
return parseIsoDate(this.draftStart);
|
|
1720
1930
|
}
|
|
1721
1931
|
renderMonthHeading(view, index, locale, headingId) {
|
|
1722
|
-
const heading = formatDate(view, locale, { month: 'long', year: 'numeric' });
|
|
1932
|
+
const heading = formatDate(view, locale, this.monthDay ? { month: 'long' } : { month: 'long', year: 'numeric' });
|
|
1723
1933
|
// Only the first month announces itself as it changes; two months move together.
|
|
1724
1934
|
const live = index === 0 ? 'polite' : null;
|
|
1725
|
-
if (!this.showDropdowns) {
|
|
1935
|
+
if (!this.showDropdowns || this.monthDay) {
|
|
1726
1936
|
return (h("div", { class: "pds-datepicker__heading", id: headingId, "aria-live": live }, heading));
|
|
1727
1937
|
}
|
|
1728
1938
|
const year = view.getUTCFullYear();
|
|
@@ -1748,14 +1958,14 @@ const PdsDatepicker = class {
|
|
|
1748
1958
|
const min = this.minDate;
|
|
1749
1959
|
const max = this.maxDate;
|
|
1750
1960
|
const selected = this.selectedDay();
|
|
1751
|
-
const [rangeStart, rangeEnd] = this.
|
|
1752
|
-
const now =
|
|
1753
|
-
const fullDate = dateFormatter(locale, FULL_DATE);
|
|
1961
|
+
const [rangeStart, rangeEnd] = this.isRange ? this.highlightedRange() : [null, null];
|
|
1962
|
+
const now = this.now;
|
|
1963
|
+
const fullDate = dateFormatter(locale, this.monthDay ? MONTH_AND_DAY : FULL_DATE);
|
|
1754
1964
|
const dayNumber = dateFormatter(locale, { day: 'numeric' });
|
|
1755
1965
|
const headingId = `${this.baseId}-calendar-heading-${index}`;
|
|
1756
1966
|
const isFirst = index === 0;
|
|
1757
1967
|
const isLast = index === this.monthCount - 1;
|
|
1758
|
-
return (h("div", { class: "pds-datepicker__month" }, h("div", { class: "pds-datepicker__header" }, isFirst ? (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) }, h("pds-icon", { icon: caretLeft, "aria-hidden": "true" }))) : (h("span", { class: "pds-datepicker__nav-spacer" })), this.renderMonthHeading(view, index, locale, headingId), isLast ? (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) }, h("pds-icon", { icon: caretRight, "aria-hidden": "true" }))) : (h("span", { class: "pds-datepicker__nav-spacer" }))), h("table", { class: "pds-datepicker__grid", role: "grid", "aria-labelledby": headingId, "aria-multiselectable": this.
|
|
1968
|
+
return (h("div", { class: "pds-datepicker__month" }, h("div", { class: "pds-datepicker__header" }, isFirst ? (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) }, h("pds-icon", { icon: caretLeft, "aria-hidden": "true" }))) : (h("span", { class: "pds-datepicker__nav-spacer" })), this.renderMonthHeading(view, index, locale, headingId), isLast ? (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) }, h("pds-icon", { icon: caretRight, "aria-hidden": "true" }))) : (h("span", { class: "pds-datepicker__nav-spacer" }))), 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 && (h("thead", null, h("tr", null, weekdayNames(locale, this.weekStart).map((name) => (h("th", { scope: "col", class: "pds-datepicker__weekday" }, h("span", { "aria-hidden": "true" }, name.short), h("span", { class: "visually-hidden" }, name.long))))))), h("tbody", null, (this.monthDay ? monthDayRows(month) : monthWeeks(year, month, this.weekStart)).map((week) => (h("tr", null, week.map((date, column) => {
|
|
1759
1969
|
if (!date)
|
|
1760
1970
|
return h("td", { class: "pds-datepicker__day pds-datepicker__day--empty" });
|
|
1761
1971
|
const iso = toIsoDate(date);
|
|
@@ -1777,14 +1987,14 @@ const PdsDatepicker = class {
|
|
|
1777
1987
|
'pds-datepicker__day--today': isToday,
|
|
1778
1988
|
'pds-datepicker__day--disabled': unavailable,
|
|
1779
1989
|
}, "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)));
|
|
1780
|
-
})))))), this.
|
|
1990
|
+
})))))), this.hasTime && this.timesUnderMonth(index).map((which) => this.renderTime(which, locale))));
|
|
1781
1991
|
}
|
|
1782
1992
|
/**
|
|
1783
1993
|
* The time pickers under a month: the start time under the first and the end time under the
|
|
1784
1994
|
* second, or both under the one month a narrow range shows.
|
|
1785
1995
|
*/
|
|
1786
1996
|
timesUnderMonth(index) {
|
|
1787
|
-
if (!this.
|
|
1997
|
+
if (!this.isRange)
|
|
1788
1998
|
return ['start'];
|
|
1789
1999
|
if (this.monthCount === 1)
|
|
1790
2000
|
return ['start', 'end'];
|
|
@@ -1809,7 +2019,7 @@ const PdsDatepicker = class {
|
|
|
1809
2019
|
if (this.timesBeforeTyping)
|
|
1810
2020
|
this.timesBeforeTyping[which === 'start' ? 0 : 1] = time;
|
|
1811
2021
|
};
|
|
1812
|
-
const groupLabel = !this.
|
|
2022
|
+
const groupLabel = !this.isRange ? this.timeLabel : which === 'start' ? this.startTimeLabel : this.endTimeLabel;
|
|
1813
2023
|
const isPm = hours >= 12;
|
|
1814
2024
|
const hourOptions = clock.hour12 ? Array.from({ length: 12 }, (_, i) => i + 1) : Array.from({ length: 24 }, (_, i) => i);
|
|
1815
2025
|
const shownHour = clock.hour12 ? hours % 12 || 12 : hours;
|
|
@@ -1850,7 +2060,7 @@ const PdsDatepicker = class {
|
|
|
1850
2060
|
return '';
|
|
1851
2061
|
const format = this.resolvedFormat;
|
|
1852
2062
|
const locale = this.resolvedLocale;
|
|
1853
|
-
if (this.
|
|
2063
|
+
if (this.isRange && !this.draftEnd)
|
|
1854
2064
|
return `${toFieldText(parts[0], format, locale)}${RANGE_SEPARATOR}`;
|
|
1855
2065
|
return parts.map((part) => toFieldText(part, format, locale)).join(RANGE_SEPARATOR);
|
|
1856
2066
|
}
|
|
@@ -1861,25 +2071,25 @@ const PdsDatepicker = class {
|
|
|
1861
2071
|
}
|
|
1862
2072
|
renderCalendar(locale) {
|
|
1863
2073
|
var _a;
|
|
1864
|
-
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a :
|
|
2074
|
+
const view = (_a = parseIsoDate(this.viewMonth)) !== null && _a !== void 0 ? _a : this.now;
|
|
1865
2075
|
const months = Array.from({ length: this.monthCount }, (_, i) => addMonths(view, i));
|
|
1866
|
-
return (h("div", { class: { 'pds-datepicker__dialog': true, 'pds-datepicker__dialog--range': this.
|
|
2076
|
+
return (h("div", { class: { 'pds-datepicker__dialog': true, 'pds-datepicker__dialog--range': this.isRange }, id: `${this.baseId}-calendar`, role: "dialog",
|
|
1867
2077
|
// A click on a part that can't take focus, as the month heading, focuses the dialog
|
|
1868
2078
|
// rather than dropping focus to the page, which would report blur mid-selection.
|
|
1869
|
-
tabindex: "-1", "aria-labelledby": this.
|
|
2079
|
+
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(), h("div", { class: "pds-datepicker__panel" }, h("div", { class: "pds-datepicker__months" }, months.map((month, index) => this.renderMonth(month, index, locale))), this.hasFooter && this.renderFooter(), this.appliesOnPick && (
|
|
1870
2080
|
// With no footer, still announce the start once it's picked, so it's clear an end comes next.
|
|
1871
2081
|
h("span", { class: "visually-hidden", "aria-live": "polite" }, this.selectionText())))));
|
|
1872
2082
|
}
|
|
1873
2083
|
render() {
|
|
1874
2084
|
const locale = this.resolvedLocale;
|
|
1875
|
-
return (h(Host, { key: '
|
|
2085
|
+
return (h(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 }, 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 && (h("button", {
|
|
1876
2086
|
// Keyed, as is the calendar button: when Clear appears after a pick, the focused
|
|
1877
2087
|
// calendar button must stay that button rather than be reused as Clear.
|
|
1878
2088
|
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,
|
|
1879
2089
|
// Out of the tab order, as a native search field's clear button is: Tab from a field
|
|
1880
2090
|
// just emptied would land on it as the change removes it, dropping focus to the page.
|
|
1881
2091
|
tabindex: "-1", onMouseDown: this.onClearMouseDown, onClick: this.onClearClick
|
|
1882
|
-
}, h("pds-icon", { key: '
|
|
2092
|
+
}, h("pds-icon", { key: '934fc6303da1dca04cb073c5875a0f9fc286fdd1', icon: remove, "aria-hidden": "true" }))), 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 }, h("pds-icon", { key: '75ab4fc79ce9f95e7ee6555763166d800a2f1135', icon: calendarSimple, "aria-hidden": "true" }))), this.isOpen && this.renderCalendar(locale)));
|
|
1883
2093
|
}
|
|
1884
2094
|
static get formAssociated() { return true; }
|
|
1885
2095
|
get el() { return getElement(this); }
|
|
@@ -1899,6 +2109,9 @@ const PdsDatepicker = class {
|
|
|
1899
2109
|
"range": [{
|
|
1900
2110
|
"contextChanged": 0
|
|
1901
2111
|
}],
|
|
2112
|
+
"monthDay": [{
|
|
2113
|
+
"contextChanged": 0
|
|
2114
|
+
}],
|
|
1902
2115
|
"min": [{
|
|
1903
2116
|
"contextChanged": 0
|
|
1904
2117
|
}],
|