@dialpad/dialtone-vue 3.120.0 → 3.120.2
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/chunks/_plugin-vue_export-helper-caHeSgYY.js +11 -0
- package/dist/chunks/_plugin-vue_export-helper-caHeSgYY.js.map +1 -0
- package/dist/chunks/_plugin-vue_export-helper-fhnQq0tA.js +10 -0
- package/dist/chunks/_plugin-vue_export-helper-fhnQq0tA.js.map +1 -0
- package/dist/chunks/{dropdown-eWOvBvwq.js → dropdown-Hn-TeTvZ.js} +151 -104
- package/dist/chunks/{dropdown-UO3UJalk.js.map → dropdown-Hn-TeTvZ.js.map} +1 -1
- package/dist/chunks/dropdown-w8Do29L5.js +442 -0
- package/dist/chunks/{dropdown-eWOvBvwq.js.map → dropdown-w8Do29L5.js.map} +1 -1
- package/dist/chunks/dropdown_constants-2pGCXy7m.js +8 -0
- package/dist/chunks/dropdown_constants-2pGCXy7m.js.map +1 -0
- package/dist/chunks/dropdown_constants-w1MXGC3Z.js +9 -0
- package/dist/chunks/dropdown_constants-w1MXGC3Z.js.map +1 -0
- package/dist/chunks/{icon_constants-OpYAAKwF.js → icon_constants-Dy4MEUJL.js} +7 -6
- package/dist/chunks/{icon_constants-2S_OSQ1t.js.map → icon_constants-Dy4MEUJL.js.map} +1 -1
- package/dist/chunks/icon_constants-QYpmdE0R.js +16 -0
- package/dist/chunks/{icon_constants-OpYAAKwF.js.map → icon_constants-QYpmdE0R.js.map} +1 -1
- package/dist/chunks/index-4qgKeErp.js +446 -0
- package/dist/chunks/{index-b4iXYvId.js.map → index-4qgKeErp.js.map} +1 -1
- package/dist/chunks/index-b_MgDylR.js +447 -0
- package/dist/chunks/{index-6tYeqbgP.js.map → index-b_MgDylR.js.map} +1 -1
- package/dist/chunks/{input-4UQWegUk.js → input-NmYDD5bn.js} +83 -60
- package/dist/chunks/{input-0Uksk4DP.js.map → input-NmYDD5bn.js.map} +1 -1
- package/dist/chunks/input-ttnte8zB.js +295 -0
- package/dist/chunks/{input-4UQWegUk.js.map → input-ttnte8zB.js.map} +1 -1
- package/dist/chunks/input_group-M-D25pOJ.js +152 -0
- package/dist/chunks/{input_group-bBKaq3Wi.js.map → input_group-M-D25pOJ.js.map} +1 -1
- package/dist/chunks/{input_group-bBKaq3Wi.js → input_group-jWnq2DJT.js} +27 -24
- package/dist/chunks/{input_group-AS760Cp7.js.map → input_group-jWnq2DJT.js.map} +1 -1
- package/dist/chunks/keyboard_list_navigation-ScXhrxya.js +284 -0
- package/dist/chunks/{keyboard_list_navigation-N74Bpdq7.js.map → keyboard_list_navigation-ScXhrxya.js.map} +1 -1
- package/dist/chunks/keyboard_list_navigation-fJnl_Iox.js +283 -0
- package/dist/chunks/{keyboard_list_navigation-F0O8nht0.js.map → keyboard_list_navigation-fJnl_Iox.js.map} +1 -1
- package/dist/chunks/link_constants-Huj7D_hm.js +22 -0
- package/dist/chunks/{link_constants-Kn6kP4i1.js.map → link_constants-Huj7D_hm.js.map} +1 -1
- package/dist/chunks/link_constants-nWVlXQBs.js +23 -0
- package/dist/chunks/{link_constants-vIUB92L4.js.map → link_constants-nWVlXQBs.js.map} +1 -1
- package/dist/chunks/list_item_constants-EiqkqZvP.js +13 -0
- package/dist/chunks/{list_item_constants-Tsz5CO1m.js.map → list_item_constants-EiqkqZvP.js.map} +1 -1
- package/dist/chunks/list_item_constants-u1xcN9Dd.js +14 -0
- package/dist/chunks/{list_item_constants-LTUc74pD.js.map → list_item_constants-u1xcN9Dd.js.map} +1 -1
- package/dist/chunks/modal-VgxXAQFP.js +105 -0
- package/dist/chunks/{modal-qEzlo0Sj.js.map → modal-VgxXAQFP.js.map} +1 -1
- package/dist/chunks/modal-XOr4kiNZ.js +106 -0
- package/dist/chunks/{modal-VuMFkZFH.js.map → modal-XOr4kiNZ.js.map} +1 -1
- package/dist/chunks/notice_action-WTucGhvr.js +222 -0
- package/dist/chunks/{notice_action-tJfD5Qw1.js.map → notice_action-WTucGhvr.js.map} +1 -1
- package/dist/chunks/notice_action-p-ePanW_.js +223 -0
- package/dist/chunks/{notice_action-jO199emq.js.map → notice_action-p-ePanW_.js.map} +1 -1
- package/dist/chunks/notice_constants-7Qt2CQEY.js +7 -0
- package/dist/chunks/{notice_constants-mC6al2Dm.js.map → notice_constants-7Qt2CQEY.js.map} +1 -1
- package/dist/chunks/notice_constants-UXo9e3bS.js +6 -0
- package/dist/chunks/{notice_constants-c--hBFQw.js.map → notice_constants-UXo9e3bS.js.map} +1 -1
- package/dist/chunks/popover_constants-JwBF9h1Z.js +143 -0
- package/dist/chunks/{popover_constants-hOEhklvr.js.map → popover_constants-JwBF9h1Z.js.map} +1 -1
- package/dist/chunks/popover_constants-Qkpb0yh2.js +144 -0
- package/dist/chunks/{popover_constants-qjlEkroB.js.map → popover_constants-Qkpb0yh2.js.map} +1 -1
- package/dist/chunks/{sr_only_close_button-7O-Ev8uM.js → sr_only_close_button-3EdsV-dH.js} +28 -24
- package/dist/chunks/{sr_only_close_button-iD7s1Pbj.js.map → sr_only_close_button-3EdsV-dH.js.map} +1 -1
- package/dist/chunks/sr_only_close_button-xGrHFjwA.js +91 -0
- package/dist/chunks/{sr_only_close_button-7O-Ev8uM.js.map → sr_only_close_button-xGrHFjwA.js.map} +1 -1
- package/dist/chunks/stack_constants-HraCekPm.js +15 -0
- package/dist/chunks/{stack_constants-m9Ickqw0.js.map → stack_constants-HraCekPm.js.map} +1 -1
- package/dist/chunks/stack_constants-SMzMWnAQ.js +14 -0
- package/dist/chunks/{stack_constants-u7tNqGtc.js.map → stack_constants-SMzMWnAQ.js.map} +1 -1
- package/dist/chunks/tab-RTDgnD9-.js +391 -0
- package/dist/chunks/{tab-at7WWglk.js.map → tab-RTDgnD9-.js.map} +1 -1
- package/dist/chunks/tab-qc3f42Yp.js +390 -0
- package/dist/chunks/{tab-GQZFMq83.js.map → tab-qc3f42Yp.js.map} +1 -1
- package/dist/common/constants.cjs +60 -0
- package/dist/{lib → common}/constants.cjs.map +1 -1
- package/dist/{lib → common}/constants.js +25 -18
- package/dist/{lib → common}/constants.js.map +1 -1
- package/dist/common/dates.cjs +72 -0
- package/dist/{lib → common}/dates.cjs.map +1 -1
- package/dist/common/dates.js +72 -0
- package/dist/{lib → common}/dates.js.map +1 -1
- package/dist/common/emoji.cjs +163 -0
- package/dist/common/emoji.cjs.map +1 -0
- package/dist/common/emoji.js +168 -0
- package/dist/common/emoji.js.map +1 -0
- package/dist/common/mixins.cjs +17 -0
- package/dist/{lib → common}/mixins.cjs.map +1 -1
- package/dist/common/mixins.js +17 -0
- package/dist/common/utils.cjs +243 -0
- package/dist/{lib → common}/utils.cjs.map +1 -1
- package/dist/common/utils.js +243 -0
- package/dist/{lib → common}/utils.js.map +1 -1
- package/dist/common/validators.cjs +23 -0
- package/dist/{lib → common}/validators.cjs.map +1 -1
- package/dist/common/validators.js +23 -0
- package/dist/{lib → common}/validators.js.map +1 -1
- package/dist/dialtone-vue.cjs +373 -1
- package/dist/dialtone-vue.cjs.map +1 -1
- package/dist/dialtone-vue.js +328 -327
- package/dist/dialtone-vue.js.map +1 -1
- package/dist/lib/attachment-carousel.cjs +345 -1
- package/dist/lib/attachment-carousel.cjs.map +1 -1
- package/dist/lib/attachment-carousel.js +126 -108
- package/dist/lib/attachment-carousel.js.map +1 -1
- package/dist/lib/avatar.cjs +447 -1
- package/dist/lib/avatar.cjs.map +1 -1
- package/dist/lib/avatar.js +135 -101
- package/dist/lib/avatar.js.map +1 -1
- package/dist/lib/badge.cjs +206 -1
- package/dist/lib/badge.cjs.map +1 -1
- package/dist/lib/badge.js +64 -48
- package/dist/lib/badge.js.map +1 -1
- package/dist/lib/banner.cjs +242 -2
- package/dist/lib/banner.cjs.map +1 -1
- package/dist/lib/banner.js +81 -71
- package/dist/lib/banner.js.map +1 -1
- package/dist/lib/breadcrumbs.cjs +150 -1
- package/dist/lib/breadcrumbs.cjs.map +1 -1
- package/dist/lib/breadcrumbs.js +60 -52
- package/dist/lib/breadcrumbs.js.map +1 -1
- package/dist/lib/button-group.cjs +41 -1
- package/dist/lib/button-group.cjs.map +1 -1
- package/dist/lib/button-group.js +15 -14
- package/dist/lib/button-group.js.map +1 -1
- package/dist/lib/button.cjs +356 -1
- package/dist/lib/button.cjs.map +1 -1
- package/dist/lib/button.js +108 -88
- package/dist/lib/button.js.map +1 -1
- package/dist/lib/callbar-button-with-popover.cjs +322 -1
- package/dist/lib/callbar-button-with-popover.cjs.map +1 -1
- package/dist/lib/callbar-button-with-popover.js +101 -83
- package/dist/lib/callbar-button-with-popover.js.map +1 -1
- package/dist/lib/callbar-button.cjs +200 -1
- package/dist/lib/callbar-button.cjs.map +1 -1
- package/dist/lib/callbar-button.js +52 -45
- package/dist/lib/callbar-button.js.map +1 -1
- package/dist/lib/callbox.cjs +217 -1
- package/dist/lib/callbox.cjs.map +1 -1
- package/dist/lib/callbox.js +80 -67
- package/dist/lib/callbox.js.map +1 -1
- package/dist/lib/card.cjs +91 -1
- package/dist/lib/card.cjs.map +1 -1
- package/dist/lib/card.js +27 -27
- package/dist/lib/card.js.map +1 -1
- package/dist/lib/checkbox-group.cjs +115 -1
- package/dist/lib/checkbox-group.cjs.map +1 -1
- package/dist/lib/checkbox-group.js +34 -23
- package/dist/lib/checkbox-group.js.map +1 -1
- package/dist/lib/checkbox.cjs +156 -1
- package/dist/lib/checkbox.cjs.map +1 -1
- package/dist/lib/checkbox.js +72 -60
- package/dist/lib/checkbox.js.map +1 -1
- package/dist/lib/chip.cjs +235 -1
- package/dist/lib/chip.cjs.map +1 -1
- package/dist/lib/chip.js +84 -67
- package/dist/lib/chip.js.map +1 -1
- package/dist/lib/codeblock.cjs +23 -2
- package/dist/lib/codeblock.cjs.map +1 -1
- package/dist/lib/codeblock.js +13 -13
- package/dist/lib/codeblock.js.map +1 -1
- package/dist/lib/collapsible.cjs +398 -1
- package/dist/lib/collapsible.cjs.map +1 -1
- package/dist/lib/collapsible.js +123 -100
- package/dist/lib/collapsible.js.map +1 -1
- package/dist/lib/combobox-multi-select.cjs +589 -1
- package/dist/lib/combobox-multi-select.cjs.map +1 -1
- package/dist/lib/combobox-multi-select.js +270 -177
- package/dist/lib/combobox-multi-select.js.map +1 -1
- package/dist/lib/combobox-with-popover.cjs +452 -1
- package/dist/lib/combobox-with-popover.cjs.map +1 -1
- package/dist/lib/combobox-with-popover.js +172 -127
- package/dist/lib/combobox-with-popover.js.map +1 -1
- package/dist/lib/combobox.cjs +18 -1
- package/dist/lib/combobox.cjs.map +1 -1
- package/dist/lib/combobox.js +9 -9
- package/dist/lib/contact-info.cjs +205 -1
- package/dist/lib/contact-info.cjs.map +1 -1
- package/dist/lib/contact-info.js +69 -60
- package/dist/lib/contact-info.js.map +1 -1
- package/dist/lib/contact-row.cjs +246 -1
- package/dist/lib/contact-row.cjs.map +1 -1
- package/dist/lib/contact-row.js +67 -63
- package/dist/lib/contact-row.js.map +1 -1
- package/dist/lib/datepicker.cjs +854 -1
- package/dist/lib/datepicker.cjs.map +1 -1
- package/dist/lib/datepicker.js +585 -441
- package/dist/lib/datepicker.js.map +1 -1
- package/dist/lib/description-list.cjs +116 -1
- package/dist/lib/description-list.cjs.map +1 -1
- package/dist/lib/description-list.js +56 -24
- package/dist/lib/description-list.js.map +1 -1
- package/dist/lib/dropdown.cjs +36 -1
- package/dist/lib/dropdown.cjs.map +1 -1
- package/dist/lib/dropdown.js +22 -21
- package/dist/lib/dropdown.js.map +1 -1
- package/dist/lib/editor.cjs +711 -1
- package/dist/lib/editor.cjs.map +1 -1
- package/dist/lib/editor.js +271 -235
- package/dist/lib/editor.js.map +1 -1
- package/dist/lib/emoji-picker.cjs +1277 -1
- package/dist/lib/emoji-picker.cjs.map +1 -1
- package/dist/lib/emoji-picker.js +859 -569
- package/dist/lib/emoji-picker.js.map +1 -1
- package/dist/lib/emoji-row.cjs +128 -1
- package/dist/lib/emoji-row.cjs.map +1 -1
- package/dist/lib/emoji-row.js +89 -75
- package/dist/lib/emoji-row.js.map +1 -1
- package/dist/lib/emoji-text-wrapper.cjs +102 -1
- package/dist/lib/emoji-text-wrapper.cjs.map +1 -1
- package/dist/lib/emoji-text-wrapper.js +42 -31
- package/dist/lib/emoji-text-wrapper.js.map +1 -1
- package/dist/lib/emoji.cjs +158 -1
- package/dist/lib/emoji.cjs.map +1 -1
- package/dist/lib/emoji.js +153 -6
- package/dist/lib/emoji.js.map +1 -1
- package/dist/lib/feed-item-row.cjs +296 -1
- package/dist/lib/feed-item-row.cjs.map +1 -1
- package/dist/lib/feed-item-row.js +119 -100
- package/dist/lib/feed-item-row.js.map +1 -1
- package/dist/lib/feed-pill.cjs +173 -1
- package/dist/lib/feed-pill.cjs.map +1 -1
- package/dist/lib/feed-pill.js +70 -57
- package/dist/lib/feed-pill.js.map +1 -1
- package/dist/lib/general-row.cjs +518 -1
- package/dist/lib/general-row.cjs.map +1 -1
- package/dist/lib/general-row.js +186 -148
- package/dist/lib/general-row.js.map +1 -1
- package/dist/lib/group-row.cjs +116 -1
- package/dist/lib/group-row.cjs.map +1 -1
- package/dist/lib/group-row.js +37 -35
- package/dist/lib/group-row.js.map +1 -1
- package/dist/lib/grouped-chip.cjs +96 -1
- package/dist/lib/grouped-chip.cjs.map +1 -1
- package/dist/lib/grouped-chip.js +51 -46
- package/dist/lib/grouped-chip.js.map +1 -1
- package/dist/lib/hovercard.cjs +223 -1
- package/dist/lib/hovercard.cjs.map +1 -1
- package/dist/lib/hovercard.js +115 -80
- package/dist/lib/hovercard.js.map +1 -1
- package/dist/lib/icon.cjs +58 -1
- package/dist/lib/icon.cjs.map +1 -1
- package/dist/lib/icon.js +20 -20
- package/dist/lib/icon.js.map +1 -1
- package/dist/lib/image-viewer.cjs +243 -1
- package/dist/lib/image-viewer.cjs.map +1 -1
- package/dist/lib/image-viewer.js +104 -80
- package/dist/lib/image-viewer.js.map +1 -1
- package/dist/lib/input-group.cjs +91 -1
- package/dist/lib/input-group.cjs.map +1 -1
- package/dist/lib/input-group.js +41 -39
- package/dist/lib/input-group.js.map +1 -1
- package/dist/lib/input.cjs +578 -1
- package/dist/lib/input.cjs.map +1 -1
- package/dist/lib/input.js +185 -137
- package/dist/lib/input.js.map +1 -1
- package/dist/lib/item-layout.cjs +91 -1
- package/dist/lib/item-layout.cjs.map +1 -1
- package/dist/lib/item-layout.js +45 -39
- package/dist/lib/item-layout.js.map +1 -1
- package/dist/lib/ivr-node.cjs +263 -1
- package/dist/lib/ivr-node.cjs.map +1 -1
- package/dist/lib/ivr-node.js +130 -112
- package/dist/lib/ivr-node.js.map +1 -1
- package/dist/lib/keyboard-shortcut.cjs +119 -1
- package/dist/lib/keyboard-shortcut.cjs.map +1 -1
- package/dist/lib/keyboard-shortcut.js +58 -48
- package/dist/lib/keyboard-shortcut.js.map +1 -1
- package/dist/lib/lazy-show.cjs +82 -1
- package/dist/lib/lazy-show.cjs.map +1 -1
- package/dist/lib/lazy-show.js +21 -19
- package/dist/lib/lazy-show.js.map +1 -1
- package/dist/lib/link.cjs +43 -1
- package/dist/lib/link.cjs.map +1 -1
- package/dist/lib/link.js +20 -19
- package/dist/lib/link.js.map +1 -1
- package/dist/lib/list-item-group.cjs +67 -1
- package/dist/lib/list-item-group.cjs.map +1 -1
- package/dist/lib/list-item-group.js +24 -22
- package/dist/lib/list-item-group.js.map +1 -1
- package/dist/lib/list-item.cjs +216 -1
- package/dist/lib/list-item.cjs.map +1 -1
- package/dist/lib/list-item.js +71 -60
- package/dist/lib/list-item.js.map +1 -1
- package/dist/lib/message-input.cjs +708 -1
- package/dist/lib/message-input.cjs.map +1 -1
- package/dist/lib/message-input.js +232 -206
- package/dist/lib/message-input.js.map +1 -1
- package/dist/lib/modal.cjs +444 -2
- package/dist/lib/modal.cjs.map +1 -1
- package/dist/lib/modal.js +153 -120
- package/dist/lib/modal.js.map +1 -1
- package/dist/lib/notice.cjs +197 -1
- package/dist/lib/notice.cjs.map +1 -1
- package/dist/lib/notice.js +66 -63
- package/dist/lib/notice.js.map +1 -1
- package/dist/lib/pagination.cjs +205 -1
- package/dist/lib/pagination.cjs.map +1 -1
- package/dist/lib/pagination.js +96 -81
- package/dist/lib/pagination.js.map +1 -1
- package/dist/lib/popover.cjs +1080 -1
- package/dist/lib/popover.cjs.map +1 -1
- package/dist/lib/popover.js +447 -267
- package/dist/lib/popover.js.map +1 -1
- package/dist/lib/presence.cjs +70 -1
- package/dist/lib/presence.cjs.map +1 -1
- package/dist/lib/presence.js +33 -27
- package/dist/lib/presence.js.map +1 -1
- package/dist/lib/radio-group.cjs +88 -1
- package/dist/lib/radio-group.cjs.map +1 -1
- package/dist/lib/radio-group.js +18 -18
- package/dist/lib/radio-group.js.map +1 -1
- package/dist/lib/radio.cjs +162 -1
- package/dist/lib/radio.cjs.map +1 -1
- package/dist/lib/radio.js +66 -57
- package/dist/lib/radio.js.map +1 -1
- package/dist/lib/rich-text-editor.cjs +1137 -1
- package/dist/lib/rich-text-editor.cjs.map +1 -1
- package/dist/lib/rich-text-editor.js +567 -386
- package/dist/lib/rich-text-editor.js.map +1 -1
- package/dist/lib/root-layout.cjs +158 -1
- package/dist/lib/root-layout.cjs.map +1 -1
- package/dist/lib/root-layout.js +33 -31
- package/dist/lib/root-layout.js.map +1 -1
- package/dist/lib/scroller.cjs +1090 -1
- package/dist/lib/scroller.cjs.map +1 -1
- package/dist/lib/scroller.js +668 -345
- package/dist/lib/scroller.js.map +1 -1
- package/dist/lib/select-menu.cjs +312 -1
- package/dist/lib/select-menu.cjs.map +1 -1
- package/dist/lib/select-menu.js +124 -79
- package/dist/lib/select-menu.js.map +1 -1
- package/dist/lib/settings-menu-button.cjs +77 -1
- package/dist/lib/settings-menu-button.cjs.map +1 -1
- package/dist/lib/settings-menu-button.js +31 -30
- package/dist/lib/settings-menu-button.js.map +1 -1
- package/dist/lib/skeleton.cjs +635 -1
- package/dist/lib/skeleton.cjs.map +1 -1
- package/dist/lib/skeleton.js +189 -152
- package/dist/lib/skeleton.js.map +1 -1
- package/dist/lib/stack.cjs +123 -1
- package/dist/lib/stack.cjs.map +1 -1
- package/dist/lib/stack.js +61 -53
- package/dist/lib/stack.js.map +1 -1
- package/dist/lib/tabs.cjs +102 -1
- package/dist/lib/tabs.cjs.map +1 -1
- package/dist/lib/tabs.js +47 -41
- package/dist/lib/tabs.js.map +1 -1
- package/dist/lib/time-pill.cjs +41 -1
- package/dist/lib/time-pill.cjs.map +1 -1
- package/dist/lib/time-pill.js +18 -14
- package/dist/lib/time-pill.js.map +1 -1
- package/dist/lib/toast.cjs +281 -1
- package/dist/lib/toast.cjs.map +1 -1
- package/dist/lib/toast.js +96 -74
- package/dist/lib/toast.js.map +1 -1
- package/dist/lib/toggle.cjs +192 -1
- package/dist/lib/toggle.cjs.map +1 -1
- package/dist/lib/toggle.js +60 -49
- package/dist/lib/toggle.js.map +1 -1
- package/dist/lib/tooltip-directive.cjs +84 -1
- package/dist/lib/tooltip-directive.cjs.map +1 -1
- package/dist/lib/tooltip-directive.js +56 -42
- package/dist/lib/tooltip-directive.js.map +1 -1
- package/dist/lib/tooltip.cjs +460 -1
- package/dist/lib/tooltip.cjs.map +1 -1
- package/dist/lib/tooltip.js +162 -103
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/lib/top-banner-info.cjs +71 -1
- package/dist/lib/top-banner-info.cjs.map +1 -1
- package/dist/lib/top-banner-info.js +27 -22
- package/dist/lib/top-banner-info.js.map +1 -1
- package/dist/lib/unread-pill.cjs +73 -1
- package/dist/lib/unread-pill.cjs.map +1 -1
- package/dist/lib/unread-pill.js +28 -25
- package/dist/lib/unread-pill.js.map +1 -1
- package/dist/lib/validation-messages.cjs +89 -1
- package/dist/lib/validation-messages.cjs.map +1 -1
- package/dist/lib/validation-messages.js +41 -36
- package/dist/lib/validation-messages.js.map +1 -1
- package/dist/style.css +1257 -1
- package/dist/types/components/rich_text_editor/extensions/emoji/EmojiComponent.vue.d.ts +2 -2
- package/dist/types/components/rich_text_editor/extensions/mentions/MentionComponent.vue.d.ts +2 -2
- package/package.json +30 -29
- package/dist/chunks/_plugin-vue_export-helper-6_y-gaV6.js +0 -2
- package/dist/chunks/_plugin-vue_export-helper-6_y-gaV6.js.map +0 -1
- package/dist/chunks/_plugin-vue_export-helper-hUChTQA_.js +0 -10
- package/dist/chunks/_plugin-vue_export-helper-hUChTQA_.js.map +0 -1
- package/dist/chunks/dropdown-UO3UJalk.js +0 -2
- package/dist/chunks/dropdown_constants-EUcDxBrX.js +0 -9
- package/dist/chunks/dropdown_constants-EUcDxBrX.js.map +0 -1
- package/dist/chunks/dropdown_constants-KHFvVI2L.js +0 -2
- package/dist/chunks/dropdown_constants-KHFvVI2L.js.map +0 -1
- package/dist/chunks/icon_constants-2S_OSQ1t.js +0 -2
- package/dist/chunks/index-6tYeqbgP.js +0 -3
- package/dist/chunks/index-IBtQ5jRJ.js +0 -2
- package/dist/chunks/index-IBtQ5jRJ.js.map +0 -1
- package/dist/chunks/index-b4iXYvId.js +0 -399
- package/dist/chunks/index-mRmwpCBG.js +0 -256
- package/dist/chunks/index-mRmwpCBG.js.map +0 -1
- package/dist/chunks/input-0Uksk4DP.js +0 -2
- package/dist/chunks/input_group-AS760Cp7.js +0 -2
- package/dist/chunks/keyboard_list_navigation-F0O8nht0.js +0 -197
- package/dist/chunks/keyboard_list_navigation-N74Bpdq7.js +0 -2
- package/dist/chunks/link_constants-Kn6kP4i1.js +0 -2
- package/dist/chunks/link_constants-vIUB92L4.js +0 -16
- package/dist/chunks/list_item_constants-LTUc74pD.js +0 -13
- package/dist/chunks/list_item_constants-Tsz5CO1m.js +0 -2
- package/dist/chunks/modal-VuMFkZFH.js +0 -82
- package/dist/chunks/modal-qEzlo0Sj.js +0 -2
- package/dist/chunks/notice_action-jO199emq.js +0 -2
- package/dist/chunks/notice_action-tJfD5Qw1.js +0 -209
- package/dist/chunks/notice_constants-c--hBFQw.js +0 -6
- package/dist/chunks/notice_constants-mC6al2Dm.js +0 -2
- package/dist/chunks/popover_constants-hOEhklvr.js +0 -2
- package/dist/chunks/popover_constants-qjlEkroB.js +0 -114
- package/dist/chunks/sr_only_close_button-iD7s1Pbj.js +0 -3
- package/dist/chunks/stack_constants-m9Ickqw0.js +0 -2
- package/dist/chunks/stack_constants-u7tNqGtc.js +0 -13
- package/dist/chunks/tab-GQZFMq83.js +0 -367
- package/dist/chunks/tab-at7WWglk.js +0 -2
- package/dist/lib/constants.cjs +0 -2
- package/dist/lib/dates.cjs +0 -2
- package/dist/lib/dates.js +0 -57
- package/dist/lib/mixins.cjs +0 -2
- package/dist/lib/mixins.js +0 -17
- package/dist/lib/utils.cjs +0 -2
- package/dist/lib/utils.js +0 -171
- package/dist/lib/validators.cjs +0 -2
- package/dist/lib/validators.js +0 -12
- /package/dist/{lib → common}/mixins.js.map +0 -0
package/dist/lib/datepicker.cjs
CHANGED
|
@@ -1,2 +1,855 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("date-fns"),x=require("./stack.cjs"),M=require("./tooltip.cjs"),p=require("./button.cjs"),w=require("./icon.cjs");require("../chunks/stack_constants-m9Ickqw0.js");require("../chunks/_plugin-vue_export-helper-6_y-gaV6.js");require("../chunks/popover_constants-hOEhklvr.js");require("tippy.js");require("./utils.cjs");require("./constants.cjs");require("./lazy-show.cjs");require("../chunks/link_constants-Kn6kP4i1.js");require("@dialpad/dialtone-icons/vue3");require("../chunks/icon_constants-2S_OSQ1t.js");require("@dialpad/dialtone-icons/icons.json");const N=0,q="MMMM",L="long",T=t=>t?new Date(t):new Date,S=(t,r,c)=>{const a=T(JSON.parse(JSON.stringify(t))),n=[];for(let l=0;l<7;l++){const i=s.addDays(a,l),f=s.getMonth(i)!==r;n.push({text:i.getDate(),value:i,currentMonth:!f,isFirstDayOfMonth:i.getDate()===1&&!f,selected:c?i.getDate()===c&&!f:!1})}return n},Y=(t,r)=>!t||!r?!1:s.isEqual(t,r),B=(t,r,c)=>{const a=[],n=T(new Date(r,t)),l=T(new Date(r,t+1,0)),i=N,f=s.startOfWeek(n,{weekStartsOn:i}),D=v=>{const y=S(v,t,c);if(a.push({days:y}),!a[a.length-1].days.some(k=>Y(k.value,l))){const k=s.addDays(v,7);D(k)}};return D(f),a},C=(t,r)=>{const c=[1,2,3,4,5,6,7].map(l=>new Intl.DateTimeFormat(t,{weekday:"short",timeZone:"UTC"}).format(new Date(`2017-01-0${l}T00:00:00+00:00`)).slice(0,2)),a=c.slice(0,r),n=c.slice(r+1,c.length);return[c[r]].concat(...n).concat(...a)},F=(t,r,c)=>new Intl.DateTimeFormat(c,{month:r}).format(new Date(2e3,t,1)),V=t=>{const r=new Date(t),c=s.getDay(r),a=s.addMonths(r,1),n=s.startOfMonth(a),l=s.getDay(n),i=(c-l+7)%7,f=s.addDays(n,i);return s.getDate(f)},E=t=>{const r=new Date(t),c=s.getDay(r);let n=s.endOfMonth(s.subMonths(r,1));for(;s.getDay(n)!==c;)n=s.addDays(n,-1);return s.getDate(n)};function P(t,r){const c=e.ref(s.getMonth(t.selectedDate)),a=e.ref(s.getYear(t.selectedDate)),n=e.ref(null),l=e.ref(0),i=e.ref([]),f=e.computed(()=>B(c.value,a.value,n.value)),D=e.computed(()=>(o,g,$)=>F(o,g,$));e.watch(c,()=>{d(),r("calendar-days",f.value)},{immediate:!0}),e.watch(a,()=>{d(),r("calendar-days",f.value)},{immediate:!0});function v(o){i.value.includes(o)||i.value.push(o)}function y(){i.value[0].$el.focus()}function k(o){switch(o.key){case"ArrowLeft":o.preventDefault(),l.value===0?(l.value=3,i.value[l.value].$el.focus()):(l.value--,i.value[l.value].$el.focus());break;case"ArrowRight":o.preventDefault(),l.value===3?(l.value=0,i.value[l.value].$el.focus()):(l.value++,i.value[l.value].$el.focus());break;case"ArrowDown":o.preventDefault(),r("focus-first-day");break;case"Tab":o.preventDefault(),r("focus-first-day");break;case"Escape":r("close-datepicker");break}}function d(){const o=s.getYear(t.selectedDate),g=s.getMonth(t.selectedDate);o!==a.value||g!==c.value?n.value=null:n.value=s.getDate(t.selectedDate)}function h(o){(c.value===0&&o===-1||c.value===11&&o===1)&&(a.value+=o);const g=s.set(t.selectedDate,{month:c.value,year:a.value}),$=o===1?s.addMonths(g,1):s.subMonths(g,1);c.value=s.getMonth($)}function m(o){a.value=a.value+o}function b(){h(1)}function u(){h(-1)}return{selectMonth:c,selectYear:a,formattedMonth:D,setDayRef:v,focusMonthYearPicker:y,handleKeyDown:k,changeMonth:h,changeYear:m,goToNextMonth:b,goToPrevMonth:u}}const O={id:"calendar-heading",class:"d-datepicker__month-year-title"},A={__name:"month-year-picker",props:{locale:{type:String,required:!0},prevMonthLabel:{type:String,required:!0},nextMonthLabel:{type:String,required:!0},prevYearLabel:{type:String,required:!0},nextYearLabel:{type:String,required:!0},changeToLabel:{type:String,required:!0},selectedDate:{type:Date,required:!0}},emits:["calendar-days","focus-first-day","focus-last-day","close-datepicker"],setup(t,{expose:r,emit:c}){const a=t,n=c,{selectMonth:l,selectYear:i,formattedMonth:f,setDayRef:D,focusMonthYearPicker:v,handleKeyDown:y,changeMonth:k,changeYear:d,goToNextMonth:h,goToPrevMonth:m}=P(a,n);return e.onMounted(()=>{v()}),r({focusMonthYearPicker:v,goToNextMonth:h,goToPrevMonth:m}),(b,u)=>(e.openBlock(),e.createBlock(e.unref(x.DtStack),{direction:"row",class:"d-datepicker__month-year",gap:"300"},{default:e.withCtx(()=>[e.createVNode(e.unref(x.DtStack),{as:"nav",direction:"row",gap:"200",class:"d-datepicker__nav"},{default:e.withCtx(()=>[e.createVNode(e.unref(M.DtTooltip),{message:t.prevYearLabel,placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(p.DtButton),{id:"prevYearButton",ref:o=>{o&&e.unref(D)(o)},size:"xs",importance:"clear",kind:"muted",circle:!0,class:"d-datepicker__nav-btn",type:"button","aria-label":`${t.changeToLabel} ${t.prevYearLabel} ${e.unref(i)-1}`,onClick:u[0]||(u[0]=o=>e.unref(d)(-1)),onKeydown:u[1]||(u[1]=o=>e.unref(y)(o))},{default:e.withCtx(()=>[e.createVNode(e.unref(w.DtIcon),{name:"chevrons-left",size:"200"})]),_:1},8,["aria-label"])]),_:1},8,["message"]),e.createVNode(e.unref(M.DtTooltip),{message:t.prevMonthLabel,placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(p.DtButton),{id:"prevMonthButton",ref:o=>{o&&e.unref(D)(o)},size:"xs",importance:"clear",kind:"muted",circle:!0,class:"d-datepicker__nav-btn",type:"button","aria-label":`${t.changeToLabel} ${t.prevMonthLabel} ${e.unref(f)(e.unref(l)-1,e.unref(L),t.locale)}`,onClick:u[2]||(u[2]=o=>e.unref(k)(-1)),onKeydown:u[3]||(u[3]=o=>e.unref(y)(o))},{default:e.withCtx(()=>[e.createVNode(e.unref(w.DtIcon),{name:"chevron-left",size:"200"})]),_:1},8,["aria-label"])]),_:1},8,["message"])]),_:1}),e.createElementVNode("div",O,e.toDisplayString(e.unref(f)(e.unref(l),e.unref(L),t.locale))+" "+e.toDisplayString(e.unref(i)),1),e.createVNode(e.unref(x.DtStack),{as:"nav",direction:"row",gap:"200",class:"d-datepicker__nav"},{default:e.withCtx(()=>[e.createVNode(e.unref(M.DtTooltip),{message:t.nextMonthLabel,placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(p.DtButton),{id:"nextMonthButton",ref:o=>{o&&e.unref(D)(o)},size:"xs",importance:"clear",kind:"muted",circle:!0,class:"d-datepicker__nav-btn",type:"button","aria-label":`${t.changeToLabel} ${t.nextMonthLabel} ${e.unref(f)(e.unref(l)+1,e.unref(L),t.locale)}`,onClick:u[4]||(u[4]=o=>e.unref(k)(1)),onKeydown:u[5]||(u[5]=o=>e.unref(y)(o))},{default:e.withCtx(()=>[e.createVNode(e.unref(w.DtIcon),{name:"chevron-right",size:"200"})]),_:1},8,["aria-label"])]),_:1},8,["message"]),e.createVNode(e.unref(M.DtTooltip),{message:t.nextYearLabel,placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(p.DtButton),{id:"nextYearButton",ref:o=>{o&&e.unref(D)(o)},size:"xs",importance:"clear",kind:"muted",circle:!0,class:"d-datepicker__nav-btn",type:"button","aria-label":`${t.changeToLabel} ${t.nextYearLabel} ${e.unref(i)+1}`,onClick:u[6]||(u[6]=o=>e.unref(d)(1)),onKeydown:u[7]||(u[7]=o=>e.unref(y)(o))},{default:e.withCtx(()=>[e.createVNode(e.unref(w.DtIcon),{name:"chevrons-right",size:"200"})]),_:1},8,["aria-label"])]),_:1},8,["message"])]),_:1})]),_:1}))}};function I(t,r){const c=e.ref(null),a=e.ref(0),n=e.ref([]),l=e.computed(()=>C(t.locale,N));e.watch(()=>t.calendarDays,()=>{a.value=0,n.value=[],c.value=null});function i(d){return`${t.selectDayLabel} ${d.text} ${s.format(d.value,q)} ${s.getYear(d.value)}`}function f(d,h){!n.value.some(m=>m.el===d)&&h.currentMonth&&n.value.push({el:d,day:h})}function D(d){switch(d.key){case"ArrowUp":d.preventDefault(),a.value-=7;try{n.value[a.value].el.$el.focus()}catch{const m=E(n.value[a.value+7].day.value);r("go-to-prev-month"),e.nextTick(()=>{n.value[m-1].el.$el.focus(),a.value+=m-1})}break;case"ArrowDown":d.preventDefault(),a.value+=7;try{n.value[a.value].el.$el.focus()}catch{const m=V(n.value[a.value-7].day.value);r("go-to-next-month"),e.nextTick(()=>{n.value[m-1].el.$el.focus(),a.value+=m-1})}break;case"ArrowLeft":d.preventDefault(),a.value>0?(a.value-=1,n.value[a.value].el.$el.focus()):(r("go-to-prev-month"),y());break;case"ArrowRight":d.preventDefault(),a.value<n.value.length-1?(a.value+=1,n.value[a.value].el.$el.focus()):(r("go-to-next-month"),v());break;case"Tab":d.preventDefault(),r("focus-month-year-picker");break;case"Escape":r("close-datepicker");break}}function v(){a.value=0,e.nextTick(()=>{n.value[a.value].el.$el.focus()})}function y(){e.nextTick(()=>{a.value=n.value.length-1,n.value[a.value].el.$el.focus()})}function k(d){d.currentMonth&&(c.value=d.text,r("select-date",d.value))}return{selectedDay:c,weekDays:l,dayAriaLabel:i,setDayRef:f,handleKeyDown:D,focusFirstDay:v,selectDay:k}}const R={class:"d-datepicker__calendar","aria-labelledby":"calendar-heading"},z=["title","aria-label"],K={__name:"calendar",props:{calendarDays:{type:Array,required:!0},locale:{type:String,required:!0},selectDayLabel:{type:String,required:!0}},emits:["select-date","focus-month-year-picker","close-datepicker","go-to-next-month","go-to-prev-month"],setup(t,{expose:r,emit:c}){const a=t,n=c,{selectedDay:l,weekDays:i,dayAriaLabel:f,setDayRef:D,handleKeyDown:v,focusFirstDay:y,selectDay:k}=I(a,n);return r({focusFirstDay:y}),(d,h)=>(e.openBlock(),e.createElementBlock("table",R,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),m=>(e.openBlock(),e.createElementBlock("th",{key:m,scope:"col",class:"d-datepicker__cell d-datepicker__cell--header"},[e.createElementVNode("span",{class:"d-datepicker__weekday",title:m,"aria-label":m},e.toDisplayString(m),9,z)]))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.calendarDays,(m,b)=>(e.openBlock(),e.createElementBlock("tr",{key:b},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.days,(u,o)=>(e.openBlock(),e.createElementBlock("td",{key:b+o,class:"d-datepicker__cell",role:"listbox"},[e.createVNode(e.unref(p.DtButton),{ref_for:!0,ref:g=>{g&&e.unref(D)(g,u)},class:e.normalizeClass(["d-datepicker__day",{"d-datepicker__day--disabled":!u.currentMonth,"d-datepicker__day--selected":e.unref(l)?u.text===e.unref(l)&&u.currentMonth:u.selected}]),circle:!0,size:"sm",importance:"clear",disabled:!u.currentMonth,type:"button","aria-selected":e.unref(l)?u.text===e.unref(l)&&u.currentMonth:u.selected,"aria-label":e.unref(f)(u),role:"option",onClick:g=>e.unref(k)(u),onKeydown:h[0]||(h[0]=g=>e.unref(v)(g))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.text),1)]),_:2},1032,["disabled","class","aria-selected","aria-label","onClick"])]))),128))]))),128))])]))}},W={class:"d-datepicker__hd"},G={class:"d-datepicker__bd"},U={__name:"datepicker",props:{prevMonthLabel:{type:String,required:!0},nextMonthLabel:{type:String,required:!0},prevYearLabel:{type:String,required:!0},nextYearLabel:{type:String,required:!0},selectDayLabel:{type:String,required:!0},changeToLabel:{type:String,required:!0},locale:{type:String,default:"en-US"},selectedDate:{type:Date,default:()=>new Date}},emits:["selected-date","close-datepicker"],setup(t){const r=e.ref([]);function c(a){r.value=a}return(a,n)=>(e.openBlock(),e.createBlock(e.unref(x.DtStack),{class:"d-datepicker",gap:"400"},{default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(A,{ref:"monthYearPicker",locale:t.locale,"prev-month-label":t.prevMonthLabel,"next-month-label":t.nextMonthLabel,"prev-year-label":t.prevYearLabel,"next-year-label":t.nextYearLabel,"change-to-label":t.changeToLabel,"selected-date":t.selectedDate,onCalendarDays:c,onFocusFirstDay:n[0]||(n[0]=l=>a.$refs.calendar.focusFirstDay()),onFocusLastDay:n[1]||(n[1]=l=>a.$refs.calendar.focusLastDay()),onCloseDatepicker:n[2]||(n[2]=l=>a.$emit("close-datepicker"))},null,8,["locale","prev-month-label","next-month-label","prev-year-label","next-year-label","change-to-label","selected-date"])]),e.createElementVNode("div",G,[e.createVNode(K,{ref:"calendar",locale:t.locale,"calendar-days":r.value,"select-day-label":t.selectDayLabel,onSelectDate:n[3]||(n[3]=l=>a.$emit("selected-date",l)),onFocusMonthYearPicker:n[4]||(n[4]=l=>a.$refs.monthYearPicker.focusMonthYearPicker()),onCloseDatepicker:n[5]||(n[5]=l=>a.$emit("close-datepicker")),onGoToNextMonth:n[6]||(n[6]=l=>a.$refs.monthYearPicker.goToNextMonth()),onGoToPrevMonth:n[7]||(n[7]=l=>a.$refs.monthYearPicker.goToPrevMonth())},null,8,["locale","calendar-days","select-day-label"])])]),_:1}))}};function H(t,r="default"){return new Intl.DateTimeFormat(r,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(t)}function J(t,r="default"){return new Intl.DateTimeFormat(r,{year:"numeric",month:"long",day:"numeric"}).format(t)}function j(t,r="default",c=!0){const a=c?{weekday:"short",year:"numeric",month:"short",day:"numeric"}:{year:"numeric",month:"short",day:"numeric"};return new Intl.DateTimeFormat(r,a).format(t)}function Z(t,r="default",c=!1){const a=c?"short":"long";return new Intl.DateTimeFormat(r,{month:a,day:"numeric"}).format(t)}function Q(t,r="default"){return new Intl.DateTimeFormat(r,{year:"2-digit",month:"2-digit",day:"2-digit"}).format(t)}exports.DtDatepicker=U;exports.formatLong=H;exports.formatMedium=J;exports.formatNoYear=Z;exports.formatNumerical=Q;exports.formatShort=j;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const dateFns = require("date-fns");
|
|
5
|
+
const lib_stack = require("./stack.cjs");
|
|
6
|
+
const lib_tooltip = require("./tooltip.cjs");
|
|
7
|
+
const lib_button = require("./button.cjs");
|
|
8
|
+
const lib_icon = require("./icon.cjs");
|
|
9
|
+
require("../chunks/stack_constants-SMzMWnAQ.js");
|
|
10
|
+
require("../chunks/_plugin-vue_export-helper-fhnQq0tA.js");
|
|
11
|
+
require("../chunks/popover_constants-JwBF9h1Z.js");
|
|
12
|
+
require("tippy.js");
|
|
13
|
+
require("../common/utils.cjs");
|
|
14
|
+
require("../common/constants.cjs");
|
|
15
|
+
require("./lazy-show.cjs");
|
|
16
|
+
require("../chunks/link_constants-Huj7D_hm.js");
|
|
17
|
+
require("@dialpad/dialtone-icons/vue3");
|
|
18
|
+
require("../chunks/icon_constants-QYpmdE0R.js");
|
|
19
|
+
require("@dialpad/dialtone-icons/icons.json");
|
|
20
|
+
const WEEK_START = 0;
|
|
21
|
+
const MONTH_FORMAT = "MMMM";
|
|
22
|
+
const INTL_MONTH_FORMAT = "long";
|
|
23
|
+
const _parsedGetDate = (value) => value ? new Date(value) : /* @__PURE__ */ new Date();
|
|
24
|
+
const getWeekDays = (startDay, month, selectedDay) => {
|
|
25
|
+
const startDate = _parsedGetDate(JSON.parse(JSON.stringify(startDay)));
|
|
26
|
+
const dates = [];
|
|
27
|
+
for (let i = 0; i < 7; i++) {
|
|
28
|
+
const next = dateFns.addDays(startDate, i);
|
|
29
|
+
const isNext = dateFns.getMonth(next) !== month;
|
|
30
|
+
dates.push({
|
|
31
|
+
text: next.getDate(),
|
|
32
|
+
value: next,
|
|
33
|
+
currentMonth: !isNext,
|
|
34
|
+
isFirstDayOfMonth: next.getDate() === 1 && !isNext,
|
|
35
|
+
// will be selected if the date is the same as the selected day and is from the current month
|
|
36
|
+
selected: selectedDay ? next.getDate() === selectedDay && !isNext : false
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return dates;
|
|
40
|
+
};
|
|
41
|
+
const isDateEqual = (date, dateToCompare) => {
|
|
42
|
+
if (!date || !dateToCompare) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return dateFns.isEqual(date, dateToCompare);
|
|
46
|
+
};
|
|
47
|
+
const getCalendarDays = (month, year, selectedDay) => {
|
|
48
|
+
const weeks = [];
|
|
49
|
+
const firstDate = _parsedGetDate(new Date(year, month));
|
|
50
|
+
const lastDate = _parsedGetDate(new Date(year, month + 1, 0));
|
|
51
|
+
const weekStartsOn = WEEK_START;
|
|
52
|
+
const firstDateInCalendar = dateFns.startOfWeek(firstDate, { weekStartsOn });
|
|
53
|
+
const addDaysToWeek = (date) => {
|
|
54
|
+
const days = getWeekDays(date, month, selectedDay);
|
|
55
|
+
weeks.push({ days });
|
|
56
|
+
if (!weeks[weeks.length - 1].days.some(
|
|
57
|
+
(day) => isDateEqual(day.value, lastDate)
|
|
58
|
+
)) {
|
|
59
|
+
const nextDate = dateFns.addDays(date, 7);
|
|
60
|
+
addDaysToWeek(nextDate);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
addDaysToWeek(firstDateInCalendar);
|
|
64
|
+
return weeks;
|
|
65
|
+
};
|
|
66
|
+
const getWeekDayNames = (locale, weekStart) => {
|
|
67
|
+
const days = [1, 2, 3, 4, 5, 6, 7].map((day) => {
|
|
68
|
+
return new Intl.DateTimeFormat(locale, { weekday: "short", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`2017-01-0${day}T00:00:00+00:00`)).slice(0, 2);
|
|
69
|
+
});
|
|
70
|
+
const beforeWeekStart = days.slice(0, weekStart);
|
|
71
|
+
const afterWeekStart = days.slice(weekStart + 1, days.length);
|
|
72
|
+
return [days[weekStart]].concat(...afterWeekStart).concat(...beforeWeekStart);
|
|
73
|
+
};
|
|
74
|
+
const formatMonth = (month, monthFormat, locale) => {
|
|
75
|
+
return new Intl.DateTimeFormat(locale, { month: monthFormat }).format(new Date(2e3, month, 1));
|
|
76
|
+
};
|
|
77
|
+
const calculateNextFocusDate = (currentDate) => {
|
|
78
|
+
const date = new Date(currentDate);
|
|
79
|
+
const currentWeekday = dateFns.getDay(date);
|
|
80
|
+
const nextMonthDate = dateFns.addMonths(date, 1);
|
|
81
|
+
const nextMonthStart = dateFns.startOfMonth(nextMonthDate);
|
|
82
|
+
const nextMonthStartWeekday = dateFns.getDay(nextMonthStart);
|
|
83
|
+
const dayDifference = (currentWeekday - nextMonthStartWeekday + 7) % 7;
|
|
84
|
+
const focusDate = dateFns.addDays(nextMonthStart, dayDifference);
|
|
85
|
+
return dateFns.getDate(focusDate);
|
|
86
|
+
};
|
|
87
|
+
const calculatePrevFocusDate = (currentDate) => {
|
|
88
|
+
const date = new Date(currentDate);
|
|
89
|
+
const currentWeekday = dateFns.getDay(date);
|
|
90
|
+
const lastDayOfPrevMonth = dateFns.endOfMonth(dateFns.subMonths(date, 1));
|
|
91
|
+
let focusDate = lastDayOfPrevMonth;
|
|
92
|
+
while (dateFns.getDay(focusDate) !== currentWeekday) {
|
|
93
|
+
focusDate = dateFns.addDays(focusDate, -1);
|
|
94
|
+
}
|
|
95
|
+
return dateFns.getDate(focusDate);
|
|
96
|
+
};
|
|
97
|
+
function useMonthYearPicker(props, emits) {
|
|
98
|
+
const selectMonth = vue.ref(dateFns.getMonth(props.selectedDate));
|
|
99
|
+
const selectYear = vue.ref(dateFns.getYear(props.selectedDate));
|
|
100
|
+
const highlightedDay = vue.ref(null);
|
|
101
|
+
const focusPicker = vue.ref(0);
|
|
102
|
+
const focusRefs = vue.ref([]);
|
|
103
|
+
const calendarDays = vue.computed(() => {
|
|
104
|
+
return getCalendarDays(selectMonth.value, selectYear.value, highlightedDay.value);
|
|
105
|
+
});
|
|
106
|
+
const formattedMonth = vue.computed(() => {
|
|
107
|
+
return (month, format, locale) => formatMonth(month, format, locale);
|
|
108
|
+
});
|
|
109
|
+
vue.watch(selectMonth, () => {
|
|
110
|
+
highlightDay();
|
|
111
|
+
emits("calendar-days", calendarDays.value);
|
|
112
|
+
}, { immediate: true });
|
|
113
|
+
vue.watch(selectYear, () => {
|
|
114
|
+
highlightDay();
|
|
115
|
+
emits("calendar-days", calendarDays.value);
|
|
116
|
+
}, { immediate: true });
|
|
117
|
+
function setDayRef(el) {
|
|
118
|
+
if (!focusRefs.value.includes(el)) {
|
|
119
|
+
focusRefs.value.push(el);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function focusMonthYearPicker() {
|
|
123
|
+
focusRefs.value[0].$el.focus();
|
|
124
|
+
}
|
|
125
|
+
function handleKeyDown(event) {
|
|
126
|
+
switch (event.key) {
|
|
127
|
+
case "ArrowLeft":
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
if (focusPicker.value === 0) {
|
|
130
|
+
focusPicker.value = 3;
|
|
131
|
+
focusRefs.value[focusPicker.value].$el.focus();
|
|
132
|
+
} else {
|
|
133
|
+
focusPicker.value--;
|
|
134
|
+
focusRefs.value[focusPicker.value].$el.focus();
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
case "ArrowRight":
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
if (focusPicker.value === 3) {
|
|
140
|
+
focusPicker.value = 0;
|
|
141
|
+
focusRefs.value[focusPicker.value].$el.focus();
|
|
142
|
+
} else {
|
|
143
|
+
focusPicker.value++;
|
|
144
|
+
focusRefs.value[focusPicker.value].$el.focus();
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
case "ArrowDown":
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
emits("focus-first-day");
|
|
150
|
+
break;
|
|
151
|
+
case "Tab":
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
emits("focus-first-day");
|
|
154
|
+
break;
|
|
155
|
+
case "Escape":
|
|
156
|
+
emits("close-datepicker");
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function highlightDay() {
|
|
161
|
+
const year = dateFns.getYear(props.selectedDate);
|
|
162
|
+
const month = dateFns.getMonth(props.selectedDate);
|
|
163
|
+
if (year !== selectYear.value || month !== selectMonth.value) {
|
|
164
|
+
highlightedDay.value = null;
|
|
165
|
+
} else {
|
|
166
|
+
highlightedDay.value = dateFns.getDate(props.selectedDate);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function changeMonth(value) {
|
|
170
|
+
if (selectMonth.value === 0 && value === -1 || selectMonth.value === 11 && value === 1) {
|
|
171
|
+
selectYear.value += value;
|
|
172
|
+
}
|
|
173
|
+
const initialDate = dateFns.set(props.selectedDate, { month: selectMonth.value, year: selectYear.value });
|
|
174
|
+
const newDate = value === 1 ? dateFns.addMonths(initialDate, 1) : dateFns.subMonths(initialDate, 1);
|
|
175
|
+
selectMonth.value = dateFns.getMonth(newDate);
|
|
176
|
+
}
|
|
177
|
+
function changeYear(value) {
|
|
178
|
+
selectYear.value = selectYear.value + value;
|
|
179
|
+
}
|
|
180
|
+
function goToNextMonth() {
|
|
181
|
+
changeMonth(1);
|
|
182
|
+
}
|
|
183
|
+
function goToPrevMonth() {
|
|
184
|
+
changeMonth(-1);
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
selectMonth,
|
|
188
|
+
selectYear,
|
|
189
|
+
formattedMonth,
|
|
190
|
+
setDayRef,
|
|
191
|
+
focusMonthYearPicker,
|
|
192
|
+
handleKeyDown,
|
|
193
|
+
changeMonth,
|
|
194
|
+
changeYear,
|
|
195
|
+
goToNextMonth,
|
|
196
|
+
goToPrevMonth
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
const _hoisted_1$2 = {
|
|
200
|
+
id: "calendar-heading",
|
|
201
|
+
class: "d-datepicker__month-year-title"
|
|
202
|
+
};
|
|
203
|
+
const _sfc_main$2 = {
|
|
204
|
+
__name: "month-year-picker",
|
|
205
|
+
props: {
|
|
206
|
+
locale: {
|
|
207
|
+
type: String,
|
|
208
|
+
required: true
|
|
209
|
+
},
|
|
210
|
+
prevMonthLabel: {
|
|
211
|
+
type: String,
|
|
212
|
+
required: true
|
|
213
|
+
},
|
|
214
|
+
nextMonthLabel: {
|
|
215
|
+
type: String,
|
|
216
|
+
required: true
|
|
217
|
+
},
|
|
218
|
+
prevYearLabel: {
|
|
219
|
+
type: String,
|
|
220
|
+
required: true
|
|
221
|
+
},
|
|
222
|
+
nextYearLabel: {
|
|
223
|
+
type: String,
|
|
224
|
+
required: true
|
|
225
|
+
},
|
|
226
|
+
changeToLabel: {
|
|
227
|
+
type: String,
|
|
228
|
+
required: true
|
|
229
|
+
},
|
|
230
|
+
selectedDate: {
|
|
231
|
+
type: Date,
|
|
232
|
+
required: true
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
emits: [
|
|
236
|
+
/**
|
|
237
|
+
* Will retrieve the calendar days of the given date
|
|
238
|
+
*
|
|
239
|
+
* @event calendar-days
|
|
240
|
+
* @type {Array}
|
|
241
|
+
*/
|
|
242
|
+
"calendar-days",
|
|
243
|
+
/**
|
|
244
|
+
* Will focus first day in calendar
|
|
245
|
+
*
|
|
246
|
+
* @event focus-first-day
|
|
247
|
+
*/
|
|
248
|
+
"focus-first-day",
|
|
249
|
+
/**
|
|
250
|
+
* Will focus last day in calendar
|
|
251
|
+
*
|
|
252
|
+
* @event focus-last-day
|
|
253
|
+
*/
|
|
254
|
+
"focus-last-day",
|
|
255
|
+
/**
|
|
256
|
+
* Will close the datepicker
|
|
257
|
+
*
|
|
258
|
+
* @event close-datepicker
|
|
259
|
+
*/
|
|
260
|
+
"close-datepicker"
|
|
261
|
+
],
|
|
262
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
263
|
+
const props = __props;
|
|
264
|
+
const emits = __emit;
|
|
265
|
+
const {
|
|
266
|
+
selectMonth,
|
|
267
|
+
selectYear,
|
|
268
|
+
formattedMonth,
|
|
269
|
+
setDayRef,
|
|
270
|
+
focusMonthYearPicker,
|
|
271
|
+
handleKeyDown,
|
|
272
|
+
changeMonth,
|
|
273
|
+
changeYear,
|
|
274
|
+
goToNextMonth,
|
|
275
|
+
goToPrevMonth
|
|
276
|
+
} = useMonthYearPicker(props, emits);
|
|
277
|
+
vue.onMounted(() => {
|
|
278
|
+
focusMonthYearPicker();
|
|
279
|
+
});
|
|
280
|
+
__expose({
|
|
281
|
+
focusMonthYearPicker,
|
|
282
|
+
goToNextMonth,
|
|
283
|
+
goToPrevMonth
|
|
284
|
+
});
|
|
285
|
+
return (_ctx, _cache) => {
|
|
286
|
+
return vue.openBlock(), vue.createBlock(vue.unref(lib_stack.DtStack), {
|
|
287
|
+
direction: "row",
|
|
288
|
+
class: "d-datepicker__month-year",
|
|
289
|
+
gap: "300"
|
|
290
|
+
}, {
|
|
291
|
+
default: vue.withCtx(() => [
|
|
292
|
+
vue.createVNode(vue.unref(lib_stack.DtStack), {
|
|
293
|
+
as: "nav",
|
|
294
|
+
direction: "row",
|
|
295
|
+
gap: "200",
|
|
296
|
+
class: "d-datepicker__nav"
|
|
297
|
+
}, {
|
|
298
|
+
default: vue.withCtx(() => [
|
|
299
|
+
vue.createVNode(vue.unref(lib_tooltip.DtTooltip), {
|
|
300
|
+
message: __props.prevYearLabel,
|
|
301
|
+
placement: "top"
|
|
302
|
+
}, {
|
|
303
|
+
anchor: vue.withCtx(() => [
|
|
304
|
+
vue.createVNode(vue.unref(lib_button.DtButton), {
|
|
305
|
+
id: "prevYearButton",
|
|
306
|
+
ref: (el) => {
|
|
307
|
+
if (el)
|
|
308
|
+
vue.unref(setDayRef)(el);
|
|
309
|
+
},
|
|
310
|
+
size: "xs",
|
|
311
|
+
importance: "clear",
|
|
312
|
+
kind: "muted",
|
|
313
|
+
circle: true,
|
|
314
|
+
class: "d-datepicker__nav-btn",
|
|
315
|
+
type: "button",
|
|
316
|
+
"aria-label": `${__props.changeToLabel} ${__props.prevYearLabel} ${vue.unref(selectYear) - 1}`,
|
|
317
|
+
onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(changeYear)(-1)),
|
|
318
|
+
onKeydown: _cache[1] || (_cache[1] = ($event) => vue.unref(handleKeyDown)($event))
|
|
319
|
+
}, {
|
|
320
|
+
default: vue.withCtx(() => [
|
|
321
|
+
vue.createVNode(vue.unref(lib_icon.DtIcon), {
|
|
322
|
+
name: "chevrons-left",
|
|
323
|
+
size: "200"
|
|
324
|
+
})
|
|
325
|
+
]),
|
|
326
|
+
_: 1
|
|
327
|
+
}, 8, ["aria-label"])
|
|
328
|
+
]),
|
|
329
|
+
_: 1
|
|
330
|
+
}, 8, ["message"]),
|
|
331
|
+
vue.createVNode(vue.unref(lib_tooltip.DtTooltip), {
|
|
332
|
+
message: __props.prevMonthLabel,
|
|
333
|
+
placement: "top"
|
|
334
|
+
}, {
|
|
335
|
+
anchor: vue.withCtx(() => [
|
|
336
|
+
vue.createVNode(vue.unref(lib_button.DtButton), {
|
|
337
|
+
id: "prevMonthButton",
|
|
338
|
+
ref: (el) => {
|
|
339
|
+
if (el)
|
|
340
|
+
vue.unref(setDayRef)(el);
|
|
341
|
+
},
|
|
342
|
+
size: "xs",
|
|
343
|
+
importance: "clear",
|
|
344
|
+
kind: "muted",
|
|
345
|
+
circle: true,
|
|
346
|
+
class: "d-datepicker__nav-btn",
|
|
347
|
+
type: "button",
|
|
348
|
+
"aria-label": `${__props.changeToLabel} ${__props.prevMonthLabel} ${vue.unref(formattedMonth)(vue.unref(selectMonth) - 1, vue.unref(INTL_MONTH_FORMAT), __props.locale)}`,
|
|
349
|
+
onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(changeMonth)(-1)),
|
|
350
|
+
onKeydown: _cache[3] || (_cache[3] = ($event) => vue.unref(handleKeyDown)($event))
|
|
351
|
+
}, {
|
|
352
|
+
default: vue.withCtx(() => [
|
|
353
|
+
vue.createVNode(vue.unref(lib_icon.DtIcon), {
|
|
354
|
+
name: "chevron-left",
|
|
355
|
+
size: "200"
|
|
356
|
+
})
|
|
357
|
+
]),
|
|
358
|
+
_: 1
|
|
359
|
+
}, 8, ["aria-label"])
|
|
360
|
+
]),
|
|
361
|
+
_: 1
|
|
362
|
+
}, 8, ["message"])
|
|
363
|
+
]),
|
|
364
|
+
_: 1
|
|
365
|
+
}),
|
|
366
|
+
vue.createElementVNode("div", _hoisted_1$2, vue.toDisplayString(vue.unref(formattedMonth)(vue.unref(selectMonth), vue.unref(INTL_MONTH_FORMAT), __props.locale)) + " " + vue.toDisplayString(vue.unref(selectYear)), 1),
|
|
367
|
+
vue.createVNode(vue.unref(lib_stack.DtStack), {
|
|
368
|
+
as: "nav",
|
|
369
|
+
direction: "row",
|
|
370
|
+
gap: "200",
|
|
371
|
+
class: "d-datepicker__nav"
|
|
372
|
+
}, {
|
|
373
|
+
default: vue.withCtx(() => [
|
|
374
|
+
vue.createVNode(vue.unref(lib_tooltip.DtTooltip), {
|
|
375
|
+
message: __props.nextMonthLabel,
|
|
376
|
+
placement: "top"
|
|
377
|
+
}, {
|
|
378
|
+
anchor: vue.withCtx(() => [
|
|
379
|
+
vue.createVNode(vue.unref(lib_button.DtButton), {
|
|
380
|
+
id: "nextMonthButton",
|
|
381
|
+
ref: (el) => {
|
|
382
|
+
if (el)
|
|
383
|
+
vue.unref(setDayRef)(el);
|
|
384
|
+
},
|
|
385
|
+
size: "xs",
|
|
386
|
+
importance: "clear",
|
|
387
|
+
kind: "muted",
|
|
388
|
+
circle: true,
|
|
389
|
+
class: "d-datepicker__nav-btn",
|
|
390
|
+
type: "button",
|
|
391
|
+
"aria-label": `${__props.changeToLabel} ${__props.nextMonthLabel} ${vue.unref(formattedMonth)(vue.unref(selectMonth) + 1, vue.unref(INTL_MONTH_FORMAT), __props.locale)}`,
|
|
392
|
+
onClick: _cache[4] || (_cache[4] = ($event) => vue.unref(changeMonth)(1)),
|
|
393
|
+
onKeydown: _cache[5] || (_cache[5] = ($event) => vue.unref(handleKeyDown)($event))
|
|
394
|
+
}, {
|
|
395
|
+
default: vue.withCtx(() => [
|
|
396
|
+
vue.createVNode(vue.unref(lib_icon.DtIcon), {
|
|
397
|
+
name: "chevron-right",
|
|
398
|
+
size: "200"
|
|
399
|
+
})
|
|
400
|
+
]),
|
|
401
|
+
_: 1
|
|
402
|
+
}, 8, ["aria-label"])
|
|
403
|
+
]),
|
|
404
|
+
_: 1
|
|
405
|
+
}, 8, ["message"]),
|
|
406
|
+
vue.createVNode(vue.unref(lib_tooltip.DtTooltip), {
|
|
407
|
+
message: __props.nextYearLabel,
|
|
408
|
+
placement: "top"
|
|
409
|
+
}, {
|
|
410
|
+
anchor: vue.withCtx(() => [
|
|
411
|
+
vue.createVNode(vue.unref(lib_button.DtButton), {
|
|
412
|
+
id: "nextYearButton",
|
|
413
|
+
ref: (el) => {
|
|
414
|
+
if (el)
|
|
415
|
+
vue.unref(setDayRef)(el);
|
|
416
|
+
},
|
|
417
|
+
size: "xs",
|
|
418
|
+
importance: "clear",
|
|
419
|
+
kind: "muted",
|
|
420
|
+
circle: true,
|
|
421
|
+
class: "d-datepicker__nav-btn",
|
|
422
|
+
type: "button",
|
|
423
|
+
"aria-label": `${__props.changeToLabel} ${__props.nextYearLabel} ${vue.unref(selectYear) + 1}`,
|
|
424
|
+
onClick: _cache[6] || (_cache[6] = ($event) => vue.unref(changeYear)(1)),
|
|
425
|
+
onKeydown: _cache[7] || (_cache[7] = ($event) => vue.unref(handleKeyDown)($event))
|
|
426
|
+
}, {
|
|
427
|
+
default: vue.withCtx(() => [
|
|
428
|
+
vue.createVNode(vue.unref(lib_icon.DtIcon), {
|
|
429
|
+
name: "chevrons-right",
|
|
430
|
+
size: "200"
|
|
431
|
+
})
|
|
432
|
+
]),
|
|
433
|
+
_: 1
|
|
434
|
+
}, 8, ["aria-label"])
|
|
435
|
+
]),
|
|
436
|
+
_: 1
|
|
437
|
+
}, 8, ["message"])
|
|
438
|
+
]),
|
|
439
|
+
_: 1
|
|
440
|
+
})
|
|
441
|
+
]),
|
|
442
|
+
_: 1
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
function useCalendar(props, emits) {
|
|
448
|
+
const selectedDay = vue.ref(null);
|
|
449
|
+
const focusDay = vue.ref(0);
|
|
450
|
+
const daysRef = vue.ref([]);
|
|
451
|
+
const weekDays = vue.computed(() => {
|
|
452
|
+
return getWeekDayNames(props.locale, WEEK_START);
|
|
453
|
+
});
|
|
454
|
+
vue.watch(() => props.calendarDays, () => {
|
|
455
|
+
focusDay.value = 0;
|
|
456
|
+
daysRef.value = [];
|
|
457
|
+
selectedDay.value = null;
|
|
458
|
+
});
|
|
459
|
+
function dayAriaLabel(day) {
|
|
460
|
+
return `${props.selectDayLabel} ${day.text} ${dateFns.format(day.value, MONTH_FORMAT)} ${dateFns.getYear(day.value)}`;
|
|
461
|
+
}
|
|
462
|
+
function setDayRef(el, day) {
|
|
463
|
+
if (!daysRef.value.some((day2) => day2.el === el) && day.currentMonth) {
|
|
464
|
+
daysRef.value.push({ el, day });
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function handleKeyDown(event) {
|
|
468
|
+
switch (event.key) {
|
|
469
|
+
case "ArrowUp":
|
|
470
|
+
event.preventDefault();
|
|
471
|
+
focusDay.value -= 7;
|
|
472
|
+
try {
|
|
473
|
+
daysRef.value[focusDay.value].el.$el.focus();
|
|
474
|
+
} catch (error) {
|
|
475
|
+
const prevFocusDate = calculatePrevFocusDate(daysRef.value[focusDay.value + 7].day.value);
|
|
476
|
+
emits("go-to-prev-month");
|
|
477
|
+
vue.nextTick(() => {
|
|
478
|
+
daysRef.value[prevFocusDate - 1].el.$el.focus();
|
|
479
|
+
focusDay.value += prevFocusDate - 1;
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
break;
|
|
483
|
+
case "ArrowDown":
|
|
484
|
+
event.preventDefault();
|
|
485
|
+
focusDay.value += 7;
|
|
486
|
+
try {
|
|
487
|
+
daysRef.value[focusDay.value].el.$el.focus();
|
|
488
|
+
} catch (error) {
|
|
489
|
+
const nextFocusDate = calculateNextFocusDate(daysRef.value[focusDay.value - 7].day.value);
|
|
490
|
+
emits("go-to-next-month");
|
|
491
|
+
vue.nextTick(() => {
|
|
492
|
+
daysRef.value[nextFocusDate - 1].el.$el.focus();
|
|
493
|
+
focusDay.value += nextFocusDate - 1;
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
break;
|
|
497
|
+
case "ArrowLeft":
|
|
498
|
+
event.preventDefault();
|
|
499
|
+
if (focusDay.value > 0) {
|
|
500
|
+
focusDay.value -= 1;
|
|
501
|
+
daysRef.value[focusDay.value].el.$el.focus();
|
|
502
|
+
} else {
|
|
503
|
+
emits("go-to-prev-month");
|
|
504
|
+
focusLastDay();
|
|
505
|
+
}
|
|
506
|
+
break;
|
|
507
|
+
case "ArrowRight":
|
|
508
|
+
event.preventDefault();
|
|
509
|
+
if (focusDay.value < daysRef.value.length - 1) {
|
|
510
|
+
focusDay.value += 1;
|
|
511
|
+
daysRef.value[focusDay.value].el.$el.focus();
|
|
512
|
+
} else {
|
|
513
|
+
emits("go-to-next-month");
|
|
514
|
+
focusFirstDay();
|
|
515
|
+
}
|
|
516
|
+
break;
|
|
517
|
+
case "Tab":
|
|
518
|
+
event.preventDefault();
|
|
519
|
+
emits("focus-month-year-picker");
|
|
520
|
+
break;
|
|
521
|
+
case "Escape":
|
|
522
|
+
emits("close-datepicker");
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
function focusFirstDay() {
|
|
527
|
+
focusDay.value = 0;
|
|
528
|
+
vue.nextTick(() => {
|
|
529
|
+
daysRef.value[focusDay.value].el.$el.focus();
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
function focusLastDay() {
|
|
533
|
+
vue.nextTick(() => {
|
|
534
|
+
focusDay.value = daysRef.value.length - 1;
|
|
535
|
+
daysRef.value[focusDay.value].el.$el.focus();
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function selectDay(day) {
|
|
539
|
+
if (!day.currentMonth) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
selectedDay.value = day.text;
|
|
543
|
+
emits("select-date", day.value);
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
selectedDay,
|
|
547
|
+
weekDays,
|
|
548
|
+
dayAriaLabel,
|
|
549
|
+
setDayRef,
|
|
550
|
+
handleKeyDown,
|
|
551
|
+
focusFirstDay,
|
|
552
|
+
selectDay
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
const _hoisted_1$1 = {
|
|
556
|
+
class: "d-datepicker__calendar",
|
|
557
|
+
"aria-labelledby": "calendar-heading"
|
|
558
|
+
};
|
|
559
|
+
const _hoisted_2$1 = ["title", "aria-label"];
|
|
560
|
+
const _sfc_main$1 = {
|
|
561
|
+
__name: "calendar",
|
|
562
|
+
props: {
|
|
563
|
+
calendarDays: {
|
|
564
|
+
type: Array,
|
|
565
|
+
required: true
|
|
566
|
+
},
|
|
567
|
+
locale: {
|
|
568
|
+
type: String,
|
|
569
|
+
required: true
|
|
570
|
+
},
|
|
571
|
+
selectDayLabel: {
|
|
572
|
+
type: String,
|
|
573
|
+
required: true
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
emits: [
|
|
577
|
+
/**
|
|
578
|
+
* Event fired when a date is selected
|
|
579
|
+
*
|
|
580
|
+
* @event select-date
|
|
581
|
+
* @type {Date}
|
|
582
|
+
*/
|
|
583
|
+
"select-date",
|
|
584
|
+
/**
|
|
585
|
+
* Will focus the month and year picker
|
|
586
|
+
*
|
|
587
|
+
* @event focus-month-year-picker
|
|
588
|
+
*/
|
|
589
|
+
"focus-month-year-picker",
|
|
590
|
+
/**
|
|
591
|
+
* Will close the datepicker
|
|
592
|
+
*
|
|
593
|
+
* @event close-datepicker
|
|
594
|
+
*/
|
|
595
|
+
"close-datepicker",
|
|
596
|
+
/**
|
|
597
|
+
* Will go to the next month
|
|
598
|
+
*
|
|
599
|
+
* @event go-to-next-month
|
|
600
|
+
*/
|
|
601
|
+
"go-to-next-month",
|
|
602
|
+
/**
|
|
603
|
+
* Will go to the previous month
|
|
604
|
+
*
|
|
605
|
+
* @event go-to-prev-month
|
|
606
|
+
*/
|
|
607
|
+
"go-to-prev-month"
|
|
608
|
+
],
|
|
609
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
610
|
+
const props = __props;
|
|
611
|
+
const emits = __emit;
|
|
612
|
+
const {
|
|
613
|
+
selectedDay,
|
|
614
|
+
weekDays,
|
|
615
|
+
dayAriaLabel,
|
|
616
|
+
setDayRef,
|
|
617
|
+
handleKeyDown,
|
|
618
|
+
focusFirstDay,
|
|
619
|
+
selectDay
|
|
620
|
+
} = useCalendar(props, emits);
|
|
621
|
+
__expose({
|
|
622
|
+
focusFirstDay
|
|
623
|
+
});
|
|
624
|
+
return (_ctx, _cache) => {
|
|
625
|
+
return vue.openBlock(), vue.createElementBlock("table", _hoisted_1$1, [
|
|
626
|
+
vue.createElementVNode("thead", null, [
|
|
627
|
+
vue.createElementVNode("tr", null, [
|
|
628
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
|
|
629
|
+
return vue.openBlock(), vue.createElementBlock("th", {
|
|
630
|
+
key: day,
|
|
631
|
+
scope: "col",
|
|
632
|
+
class: "d-datepicker__cell d-datepicker__cell--header"
|
|
633
|
+
}, [
|
|
634
|
+
vue.createElementVNode("span", {
|
|
635
|
+
class: "d-datepicker__weekday",
|
|
636
|
+
title: day,
|
|
637
|
+
"aria-label": day
|
|
638
|
+
}, vue.toDisplayString(day), 9, _hoisted_2$1)
|
|
639
|
+
]);
|
|
640
|
+
}), 128))
|
|
641
|
+
])
|
|
642
|
+
]),
|
|
643
|
+
vue.createElementVNode("tbody", null, [
|
|
644
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.calendarDays, (week, indexWeek) => {
|
|
645
|
+
return vue.openBlock(), vue.createElementBlock("tr", { key: indexWeek }, [
|
|
646
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(week.days, (day, indexDays) => {
|
|
647
|
+
return vue.openBlock(), vue.createElementBlock("td", {
|
|
648
|
+
key: indexWeek + indexDays,
|
|
649
|
+
class: "d-datepicker__cell",
|
|
650
|
+
role: "listbox"
|
|
651
|
+
}, [
|
|
652
|
+
vue.createVNode(vue.unref(lib_button.DtButton), {
|
|
653
|
+
ref_for: true,
|
|
654
|
+
ref: (el) => {
|
|
655
|
+
if (el)
|
|
656
|
+
vue.unref(setDayRef)(el, day);
|
|
657
|
+
},
|
|
658
|
+
class: vue.normalizeClass(["d-datepicker__day", {
|
|
659
|
+
"d-datepicker__day--disabled": !day.currentMonth,
|
|
660
|
+
"d-datepicker__day--selected": vue.unref(selectedDay) ? day.text === vue.unref(selectedDay) && day.currentMonth : day.selected
|
|
661
|
+
}]),
|
|
662
|
+
circle: true,
|
|
663
|
+
size: "sm",
|
|
664
|
+
importance: "clear",
|
|
665
|
+
disabled: !day.currentMonth,
|
|
666
|
+
type: "button",
|
|
667
|
+
"aria-selected": !!vue.unref(selectedDay) ? day.text === vue.unref(selectedDay) && day.currentMonth : day.selected,
|
|
668
|
+
"aria-label": vue.unref(dayAriaLabel)(day),
|
|
669
|
+
role: "option",
|
|
670
|
+
onClick: ($event) => vue.unref(selectDay)(day),
|
|
671
|
+
onKeydown: _cache[0] || (_cache[0] = ($event) => vue.unref(handleKeyDown)($event))
|
|
672
|
+
}, {
|
|
673
|
+
default: vue.withCtx(() => [
|
|
674
|
+
vue.createTextVNode(vue.toDisplayString(day.text), 1)
|
|
675
|
+
]),
|
|
676
|
+
_: 2
|
|
677
|
+
}, 1032, ["disabled", "class", "aria-selected", "aria-label", "onClick"])
|
|
678
|
+
]);
|
|
679
|
+
}), 128))
|
|
680
|
+
]);
|
|
681
|
+
}), 128))
|
|
682
|
+
])
|
|
683
|
+
]);
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
const _hoisted_1 = { class: "d-datepicker__hd" };
|
|
688
|
+
const _hoisted_2 = { class: "d-datepicker__bd" };
|
|
689
|
+
const _sfc_main = {
|
|
690
|
+
__name: "datepicker",
|
|
691
|
+
props: {
|
|
692
|
+
/**
|
|
693
|
+
* Label for the previous month button
|
|
694
|
+
*
|
|
695
|
+
* @type {String}
|
|
696
|
+
* @example 'Previous month'
|
|
697
|
+
*/
|
|
698
|
+
prevMonthLabel: {
|
|
699
|
+
type: String,
|
|
700
|
+
required: true
|
|
701
|
+
},
|
|
702
|
+
/**
|
|
703
|
+
* Label for the next month button
|
|
704
|
+
*
|
|
705
|
+
* @type {String}
|
|
706
|
+
* @example 'Next month'
|
|
707
|
+
*/
|
|
708
|
+
nextMonthLabel: {
|
|
709
|
+
type: String,
|
|
710
|
+
required: true
|
|
711
|
+
},
|
|
712
|
+
/**
|
|
713
|
+
* Label for the previous year button
|
|
714
|
+
*
|
|
715
|
+
* @type {String}
|
|
716
|
+
* @example 'Previous year'
|
|
717
|
+
*/
|
|
718
|
+
prevYearLabel: {
|
|
719
|
+
type: String,
|
|
720
|
+
required: true
|
|
721
|
+
},
|
|
722
|
+
/**
|
|
723
|
+
* Label for the next year button
|
|
724
|
+
*
|
|
725
|
+
* @type {String}
|
|
726
|
+
* @example 'Next year'
|
|
727
|
+
*/
|
|
728
|
+
nextYearLabel: {
|
|
729
|
+
type: String,
|
|
730
|
+
required: true
|
|
731
|
+
},
|
|
732
|
+
/**
|
|
733
|
+
* Label for the select day button
|
|
734
|
+
*
|
|
735
|
+
* @type {String}
|
|
736
|
+
* @example 'Select day'
|
|
737
|
+
*/
|
|
738
|
+
selectDayLabel: {
|
|
739
|
+
type: String,
|
|
740
|
+
required: true
|
|
741
|
+
},
|
|
742
|
+
/**
|
|
743
|
+
* Label for the change to button
|
|
744
|
+
*
|
|
745
|
+
* @type {String}
|
|
746
|
+
* @example 'Change to'
|
|
747
|
+
*/
|
|
748
|
+
changeToLabel: {
|
|
749
|
+
type: String,
|
|
750
|
+
required: true
|
|
751
|
+
},
|
|
752
|
+
/**
|
|
753
|
+
* Locale for the calendar
|
|
754
|
+
*
|
|
755
|
+
* @type {String}
|
|
756
|
+
*/
|
|
757
|
+
locale: {
|
|
758
|
+
type: String,
|
|
759
|
+
default: "en-US"
|
|
760
|
+
},
|
|
761
|
+
/**
|
|
762
|
+
* Selected date
|
|
763
|
+
*
|
|
764
|
+
* @type {Date}
|
|
765
|
+
*/
|
|
766
|
+
selectedDate: {
|
|
767
|
+
type: Date,
|
|
768
|
+
default: () => /* @__PURE__ */ new Date()
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
emits: [
|
|
772
|
+
/**
|
|
773
|
+
* Event fired when a date is selected
|
|
774
|
+
*
|
|
775
|
+
* @event selected-date
|
|
776
|
+
* @type {Date}
|
|
777
|
+
*/
|
|
778
|
+
"selected-date",
|
|
779
|
+
/**
|
|
780
|
+
* Event fired when user presses the esc key
|
|
781
|
+
*
|
|
782
|
+
* @event close-datepicker
|
|
783
|
+
*/
|
|
784
|
+
"close-datepicker"
|
|
785
|
+
],
|
|
786
|
+
setup(__props) {
|
|
787
|
+
const calendarDays = vue.ref([]);
|
|
788
|
+
function updateCalendarDays(days) {
|
|
789
|
+
calendarDays.value = days;
|
|
790
|
+
}
|
|
791
|
+
return (_ctx, _cache) => {
|
|
792
|
+
return vue.openBlock(), vue.createBlock(vue.unref(lib_stack.DtStack), {
|
|
793
|
+
class: "d-datepicker",
|
|
794
|
+
gap: "400"
|
|
795
|
+
}, {
|
|
796
|
+
default: vue.withCtx(() => [
|
|
797
|
+
vue.createElementVNode("div", _hoisted_1, [
|
|
798
|
+
vue.createVNode(_sfc_main$2, {
|
|
799
|
+
ref: "monthYearPicker",
|
|
800
|
+
locale: __props.locale,
|
|
801
|
+
"prev-month-label": __props.prevMonthLabel,
|
|
802
|
+
"next-month-label": __props.nextMonthLabel,
|
|
803
|
+
"prev-year-label": __props.prevYearLabel,
|
|
804
|
+
"next-year-label": __props.nextYearLabel,
|
|
805
|
+
"change-to-label": __props.changeToLabel,
|
|
806
|
+
"selected-date": __props.selectedDate,
|
|
807
|
+
onCalendarDays: updateCalendarDays,
|
|
808
|
+
onFocusFirstDay: _cache[0] || (_cache[0] = ($event) => _ctx.$refs.calendar.focusFirstDay()),
|
|
809
|
+
onFocusLastDay: _cache[1] || (_cache[1] = ($event) => _ctx.$refs.calendar.focusLastDay()),
|
|
810
|
+
onCloseDatepicker: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("close-datepicker"))
|
|
811
|
+
}, null, 8, ["locale", "prev-month-label", "next-month-label", "prev-year-label", "next-year-label", "change-to-label", "selected-date"])
|
|
812
|
+
]),
|
|
813
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
814
|
+
vue.createVNode(_sfc_main$1, {
|
|
815
|
+
ref: "calendar",
|
|
816
|
+
locale: __props.locale,
|
|
817
|
+
"calendar-days": calendarDays.value,
|
|
818
|
+
"select-day-label": __props.selectDayLabel,
|
|
819
|
+
onSelectDate: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("selected-date", $event)),
|
|
820
|
+
onFocusMonthYearPicker: _cache[4] || (_cache[4] = ($event) => _ctx.$refs.monthYearPicker.focusMonthYearPicker()),
|
|
821
|
+
onCloseDatepicker: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("close-datepicker")),
|
|
822
|
+
onGoToNextMonth: _cache[6] || (_cache[6] = ($event) => _ctx.$refs.monthYearPicker.goToNextMonth()),
|
|
823
|
+
onGoToPrevMonth: _cache[7] || (_cache[7] = ($event) => _ctx.$refs.monthYearPicker.goToPrevMonth())
|
|
824
|
+
}, null, 8, ["locale", "calendar-days", "select-day-label"])
|
|
825
|
+
])
|
|
826
|
+
]),
|
|
827
|
+
_: 1
|
|
828
|
+
});
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
function formatLong(date, locale = "default") {
|
|
833
|
+
return new Intl.DateTimeFormat(locale, { weekday: "long", year: "numeric", month: "long", day: "numeric" }).format(date);
|
|
834
|
+
}
|
|
835
|
+
function formatMedium(date, locale = "default") {
|
|
836
|
+
return new Intl.DateTimeFormat(locale, { year: "numeric", month: "long", day: "numeric" }).format(date);
|
|
837
|
+
}
|
|
838
|
+
function formatShort(date, locale = "default", showWeekday = true) {
|
|
839
|
+
const options = showWeekday ? { weekday: "short", year: "numeric", month: "short", day: "numeric" } : { year: "numeric", month: "short", day: "numeric" };
|
|
840
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
841
|
+
}
|
|
842
|
+
function formatNoYear(date, locale = "default", abbreviated = false) {
|
|
843
|
+
const monthFormat = abbreviated ? "short" : "long";
|
|
844
|
+
return new Intl.DateTimeFormat(locale, { month: monthFormat, day: "numeric" }).format(date);
|
|
845
|
+
}
|
|
846
|
+
function formatNumerical(date, locale = "default") {
|
|
847
|
+
return new Intl.DateTimeFormat(locale, { year: "2-digit", month: "2-digit", day: "2-digit" }).format(date);
|
|
848
|
+
}
|
|
849
|
+
exports.DtDatepicker = _sfc_main;
|
|
850
|
+
exports.formatLong = formatLong;
|
|
851
|
+
exports.formatMedium = formatMedium;
|
|
852
|
+
exports.formatNoYear = formatNoYear;
|
|
853
|
+
exports.formatNumerical = formatNumerical;
|
|
854
|
+
exports.formatShort = formatShort;
|
|
2
855
|
//# sourceMappingURL=datepicker.cjs.map
|