@pine-ds/core 4.2.0 → 4.4.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/closest.js +1 -1
- package/components/floating-ui.dom.js +1 -1
- package/components/i18n-format.js +1 -1
- package/components/index.d.ts +2 -0
- package/components/index.js +1 -1
- package/components/index2.js +1 -1
- package/components/mock-pds-modal.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-container.js +1 -1
- package/components/pds-copytext.js +1 -1
- package/components/pds-datepicker.d.ts +11 -0
- package/components/pds-datepicker.js +1 -0
- package/components/pds-divider.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-filters.js +1 -1
- package/components/pds-icon2.js +1 -1
- package/components/pds-image.js +1 -1
- package/components/pds-input.js +1 -1
- package/components/pds-input2.js +1 -0
- package/components/pds-link2.js +1 -1
- package/components/pds-loader2.js +1 -1
- package/components/pds-modal-content.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-property.js +1 -1
- package/components/pds-radio-group.js +1 -1
- package/components/pds-radio.js +1 -1
- package/components/pds-row.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-tabpanel.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/utils.js +1 -1
- package/dist/cjs/closest-D0qyYtJ3.js +20 -0
- package/dist/cjs/{floating-ui.dom-BZk7Blsu.js → floating-ui.dom-Dc8Anyel.js} +79 -0
- package/dist/cjs/{i18n-format-CrpIhahc.js → i18n-format-BD0PmYzT.js} +1 -0
- package/dist/cjs/{index-CuQil7H0.js → index-Bl5KnQay.js} +4 -1
- package/dist/cjs/{index-Bu3NXpbK.js → index-D-QQKB0y.js} +9 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mock-pds-modal.cjs.entry.js +3 -3
- package/dist/cjs/pds-accordion.cjs.entry.js +2 -2
- package/dist/cjs/pds-alert.cjs.entry.js +1 -1
- package/dist/cjs/pds-avatar.cjs.entry.js +2 -2
- package/dist/cjs/pds-box.cjs.entry.js +2 -2
- package/dist/cjs/pds-button.cjs.entry.js +54 -5
- package/dist/cjs/pds-checkbox.cjs.entry.js +14 -6
- package/dist/cjs/pds-chip.cjs.entry.js +34 -9
- package/dist/cjs/pds-combobox.cjs.entry.js +1225 -117
- package/dist/cjs/pds-container.cjs.entry.js +2 -2
- package/dist/cjs/pds-copytext.cjs.entry.js +5 -5
- package/dist/cjs/pds-datepicker.cjs.entry.js +1962 -0
- package/dist/cjs/pds-divider.cjs.entry.js +2 -2
- package/dist/cjs/pds-drawer-content.cjs.entry.js +2 -2
- package/dist/cjs/pds-drawer-footer.cjs.entry.js +2 -2
- package/dist/cjs/pds-drawer-header.cjs.entry.js +2 -2
- package/dist/cjs/pds-drawer.cjs.entry.js +11 -4
- package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +2 -2
- package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js +2 -2
- package/dist/cjs/pds-dropdown-menu.cjs.entry.js +11 -4
- package/dist/cjs/pds-filter.cjs.entry.js +3 -3
- package/dist/cjs/pds-filters.cjs.entry.js +2 -2
- package/dist/cjs/pds-icon.cjs.entry.js +2 -2
- package/dist/cjs/pds-image.cjs.entry.js +3 -3
- package/dist/cjs/pds-input.cjs.entry.js +8 -5
- package/dist/cjs/pds-link.cjs.entry.js +5 -5
- package/dist/cjs/pds-loader.cjs.entry.js +2 -2
- package/dist/cjs/pds-modal-content.cjs.entry.js +3 -3
- package/dist/cjs/pds-modal-footer.cjs.entry.js +2 -2
- package/dist/cjs/pds-modal-header.cjs.entry.js +2 -2
- package/dist/cjs/pds-modal.cjs.entry.js +42 -8
- package/dist/cjs/pds-multiselect.cjs.entry.js +264 -51
- package/dist/cjs/pds-popover.cjs.entry.js +30 -12
- package/dist/cjs/pds-progress.cjs.entry.js +4 -2
- package/dist/cjs/pds-property.cjs.entry.js +2 -2
- package/dist/cjs/pds-radio-group.cjs.entry.js +5 -5
- package/dist/cjs/pds-radio.cjs.entry.js +6 -6
- package/dist/cjs/pds-row.cjs.entry.js +2 -2
- package/dist/cjs/pds-select.cjs.entry.js +3 -3
- package/dist/cjs/pds-sortable-item.cjs.entry.js +3 -3
- package/dist/cjs/pds-sortable.cjs.entry.js +2 -2
- package/dist/cjs/pds-switch.cjs.entry.js +14 -6
- package/dist/cjs/pds-tab.cjs.entry.js +1 -1
- package/dist/cjs/pds-table-body.cjs.entry.js +2 -2
- package/dist/cjs/pds-table-cell.cjs.entry.js +5 -5
- package/dist/cjs/pds-table-head-cell.cjs.entry.js +4 -4
- package/dist/cjs/pds-table-head.cjs.entry.js +3 -3
- package/dist/cjs/pds-table-row.cjs.entry.js +3 -3
- package/dist/cjs/pds-table.cjs.entry.js +1 -1
- package/dist/cjs/pds-tabpanel.cjs.entry.js +2 -2
- package/dist/cjs/pds-tabs.cjs.entry.js +2 -2
- package/dist/cjs/pds-text.cjs.entry.js +5 -5
- package/dist/cjs/pds-textarea.cjs.entry.js +14 -9
- package/dist/cjs/pds-toast.cjs.entry.js +4 -4
- package/dist/cjs/pds-tooltip.cjs.entry.js +4 -4
- package/dist/cjs/pine-core.cjs.js +2 -2
- package/dist/cjs/{truncation-tooltip-Bps7_rUy.js → truncation-tooltip-CYgQfBLt.js} +1 -1
- package/dist/cjs/{utils-7jx8T2mW.js → utils-BhRmyxT8.js} +51 -6
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/pds-button/pds-button.css +1 -2
- package/dist/collection/components/pds-button/pds-button.js +53 -2
- package/dist/collection/components/pds-checkbox/pds-checkbox.css +13 -4
- package/dist/collection/components/pds-checkbox/pds-checkbox.js +19 -3
- package/dist/collection/components/pds-chip/pds-chip.css +60 -6
- package/dist/collection/components/pds-chip/pds-chip.js +69 -4
- package/dist/collection/components/pds-chip/pds-chip.tokens.css +16 -0
- package/dist/collection/components/pds-chip/stories/pds-chip.stories.js +39 -1
- package/dist/collection/components/pds-combobox/grouped-options-panel.js +262 -0
- package/dist/collection/components/pds-combobox/pds-combobox.css +243 -15
- package/dist/collection/components/pds-combobox/pds-combobox.js +1129 -115
- package/dist/collection/components/pds-combobox/stories/pds-combobox.stories.js +240 -0
- package/dist/collection/components/pds-container/pds-container.js +1 -1
- package/dist/collection/components/pds-copytext/pds-copytext.js +1 -1
- package/dist/collection/components/pds-datepicker/calendar-portal.js +136 -0
- package/dist/collection/components/pds-datepicker/date-utils.js +132 -0
- package/dist/collection/components/pds-datepicker/datepicker-interface.js +1 -0
- package/dist/collection/components/pds-datepicker/pds-datepicker.css +545 -0
- package/dist/collection/components/pds-datepicker/pds-datepicker.js +2406 -0
- package/dist/collection/components/pds-datepicker/presets.js +96 -0
- package/dist/collection/components/pds-datepicker/stories/pds-datepicker.stories.js +195 -0
- package/dist/collection/components/pds-datepicker/value.js +238 -0
- package/dist/collection/components/pds-divider/pds-divider.js +1 -1
- package/dist/collection/components/pds-drawer/pds-drawer-content/pds-drawer-content.js +1 -1
- package/dist/collection/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.js +1 -1
- package/dist/collection/components/pds-drawer/pds-drawer-header/pds-drawer-header.js +1 -1
- package/dist/collection/components/pds-drawer/pds-drawer.css +4 -0
- package/dist/collection/components/pds-drawer/pds-drawer.js +9 -2
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.js +1 -1
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.js +1 -1
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js +9 -2
- package/dist/collection/components/pds-filters/pds-filter/pds-filter.js +1 -1
- package/dist/collection/components/pds-filters/pds-filters.js +1 -1
- package/dist/collection/components/pds-image/pds-image.js +2 -2
- package/dist/collection/components/pds-input/pds-input.js +6 -3
- package/dist/collection/components/pds-link/pds-link.js +2 -2
- package/dist/collection/components/pds-loader/pds-loader.js +1 -1
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js +2 -2
- package/dist/collection/components/pds-modal/pds-modal-footer/pds-modal-footer.js +1 -1
- package/dist/collection/components/pds-modal/pds-modal-header/pds-modal-header.js +1 -1
- package/dist/collection/components/pds-modal/pds-modal.css +20 -0
- package/dist/collection/components/pds-modal/pds-modal.js +55 -10
- package/dist/collection/components/pds-modal/stories/pds-modal.stories.js +14 -0
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js +1 -1
- package/dist/collection/components/pds-multiselect/pds-multiselect.css +19 -1
- package/dist/collection/components/pds-multiselect/pds-multiselect.js +390 -47
- package/dist/collection/components/pds-multiselect/stories/pds-multiselect.stories.js +136 -1
- package/dist/collection/components/pds-popover/pds-popover.js +29 -11
- package/dist/collection/components/pds-progress/pds-progress.js +3 -1
- package/dist/collection/components/pds-property/pds-property.js +1 -1
- package/dist/collection/components/pds-radio/pds-radio.css +1 -2
- package/dist/collection/components/pds-radio/pds-radio.js +3 -3
- package/dist/collection/components/pds-radio-group/pds-radio-group.js +3 -3
- package/dist/collection/components/pds-row/pds-row.js +1 -1
- package/dist/collection/components/pds-select/pds-select.js +1 -1
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.js +1 -1
- package/dist/collection/components/pds-sortable/pds-sortable.js +1 -1
- package/dist/collection/components/pds-switch/pds-switch.css +3 -0
- package/dist/collection/components/pds-switch/pds-switch.js +20 -4
- package/dist/collection/components/pds-table/pds-table-body/pds-table-body.js +1 -1
- package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.js +2 -2
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js +1 -1
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +2 -2
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js +1 -1
- package/dist/collection/components/pds-tabs/pds-tabpanel/pds-tabpanel.js +1 -1
- package/dist/collection/components/pds-tabs/pds-tabs.js +1 -1
- package/dist/collection/components/pds-text/pds-text.js +1 -1
- package/dist/collection/components/pds-textarea/pds-textarea.js +11 -6
- package/dist/collection/components/pds-toast/pds-toast.js +3 -3
- package/dist/collection/components/pds-tooltip/pds-tooltip.js +2 -2
- package/dist/collection/utils/closest.js +8 -0
- package/dist/collection/utils/utils.js +49 -6
- package/dist/docs.json +2055 -84
- package/dist/esm/closest-DHPzKMVS.js +17 -0
- package/dist/esm/{floating-ui.dom-DDtwbwIl.js → floating-ui.dom-BPqJgIq6.js} +79 -1
- package/dist/esm/{i18n-format-BKsJZTyn.js → i18n-format-BJgZHCWe.js} +1 -1
- package/dist/esm/{index-CTLu1TM4.js → index-CB8Yh0Nt.js} +4 -1
- package/dist/esm/{index-DdPaBxPo.js → index-DxI-61GK.js} +6 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mock-pds-modal.entry.js +3 -3
- package/dist/esm/pds-accordion.entry.js +2 -2
- package/dist/esm/pds-alert.entry.js +1 -1
- package/dist/esm/pds-avatar.entry.js +2 -2
- package/dist/esm/pds-box.entry.js +2 -2
- package/dist/esm/pds-button.entry.js +54 -5
- package/dist/esm/pds-checkbox.entry.js +14 -6
- package/dist/esm/pds-chip.entry.js +34 -9
- package/dist/esm/pds-combobox.entry.js +1225 -117
- package/dist/esm/pds-container.entry.js +2 -2
- package/dist/esm/pds-copytext.entry.js +5 -5
- package/dist/esm/pds-datepicker.entry.js +1960 -0
- package/dist/esm/pds-divider.entry.js +2 -2
- package/dist/esm/pds-drawer-content.entry.js +2 -2
- package/dist/esm/pds-drawer-footer.entry.js +2 -2
- package/dist/esm/pds-drawer-header.entry.js +2 -2
- package/dist/esm/pds-drawer.entry.js +11 -4
- package/dist/esm/pds-dropdown-menu-item.entry.js +2 -2
- package/dist/esm/pds-dropdown-menu-separator.entry.js +2 -2
- package/dist/esm/pds-dropdown-menu.entry.js +11 -4
- package/dist/esm/pds-filter.entry.js +3 -3
- package/dist/esm/pds-filters.entry.js +2 -2
- package/dist/esm/pds-icon.entry.js +2 -2
- package/dist/esm/pds-image.entry.js +3 -3
- package/dist/esm/pds-input.entry.js +8 -5
- package/dist/esm/pds-link.entry.js +5 -5
- package/dist/esm/pds-loader.entry.js +2 -2
- package/dist/esm/pds-modal-content.entry.js +3 -3
- package/dist/esm/pds-modal-footer.entry.js +2 -2
- package/dist/esm/pds-modal-header.entry.js +2 -2
- package/dist/esm/pds-modal.entry.js +42 -8
- package/dist/esm/pds-multiselect.entry.js +264 -51
- package/dist/esm/pds-popover.entry.js +30 -12
- package/dist/esm/pds-progress.entry.js +4 -2
- package/dist/esm/pds-property.entry.js +2 -2
- package/dist/esm/pds-radio-group.entry.js +5 -5
- package/dist/esm/pds-radio.entry.js +6 -6
- package/dist/esm/pds-row.entry.js +2 -2
- package/dist/esm/pds-select.entry.js +3 -3
- package/dist/esm/pds-sortable-item.entry.js +3 -3
- package/dist/esm/pds-sortable.entry.js +2 -2
- package/dist/esm/pds-switch.entry.js +14 -6
- package/dist/esm/pds-tab.entry.js +1 -1
- package/dist/esm/pds-table-body.entry.js +2 -2
- package/dist/esm/pds-table-cell.entry.js +5 -5
- package/dist/esm/pds-table-head-cell.entry.js +4 -4
- package/dist/esm/pds-table-head.entry.js +3 -3
- package/dist/esm/pds-table-row.entry.js +3 -3
- package/dist/esm/pds-table.entry.js +1 -1
- package/dist/esm/pds-tabpanel.entry.js +2 -2
- package/dist/esm/pds-tabs.entry.js +2 -2
- package/dist/esm/pds-text.entry.js +5 -5
- package/dist/esm/pds-textarea.entry.js +14 -9
- package/dist/esm/pds-toast.entry.js +4 -4
- package/dist/esm/pds-tooltip.entry.js +4 -4
- package/dist/esm/pine-core.js +3 -3
- package/dist/esm/{truncation-tooltip-CdtEBn_5.js → truncation-tooltip-_902ENWC.js} +1 -1
- package/dist/esm/{utils-tJa4KYNO.js → utils-OYK5-nwe.js} +50 -7
- package/dist/esm-es5/closest-DHPzKMVS.js +1 -0
- package/dist/esm-es5/floating-ui.dom-BPqJgIq6.js +1 -0
- package/dist/esm-es5/{i18n-format-BKsJZTyn.js → i18n-format-BJgZHCWe.js} +1 -1
- package/dist/esm-es5/index-CB8Yh0Nt.js +2 -0
- package/dist/esm-es5/index-DxI-61GK.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mock-pds-modal.entry.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 +2 -2
- package/dist/esm-es5/pds-container.entry.js +1 -1
- package/dist/esm-es5/pds-copytext.entry.js +1 -1
- package/dist/esm-es5/pds-datepicker.entry.js +1 -0
- package/dist/esm-es5/pds-divider.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-filters.entry.js +1 -1
- package/dist/esm-es5/pds-icon.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-content.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-property.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/{truncation-tooltip-CdtEBn_5.js → truncation-tooltip-_902ENWC.js} +1 -1
- package/dist/esm-es5/utils-OYK5-nwe.js +1 -0
- package/dist/pine-core/p-0414092a.system.entry.js +1 -0
- package/dist/pine-core/p-04807201.entry.js +1 -0
- package/dist/pine-core/{p-56b34569.system.entry.js → p-07f0d168.system.entry.js} +1 -1
- package/dist/pine-core/p-08f5d19c.entry.js +1 -0
- package/dist/pine-core/{p-15d3a4bc.system.entry.js → p-0aaf8faa.system.entry.js} +1 -1
- package/dist/pine-core/p-0bad5955.entry.js +1 -0
- package/dist/pine-core/{p-4d388957.system.entry.js → p-0c3bf377.system.entry.js} +1 -1
- package/dist/pine-core/p-0ce79cd0.entry.js +1 -0
- package/dist/pine-core/{p-3464b456.system.entry.js → p-1057b8c3.system.entry.js} +1 -1
- package/dist/pine-core/{p-bf3afa16.system.entry.js → p-108c910a.system.entry.js} +1 -1
- package/dist/pine-core/{p-53a4852e.system.entry.js → p-166f61a6.system.entry.js} +1 -1
- package/dist/pine-core/{p-31e1722e.entry.js → p-16c8f5e3.entry.js} +1 -1
- package/dist/pine-core/p-16e258d1.entry.js +1 -0
- package/dist/pine-core/{p-591fbff5.entry.js → p-1be33c95.entry.js} +1 -1
- package/dist/pine-core/p-1e3a31da.entry.js +1 -0
- package/dist/pine-core/p-1f228db9.entry.js +1 -0
- package/dist/pine-core/p-257c6ef9.entry.js +1 -0
- package/dist/pine-core/p-26415245.system.entry.js +1 -0
- package/dist/pine-core/p-26e1e5bb.entry.js +1 -0
- package/dist/pine-core/p-27c06bf8.entry.js +2 -0
- package/dist/pine-core/p-31aee437.entry.js +1 -0
- package/dist/pine-core/p-330a76f6.system.entry.js +1 -0
- package/dist/pine-core/{p-3c4236a8.system.entry.js → p-33c63be6.system.entry.js} +1 -1
- package/dist/pine-core/{p-d46adf7d.entry.js → p-344609f9.entry.js} +2 -2
- package/dist/pine-core/{p-049681fc.entry.js → p-3a1711c1.entry.js} +1 -1
- package/dist/pine-core/p-3a9c58bd.system.entry.js +1 -0
- package/dist/pine-core/{p-e3a7d2db.entry.js → p-3ebd543f.entry.js} +1 -1
- package/dist/pine-core/p-3fbcb0c8.system.entry.js +1 -0
- package/dist/pine-core/{p-b923a70b.entry.js → p-427b4aeb.entry.js} +1 -1
- package/dist/pine-core/{p-5772f260.system.entry.js → p-42bd87ea.system.entry.js} +1 -1
- package/dist/pine-core/{p-1e2a9b5d.system.entry.js → p-43c691bf.system.entry.js} +1 -1
- package/dist/pine-core/p-4566d659.system.entry.js +1 -0
- package/dist/pine-core/p-4b8cf04a.system.entry.js +1 -0
- package/dist/pine-core/p-4d6f471c.entry.js +1 -0
- package/dist/pine-core/{p-3e0c6384.entry.js → p-4e7580c4.entry.js} +1 -1
- package/dist/pine-core/{p-0ab735aa.system.entry.js → p-4f4a2d2a.system.entry.js} +1 -1
- package/dist/pine-core/{p-7e2b934d.entry.js → p-5211aba7.entry.js} +1 -1
- package/dist/pine-core/{p-376f8286.entry.js → p-524b7d3f.entry.js} +1 -1
- package/dist/pine-core/{p-3f12afb1.entry.js → p-5613c64c.entry.js} +1 -1
- package/dist/pine-core/p-5bb24cb4.entry.js +1 -0
- package/dist/pine-core/{p-d7865297.entry.js → p-5bb80b3c.entry.js} +1 -1
- package/dist/pine-core/{p-e3cd4627.system.entry.js → p-5c6e0a26.system.entry.js} +1 -1
- package/dist/pine-core/{p-51dff5af.system.entry.js → p-5db57551.system.entry.js} +1 -1
- package/dist/pine-core/{p-f94667b5.entry.js → p-5eb00ba5.entry.js} +1 -1
- package/dist/pine-core/p-61756414.system.entry.js +1 -0
- package/dist/pine-core/{p-e5bbe8cc.entry.js → p-682e9e8f.entry.js} +1 -1
- package/dist/pine-core/p-6965db1d.entry.js +1 -0
- package/dist/pine-core/{p-5aea1082.entry.js → p-6b180ee2.entry.js} +1 -1
- package/dist/pine-core/{p-d21739eb.entry.js → p-6c53962f.entry.js} +1 -1
- package/dist/pine-core/p-6da6520b.system.entry.js +3 -0
- package/dist/pine-core/p-6e3bf862.system.entry.js +1 -0
- package/dist/pine-core/{p-053b0898.system.entry.js → p-71c9f866.system.entry.js} +1 -1
- package/dist/pine-core/{p-78fd593d.system.entry.js → p-7265b94c.system.entry.js} +1 -1
- package/dist/pine-core/{p-9187c26c.system.entry.js → p-74229b5e.system.entry.js} +1 -1
- package/dist/pine-core/p-7512c2d4.system.entry.js +1 -0
- package/dist/pine-core/p-76db406d.system.entry.js +1 -0
- package/dist/pine-core/{p-e1653d75.system.entry.js → p-79aa5f43.system.entry.js} +1 -1
- package/dist/pine-core/p-7bbcda0f.system.entry.js +1 -0
- package/dist/pine-core/p-7c8946e6.entry.js +1 -0
- package/dist/pine-core/p-7c98c90a.system.entry.js +1 -0
- package/dist/pine-core/p-81292c03.system.entry.js +1 -0
- package/dist/pine-core/p-81300046.system.entry.js +1 -0
- package/dist/pine-core/{p-a11a9c40.system.entry.js → p-8252cd84.system.entry.js} +1 -1
- package/dist/pine-core/{p-d0d2a886.system.entry.js → p-84ba0e6a.system.entry.js} +1 -1
- package/dist/pine-core/{p-c1f8a187.entry.js → p-86fc0bfa.entry.js} +1 -1
- package/dist/pine-core/p-90692bb6.entry.js +1 -0
- package/dist/pine-core/{p-2eb8d697.system.entry.js → p-90ea812c.system.entry.js} +1 -1
- package/dist/pine-core/p-948826db.entry.js +1 -0
- package/dist/pine-core/{p-714bfdbd.entry.js → p-9b66642d.entry.js} +1 -1
- package/dist/pine-core/p-BJgZHCWe.js +1 -0
- package/dist/pine-core/p-BPqJgIq6.js +1 -0
- package/dist/pine-core/p-BSRFZB4I.system.js +1 -0
- package/dist/pine-core/p-BZsj6eAn.system.js +1 -0
- package/dist/pine-core/p-CB8Yh0Nt.js +2 -0
- package/dist/pine-core/{p-B2qvvB3q.system.js → p-CBu9UrXr.system.js} +1 -1
- package/dist/pine-core/p-COtCa1Md.system.js +1 -0
- package/dist/pine-core/p-CTQZ2fkv.system.js +1 -0
- package/dist/pine-core/{p-B2nn1gSd.js → p-CnM3cCof.js} +1 -1
- package/dist/pine-core/p-CnO10OxH.system.js +1 -0
- package/dist/pine-core/p-D-akEPIU.system.js +2 -0
- package/dist/pine-core/p-DHPzKMVS.js +1 -0
- package/dist/pine-core/p-Dx8tEj0U.system.js +1 -0
- package/dist/pine-core/p-DxI-61GK.js +1 -0
- package/dist/pine-core/p-OYK5-nwe.js +1 -0
- package/dist/pine-core/p-a10af84b.system.entry.js +1 -0
- package/dist/pine-core/p-a21b530a.system.entry.js +1 -0
- package/dist/pine-core/p-a85535a4.system.entry.js +1 -0
- package/dist/pine-core/p-abc0fe2f.system.entry.js +1 -0
- package/dist/pine-core/p-ac6a5bf0.entry.js +1 -0
- package/dist/pine-core/{p-f7a5062f.entry.js → p-b0526f98.entry.js} +1 -1
- package/dist/pine-core/p-b130b716.entry.js +1 -0
- package/dist/pine-core/{p-09413b07.entry.js → p-b195d345.entry.js} +1 -1
- package/dist/pine-core/{p-e3600c53.entry.js → p-b4923acf.entry.js} +1 -1
- package/dist/pine-core/{p-e410b0d8.system.entry.js → p-b4e440e3.system.entry.js} +1 -1
- package/dist/pine-core/p-b8693a87.entry.js +1 -0
- package/dist/pine-core/{p-e95225cf.entry.js → p-b8ada1eb.entry.js} +1 -1
- package/dist/pine-core/{p-1614c000.system.entry.js → p-bb85bbb5.system.entry.js} +1 -1
- package/dist/pine-core/{p-fec298bb.system.entry.js → p-bbc539bc.system.entry.js} +2 -2
- package/dist/pine-core/{p-f21aea90.system.entry.js → p-bf833976.system.entry.js} +1 -1
- package/dist/pine-core/{p-c5ce6dea.entry.js → p-c23097af.entry.js} +1 -1
- package/dist/pine-core/p-c2dd84bd.system.entry.js +1 -0
- package/dist/pine-core/{p-869ed1c0.system.entry.js → p-c4520b04.system.entry.js} +1 -1
- package/dist/pine-core/{p-3605a5f5.entry.js → p-c4f68dfc.entry.js} +1 -1
- package/dist/pine-core/{p-d9ffb2d9.system.entry.js → p-c6fa6744.system.entry.js} +1 -1
- package/dist/pine-core/p-c7dba815.entry.js +1 -0
- package/dist/pine-core/p-cb6f55ff.entry.js +1 -0
- package/dist/pine-core/p-cfb8fa7c.system.entry.js +1 -0
- package/dist/pine-core/{p-86bc2a0c.entry.js → p-d0d7d1d4.entry.js} +1 -1
- package/dist/pine-core/{p-b109de2e.entry.js → p-d1112c8a.entry.js} +1 -1
- package/dist/pine-core/p-d4e91ad9.system.entry.js +1 -0
- package/dist/pine-core/{p-7b1e3e91.entry.js → p-da018dcb.entry.js} +1 -1
- package/dist/pine-core/{p-c09dab1a.system.entry.js → p-dc27abe6.system.entry.js} +1 -1
- package/dist/pine-core/{p-3eca0b00.entry.js → p-dc343b6d.entry.js} +1 -1
- package/dist/pine-core/p-dde753e7.system.entry.js +1 -0
- package/dist/pine-core/{p-f35596cd.entry.js → p-dea3a582.entry.js} +1 -1
- package/dist/pine-core/p-df29fd41.entry.js +1 -0
- package/dist/pine-core/{p-1f307e59.system.entry.js → p-e4e2eae2.system.entry.js} +1 -1
- package/dist/pine-core/{p-51b8490d.entry.js → p-e8668178.entry.js} +1 -1
- package/dist/pine-core/{p-5dd393cd.system.entry.js → p-eb28d21d.system.entry.js} +1 -1
- package/dist/pine-core/p-eb71a82d.system.entry.js +1 -0
- package/dist/pine-core/{p-8eef80d5.entry.js → p-ed63873c.entry.js} +1 -1
- package/dist/pine-core/{p-12182cab.entry.js → p-f4f6dc36.entry.js} +1 -1
- package/dist/pine-core/{p-be819bff.system.entry.js → p-f67a0ca8.system.entry.js} +1 -1
- package/dist/pine-core/p-fc455968.entry.js +1 -0
- package/dist/pine-core/{p-92ef1608.system.entry.js → p-fe3e2ebd.system.entry.js} +1 -1
- package/dist/pine-core/pine-core.css +1 -1
- package/dist/pine-core/pine-core.esm.js +1 -1
- package/dist/pine-core/pine-core.js +1 -1
- package/dist/types/components/pds-button/pds-button.d.ts +10 -0
- package/dist/types/components/pds-checkbox/pds-checkbox.d.ts +5 -0
- package/dist/types/components/pds-chip/pds-chip.d.ts +12 -0
- package/dist/types/components/pds-combobox/combobox-interface.d.ts +17 -0
- package/dist/types/components/pds-combobox/grouped-options-panel.d.ts +105 -0
- package/dist/types/components/pds-combobox/pds-combobox.d.ts +235 -3
- package/dist/types/components/pds-datepicker/calendar-portal.d.ts +43 -0
- package/dist/types/components/pds-datepicker/date-utils.d.ts +48 -0
- package/dist/types/components/pds-datepicker/datepicker-interface.d.ts +30 -0
- package/dist/types/components/pds-datepicker/pds-datepicker.d.ts +489 -0
- package/dist/types/components/pds-datepicker/presets.d.ts +23 -0
- package/dist/types/components/pds-datepicker/value.d.ts +47 -0
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu.d.ts +1 -0
- package/dist/types/components/pds-modal/pds-modal.d.ts +9 -2
- package/dist/types/components/pds-multiselect/multiselect-interface.d.ts +19 -0
- package/dist/types/components/pds-multiselect/pds-multiselect.d.ts +56 -1
- package/dist/types/components/pds-popover/pds-popover.d.ts +1 -0
- package/dist/types/components/pds-switch/pds-switch.d.ts +5 -0
- package/dist/types/components.d.ts +702 -11
- package/dist/types/utils/closest.d.ts +2 -0
- package/dist/types/utils/types.d.ts +2 -1
- package/dist/types/utils/utils.d.ts +25 -2
- package/dist/vscode.html-data.json +497 -7
- package/hydrate/index.js +4059 -377
- package/hydrate/index.mjs +4059 -377
- package/package.json +2 -2
- package/dist/cjs/closest-BZXvuB_Y.js +0 -11
- package/dist/esm/closest-DnUJodVd.js +0 -9
- package/dist/esm-es5/closest-DnUJodVd.js +0 -1
- package/dist/esm-es5/floating-ui.dom-DDtwbwIl.js +0 -1
- package/dist/esm-es5/index-CTLu1TM4.js +0 -2
- package/dist/esm-es5/index-DdPaBxPo.js +0 -1
- package/dist/esm-es5/utils-tJa4KYNO.js +0 -1
- package/dist/pine-core/p--Llh7wKm.system.js +0 -1
- package/dist/pine-core/p-02a47ebb.entry.js +0 -1
- package/dist/pine-core/p-12ec8186.system.entry.js +0 -1
- package/dist/pine-core/p-17dc3f87.entry.js +0 -1
- package/dist/pine-core/p-18a59cdd.system.entry.js +0 -1
- package/dist/pine-core/p-2016c878.entry.js +0 -1
- package/dist/pine-core/p-222ff58e.system.entry.js +0 -1
- package/dist/pine-core/p-324a7ae4.system.entry.js +0 -1
- package/dist/pine-core/p-32f10aa9.entry.js +0 -1
- package/dist/pine-core/p-33c0f3c9.system.entry.js +0 -1
- package/dist/pine-core/p-34e38037.system.entry.js +0 -1
- package/dist/pine-core/p-3873f55b.entry.js +0 -1
- package/dist/pine-core/p-3aec9079.entry.js +0 -1
- package/dist/pine-core/p-3c229a00.system.entry.js +0 -1
- package/dist/pine-core/p-43338f77.system.entry.js +0 -1
- package/dist/pine-core/p-4661259e.system.entry.js +0 -1
- package/dist/pine-core/p-585ad368.system.entry.js +0 -1
- package/dist/pine-core/p-5d585aa8.entry.js +0 -1
- package/dist/pine-core/p-613a64f1.entry.js +0 -1
- package/dist/pine-core/p-630f33d6.system.entry.js +0 -1
- package/dist/pine-core/p-63686e2a.system.entry.js +0 -1
- package/dist/pine-core/p-6f7a7d55.entry.js +0 -1
- package/dist/pine-core/p-6fd863e5.system.entry.js +0 -1
- package/dist/pine-core/p-76286a68.system.entry.js +0 -1
- package/dist/pine-core/p-7691a875.system.entry.js +0 -3
- package/dist/pine-core/p-7e44106e.entry.js +0 -1
- package/dist/pine-core/p-84ade640.entry.js +0 -1
- package/dist/pine-core/p-8be301b6.entry.js +0 -1
- package/dist/pine-core/p-8cc270f0.system.entry.js +0 -1
- package/dist/pine-core/p-8cea0d7a.system.entry.js +0 -1
- package/dist/pine-core/p-957dbb0c.entry.js +0 -1
- package/dist/pine-core/p-BG6uGRQj.system.js +0 -1
- package/dist/pine-core/p-BKsJZTyn.js +0 -1
- package/dist/pine-core/p-BrLs99ML.system.js +0 -1
- package/dist/pine-core/p-CTLu1TM4.js +0 -2
- package/dist/pine-core/p-Cr7-rJtJ.system.js +0 -1
- package/dist/pine-core/p-DAIsVNlL.system.js +0 -2
- package/dist/pine-core/p-DDtwbwIl.js +0 -1
- package/dist/pine-core/p-DdPaBxPo.js +0 -1
- package/dist/pine-core/p-DnUJodVd.js +0 -1
- package/dist/pine-core/p-Dr-FzkdE.system.js +0 -1
- package/dist/pine-core/p-a4a58477.entry.js +0 -1
- package/dist/pine-core/p-a98bf89f.system.entry.js +0 -1
- package/dist/pine-core/p-ac0098fd.entry.js +0 -1
- package/dist/pine-core/p-b32e3174.system.entry.js +0 -1
- package/dist/pine-core/p-be4a6cc2.entry.js +0 -1
- package/dist/pine-core/p-c0b3f2c1.system.entry.js +0 -1
- package/dist/pine-core/p-c8bffb08.system.entry.js +0 -1
- package/dist/pine-core/p-cf24ed1e.system.entry.js +0 -1
- package/dist/pine-core/p-d12ef40d.entry.js +0 -1
- package/dist/pine-core/p-d280741f.entry.js +0 -1
- package/dist/pine-core/p-d415bb01.entry.js +0 -2
- package/dist/pine-core/p-d43db3ba.entry.js +0 -1
- package/dist/pine-core/p-db5703f2.entry.js +0 -1
- package/dist/pine-core/p-dd6d9807.system.entry.js +0 -1
- package/dist/pine-core/p-e0da17aa.system.entry.js +0 -1
- package/dist/pine-core/p-ed297f3e.entry.js +0 -1
- package/dist/pine-core/p-fbf5f315.entry.js +0 -1
- package/dist/pine-core/p-kYMYDfJY.system.js +0 -1
- package/dist/pine-core/p-tJa4KYNO.js +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { addDays, addMonths, isOutOfRange, parseIsoDate } from "./date-utils";
|
|
2
|
+
const DEFAULT_LABELS = {
|
|
3
|
+
'today': 'Today',
|
|
4
|
+
'yesterday': 'Yesterday',
|
|
5
|
+
'last-7-days': 'Last 7 days',
|
|
6
|
+
'last-30-days': 'Last 30 days',
|
|
7
|
+
'last-90-days': 'Last 90 days',
|
|
8
|
+
'this-month': 'This month',
|
|
9
|
+
'last-month': 'Last month',
|
|
10
|
+
'this-quarter': 'This quarter',
|
|
11
|
+
'last-quarter': 'Last quarter',
|
|
12
|
+
'this-year': 'This year',
|
|
13
|
+
'last-year': 'Last year',
|
|
14
|
+
'year-to-date': 'Year to date',
|
|
15
|
+
'last-12-months': 'Last 12 months',
|
|
16
|
+
};
|
|
17
|
+
const utc = (year, month, day) => new Date(Date.UTC(year, month, day));
|
|
18
|
+
/**
|
|
19
|
+
* The range a built-in preset covers on the given day, or `null` for an unknown key. "Last N days"
|
|
20
|
+
* is N days ending today; "this" and "last" periods are whole periods; "to date" ends today.
|
|
21
|
+
*/
|
|
22
|
+
export function builtInPresetRange(key, now) {
|
|
23
|
+
const year = now.getUTCFullYear();
|
|
24
|
+
const month = now.getUTCMonth();
|
|
25
|
+
const quarterStart = month - (month % 3);
|
|
26
|
+
switch (key) {
|
|
27
|
+
case 'today':
|
|
28
|
+
return [now, now];
|
|
29
|
+
case 'yesterday':
|
|
30
|
+
return [addDays(now, -1), addDays(now, -1)];
|
|
31
|
+
case 'last-7-days':
|
|
32
|
+
return [addDays(now, -6), now];
|
|
33
|
+
case 'last-30-days':
|
|
34
|
+
return [addDays(now, -29), now];
|
|
35
|
+
case 'last-90-days':
|
|
36
|
+
return [addDays(now, -89), now];
|
|
37
|
+
case 'this-month':
|
|
38
|
+
return [utc(year, month, 1), utc(year, month + 1, 0)];
|
|
39
|
+
case 'last-month':
|
|
40
|
+
return [utc(year, month - 1, 1), utc(year, month, 0)];
|
|
41
|
+
case 'this-quarter':
|
|
42
|
+
return [utc(year, quarterStart, 1), utc(year, quarterStart + 3, 0)];
|
|
43
|
+
case 'last-quarter':
|
|
44
|
+
return [utc(year, quarterStart - 3, 1), utc(year, quarterStart, 0)];
|
|
45
|
+
case 'this-year':
|
|
46
|
+
return [utc(year, 0, 1), utc(year, 11, 31)];
|
|
47
|
+
case 'last-year':
|
|
48
|
+
return [utc(year - 1, 0, 1), utc(year - 1, 11, 31)];
|
|
49
|
+
case 'year-to-date':
|
|
50
|
+
return [utc(year, 0, 1), now];
|
|
51
|
+
case 'last-12-months':
|
|
52
|
+
return [addMonths(now, -12), now];
|
|
53
|
+
default:
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Normalizes the `presets` prop: a comma-separated list of built-in keys, or an array of presets
|
|
59
|
+
* that may relabel a built-in (for translation) or give their own `start` and `end`. Entries that
|
|
60
|
+
* resolve to no range are dropped.
|
|
61
|
+
*/
|
|
62
|
+
export function resolvePresets(presets, now) {
|
|
63
|
+
const entries = typeof presets === 'string'
|
|
64
|
+
? presets
|
|
65
|
+
.split(',')
|
|
66
|
+
.map((key) => key.trim())
|
|
67
|
+
.filter(Boolean)
|
|
68
|
+
.map((key) => ({ key }))
|
|
69
|
+
: Array.isArray(presets)
|
|
70
|
+
? presets
|
|
71
|
+
: [];
|
|
72
|
+
const resolved = [];
|
|
73
|
+
for (const preset of entries) {
|
|
74
|
+
// Presets often come from parsed JSON, so check types at runtime: a non-string label would
|
|
75
|
+
// otherwise reach the render as an object, which Stencil can turn into nodes.
|
|
76
|
+
if (!preset || typeof preset.key !== 'string')
|
|
77
|
+
continue;
|
|
78
|
+
const start = typeof preset.start === 'string' ? parseIsoDate(preset.start) : null;
|
|
79
|
+
const end = typeof preset.end === 'string' ? parseIsoDate(preset.end) : null;
|
|
80
|
+
const range = start && end && start <= end ? [start, end] : builtInPresetRange(preset.key, now);
|
|
81
|
+
const label = typeof preset.label === 'string' ? preset.label : DEFAULT_LABELS[preset.key];
|
|
82
|
+
if (range && label)
|
|
83
|
+
resolved.push({ key: preset.key, label, start: range[0], end: range[1] });
|
|
84
|
+
}
|
|
85
|
+
return resolved;
|
|
86
|
+
}
|
|
87
|
+
/** The first preset covering exactly this range. */
|
|
88
|
+
export function matchPreset(presets, start, end) {
|
|
89
|
+
if (!start || !end)
|
|
90
|
+
return undefined;
|
|
91
|
+
return presets.find((preset) => preset.start.getTime() === start.getTime() && preset.end.getTime() === end.getTime());
|
|
92
|
+
}
|
|
93
|
+
/** Whether a preset's whole range can be picked within `min` and `max`. */
|
|
94
|
+
export function presetInRange(preset, min, max) {
|
|
95
|
+
return !isOutOfRange(preset.start, min, max) && !isOutOfRange(preset.end, min, max);
|
|
96
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
args: {
|
|
6
|
+
autoApply: false,
|
|
7
|
+
clearable: false,
|
|
8
|
+
disabled: false,
|
|
9
|
+
errorMessage: null,
|
|
10
|
+
firstDayOfWeek: null,
|
|
11
|
+
format: 'YYYY-MM-DD',
|
|
12
|
+
fullWidth: false,
|
|
13
|
+
helperMessage: null,
|
|
14
|
+
hideLabel: false,
|
|
15
|
+
invalid: false,
|
|
16
|
+
locale: null,
|
|
17
|
+
max: null,
|
|
18
|
+
min: null,
|
|
19
|
+
minuteIncrement: 1,
|
|
20
|
+
name: null,
|
|
21
|
+
presets: null,
|
|
22
|
+
range: false,
|
|
23
|
+
placeholder: null,
|
|
24
|
+
placement: 'bottom-start',
|
|
25
|
+
readonly: false,
|
|
26
|
+
required: false,
|
|
27
|
+
showDropdowns: false,
|
|
28
|
+
timePicker: false,
|
|
29
|
+
value: null,
|
|
30
|
+
},
|
|
31
|
+
argTypes: {
|
|
32
|
+
placement: {
|
|
33
|
+
control: 'select',
|
|
34
|
+
options: ['bottom-start', 'bottom', 'bottom-end', 'top-start', 'top', 'top-end'],
|
|
35
|
+
},
|
|
36
|
+
presets: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
},
|
|
39
|
+
pdsDatepickerChange: {
|
|
40
|
+
action: 'pdsDatepickerChange',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
component: 'pds-datepicker',
|
|
44
|
+
parameters: {
|
|
45
|
+
actions: {
|
|
46
|
+
handles: ['pdsDatepickerChange'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
title: 'components/Datepicker',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const BaseTemplate = (args) => html`<pds-datepicker
|
|
53
|
+
?auto-apply=${args.autoApply}
|
|
54
|
+
?clearable=${args.clearable}
|
|
55
|
+
component-id="${args.componentId}"
|
|
56
|
+
?disabled=${args.disabled}
|
|
57
|
+
error-message=${ifDefined(args.errorMessage ?? undefined)}
|
|
58
|
+
first-day-of-week=${ifDefined(args.firstDayOfWeek ?? undefined)}
|
|
59
|
+
format=${ifDefined(args.format ?? undefined)}
|
|
60
|
+
?full-width=${args.fullWidth}
|
|
61
|
+
helper-message=${ifDefined(args.helperMessage ?? undefined)}
|
|
62
|
+
?hide-label=${args.hideLabel}
|
|
63
|
+
?invalid=${args.invalid}
|
|
64
|
+
label="${args.label}"
|
|
65
|
+
locale=${ifDefined(args.locale ?? undefined)}
|
|
66
|
+
max=${ifDefined(args.max ?? undefined)}
|
|
67
|
+
min=${ifDefined(args.min ?? undefined)}
|
|
68
|
+
minute-increment=${ifDefined(args.minuteIncrement ?? undefined)}
|
|
69
|
+
name=${ifDefined(args.name ?? undefined)}
|
|
70
|
+
placeholder=${ifDefined(args.placeholder ?? undefined)}
|
|
71
|
+
placement=${ifDefined(args.placement ?? undefined)}
|
|
72
|
+
presets=${ifDefined(args.presets ?? undefined)}
|
|
73
|
+
?range=${args.range}
|
|
74
|
+
?readonly=${args.readonly}
|
|
75
|
+
?required=${args.required}
|
|
76
|
+
?show-dropdowns=${args.showDropdowns}
|
|
77
|
+
?time-picker=${args.timePicker}
|
|
78
|
+
value=${ifDefined(args.value ?? undefined)}>
|
|
79
|
+
</pds-datepicker>`;
|
|
80
|
+
|
|
81
|
+
export const Default = BaseTemplate.bind({});
|
|
82
|
+
Default.args = {
|
|
83
|
+
componentId: 'pds-datepicker-default-example',
|
|
84
|
+
label: 'Due date',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const WithValue = BaseTemplate.bind({});
|
|
88
|
+
WithValue.args = {
|
|
89
|
+
componentId: 'pds-datepicker-value-example',
|
|
90
|
+
label: 'Due date',
|
|
91
|
+
value: '2026-10-13',
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const MinAndMax = BaseTemplate.bind({});
|
|
95
|
+
MinAndMax.args = {
|
|
96
|
+
componentId: 'pds-datepicker-range-example',
|
|
97
|
+
helperMessage: 'Pick a day between October 5 and November 20.',
|
|
98
|
+
label: 'Delivery date',
|
|
99
|
+
max: '2026-11-20',
|
|
100
|
+
min: '2026-10-05',
|
|
101
|
+
value: '2026-10-13',
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const Locale = BaseTemplate.bind({});
|
|
105
|
+
Locale.args = {
|
|
106
|
+
componentId: 'pds-datepicker-locale-example',
|
|
107
|
+
label: "Date d'échéance",
|
|
108
|
+
locale: 'fr',
|
|
109
|
+
value: '2026-10-13',
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const Invalid = BaseTemplate.bind({});
|
|
113
|
+
Invalid.args = {
|
|
114
|
+
componentId: 'pds-datepicker-invalid-example',
|
|
115
|
+
errorMessage: 'Choose a date after today.',
|
|
116
|
+
invalid: true,
|
|
117
|
+
label: 'Due date',
|
|
118
|
+
value: '2026-10-13',
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const Disabled = BaseTemplate.bind({});
|
|
122
|
+
Disabled.args = {
|
|
123
|
+
componentId: 'pds-datepicker-disabled-example',
|
|
124
|
+
disabled: true,
|
|
125
|
+
label: 'Due date',
|
|
126
|
+
value: '2026-10-13',
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const Range = BaseTemplate.bind({});
|
|
130
|
+
Range.args = {
|
|
131
|
+
componentId: 'pds-datepicker-range-mode-example',
|
|
132
|
+
label: 'Period',
|
|
133
|
+
range: true,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const RangeWithPresets = BaseTemplate.bind({});
|
|
137
|
+
RangeWithPresets.args = {
|
|
138
|
+
componentId: 'pds-datepicker-range-presets-example',
|
|
139
|
+
hideLabel: true,
|
|
140
|
+
label: 'Period',
|
|
141
|
+
presets: 'today,last-7-days,last-30-days,last-month,this-month,last-quarter,this-quarter,this-year,last-12-months,year-to-date',
|
|
142
|
+
range: true,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const RangeWithTimes = BaseTemplate.bind({});
|
|
146
|
+
RangeWithTimes.args = {
|
|
147
|
+
componentId: 'pds-datepicker-range-times-example',
|
|
148
|
+
label: 'Event',
|
|
149
|
+
minuteIncrement: 15,
|
|
150
|
+
range: true,
|
|
151
|
+
timePicker: true,
|
|
152
|
+
value: '2026-10-13T14:00/2026-10-14T22:00',
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const MonthAndYearDropdowns = BaseTemplate.bind({});
|
|
156
|
+
MonthAndYearDropdowns.args = {
|
|
157
|
+
componentId: 'pds-datepicker-dropdowns-example',
|
|
158
|
+
label: 'Birthday',
|
|
159
|
+
max: '2026-10-13',
|
|
160
|
+
min: '1901-01-01',
|
|
161
|
+
showDropdowns: true,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const InitiallyEmptyWithClear = BaseTemplate.bind({});
|
|
165
|
+
InitiallyEmptyWithClear.args = {
|
|
166
|
+
clearable: true,
|
|
167
|
+
componentId: 'pds-datepicker-clearable-example',
|
|
168
|
+
label: 'Created',
|
|
169
|
+
range: true,
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export const Format = BaseTemplate.bind({});
|
|
173
|
+
Format.args = {
|
|
174
|
+
componentId: 'pds-datepicker-format-example',
|
|
175
|
+
format: 'MM/DD/YYYY',
|
|
176
|
+
label: 'Due date',
|
|
177
|
+
value: '2026-10-13',
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const RangeAutoApply = BaseTemplate.bind({});
|
|
181
|
+
RangeAutoApply.args = {
|
|
182
|
+
autoApply: true,
|
|
183
|
+
componentId: 'pds-datepicker-auto-apply-example',
|
|
184
|
+
label: 'Period',
|
|
185
|
+
presets: 'today,last-7-days,last-30-days',
|
|
186
|
+
range: true,
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const Clearable = BaseTemplate.bind({});
|
|
190
|
+
Clearable.args = {
|
|
191
|
+
clearable: true,
|
|
192
|
+
componentId: 'pds-datepicker-clearable-single-example',
|
|
193
|
+
label: 'Due date',
|
|
194
|
+
value: '2026-10-13',
|
|
195
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { parseIsoDate, toIsoDate } from "./date-utils";
|
|
2
|
+
const DATE_TIME = /^(\d{4}-\d{2}-\d{2})(?:[T ](\d{2}):(\d{2}))?$/;
|
|
3
|
+
/** Parses `YYYY-MM-DD`, `YYYY-MM-DDTHH:mm` or `YYYY-MM-DD HH:mm`. */
|
|
4
|
+
export function parseDateTime(text) {
|
|
5
|
+
const match = DATE_TIME.exec((text !== null && text !== void 0 ? text : '').trim());
|
|
6
|
+
if (!match)
|
|
7
|
+
return null;
|
|
8
|
+
const date = parseIsoDate(match[1]);
|
|
9
|
+
if (!date)
|
|
10
|
+
return null;
|
|
11
|
+
if (match[2] === undefined)
|
|
12
|
+
return { date, time: null };
|
|
13
|
+
const hours = Number(match[2]);
|
|
14
|
+
const minutes = Number(match[3]);
|
|
15
|
+
return hours < 24 && minutes < 60 ? { date, time: `${match[2]}:${match[3]}` } : null;
|
|
16
|
+
}
|
|
17
|
+
export const DEFAULT_FORMAT = 'YYYY-MM-DD';
|
|
18
|
+
/**
|
|
19
|
+
* A format's parts: `[text]` is literal text, and the tokens are `YYYY`, `MMMM` (month name),
|
|
20
|
+
* `MMM` (short month name), `MM`/`M` (month), `DD`/`D` (day), `HH`/`H` (24-hour), `hh`/`h`
|
|
21
|
+
* (12-hour), `mm` (minutes) and `A`/`a` (AM/PM). Longest tokens first, so `MM` isn't read as two
|
|
22
|
+
* `M`s. Anything else is copied as is.
|
|
23
|
+
*/
|
|
24
|
+
const FORMAT_PARTS = /\[([^\]]*)\]|YYYY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|A|a/g;
|
|
25
|
+
const HOUR_TOKEN = /HH|H|hh|h/;
|
|
26
|
+
const TWELVE_HOUR_TOKEN = /hh|h/;
|
|
27
|
+
const PERIOD_TOKEN = /A|a/;
|
|
28
|
+
/** Without its `[literal]` parts, to test which tokens a format uses. */
|
|
29
|
+
const tokensOnly = (format) => format.replace(/\[[^\]]*\]/g, '');
|
|
30
|
+
/**
|
|
31
|
+
* The field's format: the date format, with a time added when the time picker is on and it has
|
|
32
|
+
* none, on the same clock as the time picker. A 12-hour format gets AM/PM if it has none, as
|
|
33
|
+
* `1:30` alone can't say which.
|
|
34
|
+
*/
|
|
35
|
+
export function fieldFormat(format, timePicker, hour12 = false) {
|
|
36
|
+
const date = (format === null || format === void 0 ? void 0 : format.trim()) || DEFAULT_FORMAT;
|
|
37
|
+
const tokens = tokensOnly(date);
|
|
38
|
+
if (TWELVE_HOUR_TOKEN.test(tokens) && !PERIOD_TOKEN.test(tokens))
|
|
39
|
+
return `${date} A`;
|
|
40
|
+
if (!timePicker || HOUR_TOKEN.test(tokens))
|
|
41
|
+
return date;
|
|
42
|
+
return `${date} ${hour12 ? 'h:mm A' : 'HH:mm'}`;
|
|
43
|
+
}
|
|
44
|
+
const pad = (n, width = 2) => String(n).padStart(width, '0');
|
|
45
|
+
const wordsCache = new Map();
|
|
46
|
+
/** Month names and AM/PM words in the locale, on the Gregorian calendar. */
|
|
47
|
+
function localeWords(locale) {
|
|
48
|
+
let words = wordsCache.get(locale);
|
|
49
|
+
if (!words) {
|
|
50
|
+
const month = (style) => {
|
|
51
|
+
const format = new Intl.DateTimeFormat(locale, {
|
|
52
|
+
month: style,
|
|
53
|
+
timeZone: 'UTC',
|
|
54
|
+
calendar: 'gregory',
|
|
55
|
+
});
|
|
56
|
+
return Array.from({ length: 12 }, (_, m) => format.format(new Date(Date.UTC(2023, m, 1))));
|
|
57
|
+
};
|
|
58
|
+
const clock = clockFor(locale);
|
|
59
|
+
words = { months: month('long'), shortMonths: month('short'), am: clock.am, pm: clock.pm };
|
|
60
|
+
wordsCache.set(locale, words);
|
|
61
|
+
}
|
|
62
|
+
return words;
|
|
63
|
+
}
|
|
64
|
+
/** Writes a date in a format of tokens (see `FORMAT_PARTS`), with month names and AM/PM in the locale. */
|
|
65
|
+
export function formatWith(value, format, locale = 'en-US') {
|
|
66
|
+
var _a;
|
|
67
|
+
const words = localeWords(locale);
|
|
68
|
+
const [hours, minutes] = splitTime((_a = value.time) !== null && _a !== void 0 ? _a : '00:00');
|
|
69
|
+
const hour12 = hours % 12 || 12;
|
|
70
|
+
const month = value.date.getUTCMonth();
|
|
71
|
+
const period = hours < 12 ? words.am : words.pm;
|
|
72
|
+
const parts = {
|
|
73
|
+
YYYY: pad(value.date.getUTCFullYear(), 4),
|
|
74
|
+
MMMM: words.months[month],
|
|
75
|
+
MMM: words.shortMonths[month],
|
|
76
|
+
MM: pad(month + 1),
|
|
77
|
+
M: String(month + 1),
|
|
78
|
+
DD: pad(value.date.getUTCDate()),
|
|
79
|
+
D: String(value.date.getUTCDate()),
|
|
80
|
+
HH: pad(hours),
|
|
81
|
+
H: String(hours),
|
|
82
|
+
hh: pad(hour12),
|
|
83
|
+
h: String(hour12),
|
|
84
|
+
mm: pad(minutes),
|
|
85
|
+
A: period,
|
|
86
|
+
a: period.toLowerCase(),
|
|
87
|
+
};
|
|
88
|
+
return format.replace(FORMAT_PARTS, (token, literal) => literal !== null && literal !== void 0 ? literal : parts[token]);
|
|
89
|
+
}
|
|
90
|
+
const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
91
|
+
/** Escapes a format's literal text for a pattern, letting its spaces match any run of spaces. */
|
|
92
|
+
const literalPattern = (literal) => escapeRegExp(literal).replace(/\s+/g, '\\s*');
|
|
93
|
+
const alternatives = (words) => `(${words.map(escapeRegExp).join('|')})`;
|
|
94
|
+
/**
|
|
95
|
+
* Reads typed text in a format of tokens, as written by `formatWith`. Leading zeros are optional,
|
|
96
|
+
* spaces are loose, and month names and AM/PM are matched without regard to case, in the locale or
|
|
97
|
+
* in English. Returns `null` for anything that isn't a real date and time in that format.
|
|
98
|
+
*/
|
|
99
|
+
export function parseWith(text, format, locale = 'en-US') {
|
|
100
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
101
|
+
const words = localeWords(locale);
|
|
102
|
+
const english = localeWords('en-US');
|
|
103
|
+
const periods = [words.am, words.pm, english.am, english.pm];
|
|
104
|
+
const patterns = {
|
|
105
|
+
YYYY: '(\\d{4})',
|
|
106
|
+
MMMM: alternatives([...words.months, ...english.months]),
|
|
107
|
+
MMM: alternatives([...words.shortMonths, ...english.shortMonths]),
|
|
108
|
+
MM: '(\\d{1,2})',
|
|
109
|
+
M: '(\\d{1,2})',
|
|
110
|
+
DD: '(\\d{1,2})',
|
|
111
|
+
D: '(\\d{1,2})',
|
|
112
|
+
HH: '(\\d{1,2})',
|
|
113
|
+
H: '(\\d{1,2})',
|
|
114
|
+
hh: '(\\d{1,2})',
|
|
115
|
+
h: '(\\d{1,2})',
|
|
116
|
+
mm: '(\\d{2})',
|
|
117
|
+
A: alternatives(periods),
|
|
118
|
+
a: alternatives(periods),
|
|
119
|
+
};
|
|
120
|
+
const tokens = [];
|
|
121
|
+
const build = () => {
|
|
122
|
+
tokens.length = 0;
|
|
123
|
+
let pattern = '';
|
|
124
|
+
let last = 0;
|
|
125
|
+
format.replace(FORMAT_PARTS, (token, literal, offset) => {
|
|
126
|
+
pattern += literalPattern(format.slice(last, offset));
|
|
127
|
+
if (literal !== undefined) {
|
|
128
|
+
pattern += literalPattern(literal);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
pattern += patterns[token];
|
|
132
|
+
tokens.push(token);
|
|
133
|
+
}
|
|
134
|
+
last = offset + token.length;
|
|
135
|
+
return token;
|
|
136
|
+
});
|
|
137
|
+
return new RegExp(`^\\s*${pattern}${literalPattern(format.slice(last))}\\s*$`, 'i');
|
|
138
|
+
};
|
|
139
|
+
// Two-digit minutes first, so a format with no separator, as `HHmm`, still reads `930` as 9:30;
|
|
140
|
+
// then one digit, as leading zeros are optional.
|
|
141
|
+
let match = build().exec(text !== null && text !== void 0 ? text : '');
|
|
142
|
+
if (!match) {
|
|
143
|
+
patterns.mm = '(\\d{1,2})';
|
|
144
|
+
match = build().exec(text !== null && text !== void 0 ? text : '');
|
|
145
|
+
}
|
|
146
|
+
if (!match)
|
|
147
|
+
return null;
|
|
148
|
+
const found = match;
|
|
149
|
+
const read = {};
|
|
150
|
+
tokens.forEach((token, i) => (read[token] = found[i + 1]));
|
|
151
|
+
const monthIndex = (name, long) => {
|
|
152
|
+
if (name === undefined)
|
|
153
|
+
return undefined;
|
|
154
|
+
const lists = long ? [words.months, english.months] : [words.shortMonths, english.shortMonths];
|
|
155
|
+
for (const list of lists) {
|
|
156
|
+
const index = list.findIndex((candidate) => candidate.toLowerCase() === name.toLowerCase());
|
|
157
|
+
if (index >= 0)
|
|
158
|
+
return index + 1;
|
|
159
|
+
}
|
|
160
|
+
return undefined;
|
|
161
|
+
};
|
|
162
|
+
const year = Number(read.YYYY);
|
|
163
|
+
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);
|
|
164
|
+
const day = Number((_d = read.DD) !== null && _d !== void 0 ? _d : read.D);
|
|
165
|
+
if (!read.YYYY || !month || !day)
|
|
166
|
+
return null;
|
|
167
|
+
const date = parseIsoDate(`${pad(year, 4)}-${pad(month)}-${pad(day)}`);
|
|
168
|
+
if (!date)
|
|
169
|
+
return null;
|
|
170
|
+
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;
|
|
171
|
+
if (hourText === undefined)
|
|
172
|
+
return { date, time: null };
|
|
173
|
+
let hours = Number(hourText);
|
|
174
|
+
const minutes = Number((_h = read.mm) !== null && _h !== void 0 ? _h : 0);
|
|
175
|
+
const period = (_k = ((_j = read.A) !== null && _j !== void 0 ? _j : read.a)) === null || _k === void 0 ? void 0 : _k.toLowerCase();
|
|
176
|
+
if (read.hh !== undefined || read.h !== undefined) {
|
|
177
|
+
if (hours < 1 || hours > 12)
|
|
178
|
+
return null;
|
|
179
|
+
const pm = period === words.pm.toLowerCase() || period === english.pm.toLowerCase();
|
|
180
|
+
hours = (hours % 12) + (pm ? 12 : 0);
|
|
181
|
+
}
|
|
182
|
+
return hours < 24 && minutes < 60 ? { date, time: joinTime(hours, minutes) } : null;
|
|
183
|
+
}
|
|
184
|
+
/** Reads one typed date in the format, falling back to ISO, which is always accepted. */
|
|
185
|
+
export function parseFieldText(text, format = DEFAULT_FORMAT, locale = 'en-US') {
|
|
186
|
+
var _a;
|
|
187
|
+
return (_a = parseWith(text, format, locale)) !== null && _a !== void 0 ? _a : parseDateTime(text);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Parses a typed range: two dates (with times, optionally) joined by a dash or `to` with spaces
|
|
191
|
+
* around it, as `2026-09-13 – 2026-10-13`, or by `/` when the format doesn't use slashes. The
|
|
192
|
+
* split is tried at each separator until both halves read as dates, so a format that itself has a
|
|
193
|
+
* spaced dash, as `D - M - YYYY`, still works.
|
|
194
|
+
*/
|
|
195
|
+
export function parseRangeText(text, format = DEFAULT_FORMAT, locale = 'en-US') {
|
|
196
|
+
const trimmed = (text !== null && text !== void 0 ? text : '').trim();
|
|
197
|
+
const separators = new RegExp(`${escapeRegExp(RANGE_SEPARATOR)}|\\s+(?:–|—|-|to)\\s+${format.includes('/') ? '' : '|\\s*/\\s*'}`, 'gi');
|
|
198
|
+
let found;
|
|
199
|
+
while ((found = separators.exec(trimmed)) !== null) {
|
|
200
|
+
const start = parseFieldText(trimmed.slice(0, found.index), format, locale);
|
|
201
|
+
const end = parseFieldText(trimmed.slice(found.index + found[0].length), format, locale);
|
|
202
|
+
if (start && end)
|
|
203
|
+
return compareDateTime(start, end) <= 0 ? [start, end] : null;
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
export function compareDateTime(a, b) {
|
|
208
|
+
var _a, _b;
|
|
209
|
+
const byDay = a.date.getTime() - b.date.getTime();
|
|
210
|
+
if (byDay !== 0)
|
|
211
|
+
return byDay;
|
|
212
|
+
return ((_a = a.time) !== null && _a !== void 0 ? _a : '00:00').localeCompare((_b = b.time) !== null && _b !== void 0 ? _b : '00:00');
|
|
213
|
+
}
|
|
214
|
+
/** The value form: `YYYY-MM-DD`, or `YYYY-MM-DDTHH:mm` with a time. */
|
|
215
|
+
export function toValueString(value) {
|
|
216
|
+
return value.time ? `${toIsoDate(value.date)}T${value.time}` : toIsoDate(value.date);
|
|
217
|
+
}
|
|
218
|
+
/** The field form in a format, or by default `YYYY-MM-DD`, with ` HH:mm` when it has a time. */
|
|
219
|
+
export function toFieldText(value, format, locale = 'en-US') {
|
|
220
|
+
return formatWith(value, format !== null && format !== void 0 ? format : fieldFormat(DEFAULT_FORMAT, !!value.time), locale);
|
|
221
|
+
}
|
|
222
|
+
export const RANGE_SEPARATOR = ' – ';
|
|
223
|
+
/** Hour and minute numbers from `HH:mm`. */
|
|
224
|
+
export function splitTime(time) {
|
|
225
|
+
const [hours, minutes] = time.split(':').map(Number);
|
|
226
|
+
return [hours || 0, minutes || 0];
|
|
227
|
+
}
|
|
228
|
+
export function joinTime(hours, minutes) {
|
|
229
|
+
return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`;
|
|
230
|
+
}
|
|
231
|
+
/** Whether the locale writes times on a 12-hour clock, and its AM and PM words. */
|
|
232
|
+
export function clockFor(locale) {
|
|
233
|
+
var _a, _b;
|
|
234
|
+
const format = new Intl.DateTimeFormat(locale, { hour: 'numeric', timeZone: 'UTC' });
|
|
235
|
+
const hour12 = !!format.resolvedOptions().hour12;
|
|
236
|
+
const period = (hour) => { var _a; return (_a = format.formatToParts(new Date(Date.UTC(2023, 0, 1, hour))).find((part) => part.type === 'dayPeriod')) === null || _a === void 0 ? void 0 : _a.value; };
|
|
237
|
+
return { hour12, am: (_a = period(1)) !== null && _a !== void 0 ? _a : 'AM', pm: (_b = period(13)) !== null && _b !== void 0 ? _b : 'PM' };
|
|
238
|
+
}
|
|
@@ -29,7 +29,7 @@ export class PdsDivider {
|
|
|
29
29
|
return classNames.join(' ');
|
|
30
30
|
}
|
|
31
31
|
render() {
|
|
32
|
-
return (h(Host, { key: '
|
|
32
|
+
return (h(Host, { key: '072cc8552bd33c4a00d216f15a5a848cfc97fd92', id: this.componentId }, this.hasLabel ? (h("div", { class: this.classNames(), role: "separator", "aria-label": this.label }, h("span", { class: "pds-divider__label", part: "label", "aria-hidden": "true" }, this.label))) : (h("hr", { class: this.classNames() }))));
|
|
33
33
|
}
|
|
34
34
|
static get is() { return "pds-divider"; }
|
|
35
35
|
static get encapsulation() { return "shadow"; }
|
|
@@ -12,7 +12,7 @@ export class PdsDrawerContent {
|
|
|
12
12
|
unwrapReconnectedContent(this.el.querySelector('.pds-drawer-content'), '.pds-drawer-content');
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
return (h("div", { key: '
|
|
15
|
+
return (h("div", { key: 'b4b41258eccaae8e0a9df90a75fb30d65a7ac9c4', class: "pds-drawer-content" }, h("slot", { key: 'ef90ed5b3f84b51a2938e1d8fd021b971c1c0de9' })));
|
|
16
16
|
}
|
|
17
17
|
static get is() { return "pds-drawer-content"; }
|
|
18
18
|
static get originalStyleUrls() {
|
|
@@ -6,7 +6,7 @@ export class PdsDrawerFooter {
|
|
|
6
6
|
unwrapReconnectedContent(this.el.querySelector('.pds-drawer__footer'), '.pds-drawer__footer');
|
|
7
7
|
}
|
|
8
8
|
render() {
|
|
9
|
-
return (h("footer", { key: '
|
|
9
|
+
return (h("footer", { key: '383f7cb7a95a71bd03b2e328cd4b41117e17c631', class: "pds-drawer__footer" }, h("slot", { key: 'e9e9b6c7fef502c8004223bc8611e8d798ecb966' })));
|
|
10
10
|
}
|
|
11
11
|
static get is() { return "pds-drawer-footer"; }
|
|
12
12
|
static get originalStyleUrls() {
|
|
@@ -6,7 +6,7 @@ export class PdsDrawerHeader {
|
|
|
6
6
|
unwrapReconnectedContent(this.el.querySelector('.pds-drawer__header'), '.pds-drawer__header');
|
|
7
7
|
}
|
|
8
8
|
render() {
|
|
9
|
-
return (h("header", { key: '
|
|
9
|
+
return (h("header", { key: '5524b12af7c07d322ebd6726bd1a28320a838e77', class: "pds-drawer__header" }, h("slot", { key: '8212060c5c48a53d05d320bb625ce2b6dce7c6c3' })));
|
|
10
10
|
}
|
|
11
11
|
static get is() { return "pds-drawer-header"; }
|
|
12
12
|
static get originalStyleUrls() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { closest, containsComposed } from "../../utils/closest";
|
|
2
3
|
import { unwrapReconnectedContent } from "../../utils/reconnected-content";
|
|
3
4
|
// Known selectors for content Pine components portal to document.body rather
|
|
4
5
|
// than rendering in place — pds-popover, pds-tooltip, pds-combobox's dropdown.
|
|
@@ -115,6 +116,12 @@ export class PdsDrawer {
|
|
|
115
116
|
return;
|
|
116
117
|
if (target.closest(PORTALED_OVERLAY_SELECTOR))
|
|
117
118
|
return;
|
|
119
|
+
// A datepicker's portaled calendar counts as inside only when its datepicker is in the drawer,
|
|
120
|
+
// or in an overlay portaled from it (a pds-popover in the drawer puts its content on the body).
|
|
121
|
+
const calendar = target.closest('.pds-datepicker-calendar-portal');
|
|
122
|
+
const owner = calendar === null || calendar === void 0 ? void 0 : calendar.pdsDatepicker;
|
|
123
|
+
if (owner && (containsComposed(this.el, owner) || closest(PORTALED_OVERLAY_SELECTOR, owner)))
|
|
124
|
+
return;
|
|
118
125
|
// A sibling pds-modal — e.g. a confirm dialog opened from inside the
|
|
119
126
|
// drawer but mounted at the document root rather than nested in our own
|
|
120
127
|
// content — is neither a descendant of the drawer nor on the portaled
|
|
@@ -126,11 +133,11 @@ export class PdsDrawer {
|
|
|
126
133
|
this.open = false;
|
|
127
134
|
}
|
|
128
135
|
render() {
|
|
129
|
-
return (h(Host, { key: '
|
|
136
|
+
return (h(Host, { key: '0ca6f9e5c49323c0b72c6338ecd172262afdd999', class: {
|
|
130
137
|
'pds-drawer': true,
|
|
131
138
|
[`pds-drawer--${this.side}`]: true,
|
|
132
139
|
[`pds-drawer--${this.size}`]: true,
|
|
133
|
-
} }, h("pds-modal", { key: '
|
|
140
|
+
} }, h("pds-modal", { key: '5b87fdc3aaedaa7cc7efe43482314dae8621d8c6', class: "pds-drawer__modal", ref: (el) => (this.modalEl = el), componentId: this.componentId, open: this.open, scrollable: this.scrollable, disableTopLayer: true, backdropDismiss: this.lightDismiss, disableInitialFocus: this.initialFocus === 'none' }, h("slot", { key: 'dde3adec14308881defd57f75df9393bf9f9f48f' }))));
|
|
134
141
|
}
|
|
135
142
|
static get is() { return "pds-drawer"; }
|
|
136
143
|
static get originalStyleUrls() {
|
|
@@ -72,7 +72,7 @@ export class PdsDropdownMenuItem {
|
|
|
72
72
|
}, tabIndex: this.disabled ? -1 : 0, type: "button", part: "button", onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null }, h("slot", null)));
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
|
-
return (h(Host, { key: '
|
|
75
|
+
return (h(Host, { key: 'cf22f97df3869d59820ba0deff9a21bfee2628b8', id: this.componentId, class: { 'is-disabled': this.disabled, 'destructive': !this.disabled && this.destructive }, onClick: () => !this.disabled && this.handleClick(), role: "none", tabIndex: -1, "aria-disabled": this.disabled ? 'true' : null }, this.renderElement()));
|
|
76
76
|
}
|
|
77
77
|
static get is() { return "pds-dropdown-menu-item"; }
|
|
78
78
|
static get encapsulation() { return "shadow"; }
|
|
@@ -8,7 +8,7 @@ export class PdsDropdownMenuSeparator {
|
|
|
8
8
|
this.disabled = false;
|
|
9
9
|
}
|
|
10
10
|
render() {
|
|
11
|
-
return (h(Host, { key: '
|
|
11
|
+
return (h(Host, { key: '63bd5fd3112b1030d1e86b331a659ab3a92dd387', id: this.componentId }, h("hr", { key: '0a8504d34a9b91db03abdddd86ce918c00534410' })));
|
|
12
12
|
}
|
|
13
13
|
static get is() { return "pds-dropdown-menu-separator"; }
|
|
14
14
|
static get encapsulation() { return "shadow"; }
|
|
@@ -93,7 +93,9 @@ export class PdsDropdownMenu {
|
|
|
93
93
|
// Reset focus index
|
|
94
94
|
this.currentFocusIndex = -1;
|
|
95
95
|
// Return focus to trigger
|
|
96
|
-
this.
|
|
96
|
+
if (this.isFocusInMenu()) {
|
|
97
|
+
this.triggerEl.focus();
|
|
98
|
+
}
|
|
97
99
|
};
|
|
98
100
|
// Handle click on the trigger element
|
|
99
101
|
this.handleClick = () => {
|
|
@@ -111,6 +113,11 @@ export class PdsDropdownMenu {
|
|
|
111
113
|
this.cleanupAutoUpdate = null;
|
|
112
114
|
}
|
|
113
115
|
}
|
|
116
|
+
// Outside clicks and scripted closes leave focus where it is; only focus in the menu or on its trigger returns.
|
|
117
|
+
isFocusInMenu() {
|
|
118
|
+
const focused = this.host.getRootNode().activeElement;
|
|
119
|
+
return focused != null && this.host.contains(focused);
|
|
120
|
+
}
|
|
114
121
|
// Check if a menu item is disabled (handles both component and raw elements)
|
|
115
122
|
isItemDisabled(item) {
|
|
116
123
|
const tagName = item.tagName.toLowerCase();
|
|
@@ -306,7 +313,7 @@ export class PdsDropdownMenu {
|
|
|
306
313
|
}
|
|
307
314
|
}
|
|
308
315
|
render() {
|
|
309
|
-
return (h(Host, { key: '
|
|
316
|
+
return (h(Host, { key: 'a49d859ea4b881c025620b3bad3157af8ceceb36', id: this.componentId }, h("slot", { key: '2669398c6b6f0ad4037ba34695b0880afa4c69b9', name: "trigger", onSlotchange: this.handleTriggerSlotChange }), h("pds-box", { key: 'e2a6d7892bfe4ead980df8f702e5387e62d6bd05', "border-radius": "sm", display: "flex", direction: "column", class: "pds-dropdown-menu--panel is-hidden", shadow: "100", role: "menu", "aria-orientation": "vertical", part: "menu-panel" }, h("slot", { key: '70fa9b2ac96f528ae0ebd28486b5a934fb705413', onSlotchange: this.handleSlotChange }))));
|
|
310
317
|
}
|
|
311
318
|
static get is() { return "pds-dropdown-menu"; }
|
|
312
319
|
static get encapsulation() { return "shadow"; }
|