@beeq/core 1.12.4 → 1.13.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/dist/beeq/beeq.esm.js +1 -1
- package/dist/beeq/{p-b4b02b99.entry.js → p-0d078519.entry.js} +2 -2
- package/dist/beeq/{p-b4b02b99.entry.js.map → p-0d078519.entry.js.map} +1 -1
- package/dist/beeq/{p-49a999b4.entry.js → p-1a2c4878.entry.js} +2 -2
- package/dist/beeq/p-21db4f39.entry.js +6 -0
- package/dist/beeq/p-21db4f39.entry.js.map +1 -0
- package/dist/beeq/{p-21db2c4e.entry.js → p-24bb2588.entry.js} +2 -2
- package/dist/beeq/{p-21db2c4e.entry.js.map → p-24bb2588.entry.js.map} +1 -1
- package/dist/beeq/{p-327cb74b.entry.js → p-2a081a54.entry.js} +2 -2
- package/dist/beeq/{p-327cb74b.entry.js.map → p-2a081a54.entry.js.map} +1 -1
- package/dist/beeq/{p-8974f66f.entry.js → p-2e1fffcd.entry.js} +2 -2
- package/dist/beeq/p-2fd6ea70.entry.js +6 -0
- package/dist/beeq/{p-d4df64ae.entry.js.map → p-2fd6ea70.entry.js.map} +1 -1
- package/dist/beeq/{p-f4c66e83.entry.js → p-30d1bd84.entry.js} +2 -2
- package/dist/beeq/{p-f4c66e83.entry.js.map → p-30d1bd84.entry.js.map} +1 -1
- package/dist/beeq/{p-b31d249b.entry.js → p-38006c8e.entry.js} +2 -2
- package/dist/beeq/{p-b8bac7c7.entry.js → p-3d754d97.entry.js} +2 -2
- package/dist/beeq/{p-b8bac7c7.entry.js.map → p-3d754d97.entry.js.map} +1 -1
- package/dist/beeq/{p-25772ebd.entry.js → p-45ae19aa.entry.js} +2 -2
- package/dist/beeq/p-45ae19aa.entry.js.map +1 -0
- package/dist/beeq/{p-f0a2c87e.entry.js → p-56b49d4e.entry.js} +2 -2
- package/dist/beeq/{p-f0a2c87e.entry.js.map → p-56b49d4e.entry.js.map} +1 -1
- package/dist/beeq/{p-644013aa.entry.js → p-58813f83.entry.js} +2 -2
- package/dist/beeq/{p-644013aa.entry.js.map → p-58813f83.entry.js.map} +1 -1
- package/dist/beeq/{p-0a3c5b97.entry.js → p-5eba392c.entry.js} +2 -2
- package/dist/beeq/{p-fe22de00.entry.js → p-6a38fcaf.entry.js} +2 -2
- package/dist/beeq/{p-d7c20c6f.entry.js → p-6be3f23a.entry.js} +2 -2
- package/dist/beeq/{p-d7c20c6f.entry.js.map → p-6be3f23a.entry.js.map} +1 -1
- package/dist/beeq/{p-ef783b95.entry.js → p-72ff2fe2.entry.js} +2 -2
- package/dist/beeq/{p-1764899f.entry.js → p-7ebe6b9d.entry.js} +2 -2
- package/dist/beeq/{p-1764899f.entry.js.map → p-7ebe6b9d.entry.js.map} +1 -1
- package/dist/beeq/{p-69cf0536.entry.js → p-817f7a5e.entry.js} +2 -2
- package/dist/beeq/{p-69cf0536.entry.js.map → p-817f7a5e.entry.js.map} +1 -1
- package/dist/beeq/{p-fb763ec5.entry.js → p-8bd7f4c2.entry.js} +2 -2
- package/dist/beeq/{p-8d9bef7a.entry.js → p-8be7ceb5.entry.js} +2 -2
- package/dist/beeq/{p-8d9bef7a.entry.js.map → p-8be7ceb5.entry.js.map} +1 -1
- package/dist/beeq/{p-f07f4d99.entry.js → p-9413a4d3.entry.js} +2 -2
- package/dist/beeq/{p-b7c6fdbd.entry.js → p-96f72671.entry.js} +2 -2
- package/dist/beeq/p-96f72671.entry.js.map +1 -0
- package/dist/beeq/p-Dx-CEPSQ.js.map +1 -1
- package/dist/beeq/p-a0a8ea5b.entry.js +6 -0
- package/dist/beeq/p-a0a8ea5b.entry.js.map +1 -0
- package/dist/beeq/{p-7972ba08.entry.js → p-a55354ee.entry.js} +2 -2
- package/dist/beeq/{p-365f0372.entry.js → p-a72671f9.entry.js} +2 -2
- package/dist/beeq/p-a72671f9.entry.js.map +1 -0
- package/dist/beeq/{p-56810dba.entry.js → p-bdb983f9.entry.js} +2 -2
- package/dist/beeq/{p-56810dba.entry.js.map → p-bdb983f9.entry.js.map} +1 -1
- package/dist/beeq/{p-2a7c5b1e.entry.js → p-d6c35472.entry.js} +2 -2
- package/dist/beeq/{p-2a7c5b1e.entry.js.map → p-d6c35472.entry.js.map} +1 -1
- package/dist/beeq/{p-84e96891.entry.js → p-d792e3d3.entry.js} +2 -2
- package/dist/beeq/{p-5645238d.entry.js → p-e9a1b183.entry.js} +2 -2
- package/dist/beeq/p-f688d230.entry.js +6 -0
- package/dist/beeq/{p-79aab4dd.entry.js.map → p-f688d230.entry.js.map} +1 -1
- package/dist/beeq/{p-b6f5430a.entry.js → p-f891fb4b.entry.js} +2 -2
- package/dist/beeq/{p-b26ee039.entry.js → p-fa123a10.entry.js} +2 -2
- package/dist/beeq/{p-b26ee039.entry.js.map → p-fa123a10.entry.js.map} +1 -1
- package/dist/beeq/p-uqkxeAeG.js.map +1 -1
- package/dist/beeq/svg/.icons-meta.json +13 -0
- package/dist/beeq.html-custom-data.json +2153 -50
- package/dist/cjs/beeq.cjs.js +1 -1
- package/dist/cjs/bq-accordion.cjs.entry.js +1 -1
- package/dist/cjs/bq-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-alert.cjs.entry.js +1 -1
- package/dist/cjs/bq-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-button_2.cjs.entry.js +2 -2
- package/dist/cjs/bq-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-checkbox.cjs.entry.js +4 -4
- package/dist/cjs/bq-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-date-picker.cjs.entry.js +1741 -364
- package/dist/cjs/bq-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-dialog.cjs.entry.js +5 -5
- package/dist/cjs/bq-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-divider.cjs.entry.js +4 -4
- package/dist/cjs/bq-drawer.cjs.entry.js +5 -5
- package/dist/cjs/bq-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-dropdown_2.cjs.entry.js +4 -4
- package/dist/cjs/bq-dropdown_2.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-empty-state.cjs.entry.js +6 -6
- package/dist/cjs/bq-empty-state.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-input.cjs.entry.js +8 -8
- package/dist/cjs/bq-input.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-notification.cjs.entry.js +6 -6
- package/dist/cjs/bq-notification.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-option-group.cjs.entry.js +1 -1
- package/dist/cjs/bq-option-list_2.cjs.entry.js +6 -6
- package/dist/cjs/bq-option-list_2.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-option.cjs.entry.js +4 -4
- package/dist/cjs/bq-page-title.cjs.entry.js +4 -4
- package/dist/cjs/bq-progress.cjs.entry.js +5 -5
- package/dist/cjs/bq-progress.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/bq-radio.cjs.entry.js +4 -4
- package/dist/cjs/bq-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-select.cjs.entry.js +1 -1
- package/dist/cjs/bq-select.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-side-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/bq-side-menu-item.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-side-menu.cjs.entry.js +2 -2
- package/dist/cjs/bq-slider.cjs.entry.js +3 -3
- package/dist/cjs/bq-slider.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-spinner.cjs.entry.js +4 -4
- package/dist/cjs/bq-status.cjs.entry.js +2 -2
- package/dist/cjs/bq-status.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-step-item.cjs.entry.js +5 -5
- package/dist/cjs/bq-step-item.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-steps.cjs.entry.js +2 -2
- package/dist/cjs/bq-switch.cjs.entry.js +4 -4
- package/dist/cjs/bq-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-tab-group.cjs.entry.js +3 -3
- package/dist/cjs/bq-tab.cjs.entry.js +3 -3
- package/dist/cjs/bq-textarea.cjs.entry.js +5 -5
- package/dist/cjs/bq-toast.cjs.entry.js +2 -2
- package/dist/cjs/bq-toast.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-tooltip.cjs.entry.js +4 -4
- package/dist/cjs/event-BhuEFC-I.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/slot-DKWrtk4b.js.map +1 -1
- package/dist/collection/components/accordion-group/scss/bq-accordion-group.css +1 -1
- package/dist/collection/components/alert/scss/bq-alert.css +1 -1
- package/dist/collection/components/avatar/scss/bq-avatar.css +1 -1
- package/dist/collection/components/breadcrumb/scss/bq-breadcrumb.css +1 -1
- package/dist/collection/components/breadcrumb-item/scss/bq-breadcrumb-item.css +1 -1
- package/dist/collection/components/button/scss/bq-button.css +1 -1
- package/dist/collection/components/card/scss/bq-card.css +1 -1
- package/dist/collection/components/checkbox/bq-checkbox.js +5 -4
- package/dist/collection/components/checkbox/bq-checkbox.js.map +1 -1
- package/dist/collection/components/checkbox/scss/bq-checkbox.css +1 -1
- package/dist/collection/components/date-picker/bq-date-picker.js +1141 -457
- package/dist/collection/components/date-picker/bq-date-picker.js.map +1 -1
- package/dist/collection/components/date-picker/bq-date-picker.types.js +29 -0
- package/dist/collection/components/date-picker/bq-date-picker.types.js.map +1 -1
- package/dist/collection/components/date-picker/components/CalendarDayView.js +96 -0
- package/dist/collection/components/date-picker/components/CalendarDayView.js.map +1 -0
- package/dist/collection/components/date-picker/components/CalendarHeader.js +18 -0
- package/dist/collection/components/date-picker/components/CalendarHeader.js.map +1 -0
- package/dist/collection/components/date-picker/components/CalendarMonthView.js +70 -0
- package/dist/collection/components/date-picker/components/CalendarMonthView.js.map +1 -0
- package/dist/collection/components/date-picker/components/CalendarYearView.js +68 -0
- package/dist/collection/components/date-picker/components/CalendarYearView.js.map +1 -0
- package/dist/collection/components/date-picker/helper/bounds.js +114 -0
- package/dist/collection/components/date-picker/helper/bounds.js.map +1 -0
- package/dist/collection/components/date-picker/helper/calendar.js +156 -0
- package/dist/collection/components/date-picker/helper/calendar.js.map +1 -0
- package/dist/collection/components/date-picker/helper/constants.js +62 -16
- package/dist/collection/components/date-picker/helper/constants.js.map +1 -1
- package/dist/collection/components/date-picker/helper/input.js +37 -0
- package/dist/collection/components/date-picker/helper/input.js.map +1 -0
- package/dist/collection/components/date-picker/helper/intl.js +78 -0
- package/dist/collection/components/date-picker/helper/intl.js.map +1 -0
- package/dist/collection/components/date-picker/helper/labels.js +61 -0
- package/dist/collection/components/date-picker/helper/labels.js.map +1 -0
- package/dist/collection/components/date-picker/helper/navigation.js +45 -0
- package/dist/collection/components/date-picker/helper/navigation.js.map +1 -0
- package/dist/collection/components/date-picker/helper/selection.js +167 -0
- package/dist/collection/components/date-picker/helper/selection.js.map +1 -0
- package/dist/collection/components/date-picker/helper/value.js +49 -0
- package/dist/collection/components/date-picker/helper/value.js.map +1 -0
- package/dist/collection/components/date-picker/scss/bq-date-picker.css +1 -1
- package/dist/collection/components/dialog/bq-dialog.js +4 -4
- package/dist/collection/components/dialog/scss/bq-dialog.css +1 -1
- package/dist/collection/components/divider/bq-divider.js +4 -4
- package/dist/collection/components/drawer/bq-drawer.js +4 -4
- package/dist/collection/components/drawer/scss/bq-drawer.css +1 -1
- package/dist/collection/components/dropdown/bq-dropdown.js +1 -1
- package/dist/collection/components/dropdown/scss/bq-dropdown.css +1 -1
- package/dist/collection/components/empty-state/bq-empty-state.js +5 -5
- package/dist/collection/components/empty-state/scss/bq-empty-state.css +1 -1
- package/dist/collection/components/icon/bq-icon.js +1 -1
- package/dist/collection/components/icon/svg/.icons-meta.json +13 -0
- package/dist/collection/components/input/bq-input.js +7 -7
- package/dist/collection/components/input/scss/bq-input.css +1 -1
- package/dist/collection/components/notification/bq-notification.js +5 -5
- package/dist/collection/components/notification/scss/bq-notification.css +1 -1
- package/dist/collection/components/option/bq-option.js +4 -4
- package/dist/collection/components/option-group/bq-option-group.js +1 -1
- package/dist/collection/components/option-group/scss/bq-option-group.css +1 -1
- package/dist/collection/components/option-list/bq-option-list.js +1 -1
- package/dist/collection/components/option-list/scss/bq-option-list.css +1 -1
- package/dist/collection/components/page-title/bq-page-title.js +4 -4
- package/dist/collection/components/page-title/scss/bq-page-title.css +1 -1
- package/dist/collection/components/panel/bq-panel.js +2 -2
- package/dist/collection/components/panel/scss/bq-panel.css +1 -1
- package/dist/collection/components/progress/bq-progress.js +4 -4
- package/dist/collection/components/progress/scss/bq-progress.css +1 -1
- package/dist/collection/components/radio/bq-radio.js +5 -4
- package/dist/collection/components/radio/bq-radio.js.map +1 -1
- package/dist/collection/components/radio/scss/bq-radio.css +1 -1
- package/dist/collection/components/radio-group/bq-radio-group.js +1 -1
- package/dist/collection/components/select/scss/bq-select.css +1 -1
- package/dist/collection/components/side-menu/bq-side-menu.js +2 -2
- package/dist/collection/components/side-menu-item/scss/bq-side-menu-item.css +1 -1
- package/dist/collection/components/slider/bq-slider.js +2 -2
- package/dist/collection/components/spinner/bq-spinner.js +4 -4
- package/dist/collection/components/spinner/scss/bq-spinner.css +1 -1
- package/dist/collection/components/status/bq-status.js +1 -1
- package/dist/collection/components/status/scss/bq-status.css +1 -1
- package/dist/collection/components/step-item/bq-step-item.js +4 -4
- package/dist/collection/components/step-item/scss/bq-step-item.css +1 -1
- package/dist/collection/components/steps/bq-steps.js +2 -2
- package/dist/collection/components/switch/bq-switch.js +3 -3
- package/dist/collection/components/switch/scss/bq-switch.css +1 -1
- package/dist/collection/components/tab/bq-tab.js +3 -3
- package/dist/collection/components/tab/scss/bq-tab.css +1 -1
- package/dist/collection/components/tab-group/bq-tab-group.js +3 -3
- package/dist/collection/components/tag/bq-tag.js +4 -4
- package/dist/collection/components/tag/scss/bq-tag.css +1 -1
- package/dist/collection/components/textarea/bq-textarea.js +5 -5
- package/dist/collection/components/textarea/scss/bq-textarea.css +1 -1
- package/dist/collection/components/toast/bq-toast.js +1 -1
- package/dist/collection/components/toast/scss/bq-toast.css +1 -1
- package/dist/collection/components/tooltip/bq-tooltip.js +4 -4
- package/dist/collection/components/tooltip/scss/bq-tooltip.css +1 -1
- package/dist/collection/shared/utils/event.js.map +1 -1
- package/dist/collection/shared/utils/slot.js.map +1 -1
- package/dist/components/bq-accordion-group.js +1 -1
- package/dist/components/bq-accordion-group.js.map +1 -1
- package/dist/components/bq-accordion.js +1 -1
- package/dist/components/bq-alert.js +1 -1
- package/dist/components/bq-alert.js.map +1 -1
- package/dist/components/bq-avatar.js +1 -1
- package/dist/components/bq-avatar.js.map +1 -1
- package/dist/components/bq-breadcrumb-item.js +1 -1
- package/dist/components/bq-breadcrumb-item.js.map +1 -1
- package/dist/components/bq-breadcrumb.js +1 -1
- package/dist/components/bq-breadcrumb.js.map +1 -1
- package/dist/components/bq-button.js +1 -1
- package/dist/components/bq-card.js +1 -1
- package/dist/components/bq-card.js.map +1 -1
- package/dist/components/bq-checkbox.js +1 -1
- package/dist/components/bq-checkbox.js.map +1 -1
- package/dist/components/bq-date-picker.js +1 -1
- package/dist/components/bq-date-picker.js.map +1 -1
- package/dist/components/bq-dialog.js +1 -1
- package/dist/components/bq-dialog.js.map +1 -1
- package/dist/components/bq-divider.js +1 -1
- package/dist/components/bq-drawer.js +1 -1
- package/dist/components/bq-drawer.js.map +1 -1
- package/dist/components/bq-dropdown.js +1 -1
- package/dist/components/bq-empty-state.js +1 -1
- package/dist/components/bq-empty-state.js.map +1 -1
- package/dist/components/bq-icon.js +1 -1
- package/dist/components/bq-input.js +1 -1
- package/dist/components/bq-input.js.map +1 -1
- package/dist/components/bq-notification.js +1 -1
- package/dist/components/bq-notification.js.map +1 -1
- package/dist/components/bq-option-group.js +1 -1
- package/dist/components/bq-option-group.js.map +1 -1
- package/dist/components/bq-option-list.js +1 -1
- package/dist/components/bq-option.js +1 -1
- package/dist/components/bq-page-title.js +1 -1
- package/dist/components/bq-page-title.js.map +1 -1
- package/dist/components/bq-panel.js +1 -1
- package/dist/components/bq-progress.js +1 -1
- package/dist/components/bq-progress.js.map +1 -1
- package/dist/components/bq-radio-group.js +1 -1
- package/dist/components/bq-radio.js +1 -1
- package/dist/components/bq-radio.js.map +1 -1
- package/dist/components/bq-select.js +1 -1
- package/dist/components/bq-select.js.map +1 -1
- package/dist/components/bq-side-menu-item.js +1 -1
- package/dist/components/bq-side-menu-item.js.map +1 -1
- package/dist/components/bq-side-menu.js +1 -1
- package/dist/components/bq-slider.js +1 -1
- package/dist/components/bq-spinner.js +1 -1
- package/dist/components/bq-spinner.js.map +1 -1
- package/dist/components/bq-status.js +1 -1
- package/dist/components/bq-status.js.map +1 -1
- package/dist/components/bq-step-item.js +1 -1
- package/dist/components/bq-step-item.js.map +1 -1
- package/dist/components/bq-steps.js +1 -1
- package/dist/components/bq-switch.js +1 -1
- package/dist/components/bq-switch.js.map +1 -1
- package/dist/components/bq-tab-group.js +1 -1
- package/dist/components/bq-tab.js +1 -1
- package/dist/components/bq-tab.js.map +1 -1
- package/dist/components/bq-tag.js +1 -1
- package/dist/components/bq-textarea.js +1 -1
- package/dist/components/bq-textarea.js.map +1 -1
- package/dist/components/bq-toast.js +1 -1
- package/dist/components/bq-toast.js.map +1 -1
- package/dist/components/bq-tooltip.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-CK3SnGa2.js → p-BBCVL6R0.js} +2 -2
- package/dist/components/{p-MSqM1CAF.js → p-BS8hIETL.js} +2 -2
- package/dist/components/{p-MSqM1CAF.js.map → p-BS8hIETL.js.map} +1 -1
- package/dist/components/{p-wi7vUIoV.js → p-CWawcXxA.js} +2 -2
- package/dist/components/{p-wi7vUIoV.js.map → p-CWawcXxA.js.map} +1 -1
- package/dist/components/{p-CNITfoR_.js → p-D6ngGq0Y.js} +2 -2
- package/dist/components/{p-CNITfoR_.js.map → p-D6ngGq0Y.js.map} +1 -1
- package/dist/components/{p-jrBUnEFW.js → p-DMKBBBUE.js} +2 -2
- package/dist/components/{p-jrBUnEFW.js.map → p-DMKBBBUE.js.map} +1 -1
- package/dist/components/p-Dd3v3b2E.js +6 -0
- package/dist/components/{p-CfP6le1E.js.map → p-Dd3v3b2E.js.map} +1 -1
- package/dist/components/p-Dx-CEPSQ.js.map +1 -1
- package/dist/components/{p-BOuMP_Rm.js → p-iyX-PhkX.js} +2 -2
- package/dist/components/{p-BOuMP_Rm.js.map → p-iyX-PhkX.js.map} +1 -1
- package/dist/components/p-uqkxeAeG.js.map +1 -1
- package/dist/components/{p-2bpX-u8x.js → p-v3c5-Hhf.js} +2 -2
- package/dist/custom-elements.json +25333 -1261
- package/dist/esm/beeq.js +1 -1
- package/dist/esm/bq-accordion.entry.js +1 -1
- package/dist/esm/bq-accordion.entry.js.map +1 -1
- package/dist/esm/bq-alert.entry.js +1 -1
- package/dist/esm/bq-alert.entry.js.map +1 -1
- package/dist/esm/bq-button_2.entry.js +2 -2
- package/dist/esm/bq-button_2.entry.js.map +1 -1
- package/dist/esm/bq-checkbox.entry.js +4 -4
- package/dist/esm/bq-checkbox.entry.js.map +1 -1
- package/dist/esm/bq-date-picker.entry.js +1743 -366
- package/dist/esm/bq-date-picker.entry.js.map +1 -1
- package/dist/esm/bq-dialog.entry.js +5 -5
- package/dist/esm/bq-dialog.entry.js.map +1 -1
- package/dist/esm/bq-divider.entry.js +4 -4
- package/dist/esm/bq-drawer.entry.js +5 -5
- package/dist/esm/bq-drawer.entry.js.map +1 -1
- package/dist/esm/bq-dropdown_2.entry.js +4 -4
- package/dist/esm/bq-dropdown_2.entry.js.map +1 -1
- package/dist/esm/bq-empty-state.entry.js +6 -6
- package/dist/esm/bq-empty-state.entry.js.map +1 -1
- package/dist/esm/bq-input.entry.js +8 -8
- package/dist/esm/bq-input.entry.js.map +1 -1
- package/dist/esm/bq-notification.entry.js +6 -6
- package/dist/esm/bq-notification.entry.js.map +1 -1
- package/dist/esm/bq-option-group.entry.js +1 -1
- package/dist/esm/bq-option-list_2.entry.js +6 -6
- package/dist/esm/bq-option-list_2.entry.js.map +1 -1
- package/dist/esm/bq-option.entry.js +4 -4
- package/dist/esm/bq-page-title.entry.js +4 -4
- package/dist/esm/bq-progress.entry.js +5 -5
- package/dist/esm/bq-progress.entry.js.map +1 -1
- package/dist/esm/bq-radio-group.entry.js +1 -1
- package/dist/esm/bq-radio.entry.js +4 -4
- package/dist/esm/bq-radio.entry.js.map +1 -1
- package/dist/esm/bq-select.entry.js +1 -1
- package/dist/esm/bq-select.entry.js.map +1 -1
- package/dist/esm/bq-side-menu-item.entry.js +1 -1
- package/dist/esm/bq-side-menu-item.entry.js.map +1 -1
- package/dist/esm/bq-side-menu.entry.js +2 -2
- package/dist/esm/bq-slider.entry.js +3 -3
- package/dist/esm/bq-slider.entry.js.map +1 -1
- package/dist/esm/bq-spinner.entry.js +4 -4
- package/dist/esm/bq-status.entry.js +2 -2
- package/dist/esm/bq-status.entry.js.map +1 -1
- package/dist/esm/bq-step-item.entry.js +5 -5
- package/dist/esm/bq-step-item.entry.js.map +1 -1
- package/dist/esm/bq-steps.entry.js +2 -2
- package/dist/esm/bq-switch.entry.js +4 -4
- package/dist/esm/bq-switch.entry.js.map +1 -1
- package/dist/esm/bq-tab-group.entry.js +3 -3
- package/dist/esm/bq-tab.entry.js +3 -3
- package/dist/esm/bq-textarea.entry.js +5 -5
- package/dist/esm/bq-toast.entry.js +2 -2
- package/dist/esm/bq-toast.entry.js.map +1 -1
- package/dist/esm/bq-tooltip.entry.js +4 -4
- package/dist/esm/event-Dx-CEPSQ.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/slot-uqkxeAeG.js.map +1 -1
- package/dist/hydrate/index.js +1980 -601
- package/dist/hydrate/index.mjs +1980 -601
- package/dist/stencil.config.js +6 -0
- package/dist/stencil.config.js.map +1 -1
- package/dist/types/components/checkbox/bq-checkbox.d.ts +2 -1
- package/dist/types/components/date-picker/bq-date-picker.d.ts +330 -238
- package/dist/types/components/date-picker/bq-date-picker.types.d.ts +30 -39
- package/dist/types/components/date-picker/components/CalendarDayView.d.ts +42 -0
- package/dist/types/components/date-picker/components/CalendarHeader.d.ts +34 -0
- package/dist/types/components/date-picker/components/CalendarMonthView.d.ts +34 -0
- package/dist/types/components/date-picker/components/CalendarYearView.d.ts +32 -0
- package/dist/types/components/date-picker/helper/bounds.d.ts +49 -0
- package/dist/types/components/date-picker/helper/calendar.d.ts +78 -0
- package/dist/types/components/date-picker/helper/constants.d.ts +62 -16
- package/dist/types/components/date-picker/helper/input.d.ts +23 -0
- package/dist/types/components/date-picker/helper/intl.d.ts +38 -0
- package/dist/types/components/date-picker/helper/labels.d.ts +29 -0
- package/dist/types/components/date-picker/helper/navigation.d.ts +23 -0
- package/dist/types/components/date-picker/helper/selection.d.ts +44 -0
- package/dist/types/components/date-picker/helper/value.d.ts +31 -0
- package/dist/types/components/radio/bq-radio.d.ts +2 -1
- package/dist/types/components.d.ts +437 -350
- package/dist/types/shared/utils/event.d.ts +1 -1
- package/dist/types/shared/utils/slot.d.ts +1 -1
- package/package.json +1 -1
- package/dist/beeq/p-0cfa8d0b.entry.js +0 -6
- package/dist/beeq/p-0cfa8d0b.entry.js.map +0 -1
- package/dist/beeq/p-25772ebd.entry.js.map +0 -1
- package/dist/beeq/p-365f0372.entry.js.map +0 -1
- package/dist/beeq/p-53ea5999.entry.js +0 -6
- package/dist/beeq/p-53ea5999.entry.js.map +0 -1
- package/dist/beeq/p-79aab4dd.entry.js +0 -6
- package/dist/beeq/p-b7c6fdbd.entry.js.map +0 -1
- package/dist/beeq/p-d4df64ae.entry.js +0 -6
- package/dist/collection/components/date-picker/libs/callyLibrary.js +0 -92
- package/dist/collection/components/date-picker/libs/callyLibrary.js.map +0 -1
- package/dist/components/p-CfP6le1E.js +0 -6
- package/dist/types/components/date-picker/libs/callyLibrary.d.ts +0 -15
- /package/dist/beeq/{p-49a999b4.entry.js.map → p-1a2c4878.entry.js.map} +0 -0
- /package/dist/beeq/{p-8974f66f.entry.js.map → p-2e1fffcd.entry.js.map} +0 -0
- /package/dist/beeq/{p-b31d249b.entry.js.map → p-38006c8e.entry.js.map} +0 -0
- /package/dist/beeq/{p-0a3c5b97.entry.js.map → p-5eba392c.entry.js.map} +0 -0
- /package/dist/beeq/{p-fe22de00.entry.js.map → p-6a38fcaf.entry.js.map} +0 -0
- /package/dist/beeq/{p-ef783b95.entry.js.map → p-72ff2fe2.entry.js.map} +0 -0
- /package/dist/beeq/{p-fb763ec5.entry.js.map → p-8bd7f4c2.entry.js.map} +0 -0
- /package/dist/beeq/{p-f07f4d99.entry.js.map → p-9413a4d3.entry.js.map} +0 -0
- /package/dist/beeq/{p-7972ba08.entry.js.map → p-a55354ee.entry.js.map} +0 -0
- /package/dist/beeq/{p-84e96891.entry.js.map → p-d792e3d3.entry.js.map} +0 -0
- /package/dist/beeq/{p-5645238d.entry.js.map → p-e9a1b183.entry.js.map} +0 -0
- /package/dist/beeq/{p-b6f5430a.entry.js.map → p-f891fb4b.entry.js.map} +0 -0
- /package/dist/components/{p-CK3SnGa2.js.map → p-BBCVL6R0.js.map} +0 -0
- /package/dist/components/{p-2bpX-u8x.js.map → p-v3c5-Hhf.js.map} +0 -0
|
@@ -2,126 +2,957 @@
|
|
|
2
2
|
* Built by Endavans
|
|
3
3
|
* © https://beeq.design - Apache 2 License.
|
|
4
4
|
*/
|
|
5
|
-
import { r as registerInstance, c as createEvent, a as getElement
|
|
6
|
-
import {
|
|
7
|
-
import { f as formatDisplayValue, e as extractFocusedDate, g as getTodayISO, p as parseDateInput, t as toISODateString, u as updateFormValidity, c as clampDateToRange } from './form-DLjuE3KX.js';
|
|
5
|
+
import { h, r as registerInstance, c as createEvent, a as getElement } from './index-BSSRzVAz.js';
|
|
6
|
+
import { I as ISO_DATE_LOCALE, p as parseDateInput, t as toISODateString, f as formatDisplayValue, g as getTodayISO, u as updateFormValidity } from './form-DLjuE3KX.js';
|
|
8
7
|
import { i as isNil } from './isNil-BcPwGxIn.js';
|
|
9
8
|
import { i as isEventTargetChildOfElement } from './event-Dx-CEPSQ.js';
|
|
10
|
-
import { i as isDefined } from './isDefined-DvmFa_bD.js';
|
|
11
9
|
import { i as isHTMLElement } from './isHTMLElement-D1A0LpG_.js';
|
|
12
10
|
import { v as validatePropValue } from './props-DbxZ8FhA.js';
|
|
13
11
|
import { b as hasSlotContent } from './slot-uqkxeAeG.js';
|
|
12
|
+
import { i as isDefined } from './isDefined-DvmFa_bD.js';
|
|
14
13
|
import './isString-lysmVw2n.js';
|
|
15
14
|
|
|
15
|
+
const INPUT_VALIDATION = ['error', 'none', 'success', 'warning'];
|
|
16
|
+
|
|
17
|
+
const DAYS_OF_WEEK = [0, 1, 2, 3, 4, 5, 6];
|
|
16
18
|
/** The type of the date picker */
|
|
17
19
|
const DATE_PICKER_TYPE = ['single', 'multi', 'range'];
|
|
20
|
+
/** The calendar view */
|
|
21
|
+
const CALENDAR_VIEW = ['days', 'months', 'years'];
|
|
22
|
+
/** Positioning strategy for the panel. */
|
|
23
|
+
const FLOATING_STRATEGY = ['fixed', 'absolute'];
|
|
24
|
+
/** Placement of the panel — mirrors `@floating-ui/dom` placements. */
|
|
25
|
+
const FLOATING_PLACEMENT = [
|
|
26
|
+
'top',
|
|
27
|
+
'top-start',
|
|
28
|
+
'top-end',
|
|
29
|
+
'right',
|
|
30
|
+
'right-start',
|
|
31
|
+
'right-end',
|
|
32
|
+
'bottom',
|
|
33
|
+
'bottom-start',
|
|
34
|
+
'bottom-end',
|
|
35
|
+
'left',
|
|
36
|
+
'left-start',
|
|
37
|
+
'left-end',
|
|
38
|
+
];
|
|
39
|
+
/** How the next/previous buttons should step through months. */
|
|
40
|
+
const MONTHS_PER_VIEW = ['single', 'months'];
|
|
41
|
+
/**
|
|
42
|
+
* The precision of the value produced by the date picker.
|
|
43
|
+
* - `day` → `YYYY-MM-DD` (default; drill-down to days)
|
|
44
|
+
* - `month` → `YYYY-MM` (selection commits on the months view)
|
|
45
|
+
* - `year` → `YYYY` (selection commits on the years view)
|
|
46
|
+
*/
|
|
47
|
+
const DATE_PRECISION = ['day', 'month', 'year'];
|
|
18
48
|
|
|
19
49
|
/** Default fallback input ID */
|
|
20
50
|
const DEFAULT_INPUT_ID = 'date-picker';
|
|
21
|
-
/**
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
/** Default aria labels used by the calendar navigation */
|
|
52
|
+
const DEFAULT_ARIA_LABELS = {
|
|
53
|
+
previousMonth: 'Previous month',
|
|
54
|
+
nextMonth: 'Next month',
|
|
55
|
+
previousYear: 'Previous year',
|
|
56
|
+
nextYear: 'Next year',
|
|
57
|
+
previousDecade: 'Previous decade',
|
|
58
|
+
nextDecade: 'Next decade',
|
|
59
|
+
chooseMonth: 'Choose month',
|
|
60
|
+
chooseYear: 'Choose year',
|
|
61
|
+
chooseDate: 'Choose date',
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Shadow DOM parts exposed by the component.
|
|
65
|
+
* Kept as a single list so it is easy to audit against the JSDoc @part list.
|
|
66
|
+
*/
|
|
67
|
+
const CALENDAR_PARTS = {
|
|
68
|
+
base: 'base',
|
|
69
|
+
label: 'label',
|
|
70
|
+
control: 'control',
|
|
71
|
+
prefix: 'prefix',
|
|
72
|
+
suffix: 'suffix',
|
|
73
|
+
input: 'input',
|
|
74
|
+
clearBtn: 'clear-btn',
|
|
75
|
+
button: 'button',
|
|
76
|
+
container: 'calendar__container',
|
|
77
|
+
header: 'calendar__header',
|
|
78
|
+
heading: 'calendar__heading',
|
|
79
|
+
previous: 'calendar__previous',
|
|
80
|
+
next: 'calendar__next',
|
|
81
|
+
table: 'calendar__table',
|
|
82
|
+
head: 'calendar__head',
|
|
83
|
+
tr: 'calendar__tr',
|
|
84
|
+
th: 'calendar__th',
|
|
85
|
+
week: 'calendar__week',
|
|
86
|
+
td: 'calendar__td',
|
|
87
|
+
day: 'calendar__day',
|
|
88
|
+
today: 'calendar__today',
|
|
89
|
+
selected: 'calendar__selected',
|
|
90
|
+
outside: 'calendar__outside',
|
|
91
|
+
disallowed: 'calendar__disallowed',
|
|
92
|
+
disabled: 'calendar__disabled',
|
|
93
|
+
rangeStart: 'calendar__range-start',
|
|
94
|
+
rangeEnd: 'calendar__range-end',
|
|
95
|
+
rangeInner: 'calendar__range-inner',
|
|
96
|
+
months: 'calendar__months',
|
|
97
|
+
month: 'calendar__month',
|
|
98
|
+
monthSelected: 'calendar__month-selected',
|
|
99
|
+
years: 'calendar__years',
|
|
100
|
+
year: 'calendar__year',
|
|
101
|
+
yearSelected: 'calendar__year-selected',
|
|
102
|
+
calendarTrigger: 'calendar-trigger',
|
|
103
|
+
};
|
|
104
|
+
/** Number of years shown in the decade view grid. Uses 12 to fill a 3x4 grid. */
|
|
105
|
+
const DECADE_GRID_SIZE = 12;
|
|
106
|
+
/**
|
|
107
|
+
* Maximum number of month panels rendered side-by-side. Range pickers only
|
|
108
|
+
* benefit from up to 2 panels — beyond that the popover overflows most
|
|
109
|
+
* viewports and roving keyboard navigation becomes confusing.
|
|
110
|
+
*/
|
|
111
|
+
const MAX_MONTHS_PER_VIEW = 2;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Bounds predicates for the calendar.
|
|
115
|
+
*
|
|
116
|
+
* `min` and `max` may be at any wire precision (`YYYY`, `YYYY-MM`, or
|
|
117
|
+
* `YYYY-MM-DD`); internal cell values are always full `YYYY-MM-DD` strings.
|
|
118
|
+
* All predicates are pure and rely on lexicographic comparison, which is
|
|
119
|
+
* safe for ISO 8601 dates.
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* Extract the `YYYY` prefix (as a number) from a bound string.
|
|
123
|
+
* Returns `null` if the string does not begin with a 4-digit year.
|
|
124
|
+
*/
|
|
125
|
+
const boundYear = (iso) => {
|
|
126
|
+
if (!iso)
|
|
127
|
+
return null;
|
|
128
|
+
const match = /^(\d{4})/.exec(iso);
|
|
129
|
+
return match ? Number(match[1]) : null;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Extract `{ year, month }` (month is 0-based) from a bound string. Falls
|
|
133
|
+
* back to `null` when the string doesn't contain a `YYYY-MM` prefix.
|
|
134
|
+
*/
|
|
135
|
+
const boundYearMonth = (iso) => {
|
|
136
|
+
if (!iso)
|
|
137
|
+
return null;
|
|
138
|
+
const match = /^(\d{4})-(\d{2})/.exec(iso);
|
|
139
|
+
if (!match)
|
|
140
|
+
return null;
|
|
141
|
+
const month = Number(match[2]) - 1;
|
|
142
|
+
if (month < 0 || month > 11)
|
|
143
|
+
return null;
|
|
144
|
+
return { year: Number(match[1]), month };
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Whether a given year is within the (inclusive) `min`/`max` range.
|
|
148
|
+
* A year cell is considered in-range when any day inside that year is
|
|
149
|
+
* still selectable — i.e. we compare on the year prefix only, ignoring
|
|
150
|
+
* the month/day components of `min` / `max`.
|
|
151
|
+
*/
|
|
152
|
+
const isYearWithinBounds = (year, min, max) => {
|
|
153
|
+
const minYear = boundYear(min);
|
|
154
|
+
const maxYear = boundYear(max);
|
|
155
|
+
if (minYear !== null && year < minYear)
|
|
156
|
+
return false;
|
|
157
|
+
if (maxYear !== null && year > maxYear)
|
|
158
|
+
return false;
|
|
159
|
+
return true;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Whether a `(year, month)` pair sits at-or-after the given lower bound.
|
|
163
|
+
* A `null`/`undefined` bound is treated as "no lower bound".
|
|
164
|
+
*/
|
|
165
|
+
const monthAtOrAfter = (year, month, bound) => {
|
|
166
|
+
const ym = boundYearMonth(bound);
|
|
167
|
+
if (ym)
|
|
168
|
+
return year > ym.year || (year === ym.year && month >= ym.month);
|
|
169
|
+
const y = boundYear(bound);
|
|
170
|
+
return y === null || year >= y;
|
|
171
|
+
};
|
|
172
|
+
/** Whether a `(year, month)` pair sits at-or-before the given upper bound. */
|
|
173
|
+
const monthAtOrBefore = (year, month, bound) => {
|
|
174
|
+
const ym = boundYearMonth(bound);
|
|
175
|
+
if (ym)
|
|
176
|
+
return year < ym.year || (year === ym.year && month <= ym.month);
|
|
177
|
+
const y = boundYear(bound);
|
|
178
|
+
return y === null || year <= y;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Whether a given `(year, month)` pair is within the (inclusive) `min`/`max`
|
|
182
|
+
* range. A month cell is considered in-range when any day inside that month
|
|
183
|
+
* would still satisfy the bounds — we compare on the year-month prefix and
|
|
184
|
+
* ignore the day component of `min` / `max`.
|
|
185
|
+
*/
|
|
186
|
+
const isMonthWithinBounds = (year, month, min, max) => monthAtOrAfter(year, month, min) && monthAtOrBefore(year, month, max);
|
|
187
|
+
/**
|
|
188
|
+
* Pad a bound string up to full `YYYY-MM-DD` length so it can be lexically
|
|
189
|
+
* compared with a full ISO date. `min` widens down (missing pieces become
|
|
190
|
+
* `-01`), `max` widens up (missing month → `-12`, missing day → last day of
|
|
191
|
+
* that month, honoring leap years).
|
|
192
|
+
*/
|
|
193
|
+
const padBound = (iso, kind) => {
|
|
194
|
+
if (!iso)
|
|
195
|
+
return null;
|
|
196
|
+
const yearMatch = /^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/.exec(iso);
|
|
197
|
+
if (!yearMatch)
|
|
198
|
+
return null;
|
|
199
|
+
const year = yearMatch[1];
|
|
200
|
+
const month = yearMatch[2] ?? (kind === 'min' ? '01' : '12');
|
|
201
|
+
const day = yearMatch[3] ??
|
|
202
|
+
(kind === 'min' ? '01' : String(new Date(Number(year), Number(month), 0).getDate()).padStart(2, '0'));
|
|
203
|
+
return `${year}-${month}-${day}`;
|
|
34
204
|
};
|
|
35
205
|
|
|
36
206
|
/* -------------------------------------------------------------------------- */
|
|
37
|
-
/*
|
|
207
|
+
/* Date parsing */
|
|
38
208
|
/* -------------------------------------------------------------------------- */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*/
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Parse an ISO 8601 date string (`YYYY-MM-DD`) into a local-time `Date`.
|
|
211
|
+
* Returns `null` when the string is missing or invalid.
|
|
212
|
+
*/
|
|
213
|
+
const parseISO = (iso) => {
|
|
214
|
+
if (!iso || !/^\d{4}-\d{2}-\d{2}$/.test(iso))
|
|
215
|
+
return null;
|
|
216
|
+
const [y, m, d] = iso.split('-').map(Number);
|
|
217
|
+
const date = new Date(y, m - 1, d);
|
|
218
|
+
if (date.getFullYear() !== y || date.getMonth() !== m - 1 || date.getDate() !== d)
|
|
219
|
+
return null;
|
|
220
|
+
return date;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Convert a `Date` to `YYYY-MM-DD` in local time.
|
|
224
|
+
*/
|
|
225
|
+
const toISO = (date) => date.toLocaleDateString(ISO_DATE_LOCALE);
|
|
226
|
+
/**
|
|
227
|
+
* Whether the ISO string is a valid `YYYY-MM-DD` date (round-trips through
|
|
228
|
+
* `parseISO`). Convenience predicate for input filtering.
|
|
229
|
+
*/
|
|
230
|
+
const isValidISO = (iso) => parseISO(iso) !== null;
|
|
231
|
+
const startOfMonth = (date) => new Date(date.getFullYear(), date.getMonth(), 1);
|
|
232
|
+
const endOfMonth = (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
233
|
+
const addDays = (date, amount) => {
|
|
234
|
+
const next = new Date(date);
|
|
235
|
+
next.setDate(next.getDate() + amount);
|
|
236
|
+
return next;
|
|
237
|
+
};
|
|
238
|
+
const addMonths = (date, amount) => {
|
|
239
|
+
const next = new Date(date.getFullYear(), date.getMonth() + amount, 1);
|
|
240
|
+
// Preserve the day when possible.
|
|
241
|
+
const day = Math.min(date.getDate(), endOfMonth(next).getDate());
|
|
242
|
+
next.setDate(day);
|
|
243
|
+
return next;
|
|
244
|
+
};
|
|
245
|
+
const addYears = (date, amount) => {
|
|
246
|
+
const next = new Date(date);
|
|
247
|
+
next.setFullYear(next.getFullYear() + amount);
|
|
248
|
+
return next;
|
|
249
|
+
};
|
|
250
|
+
/* -------------------------------------------------------------------------- */
|
|
251
|
+
/* Comparators */
|
|
252
|
+
/* -------------------------------------------------------------------------- */
|
|
253
|
+
const isSameDay = (a, b) => !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
254
|
+
/** ISO-string based comparison; safe for `YYYY-MM-DD`. */
|
|
255
|
+
const compareISO = (a, b) => {
|
|
256
|
+
if (a === b)
|
|
257
|
+
return 0;
|
|
258
|
+
return a < b ? -1 : 1;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Build a 6x7 matrix for the given month starting on `firstDayOfWeek`.
|
|
262
|
+
* The matrix always has 42 cells so the calendar keeps a stable height.
|
|
263
|
+
*
|
|
264
|
+
* @param anchor Any date within the target month.
|
|
265
|
+
* @param firstDayOfWeek 0 = Sunday, 1 = Monday, ...
|
|
266
|
+
*/
|
|
267
|
+
const buildMonthMatrix = (anchor, firstDayOfWeek) => {
|
|
268
|
+
const start = startOfMonth(anchor);
|
|
269
|
+
const offset = (start.getDay() - firstDayOfWeek + 7) % 7;
|
|
270
|
+
const gridStart = addDays(start, -offset);
|
|
271
|
+
const cells = [];
|
|
272
|
+
for (let i = 0; i < 42; i++) {
|
|
273
|
+
const date = addDays(gridStart, i);
|
|
274
|
+
cells.push({
|
|
275
|
+
date,
|
|
276
|
+
iso: toISO(date),
|
|
277
|
+
outside: date.getMonth() !== anchor.getMonth(),
|
|
69
278
|
});
|
|
70
|
-
|
|
71
|
-
|
|
279
|
+
}
|
|
280
|
+
const rows = [];
|
|
281
|
+
for (let r = 0; r < 6; r++)
|
|
282
|
+
rows.push(cells.slice(r * 7, r * 7 + 7));
|
|
283
|
+
return rows;
|
|
72
284
|
};
|
|
285
|
+
/* -------------------------------------------------------------------------- */
|
|
286
|
+
/* Decade grid */
|
|
287
|
+
/* -------------------------------------------------------------------------- */
|
|
73
288
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
289
|
+
* Given any year, return the anchor year of the decade grid.
|
|
290
|
+
*
|
|
291
|
+
* The reference image shows a grid like `2016 – 2027` containing the current
|
|
292
|
+
* year (`2026`). We anchor the grid so the "round" decade start (e.g. 2020,
|
|
293
|
+
* 2010, ...) appears at index 1 - i.e. one extra year before the decade and
|
|
294
|
+
* one extra year after, filling the 3x4 grid cleanly.
|
|
76
295
|
*/
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
296
|
+
const getDecadeStart = (year) => Math.floor(year / 10) * 10 - 1;
|
|
297
|
+
/**
|
|
298
|
+
* Clamp a `Date` between an optional min and max. Bounds may be at any
|
|
299
|
+
* ISO precision (`YYYY`, `YYYY-MM`, `YYYY-MM-DD`) and are padded to the
|
|
300
|
+
* widest matching day before comparing (`min` → first day, `max` → last day).
|
|
301
|
+
*/
|
|
302
|
+
const clampDate = (date, minISO, maxISO) => {
|
|
303
|
+
const min = parseISO(padBound(minISO, 'min'));
|
|
304
|
+
const max = parseISO(padBound(maxISO, 'max'));
|
|
305
|
+
if (min && date < min)
|
|
306
|
+
return min;
|
|
307
|
+
if (max && date > max)
|
|
308
|
+
return max;
|
|
309
|
+
return date;
|
|
310
|
+
};
|
|
311
|
+
/** Whether the given `Date` is within `[min, max]` ISO bounds (inclusive). */
|
|
312
|
+
const isWithinBounds = (date, minISO, maxISO) => {
|
|
313
|
+
const iso = toISO(date);
|
|
314
|
+
const minPadded = padBound(minISO, 'min');
|
|
315
|
+
const maxPadded = padBound(maxISO, 'max');
|
|
316
|
+
if (minPadded && iso < minPadded)
|
|
317
|
+
return false;
|
|
318
|
+
if (maxPadded && iso > maxPadded)
|
|
319
|
+
return false;
|
|
320
|
+
return true;
|
|
80
321
|
};
|
|
322
|
+
/** Sort two ISO strings and return `[start, end]`. */
|
|
323
|
+
const sortRange = (a, b) => (a <= b ? [a, b] : [b, a]);
|
|
324
|
+
|
|
81
325
|
/**
|
|
82
|
-
*
|
|
83
|
-
* Uses a singleton promise pattern to prevent race conditions when multiple
|
|
84
|
-
* date picker components attempt to load the library simultaneously.
|
|
326
|
+
* Cached `Intl.DateTimeFormat` factories.
|
|
85
327
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
328
|
+
* The Intl API is powerful but relatively expensive to instantiate. Since the
|
|
329
|
+
* calendar re-renders on every user interaction we keep a small LRU-ish cache
|
|
330
|
+
* keyed by locale + option shape.
|
|
331
|
+
*/
|
|
332
|
+
const cache = new Map();
|
|
333
|
+
/** Prevents unbounded growth in long-running apps. */
|
|
334
|
+
const CACHE_MAX_SIZE = 64;
|
|
335
|
+
const cacheKey = (locale, options) => {
|
|
336
|
+
const localeKey = typeof locale === 'string' ? locale : JSON.stringify(locale ?? '');
|
|
337
|
+
return `${localeKey}|${JSON.stringify(options)}`;
|
|
338
|
+
};
|
|
339
|
+
const getFormatter = (locale, options) => {
|
|
340
|
+
const key = cacheKey(locale, options);
|
|
341
|
+
let formatter = cache.get(key);
|
|
342
|
+
if (!formatter) {
|
|
343
|
+
formatter = new Intl.DateTimeFormat(locale, options);
|
|
344
|
+
cache.set(key, formatter);
|
|
345
|
+
if (cache.size > CACHE_MAX_SIZE) {
|
|
346
|
+
const firstKey = cache.keys().next().value;
|
|
347
|
+
if (firstKey !== undefined)
|
|
348
|
+
cache.delete(firstKey);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return formatter;
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Format a month, e.g. "January 2026" or "Jan".
|
|
355
|
+
*/
|
|
356
|
+
const formatMonth = (date, locale, monthStyle = 'long', includeYear = true) => getFormatter(locale, {
|
|
357
|
+
month: monthStyle,
|
|
358
|
+
...(includeYear ? { year: 'numeric' } : {}),
|
|
359
|
+
}).format(date);
|
|
360
|
+
/**
|
|
361
|
+
* Format a year, e.g. "2026".
|
|
362
|
+
*/
|
|
363
|
+
const formatYear = (date, locale) => getFormatter(locale, { year: 'numeric' }).format(date);
|
|
364
|
+
/**
|
|
365
|
+
* Returns the weekday names for the given locale ordered from `firstDayOfWeek`.
|
|
366
|
+
*
|
|
367
|
+
* @param locale The locale used for formatting.
|
|
368
|
+
* @param firstDayOfWeek The first day of the week (0 = Sunday, 1 = Monday, ...).
|
|
369
|
+
* @param style Weekday style (long, short, narrow).
|
|
370
|
+
* @returns An array of `{short, long}` names in display order.
|
|
371
|
+
*/
|
|
372
|
+
const getWeekdayNames = (locale, firstDayOfWeek, style = 'short') => {
|
|
373
|
+
const shortFormatter = getFormatter(locale, { weekday: style });
|
|
374
|
+
const longFormatter = getFormatter(locale, { weekday: 'long' });
|
|
375
|
+
// Any known Sunday works as the anchor date. 2024-01-07 is a Sunday.
|
|
376
|
+
const anchor = new Date(2024, 0, 7);
|
|
377
|
+
return Array.from({ length: 7 }, (_, i) => {
|
|
378
|
+
const dayIndex = (firstDayOfWeek + i) % 7;
|
|
379
|
+
const day = new Date(anchor);
|
|
380
|
+
day.setDate(anchor.getDate() + dayIndex);
|
|
381
|
+
return { short: shortFormatter.format(day), long: longFormatter.format(day) };
|
|
119
382
|
});
|
|
120
|
-
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Returns the localized month names.
|
|
386
|
+
*
|
|
387
|
+
* @param locale The locale used for formatting.
|
|
388
|
+
* @param style Month style (long, short, narrow).
|
|
389
|
+
*/
|
|
390
|
+
const getMonthNames = (locale, style = 'short') => {
|
|
391
|
+
const formatter = getFormatter(locale, { month: style });
|
|
392
|
+
return Array.from({ length: 12 }, (_, month) => formatter.format(new Date(2024, month, 1)));
|
|
121
393
|
};
|
|
122
394
|
|
|
123
|
-
const bqDatePickerCss = () => `.border-spacing-0,calendar-month::part(table){--tw-border-spacing-x:0;--tw-border-spacing-y:0}.transform{--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}::backdrop,:root{--bq-blue-100:#e7f0fd;--bq-blue-200:#d0e2fb;--bq-blue-300:#a1c5f7;--bq-blue-400:#73a8f3;--bq-blue-500:#448bef;--bq-blue-600:#156eeb;--bq-blue-700:#1158bc;--bq-blue-800:#0d428d;--bq-blue-900:#082c5e;--bq-blue-1000:#04162f;--bq-corai-100:#fff2f2;--bq-corai-200:#ffe6e6;--bq-corai-300:#ffccce;--bq-corai-400:#ffb3b5;--bq-corai-500:#ff999d;--bq-corai-600:#ff8084;--bq-corai-700:#cc666a;--bq-corai-800:#994d4f;--bq-corai-900:#663335;--bq-corai-1000:#331a1a;--bq-cyan-100:#e8f7fb;--bq-cyan-200:#d2f0f8;--bq-cyan-300:#a5e1f1;--bq-cyan-400:#78d1e9;--bq-cyan-500:#4bc2e2;--bq-cyan-600:#1eb3db;--bq-cyan-700:#188faf;--bq-cyan-800:#126b83;--bq-cyan-900:#0c4858;--bq-cyan-1000:#06242c;--bq-gold-100:#fbf4ec;--bq-gold-200:#f7e9da;--bq-gold-300:#f0d3b6;--bq-gold-400:#e8bc91;--bq-gold-500:#e1a66d;--bq-gold-600:#d99048;--bq-gold-700:#ae733a;--bq-gold-800:#82562b;--bq-gold-900:#573a1d;--bq-gold-1000:#2b1d0e;--bq-green-100:#e8f8ef;--bq-green-200:#d2f1e0;--bq-green-300:#a5e3c1;--bq-green-400:#78d5a1;--bq-green-500:#4bc782;--bq-green-600:#1eb963;--bq-green-700:#18944f;--bq-green-800:#126f3b;--bq-green-900:#0c4a28;--bq-green-1000:#062514;--bq-grey-100:#f1f2f4;--bq-grey-200:#e7e8eb;--bq-grey-300:#caccd2;--bq-grey-400:#a6aab3;--bq-grey-50:#f6f6f8;--bq-grey-500:#898e99;--bq-grey-600:#646a77;--bq-grey-700:#3f4350;--bq-grey-800:#2a2c35;--bq-grey-900:#1c1d23;--bq-grey-950:#15161a;--bq-grey-1000:#0d0e11;--bq-indigo-100:#edecfc;--bq-indigo-200:#dcdafa;--bq-indigo-300:#b9b5f5;--bq-indigo-400:#9590ef;--bq-indigo-500:#726bea;--bq-indigo-600:#4f46e5;--bq-indigo-700:#3f38b7;--bq-indigo-800:#2f2a89;--bq-indigo-900:#201c5c;--bq-indigo-1000:#100e2e;--bq-iris-100:#e9f0ff;--bq-iris-200:#d6e0ff;--bq-iris-300:#b2c0fe;--bq-iris-400:#8691f8;--bq-iris-500:#6061ee;--bq-iris-600:#4f46e5;--bq-iris-700:#413abd;--bq-iris-800:#332e95;--bq-iris-900:#26216d;--bq-iris-1000:#181545;--bq-lime-100:#f5fae8;--bq-lime-200:#ecf6d2;--bq-lime-300:#d9eda5;--bq-lime-400:#c5e379;--bq-lime-500:#b2da4c;--bq-lime-600:#9fd11f;--bq-lime-700:#7fa719;--bq-lime-800:#5f7d13;--bq-lime-900:#40540c;--bq-lime-1000:#202a06;--bq-magenta-100:#fce7f4;--bq-magenta-200:#f9cfea;--bq-magenta-300:#f39fd6;--bq-magenta-400:#ee6fbf;--bq-magenta-500:#e83fab;--bq-magenta-600:#de1395;--bq-magenta-700:#b20f77;--bq-magenta-800:#850c59;--bq-magenta-900:#58083c;--bq-magenta-1000:#2c041e;--bq-neutral-white:#fbfbfc;--bq-neutral-black:#060708;--bq-orange-100:#fbf0e9;--bq-orange-200:#f8e1d4;--bq-orange-300:#f1c2a8;--bq-orange-400:#eaa47d;--bq-orange-500:#e38551;--bq-orange-600:#dc6726;--bq-orange-700:#b0521e;--bq-orange-800:#843e17;--bq-orange-900:#58290f;--bq-orange-1000:#2c1508;--bq-purple-100:#efebf8;--bq-purple-200:#e0d7f2;--bq-purple-300:#c1afe5;--bq-purple-400:#a388d8;--bq-purple-500:#8460cb;--bq-purple-600:#6538be;--bq-purple-700:#512d98;--bq-purple-800:#3d2272;--bq-purple-900:#28164c;--bq-purple-1000:#140b26;--bq-red-100:#fce7ea;--bq-red-200:#f9d1d5;--bq-red-300:#f3a2ac;--bq-red-400:#ed7482;--bq-red-500:#e74559;--bq-red-600:#e1172f;--bq-red-700:#b41226;--bq-red-800:#870e1c;--bq-red-900:#5a0913;--bq-red-1000:#2d0509;--bq-sky-100:#eff4fb;--bq-sky-200:#dfeaf8;--bq-sky-300:#bfd5f1;--bq-sky-400:#9ec1e9;--bq-sky-500:#7eace2;--bq-sky-600:#5e97db;--bq-sky-700:#4b79af;--bq-sky-800:#385b83;--bq-sky-900:#263c58;--bq-sky-1000:#131e2c;--bq-teal-100:#e5f7f5;--bq-teal-200:#ccf0eb;--bq-teal-300:#99e1d8;--bq-teal-400:#66d2c4;--bq-teal-500:#33c3b1;--bq-teal-600:#00b49d;--bq-teal-700:#00907e;--bq-teal-800:#006c5e;--bq-teal-900:#00483f;--bq-teal-1000:#00241f;--bq-volcano-100:#feede7;--bq-volcano-200:#fddbd1;--bq-volcano-300:#fbb8a3;--bq-volcano-400:#fa9474;--bq-volcano-500:#f87146;--bq-volcano-600:#f64d18;--bq-volcano-700:#c53e13;--bq-volcano-800:#942e0e;--bq-volcano-900:#621f0a;--bq-volcano-1000:#310f05;--bq-yellow-100:#fefbe7;--bq-yellow-200:#fcf6d0;--bq-yellow-300:#faeea0;--bq-yellow-400:#f7e571;--bq-yellow-500:#f5dd41;--bq-yellow-600:#f2d412;--bq-yellow-700:#c2aa0e;--bq-yellow-800:#917f0b;--bq-yellow-900:#615507;--bq-yellow-1000:#302a04;--bq-endava-grey-50:#f7f7f8;--bq-endava-grey-100:#e4e6e7;--bq-endava-grey-200:#b5babe;--bq-endava-grey-300:#949ca1;--bq-endava-grey-400:#737d84;--bq-endava-grey-500:#525f67;--bq-endava-grey-600:#30404b;--bq-endava-grey-700:#2b3942;--bq-endava-grey-800:#263139;--bq-endava-grey-900:#192b37;--bq-endava-grey-950:#151b1e;--bq-endava-grey-1000:#0f1316;--bq-endava-neutral-white:#fafbfb;--bq-endava-neutral-black:#060708;--bq-endava-orange-100:#fef3f1;--bq-endava-orange-200:#fbd6d1;--bq-endava-orange-300:#fab7af;--bq-endava-orange-400:#fa988b;--bq-endava-orange-500:#fc7866;--bq-endava-orange-600:#ff5640;--bq-endava-orange-700:#ce4a39;--bq-endava-orange-800:#a03d30;--bq-endava-orange-900:#722e25;--bq-endava-orange-1000:#471e19}*,:after,:before{box-sizing:border-box}*{font:inherit;margin:0}ol[role=list],ul[role=list]{list-style-type:none}html{text-size-adjust:none;font-family:var(--bq-font-family);font-size:var(--bq-font-size--m)}html:focus-within{scroll-behavior:smooth}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:var(--bq-background--primary);color:var(--bq-text--primary);line-height:var(--bq-font-line-height--regular);min-height:100vb;text-rendering:optimizeSpeed}a:not([class]){text-decoration-skip-ink:auto}canvas,img,picture,svg,video{display:block;max-width:100%}button,input,select,textarea{font:inherit}h1,h2,h3,h4,h5,h6,p{overflow-wrap:break-word}@media (prefers-reduced-motion:reduce){html:focus-within{scroll-behavior:auto}*,:after,:before{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto;transition-duration:.01ms!important}}:where(:root){--bq-white:#fff;--bq-black:#060708;--bq-neutral-50:var(--bq-grey-50);--bq-neutral-100:var(--bq-grey-100);--bq-neutral-200:var(--bq-grey-200);--bq-neutral-300:var(--bq-grey-300);--bq-neutral-400:var(--bq-grey-400);--bq-neutral-500:var(--bq-grey-500);--bq-neutral-600:var(--bq-grey-600);--bq-neutral-700:var(--bq-grey-700);--bq-neutral-800:var(--bq-grey-800);--bq-neutral-900:var(--bq-grey-900);--bq-neutral-950:var(--bq-grey-950);--bq-neutral-1000:var(--bq-grey-1000);--bq-brand-light:var(--bq-iris-100);--bq-brand:var(--bq-iris-600);--bq-brand-dark:var(--bq-iris-1000);--bq-accent-light:var(--bq-purple-100);--bq-accent:var(--bq-purple-600);--bq-accent-dark:var(--bq-purple-1000);--bq-success-light:var(--bq-teal-100);--bq-success:var(--bq-teal-600);--bq-success-dark:var(--bq-teal-1000);--bq-danger-light:var(--bq-red-100);--bq-danger:var(--bq-red-600);--bq-danger-dark:var(--bq-red-1000);--bq-warning-light:var(--bq-gold-100);--bq-warning:var(--bq-gold-600);--bq-warning-dark:var(--bq-gold-1000);--bq-info-light:var(--bq-iris-100);--bq-info:var(--bq-iris-600);--bq-info-dark:var(--bq-iris-1000);--bq-focus:var(--bq-iris-600);--bq-data-01:var(--bq-brand);--bq-data-02:var(--bq-purple-600);--bq-data-03:var(--bq-magenta-600);--bq-data-04:var(--bq-cyan-600);--bq-data-05:var(--bq-teal-600);--bq-data-06:var(--bq-orange-600);--bq-data-07:var(--bq-yellow-600);--bq-data-08:var(--bq-red-600);--bq-data-09:var(--bq-blue-600);--bq-data-10:var(--bq-grey-600);--bq-data-11:var(--bq-black);--bq-data-12:var(--bq-white);--bq-radius--none:0;--bq-radius--xs2:0.125rem;--bq-radius--xs:0.25rem;--bq-radius--s:0.5rem;--bq-radius--m:0.75rem;--bq-radius--l:1.5rem;--bq-radius--full:9999px;--bq-box-shadow--xs:0 2px 0 rgba(0,0,0,.016);--bq-box-shadow--s:0 8px 24px rgba(0,0,0,.04);--bq-box-shadow--m:0 10px 48px -16px rgba(0,0,0,.12);--bq-box-shadow--l:0 20px 58px -16px rgba(0,0,0,.16);--bq-font-family:"Outfit",sans-serif;--bq-font-size--xs:0.75rem;--bq-font-size--s:0.875rem;--bq-font-size--m:1rem;--bq-font-size--l:1.125rem;--bq-font-size--xl:1.5rem;--bq-font-size--xxl:2rem;--bq-font-size--xxl2:2.5rem;--bq-font-size--xxl3:3rem;--bq-font-size--xxl4:3.5rem;--bq-font-size--xxl5:4rem;--bq-font-weight--thin:100;--bq-font-weight--light:300;--bq-font-weight--regular:400;--bq-font-weight--medium:500;--bq-font-weight--semibold:600;--bq-font-weight--bold:700;--bq-font-line-height--small:1.2;--bq-font-line-height--regular:1.5;--bq-font-line-height--large:1.5;--bq-spacing-xs3:0.125rem;--bq-spacing-xs2:0.25rem;--bq-spacing-xs:0.5rem;--bq-spacing-s:0.75rem;--bq-spacing-m:1rem;--bq-spacing-l:1.5rem;--bq-spacing-xl:2rem;--bq-spacing-xxl:2.5rem;--bq-spacing-xxl2:3.5rem;--bq-spacing-xxl3:4rem;--bq-spacing-xxl4:4.5rem;--bq-stroke-s:1px;--bq-stroke-m:2px;--bq-stroke-l:3px}.beeq:not([bq-mode]),.light,:root:not([bq-theme]):not([bq-mode]),:root[bq-theme=beeq]:not([bq-mode]),[bq-mode=light]{--bq-background--primary:var(--bq-white);--bq-background--secondary:var(--bq-neutral-100);--bq-background--tertiary:var(--bq-neutral-200);--bq-background--alt:var(--bq-neutral-300);--bq-background--inverse:var(--bq-neutral-900);--bq-background--brand:var(--bq-brand);--bq-background--overlay:var(--bq-neutral-900);--bq-icon--primary:var(--bq-neutral-800);--bq-icon--alt:var(--bq-white);--bq-icon--secondary:var(--bq-neutral-600);--bq-icon--inverse:var(--bq-neutral-50);--bq-icon--brand:var(--bq-brand);--bq-icon--info:var(--bq-brand);--bq-icon--success:var(--bq-success);--bq-icon--warning:var(--bq-warning);--bq-icon--danger:var(--bq-danger);--bq-stroke--primary:var(--bq-neutral-200);--bq-stroke--secondary:var(--bq-neutral-600);--bq-stroke--tertiary:var(--bq-neutral-900);--bq-stroke--inverse:var(--bq-white);--bq-stroke--brand:var(--bq-brand);--bq-stroke--alt:var(--bq-neutral-50);--bq-stroke--success:var(--bq-success);--bq-stroke--warning:var(--bq-warning);--bq-stroke--danger:var(--bq-danger);--bq-stroke--info:var(--bq-brand);--bq-text--primary:var(--bq-neutral-800);--bq-text--secondary:var(--bq-neutral-600);--bq-text--inverse:var(--bq-neutral-50);--bq-text--brand:var(--bq-brand);--bq-text--alt:var(--bq-white);--bq-text--info:var(--bq-brand);--bq-text--success:var(--bq-success);--bq-text--warning:var(--bq-warning);--bq-text--danger:var(--bq-danger);--bq-ui--primary:var(--bq-white);--bq-ui--secondary:var(--bq-neutral-100);--bq-ui--tertiary:var(--bq-neutral-500);--bq-ui--inverse:var(--bq-neutral-900);--bq-ui--brand:var(--bq-brand);--bq-ui--brand-alt:var(--bq-brand-light);--bq-ui--alt:var(--bq-neutral-50);--bq-ui--success:var(--bq-success);--bq-ui--success-alt:var(--bq-success-light);--bq-ui--warning:var(--bq-warning);--bq-ui--warning-alt:var(--bq-warning-light);--bq-ui--danger:var(--bq-danger);--bq-ui--danger-alt:var(--bq-danger-light);--bq-ui--info:var(--bq-brand);--bq-ui--info-alt:var(--bq-brand-light);--bq-hover:#bcbfc5;--bq-active:#444546}.dark,[bq-mode=dark]{--bq-background--primary:var(--bq-neutral-1000);--bq-background--secondary:var(--bq-neutral-950);--bq-background--tertiary:var(--bq-neutral-800);--bq-background--alt:var(--bq-neutral-700);--bq-background--inverse:var(--bq-neutral-600);--bq-background--brand:var(--bq-brand);--bq-background--overlay:var(--bq-neutral-900);--bq-icon--primary:var(--bq-neutral-100);--bq-icon--secondary:var(--bq-neutral-400);--bq-icon--inverse:var(--bq-neutral-800);--bq-icon--brand:var(--bq-brand);--bq-icon--alt:var(--bq-white);--bq-icon--info:var(--bq-brand);--bq-icon--success:var(--bq-success);--bq-icon--warning:var(--bq-warning);--bq-icon--danger:var(--bq-danger);--bq-stroke--primary:var(--bq-neutral-900);--bq-stroke--secondary:var(--bq-neutral-700);--bq-stroke--tertiary:var(--bq-neutral-400);--bq-stroke--inverse:var(--bq-neutral-950);--bq-stroke--brand:var(--bq-brand);--bq-stroke--alt:var(--bq-neutral-1000);--bq-stroke--success:var(--bq-success);--bq-stroke--warning:var(--bq-warning);--bq-stroke--danger:var(--bq-danger);--bq-stroke--info:var(--bq-brand);--bq-text--primary:var(--bq-neutral-100);--bq-text--secondary:var(--bq-neutral-400);--bq-text--inverse:var(--bq-neutral-800);--bq-text--brand:var(--bq-brand);--bq-text--alt:var(--bq-white);--bq-text--info:var(--bq-brand);--bq-text--success:var(--bq-success);--bq-text--warning:var(--bq-warning);--bq-text--danger:var(--bq-danger);--bq-ui--primary:var(--bq-neutral-900);--bq-ui--secondary:var(--bq-neutral-950);--bq-ui--tertiary:var(--bq-neutral-700);--bq-ui--inverse:var(--bq-neutral-100);--bq-ui--brand:var(--bq-brand);--bq-ui--brand-alt:var(--bq-brand-dark);--bq-ui--alt:var(--bq-neutral-950);--bq-ui--success:var(--bq-success);--bq-ui--success-alt:var(--bq-success-dark);--bq-ui--warning:var(--bq-warning);--bq-ui--warning-alt:var(--bq-warning-dark);--bq-ui--danger:var(--bq-danger);--bq-ui--danger-alt:var(--bq-danger-dark);--bq-ui--info:var(--bq-brand);--bq-ui--info-alt:var(--bq-brand-dark);--bq-hover:#444546;--bq-active:#1f2026}:where(.endava),:where([bq-theme=endava]){--bq-font-family:"Poppins",sans-serif;--bq-white:#fafbfb;--bq-black:#030406;--bq-neutral-50:var(--bq-endava-grey-50);--bq-neutral-100:var(--bq-endava-grey-100);--bq-neutral-200:var(--bq-endava-grey-200);--bq-neutral-300:var(--bq-endava-grey-300);--bq-neutral-400:var(--bq-endava-grey-400);--bq-neutral-500:var(--bq-endava-grey-500);--bq-neutral-600:var(--bq-endava-grey-600);--bq-neutral-700:var(--bq-endava-grey-700);--bq-neutral-800:var(--bq-endava-grey-800);--bq-neutral-900:var(--bq-endava-grey-900);--bq-neutral-950:var(--bq-endava-grey-950);--bq-neutral-1000:var(--bq-endava-grey-1000);--bq-brand-light:var(--bq-endava-orange-100);--bq-brand:var(--bq-endava-orange-600);--bq-brand-dark:var(--bq-endava-orange-1000);--bq-accent-light:var(--bq-endava-orange-100);--bq-accent:var(--bq-endava-orange-600);--bq-accent-dark:var(--bq-endava-orange-1000);--bq-success-light:var(--bq-green-100);--bq-success:var(--bq-green-600);--bq-success-dark:var(--bq-green-1000);--bq-danger-light:var(--bq-corai-100);--bq-danger:var(--bq-corai-600);--bq-danger-dark:var(--bq-corai-1000);--bq-warning-light:var(--bq-yellow-100);--bq-warning:var(--bq-yellow-600);--bq-warning-dark:var(--bq-yellow-1000);--bq-info-light:var(--bq-blue-100);--bq-info:var(--bq-blue-600);--bq-info-dark:var(--bq-blue-1000);--bq-focus:var(--bq-endava-orange-600);--bq-data-01:var(--bq-brand);--bq-data-02:#af0cd8;--bq-data-03:#0ca8d8;--bq-data-04:var(--bq-teal-600);--bq-data-05:var(--bq-yellow-600);--bq-data-06:var(--bq-orange-600);--bq-data-07:var(--bq-blue-600);--bq-data-08:var(--bq-red-600);--bq-data-09:var(--bq-purple-600);--bq-data-10:#394b56;--bq-data-11:var(--bq-black);--bq-data-12:var(--bq-white)}.endava.light,.endava:not([bq-mode]),[bq-theme=endava]:not([bq-mode]),[bq-theme=endava][bq-mode=light]{--bq-background--primary:var(--bq-white);--bq-background--secondary:var(--bq-neutral-100);--bq-background--tertiary:var(--bq-neutral-200);--bq-background--alt:var(--bq-neutral-300);--bq-background--inverse:var(--bq-neutral-900);--bq-background--brand:var(--bq-brand);--bq-background--overlay:var(--bq-neutral-900);--bq-icon--primary:var(--bq-neutral-800);--bq-icon--secondary:var(--bq-neutral-600);--bq-icon--inverse:var(--bq-neutral-50);--bq-icon--brand:var(--bq-brand);--bq-icon--alt:var(--bq-white);--bq-icon--info:var(--bq-info);--bq-icon--success:var(--bq-success);--bq-icon--warning:var(--bq-warning);--bq-icon--danger:var(--bq-danger);--bq-stroke--primary:var(--bq-neutral-200);--bq-stroke--secondary:var(--bq-neutral-600);--bq-stroke--tertiary:var(--bq-neutral-900);--bq-stroke--inverse:var(--bq-white);--bq-stroke--brand:var(--bq-brand);--bq-stroke--alt:var(--bq-neutral-50);--bq-stroke--brand-alt:var(--bq-brand-light);--bq-stroke--success:var(--bq-success);--bq-stroke--warning:var(--bq-warning);--bq-stroke--danger:var(--bq-danger);--bq-stroke--info:var(--bq-info);--bq-text--primary:var(--bq-neutral-800);--bq-text--secondary:var(--bq-neutral-600);--bq-text--inverse:var(--bq-neutral-50);--bq-text--brand:var(--bq-brand);--bq-text--alt:var(--bq-white);--bq-text--info:var(--bq-info);--bq-text--success:var(--bq-success);--bq-text--warning:var(--bq-warning);--bq-text--danger:var(--bq-danger);--bq-ui--primary:var(--bq-white);--bq-ui--secondary:var(--bq-neutral-100);--bq-ui--tertiary:var(--bq-neutral-500);--bq-ui--inverse:var(--bq-neutral-900);--bq-ui--alt:var(--bq-neutral-50);--bq-ui--brand-alt:var(--bq-brand-light);--bq-ui--brand:var(--bq-brand);--bq-ui--success:var(--bq-success);--bq-ui--success-alt:var(--bq-success-light);--bq-ui--warning:var(--bq-warning);--bq-ui--warning-alt:var(--bq-warning-light);--bq-ui--danger:var(--bq-danger);--bq-ui--danger-alt:var(--bq-danger-light);--bq-ui--info:var(--bq-info);--bq-ui--info-alt:var(--bq-info-light);--bq-hover:#444546;--bq-active:#1f2026}.endava.dark,[bq-theme=endava][bq-mode=dark]{--bq-background--primary:var(--bq-neutral-1000);--bq-background--secondary:var(--bq-neutral-900);--bq-background--tertiary:var(--bq-neutral-800);--bq-background--alt:var(--bq-neutral-700);--bq-background--inverse:var(--bq-neutral-600);--bq-background--brand:var(--bq-brand);--bq-background--overlay:var(--bq-neutral-900);--bq-icon--primary:var(--bq-neutral-100);--bq-icon--secondary:var(--bq-neutral-400);--bq-icon--inverse:var(--bq-neutral-800);--bq-icon--brand:var(--bq-brand);--bq-icon--alt:var(--bq-white);--bq-icon--info:var(--bq-info);--bq-icon--success:var(--bq-success);--bq-icon--warning:var(--bq-warning);--bq-icon--danger:var(--bq-danger);--bq-stroke--primary:var(--bq-neutral-900);--bq-stroke--secondary:var(--bq-neutral-700);--bq-stroke--tertiary:var(--bq-neutral-400);--bq-stroke--inverse:var(--bq-neutral-950);--bq-stroke--brand:var(--bq-brand);--bq-stroke--brand-alt:var(--bq-brand-dark);--bq-stroke--alt:var(--bq-neutral-1000);--bq-stroke--success:var(--bq-success);--bq-stroke--warning:var(--bq-warning);--bq-stroke--danger:var(--bq-danger);--bq-stroke--info:var(--bq-info);--bq-text--primary:var(--bq-neutral-100);--bq-text--secondary:var(--bq-neutral-400);--bq-text--inverse:var(--bq-neutral-800);--bq-text--brand:var(--bq-brand);--bq-text--alt:var(--bq-neutral-white);--bq-text--info:var(--bq-info);--bq-text--success:var(--bq-success);--bq-text--warning:var(--bq-warning);--bq-text--danger:var(--bq-danger);--bq-ui--primary:var(--bq-neutral-900);--bq-ui--secondary:var(--bq-neutral-950);--bq-ui--tertiary:var(--bq-neutral-700);--bq-ui--inverse:var(--bq-neutral-100);--bq-ui--brand:var(--bq-brand);--bq-ui--brand-alt:var(--bq-brand-dark);--bq-ui--alt:var(--bq-neutral-950);--bq-ui--success:var(--bq-success);--bq-ui--success-alt:var(--bq-success-dark);--bq-ui--warning:var(--bq-warning);--bq-ui--warning-alt:var(--bq-warning-dark);--bq-ui--danger:var(--bq-danger);--bq-ui--danger-alt:var(--bq-danger-dark);--bq-ui--info:var(--bq-info);--bq-ui--info-alt:var(--bq-info-dark);--bq-hover:#444546;--bq-active:#1f2026}.pointer-events-none{pointer-events:none}.me-\\[--bq-date-picker--gap\\]{margin-inline-end:var(--bq-date-picker--gap)}.ms-\\[--bq-date-picker--gap\\]{margin-inline-start:var(--bq-date-picker--gap)}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.size-\\[--bq-date-picker--day-size\\]{height:var(--bq-date-picker--day-size);width:var(--bq-date-picker--day-size)}.flex-auto{flex:1 1 auto}.flex-grow{flex-grow:1}.border-spacing-0{--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.cursor-inherit{cursor:inherit}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{user-select:none}.appearance-none{appearance:none}.items-center{align-items:center}.justify-center{justify-content:center}.gap-\\[--bq-date-picker--gap\\]{gap:var(--bq-date-picker--gap)}.gap-s{gap:var(--bq-spacing-s)}.rounded-\\[--bq-date-picker--border-radius\\]{border-radius:var(--bq-date-picker--border-radius)}.rounded-none{border-radius:var(--bq-radius--none)}.rounded-s{border-radius:var(--bq-radius--s)}.rounded-ee-none{border-end-end-radius:var(--bq-radius--none)}.rounded-es-none{border-end-start-radius:var(--bq-radius--none)}.rounded-se-none{border-start-end-radius:var(--bq-radius--none)}.rounded-ss-none{border-start-start-radius:var(--bq-radius--none)}.border-0{border-width:0}.border-\\[length\\:--bq-date-picker--border-width\\]{border-width:var(--bq-date-picker--border-width)}.border-\\[length\\:--bq-date-picker--currentDate-border-width\\]{border-width:var(--bq-date-picker--currentDate-border-width)}.border-none{border-style:none}.border-\\[color\\:--bq-date-picker--border-color\\]{border-color:var(--bq-date-picker--border-color)}.border-\\[color\\:--bq-date-picker--currentDate-border-color\\]{border-color:var(--bq-date-picker--currentDate-border-color)}.border-\\[color\\:--bq-focus\\]{border-color:var(--bq-focus)}.border-danger{border-color:var(--bq-stroke--danger)}.border-success{border-color:var(--bq-stroke--success)}.border-warning{border-color:var(--bq-stroke--warning)}.bg-\\[--bq-date-picker--background-color\\]{background-color:var(--bq-date-picker--background-color)}.bg-\\[--bq-date-picker--range-background-color\\]{background-color:var(--bq-date-picker--range-background-color)}.bg-\\[--bq-date-picker--range-inner-background-color\\]{background-color:var(--bq-date-picker--range-inner-background-color)}.bg-inherit{background-color:inherit}.bg-transparent{background-color:transparent}.pe-\\[--bq-date-picker--padding-end\\]{padding-inline-end:var(--bq-date-picker--padding-end)}.ps-\\[--bq-date-picker--padding-start\\]{padding-inline-start:var(--bq-date-picker--padding-start)}.font-default{font-family:var(--bq-font-family)}.font-inherit{font-family:inherit}.text-\\[length\\:--bq-date-picker--label-text-size\\]{font-size:var(--bq-date-picker--label-text-size)}.text-\\[length\\:--bq-date-picker--text-size\\]{font-size:var(--bq-date-picker--text-size)}.text-\\[length\\:_inherit\\],.text-\\[length\\:inherit\\]{font-size:inherit}.text-\\[color\\:--bq-date-picker--label-text-color\\]{color:var(--bq-date-picker--label-text-color)}.text-\\[color\\:--bq-date-picker--text-color\\]{color:var(--bq-date-picker--text-color)}.text-alt{color:var(--bq-text--alt)}.text-primary{color:var(--bq-text--primary)}.text-secondary{color:var(--bq-text--secondary)}.opacity-100{opacity:1}.opacity-60{opacity:.6}.transition-\\[border-color\\2c box-shadow\\]{transition-duration:.15s;transition-property:border-color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.border-active-danger{border-color:color-mix(in srgb,var(--bq-stroke--danger),var(--bq-active) 20%)}.border-active-success{border-color:color-mix(in srgb,var(--bq-stroke--success),var(--bq-active) 20%)}.border-active-warning{border-color:color-mix(in srgb,var(--bq-stroke--warning),var(--bq-active) 20%)}.is-full{inline-size:100%}.min-is-0{min-inline-size:0}.p-b-0{padding-block:0}.p-b-\\[--bq-date-picker--paddingY\\]{padding-block:var(--bq-date-picker--paddingY)}.p-b-xs2{padding-block:var(--bq-spacing-xs2)}.p-i-0{padding-inline:0}.p-i-xs{padding-inline:var(--bq-spacing-xs)}.m-b-0{margin-block:0}.m-be-\\[--bq-date-picker--label-margin-bottom\\]{margin-block-end:var(--bq-date-picker--label-margin-bottom)}.m-i-0{margin-inline:0}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.focus{outline:var(--bq-ring-width,2px) solid var(--bq-ring-color-focus,var(--bq-focus));outline-offset:var(--bq-ring-offset-width,1px)}@-webkit-keyframes fade-in{0%{opacity:0}}@keyframes fade-in{0%{opacity:0}}@-webkit-keyframes slide-in{0%{-webkit-transform:translateY(10px);transform:translateY(10px)}}@keyframes slide-in{0%{-webkit-transform:translateY(10px);transform:translateY(10px)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}:host{--bq-date-picker--background-color:var(--bq-ui--primary);--bq-date-picker--border-color:var(--bq-stroke--tertiary);--bq-date-picker--border-radius:var(--bq-radius--s);--bq-date-picker--border-style:solid;--bq-date-picker--border-width:var(--bq-stroke-s);--bq-date-picker--currentDate-border-color:var(--bq-stroke--brand);--bq-date-picker--currentDate-border-width:var(--bq-stroke-m);--bq-date-picker--day-size:2.25rem;--bq-date-picker--gap:var(--bq-spacing-xs);--bq-date-picker--icon-size:24px;--bq-date-picker--label-margin-bottom:var(--bq-spacing-xs);--bq-date-picker--label-text-color:var(--bq-text--primary);--bq-date-picker--label-text-size:var(--bq-font-size--s);--bq-date-picker--padding-end:var(--bq-spacing-m);--bq-date-picker--padding-start:var(--bq-spacing-m);--bq-date-picker--paddingY:var(--bq-spacing-s);--bq-date-picker--range-background-color:var(--bq-ui--brand);--bq-date-picker--range-inner-background-color:var(--bq-ui--brand-alt);--bq-date-picker--text-color:var(--bq-text--primary);--bq-date-picker--text-placeholder-color:var(--bq-text--secondary);--bq-date-picker--text-size:var(--bq-font-size--m);display:block;inline-size:100%}.bq-date-picker__label{align-items:center;color:var(--bq-date-picker--label-text-color);display:flex;flex-grow:1;font-size:var(--bq-date-picker--label-text-size);gap:var(--bq-date-picker--gap);margin-block-end:var(--bq-date-picker--label-margin-bottom)}.bq-date-picker__control{align-items:center;border-color:var(--bq-date-picker--border-color);border-radius:var(--bq-date-picker--border-radius);border-style:var(--bq-date-picker--border-style);border-width:var(--bq-date-picker--border-width);color:var(--bq-date-picker--text-color);display:flex;font-size:var(--bq-date-picker--text-size);inline-size:100%;padding-block:var(--bq-date-picker--paddingY);padding-inline-end:var(--bq-date-picker--padding-end);padding-inline-start:var(--bq-date-picker--padding-start);transition-duration:.15s;transition-property:border-color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);user-select:none}.bq-date-picker__control::placeholder{color:var(--bq-date-picker--text-placeholder-color)}.bq-date-picker__control:hover:not(.disabled):not(:focus-within){border-color:color-mix(in srgb,var(--bq-stroke--brand),var(--bq-hover) 20%)}.bq-date-picker__control:not(.disabled):focus-within{--bq-ring-width:1px;--bq-ring-offset-width:0;border-color:var(--bq-focus);outline:var(--bq-ring-width,2px) solid var(--bq-ring-color-focus,var(--bq-focus));outline-offset:var(--bq-ring-offset-width,1px)}.bq-date-picker__control:not(.disabled):focus-within .bq-date-picker__control--clear,.bq-date-picker__control:not(.disabled):hover .bq-date-picker__control--clear{display:inline-block}.bq-date-picker__control.disabled{cursor:not-allowed;opacity:.6}.bq-date-picker__control.validation-error{border-color:var(--bq-stroke--danger)}.bq-date-picker__control.validation-error:hover:not(.disabled):not(:focus-within){border-color:color-mix(in srgb,var(--bq-stroke--danger),var(--bq-hover) 20%)}.bq-date-picker__control.validation-error:not(.disabled):focus-within{--bq-ring-color-focus:var(--bq-stroke--danger);border-color:color-mix(in srgb,var(--bq-stroke--danger),var(--bq-active) 20%)}.bq-date-picker__control.validation-success{border-color:var(--bq-stroke--success)}.bq-date-picker__control.validation-success:hover:not(.disabled):not(:focus-within){border-color:color-mix(in srgb,var(--bq-stroke--success),var(--bq-hover) 20%)}.bq-date-picker__control.validation-success:not(.disabled):focus-within{--bq-ring-color-focus:var(--bq-stroke--success);border-color:color-mix(in srgb,var(--bq-stroke--success),var(--bq-active) 20%)}.bq-date-picker__control.validation-warning{border-color:var(--bq-stroke--warning)}.bq-date-picker__control.validation-warning:hover:not(.disabled):not(:focus-within){border-color:color-mix(in srgb,var(--bq-stroke--warning),var(--bq-hover) 20%)}.bq-date-picker__control.validation-warning:not(.disabled):focus-within{--bq-ring-color-focus:var(--bq-stroke--warning);border-color:color-mix(in srgb,var(--bq-stroke--warning),var(--bq-active) 20%)}.bq-date-picker__control--input{appearance:none;background-color:inherit;border-style:none;color:inherit;cursor:inherit;flex:1 1 auto;font-family:inherit;font-size:inherit;margin-block:0;margin-inline:0;min-inline-size:0;padding-block:0;padding-inline:0;user-select:none}.bq-date-picker__control--input:focus{outline:2px solid transparent;outline-offset:2px}.bq-date-picker__control--input:focus-visible{outline:2px solid transparent;outline-offset:2px}.bq-date-picker__control--clear::part(button){--bq-ring-width:initial;--bq-ring-offset-width:initial;--bq-ring-color-focus:initial}.bq-date-picker__control--prefix,.bq-date-picker__control--suffix{align-items:center;color:var(--bq-date-picker--text-color);display:flex;pointer-events:none}.bq-date-picker__control--prefix{margin-inline-end:var(--bq-date-picker--gap)}.bq-date-picker__control--suffix{margin-inline-start:var(--bq-date-picker--gap)}calendar-date::part(header),calendar-multi::part(header),calendar-range::part(header){gap:var(--bq-spacing-s);justify-content:center}calendar-date::part(heading),calendar-multi::part(heading),calendar-range::part(heading){padding-block:var(--bq-spacing-xs2);padding-inline:var(--bq-spacing-xs)}calendar-date::part(button),calendar-multi::part(button),calendar-range::part(button){background-color:transparent;border-radius:var(--bq-radius--s);border-width:0;padding-block:var(--bq-spacing-xs2);padding-inline:var(--bq-spacing-xs2);transition-duration:.2s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}calendar-date::part(button):focus-visible,calendar-multi::part(button):focus-visible,calendar-range::part(button):focus-visible{outline:var(--bq-ring-width,2px) solid var(--bq-ring-color-focus,var(--bq-focus));outline-offset:var(--bq-ring-offset-width,1px)}calendar-date::part(button):hover,calendar-multi::part(button):hover,calendar-range::part(button):hover{background-color:color-mix(in srgb,var(--bq-ui--primary),var(--bq-hover) 20%)}calendar-date::part(container),calendar-multi::part(container),calendar-range::part(container){background-color:var(--bq-date-picker--background-color);padding-block:0;padding-inline:0}calendar-month{--color-accent:var(--bq-ui--brand)}calendar-month::part(button){align-items:center;background-color:transparent;border-radius:var(--bq-radius--s);color:var(--bq-text--primary);display:flex;font-family:var(--bq-font-family);height:var(--bq-date-picker--day-size);justify-content:center;padding-block:0;padding-inline:0;transition-duration:.2s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:var(--bq-date-picker--day-size)}calendar-month::part(button):focus-visible{outline:var(--bq-ring-width,2px) solid var(--bq-ring-color-focus,var(--bq-focus));outline-offset:var(--bq-ring-offset-width,1px)}calendar-month::part(button):hover:enabled{background-color:color-mix(in srgb,var(--bq-background--secondary),var(--bq-hover) 20%)}calendar-month::part(button):disabled{cursor:not-allowed}calendar-month::part(button day disallowed){background-color:transparent!important;cursor:not-allowed!important}calendar-month::part(button day selected){background-color:var(--bq-date-picker--range-background-color);border-radius:var(--bq-radius--s);color:var(--bq-text--alt)}calendar-month::part(button day selected):hover:enabled{background-color:color-mix(in srgb,var(--bq-ui--brand),var(--bq-hover) 20%)}calendar-month::part(button day selected range-inner){background-color:var(--bq-date-picker--range-inner-background-color);border-radius:var(--bq-radius--none);color:var(--bq-text--primary)}calendar-month::part(button day selected range-inner):hover{color:var(--bq-text--alt)}calendar-month::part(button day outside){color:var(--bq-text--secondary);cursor:pointer;opacity:1}calendar-month::part(today){border-color:var(--bq-date-picker--currentDate-border-color);border-radius:var(--bq-radius--s);border-style:var(--bq-date-picker--border-style);border-width:var(--bq-date-picker--currentDate-border-width)}calendar-month::part(today selected){color:var(--bq-text--alt)}calendar-month::part(today selected range-inner){color:var(--bq-text--primary)}calendar-month::part(today range-inner){border-radius:var(--bq-radius--none)}calendar-month::part(today range-start){border-end-start-radius:var(--bq-radius--none);border-radius:var(--bq-radius--s)}calendar-month::part(today range-end){border-end-end-radius:var(--bq-radius--none);border-radius:var(--bq-radius--s)}calendar-month::part(range-start){border-end-end-radius:var(--bq-radius--none);border-start-end-radius:var(--bq-radius--none)}calendar-month::part(range-end){border-end-start-radius:var(--bq-radius--none);border-start-start-radius:var(--bq-radius--none)}calendar-month::part(range-start range-end){border-radius:var(--bq-radius--s)}calendar-month::part(table){--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);font-size:inherit}.focus-visible\\:focus:focus-visible{outline:var(--bq-ring-width,2px) solid var(--bq-ring-color-focus,var(--bq-focus));outline-offset:var(--bq-ring-offset-width,1px)}.placeholder\\:text-\\[color\\:--bq-date-picker--text-placeholder-color\\]::placeholder{color:var(--bq-date-picker--text-placeholder-color)}.hover\\:text-alt:hover{color:var(--bq-text--alt)}.hover\\:bg-hover-ui-primary:hover{background-color:color-mix(in srgb,var(--bq-ui--primary),var(--bq-hover) 20%)}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.enabled\\:hover\\:bg-hover-secondary:hover:enabled{background-color:color-mix(in srgb,var(--bq-background--secondary),var(--bq-hover) 20%)}.enabled\\:hover\\:bg-hover-ui-brand:hover:enabled{background-color:color-mix(in srgb,var(--bq-ui--brand),var(--bq-hover) 20%)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.grid{display:grid}.\\!hidden{display:none!important}.hidden{display:none}.flex-wrap{flex-wrap:wrap}.gap-\\[--bq-spacing-m\\]{gap:var(--bq-spacing-m)}@media (min-width:640px){.sm\\:block{display:block}}.\\[\\&\\:\\:part\\(button\\)\\]\\:border-none::part(button){border-style:none}.\\[\\&\\:\\:part\\(button\\)\\]\\:p-0::part(button){padding:0}.\\[\\&\\:\\:part\\(panel\\)\\]\\:p-m::part(panel){padding:var(--bq-spacing-m)}.\\[\\&\\:\\:part\\(panel\\)\\]\\:is-auto::part(panel){inline-size:auto}.absolute{position:absolute}.relative{position:relative}.inline{display:inline}.text-\\[--bq-icon--color\\]{color:var(--bq-icon--color)}.bs-\\[--bq-icon--size\\]{block-size:var(--bq-icon--size)}.is-\\[--bq-icon--size\\]{inline-size:var(--bq-icon--size)}`;
|
|
395
|
+
/* -------------------------------------------------------------------------- */
|
|
396
|
+
/* Wire format parse/serialize */
|
|
397
|
+
/* -------------------------------------------------------------------------- */
|
|
398
|
+
/**
|
|
399
|
+
* Regex matching the wire-format ISO shape for each precision.
|
|
400
|
+
* The internal selection is always `YYYY-MM-DD`; these only apply at the
|
|
401
|
+
* public value boundary.
|
|
402
|
+
*/
|
|
403
|
+
const PRECISION_ISO_REGEX = {
|
|
404
|
+
day: /^\d{4}-\d{2}-\d{2}$/,
|
|
405
|
+
month: /^\d{4}-\d{2}$/,
|
|
406
|
+
year: /^\d{4}$/,
|
|
407
|
+
};
|
|
408
|
+
/** Expand a wire-format token to a full `YYYY-MM-DD` ISO date. */
|
|
409
|
+
const expandToken = (token, precision) => {
|
|
410
|
+
if (precision === 'month')
|
|
411
|
+
return `${token}-01`;
|
|
412
|
+
if (precision === 'year')
|
|
413
|
+
return `${token}-01-01`;
|
|
414
|
+
return token;
|
|
415
|
+
};
|
|
416
|
+
/** Truncate a full `YYYY-MM-DD` ISO date to the wire-format for the precision. */
|
|
417
|
+
const truncateISO = (iso, precision) => {
|
|
418
|
+
if (precision === 'month')
|
|
419
|
+
return iso.slice(0, 7);
|
|
420
|
+
if (precision === 'year')
|
|
421
|
+
return iso.slice(0, 4);
|
|
422
|
+
return iso;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Whether the token matches the precision-specific shape *and* is a real date.
|
|
426
|
+
* For month/year we still expand to a full ISO date so `2026-13` / `2026-02-30`
|
|
427
|
+
* style errors are caught by `isValidISO`.
|
|
428
|
+
*/
|
|
429
|
+
const isValidToken = (token, precision) => {
|
|
430
|
+
if (!PRECISION_ISO_REGEX[precision].test(token))
|
|
431
|
+
return false;
|
|
432
|
+
return isValidISO(expandToken(token, precision));
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* Parse a raw `value` string into an internal `TSelection` array.
|
|
436
|
+
*
|
|
437
|
+
* Wire format:
|
|
438
|
+
* - single: `YYYY-MM-DD` (or `YYYY-MM` / `YYYY` at coarser precision)
|
|
439
|
+
* - multi: space-separated tokens
|
|
440
|
+
* - range: `<start>/<end>`
|
|
441
|
+
*
|
|
442
|
+
* Internally the selection is always stored as full `YYYY-MM-DD` — month
|
|
443
|
+
* precision expands to the first day of the month; year precision to Jan 1st.
|
|
444
|
+
*
|
|
445
|
+
* Invalid tokens (malformed strings, impossible dates like `2026-99-99`,
|
|
446
|
+
* non-ISO input) are silently discarded — the returned selection is
|
|
447
|
+
* guaranteed to contain only valid ISO-8601 dates.
|
|
448
|
+
*/
|
|
449
|
+
const parseValue = (value, type, precision = 'day') => {
|
|
450
|
+
if (!value)
|
|
451
|
+
return [];
|
|
452
|
+
const trimmed = value.trim();
|
|
453
|
+
if (!trimmed)
|
|
454
|
+
return [];
|
|
455
|
+
if (type === 'range') {
|
|
456
|
+
const parts = trimmed
|
|
457
|
+
.split('/')
|
|
458
|
+
.filter((token) => isValidToken(token, precision))
|
|
459
|
+
.map((token) => expandToken(token, precision));
|
|
460
|
+
if (parts.length === 0)
|
|
461
|
+
return [];
|
|
462
|
+
if (parts.length === 1)
|
|
463
|
+
return [parts[0]];
|
|
464
|
+
const [start, end] = sortRange(parts[0], parts[1]);
|
|
465
|
+
return [start, end];
|
|
466
|
+
}
|
|
467
|
+
if (type === 'multi') {
|
|
468
|
+
const valid = trimmed
|
|
469
|
+
.split(/\s+/)
|
|
470
|
+
.filter((token) => isValidToken(token, precision))
|
|
471
|
+
.map((token) => expandToken(token, precision));
|
|
472
|
+
return Array.from(new Set(valid)).sort(compareISO);
|
|
473
|
+
}
|
|
474
|
+
return isValidToken(trimmed, precision) ? [expandToken(trimmed, precision)] : [];
|
|
475
|
+
};
|
|
476
|
+
/**
|
|
477
|
+
* Serialize an internal `TSelection` array back to the wire format.
|
|
478
|
+
* Truncates each entry to the precision's ISO shape.
|
|
479
|
+
*/
|
|
480
|
+
const serializeValue = (selection, type, precision = 'day') => {
|
|
481
|
+
if (!selection.length)
|
|
482
|
+
return '';
|
|
483
|
+
const format = (iso) => truncateISO(iso, precision);
|
|
484
|
+
if (type === 'range') {
|
|
485
|
+
if (selection.length < 2)
|
|
486
|
+
return format(selection[0] ?? '');
|
|
487
|
+
const [start, end] = sortRange(selection[0], selection[1]);
|
|
488
|
+
return `${format(start)}/${format(end)}`;
|
|
489
|
+
}
|
|
490
|
+
if (type === 'multi') {
|
|
491
|
+
return Array.from(new Set(selection.map(format)))
|
|
492
|
+
.sort(compareISO)
|
|
493
|
+
.join(' ');
|
|
494
|
+
}
|
|
495
|
+
return format(selection[0]);
|
|
496
|
+
};
|
|
497
|
+
/* -------------------------------------------------------------------------- */
|
|
498
|
+
/* Predicates */
|
|
499
|
+
/* -------------------------------------------------------------------------- */
|
|
500
|
+
/** Whether the given ISO day is included in the selection. */
|
|
501
|
+
const isSelected = (iso, selection, type) => {
|
|
502
|
+
if (!selection.length)
|
|
503
|
+
return false;
|
|
504
|
+
if (type === 'range') {
|
|
505
|
+
if (selection.length < 2)
|
|
506
|
+
return iso === selection[0];
|
|
507
|
+
const [start, end] = selection;
|
|
508
|
+
return iso >= start && iso <= end;
|
|
509
|
+
}
|
|
510
|
+
return selection.includes(iso);
|
|
511
|
+
};
|
|
512
|
+
/** Whether the ISO day is the start of a range selection. */
|
|
513
|
+
const isRangeStart = (iso, selection, type) => type === 'range' && selection.length === 2 && iso === selection[0];
|
|
514
|
+
/** Whether the ISO day is the end of a range selection. */
|
|
515
|
+
const isRangeEnd = (iso, selection, type) => type === 'range' && selection.length === 2 && iso === selection[1];
|
|
516
|
+
/** Whether the ISO day sits strictly inside the range (not start/end). */
|
|
517
|
+
const isRangeInner = (iso, selection, type) => {
|
|
518
|
+
if (type !== 'range' || selection.length < 2)
|
|
519
|
+
return false;
|
|
520
|
+
const [start, end] = selection;
|
|
521
|
+
return iso > start && iso < end;
|
|
522
|
+
};
|
|
523
|
+
/* -------------------------------------------------------------------------- */
|
|
524
|
+
/* Selection ops */
|
|
525
|
+
/* -------------------------------------------------------------------------- */
|
|
526
|
+
/**
|
|
527
|
+
* Apply a click on `iso` and return the next selection.
|
|
528
|
+
*
|
|
529
|
+
* - single: always replace.
|
|
530
|
+
* - multi: toggle (add if missing, remove if present).
|
|
531
|
+
* - range: if there is no start OR a full range exists, start a new range;
|
|
532
|
+
* otherwise complete the range (auto-sorted).
|
|
533
|
+
*/
|
|
534
|
+
const applySelection = (iso, selection, type) => {
|
|
535
|
+
if (type === 'single')
|
|
536
|
+
return [iso];
|
|
537
|
+
if (type === 'multi') {
|
|
538
|
+
return selection.includes(iso) ? selection.filter((v) => v !== iso) : [...selection, iso].sort(compareISO);
|
|
539
|
+
}
|
|
540
|
+
// range
|
|
541
|
+
if (selection.length === 0 || selection.length === 2)
|
|
542
|
+
return [iso];
|
|
543
|
+
const [start, end] = sortRange(selection[0], iso);
|
|
544
|
+
return [start, end];
|
|
545
|
+
};
|
|
546
|
+
/**
|
|
547
|
+
* Build the highlighted range while the user is hovering with an in-progress
|
|
548
|
+
* range selection (`tentative` = the pending start).
|
|
549
|
+
*/
|
|
550
|
+
const buildTentativeRange = (tentative, hovered) => {
|
|
551
|
+
if (!tentative || !hovered)
|
|
552
|
+
return [];
|
|
553
|
+
const [start, end] = sortRange(tentative, hovered);
|
|
554
|
+
return [start, end];
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
const buildCellPartList = (state) => {
|
|
558
|
+
const parts = [CALENDAR_PARTS.day];
|
|
559
|
+
if (state.selected)
|
|
560
|
+
parts.push(CALENDAR_PARTS.selected);
|
|
561
|
+
if (state.isToday)
|
|
562
|
+
parts.push(CALENDAR_PARTS.today);
|
|
563
|
+
if (state.outside)
|
|
564
|
+
parts.push(CALENDAR_PARTS.outside);
|
|
565
|
+
if (state.disallowed)
|
|
566
|
+
parts.push(CALENDAR_PARTS.disallowed);
|
|
567
|
+
if (state.outOfBounds)
|
|
568
|
+
parts.push(CALENDAR_PARTS.disabled);
|
|
569
|
+
if (state.rangeStart)
|
|
570
|
+
parts.push(CALENDAR_PARTS.rangeStart);
|
|
571
|
+
if (state.rangeEnd)
|
|
572
|
+
parts.push(CALENDAR_PARTS.rangeEnd);
|
|
573
|
+
if (state.rangeInner)
|
|
574
|
+
parts.push(CALENDAR_PARTS.rangeInner);
|
|
575
|
+
return parts.join(' ');
|
|
576
|
+
};
|
|
577
|
+
const computeCellState = (cell, ctx) => {
|
|
578
|
+
const disallowed = ctx.isDateDisallowed?.(cell.date) ?? false;
|
|
579
|
+
const outOfBounds = !isWithinBounds(cell.date, ctx.minISO, ctx.maxISO);
|
|
580
|
+
return {
|
|
581
|
+
outside: cell.outside,
|
|
582
|
+
disallowed,
|
|
583
|
+
outOfBounds,
|
|
584
|
+
disabled: disallowed || outOfBounds,
|
|
585
|
+
selected: isSelected(cell.iso, ctx.effectiveSelection, ctx.type),
|
|
586
|
+
rangeStart: isRangeStart(cell.iso, ctx.effectiveSelection, ctx.type),
|
|
587
|
+
rangeEnd: isRangeEnd(cell.iso, ctx.effectiveSelection, ctx.type),
|
|
588
|
+
rangeInner: isRangeInner(cell.iso, ctx.effectiveSelection, ctx.type),
|
|
589
|
+
isToday: isSameDay(cell.date, ctx.today),
|
|
590
|
+
isFocused: cell.iso === ctx.focusedISO,
|
|
591
|
+
buttonHidden: cell.outside && !ctx.showOutsideDays,
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
const renderCell = (cell, state, cb) => (h("td", { key: cell.iso, "aria-selected": state.selected ? 'true' : undefined, class: "bq-date-picker__td", part: CALENDAR_PARTS.td,
|
|
595
|
+
// biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: WAI-ARIA date-picker grid pattern.
|
|
596
|
+
role: "gridcell", tabIndex: -1 }, h("button", { "aria-current": state.isToday ? 'date' : undefined, "aria-disabled": state.disabled ? 'true' : undefined, class: {
|
|
597
|
+
'bq-date-picker__day': true,
|
|
598
|
+
'is-selected': state.selected,
|
|
599
|
+
'is-today': state.isToday,
|
|
600
|
+
'is-outside': state.outside,
|
|
601
|
+
'is-disallowed': state.disallowed,
|
|
602
|
+
'is-out-of-bounds': state.outOfBounds,
|
|
603
|
+
'is-range-start': state.rangeStart,
|
|
604
|
+
'is-range-end': state.rangeEnd,
|
|
605
|
+
'is-range-inner': state.rangeInner,
|
|
606
|
+
'is-hidden': state.buttonHidden,
|
|
607
|
+
}, "data-iso": cell.iso, onClick: (ev) => !state.disabled && cb.onDaySelect(cell.iso, ev), onFocus: () => cb.onDayFocus(cell.iso), onMouseEnter: () => cb.onDayHover(cell.iso), onMouseLeave: () => cb.onDayHover(undefined), part: `${CALENDAR_PARTS.button} ${buildCellPartList(state)}`, tabIndex: state.isFocused ? 0 : -1, type: "button" }, cell.date.getDate())));
|
|
608
|
+
/**
|
|
609
|
+
* Day-level calendar view — weekday row + 6x7 grid.
|
|
610
|
+
*
|
|
611
|
+
* The grid is a `<table role="grid">` so it is announced correctly by screen
|
|
612
|
+
* readers, and it uses a roving tabindex so only the "focused" day is in the
|
|
613
|
+
* tab order. Keyboard nav is delegated to the host via `onGridKeyDown`.
|
|
614
|
+
*/
|
|
615
|
+
const CalendarDayView = (props) => {
|
|
616
|
+
const { viewDate, selection, tentativeRange, focusedISO, type, locale, firstDayOfWeek, showOutsideDays, minISO, maxISO, isDateDisallowed, onDaySelect, onDayHover, onDayFocus, onGridKeyDown, } = props;
|
|
617
|
+
const weekdays = getWeekdayNames(locale, firstDayOfWeek, 'short');
|
|
618
|
+
const rows = buildMonthMatrix(viewDate, firstDayOfWeek);
|
|
619
|
+
const today = new Date();
|
|
620
|
+
// Localized "Month Year" label used to name the grid for screen readers,
|
|
621
|
+
// e.g. "July 2026". Always computed so the grid is named even when the
|
|
622
|
+
// visible heading is rendered outside this component.
|
|
623
|
+
const gridLabel = formatMonth(viewDate, locale, 'long', true);
|
|
624
|
+
// The effective selection includes the tentative range so hover states
|
|
625
|
+
// preview correctly during range selection.
|
|
626
|
+
const effectiveSelection = type === 'range' && tentativeRange.length === 2 ? tentativeRange : selection;
|
|
627
|
+
return (h("div", { class: "bq-date-picker__day-view" }, h("table", { "aria-label": gridLabel, class: "bq-date-picker__table", onKeyDown: onGridKeyDown, part: CALENDAR_PARTS.table,
|
|
628
|
+
// biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: WAI-ARIA date-picker grid pattern.
|
|
629
|
+
role: "grid" }, h("thead", { part: CALENDAR_PARTS.head }, h("tr", { part: CALENDAR_PARTS.tr }, weekdays.map((wd) => (h("th", { key: wd.long, abbr: wd.long, class: "bq-date-picker__th", part: CALENDAR_PARTS.th, scope: "col" }, wd.short))))), h("tbody", null, rows.map((row) => (h("tr", { key: row[0].iso, class: "bq-date-picker__week", part: `${CALENDAR_PARTS.tr} ${CALENDAR_PARTS.week}` }, row.map((cell) => {
|
|
630
|
+
const state = computeCellState(cell, {
|
|
631
|
+
effectiveSelection,
|
|
632
|
+
type,
|
|
633
|
+
today,
|
|
634
|
+
focusedISO,
|
|
635
|
+
minISO,
|
|
636
|
+
maxISO,
|
|
637
|
+
isDateDisallowed,
|
|
638
|
+
showOutsideDays,
|
|
639
|
+
});
|
|
640
|
+
return renderCell(cell, state, { onDaySelect, onDayHover, onDayFocus });
|
|
641
|
+
}))))))));
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Calendar header — previous / title / next.
|
|
646
|
+
*
|
|
647
|
+
* The header is rendered once per calendar panel. It exposes the standard
|
|
648
|
+
* `calendar__header`, `calendar__previous`, `calendar__heading`, and
|
|
649
|
+
* `calendar__next` shadow parts so consumers can theme any button.
|
|
650
|
+
*/
|
|
651
|
+
const CalendarHeader = ({ view, label, previousLabel, nextLabel, titleLabel, previousDisabled = false, nextDisabled = false, titleInteractive = true, onPrevious, onNext, onTitleClick, }) => (h("div", { class: "bq-date-picker__header", part: CALENDAR_PARTS.header }, h("bq-button", { appearance: "text", border: "s", class: "bq-date-picker__nav-button", disabled: previousDisabled, label: previousLabel, onlyIcon: true, onBqClick: onPrevious, part: `${CALENDAR_PARTS.button} ${CALENDAR_PARTS.previous}`, size: "small", type: "button" }, h("bq-icon", { "aria-hidden": "true", class: "bq-date-picker__nav-icon", name: "caret-left" })), h("bq-button", { appearance: "text", "aria-live": "polite", border: "s", class: {
|
|
652
|
+
'bq-date-picker__heading': true,
|
|
653
|
+
'bq-date-picker__heading--static': !titleInteractive,
|
|
654
|
+
}, "data-view": view, disabled: !titleInteractive, label: titleLabel, onBqClick: onTitleClick, part: CALENDAR_PARTS.heading, size: "small", type: "button", block: true }, label), h("bq-button", { appearance: "text", border: "s", class: "bq-date-picker__nav-button", disabled: nextDisabled, label: nextLabel, onlyIcon: true, onBqClick: onNext, part: `${CALENDAR_PARTS.button} ${CALENDAR_PARTS.next}`, size: "small", type: "button" }, h("bq-icon", { "aria-hidden": "true", class: "bq-date-picker__nav-icon", name: "caret-right" }))));
|
|
655
|
+
|
|
656
|
+
/** ISO used to compare a month cell against the internal selection. */
|
|
657
|
+
const monthCellISO = (year, month) => `${year}-${String(month + 1).padStart(2, '0')}-01`;
|
|
658
|
+
const buildMonthParts = (state) => {
|
|
659
|
+
const parts = [CALENDAR_PARTS.month];
|
|
660
|
+
if (state.selected)
|
|
661
|
+
parts.push(CALENDAR_PARTS.monthSelected);
|
|
662
|
+
if (state.rangeStart)
|
|
663
|
+
parts.push(CALENDAR_PARTS.rangeStart);
|
|
664
|
+
if (state.rangeEnd)
|
|
665
|
+
parts.push(CALENDAR_PARTS.rangeEnd);
|
|
666
|
+
if (state.rangeInner)
|
|
667
|
+
parts.push(CALENDAR_PARTS.rangeInner);
|
|
668
|
+
if (state.disabled)
|
|
669
|
+
parts.push(CALENDAR_PARTS.disabled);
|
|
670
|
+
return parts.join(' ');
|
|
671
|
+
};
|
|
672
|
+
const buildMonthCellState = (year, month, focusedMonth, minISO, maxISO, selection, type) => {
|
|
673
|
+
const iso = monthCellISO(year, month);
|
|
674
|
+
const disabled = !isMonthWithinBounds(year, month, minISO, maxISO);
|
|
675
|
+
return {
|
|
676
|
+
iso,
|
|
677
|
+
disabled,
|
|
678
|
+
selected: isSelected(iso, selection, type),
|
|
679
|
+
rangeStart: isRangeStart(iso, selection, type),
|
|
680
|
+
rangeEnd: isRangeEnd(iso, selection, type),
|
|
681
|
+
rangeInner: isRangeInner(iso, selection, type),
|
|
682
|
+
isFocused: focusedMonth === month,
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
const chunkMonths = (months, columns) => {
|
|
686
|
+
const rows = [];
|
|
687
|
+
for (let month = 0; month < months.length; month += columns) {
|
|
688
|
+
rows.push(months.slice(month, month + columns).map((name, offset) => ({ month: month + offset, name })));
|
|
689
|
+
}
|
|
690
|
+
return rows;
|
|
691
|
+
};
|
|
692
|
+
const renderMonthCell = ({ month, name, state, onMonthSelect, onMonthFocus, onMonthHover }) => (
|
|
693
|
+
// biome-ignore lint/a11y/useFocusableInteractive: gridcell is a structural ARIA container; focus is managed by the child <button> via roving tabindex
|
|
694
|
+
h("div", { "aria-selected": state.selected ? 'true' : undefined, class: "bq-date-picker__month-gridcell", role: "gridcell", key: month }, h("button", { "aria-disabled": state.disabled ? 'true' : undefined, class: {
|
|
695
|
+
'bq-date-picker__month-cell': true,
|
|
696
|
+
'is-selected': state.selected,
|
|
697
|
+
'is-range-start': state.rangeStart,
|
|
698
|
+
'is-range-end': state.rangeEnd,
|
|
699
|
+
'is-range-inner': state.rangeInner,
|
|
700
|
+
'is-out-of-bounds': state.disabled,
|
|
701
|
+
}, "data-month": month, disabled: state.disabled, onClick: (ev) => !state.disabled && onMonthSelect(month, ev), onFocus: () => onMonthFocus(month), onMouseEnter: () => onMonthHover(state.iso), onMouseLeave: () => onMonthHover(undefined), part: `${CALENDAR_PARTS.button} ${buildMonthParts(state)}`, tabIndex: state.isFocused ? 0 : -1, type: "button" }, name)));
|
|
702
|
+
/**
|
|
703
|
+
* Month picker — 12 buttons in a 3×4 grid.
|
|
704
|
+
*/
|
|
705
|
+
const CalendarMonthView = ({ year, focusedMonth, locale, minISO, maxISO, selection, tentativeRange, type, onMonthSelect, onMonthFocus, onMonthHover, onGridKeyDown, gridColumns, }) => {
|
|
706
|
+
const months = getMonthNames(locale, 'short');
|
|
707
|
+
const effectiveSelection = type === 'range' && tentativeRange.length === 2 ? tentativeRange : selection;
|
|
708
|
+
const rows = chunkMonths(months, gridColumns);
|
|
709
|
+
return (h("div", { class: "bq-date-picker__months", "data-grid-columns": String(gridColumns), onKeyDown: onGridKeyDown, part: CALENDAR_PARTS.months, role: "grid", tabIndex: -1 }, rows.map((row) => (
|
|
710
|
+
// biome-ignore lint/a11y/useFocusableInteractive: gridcell is a structural ARIA container; focus is managed by the child <button> via roving tabindex
|
|
711
|
+
h("div", { class: "bq-date-picker__month-row", role: "row", key: `month-row-${row.map(({ month }) => month).join('-')}` }, row.map(({ month, name }) => {
|
|
712
|
+
const state = buildMonthCellState(year, month, focusedMonth, minISO, maxISO, effectiveSelection, type);
|
|
713
|
+
return renderMonthCell({ month, name, state, onMonthSelect, onMonthFocus, onMonthHover });
|
|
714
|
+
}))))));
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
/** ISO used to compare a year cell against the internal selection. */
|
|
718
|
+
const yearCellISO = (year) => `${year}-01-01`;
|
|
719
|
+
const buildYearParts = (state) => {
|
|
720
|
+
const parts = [CALENDAR_PARTS.year];
|
|
721
|
+
if (state.selected)
|
|
722
|
+
parts.push(CALENDAR_PARTS.yearSelected);
|
|
723
|
+
if (state.rangeStart)
|
|
724
|
+
parts.push(CALENDAR_PARTS.rangeStart);
|
|
725
|
+
if (state.rangeEnd)
|
|
726
|
+
parts.push(CALENDAR_PARTS.rangeEnd);
|
|
727
|
+
if (state.rangeInner)
|
|
728
|
+
parts.push(CALENDAR_PARTS.rangeInner);
|
|
729
|
+
if (state.disabled)
|
|
730
|
+
parts.push(CALENDAR_PARTS.disabled);
|
|
731
|
+
return parts.join(' ');
|
|
732
|
+
};
|
|
733
|
+
const buildYearCellState = (year, focusedYear, minISO, maxISO, selection, type) => {
|
|
734
|
+
const iso = yearCellISO(year);
|
|
735
|
+
const disabled = !isYearWithinBounds(year, minISO, maxISO);
|
|
736
|
+
return {
|
|
737
|
+
iso,
|
|
738
|
+
disabled,
|
|
739
|
+
selected: isSelected(iso, selection, type),
|
|
740
|
+
rangeStart: isRangeStart(iso, selection, type),
|
|
741
|
+
rangeEnd: isRangeEnd(iso, selection, type),
|
|
742
|
+
rangeInner: isRangeInner(iso, selection, type),
|
|
743
|
+
isFocused: focusedYear === year,
|
|
744
|
+
};
|
|
745
|
+
};
|
|
746
|
+
const chunkYears = (years, columns) => {
|
|
747
|
+
const rows = [];
|
|
748
|
+
for (let index = 0; index < years.length; index += columns) {
|
|
749
|
+
rows.push(years.slice(index, index + columns));
|
|
750
|
+
}
|
|
751
|
+
return rows;
|
|
752
|
+
};
|
|
753
|
+
const renderYearCell = ({ year, state, onYearSelect, onYearFocus, onYearHover }) => (
|
|
754
|
+
// biome-ignore lint/a11y/useFocusableInteractive: gridcell is a structural ARIA container; focus is managed by the child <button> via roving tabindex
|
|
755
|
+
h("div", { "aria-selected": state.selected ? 'true' : undefined, class: "bq-date-picker__year-gridcell", key: year, role: "gridcell" }, h("button", { "aria-disabled": state.disabled ? 'true' : undefined, class: {
|
|
756
|
+
'bq-date-picker__year-cell': true,
|
|
757
|
+
'is-selected': state.selected,
|
|
758
|
+
'is-range-start': state.rangeStart,
|
|
759
|
+
'is-range-end': state.rangeEnd,
|
|
760
|
+
'is-range-inner': state.rangeInner,
|
|
761
|
+
'is-out-of-bounds': state.disabled,
|
|
762
|
+
}, "data-year": year, disabled: state.disabled, onClick: (ev) => !state.disabled && onYearSelect(year, ev), onFocus: () => onYearFocus(year), onMouseEnter: () => onYearHover(state.iso), onMouseLeave: () => onYearHover(undefined), part: `${CALENDAR_PARTS.button} ${buildYearParts(state)}`, tabIndex: state.isFocused ? 0 : -1, type: "button" }, year)));
|
|
763
|
+
/**
|
|
764
|
+
* Year picker — 12 buttons for a decade grid.
|
|
765
|
+
*/
|
|
766
|
+
const CalendarYearView = ({ years, focusedYear, minISO, maxISO, selection, tentativeRange, type, onYearSelect, onYearFocus, onYearHover, onGridKeyDown, gridColumns, }) => {
|
|
767
|
+
const effectiveSelection = type === 'range' && tentativeRange.length === 2 ? tentativeRange : selection;
|
|
768
|
+
const rows = chunkYears(years, gridColumns);
|
|
769
|
+
return (h("div", { class: "bq-date-picker__years", "data-grid-columns": String(gridColumns), onKeyDown: onGridKeyDown, part: CALENDAR_PARTS.years, role: "grid", tabIndex: -1 }, rows.map((row) => (
|
|
770
|
+
// biome-ignore lint/a11y/useFocusableInteractive: gridcell is a structural ARIA container; focus is managed by the child <button> via roving tabindex
|
|
771
|
+
h("div", { class: "bq-date-picker__year-row", key: `year-row-${row.join('-')}`, role: "row" }, row.map((year) => {
|
|
772
|
+
const state = buildYearCellState(year, focusedYear, minISO, maxISO, effectiveSelection, type);
|
|
773
|
+
return renderYearCell({ year, state, onYearSelect, onYearFocus, onYearHover });
|
|
774
|
+
}))))));
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Precision-aware, bounds-aware parser for the trigger input field.
|
|
779
|
+
* Returns the parsed date as a wire-format string at the configured
|
|
780
|
+
* precision, clamped against `min`/`max`, or `{ invalid: true }` on failure.
|
|
781
|
+
*/
|
|
782
|
+
const parseTypedInput = (text, locale, precision, min, max, isDateDisallowed) => {
|
|
783
|
+
const trimmed = text.trim();
|
|
784
|
+
if (!trimmed)
|
|
785
|
+
return { value: undefined };
|
|
786
|
+
const parsed = parseDateInput(trimmed, locale);
|
|
787
|
+
if (!parsed || isDateDisallowed?.(parsed))
|
|
788
|
+
return { invalid: true };
|
|
789
|
+
const iso = clampISO(toISODateString(parsed), min, max);
|
|
790
|
+
return { value: serializeValue([iso], 'single', precision) };
|
|
791
|
+
};
|
|
792
|
+
/**
|
|
793
|
+
* Lexically clamp a full `YYYY-MM-DD` ISO date to precision-padded bounds.
|
|
794
|
+
* Coarser bounds (`YYYY`, `YYYY-MM`) are padded to the widest matching day
|
|
795
|
+
* before comparing.
|
|
796
|
+
*/
|
|
797
|
+
const clampISO = (iso, min, max) => {
|
|
798
|
+
const paddedMin = padBound(min, 'min');
|
|
799
|
+
const paddedMax = padBound(max, 'max');
|
|
800
|
+
if (paddedMin && iso < paddedMin)
|
|
801
|
+
return paddedMin;
|
|
802
|
+
if (paddedMax && iso > paddedMax)
|
|
803
|
+
return paddedMax;
|
|
804
|
+
return iso;
|
|
805
|
+
};
|
|
124
806
|
|
|
807
|
+
/**
|
|
808
|
+
* Builds the label shown in the calendar header title button.
|
|
809
|
+
*
|
|
810
|
+
* - `days`: localized "Month Year" for a single panel, or "StartYear – EndYear"
|
|
811
|
+
* when several months are visible at once.
|
|
812
|
+
* - `months`: the localized year currently in focus.
|
|
813
|
+
* - `years`: the closed range spanning the visible decade.
|
|
814
|
+
*/
|
|
815
|
+
const getHeaderLabel = ({ view, viewDate, focusedYear, decadeStart, monthCount, locale, }) => {
|
|
816
|
+
if (view === 'days') {
|
|
817
|
+
if (monthCount > 1) {
|
|
818
|
+
const first = startOfMonth(viewDate);
|
|
819
|
+
const last = startOfMonth(addMonths(viewDate, monthCount - 1));
|
|
820
|
+
const startYear = formatYear(first, locale);
|
|
821
|
+
const endYear = formatYear(last, locale);
|
|
822
|
+
return startYear === endYear ? startYear : `${startYear} – ${endYear}`;
|
|
823
|
+
}
|
|
824
|
+
return formatMonth(viewDate, locale, 'long', true);
|
|
825
|
+
}
|
|
826
|
+
if (view === 'months') {
|
|
827
|
+
return formatYear(new Date(focusedYear, 0, 1), locale);
|
|
828
|
+
}
|
|
829
|
+
const end = decadeStart + DECADE_GRID_SIZE - 1;
|
|
830
|
+
return `${decadeStart} – ${end}`;
|
|
831
|
+
};
|
|
832
|
+
/**
|
|
833
|
+
* Aria label announcing what clicking the title switches to.
|
|
834
|
+
* Views cycle days → months → years → back to the base view (days for
|
|
835
|
+
* `precision="day"`, months for `precision="month"`).
|
|
836
|
+
*/
|
|
837
|
+
const getHeaderTitleLabel = (view, precision = 'day') => {
|
|
838
|
+
if (view === 'days')
|
|
839
|
+
return DEFAULT_ARIA_LABELS.chooseMonth;
|
|
840
|
+
if (view === 'months')
|
|
841
|
+
return DEFAULT_ARIA_LABELS.chooseYear;
|
|
842
|
+
return precision === 'month' ? DEFAULT_ARIA_LABELS.chooseMonth : DEFAULT_ARIA_LABELS.chooseDate;
|
|
843
|
+
};
|
|
844
|
+
/** Aria label for the "previous" navigation button, per view. */
|
|
845
|
+
const getPreviousLabel = (view) => {
|
|
846
|
+
if (view === 'days')
|
|
847
|
+
return DEFAULT_ARIA_LABELS.previousMonth;
|
|
848
|
+
if (view === 'months')
|
|
849
|
+
return DEFAULT_ARIA_LABELS.previousYear;
|
|
850
|
+
return DEFAULT_ARIA_LABELS.previousDecade;
|
|
851
|
+
};
|
|
852
|
+
/** Aria label for the "next" navigation button, per view. */
|
|
853
|
+
const getNextLabel = (view) => {
|
|
854
|
+
if (view === 'days')
|
|
855
|
+
return DEFAULT_ARIA_LABELS.nextMonth;
|
|
856
|
+
if (view === 'months')
|
|
857
|
+
return DEFAULT_ARIA_LABELS.nextYear;
|
|
858
|
+
return DEFAULT_ARIA_LABELS.nextDecade;
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Advances a focused month cursor by `delta` months, carrying over to the
|
|
863
|
+
* previous or next year as needed. Pure — accepts and returns primitives so
|
|
864
|
+
* it can be unit-tested and reused by keyboard handlers.
|
|
865
|
+
*/
|
|
866
|
+
const advanceFocusedMonth = (focusedMonth, focusedYear, delta) => {
|
|
867
|
+
let month = focusedMonth + delta;
|
|
868
|
+
let year = focusedYear;
|
|
869
|
+
while (month < 0) {
|
|
870
|
+
month += 12;
|
|
871
|
+
year -= 1;
|
|
872
|
+
}
|
|
873
|
+
while (month > 11) {
|
|
874
|
+
month -= 12;
|
|
875
|
+
year += 1;
|
|
876
|
+
}
|
|
877
|
+
return { month, year };
|
|
878
|
+
};
|
|
879
|
+
/**
|
|
880
|
+
* Advances a focused year cursor by `delta` years, sliding the visible
|
|
881
|
+
* decade grid so the focused year always stays in view.
|
|
882
|
+
*/
|
|
883
|
+
const advanceFocusedYear = (focusedYear, decadeStart, delta) => {
|
|
884
|
+
const year = focusedYear + delta;
|
|
885
|
+
let nextDecadeStart = decadeStart;
|
|
886
|
+
if (year < decadeStart) {
|
|
887
|
+
nextDecadeStart = decadeStart - DECADE_GRID_SIZE;
|
|
888
|
+
}
|
|
889
|
+
else if (year > decadeStart + DECADE_GRID_SIZE - 1) {
|
|
890
|
+
nextDecadeStart = decadeStart + DECADE_GRID_SIZE;
|
|
891
|
+
}
|
|
892
|
+
return { year, decadeStart: nextDecadeStart };
|
|
893
|
+
};
|
|
894
|
+
/**
|
|
895
|
+
* Number of columns used to render the months/years grids. The grids widen
|
|
896
|
+
* from 3 → 4 columns when multiple months are visible, so vertical arrow
|
|
897
|
+
* navigation stride must match.
|
|
898
|
+
*/
|
|
899
|
+
const getGridColumns = (monthCount) => (monthCount > 1 ? 4 : 3);
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Normalizes a raw public `value` string against the current picker `type`
|
|
903
|
+
* and `precision`.
|
|
904
|
+
*
|
|
905
|
+
* Runs the value through `parseValue`/`serializeValue` so any invalid ISO
|
|
906
|
+
* tokens are dropped before the value ever reaches the form, the display
|
|
907
|
+
* input, or the visible selection. Returns `undefined` when normalization
|
|
908
|
+
* leaves an empty string, so callers can distinguish "no value" from "empty
|
|
909
|
+
* string value".
|
|
910
|
+
*/
|
|
911
|
+
const normalizeValue = (raw, type, precision = 'day') => {
|
|
912
|
+
const serialized = serializeValue(parseValue(raw, type, precision), type, precision);
|
|
913
|
+
return serialized === '' ? undefined : serialized;
|
|
914
|
+
};
|
|
915
|
+
/** Whether a value string is present and non-empty — used to drive UI affordances. */
|
|
916
|
+
const computeHasValue = (value) => isDefined(value) && `${value}`.length > 0;
|
|
917
|
+
/**
|
|
918
|
+
* Formats the current value for display in the trigger input. Thin wrapper
|
|
919
|
+
* around `formatDisplayValue` that accepts `undefined` and coerces to an
|
|
920
|
+
* empty string, so callers don't have to repeat the null check.
|
|
921
|
+
*
|
|
922
|
+
* Precision-agnostic: internally the selection is stored as full ISO dates
|
|
923
|
+
* (the first day of the month / January 1st for coarser precisions), so
|
|
924
|
+
* `Intl.DateTimeFormat(locale, formatOptions)` produces the right label
|
|
925
|
+
* whether the user asked for `{ year: 'numeric' }` or `{ dateStyle: 'full' }`.
|
|
926
|
+
*/
|
|
927
|
+
const computeDisplayDate = (value, type, locale, formatOptions, precision = 'day') => {
|
|
928
|
+
// Expand precision-truncated wire values back to full ISO so
|
|
929
|
+
// `formatDisplayValue` (which expects YYYY-MM-DD) can parse them.
|
|
930
|
+
const expanded = serializeValue(parseValue(value ?? '', type, precision), type, 'day');
|
|
931
|
+
return formatDisplayValue(expanded, type, locale, formatOptions);
|
|
932
|
+
};
|
|
933
|
+
/**
|
|
934
|
+
* Default `Intl.DateTimeFormat` options per precision.
|
|
935
|
+
* Applied when the consumer hasn't explicitly overridden `formatOptions`, so
|
|
936
|
+
* a `precision="month"` picker doesn't show "1 May 2026".
|
|
937
|
+
*/
|
|
938
|
+
const DEFAULT_FORMAT_OPTIONS_BY_PRECISION = {
|
|
939
|
+
day: { day: 'numeric', month: 'short', year: 'numeric' },
|
|
940
|
+
month: { month: 'long', year: 'numeric' },
|
|
941
|
+
year: { year: 'numeric' },
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
const bqDatePickerCss = () => `.transform{--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}::backdrop,:root{--bq-blue-100:#e7f0fd;--bq-blue-200:#d0e2fb;--bq-blue-300:#a1c5f7;--bq-blue-400:#73a8f3;--bq-blue-500:#448bef;--bq-blue-600:#156eeb;--bq-blue-700:#1158bc;--bq-blue-800:#0d428d;--bq-blue-900:#082c5e;--bq-blue-1000:#04162f;--bq-corai-100:#fff2f2;--bq-corai-200:#ffe6e6;--bq-corai-300:#ffccce;--bq-corai-400:#ffb3b5;--bq-corai-500:#ff999d;--bq-corai-600:#ff8084;--bq-corai-700:#cc666a;--bq-corai-800:#994d4f;--bq-corai-900:#663335;--bq-corai-1000:#331a1a;--bq-cyan-100:#e8f7fb;--bq-cyan-200:#d2f0f8;--bq-cyan-300:#a5e1f1;--bq-cyan-400:#78d1e9;--bq-cyan-500:#4bc2e2;--bq-cyan-600:#1eb3db;--bq-cyan-700:#188faf;--bq-cyan-800:#126b83;--bq-cyan-900:#0c4858;--bq-cyan-1000:#06242c;--bq-gold-100:#fbf4ec;--bq-gold-200:#f7e9da;--bq-gold-300:#f0d3b6;--bq-gold-400:#e8bc91;--bq-gold-500:#e1a66d;--bq-gold-600:#d99048;--bq-gold-700:#ae733a;--bq-gold-800:#82562b;--bq-gold-900:#573a1d;--bq-gold-1000:#2b1d0e;--bq-green-100:#e8f8ef;--bq-green-200:#d2f1e0;--bq-green-300:#a5e3c1;--bq-green-400:#78d5a1;--bq-green-500:#4bc782;--bq-green-600:#1eb963;--bq-green-700:#18944f;--bq-green-800:#126f3b;--bq-green-900:#0c4a28;--bq-green-1000:#062514;--bq-grey-100:#f1f2f4;--bq-grey-200:#e7e8eb;--bq-grey-300:#caccd2;--bq-grey-400:#a6aab3;--bq-grey-50:#f6f6f8;--bq-grey-500:#898e99;--bq-grey-600:#646a77;--bq-grey-700:#3f4350;--bq-grey-800:#2a2c35;--bq-grey-900:#1c1d23;--bq-grey-950:#15161a;--bq-grey-1000:#0d0e11;--bq-indigo-100:#edecfc;--bq-indigo-200:#dcdafa;--bq-indigo-300:#b9b5f5;--bq-indigo-400:#9590ef;--bq-indigo-500:#726bea;--bq-indigo-600:#4f46e5;--bq-indigo-700:#3f38b7;--bq-indigo-800:#2f2a89;--bq-indigo-900:#201c5c;--bq-indigo-1000:#100e2e;--bq-iris-100:#e9f0ff;--bq-iris-200:#d6e0ff;--bq-iris-300:#b2c0fe;--bq-iris-400:#8691f8;--bq-iris-500:#6061ee;--bq-iris-600:#4f46e5;--bq-iris-700:#413abd;--bq-iris-800:#332e95;--bq-iris-900:#26216d;--bq-iris-1000:#181545;--bq-lime-100:#f5fae8;--bq-lime-200:#ecf6d2;--bq-lime-300:#d9eda5;--bq-lime-400:#c5e379;--bq-lime-500:#b2da4c;--bq-lime-600:#9fd11f;--bq-lime-700:#7fa719;--bq-lime-800:#5f7d13;--bq-lime-900:#40540c;--bq-lime-1000:#202a06;--bq-magenta-100:#fce7f4;--bq-magenta-200:#f9cfea;--bq-magenta-300:#f39fd6;--bq-magenta-400:#ee6fbf;--bq-magenta-500:#e83fab;--bq-magenta-600:#de1395;--bq-magenta-700:#b20f77;--bq-magenta-800:#850c59;--bq-magenta-900:#58083c;--bq-magenta-1000:#2c041e;--bq-neutral-white:#fbfbfc;--bq-neutral-black:#060708;--bq-orange-100:#fbf0e9;--bq-orange-200:#f8e1d4;--bq-orange-300:#f1c2a8;--bq-orange-400:#eaa47d;--bq-orange-500:#e38551;--bq-orange-600:#dc6726;--bq-orange-700:#b0521e;--bq-orange-800:#843e17;--bq-orange-900:#58290f;--bq-orange-1000:#2c1508;--bq-purple-100:#efebf8;--bq-purple-200:#e0d7f2;--bq-purple-300:#c1afe5;--bq-purple-400:#a388d8;--bq-purple-500:#8460cb;--bq-purple-600:#6538be;--bq-purple-700:#512d98;--bq-purple-800:#3d2272;--bq-purple-900:#28164c;--bq-purple-1000:#140b26;--bq-red-100:#fce7ea;--bq-red-200:#f9d1d5;--bq-red-300:#f3a2ac;--bq-red-400:#ed7482;--bq-red-500:#e74559;--bq-red-600:#e1172f;--bq-red-700:#b41226;--bq-red-800:#870e1c;--bq-red-900:#5a0913;--bq-red-1000:#2d0509;--bq-sky-100:#eff4fb;--bq-sky-200:#dfeaf8;--bq-sky-300:#bfd5f1;--bq-sky-400:#9ec1e9;--bq-sky-500:#7eace2;--bq-sky-600:#5e97db;--bq-sky-700:#4b79af;--bq-sky-800:#385b83;--bq-sky-900:#263c58;--bq-sky-1000:#131e2c;--bq-teal-100:#e5f7f5;--bq-teal-200:#ccf0eb;--bq-teal-300:#99e1d8;--bq-teal-400:#66d2c4;--bq-teal-500:#33c3b1;--bq-teal-600:#00b49d;--bq-teal-700:#00907e;--bq-teal-800:#006c5e;--bq-teal-900:#00483f;--bq-teal-1000:#00241f;--bq-volcano-100:#feede7;--bq-volcano-200:#fddbd1;--bq-volcano-300:#fbb8a3;--bq-volcano-400:#fa9474;--bq-volcano-500:#f87146;--bq-volcano-600:#f64d18;--bq-volcano-700:#c53e13;--bq-volcano-800:#942e0e;--bq-volcano-900:#621f0a;--bq-volcano-1000:#310f05;--bq-yellow-100:#fefbe7;--bq-yellow-200:#fcf6d0;--bq-yellow-300:#faeea0;--bq-yellow-400:#f7e571;--bq-yellow-500:#f5dd41;--bq-yellow-600:#f2d412;--bq-yellow-700:#c2aa0e;--bq-yellow-800:#917f0b;--bq-yellow-900:#615507;--bq-yellow-1000:#302a04;--bq-endava-grey-50:#f7f7f8;--bq-endava-grey-100:#e4e6e7;--bq-endava-grey-200:#b5babe;--bq-endava-grey-300:#949ca1;--bq-endava-grey-400:#737d84;--bq-endava-grey-500:#525f67;--bq-endava-grey-600:#30404b;--bq-endava-grey-700:#2b3942;--bq-endava-grey-800:#263139;--bq-endava-grey-900:#192b37;--bq-endava-grey-950:#151b1e;--bq-endava-grey-1000:#0f1316;--bq-endava-neutral-white:#fafbfb;--bq-endava-neutral-black:#060708;--bq-endava-orange-100:#fef3f1;--bq-endava-orange-200:#fbd6d1;--bq-endava-orange-300:#fab7af;--bq-endava-orange-400:#fa988b;--bq-endava-orange-500:#fc7866;--bq-endava-orange-600:#ff5640;--bq-endava-orange-700:#ce4a39;--bq-endava-orange-800:#a03d30;--bq-endava-orange-900:#722e25;--bq-endava-orange-1000:#471e19}*,:after,:before{-webkit-box-sizing:border-box;box-sizing:border-box}*{font:inherit;margin:0}ol[role=list],ul[role=list]{list-style-type:none}html{text-size-adjust:none;font-family:var(--bq-font-family);font-size:var(--bq-font-size--m)}html:focus-within{scroll-behavior:smooth}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:var(--bq-background--primary);color:var(--bq-text--primary);line-height:var(--bq-font-line-height--regular);min-height:100vb;text-rendering:optimizeSpeed}a:not([class]){text-decoration-skip-ink:auto}canvas,img,picture,svg,video{display:block;max-width:100%}button,input,select,textarea{font:inherit}h1,h2,h3,h4,h5,h6,p{overflow-wrap:break-word}@media (prefers-reduced-motion:reduce){html:focus-within{scroll-behavior:auto}*,:after,:before{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto;transition-duration:.01ms!important}}:where(:root){--bq-white:#fff;--bq-black:#060708;--bq-neutral-50:var(--bq-grey-50);--bq-neutral-100:var(--bq-grey-100);--bq-neutral-200:var(--bq-grey-200);--bq-neutral-300:var(--bq-grey-300);--bq-neutral-400:var(--bq-grey-400);--bq-neutral-500:var(--bq-grey-500);--bq-neutral-600:var(--bq-grey-600);--bq-neutral-700:var(--bq-grey-700);--bq-neutral-800:var(--bq-grey-800);--bq-neutral-900:var(--bq-grey-900);--bq-neutral-950:var(--bq-grey-950);--bq-neutral-1000:var(--bq-grey-1000);--bq-brand-light:var(--bq-iris-100);--bq-brand:var(--bq-iris-600);--bq-brand-dark:var(--bq-iris-1000);--bq-accent-light:var(--bq-purple-100);--bq-accent:var(--bq-purple-600);--bq-accent-dark:var(--bq-purple-1000);--bq-success-light:var(--bq-teal-100);--bq-success:var(--bq-teal-600);--bq-success-dark:var(--bq-teal-1000);--bq-danger-light:var(--bq-red-100);--bq-danger:var(--bq-red-600);--bq-danger-dark:var(--bq-red-1000);--bq-warning-light:var(--bq-gold-100);--bq-warning:var(--bq-gold-600);--bq-warning-dark:var(--bq-gold-1000);--bq-info-light:var(--bq-iris-100);--bq-info:var(--bq-iris-600);--bq-info-dark:var(--bq-iris-1000);--bq-focus:var(--bq-iris-600);--bq-data-01:var(--bq-brand);--bq-data-02:var(--bq-purple-600);--bq-data-03:var(--bq-magenta-600);--bq-data-04:var(--bq-cyan-600);--bq-data-05:var(--bq-teal-600);--bq-data-06:var(--bq-orange-600);--bq-data-07:var(--bq-yellow-600);--bq-data-08:var(--bq-red-600);--bq-data-09:var(--bq-blue-600);--bq-data-10:var(--bq-grey-600);--bq-data-11:var(--bq-black);--bq-data-12:var(--bq-white);--bq-radius--none:0;--bq-radius--xs2:0.125rem;--bq-radius--xs:0.25rem;--bq-radius--s:0.5rem;--bq-radius--m:0.75rem;--bq-radius--l:1.5rem;--bq-radius--full:9999px;--bq-box-shadow--xs:0 2px 0 rgba(0,0,0,.016);--bq-box-shadow--s:0 8px 24px rgba(0,0,0,.04);--bq-box-shadow--m:0 10px 48px -16px rgba(0,0,0,.12);--bq-box-shadow--l:0 20px 58px -16px rgba(0,0,0,.16);--bq-font-family:"Outfit",sans-serif;--bq-font-size--xs:0.75rem;--bq-font-size--s:0.875rem;--bq-font-size--m:1rem;--bq-font-size--l:1.125rem;--bq-font-size--xl:1.5rem;--bq-font-size--xxl:2rem;--bq-font-size--xxl2:2.5rem;--bq-font-size--xxl3:3rem;--bq-font-size--xxl4:3.5rem;--bq-font-size--xxl5:4rem;--bq-font-weight--thin:100;--bq-font-weight--light:300;--bq-font-weight--regular:400;--bq-font-weight--medium:500;--bq-font-weight--semibold:600;--bq-font-weight--bold:700;--bq-font-line-height--small:1.2;--bq-font-line-height--regular:1.5;--bq-font-line-height--large:1.5;--bq-spacing-xs3:0.125rem;--bq-spacing-xs2:0.25rem;--bq-spacing-xs:0.5rem;--bq-spacing-s:0.75rem;--bq-spacing-m:1rem;--bq-spacing-l:1.5rem;--bq-spacing-xl:2rem;--bq-spacing-xxl:2.5rem;--bq-spacing-xxl2:3.5rem;--bq-spacing-xxl3:4rem;--bq-spacing-xxl4:4.5rem;--bq-stroke-s:1px;--bq-stroke-m:2px;--bq-stroke-l:3px}.beeq:not([bq-mode]),.light,:root:not([bq-theme]):not([bq-mode]),:root[bq-theme=beeq]:not([bq-mode]),[bq-mode=light]{--bq-background--primary:var(--bq-white);--bq-background--secondary:var(--bq-neutral-100);--bq-background--tertiary:var(--bq-neutral-200);--bq-background--alt:var(--bq-neutral-300);--bq-background--inverse:var(--bq-neutral-900);--bq-background--brand:var(--bq-brand);--bq-background--overlay:var(--bq-neutral-900);--bq-icon--primary:var(--bq-neutral-800);--bq-icon--alt:var(--bq-white);--bq-icon--secondary:var(--bq-neutral-600);--bq-icon--inverse:var(--bq-neutral-50);--bq-icon--brand:var(--bq-brand);--bq-icon--info:var(--bq-brand);--bq-icon--success:var(--bq-success);--bq-icon--warning:var(--bq-warning);--bq-icon--danger:var(--bq-danger);--bq-stroke--primary:var(--bq-neutral-200);--bq-stroke--secondary:var(--bq-neutral-600);--bq-stroke--tertiary:var(--bq-neutral-900);--bq-stroke--inverse:var(--bq-white);--bq-stroke--brand:var(--bq-brand);--bq-stroke--alt:var(--bq-neutral-50);--bq-stroke--success:var(--bq-success);--bq-stroke--warning:var(--bq-warning);--bq-stroke--danger:var(--bq-danger);--bq-stroke--info:var(--bq-brand);--bq-text--primary:var(--bq-neutral-800);--bq-text--secondary:var(--bq-neutral-600);--bq-text--inverse:var(--bq-neutral-50);--bq-text--brand:var(--bq-brand);--bq-text--alt:var(--bq-white);--bq-text--info:var(--bq-brand);--bq-text--success:var(--bq-success);--bq-text--warning:var(--bq-warning);--bq-text--danger:var(--bq-danger);--bq-ui--primary:var(--bq-white);--bq-ui--secondary:var(--bq-neutral-100);--bq-ui--tertiary:var(--bq-neutral-500);--bq-ui--inverse:var(--bq-neutral-900);--bq-ui--brand:var(--bq-brand);--bq-ui--brand-alt:var(--bq-brand-light);--bq-ui--alt:var(--bq-neutral-50);--bq-ui--success:var(--bq-success);--bq-ui--success-alt:var(--bq-success-light);--bq-ui--warning:var(--bq-warning);--bq-ui--warning-alt:var(--bq-warning-light);--bq-ui--danger:var(--bq-danger);--bq-ui--danger-alt:var(--bq-danger-light);--bq-ui--info:var(--bq-brand);--bq-ui--info-alt:var(--bq-brand-light);--bq-hover:#bcbfc5;--bq-active:#444546}.dark,[bq-mode=dark]{--bq-background--primary:var(--bq-neutral-1000);--bq-background--secondary:var(--bq-neutral-950);--bq-background--tertiary:var(--bq-neutral-800);--bq-background--alt:var(--bq-neutral-700);--bq-background--inverse:var(--bq-neutral-600);--bq-background--brand:var(--bq-brand);--bq-background--overlay:var(--bq-neutral-900);--bq-icon--primary:var(--bq-neutral-100);--bq-icon--secondary:var(--bq-neutral-400);--bq-icon--inverse:var(--bq-neutral-800);--bq-icon--brand:var(--bq-brand);--bq-icon--alt:var(--bq-white);--bq-icon--info:var(--bq-brand);--bq-icon--success:var(--bq-success);--bq-icon--warning:var(--bq-warning);--bq-icon--danger:var(--bq-danger);--bq-stroke--primary:var(--bq-neutral-900);--bq-stroke--secondary:var(--bq-neutral-700);--bq-stroke--tertiary:var(--bq-neutral-400);--bq-stroke--inverse:var(--bq-neutral-950);--bq-stroke--brand:var(--bq-brand);--bq-stroke--alt:var(--bq-neutral-1000);--bq-stroke--success:var(--bq-success);--bq-stroke--warning:var(--bq-warning);--bq-stroke--danger:var(--bq-danger);--bq-stroke--info:var(--bq-brand);--bq-text--primary:var(--bq-neutral-100);--bq-text--secondary:var(--bq-neutral-400);--bq-text--inverse:var(--bq-neutral-800);--bq-text--brand:var(--bq-brand);--bq-text--alt:var(--bq-white);--bq-text--info:var(--bq-brand);--bq-text--success:var(--bq-success);--bq-text--warning:var(--bq-warning);--bq-text--danger:var(--bq-danger);--bq-ui--primary:var(--bq-neutral-900);--bq-ui--secondary:var(--bq-neutral-950);--bq-ui--tertiary:var(--bq-neutral-700);--bq-ui--inverse:var(--bq-neutral-100);--bq-ui--brand:var(--bq-brand);--bq-ui--brand-alt:var(--bq-brand-dark);--bq-ui--alt:var(--bq-neutral-950);--bq-ui--success:var(--bq-success);--bq-ui--success-alt:var(--bq-success-dark);--bq-ui--warning:var(--bq-warning);--bq-ui--warning-alt:var(--bq-warning-dark);--bq-ui--danger:var(--bq-danger);--bq-ui--danger-alt:var(--bq-danger-dark);--bq-ui--info:var(--bq-brand);--bq-ui--info-alt:var(--bq-brand-dark);--bq-hover:#444546;--bq-active:#1f2026}:where(.endava),:where([bq-theme=endava]){--bq-font-family:"Poppins",sans-serif;--bq-white:#fafbfb;--bq-black:#030406;--bq-neutral-50:var(--bq-endava-grey-50);--bq-neutral-100:var(--bq-endava-grey-100);--bq-neutral-200:var(--bq-endava-grey-200);--bq-neutral-300:var(--bq-endava-grey-300);--bq-neutral-400:var(--bq-endava-grey-400);--bq-neutral-500:var(--bq-endava-grey-500);--bq-neutral-600:var(--bq-endava-grey-600);--bq-neutral-700:var(--bq-endava-grey-700);--bq-neutral-800:var(--bq-endava-grey-800);--bq-neutral-900:var(--bq-endava-grey-900);--bq-neutral-950:var(--bq-endava-grey-950);--bq-neutral-1000:var(--bq-endava-grey-1000);--bq-brand-light:var(--bq-endava-orange-100);--bq-brand:var(--bq-endava-orange-600);--bq-brand-dark:var(--bq-endava-orange-1000);--bq-accent-light:var(--bq-endava-orange-100);--bq-accent:var(--bq-endava-orange-600);--bq-accent-dark:var(--bq-endava-orange-1000);--bq-success-light:var(--bq-green-100);--bq-success:var(--bq-green-600);--bq-success-dark:var(--bq-green-1000);--bq-danger-light:var(--bq-corai-100);--bq-danger:var(--bq-corai-600);--bq-danger-dark:var(--bq-corai-1000);--bq-warning-light:var(--bq-yellow-100);--bq-warning:var(--bq-yellow-600);--bq-warning-dark:var(--bq-yellow-1000);--bq-info-light:var(--bq-blue-100);--bq-info:var(--bq-blue-600);--bq-info-dark:var(--bq-blue-1000);--bq-focus:var(--bq-endava-orange-600);--bq-data-01:var(--bq-brand);--bq-data-02:#af0cd8;--bq-data-03:#0ca8d8;--bq-data-04:var(--bq-teal-600);--bq-data-05:var(--bq-yellow-600);--bq-data-06:var(--bq-orange-600);--bq-data-07:var(--bq-blue-600);--bq-data-08:var(--bq-red-600);--bq-data-09:var(--bq-purple-600);--bq-data-10:#394b56;--bq-data-11:var(--bq-black);--bq-data-12:var(--bq-white)}.endava.light,.endava:not([bq-mode]),[bq-theme=endava]:not([bq-mode]),[bq-theme=endava][bq-mode=light]{--bq-background--primary:var(--bq-white);--bq-background--secondary:var(--bq-neutral-100);--bq-background--tertiary:var(--bq-neutral-200);--bq-background--alt:var(--bq-neutral-300);--bq-background--inverse:var(--bq-neutral-900);--bq-background--brand:var(--bq-brand);--bq-background--overlay:var(--bq-neutral-900);--bq-icon--primary:var(--bq-neutral-800);--bq-icon--secondary:var(--bq-neutral-600);--bq-icon--inverse:var(--bq-neutral-50);--bq-icon--brand:var(--bq-brand);--bq-icon--alt:var(--bq-white);--bq-icon--info:var(--bq-info);--bq-icon--success:var(--bq-success);--bq-icon--warning:var(--bq-warning);--bq-icon--danger:var(--bq-danger);--bq-stroke--primary:var(--bq-neutral-200);--bq-stroke--secondary:var(--bq-neutral-600);--bq-stroke--tertiary:var(--bq-neutral-900);--bq-stroke--inverse:var(--bq-white);--bq-stroke--brand:var(--bq-brand);--bq-stroke--alt:var(--bq-neutral-50);--bq-stroke--brand-alt:var(--bq-brand-light);--bq-stroke--success:var(--bq-success);--bq-stroke--warning:var(--bq-warning);--bq-stroke--danger:var(--bq-danger);--bq-stroke--info:var(--bq-info);--bq-text--primary:var(--bq-neutral-800);--bq-text--secondary:var(--bq-neutral-600);--bq-text--inverse:var(--bq-neutral-50);--bq-text--brand:var(--bq-brand);--bq-text--alt:var(--bq-white);--bq-text--info:var(--bq-info);--bq-text--success:var(--bq-success);--bq-text--warning:var(--bq-warning);--bq-text--danger:var(--bq-danger);--bq-ui--primary:var(--bq-white);--bq-ui--secondary:var(--bq-neutral-100);--bq-ui--tertiary:var(--bq-neutral-500);--bq-ui--inverse:var(--bq-neutral-900);--bq-ui--alt:var(--bq-neutral-50);--bq-ui--brand-alt:var(--bq-brand-light);--bq-ui--brand:var(--bq-brand);--bq-ui--success:var(--bq-success);--bq-ui--success-alt:var(--bq-success-light);--bq-ui--warning:var(--bq-warning);--bq-ui--warning-alt:var(--bq-warning-light);--bq-ui--danger:var(--bq-danger);--bq-ui--danger-alt:var(--bq-danger-light);--bq-ui--info:var(--bq-info);--bq-ui--info-alt:var(--bq-info-light);--bq-hover:#444546;--bq-active:#1f2026}.endava.dark,[bq-theme=endava][bq-mode=dark]{--bq-background--primary:var(--bq-neutral-1000);--bq-background--secondary:var(--bq-neutral-900);--bq-background--tertiary:var(--bq-neutral-800);--bq-background--alt:var(--bq-neutral-700);--bq-background--inverse:var(--bq-neutral-600);--bq-background--brand:var(--bq-brand);--bq-background--overlay:var(--bq-neutral-900);--bq-icon--primary:var(--bq-neutral-100);--bq-icon--secondary:var(--bq-neutral-400);--bq-icon--inverse:var(--bq-neutral-800);--bq-icon--brand:var(--bq-brand);--bq-icon--alt:var(--bq-white);--bq-icon--info:var(--bq-info);--bq-icon--success:var(--bq-success);--bq-icon--warning:var(--bq-warning);--bq-icon--danger:var(--bq-danger);--bq-stroke--primary:var(--bq-neutral-900);--bq-stroke--secondary:var(--bq-neutral-700);--bq-stroke--tertiary:var(--bq-neutral-400);--bq-stroke--inverse:var(--bq-neutral-950);--bq-stroke--brand:var(--bq-brand);--bq-stroke--brand-alt:var(--bq-brand-dark);--bq-stroke--alt:var(--bq-neutral-1000);--bq-stroke--success:var(--bq-success);--bq-stroke--warning:var(--bq-warning);--bq-stroke--danger:var(--bq-danger);--bq-stroke--info:var(--bq-info);--bq-text--primary:var(--bq-neutral-100);--bq-text--secondary:var(--bq-neutral-400);--bq-text--inverse:var(--bq-neutral-800);--bq-text--brand:var(--bq-brand);--bq-text--alt:var(--bq-neutral-white);--bq-text--info:var(--bq-info);--bq-text--success:var(--bq-success);--bq-text--warning:var(--bq-warning);--bq-text--danger:var(--bq-danger);--bq-ui--primary:var(--bq-neutral-900);--bq-ui--secondary:var(--bq-neutral-950);--bq-ui--tertiary:var(--bq-neutral-700);--bq-ui--inverse:var(--bq-neutral-100);--bq-ui--brand:var(--bq-brand);--bq-ui--brand-alt:var(--bq-brand-dark);--bq-ui--alt:var(--bq-neutral-950);--bq-ui--success:var(--bq-success);--bq-ui--success-alt:var(--bq-success-dark);--bq-ui--warning:var(--bq-warning);--bq-ui--warning-alt:var(--bq-warning-dark);--bq-ui--danger:var(--bq-danger);--bq-ui--danger-alt:var(--bq-danger-dark);--bq-ui--info:var(--bq-info);--bq-ui--info-alt:var(--bq-info-dark);--bq-hover:#444546;--bq-active:#1f2026}.block{display:block}.flex{display:flex}@-webkit-keyframes fade-in{0%{opacity:0}}@keyframes fade-in{0%{opacity:0}}@-webkit-keyframes slide-in{0%{-webkit-transform:translateY(10px);transform:translateY(10px)}}@keyframes slide-in{0%{-webkit-transform:translateY(10px);transform:translateY(10px)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}:host{--bq-date-picker--background-color:var(--bq-ui--primary);--bq-date-picker--border-color:var(--bq-stroke--tertiary);--bq-date-picker--border-color-disabled:var(--bq-stroke--secondary);--bq-date-picker--border-color-focus:var(--bq-stroke--brand);--bq-date-picker--border-radius:var(--bq-radius--s);--bq-date-picker--border-style:solid;--bq-date-picker--border-width:1px;--bq-date-picker--currentDate-border-color:var(--bq-stroke--brand);--bq-date-picker--currentDate-border-width:2px;--bq-date-picker--day-size:2.25rem;--bq-date-picker--gap:var(--bq-spacing-xs);--bq-date-picker--header-title-color:var(--bq-text--primary);--bq-date-picker--icon-size:1.5rem;--bq-date-picker--label-margin-bottom:var(--bq-spacing-xs);--bq-date-picker--label-text-color:var(--bq-text--primary);--bq-date-picker--label-text-size:0.875rem;--bq-date-picker--padding-end:var(--bq-spacing-m);--bq-date-picker--padding-start:var(--bq-spacing-m);--bq-date-picker--paddingY:var(--bq-spacing-s);--bq-date-picker--range-background-color:var(--bq-ui--brand);--bq-date-picker--range-inner-background-color:var(--bq-ui--brand-alt);--bq-date-picker--row-gap:0.125rem;--bq-date-picker--text-color:var(--bq-text--primary);--bq-date-picker--text-placeholder-color:var(--bq-text--secondary);--bq-date-picker--text-size:1rem;--bq-date-picker--view-cell-background-hover:var(--bq-ui--secondary);--bq-date-picker--view-cell-background-selected:var(--bq-ui--brand);--bq-date-picker--view-cell-height:2.75rem;--bq-date-picker--view-cell-radius:0.5rem;--bq-date-picker--view-cell-text-selected:var(--bq-text--alt);-webkit-box-sizing:border-box;box-sizing:border-box;display:block;inline-size:100%}.bq-date-picker__label.is-hidden,.bq-date-picker__prefix.is-hidden{display:none}.bq-date-picker__label{-webkit-box-align:center;-ms-flex-align:center;-webkit-margin-after:var(--bq-date-picker--label-margin-bottom);align-items:center;color:var(--bq-date-picker--label-text-color);display:-webkit-box;display:-ms-flexbox;display:flex;font-size:var(--bq-date-picker--label-text-size);gap:var(--bq-date-picker--gap);margin-block-end:var(--bq-date-picker--label-margin-bottom)}.bq-date-picker__dropdown{display:block;inline-size:100%}.bq-date-picker__dropdown::part(panel){--bq-panel--width:max-content;block-size:auto;inline-size:-webkit-max-content;inline-size:-moz-max-content;inline-size:max-content;max-inline-size:min(100vw - 2rem,100vw);padding:1rem}.bq-date-picker__control{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--bq-date-picker--background-color);border:var(--bq-date-picker--border-width) var(--bq-date-picker--border-style) var(--bq-date-picker--border-color);border-radius:var(--bq-date-picker--border-radius);color:var(--bq-date-picker--text-color);display:-webkit-box;display:-ms-flexbox;display:flex;font-size:var(--bq-date-picker--text-size);inline-size:100%;padding-block:var(--bq-date-picker--paddingY);padding-inline:var(--bq-date-picker--padding-start) var(--bq-date-picker--padding-end);-webkit-transition:border-color .15s ease,-webkit-box-shadow .15s ease;transition:border-color .15s ease,-webkit-box-shadow .15s ease;transition:border-color .15s ease,box-shadow .15s ease;transition:border-color .15s ease,box-shadow .15s ease,-webkit-box-shadow .15s ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.bq-date-picker__control:not(.is-disabled,:focus-within,.is-open):hover{border-color:color-mix(in srgb,var(--bq-date-picker--border-color-focus),var(--bq-hover) 20%)}.bq-date-picker__control:not(.is-disabled):is(:focus-within,.is-open){--bq-ring-width:1px;--bq-ring-offset-width:0;--bq-ring-color-focus:var(--bq-focus);border-color:var(--bq-focus);outline:var(--bq-ring-width) solid var(--bq-ring-color-focus);outline-offset:var(--bq-ring-offset-width)}.bq-date-picker__control.is-disabled{--bq-date-picker--border-color:var(--bq-date-picker--border-color-disabled);cursor:not-allowed;opacity:.6}.bq-date-picker__control.validation-error,.bq-date-picker__control.validation-success,.bq-date-picker__control.validation-warning{--bq-date-picker--border-color:var(--bq-date-picker--validation-color)}.bq-date-picker__control.validation-error:not(.is-disabled,:focus-within,.is-open):hover,.bq-date-picker__control.validation-success:not(.is-disabled,:focus-within,.is-open):hover,.bq-date-picker__control.validation-warning:not(.is-disabled,:focus-within,.is-open):hover{border-color:color-mix(in srgb,var(--bq-date-picker--validation-color),var(--bq-hover) 20%)}.bq-date-picker__control.validation-error:not(.is-disabled):is(:focus-within,.is-open),.bq-date-picker__control.validation-success:not(.is-disabled):is(:focus-within,.is-open),.bq-date-picker__control.validation-warning:not(.is-disabled):is(:focus-within,.is-open){--bq-ring-color-focus:var(--bq-date-picker--validation-color);border-color:color-mix(in srgb,var(--bq-date-picker--validation-color),var(--bq-active) 20%)}.bq-date-picker__control.validation-error{--bq-date-picker--validation-color:var(--bq-stroke--danger)}.bq-date-picker__control.validation-success{--bq-date-picker--validation-color:var(--bq-stroke--success)}.bq-date-picker__control.validation-warning{--bq-date-picker--validation-color:var(--bq-stroke--warning)}.bq-date-picker__input{-webkit-box-flex:1;background:transparent;border:none;color:inherit;-ms-flex:1 1 auto;flex:1 1 auto;font:inherit;font-size:inherit;margin:0;min-inline-size:0;padding:0}.bq-date-picker__input::-webkit-input-placeholder{color:var(--bq-date-picker--text-placeholder-color)}.bq-date-picker__input::-moz-placeholder{color:var(--bq-date-picker--text-placeholder-color)}.bq-date-picker__input:-ms-input-placeholder{color:var(--bq-date-picker--text-placeholder-color)}.bq-date-picker__input::-ms-input-placeholder{color:var(--bq-date-picker--text-placeholder-color)}.bq-date-picker__input::placeholder{color:var(--bq-date-picker--text-placeholder-color)}.bq-date-picker__input:focus,.bq-date-picker__input:focus-visible{outline:none}.bq-date-picker__prefix{-webkit-box-align:center;-ms-flex-align:center;-webkit-margin-end:var(--bq-date-picker--gap);align-items:center;color:var(--bq-date-picker--text-color);margin-inline-end:var(--bq-date-picker--gap);pointer-events:none}.bq-date-picker__prefix,.bq-date-picker__prefix bq-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.bq-date-picker__prefix bq-icon{font-size:var(--bq-date-picker--icon-size)}.bq-date-picker__calendar-trigger,.bq-date-picker__clear{-webkit-margin-start:var(--bq-date-picker--gap);margin-inline-start:var(--bq-date-picker--gap)}.bq-date-picker__calendar-trigger::part(button),.bq-date-picker__clear::part(button){--bq-ring-width:initial;--bq-ring-offset-width:initial;border:none;padding:0}.bq-date-picker__calendar-trigger bq-icon,.bq-date-picker__clear bq-icon{display:-webkit-box;display:-ms-flexbox;display:flex}.bq-date-picker__clear{display:none}.bq-date-picker__control:is(:hover,:focus-within,.is-open):not(.is-disabled) .bq-date-picker__clear{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.bq-date-picker__calendar-trigger{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.bq-date-picker__calendar{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:var(--bq-date-picker--background-color);color:var(--bq-date-picker--text-color);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:.75rem;min-inline-size:17.5rem}.bq-date-picker__header{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:grid;gap:.25rem;grid-template-columns:auto 1fr auto}.bq-date-picker__nav-button::part(button){block-size:2rem;inline-size:2rem}.bq-date-picker__heading::part(button){font-weight:600}.bq-date-picker__heading--static{pointer-events:none}.bq-date-picker__panels{-webkit-box-orient:horizontal;-webkit-box-align:start;-ms-flex-align:start;-webkit-box-pack:center;-ms-flex-pack:center;align-items:flex-start;-ms-flex-flow:row wrap;flex-flow:row wrap;gap:1rem;justify-content:center}.bq-date-picker__panel,.bq-date-picker__panels{-webkit-box-direction:normal;display:-webkit-box;display:-ms-flexbox;display:flex}.bq-date-picker__panel{-webkit-box-orient:vertical;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-direction:column;flex-direction:column;gap:.5rem}.bq-date-picker__month-label{color:var(--bq-date-picker--header-title-color);font-weight:600;text-align:center}@media (width <= 40rem){.bq-date-picker__panels{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column}}.bq-date-picker__table{border-collapse:collapse;border-spacing:0;font-size:inherit;inline-size:100%}.bq-date-picker__th{color:var(--bq-date-picker--text-placeholder-color);font-size:.75rem;font-weight:500;padding-block:.25rem;text-align:center;text-transform:uppercase}.bq-date-picker__td{padding:0;padding-block:var(--bq-date-picker--row-gap);text-align:center}.bq-date-picker__day{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:center;-ms-flex-pack:center;align-items:center;background:transparent;block-size:var(--bq-date-picker--day-size);border:none;border-radius:var(--bq-date-picker--view-cell-radius);color:inherit;cursor:pointer;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font:inherit;inline-size:var(--bq-date-picker--day-size);justify-content:center;padding:0;-webkit-transition:background-color .15s ease,color .15s ease;transition:background-color .15s ease,color .15s ease}.bq-date-picker__day:hover:not([aria-disabled=true],.is-selected){background-color:var(--bq-date-picker--view-cell-background-hover)}.bq-date-picker__day:focus-visible{outline:2px solid var(--bq-date-picker--border-color-focus);outline-offset:-2px}.bq-date-picker__day.is-disallowed,.bq-date-picker__day.is-out-of-bounds,.bq-date-picker__day[aria-disabled=true]{cursor:not-allowed;opacity:.35}.bq-date-picker__day.is-outside{color:var(--bq-date-picker--text-placeholder-color)}.bq-date-picker__day.is-hidden{pointer-events:none;visibility:hidden}.bq-date-picker__day.is-today:not(.is-selected){border:var(--bq-date-picker--currentDate-border-width) var(--bq-date-picker--border-style) var(--bq-date-picker--currentDate-border-color)}.bq-date-picker__day.is-selected{color:var(--bq-date-picker--view-cell-text-selected)}.bq-date-picker__day.is-selected,.bq-date-picker__day.is-selected:hover:not([aria-disabled=true]){background-color:var(--bq-date-picker--view-cell-background-selected)}.bq-date-picker__day.is-range-inner{background-color:var(--bq-date-picker--range-inner-background-color);border-radius:0;color:var(--bq-date-picker--text-color)}.bq-date-picker__day.is-range-start{border-end-end-radius:0;border-start-end-radius:0}.bq-date-picker__day.is-range-end,.bq-date-picker__day.is-range-start{background-color:var(--bq-date-picker--range-background-color);color:var(--bq-date-picker--view-cell-text-selected)}.bq-date-picker__day.is-range-end{border-end-start-radius:0;border-start-start-radius:0}.bq-date-picker__day.is-range-start.is-range-end{border-radius:var(--bq-date-picker--view-cell-radius)}.bq-date-picker__view{min-inline-size:calc(var(--bq-date-picker--panel-count, 1)*var(--bq-date-picker--day-size)*7 + max(0,var(--bq-date-picker--panel-count, 1) - 1)*1rem)}.bq-date-picker__months,.bq-date-picker__years{-webkit-box-orient:vertical;-webkit-box-direction:normal;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:.5rem;padding-block:.5rem}.bq-date-picker__month-row,.bq-date-picker__year-row{display:grid;gap:.5rem;grid-template-columns:repeat(3,1fr)}.bq-date-picker__months[data-grid-columns="4"] .bq-date-picker__month-row,.bq-date-picker__years[data-grid-columns="4"] .bq-date-picker__year-row{grid-template-columns:repeat(4,1fr)}.bq-date-picker__month-gridcell,.bq-date-picker__year-gridcell{min-inline-size:0}@media (width <= 40rem){.bq-date-picker__view{min-inline-size:auto}}.bq-date-picker__month-cell,.bq-date-picker__year-cell{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:center;-ms-flex-pack:center;align-items:center;background:transparent;block-size:var(--bq-date-picker--view-cell-height);border:none;border-radius:var(--bq-date-picker--view-cell-radius);color:inherit;cursor:pointer;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font:inherit;inline-size:100%;justify-content:center;padding-block:.5rem;padding-inline:.5rem;-webkit-transition:background-color .15s ease,color .15s ease;transition:background-color .15s ease,color .15s ease}.bq-date-picker__month-cell:hover:not(:disabled,.is-selected),.bq-date-picker__year-cell:hover:not(:disabled,.is-selected){background-color:var(--bq-date-picker--view-cell-background-hover)}.bq-date-picker__month-cell:focus-visible,.bq-date-picker__year-cell:focus-visible{outline:2px solid var(--bq-date-picker--border-color-focus);outline-offset:1px}.bq-date-picker__month-cell.is-selected,.bq-date-picker__year-cell.is-selected{background-color:var(--bq-date-picker--view-cell-background-selected);color:var(--bq-date-picker--view-cell-text-selected)}.bq-date-picker__month-cell.is-range-inner,.bq-date-picker__year-cell.is-range-inner{background-color:var(--bq-date-picker--range-inner-background-color);color:var(--bq-date-picker--text-color)}.bq-date-picker__month-cell.is-out-of-bounds,.bq-date-picker__month-cell:disabled,.bq-date-picker__year-cell.is-out-of-bounds,.bq-date-picker__year-cell:disabled{cursor:not-allowed;opacity:.35}@media (prefers-reduced-motion:reduce){.bq-date-picker__control,.bq-date-picker__day,.bq-date-picker__month-cell,.bq-date-picker__year-cell{-webkit-transition:none;transition:none}}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.table{display:table}.grid{display:grid}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.focus{outline:var(--bq-ring-width,2px) solid var(--bq-ring-color-focus,var(--bq-focus));outline-offset:var(--bq-ring-offset-width,1px)}.ms-\\[--bq-date-picker--gap\\]{margin-inline-start:var(--bq-date-picker--gap)}.\\!hidden{display:none!important}.hidden{display:none}.\\[\\&\\:\\:part\\(button\\)\\]\\:border-none::part(button){border-style:none}.\\[\\&\\:\\:part\\(button\\)\\]\\:p-0::part(button){padding:0}`;
|
|
945
|
+
|
|
946
|
+
/** Compose the default constraint-validation message for a set of flags. */
|
|
947
|
+
const defaultValidityMessage = (flags) => {
|
|
948
|
+
if (flags.badInput)
|
|
949
|
+
return 'Please, input or select a valid date';
|
|
950
|
+
if (flags.rangeUnderflow && flags.rangeOverflow)
|
|
951
|
+
return 'Selected value is outside the allowed range';
|
|
952
|
+
if (flags.rangeUnderflow)
|
|
953
|
+
return 'Selected value is before the minimum';
|
|
954
|
+
return 'Selected value is after the maximum';
|
|
955
|
+
};
|
|
125
956
|
const BqDatePicker = class {
|
|
126
957
|
constructor(hostRef) {
|
|
127
958
|
registerInstance(this, hostRef);
|
|
@@ -129,6 +960,7 @@ const BqDatePicker = class {
|
|
|
129
960
|
this.bqChange = createEvent(this, "bqChange");
|
|
130
961
|
this.bqClear = createEvent(this, "bqClear");
|
|
131
962
|
this.bqFocus = createEvent(this, "bqFocus");
|
|
963
|
+
this.bqViewChange = createEvent(this, "bqViewChange");
|
|
132
964
|
if (hostRef.$hostElement$["s-ei"]) {
|
|
133
965
|
this.internals = hostRef.$hostElement$["s-ei"];
|
|
134
966
|
}
|
|
@@ -139,12 +971,24 @@ const BqDatePicker = class {
|
|
|
139
971
|
}
|
|
140
972
|
// Own Properties
|
|
141
973
|
// ====================
|
|
142
|
-
|
|
974
|
+
/**
|
|
975
|
+
* Memoized parsed selection. Key encodes both `value` and `type` so cache
|
|
976
|
+
* misses invalidate correctly. Value derives from `value`; not promoted to
|
|
977
|
+
* `@State()` to preserve a single source of truth.
|
|
978
|
+
*/
|
|
979
|
+
cachedSelection;
|
|
980
|
+
/** Sticky flag: last typed input couldn't be parsed. Cleared on next successful commit or `clear()`. */
|
|
981
|
+
hasBadInput = false;
|
|
982
|
+
/** Initial `value` captured at load time, restored on form reset. */
|
|
983
|
+
initialValue;
|
|
143
984
|
inputElem;
|
|
144
|
-
|
|
985
|
+
/** Set while `commitSelection` writes back to `this.value`. */
|
|
986
|
+
isCommittingSelection = false;
|
|
145
987
|
labelElem;
|
|
988
|
+
/** Pending requestAnimationFrame id used by `focusButton`. */
|
|
989
|
+
pendingFocusRAF;
|
|
146
990
|
prefixElem;
|
|
147
|
-
|
|
991
|
+
triggerBtnElem;
|
|
148
992
|
// Reference to host HTML element
|
|
149
993
|
// ===================================
|
|
150
994
|
internals;
|
|
@@ -152,158 +996,275 @@ const BqDatePicker = class {
|
|
|
152
996
|
// State() variables
|
|
153
997
|
// Inlined decorator, alphabetical order
|
|
154
998
|
// =======================================
|
|
155
|
-
|
|
156
|
-
focusedDate;
|
|
999
|
+
decadeStart = getDecadeStart(new Date().getFullYear());
|
|
157
1000
|
displayDate;
|
|
1001
|
+
focusedISO = getTodayISO();
|
|
1002
|
+
focusedMonth = new Date().getMonth();
|
|
1003
|
+
focusedYear = new Date().getFullYear();
|
|
1004
|
+
hasConstraintError = false;
|
|
158
1005
|
hasLabel = false;
|
|
159
1006
|
hasPrefix = false;
|
|
160
|
-
hasRangeEnd = false;
|
|
161
|
-
hasSuffix = false;
|
|
162
1007
|
hasValue = false;
|
|
1008
|
+
tentativeHover;
|
|
1009
|
+
view = 'days';
|
|
1010
|
+
viewDate = new Date();
|
|
163
1011
|
// Public Property API
|
|
164
1012
|
// ========================
|
|
165
|
-
/** If `true`, the Date picker input will be focused on component render */
|
|
166
|
-
autofocus;
|
|
167
|
-
/** The clear button aria label */
|
|
1013
|
+
/** If `true`, the Date picker input will be focused on component render. */
|
|
1014
|
+
autofocus = false;
|
|
1015
|
+
/** The clear button aria label. */
|
|
168
1016
|
clearButtonLabel = 'Clear value';
|
|
169
|
-
/**
|
|
1017
|
+
/** The aria-label for the calendar trigger button. */
|
|
1018
|
+
calendarButtonLabel = 'Open calendar';
|
|
1019
|
+
/** If `true`, the clear button won't be displayed. */
|
|
170
1020
|
disableClear = false;
|
|
171
|
-
/**
|
|
172
|
-
* Indicates whether the Date picker input is disabled or not.
|
|
173
|
-
* If `true`, the Date picker is disabled and cannot be interacted with.
|
|
174
|
-
*/
|
|
1021
|
+
/** Indicates whether the Date picker input is disabled or not. */
|
|
175
1022
|
disabled = false;
|
|
176
|
-
/**
|
|
1023
|
+
/** Distance (gutter) between the Date picker panel and the input element. */
|
|
177
1024
|
distance = 8;
|
|
178
|
-
/** The first day of the week, where Sunday is 0, Monday is 1, etc */
|
|
1025
|
+
/** The first day of the week, where Sunday is 0, Monday is 1, etc. */
|
|
179
1026
|
firstDayOfWeek = 1;
|
|
180
|
-
/**
|
|
181
|
-
*
|
|
1027
|
+
/**
|
|
1028
|
+
* Options used when formatting the displayed value.
|
|
1029
|
+
*
|
|
1030
|
+
* When omitted, sensible defaults are picked based on `precision`:
|
|
1031
|
+
* - `day` → `{ day: 'numeric', month: 'short', year: 'numeric' }`
|
|
1032
|
+
* - `month` → `{ month: 'long', year: 'numeric' }`
|
|
1033
|
+
* - `year` → `{ year: 'numeric' }`
|
|
182
1034
|
*/
|
|
183
|
-
formatOptions
|
|
184
|
-
|
|
185
|
-
month: 'short',
|
|
186
|
-
year: 'numeric',
|
|
187
|
-
};
|
|
188
|
-
/** The ID of the form that the Date picker input belongs to. */
|
|
1035
|
+
formatOptions;
|
|
1036
|
+
/** The ID of the form the input belongs to. */
|
|
189
1037
|
form;
|
|
190
|
-
/**
|
|
1038
|
+
/** Native form validation message (mandatory if `required` is set). */
|
|
191
1039
|
formValidationMessage;
|
|
192
|
-
/**
|
|
1040
|
+
/** The view opened first when the panel becomes visible. */
|
|
1041
|
+
initialView = 'days';
|
|
1042
|
+
/** Predicate that marks specific dates as unselectable. */
|
|
193
1043
|
isDateDisallowed;
|
|
194
|
-
/**
|
|
195
|
-
* Details: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument
|
|
196
|
-
*/
|
|
1044
|
+
/** Locale used for formatting dates. */
|
|
197
1045
|
locale = 'en-GB';
|
|
198
|
-
/**
|
|
1046
|
+
/** Latest date that can be selected (ISO). */
|
|
199
1047
|
max;
|
|
200
|
-
/**
|
|
1048
|
+
/** Earliest date that can be selected (ISO). */
|
|
201
1049
|
min;
|
|
202
|
-
/** Number of months to show when range is `true` */
|
|
203
|
-
months;
|
|
204
1050
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
1051
|
+
* Number of months to show side by side (range / multi). Capped at 2.
|
|
1052
|
+
* Larger values are silently clamped to keep the popover from overflowing
|
|
1053
|
+
* the viewport and to preserve keyboard navigation semantics.
|
|
1054
|
+
*/
|
|
1055
|
+
months = 1;
|
|
1056
|
+
/**
|
|
1057
|
+
* How the next/previous buttons should navigate the calendar.
|
|
1058
|
+
* - single: navigate one month at a time.
|
|
1059
|
+
* - months: navigate by the number of months displayed.
|
|
208
1060
|
*/
|
|
209
1061
|
monthsPerView = 'single';
|
|
210
1062
|
/** The Date picker input name. */
|
|
211
1063
|
name;
|
|
212
|
-
/** If `true`, the
|
|
1064
|
+
/** If `true`, the panel is visible. */
|
|
213
1065
|
open = false;
|
|
214
|
-
/**
|
|
1066
|
+
/** Overrides the height of the Date picker panel. */
|
|
215
1067
|
panelHeight = 'auto';
|
|
216
|
-
/**
|
|
1068
|
+
/** Placeholder text shown when no value is selected. */
|
|
217
1069
|
placeholder;
|
|
218
|
-
/** Position of the Date picker panel */
|
|
1070
|
+
/** Position of the Date picker panel. */
|
|
219
1071
|
placement = 'bottom-end';
|
|
220
|
-
/**
|
|
221
|
-
|
|
222
|
-
|
|
1072
|
+
/**
|
|
1073
|
+
* Precision of the value produced by the picker.
|
|
1074
|
+
*
|
|
1075
|
+
* - `day` → `YYYY-MM-DD` (default). Standard drill-down.
|
|
1076
|
+
* - `month` → `YYYY-MM`. Selection commits on the months view; no days view.
|
|
1077
|
+
* - `year` → `YYYY`. Selection commits on the years view; no months/days view.
|
|
1078
|
+
*
|
|
1079
|
+
* When precision is coarser than day, `initialView` is forced to match and
|
|
1080
|
+
* the header title cycles through the views available for that precision.
|
|
1081
|
+
*/
|
|
1082
|
+
precision = 'day';
|
|
1083
|
+
/** Whether a value must be selected before submitting the form. */
|
|
1084
|
+
required = false;
|
|
1085
|
+
/** Skidding between the panel and the input element. */
|
|
223
1086
|
skidding = 0;
|
|
224
|
-
/** Whether to
|
|
1087
|
+
/** Whether to render days outside the current month. */
|
|
225
1088
|
showOutsideDays = false;
|
|
226
|
-
/**
|
|
1089
|
+
/** Positioning strategy for the panel. */
|
|
227
1090
|
strategy = 'fixed';
|
|
228
|
-
/**
|
|
229
|
-
|
|
230
|
-
|
|
1091
|
+
/**
|
|
1092
|
+
* Selection type.
|
|
1093
|
+
* - `single`: single date.
|
|
1094
|
+
* - `multi`: multiple discrete dates.
|
|
1095
|
+
* - `range`: contiguous range.
|
|
1096
|
+
*/
|
|
231
1097
|
type = 'single';
|
|
1098
|
+
/** Validation state applied to the input. */
|
|
1099
|
+
validationStatus = 'none';
|
|
232
1100
|
/**
|
|
233
|
-
*
|
|
1101
|
+
* Currently selected value, in the precision-aware wire format:
|
|
1102
|
+
* - `precision="day"` → tokens are `YYYY-MM-DD`
|
|
1103
|
+
* - `precision="month"` → tokens are `YYYY-MM`
|
|
1104
|
+
* - `precision="year"` → tokens are `YYYY`
|
|
234
1105
|
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* - `
|
|
238
|
-
* - `
|
|
239
|
-
* - `'warning'`: The input has a validation warning.
|
|
240
|
-
* - `'success'`: The input has passed validation.
|
|
1106
|
+
* How multiple tokens are combined depends on `type`:
|
|
1107
|
+
* - `single` → a single token (e.g. `"2025-05-15"`, `"2025-05"`, `"2025"`)
|
|
1108
|
+
* - `range` → `"start/end"` — two tokens joined with `/`
|
|
1109
|
+
* - `multi` → space-separated tokens (e.g. `"2025-05-15 2025-05-20"`)
|
|
241
1110
|
*/
|
|
242
|
-
validationStatus = 'none';
|
|
243
|
-
/** The select input value represents the currently selected date or range and can be used to reset the field to a previous value.
|
|
244
|
-
* All dates are expected in ISO-8601 format (YYYY-MM-DD). */
|
|
245
1111
|
value;
|
|
246
1112
|
// Prop lifecycle events
|
|
247
1113
|
// =======================
|
|
248
1114
|
handleValueChange(newValue, oldValue) {
|
|
249
1115
|
if (newValue === oldValue)
|
|
250
1116
|
return;
|
|
251
|
-
|
|
252
|
-
|
|
1117
|
+
// Normalize invalid tokens before propagating to the form or the UI so
|
|
1118
|
+
// consumers can't submit an invalid wire value while the display shows
|
|
1119
|
+
// nothing. If normalization rewrote the value, reflect it back on the
|
|
1120
|
+
// prop and let the follow-up watcher tick handle the normalized string.
|
|
1121
|
+
const normalized = normalizeValue(newValue, this.type, this.precision);
|
|
1122
|
+
if (normalized !== newValue) {
|
|
1123
|
+
this.value = normalized;
|
|
253
1124
|
return;
|
|
254
|
-
|
|
255
|
-
this.
|
|
256
|
-
this.
|
|
257
|
-
this.
|
|
258
|
-
|
|
1125
|
+
}
|
|
1126
|
+
this.hasBadInput = false;
|
|
1127
|
+
this.syncDerivedFromValue();
|
|
1128
|
+
if (this.isCommittingSelection)
|
|
1129
|
+
return;
|
|
1130
|
+
this.syncViewToValue();
|
|
1131
|
+
}
|
|
1132
|
+
handleFormattingChange() {
|
|
1133
|
+
// Re-format the display without re-parsing the wire value.
|
|
1134
|
+
this.hasValue = computeHasValue(this.value);
|
|
1135
|
+
this.displayDate = computeDisplayDate(this.value, this.type, this.locale, this.effectiveFormatOptions, this.precision);
|
|
1136
|
+
}
|
|
1137
|
+
handleTypeChange() {
|
|
1138
|
+
// `type` affects wire-format parsing, display formatting, and validity.
|
|
1139
|
+
// Re-normalize the current value against the new type; if that rewrites
|
|
1140
|
+
// the value, the `value` watcher takes over. Otherwise refresh derived
|
|
1141
|
+
// state and re-sync the visible calendar range.
|
|
1142
|
+
const normalized = normalizeValue(this.value, this.type, this.precision);
|
|
1143
|
+
if (normalized !== this.value) {
|
|
1144
|
+
this.value = normalized;
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
this.syncDerivedFromValue();
|
|
1148
|
+
this.syncViewToValue();
|
|
1149
|
+
}
|
|
1150
|
+
handlePrecisionChange() {
|
|
1151
|
+
validatePropValue(DATE_PRECISION, 'day', this.el, 'precision');
|
|
1152
|
+
// Precision affects both wire format and default view. Force the calendar
|
|
1153
|
+
// to open on the matching view and re-normalize the current value so
|
|
1154
|
+
// trailing day/month segments are dropped or padded consistently.
|
|
1155
|
+
this.view = this.precisionToView(this.precision);
|
|
1156
|
+
const normalized = normalizeValue(this.value, this.type, this.precision);
|
|
1157
|
+
if (normalized !== this.value) {
|
|
1158
|
+
this.value = normalized;
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
this.syncDerivedFromValue();
|
|
1162
|
+
this.syncViewToValue();
|
|
1163
|
+
}
|
|
1164
|
+
handleBoundsChange() {
|
|
1165
|
+
this.syncValidity();
|
|
1166
|
+
this.syncViewToValue();
|
|
1167
|
+
}
|
|
1168
|
+
handleRequiredChange() {
|
|
1169
|
+
this.syncValidity();
|
|
259
1170
|
}
|
|
260
1171
|
checkPropValues() {
|
|
261
1172
|
validatePropValue(DATE_PICKER_TYPE, 'single', this.el, 'type');
|
|
1173
|
+
validatePropValue(CALENDAR_VIEW, 'days', this.el, 'initialView');
|
|
1174
|
+
validatePropValue(DATE_PRECISION, 'day', this.el, 'precision');
|
|
1175
|
+
validatePropValue(MONTHS_PER_VIEW, 'single', this.el, 'monthsPerView');
|
|
1176
|
+
validatePropValue(FLOATING_STRATEGY, 'fixed', this.el, 'strategy');
|
|
1177
|
+
validatePropValue(FLOATING_PLACEMENT, 'bottom-end', this.el, 'placement');
|
|
1178
|
+
validatePropValue(INPUT_VALIDATION, 'none', this.el, 'validationStatus');
|
|
1179
|
+
validatePropValue(DAYS_OF_WEEK, 1, this.el, 'firstDayOfWeek');
|
|
1180
|
+
}
|
|
1181
|
+
handleMonthsChange() {
|
|
1182
|
+
// Clamp `months` to an integer in [1, MAX_MONTHS_PER_VIEW]. Non-single
|
|
1183
|
+
// pickers may show 1..MAX side-by-side; single pickers ignore the value
|
|
1184
|
+
// in `getMonthCount()`, so we still clamp defensively to keep the prop
|
|
1185
|
+
// reflected value predictable.
|
|
1186
|
+
const clamped = this.clampMonths(this.months);
|
|
1187
|
+
if (clamped !== this.months)
|
|
1188
|
+
this.months = clamped;
|
|
1189
|
+
}
|
|
1190
|
+
handleOpen(open) {
|
|
1191
|
+
if (!open) {
|
|
1192
|
+
this.tentativeHover = undefined;
|
|
1193
|
+
// Return focus to the calendar trigger button after closing the panel,
|
|
1194
|
+
// so keyboard users don't lose their position in the document.
|
|
1195
|
+
requestAnimationFrame(() => this.triggerBtnElem?.shadowRoot?.querySelector('button')?.focus());
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
// Precision locks the initial view; otherwise honor the consumer-provided one.
|
|
1199
|
+
this.view = this.precision === 'day' ? this.initialView : this.precisionToView(this.precision);
|
|
1200
|
+
this.syncViewToValue();
|
|
1201
|
+
// Move keyboard focus into the calendar so screen-reader / keyboard users
|
|
1202
|
+
// land on the focused day (or the equivalent focused cell for
|
|
1203
|
+
// months/years views). Non-modal popup: focus is *moved*, not trapped.
|
|
1204
|
+
this.focusActiveCell();
|
|
1205
|
+
}
|
|
1206
|
+
handleViewChange(next, prev) {
|
|
1207
|
+
if (next === prev)
|
|
1208
|
+
return;
|
|
1209
|
+
this.bqViewChange.emit({ view: next, el: this.el });
|
|
262
1210
|
}
|
|
263
1211
|
// Events section
|
|
264
1212
|
// Requires JSDocs for public API documentation
|
|
265
1213
|
// ==============================================
|
|
266
|
-
/** Callback handler emitted when the input loses focus */
|
|
1214
|
+
/** Callback handler emitted when the input loses focus. */
|
|
267
1215
|
bqBlur;
|
|
268
1216
|
/**
|
|
269
|
-
* Callback handler emitted when the input value
|
|
270
|
-
* This handler is called whenever the user finishes typing or pasting text into the input field and then clicks outside of the input field.
|
|
1217
|
+
* Callback handler emitted when the input value changes.
|
|
271
1218
|
*/
|
|
272
1219
|
bqChange;
|
|
273
|
-
/** Callback handler emitted when the
|
|
1220
|
+
/** Callback handler emitted when the value is cleared. */
|
|
274
1221
|
bqClear;
|
|
275
|
-
/** Callback handler emitted when the input
|
|
1222
|
+
/** Callback handler emitted when the input receives focus. */
|
|
276
1223
|
bqFocus;
|
|
1224
|
+
/**
|
|
1225
|
+
* Callback handler emitted when the internal calendar view changes
|
|
1226
|
+
* (e.g. from `days` to `months`, or from `years` back to `days`).
|
|
1227
|
+
*/
|
|
1228
|
+
bqViewChange;
|
|
277
1229
|
// Component lifecycle events
|
|
278
1230
|
// Ordered by their natural call order
|
|
279
1231
|
// =====================================
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
1232
|
+
componentWillLoad() {
|
|
1233
|
+
this.initialValue = this.value;
|
|
1234
|
+
// Precision locks the initial view when set. Otherwise honor `initialView`.
|
|
1235
|
+
// When the picker is rendered with `open` already true, `handleOpen` never
|
|
1236
|
+
// fires — apply the preference here so the initial paint respects it.
|
|
1237
|
+
this.view = this.precision === 'day' ? this.initialView : this.precisionToView(this.precision);
|
|
1238
|
+
this.checkPropValues();
|
|
1239
|
+
this.handleMonthsChange();
|
|
1240
|
+
this.syncViewToValue();
|
|
290
1241
|
}
|
|
291
1242
|
componentDidLoad() {
|
|
292
1243
|
this.handleSlotChange();
|
|
293
1244
|
this.handleValueChange(this.value, undefined);
|
|
1245
|
+
if (this.autofocus)
|
|
1246
|
+
this.inputElem?.focus();
|
|
1247
|
+
// `@Watch('open')` doesn't run for the initial prop value, so pickers
|
|
1248
|
+
// rendered with `open` never move focus into the calendar. Do it here.
|
|
1249
|
+
if (this.open)
|
|
1250
|
+
this.focusActiveCell();
|
|
294
1251
|
}
|
|
295
|
-
|
|
296
|
-
if (this.
|
|
297
|
-
this.
|
|
1252
|
+
disconnectedCallback() {
|
|
1253
|
+
if (this.pendingFocusRAF !== undefined) {
|
|
1254
|
+
cancelAnimationFrame(this.pendingFocusRAF);
|
|
1255
|
+
this.pendingFocusRAF = undefined;
|
|
298
1256
|
}
|
|
299
1257
|
}
|
|
300
1258
|
formAssociatedCallback() {
|
|
301
|
-
this.
|
|
1259
|
+
this.syncValidity();
|
|
302
1260
|
}
|
|
303
1261
|
formResetCallback() {
|
|
304
|
-
|
|
1262
|
+
// Native form reset should restore the value the field had when the form
|
|
1263
|
+
// was first parsed, not blank it. The `value` watcher takes care of
|
|
1264
|
+
// syncing derived state, form value, and validity.
|
|
1265
|
+
if (this.value === this.initialValue)
|
|
305
1266
|
return;
|
|
306
|
-
this.
|
|
1267
|
+
this.value = this.initialValue;
|
|
307
1268
|
}
|
|
308
1269
|
// Listeners
|
|
309
1270
|
// ==============
|
|
@@ -315,15 +1276,6 @@ const BqDatePicker = class {
|
|
|
315
1276
|
return;
|
|
316
1277
|
this.open = open;
|
|
317
1278
|
}
|
|
318
|
-
handleClickOutside(ev) {
|
|
319
|
-
const { open, type, hasRangeEnd } = this;
|
|
320
|
-
if (!open || type !== 'range' || ev.button !== 0)
|
|
321
|
-
return;
|
|
322
|
-
if (isEventTargetChildOfElement(ev, this.el) || hasRangeEnd)
|
|
323
|
-
return;
|
|
324
|
-
this.tentative = undefined;
|
|
325
|
-
this.hasRangeEnd = false;
|
|
326
|
-
}
|
|
327
1279
|
// Public methods API
|
|
328
1280
|
// These methods are exposed on the host element.
|
|
329
1281
|
// Always use two lines.
|
|
@@ -331,255 +1283,631 @@ const BqDatePicker = class {
|
|
|
331
1283
|
// Requires JSDocs for public API documentation.
|
|
332
1284
|
// ===============================================
|
|
333
1285
|
/**
|
|
334
|
-
* Clears the selected value
|
|
335
|
-
*
|
|
1286
|
+
* Clears the selected value and any pending validation state (bad input,
|
|
1287
|
+
* bounds overflow). Emits `bqClear`. No-op when the component is disabled.
|
|
1288
|
+
*
|
|
1289
|
+
* @returns A promise that resolves once the value has been cleared.
|
|
336
1290
|
*/
|
|
337
1291
|
async clear() {
|
|
338
1292
|
if (this.disabled)
|
|
339
1293
|
return;
|
|
340
|
-
this.
|
|
341
|
-
this.internals.setFormValue(undefined);
|
|
1294
|
+
this.clearValue();
|
|
342
1295
|
this.bqClear.emit(this.el);
|
|
343
1296
|
}
|
|
344
1297
|
// Local methods
|
|
345
1298
|
// Internal business logic.
|
|
346
1299
|
// These methods cannot be called from the host element.
|
|
347
1300
|
// =======================================================
|
|
348
|
-
/**
|
|
349
|
-
* Handles the blur event for the date picker input.
|
|
350
|
-
* @returns {void}
|
|
351
|
-
*/
|
|
352
1301
|
handleBlur = () => {
|
|
353
1302
|
if (this.disabled)
|
|
354
1303
|
return;
|
|
355
1304
|
this.bqBlur.emit(this.el);
|
|
356
1305
|
};
|
|
357
|
-
/**
|
|
358
|
-
* Handles the focus event for the date picker input.
|
|
359
|
-
* @returns {void}
|
|
360
|
-
*/
|
|
361
1306
|
handleFocus = () => {
|
|
362
1307
|
if (this.disabled)
|
|
363
1308
|
return;
|
|
364
1309
|
this.bqFocus.emit(this.el);
|
|
365
1310
|
};
|
|
366
|
-
|
|
367
|
-
* Updates the focused date in the calendar component.
|
|
368
|
-
* Falls back to today's date if no value is set.
|
|
369
|
-
* @returns {void}
|
|
370
|
-
*/
|
|
371
|
-
setFocusedDate = () => {
|
|
372
|
-
const { callyElem, isCallyLoaded, value } = this;
|
|
373
|
-
if (!callyElem || !isCallyLoaded)
|
|
374
|
-
return;
|
|
375
|
-
const nextFocused = value ? extractFocusedDate(value) : getTodayISO();
|
|
376
|
-
if (this.focusedDate === nextFocused)
|
|
377
|
-
return;
|
|
378
|
-
this.focusedDate = nextFocused;
|
|
379
|
-
if (callyElem.focusedDate !== this.focusedDate) {
|
|
380
|
-
// We need to set the focused date in the calendar component via a ref
|
|
381
|
-
// because it doesn't work when passed as a prop (the Cally element does not re-render)
|
|
382
|
-
callyElem.focusedDate = this.focusedDate;
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
/**
|
|
386
|
-
* Handles user input changes with locale-aware date parsing.
|
|
387
|
-
* Validates against disallowed dates and min/max constraints.
|
|
388
|
-
* @param {Event} ev - The change event.
|
|
389
|
-
* @returns {void}
|
|
390
|
-
*/
|
|
391
|
-
handleChange = (ev) => {
|
|
1311
|
+
handleInputChange = (ev) => {
|
|
392
1312
|
if (this.disabled || !isHTMLElement(ev.target, 'input'))
|
|
393
1313
|
return;
|
|
394
1314
|
const inputValue = ev.target.value.trim();
|
|
395
1315
|
if (!inputValue) {
|
|
1316
|
+
this.hasBadInput = false;
|
|
396
1317
|
this.clearValue();
|
|
397
1318
|
this.bqChange.emit({ value: this.value, el: this.el });
|
|
398
1319
|
return;
|
|
399
1320
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
//
|
|
404
|
-
this.
|
|
405
|
-
this.
|
|
406
|
-
this.
|
|
1321
|
+
const parsed = parseTypedInput(inputValue, this.locale, this.precision, this.min, this.max, this.isDateDisallowed);
|
|
1322
|
+
if (parsed.invalid || parsed.value == null) {
|
|
1323
|
+
// Flag as `badInput` and emit `undefined` — never propagate the raw
|
|
1324
|
+
// typed string, which would break the precision-aware wire contract.
|
|
1325
|
+
this.hasBadInput = true;
|
|
1326
|
+
this.internals.setFormValue(null);
|
|
1327
|
+
this.syncValidity();
|
|
1328
|
+
this.bqChange.emit({ value: undefined, el: this.el });
|
|
407
1329
|
return;
|
|
408
1330
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
this.internals.setFormValue(undefined);
|
|
412
|
-
this.updateFormValidity();
|
|
413
|
-
this.bqChange.emit({ value: inputValue, el: this.el });
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
// Valid date: normalize to ISO format and clamp to range if needed
|
|
417
|
-
// Note: clamping is done based on string comparison of ISO dates and only when min/max are set
|
|
418
|
-
let isoDate = toISODateString(dateValue);
|
|
419
|
-
isoDate = clampDateToRange(isoDate, this.min, this.max);
|
|
420
|
-
this.value = isoDate;
|
|
421
|
-
this.displayDate = formatDisplayValue(isoDate, this.type, this.locale, this.formatOptions);
|
|
422
|
-
this.internals.setFormValue(isoDate);
|
|
423
|
-
this.updateFormValidity();
|
|
1331
|
+
this.hasBadInput = false;
|
|
1332
|
+
this.value = parsed.value;
|
|
424
1333
|
this.bqChange.emit({ value: this.value, el: this.el });
|
|
425
1334
|
};
|
|
426
|
-
/**
|
|
427
|
-
* Handles the change event when the user selects a date in the calendar component.
|
|
428
|
-
* @param {Event} ev - The change event.
|
|
429
|
-
* @returns {void}
|
|
430
|
-
*/
|
|
431
|
-
handleCalendarChange = (ev) => {
|
|
432
|
-
if (this.isInternalUpdate)
|
|
433
|
-
return;
|
|
434
|
-
const shouldStayOpen = this.type === 'multi';
|
|
435
|
-
const value = ev.target.value;
|
|
436
|
-
if (this.value === value) {
|
|
437
|
-
this.open = shouldStayOpen;
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
this.isInternalUpdate = true;
|
|
441
|
-
this.value = value;
|
|
442
|
-
this.displayDate = formatDisplayValue(value, this.type, this.locale, this.formatOptions);
|
|
443
|
-
this.inputElem.value = this.displayDate;
|
|
444
|
-
this.inputElem.focus();
|
|
445
|
-
this.internals.setFormValue(value);
|
|
446
|
-
this.bqChange.emit({ value: this.value, el: this.el });
|
|
447
|
-
this.open = shouldStayOpen;
|
|
448
|
-
};
|
|
449
|
-
/**
|
|
450
|
-
* Handles the range start event when the user starts selecting a date range
|
|
451
|
-
* @param {CustomEvent} ev - The range start event.
|
|
452
|
-
* @returns {void}
|
|
453
|
-
*/
|
|
454
|
-
handleCalendarRangeStart = (ev) => {
|
|
455
|
-
this.hasRangeEnd = false;
|
|
456
|
-
this.tentative = ev.detail;
|
|
457
|
-
};
|
|
458
|
-
/**
|
|
459
|
-
* Handles the range end event when the user finishes selecting a date range
|
|
460
|
-
* @returns {void}
|
|
461
|
-
*/
|
|
462
|
-
handleCalendarRangeEnd = () => {
|
|
463
|
-
this.hasRangeEnd = true;
|
|
464
|
-
};
|
|
465
|
-
/**
|
|
466
|
-
* Handles the clear click event when the user clicks the clear button
|
|
467
|
-
* @param {CustomEvent} ev - The clear click event.
|
|
468
|
-
* @returns {void}
|
|
469
|
-
*/
|
|
470
1335
|
handleClearClick = (ev) => {
|
|
471
1336
|
if (this.disabled)
|
|
472
1337
|
return;
|
|
473
|
-
this.inputElem
|
|
1338
|
+
if (this.inputElem)
|
|
1339
|
+
this.inputElem.value = '';
|
|
474
1340
|
this.clearValue();
|
|
475
|
-
this.hasRangeEnd = false;
|
|
476
1341
|
this.bqClear.emit(this.el);
|
|
477
1342
|
this.bqChange.emit({ value: this.value, el: this.el });
|
|
478
|
-
this.inputElem
|
|
1343
|
+
this.inputElem?.focus();
|
|
479
1344
|
ev.stopPropagation();
|
|
480
1345
|
};
|
|
1346
|
+
/** Toggles the calendar panel open/closed when the trigger button is activated. */
|
|
1347
|
+
handleTriggerClick = () => {
|
|
1348
|
+
if (this.disabled)
|
|
1349
|
+
return;
|
|
1350
|
+
this.open = !this.open;
|
|
1351
|
+
};
|
|
481
1352
|
/**
|
|
482
|
-
*
|
|
483
|
-
*
|
|
1353
|
+
* Handles keyboard shortcuts on the text input.
|
|
1354
|
+
* - `ArrowDown` / `Alt+ArrowDown` → open panel and focus active cell.
|
|
1355
|
+
* - `Escape` → close panel (focus stays on input).
|
|
484
1356
|
*/
|
|
1357
|
+
handleInputKeyDown = (ev) => {
|
|
1358
|
+
if (this.disabled)
|
|
1359
|
+
return;
|
|
1360
|
+
if (ev.key === 'ArrowDown') {
|
|
1361
|
+
ev.preventDefault();
|
|
1362
|
+
if (!this.open)
|
|
1363
|
+
this.open = true;
|
|
1364
|
+
}
|
|
1365
|
+
else if (ev.key === 'Escape' && this.open) {
|
|
1366
|
+
ev.preventDefault();
|
|
1367
|
+
this.open = false;
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
485
1370
|
clearValue = () => {
|
|
486
1371
|
this.value = undefined;
|
|
487
1372
|
this.displayDate = undefined;
|
|
488
|
-
this.
|
|
1373
|
+
this.hasBadInput = false;
|
|
1374
|
+
this.internals.setFormValue(null);
|
|
1375
|
+
this.tentativeHover = undefined;
|
|
1376
|
+
};
|
|
1377
|
+
handleSlotChange = () => {
|
|
1378
|
+
this.hasLabel = this.labelElem ? hasSlotContent(this.labelElem) : false;
|
|
1379
|
+
this.hasPrefix = this.prefixElem ? hasSlotContent(this.prefixElem) : false;
|
|
1380
|
+
};
|
|
1381
|
+
updateFormValidity = () => {
|
|
1382
|
+
updateFormValidity({
|
|
1383
|
+
internals: this.internals,
|
|
1384
|
+
required: this.required,
|
|
1385
|
+
value: this.value,
|
|
1386
|
+
inputElem: this.inputElem,
|
|
1387
|
+
validationMessage: this.formValidationMessage,
|
|
1388
|
+
defaultMessage: 'Please, input or select a valid date',
|
|
1389
|
+
});
|
|
489
1390
|
};
|
|
490
1391
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
1392
|
+
* Recompute all state derived from the public `value` (form value,
|
|
1393
|
+
* `hasValue`, formatted display). Called from `value` and any prop that
|
|
1394
|
+
* affects display formatting (`type`, `locale`, `formatOptions`).
|
|
493
1395
|
*/
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
this.
|
|
497
|
-
this.
|
|
1396
|
+
syncDerivedFromValue = () => {
|
|
1397
|
+
const current = this.value;
|
|
1398
|
+
this.internals.setFormValue(!isNil(current) ? `${current}` : null);
|
|
1399
|
+
this.syncValidity();
|
|
1400
|
+
this.hasValue = computeHasValue(current);
|
|
1401
|
+
this.displayDate = computeDisplayDate(current, this.type, this.locale, this.effectiveFormatOptions, this.precision);
|
|
498
1402
|
};
|
|
499
1403
|
/**
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
* @returns {JSX.Element | null} The calendar month element.
|
|
1404
|
+
* Runs the full form-validity pipeline in a consistent order: `required`
|
|
1405
|
+
* → bounds → `badInput`. Multiple failing constraints are unioned into a
|
|
1406
|
+
* single `setValidity` call.
|
|
504
1407
|
*/
|
|
505
|
-
|
|
506
|
-
if (!this.
|
|
507
|
-
return
|
|
508
|
-
|
|
1408
|
+
syncValidity = () => {
|
|
1409
|
+
if (!this.internals)
|
|
1410
|
+
return;
|
|
1411
|
+
this.updateFormValidity();
|
|
1412
|
+
const boundsFlags = this.computeBoundsValidityFlags();
|
|
1413
|
+
const flags = { ...boundsFlags };
|
|
1414
|
+
if (this.hasBadInput)
|
|
1415
|
+
flags.badInput = true;
|
|
1416
|
+
const hasCustomConstraintError = Object.keys(flags).length > 0;
|
|
1417
|
+
if (!hasCustomConstraintError) {
|
|
1418
|
+
this.hasConstraintError = !this.internals.validity.valid;
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
const message = this.formValidationMessage ?? defaultValidityMessage(flags);
|
|
1422
|
+
this.internals.states.delete('valid');
|
|
1423
|
+
this.internals.states.add('invalid');
|
|
1424
|
+
this.internals.setValidity(flags, message, this.inputElem);
|
|
1425
|
+
this.hasConstraintError = true;
|
|
1426
|
+
};
|
|
1427
|
+
/** Returns `rangeUnderflow` / `rangeOverflow` flags for the current selection. */
|
|
1428
|
+
computeBoundsValidityFlags = () => {
|
|
1429
|
+
if (!this.min && !this.max)
|
|
1430
|
+
return {};
|
|
1431
|
+
const selection = parseValue(this.value, this.type, this.precision);
|
|
1432
|
+
if (selection.length === 0)
|
|
1433
|
+
return {};
|
|
1434
|
+
const paddedMin = padBound(this.min, 'min');
|
|
1435
|
+
const paddedMax = padBound(this.max, 'max');
|
|
1436
|
+
let rangeUnderflow = false;
|
|
1437
|
+
let rangeOverflow = false;
|
|
1438
|
+
for (const iso of selection) {
|
|
1439
|
+
if (paddedMin && iso < paddedMin)
|
|
1440
|
+
rangeUnderflow = true;
|
|
1441
|
+
if (paddedMax && iso > paddedMax)
|
|
1442
|
+
rangeOverflow = true;
|
|
1443
|
+
}
|
|
1444
|
+
if (!rangeUnderflow && !rangeOverflow)
|
|
1445
|
+
return {};
|
|
1446
|
+
return { rangeUnderflow, rangeOverflow };
|
|
1447
|
+
};
|
|
1448
|
+
clampMonths = (value) => {
|
|
1449
|
+
const rounded = Math.floor(Number(value));
|
|
1450
|
+
if (!Number.isFinite(rounded) || rounded < 1)
|
|
1451
|
+
return 1;
|
|
1452
|
+
return Math.min(rounded, MAX_MONTHS_PER_VIEW);
|
|
509
1453
|
};
|
|
510
1454
|
/**
|
|
511
|
-
*
|
|
1455
|
+
* Align the internal `viewDate` / `focused*` state with the current value.
|
|
1456
|
+
* Called when the panel opens and whenever an *external* prop change
|
|
1457
|
+
* invalidates the current view (value, type, precision, min/max). Internal
|
|
1458
|
+
* commits skip this via `isCommittingSelection` so the user's navigated
|
|
1459
|
+
* year isn't clobbered by a subsequent multi/range selection.
|
|
512
1460
|
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
1461
|
+
* Uses `parseValue` (precision-aware, always returns full ISO dates) rather
|
|
1462
|
+
* than a raw `YYYY-MM-DD` regex so that month/year wire values like
|
|
1463
|
+
* `"2025-05"` or `"2025"` land on the right cell instead of falling back
|
|
1464
|
+
* to today.
|
|
1465
|
+
*/
|
|
1466
|
+
syncViewToValue = () => {
|
|
1467
|
+
const parsed = parseValue(this.value, this.type, this.precision);
|
|
1468
|
+
const focusISO = parsed[0] ?? getTodayISO();
|
|
1469
|
+
const focus = parseISO(focusISO) ?? new Date();
|
|
1470
|
+
const bounded = clampDate(focus, this.min, this.max);
|
|
1471
|
+
this.focusedISO = toISO(bounded);
|
|
1472
|
+
this.viewDate = startOfMonth(bounded);
|
|
1473
|
+
this.focusedMonth = bounded.getMonth();
|
|
1474
|
+
this.focusedYear = bounded.getFullYear();
|
|
1475
|
+
this.decadeStart = getDecadeStart(bounded.getFullYear());
|
|
1476
|
+
};
|
|
1477
|
+
get selection() {
|
|
1478
|
+
const key = `${this.type}|${this.precision}|${this.value ?? ''}`;
|
|
1479
|
+
if (this.cachedSelection?.key === key)
|
|
1480
|
+
return this.cachedSelection.value;
|
|
1481
|
+
const parsed = parseValue(this.value, this.type, this.precision);
|
|
1482
|
+
this.cachedSelection = { key, value: parsed };
|
|
1483
|
+
return parsed;
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Effective `Intl.DateTimeFormatOptions` — user-provided when set, otherwise
|
|
1487
|
+
* the precision-appropriate default. Prevents a `month` picker from
|
|
1488
|
+
* accidentally rendering "1 May 2026" when the consumer just sets
|
|
1489
|
+
* `precision="month"` without overriding `formatOptions`.
|
|
522
1490
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
1491
|
+
get effectiveFormatOptions() {
|
|
1492
|
+
return this.formatOptions ?? DEFAULT_FORMAT_OPTIONS_BY_PRECISION[this.precision];
|
|
1493
|
+
}
|
|
1494
|
+
/** Map a precision value to the calendar view that commits selections. */
|
|
1495
|
+
precisionToView = (precision) => {
|
|
1496
|
+
if (precision === 'month')
|
|
1497
|
+
return 'months';
|
|
1498
|
+
if (precision === 'year')
|
|
1499
|
+
return 'years';
|
|
1500
|
+
return 'days';
|
|
1501
|
+
};
|
|
1502
|
+
get tentativeRange() {
|
|
1503
|
+
if (this.type !== 'range')
|
|
525
1504
|
return [];
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
1505
|
+
const parsed = this.selection;
|
|
1506
|
+
// While the user is completing a range (one endpoint chosen) show the
|
|
1507
|
+
// hover preview between that endpoint and the current hovered day.
|
|
1508
|
+
if (parsed.length === 1)
|
|
1509
|
+
return buildTentativeRange(parsed[0], this.tentativeHover);
|
|
1510
|
+
return [];
|
|
1511
|
+
}
|
|
1512
|
+
/* --------------------------- View transitions -------------------------- */
|
|
1513
|
+
/**
|
|
1514
|
+
* Return the date that view transitions (days ⇄ months ⇄ years) should
|
|
1515
|
+
* center the focus on.
|
|
1516
|
+
*
|
|
1517
|
+
* Priority:
|
|
1518
|
+
* 1. First entry of the current selection — for `range` this is the start
|
|
1519
|
+
* date (selection is sorted on parse), for `multi` it is the earliest.
|
|
1520
|
+
* 2. Otherwise the currently displayed `viewDate` (i.e. the month/year the
|
|
1521
|
+
* user has navigated to with prev/next).
|
|
1522
|
+
*/
|
|
1523
|
+
getViewFocusReference = () => {
|
|
1524
|
+
const [first] = this.selection;
|
|
1525
|
+
if (first) {
|
|
1526
|
+
const parsed = parseISO(first);
|
|
1527
|
+
if (parsed)
|
|
1528
|
+
return parsed;
|
|
1529
|
+
}
|
|
1530
|
+
return this.viewDate;
|
|
1531
|
+
};
|
|
1532
|
+
handleHeaderTitleClick = () => {
|
|
1533
|
+
if (this.precision === 'year')
|
|
1534
|
+
return;
|
|
1535
|
+
if (this.view === 'days') {
|
|
1536
|
+
const ref = this.getViewFocusReference();
|
|
1537
|
+
this.focusedMonth = ref.getMonth();
|
|
1538
|
+
this.focusedYear = ref.getFullYear();
|
|
1539
|
+
this.view = 'months';
|
|
1540
|
+
this.focusActiveCell();
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
if (this.view === 'months') {
|
|
1544
|
+
const ref = this.getViewFocusReference();
|
|
1545
|
+
this.focusedYear = ref.getFullYear();
|
|
1546
|
+
this.decadeStart = getDecadeStart(ref.getFullYear());
|
|
1547
|
+
this.view = 'years';
|
|
1548
|
+
this.focusActiveCell();
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
// years view → cycle back to the base view for the current precision
|
|
1552
|
+
this.view = this.precisionToView(this.precision);
|
|
1553
|
+
this.focusActiveCell();
|
|
1554
|
+
};
|
|
1555
|
+
handleHeaderPrev = () => {
|
|
1556
|
+
if (this.view === 'days') {
|
|
1557
|
+
const step = this.monthsPerView === 'months' ? Math.max(1, this.months) : 1;
|
|
1558
|
+
this.viewDate = addMonths(this.viewDate, -step);
|
|
1559
|
+
this.focusedISO = toISO(clampDate(startOfMonth(this.viewDate), this.min, this.max));
|
|
1560
|
+
}
|
|
1561
|
+
else if (this.view === 'months') {
|
|
1562
|
+
this.focusedYear = this.focusedYear - 1;
|
|
1563
|
+
}
|
|
1564
|
+
else {
|
|
1565
|
+
this.decadeStart = this.decadeStart - DECADE_GRID_SIZE;
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
handleHeaderNext = () => {
|
|
1569
|
+
if (this.view === 'days') {
|
|
1570
|
+
const step = this.monthsPerView === 'months' ? Math.max(1, this.months) : 1;
|
|
1571
|
+
this.viewDate = addMonths(this.viewDate, step);
|
|
1572
|
+
this.focusedISO = toISO(clampDate(startOfMonth(this.viewDate), this.min, this.max));
|
|
1573
|
+
}
|
|
1574
|
+
else if (this.view === 'months') {
|
|
1575
|
+
this.focusedYear = this.focusedYear + 1;
|
|
1576
|
+
}
|
|
1577
|
+
else {
|
|
1578
|
+
this.decadeStart = this.decadeStart + DECADE_GRID_SIZE;
|
|
532
1579
|
}
|
|
533
|
-
|
|
1580
|
+
};
|
|
1581
|
+
handleMonthSelect = (month) => {
|
|
1582
|
+
// When precision is `month`, selecting a month commits the value instead
|
|
1583
|
+
// of drilling to the days view. Gate the commit on bounds so keyboard
|
|
1584
|
+
// Enter/Space cannot bypass the click-path disabled check.
|
|
1585
|
+
if (this.precision === 'month') {
|
|
1586
|
+
if (!isMonthWithinBounds(this.focusedYear, month, this.min, this.max))
|
|
1587
|
+
return;
|
|
1588
|
+
this.focusedMonth = month;
|
|
1589
|
+
this.viewDate = new Date(this.focusedYear, month, 1);
|
|
1590
|
+
this.commitSelection(toISO(new Date(this.focusedYear, month, 1)));
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
this.viewDate = new Date(this.focusedYear, month, 1);
|
|
1594
|
+
this.focusedMonth = month;
|
|
1595
|
+
// Preserve day-of-month from the current focus (value or today), clamped
|
|
1596
|
+
// to the last day of the destination month and to min/max bounds.
|
|
1597
|
+
const nextFocus = clampDate(new Date(this.focusedYear, month, Math.min(new Date(this.focusedISO).getDate() || 1, endOfMonth(this.viewDate).getDate())), this.min, this.max);
|
|
1598
|
+
this.focusedISO = toISO(nextFocus);
|
|
1599
|
+
this.view = 'days';
|
|
1600
|
+
this.focusActiveCell();
|
|
1601
|
+
};
|
|
1602
|
+
handleYearSelect = (year) => {
|
|
1603
|
+
// When precision is `year`, selecting a year commits the value instead
|
|
1604
|
+
// of drilling to the months view. Gate the commit on bounds so keyboard
|
|
1605
|
+
// Enter/Space cannot bypass the click-path disabled check.
|
|
1606
|
+
if (this.precision === 'year') {
|
|
1607
|
+
if (!isYearWithinBounds(year, this.min, this.max))
|
|
1608
|
+
return;
|
|
1609
|
+
this.focusedYear = year;
|
|
1610
|
+
this.viewDate = new Date(year, 0, 1);
|
|
1611
|
+
this.commitSelection(toISO(new Date(year, 0, 1)));
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
this.focusedYear = year;
|
|
1615
|
+
this.viewDate = new Date(year, this.focusedMonth, 1);
|
|
1616
|
+
this.view = 'months';
|
|
1617
|
+
this.focusActiveCell();
|
|
1618
|
+
};
|
|
1619
|
+
/* ---------------------------- Day selection ---------------------------- */
|
|
1620
|
+
handleDaySelect = (iso) => {
|
|
1621
|
+
this.commitSelection(iso);
|
|
534
1622
|
};
|
|
535
1623
|
/**
|
|
536
|
-
*
|
|
537
|
-
*
|
|
1624
|
+
* Shared commit path used by day / month / year selection. Keeps the
|
|
1625
|
+
* selection logic (single/multi/range) and post-commit behaviour (event,
|
|
1626
|
+
* open state, tentative hover, view sync) identical across precisions.
|
|
538
1627
|
*/
|
|
539
|
-
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
1628
|
+
commitSelection = (iso) => {
|
|
1629
|
+
const next = applySelection(iso, this.selection, this.type);
|
|
1630
|
+
const shouldStayOpen = this.type === 'multi' || (this.type === 'range' && next.length === 1);
|
|
1631
|
+
this.hasBadInput = false;
|
|
1632
|
+
// Guard so `handleValueChange` doesn't re-sync the view back to `parsed[0]`
|
|
1633
|
+
// (would jump multi/range pickers to the earliest selected date) or to
|
|
1634
|
+
// today (when precision truncation leaves no full ISO to extract).
|
|
1635
|
+
this.isCommittingSelection = true;
|
|
1636
|
+
this.value = serializeValue(next, this.type, this.precision);
|
|
1637
|
+
this.isCommittingSelection = false;
|
|
1638
|
+
this.focusedISO = iso;
|
|
1639
|
+
const parsedIso = parseISO(iso);
|
|
1640
|
+
if (parsedIso) {
|
|
1641
|
+
this.viewDate = startOfMonth(parsedIso);
|
|
1642
|
+
this.focusedMonth = parsedIso.getMonth();
|
|
1643
|
+
this.focusedYear = parsedIso.getFullYear();
|
|
1644
|
+
if (this.precision !== 'year') {
|
|
1645
|
+
this.decadeStart = getDecadeStart(parsedIso.getFullYear());
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
this.tentativeHover = this.type === 'range' && next.length === 1 ? iso : undefined;
|
|
1649
|
+
this.bqChange.emit({ value: this.value, el: this.el });
|
|
1650
|
+
this.open = shouldStayOpen;
|
|
1651
|
+
};
|
|
1652
|
+
handleDayHover = (iso) => {
|
|
1653
|
+
if (this.type !== 'range')
|
|
1654
|
+
return;
|
|
1655
|
+
this.tentativeHover = iso;
|
|
1656
|
+
};
|
|
1657
|
+
handleDayFocus = (iso) => {
|
|
1658
|
+
if (this.focusedISO === iso)
|
|
1659
|
+
return;
|
|
1660
|
+
this.focusedISO = iso;
|
|
1661
|
+
};
|
|
1662
|
+
/* ------------------------- Grid keyboard nav --------------------------- */
|
|
1663
|
+
getRTLDirection = () => {
|
|
1664
|
+
// Walk up through the composed tree so that dir="rtl" set on <html> or
|
|
1665
|
+
// any ancestor is picked up, not just a direct attribute on the host.
|
|
1666
|
+
const dir = this.el.closest('[dir]')?.dir ?? getComputedStyle(this.el).direction;
|
|
1667
|
+
return dir === 'rtl' ? -1 : 1;
|
|
1668
|
+
};
|
|
1669
|
+
moveFocusedDay = (deltaDays) => {
|
|
1670
|
+
const current = parseISO(this.focusedISO) ?? new Date();
|
|
1671
|
+
const next = clampDate(addDays(current, deltaDays), this.min, this.max);
|
|
1672
|
+
this.focusedISO = toISO(next);
|
|
1673
|
+
if (next.getMonth() !== this.viewDate.getMonth() || next.getFullYear() !== this.viewDate.getFullYear()) {
|
|
1674
|
+
this.viewDate = startOfMonth(next);
|
|
1675
|
+
}
|
|
1676
|
+
this.focusButton(`[data-iso="${this.focusedISO}"]`);
|
|
1677
|
+
};
|
|
1678
|
+
moveFocusedDayHome = () => {
|
|
1679
|
+
const first = this.firstDayOfWeek ?? 1;
|
|
1680
|
+
const dayOfWeek = parseISO(this.focusedISO)?.getDay() ?? 0;
|
|
1681
|
+
this.moveFocusedDay(-((dayOfWeek - first + 7) % 7));
|
|
1682
|
+
};
|
|
1683
|
+
moveFocusedDayEnd = () => {
|
|
1684
|
+
const first = this.firstDayOfWeek ?? 1;
|
|
1685
|
+
const focus = parseISO(this.focusedISO) ?? new Date();
|
|
1686
|
+
const rowIndex = (focus.getDay() - first + 7) % 7;
|
|
1687
|
+
this.moveFocusedDay(6 - rowIndex);
|
|
1688
|
+
};
|
|
1689
|
+
pageFocusedMonth = (direction, byYear) => {
|
|
1690
|
+
this.viewDate = byYear ? addYears(this.viewDate, direction) : addMonths(this.viewDate, direction);
|
|
1691
|
+
this.focusedISO = toISO(clampDate(startOfMonth(this.viewDate), this.min, this.max));
|
|
1692
|
+
};
|
|
1693
|
+
selectFocusedDay = () => {
|
|
1694
|
+
const iso = this.focusedISO;
|
|
1695
|
+
const parsed = parseISO(iso);
|
|
1696
|
+
if (parsed && isWithinBounds(parsed, this.min, this.max) && !this.isDateDisallowed?.(parsed)) {
|
|
1697
|
+
this.handleDaySelect(iso);
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
handleDayGridKeyDown = (ev) => {
|
|
1701
|
+
const rtl = this.getRTLDirection();
|
|
1702
|
+
const handlers = {
|
|
1703
|
+
ArrowLeft: () => this.moveFocusedDay(-1 * rtl),
|
|
1704
|
+
ArrowRight: () => this.moveFocusedDay(1 * rtl),
|
|
1705
|
+
ArrowUp: () => this.moveFocusedDay(-7),
|
|
1706
|
+
ArrowDown: () => this.moveFocusedDay(7),
|
|
1707
|
+
Home: () => this.moveFocusedDayHome(),
|
|
1708
|
+
End: () => this.moveFocusedDayEnd(),
|
|
1709
|
+
PageUp: () => this.pageFocusedMonth(-1, ev.shiftKey),
|
|
1710
|
+
PageDown: () => this.pageFocusedMonth(1, ev.shiftKey),
|
|
1711
|
+
Escape: () => {
|
|
1712
|
+
this.open = false;
|
|
1713
|
+
this.inputElem?.focus();
|
|
1714
|
+
},
|
|
1715
|
+
Enter: () => this.selectFocusedDay(),
|
|
1716
|
+
' ': () => this.selectFocusedDay(),
|
|
1717
|
+
};
|
|
1718
|
+
const handler = handlers[ev.key];
|
|
1719
|
+
if (handler) {
|
|
1720
|
+
ev.preventDefault();
|
|
1721
|
+
handler();
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
getGridColumns = () => {
|
|
1725
|
+
// Months/years grids visually expand from 3 to 4 columns in multi-panel
|
|
1726
|
+
// mode. Keep arrow-key stride in sync so vertical navigation still lands
|
|
1727
|
+
// on the row directly above/below the current cell.
|
|
1728
|
+
return getGridColumns(this.getMonthCount());
|
|
1729
|
+
};
|
|
1730
|
+
handleMonthGridKeyDown = (ev) => {
|
|
1731
|
+
const rtl = this.getRTLDirection();
|
|
1732
|
+
const stride = this.getGridColumns();
|
|
1733
|
+
const move = (delta) => {
|
|
1734
|
+
const { month, year } = advanceFocusedMonth(this.focusedMonth, this.focusedYear, delta);
|
|
1735
|
+
this.focusedMonth = month;
|
|
1736
|
+
this.focusedYear = year;
|
|
1737
|
+
this.focusButton(`[data-month="${month}"]`);
|
|
1738
|
+
};
|
|
1739
|
+
switch (ev.key) {
|
|
1740
|
+
case 'ArrowLeft':
|
|
1741
|
+
ev.preventDefault();
|
|
1742
|
+
move(-1 * rtl);
|
|
1743
|
+
return;
|
|
1744
|
+
case 'ArrowRight':
|
|
1745
|
+
ev.preventDefault();
|
|
1746
|
+
move(1 * rtl);
|
|
1747
|
+
return;
|
|
1748
|
+
case 'ArrowUp':
|
|
1749
|
+
ev.preventDefault();
|
|
1750
|
+
move(-stride);
|
|
1751
|
+
return;
|
|
1752
|
+
case 'ArrowDown':
|
|
1753
|
+
ev.preventDefault();
|
|
1754
|
+
move(stride);
|
|
1755
|
+
return;
|
|
1756
|
+
case 'Enter':
|
|
1757
|
+
case ' ':
|
|
1758
|
+
ev.preventDefault();
|
|
1759
|
+
this.handleMonthSelect(this.focusedMonth);
|
|
1760
|
+
return;
|
|
1761
|
+
case 'Escape':
|
|
1762
|
+
ev.preventDefault();
|
|
1763
|
+
this.view = 'days';
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
handleYearGridKeyDown = (ev) => {
|
|
1767
|
+
const rtl = this.getRTLDirection();
|
|
1768
|
+
const stride = this.getGridColumns();
|
|
1769
|
+
const move = (delta) => {
|
|
1770
|
+
const { year, decadeStart } = advanceFocusedYear(this.focusedYear, this.decadeStart, delta);
|
|
1771
|
+
this.focusedYear = year;
|
|
1772
|
+
this.decadeStart = decadeStart;
|
|
1773
|
+
this.focusButton(`[data-year="${year}"]`);
|
|
1774
|
+
};
|
|
1775
|
+
switch (ev.key) {
|
|
1776
|
+
case 'ArrowLeft':
|
|
1777
|
+
ev.preventDefault();
|
|
1778
|
+
move(-1 * rtl);
|
|
1779
|
+
return;
|
|
1780
|
+
case 'ArrowRight':
|
|
1781
|
+
ev.preventDefault();
|
|
1782
|
+
move(1 * rtl);
|
|
1783
|
+
return;
|
|
1784
|
+
case 'ArrowUp':
|
|
1785
|
+
ev.preventDefault();
|
|
1786
|
+
move(-stride);
|
|
1787
|
+
return;
|
|
1788
|
+
case 'ArrowDown':
|
|
1789
|
+
ev.preventDefault();
|
|
1790
|
+
move(stride);
|
|
1791
|
+
return;
|
|
1792
|
+
case 'Enter':
|
|
1793
|
+
case ' ':
|
|
1794
|
+
ev.preventDefault();
|
|
1795
|
+
this.handleYearSelect(this.focusedYear);
|
|
1796
|
+
return;
|
|
1797
|
+
case 'Escape':
|
|
1798
|
+
ev.preventDefault();
|
|
1799
|
+
this.view = 'months';
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
focusButton = (selector) => {
|
|
1803
|
+
// Cancel any prior pending focus request so rapid state changes don't
|
|
1804
|
+
// race — only the latest target should win.
|
|
1805
|
+
if (this.pendingFocusRAF !== undefined)
|
|
1806
|
+
cancelAnimationFrame(this.pendingFocusRAF);
|
|
1807
|
+
this.pendingFocusRAF = requestAnimationFrame(() => {
|
|
1808
|
+
this.pendingFocusRAF = undefined;
|
|
1809
|
+
const button = this.el.shadowRoot?.querySelector(selector);
|
|
1810
|
+
button?.focus();
|
|
548
1811
|
});
|
|
549
1812
|
};
|
|
550
1813
|
/**
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
* @returns The Cally calendar component tag name.
|
|
1814
|
+
* Focus the currently active cell for the visible view. Called after the
|
|
1815
|
+
* popup opens so keyboard users don't have to tab into the calendar.
|
|
555
1816
|
*/
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
1817
|
+
focusActiveCell = () => {
|
|
1818
|
+
if (this.view === 'months') {
|
|
1819
|
+
this.focusButton(`[data-month="${this.focusedMonth}"]`);
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1822
|
+
if (this.view === 'years') {
|
|
1823
|
+
this.focusButton(`[data-year="${this.focusedYear}"]`);
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1826
|
+
this.focusButton(`[data-iso="${this.focusedISO}"]`);
|
|
1827
|
+
};
|
|
1828
|
+
/* -------------------------- Header labels ------------------------------ */
|
|
1829
|
+
getMonthCount = () => {
|
|
1830
|
+
if (this.type === 'single')
|
|
1831
|
+
return 1;
|
|
1832
|
+
// `handleMonthsChange` clamps the prop on write, so here we just guard
|
|
1833
|
+
// against the initial value before the first watcher tick.
|
|
1834
|
+
return this.clampMonths(this.months);
|
|
1835
|
+
};
|
|
1836
|
+
getHeaderLabel = () => {
|
|
1837
|
+
return getHeaderLabel({
|
|
1838
|
+
view: this.view,
|
|
1839
|
+
viewDate: this.viewDate,
|
|
1840
|
+
focusedYear: this.focusedYear,
|
|
1841
|
+
decadeStart: this.decadeStart,
|
|
1842
|
+
monthCount: this.getMonthCount(),
|
|
1843
|
+
locale: this.locale,
|
|
1844
|
+
});
|
|
1845
|
+
};
|
|
1846
|
+
getHeaderTitleLabel = () => {
|
|
1847
|
+
return getHeaderTitleLabel(this.view, this.precision);
|
|
1848
|
+
};
|
|
1849
|
+
getPreviousLabel = () => {
|
|
1850
|
+
return getPreviousLabel(this.view);
|
|
1851
|
+
};
|
|
1852
|
+
getNextLabel = () => {
|
|
1853
|
+
return getNextLabel(this.view);
|
|
1854
|
+
};
|
|
1855
|
+
renderDayPanels = () => {
|
|
1856
|
+
const panels = [];
|
|
1857
|
+
const monthCount = this.getMonthCount();
|
|
1858
|
+
for (let i = 0; i < monthCount; i++) {
|
|
1859
|
+
const anchor = addMonths(this.viewDate, i);
|
|
1860
|
+
const anchorKey = toISO(startOfMonth(anchor));
|
|
1861
|
+
panels.push(h("div", { key: anchorKey, class: {
|
|
1862
|
+
'bq-date-picker__panel': true,
|
|
1863
|
+
'bq-date-picker__panel--extra': i > 0,
|
|
1864
|
+
} }, monthCount > 1 && (h("div", { class: "bq-date-picker__month-label", part: CALENDAR_PARTS.heading }, formatMonth(anchor, this.locale, 'long', true))), h(CalendarDayView, { viewDate: anchor, selection: this.selection, tentativeRange: this.tentativeRange, focusedISO: this.focusedISO, type: this.type, locale: this.locale, firstDayOfWeek: this.firstDayOfWeek ?? 1, showOutsideDays: this.showOutsideDays, minISO: this.min, maxISO: this.max, isDateDisallowed: this.isDateDisallowed, onDaySelect: (iso) => this.handleDaySelect(iso), onDayHover: (iso) => this.handleDayHover(iso), onDayFocus: (iso) => this.handleDayFocus(iso), onGridKeyDown: this.handleDayGridKeyDown })));
|
|
1865
|
+
}
|
|
1866
|
+
return h("div", { class: "bq-date-picker__panels" }, panels);
|
|
1867
|
+
};
|
|
1868
|
+
renderMonthsView = () => {
|
|
1869
|
+
const gridColumns = this.getGridColumns();
|
|
1870
|
+
return (h(CalendarMonthView, { year: this.focusedYear, focusedMonth: this.focusedMonth, gridColumns: gridColumns, locale: this.locale, minISO: this.min, maxISO: this.max, selection: this.selection, tentativeRange: this.tentativeRange, type: this.type, onMonthSelect: (month) => this.handleMonthSelect(month), onMonthHover: (iso) => this.handleDayHover(iso), onMonthFocus: (month) => {
|
|
1871
|
+
this.focusedMonth = month;
|
|
1872
|
+
}, onGridKeyDown: this.handleMonthGridKeyDown }));
|
|
1873
|
+
};
|
|
1874
|
+
renderYearsView = () => {
|
|
1875
|
+
const start = this.decadeStart;
|
|
1876
|
+
const end = start + DECADE_GRID_SIZE - 1;
|
|
1877
|
+
const years = Array.from({ length: DECADE_GRID_SIZE }, (_, i) => start + i);
|
|
1878
|
+
const effectiveFocused = this.focusedYear >= start && this.focusedYear <= end ? this.focusedYear : start;
|
|
1879
|
+
const gridColumns = this.getGridColumns();
|
|
1880
|
+
return (h(CalendarYearView, { years: years, focusedYear: effectiveFocused, gridColumns: gridColumns, minISO: this.min, maxISO: this.max, selection: this.selection, tentativeRange: this.tentativeRange, type: this.type, onYearSelect: (year) => this.handleYearSelect(year), onYearHover: (iso) => this.handleDayHover(iso), onYearFocus: (year) => {
|
|
1881
|
+
this.focusedYear = year;
|
|
1882
|
+
}, onGridKeyDown: this.handleYearGridKeyDown }));
|
|
1883
|
+
};
|
|
1884
|
+
renderView = () => {
|
|
1885
|
+
if (this.view === 'months')
|
|
1886
|
+
return this.renderMonthsView();
|
|
1887
|
+
if (this.view === 'years')
|
|
1888
|
+
return this.renderYearsView();
|
|
1889
|
+
return this.renderDayPanels();
|
|
1890
|
+
};
|
|
559
1891
|
// render() function
|
|
560
1892
|
// Always the last one in the class.
|
|
561
1893
|
// ===================================
|
|
562
1894
|
render() {
|
|
563
|
-
const CallyCalendar = this.calendarType;
|
|
564
1895
|
const labelId = `bq-date-picker__label-${this.name || DEFAULT_INPUT_ID}`;
|
|
565
|
-
|
|
1896
|
+
const popupId = `bq-date-picker__popup-${this.name || DEFAULT_INPUT_ID}`;
|
|
1897
|
+
return (h("div", { key: 'fbfb1d3294161587b4dc1097f472a7c56d42113d', class: "bq-date-picker", part: CALENDAR_PARTS.base }, h("label", { key: '653bbad6d53c67fac40fde49fe19eb53dd9058a3', class: { 'bq-date-picker__label': true, 'is-hidden': !this.hasLabel }, htmlFor: this.name || DEFAULT_INPUT_ID, part: CALENDAR_PARTS.label, ref: (labelElem) => {
|
|
566
1898
|
this.labelElem = labelElem;
|
|
567
|
-
} }, h("slot", { key: '
|
|
1899
|
+
} }, h("slot", { key: '07e94277fbaf22b70bdd99d07159d41890210aa4', id: labelId, name: "label", onSlotchange: this.handleSlotChange })), h("bq-dropdown", { key: '41797796782799bb526b0f7848d13142824a6992', class: "bq-date-picker__dropdown", disabled: this.disabled, distance: this.distance, exportparts: "panel", open: this.open, panelHeight: this.panelHeight, placement: this.placement, skidding: this.skidding, strategy: this.strategy }, h("div", { key: '34a12c0fedb7ef5e0b01027d6880d76b98aba95c', class: {
|
|
568
1900
|
'bq-date-picker__control': true,
|
|
569
1901
|
[`validation-${this.validationStatus}`]: true,
|
|
570
|
-
disabled: this.disabled,
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
this.suffixElem = spanElem;
|
|
580
|
-
} }, h("slot", { key: '5501e90797705d98883a0a9ec178ae21922407dd', name: "suffix", onSlotchange: this.handleSlotChange }, h("bq-icon", { key: '0a7e047ade9014cb9997a0ffcf47098bbe6160eb', class: "flex", name: "calendar-blank" })))), this.isCallyLoaded && (h(CallyCalendar, { key: 'cdbb9f9cb40d03b40f743d1086f9cc3c0055c233', "aria-labelledby": labelId, "aria-modal": "true", exportparts: CALENDAR_CONTAINER_EXPORT_PARTS, firstDayOfWeek: this.firstDayOfWeek, isDateDisallowed: this.isDateDisallowed, locale: this.locale, max: this.max, min: this.min, months: this.months, onChange: this.handleCalendarChange, onRangeend: this.handleCalendarRangeEnd, onRangestart: this.handleCalendarRangeStart, pageBy: this.monthsPerView, ref: (elem) => {
|
|
581
|
-
this.callyElem = elem;
|
|
582
|
-
}, role: "dialog", showOutsideDays: this.showOutsideDays, tentative: this.tentative, value: this.value }, h("bq-icon", { key: '4c10bc74c6e248f07b66fc4af28917a9b83bcc48', color: "text--primary", label: "Previous", name: "caret-left", slot: "previous" }), h("bq-icon", { key: '4f1875fa4e48db09e83ae5aa5c4c7ab0591cb2d4', color: "text--primary", label: "Next", name: "caret-right", slot: "next" }), h("div", { key: '92d856991700e38e8fbf383eae2b8d2c85d0faed', class: "flex flex-wrap justify-center gap-[--bq-spacing-m]" }, this.generateCalendarMonths()))))));
|
|
1902
|
+
'is-disabled': !!this.disabled,
|
|
1903
|
+
'is-open': !!this.open,
|
|
1904
|
+
}, part: CALENDAR_PARTS.control, slot: "trigger" }, h("span", { key: '074fef90f99a4f04b9dcf93662f32474872fae8d', class: { 'bq-date-picker__prefix': true, 'is-hidden': !this.hasPrefix }, part: CALENDAR_PARTS.prefix, ref: (el) => {
|
|
1905
|
+
this.prefixElem = el;
|
|
1906
|
+
} }, h("slot", { key: '040653982a81730279c4115a19415b01dbc24930', name: "prefix", onSlotchange: this.handleSlotChange })), h("input", { key: 'a72cc21a3811e27890881cd6b24340f3014bd891', "aria-controls": popupId, "aria-disabled": this.disabled ? 'true' : 'false', "aria-expanded": this.open ? 'true' : 'false', "aria-haspopup": "dialog", "aria-invalid": this.validationStatus === 'error' || this.hasConstraintError ? 'true' : 'false', "aria-labelledby": this.hasLabel ? labelId : undefined, autoCapitalize: "off", autoComplete: "off", class: "bq-date-picker__input", disabled: this.disabled, form: this.form, id: this.name || DEFAULT_INPUT_ID, name: this.name, onBlur: this.handleBlur, onChange: this.handleInputChange, onFocus: this.handleFocus, onKeyDown: this.handleInputKeyDown, part: CALENDAR_PARTS.input, placeholder: this.placeholder, readonly: this.type !== 'single', ref: (el) => {
|
|
1907
|
+
this.inputElem = el;
|
|
1908
|
+
}, required: this.required, role: "combobox", spellcheck: false, type: "text", value: this.displayDate }), this.hasValue && !this.disabled && !this.disableClear && (h("bq-button", { key: '4755ef5fd92ad15e4251e8e6b1a0c54fcab70211', appearance: "text", border: "xs", class: "bq-date-picker__clear", exportparts: "button", label: this.clearButtonLabel, onBqClick: this.handleClearClick, onlyIcon: true, part: CALENDAR_PARTS.clearBtn, size: "small" }, h("slot", { key: '3822545148e63e70ba3db113f68ef433f8cec557', name: "clear-icon" }, h("bq-icon", { key: '68fb241e92345c8ba00234a4549fde7596356244', "aria-hidden": "true", name: "x-circle" })))), h("bq-button", { key: 'a0d973454fe7a4a5176ec74cbfd4f53f8b5e502b', appearance: "text", border: "xs", class: "bq-date-picker__calendar-trigger", disabled: this.disabled, exportparts: "button", label: this.calendarButtonLabel, onClick: (ev) => ev.stopPropagation(), onBqClick: this.handleTriggerClick, onlyIcon: true, part: `${CALENDAR_PARTS.button} ${CALENDAR_PARTS.suffix} ${CALENDAR_PARTS.calendarTrigger}`, ref: (el) => {
|
|
1909
|
+
this.triggerBtnElem = el;
|
|
1910
|
+
}, size: "small" }, h("slot", { key: '232204777692c2fec6f341bb1839084aa0f333a3', name: "suffix", onSlotchange: this.handleSlotChange }, h("bq-icon", { key: '61a8deb36c0a991e7d3a9922150eeb1740494c7e', "aria-hidden": "true", name: "calendar-blank" })))), h("div", { key: 'f65869f887710ff537b00812aacf2bbd01ddeb3e', "aria-label": this.hasLabel ? undefined : 'Date picker', "aria-labelledby": this.hasLabel ? labelId : undefined, class: "bq-date-picker__calendar", id: popupId, part: CALENDAR_PARTS.container, role: "dialog", style: { '--bq-date-picker--panel-count': `${this.getMonthCount()}` } }, h(CalendarHeader, { key: 'a07e486177b1df9f477de1fe6c0c484356e0d6b9', view: this.view, label: this.getHeaderLabel(), previousLabel: this.getPreviousLabel(), nextLabel: this.getNextLabel(), titleLabel: this.getHeaderTitleLabel(), titleInteractive: this.precision !== 'year', onPrevious: () => this.handleHeaderPrev(), onNext: () => this.handleHeaderNext(), onTitleClick: () => this.handleHeaderTitleClick() }), h("div", { key: '00a0802e6eb76113fd68ee8852a98c762dc015bb', class: "bq-date-picker__view" }, this.renderView())))));
|
|
583
1911
|
}
|
|
584
1912
|
static get delegatesFocus() { return true; }
|
|
585
1913
|
static get formAssociated() { return true; }
|
|
@@ -587,8 +1915,57 @@ const BqDatePicker = class {
|
|
|
587
1915
|
"value": [{
|
|
588
1916
|
"handleValueChange": 0
|
|
589
1917
|
}],
|
|
1918
|
+
"formatOptions": [{
|
|
1919
|
+
"handleFormattingChange": 0
|
|
1920
|
+
}],
|
|
1921
|
+
"locale": [{
|
|
1922
|
+
"handleFormattingChange": 0
|
|
1923
|
+
}],
|
|
590
1924
|
"type": [{
|
|
1925
|
+
"handleTypeChange": 0
|
|
1926
|
+
}, {
|
|
1927
|
+
"checkPropValues": 0
|
|
1928
|
+
}],
|
|
1929
|
+
"precision": [{
|
|
1930
|
+
"handlePrecisionChange": 0
|
|
1931
|
+
}, {
|
|
1932
|
+
"checkPropValues": 0
|
|
1933
|
+
}],
|
|
1934
|
+
"max": [{
|
|
1935
|
+
"handleBoundsChange": 0
|
|
1936
|
+
}],
|
|
1937
|
+
"min": [{
|
|
1938
|
+
"handleBoundsChange": 0
|
|
1939
|
+
}],
|
|
1940
|
+
"required": [{
|
|
1941
|
+
"handleRequiredChange": 0
|
|
1942
|
+
}],
|
|
1943
|
+
"firstDayOfWeek": [{
|
|
1944
|
+
"checkPropValues": 0
|
|
1945
|
+
}],
|
|
1946
|
+
"initialView": [{
|
|
1947
|
+
"checkPropValues": 0
|
|
1948
|
+
}],
|
|
1949
|
+
"monthsPerView": [{
|
|
1950
|
+
"checkPropValues": 0
|
|
1951
|
+
}],
|
|
1952
|
+
"placement": [{
|
|
1953
|
+
"checkPropValues": 0
|
|
1954
|
+
}],
|
|
1955
|
+
"strategy": [{
|
|
1956
|
+
"checkPropValues": 0
|
|
1957
|
+
}],
|
|
1958
|
+
"validationStatus": [{
|
|
591
1959
|
"checkPropValues": 0
|
|
1960
|
+
}],
|
|
1961
|
+
"months": [{
|
|
1962
|
+
"handleMonthsChange": 0
|
|
1963
|
+
}],
|
|
1964
|
+
"open": [{
|
|
1965
|
+
"handleOpen": 0
|
|
1966
|
+
}],
|
|
1967
|
+
"view": [{
|
|
1968
|
+
"handleViewChange": 0
|
|
592
1969
|
}]
|
|
593
1970
|
}; }
|
|
594
1971
|
};
|