@dialpad/dialtone-vue 2.124.0 → 2.125.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/_plugin-vue2_normalizer-u6G_3nkj.js +33 -0
- package/dist/chunks/_plugin-vue2_normalizer-u6G_3nkj.js.map +1 -0
- package/dist/chunks/dropdown-SMWaTWyF.js +357 -0
- package/dist/chunks/dropdown-SMWaTWyF.js.map +1 -0
- package/dist/chunks/dropdown_constants-EUcDxBrX.js +9 -0
- package/dist/chunks/dropdown_constants-EUcDxBrX.js.map +1 -0
- package/dist/chunks/icon_constants-OpYAAKwF.js +16 -0
- package/dist/chunks/icon_constants-OpYAAKwF.js.map +1 -0
- package/dist/chunks/index-nIyl_PL6.js +372 -0
- package/dist/chunks/index-nIyl_PL6.js.map +1 -0
- package/dist/chunks/index-o4OMWMuv.js +244 -0
- package/dist/chunks/index-o4OMWMuv.js.map +1 -0
- package/dist/chunks/input-1tm09l_-.js +273 -0
- package/dist/chunks/input-1tm09l_-.js.map +1 -0
- package/dist/chunks/input_group-zcAq3DQl.js +141 -0
- package/dist/chunks/input_group-zcAq3DQl.js.map +1 -0
- package/dist/chunks/keyboard_list_navigation-F0O8nht0.js +197 -0
- package/dist/chunks/keyboard_list_navigation-F0O8nht0.js.map +1 -0
- package/dist/chunks/link_constants-vIUB92L4.js +16 -0
- package/dist/chunks/link_constants-vIUB92L4.js.map +1 -0
- package/dist/chunks/list_item_constants-LTUc74pD.js +13 -0
- package/dist/chunks/list_item_constants-LTUc74pD.js.map +1 -0
- package/dist/chunks/modal-VuMFkZFH.js +82 -0
- package/dist/chunks/modal-VuMFkZFH.js.map +1 -0
- package/dist/chunks/notice_action-9NmtQRai.js +182 -0
- package/dist/chunks/notice_action-9NmtQRai.js.map +1 -0
- package/dist/chunks/notice_constants-c--hBFQw.js +6 -0
- package/dist/chunks/notice_constants-c--hBFQw.js.map +1 -0
- package/dist/chunks/popover_constants-qjlEkroB.js +114 -0
- package/dist/chunks/popover_constants-qjlEkroB.js.map +1 -0
- package/dist/chunks/sr_only_close_button-JGole5Xi.js +86 -0
- package/dist/chunks/sr_only_close_button-JGole5Xi.js.map +1 -0
- package/dist/chunks/stack_constants-u7tNqGtc.js +13 -0
- package/dist/chunks/stack_constants-u7tNqGtc.js.map +1 -0
- package/dist/chunks/tab-Qm9LVkYj.js +346 -0
- package/dist/chunks/tab-Qm9LVkYj.js.map +1 -0
- package/dist/component-documentation.json +1 -1
- package/dist/dialtone-vue.js +356 -10364
- package/dist/dialtone-vue.js.map +1 -0
- package/dist/lib/attachment-carousel.js +250 -0
- package/dist/lib/attachment-carousel.js.map +1 -0
- package/dist/lib/avatar.js +369 -0
- package/dist/lib/avatar.js.map +1 -0
- package/dist/lib/badge.js +169 -0
- package/dist/lib/badge.js.map +1 -0
- package/dist/lib/banner.js +200 -0
- package/dist/lib/banner.js.map +1 -0
- package/dist/lib/breadcrumbs.js +138 -0
- package/dist/lib/breadcrumbs.js.map +1 -0
- package/dist/lib/button-group.js +45 -0
- package/dist/lib/button-group.js.map +1 -0
- package/dist/lib/button.js +328 -0
- package/dist/lib/button.js.map +1 -0
- package/dist/lib/callbar-button-with-popover.js +235 -0
- package/dist/lib/callbar-button-with-popover.js.map +1 -0
- package/dist/lib/callbar-button.js +175 -0
- package/dist/lib/callbar-button.js.map +1 -0
- package/dist/lib/callbox.js +142 -0
- package/dist/lib/callbox.js.map +1 -0
- package/dist/lib/card.js +72 -0
- package/dist/lib/card.js.map +1 -0
- package/dist/lib/checkbox-group.js +117 -0
- package/dist/lib/checkbox-group.js.map +1 -0
- package/dist/lib/checkbox.js +117 -0
- package/dist/lib/checkbox.js.map +1 -0
- package/dist/lib/chip.js +186 -0
- package/dist/lib/chip.js.map +1 -0
- package/dist/lib/codeblock.js +29 -0
- package/dist/lib/codeblock.js.map +1 -0
- package/dist/lib/collapsible.js +313 -0
- package/dist/lib/collapsible.js.map +1 -0
- package/dist/lib/combobox-multi-select.js +433 -0
- package/dist/lib/combobox-multi-select.js.map +1 -0
- package/dist/lib/combobox-with-popover.js +341 -0
- package/dist/lib/combobox-with-popover.js.map +1 -0
- package/dist/lib/combobox.js +19 -0
- package/dist/lib/combobox.js.map +1 -0
- package/dist/lib/constants.js +53 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/contact-info.js +145 -0
- package/dist/lib/contact-info.js.map +1 -0
- package/dist/lib/contact-row.js +203 -0
- package/dist/lib/contact-row.js.map +1 -0
- package/dist/lib/datepicker.js +552 -0
- package/dist/lib/datepicker.js.map +1 -0
- package/dist/lib/dates.js +57 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/description-list.js +83 -0
- package/dist/lib/description-list.js.map +1 -0
- package/dist/lib/dropdown.js +45 -0
- package/dist/lib/dropdown.js.map +1 -0
- package/dist/lib/editor.js +527 -0
- package/dist/lib/editor.js.map +1 -0
- package/dist/{emoji_picker-kiTOKaq8.js → lib/emoji-picker.js} +30 -11
- package/dist/lib/emoji-picker.js.map +1 -0
- package/dist/lib/emoji-row.js +83 -0
- package/dist/lib/emoji-row.js.map +1 -0
- package/dist/{emoji_text_wrapper-48ClwKvf.js → lib/emoji-text-wrapper.js} +19 -13
- package/dist/lib/emoji-text-wrapper.js.map +1 -0
- package/dist/lib/emoji.js +11 -0
- package/dist/lib/emoji.js.map +1 -0
- package/dist/lib/feed-item-row.js +207 -0
- package/dist/lib/feed-item-row.js.map +1 -0
- package/dist/lib/feed-pill.js +142 -0
- package/dist/lib/feed-pill.js.map +1 -0
- package/dist/lib/general-row.js +379 -0
- package/dist/lib/general-row.js.map +1 -0
- package/dist/lib/group-row.js +115 -0
- package/dist/lib/group-row.js.map +1 -0
- package/dist/lib/grouped-chip.js +45 -0
- package/dist/lib/grouped-chip.js.map +1 -0
- package/dist/lib/hovercard.js +194 -0
- package/dist/lib/hovercard.js.map +1 -0
- package/dist/lib/icon.js +82 -0
- package/dist/lib/icon.js.map +1 -0
- package/dist/lib/image-viewer.js +171 -0
- package/dist/lib/image-viewer.js.map +1 -0
- package/dist/lib/input-group.js +90 -0
- package/dist/lib/input-group.js.map +1 -0
- package/dist/lib/input.js +455 -0
- package/dist/lib/input.js.map +1 -0
- package/dist/lib/item-layout.js +39 -0
- package/dist/lib/item-layout.js.map +1 -0
- package/dist/lib/ivr-node.js +195 -0
- package/dist/lib/ivr-node.js.map +1 -0
- package/dist/lib/keyboard-shortcut.js +100 -0
- package/dist/lib/keyboard-shortcut.js.map +1 -0
- package/dist/lib/lazy-show.js +77 -0
- package/dist/lib/lazy-show.js.map +1 -0
- package/dist/lib/link.js +69 -0
- package/dist/lib/link.js.map +1 -0
- package/dist/lib/list-item-group.js +59 -0
- package/dist/lib/list-item-group.js.map +1 -0
- package/dist/lib/list-item.js +195 -0
- package/dist/lib/list-item.js.map +1 -0
- package/dist/{message_input.js → lib/message-input.js} +107 -55
- package/dist/lib/message-input.js.map +1 -0
- package/dist/lib/mixins.js +17 -0
- package/dist/lib/mixins.js.map +1 -0
- package/dist/lib/modal.js +324 -0
- package/dist/lib/modal.js.map +1 -0
- package/dist/lib/notice.js +158 -0
- package/dist/lib/notice.js.map +1 -0
- package/dist/lib/pagination.js +142 -0
- package/dist/lib/pagination.js.map +1 -0
- package/dist/lib/popover.js +779 -0
- package/dist/lib/popover.js.map +1 -0
- package/dist/lib/presence.js +60 -0
- package/dist/lib/presence.js.map +1 -0
- package/dist/lib/radio-group.js +97 -0
- package/dist/lib/radio-group.js.map +1 -0
- package/dist/lib/radio.js +111 -0
- package/dist/lib/radio.js.map +1 -0
- package/dist/lib/rich-text-editor.js +920 -0
- package/dist/lib/rich-text-editor.js.map +1 -0
- package/dist/lib/root-layout.js +127 -0
- package/dist/lib/root-layout.js.map +1 -0
- package/dist/lib/select-menu.js +243 -0
- package/dist/lib/select-menu.js.map +1 -0
- package/dist/lib/settings-menu-button.js +65 -0
- package/dist/lib/settings-menu-button.js.map +1 -0
- package/dist/lib/skeleton.js +574 -0
- package/dist/lib/skeleton.js.map +1 -0
- package/dist/lib/stack.js +118 -0
- package/dist/lib/stack.js.map +1 -0
- package/dist/lib/tabs.js +93 -0
- package/dist/lib/tabs.js.map +1 -0
- package/dist/lib/time-pill.js +43 -0
- package/dist/lib/time-pill.js.map +1 -0
- package/dist/lib/toast.js +226 -0
- package/dist/lib/toast.js.map +1 -0
- package/dist/lib/toggle.js +169 -0
- package/dist/lib/toggle.js.map +1 -0
- package/dist/{directives.js → lib/tooltip-directive.js} +24 -17
- package/dist/lib/tooltip-directive.js.map +1 -0
- package/dist/lib/tooltip.js +376 -0
- package/dist/lib/tooltip.js.map +1 -0
- package/dist/lib/top-banner-info.js +60 -0
- package/dist/lib/top-banner-info.js.map +1 -0
- package/dist/lib/unread-pill.js +61 -0
- package/dist/lib/unread-pill.js.map +1 -0
- package/dist/lib/utils.js +175 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/validation-messages.js +83 -0
- package/dist/lib/validation-messages.js.map +1 -0
- package/dist/lib/validators.js +12 -0
- package/dist/lib/validators.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/types/common/{constants.d.ts → constants/index.d.ts} +1 -1
- package/dist/types/common/constants/index.d.ts.map +1 -0
- package/dist/types/common/{dates.d.ts → dates/index.d.ts} +1 -1
- package/dist/types/common/dates/index.d.ts.map +1 -0
- package/dist/types/common/{emoji.d.ts → emoji/index.d.ts} +1 -1
- package/dist/types/common/{emoji.d.ts.map → emoji/index.d.ts.map} +1 -1
- package/dist/types/common/{utils.d.ts → utils/index.d.ts} +1 -1
- package/dist/types/common/utils/index.d.ts.map +1 -0
- package/dist/types/common/{validators.d.ts → validators/index.d.ts} +1 -1
- package/dist/types/common/validators/index.d.ts.map +1 -0
- package/dist/types/components/avatar/avatar.vue.d.ts +1 -1
- package/dist/types/components/button/button.vue.d.ts +2 -2
- package/dist/types/components/card/card.vue.d.ts +1 -1
- package/dist/types/components/checkbox/checkbox.vue.d.ts +7 -7
- package/dist/types/components/checkbox/checkbox.vue.d.ts.map +1 -1
- package/dist/types/components/chip/chip.vue.d.ts +2 -2
- package/dist/types/components/collapsible/collapsible.vue.d.ts +3 -3
- package/dist/types/components/combobox/combobox.vue.d.ts +7 -8
- package/dist/types/components/combobox/combobox.vue.d.ts.map +1 -1
- package/dist/types/components/dropdown/dropdown.vue.d.ts +1 -1
- package/dist/types/components/emoji/emoji.vue.d.ts +1 -1
- package/dist/types/components/emoji_picker/modules/emoji_selector.vue.d.ts +1 -219
- package/dist/types/components/icon/icon.vue.d.ts +20 -16
- package/dist/types/components/icon/icon.vue.d.ts.map +1 -1
- package/dist/types/components/icon/icon_constants.d.ts +2 -0
- package/dist/types/components/icon/icon_constants.d.ts.map +1 -1
- package/dist/types/components/icon/index.d.ts +1 -1
- package/dist/types/components/input_group/input_group.vue.d.ts +15 -6
- package/dist/types/components/input_group/input_group.vue.d.ts.map +1 -1
- package/dist/types/components/list_item_group/list_item_group.vue.d.ts +1 -1
- package/dist/types/components/modal/modal.vue.d.ts +7 -2
- package/dist/types/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/types/components/notice/notice_action.vue.d.ts +3 -1
- package/dist/types/components/notice/notice_action.vue.d.ts.map +1 -1
- package/dist/types/components/popover/popover_header_footer.vue.d.ts +1 -1
- package/dist/types/components/radio/radio.vue.d.ts +2 -12
- package/dist/types/components/radio/radio.vue.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts +1 -1
- package/dist/types/components/skeleton/skeleton-list-item.vue.d.ts +1 -1
- package/dist/types/components/skeleton/skeleton-paragraph.vue.d.ts +3 -3
- package/dist/types/components/skeleton/skeleton-shape.vue.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton-text.vue.d.ts +8 -3
- package/dist/types/components/skeleton/skeleton-text.vue.d.ts.map +1 -1
- package/dist/types/components/skeleton/skeleton.vue.d.ts +1 -1
- package/dist/types/components/toggle/toggle.vue.d.ts +1 -1
- package/dist/types/components/tooltip/tooltip.vue.d.ts +2 -2
- package/dist/types/index.d.ts +36 -29
- package/dist/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts +1 -1
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +2 -2
- package/dist/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -1
- package/dist/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +2 -2
- package/dist/types/recipes/conversation_view/editor/editor.vue.d.ts +9 -0
- package/dist/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/package.json +19 -59
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -2890
- package/dist/dialtone-vue.cjs +0 -5
- package/dist/directives.cjs +0 -1
- package/dist/emoji.cjs +0 -1
- package/dist/emoji.js +0 -35
- package/dist/emoji_picker-njWWAm6V.cjs +0 -1
- package/dist/emoji_text_wrapper-ZlynvHnd.cjs +0 -1
- package/dist/index-OF94C6nQ.js +0 -142833
- package/dist/index-Wx7Jagcr.cjs +0 -1
- package/dist/message_input.cjs +0 -1
- package/dist/rich_text_editor-9sMob7ck.js +0 -16478
- package/dist/rich_text_editor-Eh5kYokw.cjs +0 -97
- package/dist/tooltip-88U5vFMA.js +0 -2516
- package/dist/tooltip-i2wxFIIi.cjs +0 -21
- package/dist/types/common/constants.d.ts.map +0 -1
- package/dist/types/common/dates.d.ts.map +0 -1
- package/dist/types/common/utils.d.ts.map +0 -1
- package/dist/types/common/validators.d.ts.map +0 -1
- package/dist/types/components/emoji_picker/emojis/index.d.ts +0 -50
- package/dist/types/components/emoji_picker/emojis/index.d.ts.map +0 -1
- package/dist/types/directives.d.ts +0 -2
- package/dist/types/directives.d.ts.map +0 -1
- package/dist/types/emoji.d.ts +0 -5
- package/dist/types/emoji.d.ts.map +0 -1
- package/dist/types/message_input.d.ts +0 -3
- package/dist/types/message_input.d.ts.map +0 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import s from "vue";
|
|
2
|
+
import i from "./utils.js";
|
|
3
|
+
import { n } from "../chunks/_plugin-vue2_normalizer-u6G_3nkj.js";
|
|
4
|
+
import "./constants.js";
|
|
5
|
+
const a = {
|
|
6
|
+
sm: "d-toggle--small",
|
|
7
|
+
md: ""
|
|
8
|
+
}, r = [!1, !0, "mixed"], d = {
|
|
9
|
+
name: "DtToggle",
|
|
10
|
+
inheritAttrs: !1,
|
|
11
|
+
model: {
|
|
12
|
+
prop: "checked",
|
|
13
|
+
event: "change"
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
/**
|
|
17
|
+
* The id of the toggle
|
|
18
|
+
*/
|
|
19
|
+
id: {
|
|
20
|
+
type: String,
|
|
21
|
+
default() {
|
|
22
|
+
return i.getUniqueString();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Disables the toggle interactions
|
|
27
|
+
* @values true, false
|
|
28
|
+
*/
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !1
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Value of the toggle
|
|
35
|
+
* @model checked
|
|
36
|
+
* @values true, false, 'mixed'
|
|
37
|
+
*/
|
|
38
|
+
checked: {
|
|
39
|
+
type: [Boolean, String],
|
|
40
|
+
default: !1,
|
|
41
|
+
validator: (t) => r.includes(t)
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Whether the component toggles on click. If you set this to false it means you will handle the toggling manually
|
|
45
|
+
* via the checked prop or v-model. Change events will still be triggered.
|
|
46
|
+
* @values true, false
|
|
47
|
+
*/
|
|
48
|
+
toggleOnClick: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !0
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* The size of the toggle.
|
|
54
|
+
* @values sm, md
|
|
55
|
+
*/
|
|
56
|
+
size: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "md",
|
|
59
|
+
validator: (t) => Object.keys(a).includes(t)
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Shows the icon
|
|
63
|
+
* @values true, false
|
|
64
|
+
*/
|
|
65
|
+
showIcon: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: !0
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Used to customize the label container
|
|
71
|
+
*/
|
|
72
|
+
labelClass: {
|
|
73
|
+
type: [String, Array, Object],
|
|
74
|
+
default: ""
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* A set of props that are passed into the label container
|
|
78
|
+
*/
|
|
79
|
+
labelChildProps: {
|
|
80
|
+
type: Object,
|
|
81
|
+
default: () => ({})
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
emits: [
|
|
85
|
+
/**
|
|
86
|
+
* Toggle change event
|
|
87
|
+
*
|
|
88
|
+
* @event change
|
|
89
|
+
* @type {Boolean}
|
|
90
|
+
* @model change
|
|
91
|
+
*/
|
|
92
|
+
"change"
|
|
93
|
+
],
|
|
94
|
+
data() {
|
|
95
|
+
return {
|
|
96
|
+
internalChecked: this.checked
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
computed: {
|
|
100
|
+
inputListeners() {
|
|
101
|
+
return {
|
|
102
|
+
...this.$listeners,
|
|
103
|
+
click: (t) => this.toggleCheckedValue()
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
isIndeterminate() {
|
|
107
|
+
return this.internalChecked === "mixed";
|
|
108
|
+
},
|
|
109
|
+
toggleRole() {
|
|
110
|
+
return this.isIndeterminate ? "checkbox" : "switch";
|
|
111
|
+
},
|
|
112
|
+
toggleClasses() {
|
|
113
|
+
return [
|
|
114
|
+
"d-toggle",
|
|
115
|
+
a[this.size],
|
|
116
|
+
{
|
|
117
|
+
"d-toggle--checked": this.internalChecked === !0,
|
|
118
|
+
"d-toggle--disabled": this.disabled,
|
|
119
|
+
"d-toggle--indeterminate": this.isIndeterminate
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
watch: {
|
|
125
|
+
checked(t) {
|
|
126
|
+
this.internalChecked = t;
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
mounted() {
|
|
130
|
+
this.runValidations();
|
|
131
|
+
},
|
|
132
|
+
methods: {
|
|
133
|
+
toggleCheckedValue() {
|
|
134
|
+
this.$emit("change", !this.internalChecked), this.toggleOnClick && (this.internalChecked = !this.internalChecked);
|
|
135
|
+
},
|
|
136
|
+
hasSlotLabel() {
|
|
137
|
+
return !!this.$slots.default;
|
|
138
|
+
},
|
|
139
|
+
runValidations() {
|
|
140
|
+
this.validateInputLabels(this.hasSlotLabel(), this.$attrs["aria-label"]);
|
|
141
|
+
},
|
|
142
|
+
validateInputLabels(t, e) {
|
|
143
|
+
!t && !e && s.util.warn(
|
|
144
|
+
"You must provide an aria-label when there is no label passed",
|
|
145
|
+
this
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var o = function() {
|
|
151
|
+
var e = this, l = e._self._c;
|
|
152
|
+
return l("div", { staticClass: "d-toggle-wrapper" }, [e.$slots.default ? l("label", e._b({ class: e.labelClass, attrs: { for: e.id, "data-qa": "toggle-label" } }, "label", e.labelChildProps, !1), [e._t("default")], 2) : e._e(), l("button", e._g(e._b({ class: e.toggleClasses, attrs: { id: e.id, role: e.toggleRole, type: "button", "aria-checked": e.internalChecked.toString(), disabled: e.disabled, "aria-disabled": e.disabled.toString() } }, "button", e.$attrs, !1), e.inputListeners), [e.showIcon ? l("span", { staticClass: "d-toggle__inner" }) : e._e()])]);
|
|
153
|
+
}, c = [], h = /* @__PURE__ */ n(
|
|
154
|
+
d,
|
|
155
|
+
o,
|
|
156
|
+
c,
|
|
157
|
+
!1,
|
|
158
|
+
null,
|
|
159
|
+
null,
|
|
160
|
+
null,
|
|
161
|
+
null
|
|
162
|
+
);
|
|
163
|
+
const m = h.exports;
|
|
164
|
+
export {
|
|
165
|
+
m as DtToggle,
|
|
166
|
+
r as TOGGLE_CHECKED_VALUES,
|
|
167
|
+
a as TOGGLE_SIZE_MODIFIERS
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.js","sources":["../../components/toggle/toggle_constants.js","../../components/toggle/toggle.vue"],"sourcesContent":["export const TOGGLE_SIZE_MODIFIERS = {\n sm: 'd-toggle--small',\n md: '',\n};\n\nexport const TOGGLE_CHECKED_VALUES = [false, true, 'mixed'];\n\nexport default {\n TOGGLE_SIZE_MODIFIERS,\n TOGGLE_CHECKED_VALUES,\n};\n","<template>\n <div class=\"d-toggle-wrapper\">\n <label\n v-if=\"$slots.default\"\n :class=\"labelClass\"\n :for=\"id\"\n v-bind=\"labelChildProps\"\n data-qa=\"toggle-label\"\n >\n <!-- @slot Slot for the main content -->\n <slot />\n </label>\n <button\n :id=\"id\"\n :role=\"toggleRole\"\n type=\"button\"\n :aria-checked=\"internalChecked.toString()\"\n :disabled=\"disabled\"\n :aria-disabled=\"disabled.toString()\"\n :class=\"toggleClasses\"\n v-bind=\"$attrs\"\n v-on=\"inputListeners\"\n >\n <span\n v-if=\"showIcon\"\n class=\"d-toggle__inner\"\n />\n </button>\n </div>\n</template>\n\n<script>\nimport Vue from 'vue';\nimport utils from '@/common/utils';\nimport { TOGGLE_CHECKED_VALUES, TOGGLE_SIZE_MODIFIERS } from '@/components/toggle/toggle_constants';\n\n/**\n * A toggle (or \"switch\") is a button control element that allows the user to make a binary (on/off) selection.\n * @see https://dialtone.dialpad.com/components/toggle.html\n */\nexport default {\n\n name: 'DtToggle',\n\n inheritAttrs: false,\n\n model: {\n prop: 'checked',\n event: 'change',\n },\n\n props: {\n\n /**\n * The id of the toggle\n */\n id: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Disables the toggle interactions\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Value of the toggle\n * @model checked\n * @values true, false, 'mixed'\n */\n checked: {\n type: [Boolean, String],\n default: false,\n validator: (v) => TOGGLE_CHECKED_VALUES.includes(v),\n },\n\n /**\n * Whether the component toggles on click. If you set this to false it means you will handle the toggling manually\n * via the checked prop or v-model. Change events will still be triggered.\n * @values true, false\n */\n toggleOnClick: {\n type: Boolean,\n default: true,\n },\n\n /**\n * The size of the toggle.\n * @values sm, md\n */\n size: {\n type: String,\n default: 'md',\n validator: (s) => Object.keys(TOGGLE_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Shows the icon\n * @values true, false\n */\n showIcon: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * A set of props that are passed into the label container\n */\n labelChildProps: {\n type: Object,\n default: () => ({}),\n },\n },\n\n emits: [\n /**\n * Toggle change event\n *\n * @event change\n * @type {Boolean}\n * @model change\n */\n 'change',\n ],\n\n data () {\n return {\n internalChecked: this.checked,\n };\n },\n\n computed: {\n inputListeners () {\n return {\n ...this.$listeners,\n click: _ => this.toggleCheckedValue(),\n };\n },\n\n isIndeterminate () {\n return this.internalChecked === 'mixed';\n },\n\n toggleRole () {\n return this.isIndeterminate ? 'checkbox' : 'switch';\n },\n\n toggleClasses () {\n return [\n 'd-toggle',\n TOGGLE_SIZE_MODIFIERS[this.size],\n {\n 'd-toggle--checked': this.internalChecked === true,\n 'd-toggle--disabled': this.disabled,\n 'd-toggle--indeterminate': this.isIndeterminate,\n },\n ];\n },\n },\n\n watch: {\n checked (newChecked) {\n this.internalChecked = newChecked;\n },\n },\n\n mounted () {\n this.runValidations();\n },\n\n methods: {\n toggleCheckedValue () {\n this.$emit('change', !this.internalChecked);\n\n if (this.toggleOnClick) {\n this.internalChecked = !this.internalChecked;\n }\n },\n\n hasSlotLabel () {\n return !!(this.$slots.default);\n },\n\n runValidations () {\n this.validateInputLabels(this.hasSlotLabel(), this.$attrs['aria-label']);\n },\n\n validateInputLabels (hasLabel, ariaLabel) {\n if (!hasLabel && !ariaLabel) {\n Vue.util.warn(\n 'You must provide an aria-label when there is no label passed',\n this,\n );\n }\n },\n },\n};\n</script>\n"],"names":["TOGGLE_SIZE_MODIFIERS","TOGGLE_CHECKED_VALUES","_sfc_main","utils","v","s","_","newChecked","hasLabel","ariaLabel","Vue"],"mappings":"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"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getUniqueString as m } from "./utils.js";
|
|
2
|
+
import { DtTooltip as n } from "./tooltip.js";
|
|
3
|
+
import "./constants.js";
|
|
2
4
|
import "vue";
|
|
3
|
-
|
|
5
|
+
import "../chunks/popover_constants-qjlEkroB.js";
|
|
6
|
+
import "tippy.js";
|
|
7
|
+
import "../chunks/_plugin-vue2_normalizer-u6G_3nkj.js";
|
|
8
|
+
import "./lazy-show.js";
|
|
9
|
+
const E = {
|
|
4
10
|
name: "dt-tooltip-directive",
|
|
5
|
-
install(
|
|
11
|
+
install(r) {
|
|
6
12
|
const l = document.createElement("div");
|
|
7
13
|
document.body.appendChild(l);
|
|
8
|
-
const a = "top", p = new
|
|
14
|
+
const a = "top", p = new r({
|
|
9
15
|
name: "DtTooltipDirectiveApp",
|
|
10
16
|
components: { DtTooltip: n },
|
|
11
17
|
data() {
|
|
@@ -14,9 +20,9 @@ const v = {
|
|
|
14
20
|
};
|
|
15
21
|
},
|
|
16
22
|
methods: {
|
|
17
|
-
addOrUpdateTooltip(t, o,
|
|
18
|
-
const
|
|
19
|
-
|
|
23
|
+
addOrUpdateTooltip(t, o, i) {
|
|
24
|
+
const e = this.tooltips.findIndex((d) => d.id === t);
|
|
25
|
+
e !== -1 ? (this.tooltips[e].message = o, this.tooltips[e].placement = i) : this.tooltips.push({ id: t, message: o, placement: i });
|
|
20
26
|
},
|
|
21
27
|
removeTooltip(t) {
|
|
22
28
|
this.tooltips = this.tooltips.filter((o) => o.id !== t);
|
|
@@ -29,11 +35,11 @@ const v = {
|
|
|
29
35
|
domProps: { id: "dt-tooltip-directive-app" }
|
|
30
36
|
},
|
|
31
37
|
[
|
|
32
|
-
this.tooltips.map(({ id: o, message:
|
|
38
|
+
this.tooltips.map(({ id: o, message: i, placement: e }) => t(n, {
|
|
33
39
|
key: o,
|
|
34
40
|
props: {
|
|
35
|
-
message:
|
|
36
|
-
placement:
|
|
41
|
+
message: i,
|
|
42
|
+
placement: e,
|
|
37
43
|
/**
|
|
38
44
|
* Set the delay to false when running tests only.
|
|
39
45
|
*/
|
|
@@ -45,23 +51,24 @@ const v = {
|
|
|
45
51
|
);
|
|
46
52
|
}
|
|
47
53
|
});
|
|
48
|
-
p.$mount(l),
|
|
54
|
+
p.$mount(l), r.directive("dt-tooltip", {
|
|
49
55
|
bind(t, o) {
|
|
50
|
-
|
|
56
|
+
s(t, o);
|
|
51
57
|
},
|
|
52
58
|
update(t, o) {
|
|
53
|
-
o.value !== o.oldValue &&
|
|
59
|
+
o.value !== o.oldValue && s(t, o);
|
|
54
60
|
},
|
|
55
61
|
unbind(t) {
|
|
56
62
|
p.removeTooltip(t.getAttribute("data-dt-tooltip-id"));
|
|
57
63
|
}
|
|
58
64
|
});
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
t.setAttribute("data-dt-tooltip-id",
|
|
65
|
+
function s(t, o) {
|
|
66
|
+
const i = t.getAttribute("data-dt-tooltip-id") || m(), e = o.value, d = o.arg || a;
|
|
67
|
+
t.setAttribute("data-dt-tooltip-id", i), p.addOrUpdateTooltip(i, e, d);
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
};
|
|
65
71
|
export {
|
|
66
|
-
|
|
72
|
+
E as DtTooltipDirective
|
|
67
73
|
};
|
|
74
|
+
//# sourceMappingURL=tooltip-directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip-directive.js","sources":["../../directives/tooltip/tooltip.js"],"sourcesContent":["import { DtTooltip } from '@/components/tooltip';\nimport { getUniqueString } from '@/common/utils';\n\nexport const DtTooltipDirective = {\n name: 'dt-tooltip-directive',\n install (Vue) {\n const mountPoint = document.createElement('div');\n document.body.appendChild(mountPoint);\n\n const DEFAULT_PLACEMENT = 'top';\n const DtTooltipDirectiveApp = new Vue({\n name: 'DtTooltipDirectiveApp',\n components: { DtTooltip },\n data () {\n return {\n tooltips: [],\n };\n },\n\n methods: {\n addOrUpdateTooltip (id, message, placement) {\n const index = this.tooltips.findIndex(tooltip => tooltip.id === id);\n if (index !== -1) {\n // Update existing tooltip\n this.tooltips[index].message = message;\n this.tooltips[index].placement = placement;\n } else {\n // Add new tooltip\n this.tooltips.push({ id, message, placement });\n }\n },\n\n removeTooltip (id) {\n this.tooltips = this.tooltips.filter(tooltip => tooltip.id !== id);\n },\n },\n\n render (h) {\n return h('div',\n {\n domProps: { id: 'dt-tooltip-directive-app' },\n },\n [\n this.tooltips.map(({ id, message, placement }) => {\n return h(DtTooltip, {\n key: id,\n props: {\n message,\n placement,\n /**\n * Set the delay to false when running tests only.\n */\n delay: process.env.NODE_ENV !== 'test',\n externalAnchor: `[data-dt-tooltip-id=\"${id}\"]`,\n },\n });\n }),\n ],\n );\n },\n });\n\n DtTooltipDirectiveApp.$mount(mountPoint);\n\n Vue.directive('dt-tooltip', {\n bind (anchor, binding) {\n // Initial tooltip setup\n setupTooltip(anchor, binding);\n },\n update (anchor, binding) {\n // Update tooltip on binding value change\n if (binding.value !== binding.oldValue) {\n setupTooltip(anchor, binding);\n }\n },\n unbind (anchor) {\n DtTooltipDirectiveApp.removeTooltip(anchor.getAttribute('data-dt-tooltip-id'));\n },\n });\n\n function setupTooltip (anchor, binding) {\n const tooltipId = anchor.getAttribute('data-dt-tooltip-id') || getUniqueString();\n const message = binding.value;\n const placement = binding.arg || DEFAULT_PLACEMENT;\n\n anchor.setAttribute('data-dt-tooltip-id', tooltipId);\n DtTooltipDirectiveApp.addOrUpdateTooltip(tooltipId, message, placement);\n }\n },\n};\n\nexport default DtTooltipDirective;\n"],"names":["DtTooltipDirective","Vue","mountPoint","DEFAULT_PLACEMENT","DtTooltipDirectiveApp","DtTooltip","id","message","placement","index","tooltip","h","anchor","binding","setupTooltip","tooltipId","getUniqueString"],"mappings":";;;;;;;;AAGY,MAACA,IAAqB;AAAA,EAChC,MAAM;AAAA,EACN,QAASC,GAAK;AACZ,UAAMC,IAAa,SAAS,cAAc,KAAK;AAC/C,aAAS,KAAK,YAAYA,CAAU;AAEpC,UAAMC,IAAoB,OACpBC,IAAwB,IAAIH,EAAI;AAAA,MACpC,MAAM;AAAA,MACN,YAAY,EAAE,WAAAI,EAAW;AAAA,MACzB,OAAQ;AACN,eAAO;AAAA,UACL,UAAU,CAAE;AAAA,QACtB;AAAA,MACO;AAAA,MAED,SAAS;AAAA,QACP,mBAAoBC,GAAIC,GAASC,GAAW;AAC1C,gBAAMC,IAAQ,KAAK,SAAS,UAAU,CAAAC,MAAWA,EAAQ,OAAOJ,CAAE;AAClE,UAAIG,MAAU,MAEZ,KAAK,SAASA,CAAK,EAAE,UAAUF,GAC/B,KAAK,SAASE,CAAK,EAAE,YAAYD,KAGjC,KAAK,SAAS,KAAK,EAAE,IAAAF,GAAI,SAAAC,GAAS,WAAAC,EAAS,CAAE;AAAA,QAEhD;AAAA,QAED,cAAeF,GAAI;AACjB,eAAK,WAAW,KAAK,SAAS,OAAO,CAAAI,MAAWA,EAAQ,OAAOJ,CAAE;AAAA,QAClE;AAAA,MACF;AAAA,MAED,OAAQK,GAAG;AACT,eAAOA;AAAA,UAAE;AAAA,UACP;AAAA,YACE,UAAU,EAAE,IAAI,2BAA4B;AAAA,UAC7C;AAAA,UACD;AAAA,YACE,KAAK,SAAS,IAAI,CAAC,EAAE,IAAAL,GAAI,SAAAC,GAAS,WAAAC,QACzBG,EAAEN,GAAW;AAAA,cAClB,KAAKC;AAAA,cACL,OAAO;AAAA,gBACL,SAAAC;AAAA,gBACA,WAAAC;AAAA;AAAA;AAAA;AAAA,gBAIA,OAAO,QAAQ,IAAI,aAAa;AAAA,gBAChC,gBAAgB,wBAAwBF,CAAE;AAAA,cAC3C;AAAA,YACjB,CAAe,CACF;AAAA,UACF;AAAA,QACX;AAAA,MACO;AAAA,IACP,CAAK;AAED,IAAAF,EAAsB,OAAOF,CAAU,GAEvCD,EAAI,UAAU,cAAc;AAAA,MAC1B,KAAMW,GAAQC,GAAS;AAErB,QAAAC,EAAaF,GAAQC,CAAO;AAAA,MAC7B;AAAA,MACD,OAAQD,GAAQC,GAAS;AAEvB,QAAIA,EAAQ,UAAUA,EAAQ,YAC5BC,EAAaF,GAAQC,CAAO;AAAA,MAE/B;AAAA,MACD,OAAQD,GAAQ;AACd,QAAAR,EAAsB,cAAcQ,EAAO,aAAa,oBAAoB,CAAC;AAAA,MAC9E;AAAA,IACP,CAAK;AAED,aAASE,EAAcF,GAAQC,GAAS;AACtC,YAAME,IAAYH,EAAO,aAAa,oBAAoB,KAAKI,EAAe,GACxET,IAAUM,EAAQ,OAClBL,IAAYK,EAAQ,OAAOV;AAEjC,MAAAS,EAAO,aAAa,sBAAsBG,CAAS,GACnDX,EAAsB,mBAAmBW,GAAWR,GAASC,CAAS;AAAA,IACvE;AAAA,EACF;AACH;"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { T as r, j as a, e as h, i as l, l as c, m as u, n as p, h as d } from "../chunks/popover_constants-qjlEkroB.js";
|
|
2
|
+
import { k as D } from "../chunks/popover_constants-qjlEkroB.js";
|
|
3
|
+
import { getUniqueString as f } from "./utils.js";
|
|
4
|
+
import { n as m } from "../chunks/_plugin-vue2_normalizer-u6G_3nkj.js";
|
|
5
|
+
import { DtLazyShow as y } from "./lazy-show.js";
|
|
6
|
+
import "tippy.js";
|
|
7
|
+
import "./constants.js";
|
|
8
|
+
import "vue";
|
|
9
|
+
const T = {
|
|
10
|
+
name: "DtTooltip",
|
|
11
|
+
components: {
|
|
12
|
+
DtLazyShow: y
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
/**
|
|
16
|
+
* The id of the tooltip
|
|
17
|
+
*/
|
|
18
|
+
id: {
|
|
19
|
+
type: String,
|
|
20
|
+
default() {
|
|
21
|
+
return f();
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* If the popover does not fit in the direction described by "placement",
|
|
26
|
+
* it will attempt to change its direction to the "fallbackPlacements"
|
|
27
|
+
* if defined, otherwise it will automatically position to a new location
|
|
28
|
+
* as it sees best fit. See
|
|
29
|
+
* <a
|
|
30
|
+
* class="d-link"
|
|
31
|
+
* href="https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements"
|
|
32
|
+
* target="_blank"
|
|
33
|
+
* >
|
|
34
|
+
* Popper.js docs
|
|
35
|
+
* </a>
|
|
36
|
+
* */
|
|
37
|
+
fallbackPlacements: {
|
|
38
|
+
type: Array,
|
|
39
|
+
default: () => ["auto"]
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* If true, applies inverted styles to the tooltip
|
|
43
|
+
* @values true, false
|
|
44
|
+
*/
|
|
45
|
+
inverted: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Displaces the tooltip from its reference element
|
|
51
|
+
* by the specified number of pixels. See
|
|
52
|
+
* <a
|
|
53
|
+
* class="d-link"
|
|
54
|
+
* href="https://atomiks.github.io/tippyjs/v6/all-props/#offset"
|
|
55
|
+
* target="_blank"
|
|
56
|
+
* >
|
|
57
|
+
* Tippy.js docs
|
|
58
|
+
* </a>
|
|
59
|
+
*/
|
|
60
|
+
offset: {
|
|
61
|
+
type: Array,
|
|
62
|
+
default: () => [0, -4]
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* The direction the popover displays relative to the anchor. See
|
|
66
|
+
* <a
|
|
67
|
+
* class="d-link"
|
|
68
|
+
* href="https://atomiks.github.io/tippyjs/v6/all-props/#placement"
|
|
69
|
+
* target="_blank"
|
|
70
|
+
* >
|
|
71
|
+
* Tippy.js docs
|
|
72
|
+
* </a>
|
|
73
|
+
* @values top, top-start, top-end,
|
|
74
|
+
* right, right-start, right-end,
|
|
75
|
+
* left, left-start, left-end,
|
|
76
|
+
* bottom, bottom-start, bottom-end,
|
|
77
|
+
* auto, auto-start, auto-end
|
|
78
|
+
*/
|
|
79
|
+
placement: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: "top",
|
|
82
|
+
validator(e) {
|
|
83
|
+
return r.includes(e);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* If the tooltip sticks to the anchor. This is usually not needed, but can be needed
|
|
88
|
+
* if the reference element's position is animating, or to automatically update the popover
|
|
89
|
+
* position in those cases the DOM layout changes the reference element's position.
|
|
90
|
+
* `true` enables it, `reference` only checks the "reference" rect for changes and `popper` only
|
|
91
|
+
* checks the "popper" rect for changes. See
|
|
92
|
+
* <a
|
|
93
|
+
* class="d-link"
|
|
94
|
+
* href="https://atomiks.github.io/tippyjs/v6/all-props/#sticky"
|
|
95
|
+
* target="_blank"
|
|
96
|
+
* >
|
|
97
|
+
* Tippy.js docs
|
|
98
|
+
* </a>
|
|
99
|
+
* @values true, false, reference, popper
|
|
100
|
+
*/
|
|
101
|
+
sticky: {
|
|
102
|
+
type: [Boolean, String],
|
|
103
|
+
default: !1,
|
|
104
|
+
validator: (e) => a.includes(e)
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* Sets the element to which the tooltip is going to append to.
|
|
108
|
+
* 'body' will append to the nearest body (supports shadow DOM).
|
|
109
|
+
* This prop is not reactive, must be set on initial render.
|
|
110
|
+
* @values 'body', 'parent', HTMLElement,
|
|
111
|
+
*/
|
|
112
|
+
appendTo: {
|
|
113
|
+
type: [HTMLElement, String],
|
|
114
|
+
default: "body",
|
|
115
|
+
validator: (e) => h.includes(e) || e instanceof HTMLElement
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* Additional css classes for the tooltip content element.
|
|
119
|
+
* Can accept all of String, Object, and Array, i.e. has the
|
|
120
|
+
* same api as Vue's built-in handling of the class attribute.
|
|
121
|
+
*/
|
|
122
|
+
contentClass: {
|
|
123
|
+
type: [String, Object, Array],
|
|
124
|
+
default: ""
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* A provided message for the tooltip content
|
|
128
|
+
*/
|
|
129
|
+
message: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: ""
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* Controls whether hover/focus causes the tooltip to appear.
|
|
135
|
+
* Cannot be combined with the show prop. show value will be ignored.
|
|
136
|
+
* by default this is true, if you override with false, the tooltip will never show up.
|
|
137
|
+
*/
|
|
138
|
+
enabled: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: !0
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* Controls whether the tooltip is shown. Leaving this null will have the tooltip trigger on mouseover by default.
|
|
144
|
+
* If you set this value, the default mouseover behavior will be disabled and you can control it as you need.
|
|
145
|
+
* Supports .sync modifier
|
|
146
|
+
* @values null, true, false
|
|
147
|
+
*/
|
|
148
|
+
show: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: null
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* Named transition when the content display is toggled.
|
|
154
|
+
* @see DtLazyShow
|
|
155
|
+
*/
|
|
156
|
+
transition: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: "fade"
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* Whether the tooltip will have a delay when being focused or moused over.
|
|
162
|
+
* @values true, false
|
|
163
|
+
*/
|
|
164
|
+
delay: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: !0
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* External anchor id to use in those cases the anchor can't be provided via the slot.
|
|
170
|
+
* For instance, using the combobox's input as the anchor for the popover.
|
|
171
|
+
*/
|
|
172
|
+
externalAnchor: {
|
|
173
|
+
type: String,
|
|
174
|
+
default: null
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
emits: [
|
|
178
|
+
/**
|
|
179
|
+
* Emitted when tooltip is shown or hidden
|
|
180
|
+
*
|
|
181
|
+
* @event shown
|
|
182
|
+
* @type {Boolean}
|
|
183
|
+
*/
|
|
184
|
+
"shown",
|
|
185
|
+
/**
|
|
186
|
+
* Sync show value
|
|
187
|
+
*
|
|
188
|
+
* @event update:show
|
|
189
|
+
*/
|
|
190
|
+
"update:show"
|
|
191
|
+
],
|
|
192
|
+
data() {
|
|
193
|
+
return {
|
|
194
|
+
TOOLTIP_KIND_MODIFIERS: l,
|
|
195
|
+
tip: null,
|
|
196
|
+
inTimer: null,
|
|
197
|
+
// Internal state for whether the tooltip is shown. Changing the prop
|
|
198
|
+
// will update this.
|
|
199
|
+
isShown: !1,
|
|
200
|
+
// this is where the placement currently is, this can be different than
|
|
201
|
+
// the placement prop when there is not enough available room for the tip
|
|
202
|
+
// to display and it uses a fallback placement.
|
|
203
|
+
currentPlacement: this.placement,
|
|
204
|
+
// flag check touch based device
|
|
205
|
+
isTouchDevice: !1
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
computed: {
|
|
209
|
+
// whether the tooltip is visible or not.
|
|
210
|
+
isVisible() {
|
|
211
|
+
var i, o;
|
|
212
|
+
const e = !!((i = this.message) != null && i.trim()), t = !!((o = this.$slots) != null && o.default), n = !this.isTouchDevice;
|
|
213
|
+
return this.isShown && this.enabled && (e || t) && n;
|
|
214
|
+
},
|
|
215
|
+
tooltipListeners() {
|
|
216
|
+
return {
|
|
217
|
+
...this.$listeners,
|
|
218
|
+
"after-leave": () => {
|
|
219
|
+
this.onLeaveTransitionComplete();
|
|
220
|
+
},
|
|
221
|
+
"after-enter": () => {
|
|
222
|
+
this.onEnterTransitionComplete();
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
tippyProps() {
|
|
227
|
+
return {
|
|
228
|
+
offset: this.offset,
|
|
229
|
+
interactive: !1,
|
|
230
|
+
trigger: "manual",
|
|
231
|
+
placement: this.placement,
|
|
232
|
+
sticky: this.sticky,
|
|
233
|
+
popperOptions: c({
|
|
234
|
+
fallbackPlacements: this.fallbackPlacements,
|
|
235
|
+
hasHideModifierEnabled: !0,
|
|
236
|
+
onChangePlacement: this.onChangePlacement
|
|
237
|
+
})
|
|
238
|
+
};
|
|
239
|
+
},
|
|
240
|
+
anchor() {
|
|
241
|
+
return this.externalAnchor ? document.body.querySelector(this.externalAnchor) : u(this.$refs.anchor);
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
watch: {
|
|
245
|
+
tippyProps: {
|
|
246
|
+
handler: "setProps",
|
|
247
|
+
deep: !0
|
|
248
|
+
},
|
|
249
|
+
show: {
|
|
250
|
+
handler: function(e) {
|
|
251
|
+
e !== null && (this.isShown = e);
|
|
252
|
+
},
|
|
253
|
+
immediate: !0
|
|
254
|
+
},
|
|
255
|
+
isShown(e) {
|
|
256
|
+
e ? (this.setProps(), this.tip.show()) : this.tip.hide();
|
|
257
|
+
},
|
|
258
|
+
sticky(e) {
|
|
259
|
+
this.tip.setProps({
|
|
260
|
+
sticky: e
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
mounted() {
|
|
265
|
+
!this.enabled && this.show != null && (console.warn("Tooltip: You cannot use both the enabled and show props at the same time."), console.warn("The show prop will be ignored.")), this.externalAnchor && this.addExternalAnchorEventListeners(), this.tip = p(this.anchor, this.initOptions()), this.isShown && this.tip.show();
|
|
266
|
+
},
|
|
267
|
+
beforeDestroy() {
|
|
268
|
+
var e;
|
|
269
|
+
this.externalAnchor && this.removeExternalAnchorEventListeners(), this.tip && ((e = this.tip) == null || e.destroy());
|
|
270
|
+
},
|
|
271
|
+
methods: {
|
|
272
|
+
calculateAnchorZindex() {
|
|
273
|
+
return this.$el.getRootNode().querySelector('.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"]') || // Special case because we don't have any dialtone drawer component yet. Render at 651 when
|
|
274
|
+
// anchor of popover is within a drawer.
|
|
275
|
+
this.$el.closest(".d-zi-drawer") ? 651 : 400;
|
|
276
|
+
},
|
|
277
|
+
hasVisibleFocus() {
|
|
278
|
+
return this.anchor.matches(":focus-visible");
|
|
279
|
+
},
|
|
280
|
+
onEnterAnchor(e) {
|
|
281
|
+
this.isTouchDevice && !e.relatedTarget || (this.delay ? this.inTimer = setTimeout((function(t) {
|
|
282
|
+
this.triggerShow(t);
|
|
283
|
+
}).bind(this, e), d) : this.triggerShow(e), this.isTouchDevice = !1);
|
|
284
|
+
},
|
|
285
|
+
triggerShow(e) {
|
|
286
|
+
e.type === "focusin" ? this.show === null && this.hasVisibleFocus() && (this.isShown = !0) : this.show === null && (this.isShown = !0);
|
|
287
|
+
},
|
|
288
|
+
onLeaveAnchor(e) {
|
|
289
|
+
e.type === "keydown" && e.code !== "Escape" || (clearTimeout(this.inTimer), this.triggerHide());
|
|
290
|
+
},
|
|
291
|
+
triggerHide() {
|
|
292
|
+
this.show === null && (this.isShown = !1);
|
|
293
|
+
},
|
|
294
|
+
onChangePlacement(e) {
|
|
295
|
+
this.currentPlacement = e;
|
|
296
|
+
},
|
|
297
|
+
onLeaveTransitionComplete() {
|
|
298
|
+
var e;
|
|
299
|
+
(e = this.tip) == null || e.unmount(), this.$emit("shown", !1), this.show !== null && this.$emit("update:show", !1);
|
|
300
|
+
},
|
|
301
|
+
onEnterTransitionComplete() {
|
|
302
|
+
this.$emit("shown", !0), this.show !== null && this.$emit("update:show", !0);
|
|
303
|
+
},
|
|
304
|
+
setProps() {
|
|
305
|
+
var e, t;
|
|
306
|
+
this.tip && this.tip.setProps && this.tip.setProps({
|
|
307
|
+
...this.tippyProps,
|
|
308
|
+
zIndex: this.calculateAnchorZindex(),
|
|
309
|
+
appendTo: this.appendTo === "body" ? (t = (e = this.anchor) == null ? void 0 : e.getRootNode()) == null ? void 0 : t.querySelector("body") : this.appendTo
|
|
310
|
+
});
|
|
311
|
+
},
|
|
312
|
+
onMount() {
|
|
313
|
+
this.setProps();
|
|
314
|
+
},
|
|
315
|
+
initOptions() {
|
|
316
|
+
return {
|
|
317
|
+
contentElement: this.$refs.content.$el,
|
|
318
|
+
allowHTML: !0,
|
|
319
|
+
zIndex: this.calculateAnchorZindex(),
|
|
320
|
+
onMount: this.onMount,
|
|
321
|
+
...this.tippyProps
|
|
322
|
+
};
|
|
323
|
+
},
|
|
324
|
+
addExternalAnchorEventListeners() {
|
|
325
|
+
["focusin", "mouseenter"].forEach((e) => {
|
|
326
|
+
this.anchor.addEventListener(e, (t) => this.onEnterAnchor(t));
|
|
327
|
+
}), ["focusout", "mouseleave", "keydown"].forEach((e) => {
|
|
328
|
+
this.anchor.addEventListener(e, (t) => this.onLeaveAnchor(t));
|
|
329
|
+
});
|
|
330
|
+
},
|
|
331
|
+
removeExternalAnchorEventListeners() {
|
|
332
|
+
["focusin", "mouseenter"].forEach((e) => {
|
|
333
|
+
this.anchor.removeEventListener(e, (t) => this.onEnterAnchor(t));
|
|
334
|
+
}), ["focusout", "mouseleave", "keydown"].forEach((e) => {
|
|
335
|
+
this.anchor.removeEventListener(e, (t) => this.onLeaveAnchor(t));
|
|
336
|
+
});
|
|
337
|
+
},
|
|
338
|
+
onTouchStart() {
|
|
339
|
+
this.isTouchDevice = !0;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
var v = function() {
|
|
344
|
+
var t = this, n = t._self._c;
|
|
345
|
+
return n("div", { attrs: { "data-qa": "dt-tooltip-container" } }, [t.externalAnchor ? t._e() : n("span", { ref: "anchor", attrs: { "data-qa": "dt-tooltip-anchor" }, on: { focusin: t.onEnterAnchor, focusout: t.onLeaveAnchor, mouseenter: t.onEnterAnchor, mouseleave: t.onLeaveAnchor, keydown: function(s) {
|
|
346
|
+
return !s.type.indexOf("key") && t._k(s.keyCode, "esc", 27, s.key, ["Esc", "Escape"]) ? null : t.onLeaveAnchor.apply(null, arguments);
|
|
347
|
+
}, touchstart: t.onTouchStart } }, [t._t("anchor")], 2), n("dt-lazy-show", t._g({ ref: "content", class: [
|
|
348
|
+
"d-tooltip",
|
|
349
|
+
`d-tooltip__arrow-tippy--${t.currentPlacement}`,
|
|
350
|
+
{
|
|
351
|
+
[t.TOOLTIP_KIND_MODIFIERS.inverted]: t.inverted
|
|
352
|
+
},
|
|
353
|
+
t.contentClass
|
|
354
|
+
], attrs: { id: t.id, show: t.isVisible, role: "tooltip", "aria-hidden": "false", "data-qa": "dt-tooltip", appear: "", transition: t.transition } }, t.tooltipListeners), [t._t("default", function() {
|
|
355
|
+
return [t._v(" " + t._s(t.message) + " ")];
|
|
356
|
+
})], 2)], 1);
|
|
357
|
+
}, w = [], E = /* @__PURE__ */ m(
|
|
358
|
+
T,
|
|
359
|
+
v,
|
|
360
|
+
w,
|
|
361
|
+
!1,
|
|
362
|
+
null,
|
|
363
|
+
null,
|
|
364
|
+
null,
|
|
365
|
+
null
|
|
366
|
+
);
|
|
367
|
+
const O = E.exports;
|
|
368
|
+
export {
|
|
369
|
+
O as DtTooltip,
|
|
370
|
+
d as TOOLTIP_DELAY_MS,
|
|
371
|
+
r as TOOLTIP_DIRECTIONS,
|
|
372
|
+
D as TOOLTIP_HIDE_ON_CLICK_VARIANTS,
|
|
373
|
+
l as TOOLTIP_KIND_MODIFIERS,
|
|
374
|
+
a as TOOLTIP_STICKY_VALUES
|
|
375
|
+
};
|
|
376
|
+
//# sourceMappingURL=tooltip.js.map
|