@dialpad/dialtone 9.123.2 → 9.125.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -5
- package/dist/css/dialtone-default-theme.css +414 -77
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone-docs.json +1 -1
- package/dist/css/dialtone.css +188 -68
- package/dist/css/dialtone.min.css +1 -1
- package/dist/css/svg/spot/playlist.svg +1 -0
- package/dist/css/vue/spot/SpotPlaylist.vue +3 -0
- package/dist/tokens/doc.json +24348 -24348
- package/dist/vue2/common/mixins/index.cjs +1 -1
- package/dist/vue2/common/mixins/index.js +10 -10
- package/dist/vue2/common/mixins/localization.cjs +2 -0
- package/dist/vue2/common/mixins/localization.cjs.map +1 -0
- package/dist/vue2/common/mixins/localization.js +10 -0
- package/dist/vue2/common/mixins/localization.js.map +1 -0
- package/dist/vue2/common/utils/index.cjs +1 -1
- package/dist/vue2/common/utils/index.cjs.map +1 -1
- package/dist/vue2/common/utils/index.js +43 -39
- package/dist/vue2/common/utils/index.js.map +1 -1
- package/dist/vue2/component-documentation.json +1 -1
- package/dist/vue2/dialtone-vue.cjs +1 -1
- package/dist/vue2/dialtone-vue.js +341 -340
- package/dist/vue2/dialtone-vue.js.map +1 -1
- package/dist/vue2/lib/attachment-carousel/attachment-carousel.cjs +1 -1
- package/dist/vue2/lib/attachment-carousel/attachment-carousel.cjs.map +1 -1
- package/dist/vue2/lib/attachment-carousel/attachment-carousel.js +61 -86
- package/dist/vue2/lib/attachment-carousel/attachment-carousel.js.map +1 -1
- package/dist/vue2/lib/banner/banner.cjs +2 -2
- package/dist/vue2/lib/banner/banner.cjs.map +1 -1
- package/dist/vue2/lib/banner/banner.js +25 -33
- package/dist/vue2/lib/banner/banner.js.map +1 -1
- package/dist/vue2/lib/breadcrumbs/breadcrumbs.cjs +1 -1
- package/dist/vue2/lib/breadcrumbs/breadcrumbs.cjs.map +1 -1
- package/dist/vue2/lib/breadcrumbs/breadcrumbs.js +14 -12
- package/dist/vue2/lib/breadcrumbs/breadcrumbs.js.map +1 -1
- package/dist/vue2/lib/button/button.cjs +1 -1
- package/dist/vue2/lib/button/button.cjs.map +1 -1
- package/dist/vue2/lib/button/button.js +11 -9
- package/dist/vue2/lib/button/button.js.map +1 -1
- package/dist/vue2/lib/callbar-button-with-dropdown/callbar-button-with-dropdown.cjs +1 -1
- package/dist/vue2/lib/callbar-button-with-dropdown/callbar-button-with-dropdown.cjs.map +1 -1
- package/dist/vue2/lib/callbar-button-with-dropdown/callbar-button-with-dropdown.js +19 -25
- package/dist/vue2/lib/callbar-button-with-dropdown/callbar-button-with-dropdown.js.map +1 -1
- package/dist/vue2/lib/callbar-button-with-popover/callbar-button-with-popover.cjs +1 -1
- package/dist/vue2/lib/callbar-button-with-popover/callbar-button-with-popover.cjs.map +1 -1
- package/dist/vue2/lib/callbar-button-with-popover/callbar-button-with-popover.js +18 -21
- package/dist/vue2/lib/callbar-button-with-popover/callbar-button-with-popover.js.map +1 -1
- package/dist/vue2/lib/chip/chip.cjs +1 -1
- package/dist/vue2/lib/chip/chip.cjs.map +1 -1
- package/dist/vue2/lib/chip/chip.js +24 -29
- package/dist/vue2/lib/chip/chip.js.map +1 -1
- package/dist/vue2/lib/combobox/combobox-constants.cjs +1 -1
- package/dist/vue2/lib/combobox/combobox-constants.cjs.map +1 -1
- package/dist/vue2/lib/combobox/combobox-constants.js +2 -2
- package/dist/vue2/lib/combobox/combobox-constants.js.map +1 -1
- package/dist/vue2/lib/combobox/combobox-empty-list.cjs.map +1 -1
- package/dist/vue2/lib/combobox/combobox-empty-list.js.map +1 -1
- package/dist/vue2/lib/combobox/combobox-loading-list.cjs.map +1 -1
- package/dist/vue2/lib/combobox/combobox-loading-list.js.map +1 -1
- package/dist/vue2/lib/combobox/combobox.cjs +2 -2
- package/dist/vue2/lib/combobox/combobox.cjs.map +1 -1
- package/dist/vue2/lib/combobox/combobox.js +12 -12
- package/dist/vue2/lib/combobox/combobox.js.map +1 -1
- package/dist/vue2/lib/combobox/index.cjs +1 -1
- package/dist/vue2/lib/combobox/index.js +3 -3
- package/dist/vue2/lib/combobox-multi-select/combobox-multi-select.cjs +1 -1
- package/dist/vue2/lib/combobox-multi-select/combobox-multi-select.cjs.map +1 -1
- package/dist/vue2/lib/combobox-multi-select/combobox-multi-select.js +19 -20
- package/dist/vue2/lib/combobox-multi-select/combobox-multi-select.js.map +1 -1
- package/dist/vue2/lib/combobox-with-popover/combobox-with-popover.cjs +1 -1
- package/dist/vue2/lib/combobox-with-popover/combobox-with-popover.cjs.map +1 -1
- package/dist/vue2/lib/combobox-with-popover/combobox-with-popover.js +22 -24
- package/dist/vue2/lib/combobox-with-popover/combobox-with-popover.js.map +1 -1
- package/dist/vue2/lib/contact-centers-row/contact-centers-row.cjs +1 -1
- package/dist/vue2/lib/contact-centers-row/contact-centers-row.cjs.map +1 -1
- package/dist/vue2/lib/contact-centers-row/contact-centers-row.js +40 -36
- package/dist/vue2/lib/contact-centers-row/contact-centers-row.js.map +1 -1
- package/dist/vue2/lib/contact-row/contact-row.cjs +1 -1
- package/dist/vue2/lib/contact-row/contact-row.cjs.map +1 -1
- package/dist/vue2/lib/contact-row/contact-row.js +11 -25
- package/dist/vue2/lib/contact-row/contact-row.js.map +1 -1
- package/dist/vue2/lib/datepicker/datepicker-constants.cjs +1 -1
- package/dist/vue2/lib/datepicker/datepicker-constants.cjs.map +1 -1
- package/dist/vue2/lib/datepicker/datepicker-constants.js +2 -3
- package/dist/vue2/lib/datepicker/datepicker-constants.js.map +1 -1
- package/dist/vue2/lib/datepicker/datepicker.cjs +1 -1
- package/dist/vue2/lib/datepicker/datepicker.cjs.map +1 -1
- package/dist/vue2/lib/datepicker/datepicker.js +143 -229
- package/dist/vue2/lib/datepicker/datepicker.js.map +1 -1
- package/dist/vue2/lib/datepicker/utils.cjs +1 -1
- package/dist/vue2/lib/datepicker/utils.cjs.map +1 -1
- package/dist/vue2/lib/datepicker/utils.js +12 -11
- package/dist/vue2/lib/datepicker/utils.js.map +1 -1
- package/dist/vue2/lib/description-list/description-list.cjs +1 -1
- package/dist/vue2/lib/description-list/description-list.cjs.map +1 -1
- package/dist/vue2/lib/description-list/description-list.js +8 -8
- package/dist/vue2/lib/description-list/description-list.js.map +1 -1
- package/dist/vue2/lib/dropdown/dropdown.cjs +1 -1
- package/dist/vue2/lib/dropdown/dropdown.cjs.map +1 -1
- package/dist/vue2/lib/dropdown/dropdown.js +48 -50
- package/dist/vue2/lib/dropdown/dropdown.js.map +1 -1
- package/dist/vue2/lib/editor/editor.cjs +1 -1
- package/dist/vue2/lib/editor/editor.cjs.map +1 -1
- package/dist/vue2/lib/editor/editor.js +78 -87
- package/dist/vue2/lib/editor/editor.js.map +1 -1
- package/dist/vue2/lib/emoji-picker/emoji-picker-constants.cjs +1 -1
- package/dist/vue2/lib/emoji-picker/emoji-picker-constants.cjs.map +1 -1
- package/dist/vue2/lib/emoji-picker/emoji-picker-constants.js +6 -19
- package/dist/vue2/lib/emoji-picker/emoji-picker-constants.js.map +1 -1
- package/dist/vue2/lib/emoji-picker/emoji-picker.cjs +1 -1
- package/dist/vue2/lib/emoji-picker/emoji-picker.cjs.map +1 -1
- package/dist/vue2/lib/emoji-picker/emoji-picker.js +106 -145
- package/dist/vue2/lib/emoji-picker/emoji-picker.js.map +1 -1
- package/dist/vue2/lib/emoji-picker/index.cjs +1 -1
- package/dist/vue2/lib/emoji-picker/index.js +6 -7
- package/dist/vue2/lib/emoji-row/emoji-row-constants.cjs +1 -1
- package/dist/vue2/lib/emoji-row/emoji-row-constants.cjs.map +1 -1
- package/dist/vue2/lib/emoji-row/emoji-row-constants.js +5 -7
- package/dist/vue2/lib/emoji-row/emoji-row-constants.js.map +1 -1
- package/dist/vue2/lib/emoji-row/emoji-row.cjs +1 -1
- package/dist/vue2/lib/emoji-row/emoji-row.cjs.map +1 -1
- package/dist/vue2/lib/emoji-row/emoji-row.js +31 -22
- package/dist/vue2/lib/emoji-row/emoji-row.js.map +1 -1
- package/dist/vue2/lib/feed-item-pill/feed-item-pill.cjs +1 -1
- package/dist/vue2/lib/feed-item-pill/feed-item-pill.cjs.map +1 -1
- package/dist/vue2/lib/feed-item-pill/feed-item-pill.js +20 -22
- package/dist/vue2/lib/feed-item-pill/feed-item-pill.js.map +1 -1
- package/dist/vue2/lib/general-row/general-row.cjs +1 -1
- package/dist/vue2/lib/general-row/general-row.cjs.map +1 -1
- package/dist/vue2/lib/general-row/general-row.js +63 -52
- package/dist/vue2/lib/general-row/general-row.js.map +1 -1
- package/dist/vue2/lib/group-row/group-row.cjs +1 -1
- package/dist/vue2/lib/group-row/group-row.cjs.map +1 -1
- package/dist/vue2/lib/group-row/group-row.js +43 -32
- package/dist/vue2/lib/group-row/group-row.js.map +1 -1
- package/dist/vue2/lib/icon/icon-constants.cjs.map +1 -1
- package/dist/vue2/lib/icon/icon-constants.js.map +1 -1
- package/dist/vue2/lib/icon/icon.cjs +1 -1
- package/dist/vue2/lib/icon/icon.cjs.map +1 -1
- package/dist/vue2/lib/icon/icon.js +12 -8
- package/dist/vue2/lib/icon/icon.js.map +1 -1
- package/dist/vue2/lib/image-viewer/image-viewer.cjs +1 -1
- package/dist/vue2/lib/image-viewer/image-viewer.cjs.map +1 -1
- package/dist/vue2/lib/image-viewer/image-viewer.js +30 -31
- package/dist/vue2/lib/image-viewer/image-viewer.js.map +1 -1
- package/dist/vue2/lib/ivr-node/ivr-node-constants.cjs +1 -1
- package/dist/vue2/lib/ivr-node/ivr-node-constants.cjs.map +1 -1
- package/dist/vue2/lib/ivr-node/ivr-node-constants.js +24 -24
- package/dist/vue2/lib/ivr-node/ivr-node-constants.js.map +1 -1
- package/dist/vue2/lib/ivr-node/ivr-node.cjs +1 -1
- package/dist/vue2/lib/ivr-node/ivr-node.cjs.map +1 -1
- package/dist/vue2/lib/ivr-node/ivr-node.js +38 -36
- package/dist/vue2/lib/ivr-node/ivr-node.js.map +1 -1
- package/dist/vue2/lib/message-input/message-input-link.cjs +1 -1
- package/dist/vue2/lib/message-input/message-input-link.cjs.map +1 -1
- package/dist/vue2/lib/message-input/message-input-link.js +48 -23
- package/dist/vue2/lib/message-input/message-input-link.js.map +1 -1
- package/dist/vue2/lib/message-input/message-input-topbar.cjs +1 -1
- package/dist/vue2/lib/message-input/message-input-topbar.cjs.map +1 -1
- package/dist/vue2/lib/message-input/message-input-topbar.js +50 -22
- package/dist/vue2/lib/message-input/message-input-topbar.js.map +1 -1
- package/dist/vue2/lib/message-input/message-input.cjs +1 -1
- package/dist/vue2/lib/message-input/message-input.cjs.map +1 -1
- package/dist/vue2/lib/message-input/message-input.js +112 -143
- package/dist/vue2/lib/message-input/message-input.js.map +1 -1
- package/dist/vue2/lib/modal/modal.cjs +1 -2
- package/dist/vue2/lib/modal/modal.cjs.map +1 -1
- package/dist/vue2/lib/modal/modal.js +25 -42
- package/dist/vue2/lib/modal/modal.js.map +1 -1
- package/dist/vue2/lib/notice/notice-action.cjs +1 -1
- package/dist/vue2/lib/notice/notice-action.cjs.map +1 -1
- package/dist/vue2/lib/notice/notice-action.js +19 -26
- package/dist/vue2/lib/notice/notice-action.js.map +1 -1
- package/dist/vue2/lib/notice/notice.cjs +1 -1
- package/dist/vue2/lib/notice/notice.cjs.map +1 -1
- package/dist/vue2/lib/notice/notice.js +18 -27
- package/dist/vue2/lib/notice/notice.js.map +1 -1
- package/dist/vue2/lib/pagination/pagination.cjs +1 -1
- package/dist/vue2/lib/pagination/pagination.cjs.map +1 -1
- package/dist/vue2/lib/pagination/pagination.js +49 -58
- package/dist/vue2/lib/pagination/pagination.js.map +1 -1
- package/dist/vue2/lib/popover/popover-header-footer.cjs +1 -1
- package/dist/vue2/lib/popover/popover-header-footer.cjs.map +1 -1
- package/dist/vue2/lib/popover/popover-header-footer.js +24 -26
- package/dist/vue2/lib/popover/popover-header-footer.js.map +1 -1
- package/dist/vue2/lib/popover/popover.cjs +1 -1
- package/dist/vue2/lib/popover/popover.cjs.map +1 -1
- package/dist/vue2/lib/popover/popover.js +26 -35
- package/dist/vue2/lib/popover/popover.js.map +1 -1
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs +5 -5
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.js +330 -320
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/vue2/lib/settings-menu-button/settings-menu-button.cjs.map +1 -1
- package/dist/vue2/lib/settings-menu-button/settings-menu-button.js.map +1 -1
- package/dist/vue2/lib/time-pill/time-pill.cjs.map +1 -1
- package/dist/vue2/lib/time-pill/time-pill.js.map +1 -1
- package/dist/vue2/lib/toast/toast.cjs +1 -1
- package/dist/vue2/lib/toast/toast.cjs.map +1 -1
- package/dist/vue2/lib/toast/toast.js +64 -97
- package/dist/vue2/lib/toast/toast.js.map +1 -1
- package/dist/vue2/lib/unread-pill/unread-pill.cjs +1 -1
- package/dist/vue2/lib/unread-pill/unread-pill.cjs.map +1 -1
- package/dist/vue2/lib/unread-pill/unread-pill.js +27 -18
- package/dist/vue2/lib/unread-pill/unread-pill.js.map +1 -1
- package/dist/vue2/localization/en-US.cjs +185 -0
- package/dist/vue2/localization/en-US.cjs.map +1 -0
- package/dist/vue2/localization/en-US.js +188 -0
- package/dist/vue2/localization/en-US.js.map +1 -0
- package/dist/vue2/localization/es-LA.cjs +169 -0
- package/dist/vue2/localization/es-LA.cjs.map +1 -0
- package/dist/vue2/localization/es-LA.js +172 -0
- package/dist/vue2/localization/es-LA.js.map +1 -0
- package/dist/vue2/localization/index.cjs +1176 -0
- package/dist/vue2/localization/index.cjs.map +1 -0
- package/dist/vue2/localization/index.js +1239 -0
- package/dist/vue2/localization/index.js.map +1 -0
- package/dist/vue2/node_modules/@tiptap/vue-2.cjs.map +1 -1
- package/dist/vue2/node_modules/@tiptap/vue-2.js.map +1 -1
- package/dist/vue2/shared/sr_only_close_button.cjs +1 -1
- package/dist/vue2/shared/sr_only_close_button.cjs.map +1 -1
- package/dist/vue2/shared/sr_only_close_button.js +19 -22
- package/dist/vue2/shared/sr_only_close_button.js.map +1 -1
- package/dist/vue2/types/common/mixins/index.d.ts +1 -1
- package/dist/vue2/types/common/mixins/localization.d.ts +8 -0
- package/dist/vue2/types/common/mixins/localization.d.ts.map +1 -0
- package/dist/vue2/types/common/sr_only_close_button.vue.d.ts +7 -13
- package/dist/vue2/types/common/sr_only_close_button.vue.d.ts.map +1 -1
- package/dist/vue2/types/common/utils/index.d.ts +1 -0
- package/dist/vue2/types/common/utils/index.d.ts.map +1 -1
- package/dist/vue2/types/components/banner/banner.vue.d.ts +0 -33
- package/dist/vue2/types/components/banner/banner.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/breadcrumbs/breadcrumbs.vue.d.ts +5 -1
- package/dist/vue2/types/components/button/button.vue.d.ts +6 -2
- package/dist/vue2/types/components/chip/chip.vue.d.ts +8 -18
- package/dist/vue2/types/components/combobox/combobox_constants.d.ts +2 -2
- package/dist/vue2/types/components/combobox/index.d.ts +1 -1
- package/dist/vue2/types/components/datepicker/datepicker.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/datepicker/datepicker_constants.d.ts +0 -1
- package/dist/vue2/types/components/datepicker/datepicker_constants.d.ts.map +1 -1
- package/dist/vue2/types/components/datepicker/modules/calendar.vue.d.ts +5 -17
- package/dist/vue2/types/components/datepicker/modules/month-year-picker.vue.d.ts +8 -48
- package/dist/vue2/types/components/datepicker/utils.d.ts +1 -0
- package/dist/vue2/types/components/datepicker/utils.d.ts.map +1 -1
- package/dist/vue2/types/components/dropdown/dropdown.vue.d.ts +0 -24
- package/dist/vue2/types/components/dropdown/dropdown.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/emoji_picker/emoji_picker.vue.d.ts +5 -1
- package/dist/vue2/types/components/emoji_picker/emoji_picker_constants.d.ts +0 -13
- package/dist/vue2/types/components/icon/icon.vue.d.ts +1 -0
- package/dist/vue2/types/components/icon/icon_constants.d.ts.map +1 -1
- package/dist/vue2/types/components/image_viewer/image_viewer.vue.d.ts +5 -8
- package/dist/vue2/types/components/image_viewer/image_viewer.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/modal/modal.vue.d.ts +3 -33
- package/dist/vue2/types/components/notice/notice.vue.d.ts +1 -34
- package/dist/vue2/types/components/notice/notice.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/notice/notice_action.vue.d.ts +3 -31
- package/dist/vue2/types/components/notice/notice_action.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/pagination/pagination.vue.d.ts +9 -26
- package/dist/vue2/types/components/pagination/pagination.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/popover/popover.vue.d.ts +0 -33
- package/dist/vue2/types/components/popover/popover.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/popover/popover_header_footer.vue.d.ts +8 -11
- package/dist/vue2/types/components/popover/popover_header_footer.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts +15 -2
- package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/toast/layouts/toast_layout_alternate.vue.d.ts +1 -43
- package/dist/vue2/types/components/toast/layouts/toast_layout_alternate.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/toast/layouts/toast_layout_default.vue.d.ts +1 -34
- package/dist/vue2/types/components/toast/layouts/toast_layout_default.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/toast/toast.vue.d.ts +3 -111
- package/dist/vue2/types/components/toast/toast.vue.d.ts.map +1 -1
- package/dist/vue2/types/index.d.ts +1 -0
- package/dist/vue2/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +7 -13
- package/dist/vue2/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +7 -12
- package/dist/vue2/types/recipes/cards/ivr_node/ivr_node.vue.d.ts +8 -10
- package/dist/vue2/types/recipes/cards/ivr_node/ivr_node.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/cards/ivr_node/ivr_node_constants.d.ts +7 -7
- package/dist/vue2/types/recipes/cards/ivr_node/ivr_node_constants.d.ts.map +1 -1
- package/dist/vue2/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -25
- package/dist/vue2/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +1 -25
- package/dist/vue2/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts +5 -41
- package/dist/vue2/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts +8 -26
- package/dist/vue2/types/recipes/conversation_view/attachment_carousel/media_components/progress_bar.vue.d.ts +2 -2
- package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts +20 -61
- package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts +6 -1
- package/dist/vue2/types/recipes/conversation_view/emoji_row/emoji_row_constants.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +9 -12
- package/dist/vue2/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts +8 -2
- package/dist/vue2/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +15 -90
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +14 -2
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +14 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts +10 -11
- package/dist/vue2/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/contact_row/contact_row.vue.d.ts +0 -18
- package/dist/vue2/types/recipes/leftbar/contact_row/contact_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/general_row/general_row.vue.d.ts +21 -37
- package/dist/vue2/types/recipes/leftbar/general_row/general_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/group_row/group_row.vue.d.ts +9 -18
- package/dist/vue2/types/recipes/leftbar/group_row/group_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/unread_pill/unread_pill.vue.d.ts +7 -1
- package/dist/vue2/types/recipes/leftbar/unread_pill/unread_pill.vue.d.ts.map +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.cjs +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.cjs.map +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.js +3 -2
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.js.map +1 -1
- package/package.json +4 -3
- package/dist/vue2/common/mixins/sr-only-close-button.cjs +0 -3
- package/dist/vue2/common/mixins/sr-only-close-button.cjs.map +0 -1
- package/dist/vue2/common/mixins/sr-only-close-button.js +0 -44
- package/dist/vue2/common/mixins/sr-only-close-button.js.map +0 -1
- package/dist/vue2/lib/contact-row/contact-row-constants.cjs +0 -2
- package/dist/vue2/lib/contact-row/contact-row-constants.cjs.map +0 -1
- package/dist/vue2/lib/contact-row/contact-row-constants.js +0 -5
- package/dist/vue2/lib/contact-row/contact-row-constants.js.map +0 -1
- package/dist/vue2/lib/emoji/emoji-constants.cjs +0 -2
- package/dist/vue2/lib/emoji/emoji-constants.cjs.map +0 -1
- package/dist/vue2/lib/emoji/emoji-constants.js +0 -5
- package/dist/vue2/lib/emoji/emoji-constants.js.map +0 -1
- package/dist/vue2/lib/group-row/group-row-constants.cjs +0 -2
- package/dist/vue2/lib/group-row/group-row-constants.cjs.map +0 -1
- package/dist/vue2/lib/group-row/group-row-constants.js +0 -8
- package/dist/vue2/lib/group-row/group-row-constants.js.map +0 -1
- package/dist/vue2/lib/time-pill/time-pill-constants.cjs +0 -2
- package/dist/vue2/lib/time-pill/time-pill-constants.cjs.map +0 -1
- package/dist/vue2/lib/time-pill/time-pill-constants.js +0 -8
- package/dist/vue2/lib/time-pill/time-pill-constants.js.map +0 -1
- package/dist/vue2/types/common/mixins/sr_only_close_button.d.ts +0 -30
- package/dist/vue2/types/common/mixins/sr_only_close_button.d.ts.map +0 -1
- package/dist/vue2/types/components/emoji/emoji_constants.d.ts +0 -3
- package/dist/vue2/types/components/emoji/emoji_constants.d.ts.map +0 -1
- package/dist/vue2/types/recipes/conversation_view/time_pill/time_pill_constants.d.ts +0 -6
- package/dist/vue2/types/recipes/conversation_view/time_pill/time_pill_constants.d.ts.map +0 -1
- package/dist/vue2/types/recipes/leftbar/contact_row/contact_row_constants.d.ts +0 -3
- package/dist/vue2/types/recipes/leftbar/contact_row/contact_row_constants.d.ts.map +0 -1
- package/dist/vue2/types/recipes/leftbar/group_row/group_row_constants.d.ts +0 -6
- package/dist/vue2/types/recipes/leftbar/group_row/group_row_constants.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./dom.cjs"),i=require("./input.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./dom.cjs"),i=require("./input.cjs"),o=require("./input-group.cjs"),t=require("./keyboard-list-navigation.cjs"),e=require("./modal.cjs"),u=require("./skeleton.cjs"),r=require("./localization.cjs");exports.DtDOMMixin=n.default;exports.DtCheckableInputMixin=i.CheckableMixin;exports.DtGroupableInputMixin=i.GroupableMixin;exports.DtInputMixin=i.InputMixin;exports.DtInputGroupMixin=o.InputGroupMixin;exports.DtKeyboardListNavigationMixin=t.default;exports.DtModalMixin=e.default;exports.DtSkeletonMixin=u.default;exports.DtLocalizationMixin=r.default;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { CheckableMixin as
|
|
1
|
+
import { default as a } from "./dom.js";
|
|
2
|
+
import { CheckableMixin as n, GroupableMixin as e, InputMixin as x } from "./input.js";
|
|
3
3
|
import { InputGroupMixin as p } from "./input-group.js";
|
|
4
4
|
import { default as M } from "./keyboard-list-navigation.js";
|
|
5
|
-
import { default as
|
|
5
|
+
import { default as l } from "./modal.js";
|
|
6
6
|
import { default as D } from "./skeleton.js";
|
|
7
|
-
import { default as m } from "./
|
|
7
|
+
import { default as m } from "./localization.js";
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
n as DtCheckableInputMixin,
|
|
10
|
+
a as DtDOMMixin,
|
|
11
11
|
e as DtGroupableInputMixin,
|
|
12
12
|
p as DtInputGroupMixin,
|
|
13
|
-
|
|
13
|
+
x as DtInputMixin,
|
|
14
14
|
M as DtKeyboardListNavigationMixin,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
m as DtLocalizationMixin,
|
|
16
|
+
l as DtModalMixin,
|
|
17
|
+
D as DtSkeletonMixin
|
|
18
18
|
};
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localization.cjs","sources":["../../../common/mixins/localization.js"],"sourcesContent":["/**\n * Simple mixin to reuse the i18n instance.\n */\n\nimport { DialtoneLocalization } from '@/localization';\n\nexport default {\n data () {\n return { i18n: new DialtoneLocalization() };\n },\n};\n"],"names":["DtLocalizationMixin","DialtoneLocalization"],"mappings":"4JAMeA,EAAA,CACb,MAAQ,CACN,MAAO,CAAE,KAAM,IAAIC,EAAoB,qBACxC,CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localization.js","sources":["../../../common/mixins/localization.js"],"sourcesContent":["/**\n * Simple mixin to reuse the i18n instance.\n */\n\nimport { DialtoneLocalization } from '@/localization';\n\nexport default {\n data () {\n return { i18n: new DialtoneLocalization() };\n },\n};\n"],"names":["DtLocalizationMixin","DialtoneLocalization"],"mappings":";AAMA,MAAeA,IAAA;AAAA,EACb,OAAQ;AACN,WAAO,EAAE,MAAM,IAAIC,EAAoB;EACxC;AACH;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../constants/index.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../constants/index.cjs"),v=require("vue");let D=0,u;const $="input:not([type=hidden]):not(:disabled)",M="select:not(:disabled),textarea:not(:disabled),button:not(:disabled)",j=`${$},${M}`,k=`a,frame,iframe,${j},*[tabindex]`,V=typeof setImmediate=="function"?setImmediate:setTimeout;function l(e=o.DEFAULT_PREFIX){return`${e}${D++}`}function d(e,t){if(t){const n=f(t);return e[Math.abs(n)%e.length]}else return e[s(e.length)]}function f(e){let t;for(let n=0;n<e.length;n++)t=Math.imul(31,t)+e.charCodeAt(n)|0;return t}function s(e){return Math.floor(Math.random()*e)}function m(e){return e?e.map(t=>typeof t=="string"?{message:t,type:o.DEFAULT_VALIDATION_MESSAGE_TYPE}:t):[]}function E(e){const t=c(e);return!e||!t?[]:e.filter(n=>!!n.message&&n.type===t)}function c(e){return e?r(e,o.VALIDATION_MESSAGE_TYPES.ERROR)?o.VALIDATION_MESSAGE_TYPES.ERROR:r(e,o.VALIDATION_MESSAGE_TYPES.WARNING)?o.VALIDATION_MESSAGE_TYPES.WARNING:r(e,o.VALIDATION_MESSAGE_TYPES.SUCCESS)?o.VALIDATION_MESSAGE_TYPES.SUCCESS:null:null}function r(e,t){return!e||!t?!1:e.some(n=>(n==null?void 0:n.type)===t)}function W(e){return e==null?void 0:e.querySelector(k)}const b={name:"html-fragment",functional:!0,props:["html"],render(e,t){return new v({name:"Inner",beforeCreate(){this.$createElement=e},template:`<div>${t.props.html}</div>`}).$mount()._vnode.children}},g=()=>new Promise(e=>{V(e)}),h=e=>e==null?void 0:e.toLowerCase().split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(""),z=e=>e.replace(/\.?([A-Z0-9]+)/g,(t,n)=>"-"+n.toLowerCase()).replace(/^-/,"");function S(e,t=300){clearTimeout(u),u=setTimeout(e,t)}function p(e){const t=e.getBoundingClientRect(),n={top:t.top<0,left:t.left<0,bottom:t.bottom>(window.innerHeight||document.documentElement.clientHeight),right:t.right>(window.innerWidth||document.documentElement.clientWidth)};return n.any=Object.values(n).some(i=>i),n.all=Object.values(n).every(i=>i),n}const G=/(?:(?:[^\s!@#$%^&*()_=+[\]{}\\|;:'",.<>/?]+)\.)/,B=new RegExp("(?:com|ru|org|net|de|jp|uk|br|it|pl|fr|in|au|ir|info|nl|cn|es|cz|kr|ca|eu|ua|co|gr|za|ro|biz|ch|se|tw|mx|vn|hu|be|tr|at|dk|tv|me|ar|sk|no|us|fi|id|cl|xyz|io|pt|by|il|ie|nz|kz|hk|lt|cc|my|sg|club|bg|edu|рф|pk|su|top|th|hr|rs|pe|pro|si|az|lv|pw|ae|ph|online|ng|ee|ws|ve|cat)"),H=new RegExp("(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])"),R=new RegExp("(?:"+[[G.source,B.source].join("+"),H.source].join("|")+")"),Y=/(?:(?:[;/][^#?<>\s]*)?)/,A=/(?:(?:\?[^#<>\s]+)?(?:#[^<>\s]+)?)/,_=new RegExp("\\b"+[R.source,Y.source,A.source,"(?!\\w)"].join("+")),T=/\b[a-z\d.-]+:\/\/[^<>\s]+/,C=new RegExp("(?:mailto:)?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@"+[R.source,A.source].join("+")+"(?!\\w)");function a(e=7,t=15){try{return new RegExp(`(?:^|(?<=\\W))(?![\\s\\-])\\+?(?:[0-9()\\- \\t]{${e},${t}})(?=\\b)(?=\\W(?=\\W|$)|\\s|$)`)}catch{console.warn("This browser doesn't support regex lookahead/lookbehind")}return new RegExp(`(?![\\s\\-])\\+?(?:[0-9()\\- \\t]{${e},${t}})(?=\\b)(?=\\W(?=\\W|$)|\\s|$)`)}const O=a(),I=new RegExp([_.source,T.source,C.source,O.source].join("|"),"gi");function x(e){var t;return!e||!["string","number"].includes(typeof e)?!1:(e=e.toString(),((t=O.exec(e))==null?void 0:t[0])===e)}function L(e){var t,n;return!e||typeof e!="string"?!1:((t=_.exec(e))==null?void 0:t[0])===e||((n=T.exec(e))==null?void 0:n[0])===e}function N(e){var t;return!e||typeof e!="string"?!1:((t=C.exec(e))==null?void 0:t[0])===e}function w(e){return e.filter(t=>!!t).join(", ")}function y(e,t="en-US"){return e.replace(new RegExp("^\\p{CWU}","u"),n=>n.toLocaleUpperCase(t))}function q(e,t){typeof process>"u"||process.env.NODE_ENV==="test"&&(!e||!(e instanceof HTMLElement)||!(document!=null&&document.body)||document.body.contains(e)||console.warn(`The ${t} component is not attached to the document body. This may cause issues.`))}function P(e=document.documentElement){return!!e.hasAttribute("data-overlayscrollbars")}function U(e=document.documentElement){P(e)?e.classList.add("d-scrollbar-disabled"):e.classList.add("d-of-hidden")}function F(e=document.documentElement){P(e)?e.classList.remove("d-scrollbar-disabled"):e.classList.remove("d-of-hidden")}function K(e){return e.replaceAll(/[ -]/g,"_").replaceAll(/\W/g,"").toUpperCase()}const Q={getUniqueString:l,getRandomElement:d,getRandomInt:s,formatMessages:m,filterFormattedMessages:E,hasFormattedMessageOfType:r,getValidationState:c,htmlFragment:b,flushPromises:g,kebabCaseToPascalCase:h,debounce:S,isOutOfViewPort:p,getPhoneNumberRegex:a,linkRegex:I,isEmailAddress:N,isPhoneNumber:x,isURL:L,safeConcatStrings:w,capitalizeFirstLetter:y,disableRootScrolling:U,enableRootScrolling:F};exports.capitalizeFirstLetter=y;exports.debounce=S;exports.default=Q;exports.disableRootScrolling=U;exports.enableRootScrolling=F;exports.filterFormattedMessages=E;exports.findFirstFocusableNode=W;exports.flushPromises=g;exports.formatMessages=m;exports.getPhoneNumberRegex=a;exports.getRandomElement=d;exports.getRandomInt=s;exports.getUniqueString=l;exports.getValidationState=c;exports.hasFormattedMessageOfType=r;exports.htmlFragment=b;exports.isEmailAddress=N;exports.isOutOfViewPort=p;exports.isPhoneNumber=x;exports.isURL=L;exports.javaHashCode=f;exports.kebabCaseToPascalCase=h;exports.linkRegex=I;exports.pascalCaseToKebabCase=z;exports.safeConcatStrings=w;exports.toFluentKeyString=K;exports.warnIfUnmounted=q;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../common/utils/index.js"],"sourcesContent":["import {\n DEFAULT_PREFIX,\n DEFAULT_VALIDATION_MESSAGE_TYPE,\n VALIDATION_MESSAGE_TYPES,\n} from '../constants';\nimport Vue from 'vue';\n\nlet UNIQUE_ID_COUNTER = 0;\nlet TIMER;\n\n// selector to find focusable not hidden inputs\nconst FOCUSABLE_SELECTOR_NOT_HIDDEN = 'input:not([type=hidden]):not(:disabled)';\n// selector to find focusable not disables elements\nconst FOCUSABLE_SELECTOR_NOT_DISABLED = 'select:not(:disabled),textarea:not(:disabled),button:not(:disabled)';\n// // selector to find focusable not hidden and disabled elements\nconst FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED = `${FOCUSABLE_SELECTOR_NOT_HIDDEN},${FOCUSABLE_SELECTOR_NOT_DISABLED}`;\n// selector to find focusable elements\nconst FOCUSABLE_SELECTOR = `a,frame,iframe,${FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED},*[tabindex]`;\n\nconst scheduler = typeof setImmediate === 'function' ? setImmediate : setTimeout;\n\nexport function getUniqueString (prefix = DEFAULT_PREFIX) {\n return `${prefix}${UNIQUE_ID_COUNTER++}`;\n}\n\n/**\n * Returns a random element from array\n * @param array - the array to return a random element from\n * @param {string} seed - use a string to seed the randomization, so it returns the same element each time\n * based on that string.\n * @returns {*} - the random element\n */\nexport function getRandomElement (array, seed) {\n if (seed) {\n const hash = javaHashCode(seed);\n return array[Math.abs(hash) % array.length];\n } else {\n return array[getRandomInt(array.length)];\n }\n}\n\n/**\n * Returns a hash code for a string.\n * (Compatible to Java's String.hashCode())\n * We use this algo to be in sync with android.\n *\n * The hash code for a string object is computed as\n * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]\n * using number arithmetic, where s[i] is the i th character\n * of the given string, n is the length of the string,\n * and ^ indicates exponentiation.\n * (The hash value of the empty string is zero.)\n *\n * @param {string} str a string\n * @return {number} a hash code value for the given string.\n */\nexport function javaHashCode (str) {\n let h;\n for (let i = 0; i < str.length; i++) {\n h = Math.imul(31, h) + str.charCodeAt(i) | 0;\n }\n\n return h;\n}\n\n/**\n * Generate a random integer\n * @param {number} max - max range of integer to generate\n * @returns {number} randomly generated integer between 0 and max\n */\nexport function getRandomInt (max) {\n return Math.floor(Math.random() * max);\n}\n\nexport function formatMessages (messages) {\n if (!messages) {\n return [];\n }\n\n return messages.map(message => {\n if (typeof message === 'string') {\n return {\n message,\n type: DEFAULT_VALIDATION_MESSAGE_TYPE,\n };\n }\n\n return message;\n });\n}\n\nexport function filterFormattedMessages (formattedMessages) {\n const validationState = getValidationState(formattedMessages);\n\n if (!formattedMessages || !validationState) {\n return [];\n }\n\n return formattedMessages.filter(message => !!message.message && message.type === validationState);\n}\n\n/*\n * The priority order of message types is as flows: 'error' > 'warning' > 'success'.\n * If any message of type 'error' is present in messages, the input state is considered\n * to be 'error', then 'warning' and lastly 'success'.\n */\nexport function getValidationState (formattedMessages) {\n if (!formattedMessages) {\n return null;\n }\n\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.ERROR)) {\n return VALIDATION_MESSAGE_TYPES.ERROR;\n }\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.WARNING)) {\n return VALIDATION_MESSAGE_TYPES.WARNING;\n }\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.SUCCESS)) {\n return VALIDATION_MESSAGE_TYPES.SUCCESS;\n }\n\n return null;\n}\n\nexport function hasFormattedMessageOfType (formattedMessages, messageType) {\n if (!formattedMessages || !messageType) {\n return false;\n }\n\n return formattedMessages.some(message => message?.type === messageType);\n}\n\nexport function findFirstFocusableNode (element) {\n return element?.querySelector(FOCUSABLE_SELECTOR);\n}\n\n/* html-fragment component:\n * To render html without wrapping in another element as when using v-html.\n * props: html\n */\nexport const htmlFragment = {\n name: 'html-fragment',\n functional: true,\n props: ['html'],\n render (h, ctx) {\n return new Vue({\n // eslint-disable-next-line vue/multi-word-component-names\n name: 'Inner',\n beforeCreate () { this.$createElement = h; },\n template: `<div>${ctx.props.html}</div>`,\n }).$mount()._vnode.children;\n },\n};\n\nexport const flushPromises = () => {\n return new Promise((resolve) => {\n scheduler(resolve);\n });\n};\n\n/**\n * Transform a string from kebab-case to PascalCase\n * @param string\n * @returns {string}\n */\nexport const kebabCaseToPascalCase = (string) => {\n return string?.toLowerCase()\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n};\n\n/**\n * Transform a string from PascalCase to kebab-case\n * @param string\n * @returns {string}\n */\nexport const pascalCaseToKebabCase = (string) => {\n return string\n .replace(/\\.?([A-Z0-9]+)/g, (x, y) => '-' + y.toLowerCase())\n .replace(/^-/, '');\n};\n\n/*\n* Set's a global timer to debounce the execution of a function.\n* @param { object } func - the function that is going to be called after timeout\n* @param { number } [timeout=300] timeout\n* */\nexport function debounce (func, timeout = 300) {\n clearTimeout(TIMER);\n TIMER = setTimeout(func, timeout);\n}\n\n/**\n * Checks if the element is out of the viewport\n * https://gomakethings.com/how-to-check-if-any-part-of-an-element-is-out-of-the-viewport-with-vanilla-js/\n * @param {HTMLElement} element The element to check\n * @return {Object} A set of booleans for each side of the element\n */\n\nexport function isOutOfViewPort (element) {\n const bounding = element.getBoundingClientRect();\n\n const isOut = {\n top: bounding.top < 0,\n left: bounding.left < 0,\n bottom: bounding.bottom > (window.innerHeight || document.documentElement.clientHeight),\n right: bounding.right > (window.innerWidth || document.documentElement.clientWidth),\n };\n isOut.any = Object.values(isOut).some(val => val);\n isOut.all = Object.values(isOut).every(val => val);\n return isOut;\n}\n\n// match valid characters for a domain name followed by a dot, e.g. \"dialpad.\"\nconst domainNameRegex = /(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)/;\n\n// match valid TLDs for a hostname (outdated list from ~2017)\nconst tldRegerx = new RegExp(\n '(?:' +\n 'com|ru|org|net|de|jp|uk|br|it|pl|fr|in|au|ir|info|nl|cn|es|cz|kr|ca|eu|ua|co|gr|' +\n 'za|ro|biz|ch|se|tw|mx|vn|hu|be|tr|at|dk|tv|me|ar|sk|no|us|fi|id|cl|xyz|io|pt|by|' +\n 'il|ie|nz|kz|hk|lt|cc|my|sg|club|bg|edu|рф|pk|su|top|th|hr|rs|pe|pro|si|az|lv|pw|' +\n 'ae|ph|online|ng|ee|ws|ve|cat' +\n ')',\n);\n\n// match valid IPv4 addresses, e.g. \"192.158.1.38\"\nconst ipv4Regex = new RegExp(\n '(?:(?:[0-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])\\\\.){3}' +\n '(?:[0-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])',\n);\n\n// match hostnames OR IPv4 addresses, e.g. \"dialpad.com\" or \"192.158.1.38\"\nconst hostnameOrIpRegex = new RegExp(\n '(?:' +\n [\n [\n domainNameRegex.source,\n tldRegerx.source,\n ].join('+'),\n ipv4Regex.source,\n ].join('|') +\n ')',\n);\n\n// match URL paths, e.g. \"/news\"\nconst urlPathRegex = /(?:(?:[;/][^#?<>\\s]*)?)/;\n\n// match URL queries and fragments, e.g. \"?cache=1&new=true\" or \"#heading1\"\nconst urlQueryOrFragmentRegex = /(?:(?:\\?[^#<>\\s]+)?(?:#[^<>\\s]+)?)/;\n\n// match complete hostnames or IPv4 addresses without a protocol and with optional\n// URL paths, queries and fragments e.g. \"dialpad.com/news?cache=1#heading1\"\nconst urlWithoutProtocolRegex = new RegExp(\n '\\\\b' +\n [\n hostnameOrIpRegex.source,\n urlPathRegex.source,\n urlQueryOrFragmentRegex.source,\n '(?!\\\\w)',\n ].join('+'),\n);\n\n// match complete hostnames with protocols and optional URL paths, queries and fragments,\n// e.g. \"ws://localhost:9010\" or \"https://dialpad.com/news?cache=1#heading1\"\nconst urlWithProtocolRegex = /\\b[a-z\\d.-]+:\\/\\/[^<>\\s]+/;\n\n// match email addresses with an optional \"mailto:\" prefix and URL queries, e.g.\n// \"hey@dialpad.com\" or \"mailto:hey@dialpad.com?subject=Hi&body=Hey%20there\"\nconst emailAddressRegex = new RegExp(\n '(?:mailto:)?' +\n '[a-z0-9!#$%&\\'*+/=?^_`{|}~-]+(?:\\\\.[a-z0-9!#$%&\\'*+/=?^_`{|}~-]+)*@' +\n [\n hostnameOrIpRegex.source,\n urlQueryOrFragmentRegex.source,\n ].join('+') +\n '(?!\\\\w)',\n);\n\n/**\n * Match phone numbers, e.g. \"765-8813\", \"(778) 765-8813\" or \"+17787658813\".\n * @param {number} minLength\n * @param {number} maxLength\n * @returns {RegExp}\n */\nexport function getPhoneNumberRegex (minLength = 7, maxLength = 15) {\n // Some older browser versions don't support lookbehind, so provide a RegExp\n // version without it. It fails just one test case, so IMO it's still good\n // enough to use. https://caniuse.com/js-regexp-lookbehind\n try {\n return new RegExp(\n '(?:^|(?<=\\\\W))' +\n '(?![\\\\s\\\\-])\\\\+?(?:[0-9()\\\\- \\\\t]' +\n `{${minLength},${maxLength}}` +\n ')(?=\\\\b)(?=\\\\W(?=\\\\W|$)|\\\\s|$)',\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('This browser doesn\\'t support regex lookahead/lookbehind');\n }\n\n return new RegExp(\n '(?![\\\\s\\\\-])\\\\+?(?:[0-9()\\\\- \\\\t]' +\n `{${minLength},${maxLength}}` +\n ')(?=\\\\b)(?=\\\\W(?=\\\\W|$)|\\\\s|$)',\n );\n}\n\nconst phoneNumberRegex = getPhoneNumberRegex();\n\n// match all link types\nexport const linkRegex = new RegExp(\n [\n urlWithoutProtocolRegex.source,\n urlWithProtocolRegex.source,\n emailAddressRegex.source,\n phoneNumberRegex.source,\n ].join('|'),\n 'gi',\n);\n\n/**\n * Check if a string is a phone number. Validates only exact matches.\n * @param {string|number} input\n * @returns {boolean}\n */\nexport function isPhoneNumber (input) {\n if (!input || (!['string', 'number'].includes(typeof input))) return false;\n input = input.toString();\n return phoneNumberRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Check if a string is an URL. Validates only exact matches.\n * @param {string} input\n * @returns {boolean}\n */\nexport function isURL (input) {\n if (!input || typeof input !== 'string') return false;\n return urlWithoutProtocolRegex.exec(input)?.[0] === input ||\n urlWithProtocolRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Check if a string is an email address. Validates only exact matches.\n * @param {string} input\n * @returns {boolean}\n */\nexport function isEmailAddress (input) {\n if (!input || typeof input !== 'string') return false;\n return emailAddressRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Concatenate a string removing null or undefined elements\n * avoiding parsing them as string with template strings\n * @param {Array} elements\n * @returns {String}\n */\nexport function safeConcatStrings (elements) {\n return elements.filter(str => !!str).join(' ');\n}\n\n/**\n * Locale safe function to capitalize the first letter of a string.\n * @param {string} str the string to capitalize the first letter of\n * @param {string} locale a string representing the locale to be used. Defaults to 'en-US'\n * @returns The passed in string with the first letter capitalized\n */\nexport function capitalizeFirstLetter (str, locale = 'en-US') {\n return str.replace(/^\\p{CWU}/u, char => char.toLocaleUpperCase(locale));\n}\n\n/**\n * Warns if the component is not mounted properly. Useful for tests.\n * @param {HTMLElement} componentRef - the component reference\n * @param {string} componentName - the component name\n */\n// eslint-disable-next-line complexity\nexport function warnIfUnmounted (componentRef, componentName) {\n if (typeof process === 'undefined') return;\n if (process.env.NODE_ENV !== 'test') return;\n if (!componentRef || !(componentRef instanceof HTMLElement) || !document?.body) return;\n if (!document.body.contains(componentRef)) {\n console.warn(`The ${componentName} component is not attached to the document body. This may cause issues.`);\n }\n}\n\n/**\n * checks whether the dt-scrollbar is being used on the root element.\n * @param rootElement {HTMLElement}\n * @returns {boolean}\n */\nfunction isDtScrollbarInUse (rootElement = document.documentElement) {\n if (rootElement.hasAttribute('data-overlayscrollbars')) {\n return true;\n }\n return false;\n}\n\n/**\n * This will disable scrolling on the root element regardless of whether you are using dt-scrollbar or not.\n * @param rootElement {HTMLElement}\n */\nexport function disableRootScrolling (rootElement = document.documentElement) {\n if (isDtScrollbarInUse(rootElement)) {\n rootElement.classList.add('d-scrollbar-disabled');\n } else {\n rootElement.classList.add('d-of-hidden');\n }\n}\n\n/**\n * This will enable scrolling on the root element regardless of whether you are using dt-scrollbar or not.\n * @param rootElement {HTMLElement}\n */\nexport function enableRootScrolling (rootElement = document.documentElement) {\n if (isDtScrollbarInUse(rootElement)) {\n rootElement.classList.remove('d-scrollbar-disabled');\n } else {\n rootElement.classList.remove('d-of-hidden');\n }\n}\n\nexport default {\n getUniqueString,\n getRandomElement,\n getRandomInt,\n formatMessages,\n filterFormattedMessages,\n hasFormattedMessageOfType,\n getValidationState,\n htmlFragment,\n flushPromises,\n kebabCaseToPascalCase,\n debounce,\n isOutOfViewPort,\n getPhoneNumberRegex,\n linkRegex,\n isEmailAddress,\n isPhoneNumber,\n isURL,\n safeConcatStrings,\n capitalizeFirstLetter,\n disableRootScrolling,\n enableRootScrolling,\n};\n"],"names":["UNIQUE_ID_COUNTER","TIMER","FOCUSABLE_SELECTOR_NOT_HIDDEN","FOCUSABLE_SELECTOR_NOT_DISABLED","FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED","FOCUSABLE_SELECTOR","scheduler","getUniqueString","prefix","DEFAULT_PREFIX","getRandomElement","array","seed","hash","javaHashCode","getRandomInt","str","h","i","max","formatMessages","messages","message","DEFAULT_VALIDATION_MESSAGE_TYPE","filterFormattedMessages","formattedMessages","validationState","getValidationState","hasFormattedMessageOfType","VALIDATION_MESSAGE_TYPES","messageType","findFirstFocusableNode","element","htmlFragment","ctx","Vue","flushPromises","resolve","kebabCaseToPascalCase","string","word","pascalCaseToKebabCase","x","y","debounce","func","timeout","isOutOfViewPort","bounding","isOut","val","domainNameRegex","tldRegerx","ipv4Regex","hostnameOrIpRegex","urlPathRegex","urlQueryOrFragmentRegex","urlWithoutProtocolRegex","urlWithProtocolRegex","emailAddressRegex","getPhoneNumberRegex","minLength","maxLength","phoneNumberRegex","linkRegex","isPhoneNumber","input","_a","isURL","_b","isEmailAddress","safeConcatStrings","elements","capitalizeFirstLetter","locale","char","warnIfUnmounted","componentRef","componentName","isDtScrollbarInUse","rootElement","disableRootScrolling","enableRootScrolling","utils"],"mappings":"uKAOA,IAAIA,EAAoB,EACpBC,EAGJ,MAAMC,EAAgC,0CAEhCC,EAAkC,sEAElCC,EAAyC,GAAGF,CAA6B,IAAIC,CAA+B,GAE5GE,EAAqB,kBAAkBD,CAAsC,eAE7EE,EAAY,OAAO,cAAiB,WAAa,aAAe,WAE/D,SAASC,EAAiBC,EAASC,iBAAgB,CACxD,MAAO,GAAGD,CAAM,GAAGR,GAAmB,EACxC,CASO,SAASU,EAAkBC,EAAOC,EAAM,CAC7C,GA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AASK,EAAmBC,EAAU,CAC3C,OAAOA,EAAS,OAAOxD,GAAO,CAAC,CAACA,CAAG,EAAE,KAAK,GAAG,CAC/C,CAQO,SAASyD,EAAuBzD,EAAK0D,EAAS,QAAS,CAC5D,OAAO1D,EAAI,QAAQ,0BAAW,EAAE2D,GAAQA,EAAK,kBAAkBD,CAAM,CAAC,CACxE,CAQO,SAASE,EAAiBC,EAAcC,EAAe,CACxD,OAAO,QAAY,KACnB,QAAQ,IAAI,WAAa,SACzB,CAACD,GAAgB,EAAEA,aAAwB,cAAgB,EAAC,yBAAU,OACrE,SAAS,KAAK,SAASA,CAAY,GACtC,QAAQ,KAAK,OAAOC,CAAa,yEAAyE,EAE9G,CAOA,SAASC,EAAoBC,EAAc,SAAS,gBAAiB,CACnE,MAAI,EAAAA,EAAY,aAAa,wBAAwB,CAIvD,CAMO,SAASC,EAAsBD,EAAc,SAAS,gBAAiB,CACxED,EAAmBC,CAAW,EAChCA,EAAY,UAAU,IAAI,sBAAsB,EAEhDA,EAAY,UAAU,IAAI,aAAa,CAE3C,CAMO,SAASE,EAAqBF,EAAc,SAAS,gBAAiB,CACvED,EAAmBC,CAAW,EAChCA,EAAY,UAAU,OAAO,sBAAsB,EAEnDA,EAAY,UAAU,OAAO,aAAa,CAE9C,CAEA,MAAeG,EAAA,CACb,gBAAA5E,EACA,iBAAAG,EACA,aAAAK,EACA,eAAAK,EACA,wBAAAI,EACA,0BAAAI,EACA,mBAAAD,EACA,aAAAM,EACA,cAAAG,EACA,sBAAAE,EACA,SAAAM,EACA,gBAAAG,EACA,oBAAAa,EACA,UAAAI,EACA,eAAAM,EACA,cAAAL,EACA,MAAAG,EACA,kBAAAG,EACA,sBAAAE,EACA,qBAAAQ,EACA,oBAAAC,CACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../common/utils/index.js"],"sourcesContent":["import {\n DEFAULT_PREFIX,\n DEFAULT_VALIDATION_MESSAGE_TYPE,\n VALIDATION_MESSAGE_TYPES,\n} from '../constants/index.js';\nimport Vue from 'vue';\n\nlet UNIQUE_ID_COUNTER = 0;\nlet TIMER;\n\n// selector to find focusable not hidden inputs\nconst FOCUSABLE_SELECTOR_NOT_HIDDEN = 'input:not([type=hidden]):not(:disabled)';\n// selector to find focusable not disables elements\nconst FOCUSABLE_SELECTOR_NOT_DISABLED = 'select:not(:disabled),textarea:not(:disabled),button:not(:disabled)';\n// // selector to find focusable not hidden and disabled elements\nconst FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED = `${FOCUSABLE_SELECTOR_NOT_HIDDEN},${FOCUSABLE_SELECTOR_NOT_DISABLED}`;\n// selector to find focusable elements\nconst FOCUSABLE_SELECTOR = `a,frame,iframe,${FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED},*[tabindex]`;\n\nconst scheduler = typeof setImmediate === 'function' ? setImmediate : setTimeout;\n\nexport function getUniqueString (prefix = DEFAULT_PREFIX) {\n return `${prefix}${UNIQUE_ID_COUNTER++}`;\n}\n\n/**\n * Returns a random element from array\n * @param array - the array to return a random element from\n * @param {string} seed - use a string to seed the randomization, so it returns the same element each time\n * based on that string.\n * @returns {*} - the random element\n */\nexport function getRandomElement (array, seed) {\n if (seed) {\n const hash = javaHashCode(seed);\n return array[Math.abs(hash) % array.length];\n } else {\n return array[getRandomInt(array.length)];\n }\n}\n\n/**\n * Returns a hash code for a string.\n * (Compatible to Java's String.hashCode())\n * We use this algo to be in sync with android.\n *\n * The hash code for a string object is computed as\n * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]\n * using number arithmetic, where s[i] is the i th character\n * of the given string, n is the length of the string,\n * and ^ indicates exponentiation.\n * (The hash value of the empty string is zero.)\n *\n * @param {string} str a string\n * @return {number} a hash code value for the given string.\n */\nexport function javaHashCode (str) {\n let h;\n for (let i = 0; i < str.length; i++) {\n h = Math.imul(31, h) + str.charCodeAt(i) | 0;\n }\n\n return h;\n}\n\n/**\n * Generate a random integer\n * @param {number} max - max range of integer to generate\n * @returns {number} randomly generated integer between 0 and max\n */\nexport function getRandomInt (max) {\n return Math.floor(Math.random() * max);\n}\n\nexport function formatMessages (messages) {\n if (!messages) {\n return [];\n }\n\n return messages.map(message => {\n if (typeof message === 'string') {\n return {\n message,\n type: DEFAULT_VALIDATION_MESSAGE_TYPE,\n };\n }\n\n return message;\n });\n}\n\nexport function filterFormattedMessages (formattedMessages) {\n const validationState = getValidationState(formattedMessages);\n\n if (!formattedMessages || !validationState) {\n return [];\n }\n\n return formattedMessages.filter(message => !!message.message && message.type === validationState);\n}\n\n/*\n * The priority order of message types is as flows: 'error' > 'warning' > 'success'.\n * If any message of type 'error' is present in messages, the input state is considered\n * to be 'error', then 'warning' and lastly 'success'.\n */\nexport function getValidationState (formattedMessages) {\n if (!formattedMessages) {\n return null;\n }\n\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.ERROR)) {\n return VALIDATION_MESSAGE_TYPES.ERROR;\n }\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.WARNING)) {\n return VALIDATION_MESSAGE_TYPES.WARNING;\n }\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.SUCCESS)) {\n return VALIDATION_MESSAGE_TYPES.SUCCESS;\n }\n\n return null;\n}\n\nexport function hasFormattedMessageOfType (formattedMessages, messageType) {\n if (!formattedMessages || !messageType) {\n return false;\n }\n\n return formattedMessages.some(message => message?.type === messageType);\n}\n\nexport function findFirstFocusableNode (element) {\n return element?.querySelector(FOCUSABLE_SELECTOR);\n}\n\n/* html-fragment component:\n * To render html without wrapping in another element as when using v-html.\n * props: html\n */\nexport const htmlFragment = {\n name: 'html-fragment',\n functional: true,\n props: ['html'],\n render (h, ctx) {\n return new Vue({\n // eslint-disable-next-line vue/multi-word-component-names\n name: 'Inner',\n beforeCreate () { this.$createElement = h; },\n template: `<div>${ctx.props.html}</div>`,\n }).$mount()._vnode.children;\n },\n};\n\nexport const flushPromises = () => {\n return new Promise((resolve) => {\n scheduler(resolve);\n });\n};\n\n/**\n * Transform a string from kebab-case to PascalCase\n * @param string\n * @returns {string}\n */\nexport const kebabCaseToPascalCase = (string) => {\n return string?.toLowerCase()\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n};\n\n/**\n * Transform a string from PascalCase to kebab-case\n * @param string\n * @returns {string}\n */\nexport const pascalCaseToKebabCase = (string) => {\n return string\n .replace(/\\.?([A-Z0-9]+)/g, (x, y) => '-' + y.toLowerCase())\n .replace(/^-/, '');\n};\n\n/*\n* Set's a global timer to debounce the execution of a function.\n* @param { object } func - the function that is going to be called after timeout\n* @param { number } [timeout=300] timeout\n* */\nexport function debounce (func, timeout = 300) {\n clearTimeout(TIMER);\n TIMER = setTimeout(func, timeout);\n}\n\n/**\n * Checks if the element is out of the viewport\n * https://gomakethings.com/how-to-check-if-any-part-of-an-element-is-out-of-the-viewport-with-vanilla-js/\n * @param {HTMLElement} element The element to check\n * @return {Object} A set of booleans for each side of the element\n */\n\nexport function isOutOfViewPort (element) {\n const bounding = element.getBoundingClientRect();\n\n const isOut = {\n top: bounding.top < 0,\n left: bounding.left < 0,\n bottom: bounding.bottom > (window.innerHeight || document.documentElement.clientHeight),\n right: bounding.right > (window.innerWidth || document.documentElement.clientWidth),\n };\n isOut.any = Object.values(isOut).some(val => val);\n isOut.all = Object.values(isOut).every(val => val);\n return isOut;\n}\n\n// match valid characters for a domain name followed by a dot, e.g. \"dialpad.\"\nconst domainNameRegex = /(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)/;\n\n// match valid TLDs for a hostname (outdated list from ~2017)\nconst tldRegerx = new RegExp(\n '(?:' +\n 'com|ru|org|net|de|jp|uk|br|it|pl|fr|in|au|ir|info|nl|cn|es|cz|kr|ca|eu|ua|co|gr|' +\n 'za|ro|biz|ch|se|tw|mx|vn|hu|be|tr|at|dk|tv|me|ar|sk|no|us|fi|id|cl|xyz|io|pt|by|' +\n 'il|ie|nz|kz|hk|lt|cc|my|sg|club|bg|edu|рф|pk|su|top|th|hr|rs|pe|pro|si|az|lv|pw|' +\n 'ae|ph|online|ng|ee|ws|ve|cat' +\n ')',\n);\n\n// match valid IPv4 addresses, e.g. \"192.158.1.38\"\nconst ipv4Regex = new RegExp(\n '(?:(?:[0-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])\\\\.){3}' +\n '(?:[0-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])',\n);\n\n// match hostnames OR IPv4 addresses, e.g. \"dialpad.com\" or \"192.158.1.38\"\nconst hostnameOrIpRegex = new RegExp(\n '(?:' +\n [\n [\n domainNameRegex.source,\n tldRegerx.source,\n ].join('+'),\n ipv4Regex.source,\n ].join('|') +\n ')',\n);\n\n// match URL paths, e.g. \"/news\"\nconst urlPathRegex = /(?:(?:[;/][^#?<>\\s]*)?)/;\n\n// match URL queries and fragments, e.g. \"?cache=1&new=true\" or \"#heading1\"\nconst urlQueryOrFragmentRegex = /(?:(?:\\?[^#<>\\s]+)?(?:#[^<>\\s]+)?)/;\n\n// match complete hostnames or IPv4 addresses without a protocol and with optional\n// URL paths, queries and fragments e.g. \"dialpad.com/news?cache=1#heading1\"\nconst urlWithoutProtocolRegex = new RegExp(\n '\\\\b' +\n [\n hostnameOrIpRegex.source,\n urlPathRegex.source,\n urlQueryOrFragmentRegex.source,\n '(?!\\\\w)',\n ].join('+'),\n);\n\n// match complete hostnames with protocols and optional URL paths, queries and fragments,\n// e.g. \"ws://localhost:9010\" or \"https://dialpad.com/news?cache=1#heading1\"\nconst urlWithProtocolRegex = /\\b[a-z\\d.-]+:\\/\\/[^<>\\s]+/;\n\n// match email addresses with an optional \"mailto:\" prefix and URL queries, e.g.\n// \"hey@dialpad.com\" or \"mailto:hey@dialpad.com?subject=Hi&body=Hey%20there\"\nconst emailAddressRegex = new RegExp(\n '(?:mailto:)?' +\n '[a-z0-9!#$%&\\'*+/=?^_`{|}~-]+(?:\\\\.[a-z0-9!#$%&\\'*+/=?^_`{|}~-]+)*@' +\n [\n hostnameOrIpRegex.source,\n urlQueryOrFragmentRegex.source,\n ].join('+') +\n '(?!\\\\w)',\n);\n\n/**\n * Match phone numbers, e.g. \"765-8813\", \"(778) 765-8813\" or \"+17787658813\".\n * @param {number} minLength\n * @param {number} maxLength\n * @returns {RegExp}\n */\nexport function getPhoneNumberRegex (minLength = 7, maxLength = 15) {\n // Some older browser versions don't support lookbehind, so provide a RegExp\n // version without it. It fails just one test case, so IMO it's still good\n // enough to use. https://caniuse.com/js-regexp-lookbehind\n try {\n return new RegExp(\n '(?:^|(?<=\\\\W))' +\n '(?![\\\\s\\\\-])\\\\+?(?:[0-9()\\\\- \\\\t]' +\n `{${minLength},${maxLength}}` +\n ')(?=\\\\b)(?=\\\\W(?=\\\\W|$)|\\\\s|$)',\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('This browser doesn\\'t support regex lookahead/lookbehind');\n }\n\n return new RegExp(\n '(?![\\\\s\\\\-])\\\\+?(?:[0-9()\\\\- \\\\t]' +\n `{${minLength},${maxLength}}` +\n ')(?=\\\\b)(?=\\\\W(?=\\\\W|$)|\\\\s|$)',\n );\n}\n\nconst phoneNumberRegex = getPhoneNumberRegex();\n\n// match all link types\nexport const linkRegex = new RegExp(\n [\n urlWithoutProtocolRegex.source,\n urlWithProtocolRegex.source,\n emailAddressRegex.source,\n phoneNumberRegex.source,\n ].join('|'),\n 'gi',\n);\n\n/**\n * Check if a string is a phone number. Validates only exact matches.\n * @param {string|number} input\n * @returns {boolean}\n */\nexport function isPhoneNumber (input) {\n if (!input || (!['string', 'number'].includes(typeof input))) return false;\n input = input.toString();\n return phoneNumberRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Check if a string is an URL. Validates only exact matches.\n * @param {string} input\n * @returns {boolean}\n */\nexport function isURL (input) {\n if (!input || typeof input !== 'string') return false;\n return urlWithoutProtocolRegex.exec(input)?.[0] === input ||\n urlWithProtocolRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Check if a string is an email address. Validates only exact matches.\n * @param {string} input\n * @returns {boolean}\n */\nexport function isEmailAddress (input) {\n if (!input || typeof input !== 'string') return false;\n return emailAddressRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Concatenate a string removing null or undefined elements\n * avoiding parsing them as string with template strings\n * @param {Array} elements\n * @returns {String}\n */\nexport function safeConcatStrings (elements) {\n return elements.filter(str => !!str).join(', ');\n}\n\n/**\n * Locale safe function to capitalize the first letter of a string.\n * @param {string} str the string to capitalize the first letter of\n * @param {string} locale a string representing the locale to be used. Defaults to 'en-US'\n * @returns The passed in string with the first letter capitalized\n */\nexport function capitalizeFirstLetter (str, locale = 'en-US') {\n return str.replace(/^\\p{CWU}/u, char => char.toLocaleUpperCase(locale));\n}\n\n/**\n * Warns if the component is not mounted properly. Useful for tests.\n * @param {HTMLElement} componentRef - the component reference\n * @param {string} componentName - the component name\n */\n// eslint-disable-next-line complexity\nexport function warnIfUnmounted (componentRef, componentName) {\n if (typeof process === 'undefined') return;\n if (process.env.NODE_ENV !== 'test') return;\n if (!componentRef || !(componentRef instanceof HTMLElement) || !document?.body) return;\n if (!document.body.contains(componentRef)) {\n console.warn(`The ${componentName} component is not attached to the document body. This may cause issues.`);\n }\n}\n\n/**\n * checks whether the dt-scrollbar is being used on the root element.\n * @param rootElement {HTMLElement}\n * @returns {boolean}\n */\nfunction isDtScrollbarInUse (rootElement = document.documentElement) {\n if (rootElement.hasAttribute('data-overlayscrollbars')) {\n return true;\n }\n return false;\n}\n\n/**\n * This will disable scrolling on the root element regardless of whether you are using dt-scrollbar or not.\n * @param rootElement {HTMLElement}\n */\nexport function disableRootScrolling (rootElement = document.documentElement) {\n if (isDtScrollbarInUse(rootElement)) {\n rootElement.classList.add('d-scrollbar-disabled');\n } else {\n rootElement.classList.add('d-of-hidden');\n }\n}\n\n/**\n * This will enable scrolling on the root element regardless of whether you are using dt-scrollbar or not.\n * @param rootElement {HTMLElement}\n */\nexport function enableRootScrolling (rootElement = document.documentElement) {\n if (isDtScrollbarInUse(rootElement)) {\n rootElement.classList.remove('d-scrollbar-disabled');\n } else {\n rootElement.classList.remove('d-of-hidden');\n }\n}\n\n/**\n * This will take a text string e.g \"accessibility-mac\"\n * and convert it to our Fluent Key standard format \"ACCESSIBILITY_MAC\"\n * @param text\n * @returns {string}\n */\nexport function toFluentKeyString (text) {\n return text\n .replaceAll(/[ -]/g, '_')\n .replaceAll(/\\W/g, '')\n .toUpperCase();\n}\n\nexport default {\n getUniqueString,\n getRandomElement,\n getRandomInt,\n formatMessages,\n filterFormattedMessages,\n hasFormattedMessageOfType,\n getValidationState,\n htmlFragment,\n flushPromises,\n kebabCaseToPascalCase,\n debounce,\n isOutOfViewPort,\n getPhoneNumberRegex,\n linkRegex,\n isEmailAddress,\n isPhoneNumber,\n isURL,\n safeConcatStrings,\n capitalizeFirstLetter,\n disableRootScrolling,\n enableRootScrolling,\n};\n"],"names":["UNIQUE_ID_COUNTER","TIMER","FOCUSABLE_SELECTOR_NOT_HIDDEN","FOCUSABLE_SELECTOR_NOT_DISABLED","FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED","FOCUSABLE_SELECTOR","scheduler","getUniqueString","prefix","DEFAULT_PREFIX","getRandomElement","array","seed","hash","javaHashCode","getRandomInt","str","h","i","max","formatMessages","messages","message","DEFAULT_VALIDATION_MESSAGE_TYPE","filterFormattedMessages","formattedMessages","validationState","getValidationState","hasFormattedMessageOfType","VALIDATION_MESSAGE_TYPES","messageType","findFirstFocusableNode","element","htmlFragment","ctx","Vue","flushPromises","resolve","kebabCaseToPascalCase","string","word","pascalCaseToKebabCase","x","y","debounce","func","timeout","isOutOfViewPort","bounding","isOut","val","domainNameRegex","tldRegerx","ipv4Regex","hostnameOrIpRegex","urlPathRegex","urlQueryOrFragmentRegex","urlWithoutProtocolRegex","urlWithProtocolRegex","emailAddressRegex","getPhoneNumberRegex","minLength","maxLength","phoneNumberRegex","linkRegex","isPhoneNumber","input","_a","isURL","_b","isEmailAddress","safeConcatStrings","elements","capitalizeFirstLetter","locale","char","warnIfUnmounted","componentRef","componentName","isDtScrollbarInUse","rootElement","disableRootScrolling","enableRootScrolling","toFluentKeyString","text","utils"],"mappings":"uKAOA,IAAIA,EAAoB,EACpBC,EAGJ,MAAMC,EAAgC,0CAEhCC,EAAkC,sEAElCC,EAAyC,GAAGF,CAA6B,IAAIC,CAA+B,GAE5GE,EAAqB,kBAAkBD,CAAsC,eAE7EE,EAAY,OAAO,cAAiB,WAAa,aAAe,WAE/D,SAASC,EAAiBC,EAASC,iBAAgB,CACxD,MAAO,GAAGD,CAAM,GAAGR,GAAmB,EACxC,CASO,SAASU,EAAkBC,EAAOC,EAAM,CAC7C,GAAIA,EAAM,CACR,MAAMC,EAAOC,EAAaF,CAAI,EAC9B,OAAOD,EAAM,KAAK,IAAIE,CAAI,EAAIF,EAAM,MAAM,CAC9C,KACI,QAAOA,EAAMI,EAAaJ,EAAM,MAAM,CAAC,CAE3C,CAiBO,SAASG,EAAcE,EAAK,CACjC,IAAIC,EACJ,QAASC,EAAI,EAAGA,EAAIF,EAAI,OAAQE,IAC9BD,EAAI,KAAK,KAAK,GAAIA,CAAC,EAAID,EAAI,WAAWE,CAAC,EAAI,EAG7C,OAAOD,CACT,CAOO,SAASF,EAAcI,EAAK,CACjC,OAAO,KAAK,MAAM,KAAK,OAAQ,EAAGA,CAAG,CACvC,CAEO,SAASC,EAAgBC,EAAU,CACxC,OAAKA,EAIEA,EAAS,IAAIC,GACd,OAAOA,GAAY,SACd,CACL,QAAAA,EACA,KAAMC,EAA+B,+BAC7C,EAGWD,CACR,EAZQ,EAaX,CAEO,SAASE,EAAyBC,EAAmB,CAC1D,MAAMC,EAAkBC,EAAmBF,CAAiB,EAE5D,MAAI,CAACA,GAAqB,CAACC,EAClB,GAGFD,EAAkB,OAAOH,GAAW,CAAC,CAACA,EAAQ,SAAWA,EAAQ,OAASI,CAAe,CAClG,CAO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nDA,EAAY,UAAU,OAAO,aAAa,CAE9C,CAQO,SAASG,EAAmBC,EAAM,CACvC,OAAOA,EACJ,WAAW,QAAS,GAAG,EACvB,WAAW,MAAO,EAAE,EACpB,aACL,CAEA,MAAeC,EAAA,CACb,gBAAA9E,EACA,iBAAAG,EACA,aAAAK,EACA,eAAAK,EACA,wBAAAI,EACA,0BAAAI,EACA,mBAAAD,EACA,aAAAM,EACA,cAAAG,EACA,sBAAAE,EACA,SAAAM,EACA,gBAAAG,EACA,oBAAAa,EACA,UAAAI,EACA,eAAAM,EACA,cAAAL,EACA,MAAAG,EACA,kBAAAG,EACA,sBAAAE,EACA,qBAAAQ,EACA,oBAAAC,CACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DEFAULT_PREFIX as
|
|
2
|
-
import
|
|
1
|
+
import { DEFAULT_PREFIX as E, DEFAULT_VALIDATION_MESSAGE_TYPE as g, VALIDATION_MESSAGE_TYPES as o } from "../constants/index.js";
|
|
2
|
+
import R from "vue";
|
|
3
3
|
let S = 0, c;
|
|
4
|
-
const x = "input:not([type=hidden]):not(:disabled)", C = "select:not(:disabled),textarea:not(:disabled),button:not(:disabled)", w = `${x},${C}`, O = `a,frame,iframe,${w},*[tabindex]`,
|
|
5
|
-
function
|
|
4
|
+
const x = "input:not([type=hidden]):not(:disabled)", C = "select:not(:disabled),textarea:not(:disabled),button:not(:disabled)", w = `${x},${C}`, O = `a,frame,iframe,${w},*[tabindex]`, _ = typeof setImmediate == "function" ? setImmediate : setTimeout;
|
|
5
|
+
function A(e = E) {
|
|
6
6
|
return `${e}${S++}`;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function T(e, t) {
|
|
9
9
|
if (t) {
|
|
10
10
|
const n = L(t);
|
|
11
11
|
return e[Math.abs(n) % e.length];
|
|
@@ -21,13 +21,13 @@ function L(e) {
|
|
|
21
21
|
function s(e) {
|
|
22
22
|
return Math.floor(Math.random() * e);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function y(e) {
|
|
25
25
|
return e ? e.map((t) => typeof t == "string" ? {
|
|
26
26
|
message: t,
|
|
27
|
-
type:
|
|
27
|
+
type: g
|
|
28
28
|
} : t) : [];
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function I(e) {
|
|
31
31
|
const t = u(e);
|
|
32
32
|
return !e || !t ? [] : e.filter((n) => !!n.message && n.type === t);
|
|
33
33
|
}
|
|
@@ -37,7 +37,7 @@ function u(e) {
|
|
|
37
37
|
function r(e, t) {
|
|
38
38
|
return !e || !t ? !1 : e.some((n) => (n == null ? void 0 : n.type) === t);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Y(e) {
|
|
41
41
|
return e == null ? void 0 : e.querySelector(O);
|
|
42
42
|
}
|
|
43
43
|
const N = {
|
|
@@ -45,7 +45,7 @@ const N = {
|
|
|
45
45
|
functional: !0,
|
|
46
46
|
props: ["html"],
|
|
47
47
|
render(e, t) {
|
|
48
|
-
return new
|
|
48
|
+
return new R({
|
|
49
49
|
// eslint-disable-next-line vue/multi-word-component-names
|
|
50
50
|
name: "Inner",
|
|
51
51
|
beforeCreate() {
|
|
@@ -54,9 +54,9 @@ const N = {
|
|
|
54
54
|
template: `<div>${t.props.html}</div>`
|
|
55
55
|
}).$mount()._vnode.children;
|
|
56
56
|
}
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
}),
|
|
57
|
+
}, U = () => new Promise((e) => {
|
|
58
|
+
_(e);
|
|
59
|
+
}), $ = (e) => e == null ? void 0 : e.toLowerCase().split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(""), X = (e) => e.replace(/\.?([A-Z0-9]+)/g, (t, n) => "-" + n.toLowerCase()).replace(/^-/, "");
|
|
60
60
|
function v(e, t = 300) {
|
|
61
61
|
clearTimeout(c), c = setTimeout(e, t);
|
|
62
62
|
}
|
|
@@ -69,17 +69,17 @@ function D(e) {
|
|
|
69
69
|
};
|
|
70
70
|
return n.any = Object.values(n).some((i) => i), n.all = Object.values(n).every((i) => i), n;
|
|
71
71
|
}
|
|
72
|
-
const F = /(?:(?:[^\s!@#$%^&*()_=+[\]{}\\|;:'",.<>/?]+)\.)/,
|
|
72
|
+
const F = /(?:(?:[^\s!@#$%^&*()_=+[\]{}\\|;:'",.<>/?]+)\.)/, W = new RegExp(
|
|
73
73
|
"(?:com|ru|org|net|de|jp|uk|br|it|pl|fr|in|au|ir|info|nl|cn|es|cz|kr|ca|eu|ua|co|gr|za|ro|biz|ch|se|tw|mx|vn|hu|be|tr|at|dk|tv|me|ar|sk|no|us|fi|id|cl|xyz|io|pt|by|il|ie|nz|kz|hk|lt|cc|my|sg|club|bg|edu|рф|pk|su|top|th|hr|rs|pe|pro|si|az|lv|pw|ae|ph|online|ng|ee|ws|ve|cat)"
|
|
74
|
-
),
|
|
74
|
+
), P = new RegExp(
|
|
75
75
|
"(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])"
|
|
76
76
|
), l = new RegExp(
|
|
77
77
|
"(?:" + [
|
|
78
78
|
[
|
|
79
79
|
F.source,
|
|
80
|
-
|
|
80
|
+
W.source
|
|
81
81
|
].join("+"),
|
|
82
|
-
|
|
82
|
+
P.source
|
|
83
83
|
].join("|") + ")"
|
|
84
84
|
), j = /(?:(?:[;/][^#?<>\s]*)?)/, a = /(?:(?:\?[^#<>\s]+)?(?:#[^<>\s]+)?)/, d = new RegExp(
|
|
85
85
|
"\\b" + [
|
|
@@ -106,18 +106,18 @@ function h(e = 7, t = 15) {
|
|
|
106
106
|
`(?![\\s\\-])\\+?(?:[0-9()\\- \\t]{${e},${t}})(?=\\b)(?=\\W(?=\\W|$)|\\s|$)`
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
|
-
const
|
|
109
|
+
const p = h(), k = new RegExp(
|
|
110
110
|
[
|
|
111
111
|
d.source,
|
|
112
112
|
f.source,
|
|
113
113
|
m.source,
|
|
114
|
-
|
|
114
|
+
p.source
|
|
115
115
|
].join("|"),
|
|
116
116
|
"gi"
|
|
117
117
|
);
|
|
118
118
|
function z(e) {
|
|
119
119
|
var t;
|
|
120
|
-
return !e || !["string", "number"].includes(typeof e) ? !1 : (e = e.toString(), ((t =
|
|
120
|
+
return !e || !["string", "number"].includes(typeof e) ? !1 : (e = e.toString(), ((t = p.exec(e)) == null ? void 0 : t[0]) === e);
|
|
121
121
|
}
|
|
122
122
|
function B(e) {
|
|
123
123
|
var t, n;
|
|
@@ -128,7 +128,7 @@ function H(e) {
|
|
|
128
128
|
return !e || typeof e != "string" ? !1 : ((t = m.exec(e)) == null ? void 0 : t[0]) === e;
|
|
129
129
|
}
|
|
130
130
|
function V(e) {
|
|
131
|
-
return e.filter((t) => !!t).join(" ");
|
|
131
|
+
return e.filter((t) => !!t).join(", ");
|
|
132
132
|
}
|
|
133
133
|
function M(e, t = "en-US") {
|
|
134
134
|
return e.replace(new RegExp("^\\p{CWU}", "u"), (n) => n.toLocaleUpperCase(t));
|
|
@@ -136,26 +136,29 @@ function M(e, t = "en-US") {
|
|
|
136
136
|
function Z(e, t) {
|
|
137
137
|
typeof process > "u" || process.env.NODE_ENV === "test" && (!e || !(e instanceof HTMLElement) || !(document != null && document.body) || document.body.contains(e) || console.warn(`The ${t} component is not attached to the document body. This may cause issues.`));
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function b(e = document.documentElement) {
|
|
140
140
|
return !!e.hasAttribute("data-overlayscrollbars");
|
|
141
141
|
}
|
|
142
142
|
function G(e = document.documentElement) {
|
|
143
|
-
|
|
143
|
+
b(e) ? e.classList.add("d-scrollbar-disabled") : e.classList.add("d-of-hidden");
|
|
144
144
|
}
|
|
145
145
|
function q(e = document.documentElement) {
|
|
146
|
-
|
|
146
|
+
b(e) ? e.classList.remove("d-scrollbar-disabled") : e.classList.remove("d-of-hidden");
|
|
147
|
+
}
|
|
148
|
+
function J(e) {
|
|
149
|
+
return e.replaceAll(/[ -]/g, "_").replaceAll(/\W/g, "").toUpperCase();
|
|
147
150
|
}
|
|
148
|
-
const
|
|
149
|
-
getUniqueString:
|
|
150
|
-
getRandomElement:
|
|
151
|
+
const ee = {
|
|
152
|
+
getUniqueString: A,
|
|
153
|
+
getRandomElement: T,
|
|
151
154
|
getRandomInt: s,
|
|
152
|
-
formatMessages:
|
|
153
|
-
filterFormattedMessages:
|
|
155
|
+
formatMessages: y,
|
|
156
|
+
filterFormattedMessages: I,
|
|
154
157
|
hasFormattedMessageOfType: r,
|
|
155
158
|
getValidationState: u,
|
|
156
159
|
htmlFragment: N,
|
|
157
|
-
flushPromises:
|
|
158
|
-
kebabCaseToPascalCase:
|
|
160
|
+
flushPromises: U,
|
|
161
|
+
kebabCaseToPascalCase: $,
|
|
159
162
|
debounce: v,
|
|
160
163
|
isOutOfViewPort: D,
|
|
161
164
|
getPhoneNumberRegex: h,
|
|
@@ -171,17 +174,17 @@ const J = {
|
|
|
171
174
|
export {
|
|
172
175
|
M as capitalizeFirstLetter,
|
|
173
176
|
v as debounce,
|
|
174
|
-
|
|
177
|
+
ee as default,
|
|
175
178
|
G as disableRootScrolling,
|
|
176
179
|
q as enableRootScrolling,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
I as filterFormattedMessages,
|
|
181
|
+
Y as findFirstFocusableNode,
|
|
182
|
+
U as flushPromises,
|
|
183
|
+
y as formatMessages,
|
|
181
184
|
h as getPhoneNumberRegex,
|
|
182
|
-
|
|
185
|
+
T as getRandomElement,
|
|
183
186
|
s as getRandomInt,
|
|
184
|
-
|
|
187
|
+
A as getUniqueString,
|
|
185
188
|
u as getValidationState,
|
|
186
189
|
r as hasFormattedMessageOfType,
|
|
187
190
|
N as htmlFragment,
|
|
@@ -190,10 +193,11 @@ export {
|
|
|
190
193
|
z as isPhoneNumber,
|
|
191
194
|
B as isURL,
|
|
192
195
|
L as javaHashCode,
|
|
193
|
-
|
|
196
|
+
$ as kebabCaseToPascalCase,
|
|
194
197
|
k as linkRegex,
|
|
195
198
|
X as pascalCaseToKebabCase,
|
|
196
199
|
V as safeConcatStrings,
|
|
200
|
+
J as toFluentKeyString,
|
|
197
201
|
Z as warnIfUnmounted
|
|
198
202
|
};
|
|
199
203
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../common/utils/index.js"],"sourcesContent":["import {\n DEFAULT_PREFIX,\n DEFAULT_VALIDATION_MESSAGE_TYPE,\n VALIDATION_MESSAGE_TYPES,\n} from '../constants';\nimport Vue from 'vue';\n\nlet UNIQUE_ID_COUNTER = 0;\nlet TIMER;\n\n// selector to find focusable not hidden inputs\nconst FOCUSABLE_SELECTOR_NOT_HIDDEN = 'input:not([type=hidden]):not(:disabled)';\n// selector to find focusable not disables elements\nconst FOCUSABLE_SELECTOR_NOT_DISABLED = 'select:not(:disabled),textarea:not(:disabled),button:not(:disabled)';\n// // selector to find focusable not hidden and disabled elements\nconst FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED = `${FOCUSABLE_SELECTOR_NOT_HIDDEN},${FOCUSABLE_SELECTOR_NOT_DISABLED}`;\n// selector to find focusable elements\nconst FOCUSABLE_SELECTOR = `a,frame,iframe,${FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED},*[tabindex]`;\n\nconst scheduler = typeof setImmediate === 'function' ? setImmediate : setTimeout;\n\nexport function getUniqueString (prefix = DEFAULT_PREFIX) {\n return `${prefix}${UNIQUE_ID_COUNTER++}`;\n}\n\n/**\n * Returns a random element from array\n * @param array - the array to return a random element from\n * @param {string} seed - use a string to seed the randomization, so it returns the same element each time\n * based on that string.\n * @returns {*} - the random element\n */\nexport function getRandomElement (array, seed) {\n if (seed) {\n const hash = javaHashCode(seed);\n return array[Math.abs(hash) % array.length];\n } else {\n return array[getRandomInt(array.length)];\n }\n}\n\n/**\n * Returns a hash code for a string.\n * (Compatible to Java's String.hashCode())\n * We use this algo to be in sync with android.\n *\n * The hash code for a string object is computed as\n * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]\n * using number arithmetic, where s[i] is the i th character\n * of the given string, n is the length of the string,\n * and ^ indicates exponentiation.\n * (The hash value of the empty string is zero.)\n *\n * @param {string} str a string\n * @return {number} a hash code value for the given string.\n */\nexport function javaHashCode (str) {\n let h;\n for (let i = 0; i < str.length; i++) {\n h = Math.imul(31, h) + str.charCodeAt(i) | 0;\n }\n\n return h;\n}\n\n/**\n * Generate a random integer\n * @param {number} max - max range of integer to generate\n * @returns {number} randomly generated integer between 0 and max\n */\nexport function getRandomInt (max) {\n return Math.floor(Math.random() * max);\n}\n\nexport function formatMessages (messages) {\n if (!messages) {\n return [];\n }\n\n return messages.map(message => {\n if (typeof message === 'string') {\n return {\n message,\n type: DEFAULT_VALIDATION_MESSAGE_TYPE,\n };\n }\n\n return message;\n });\n}\n\nexport function filterFormattedMessages (formattedMessages) {\n const validationState = getValidationState(formattedMessages);\n\n if (!formattedMessages || !validationState) {\n return [];\n }\n\n return formattedMessages.filter(message => !!message.message && message.type === validationState);\n}\n\n/*\n * The priority order of message types is as flows: 'error' > 'warning' > 'success'.\n * If any message of type 'error' is present in messages, the input state is considered\n * to be 'error', then 'warning' and lastly 'success'.\n */\nexport function getValidationState (formattedMessages) {\n if (!formattedMessages) {\n return null;\n }\n\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.ERROR)) {\n return VALIDATION_MESSAGE_TYPES.ERROR;\n }\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.WARNING)) {\n return VALIDATION_MESSAGE_TYPES.WARNING;\n }\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.SUCCESS)) {\n return VALIDATION_MESSAGE_TYPES.SUCCESS;\n }\n\n return null;\n}\n\nexport function hasFormattedMessageOfType (formattedMessages, messageType) {\n if (!formattedMessages || !messageType) {\n return false;\n }\n\n return formattedMessages.some(message => message?.type === messageType);\n}\n\nexport function findFirstFocusableNode (element) {\n return element?.querySelector(FOCUSABLE_SELECTOR);\n}\n\n/* html-fragment component:\n * To render html without wrapping in another element as when using v-html.\n * props: html\n */\nexport const htmlFragment = {\n name: 'html-fragment',\n functional: true,\n props: ['html'],\n render (h, ctx) {\n return new Vue({\n // eslint-disable-next-line vue/multi-word-component-names\n name: 'Inner',\n beforeCreate () { this.$createElement = h; },\n template: `<div>${ctx.props.html}</div>`,\n }).$mount()._vnode.children;\n },\n};\n\nexport const flushPromises = () => {\n return new Promise((resolve) => {\n scheduler(resolve);\n });\n};\n\n/**\n * Transform a string from kebab-case to PascalCase\n * @param string\n * @returns {string}\n */\nexport const kebabCaseToPascalCase = (string) => {\n return string?.toLowerCase()\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n};\n\n/**\n * Transform a string from PascalCase to kebab-case\n * @param string\n * @returns {string}\n */\nexport const pascalCaseToKebabCase = (string) => {\n return string\n .replace(/\\.?([A-Z0-9]+)/g, (x, y) => '-' + y.toLowerCase())\n .replace(/^-/, '');\n};\n\n/*\n* Set's a global timer to debounce the execution of a function.\n* @param { object } func - the function that is going to be called after timeout\n* @param { number } [timeout=300] timeout\n* */\nexport function debounce (func, timeout = 300) {\n clearTimeout(TIMER);\n TIMER = setTimeout(func, timeout);\n}\n\n/**\n * Checks if the element is out of the viewport\n * https://gomakethings.com/how-to-check-if-any-part-of-an-element-is-out-of-the-viewport-with-vanilla-js/\n * @param {HTMLElement} element The element to check\n * @return {Object} A set of booleans for each side of the element\n */\n\nexport function isOutOfViewPort (element) {\n const bounding = element.getBoundingClientRect();\n\n const isOut = {\n top: bounding.top < 0,\n left: bounding.left < 0,\n bottom: bounding.bottom > (window.innerHeight || document.documentElement.clientHeight),\n right: bounding.right > (window.innerWidth || document.documentElement.clientWidth),\n };\n isOut.any = Object.values(isOut).some(val => val);\n isOut.all = Object.values(isOut).every(val => val);\n return isOut;\n}\n\n// match valid characters for a domain name followed by a dot, e.g. \"dialpad.\"\nconst domainNameRegex = /(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)/;\n\n// match valid TLDs for a hostname (outdated list from ~2017)\nconst tldRegerx = new RegExp(\n '(?:' +\n 'com|ru|org|net|de|jp|uk|br|it|pl|fr|in|au|ir|info|nl|cn|es|cz|kr|ca|eu|ua|co|gr|' +\n 'za|ro|biz|ch|se|tw|mx|vn|hu|be|tr|at|dk|tv|me|ar|sk|no|us|fi|id|cl|xyz|io|pt|by|' +\n 'il|ie|nz|kz|hk|lt|cc|my|sg|club|bg|edu|рф|pk|su|top|th|hr|rs|pe|pro|si|az|lv|pw|' +\n 'ae|ph|online|ng|ee|ws|ve|cat' +\n ')',\n);\n\n// match valid IPv4 addresses, e.g. \"192.158.1.38\"\nconst ipv4Regex = new RegExp(\n '(?:(?:[0-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])\\\\.){3}' +\n '(?:[0-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])',\n);\n\n// match hostnames OR IPv4 addresses, e.g. \"dialpad.com\" or \"192.158.1.38\"\nconst hostnameOrIpRegex = new RegExp(\n '(?:' +\n [\n [\n domainNameRegex.source,\n tldRegerx.source,\n ].join('+'),\n ipv4Regex.source,\n ].join('|') +\n ')',\n);\n\n// match URL paths, e.g. \"/news\"\nconst urlPathRegex = /(?:(?:[;/][^#?<>\\s]*)?)/;\n\n// match URL queries and fragments, e.g. \"?cache=1&new=true\" or \"#heading1\"\nconst urlQueryOrFragmentRegex = /(?:(?:\\?[^#<>\\s]+)?(?:#[^<>\\s]+)?)/;\n\n// match complete hostnames or IPv4 addresses without a protocol and with optional\n// URL paths, queries and fragments e.g. \"dialpad.com/news?cache=1#heading1\"\nconst urlWithoutProtocolRegex = new RegExp(\n '\\\\b' +\n [\n hostnameOrIpRegex.source,\n urlPathRegex.source,\n urlQueryOrFragmentRegex.source,\n '(?!\\\\w)',\n ].join('+'),\n);\n\n// match complete hostnames with protocols and optional URL paths, queries and fragments,\n// e.g. \"ws://localhost:9010\" or \"https://dialpad.com/news?cache=1#heading1\"\nconst urlWithProtocolRegex = /\\b[a-z\\d.-]+:\\/\\/[^<>\\s]+/;\n\n// match email addresses with an optional \"mailto:\" prefix and URL queries, e.g.\n// \"hey@dialpad.com\" or \"mailto:hey@dialpad.com?subject=Hi&body=Hey%20there\"\nconst emailAddressRegex = new RegExp(\n '(?:mailto:)?' +\n '[a-z0-9!#$%&\\'*+/=?^_`{|}~-]+(?:\\\\.[a-z0-9!#$%&\\'*+/=?^_`{|}~-]+)*@' +\n [\n hostnameOrIpRegex.source,\n urlQueryOrFragmentRegex.source,\n ].join('+') +\n '(?!\\\\w)',\n);\n\n/**\n * Match phone numbers, e.g. \"765-8813\", \"(778) 765-8813\" or \"+17787658813\".\n * @param {number} minLength\n * @param {number} maxLength\n * @returns {RegExp}\n */\nexport function getPhoneNumberRegex (minLength = 7, maxLength = 15) {\n // Some older browser versions don't support lookbehind, so provide a RegExp\n // version without it. It fails just one test case, so IMO it's still good\n // enough to use. https://caniuse.com/js-regexp-lookbehind\n try {\n return new RegExp(\n '(?:^|(?<=\\\\W))' +\n '(?![\\\\s\\\\-])\\\\+?(?:[0-9()\\\\- \\\\t]' +\n `{${minLength},${maxLength}}` +\n ')(?=\\\\b)(?=\\\\W(?=\\\\W|$)|\\\\s|$)',\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('This browser doesn\\'t support regex lookahead/lookbehind');\n }\n\n return new RegExp(\n '(?![\\\\s\\\\-])\\\\+?(?:[0-9()\\\\- \\\\t]' +\n `{${minLength},${maxLength}}` +\n ')(?=\\\\b)(?=\\\\W(?=\\\\W|$)|\\\\s|$)',\n );\n}\n\nconst phoneNumberRegex = getPhoneNumberRegex();\n\n// match all link types\nexport const linkRegex = new RegExp(\n [\n urlWithoutProtocolRegex.source,\n urlWithProtocolRegex.source,\n emailAddressRegex.source,\n phoneNumberRegex.source,\n ].join('|'),\n 'gi',\n);\n\n/**\n * Check if a string is a phone number. Validates only exact matches.\n * @param {string|number} input\n * @returns {boolean}\n */\nexport function isPhoneNumber (input) {\n if (!input || (!['string', 'number'].includes(typeof input))) return false;\n input = input.toString();\n return phoneNumberRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Check if a string is an URL. Validates only exact matches.\n * @param {string} input\n * @returns {boolean}\n */\nexport function isURL (input) {\n if (!input || typeof input !== 'string') return false;\n return urlWithoutProtocolRegex.exec(input)?.[0] === input ||\n urlWithProtocolRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Check if a string is an email address. Validates only exact matches.\n * @param {string} input\n * @returns {boolean}\n */\nexport function isEmailAddress (input) {\n if (!input || typeof input !== 'string') return false;\n return emailAddressRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Concatenate a string removing null or undefined elements\n * avoiding parsing them as string with template strings\n * @param {Array} elements\n * @returns {String}\n */\nexport function safeConcatStrings (elements) {\n return elements.filter(str => !!str).join(' ');\n}\n\n/**\n * Locale safe function to capitalize the first letter of a string.\n * @param {string} str the string to capitalize the first letter of\n * @param {string} locale a string representing the locale to be used. Defaults to 'en-US'\n * @returns The passed in string with the first letter capitalized\n */\nexport function capitalizeFirstLetter (str, locale = 'en-US') {\n return str.replace(/^\\p{CWU}/u, char => char.toLocaleUpperCase(locale));\n}\n\n/**\n * Warns if the component is not mounted properly. Useful for tests.\n * @param {HTMLElement} componentRef - the component reference\n * @param {string} componentName - the component name\n */\n// eslint-disable-next-line complexity\nexport function warnIfUnmounted (componentRef, componentName) {\n if (typeof process === 'undefined') return;\n if (process.env.NODE_ENV !== 'test') return;\n if (!componentRef || !(componentRef instanceof HTMLElement) || !document?.body) return;\n if (!document.body.contains(componentRef)) {\n console.warn(`The ${componentName} component is not attached to the document body. This may cause issues.`);\n }\n}\n\n/**\n * checks whether the dt-scrollbar is being used on the root element.\n * @param rootElement {HTMLElement}\n * @returns {boolean}\n */\nfunction isDtScrollbarInUse (rootElement = document.documentElement) {\n if (rootElement.hasAttribute('data-overlayscrollbars')) {\n return true;\n }\n return false;\n}\n\n/**\n * This will disable scrolling on the root element regardless of whether you are using dt-scrollbar or not.\n * @param rootElement {HTMLElement}\n */\nexport function disableRootScrolling (rootElement = document.documentElement) {\n if (isDtScrollbarInUse(rootElement)) {\n rootElement.classList.add('d-scrollbar-disabled');\n } else {\n rootElement.classList.add('d-of-hidden');\n }\n}\n\n/**\n * This will enable scrolling on the root element regardless of whether you are using dt-scrollbar or not.\n * @param rootElement {HTMLElement}\n */\nexport function enableRootScrolling (rootElement = document.documentElement) {\n if (isDtScrollbarInUse(rootElement)) {\n rootElement.classList.remove('d-scrollbar-disabled');\n } else {\n rootElement.classList.remove('d-of-hidden');\n }\n}\n\nexport default {\n getUniqueString,\n getRandomElement,\n getRandomInt,\n formatMessages,\n filterFormattedMessages,\n hasFormattedMessageOfType,\n getValidationState,\n htmlFragment,\n flushPromises,\n kebabCaseToPascalCase,\n debounce,\n isOutOfViewPort,\n getPhoneNumberRegex,\n linkRegex,\n isEmailAddress,\n isPhoneNumber,\n isURL,\n safeConcatStrings,\n capitalizeFirstLetter,\n disableRootScrolling,\n enableRootScrolling,\n};\n"],"names":["UNIQUE_ID_COUNTER","TIMER","FOCUSABLE_SELECTOR_NOT_HIDDEN","FOCUSABLE_SELECTOR_NOT_DISABLED","FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED","FOCUSABLE_SELECTOR","scheduler","getUniqueString","prefix","DEFAULT_PREFIX","getRandomElement","array","seed","hash","javaHashCode","getRandomInt","str","h","i","max","formatMessages","messages","message","DEFAULT_VALIDATION_MESSAGE_TYPE","filterFormattedMessages","formattedMessages","validationState","getValidationState","hasFormattedMessageOfType","VALIDATION_MESSAGE_TYPES","messageType","findFirstFocusableNode","element","htmlFragment","ctx","Vue","flushPromises","resolve","kebabCaseToPascalCase","string","word","pascalCaseToKebabCase","x","y","debounce","func","timeout","isOutOfViewPort","bounding","isOut","val","domainNameRegex","tldRegerx","ipv4Regex","hostnameOrIpRegex","urlPathRegex","urlQueryOrFragmentRegex","urlWithoutProtocolRegex","urlWithProtocolRegex","emailAddressRegex","getPhoneNumberRegex","minLength","maxLength","phoneNumberRegex","linkRegex","isPhoneNumber","input","_a","isURL","_b","isEmailAddress","safeConcatStrings","elements","capitalizeFirstLetter","locale","char","warnIfUnmounted","componentRef","componentName","isDtScrollbarInUse","rootElement","disableRootScrolling","enableRootScrolling","utils"],"mappings":";;AAOA,IAAIA,IAAoB,GACpBC;AAGJ,MAAMC,IAAgC,2CAEhCC,IAAkC,uEAElCC,IAAyC,GAAGF,CAA6B,IAAIC,CAA+B,IAE5GE,IAAqB,kBAAkBD,CAAsC,gBAE7EE,IAAY,OAAO,gBAAiB,aAAa,eAAe;AAE/D,SAASC,EAAiBC,IAASC,GAAgB;AACxD,SAAO,GAAGD,CAAM,GAAGR,GAAmB;AACxC;AASO,SAASU,EAAkBC,GAAOC,GAAM;AAC7C,MAAIA,GAAM;AACR,UAAMC,IAAOC,EAAaF,CAAI;AAC9B,WAAOD,EAAM,KAAK,IAAIE,CAAI,IAAIF,EAAM,MAAM;AAAA,EAC9C;AACI,WAAOA,EAAMI,EAAaJ,EAAM,MAAM,CAAC;AAE3C;AAiBO,SAASG,EAAcE,GAAK;AACjC,MAAIC;AACJ,WAASC,IAAI,GAAGA,IAAIF,EAAI,QAAQE;AAC9B,IAAAD,IAAI,KAAK,KAAK,IAAIA,CAAC,IAAID,EAAI,WAAWE,CAAC,IAAI;AAG7C,SAAOD;AACT;AAOO,SAASF,EAAcI,GAAK;AACjC,SAAO,KAAK,MAAM,KAAK,OAAQ,IAAGA,CAAG;AACvC;AAEO,SAASC,EAAgBC,GAAU;AACxC,SAAKA,IAIEA,EAAS,IAAI,CAAAC,MACd,OAAOA,KAAY,WACd;AAAA,IACL,SAAAA;AAAA,IACA,MAAMC;AAAA,EACd,IAGWD,C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,EAAiBC,GAAcC,GAAe;AAC5D,EAAI,OAAO,UAAY,OACnB,QAAQ,IAAI,aAAa,WACzB,CAACD,KAAgB,EAAEA,aAAwB,gBAAgB,EAAC,6BAAU,SACrE,SAAS,KAAK,SAASA,CAAY,KACtC,QAAQ,KAAK,OAAOC,CAAa,yEAAyE;AAE9G;AAOA,SAASC,EAAoBC,IAAc,SAAS,iBAAiB;AACnE,SAAI,EAAAA,EAAY,aAAa,wBAAwB;AAIvD;AAMO,SAASC,EAAsBD,IAAc,SAAS,iBAAiB;AAC5E,EAAID,EAAmBC,CAAW,IAChCA,EAAY,UAAU,IAAI,sBAAsB,IAEhDA,EAAY,UAAU,IAAI,aAAa;AAE3C;AAMO,SAASE,EAAqBF,IAAc,SAAS,iBAAiB;AAC3E,EAAID,EAAmBC,CAAW,IAChCA,EAAY,UAAU,OAAO,sBAAsB,IAEnDA,EAAY,UAAU,OAAO,aAAa;AAE9C;AAEA,MAAeG,IAAA;AAAA,EACb,iBAAA5E;AAAA,EACA,kBAAAG;AAAA,EACA,cAAAK;AAAA,EACA,gBAAAK;AAAA,EACA,yBAAAI;AAAA,EACA,2BAAAI;AAAA,EACA,oBAAAD;AAAA,EACA,cAAAM;AAAA,EACA,eAAAG;AAAA,EACA,uBAAAE;AAAA,EACA,UAAAM;AAAA,EACA,iBAAAG;AAAA,EACA,qBAAAa;AAAA,EACA,WAAAI;AAAA,EACA,gBAAAM;AAAA,EACA,eAAAL;AAAA,EACA,OAAAG;AAAA,EACA,mBAAAG;AAAA,EACA,uBAAAE;AAAA,EACA,sBAAAQ;AAAA,EACA,qBAAAC;AACF;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../common/utils/index.js"],"sourcesContent":["import {\n DEFAULT_PREFIX,\n DEFAULT_VALIDATION_MESSAGE_TYPE,\n VALIDATION_MESSAGE_TYPES,\n} from '../constants/index.js';\nimport Vue from 'vue';\n\nlet UNIQUE_ID_COUNTER = 0;\nlet TIMER;\n\n// selector to find focusable not hidden inputs\nconst FOCUSABLE_SELECTOR_NOT_HIDDEN = 'input:not([type=hidden]):not(:disabled)';\n// selector to find focusable not disables elements\nconst FOCUSABLE_SELECTOR_NOT_DISABLED = 'select:not(:disabled),textarea:not(:disabled),button:not(:disabled)';\n// // selector to find focusable not hidden and disabled elements\nconst FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED = `${FOCUSABLE_SELECTOR_NOT_HIDDEN},${FOCUSABLE_SELECTOR_NOT_DISABLED}`;\n// selector to find focusable elements\nconst FOCUSABLE_SELECTOR = `a,frame,iframe,${FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED},*[tabindex]`;\n\nconst scheduler = typeof setImmediate === 'function' ? setImmediate : setTimeout;\n\nexport function getUniqueString (prefix = DEFAULT_PREFIX) {\n return `${prefix}${UNIQUE_ID_COUNTER++}`;\n}\n\n/**\n * Returns a random element from array\n * @param array - the array to return a random element from\n * @param {string} seed - use a string to seed the randomization, so it returns the same element each time\n * based on that string.\n * @returns {*} - the random element\n */\nexport function getRandomElement (array, seed) {\n if (seed) {\n const hash = javaHashCode(seed);\n return array[Math.abs(hash) % array.length];\n } else {\n return array[getRandomInt(array.length)];\n }\n}\n\n/**\n * Returns a hash code for a string.\n * (Compatible to Java's String.hashCode())\n * We use this algo to be in sync with android.\n *\n * The hash code for a string object is computed as\n * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]\n * using number arithmetic, where s[i] is the i th character\n * of the given string, n is the length of the string,\n * and ^ indicates exponentiation.\n * (The hash value of the empty string is zero.)\n *\n * @param {string} str a string\n * @return {number} a hash code value for the given string.\n */\nexport function javaHashCode (str) {\n let h;\n for (let i = 0; i < str.length; i++) {\n h = Math.imul(31, h) + str.charCodeAt(i) | 0;\n }\n\n return h;\n}\n\n/**\n * Generate a random integer\n * @param {number} max - max range of integer to generate\n * @returns {number} randomly generated integer between 0 and max\n */\nexport function getRandomInt (max) {\n return Math.floor(Math.random() * max);\n}\n\nexport function formatMessages (messages) {\n if (!messages) {\n return [];\n }\n\n return messages.map(message => {\n if (typeof message === 'string') {\n return {\n message,\n type: DEFAULT_VALIDATION_MESSAGE_TYPE,\n };\n }\n\n return message;\n });\n}\n\nexport function filterFormattedMessages (formattedMessages) {\n const validationState = getValidationState(formattedMessages);\n\n if (!formattedMessages || !validationState) {\n return [];\n }\n\n return formattedMessages.filter(message => !!message.message && message.type === validationState);\n}\n\n/*\n * The priority order of message types is as flows: 'error' > 'warning' > 'success'.\n * If any message of type 'error' is present in messages, the input state is considered\n * to be 'error', then 'warning' and lastly 'success'.\n */\nexport function getValidationState (formattedMessages) {\n if (!formattedMessages) {\n return null;\n }\n\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.ERROR)) {\n return VALIDATION_MESSAGE_TYPES.ERROR;\n }\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.WARNING)) {\n return VALIDATION_MESSAGE_TYPES.WARNING;\n }\n if (hasFormattedMessageOfType(formattedMessages, VALIDATION_MESSAGE_TYPES.SUCCESS)) {\n return VALIDATION_MESSAGE_TYPES.SUCCESS;\n }\n\n return null;\n}\n\nexport function hasFormattedMessageOfType (formattedMessages, messageType) {\n if (!formattedMessages || !messageType) {\n return false;\n }\n\n return formattedMessages.some(message => message?.type === messageType);\n}\n\nexport function findFirstFocusableNode (element) {\n return element?.querySelector(FOCUSABLE_SELECTOR);\n}\n\n/* html-fragment component:\n * To render html without wrapping in another element as when using v-html.\n * props: html\n */\nexport const htmlFragment = {\n name: 'html-fragment',\n functional: true,\n props: ['html'],\n render (h, ctx) {\n return new Vue({\n // eslint-disable-next-line vue/multi-word-component-names\n name: 'Inner',\n beforeCreate () { this.$createElement = h; },\n template: `<div>${ctx.props.html}</div>`,\n }).$mount()._vnode.children;\n },\n};\n\nexport const flushPromises = () => {\n return new Promise((resolve) => {\n scheduler(resolve);\n });\n};\n\n/**\n * Transform a string from kebab-case to PascalCase\n * @param string\n * @returns {string}\n */\nexport const kebabCaseToPascalCase = (string) => {\n return string?.toLowerCase()\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n};\n\n/**\n * Transform a string from PascalCase to kebab-case\n * @param string\n * @returns {string}\n */\nexport const pascalCaseToKebabCase = (string) => {\n return string\n .replace(/\\.?([A-Z0-9]+)/g, (x, y) => '-' + y.toLowerCase())\n .replace(/^-/, '');\n};\n\n/*\n* Set's a global timer to debounce the execution of a function.\n* @param { object } func - the function that is going to be called after timeout\n* @param { number } [timeout=300] timeout\n* */\nexport function debounce (func, timeout = 300) {\n clearTimeout(TIMER);\n TIMER = setTimeout(func, timeout);\n}\n\n/**\n * Checks if the element is out of the viewport\n * https://gomakethings.com/how-to-check-if-any-part-of-an-element-is-out-of-the-viewport-with-vanilla-js/\n * @param {HTMLElement} element The element to check\n * @return {Object} A set of booleans for each side of the element\n */\n\nexport function isOutOfViewPort (element) {\n const bounding = element.getBoundingClientRect();\n\n const isOut = {\n top: bounding.top < 0,\n left: bounding.left < 0,\n bottom: bounding.bottom > (window.innerHeight || document.documentElement.clientHeight),\n right: bounding.right > (window.innerWidth || document.documentElement.clientWidth),\n };\n isOut.any = Object.values(isOut).some(val => val);\n isOut.all = Object.values(isOut).every(val => val);\n return isOut;\n}\n\n// match valid characters for a domain name followed by a dot, e.g. \"dialpad.\"\nconst domainNameRegex = /(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)/;\n\n// match valid TLDs for a hostname (outdated list from ~2017)\nconst tldRegerx = new RegExp(\n '(?:' +\n 'com|ru|org|net|de|jp|uk|br|it|pl|fr|in|au|ir|info|nl|cn|es|cz|kr|ca|eu|ua|co|gr|' +\n 'za|ro|biz|ch|se|tw|mx|vn|hu|be|tr|at|dk|tv|me|ar|sk|no|us|fi|id|cl|xyz|io|pt|by|' +\n 'il|ie|nz|kz|hk|lt|cc|my|sg|club|bg|edu|рф|pk|su|top|th|hr|rs|pe|pro|si|az|lv|pw|' +\n 'ae|ph|online|ng|ee|ws|ve|cat' +\n ')',\n);\n\n// match valid IPv4 addresses, e.g. \"192.158.1.38\"\nconst ipv4Regex = new RegExp(\n '(?:(?:[0-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])\\\\.){3}' +\n '(?:[0-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])',\n);\n\n// match hostnames OR IPv4 addresses, e.g. \"dialpad.com\" or \"192.158.1.38\"\nconst hostnameOrIpRegex = new RegExp(\n '(?:' +\n [\n [\n domainNameRegex.source,\n tldRegerx.source,\n ].join('+'),\n ipv4Regex.source,\n ].join('|') +\n ')',\n);\n\n// match URL paths, e.g. \"/news\"\nconst urlPathRegex = /(?:(?:[;/][^#?<>\\s]*)?)/;\n\n// match URL queries and fragments, e.g. \"?cache=1&new=true\" or \"#heading1\"\nconst urlQueryOrFragmentRegex = /(?:(?:\\?[^#<>\\s]+)?(?:#[^<>\\s]+)?)/;\n\n// match complete hostnames or IPv4 addresses without a protocol and with optional\n// URL paths, queries and fragments e.g. \"dialpad.com/news?cache=1#heading1\"\nconst urlWithoutProtocolRegex = new RegExp(\n '\\\\b' +\n [\n hostnameOrIpRegex.source,\n urlPathRegex.source,\n urlQueryOrFragmentRegex.source,\n '(?!\\\\w)',\n ].join('+'),\n);\n\n// match complete hostnames with protocols and optional URL paths, queries and fragments,\n// e.g. \"ws://localhost:9010\" or \"https://dialpad.com/news?cache=1#heading1\"\nconst urlWithProtocolRegex = /\\b[a-z\\d.-]+:\\/\\/[^<>\\s]+/;\n\n// match email addresses with an optional \"mailto:\" prefix and URL queries, e.g.\n// \"hey@dialpad.com\" or \"mailto:hey@dialpad.com?subject=Hi&body=Hey%20there\"\nconst emailAddressRegex = new RegExp(\n '(?:mailto:)?' +\n '[a-z0-9!#$%&\\'*+/=?^_`{|}~-]+(?:\\\\.[a-z0-9!#$%&\\'*+/=?^_`{|}~-]+)*@' +\n [\n hostnameOrIpRegex.source,\n urlQueryOrFragmentRegex.source,\n ].join('+') +\n '(?!\\\\w)',\n);\n\n/**\n * Match phone numbers, e.g. \"765-8813\", \"(778) 765-8813\" or \"+17787658813\".\n * @param {number} minLength\n * @param {number} maxLength\n * @returns {RegExp}\n */\nexport function getPhoneNumberRegex (minLength = 7, maxLength = 15) {\n // Some older browser versions don't support lookbehind, so provide a RegExp\n // version without it. It fails just one test case, so IMO it's still good\n // enough to use. https://caniuse.com/js-regexp-lookbehind\n try {\n return new RegExp(\n '(?:^|(?<=\\\\W))' +\n '(?![\\\\s\\\\-])\\\\+?(?:[0-9()\\\\- \\\\t]' +\n `{${minLength},${maxLength}}` +\n ')(?=\\\\b)(?=\\\\W(?=\\\\W|$)|\\\\s|$)',\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('This browser doesn\\'t support regex lookahead/lookbehind');\n }\n\n return new RegExp(\n '(?![\\\\s\\\\-])\\\\+?(?:[0-9()\\\\- \\\\t]' +\n `{${minLength},${maxLength}}` +\n ')(?=\\\\b)(?=\\\\W(?=\\\\W|$)|\\\\s|$)',\n );\n}\n\nconst phoneNumberRegex = getPhoneNumberRegex();\n\n// match all link types\nexport const linkRegex = new RegExp(\n [\n urlWithoutProtocolRegex.source,\n urlWithProtocolRegex.source,\n emailAddressRegex.source,\n phoneNumberRegex.source,\n ].join('|'),\n 'gi',\n);\n\n/**\n * Check if a string is a phone number. Validates only exact matches.\n * @param {string|number} input\n * @returns {boolean}\n */\nexport function isPhoneNumber (input) {\n if (!input || (!['string', 'number'].includes(typeof input))) return false;\n input = input.toString();\n return phoneNumberRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Check if a string is an URL. Validates only exact matches.\n * @param {string} input\n * @returns {boolean}\n */\nexport function isURL (input) {\n if (!input || typeof input !== 'string') return false;\n return urlWithoutProtocolRegex.exec(input)?.[0] === input ||\n urlWithProtocolRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Check if a string is an email address. Validates only exact matches.\n * @param {string} input\n * @returns {boolean}\n */\nexport function isEmailAddress (input) {\n if (!input || typeof input !== 'string') return false;\n return emailAddressRegex.exec(input)?.[0] === input;\n}\n\n/**\n * Concatenate a string removing null or undefined elements\n * avoiding parsing them as string with template strings\n * @param {Array} elements\n * @returns {String}\n */\nexport function safeConcatStrings (elements) {\n return elements.filter(str => !!str).join(', ');\n}\n\n/**\n * Locale safe function to capitalize the first letter of a string.\n * @param {string} str the string to capitalize the first letter of\n * @param {string} locale a string representing the locale to be used. Defaults to 'en-US'\n * @returns The passed in string with the first letter capitalized\n */\nexport function capitalizeFirstLetter (str, locale = 'en-US') {\n return str.replace(/^\\p{CWU}/u, char => char.toLocaleUpperCase(locale));\n}\n\n/**\n * Warns if the component is not mounted properly. Useful for tests.\n * @param {HTMLElement} componentRef - the component reference\n * @param {string} componentName - the component name\n */\n// eslint-disable-next-line complexity\nexport function warnIfUnmounted (componentRef, componentName) {\n if (typeof process === 'undefined') return;\n if (process.env.NODE_ENV !== 'test') return;\n if (!componentRef || !(componentRef instanceof HTMLElement) || !document?.body) return;\n if (!document.body.contains(componentRef)) {\n console.warn(`The ${componentName} component is not attached to the document body. This may cause issues.`);\n }\n}\n\n/**\n * checks whether the dt-scrollbar is being used on the root element.\n * @param rootElement {HTMLElement}\n * @returns {boolean}\n */\nfunction isDtScrollbarInUse (rootElement = document.documentElement) {\n if (rootElement.hasAttribute('data-overlayscrollbars')) {\n return true;\n }\n return false;\n}\n\n/**\n * This will disable scrolling on the root element regardless of whether you are using dt-scrollbar or not.\n * @param rootElement {HTMLElement}\n */\nexport function disableRootScrolling (rootElement = document.documentElement) {\n if (isDtScrollbarInUse(rootElement)) {\n rootElement.classList.add('d-scrollbar-disabled');\n } else {\n rootElement.classList.add('d-of-hidden');\n }\n}\n\n/**\n * This will enable scrolling on the root element regardless of whether you are using dt-scrollbar or not.\n * @param rootElement {HTMLElement}\n */\nexport function enableRootScrolling (rootElement = document.documentElement) {\n if (isDtScrollbarInUse(rootElement)) {\n rootElement.classList.remove('d-scrollbar-disabled');\n } else {\n rootElement.classList.remove('d-of-hidden');\n }\n}\n\n/**\n * This will take a text string e.g \"accessibility-mac\"\n * and convert it to our Fluent Key standard format \"ACCESSIBILITY_MAC\"\n * @param text\n * @returns {string}\n */\nexport function toFluentKeyString (text) {\n return text\n .replaceAll(/[ -]/g, '_')\n .replaceAll(/\\W/g, '')\n .toUpperCase();\n}\n\nexport default {\n getUniqueString,\n getRandomElement,\n getRandomInt,\n formatMessages,\n filterFormattedMessages,\n hasFormattedMessageOfType,\n getValidationState,\n htmlFragment,\n flushPromises,\n kebabCaseToPascalCase,\n debounce,\n isOutOfViewPort,\n getPhoneNumberRegex,\n linkRegex,\n isEmailAddress,\n isPhoneNumber,\n isURL,\n safeConcatStrings,\n capitalizeFirstLetter,\n disableRootScrolling,\n enableRootScrolling,\n};\n"],"names":["UNIQUE_ID_COUNTER","TIMER","FOCUSABLE_SELECTOR_NOT_HIDDEN","FOCUSABLE_SELECTOR_NOT_DISABLED","FOCUSABLE_SELECTOR_NOT_HIDDEN_DISABLED","FOCUSABLE_SELECTOR","scheduler","getUniqueString","prefix","DEFAULT_PREFIX","getRandomElement","array","seed","hash","javaHashCode","getRandomInt","str","h","i","max","formatMessages","messages","message","DEFAULT_VALIDATION_MESSAGE_TYPE","filterFormattedMessages","formattedMessages","validationState","getValidationState","hasFormattedMessageOfType","VALIDATION_MESSAGE_TYPES","messageType","findFirstFocusableNode","element","htmlFragment","ctx","Vue","flushPromises","resolve","kebabCaseToPascalCase","string","word","pascalCaseToKebabCase","x","y","debounce","func","timeout","isOutOfViewPort","bounding","isOut","val","domainNameRegex","tldRegerx","ipv4Regex","hostnameOrIpRegex","urlPathRegex","urlQueryOrFragmentRegex","urlWithoutProtocolRegex","urlWithProtocolRegex","emailAddressRegex","getPhoneNumberRegex","minLength","maxLength","phoneNumberRegex","linkRegex","isPhoneNumber","input","_a","isURL","_b","isEmailAddress","safeConcatStrings","elements","capitalizeFirstLetter","locale","char","warnIfUnmounted","componentRef","componentName","isDtScrollbarInUse","rootElement","disableRootScrolling","enableRootScrolling","toFluentKeyString","text","utils"],"mappings":";;AAOA,IAAIA,IAAoB,GACpBC;AAGJ,MAAMC,IAAgC,2CAEhCC,IAAkC,uEAElCC,IAAyC,GAAGF,CAA6B,IAAIC,CAA+B,IAE5GE,IAAqB,kBAAkBD,CAAsC,gBAE7EE,IAAY,OAAO,gBAAiB,aAAa,eAAe;AAE/D,SAASC,EAAiBC,IAASC,GAAgB;AACxD,SAAO,GAAGD,CAAM,GAAGR,GAAmB;AACxC;AASO,SAASU,EAAkBC,GAAOC,GAAM;AAC7C,MAAIA,GAAM;AACR,UAAMC,IAAOC,EAAaF,CAAI;AAC9B,WAAOD,EAAM,KAAK,IAAIE,CAAI,IAAIF,EAAM,MAAM;AAAA,EAC9C;AACI,WAAOA,EAAMI,EAAaJ,EAAM,MAAM,CAAC;AAE3C;AAiBO,SAASG,EAAcE,GAAK;AACjC,MAAIC;AACJ,WAASC,IAAI,GAAGA,IAAIF,EAAI,QAAQE;AAC9B,IAAAD,IAAI,KAAK,KAAK,IAAIA,CAAC,IAAID,EAAI,WAAWE,CAAC,IAAI;AAG7C,SAAOD;AACT;AAOO,SAASF,EAAcI,GAAK;AACjC,SAAO,KAAK,MAAM,KAAK,OAAQ,IAAGA,CAAG;AACvC;AAEO,SAASC,EAAgBC,GAAU;AACxC,SAAKA,IAIEA,EAAS,IAAI,CAAAC,MACd,OAAOA,KAAY,WACd;AAAA,IACL,SAAAA;AAAA,IACA,MAAMC;AAAA,EACd,IAGWD,CACR,IAZQ;AAaX;AAEO,SAASE,EAAyBC,GAAmB;AAC1D,QAAMC,IAAkBC,EAAmBF,CAAiB;AAE5D,SAAI,CAACA,KAAqB,CAACC,IAClB,KAGFD,EAAkB,OAAO,CAAAH,MAAW,CAAC,CAACA,EAAQ,WAAWA,EAAQ,SAASI,CAAe;AAClG;AAOO,SAASC,EAAoBF,GAAmB;AACrD,SAAKA,IAIDG,EAA0BH,G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