@dialpad/dialtone-vue 3.209.0 → 3.210.0-next.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/common/mixins/keyboard-list-navigation.cjs +1 -1
- package/dist/common/mixins/keyboard-list-navigation.cjs.map +1 -1
- package/dist/common/mixins/keyboard-list-navigation.js +7 -7
- package/dist/common/mixins/keyboard-list-navigation.js.map +1 -1
- package/dist/component-documentation.json +1 -1
- package/dist/dialtone-vue.cjs +1 -1
- package/dist/dialtone-vue.js +422 -386
- package/dist/dialtone-vue.js.map +1 -1
- package/dist/lib/attachment-carousel/attachment-carousel.cjs +1 -1
- package/dist/lib/attachment-carousel/attachment-carousel.cjs.map +1 -1
- package/dist/lib/attachment-carousel/attachment-carousel.js +64 -117
- package/dist/lib/attachment-carousel/attachment-carousel.js.map +1 -1
- package/dist/lib/avatar/avatar-constants.cjs +1 -1
- package/dist/lib/avatar/avatar-constants.cjs.map +1 -1
- package/dist/lib/avatar/avatar-constants.js +169 -43
- package/dist/lib/avatar/avatar-constants.js.map +1 -1
- package/dist/lib/avatar/avatar.cjs +1 -1
- package/dist/lib/avatar/avatar.cjs.map +1 -1
- package/dist/lib/avatar/avatar.js +185 -100
- package/dist/lib/avatar/avatar.js.map +1 -1
- package/dist/lib/avatar/index.cjs +1 -1
- package/dist/lib/avatar/index.js +16 -10
- package/dist/lib/badge/badge.cjs +1 -1
- package/dist/lib/badge/badge.cjs.map +1 -1
- package/dist/lib/badge/badge.js +47 -35
- package/dist/lib/badge/badge.js.map +1 -1
- package/dist/lib/button/button-constants.cjs +1 -1
- package/dist/lib/button/button-constants.cjs.map +1 -1
- package/dist/lib/button/button-constants.js +23 -19
- package/dist/lib/button/button-constants.js.map +1 -1
- package/dist/lib/button/button.cjs +1 -1
- package/dist/lib/button/button.cjs.map +1 -1
- package/dist/lib/button/button.js +138 -60
- package/dist/lib/button/button.js.map +1 -1
- package/dist/lib/callbar-button/callbar-button.cjs +1 -1
- package/dist/lib/callbar-button/callbar-button.cjs.map +1 -1
- package/dist/lib/callbar-button/callbar-button.js +8 -9
- package/dist/lib/callbar-button/callbar-button.js.map +1 -1
- package/dist/lib/callbox/callbox.cjs +1 -1
- package/dist/lib/callbox/callbox.cjs.map +1 -1
- package/dist/lib/callbox/callbox.js +47 -47
- package/dist/lib/callbox/callbox.js.map +1 -1
- package/dist/lib/combobox-multi-select/combobox-multi-select.cjs +1 -1
- package/dist/lib/combobox-multi-select/combobox-multi-select.cjs.map +1 -1
- package/dist/lib/combobox-multi-select/combobox-multi-select.js +31 -31
- package/dist/lib/combobox-multi-select/combobox-multi-select.js.map +1 -1
- package/dist/lib/contact-centers-row/contact-centers-row.cjs +1 -1
- package/dist/lib/contact-centers-row/contact-centers-row.cjs.map +1 -1
- package/dist/lib/contact-centers-row/contact-centers-row.js +33 -33
- package/dist/lib/contact-centers-row/contact-centers-row.js.map +1 -1
- package/dist/lib/contact-info/contact-info.cjs +1 -1
- package/dist/lib/contact-info/contact-info.cjs.map +1 -1
- package/dist/lib/contact-info/contact-info.js +56 -56
- package/dist/lib/contact-info/contact-info.js.map +1 -1
- package/dist/lib/contact-row/contact-row.cjs +1 -1
- package/dist/lib/contact-row/contact-row.cjs.map +1 -1
- package/dist/lib/contact-row/contact-row.js +1 -1
- package/dist/lib/contact-row/contact-row.js.map +1 -1
- package/dist/lib/datepicker/datepicker.cjs +1 -1
- package/dist/lib/datepicker/datepicker.cjs.map +1 -1
- package/dist/lib/datepicker/datepicker.js +11 -11
- package/dist/lib/datepicker/datepicker.js.map +1 -1
- package/dist/lib/editor/editor.cjs +1 -1
- package/dist/lib/editor/editor.cjs.map +1 -1
- package/dist/lib/editor/editor.js +13 -12
- package/dist/lib/editor/editor.js.map +1 -1
- package/dist/lib/emoji-picker/emoji-picker.cjs +1 -1
- package/dist/lib/emoji-picker/emoji-picker.cjs.map +1 -1
- package/dist/lib/emoji-picker/emoji-picker.js +2 -2
- package/dist/lib/emoji-picker/emoji-picker.js.map +1 -1
- package/dist/lib/feed-item-pill/feed-item-pill.cjs +1 -1
- package/dist/lib/feed-item-pill/feed-item-pill.cjs.map +1 -1
- package/dist/lib/feed-item-pill/feed-item-pill.js +56 -53
- package/dist/lib/feed-item-pill/feed-item-pill.js.map +1 -1
- package/dist/lib/feed-item-row/feed-item-row.cjs +1 -1
- package/dist/lib/feed-item-row/feed-item-row.cjs.map +1 -1
- package/dist/lib/feed-item-row/feed-item-row.js +11 -11
- package/dist/lib/feed-item-row/feed-item-row.js.map +1 -1
- package/dist/lib/filter-pill/filter-pill.cjs +2 -0
- package/dist/lib/filter-pill/filter-pill.cjs.map +1 -0
- package/dist/lib/filter-pill/filter-pill.js +346 -0
- package/dist/lib/filter-pill/filter-pill.js.map +1 -0
- package/dist/lib/filter-pill/index.cjs +2 -0
- package/dist/lib/filter-pill/index.cjs.map +1 -0
- package/dist/lib/filter-pill/index.js +5 -0
- package/dist/lib/filter-pill/index.js.map +1 -0
- package/dist/lib/general-row/general-row.cjs +1 -1
- package/dist/lib/general-row/general-row.cjs.map +1 -1
- package/dist/lib/general-row/general-row.js +153 -99
- package/dist/lib/general-row/general-row.js.map +1 -1
- package/dist/lib/group-row/group-row.cjs +1 -1
- package/dist/lib/group-row/group-row.cjs.map +1 -1
- package/dist/lib/group-row/group-row.js +1 -1
- package/dist/lib/group-row/group-row.js.map +1 -1
- package/dist/lib/grouped-chip/grouped-chip.cjs +1 -1
- package/dist/lib/grouped-chip/grouped-chip.cjs.map +1 -1
- package/dist/lib/grouped-chip/grouped-chip.js +31 -31
- package/dist/lib/grouped-chip/grouped-chip.js.map +1 -1
- package/dist/lib/input/input.cjs +1 -1
- package/dist/lib/input/input.cjs.map +1 -1
- package/dist/lib/input/input.js +53 -42
- package/dist/lib/input/input.js.map +1 -1
- package/dist/lib/item-layout/item-layout.cjs +3 -3
- package/dist/lib/item-layout/item-layout.cjs.map +1 -1
- package/dist/lib/item-layout/item-layout.js +74 -39
- package/dist/lib/item-layout/item-layout.js.map +1 -1
- package/dist/lib/kitchen-sink/kitchen-sink-view.cjs +2 -0
- package/dist/lib/kitchen-sink/kitchen-sink-view.cjs.map +1 -0
- package/dist/lib/kitchen-sink/kitchen-sink-view.js +263 -0
- package/dist/lib/kitchen-sink/kitchen-sink-view.js.map +1 -0
- package/dist/lib/link/link.cjs +1 -1
- package/dist/lib/link/link.cjs.map +1 -1
- package/dist/lib/link/link.js +21 -12
- package/dist/lib/link/link.js.map +1 -1
- package/dist/lib/list-item/list-item.cjs +1 -1
- package/dist/lib/list-item/list-item.cjs.map +1 -1
- package/dist/lib/list-item/list-item.js +25 -15
- package/dist/lib/list-item/list-item.js.map +1 -1
- package/dist/lib/loader/loader.cjs +13 -1
- package/dist/lib/loader/loader.cjs.map +1 -1
- package/dist/lib/loader/loader.js +31 -20
- package/dist/lib/loader/loader.js.map +1 -1
- package/dist/lib/message-input/message-input.cjs +1 -1
- package/dist/lib/message-input/message-input.cjs.map +1 -1
- package/dist/lib/message-input/message-input.js +44 -43
- package/dist/lib/message-input/message-input.js.map +1 -1
- package/dist/lib/mode-island/index.cjs +2 -0
- package/dist/lib/mode-island/index.cjs.map +1 -0
- package/dist/lib/mode-island/index.js +7 -0
- package/dist/lib/mode-island/index.js.map +1 -0
- package/dist/lib/mode-island/mode-island-constants.cjs +2 -0
- package/dist/lib/mode-island/mode-island-constants.cjs.map +1 -0
- package/dist/lib/mode-island/mode-island-constants.js +12 -0
- package/dist/lib/mode-island/mode-island-constants.js.map +1 -0
- package/dist/lib/mode-island/mode-island.cjs +2 -0
- package/dist/lib/mode-island/mode-island.cjs.map +1 -0
- package/dist/lib/mode-island/mode-island.js +130 -0
- package/dist/lib/mode-island/mode-island.js.map +1 -0
- package/dist/lib/mode-island/utils.cjs +2 -0
- package/dist/lib/mode-island/utils.cjs.map +1 -0
- package/dist/lib/mode-island/utils.js +32 -0
- package/dist/lib/mode-island/utils.js.map +1 -0
- package/dist/lib/mode-island/validators.cjs +2 -0
- package/dist/lib/mode-island/validators.cjs.map +1 -0
- package/dist/lib/mode-island/validators.js +12 -0
- package/dist/lib/mode-island/validators.js.map +1 -0
- package/dist/lib/pagination/pagination.cjs +1 -1
- package/dist/lib/pagination/pagination.cjs.map +1 -1
- package/dist/lib/pagination/pagination.js +15 -14
- package/dist/lib/pagination/pagination.js.map +1 -1
- package/dist/lib/popover/popover.cjs +1 -1
- package/dist/lib/popover/popover.cjs.map +1 -1
- package/dist/lib/popover/popover.js +1 -1
- package/dist/lib/popover/popover.js.map +1 -1
- package/dist/lib/progress-circle/index.cjs +2 -0
- package/dist/lib/progress-circle/index.cjs.map +1 -0
- package/dist/lib/progress-circle/index.js +10 -0
- package/dist/lib/progress-circle/index.js.map +1 -0
- package/dist/lib/progress-circle/progress-circle-constants.cjs +2 -0
- package/dist/lib/progress-circle/progress-circle-constants.cjs.map +1 -0
- package/dist/lib/progress-circle/progress-circle-constants.js +25 -0
- package/dist/lib/progress-circle/progress-circle-constants.js.map +1 -0
- package/dist/lib/progress-circle/progress-circle.cjs +2 -0
- package/dist/lib/progress-circle/progress-circle.cjs.map +1 -0
- package/dist/lib/progress-circle/progress-circle.js +136 -0
- package/dist/lib/progress-circle/progress-circle.js.map +1 -0
- package/dist/lib/rich-text-editor/rich-text-editor.cjs +2 -2
- package/dist/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.js +115 -97
- package/dist/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/lib/root-layout/root-layout-constants.cjs +1 -1
- package/dist/lib/root-layout/root-layout-constants.cjs.map +1 -1
- package/dist/lib/root-layout/root-layout-constants.js +4 -2
- package/dist/lib/root-layout/root-layout-constants.js.map +1 -1
- package/dist/lib/root-layout/root-layout.cjs +1 -1
- package/dist/lib/root-layout/root-layout.cjs.map +1 -1
- package/dist/lib/root-layout/root-layout.js +9 -10
- package/dist/lib/root-layout/root-layout.js.map +1 -1
- package/dist/lib/settings-menu-button/settings-menu-button.cjs +1 -1
- package/dist/lib/settings-menu-button/settings-menu-button.cjs.map +1 -1
- package/dist/lib/settings-menu-button/settings-menu-button.js +14 -15
- package/dist/lib/settings-menu-button/settings-menu-button.js.map +1 -1
- package/dist/lib/split-button/split-button-alpha.cjs +1 -1
- package/dist/lib/split-button/split-button-alpha.cjs.map +1 -1
- package/dist/lib/split-button/split-button-alpha.js +51 -28
- package/dist/lib/split-button/split-button-alpha.js.map +1 -1
- package/dist/lib/split-button/split-button.cjs +1 -1
- package/dist/lib/split-button/split-button.cjs.map +1 -1
- package/dist/lib/split-button/split-button.js +235 -89
- package/dist/lib/split-button/split-button.js.map +1 -1
- package/dist/lib/text/index.cjs +2 -0
- package/dist/lib/text/index.cjs.map +1 -0
- package/dist/lib/text/index.js +20 -0
- package/dist/lib/text/index.js.map +1 -0
- package/dist/lib/text/text-constants.cjs +2 -0
- package/dist/lib/text/text-constants.cjs.map +1 -0
- package/dist/lib/text/text-constants.js +69 -0
- package/dist/lib/text/text-constants.js.map +1 -0
- package/dist/lib/text/text-tone-tokens.cjs +2 -0
- package/dist/lib/text/text-tone-tokens.cjs.map +1 -0
- package/dist/lib/text/text-tone-tokens.js +33 -0
- package/dist/lib/text/text-tone-tokens.js.map +1 -0
- package/dist/lib/text/text.cjs +2 -0
- package/dist/lib/text/text.cjs.map +1 -0
- package/dist/lib/text/text.js +203 -0
- package/dist/lib/text/text.js.map +1 -0
- package/dist/lib/top-banner-info/top-banner-info.cjs +1 -1
- package/dist/lib/top-banner-info/top-banner-info.cjs.map +1 -1
- package/dist/lib/top-banner-info/top-banner-info.js +16 -16
- package/dist/lib/top-banner-info/top-banner-info.js.map +1 -1
- package/dist/localization/en-US.cjs +2 -0
- package/dist/localization/en-US.cjs.map +1 -1
- package/dist/localization/en-US.js +2 -0
- package/dist/localization/en-US.js.map +1 -1
- package/dist/localization/es-LA.cjs +1 -1
- package/dist/localization/es-LA.cjs.map +1 -1
- package/dist/localization/es-LA.js +1 -1
- package/dist/localization/es-LA.js.map +1 -1
- package/dist/localization/it-IT.cjs +3 -3
- package/dist/localization/it-IT.cjs.map +1 -1
- package/dist/localization/it-IT.js +3 -3
- package/dist/localization/it-IT.js.map +1 -1
- package/dist/localization/nl-NL.cjs +2 -2
- package/dist/localization/nl-NL.cjs.map +1 -1
- package/dist/localization/nl-NL.js +2 -2
- package/dist/localization/nl-NL.js.map +1 -1
- package/dist/localization/ru-RU.cjs +1 -1
- package/dist/localization/ru-RU.cjs.map +1 -1
- package/dist/localization/ru-RU.js +1 -1
- package/dist/localization/ru-RU.js.map +1 -1
- package/dist/localization/zh-CN.cjs +1 -1
- package/dist/localization/zh-CN.cjs.map +1 -1
- package/dist/localization/zh-CN.js +1 -1
- package/dist/localization/zh-CN.js.map +1 -1
- package/dist/node_modules/@tiptap/vue-3.cjs.map +1 -1
- package/dist/node_modules/@tiptap/vue-3.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/common/mixins/keyboard_list_navigation.d.ts.map +1 -1
- package/dist/types/common/sr_only_close_button.vue.d.ts +20 -2
- package/dist/types/components/avatar/avatar.vue.d.ts +71 -25
- package/dist/types/components/avatar/avatar.vue.d.ts.map +1 -1
- package/dist/types/components/avatar/avatar_constants.d.ts +86 -29
- package/dist/types/components/avatar/avatar_constants.d.ts.map +1 -1
- package/dist/types/components/avatar/index.d.ts +1 -1
- package/dist/types/components/badge/badge.vue.d.ts.map +1 -1
- package/dist/types/components/banner/banner.vue.d.ts +40 -4
- package/dist/types/components/banner/banner.vue.d.ts.map +1 -1
- package/dist/types/components/breadcrumbs/breadcrumb_item.vue.d.ts +9 -0
- package/dist/types/components/breadcrumbs/breadcrumb_item.vue.d.ts.map +1 -1
- package/dist/types/components/breadcrumbs/breadcrumbs.vue.d.ts +9 -0
- package/dist/types/components/button/button.vue.d.ts +20 -2
- package/dist/types/components/button/button.vue.d.ts.map +1 -1
- package/dist/types/components/button/button_constants.d.ts +4 -0
- package/dist/types/components/button/button_constants.d.ts.map +1 -1
- package/dist/types/components/chip/chip.vue.d.ts +20 -2
- package/dist/types/components/chip/chip.vue.d.ts.map +1 -1
- package/dist/types/components/collapsible/collapsible.vue.d.ts +20 -2
- package/dist/types/components/collapsible/collapsible.vue.d.ts.map +1 -1
- package/dist/types/components/combobox/combobox.vue.d.ts +79 -13
- package/dist/types/components/combobox/combobox.vue.d.ts.map +1 -1
- package/dist/types/components/combobox/combobox_empty-list.vue.d.ts +39 -6
- package/dist/types/components/combobox/combobox_empty-list.vue.d.ts.map +1 -1
- package/dist/types/components/combobox/combobox_loading-list.vue.d.ts +39 -6
- package/dist/types/components/combobox/combobox_loading-list.vue.d.ts.map +1 -1
- package/dist/types/components/dropdown/dropdown.vue.d.ts +40 -4
- package/dist/types/components/dropdown/dropdown.vue.d.ts.map +1 -1
- package/dist/types/components/filter_pill/filter_pill.vue.d.ts +2016 -0
- package/dist/types/components/filter_pill/filter_pill.vue.d.ts.map +1 -0
- package/dist/types/components/filter_pill/index.d.ts +2 -0
- package/dist/types/components/filter_pill/index.d.ts.map +1 -0
- package/dist/types/components/hovercard/hovercard.vue.d.ts +80 -8
- package/dist/types/components/hovercard/hovercard.vue.d.ts.map +1 -1
- package/dist/types/components/image_viewer/image_viewer.vue.d.ts +40 -4
- package/dist/types/components/image_viewer/image_viewer.vue.d.ts.map +1 -1
- package/dist/types/components/input/input.vue.d.ts.map +1 -1
- package/dist/types/components/item_layout/item_layout.vue.d.ts +36 -5
- package/dist/types/components/item_layout/item_layout.vue.d.ts.map +1 -1
- package/dist/types/components/link/link.vue.d.ts +9 -0
- package/dist/types/components/list_item/list_item.vue.d.ts +39 -6
- package/dist/types/components/list_item/list_item.vue.d.ts.map +1 -1
- package/dist/types/components/loader/loader.vue.d.ts +1 -32
- package/dist/types/components/loader/loader.vue.d.ts.map +1 -1
- package/dist/types/components/modal/modal.vue.d.ts +40 -4
- package/dist/types/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/types/components/mode_island/index.d.ts +3 -0
- package/dist/types/components/mode_island/index.d.ts.map +1 -0
- package/dist/types/components/mode_island/mode_island.vue.d.ts +3 -0
- package/dist/types/components/mode_island/mode_island.vue.d.ts.map +1 -0
- package/dist/types/components/mode_island/mode_island_constants.d.ts +10 -0
- package/dist/types/components/mode_island/mode_island_constants.d.ts.map +1 -0
- package/dist/types/components/mode_island/utils.d.ts +12 -0
- package/dist/types/components/mode_island/utils.d.ts.map +1 -0
- package/dist/types/components/mode_island/validators.d.ts +6 -0
- package/dist/types/components/mode_island/validators.d.ts.map +1 -0
- package/dist/types/components/notice/notice.vue.d.ts +40 -4
- package/dist/types/components/notice/notice.vue.d.ts.map +1 -1
- package/dist/types/components/notice/notice_action.vue.d.ts +40 -4
- package/dist/types/components/notice/notice_action.vue.d.ts.map +1 -1
- package/dist/types/components/pagination/pagination.vue.d.ts +20 -2
- package/dist/types/components/pagination/pagination.vue.d.ts.map +1 -1
- package/dist/types/components/popover/popover.vue.d.ts +40 -4
- package/dist/types/components/popover/popover.vue.d.ts.map +1 -1
- package/dist/types/components/popover/popover_header_footer.vue.d.ts +20 -2
- package/dist/types/components/popover/popover_header_footer.vue.d.ts.map +1 -1
- package/dist/types/components/progress_circle/index.d.ts +3 -0
- package/dist/types/components/progress_circle/index.d.ts.map +1 -0
- package/dist/types/components/progress_circle/progress_circle.vue.d.ts +70 -0
- package/dist/types/components/progress_circle/progress_circle.vue.d.ts.map +1 -0
- package/dist/types/components/progress_circle/progress_circle_constants.d.ts +23 -0
- package/dist/types/components/progress_circle/progress_circle_constants.d.ts.map +1 -0
- package/dist/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts +9 -0
- package/dist/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/mentions/MentionComponent.vue.d.ts +9 -0
- package/dist/types/components/rich_text_editor/extensions/mentions/MentionSuggestion.vue.d.ts +71 -25
- package/dist/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts +39 -6
- package/dist/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/variable/VariableComponent.vue.d.ts +61 -6
- package/dist/types/components/rich_text_editor/extensions/variable/VariableComponent.vue.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/variable/variable.d.ts.map +1 -1
- package/dist/types/components/root_layout/root_layout_constants.d.ts +2 -0
- package/dist/types/components/root_layout/root_layout_constants.d.ts.map +1 -1
- package/dist/types/components/split_button/split_button-alpha.vue.d.ts +21 -3
- package/dist/types/components/split_button/split_button-alpha.vue.d.ts.map +1 -1
- package/dist/types/components/split_button/split_button-omega.vue.d.ts +20 -2
- package/dist/types/components/split_button/split_button-omega.vue.d.ts.map +1 -1
- package/dist/types/components/split_button/split_button.vue.d.ts +214 -28
- package/dist/types/components/split_button/split_button.vue.d.ts.map +1 -1
- package/dist/types/components/tab/tab.vue.d.ts +20 -2
- package/dist/types/components/text/index.d.ts +3 -0
- package/dist/types/components/text/index.d.ts.map +1 -0
- package/dist/types/components/text/scripts/update-text-tone-tokens.d.cts +3 -0
- package/dist/types/components/text/scripts/update-text-tone-tokens.d.cts.map +1 -0
- package/dist/types/components/text/scripts/update_text_tone_tokens.d.cts +3 -0
- package/dist/types/components/text/scripts/update_text_tone_tokens.d.cts.map +1 -0
- package/dist/types/components/text/scripts/update_text_tone_tokens.d.ts +1 -0
- package/dist/types/components/text/scripts/update_text_tone_tokens.d.ts.map +1 -0
- package/dist/types/components/text/text.vue.d.ts +141 -0
- package/dist/types/components/text/text.vue.d.ts.map +1 -0
- package/dist/types/components/text/text_constants.d.ts +73 -0
- package/dist/types/components/text/text_constants.d.ts.map +1 -0
- package/dist/types/components/text/text_tone_tokens.d.ts +3 -0
- package/dist/types/components/text/text_tone_tokens.d.ts.map +1 -0
- package/dist/types/components/toast/layouts/toast_layout_alternate.vue.d.ts +40 -4
- package/dist/types/components/toast/layouts/toast_layout_alternate.vue.d.ts.map +1 -1
- package/dist/types/components/toast/layouts/toast_layout_default.vue.d.ts +40 -4
- package/dist/types/components/toast/layouts/toast_layout_default.vue.d.ts.map +1 -1
- package/dist/types/components/toast/toast.vue.d.ts +160 -16
- package/dist/types/components/toast/toast.vue.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts +20 -2
- package/dist/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts.map +1 -1
- package/dist/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +80 -8
- package/dist/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts.map +1 -1
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +80 -8
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts.map +1 -1
- package/dist/types/recipes/cards/ivr_node/ivr_node.vue.d.ts +60 -6
- package/dist/types/recipes/cards/ivr_node/ivr_node.vue.d.ts.map +1 -1
- package/dist/types/recipes/chips/grouped_chip/grouped_chip.vue.d.ts +20 -2
- package/dist/types/recipes/chips/grouped_chip/grouped_chip.vue.d.ts.map +1 -1
- package/dist/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +198 -30
- package/dist/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts +124 -12
- package/dist/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts +104 -10
- package/dist/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/editor/EditorToolbarButton.vue.d.ts +20 -2
- package/dist/types/recipes/conversation_view/editor/EditorToolbarDropdownButton.vue.d.ts +60 -6
- package/dist/types/recipes/conversation_view/editor/EditorToolbarDropdownButton.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/editor/EditorToolbarPopoverButton.vue.d.ts +60 -6
- package/dist/types/recipes/conversation_view/editor/EditorToolbarPopoverButton.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts +20 -2
- package/dist/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +56 -7
- package/dist/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/feed_item_row/feed_item_row.vue.d.ts +110 -31
- package/dist/types/recipes/conversation_view/feed_item_row/feed_item_row.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts +56 -7
- package/dist/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts +20 -2
- package/dist/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +80 -8
- package/dist/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +20 -2
- package/dist/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts.map +1 -1
- package/dist/types/recipes/header/settings_menu_button/settings_menu_button.vue.d.ts +20 -2
- package/dist/types/recipes/header/settings_menu_button/settings_menu_button.vue.d.ts.map +1 -1
- package/dist/types/recipes/item_layout/contact_info/contact_info.vue.d.ts +107 -30
- package/dist/types/recipes/item_layout/contact_info/contact_info.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/callbox/callbox.vue.d.ts +71 -25
- package/dist/types/recipes/leftbar/callbox/callbox.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts +20 -2
- package/dist/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/contact_row/contact_row.vue.d.ts +449 -28
- package/dist/types/recipes/leftbar/contact_row/contact_row.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/general_row/general_row.vue.d.ts +378 -3
- package/dist/types/recipes/leftbar/general_row/general_row.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/group_row/group_row.vue.d.ts +378 -3
- package/dist/types/recipes/leftbar/group_row/group_row.vue.d.ts.map +1 -1
- package/dist/types/recipes/notices/top_banner_info/top_banner_info.vue.d.ts.map +1 -1
- package/package.json +6 -5
- package/dist/types/recipes/conversation_view/attachment_carousel/media_components/progress_bar.vue.d.ts +0 -30
- package/dist/types/recipes/conversation_view/attachment_carousel/media_components/progress_bar.vue.d.ts.map +0 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { DT_MODE_ISLAND_TYPES as r } from "./mode-island-constants.js";
|
|
2
|
+
import { modeValidator as l } from "./validators.js";
|
|
3
|
+
import { getRootContrast as s, getOppositeMode as a, findParentMode as u, getRootMode as c } from "./utils.js";
|
|
4
|
+
import { openBlock as m, createBlock as h, resolveDynamicComponent as f, mergeProps as b, withCtx as p, renderSlot as M } from "vue";
|
|
5
|
+
import { _ as v } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
+
const O = {
|
|
7
|
+
name: "DtModeIsland",
|
|
8
|
+
compatConfig: { MODE: 3 },
|
|
9
|
+
provide() {
|
|
10
|
+
return {
|
|
11
|
+
dtModeIslandMode: () => this.computedMode
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
inject: {
|
|
15
|
+
parentModeIslandMode: {
|
|
16
|
+
from: "dtModeIslandMode",
|
|
17
|
+
default: null
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
inheritAttrs: !1,
|
|
21
|
+
props: {
|
|
22
|
+
/**
|
|
23
|
+
* Set this prop to render the mode island as a specific HTML element.
|
|
24
|
+
* @type {String}
|
|
25
|
+
* @values div, section, nav, article, aside, header, footer, main
|
|
26
|
+
*/
|
|
27
|
+
as: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "div"
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* The mode to apply to the island.
|
|
33
|
+
* - 'inverted': Opposite of parent or root mode
|
|
34
|
+
* - 'light': Always light mode
|
|
35
|
+
* - 'dark': Always dark mode
|
|
36
|
+
* @type {String}
|
|
37
|
+
* @values inverted, light, dark
|
|
38
|
+
*/
|
|
39
|
+
mode: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: r.INVERTED,
|
|
42
|
+
validator: l
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
currentContrast: s(),
|
|
48
|
+
contrastObserver: null,
|
|
49
|
+
modeObserver: null,
|
|
50
|
+
elementRef: null,
|
|
51
|
+
calculatedMode: null
|
|
52
|
+
// Store calculated mode as reactive data
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
computed: {
|
|
56
|
+
isInverted() {
|
|
57
|
+
return this.mode === r.INVERTED;
|
|
58
|
+
},
|
|
59
|
+
invertedAttribute() {
|
|
60
|
+
return this.isInverted ? "" : null;
|
|
61
|
+
},
|
|
62
|
+
computedMode() {
|
|
63
|
+
return this.mode === r.LIGHT || this.mode === r.DARK ? this.mode : this.mode === r.INVERTED && this.calculatedMode ? this.calculatedMode : this.calculateInvertedMode();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
beforeCreate() {
|
|
67
|
+
if (this.$attrs && this.$attrs["data-dt-brand"])
|
|
68
|
+
throw new Error("[DtModeIsland] The data-dt-brand attribute is not allowed on mode islands. Brand should only be set at the root level.");
|
|
69
|
+
},
|
|
70
|
+
mounted() {
|
|
71
|
+
this.elementRef = this.$el, this.setupContrastObserver(), this.isInverted && (this.calculatedMode = this.calculateInvertedMode(), this.setupModeObserver()), this.currentContrast = s();
|
|
72
|
+
},
|
|
73
|
+
beforeUnmount() {
|
|
74
|
+
this.contrastObserver && (this.contrastObserver.disconnect(), this.contrastObserver = null), this.modeObserver && (this.modeObserver.disconnect(), this.modeObserver = null);
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
calculateInvertedMode() {
|
|
78
|
+
if (this.parentModeIslandMode) {
|
|
79
|
+
const t = typeof this.parentModeIslandMode == "function" ? this.parentModeIslandMode() : this.parentModeIslandMode;
|
|
80
|
+
return a(t);
|
|
81
|
+
}
|
|
82
|
+
if (this.elementRef) {
|
|
83
|
+
const t = u(this.elementRef);
|
|
84
|
+
return a(t);
|
|
85
|
+
}
|
|
86
|
+
return a(c());
|
|
87
|
+
},
|
|
88
|
+
setupContrastObserver() {
|
|
89
|
+
this.contrastObserver = new MutationObserver((t) => {
|
|
90
|
+
for (const e of t)
|
|
91
|
+
e.type === "attributes" && e.attributeName === "data-dt-contrast" && (this.currentContrast = s());
|
|
92
|
+
}), this.contrastObserver.observe(document.documentElement, {
|
|
93
|
+
attributes: !0,
|
|
94
|
+
attributeFilter: ["data-dt-contrast"]
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
setupModeObserver() {
|
|
98
|
+
var o;
|
|
99
|
+
const t = {
|
|
100
|
+
attributes: !0,
|
|
101
|
+
attributeFilter: ["data-dt-mode"],
|
|
102
|
+
subtree: !1
|
|
103
|
+
};
|
|
104
|
+
this.modeObserver = new MutationObserver((n) => {
|
|
105
|
+
for (const d of n)
|
|
106
|
+
d.type === "attributes" && d.attributeName === "data-dt-mode" && (this.calculatedMode = this.calculateInvertedMode());
|
|
107
|
+
}), this.modeObserver.observe(document.documentElement, t);
|
|
108
|
+
let e = (o = this.elementRef) == null ? void 0 : o.parentElement;
|
|
109
|
+
for (; e; )
|
|
110
|
+
e.hasAttribute("data-dt-mode") && this.modeObserver.observe(e, t), e = e.parentElement;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
function I(t, e, o, n, d, i) {
|
|
115
|
+
return m(), h(f(o.as), b({ class: "d-mode-island" }, t.$attrs, {
|
|
116
|
+
"data-dt-mode": i.computedMode,
|
|
117
|
+
"data-mode-island-inverted": i.invertedAttribute,
|
|
118
|
+
"data-dt-contrast": d.currentContrast
|
|
119
|
+
}), {
|
|
120
|
+
default: p(() => [
|
|
121
|
+
M(t.$slots, "default")
|
|
122
|
+
]),
|
|
123
|
+
_: 3
|
|
124
|
+
}, 16, ["data-dt-mode", "data-mode-island-inverted", "data-dt-contrast"]);
|
|
125
|
+
}
|
|
126
|
+
const g = /* @__PURE__ */ v(O, [["render", I]]);
|
|
127
|
+
export {
|
|
128
|
+
g as default
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=mode-island.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-island.js","sources":["../../../components/mode_island/mode_island.vue"],"sourcesContent":["<template>\n <component\n :is=\"as\"\n class=\"d-mode-island\"\n v-bind=\"$attrs\"\n :data-dt-mode=\"computedMode\"\n :data-mode-island-inverted=\"invertedAttribute\"\n :data-dt-contrast=\"currentContrast\"\n >\n <!-- @slot Slot for main content -->\n <slot />\n </component>\n</template>\n\n<script>\nimport { DT_MODE_ISLAND_TYPES } from './mode_island_constants';\nimport { modeValidator } from './validators';\nimport {\n getOppositeMode,\n getRootMode,\n getRootContrast,\n findParentMode,\n} from './utils';\n\nexport default {\n name: 'DtModeIsland',\n compatConfig: { MODE: 3 },\n\n provide () {\n return {\n dtModeIslandMode: () => this.computedMode,\n };\n },\n\n inject: {\n parentModeIslandMode: {\n from: 'dtModeIslandMode',\n default: null,\n },\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Set this prop to render the mode island as a specific HTML element.\n * @type {String}\n * @values div, section, nav, article, aside, header, footer, main\n */\n as: {\n type: String,\n default: 'div',\n },\n\n /**\n * The mode to apply to the island.\n * - 'inverted': Opposite of parent or root mode\n * - 'light': Always light mode\n * - 'dark': Always dark mode\n * @type {String}\n * @values inverted, light, dark\n */\n mode: {\n type: String,\n default: DT_MODE_ISLAND_TYPES.INVERTED,\n validator: modeValidator,\n },\n },\n\n data () {\n return {\n currentContrast: getRootContrast(),\n contrastObserver: null,\n modeObserver: null,\n elementRef: null,\n calculatedMode: null, // Store calculated mode as reactive data\n };\n },\n\n computed: {\n isInverted () {\n return this.mode === DT_MODE_ISLAND_TYPES.INVERTED;\n },\n\n invertedAttribute () {\n return this.isInverted ? '' : null;\n },\n\n computedMode () {\n // If mode is explicitly light or dark, use it directly\n if (this.mode === DT_MODE_ISLAND_TYPES.LIGHT || this.mode === DT_MODE_ISLAND_TYPES.DARK) {\n return this.mode;\n }\n\n // If mode is inverted, use the calculated mode if available\n if (this.mode === DT_MODE_ISLAND_TYPES.INVERTED && this.calculatedMode) {\n return this.calculatedMode;\n }\n\n // Otherwise calculate it now\n return this.calculateInvertedMode();\n },\n },\n\n beforeCreate () {\n // Throw error if data-dt-brand is manually set\n if (this.$attrs && this.$attrs['data-dt-brand']) {\n throw new Error('[DtModeIsland] The data-dt-brand attribute is not allowed on mode islands. Brand should only be set at the root level.');\n }\n },\n\n mounted () {\n // Store element reference\n this.elementRef = this.$el;\n\n // Setup MutationObserver to watch for contrast changes on root\n this.setupContrastObserver();\n\n // Setup MutationObserver to watch for mode changes (only if inverted)\n if (this.isInverted) {\n // Initialize the calculated mode\n this.calculatedMode = this.calculateInvertedMode();\n this.setupModeObserver();\n }\n\n // Initial contrast value\n this.currentContrast = getRootContrast();\n },\n\n beforeUnmount () {\n // Cleanup observers\n if (this.contrastObserver) {\n this.contrastObserver.disconnect();\n this.contrastObserver = null;\n }\n if (this.modeObserver) {\n this.modeObserver.disconnect();\n this.modeObserver = null;\n }\n },\n\n methods: {\n calculateInvertedMode () {\n // First check if there's a parent mode island\n if (this.parentModeIslandMode) {\n const parentMode = typeof this.parentModeIslandMode === 'function'\n ? this.parentModeIslandMode()\n : this.parentModeIslandMode;\n return getOppositeMode(parentMode);\n }\n\n // Otherwise, find the nearest parent with data-dt-mode\n if (this.elementRef) {\n const parentMode = findParentMode(this.elementRef);\n return getOppositeMode(parentMode);\n }\n\n // Default fallback\n return getOppositeMode(getRootMode());\n },\n\n setupContrastObserver () {\n this.contrastObserver = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'attributes' && mutation.attributeName === 'data-dt-contrast') {\n this.currentContrast = getRootContrast();\n }\n }\n });\n\n this.contrastObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-dt-contrast'],\n });\n },\n\n setupModeObserver () {\n const config = {\n attributes: true,\n attributeFilter: ['data-dt-mode'],\n subtree: false,\n };\n\n this.modeObserver = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'attributes' && mutation.attributeName === 'data-dt-mode') {\n // Recalculate and update the reactive data property\n this.calculatedMode = this.calculateInvertedMode();\n }\n }\n });\n\n // Observe root element\n this.modeObserver.observe(document.documentElement, config);\n\n // Also observe all parent elements with data-dt-mode\n let parent = this.elementRef?.parentElement;\n while (parent) {\n if (parent.hasAttribute('data-dt-mode')) {\n this.modeObserver.observe(parent, config);\n }\n parent = parent.parentElement;\n }\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DT_MODE_ISLAND_TYPES","modeValidator","getRootContrast","parentMode","getOppositeMode","findParentMode","getRootMode","mutationsList","mutation","config","parent","_a","_createBlock","_resolveDynamicComponent","$props","_mergeProps","_ctx","$options","$data","_renderSlot"],"mappings":";;;;;AAwBA,MAAKA,IAAU;AAAA,EACb,MAAM;AAAA,EACN,cAAc,EAAE,MAAM;EAEtB,UAAW;AACT,WAAO;AAAA,MACL,kBAAkB,MAAM,KAAK;AAAA;EAEjC;AAAA,EAEA,QAAQ;AAAA,IACN,sBAAsB;AAAA,MACpB,MAAM;AAAA,MACN,SAAS;AAAA;;EAIb,cAAc;AAAA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
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function n(t){return t==="light"?"dark":"light"}function o(){return document.documentElement.getAttribute("data-dt-mode")||"light"}function r(){return document.documentElement.getAttribute("data-dt-contrast")||"default"}function d(t){let e=t==null?void 0:t.parentElement;for(;e&&e!==document.documentElement;){if(e.hasAttribute("data-dt-mode"))return e.getAttribute("data-dt-mode");e=e.parentElement}return o()}const u={getOppositeMode:n,getRootMode:o,getRootContrast:r,findParentMode:d};exports.default=u;exports.findParentMode=d;exports.getOppositeMode=n;exports.getRootContrast=r;exports.getRootMode=o;
|
|
2
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../components/mode_island/utils.js"],"sourcesContent":["/**\n * Get the opposite mode (light <-> dark)\n * @param {string} currentMode - The current mode\n * @returns {string} The opposite mode\n */\nexport function getOppositeMode (currentMode) {\n return currentMode === 'light' ? 'dark' : 'light';\n}\n\n/**\n * Get the mode from the root HTML element\n * @returns {string} The root mode or 'light' as default\n */\nexport function getRootMode () {\n const rootMode = document.documentElement.getAttribute('data-dt-mode');\n return rootMode || 'light';\n}\n\n/**\n * Get the contrast from the root HTML element\n * @returns {string} The root contrast or 'default' as default\n */\nexport function getRootContrast () {\n const rootContrast = document.documentElement.getAttribute('data-dt-contrast');\n return rootContrast || 'default';\n}\n\n/**\n * Find the mode from the nearest parent element with data-dt-mode attribute\n * @param {HTMLElement} el - The starting element\n * @returns {string} The parent mode or root mode\n */\nexport function findParentMode (el) {\n let parent = el?.parentElement;\n while (parent && parent !== document.documentElement) {\n if (parent.hasAttribute('data-dt-mode')) {\n return parent.getAttribute('data-dt-mode');\n }\n parent = parent.parentElement;\n }\n return getRootMode();\n}\n\nexport default {\n getOppositeMode,\n getRootMode,\n getRootContrast,\n findParentMode,\n};"],"names":["getOppositeMode","currentMode","getRootMode","getRootContrast","findParentMode","el","parent","utils"],"mappings":"4GAKO,SAASA,EAAiBC,EAAa,CAC5C,OAAOA,IAAgB,QAAU,OAAS,OAC5C,CAMO,SAASC,GAAe,CAE7B,OADiB,SAAS,gBAAgB,aAAa,cAAc,GAClD,OACrB,CAMO,SAASC,GAAmB,CAEjC,OADqB,SAAS,gBAAgB,aAAa,kBAAkB,GACtD,SACzB,CAOO,SAASC,EAAgBC,EAAI,CAClC,IAAIC,EAASD,GAAA,YAAAA,EAAI,cACjB,KAAOC,GAAUA,IAAW,SAAS,iBAAiB,CACpD,GAAIA,EAAO,aAAa,cAAc,EACpC,OAAOA,EAAO,aAAa,cAAc,EAE3CA,EAASA,EAAO,aAClB,CACA,OAAOJ,EAAW,CACpB,CAEA,MAAAK,EAAe,CACb,gBAAAP,EACA,YAAAE,EACA,gBAAAC,EACA,eAAAC,CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function n(t) {
|
|
2
|
+
return t === "light" ? "dark" : "light";
|
|
3
|
+
}
|
|
4
|
+
function o() {
|
|
5
|
+
return document.documentElement.getAttribute("data-dt-mode") || "light";
|
|
6
|
+
}
|
|
7
|
+
function r() {
|
|
8
|
+
return document.documentElement.getAttribute("data-dt-contrast") || "default";
|
|
9
|
+
}
|
|
10
|
+
function d(t) {
|
|
11
|
+
let e = t == null ? void 0 : t.parentElement;
|
|
12
|
+
for (; e && e !== document.documentElement; ) {
|
|
13
|
+
if (e.hasAttribute("data-dt-mode"))
|
|
14
|
+
return e.getAttribute("data-dt-mode");
|
|
15
|
+
e = e.parentElement;
|
|
16
|
+
}
|
|
17
|
+
return o();
|
|
18
|
+
}
|
|
19
|
+
const u = {
|
|
20
|
+
getOppositeMode: n,
|
|
21
|
+
getRootMode: o,
|
|
22
|
+
getRootContrast: r,
|
|
23
|
+
findParentMode: d
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
u as default,
|
|
27
|
+
d as findParentMode,
|
|
28
|
+
n as getOppositeMode,
|
|
29
|
+
r as getRootContrast,
|
|
30
|
+
o as getRootMode
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../components/mode_island/utils.js"],"sourcesContent":["/**\n * Get the opposite mode (light <-> dark)\n * @param {string} currentMode - The current mode\n * @returns {string} The opposite mode\n */\nexport function getOppositeMode (currentMode) {\n return currentMode === 'light' ? 'dark' : 'light';\n}\n\n/**\n * Get the mode from the root HTML element\n * @returns {string} The root mode or 'light' as default\n */\nexport function getRootMode () {\n const rootMode = document.documentElement.getAttribute('data-dt-mode');\n return rootMode || 'light';\n}\n\n/**\n * Get the contrast from the root HTML element\n * @returns {string} The root contrast or 'default' as default\n */\nexport function getRootContrast () {\n const rootContrast = document.documentElement.getAttribute('data-dt-contrast');\n return rootContrast || 'default';\n}\n\n/**\n * Find the mode from the nearest parent element with data-dt-mode attribute\n * @param {HTMLElement} el - The starting element\n * @returns {string} The parent mode or root mode\n */\nexport function findParentMode (el) {\n let parent = el?.parentElement;\n while (parent && parent !== document.documentElement) {\n if (parent.hasAttribute('data-dt-mode')) {\n return parent.getAttribute('data-dt-mode');\n }\n parent = parent.parentElement;\n }\n return getRootMode();\n}\n\nexport default {\n getOppositeMode,\n getRootMode,\n getRootContrast,\n findParentMode,\n};"],"names":["getOppositeMode","currentMode","getRootMode","getRootContrast","findParentMode","el","parent","utils"],"mappings":"AAKO,SAASA,EAAiBC,GAAa;AAC5C,SAAOA,MAAgB,UAAU,SAAS;AAC5C;AAMO,SAASC,IAAe;AAE7B,SADiB,SAAS,gBAAgB,aAAa,cAAc,KAClD;AACrB;AAMO,SAASC,IAAmB;AAEjC,SADqB,SAAS,gBAAgB,aAAa,kBAAkB,KACtD;AACzB;AAOO,SAASC,EAAgBC,GAAI;AAClC,MAAIC,IAASD,KAAA,gBAAAA,EAAI;AACjB,SAAOC,KAAUA,MAAW,SAAS,mBAAiB;AACpD,QAAIA,EAAO,aAAa,cAAc;AACpC,aAAOA,EAAO,aAAa,cAAc;AAE3C,IAAAA,IAASA,EAAO;AAAA,EAClB;AACA,SAAOJ,EAAW;AACpB;AAEA,MAAAK,IAAe;AAAA,EACb,iBAAAP;AAAA,EACA,aAAAE;AAAA,EACA,iBAAAC;AAAA,EACA,gBAAAC;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./mode-island-constants.cjs");function e(t){return Object.values(o.DT_MODE_ISLAND_TYPES).includes(t)}const a={modeValidator:e};exports.default=a;exports.modeValidator=e;
|
|
2
|
+
//# sourceMappingURL=validators.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.cjs","sources":["../../../components/mode_island/validators.js"],"sourcesContent":["import { DT_MODE_ISLAND_TYPES } from './mode_island_constants';\n\nexport function modeValidator (mode) {\n return Object.values(DT_MODE_ISLAND_TYPES).includes(mode);\n}\n\nexport default {\n modeValidator,\n};"],"names":["modeValidator","mode","DT_MODE_ISLAND_TYPES","validators"],"mappings":"2JAEO,SAASA,EAAeC,EAAM,CACnC,OAAO,OAAO,OAAOC,EAAAA,oBAAoB,EAAE,SAASD,CAAI,CAC1D,CAEA,MAAAE,EAAe,CACb,cAAAH,CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DT_MODE_ISLAND_TYPES as o } from "./mode-island-constants.js";
|
|
2
|
+
function a(t) {
|
|
3
|
+
return Object.values(o).includes(t);
|
|
4
|
+
}
|
|
5
|
+
const r = {
|
|
6
|
+
modeValidator: a
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
r as default,
|
|
10
|
+
a as modeValidator
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sources":["../../../components/mode_island/validators.js"],"sourcesContent":["import { DT_MODE_ISLAND_TYPES } from './mode_island_constants';\n\nexport function modeValidator (mode) {\n return Object.values(DT_MODE_ISLAND_TYPES).includes(mode);\n}\n\nexport default {\n modeValidator,\n};"],"names":["modeValidator","mode","DT_MODE_ISLAND_TYPES","validators"],"mappings":";AAEO,SAASA,EAAeC,GAAM;AACnC,SAAO,OAAO,OAAOC,CAAoB,EAAE,SAASD,CAAI;AAC1D;AAEA,MAAAE,IAAe;AAAA,EACb,eAAAH;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@dialpad/dialtone-icons/vue3"),_=require("../../localization/index.cjs"),e=require("vue"),P=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@dialpad/dialtone-icons/vue3"),_=require("../../localization/index.cjs"),e=require("vue"),P=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),m=require("../button/button.cjs"),b={compatConfig:{MODE:3},name:"DtPagination",components:{DtButton:m.default,DtIconChevronLeft:u.DtIconChevronLeft,DtIconChevronRight:u.DtIconChevronRight,DtIconMoreHorizontal:u.DtIconMoreHorizontal},props:{ariaLabel:{type:String,required:!0},totalPages:{type:Number,required:!0},activePage:{type:Number,default:1},maxVisible:{type:Number,default:5},hideEdges:{type:Boolean,default:!1}},emits:["change"],data(){return{currentPage:this.activePage,i18n:new _.DialtoneLocalization}},computed:{isFirstPage(){return this.currentPage===1},isLastPage(){return this.currentPage===this.totalPages},pages(){if(this.maxVisible===0)return[];if(this.totalPages<=this.maxVisible)return this.range(1,this.totalPages);let t=this.maxVisible-1,i=this.totalPages-t+1;if(this.hideEdges&&(t=t+1,i=i-1),this.currentPage<t){const r=[...this.range(1,t),"..."];return this.hideEdges||r.push(this.totalPages),r}if(this.currentPage>i){const r=["...",...this.range(i,this.totalPages)];return this.hideEdges||r.unshift(1),r}const o=this.maxVisible-(3-this.maxVisible%2),l=Math.floor(o/2);let s=this.currentPage-l,a=this.currentPage+l;this.hideEdges&&(s=s-1,a=a+1);const c=["...",...this.range(s,a),"..."];return this.hideEdges?c:[1,...c,this.totalPages]},prevAriaLabel(){return this.isFirstPage?this.i18n.$t("DIALTONE_PAGINATION_FIRST_PAGE"):this.i18n.$t("DIALTONE_PAGINATION_PREVIOUS_PAGE")},nextAriaLabel(){return this.isLastPage?this.i18n.$t("DIALTONE_PAGINATION_LAST_PAGE"):this.i18n.$t("DIALTONE_PAGINATION_NEXT_PAGE")},pageNumberAriaLabel(){return t=>t===this.totalPages?`${this.i18n.$t("DIALTONE_PAGINATION_LAST_PAGE")} ${t}`:`${this.i18n.$t("DIALTONE_PAGINATION_PAGE_NUMBER",{page:t})}`}},watch:{activePage(){this.currentPage=this.activePage},totalPages(t){(this.currentPage>t||this.currentPage<=0)&&(this.currentPage=t)}},methods:{range(t,i){const o=[];t=t>0?t:1;for(let l=t;l<=i;l++)o.push(l);return o},changePage(t){this.currentPage=t,this.$emit("change",this.currentPage)}}},p=["aria-label"],N={key:0,class:"d-pagination__separator-icon","data-qa":"dt-pagination-separator"};function A(t,i,o,l,s,a){const c=e.resolveComponent("dt-icon-chevron-left"),r=e.resolveComponent("dt-button"),g=e.resolveComponent("dt-icon-more-horizontal"),h=e.resolveComponent("dt-icon-chevron-right");return e.withDirectives((e.openBlock(),e.createElementBlock("nav",{"aria-label":o.ariaLabel,class:"d-pagination"},[e.createVNode(r,{class:"d-pagination__button","data-qa":"dt-pagination-prev","aria-label":a.prevAriaLabel,kind:"muted",importance:"clear",disabled:a.isFirstPage,onClick:i[0]||(i[0]=n=>a.changePage(s.currentPage-1))},{icon:e.withCtx(()=>[e.createVNode(c,{size:"300"})]),_:1},8,["aria-label","disabled"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.pages,(n,d)=>(e.openBlock(),e.createElementBlock("div",{key:`page-${n}-${d}`,class:e.normalizeClass({"d-pagination__separator":isNaN(Number(n))})},[isNaN(Number(n))?(e.openBlock(),e.createElementBlock("div",N,[e.createVNode(g,{size:"300"})])):(e.openBlock(),e.createBlock(r,{key:1,class:"d-pagination__item","aria-label":a.pageNumberAriaLabel(n),kind:s.currentPage===n?"default":"muted",importance:s.currentPage===n?"primary":"clear","label-class":"d-pagination__item-label",onClick:f=>a.changePage(n)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n),1)]),_:2},1032,["aria-label","kind","importance","onClick"]))],2))),128)),e.createVNode(r,{class:"d-pagination__button","data-qa":"dt-pagination-next","aria-label":a.nextAriaLabel,disabled:a.isLastPage,kind:"muted",importance:"clear",onClick:i[1]||(i[1]=n=>a.changePage(s.currentPage+1))},{icon:e.withCtx(()=>[e.createVNode(h,{size:"300"})]),_:1},8,["aria-label","disabled"])],8,p)),[[e.vShow,o.totalPages>0]])}const v=P._(b,[["render",A]]);exports.default=v;
|
|
2
2
|
//# sourceMappingURL=pagination.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.cjs","sources":["../../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n v-show=\"totalPages > 0\"\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n kind=\"muted\"\n importance=\"clear\"\n :disabled=\"isFirstPage\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon-chevron-left\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon-more-horizontal\n size=\"300\"\n />\n <!-- … -->\n </div>\n <dt-button\n v-else\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n importance=\"clear\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon-chevron-right\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIconChevronLeft, DtIconChevronRight, DtIconMoreHorizontal } from '@dialpad/dialtone-icons/vue3';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIconChevronLeft,\n DtIconChevronRight,\n DtIconMoreHorizontal,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n\n /**\n * Sometimes you may need to hide start and end page number buttons when moving in between.\n * This prop will be used to hide the first and last page buttons when not near the edges.\n * This is useful when your backend does not support offset and you can only use cursor based pagination.\n */\n hideEdges: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n // eslint-disable-next-line complexity\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n let start = this.maxVisible - 1;\n let end = this.totalPages - start + 1;\n\n // if hideEdges is true, modify the start and\n // end to account for the hidden pages\n if (this.hideEdges) {\n start = start + 1;\n end = end - 1;\n }\n\n if (this.currentPage < start) {\n const pages = [...this.range(1, start), '...'];\n if (!this.hideEdges) {\n // add last page to the end\n pages.push(this.totalPages);\n }\n return pages;\n }\n\n if (this.currentPage > end) {\n const pages = ['...', ...this.range(end, this.totalPages)];\n if (!this.hideEdges) {\n // add first page to the beginning\n pages.unshift(1);\n }\n return pages;\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n let left = this.currentPage - centerIndex;\n let right = this.currentPage + centerIndex;\n\n // if hideEdge is true, modify the left and right to account for the hidden pages\n if (this.hideEdges) {\n left = left - 1;\n right = right + 1;\n }\n\n const pages = ['...', ...this.range(left, right), '...'];\n if (!this.hideEdges) {\n return [1, ...pages, this.totalPages];\n }\n return pages;\n },\n\n prevAriaLabel () {\n return this.isFirstPage ? this.i18n.$t('DIALTONE_PAGINATION_FIRST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_PREVIOUS_PAGE');\n },\n\n nextAriaLabel () {\n return this.isLastPage ? this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_NEXT_PAGE');\n },\n\n pageNumberAriaLabel () {\n return (page) => {\n return page === this.totalPages ? `${this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE')} ${page}` : `${this.i18n.$t('DIALTONE_PAGINATION_PAGE_NUMBER', { page })}`;\n };\n },\n },\n\n watch: {\n activePage () {\n this.currentPage = this.activePage;\n },\n\n totalPages (pages) {\n if (this.currentPage > pages || this.currentPage <= 0){\n this.currentPage = pages;\n }\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIconChevronLeft","DtIconChevronRight","DtIconMoreHorizontal","DialtoneLocalization","start","end","pages","total","centerIndex","left","right","page","from","to","range","i","_createElementBlock","$props","_createVNode","_component_dt_button","$options","_cache","$event","$data","_component_dt_icon_chevron_left","_openBlock","_Fragment","_renderList","index","_normalizeClass","_hoisted_2","_component_dt_icon_more_horizontal","_createBlock","_component_dt_icon_chevron_right"],"mappings":"mTA2EKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,eAEN,WAAY,CACV,SAAAC,EAAAA,QACA,kBAAAC,EAAAA,kBACA,mBAAAC,EAAAA,mBACA,qBAAAC,EAAAA,sBAGF,MAAO,CAIL,UAAW,CACT,KAAM,OACN,SAAU,IAMZ,WAAY,CACV,KAAM,OACN,SAAU,IAMZ,WAAY,CACV,KAAM,OACN,QAAS,GAQX,WAAY,CACV,KAAM,OACN,QAAS,GAQX,UAAW,CACT,KAAM,QACN,QAAS,KAIb,MAAO,CAOL,UAGF,MAAQ,CACN,MAAO,CACL,YAAa,KAAK,WAClB,KAAM,IAAIC,EAAAA,qBAEd,EAEA,SAAU,CACR,aAAe,CACb,OAAO,KAAK,cAAgB,CAC9B,EAEA,YAAc,CACZ,OAAO,KAAK,cAAgB,KAAK,UACnC,EAGA,OAAS,CACP,GAAI,KAAK,aAAe,EACtB,MAAO,CAAA,EAET,GA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BAAoBT,CAAI,EACpC,KAAMY,EAAA,cAAgBZ,EAAI,UAAA,QAC1B,WAAYY,EAAA,cAAgBZ,EAAI,UAAA,QACjC,cAAY,GACX,QAAKW,GAAEF,EAAA,WAAWT,CAAI,sBAEvB,IAAU,qCAAPA,CAAI,EAAA,CAAA,yEAGXO,EAAAA,YAcYC,EAAA,CAbV,MAAM,uBACN,UAAQ,qBACP,aAAYC,EAAA,cACZ,SAAUA,EAAA,WACX,KAAK,QACL,WAAW,QACV,QAAKC,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAC,GAAEF,EAAA,WAAWG,EAAA,YAAW,CAAA,KAEnB,eACT,IAEE,CAFFL,EAAAA,YAEEe,EAAA,CADA,KAAK,KAAK,CAAA,uDAzDRhB,EAAA,WAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"pagination.cjs","sources":["../../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n v-show=\"totalPages > 0\"\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n kind=\"muted\"\n importance=\"clear\"\n :disabled=\"isFirstPage\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon-chevron-left\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon-more-horizontal\n size=\"300\"\n />\n <!-- … -->\n </div>\n <dt-button\n v-else\n class=\"d-pagination__item\"\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"d-pagination__item-label\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n importance=\"clear\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon-chevron-right\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIconChevronLeft, DtIconChevronRight, DtIconMoreHorizontal } from '@dialpad/dialtone-icons/vue3';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIconChevronLeft,\n DtIconChevronRight,\n DtIconMoreHorizontal,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n\n /**\n * Sometimes you may need to hide start and end page number buttons when moving in between.\n * This prop will be used to hide the first and last page buttons when not near the edges.\n * This is useful when your backend does not support offset and you can only use cursor based pagination.\n */\n hideEdges: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n // eslint-disable-next-line complexity\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n let start = this.maxVisible - 1;\n let end = this.totalPages - start + 1;\n\n // if hideEdges is true, modify the start and\n // end to account for the hidden pages\n if (this.hideEdges) {\n start = start + 1;\n end = end - 1;\n }\n\n if (this.currentPage < start) {\n const pages = [...this.range(1, start), '...'];\n if (!this.hideEdges) {\n // add last page to the end\n pages.push(this.totalPages);\n }\n return pages;\n }\n\n if (this.currentPage > end) {\n const pages = ['...', ...this.range(end, this.totalPages)];\n if (!this.hideEdges) {\n // add first page to the beginning\n pages.unshift(1);\n }\n return pages;\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n let left = this.currentPage - centerIndex;\n let right = this.currentPage + centerIndex;\n\n // if hideEdge is true, modify the left and right to account for the hidden pages\n if (this.hideEdges) {\n left = left - 1;\n right = right + 1;\n }\n\n const pages = ['...', ...this.range(left, right), '...'];\n if (!this.hideEdges) {\n return [1, ...pages, this.totalPages];\n }\n return pages;\n },\n\n prevAriaLabel () {\n return this.isFirstPage ? this.i18n.$t('DIALTONE_PAGINATION_FIRST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_PREVIOUS_PAGE');\n },\n\n nextAriaLabel () {\n return this.isLastPage ? this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_NEXT_PAGE');\n },\n\n pageNumberAriaLabel () {\n return (page) => {\n return page === this.totalPages ? `${this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE')} ${page}` : `${this.i18n.$t('DIALTONE_PAGINATION_PAGE_NUMBER', { page })}`;\n };\n },\n },\n\n watch: {\n activePage () {\n this.currentPage = this.activePage;\n },\n\n totalPages (pages) {\n if (this.currentPage > pages || this.currentPage <= 0){\n this.currentPage = pages;\n }\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIconChevronLeft","DtIconChevronRight","DtIconMoreHorizontal","DialtoneLocalization","start","end","pages","total","centerIndex","left","right","page","from","to","range","i","_createElementBlock","$props","_createVNode","_component_dt_button","$options","_cache","$event","$data","_component_dt_icon_chevron_left","_openBlock","_Fragment","_renderList","index","_normalizeClass","_hoisted_2","_component_dt_icon_more_horizontal","_createBlock","_component_dt_icon_chevron_right"],"mappings":"mTA4EKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,eAEN,WAAY,CACV,SAAAC,EAAAA,QACA,kBAAAC,EAAAA,kBACA,mBAAAC,EAAAA,mBACA,qBAAAC,EAAAA,sBAGF,MAAO,CAIL,UAAW,CACT,KAAM,OACN,SAAU,IAMZ,WAAY,CACV,KAAM,OACN,SAAU,IAMZ,WAAY,CACV,KAAM,OACN,QAAS,GAQX,WAAY,CACV,KAAM,OACN,QAAS,GAQX,UAAW,CACT,KAAM,QACN,QAAS,KAIb,MAAO,CAOL,UAGF,MAAQ,CACN,MAAO,CACL,YAAa,KAAK,WAClB,KAAM,IAAIC,EAAAA,qBAEd,EAEA,SAAU,CACR,aAAe,CACb,OAAO,KAAK,cAAgB,CAC9B,EAEA,YAAc,CACZ,OAAO,KAAK,cAAgB,KAAK,UACnC,EAGA,OAAS,CACP,GAAI,KAAK,aAAe,EACtB,MAAO,CAAA,EAET,GAAI,KAAK,YAAc,KAAK,WAC1B,OAAO,KAAK,MAAM,EAAG,KAAK,UAAU,EAGtC,IAAIC,EAAQ,KAAK,WAAa,EAC1BC,EAAM,KAAK,WAAaD,EAAQ,EASpC,GALI,KAAK,YACPA,EAAQA,EAAQ,EA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,qCAAPA,CAAI,EAAA,CAAA,yEAGXO,EAAAA,YAcYC,EAAA,CAbV,MAAM,uBACN,UAAQ,qBACP,aAAYC,EAAA,cACZ,SAAUA,EAAA,WACX,KAAK,QACL,WAAW,QACV,QAAKC,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAC,GAAEF,EAAA,WAAWG,EAAA,YAAW,CAAA,KAEnB,eACT,IAEE,CAFFL,EAAAA,YAEEe,EAAA,CADA,KAAK,KAAK,CAAA,uDA1DRhB,EAAA,WAAU,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DtIconMoreHorizontal as b, DtIconChevronRight as p, DtIconChevronLeft as N } from "@dialpad/dialtone-icons/vue3";
|
|
2
2
|
import { DialtoneLocalization as A } from "../../localization/index.js";
|
|
3
|
-
import { resolveComponent as
|
|
3
|
+
import { resolveComponent as h, withDirectives as f, openBlock as l, createElementBlock as d, createVNode as c, withCtx as u, Fragment as I, renderList as E, normalizeClass as v, createBlock as L, createTextVNode as T, toDisplayString as x, vShow as D } from "vue";
|
|
4
4
|
import { _ as k } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
5
|
import O from "../button/button.js";
|
|
6
6
|
const G = {
|
|
@@ -93,8 +93,8 @@ const G = {
|
|
|
93
93
|
const s = this.maxVisible - (3 - this.maxVisible % 2), o = Math.floor(s / 2);
|
|
94
94
|
let n = this.currentPage - o, e = this.currentPage + o;
|
|
95
95
|
this.hideEdges && (n = n - 1, e = e + 1);
|
|
96
|
-
const
|
|
97
|
-
return this.hideEdges ?
|
|
96
|
+
const g = ["...", ...this.range(n, e), "..."];
|
|
97
|
+
return this.hideEdges ? g : [1, ...g, this.totalPages];
|
|
98
98
|
},
|
|
99
99
|
prevAriaLabel() {
|
|
100
100
|
return this.isFirstPage ? this.i18n.$t("DIALTONE_PAGINATION_FIRST_PAGE") : this.i18n.$t("DIALTONE_PAGINATION_PREVIOUS_PAGE");
|
|
@@ -132,8 +132,8 @@ const G = {
|
|
|
132
132
|
"data-qa": "dt-pagination-separator"
|
|
133
133
|
};
|
|
134
134
|
function V(t, a, s, o, n, e) {
|
|
135
|
-
const
|
|
136
|
-
return f((l(),
|
|
135
|
+
const g = h("dt-icon-chevron-left"), r = h("dt-button"), _ = h("dt-icon-more-horizontal"), P = h("dt-icon-chevron-right");
|
|
136
|
+
return f((l(), d("nav", {
|
|
137
137
|
"aria-label": s.ariaLabel,
|
|
138
138
|
class: "d-pagination"
|
|
139
139
|
}, [
|
|
@@ -146,26 +146,27 @@ function V(t, a, s, o, n, e) {
|
|
|
146
146
|
disabled: e.isFirstPage,
|
|
147
147
|
onClick: a[0] || (a[0] = (i) => e.changePage(n.currentPage - 1))
|
|
148
148
|
}, {
|
|
149
|
-
icon:
|
|
150
|
-
c(
|
|
149
|
+
icon: u(() => [
|
|
150
|
+
c(g, { size: "300" })
|
|
151
151
|
]),
|
|
152
152
|
_: 1
|
|
153
153
|
}, 8, ["aria-label", "disabled"]),
|
|
154
|
-
(l(!0),
|
|
154
|
+
(l(!0), d(I, null, E(e.pages, (i, m) => (l(), d("div", {
|
|
155
155
|
key: `page-${i}-${m}`,
|
|
156
156
|
class: v({ "d-pagination__separator": isNaN(Number(i)) })
|
|
157
157
|
}, [
|
|
158
|
-
isNaN(Number(i)) ? (l(),
|
|
159
|
-
c(
|
|
158
|
+
isNaN(Number(i)) ? (l(), d("div", C, [
|
|
159
|
+
c(_, { size: "300" })
|
|
160
160
|
])) : (l(), L(r, {
|
|
161
161
|
key: 1,
|
|
162
|
+
class: "d-pagination__item",
|
|
162
163
|
"aria-label": e.pageNumberAriaLabel(i),
|
|
163
164
|
kind: n.currentPage === i ? "default" : "muted",
|
|
164
165
|
importance: n.currentPage === i ? "primary" : "clear",
|
|
165
|
-
"label-class": "",
|
|
166
|
+
"label-class": "d-pagination__item-label",
|
|
166
167
|
onClick: (z) => e.changePage(i)
|
|
167
168
|
}, {
|
|
168
|
-
default:
|
|
169
|
+
default: u(() => [
|
|
169
170
|
T(x(i), 1)
|
|
170
171
|
]),
|
|
171
172
|
_: 2
|
|
@@ -180,8 +181,8 @@ function V(t, a, s, o, n, e) {
|
|
|
180
181
|
importance: "clear",
|
|
181
182
|
onClick: a[1] || (a[1] = (i) => e.changePage(n.currentPage + 1))
|
|
182
183
|
}, {
|
|
183
|
-
icon:
|
|
184
|
-
c(
|
|
184
|
+
icon: u(() => [
|
|
185
|
+
c(P, { size: "300" })
|
|
185
186
|
]),
|
|
186
187
|
_: 1
|
|
187
188
|
}, 8, ["aria-label", "disabled"])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sources":["../../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n v-show=\"totalPages > 0\"\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n kind=\"muted\"\n importance=\"clear\"\n :disabled=\"isFirstPage\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon-chevron-left\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon-more-horizontal\n size=\"300\"\n />\n <!-- … -->\n </div>\n <dt-button\n v-else\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n importance=\"clear\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon-chevron-right\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIconChevronLeft, DtIconChevronRight, DtIconMoreHorizontal } from '@dialpad/dialtone-icons/vue3';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIconChevronLeft,\n DtIconChevronRight,\n DtIconMoreHorizontal,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n\n /**\n * Sometimes you may need to hide start and end page number buttons when moving in between.\n * This prop will be used to hide the first and last page buttons when not near the edges.\n * This is useful when your backend does not support offset and you can only use cursor based pagination.\n */\n hideEdges: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n // eslint-disable-next-line complexity\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n let start = this.maxVisible - 1;\n let end = this.totalPages - start + 1;\n\n // if hideEdges is true, modify the start and\n // end to account for the hidden pages\n if (this.hideEdges) {\n start = start + 1;\n end = end - 1;\n }\n\n if (this.currentPage < start) {\n const pages = [...this.range(1, start), '...'];\n if (!this.hideEdges) {\n // add last page to the end\n pages.push(this.totalPages);\n }\n return pages;\n }\n\n if (this.currentPage > end) {\n const pages = ['...', ...this.range(end, this.totalPages)];\n if (!this.hideEdges) {\n // add first page to the beginning\n pages.unshift(1);\n }\n return pages;\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n let left = this.currentPage - centerIndex;\n let right = this.currentPage + centerIndex;\n\n // if hideEdge is true, modify the left and right to account for the hidden pages\n if (this.hideEdges) {\n left = left - 1;\n right = right + 1;\n }\n\n const pages = ['...', ...this.range(left, right), '...'];\n if (!this.hideEdges) {\n return [1, ...pages, this.totalPages];\n }\n return pages;\n },\n\n prevAriaLabel () {\n return this.isFirstPage ? this.i18n.$t('DIALTONE_PAGINATION_FIRST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_PREVIOUS_PAGE');\n },\n\n nextAriaLabel () {\n return this.isLastPage ? this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_NEXT_PAGE');\n },\n\n pageNumberAriaLabel () {\n return (page) => {\n return page === this.totalPages ? `${this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE')} ${page}` : `${this.i18n.$t('DIALTONE_PAGINATION_PAGE_NUMBER', { page })}`;\n };\n },\n },\n\n watch: {\n activePage () {\n this.currentPage = this.activePage;\n },\n\n totalPages (pages) {\n if (this.currentPage > pages || this.currentPage <= 0){\n this.currentPage = pages;\n }\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIconChevronLeft","DtIconChevronRight","DtIconMoreHorizontal","DialtoneLocalization","start","end","pages","total","centerIndex","left","right","page","from","to","range","i","_createElementBlock","$props","_createVNode","_component_dt_button","$options","_cache","$event","$data","_component_dt_icon_chevron_left","_openBlock","_Fragment","_renderList","index","_normalizeClass","_hoisted_2","_component_dt_icon_more_horizontal","_createBlock","_component_dt_icon_chevron_right"],"mappings":";;;;;AA2EA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,sBAAAC;AAAA;EAGF,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,UAAU;AAAA;;;;IAMZ,YAAY;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA;;;;IAMZ,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA;;EAIb,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOL;AAAA;EAGF,OAAQ;AACN,WAAO;AAAA,MACL,aAAa,KAAK;AAAA,MAClB,MAAM,IAAIC,EAAoB;AAAA;EAElC;AAAA,EAEA,UAAU;AAAA,IACR,cAAe;AACb,aAAO,KAAK,gBAAgB;AAAA,IAC9B;AAAA,IAEA,aAAc;AACZ,aAAO,KAAK,gBAAgB,KAAK;AAAA,IACnC;AAAA;AAAA,IAGA,QAAS;AACP,UAAI,KAAK,eAAe;AACtB,eAAO,CAAA;AAET,UAAI,KAAK,cAAc,KAAK;AAC1B,eAAO,KAAK,MAAM,GAAG,KAAK,UAAU;AAGtC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,OATNc,GASM;AAAA,QAJJZ,EAEEa,GAAA,EADA,MAAK,MAAK,CAAA;AAAA,kBAIdC,EASYb,GAAA;AAAA;QAPT,cAAYC,EAAA,oBAAoBT,CAAI;AAAA,QACpC,MAAMY,EAAA,gBAAgBZ,IAAI,YAAA;AAAA,QAC1B,YAAYY,EAAA,gBAAgBZ,IAAI,YAAA;AAAA,QACjC,eAAY;AAAA,QACX,SAAK,CAAAW,MAAEF,EAAA,WAAWT,CAAI;AAAA;mBAEvB,MAAU;AAAA,cAAPA,CAAI,GAAA,CAAA;AAAA;;;;IAGXO,EAcYC,GAAA;AAAA,MAbV,OAAM;AAAA,MACN,WAAQ;AAAA,MACP,cAAYC,EAAA;AAAA,MACZ,UAAUA,EAAA;AAAA,MACX,MAAK;AAAA,MACL,YAAW;AAAA,MACV,SAAKC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEF,EAAA,WAAWG,EAAA,cAAW,CAAA;AAAA;MAEnB,QACT,MAEE;AAAA,QAFFL,EAEEe,GAAA,EADA,MAAK,MAAK,CAAA;AAAA;;;;QAzDRhB,EAAA,aAAU,CAAA;AAAA;;;"}
|
|
1
|
+
{"version":3,"file":"pagination.js","sources":["../../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n v-show=\"totalPages > 0\"\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n kind=\"muted\"\n importance=\"clear\"\n :disabled=\"isFirstPage\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon-chevron-left\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon-more-horizontal\n size=\"300\"\n />\n <!-- … -->\n </div>\n <dt-button\n v-else\n class=\"d-pagination__item\"\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"d-pagination__item-label\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n importance=\"clear\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon-chevron-right\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIconChevronLeft, DtIconChevronRight, DtIconMoreHorizontal } from '@dialpad/dialtone-icons/vue3';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIconChevronLeft,\n DtIconChevronRight,\n DtIconMoreHorizontal,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n\n /**\n * Sometimes you may need to hide start and end page number buttons when moving in between.\n * This prop will be used to hide the first and last page buttons when not near the edges.\n * This is useful when your backend does not support offset and you can only use cursor based pagination.\n */\n hideEdges: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n // eslint-disable-next-line complexity\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n let start = this.maxVisible - 1;\n let end = this.totalPages - start + 1;\n\n // if hideEdges is true, modify the start and\n // end to account for the hidden pages\n if (this.hideEdges) {\n start = start + 1;\n end = end - 1;\n }\n\n if (this.currentPage < start) {\n const pages = [...this.range(1, start), '...'];\n if (!this.hideEdges) {\n // add last page to the end\n pages.push(this.totalPages);\n }\n return pages;\n }\n\n if (this.currentPage > end) {\n const pages = ['...', ...this.range(end, this.totalPages)];\n if (!this.hideEdges) {\n // add first page to the beginning\n pages.unshift(1);\n }\n return pages;\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n let left = this.currentPage - centerIndex;\n let right = this.currentPage + centerIndex;\n\n // if hideEdge is true, modify the left and right to account for the hidden pages\n if (this.hideEdges) {\n left = left - 1;\n right = right + 1;\n }\n\n const pages = ['...', ...this.range(left, right), '...'];\n if (!this.hideEdges) {\n return [1, ...pages, this.totalPages];\n }\n return pages;\n },\n\n prevAriaLabel () {\n return this.isFirstPage ? this.i18n.$t('DIALTONE_PAGINATION_FIRST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_PREVIOUS_PAGE');\n },\n\n nextAriaLabel () {\n return this.isLastPage ? this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_NEXT_PAGE');\n },\n\n pageNumberAriaLabel () {\n return (page) => {\n return page === this.totalPages ? `${this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE')} ${page}` : `${this.i18n.$t('DIALTONE_PAGINATION_PAGE_NUMBER', { page })}`;\n };\n },\n },\n\n watch: {\n activePage () {\n this.currentPage = this.activePage;\n },\n\n totalPages (pages) {\n if (this.currentPage > pages || this.currentPage <= 0){\n this.currentPage = pages;\n }\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIconChevronLeft","DtIconChevronRight","DtIconMoreHorizontal","DialtoneLocalization","start","end","pages","total","centerIndex","left","right","page","from","to","range","i","_createElementBlock","$props","_createVNode","_component_dt_button","$options","_cache","$event","$data","_component_dt_icon_chevron_left","_openBlock","_Fragment","_renderList","index","_normalizeClass","_hoisted_2","_component_dt_icon_more_horizontal","_createBlock","_component_dt_icon_chevron_right"],"mappings":";;;;;AA4EA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,sBAAAC;AAAA;EAGF,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,UAAU;AAAA;;;;IAMZ,YAAY;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA;;;;IAMZ,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA;;EAIb,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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over-constants.cjs"),a=require("../../common/utils/index.cjs"),f=require("../../common/mixins/modal.cjs"),u=require("./tippy-utils.cjs"),m=require("./popover-header-footer.cjs"),v=require("../../shared/sr_only_close_button.cjs"),n=require("vue"),E=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),y=require("../lazy-show/lazy-show.cjs"),g={compatConfig:{MODE:3},name:"DtPopover",components:{SrOnlyCloseButton:v.default,DtLazyShow:y.default,PopoverHeaderFooter:m.default},mixins:[f.default],props:{open:{type:Boolean,default:null},openOnContext:{type:Boolean,default:!1},elementType:{type:String,default:"div"},transition:{type:String,default:"fade"},role:{type:String,default:"dialog",validator:e=>d.POPOVER_ROLES.includes(e)},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null},padding:{type:String,default:"large",validator:e=>Object.keys(d.POPOVER_PADDING_CLASSES).some(t=>t===e)},contentClass:{type:[String,Array,Object],default:""},contentWidth:{type:String,default:"",validator:e=>d.POPOVER_CONTENT_WIDTHS.includes(e)},contentAppear:{type:Boolean,default:null},contentTabindex:{type:Number||null,default:-1},externalAnchor:{type:String,default:""},id:{type:String,default(){return a.getUniqueString()}},offset:{type:Array,default:()=>[0,4]},hideOnClick:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},fallbackPlacements:{type:Array,default:()=>["auto"]},placement:{type:String,default:"bottom-end"},tether:{type:Boolean,default:!0},sticky:{type:[Boolean,String],default:!1,validator:e=>d.POPOVER_STICKY_VALUES.includes(e)},maxHeight:{type:String,default:""},maxWidth:{type:String,default:""},showCloseButton:{type:Boolean,default:!1},headerClass:{type:[String,Array,Object],default:""},footerClass:{type:[String,Array,Object],default:""},dialogClass:{type:[String,Array,Object],default:""},initialFocusElement:{type:[String,HTMLElement],default:"first",validator:e=>d.POPOVER_INITIAL_FOCUS_STRINGS.includes(e)||e instanceof HTMLElement||e.startsWith("#")},openWithArrowKeys:{type:Boolean,default:!1},appendTo:{type:[HTMLElement,String],default:"body",validator:e=>d.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement}},emits:["keydown","update:open","opened","mouseenter-popover","mouseleave-popover","mouseenter-popover-anchor","mouseleave-popover-anchor"],data(){return{POPOVER_PADDING_CLASSES:d.POPOVER_PADDING_CLASSES,POPOVER_HEADER_FOOTER_PADDING_CLASSES:d.POPOVER_HEADER_FOOTER_PADDING_CLASSES,intersectionObserver:null,mutationObserver:null,isOutsideViewport:!1,isOpen:!1,toAppear:!1,anchorEl:null,popoverContentEl:null,hasSlotContent:a.hasSlotContent}},computed:{popoverListeners(){return{keydown:e=>{this.onKeydown(e)},"after-leave":()=>{this.onLeaveTransitionComplete()},"after-enter":()=>{this.onEnterTransitionComplete()}}},calculatedMaxHeight(){return this.isOutsideViewport&&this.modal?"calc(100vh - var(--dt-space-300))":this.maxHeight},labelledBy(){return this.ariaLabelledby||!this.ariaLabel&&a.getUniqueString("DtPopover__anchor")}},watch:{$props:{immediate:!0,deep:!0,handler(){this.validateProps()}},modal(e){var t;(t=this.tip)==null||t.setProps({zIndex:e?650:this.calculateAnchorZindex()})},offset(e){var t;(t=this.tip)==null||t.setProps({offset:e})},sticky(e){var t;(t=this.tip)==null||t.setProps({sticky:e})},fallbackPlacements(){var e;(e=this.tip)==null||e.setProps({popperOptions:this.popperOptions()})},tether(){var e;(e=this.tip)==null||e.setProps({popperOptions:this.popperOptions()})},placement(e){var t;(t=this.tip)==null||t.setProps({placement:e})},open:{handler:function(e){e!==null&&(this.isOpen=e),e===!0&&(this.toAppear=!0)},immediate:!0},contentAppear:{handler:function(e){e!==null&&(this.toAppear=e)}},isOpen(e,t){var o,s;e?(this.initTippyInstance(),(o=this.tip)==null||o.show()):!e&&t!==e&&(this.removeEventListeners(),(s=this.tip)==null||s.hide())}},mounted(){var e;a.warnIfUnmounted(a.returnFirstEl(this.$el),this.$options.name),this.popoverContentEl=a.returnFirstEl((e=this.$refs.content)==null?void 0:e.$el),this.updateAnchorEl(),this.mutationObserver=new MutationObserver(this.updateAnchorEl),this.mutationObserver.observe(this.$refs.anchor,{childList:!0}),this.intersectionObserver=new IntersectionObserver(this.hasIntersectedViewport),this.intersectionObserver.observe(this.popoverContentEl)},beforeUnmount(){var e,t,o;(e=this.tip)==null||e.destroy(),(t=this.intersectionObserver)==null||t.disconnect(),(o=this.mutationObserver)==null||o.disconnect(),this.removeReferences(),this.removeEventListeners()},methods:{hasIntersectedViewport(e){var s;const t=(s=e==null?void 0:e[0])==null?void 0:s.target;if(!t)return;const o=a.isOutOfViewPort(t);this.isOutsideViewport=o.bottom||o.top},updateAnchorEl(){var o,s;const t=(this.externalAnchor?this.$refs.anchor.getRootNode().querySelector(`#${this.externalAnchor}`):null)??this.$refs.anchor.children[0];if(t!==this.anchorEl){if(this.anchorEl=t,(o=this.tip)==null||o.destroy(),delete this.tip,!this.anchorEl){console.warn("No anchor found for popover");return}this.isOpen&&(this.initTippyInstance(),(s=this.tip)==null||s.show())}},popperOptions(){return u.getPopperOptions({fallbackPlacements:this.fallbackPlacements,tether:this.tether,hasHideModifierEnabled:!0})},validateProps(){this.modal&&this.initialFocusElement==="none"&&console.error('If the popover is modal you must set the initialFocusElement prop. Possible values: "dialog", "first", HTMLElement')},calculateAnchorZindex(){var e;return a.returnFirstEl(this.$el).getRootNode().querySelector('.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"]')||(e=this.anchorEl)!=null&&e.closest(".d-zi-drawer")?650:300},defaultToggleOpen(e){var t,o,s;if(!this.openOnContext&&(this.open===null||this.open===void 0)){if(!((t=this.anchorEl)!=null&&t.contains(e.target))&&!((o=this.anchorEl)!=null&&o.isEqualNode(e.target))||(s=this.anchorEl)!=null&&s.disabled)return;this.toggleOpen()}},async onContext(e){var t;this.openOnContext&&(e.preventDefault(),this.isOpen=!0,await this.$nextTick(),(t=this.tip)==null||t.setProps({placement:"right-start",getReferenceClientRect:()=>({width:0,height:0,top:e.clientY,bottom:e.clientY,left:e.clientX,right:e.clientX})}))},toggleOpen(){this.isOpen=!this.isOpen},onArrowKeyPress(e){var t;this.open===null&&(this.openWithArrowKeys&&((t=this.anchorEl)!=null&&t.contains(e.target))&&(this.isOpen||(this.isOpen=!0)),this.$emit("keydown",e))},addEventListeners(){window.addEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.addEventListener("resize",this.onResize)},removeEventListeners(){window.removeEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.removeEventListener("resize",this.onResize)},closePopover(){this.isOpen=!1},preventScrolling(){var e,t,o;if(this.modal){const s=(e=this.anchorEl)==null?void 0:e.closest("body, .tippy-box");if(!s)return;((t=s.tagName)==null?void 0:t.toLowerCase())==="body"?(a.disableRootScrolling(this.anchorEl.getRootNode().host),(o=this.tip)==null||o.setProps({offset:this.offset})):s.classList.add("d-zi-popover")}},enableScrolling(){var t,o,s;const e=(t=this.anchorEl)==null?void 0:t.closest("body, .tippy-box");e&&(((o=e.tagName)==null?void 0:o.toLowerCase())==="body"?(a.enableRootScrolling(this.anchorEl.getRootNode().host),(s=this.tip)==null||s.setProps({offset:this.offset})):e.classList.remove("d-zi-popover"))},removeReferences(){this.anchorEl=null,this.popoverContentEl=null,this.tip=null},async onShow(){this.contentWidth==="anchor"&&await this.setPopoverContentAnchorWidth(),this.contentWidth===null&&(this.popoverContentEl.style.width="auto"),this.addEventListeners()},async onLeaveTransitionComplete(){var e;this.modal&&(await this.focusFirstElement(this.$refs.anchor),await this.$nextTick(),this.enableScrolling()),(e=this.tip)==null||e.unmount(),this.$emit("opened",!1),this.open!==null&&this.$emit("update:open",!1)},async onEnterTransitionComplete(){this.focusInitialElement(),await this.$nextTick(),this.preventScrolling(),this.$emit("opened",!0,this.$refs.popover__content),this.open!==null&&this.$emit("update:open",!0)},focusInitialElement(){var e,t;this.initialFocusElement==="dialog"&&((t=a.returnFirstEl((e=this.$refs.content)==null?void 0:e.$el))==null||t.focus()),this.initialFocusElement.startsWith("#")&&this.focusInitialElementById(),this.initialFocusElement==="first"&&this.focusFirstElementIfNeeded(this.$refs.popover__content),this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()},focusInitialElementById(){var t,o,s,r;const e=(o=a.returnFirstEl((t=this.$refs.content)==null?void 0:t.$el))==null?void 0:o.querySelector(this.initialFocusElement);e?e.focus():(console.warn('Could not find the element specified in dt-popover prop "initialFocusElement". Defaulting to focusing the dialog.'),(r=a.returnFirstEl((s=this.$refs.content)==null?void 0:s.$el))==null||r.focus())},onResize(){this.closePopover()},onClickOutside(){var t;if(!this.hideOnClick)return;((t=this.popoverContentEl)==null?void 0:t.querySelector(".d-popover__anchor--opened"))||this.closePopover()},onKeydown(e){e.key==="Tab"&&this.modal&&this.focusTrappedTabPress(e,this.popoverContentEl),e.key==="Escape"&&this.closePopover(),this.$emit("keydown",e)},async setPopoverContentAnchorWidth(){var e;await this.$nextTick(),this.popoverContentEl.style.width=`${(e=this.anchorEl)==null?void 0:e.clientWidth}px`},focusFirstElementIfNeeded(e){var o,s;this._getFocusableElements(e,!0).length!==0?this.focusFirstElement(e):this.showCloseButton?(o=this.$refs.popover__header)==null||o.focusCloseButton():a.returnFirstEl((s=this.$refs.content)==null?void 0:s.$el).focus()},getReferenceClientRect(e){var h,p;const t=(h=this.anchorEl)==null?void 0:h.getBoundingClientRect();if(this.appendTo!=="root"||e)return t;const o=(p=this.anchorEl)==null?void 0:p.ownerDocument,s=(o==null?void 0:o.defaultView)||(o==null?void 0:o.parentWindow),r=s==null?void 0:s.frameElement;if(!r)return t;const i=r.getBoundingClientRect();return{width:t==null?void 0:t.width,height:t==null?void 0:t.height,top:(i==null?void 0:i.top)+(t==null?void 0:t.top),left:(i==null?void 0:i.left)+(t==null?void 0:t.left),right:(i==null?void 0:i.right)+(t==null?void 0:t.right),bottom:(i==null?void 0:i.bottom)+(t==null?void 0:t.bottom)}},initTippyInstance(){var o,s,r;let e=null,t=!1;switch(this.appendTo){case"body":e=(s=(o=this.anchorEl)==null?void 0:o.getRootNode())==null?void 0:s.querySelector("body");break;case"root":try{e=window.parent.document.body}catch(i){console.error("Could not attach the popover to iframe parent window: ",i),e="parent",t=!0}break;default:e=this.appendTo;break}(r=this.tip)==null||r.destroy(),this.tip=u.createTippyPopover(this.anchorEl,{popperOptions:this.popperOptions(),contentElement:this.popoverContentEl,placement:this.placement,offset:this.offset,sticky:this.sticky,appendTo:e,interactive:!0,trigger:"manual",getReferenceClientRect:()=>this.getReferenceClientRect(t),hideOnClick:!1,zIndex:this.modal?650:this.calculateAnchorZindex(),onClickOutside:this.onClickOutside,onShow:this.onShow})},onMouseEnter(){this.$emit("mouseenter-popover")},onMouseLeave(){this.$emit("mouseleave-popover")},onMouseEnterAnchor(){this.$emit("mouseenter-popover-anchor")},onMouseLeaveAnchor(){this.$emit("mouseleave-popover-anchor")}}},C=["id","data-qa","tabindex"],O=["data-qa"];function b(e,t,o,s,r,i){const h=n.resolveComponent("popover-header-footer"),p=n.resolveComponent("sr-only-close-button"),c=n.resolveComponent("dt-lazy-show");return n.openBlock(),n.createElementBlock("div",null,[o.modal&&r.isOpen?(n.openBlock(),n.createBlock(n.Teleport,{key:0,to:"body"},[n.createElementVNode("div",{class:"d-modal--transparent","aria-hidden":"false",onClick:t[0]||(t[0]=n.withModifiers(()=>{},["prevent","stop"]))})])):n.createCommentVNode("",!0),(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.elementType),{ref:"popover",class:n.normalizeClass(["d-popover",{"d-popover__anchor--opened":r.isOpen}]),"data-qa":"dt-popover-container"},{default:n.withCtx(()=>[n.createElementVNode("div",{id:!o.ariaLabelledby&&i.labelledBy,ref:"anchor","data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}-anchor`:"dt-popover-anchor",tabindex:o.openOnContext?0:void 0,onClickCapture:t[1]||(t[1]=(...l)=>i.defaultToggleOpen&&i.defaultToggleOpen(...l)),onContextmenu:t[2]||(t[2]=(...l)=>i.onContext&&i.onContext(...l)),onKeydown:[t[3]||(t[3]=n.withKeys(n.withModifiers((...l)=>i.onArrowKeyPress&&i.onArrowKeyPress(...l),["prevent"]),["up"])),t[4]||(t[4]=n.withKeys(n.withModifiers((...l)=>i.onArrowKeyPress&&i.onArrowKeyPress(...l),["prevent"]),["down"])),t[6]||(t[6]=n.withKeys(l=>e.$emit("keydown",l),["enter"])),t[7]||(t[7]=n.withKeys(l=>e.$emit("keydown",l),["space"]))],onKeydownCapture:t[5]||(t[5]=n.withKeys((...l)=>i.closePopover&&i.closePopover(...l),["escape"])),onMouseenter:t[8]||(t[8]=(...l)=>i.onMouseEnter&&i.onMouseEnter(...l)),onMouseleave:t[9]||(t[9]=(...l)=>i.onMouseLeave&&i.onMouseLeave(...l))},[n.renderSlot(e.$slots,"anchor",{attrs:{"aria-expanded":r.isOpen.toString(),"aria-controls":o.id,"aria-haspopup":o.role}})],40,C),n.createVNode(c,n.mergeProps({id:o.id,ref:"content",role:o.role,"data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}__dialog`:"dt-popover","aria-hidden":`${!r.isOpen}`,"aria-labelledby":i.labelledBy,"aria-label":o.ariaLabel,"aria-modal":`${!o.modal}`,transition:o.transition,show:r.isOpen,appear:r.toAppear,class:["d-popover__dialog",{"d-popover__dialog--modal":o.modal},o.dialogClass],style:{"max-height":i.calculatedMaxHeight,"max-width":o.maxWidth},css:e.$attrs.css,tabindex:o.contentTabindex},n.toHandlers(i.popoverListeners),{onMouseenter:i.onMouseEnterAnchor,onMouseleave:i.onMouseLeaveAnchor}),{default:n.withCtx(()=>[r.hasSlotContent(e.$slots.headerContent)||o.showCloseButton?(n.openBlock(),n.createBlock(h,{key:0,ref:"popover__header",class:n.normalizeClass(r.POPOVER_HEADER_FOOTER_PADDING_CLASSES[o.padding]),"content-class":o.headerClass,type:"header","show-close-button":o.showCloseButton,onClose:i.closePopover},{content:n.withCtx(()=>[n.renderSlot(e.$slots,"headerContent",{close:i.closePopover})]),_:3},8,["class","content-class","show-close-button","onClose"])):n.createCommentVNode("",!0),n.createElementVNode("div",{ref:"popover__content","data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}-content`:"dt-popover-content",class:n.normalizeClass(["d-popover__content",r.POPOVER_PADDING_CLASSES[o.padding],o.contentClass])},[n.renderSlot(e.$slots,"content",{close:i.closePopover})],10,O),r.hasSlotContent(e.$slots.footerContent)?(n.openBlock(),n.createBlock(h,{key:1,ref:"popover__footer",type:"footer",class:n.normalizeClass(r.POPOVER_HEADER_FOOTER_PADDING_CLASSES[o.padding]),"content-class":o.footerClass},{content:n.withCtx(()=>[n.renderSlot(e.$slots,"footerContent",{close:i.closePopover})]),_:3},8,["class","content-class"])):n.createCommentVNode("",!0),o.showCloseButton?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(p,{key:2,onClose:i.closePopover},null,8,["onClose"]))]),_:3},16,["id","role","data-qa","aria-hidden","aria-labelledby","aria-label","aria-modal","transition","show","appear","class","style","css","tabindex","onMouseenter","onMouseleave"])]),_:3},8,["class"]))])}const w=E._(g,[["render",b]]);exports.default=w;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./popover-constants.cjs"),a=require("../../common/utils/index.cjs"),f=require("../../common/mixins/modal.cjs"),u=require("./tippy-utils.cjs"),m=require("./popover-header-footer.cjs"),v=require("../../shared/sr_only_close_button.cjs"),n=require("vue"),E=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),y=require("../lazy-show/lazy-show.cjs"),g={compatConfig:{MODE:3},name:"DtPopover",components:{SrOnlyCloseButton:v.default,DtLazyShow:y.default,PopoverHeaderFooter:m.default},mixins:[f.default],props:{open:{type:Boolean,default:null},openOnContext:{type:Boolean,default:!1},elementType:{type:String,default:"div"},transition:{type:String,default:"fade"},role:{type:String,default:"dialog",validator:e=>d.POPOVER_ROLES.includes(e)},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null},padding:{type:String,default:"large",validator:e=>Object.keys(d.POPOVER_PADDING_CLASSES).some(t=>t===e)},contentClass:{type:[String,Array,Object],default:""},contentWidth:{type:String,default:"",validator:e=>d.POPOVER_CONTENT_WIDTHS.includes(e)},contentAppear:{type:Boolean,default:null},contentTabindex:{type:Number||null,default:-1},externalAnchor:{type:String,default:""},id:{type:String,default(){return a.getUniqueString()}},offset:{type:Array,default:()=>[0,4]},hideOnClick:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},fallbackPlacements:{type:Array,default:()=>["auto"]},placement:{type:String,default:"bottom-end"},tether:{type:Boolean,default:!0},sticky:{type:[Boolean,String],default:!1,validator:e=>d.POPOVER_STICKY_VALUES.includes(e)},maxHeight:{type:String,default:""},maxWidth:{type:String,default:""},showCloseButton:{type:Boolean,default:!1},headerClass:{type:[String,Array,Object],default:""},footerClass:{type:[String,Array,Object],default:""},dialogClass:{type:[String,Array,Object],default:""},initialFocusElement:{type:[String,HTMLElement],default:"first",validator:e=>d.POPOVER_INITIAL_FOCUS_STRINGS.includes(e)||e instanceof HTMLElement||e.startsWith("#")},openWithArrowKeys:{type:Boolean,default:!1},appendTo:{type:[HTMLElement,String],default:"body",validator:e=>d.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement}},emits:["keydown","update:open","opened","mouseenter-popover","mouseleave-popover","mouseenter-popover-anchor","mouseleave-popover-anchor"],data(){return{POPOVER_PADDING_CLASSES:d.POPOVER_PADDING_CLASSES,POPOVER_HEADER_FOOTER_PADDING_CLASSES:d.POPOVER_HEADER_FOOTER_PADDING_CLASSES,intersectionObserver:null,mutationObserver:null,isOutsideViewport:!1,isOpen:!1,toAppear:!1,anchorEl:null,popoverContentEl:null,hasSlotContent:a.hasSlotContent}},computed:{popoverListeners(){return{keydown:e=>{this.onKeydown(e)},"after-leave":()=>{this.onLeaveTransitionComplete()},"after-enter":()=>{this.onEnterTransitionComplete()}}},calculatedMaxHeight(){return this.isOutsideViewport&&this.modal?"calc(100vh - var(--dt-spacing-50))":this.maxHeight},labelledBy(){return this.ariaLabelledby||!this.ariaLabel&&a.getUniqueString("DtPopover__anchor")}},watch:{$props:{immediate:!0,deep:!0,handler(){this.validateProps()}},modal(e){var t;(t=this.tip)==null||t.setProps({zIndex:e?650:this.calculateAnchorZindex()})},offset(e){var t;(t=this.tip)==null||t.setProps({offset:e})},sticky(e){var t;(t=this.tip)==null||t.setProps({sticky:e})},fallbackPlacements(){var e;(e=this.tip)==null||e.setProps({popperOptions:this.popperOptions()})},tether(){var e;(e=this.tip)==null||e.setProps({popperOptions:this.popperOptions()})},placement(e){var t;(t=this.tip)==null||t.setProps({placement:e})},open:{handler:function(e){e!==null&&(this.isOpen=e),e===!0&&(this.toAppear=!0)},immediate:!0},contentAppear:{handler:function(e){e!==null&&(this.toAppear=e)}},isOpen(e,t){var o,s;e?(this.initTippyInstance(),(o=this.tip)==null||o.show()):!e&&t!==e&&(this.removeEventListeners(),(s=this.tip)==null||s.hide())}},mounted(){var e;a.warnIfUnmounted(a.returnFirstEl(this.$el),this.$options.name),this.popoverContentEl=a.returnFirstEl((e=this.$refs.content)==null?void 0:e.$el),this.updateAnchorEl(),this.mutationObserver=new MutationObserver(this.updateAnchorEl),this.mutationObserver.observe(this.$refs.anchor,{childList:!0}),this.intersectionObserver=new IntersectionObserver(this.hasIntersectedViewport),this.intersectionObserver.observe(this.popoverContentEl)},beforeUnmount(){var e,t,o;(e=this.tip)==null||e.destroy(),(t=this.intersectionObserver)==null||t.disconnect(),(o=this.mutationObserver)==null||o.disconnect(),this.removeReferences(),this.removeEventListeners()},methods:{hasIntersectedViewport(e){var s;const t=(s=e==null?void 0:e[0])==null?void 0:s.target;if(!t)return;const o=a.isOutOfViewPort(t);this.isOutsideViewport=o.bottom||o.top},updateAnchorEl(){var o,s;const t=(this.externalAnchor?this.$refs.anchor.getRootNode().querySelector(`#${this.externalAnchor}`):null)??this.$refs.anchor.children[0];if(t!==this.anchorEl){if(this.anchorEl=t,(o=this.tip)==null||o.destroy(),delete this.tip,!this.anchorEl){console.warn("No anchor found for popover");return}this.isOpen&&(this.initTippyInstance(),(s=this.tip)==null||s.show())}},popperOptions(){return u.getPopperOptions({fallbackPlacements:this.fallbackPlacements,tether:this.tether,hasHideModifierEnabled:!0})},validateProps(){this.modal&&this.initialFocusElement==="none"&&console.error('If the popover is modal you must set the initialFocusElement prop. Possible values: "dialog", "first", HTMLElement')},calculateAnchorZindex(){var e;return a.returnFirstEl(this.$el).getRootNode().querySelector('.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"]')||(e=this.anchorEl)!=null&&e.closest(".d-zi-drawer")?650:300},defaultToggleOpen(e){var t,o,s;if(!this.openOnContext&&(this.open===null||this.open===void 0)){if(!((t=this.anchorEl)!=null&&t.contains(e.target))&&!((o=this.anchorEl)!=null&&o.isEqualNode(e.target))||(s=this.anchorEl)!=null&&s.disabled)return;this.toggleOpen()}},async onContext(e){var t;this.openOnContext&&(e.preventDefault(),this.isOpen=!0,await this.$nextTick(),(t=this.tip)==null||t.setProps({placement:"right-start",getReferenceClientRect:()=>({width:0,height:0,top:e.clientY,bottom:e.clientY,left:e.clientX,right:e.clientX})}))},toggleOpen(){this.isOpen=!this.isOpen},onArrowKeyPress(e){var t;this.open===null&&(this.openWithArrowKeys&&((t=this.anchorEl)!=null&&t.contains(e.target))&&(this.isOpen||(this.isOpen=!0)),this.$emit("keydown",e))},addEventListeners(){window.addEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.addEventListener("resize",this.onResize)},removeEventListeners(){window.removeEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.removeEventListener("resize",this.onResize)},closePopover(){this.isOpen=!1},preventScrolling(){var e,t,o;if(this.modal){const s=(e=this.anchorEl)==null?void 0:e.closest("body, .tippy-box");if(!s)return;((t=s.tagName)==null?void 0:t.toLowerCase())==="body"?(a.disableRootScrolling(this.anchorEl.getRootNode().host),(o=this.tip)==null||o.setProps({offset:this.offset})):s.classList.add("d-zi-popover")}},enableScrolling(){var t,o,s;const e=(t=this.anchorEl)==null?void 0:t.closest("body, .tippy-box");e&&(((o=e.tagName)==null?void 0:o.toLowerCase())==="body"?(a.enableRootScrolling(this.anchorEl.getRootNode().host),(s=this.tip)==null||s.setProps({offset:this.offset})):e.classList.remove("d-zi-popover"))},removeReferences(){this.anchorEl=null,this.popoverContentEl=null,this.tip=null},async onShow(){this.contentWidth==="anchor"&&await this.setPopoverContentAnchorWidth(),this.contentWidth===null&&(this.popoverContentEl.style.width="auto"),this.addEventListeners()},async onLeaveTransitionComplete(){var e;this.modal&&(await this.focusFirstElement(this.$refs.anchor),await this.$nextTick(),this.enableScrolling()),(e=this.tip)==null||e.unmount(),this.$emit("opened",!1),this.open!==null&&this.$emit("update:open",!1)},async onEnterTransitionComplete(){this.focusInitialElement(),await this.$nextTick(),this.preventScrolling(),this.$emit("opened",!0,this.$refs.popover__content),this.open!==null&&this.$emit("update:open",!0)},focusInitialElement(){var e,t;this.initialFocusElement==="dialog"&&((t=a.returnFirstEl((e=this.$refs.content)==null?void 0:e.$el))==null||t.focus()),this.initialFocusElement.startsWith("#")&&this.focusInitialElementById(),this.initialFocusElement==="first"&&this.focusFirstElementIfNeeded(this.$refs.popover__content),this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()},focusInitialElementById(){var t,o,s,r;const e=(o=a.returnFirstEl((t=this.$refs.content)==null?void 0:t.$el))==null?void 0:o.querySelector(this.initialFocusElement);e?e.focus():(console.warn('Could not find the element specified in dt-popover prop "initialFocusElement". Defaulting to focusing the dialog.'),(r=a.returnFirstEl((s=this.$refs.content)==null?void 0:s.$el))==null||r.focus())},onResize(){this.closePopover()},onClickOutside(){var t;if(!this.hideOnClick)return;((t=this.popoverContentEl)==null?void 0:t.querySelector(".d-popover__anchor--opened"))||this.closePopover()},onKeydown(e){e.key==="Tab"&&this.modal&&this.focusTrappedTabPress(e,this.popoverContentEl),e.key==="Escape"&&this.closePopover(),this.$emit("keydown",e)},async setPopoverContentAnchorWidth(){var e;await this.$nextTick(),this.popoverContentEl.style.width=`${(e=this.anchorEl)==null?void 0:e.clientWidth}px`},focusFirstElementIfNeeded(e){var o,s;this._getFocusableElements(e,!0).length!==0?this.focusFirstElement(e):this.showCloseButton?(o=this.$refs.popover__header)==null||o.focusCloseButton():a.returnFirstEl((s=this.$refs.content)==null?void 0:s.$el).focus()},getReferenceClientRect(e){var h,p;const t=(h=this.anchorEl)==null?void 0:h.getBoundingClientRect();if(this.appendTo!=="root"||e)return t;const o=(p=this.anchorEl)==null?void 0:p.ownerDocument,s=(o==null?void 0:o.defaultView)||(o==null?void 0:o.parentWindow),r=s==null?void 0:s.frameElement;if(!r)return t;const i=r.getBoundingClientRect();return{width:t==null?void 0:t.width,height:t==null?void 0:t.height,top:(i==null?void 0:i.top)+(t==null?void 0:t.top),left:(i==null?void 0:i.left)+(t==null?void 0:t.left),right:(i==null?void 0:i.right)+(t==null?void 0:t.right),bottom:(i==null?void 0:i.bottom)+(t==null?void 0:t.bottom)}},initTippyInstance(){var o,s,r;let e=null,t=!1;switch(this.appendTo){case"body":e=(s=(o=this.anchorEl)==null?void 0:o.getRootNode())==null?void 0:s.querySelector("body");break;case"root":try{e=window.parent.document.body}catch(i){console.error("Could not attach the popover to iframe parent window: ",i),e="parent",t=!0}break;default:e=this.appendTo;break}(r=this.tip)==null||r.destroy(),this.tip=u.createTippyPopover(this.anchorEl,{popperOptions:this.popperOptions(),contentElement:this.popoverContentEl,placement:this.placement,offset:this.offset,sticky:this.sticky,appendTo:e,interactive:!0,trigger:"manual",getReferenceClientRect:()=>this.getReferenceClientRect(t),hideOnClick:!1,zIndex:this.modal?650:this.calculateAnchorZindex(),onClickOutside:this.onClickOutside,onShow:this.onShow})},onMouseEnter(){this.$emit("mouseenter-popover")},onMouseLeave(){this.$emit("mouseleave-popover")},onMouseEnterAnchor(){this.$emit("mouseenter-popover-anchor")},onMouseLeaveAnchor(){this.$emit("mouseleave-popover-anchor")}}},C=["id","data-qa","tabindex"],O=["data-qa"];function b(e,t,o,s,r,i){const h=n.resolveComponent("popover-header-footer"),p=n.resolveComponent("sr-only-close-button"),c=n.resolveComponent("dt-lazy-show");return n.openBlock(),n.createElementBlock("div",null,[o.modal&&r.isOpen?(n.openBlock(),n.createBlock(n.Teleport,{key:0,to:"body"},[n.createElementVNode("div",{class:"d-modal--transparent","aria-hidden":"false",onClick:t[0]||(t[0]=n.withModifiers(()=>{},["prevent","stop"]))})])):n.createCommentVNode("",!0),(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.elementType),{ref:"popover",class:n.normalizeClass(["d-popover",{"d-popover__anchor--opened":r.isOpen}]),"data-qa":"dt-popover-container"},{default:n.withCtx(()=>[n.createElementVNode("div",{id:!o.ariaLabelledby&&i.labelledBy,ref:"anchor","data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}-anchor`:"dt-popover-anchor",tabindex:o.openOnContext?0:void 0,onClickCapture:t[1]||(t[1]=(...l)=>i.defaultToggleOpen&&i.defaultToggleOpen(...l)),onContextmenu:t[2]||(t[2]=(...l)=>i.onContext&&i.onContext(...l)),onKeydown:[t[3]||(t[3]=n.withKeys(n.withModifiers((...l)=>i.onArrowKeyPress&&i.onArrowKeyPress(...l),["prevent"]),["up"])),t[4]||(t[4]=n.withKeys(n.withModifiers((...l)=>i.onArrowKeyPress&&i.onArrowKeyPress(...l),["prevent"]),["down"])),t[6]||(t[6]=n.withKeys(l=>e.$emit("keydown",l),["enter"])),t[7]||(t[7]=n.withKeys(l=>e.$emit("keydown",l),["space"]))],onKeydownCapture:t[5]||(t[5]=n.withKeys((...l)=>i.closePopover&&i.closePopover(...l),["escape"])),onMouseenter:t[8]||(t[8]=(...l)=>i.onMouseEnter&&i.onMouseEnter(...l)),onMouseleave:t[9]||(t[9]=(...l)=>i.onMouseLeave&&i.onMouseLeave(...l))},[n.renderSlot(e.$slots,"anchor",{attrs:{"aria-expanded":r.isOpen.toString(),"aria-controls":o.id,"aria-haspopup":o.role}})],40,C),n.createVNode(c,n.mergeProps({id:o.id,ref:"content",role:o.role,"data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}__dialog`:"dt-popover","aria-hidden":`${!r.isOpen}`,"aria-labelledby":i.labelledBy,"aria-label":o.ariaLabel,"aria-modal":`${!o.modal}`,transition:o.transition,show:r.isOpen,appear:r.toAppear,class:["d-popover__dialog",{"d-popover__dialog--modal":o.modal},o.dialogClass],style:{"max-height":i.calculatedMaxHeight,"max-width":o.maxWidth},css:e.$attrs.css,tabindex:o.contentTabindex},n.toHandlers(i.popoverListeners),{onMouseenter:i.onMouseEnterAnchor,onMouseleave:i.onMouseLeaveAnchor}),{default:n.withCtx(()=>[r.hasSlotContent(e.$slots.headerContent)||o.showCloseButton?(n.openBlock(),n.createBlock(h,{key:0,ref:"popover__header",class:n.normalizeClass(r.POPOVER_HEADER_FOOTER_PADDING_CLASSES[o.padding]),"content-class":o.headerClass,type:"header","show-close-button":o.showCloseButton,onClose:i.closePopover},{content:n.withCtx(()=>[n.renderSlot(e.$slots,"headerContent",{close:i.closePopover})]),_:3},8,["class","content-class","show-close-button","onClose"])):n.createCommentVNode("",!0),n.createElementVNode("div",{ref:"popover__content","data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}-content`:"dt-popover-content",class:n.normalizeClass(["d-popover__content",r.POPOVER_PADDING_CLASSES[o.padding],o.contentClass])},[n.renderSlot(e.$slots,"content",{close:i.closePopover})],10,O),r.hasSlotContent(e.$slots.footerContent)?(n.openBlock(),n.createBlock(h,{key:1,ref:"popover__footer",type:"footer",class:n.normalizeClass(r.POPOVER_HEADER_FOOTER_PADDING_CLASSES[o.padding]),"content-class":o.footerClass},{content:n.withCtx(()=>[n.renderSlot(e.$slots,"footerContent",{close:i.closePopover})]),_:3},8,["class","content-class"])):n.createCommentVNode("",!0),o.showCloseButton?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(p,{key:2,onClose:i.closePopover},null,8,["onClose"]))]),_:3},16,["id","role","data-qa","aria-hidden","aria-labelledby","aria-label","aria-modal","transition","show","appear","class","style","css","tabindex","onMouseenter","onMouseleave"])]),_:3},8,["class"]))])}const w=E._(g,[["render",b]]);exports.default=w;
|
|
2
2
|
//# sourceMappingURL=popover.cjs.map
|