@dialpad/dialtone-vue 2.126.0 → 2.127.1
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-vue2_normalizer-1aBeR4AK.js +59 -0
- package/dist/chunks/_plugin-vue2_normalizer-1aBeR4AK.js.map +1 -0
- package/dist/chunks/_plugin-vue2_normalizer-sOSkiPF3.js +60 -0
- package/dist/chunks/_plugin-vue2_normalizer-sOSkiPF3.js.map +1 -0
- package/dist/chunks/{dropdown-SMWaTWyF.js → dropdown-DTtcQEFC.js} +131 -84
- package/dist/chunks/{dropdown-SMWaTWyF.js.map → dropdown-DTtcQEFC.js.map} +1 -1
- package/dist/chunks/dropdown-IaLNHmVd.js +403 -0
- package/dist/chunks/dropdown-IaLNHmVd.js.map +1 -0
- 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-OpYAAKwF.js.map → icon_constants-Dy4MEUJL.js.map} +1 -1
- package/dist/chunks/icon_constants-QYpmdE0R.js +16 -0
- package/dist/chunks/icon_constants-QYpmdE0R.js.map +1 -0
- package/dist/chunks/index-DUr1xHR0.js +442 -0
- package/dist/chunks/{index-nIyl_PL6.js.map → index-DUr1xHR0.js.map} +1 -1
- package/dist/chunks/index-IA-Z8fgm.js +441 -0
- package/dist/chunks/index-IA-Z8fgm.js.map +1 -0
- package/dist/chunks/{input-1tm09l_-.js → input-6kbd8Pju.js} +83 -60
- package/dist/chunks/{input-1tm09l_-.js.map → input-6kbd8Pju.js.map} +1 -1
- package/dist/chunks/input-Axw-wFj2.js +295 -0
- package/dist/chunks/input-Axw-wFj2.js.map +1 -0
- package/dist/chunks/input_group-m3cWYUfI.js +143 -0
- package/dist/chunks/{input_group-zcAq3DQl.js.map → input_group-m3cWYUfI.js.map} +1 -1
- package/dist/chunks/{input_group-zcAq3DQl.js → input_group-qVZaS5Bb.js} +27 -24
- package/dist/chunks/input_group-qVZaS5Bb.js.map +1 -0
- package/dist/chunks/keyboard_list_navigation-ScXhrxya.js +284 -0
- package/dist/chunks/{keyboard_list_navigation-F0O8nht0.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-fJnl_Iox.js.map +1 -0
- package/dist/chunks/link_constants-Huj7D_hm.js +22 -0
- package/dist/chunks/{link_constants-vIUB92L4.js.map → link_constants-Huj7D_hm.js.map} +1 -1
- package/dist/chunks/link_constants-nWVlXQBs.js +23 -0
- package/dist/chunks/link_constants-nWVlXQBs.js.map +1 -0
- package/dist/chunks/list_item_constants-EiqkqZvP.js +13 -0
- package/dist/chunks/{list_item_constants-LTUc74pD.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-u1xcN9Dd.js.map +1 -0
- package/dist/chunks/modal-VgxXAQFP.js +105 -0
- package/dist/chunks/{modal-VuMFkZFH.js.map → modal-VgxXAQFP.js.map} +1 -1
- package/dist/chunks/modal-XOr4kiNZ.js +106 -0
- package/dist/chunks/modal-XOr4kiNZ.js.map +1 -0
- package/dist/chunks/notice_action-IRUoLX2d.js +196 -0
- package/dist/chunks/{notice_action-9NmtQRai.js.map → notice_action-IRUoLX2d.js.map} +1 -1
- package/dist/chunks/notice_action-P6uDyE9x.js +195 -0
- package/dist/chunks/notice_action-P6uDyE9x.js.map +1 -0
- package/dist/chunks/notice_constants-7Qt2CQEY.js +7 -0
- package/dist/chunks/{notice_constants-c--hBFQw.js.map → notice_constants-7Qt2CQEY.js.map} +1 -1
- package/dist/chunks/notice_constants-UXo9e3bS.js +6 -0
- package/dist/chunks/notice_constants-UXo9e3bS.js.map +1 -0
- package/dist/chunks/popover_constants-JwBF9h1Z.js +143 -0
- package/dist/chunks/{popover_constants-qjlEkroB.js.map → popover_constants-JwBF9h1Z.js.map} +1 -1
- package/dist/chunks/popover_constants-Qkpb0yh2.js +144 -0
- package/dist/chunks/popover_constants-Qkpb0yh2.js.map +1 -0
- package/dist/chunks/sr_only_close_button-81bHIpPu.js +95 -0
- package/dist/chunks/{sr_only_close_button-JGole5Xi.js.map → sr_only_close_button-81bHIpPu.js.map} +1 -1
- package/dist/chunks/sr_only_close_button-ZaGdAHz7.js +94 -0
- package/dist/chunks/sr_only_close_button-ZaGdAHz7.js.map +1 -0
- package/dist/chunks/stack_constants-HraCekPm.js +15 -0
- package/dist/chunks/{stack_constants-u7tNqGtc.js.map → stack_constants-HraCekPm.js.map} +1 -1
- package/dist/chunks/stack_constants-SMzMWnAQ.js +14 -0
- package/dist/chunks/stack_constants-SMzMWnAQ.js.map +1 -0
- package/dist/chunks/tab-FcsV5VmK.js +386 -0
- package/dist/chunks/tab-FcsV5VmK.js.map +1 -0
- package/dist/chunks/tab-V4cb44Ry.js +387 -0
- package/dist/chunks/{tab-Qm9LVkYj.js.map → tab-V4cb44Ry.js.map} +1 -1
- package/dist/common/constants.cjs +60 -0
- package/dist/common/constants.cjs.map +1 -0
- 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/common/dates.cjs.map +1 -0
- 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/common/mixins.cjs.map +1 -0
- package/dist/common/mixins.js +17 -0
- package/dist/common/utils.cjs +237 -0
- package/dist/common/utils.cjs.map +1 -0
- package/dist/common/utils.js +237 -0
- package/dist/{lib → common}/utils.js.map +1 -1
- package/dist/common/validators.cjs +23 -0
- package/dist/common/validators.cjs.map +1 -0
- package/dist/common/validators.js +23 -0
- package/dist/{lib → common}/validators.js.map +1 -1
- package/dist/component-documentation.json +1 -1
- package/dist/dialtone-vue.cjs +373 -0
- package/dist/dialtone-vue.cjs.map +1 -0
- package/dist/dialtone-vue.js +325 -324
- package/dist/dialtone-vue.js.map +1 -1
- package/dist/lib/attachment-carousel.cjs +261 -0
- package/dist/lib/attachment-carousel.cjs.map +1 -0
- package/dist/lib/attachment-carousel.js +96 -85
- package/dist/lib/attachment-carousel.js.map +1 -1
- package/dist/lib/avatar.cjs +400 -0
- package/dist/lib/avatar.cjs.map +1 -0
- package/dist/lib/avatar.js +111 -80
- package/dist/lib/avatar.js.map +1 -1
- package/dist/lib/badge.cjs +183 -0
- package/dist/lib/badge.cjs.map +1 -0
- package/dist/lib/badge.js +53 -39
- package/dist/lib/badge.js.map +1 -1
- package/dist/lib/banner.cjs +210 -0
- package/dist/lib/banner.cjs.map +1 -0
- package/dist/lib/banner.js +58 -48
- package/dist/lib/banner.js.map +1 -1
- package/dist/lib/breadcrumbs.cjs +147 -0
- package/dist/lib/breadcrumbs.cjs.map +1 -0
- package/dist/lib/breadcrumbs.js +57 -48
- package/dist/lib/breadcrumbs.js.map +1 -1
- package/dist/lib/button-group.cjs +48 -0
- package/dist/lib/button-group.cjs.map +1 -0
- package/dist/lib/button-group.js +21 -18
- package/dist/lib/button-group.js.map +1 -1
- package/dist/lib/button.cjs +350 -0
- package/dist/lib/button.cjs.map +1 -0
- package/dist/lib/button.js +98 -76
- package/dist/lib/button.js.map +1 -1
- package/dist/lib/callbar-button-with-popover.cjs +250 -0
- package/dist/lib/callbar-button-with-popover.cjs.map +1 -0
- package/dist/lib/callbar-button-with-popover.js +66 -51
- package/dist/lib/callbar-button-with-popover.js.map +1 -1
- package/dist/lib/callbar-button.cjs +183 -0
- package/dist/lib/callbar-button.cjs.map +1 -0
- package/dist/lib/callbar-button.js +42 -34
- package/dist/lib/callbar-button.js.map +1 -1
- package/dist/lib/callbox.cjs +147 -0
- package/dist/lib/callbox.cjs.map +1 -0
- package/dist/lib/callbox.js +38 -33
- package/dist/lib/callbox.js.map +1 -1
- package/dist/lib/card.cjs +74 -0
- package/dist/lib/card.cjs.map +1 -0
- package/dist/lib/card.js +22 -20
- package/dist/lib/card.js.map +1 -1
- package/dist/lib/checkbox-group.cjs +130 -0
- package/dist/lib/checkbox-group.cjs.map +1 -0
- package/dist/lib/checkbox-group.js +42 -29
- package/dist/lib/checkbox-group.js.map +1 -1
- package/dist/lib/checkbox.cjs +128 -0
- package/dist/lib/checkbox.cjs.map +1 -0
- package/dist/lib/checkbox.js +46 -35
- package/dist/lib/checkbox.js.map +1 -1
- package/dist/lib/chip.cjs +199 -0
- package/dist/lib/chip.cjs.map +1 -0
- package/dist/lib/chip.js +59 -46
- package/dist/lib/chip.js.map +1 -1
- package/dist/lib/codeblock.cjs +30 -0
- package/dist/lib/codeblock.cjs.map +1 -0
- package/dist/lib/codeblock.js +15 -14
- package/dist/lib/codeblock.js.map +1 -1
- package/dist/lib/collapsible.cjs +335 -0
- package/dist/lib/collapsible.cjs.map +1 -0
- package/dist/lib/collapsible.js +91 -69
- package/dist/lib/collapsible.js.map +1 -1
- package/dist/lib/combobox-multi-select.cjs +520 -0
- package/dist/lib/combobox-multi-select.cjs.map +1 -0
- package/dist/lib/combobox-multi-select.js +223 -136
- package/dist/lib/combobox-multi-select.js.map +1 -1
- package/dist/lib/combobox-with-popover.cjs +385 -0
- package/dist/lib/combobox-with-popover.cjs.map +1 -0
- package/dist/lib/combobox-with-popover.js +131 -87
- package/dist/lib/combobox-with-popover.js.map +1 -1
- package/dist/lib/combobox.cjs +19 -0
- package/dist/lib/combobox.cjs.map +1 -0
- package/dist/lib/combobox.js +9 -9
- package/dist/lib/contact-info.cjs +146 -0
- package/dist/lib/contact-info.cjs.map +1 -0
- package/dist/lib/contact-info.js +34 -33
- package/dist/lib/contact-info.js.map +1 -1
- package/dist/lib/contact-row.cjs +206 -0
- package/dist/lib/contact-row.cjs.map +1 -0
- package/dist/lib/contact-row.js +42 -39
- package/dist/lib/contact-row.js.map +1 -1
- package/dist/lib/datepicker.cjs +663 -0
- package/dist/lib/datepicker.cjs.map +1 -0
- package/dist/lib/datepicker.js +330 -219
- package/dist/lib/datepicker.js.map +1 -1
- package/dist/lib/description-list.cjs +115 -0
- package/dist/lib/description-list.cjs.map +1 -0
- package/dist/lib/description-list.js +51 -19
- package/dist/lib/description-list.js.map +1 -1
- package/dist/lib/dropdown.cjs +46 -0
- package/dist/lib/dropdown.cjs.map +1 -0
- package/dist/lib/dropdown.js +27 -26
- package/dist/lib/dropdown.js.map +1 -1
- package/dist/lib/editor.cjs +556 -0
- package/dist/lib/editor.cjs.map +1 -0
- package/dist/lib/editor.js +191 -162
- package/dist/lib/editor.js.map +1 -1
- package/dist/lib/emoji-picker.cjs +1064 -0
- package/dist/lib/emoji-picker.cjs.map +1 -0
- package/dist/lib/emoji-picker.js +638 -375
- package/dist/lib/emoji-picker.js.map +1 -1
- package/dist/lib/emoji-row.cjs +89 -0
- package/dist/lib/emoji-row.cjs.map +1 -0
- package/dist/lib/emoji-row.js +46 -40
- package/dist/lib/emoji-row.js.map +1 -1
- package/dist/lib/emoji-text-wrapper.cjs +110 -0
- package/dist/lib/emoji-text-wrapper.cjs.map +1 -0
- package/dist/lib/emoji-text-wrapper.js +49 -35
- package/dist/lib/emoji-text-wrapper.js.map +1 -1
- package/dist/lib/emoji.cjs +146 -0
- package/dist/lib/emoji.cjs.map +1 -0
- package/dist/lib/emoji.js +140 -5
- package/dist/lib/emoji.js.map +1 -1
- package/dist/lib/feed-item-row.cjs +214 -0
- package/dist/lib/feed-item-row.cjs.map +1 -0
- package/dist/lib/feed-item-row.js +71 -64
- package/dist/lib/feed-item-row.js.map +1 -1
- package/dist/lib/feed-pill.cjs +150 -0
- package/dist/lib/feed-pill.cjs.map +1 -0
- package/dist/lib/feed-pill.js +60 -52
- package/dist/lib/feed-pill.js.map +1 -1
- package/dist/lib/general-row.cjs +406 -0
- package/dist/lib/general-row.cjs.map +1 -0
- package/dist/lib/general-row.js +133 -106
- package/dist/lib/general-row.js.map +1 -1
- package/dist/lib/group-row.cjs +118 -0
- package/dist/lib/group-row.cjs.map +1 -0
- package/dist/lib/group-row.js +34 -31
- package/dist/lib/group-row.js.map +1 -1
- package/dist/lib/grouped-chip.cjs +46 -0
- package/dist/lib/grouped-chip.cjs.map +1 -0
- package/dist/lib/grouped-chip.js +28 -27
- package/dist/lib/grouped-chip.js.map +1 -1
- package/dist/lib/hovercard.cjs +228 -0
- package/dist/lib/hovercard.cjs.map +1 -0
- package/dist/lib/hovercard.js +98 -64
- package/dist/lib/hovercard.js.map +1 -1
- package/dist/lib/icon.cjs +60 -0
- package/dist/lib/icon.cjs.map +1 -0
- package/dist/lib/icon.js +22 -44
- package/dist/lib/icon.js.map +1 -1
- package/dist/lib/image-viewer.cjs +191 -0
- package/dist/lib/image-viewer.cjs.map +1 -0
- package/dist/lib/image-viewer.js +83 -63
- package/dist/lib/image-viewer.js.map +1 -1
- package/dist/lib/input-group.cjs +92 -0
- package/dist/lib/input-group.cjs.map +1 -0
- package/dist/lib/input-group.js +29 -27
- package/dist/lib/input-group.js.map +1 -1
- package/dist/lib/input.cjs +493 -0
- package/dist/lib/input.cjs.map +1 -0
- package/dist/lib/input.js +127 -89
- package/dist/lib/input.js.map +1 -1
- package/dist/lib/item-layout.cjs +41 -0
- package/dist/lib/item-layout.cjs.map +1 -0
- package/dist/lib/item-layout.js +15 -13
- package/dist/lib/item-layout.js.map +1 -1
- package/dist/lib/ivr-node.cjs +210 -0
- package/dist/lib/ivr-node.cjs.map +1 -0
- package/dist/lib/ivr-node.js +115 -100
- package/dist/lib/ivr-node.js.map +1 -1
- package/dist/lib/keyboard-shortcut.cjs +107 -0
- package/dist/lib/keyboard-shortcut.cjs.map +1 -0
- package/dist/lib/keyboard-shortcut.js +42 -35
- package/dist/lib/keyboard-shortcut.js.map +1 -1
- package/dist/lib/lazy-show.cjs +81 -0
- package/dist/lib/lazy-show.cjs.map +1 -0
- package/dist/lib/lazy-show.js +20 -16
- package/dist/lib/lazy-show.js.map +1 -1
- package/dist/lib/link.cjs +71 -0
- package/dist/lib/link.cjs.map +1 -0
- package/dist/lib/link.js +22 -20
- package/dist/lib/link.js.map +1 -1
- package/dist/lib/list-item-group.cjs +61 -0
- package/dist/lib/list-item-group.cjs.map +1 -0
- package/dist/lib/list-item-group.js +19 -17
- package/dist/lib/list-item-group.js.map +1 -1
- package/dist/lib/list-item.cjs +205 -0
- package/dist/lib/list-item.cjs.map +1 -0
- package/dist/lib/list-item.js +67 -57
- package/dist/lib/list-item.js.map +1 -1
- package/dist/lib/message-input.cjs +555 -0
- package/dist/lib/message-input.cjs.map +1 -0
- package/dist/lib/message-input.js +211 -147
- package/dist/lib/message-input.js.map +1 -1
- package/dist/lib/modal.cjs +351 -0
- package/dist/lib/modal.cjs.map +1 -0
- package/dist/lib/modal.js +118 -91
- package/dist/lib/modal.js.map +1 -1
- package/dist/lib/notice.cjs +160 -0
- package/dist/lib/notice.cjs.map +1 -0
- package/dist/lib/notice.js +46 -44
- package/dist/lib/notice.js.map +1 -1
- package/dist/lib/pagination.cjs +153 -0
- package/dist/lib/pagination.cjs.map +1 -0
- package/dist/lib/pagination.js +60 -49
- package/dist/lib/pagination.js.map +1 -1
- package/dist/lib/popover.cjs +957 -0
- package/dist/lib/popover.cjs.map +1 -0
- package/dist/lib/popover.js +401 -222
- package/dist/lib/popover.js.map +1 -1
- package/dist/lib/presence.cjs +66 -0
- package/dist/lib/presence.cjs.map +1 -0
- package/dist/lib/presence.js +32 -26
- package/dist/lib/presence.js.map +1 -1
- package/dist/lib/radio-group.cjs +99 -0
- package/dist/lib/radio-group.cjs.map +1 -0
- package/dist/lib/radio-group.js +24 -22
- package/dist/lib/radio-group.js.map +1 -1
- package/dist/lib/radio.cjs +119 -0
- package/dist/lib/radio.cjs.map +1 -0
- package/dist/lib/radio.js +43 -35
- package/dist/lib/radio.js.map +1 -1
- package/dist/lib/rich-text-editor.cjs +1139 -0
- package/dist/lib/rich-text-editor.cjs.map +1 -0
- package/dist/lib/rich-text-editor.js +611 -392
- package/dist/lib/rich-text-editor.js.map +1 -1
- package/dist/lib/root-layout.cjs +131 -0
- package/dist/lib/root-layout.cjs.map +1 -0
- package/dist/lib/root-layout.js +28 -24
- package/dist/lib/root-layout.js.map +1 -1
- package/dist/lib/select-menu.cjs +283 -0
- package/dist/lib/select-menu.cjs.map +1 -0
- package/dist/lib/select-menu.js +101 -61
- package/dist/lib/select-menu.js.map +1 -1
- package/dist/lib/settings-menu-button.cjs +66 -0
- package/dist/lib/settings-menu-button.cjs.map +1 -0
- package/dist/lib/settings-menu-button.js +26 -25
- package/dist/lib/settings-menu-button.js.map +1 -1
- package/dist/lib/skeleton.cjs +613 -0
- package/dist/lib/skeleton.cjs.map +1 -0
- package/dist/lib/skeleton.js +174 -135
- package/dist/lib/skeleton.js.map +1 -1
- package/dist/lib/stack.cjs +128 -0
- package/dist/lib/stack.cjs.map +1 -0
- package/dist/lib/stack.js +66 -56
- package/dist/lib/stack.js.map +1 -1
- package/dist/lib/tabs.cjs +100 -0
- package/dist/lib/tabs.cjs.map +1 -0
- package/dist/lib/tabs.js +42 -35
- package/dist/lib/tabs.js.map +1 -1
- package/dist/lib/time-pill.cjs +48 -0
- package/dist/lib/time-pill.cjs.map +1 -0
- package/dist/lib/time-pill.js +21 -16
- package/dist/lib/time-pill.js.map +1 -1
- package/dist/lib/toast.cjs +248 -0
- package/dist/lib/toast.cjs.map +1 -0
- package/dist/lib/toast.js +78 -56
- package/dist/lib/toast.js.map +1 -1
- package/dist/lib/toggle.cjs +178 -0
- package/dist/lib/toggle.cjs.map +1 -0
- package/dist/lib/toggle.js +46 -37
- package/dist/lib/toggle.js.map +1 -1
- package/dist/lib/tooltip-directive.cjs +88 -0
- package/dist/lib/tooltip-directive.cjs.map +1 -0
- package/dist/lib/tooltip-directive.js +55 -41
- package/dist/lib/tooltip-directive.js.map +1 -1
- package/dist/lib/tooltip.cjs +437 -0
- package/dist/lib/tooltip.cjs.map +1 -0
- package/dist/lib/tooltip.js +152 -90
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/lib/top-banner-info.cjs +64 -0
- package/dist/lib/top-banner-info.cjs.map +1 -0
- package/dist/lib/top-banner-info.js +22 -18
- package/dist/lib/top-banner-info.js.map +1 -1
- package/dist/lib/unread-pill.cjs +64 -0
- package/dist/lib/unread-pill.cjs.map +1 -0
- package/dist/lib/unread-pill.js +25 -22
- package/dist/lib/unread-pill.js.map +1 -1
- package/dist/lib/validation-messages.cjs +86 -0
- package/dist/lib/validation-messages.cjs.map +1 -0
- package/dist/lib/validation-messages.js +32 -29
- package/dist/lib/validation-messages.js.map +1 -1
- package/dist/style.css +1214 -1
- package/dist/types/components/avatar/avatar.vue.d.ts +1 -1
- package/dist/types/components/button/button.vue.d.ts +2 -2
- package/dist/types/components/card/card.vue.d.ts +1 -1
- package/dist/types/components/chip/chip.vue.d.ts +1 -1
- package/dist/types/components/collapsible/collapsible.vue.d.ts +2 -2
- package/dist/types/components/combobox/combobox.vue.d.ts +1 -1
- package/dist/types/components/dropdown/dropdown.vue.d.ts +1 -1
- package/dist/types/components/emoji/emoji.vue.d.ts +1 -1
- package/dist/types/components/icon/icon.vue.d.ts +2 -22
- package/dist/types/components/icon/icon.vue.d.ts.map +1 -1
- package/dist/types/components/list_item_group/list_item_group.vue.d.ts +1 -1
- package/dist/types/components/modal/modal.vue.d.ts +2 -2
- package/dist/types/components/popover/popover_header_footer.vue.d.ts +1 -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/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +91 -1
- package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/types/components/skeleton/skeleton-list-item.vue.d.ts +1 -1
- package/dist/types/components/skeleton/skeleton-paragraph.vue.d.ts +3 -3
- package/dist/types/components/skeleton/skeleton-shape.vue.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton-text.vue.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton.vue.d.ts +1 -1
- package/dist/types/components/tooltip/tooltip.vue.d.ts +2 -2
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +1 -1
- package/dist/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -1
- package/dist/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +2 -2
- package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +90 -0
- package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/general_row/general_row.vue.d.ts +1 -1
- package/dist/types/recipes/leftbar/general_row/leftbar_general_row_icon.vue.d.ts +1 -1
- package/package.json +37 -35
- package/dist/chunks/_plugin-vue2_normalizer-u6G_3nkj.js +0 -33
- package/dist/chunks/_plugin-vue2_normalizer-u6G_3nkj.js.map +0 -1
- package/dist/chunks/dropdown_constants-EUcDxBrX.js +0 -9
- package/dist/chunks/dropdown_constants-EUcDxBrX.js.map +0 -1
- package/dist/chunks/index-YkSDT8-g.js +0 -244
- package/dist/chunks/index-YkSDT8-g.js.map +0 -1
- package/dist/chunks/index-nIyl_PL6.js +0 -372
- package/dist/chunks/keyboard_list_navigation-F0O8nht0.js +0 -197
- package/dist/chunks/link_constants-vIUB92L4.js +0 -16
- package/dist/chunks/list_item_constants-LTUc74pD.js +0 -13
- package/dist/chunks/modal-VuMFkZFH.js +0 -82
- package/dist/chunks/notice_action-9NmtQRai.js +0 -182
- package/dist/chunks/notice_constants-c--hBFQw.js +0 -6
- package/dist/chunks/popover_constants-qjlEkroB.js +0 -114
- package/dist/chunks/sr_only_close_button-JGole5Xi.js +0 -86
- package/dist/chunks/stack_constants-u7tNqGtc.js +0 -13
- package/dist/chunks/tab-Qm9LVkYj.js +0 -346
- package/dist/lib/dates.js +0 -57
- package/dist/lib/mixins.js +0 -17
- package/dist/lib/utils.js +0 -175
- package/dist/lib/validators.js +0 -12
- /package/dist/{lib → common}/mixins.js.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard_list_navigation-F0O8nht0.js","sources":["../../common/mixins/dom.js","../../common/mixins/keyboard_list_navigation.js"],"sourcesContent":["export default {\n methods: {\n /**\n * Scroll an element into view if it is not fully visible in its nearest scrollable ancestor.\n * @param {Element} ref\n */\n scrollElementIntoViewIfNeeded (ref, opt_center, opt_behavior, opt_parent) {\n if (ref.scrollIntoViewIfNeeded) {\n this.scrollIntoViewIfNeeded(ref, opt_center, opt_behavior, opt_parent);\n } else {\n this.scrollIntoView(ref, 'bottom', false, opt_behavior, opt_parent);\n }\n },\n\n /**\n * Scroll an element to the top or bottom of its scroll ancestor.\n * @param {Element} ref\n */\n scrollElementIntoView (ref, opt_scrollToTop, opt_behavior, opt_parent) {\n if (opt_scrollToTop === 'center') {\n this.scrollIntoView(ref, 'center', false, opt_behavior, opt_parent);\n return;\n }\n\n if (opt_scrollToTop === false) {\n this.scrollIntoView(ref, 'bottom', false, opt_behavior, opt_parent);\n } else {\n this.scrollIntoView(ref, 'top', false, opt_behavior, opt_parent);\n }\n },\n\n scrollIntoViewIfNeeded (ref, opt_center, opt_behavior, opt_parent) {\n const dir = opt_center ? 'center' : undefined;\n this.scrollIntoView(ref, dir, true, opt_behavior, opt_parent);\n },\n\n scrollIntoView (ref, opt_dir, opt_ifNeeded, opt_behavior, opt_parent) {\n if (!ref || !ref.parentElement) {\n return;\n }\n const offsetTop = ref.offsetTop;\n const refParent = opt_parent || ref.parentElement;\n const scrollBounds = this._getScrollBounds(refParent);\n const parentHeight = scrollBounds.bottom - scrollBounds.top;\n const elHeight = this._getElementHeight(ref);\n const offsetBottom = offsetTop + elHeight;\n let scrollTop = -1;\n switch (opt_dir) {\n case 'top':\n scrollTop = offsetTop;\n break;\n case 'center':\n scrollTop = offsetTop + (elHeight - parentHeight) / 2;\n break;\n case 'bottom':\n scrollTop = scrollTop = offsetBottom - parentHeight;\n break;\n default:\n // Go to the closest edge if needed and no direction is provided.\n if (offsetTop - scrollBounds.top <= (parentHeight / 2)) {\n // Lock it to the top edge.\n scrollTop = offsetTop;\n } else {\n scrollTop = offsetBottom - parentHeight;\n }\n break;\n }\n this._setScrollTop(refParent, scrollTop, scrollBounds, offsetTop, offsetBottom, opt_ifNeeded, opt_behavior);\n },\n\n _setScrollTop (el, scrollTop, bounds, offsetTop, offsetBottom, opt_isNeeded, opt_behavior) {\n bounds = bounds || this._getScrollBounds(el);\n const parentHeight = bounds.bottom - bounds.top;\n if (opt_isNeeded && this._inScrollBounds(offsetTop, offsetBottom, bounds)) {\n // Then lock to the top or bottom if it's hanging off the edge.\n if (offsetTop < bounds.top) {\n // Snap it to the top.\n scrollTop = offsetTop;\n } else if (offsetBottom > bounds.bottom) {\n scrollTop = offsetBottom - parentHeight;\n } else {\n return;\n }\n }\n\n if (opt_behavior) {\n el.scrollTo({ top: scrollTop, behavior: opt_behavior });\n } else {\n el.scrollTop = scrollTop;\n }\n },\n\n _getElementHeight (el) {\n return el.getBoundingClientRect().height;\n },\n\n _getScrollBounds (el) {\n const height = this._getElementHeight(el);\n const scrollTop = el.scrollTop;\n return {\n top: scrollTop,\n bottom: scrollTop + height,\n };\n },\n\n _inScrollBounds (top, bottom, bounds) {\n // Since we read from top to bottom, we want more than 3/4 to be visible at the top\n // (bc you're looking at the bottom half) or a quarter visible at the bottom (bc you\n // can read the beginning of it)\n\n const height = bottom - top;\n return (bottom <= bounds.bottom + (3 * height / 4)) && (top >= bounds.top - (height / 4));\n },\n },\n};\n","import Dom from './dom';\n\nconst ERROR_INVALID_LIST_ELEMENT = (\n 'listElementKey is required or the referenced ' +\n 'element doesn\\'t exist. Received listElement: '\n);\n\n/**\n * Usage: `mixins: [keyboardNavigationMixin(options)]`\n *\n * This mixin provides some common data and methods to navigate a list of items\n * (such as a dropdown or select menu) by keyboard.\n *\n * To be effective, you must bind the onUpKey and onDownKey events, usually to\n * the root element of the component.\n *\n * @param listItemRole\n * @param indexKey\n * @param idKey\n * @param listElementKey\n * @param activeItemKey\n * @param openMethod\n * @param afterHighlightMethod\n * @param beginningOfListMethod\n * @param endOfListMethod\n * @param scrollToOnHighlight\n * @param focusOnKeyboardNavigation\n * @displayName Keyboard Navigation Mixin\n */\nexport default ({\n // Role of the list items in the component. This is used to identify the list items\n // so you must update this if the role of your list items is anything other than 'option'\n listItemRole = 'option',\n // Key of the data prop that will be added to the component.\n indexKey = 'highlightIndex',\n idKey = 'highlightId',\n // Key of the method that references the list element.\n listElementKey = 'listRef',\n // Optional, Key of the computed prop that references the currently active item element.\n activeItemKey = '',\n // Optional, name of the method that toggles the list visibility. Used for\n // opening the list when up or down is pressed.\n openMethod = null,\n // Optional, method to call when the highlightIndex is changed.\n afterHighlightMethod = null,\n // Optional, method to call when the highlightIndex goes past the beginning of the list.\n beginningOfListMethod = null,\n // Optional, method to call when the highlightIndex goes past the end of the list.\n endOfListMethod = null,\n // Scroll the active element into view when highlighted by a keyboard event.\n scrollToOnHighlight = true,\n // Focus the active element on keyboard navigation.\n focusOnKeyboardNavigation = false,\n} = {}) => ({\n mixins: [Dom],\n\n data () {\n return {\n [indexKey]: -1,\n [idKey]: '',\n scrollToOnHighlight,\n focusOnKeyboardNavigation,\n };\n },\n\n provide () {\n return {\n highlightId: () => this[idKey],\n };\n },\n\n methods: {\n // Returns the list element\n // this[listElement]() can return a Vue component, in which case we need to target\n // the $el property, or it can simply be an html element.\n _getListElement () {\n return this[listElementKey]()?.$el || this[listElementKey]();\n },\n\n // Gets the length of all the items in the list, uses the listItemRole param to determine\n // whether an element is a list item.\n _itemsLength () {\n const listItems = this._getListItemNodes();\n\n if (listItems === null) {\n return 0;\n }\n\n return listItems.length;\n },\n\n // Gets all the list item nodes within the list element\n _getListItemNodes () {\n const listElement = this._getListElement();\n\n if (!listElement) {\n console.error(ERROR_INVALID_LIST_ELEMENT, listElement);\n return null;\n }\n\n return Array.from(listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`));\n },\n\n onUpKey () {\n if (openMethod) {\n this[openMethod](true);\n }\n if (this[indexKey] > 0) {\n this.setHighlightIndex(this[indexKey] - 1);\n } else if (beginningOfListMethod) {\n this[beginningOfListMethod]();\n }\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onDownKey () {\n if (openMethod) {\n this[openMethod](true);\n }\n if (this[indexKey] < this._itemsLength() - 1) {\n this.setHighlightIndex(this[indexKey] + 1);\n } else if (endOfListMethod) {\n this[endOfListMethod]();\n }\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onHomeKey () {\n this.jumpToBeginning();\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onEndKey () {\n this.jumpToEnd();\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onNavigationKey (key) {\n const listItems = this._getListItemNodes();\n\n const matchingItems = listItems.filter(item => {\n const content = item.textContent.trim().toLowerCase();\n return content.startsWith(key.toLowerCase());\n });\n\n if (matchingItems.length <= 0) {\n return;\n }\n\n const highlightedMatchingItemIndex = matchingItems.findIndex(item => {\n return this[indexKey] === listItems.indexOf(item);\n });\n\n const nextHighlightedItemIndex = listItems.indexOf(\n highlightedMatchingItemIndex < matchingItems.length - 1\n ? matchingItems[highlightedMatchingItemIndex + 1]\n : matchingItems[0],\n );\n\n this.setHighlightIndex(nextHighlightedItemIndex);\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n isValidLetter (key) {\n if (key.length > 1) {\n return false;\n }\n\n return (key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z');\n },\n\n jumpToBeginning () {\n this.setHighlightIndex(0);\n },\n\n jumpToEnd () {\n this.setHighlightIndex(this._itemsLength() - 1);\n },\n\n setHighlightIndex (num) {\n this[indexKey] = num;\n this[idKey] = this._getItemId(num);\n\n if (this._itemsLength() && afterHighlightMethod) {\n this[afterHighlightMethod](num);\n }\n },\n\n setHighlightId (id) {\n this[idKey] = id;\n this[indexKey] = this._getItemIndex(id);\n\n if (this._itemsLength() && afterHighlightMethod) {\n this[afterHighlightMethod](this._getItemIndex(id));\n }\n },\n\n _getItemIndex (id) {\n const listElement = this._getListElement();\n if (!listElement) {\n return;\n }\n\n const listItems = Array.from(listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`));\n return listItems.indexOf(listElement.querySelector(`#${id}`));\n },\n\n _getItemId (index) {\n const listElement = this._getListElement();\n if (!listElement) {\n return;\n }\n\n return listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`)[index]?.id;\n },\n\n scrollActiveItemIntoViewIfNeeded () {\n if (!this.scrollToOnHighlight) {\n return;\n }\n const activeItemEl = this[activeItemKey];\n if (activeItemEl) {\n // When listElementKey is not passed,\n // scrollElementIntoViewIfNeeded will default to the immediate wrapper of the item.\n const listElement = this._getListElement();\n this.scrollElementIntoViewIfNeeded(activeItemEl, null, null, listElement);\n }\n },\n\n focusActiveItemIfNeeded () {\n if (!this.focusOnKeyboardNavigation) {\n return;\n }\n const activeItemEl = this[activeItemKey];\n if (activeItemEl) {\n activeItemEl.focus();\n }\n },\n },\n});\n"],"names":["Dom","ref","opt_center","opt_behavior","opt_parent","opt_scrollToTop","dir","opt_dir","opt_ifNeeded","offsetTop","refParent","scrollBounds","parentHeight","elHeight","offsetBottom","scrollTop","el","bounds","opt_isNeeded","height","top","bottom","ERROR_INVALID_LIST_ELEMENT","KeyboardNavigation","listItemRole","indexKey","idKey","listElementKey","activeItemKey","openMethod","afterHighlightMethod","beginningOfListMethod","endOfListMethod","scrollToOnHighlight","focusOnKeyboardNavigation","_a","listItems","listElement","key","matchingItems","item","highlightedMatchingItemIndex","nextHighlightedItemIndex","num","id","index","activeItemEl"],"mappings":"AAAA,MAAeA,IAAA;AAAA,EACb,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,IAKP,8BAA+BC,GAAKC,GAAYC,GAAcC,GAAY;AACxE,MAAIH,EAAI,yBACN,KAAK,uBAAuBA,GAAKC,GAAYC,GAAcC,CAAU,IAErE,KAAK,eAAeH,GAAK,UAAU,IAAOE,GAAcC,CAAU;AAAA,IAErE;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,sBAAuBH,GAAKI,GAAiBF,GAAcC,GAAY;AACrE,UAAIC,MAAoB,UAAU;AAChC,aAAK,eAAeJ,GAAK,UAAU,IAAOE,GAAcC,CAAU;AAClE;AAAA,MACD;AAED,MAAIC,MAAoB,KACtB,KAAK,eAAeJ,GAAK,UAAU,IAAOE,GAAcC,CAAU,IAElE,KAAK,eAAeH,GAAK,OAAO,IAAOE,GAAcC,CAAU;AAAA,IAElE;AAAA,IAED,uBAAwBH,GAAKC,GAAYC,GAAcC,GAAY;AACjE,YAAME,IAAMJ,IAAa,WAAW;AACpC,WAAK,eAAeD,GAAKK,GAAK,IAAMH,GAAcC,CAAU;AAAA,IAC7D;AAAA,IAED,eAAgBH,GAAKM,GAASC,GAAcL,GAAcC,GAAY;AACpE,UAAI,CAACH,KAAO,CAACA,EAAI;AACf;AAEF,YAAMQ,IAAYR,EAAI,WAChBS,IAAYN,KAAcH,EAAI,eAC9BU,IAAe,KAAK,iBAAiBD,CAAS,GAC9CE,IAAeD,EAAa,SAASA,EAAa,KAClDE,IAAW,KAAK,kBAAkBZ,CAAG,GACrCa,IAAeL,IAAYI;AACjC,UAAIE,IAAY;AAChB,cAAQR,GAAO;AAAA,QACb,KAAK;AACH,UAAAQ,IAAYN;AACZ;AAAA,QACF,KAAK;AACH,UAAAM,IAAYN,KAAaI,I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CAAK,IAAI,KAAK,WAAWiB,CAAG,GAE7B,KAAK,aAAc,KAAIb,KACzB,KAAKA,CAAoB,EAAEa,CAAG;AAAA,IAEjC;AAAA,IAED,eAAgBC,GAAI;AAClB,WAAKlB,CAAK,IAAIkB,GACd,KAAKnB,CAAQ,IAAI,KAAK,cAAcmB,CAAE,GAElC,KAAK,aAAc,KAAId,KACzB,KAAKA,CAAoB,EAAE,KAAK,cAAcc,CAAE,CAAC;AAAA,IAEpD;AAAA,IAED,cAAeA,GAAI;AACjB,YAAMP,IAAc,KAAK;AACzB,aAAKA,IAIa,MAAM,KAAKA,EAAY,iBAAiB,UAAUb,CAAY,2BAA2B,CAAC,EAC3F,QAAQa,EAAY,cAAc,IAAIO,CAAE,EAAE,CAAC,IAJ1D;AAAA,IAKH;AAAA,IAED,WAAYC,GAAO;ADpNvB,UAAAV;ACqNM,YAAME,IAAc,KAAK;AACzB,UAAKA;AAIL,gBAAOF,IAAAE,EAAY,iBAAiB,UAAUb,CAAY,2BAA2B,EAAEqB,CAAK,MAArF,gBAAAV,EAAwF;AAAA,IAChG;AAAA,IAED,mCAAoC;AAClC,UAAI,CAAC,KAAK;AACR;AAEF,YAAMW,IAAe,KAAKlB,CAAa;AACvC,UAAIkB,GAAc;AAGhB,cAAMT,IAAc,KAAK;AACzB,aAAK,8BAA8BS,GAAc,MAAM,MAAMT,CAAW;AAAA,MACzE;AAAA,IACF;AAAA,IAED,0BAA2B;AACzB,UAAI,CAAC,KAAK;AACR;AAEF,YAAMS,IAAe,KAAKlB,CAAa;AACvC,MAAIkB,KACFA,EAAa,MAAK;AAAA,IAErB;AAAA,EACF;AACH;"}
|
|
1
|
+
{"version":3,"file":"keyboard_list_navigation-ScXhrxya.js","sources":["../../common/mixins/dom.js","../../common/mixins/keyboard_list_navigation.js"],"sourcesContent":["export default {\n methods: {\n /**\n * Scroll an element into view if it is not fully visible in its nearest scrollable ancestor.\n * @param {Element} ref\n */\n scrollElementIntoViewIfNeeded (ref, opt_center, opt_behavior, opt_parent) {\n if (ref.scrollIntoViewIfNeeded) {\n this.scrollIntoViewIfNeeded(ref, opt_center, opt_behavior, opt_parent);\n } else {\n this.scrollIntoView(ref, 'bottom', false, opt_behavior, opt_parent);\n }\n },\n\n /**\n * Scroll an element to the top or bottom of its scroll ancestor.\n * @param {Element} ref\n */\n scrollElementIntoView (ref, opt_scrollToTop, opt_behavior, opt_parent) {\n if (opt_scrollToTop === 'center') {\n this.scrollIntoView(ref, 'center', false, opt_behavior, opt_parent);\n return;\n }\n\n if (opt_scrollToTop === false) {\n this.scrollIntoView(ref, 'bottom', false, opt_behavior, opt_parent);\n } else {\n this.scrollIntoView(ref, 'top', false, opt_behavior, opt_parent);\n }\n },\n\n scrollIntoViewIfNeeded (ref, opt_center, opt_behavior, opt_parent) {\n const dir = opt_center ? 'center' : undefined;\n this.scrollIntoView(ref, dir, true, opt_behavior, opt_parent);\n },\n\n scrollIntoView (ref, opt_dir, opt_ifNeeded, opt_behavior, opt_parent) {\n if (!ref || !ref.parentElement) {\n return;\n }\n const offsetTop = ref.offsetTop;\n const refParent = opt_parent || ref.parentElement;\n const scrollBounds = this._getScrollBounds(refParent);\n const parentHeight = scrollBounds.bottom - scrollBounds.top;\n const elHeight = this._getElementHeight(ref);\n const offsetBottom = offsetTop + elHeight;\n let scrollTop = -1;\n switch (opt_dir) {\n case 'top':\n scrollTop = offsetTop;\n break;\n case 'center':\n scrollTop = offsetTop + (elHeight - parentHeight) / 2;\n break;\n case 'bottom':\n scrollTop = scrollTop = offsetBottom - parentHeight;\n break;\n default:\n // Go to the closest edge if needed and no direction is provided.\n if (offsetTop - scrollBounds.top <= (parentHeight / 2)) {\n // Lock it to the top edge.\n scrollTop = offsetTop;\n } else {\n scrollTop = offsetBottom - parentHeight;\n }\n break;\n }\n this._setScrollTop(refParent, scrollTop, scrollBounds, offsetTop, offsetBottom, opt_ifNeeded, opt_behavior);\n },\n\n _setScrollTop (el, scrollTop, bounds, offsetTop, offsetBottom, opt_isNeeded, opt_behavior) {\n bounds = bounds || this._getScrollBounds(el);\n const parentHeight = bounds.bottom - bounds.top;\n if (opt_isNeeded && this._inScrollBounds(offsetTop, offsetBottom, bounds)) {\n // Then lock to the top or bottom if it's hanging off the edge.\n if (offsetTop < bounds.top) {\n // Snap it to the top.\n scrollTop = offsetTop;\n } else if (offsetBottom > bounds.bottom) {\n scrollTop = offsetBottom - parentHeight;\n } else {\n return;\n }\n }\n\n if (opt_behavior) {\n el.scrollTo({ top: scrollTop, behavior: opt_behavior });\n } else {\n el.scrollTop = scrollTop;\n }\n },\n\n _getElementHeight (el) {\n return el.getBoundingClientRect().height;\n },\n\n _getScrollBounds (el) {\n const height = this._getElementHeight(el);\n const scrollTop = el.scrollTop;\n return {\n top: scrollTop,\n bottom: scrollTop + height,\n };\n },\n\n _inScrollBounds (top, bottom, bounds) {\n // Since we read from top to bottom, we want more than 3/4 to be visible at the top\n // (bc you're looking at the bottom half) or a quarter visible at the bottom (bc you\n // can read the beginning of it)\n\n const height = bottom - top;\n return (bottom <= bounds.bottom + (3 * height / 4)) && (top >= bounds.top - (height / 4));\n },\n },\n};\n","import Dom from './dom';\n\nconst ERROR_INVALID_LIST_ELEMENT = (\n 'listElementKey is required or the referenced ' +\n 'element doesn\\'t exist. Received listElement: '\n);\n\n/**\n * Usage: `mixins: [keyboardNavigationMixin(options)]`\n *\n * This mixin provides some common data and methods to navigate a list of items\n * (such as a dropdown or select menu) by keyboard.\n *\n * To be effective, you must bind the onUpKey and onDownKey events, usually to\n * the root element of the component.\n *\n * @param listItemRole\n * @param indexKey\n * @param idKey\n * @param listElementKey\n * @param activeItemKey\n * @param openMethod\n * @param afterHighlightMethod\n * @param beginningOfListMethod\n * @param endOfListMethod\n * @param scrollToOnHighlight\n * @param focusOnKeyboardNavigation\n * @displayName Keyboard Navigation Mixin\n */\nexport default ({\n // Role of the list items in the component. This is used to identify the list items\n // so you must update this if the role of your list items is anything other than 'option'\n listItemRole = 'option',\n // Key of the data prop that will be added to the component.\n indexKey = 'highlightIndex',\n idKey = 'highlightId',\n // Key of the method that references the list element.\n listElementKey = 'listRef',\n // Optional, Key of the computed prop that references the currently active item element.\n activeItemKey = '',\n // Optional, name of the method that toggles the list visibility. Used for\n // opening the list when up or down is pressed.\n openMethod = null,\n // Optional, method to call when the highlightIndex is changed.\n afterHighlightMethod = null,\n // Optional, method to call when the highlightIndex goes past the beginning of the list.\n beginningOfListMethod = null,\n // Optional, method to call when the highlightIndex goes past the end of the list.\n endOfListMethod = null,\n // Scroll the active element into view when highlighted by a keyboard event.\n scrollToOnHighlight = true,\n // Focus the active element on keyboard navigation.\n focusOnKeyboardNavigation = false,\n} = {}) => ({\n mixins: [Dom],\n\n data () {\n return {\n [indexKey]: -1,\n [idKey]: '',\n scrollToOnHighlight,\n focusOnKeyboardNavigation,\n };\n },\n\n provide () {\n return {\n highlightId: () => this[idKey],\n };\n },\n\n methods: {\n // Returns the list element\n // this[listElement]() can return a Vue component, in which case we need to target\n // the $el property, or it can simply be an html element.\n _getListElement () {\n return this[listElementKey]()?.$el || this[listElementKey]();\n },\n\n // Gets the length of all the items in the list, uses the listItemRole param to determine\n // whether an element is a list item.\n _itemsLength () {\n const listItems = this._getListItemNodes();\n\n if (listItems === null) {\n return 0;\n }\n\n return listItems.length;\n },\n\n // Gets all the list item nodes within the list element\n _getListItemNodes () {\n const listElement = this._getListElement();\n\n if (!listElement) {\n console.error(ERROR_INVALID_LIST_ELEMENT, listElement);\n return null;\n }\n\n return Array.from(listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`));\n },\n\n onUpKey () {\n if (openMethod) {\n this[openMethod](true);\n }\n if (this[indexKey] > 0) {\n this.setHighlightIndex(this[indexKey] - 1);\n } else if (beginningOfListMethod) {\n this[beginningOfListMethod]();\n }\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onDownKey () {\n if (openMethod) {\n this[openMethod](true);\n }\n if (this[indexKey] < this._itemsLength() - 1) {\n this.setHighlightIndex(this[indexKey] + 1);\n } else if (endOfListMethod) {\n this[endOfListMethod]();\n }\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onHomeKey () {\n this.jumpToBeginning();\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onEndKey () {\n this.jumpToEnd();\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onNavigationKey (key) {\n const listItems = this._getListItemNodes();\n\n const matchingItems = listItems.filter(item => {\n const content = item.textContent.trim().toLowerCase();\n return content.startsWith(key.toLowerCase());\n });\n\n if (matchingItems.length <= 0) {\n return;\n }\n\n const highlightedMatchingItemIndex = matchingItems.findIndex(item => {\n return this[indexKey] === listItems.indexOf(item);\n });\n\n const nextHighlightedItemIndex = listItems.indexOf(\n highlightedMatchingItemIndex < matchingItems.length - 1\n ? matchingItems[highlightedMatchingItemIndex + 1]\n : matchingItems[0],\n );\n\n this.setHighlightIndex(nextHighlightedItemIndex);\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n isValidLetter (key) {\n if (key.length > 1) {\n return false;\n }\n\n return (key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z');\n },\n\n jumpToBeginning () {\n this.setHighlightIndex(0);\n },\n\n jumpToEnd () {\n this.setHighlightIndex(this._itemsLength() - 1);\n },\n\n setHighlightIndex (num) {\n this[indexKey] = num;\n this[idKey] = this._getItemId(num);\n\n if (this._itemsLength() && afterHighlightMethod) {\n this[afterHighlightMethod](num);\n }\n },\n\n setHighlightId (id) {\n this[idKey] = id;\n this[indexKey] = this._getItemIndex(id);\n\n if (this._itemsLength() && afterHighlightMethod) {\n this[afterHighlightMethod](this._getItemIndex(id));\n }\n },\n\n _getItemIndex (id) {\n const listElement = this._getListElement();\n if (!listElement) {\n return;\n }\n\n const listItems = Array.from(listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`));\n return listItems.indexOf(listElement.querySelector(`#${id}`));\n },\n\n _getItemId (index) {\n const listElement = this._getListElement();\n if (!listElement) {\n return;\n }\n\n return listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`)[index]?.id;\n },\n\n scrollActiveItemIntoViewIfNeeded () {\n if (!this.scrollToOnHighlight) {\n return;\n }\n const activeItemEl = this[activeItemKey];\n if (activeItemEl) {\n // When listElementKey is not passed,\n // scrollElementIntoViewIfNeeded will default to the immediate wrapper of the item.\n const listElement = this._getListElement();\n this.scrollElementIntoViewIfNeeded(activeItemEl, null, null, listElement);\n }\n },\n\n focusActiveItemIfNeeded () {\n if (!this.focusOnKeyboardNavigation) {\n return;\n }\n const activeItemEl = this[activeItemKey];\n if (activeItemEl) {\n activeItemEl.focus();\n }\n },\n },\n});\n"],"names":[],"mappings":"AAAA,MAAe,MAAA;AAAA,EACb,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,IAKP,8BAA+B,KAAK,YAAY,cAAc,YAAY;AACxE,UAAI,IAAI,wBAAwB;AAC9B,aAAK,uBAAuB,KAAK,YAAY,cAAc,UAAU;AAAA,MAC7E,OAAa;AACL,aAAK,eAAe,KAAK,UAAU,OAAO,cAAc,UAAU;AAAA,MACnE;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,sBAAuB,KAAK,iBAAiB,cAAc,YAAY;AACrE,UAAI,oBAAoB,UAAU;AAChC,aAAK,eAAe,KAAK,UAAU,OAAO,cAAc,UAAU;AAClE;AAAA,MACD;AAED,UAAI,oBAAoB,OAAO;AAC7B,aAAK,eAAe,KAAK,UAAU,OAAO,cAAc,UAAU;AAAA,MAC1E,OAAa;AACL,aAAK,eAAe,KAAK,OAAO,OAAO,cAAc,UAAU;AAAA,MAChE;AAAA,IACF;AAAA,IAED,uBAAwB,KAAK,YAAY,cAAc,YAAY;AACjE,YAAM,MAAM,aAAa,WAAW;AACpC,WAAK,eAAe,KAAK,KAAK,MAAM,cA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;AAAA,MACD;AAED,cAAO,iBAAY,iBAAiB,UAAU,YAAY,2BAA2B,EAAE,KAAK,MAArF,mBAAwF;AAAA,IAChG;AAAA,IAED,mCAAoC;AAClC,UAAI,CAAC,KAAK,qBAAqB;AAC7B;AAAA,MACD;AACD,YAAM,eAAe,KAAK,aAAa;AACvC,UAAI,cAAc;AAGhB,cAAM,cAAc,KAAK;AACzB,aAAK,8BAA8B,cAAc,MAAM,MAAM,WAAW;AAAA,MACzE;AAAA,IACF;AAAA,IAED,0BAA2B;AACzB,UAAI,CAAC,KAAK,2BAA2B;AACnC;AAAA,MACD;AACD,YAAM,eAAe,KAAK,aAAa;AACvC,UAAI,cAAc;AAChB,qBAAa,MAAK;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AACH;"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const Dom = {
|
|
3
|
+
methods: {
|
|
4
|
+
/**
|
|
5
|
+
* Scroll an element into view if it is not fully visible in its nearest scrollable ancestor.
|
|
6
|
+
* @param {Element} ref
|
|
7
|
+
*/
|
|
8
|
+
scrollElementIntoViewIfNeeded(ref, opt_center, opt_behavior, opt_parent) {
|
|
9
|
+
if (ref.scrollIntoViewIfNeeded) {
|
|
10
|
+
this.scrollIntoViewIfNeeded(ref, opt_center, opt_behavior, opt_parent);
|
|
11
|
+
} else {
|
|
12
|
+
this.scrollIntoView(ref, "bottom", false, opt_behavior, opt_parent);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Scroll an element to the top or bottom of its scroll ancestor.
|
|
17
|
+
* @param {Element} ref
|
|
18
|
+
*/
|
|
19
|
+
scrollElementIntoView(ref, opt_scrollToTop, opt_behavior, opt_parent) {
|
|
20
|
+
if (opt_scrollToTop === "center") {
|
|
21
|
+
this.scrollIntoView(ref, "center", false, opt_behavior, opt_parent);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (opt_scrollToTop === false) {
|
|
25
|
+
this.scrollIntoView(ref, "bottom", false, opt_behavior, opt_parent);
|
|
26
|
+
} else {
|
|
27
|
+
this.scrollIntoView(ref, "top", false, opt_behavior, opt_parent);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
scrollIntoViewIfNeeded(ref, opt_center, opt_behavior, opt_parent) {
|
|
31
|
+
const dir = opt_center ? "center" : void 0;
|
|
32
|
+
this.scrollIntoView(ref, dir, true, opt_behavior, opt_parent);
|
|
33
|
+
},
|
|
34
|
+
scrollIntoView(ref, opt_dir, opt_ifNeeded, opt_behavior, opt_parent) {
|
|
35
|
+
if (!ref || !ref.parentElement) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const offsetTop = ref.offsetTop;
|
|
39
|
+
const refParent = opt_parent || ref.parentElement;
|
|
40
|
+
const scrollBounds = this._getScrollBounds(refParent);
|
|
41
|
+
const parentHeight = scrollBounds.bottom - scrollBounds.top;
|
|
42
|
+
const elHeight = this._getElementHeight(ref);
|
|
43
|
+
const offsetBottom = offsetTop + elHeight;
|
|
44
|
+
let scrollTop = -1;
|
|
45
|
+
switch (opt_dir) {
|
|
46
|
+
case "top":
|
|
47
|
+
scrollTop = offsetTop;
|
|
48
|
+
break;
|
|
49
|
+
case "center":
|
|
50
|
+
scrollTop = offsetTop + (elHeight - parentHeight) / 2;
|
|
51
|
+
break;
|
|
52
|
+
case "bottom":
|
|
53
|
+
scrollTop = scrollTop = offsetBottom - parentHeight;
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
if (offsetTop - scrollBounds.top <= parentHeight / 2) {
|
|
57
|
+
scrollTop = offsetTop;
|
|
58
|
+
} else {
|
|
59
|
+
scrollTop = offsetBottom - parentHeight;
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
this._setScrollTop(refParent, scrollTop, scrollBounds, offsetTop, offsetBottom, opt_ifNeeded, opt_behavior);
|
|
64
|
+
},
|
|
65
|
+
_setScrollTop(el, scrollTop, bounds, offsetTop, offsetBottom, opt_isNeeded, opt_behavior) {
|
|
66
|
+
bounds = bounds || this._getScrollBounds(el);
|
|
67
|
+
const parentHeight = bounds.bottom - bounds.top;
|
|
68
|
+
if (opt_isNeeded && this._inScrollBounds(offsetTop, offsetBottom, bounds)) {
|
|
69
|
+
if (offsetTop < bounds.top) {
|
|
70
|
+
scrollTop = offsetTop;
|
|
71
|
+
} else if (offsetBottom > bounds.bottom) {
|
|
72
|
+
scrollTop = offsetBottom - parentHeight;
|
|
73
|
+
} else {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (opt_behavior) {
|
|
78
|
+
el.scrollTo({ top: scrollTop, behavior: opt_behavior });
|
|
79
|
+
} else {
|
|
80
|
+
el.scrollTop = scrollTop;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
_getElementHeight(el) {
|
|
84
|
+
return el.getBoundingClientRect().height;
|
|
85
|
+
},
|
|
86
|
+
_getScrollBounds(el) {
|
|
87
|
+
const height = this._getElementHeight(el);
|
|
88
|
+
const scrollTop = el.scrollTop;
|
|
89
|
+
return {
|
|
90
|
+
top: scrollTop,
|
|
91
|
+
bottom: scrollTop + height
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
_inScrollBounds(top, bottom, bounds) {
|
|
95
|
+
const height = bottom - top;
|
|
96
|
+
return bottom <= bounds.bottom + 3 * height / 4 && top >= bounds.top - height / 4;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const ERROR_INVALID_LIST_ELEMENT = "listElementKey is required or the referenced element doesn't exist. Received listElement: ";
|
|
101
|
+
const KeyboardNavigation = ({
|
|
102
|
+
// Role of the list items in the component. This is used to identify the list items
|
|
103
|
+
// so you must update this if the role of your list items is anything other than 'option'
|
|
104
|
+
listItemRole = "option",
|
|
105
|
+
// Key of the data prop that will be added to the component.
|
|
106
|
+
indexKey = "highlightIndex",
|
|
107
|
+
idKey = "highlightId",
|
|
108
|
+
// Key of the method that references the list element.
|
|
109
|
+
listElementKey = "listRef",
|
|
110
|
+
// Optional, Key of the computed prop that references the currently active item element.
|
|
111
|
+
activeItemKey = "",
|
|
112
|
+
// Optional, name of the method that toggles the list visibility. Used for
|
|
113
|
+
// opening the list when up or down is pressed.
|
|
114
|
+
openMethod = null,
|
|
115
|
+
// Optional, method to call when the highlightIndex is changed.
|
|
116
|
+
afterHighlightMethod = null,
|
|
117
|
+
// Optional, method to call when the highlightIndex goes past the beginning of the list.
|
|
118
|
+
beginningOfListMethod = null,
|
|
119
|
+
// Optional, method to call when the highlightIndex goes past the end of the list.
|
|
120
|
+
endOfListMethod = null,
|
|
121
|
+
// Scroll the active element into view when highlighted by a keyboard event.
|
|
122
|
+
scrollToOnHighlight = true,
|
|
123
|
+
// Focus the active element on keyboard navigation.
|
|
124
|
+
focusOnKeyboardNavigation = false
|
|
125
|
+
} = {}) => ({
|
|
126
|
+
mixins: [Dom],
|
|
127
|
+
data() {
|
|
128
|
+
return {
|
|
129
|
+
[indexKey]: -1,
|
|
130
|
+
[idKey]: "",
|
|
131
|
+
scrollToOnHighlight,
|
|
132
|
+
focusOnKeyboardNavigation
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
provide() {
|
|
136
|
+
return {
|
|
137
|
+
highlightId: () => this[idKey]
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
methods: {
|
|
141
|
+
// Returns the list element
|
|
142
|
+
// this[listElement]() can return a Vue component, in which case we need to target
|
|
143
|
+
// the $el property, or it can simply be an html element.
|
|
144
|
+
_getListElement() {
|
|
145
|
+
var _a;
|
|
146
|
+
return ((_a = this[listElementKey]()) == null ? void 0 : _a.$el) || this[listElementKey]();
|
|
147
|
+
},
|
|
148
|
+
// Gets the length of all the items in the list, uses the listItemRole param to determine
|
|
149
|
+
// whether an element is a list item.
|
|
150
|
+
_itemsLength() {
|
|
151
|
+
const listItems = this._getListItemNodes();
|
|
152
|
+
if (listItems === null) {
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
155
|
+
return listItems.length;
|
|
156
|
+
},
|
|
157
|
+
// Gets all the list item nodes within the list element
|
|
158
|
+
_getListItemNodes() {
|
|
159
|
+
const listElement = this._getListElement();
|
|
160
|
+
if (!listElement) {
|
|
161
|
+
console.error(ERROR_INVALID_LIST_ELEMENT, listElement);
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
return Array.from(listElement.querySelectorAll(`[role="${listItemRole}"], #sr-only-close-button`));
|
|
165
|
+
},
|
|
166
|
+
onUpKey() {
|
|
167
|
+
if (openMethod) {
|
|
168
|
+
this[openMethod](true);
|
|
169
|
+
}
|
|
170
|
+
if (this[indexKey] > 0) {
|
|
171
|
+
this.setHighlightIndex(this[indexKey] - 1);
|
|
172
|
+
} else if (beginningOfListMethod) {
|
|
173
|
+
this[beginningOfListMethod]();
|
|
174
|
+
}
|
|
175
|
+
this.scrollActiveItemIntoViewIfNeeded();
|
|
176
|
+
this.focusActiveItemIfNeeded();
|
|
177
|
+
},
|
|
178
|
+
onDownKey() {
|
|
179
|
+
if (openMethod) {
|
|
180
|
+
this[openMethod](true);
|
|
181
|
+
}
|
|
182
|
+
if (this[indexKey] < this._itemsLength() - 1) {
|
|
183
|
+
this.setHighlightIndex(this[indexKey] + 1);
|
|
184
|
+
} else if (endOfListMethod) {
|
|
185
|
+
this[endOfListMethod]();
|
|
186
|
+
}
|
|
187
|
+
this.scrollActiveItemIntoViewIfNeeded();
|
|
188
|
+
this.focusActiveItemIfNeeded();
|
|
189
|
+
},
|
|
190
|
+
onHomeKey() {
|
|
191
|
+
this.jumpToBeginning();
|
|
192
|
+
this.scrollActiveItemIntoViewIfNeeded();
|
|
193
|
+
this.focusActiveItemIfNeeded();
|
|
194
|
+
},
|
|
195
|
+
onEndKey() {
|
|
196
|
+
this.jumpToEnd();
|
|
197
|
+
this.scrollActiveItemIntoViewIfNeeded();
|
|
198
|
+
this.focusActiveItemIfNeeded();
|
|
199
|
+
},
|
|
200
|
+
onNavigationKey(key) {
|
|
201
|
+
const listItems = this._getListItemNodes();
|
|
202
|
+
const matchingItems = listItems.filter((item) => {
|
|
203
|
+
const content = item.textContent.trim().toLowerCase();
|
|
204
|
+
return content.startsWith(key.toLowerCase());
|
|
205
|
+
});
|
|
206
|
+
if (matchingItems.length <= 0) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const highlightedMatchingItemIndex = matchingItems.findIndex((item) => {
|
|
210
|
+
return this[indexKey] === listItems.indexOf(item);
|
|
211
|
+
});
|
|
212
|
+
const nextHighlightedItemIndex = listItems.indexOf(
|
|
213
|
+
highlightedMatchingItemIndex < matchingItems.length - 1 ? matchingItems[highlightedMatchingItemIndex + 1] : matchingItems[0]
|
|
214
|
+
);
|
|
215
|
+
this.setHighlightIndex(nextHighlightedItemIndex);
|
|
216
|
+
this.scrollActiveItemIntoViewIfNeeded();
|
|
217
|
+
this.focusActiveItemIfNeeded();
|
|
218
|
+
},
|
|
219
|
+
isValidLetter(key) {
|
|
220
|
+
if (key.length > 1) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
return key >= "a" && key <= "z" || key >= "A" && key <= "Z";
|
|
224
|
+
},
|
|
225
|
+
jumpToBeginning() {
|
|
226
|
+
this.setHighlightIndex(0);
|
|
227
|
+
},
|
|
228
|
+
jumpToEnd() {
|
|
229
|
+
this.setHighlightIndex(this._itemsLength() - 1);
|
|
230
|
+
},
|
|
231
|
+
setHighlightIndex(num) {
|
|
232
|
+
this[indexKey] = num;
|
|
233
|
+
this[idKey] = this._getItemId(num);
|
|
234
|
+
if (this._itemsLength() && afterHighlightMethod) {
|
|
235
|
+
this[afterHighlightMethod](num);
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
setHighlightId(id) {
|
|
239
|
+
this[idKey] = id;
|
|
240
|
+
this[indexKey] = this._getItemIndex(id);
|
|
241
|
+
if (this._itemsLength() && afterHighlightMethod) {
|
|
242
|
+
this[afterHighlightMethod](this._getItemIndex(id));
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
_getItemIndex(id) {
|
|
246
|
+
const listElement = this._getListElement();
|
|
247
|
+
if (!listElement) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const listItems = Array.from(listElement.querySelectorAll(`[role="${listItemRole}"], #sr-only-close-button`));
|
|
251
|
+
return listItems.indexOf(listElement.querySelector(`#${id}`));
|
|
252
|
+
},
|
|
253
|
+
_getItemId(index) {
|
|
254
|
+
var _a;
|
|
255
|
+
const listElement = this._getListElement();
|
|
256
|
+
if (!listElement) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
return (_a = listElement.querySelectorAll(`[role="${listItemRole}"], #sr-only-close-button`)[index]) == null ? void 0 : _a.id;
|
|
260
|
+
},
|
|
261
|
+
scrollActiveItemIntoViewIfNeeded() {
|
|
262
|
+
if (!this.scrollToOnHighlight) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const activeItemEl = this[activeItemKey];
|
|
266
|
+
if (activeItemEl) {
|
|
267
|
+
const listElement = this._getListElement();
|
|
268
|
+
this.scrollElementIntoViewIfNeeded(activeItemEl, null, null, listElement);
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
focusActiveItemIfNeeded() {
|
|
272
|
+
if (!this.focusOnKeyboardNavigation) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const activeItemEl = this[activeItemKey];
|
|
276
|
+
if (activeItemEl) {
|
|
277
|
+
activeItemEl.focus();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
exports.KeyboardNavigation = KeyboardNavigation;
|
|
283
|
+
//# sourceMappingURL=keyboard_list_navigation-fJnl_Iox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard_list_navigation-fJnl_Iox.js","sources":["../../common/mixins/dom.js","../../common/mixins/keyboard_list_navigation.js"],"sourcesContent":["export default {\n methods: {\n /**\n * Scroll an element into view if it is not fully visible in its nearest scrollable ancestor.\n * @param {Element} ref\n */\n scrollElementIntoViewIfNeeded (ref, opt_center, opt_behavior, opt_parent) {\n if (ref.scrollIntoViewIfNeeded) {\n this.scrollIntoViewIfNeeded(ref, opt_center, opt_behavior, opt_parent);\n } else {\n this.scrollIntoView(ref, 'bottom', false, opt_behavior, opt_parent);\n }\n },\n\n /**\n * Scroll an element to the top or bottom of its scroll ancestor.\n * @param {Element} ref\n */\n scrollElementIntoView (ref, opt_scrollToTop, opt_behavior, opt_parent) {\n if (opt_scrollToTop === 'center') {\n this.scrollIntoView(ref, 'center', false, opt_behavior, opt_parent);\n return;\n }\n\n if (opt_scrollToTop === false) {\n this.scrollIntoView(ref, 'bottom', false, opt_behavior, opt_parent);\n } else {\n this.scrollIntoView(ref, 'top', false, opt_behavior, opt_parent);\n }\n },\n\n scrollIntoViewIfNeeded (ref, opt_center, opt_behavior, opt_parent) {\n const dir = opt_center ? 'center' : undefined;\n this.scrollIntoView(ref, dir, true, opt_behavior, opt_parent);\n },\n\n scrollIntoView (ref, opt_dir, opt_ifNeeded, opt_behavior, opt_parent) {\n if (!ref || !ref.parentElement) {\n return;\n }\n const offsetTop = ref.offsetTop;\n const refParent = opt_parent || ref.parentElement;\n const scrollBounds = this._getScrollBounds(refParent);\n const parentHeight = scrollBounds.bottom - scrollBounds.top;\n const elHeight = this._getElementHeight(ref);\n const offsetBottom = offsetTop + elHeight;\n let scrollTop = -1;\n switch (opt_dir) {\n case 'top':\n scrollTop = offsetTop;\n break;\n case 'center':\n scrollTop = offsetTop + (elHeight - parentHeight) / 2;\n break;\n case 'bottom':\n scrollTop = scrollTop = offsetBottom - parentHeight;\n break;\n default:\n // Go to the closest edge if needed and no direction is provided.\n if (offsetTop - scrollBounds.top <= (parentHeight / 2)) {\n // Lock it to the top edge.\n scrollTop = offsetTop;\n } else {\n scrollTop = offsetBottom - parentHeight;\n }\n break;\n }\n this._setScrollTop(refParent, scrollTop, scrollBounds, offsetTop, offsetBottom, opt_ifNeeded, opt_behavior);\n },\n\n _setScrollTop (el, scrollTop, bounds, offsetTop, offsetBottom, opt_isNeeded, opt_behavior) {\n bounds = bounds || this._getScrollBounds(el);\n const parentHeight = bounds.bottom - bounds.top;\n if (opt_isNeeded && this._inScrollBounds(offsetTop, offsetBottom, bounds)) {\n // Then lock to the top or bottom if it's hanging off the edge.\n if (offsetTop < bounds.top) {\n // Snap it to the top.\n scrollTop = offsetTop;\n } else if (offsetBottom > bounds.bottom) {\n scrollTop = offsetBottom - parentHeight;\n } else {\n return;\n }\n }\n\n if (opt_behavior) {\n el.scrollTo({ top: scrollTop, behavior: opt_behavior });\n } else {\n el.scrollTop = scrollTop;\n }\n },\n\n _getElementHeight (el) {\n return el.getBoundingClientRect().height;\n },\n\n _getScrollBounds (el) {\n const height = this._getElementHeight(el);\n const scrollTop = el.scrollTop;\n return {\n top: scrollTop,\n bottom: scrollTop + height,\n };\n },\n\n _inScrollBounds (top, bottom, bounds) {\n // Since we read from top to bottom, we want more than 3/4 to be visible at the top\n // (bc you're looking at the bottom half) or a quarter visible at the bottom (bc you\n // can read the beginning of it)\n\n const height = bottom - top;\n return (bottom <= bounds.bottom + (3 * height / 4)) && (top >= bounds.top - (height / 4));\n },\n },\n};\n","import Dom from './dom';\n\nconst ERROR_INVALID_LIST_ELEMENT = (\n 'listElementKey is required or the referenced ' +\n 'element doesn\\'t exist. Received listElement: '\n);\n\n/**\n * Usage: `mixins: [keyboardNavigationMixin(options)]`\n *\n * This mixin provides some common data and methods to navigate a list of items\n * (such as a dropdown or select menu) by keyboard.\n *\n * To be effective, you must bind the onUpKey and onDownKey events, usually to\n * the root element of the component.\n *\n * @param listItemRole\n * @param indexKey\n * @param idKey\n * @param listElementKey\n * @param activeItemKey\n * @param openMethod\n * @param afterHighlightMethod\n * @param beginningOfListMethod\n * @param endOfListMethod\n * @param scrollToOnHighlight\n * @param focusOnKeyboardNavigation\n * @displayName Keyboard Navigation Mixin\n */\nexport default ({\n // Role of the list items in the component. This is used to identify the list items\n // so you must update this if the role of your list items is anything other than 'option'\n listItemRole = 'option',\n // Key of the data prop that will be added to the component.\n indexKey = 'highlightIndex',\n idKey = 'highlightId',\n // Key of the method that references the list element.\n listElementKey = 'listRef',\n // Optional, Key of the computed prop that references the currently active item element.\n activeItemKey = '',\n // Optional, name of the method that toggles the list visibility. Used for\n // opening the list when up or down is pressed.\n openMethod = null,\n // Optional, method to call when the highlightIndex is changed.\n afterHighlightMethod = null,\n // Optional, method to call when the highlightIndex goes past the beginning of the list.\n beginningOfListMethod = null,\n // Optional, method to call when the highlightIndex goes past the end of the list.\n endOfListMethod = null,\n // Scroll the active element into view when highlighted by a keyboard event.\n scrollToOnHighlight = true,\n // Focus the active element on keyboard navigation.\n focusOnKeyboardNavigation = false,\n} = {}) => ({\n mixins: [Dom],\n\n data () {\n return {\n [indexKey]: -1,\n [idKey]: '',\n scrollToOnHighlight,\n focusOnKeyboardNavigation,\n };\n },\n\n provide () {\n return {\n highlightId: () => this[idKey],\n };\n },\n\n methods: {\n // Returns the list element\n // this[listElement]() can return a Vue component, in which case we need to target\n // the $el property, or it can simply be an html element.\n _getListElement () {\n return this[listElementKey]()?.$el || this[listElementKey]();\n },\n\n // Gets the length of all the items in the list, uses the listItemRole param to determine\n // whether an element is a list item.\n _itemsLength () {\n const listItems = this._getListItemNodes();\n\n if (listItems === null) {\n return 0;\n }\n\n return listItems.length;\n },\n\n // Gets all the list item nodes within the list element\n _getListItemNodes () {\n const listElement = this._getListElement();\n\n if (!listElement) {\n console.error(ERROR_INVALID_LIST_ELEMENT, listElement);\n return null;\n }\n\n return Array.from(listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`));\n },\n\n onUpKey () {\n if (openMethod) {\n this[openMethod](true);\n }\n if (this[indexKey] > 0) {\n this.setHighlightIndex(this[indexKey] - 1);\n } else if (beginningOfListMethod) {\n this[beginningOfListMethod]();\n }\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onDownKey () {\n if (openMethod) {\n this[openMethod](true);\n }\n if (this[indexKey] < this._itemsLength() - 1) {\n this.setHighlightIndex(this[indexKey] + 1);\n } else if (endOfListMethod) {\n this[endOfListMethod]();\n }\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onHomeKey () {\n this.jumpToBeginning();\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onEndKey () {\n this.jumpToEnd();\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n onNavigationKey (key) {\n const listItems = this._getListItemNodes();\n\n const matchingItems = listItems.filter(item => {\n const content = item.textContent.trim().toLowerCase();\n return content.startsWith(key.toLowerCase());\n });\n\n if (matchingItems.length <= 0) {\n return;\n }\n\n const highlightedMatchingItemIndex = matchingItems.findIndex(item => {\n return this[indexKey] === listItems.indexOf(item);\n });\n\n const nextHighlightedItemIndex = listItems.indexOf(\n highlightedMatchingItemIndex < matchingItems.length - 1\n ? matchingItems[highlightedMatchingItemIndex + 1]\n : matchingItems[0],\n );\n\n this.setHighlightIndex(nextHighlightedItemIndex);\n this.scrollActiveItemIntoViewIfNeeded();\n this.focusActiveItemIfNeeded();\n },\n\n isValidLetter (key) {\n if (key.length > 1) {\n return false;\n }\n\n return (key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z');\n },\n\n jumpToBeginning () {\n this.setHighlightIndex(0);\n },\n\n jumpToEnd () {\n this.setHighlightIndex(this._itemsLength() - 1);\n },\n\n setHighlightIndex (num) {\n this[indexKey] = num;\n this[idKey] = this._getItemId(num);\n\n if (this._itemsLength() && afterHighlightMethod) {\n this[afterHighlightMethod](num);\n }\n },\n\n setHighlightId (id) {\n this[idKey] = id;\n this[indexKey] = this._getItemIndex(id);\n\n if (this._itemsLength() && afterHighlightMethod) {\n this[afterHighlightMethod](this._getItemIndex(id));\n }\n },\n\n _getItemIndex (id) {\n const listElement = this._getListElement();\n if (!listElement) {\n return;\n }\n\n const listItems = Array.from(listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`));\n return listItems.indexOf(listElement.querySelector(`#${id}`));\n },\n\n _getItemId (index) {\n const listElement = this._getListElement();\n if (!listElement) {\n return;\n }\n\n return listElement.querySelectorAll(`[role=\"${listItemRole}\"], #sr-only-close-button`)[index]?.id;\n },\n\n scrollActiveItemIntoViewIfNeeded () {\n if (!this.scrollToOnHighlight) {\n return;\n }\n const activeItemEl = this[activeItemKey];\n if (activeItemEl) {\n // When listElementKey is not passed,\n // scrollElementIntoViewIfNeeded will default to the immediate wrapper of the item.\n const listElement = this._getListElement();\n this.scrollElementIntoViewIfNeeded(activeItemEl, null, null, listElement);\n }\n },\n\n focusActiveItemIfNeeded () {\n if (!this.focusOnKeyboardNavigation) {\n return;\n }\n const activeItemEl = this[activeItemKey];\n if (activeItemEl) {\n activeItemEl.focus();\n }\n },\n },\n});\n"],"names":[],"mappings":";AAAA,MAAe,MAAA;AAAA,EACb,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,IAKP,8BAA+B,KAAK,YAAY,cAAc,YAAY;AACxE,UAAI,IAAI,wBAAwB;AAC9B,aAAK,uBAAuB,KAAK,YAAY,cAAc,UAAU;AAAA,MAC7E,OAAa;AACL,aAAK,eAAe,KAAK,UAAU,OAAO,cAAc,UAAU;AAAA,MACnE;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,sBAAuB,KAAK,iBAAiB,cAAc,YAAY;AACrE,UAAI,oBAAoB,UAAU;AAChC,aAAK,eAAe,KAAK,UAAU,OAAO,cAAc,UAAU;AAClE;AAAA,MACD;AAED,UAAI,oBAAoB,OAAO;AAC7B,aAAK,eAAe,KAAK,UAAU,OAAO,cAAc,UAAU;AAAA,MAC1E,OAAa;AACL,aAAK,eAAe,KAAK,OAAO,OAAO,cAAc,UAAU;AAAA,MA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,EAAE,EAAE,CAAC;AAAA,IAC7D;AAAA,IAED,WAAY,OAAO;;AACjB,YAAM,cAAc,KAAK;AACzB,UAAI,CAAC,aAAa;AAChB;AAAA,MACD;AAED,cAAO,iBAAY,iBAAiB,UAAU,YAAY,2BAA2B,EAAE,KAAK,MAArF,mBAAwF;AAAA,IAChG;AAAA,IAED,mCAAoC;AAClC,UAAI,CAAC,KAAK,qBAAqB;AAC7B;AAAA,MACD;AACD,YAAM,eAAe,KAAK,aAAa;AACvC,UAAI,cAAc;AAGhB,cAAM,cAAc,KAAK;AACzB,aAAK,8BAA8B,cAAc,MAAM,MAAM,WAAW;AAAA,MACzE;AAAA,IACF;AAAA,IAED,0BAA2B;AACzB,UAAI,CAAC,KAAK,2BAA2B;AACnC;AAAA,MACD;AACD,YAAM,eAAe,KAAK,aAAa;AACvC,UAAI,cAAc;AAChB,qBAAa,MAAK;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AACH;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const DANGER = "danger";
|
|
3
|
+
const WARNING = "warning";
|
|
4
|
+
const SUCCESS = "success";
|
|
5
|
+
const MUTED = "muted";
|
|
6
|
+
const INVERTED = "inverted";
|
|
7
|
+
const MENTION = "mention";
|
|
8
|
+
const LINK_VARIANTS = ["", DANGER, WARNING, SUCCESS, MUTED, INVERTED, MENTION];
|
|
9
|
+
const LINK_KIND_MODIFIERS = {
|
|
10
|
+
default: "",
|
|
11
|
+
warning: "d-link--warning",
|
|
12
|
+
danger: "d-link--danger",
|
|
13
|
+
success: "d-link--success",
|
|
14
|
+
muted: "d-link--muted",
|
|
15
|
+
inverted: "d-link--inverted",
|
|
16
|
+
mention: "d-link--mention"
|
|
17
|
+
};
|
|
18
|
+
exports.INVERTED = INVERTED;
|
|
19
|
+
exports.LINK_KIND_MODIFIERS = LINK_KIND_MODIFIERS;
|
|
20
|
+
exports.LINK_VARIANTS = LINK_VARIANTS;
|
|
21
|
+
exports.MUTED = MUTED;
|
|
22
|
+
//# sourceMappingURL=link_constants-Huj7D_hm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link_constants-
|
|
1
|
+
{"version":3,"file":"link_constants-Huj7D_hm.js","sources":["../../components/link/link_constants.js"],"sourcesContent":["export const DANGER = 'danger';\nexport const WARNING = 'warning';\nexport const SUCCESS = 'success';\nexport const MUTED = 'muted';\nexport const INVERTED = 'inverted';\nexport const MENTION = 'mention';\nexport const LINK_VARIANTS = ['', DANGER, WARNING, SUCCESS, MUTED, INVERTED, MENTION];\n\nexport const LINK_KIND_MODIFIERS = {\n default: '',\n warning: 'd-link--warning',\n danger: 'd-link--danger',\n success: 'd-link--success',\n muted: 'd-link--muted',\n inverted: 'd-link--inverted',\n mention: 'd-link--mention',\n};\n\nexport default {\n LINK_VARIANTS,\n LINK_KIND_MODIFIERS,\n};\n"],"names":[],"mappings":";AAAO,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,UAAU;AACX,MAAC,QAAQ;AACT,MAAC,WAAW;AACjB,MAAM,UAAU;AACX,MAAC,gBAAgB,CAAC,IAAI,QAAQ,SAAS,SAAS,OAAO,UAAU,OAAO;AAExE,MAAC,sBAAsB;AAAA,EACjC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS;AACX;;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const DANGER = "danger";
|
|
2
|
+
const WARNING = "warning";
|
|
3
|
+
const SUCCESS = "success";
|
|
4
|
+
const MUTED = "muted";
|
|
5
|
+
const INVERTED = "inverted";
|
|
6
|
+
const MENTION = "mention";
|
|
7
|
+
const LINK_VARIANTS = ["", DANGER, WARNING, SUCCESS, MUTED, INVERTED, MENTION];
|
|
8
|
+
const LINK_KIND_MODIFIERS = {
|
|
9
|
+
default: "",
|
|
10
|
+
warning: "d-link--warning",
|
|
11
|
+
danger: "d-link--danger",
|
|
12
|
+
success: "d-link--success",
|
|
13
|
+
muted: "d-link--muted",
|
|
14
|
+
inverted: "d-link--inverted",
|
|
15
|
+
mention: "d-link--mention"
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
INVERTED,
|
|
19
|
+
LINK_KIND_MODIFIERS,
|
|
20
|
+
LINK_VARIANTS,
|
|
21
|
+
MUTED
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=link_constants-nWVlXQBs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link_constants-nWVlXQBs.js","sources":["../../components/link/link_constants.js"],"sourcesContent":["export const DANGER = 'danger';\nexport const WARNING = 'warning';\nexport const SUCCESS = 'success';\nexport const MUTED = 'muted';\nexport const INVERTED = 'inverted';\nexport const MENTION = 'mention';\nexport const LINK_VARIANTS = ['', DANGER, WARNING, SUCCESS, MUTED, INVERTED, MENTION];\n\nexport const LINK_KIND_MODIFIERS = {\n default: '',\n warning: 'd-link--warning',\n danger: 'd-link--danger',\n success: 'd-link--success',\n muted: 'd-link--muted',\n inverted: 'd-link--inverted',\n mention: 'd-link--mention',\n};\n\nexport default {\n LINK_VARIANTS,\n LINK_KIND_MODIFIERS,\n};\n"],"names":[],"mappings":"AAAO,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,UAAU;AACX,MAAC,QAAQ;AACT,MAAC,WAAW;AACjB,MAAM,UAAU;AACX,MAAC,gBAAgB,CAAC,IAAI,QAAQ,SAAS,SAAS,OAAO,UAAU,OAAO;AAExE,MAAC,sBAAsB;AAAA,EACjC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS;AACX;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const LIST_ITEM_TYPES = {
|
|
3
|
+
DEFAULT: "default",
|
|
4
|
+
CUSTOM: "custom"
|
|
5
|
+
};
|
|
6
|
+
const LIST_ITEM_NAVIGATION_TYPES = {
|
|
7
|
+
ARROW_KEYS: "arrow-keys",
|
|
8
|
+
TAB: "tab",
|
|
9
|
+
NONE: "none"
|
|
10
|
+
};
|
|
11
|
+
exports.LIST_ITEM_NAVIGATION_TYPES = LIST_ITEM_NAVIGATION_TYPES;
|
|
12
|
+
exports.LIST_ITEM_TYPES = LIST_ITEM_TYPES;
|
|
13
|
+
//# sourceMappingURL=list_item_constants-EiqkqZvP.js.map
|
package/dist/chunks/{list_item_constants-LTUc74pD.js.map → list_item_constants-EiqkqZvP.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_item_constants-
|
|
1
|
+
{"version":3,"file":"list_item_constants-EiqkqZvP.js","sources":["../../components/list_item/list_item_constants.js"],"sourcesContent":["export const LIST_ITEM_TYPES = {\n DEFAULT: 'default',\n CUSTOM: 'custom',\n};\n\nexport const LIST_ITEM_NAVIGATION_TYPES = {\n ARROW_KEYS: 'arrow-keys',\n TAB: 'tab',\n NONE: 'none',\n};\n\nexport default {\n LIST_ITEM_TYPES,\n LIST_ITEM_NAVIGATION_TYPES,\n};\n"],"names":[],"mappings":";AAAY,MAAC,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,QAAQ;AACV;AAEY,MAAC,6BAA6B;AAAA,EACxC,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,MAAM;AACR;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const LIST_ITEM_TYPES = {
|
|
2
|
+
DEFAULT: "default",
|
|
3
|
+
CUSTOM: "custom"
|
|
4
|
+
};
|
|
5
|
+
const LIST_ITEM_NAVIGATION_TYPES = {
|
|
6
|
+
ARROW_KEYS: "arrow-keys",
|
|
7
|
+
TAB: "tab",
|
|
8
|
+
NONE: "none"
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
LIST_ITEM_NAVIGATION_TYPES,
|
|
12
|
+
LIST_ITEM_TYPES
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=list_item_constants-u1xcN9Dd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_item_constants-u1xcN9Dd.js","sources":["../../components/list_item/list_item_constants.js"],"sourcesContent":["export const LIST_ITEM_TYPES = {\n DEFAULT: 'default',\n CUSTOM: 'custom',\n};\n\nexport const LIST_ITEM_NAVIGATION_TYPES = {\n ARROW_KEYS: 'arrow-keys',\n TAB: 'tab',\n NONE: 'none',\n};\n\nexport default {\n LIST_ITEM_TYPES,\n LIST_ITEM_NAVIGATION_TYPES,\n};\n"],"names":[],"mappings":"AAAY,MAAC,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,QAAQ;AACV;AAEY,MAAC,6BAA6B;AAAA,EACxC,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,MAAM;AACR;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const focusableAttrs = ':not(:disabled):not([aria-disabled="true"]):not([role="presentation"])';
|
|
3
|
+
const tabbableAttrs = `${focusableAttrs}:not([tabindex="-1"])`;
|
|
4
|
+
const focusableElementsList = `button,[href],input,select,textarea,details,[tabindex]`;
|
|
5
|
+
const Modal = {
|
|
6
|
+
methods: {
|
|
7
|
+
/**
|
|
8
|
+
* get the first focusable element in your component, includes tabindex="-1".
|
|
9
|
+
* @param {object} el - optional - ref of dom element to trap focus on.
|
|
10
|
+
* will default to the root node of the vue component
|
|
11
|
+
*/
|
|
12
|
+
async getFirstFocusableElement(el) {
|
|
13
|
+
await this.$nextTick();
|
|
14
|
+
const focusableElements = this._getFocusableElements(el, true);
|
|
15
|
+
return this._getFirstFocusElement(focusableElements);
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* set focus to the first focusable element in your component, includes tabindex="-1".
|
|
19
|
+
* @param {object} el - optional - ref of dom element to trap focus on.
|
|
20
|
+
* will default to the root node of the vue component
|
|
21
|
+
*/
|
|
22
|
+
async focusFirstElement(el = this.$el) {
|
|
23
|
+
const elToFocus = await this.getFirstFocusableElement(el);
|
|
24
|
+
elToFocus == null ? void 0 : elToFocus.focus({ preventScroll: true });
|
|
25
|
+
},
|
|
26
|
+
async focusElementById(elementId) {
|
|
27
|
+
var _a;
|
|
28
|
+
await this.$nextTick();
|
|
29
|
+
const result = (_a = this.$el) == null ? void 0 : _a.querySelector(elementId);
|
|
30
|
+
if (result) {
|
|
31
|
+
result.focus();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
console.warn('Could not find the element specified in dt-modal prop "initialFocusElement". Defaulting to focusing the first element.');
|
|
35
|
+
await this.focusFirstElement();
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* internal use only.
|
|
39
|
+
*
|
|
40
|
+
* @param focusableElements - list of focusable elements
|
|
41
|
+
* @returns {*} - first DOM element that is focusable.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
_getFirstFocusElement(focusableElements) {
|
|
45
|
+
if (!focusableElements.length) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let firstFocusEl = focusableElements[0];
|
|
49
|
+
if (firstFocusEl.matches('[type="radio"]:not(:checked)')) {
|
|
50
|
+
firstFocusEl = focusableElements.find((el) => el.checked && el.name === firstFocusEl.name) || firstFocusEl;
|
|
51
|
+
}
|
|
52
|
+
return firstFocusEl;
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* internal use only.
|
|
56
|
+
*
|
|
57
|
+
* gets all the focusable elements within the component
|
|
58
|
+
* and sets the first and last of those elements.
|
|
59
|
+
*
|
|
60
|
+
* @param {object} el - the root dom element to find focusable elements in.
|
|
61
|
+
* @param {bool} includeNegativeTabIndex - will include tabindex="-1" in the list of focusable elements.
|
|
62
|
+
*/
|
|
63
|
+
_getFocusableElements(el = this.$el, includeNegativeTabIndex = false) {
|
|
64
|
+
if (!el)
|
|
65
|
+
return [];
|
|
66
|
+
const focusableContent = [...el.querySelectorAll(focusableElementsList)];
|
|
67
|
+
return focusableContent.filter((fc) => {
|
|
68
|
+
const style = window.getComputedStyle(fc);
|
|
69
|
+
return style.getPropertyValue("display") !== "none" && style.getPropertyValue("visibility") !== "hidden" && fc.matches(includeNegativeTabIndex ? focusableAttrs : tabbableAttrs);
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* tabs to the next element contained within your component, does not include tabindex="-1".
|
|
74
|
+
* @param {object} e - keypress event
|
|
75
|
+
* @param {object} el - optional - ref of dom element to trap focus on.
|
|
76
|
+
* will default to the root node of the vue component
|
|
77
|
+
*/
|
|
78
|
+
focusTrappedTabPress(e, el) {
|
|
79
|
+
const isTabPressed = e.key === "Tab";
|
|
80
|
+
if (!isTabPressed) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const focusableElements = this._getFocusableElements(el);
|
|
84
|
+
if (!focusableElements.length) {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const firstFocusableElement = this._getFirstFocusElement(focusableElements);
|
|
89
|
+
const lastFocusableElement = focusableElements[focusableElements.length - 1];
|
|
90
|
+
if (e.shiftKey) {
|
|
91
|
+
if (document.activeElement === firstFocusableElement) {
|
|
92
|
+
lastFocusableElement.focus();
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
if (document.activeElement === lastFocusableElement) {
|
|
97
|
+
firstFocusableElement.focus();
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
exports.Modal = Modal;
|
|
105
|
+
//# sourceMappingURL=modal-VgxXAQFP.js.map
|