@dialpad/dialtone-vue 3.93.1 → 3.94.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.
Files changed (58) hide show
  1. package/CHANGELOG.json +1 -1
  2. package/CHANGELOG.md +25 -0
  3. package/dist/component-documentation.json +1 -1
  4. package/dist/dialtone-vue.cjs +5 -5
  5. package/dist/dialtone-vue.js +2228 -3726
  6. package/dist/directives.cjs +1 -1
  7. package/dist/directives.js +4 -3
  8. package/dist/emoji-2ba641cd.cjs +1 -0
  9. package/dist/{emoji-ee056efb.js → emoji-fa0ee549.js} +1073 -17030
  10. package/dist/emoji.cjs +1 -1
  11. package/dist/emoji.js +31 -29
  12. package/dist/message_input-104c4579.js +3619 -0
  13. package/dist/message_input-4d2df135.cjs +2 -0
  14. package/dist/message_input.cjs +1 -1
  15. package/dist/message_input.js +18 -4
  16. package/dist/style.css +1 -1
  17. package/dist/tooltip-0cdd1500.js +738 -0
  18. package/dist/tooltip-e88ebb8c.cjs +1 -0
  19. package/dist/types/common/storybook_utils.d.ts +1 -1
  20. package/dist/types/common/storybook_utils.d.ts.map +1 -1
  21. package/dist/types/components/avatar/avatar.vue.d.ts +1 -1
  22. package/dist/types/components/button/button.vue.d.ts +1 -1
  23. package/dist/types/components/chip/chip.vue.d.ts +1 -1
  24. package/dist/types/components/combobox/combobox.vue.d.ts +1 -1
  25. package/dist/types/components/datepicker/modules/month-year-picker.vue.d.ts +1 -1
  26. package/dist/types/components/description_list/description_list.vue.d.ts +98 -0
  27. package/dist/types/components/description_list/description_list.vue.d.ts.map +1 -0
  28. package/dist/types/components/description_list/description_list_constants.d.ts +2 -0
  29. package/dist/types/components/description_list/description_list_constants.d.ts.map +1 -0
  30. package/dist/types/components/description_list/description_list_validators.d.ts +2 -0
  31. package/dist/types/components/description_list/description_list_validators.d.ts.map +1 -0
  32. package/dist/types/components/description_list/index.d.ts +3 -0
  33. package/dist/types/components/description_list/index.d.ts.map +1 -0
  34. package/dist/types/components/icon/icon.vue.d.ts +16 -2
  35. package/dist/types/components/icon/icon.vue.d.ts.map +1 -1
  36. package/dist/types/components/icon/icon_constants.d.ts +0 -2
  37. package/dist/types/components/icon/icon_constants.d.ts.map +1 -1
  38. package/dist/types/components/input/input.vue.d.ts +1 -1
  39. package/dist/types/components/modal/modal.vue.d.ts +1 -1
  40. package/dist/types/components/notice/notice.vue.d.ts +1 -1
  41. package/dist/types/components/radio/radio.vue.d.ts +1 -1
  42. package/dist/types/components/root_layout/root_layout.vue.d.ts +2 -2
  43. package/dist/types/components/scroller/modules/core_scroller.vue.d.ts +1 -1
  44. package/dist/types/components/scroller/modules/scroller_item.vue.d.ts +1 -1
  45. package/dist/types/components/tabs/tab.vue.d.ts +1 -1
  46. package/dist/types/components/toast/toast.vue.d.ts +2 -2
  47. package/dist/types/components/tooltip/tooltip.vue.d.ts +1 -1
  48. package/dist/types/index.d.ts +1 -0
  49. package/dist/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -1
  50. package/dist/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +1 -1
  51. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +17 -0
  52. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  53. package/package.json +8 -4
  54. package/dist/emoji-125c2250.cjs +0 -1
  55. package/dist/message_input-2f040a4e.cjs +0 -93
  56. package/dist/message_input-97a05856.js +0 -15876
  57. package/dist/tooltip-02b802bc.js +0 -2577
  58. package/dist/tooltip-3390fc3b.cjs +0 -25
@@ -0,0 +1,3619 @@
1
+ import { NodeViewWrapper as oe, nodeViewProps as ie, VueRenderer as ae, VueNodeViewRenderer as re, EditorContent as ke, Editor as Ie } from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/vue-3/dist/index.js";
2
+ import we from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/extension-code-block/dist/index.js";
3
+ import Oe from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/extension-document/dist/index.js";
4
+ import Te from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/extension-hard-break/dist/index.js";
5
+ import Ae from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/extension-paragraph/dist/index.js";
6
+ import Pe from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/extension-placeholder/dist/index.js";
7
+ import Le from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/extension-text/dist/index.js";
8
+ import { Node as je, mergeAttributes as K, nodeInputRule as U, nodePasteRule as G, getMarksBetween as De, combineTransactionSteps as xe, getChangedRanges as Re, findChildrenInRange as Fe, Mark as Ne } from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/core/dist/index.js";
9
+ import { D as A, y as Be, b as N, L as Ve, j as Me, g as le, a5 as He, a0 as qe, a3 as de, _ as Ke, f as ze } from "./emoji-fa0ee549.js";
10
+ import { openBlock as a, createElementBlock as p, toDisplayString as E, createCommentVNode as g, createElementVNode as S, normalizeClass as _, resolveComponent as d, createBlock as h, resolveDynamicComponent as O, withCtx as u, mergeProps as L, renderSlot as f, createVNode as m, createTextVNode as R, withKeys as w, withModifiers as P, toHandlers as ce, createSlots as $e, renderList as ue, Teleport as We, withDirectives as Ue, Fragment as me, vShow as Ge, markRaw as pe, normalizeStyle as Ye } from "vue";
11
+ import { _ as v, g as H, p as Ze, h as B, u as Xe, q as Je, d as Qe, r as et, t as tt, v as nt, w as st, x as ot, D as it } from "./tooltip-0cdd1500.js";
12
+ import { PluginKey as fe, Plugin as at } from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/pm/state/dist/index.js";
13
+ import rt from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/suggestion/dist/index.js";
14
+ import "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/emoji-regex/index.mjs";
15
+ import he from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/tippy.js/dist/tippy.esm.js";
16
+ import lt from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@tiptap/extension-mention/dist/index.js";
17
+ import dt from "/home/runner/work/dialtone-vue/dialtone-vue/node_modules/@dialpad/dialtone-icons/dist/icons.json";
18
+ const D = {
19
+ BUSY: "busy",
20
+ AWAY: "away",
21
+ OFFLINE: "offline",
22
+ ACTIVE: "active"
23
+ }, ct = [
24
+ D.BUSY,
25
+ D.AWAY,
26
+ D.OFFLINE,
27
+ D.ACTIVE
28
+ ], ut = {
29
+ name: "DtPresence",
30
+ props: {
31
+ /**
32
+ * Determines the color of the inner presence circle, indicating status.
33
+ * Accepts one of 4 values: 'busy', 'away', 'active', 'offline'
34
+ * @values busy, away, active, offline
35
+ */
36
+ presence: {
37
+ type: String,
38
+ default: D.ACTIVE,
39
+ validator: (e) => ct.includes(e)
40
+ },
41
+ /**
42
+ * Since Presence is a visual element, we need SRs to read out any state changes
43
+ * that occur.
44
+ * Text entered here will be read by assistive technology. If null this component will be ignored by AT.
45
+ */
46
+ srText: {
47
+ type: String,
48
+ default: null
49
+ }
50
+ }
51
+ }, mt = ["aria-live"], pt = {
52
+ key: 0,
53
+ "data-qa": "dt-presence-sr-text",
54
+ class: "sr-only"
55
+ };
56
+ function ft(e, t, n, i, o, s) {
57
+ return a(), p("div", {
58
+ class: "d-presence",
59
+ "data-qa": "dt-presence",
60
+ role: "status",
61
+ "aria-live": e.$attrs.ariaLive || "off"
62
+ }, [
63
+ n.srText ? (a(), p("span", pt, E(n.srText), 1)) : g("", !0),
64
+ S("div", {
65
+ class: _(["d-presence__inner", {
66
+ "d-presence__inner--active": n.presence === "active",
67
+ "d-presence__inner--away": n.presence === "away",
68
+ "d-presence__inner--busy": n.presence === "busy",
69
+ "d-presence__inner--offline": n.presence === "offline"
70
+ }])
71
+ }, null, 2)
72
+ ], 8, mt);
73
+ }
74
+ const ht = /* @__PURE__ */ v(ut, [["render", ft]]), V = {
75
+ xs: "d-avatar--xs",
76
+ sm: "d-avatar--sm",
77
+ md: "d-avatar--md",
78
+ lg: "d-avatar--lg",
79
+ xl: "d-avatar--xl"
80
+ }, gt = {
81
+ default: "",
82
+ icon: "d-avatar__icon",
83
+ initials: "d-avatar__initials"
84
+ }, yt = {
85
+ md: "d-avatar__presence--md",
86
+ lg: "d-avatar__presence--lg"
87
+ }, Y = {
88
+ NONE: "",
89
+ BUSY: "busy",
90
+ AWAY: "away",
91
+ OFFLINE: "offline",
92
+ ACTIVE: "active"
93
+ }, _t = {
94
+ xs: "100",
95
+ sm: "200",
96
+ md: "300",
97
+ lg: "500",
98
+ xl: "600"
99
+ }, vt = [
100
+ "100",
101
+ "200",
102
+ "300",
103
+ "400",
104
+ "500",
105
+ "600",
106
+ "700",
107
+ "800",
108
+ "900",
109
+ "1000",
110
+ "1100",
111
+ "1200",
112
+ "1300",
113
+ "1400",
114
+ "1500",
115
+ "1600",
116
+ "1700",
117
+ "1800"
118
+ ], Z = (e) => e > 1;
119
+ function bt() {
120
+ return [void 0, ...dt];
121
+ }
122
+ const St = (e) => {
123
+ if (typeof e != "string" || !e.trim())
124
+ return "";
125
+ const t = e.trim().split(/\s+/g);
126
+ return t.length === 1 ? t.join("").substring(0, 2) : t.filter((n, i) => i === 0 || i === t.length - 1).map((n) => n.slice(0, 1).toUpperCase()).join("");
127
+ };
128
+ const Et = bt(), Ct = {
129
+ name: "DtAvatar",
130
+ components: { DtPresence: ht, DtIcon: A },
131
+ inheritAttrs: !1,
132
+ props: {
133
+ /**
134
+ * Id of the avatar content wrapper element
135
+ */
136
+ id: {
137
+ type: String,
138
+ default() {
139
+ return H();
140
+ }
141
+ },
142
+ /**
143
+ * Pass in a seed to get the random color generation based on that string. For example if you pass in a
144
+ * user ID as the string it will return the same randomly generated colors every time for that user.
145
+ */
146
+ seed: {
147
+ type: String,
148
+ default: void 0
149
+ },
150
+ /**
151
+ * Set the avatar background to a specific color. If undefined will randomize the color which can be deterministic
152
+ * if the seed prop is set.
153
+ */
154
+ color: {
155
+ type: String,
156
+ default: void 0
157
+ },
158
+ /**
159
+ * The size of the avatar
160
+ * @values xs, sm, md, lg, xl
161
+ */
162
+ size: {
163
+ type: String,
164
+ default: "md",
165
+ validator: (e) => Object.keys(V).includes(e)
166
+ },
167
+ /**
168
+ * Used to customize the avatar container
169
+ */
170
+ avatarClass: {
171
+ type: [String, Array, Object],
172
+ default: ""
173
+ },
174
+ /**
175
+ * Set classes on the avatar canvas. Wrapper around the core avatar image.
176
+ */
177
+ canvasClass: {
178
+ type: [String, Array, Object],
179
+ default: ""
180
+ },
181
+ /**
182
+ * Pass through classes. Used to customize the avatar icon
183
+ */
184
+ iconClass: {
185
+ type: [String, Array, Object],
186
+ default: ""
187
+ },
188
+ /**
189
+ * Determines whether to show the presence indicator for
190
+ * Avatar - accepts PRESENCE_STATES values: 'busy', 'away', 'offline',
191
+ * or 'active'. By default, it's null and nothing is shown.
192
+ * @values null, busy, away, offline, active
193
+ */
194
+ presence: {
195
+ type: String,
196
+ default: Y.NONE,
197
+ validator: (e) => Object.values(Y).includes(e)
198
+ },
199
+ /**
200
+ * A set of props to be passed into the presence component.
201
+ */
202
+ presenceProps: {
203
+ type: Object,
204
+ default: () => ({})
205
+ },
206
+ /**
207
+ * Determines whether to show a group avatar.
208
+ * Limit to 2 digits max, more than 99 will be rendered as “99+”.
209
+ * if the number is 1 or less it would just show the regular avatar as if group had not been set.
210
+ */
211
+ group: {
212
+ type: Number,
213
+ default: void 0,
214
+ validator: (e) => Z(e)
215
+ },
216
+ /**
217
+ * The icon that overlays the avatar
218
+ */
219
+ overlayIcon: {
220
+ type: String,
221
+ default: ""
222
+ },
223
+ /**
224
+ * The text that overlays the avatar
225
+ */
226
+ overlayText: {
227
+ type: String,
228
+ default: ""
229
+ },
230
+ /**
231
+ * Used to customize the avatar overlay
232
+ */
233
+ overlayClass: {
234
+ type: [String, Array, Object],
235
+ default: ""
236
+ },
237
+ /**
238
+ * Source of the image
239
+ */
240
+ imageSrc: {
241
+ type: String,
242
+ default: ""
243
+ },
244
+ /**
245
+ * Alt attribute of the image, by default
246
+ * it'd be the full name
247
+ */
248
+ imageAlt: {
249
+ type: String,
250
+ default: ""
251
+ },
252
+ /**
253
+ * Icon name to be displayed on the avatar
254
+ */
255
+ iconName: {
256
+ type: String,
257
+ default: void 0,
258
+ validator: (e) => Et.includes(e)
259
+ },
260
+ /**
261
+ * Icon size to be displayed on the avatar
262
+ * @values 100, 200, 300, 400, 500, 600, 700, 800
263
+ */
264
+ iconSize: {
265
+ type: String,
266
+ default: "",
267
+ validator: (e) => !e || Object.keys(Be).includes(e)
268
+ },
269
+ /**
270
+ * Full name used to extract initials and set alt attribute.
271
+ */
272
+ fullName: {
273
+ type: String,
274
+ default: ""
275
+ },
276
+ /**
277
+ * Makes the avatar focusable and clickable,
278
+ * emits a click event when clicked.
279
+ */
280
+ clickable: {
281
+ type: Boolean,
282
+ default: !1
283
+ }
284
+ },
285
+ emits: [
286
+ /**
287
+ * Avatar click event
288
+ *
289
+ * @event click
290
+ * @type {PointerEvent | KeyboardEvent}
291
+ */
292
+ "click"
293
+ ],
294
+ data() {
295
+ return {
296
+ AVATAR_SIZE_MODIFIERS: V,
297
+ AVATAR_KIND_MODIFIERS: gt,
298
+ AVATAR_PRESENCE_SIZE_MODIFIERS: yt,
299
+ AVATAR_ICON_SIZES: _t,
300
+ imageLoadedSuccessfully: null,
301
+ formattedInitials: "",
302
+ initializing: !1
303
+ };
304
+ },
305
+ computed: {
306
+ isNotIconType() {
307
+ return !this.iconName;
308
+ },
309
+ avatarClasses() {
310
+ return [
311
+ "d-avatar",
312
+ V[this.validatedSize],
313
+ this.avatarClass,
314
+ {
315
+ "d-avatar--group": this.showGroup,
316
+ [`d-avatar--color-${this.getColor()}`]: this.isNotIconType,
317
+ "d-avatar--clickable": this.clickable
318
+ }
319
+ ];
320
+ },
321
+ overlayClasses() {
322
+ return [
323
+ "d-avatar__overlay",
324
+ this.overlayClass
325
+ ];
326
+ },
327
+ showGroup() {
328
+ return Z(this.group);
329
+ },
330
+ formattedGroup() {
331
+ return this.group > 99 ? "99+" : this.group;
332
+ },
333
+ validatedSize() {
334
+ return this.group ? "xs" : this.size;
335
+ },
336
+ showImage() {
337
+ return this.imageLoadedSuccessfully !== !1 && this.imageSrc;
338
+ },
339
+ buttonAriaLabel() {
340
+ if (this.clickable)
341
+ return this.fullName || this.imageAlt || this.$attrs["aria-label"];
342
+ }
343
+ },
344
+ watch: {
345
+ fullName: {
346
+ immediate: !0,
347
+ handler(e) {
348
+ this.formatInitials(e);
349
+ }
350
+ },
351
+ imageSrc(e) {
352
+ this.imageLoadedSuccessfully = null, e && (this.validateProps(), this.setImageListeners());
353
+ }
354
+ },
355
+ mounted() {
356
+ this.validateProps(), this.setImageListeners();
357
+ },
358
+ methods: {
359
+ async setImageListeners() {
360
+ await this.$nextTick();
361
+ const e = this.$refs.avatarImage;
362
+ e && (e.addEventListener("load", () => this._loadedImageEventHandler(e), { once: !0 }), e.addEventListener("error", () => this._erroredImageEventHandler(e), { once: !0 }));
363
+ },
364
+ formatInitials(e) {
365
+ const t = St(e);
366
+ this.validatedSize === "xs" ? this.formattedInitials = "" : this.validatedSize === "sm" ? this.formattedInitials = t[0] : this.formattedInitials = t;
367
+ },
368
+ getColor() {
369
+ return this.color ?? Ze(vt, this.seed);
370
+ },
371
+ _loadedImageEventHandler(e) {
372
+ this.imageLoadedSuccessfully = !0, e.classList.remove("d-d-none");
373
+ },
374
+ _erroredImageEventHandler(e) {
375
+ this.imageLoadedSuccessfully = !1, e.classList.add("d-d-none");
376
+ },
377
+ validateProps() {
378
+ if (this.imageSrc && !(this.fullName || this.imageAlt))
379
+ throw new Error("full-name or image-alt must be set if image-src is provided");
380
+ },
381
+ handleClick(e) {
382
+ this.clickable && this.$emit("click", e);
383
+ }
384
+ }
385
+ }, kt = ["src", "alt"], It = {
386
+ key: 1,
387
+ class: "d-avatar__overlay-text"
388
+ }, wt = {
389
+ key: 1,
390
+ class: "d-avatar__count",
391
+ "data-qa": "dt-avatar-count"
392
+ };
393
+ function Ot(e, t, n, i, o, s) {
394
+ const r = d("dt-icon"), c = d("dt-presence");
395
+ return a(), h(O(n.clickable ? "button" : "div"), {
396
+ id: n.id,
397
+ class: _(s.avatarClasses),
398
+ "data-qa": "dt-avatar",
399
+ "aria-label": s.buttonAriaLabel,
400
+ onClick: s.handleClick
401
+ }, {
402
+ default: u(() => [
403
+ S("div", {
404
+ ref: "canvas",
405
+ class: _([
406
+ n.canvasClass,
407
+ "d-avatar__canvas",
408
+ { "d-avatar--image-loaded": o.imageLoadedSuccessfully }
409
+ ])
410
+ }, [
411
+ s.showImage ? (a(), p("img", {
412
+ key: 0,
413
+ ref: "avatarImage",
414
+ class: "d-avatar__image",
415
+ "data-qa": "dt-avatar-image",
416
+ src: n.imageSrc,
417
+ alt: n.imageAlt || n.fullName
418
+ }, null, 8, kt)) : n.iconName ? (a(), h(r, {
419
+ key: 1,
420
+ name: n.iconName,
421
+ size: n.iconSize || o.AVATAR_ICON_SIZES[n.size],
422
+ class: _([n.iconClass, o.AVATAR_KIND_MODIFIERS.icon]),
423
+ "data-qa": "dt-avatar-icon"
424
+ }, null, 8, ["name", "size", "class"])) : (a(), p("span", {
425
+ key: 2,
426
+ class: _([o.AVATAR_KIND_MODIFIERS.initials, "d-ps-absolute d-zi-base d-us-none"])
427
+ }, E(o.formattedInitials), 3))
428
+ ], 2),
429
+ n.overlayIcon || n.overlayText ? (a(), p("div", {
430
+ key: 0,
431
+ class: _(s.overlayClasses)
432
+ }, [
433
+ n.overlayIcon ? (a(), h(r, {
434
+ key: 0,
435
+ class: "d-avatar__overlay-icon",
436
+ name: n.overlayIcon
437
+ }, null, 8, ["name"])) : n.overlayText ? (a(), p("p", It, E(n.overlayText), 1)) : g("", !0)
438
+ ], 2)) : g("", !0),
439
+ s.showGroup ? (a(), p("span", wt, E(s.formattedGroup), 1)) : g("", !0),
440
+ n.presence && !s.showGroup ? (a(), h(c, L({
441
+ key: 2,
442
+ presence: n.presence,
443
+ class: [
444
+ "d-avatar__presence",
445
+ o.AVATAR_PRESENCE_SIZE_MODIFIERS[n.size]
446
+ ]
447
+ }, n.presenceProps, { "data-qa": "dt-presence" }), null, 16, ["presence", "class"])) : g("", !0)
448
+ ]),
449
+ _: 1
450
+ }, 8, ["id", "class", "aria-label", "onClick"]);
451
+ }
452
+ const Tt = /* @__PURE__ */ v(Ct, [["render", Ot]]), z = ["base", "error", "info", "success", "warning"], At = ["alert", "alertdialog", "status"], Pt = /* @__PURE__ */ new Map([
453
+ ["info", "info"],
454
+ ["success", "check-circle"],
455
+ ["warning", "alert-triangle"],
456
+ ["error", "alert-circle"],
457
+ ["base", "bell"]
458
+ ]), Lt = {
459
+ name: "DtNoticeIcon",
460
+ components: {
461
+ DtIcon: A
462
+ },
463
+ props: {
464
+ /**
465
+ * Kind of icon
466
+ * @values base, error, info, success, warning
467
+ */
468
+ kind: {
469
+ type: String,
470
+ default: "base",
471
+ validate(e) {
472
+ return z.includes(e);
473
+ }
474
+ }
475
+ },
476
+ data() {
477
+ return {
478
+ hasSlotContent: B
479
+ };
480
+ },
481
+ computed: {
482
+ defaultIcon() {
483
+ return Pt.get(this.kind);
484
+ }
485
+ }
486
+ }, jt = {
487
+ key: 0,
488
+ "aria-hidden": "true",
489
+ class: "d-notice__icon"
490
+ };
491
+ function Dt(e, t, n, i, o, s) {
492
+ const r = d("dt-icon");
493
+ return s.defaultIcon || o.hasSlotContent(e.$slots.default) ? (a(), p("div", jt, [
494
+ f(e.$slots, "default", {}, () => [
495
+ m(r, {
496
+ name: s.defaultIcon,
497
+ size: "400"
498
+ }, null, 8, ["name"])
499
+ ])
500
+ ])) : g("", !0);
501
+ }
502
+ const xt = /* @__PURE__ */ v(Lt, [["render", Dt]]), Rt = {
503
+ name: "DtNoticeContent",
504
+ props: {
505
+ /**
506
+ * Title header of the notice. This can be left blank to remove the title from the notice entirely.
507
+ */
508
+ title: {
509
+ type: String,
510
+ default: ""
511
+ },
512
+ /**
513
+ * ID for the title element of the component. Useful for aria-describedby
514
+ * or aria-labelledby or any other reason you may need an id to refer to the title.
515
+ */
516
+ titleId: {
517
+ type: String,
518
+ default: void 0
519
+ },
520
+ /**
521
+ * ID for the content element of the component. Useful for aria-describedby
522
+ * or aria-labelledby or any other reason you may need an id to refer to the content.
523
+ */
524
+ contentId: {
525
+ type: String,
526
+ default: void 0
527
+ }
528
+ },
529
+ data() {
530
+ return {
531
+ hasSlotContent: B
532
+ };
533
+ }
534
+ }, Ft = {
535
+ class: "d-notice__content",
536
+ "data-qa": "notice-content"
537
+ }, Nt = ["id"], Bt = ["id"];
538
+ function Vt(e, t, n, i, o, s) {
539
+ return a(), p("div", Ft, [
540
+ n.title || o.hasSlotContent(e.$slots.titleOverride) ? (a(), p("p", {
541
+ key: 0,
542
+ id: n.titleId,
543
+ class: "d-notice__title",
544
+ "data-qa": "notice-content-title"
545
+ }, [
546
+ f(e.$slots, "titleOverride", {}, () => [
547
+ R(E(n.title), 1)
548
+ ])
549
+ ], 8, Nt)) : g("", !0),
550
+ S("p", {
551
+ id: n.contentId,
552
+ class: "d-notice__message",
553
+ "data-qa": "notice-content-message"
554
+ }, [
555
+ f(e.$slots, "default")
556
+ ], 8, Bt)
557
+ ]);
558
+ }
559
+ const Mt = /* @__PURE__ */ v(Rt, [["render", Vt]]), $ = {
560
+ props: {
561
+ /**
562
+ * If true, a hidden close button is included for screen readers
563
+ * @values true, false
564
+ */
565
+ visuallyHiddenClose: {
566
+ type: Boolean,
567
+ default: !1
568
+ },
569
+ /**
570
+ * Label for the visually hidden close button
571
+ * Required if visuallyHiddenClose is set to `true`
572
+ */
573
+ visuallyHiddenCloseLabel: {
574
+ type: String,
575
+ default: null
576
+ }
577
+ },
578
+ watch: {
579
+ $props: {
580
+ immediate: !0,
581
+ deep: !0,
582
+ handler() {
583
+ this.validateVisuallyHiddenCloseProps();
584
+ }
585
+ }
586
+ },
587
+ computed: {
588
+ showVisuallyHiddenClose() {
589
+ return this.visuallyHiddenClose && this.visuallyHiddenCloseLabel != null;
590
+ }
591
+ },
592
+ methods: {
593
+ validateVisuallyHiddenCloseProps() {
594
+ this.visuallyHiddenClose && !this.visuallyHiddenCloseLabel && console.error(`If visuallyHiddenClose prop is true, the component includes
595
+ a visually hidden close button and you must set the visuallyHiddenCloseLabel prop.`);
596
+ }
597
+ }
598
+ }, Ht = {
599
+ name: "SrOnlyCloseButton",
600
+ components: {
601
+ DtIcon: A,
602
+ DtButton: N
603
+ },
604
+ props: {
605
+ /**
606
+ * Label for the visually hidden close button
607
+ * Required if visuallyHiddenClose is set to `true`
608
+ */
609
+ visuallyHiddenCloseLabel: {
610
+ type: String,
611
+ default: null
612
+ }
613
+ },
614
+ emits: ["close"],
615
+ methods: {
616
+ close() {
617
+ this.$emit("close");
618
+ }
619
+ }
620
+ };
621
+ function qt(e, t, n, i, o, s) {
622
+ const r = d("dt-icon"), c = d("dt-button");
623
+ return a(), h(c, {
624
+ id: "sr-only-close-button",
625
+ "data-qa": "dt-sr-only-close-button",
626
+ class: "d-vi-visible-sr",
627
+ "aria-label": n.visuallyHiddenCloseLabel,
628
+ onClick: s.close,
629
+ onKeydown: w(P(s.close, ["prevent", "stop"]), ["space"])
630
+ }, {
631
+ default: u(() => [
632
+ m(r, { name: "close" })
633
+ ]),
634
+ _: 1
635
+ }, 8, ["aria-label", "onClick", "onKeydown"]);
636
+ }
637
+ const ge = /* @__PURE__ */ v(Ht, [["render", qt]]), Kt = {
638
+ name: "DtNoticeAction",
639
+ components: {
640
+ DtIcon: A,
641
+ DtButton: N,
642
+ SrOnlyCloseButton: ge
643
+ },
644
+ mixins: [$],
645
+ props: {
646
+ /**
647
+ * Props for the notice close button.
648
+ */
649
+ closeButtonProps: {
650
+ type: Object,
651
+ default: () => ({})
652
+ },
653
+ /**
654
+ * Hides the close button from the notice
655
+ * @values true, false
656
+ */
657
+ hideClose: {
658
+ type: Boolean,
659
+ default: !1
660
+ }
661
+ },
662
+ emits: [
663
+ /**
664
+ * Close button click event
665
+ *
666
+ * @event close
667
+ */
668
+ "close"
669
+ ],
670
+ created() {
671
+ !this.hideClose && !this.closeButtonProps.ariaLabel && console.error("Invalid props: you must pass in closeButtonProps.ariaLabel if the close button is displayed.");
672
+ },
673
+ mounted() {
674
+ this.hideClose || (this.lastFocusedElement = document.activeElement);
675
+ },
676
+ beforeUnmount() {
677
+ var e;
678
+ (e = this.lastFocusedElement) == null || e.focus();
679
+ },
680
+ methods: {
681
+ close() {
682
+ this.$emit("close");
683
+ }
684
+ }
685
+ }, zt = {
686
+ class: "d-notice__actions",
687
+ "data-qa": "notice-content-actions"
688
+ };
689
+ function $t(e, t, n, i, o, s) {
690
+ const r = d("dt-icon"), c = d("dt-button"), b = d("sr-only-close-button");
691
+ return a(), p("div", zt, [
692
+ f(e.$slots, "default"),
693
+ n.hideClose ? g("", !0) : (a(), h(c, L({
694
+ key: 0,
695
+ ref: "closeButton",
696
+ "data-qa": "dt-notice-action-close-button",
697
+ size: "sm",
698
+ importance: "clear",
699
+ circle: "",
700
+ "aria-label": n.closeButtonProps.ariaLabel ? n.closeButtonProps.ariaLabel : "Close"
701
+ }, n.closeButtonProps, { onClick: s.close }), {
702
+ icon: u(() => [
703
+ m(r, {
704
+ name: "close",
705
+ size: "200"
706
+ })
707
+ ]),
708
+ _: 1
709
+ }, 16, ["aria-label", "onClick"])),
710
+ e.showVisuallyHiddenClose ? (a(), h(b, {
711
+ key: 1,
712
+ "visually-hidden-close-label": e.visuallyHiddenCloseLabel,
713
+ onClose: s.close
714
+ }, null, 8, ["visually-hidden-close-label", "onClose"])) : g("", !0)
715
+ ]);
716
+ }
717
+ const Wt = /* @__PURE__ */ v(Kt, [["render", $t]]), ye = ':not(:disabled):not([aria-disabled="true"]):not([role="presentation"])', Ut = `${ye}:not([tabindex="-1"])`, Gt = "button,[href],input,select,textarea,details,[tabindex]", Yt = {
718
+ methods: {
719
+ /**
720
+ * get the first focusable element in your component, includes tabindex="-1".
721
+ * @param {object} el - optional - ref of dom element to trap focus on.
722
+ * will default to the root node of the vue component
723
+ */
724
+ async getFirstFocusableElement(e) {
725
+ await this.$nextTick();
726
+ const t = this._getFocusableElements(e, !0);
727
+ return this._getFirstFocusElement(t);
728
+ },
729
+ /**
730
+ * set focus to the first focusable element in your component, includes tabindex="-1".
731
+ * @param {object} el - optional - ref of dom element to trap focus on.
732
+ * will default to the root node of the vue component
733
+ */
734
+ async focusFirstElement(e) {
735
+ const t = await this.getFirstFocusableElement(e);
736
+ t == null || t.focus({ preventScroll: !0 });
737
+ },
738
+ /**
739
+ * internal use only.
740
+ *
741
+ * @param focusableElements - list of focusable elements
742
+ * @returns {*} - first DOM element that is focusable.
743
+ * @private
744
+ */
745
+ _getFirstFocusElement(e) {
746
+ if (!e.length)
747
+ return;
748
+ let t = e[0];
749
+ return t.matches('[type="radio"]:not(:checked)') && (t = e.find((n) => n.checked && n.name === t.name) || t), t;
750
+ },
751
+ /**
752
+ * internal use only.
753
+ *
754
+ * gets all the focusable elements within the component
755
+ * and sets the first and last of those elements.
756
+ *
757
+ * @param {object} el - the root dom element to find focusable elements in.
758
+ * @param {bool} includeNegativeTabIndex - will include tabindex="-1" in the list of focusable elements.
759
+ */
760
+ _getFocusableElements(e = this.$el, t = !1) {
761
+ return e ? [...e.querySelectorAll(Gt)].filter((i) => {
762
+ const o = window.getComputedStyle(i);
763
+ return o.getPropertyValue("display") !== "none" && o.getPropertyValue("visibility") !== "hidden" && i.matches(t ? ye : Ut);
764
+ }) : [];
765
+ },
766
+ /**
767
+ * tabs to the next element contained within your component, does not include tabindex="-1".
768
+ * @param {object} e - keypress event
769
+ * @param {object} el - optional - ref of dom element to trap focus on.
770
+ * will default to the root node of the vue component
771
+ */
772
+ focusTrappedTabPress(e, t) {
773
+ if (!(e.key === "Tab"))
774
+ return;
775
+ const i = this._getFocusableElements(t);
776
+ if (!i.length) {
777
+ e.preventDefault();
778
+ return;
779
+ }
780
+ const o = this._getFirstFocusElement(i), s = i[i.length - 1];
781
+ e.shiftKey ? document.activeElement === o && (s.focus(), e.preventDefault()) : document.activeElement === s && (o.focus(), e.preventDefault());
782
+ }
783
+ }
784
+ }, Zt = {
785
+ name: "DtLink",
786
+ props: {
787
+ /**
788
+ * Applies the link variant styles
789
+ * @values null, danger, warning, success, muted, inverted
790
+ */
791
+ kind: {
792
+ type: String,
793
+ default: "",
794
+ validator(e) {
795
+ return Ve.includes(e);
796
+ }
797
+ }
798
+ },
799
+ data() {
800
+ return {
801
+ LINK_KIND_MODIFIERS: Me
802
+ };
803
+ }
804
+ }, Xt = ["href"];
805
+ function Jt(e, t, n, i, o, s) {
806
+ return a(), p("a", {
807
+ class: _([
808
+ "d-link",
809
+ o.LINK_KIND_MODIFIERS[n.kind]
810
+ ]),
811
+ "data-qa": "dt-link",
812
+ href: "href" in e.$attrs ? e.$attrs.href : "javascript:void(0)"
813
+ }, [
814
+ f(e.$slots, "default")
815
+ ], 10, Xt);
816
+ }
817
+ const Qt = /* @__PURE__ */ v(Zt, [["render", Jt]]), M = {
818
+ DEFAULT: "default",
819
+ CUSTOM: "custom"
820
+ }, F = {
821
+ ARROW_KEYS: "arrow-keys",
822
+ TAB: "tab",
823
+ NONE: "none"
824
+ };
825
+ const en = {
826
+ name: "DtItemLayout",
827
+ props: {
828
+ /**
829
+ * Set this prop to render layout as a specific HTML element.
830
+ */
831
+ as: {
832
+ type: String,
833
+ default: "div"
834
+ }
835
+ }
836
+ }, tn = {
837
+ key: 0,
838
+ "data-qa": "dt-item-layout-left-wrapper",
839
+ class: "dt-item-layout--left"
840
+ }, nn = {
841
+ "data-qa": "dt-item-layout-content-wrapper",
842
+ class: "dt-item-layout--content"
843
+ }, sn = {
844
+ key: 0,
845
+ "data-qa": "dt-item-layout-title-wrapper",
846
+ class: "dt-item-layout--title"
847
+ }, on = {
848
+ key: 2,
849
+ "data-qa": "dt-item-layout-bottom-wrapper",
850
+ class: "dt-item-layout--bottom"
851
+ }, an = {
852
+ key: 1,
853
+ "data-qa": "dt-item-layout-right-wrapper",
854
+ class: "dt-item-layout--right"
855
+ }, rn = {
856
+ key: 2,
857
+ "data-qa": "dt-item-layout-selected-wrapper",
858
+ class: "dt-item-layout--selected"
859
+ };
860
+ function ln(e, t, n, i, o, s) {
861
+ return a(), h(O(n.as), { class: "dt-item-layout" }, {
862
+ default: u(() => [
863
+ e.$slots.left ? (a(), p("section", tn, [
864
+ f(e.$slots, "left", {}, void 0, !0)
865
+ ])) : g("", !0),
866
+ S("section", nn, [
867
+ e.$slots.default ? (a(), p("div", sn, [
868
+ f(e.$slots, "default", {}, void 0, !0)
869
+ ])) : g("", !0),
870
+ e.$slots.subtitle ? (a(), p("div", {
871
+ key: 1,
872
+ "data-qa": "dt-item-layout-subtitle-wrapper",
873
+ class: _(["dt-item-layout--subtitle", { "d-mtn2": e.$slots.default }])
874
+ }, [
875
+ f(e.$slots, "subtitle", {}, void 0, !0)
876
+ ], 2)) : g("", !0),
877
+ e.$slots.bottom ? (a(), p("div", on, [
878
+ f(e.$slots, "bottom", {}, void 0, !0)
879
+ ])) : g("", !0)
880
+ ]),
881
+ e.$slots.right ? (a(), p("section", an, [
882
+ f(e.$slots, "right", {}, void 0, !0)
883
+ ])) : g("", !0),
884
+ e.$slots.selected ? (a(), p("section", rn, [
885
+ f(e.$slots, "selected", {}, void 0, !0)
886
+ ])) : g("", !0)
887
+ ]),
888
+ _: 3
889
+ });
890
+ }
891
+ const X = /* @__PURE__ */ v(en, [["render", ln], ["__scopeId", "data-v-9afad3c4"]]);
892
+ const dn = {
893
+ name: "DtListItem",
894
+ components: {
895
+ DtItemLayout: X,
896
+ DtIcon: A
897
+ },
898
+ /**
899
+ * Value provided from keyboard_list_navigation.js using id prop.
900
+ */
901
+ inject: {
902
+ highlightId: { default: null }
903
+ },
904
+ props: {
905
+ /**
906
+ * Id for the item.
907
+ */
908
+ id: {
909
+ type: String,
910
+ default() {
911
+ return Xe.getUniqueString();
912
+ }
913
+ },
914
+ /**
915
+ * String to use for the item's role.
916
+ */
917
+ role: {
918
+ type: String,
919
+ default: "listitem"
920
+ },
921
+ /**
922
+ * HTML element type (tag name) of the content wrapper element.
923
+ */
924
+ elementType: {
925
+ type: String,
926
+ default: "li"
927
+ },
928
+ /**
929
+ * The type of child list item to use.
930
+ * @values default, custom
931
+ */
932
+ type: {
933
+ type: String,
934
+ default: M.DEFAULT,
935
+ validator: (e) => Object.values(M).includes(e)
936
+ },
937
+ /**
938
+ * The type of navigation that this component should support.
939
+ * - "arrow-keys" for items that are navigated with UP/DOWN keys.
940
+ * - "tab" for items that are navigated using the TAB key.
941
+ * - "none" for static items that are not interactive.
942
+ * @values arrow-keys, tab, none
943
+ */
944
+ navigationType: {
945
+ type: String,
946
+ default: F.NONE,
947
+ validator: (e) => Object.values(F).includes(e)
948
+ },
949
+ /**
950
+ * Applies selected styles to the list item
951
+ */
952
+ selected: {
953
+ type: Boolean,
954
+ default: !1
955
+ }
956
+ },
957
+ emits: [
958
+ /**
959
+ * Key down event
960
+ *
961
+ * @event keydown
962
+ * @type {KeyboardEvent}
963
+ */
964
+ "keydown",
965
+ /**
966
+ * Native mouse move event
967
+ *
968
+ * @event mousemove
969
+ * @type {MouseEvent}
970
+ */
971
+ "mousemove",
972
+ /**
973
+ * Native mouse leave event
974
+ *
975
+ * @event mouseleave
976
+ * @type {MouseEvent}
977
+ */
978
+ "mouseleave",
979
+ /**
980
+ * Mouse down event
981
+ *
982
+ * @event mousedown
983
+ */
984
+ "mousedown"
985
+ ],
986
+ data() {
987
+ return {
988
+ injected: !1,
989
+ mouseHighlighted: !1
990
+ };
991
+ },
992
+ computed: {
993
+ listItemType() {
994
+ switch (this.type) {
995
+ case M.DEFAULT:
996
+ return X;
997
+ default:
998
+ return null;
999
+ }
1000
+ },
1001
+ listItemListeners() {
1002
+ return {
1003
+ keydown: (e) => {
1004
+ ["enter", "space"].includes(e.code.toLowerCase()) && this.onClick(e), this.$emit("keydown", e);
1005
+ },
1006
+ mousemove: (e) => {
1007
+ this.onMouseHover(e), this.$emit("mousemove", e);
1008
+ },
1009
+ mouseleave: (e) => {
1010
+ this.onMouseLeave(e), this.$emit("mouseleave", e);
1011
+ }
1012
+ };
1013
+ },
1014
+ /**
1015
+ * For keyboard navigation, whether this item is currently highlighted.
1016
+ * An injected highlightId will override the default mouseover highlight.
1017
+ */
1018
+ isHighlighted() {
1019
+ return this.isHoverable ? this.highlightId && this.highlightId() ? this.id === this.highlightId() : this.mouseHighlighted : !1;
1020
+ },
1021
+ isFocusable() {
1022
+ return this.navigationType === F.TAB;
1023
+ },
1024
+ /**
1025
+ * Whether to apply hover styles.
1026
+ */
1027
+ isHoverable() {
1028
+ return this.navigationType !== F.NONE;
1029
+ }
1030
+ },
1031
+ methods: {
1032
+ onClick(e) {
1033
+ this.$emit("click", e);
1034
+ },
1035
+ onMouseHover() {
1036
+ this.mouseHighlighted = !0;
1037
+ },
1038
+ onMouseLeave() {
1039
+ this.mouseHighlighted = !1;
1040
+ }
1041
+ }
1042
+ };
1043
+ function cn(e, t, n, i, o, s) {
1044
+ const r = d("dt-icon");
1045
+ return a(), h(O(n.elementType), L({
1046
+ id: n.id,
1047
+ class: ["dt-list-item", {
1048
+ "dt-list-item--focusable": s.isFocusable,
1049
+ "dt-list-item--highlighted": s.isHighlighted,
1050
+ "dt-list-item--static": !s.isHoverable
1051
+ }],
1052
+ tabindex: s.isFocusable ? 0 : -1,
1053
+ role: n.role,
1054
+ "aria-selected": s.isHighlighted
1055
+ }, ce(s.listItemListeners)), {
1056
+ default: u(() => [
1057
+ s.listItemType ? (a(), h(O(s.listItemType), { key: 0 }, $e({ _: 2 }, [
1058
+ ue(e.$slots, (c, b) => ({
1059
+ name: b,
1060
+ fn: u(() => [
1061
+ f(e.$slots, b)
1062
+ ])
1063
+ })),
1064
+ n.selected ? {
1065
+ name: "selected",
1066
+ fn: u(() => [
1067
+ m(r, {
1068
+ name: "check",
1069
+ size: "400",
1070
+ class: "dt-list-item--selected-icon"
1071
+ })
1072
+ ]),
1073
+ key: "0"
1074
+ } : void 0
1075
+ ]), 1024)) : f(e.$slots, "default", { key: 1 })
1076
+ ]),
1077
+ _: 3
1078
+ }, 16, ["id", "class", "tabindex", "role", "aria-selected"]);
1079
+ }
1080
+ const un = /* @__PURE__ */ v(dn, [["render", cn]]), T = {
1081
+ default: "column",
1082
+ column: "column",
1083
+ row: "row",
1084
+ "row-reverse": "row-reverse",
1085
+ "column-reverse": "column-reverse"
1086
+ }, _e = ["sm", "md", "lg", "xl"], W = ["0", "100", "200", "300", "400", "500", "600"], J = {
1087
+ none: void 0,
1088
+ small: "d-p4",
1089
+ medium: "d-p8",
1090
+ large: "d-p16"
1091
+ }, mn = {
1092
+ none: void 0,
1093
+ small: "d-pl4",
1094
+ medium: "d-pl8",
1095
+ large: "d-pl16"
1096
+ }, pn = ["dialog", "menu", "listbox", "tree", "grid"], fn = ["", "anchor"], hn = ["none", "dialog", "first"], gn = ["parent", "body"], yn = [
1097
+ ...Je
1098
+ ], _n = {
1099
+ name: "PopoverHeaderFooter",
1100
+ components: {
1101
+ DtButton: N,
1102
+ DtIcon: A
1103
+ },
1104
+ props: {
1105
+ // eslint-disable-next-line vue/require-default-prop
1106
+ type: {
1107
+ type: String,
1108
+ validator: function(e) {
1109
+ return ["header", "footer"].includes(e);
1110
+ }
1111
+ },
1112
+ /**
1113
+ * Additional class name for the content wrapper element.
1114
+ */
1115
+ contentClass: {
1116
+ type: [String, Array, Object],
1117
+ default: ""
1118
+ },
1119
+ /**
1120
+ * Determines visibility for close button
1121
+ * @values true, false
1122
+ */
1123
+ showCloseButton: {
1124
+ type: Boolean,
1125
+ default: !1
1126
+ },
1127
+ /**
1128
+ * A set of props to be passed into the popover's header close button.
1129
+ * Requires an 'ariaLabel' property.
1130
+ */
1131
+ closeButtonProps: {
1132
+ type: Object,
1133
+ default: () => {
1134
+ }
1135
+ }
1136
+ },
1137
+ emits: [
1138
+ /**
1139
+ * Emitted when popover is closed
1140
+ *
1141
+ * @event close
1142
+ * @type { Boolean }
1143
+ */
1144
+ "close"
1145
+ ],
1146
+ data() {
1147
+ return {
1148
+ hasSlotContent: B
1149
+ };
1150
+ },
1151
+ methods: {
1152
+ focusCloseButton() {
1153
+ var t;
1154
+ const e = (t = this.$refs["popover__close-button"]) == null ? void 0 : t.$el;
1155
+ e == null || e.focus();
1156
+ }
1157
+ }
1158
+ };
1159
+ function vn(e, t, n, i, o, s) {
1160
+ const r = d("dt-icon"), c = d("dt-button");
1161
+ return a(), p("div", {
1162
+ "data-qa": "dt-popover-header-footer",
1163
+ class: _({
1164
+ "d-popover__header": n.type === "header",
1165
+ "d-popover__footer": n.type === "footer"
1166
+ })
1167
+ }, [
1168
+ o.hasSlotContent(e.$slots.content) ? (a(), p("div", {
1169
+ key: 0,
1170
+ "data-qa": "dt-popover-header-footer-content",
1171
+ class: _(["d-to-ellipsis", "d-w100p", n.contentClass])
1172
+ }, [
1173
+ f(e.$slots, "content")
1174
+ ], 2)) : g("", !0),
1175
+ n.showCloseButton ? (a(), h(c, L({
1176
+ key: 1,
1177
+ ref: "popover__close-button",
1178
+ "data-qa": "dt-popover-close",
1179
+ class: "d-p6 d-mr6 d-bc-transparent",
1180
+ importance: "outlined",
1181
+ kind: "muted",
1182
+ circle: ""
1183
+ }, n.closeButtonProps, {
1184
+ onClick: t[0] || (t[0] = (b) => e.$emit("close"))
1185
+ }), {
1186
+ icon: u(() => [
1187
+ m(r, {
1188
+ name: "close",
1189
+ size: "300"
1190
+ })
1191
+ ]),
1192
+ _: 1
1193
+ }, 16)) : g("", !0)
1194
+ ], 2);
1195
+ }
1196
+ const bn = /* @__PURE__ */ v(_n, [["render", vn]]);
1197
+ const Sn = {
1198
+ name: "DtPopover",
1199
+ /********************
1200
+ * CHILD COMPONENTS *
1201
+ ********************/
1202
+ components: {
1203
+ SrOnlyCloseButton: ge,
1204
+ DtLazyShow: Qe,
1205
+ PopoverHeaderFooter: bn
1206
+ },
1207
+ mixins: [Yt, $],
1208
+ props: {
1209
+ /**
1210
+ * Controls whether the popover is shown. Leaving this null will have the popover trigger on click by default.
1211
+ * If you set this value, the default trigger behavior will be disabled, and you can control it as you need.
1212
+ * Supports v-model
1213
+ * @values null, true, false
1214
+ */
1215
+ open: {
1216
+ type: Boolean,
1217
+ default: null
1218
+ },
1219
+ /**
1220
+ * Opens the popover on right click (context menu). If you set this value to `true`,
1221
+ * the default trigger behavior will be disabled.
1222
+ * @values true, false
1223
+ */
1224
+ openOnContext: {
1225
+ type: Boolean,
1226
+ default: !1
1227
+ },
1228
+ /**
1229
+ * Element type (tag name) of the root element of the component.
1230
+ */
1231
+ elementType: {
1232
+ type: String,
1233
+ default: "div"
1234
+ },
1235
+ /**
1236
+ * Named transition when the content display is toggled.
1237
+ * @see DtLazyShow
1238
+ */
1239
+ transition: {
1240
+ type: String,
1241
+ default: "fade"
1242
+ },
1243
+ /**
1244
+ * ARIA role for the content of the popover. Defaults to "dialog".
1245
+ * <a class="d-link" href="https://www.w3.org/TR/wai-aria/#aria-haspopup" target="_blank">aria-haspopup</a>
1246
+ */
1247
+ role: {
1248
+ type: String,
1249
+ default: "dialog",
1250
+ validator: (e) => pn.includes(e)
1251
+ },
1252
+ /**
1253
+ * ID of the element that serves as the label for the popover content.
1254
+ * Defaults to the "anchor" element; this exists to provide a different
1255
+ * ID of the label element if, for example, the anchor slot contains
1256
+ * other items that do not serve as a label. You should provide this
1257
+ * or ariaLabel, but not both.
1258
+ */
1259
+ ariaLabelledby: {
1260
+ type: String,
1261
+ default: null
1262
+ },
1263
+ /**
1264
+ * Descriptive label for the popover content. You should provide this
1265
+ * or ariaLabelledby, but not both.
1266
+ */
1267
+ ariaLabel: {
1268
+ type: String,
1269
+ default: null
1270
+ },
1271
+ /**
1272
+ * A set of props to be passed into the popover's header close button.
1273
+ * Requires an 'ariaLabel' property, when the header popover is visible
1274
+ */
1275
+ closeButtonProps: {
1276
+ type: Object,
1277
+ default: () => ({})
1278
+ },
1279
+ /**
1280
+ * Padding size class for the popover content.
1281
+ * @values none, small, medium, large
1282
+ */
1283
+ padding: {
1284
+ type: String,
1285
+ default: "large",
1286
+ validator: (e) => Object.keys(J).some((t) => t === e)
1287
+ },
1288
+ /**
1289
+ * Additional class name for the content wrapper element.
1290
+ */
1291
+ contentClass: {
1292
+ type: [String, Array, Object],
1293
+ default: ""
1294
+ },
1295
+ /**
1296
+ * Width configuration for the popover content. When its value is 'anchor',
1297
+ * the popover content will have the same width as the anchor.
1298
+ * @values null, anchor
1299
+ */
1300
+ contentWidth: {
1301
+ type: String,
1302
+ default: "",
1303
+ validator: (e) => fn.includes(e)
1304
+ },
1305
+ /**
1306
+ * Whether to apply transition on initial render in the content lazy show component.
1307
+ */
1308
+ contentAppear: {
1309
+ type: Boolean,
1310
+ default: null
1311
+ },
1312
+ /**
1313
+ * Tabindex value for the content. Passing null, no tabindex attribute will be set.
1314
+ */
1315
+ contentTabindex: {
1316
+ type: Number || null,
1317
+ default: -1
1318
+ },
1319
+ /**
1320
+ * External anchor id to use in those cases the anchor can't be provided via the slot.
1321
+ * For instance, using the combobox's input as the anchor for the popover.
1322
+ */
1323
+ externalAnchor: {
1324
+ type: String,
1325
+ default: ""
1326
+ },
1327
+ /**
1328
+ * The id of the tooltip
1329
+ */
1330
+ id: {
1331
+ type: String,
1332
+ default() {
1333
+ return H();
1334
+ }
1335
+ },
1336
+ /**
1337
+ * Displaces the content box from its anchor element
1338
+ * by the specified number of pixels.
1339
+ * <a
1340
+ * class="d-link"
1341
+ * href="https://atomiks.github.io/tippyjs/v6/all-props/#offset"
1342
+ * target="_blank"
1343
+ * >
1344
+ * Tippy.js docs
1345
+ * </a>
1346
+ */
1347
+ offset: {
1348
+ type: Array,
1349
+ default: () => [0, 4]
1350
+ },
1351
+ /**
1352
+ * Determines if the popover hides upon clicking the
1353
+ * anchor or outside the content box.
1354
+ * @values true, false
1355
+ */
1356
+ hideOnClick: {
1357
+ type: Boolean,
1358
+ default: !0
1359
+ },
1360
+ /**
1361
+ * Determines modal state. If enabled popover has a modal overlay
1362
+ * preventing interaction with elements below it, but it is invisible.
1363
+ * @values true, false
1364
+ */
1365
+ modal: {
1366
+ type: Boolean,
1367
+ default: !0
1368
+ },
1369
+ /**
1370
+ * If the popover does not fit in the direction described by "placement",
1371
+ * it will attempt to change its direction to the "fallbackPlacements".
1372
+ * <a
1373
+ * class="d-link"
1374
+ * href="https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements"
1375
+ * target="_blank"
1376
+ * >
1377
+ * Popper.js docs
1378
+ * </a>
1379
+ * */
1380
+ fallbackPlacements: {
1381
+ type: Array,
1382
+ default: () => ["auto"]
1383
+ },
1384
+ /**
1385
+ * The direction the popover displays relative to the anchor.
1386
+ * <a
1387
+ * class="d-link"
1388
+ * href="https://atomiks.github.io/tippyjs/v6/all-props/#placement"
1389
+ * target="_blank"
1390
+ * >
1391
+ * Tippy.js docs
1392
+ * </a>
1393
+ * @values top, top-start, top-end,
1394
+ * right, right-start, right-end,
1395
+ * left, left-start, left-end,
1396
+ * bottom, bottom-start, bottom-end,
1397
+ * auto, auto-start, auto-end
1398
+ */
1399
+ placement: {
1400
+ type: String,
1401
+ default: "bottom-end"
1402
+ },
1403
+ /**
1404
+ * If set to false the dialog will display over top of the anchor when there is insufficient space.
1405
+ * If set to true it will never move from its position relative to the anchor and will clip instead.
1406
+ * <a
1407
+ * class="d-link"
1408
+ * href="https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether"
1409
+ * target="_blank"
1410
+ * >
1411
+ * Popper.js docs
1412
+ * </a>
1413
+ * @values true, false
1414
+ */
1415
+ tether: {
1416
+ type: Boolean,
1417
+ default: !0
1418
+ },
1419
+ /**
1420
+ * If the popover sticks to the anchor. This is usually not needed, but can be needed
1421
+ * if the reference element's position is animating, or to automatically update the popover
1422
+ * position in those cases the DOM layout changes the reference element's position.
1423
+ * `true` enables it, `reference` only checks the "reference" rect for changes and `popper` only
1424
+ * checks the "popper" rect for changes.
1425
+ * <a
1426
+ * class="d-link"
1427
+ * href="https://atomiks.github.io/tippyjs/v6/all-props/#sticky"
1428
+ * target="_blank"
1429
+ * >
1430
+ * Tippy.js docs
1431
+ * </a>
1432
+ * @values true, false, reference, popper
1433
+ */
1434
+ sticky: {
1435
+ type: [Boolean, String],
1436
+ default: !1,
1437
+ validator: (e) => yn.includes(e)
1438
+ },
1439
+ /**
1440
+ * Determines maximum height for the popover before overflow.
1441
+ * Possible units rem|px|em
1442
+ */
1443
+ maxHeight: {
1444
+ type: String,
1445
+ default: ""
1446
+ },
1447
+ /**
1448
+ * Determines maximum width for the popover before overflow.
1449
+ * Possible units rem|px|%|em
1450
+ */
1451
+ maxWidth: {
1452
+ type: String,
1453
+ default: ""
1454
+ },
1455
+ /**
1456
+ * Determines visibility for close button
1457
+ * @values true, false
1458
+ */
1459
+ showCloseButton: {
1460
+ type: Boolean,
1461
+ default: !1
1462
+ },
1463
+ /**
1464
+ * Additional class name for the header content wrapper element.
1465
+ */
1466
+ headerClass: {
1467
+ type: [String, Array, Object],
1468
+ default: ""
1469
+ },
1470
+ /**
1471
+ * Additional class name for the footer content wrapper element.
1472
+ */
1473
+ footerClass: {
1474
+ type: [String, Array, Object],
1475
+ default: ""
1476
+ },
1477
+ /**
1478
+ * Additional class name for the dialog element.
1479
+ */
1480
+ dialogClass: {
1481
+ type: [String, Array, Object],
1482
+ default: ""
1483
+ },
1484
+ /**
1485
+ * The element that is focused when the popover is opened. This can be an
1486
+ * HTMLElement within the popover, a string starting with '#' which will
1487
+ * find the element by ID. 'first' which will automatically focus
1488
+ * the first element, or 'dialog' which will focus the dialog window itself.
1489
+ * If the dialog is modal this prop cannot be 'none'.
1490
+ * @values none, dialog, first
1491
+ */
1492
+ initialFocusElement: {
1493
+ type: [String, HTMLElement],
1494
+ default: "first",
1495
+ validator: (e) => hn.includes(e) || e instanceof HTMLElement || e.startsWith("#")
1496
+ },
1497
+ /**
1498
+ * If the popover should open pressing up or down arrow key on the anchor element.
1499
+ * This can be set when not passing open prop.
1500
+ * @values true, false
1501
+ */
1502
+ openWithArrowKeys: {
1503
+ type: Boolean,
1504
+ default: !1
1505
+ },
1506
+ /**
1507
+ * Sets the element to which the popover is going to append to.
1508
+ * 'body' will append to the nearest body (supports shadow DOM).
1509
+ * @values 'body', 'parent', HTMLElement,
1510
+ */
1511
+ appendTo: {
1512
+ type: [HTMLElement, String],
1513
+ default: "body",
1514
+ validator: (e) => gn.includes(e) || e instanceof HTMLElement
1515
+ }
1516
+ },
1517
+ emits: [
1518
+ /**
1519
+ * Native keydown event
1520
+ *
1521
+ * @event keydown
1522
+ * @type {KeyboardEvent}
1523
+ */
1524
+ "keydown",
1525
+ /**
1526
+ * Event fired to sync the open prop with the parent component
1527
+ * @event update:open
1528
+ */
1529
+ "update:open",
1530
+ /**
1531
+ * Emitted when popover is shown or hidden
1532
+ *
1533
+ * @event opened
1534
+ * @type {Boolean | Array}
1535
+ */
1536
+ "opened"
1537
+ ],
1538
+ data() {
1539
+ return {
1540
+ POPOVER_PADDING_CLASSES: J,
1541
+ POPOVER_HEADER_FOOTER_PADDING_CLASSES: mn,
1542
+ intersectionObserver: null,
1543
+ isOutsideViewport: !1,
1544
+ isOpen: !1,
1545
+ toAppear: !1,
1546
+ anchorEl: null,
1547
+ popoverContentEl: null,
1548
+ hasSlotContent: B
1549
+ };
1550
+ },
1551
+ computed: {
1552
+ popoverListeners() {
1553
+ return {
1554
+ keydown: (e) => {
1555
+ this.onKeydown(e);
1556
+ },
1557
+ "after-leave": (e) => {
1558
+ this.onLeaveTransitionComplete();
1559
+ },
1560
+ "after-enter": (e) => {
1561
+ this.onEnterTransitionComplete();
1562
+ }
1563
+ };
1564
+ },
1565
+ calculatedMaxHeight() {
1566
+ return this.isOutsideViewport && this.modal ? "calc(100vh - var(--dt-space-300))" : this.maxHeight;
1567
+ },
1568
+ labelledBy() {
1569
+ return this.ariaLabelledby || !this.ariaLabel && H("DtPopover__anchor");
1570
+ }
1571
+ },
1572
+ watch: {
1573
+ $props: {
1574
+ immediate: !0,
1575
+ deep: !0,
1576
+ handler() {
1577
+ this.validateProps();
1578
+ }
1579
+ },
1580
+ modal(e) {
1581
+ var t;
1582
+ (t = this.tip) == null || t.setProps({
1583
+ zIndex: e ? 650 : this.calculateAnchorZindex()
1584
+ });
1585
+ },
1586
+ offset(e) {
1587
+ var t;
1588
+ (t = this.tip) == null || t.setProps({
1589
+ offset: e
1590
+ });
1591
+ },
1592
+ sticky(e) {
1593
+ var t;
1594
+ (t = this.tip) == null || t.setProps({
1595
+ sticky: e
1596
+ });
1597
+ },
1598
+ fallbackPlacements() {
1599
+ var e;
1600
+ (e = this.tip) == null || e.setProps({
1601
+ popperOptions: this.popperOptions()
1602
+ });
1603
+ },
1604
+ tether() {
1605
+ var e;
1606
+ (e = this.tip) == null || e.setProps({
1607
+ popperOptions: this.popperOptions()
1608
+ });
1609
+ },
1610
+ placement(e) {
1611
+ var t;
1612
+ (t = this.tip) == null || t.setProps({
1613
+ placement: e
1614
+ });
1615
+ },
1616
+ open: {
1617
+ handler: function(e) {
1618
+ e !== null && (this.isOpen = e), e === !0 && (this.toAppear = !0);
1619
+ },
1620
+ immediate: !0
1621
+ },
1622
+ contentAppear: {
1623
+ handler: function(e) {
1624
+ e !== null && (this.toAppear = e);
1625
+ }
1626
+ },
1627
+ isOpen(e, t) {
1628
+ e ? (this.initTippyInstance(), this.tip.show()) : !e && t !== e && (this.removeEventListeners(), this.tip.hide());
1629
+ }
1630
+ },
1631
+ mounted() {
1632
+ const e = this.externalAnchor ? this.$refs.anchor.getRootNode().querySelector(`#${this.externalAnchor}`) : null;
1633
+ this.anchorEl = e ?? this.$refs.anchor.children[0], this.popoverContentEl = this.$refs.content.$el, this.isOpen && (this.initTippyInstance(), this.tip.show()), this.intersectionObserver = new IntersectionObserver(this.hasIntersectedViewport), this.intersectionObserver.observe(this.popoverContentEl);
1634
+ },
1635
+ beforeUnmount() {
1636
+ var e;
1637
+ (e = this.tip) == null || e.destroy(), this.intersectionObserver.disconnect(), this.removeReferences(), this.removeEventListeners();
1638
+ },
1639
+ /******************
1640
+ * METHODS *
1641
+ ******************/
1642
+ methods: {
1643
+ hasIntersectedViewport(e) {
1644
+ var i;
1645
+ const t = (i = e == null ? void 0 : e[0]) == null ? void 0 : i.target;
1646
+ if (!t)
1647
+ return;
1648
+ const n = et(t);
1649
+ this.isOutsideViewport = n.bottom || n.top;
1650
+ },
1651
+ popperOptions() {
1652
+ return tt({
1653
+ fallbackPlacements: this.fallbackPlacements,
1654
+ tether: this.tether,
1655
+ hasHideModifierEnabled: !0
1656
+ });
1657
+ },
1658
+ validateProps() {
1659
+ this.modal && this.initialFocusElement === "none" && console.error('If the popover is modal you must set the initialFocusElement prop. Possible values: "dialog", "first", HTMLElement');
1660
+ },
1661
+ calculateAnchorZindex() {
1662
+ var e;
1663
+ 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 650 when
1664
+ // anchor of popover is within a drawer.
1665
+ (e = this.anchorEl) != null && e.closest(".d-zi-drawer") ? 650 : 300;
1666
+ },
1667
+ defaultToggleOpen(e) {
1668
+ var t, n, i;
1669
+ if (!this.openOnContext && (this.open === null || this.open === void 0)) {
1670
+ if (!((t = this.anchorEl) != null && t.contains(e.target)) && !((n = this.anchorEl) != null && n.isEqualNode(e.target)) || (i = this.anchorEl) != null && i.disabled)
1671
+ return;
1672
+ this.toggleOpen();
1673
+ }
1674
+ },
1675
+ async onContext(e) {
1676
+ this.openOnContext && (e.preventDefault(), this.isOpen = !0, await this.$nextTick(), this.tip.setProps({
1677
+ placement: "right-start",
1678
+ getReferenceClientRect: () => ({
1679
+ width: 0,
1680
+ height: 0,
1681
+ top: e.clientY,
1682
+ bottom: e.clientY,
1683
+ left: e.clientX,
1684
+ right: e.clientX
1685
+ })
1686
+ }));
1687
+ },
1688
+ toggleOpen() {
1689
+ this.isOpen = !this.isOpen;
1690
+ },
1691
+ onArrowKeyPress(e) {
1692
+ var t;
1693
+ this.open === null && (this.openWithArrowKeys && ((t = this.anchorEl) != null && t.contains(e.target)) && (this.isOpen || (this.isOpen = !0)), this.$emit("keydown", e));
1694
+ },
1695
+ addEventListeners() {
1696
+ window.addEventListener("dt-popover-close", this.closePopover), this.contentWidth === "anchor" && window.addEventListener("resize", this.onResize);
1697
+ },
1698
+ removeEventListeners() {
1699
+ window.removeEventListener("dt-popover-close", this.closePopover), this.contentWidth === "anchor" && window.removeEventListener("resize", this.onResize);
1700
+ },
1701
+ closePopover() {
1702
+ this.isOpen = !1;
1703
+ },
1704
+ /*
1705
+ * Prevents scrolling outside of the currently opened modal popover by:
1706
+ * - when anchor is not within another popover: setting the body to overflow: hidden
1707
+ * - when anchor is within another popover: set the popover dialog container to it's non-modal z-index
1708
+ * since it is no longer the active modal. This puts it underneath the overlay and prevents scrolling.
1709
+ **/
1710
+ preventScrolling() {
1711
+ var e;
1712
+ if (this.modal) {
1713
+ const t = (e = this.anchorEl) == null ? void 0 : e.closest("body, .tippy-box");
1714
+ t.tagName.toLowerCase() === "body" ? (t.classList.add("d-of-hidden"), this.tip.setProps({ offset: this.offset })) : t.classList.add("d-zi-popover");
1715
+ }
1716
+ },
1717
+ /*
1718
+ * Resets the prevent scrolling properties set in preventScrolling() back to normal.
1719
+ **/
1720
+ enableScrolling() {
1721
+ var t, n;
1722
+ const e = (t = this.anchorEl) == null ? void 0 : t.closest("body, .tippy-box");
1723
+ e && (((n = e.tagName) == null ? void 0 : n.toLowerCase()) === "body" ? (e.classList.remove("d-of-hidden"), this.tip.setProps({ offset: this.offset })) : e.classList.remove("d-zi-popover"));
1724
+ },
1725
+ removeReferences() {
1726
+ this.anchorEl = null, this.popoverContentEl = null, this.tip = null;
1727
+ },
1728
+ async onShow() {
1729
+ this.contentWidth === "anchor" && await this.setPopoverContentAnchorWidth(), this.contentWidth === null && (this.popoverContentEl.style.width = "auto"), this.addEventListeners();
1730
+ },
1731
+ async onLeaveTransitionComplete() {
1732
+ var e;
1733
+ this.modal && (await this.focusFirstElement(this.$refs.anchor), await this.$nextTick(), this.enableScrolling()), (e = this.tip) == null || e.unmount(), this.$emit("opened", !1), this.open !== null && this.$emit("update:open", !1);
1734
+ },
1735
+ async onEnterTransitionComplete() {
1736
+ this.focusInitialElement(), await this.$nextTick(), this.preventScrolling(), this.$emit("opened", !0, this.$refs.popover__content), this.open !== null && this.$emit("update:open", !0);
1737
+ },
1738
+ focusInitialElement() {
1739
+ this.initialFocusElement === "dialog" && this.$refs.content.$el.focus(), this.initialFocusElement.startsWith("#") && this.focusInitialElementById(), this.initialFocusElement === "first" && this.focusFirstElementIfNeeded(this.$refs.popover__content), this.initialFocusElement instanceof HTMLElement && this.initialFocusElement.focus();
1740
+ },
1741
+ focusInitialElementById() {
1742
+ var t, n, i;
1743
+ const e = (n = (t = this.$refs.content) == null ? void 0 : t.$el) == null ? void 0 : n.querySelector(this.initialFocusElement);
1744
+ e ? e.focus() : console.warn('Could not find the element specified in dt-popover prop "initialFocusElement". Defaulting to focusing the dialog.'), e ? e.focus() : (i = this.$refs.content) == null || i.$el.focus();
1745
+ },
1746
+ onResize() {
1747
+ this.closePopover();
1748
+ },
1749
+ onClickOutside() {
1750
+ if (!this.hideOnClick)
1751
+ return;
1752
+ this.popoverContentEl.querySelector(".d-popover__anchor--opened") || this.closePopover();
1753
+ },
1754
+ onKeydown(e) {
1755
+ e.key === "Tab" && this.modal && this.focusTrappedTabPress(e, this.popoverContentEl), e.key === "Escape" && this.closePopover(), this.$emit("keydown", e);
1756
+ },
1757
+ async setPopoverContentAnchorWidth() {
1758
+ var e;
1759
+ await this.$nextTick(), this.popoverContentEl.style.width = `${(e = this.anchorEl) == null ? void 0 : e.clientWidth}px`;
1760
+ },
1761
+ focusFirstElementIfNeeded(e) {
1762
+ var n, i;
1763
+ this._getFocusableElements(e, !0).length !== 0 ? this.focusFirstElement(e) : this.showCloseButton ? (n = this.$refs.popover__header) == null || n.focusCloseButton() : (i = this.$refs.content) == null || i.$el.focus();
1764
+ },
1765
+ initTippyInstance() {
1766
+ var e, t;
1767
+ this.tip = nt(this.anchorEl, {
1768
+ popperOptions: this.popperOptions(),
1769
+ contentElement: this.popoverContentEl,
1770
+ placement: this.placement,
1771
+ offset: this.offset,
1772
+ sticky: this.sticky,
1773
+ appendTo: this.appendTo === "body" ? (t = (e = this.anchorEl) == null ? void 0 : e.getRootNode()) == null ? void 0 : t.querySelector("body") : this.appendTo,
1774
+ interactive: !0,
1775
+ trigger: "manual",
1776
+ // We have to manage hideOnClick functionality manually to handle
1777
+ // popover within popover situations.
1778
+ hideOnClick: !1,
1779
+ zIndex: this.modal ? 650 : this.calculateAnchorZindex(),
1780
+ onClickOutside: this.onClickOutside,
1781
+ onShow: this.onShow
1782
+ });
1783
+ }
1784
+ }
1785
+ }, En = ["aria-hidden"], Cn = ["id", "tabindex"];
1786
+ function kn(e, t, n, i, o, s) {
1787
+ const r = d("popover-header-footer"), c = d("sr-only-close-button"), b = d("dt-lazy-show");
1788
+ return a(), p("div", null, [
1789
+ n.modal && o.isOpen ? (a(), h(We, {
1790
+ key: 0,
1791
+ to: "body"
1792
+ }, [
1793
+ S("div", {
1794
+ class: "d-modal--transparent",
1795
+ "aria-hidden": n.modal && o.isOpen ? "false" : "true",
1796
+ onClick: t[0] || (t[0] = P(() => {
1797
+ }, ["prevent", "stop"]))
1798
+ }, null, 8, En)
1799
+ ])) : g("", !0),
1800
+ (a(), h(O(n.elementType), {
1801
+ ref: "popover",
1802
+ class: _(["d-popover", { "d-popover__anchor--opened": o.isOpen }]),
1803
+ "data-qa": "dt-popover-container"
1804
+ }, {
1805
+ default: u(() => [
1806
+ S("div", {
1807
+ id: !n.ariaLabelledby && s.labelledBy,
1808
+ ref: "anchor",
1809
+ "data-qa": "dt-popover-anchor",
1810
+ tabindex: n.openOnContext ? 0 : void 0,
1811
+ onClickCapture: t[1] || (t[1] = (...y) => s.defaultToggleOpen && s.defaultToggleOpen(...y)),
1812
+ onContextmenu: t[2] || (t[2] = (...y) => s.onContext && s.onContext(...y)),
1813
+ onKeydown: [
1814
+ t[3] || (t[3] = w(P((...y) => s.onArrowKeyPress && s.onArrowKeyPress(...y), ["prevent"]), ["up"])),
1815
+ t[4] || (t[4] = w(P((...y) => s.onArrowKeyPress && s.onArrowKeyPress(...y), ["prevent"]), ["down"])),
1816
+ t[6] || (t[6] = w((y) => e.$emit("keydown", y), ["enter"])),
1817
+ t[7] || (t[7] = w((y) => e.$emit("keydown", y), ["space"]))
1818
+ ],
1819
+ onKeydownCapture: t[5] || (t[5] = w((...y) => s.closePopover && s.closePopover(...y), ["escape"]))
1820
+ }, [
1821
+ f(e.$slots, "anchor", {
1822
+ attrs: {
1823
+ "aria-expanded": o.isOpen.toString(),
1824
+ "aria-controls": n.id,
1825
+ "aria-haspopup": n.role
1826
+ }
1827
+ })
1828
+ ], 40, Cn),
1829
+ m(b, L({
1830
+ id: n.id,
1831
+ ref: "content",
1832
+ role: n.role,
1833
+ "data-qa": "dt-popover",
1834
+ "aria-hidden": `${!o.isOpen}`,
1835
+ "aria-labelledby": s.labelledBy,
1836
+ "aria-label": n.ariaLabel,
1837
+ "aria-modal": `${!n.modal}`,
1838
+ transition: n.transition,
1839
+ show: o.isOpen,
1840
+ appear: o.toAppear,
1841
+ class: ["d-popover__dialog", { "d-popover__dialog--modal": n.modal }, n.dialogClass],
1842
+ style: {
1843
+ "max-height": s.calculatedMaxHeight,
1844
+ "max-width": n.maxWidth
1845
+ },
1846
+ css: e.$attrs.css,
1847
+ tabindex: n.contentTabindex
1848
+ }, ce(s.popoverListeners)), {
1849
+ default: u(() => [
1850
+ o.hasSlotContent(e.$slots.headerContent) || n.showCloseButton ? (a(), h(r, {
1851
+ key: 0,
1852
+ ref: "popover__header",
1853
+ class: _(o.POPOVER_HEADER_FOOTER_PADDING_CLASSES[n.padding]),
1854
+ "content-class": n.headerClass,
1855
+ type: "header",
1856
+ "show-close-button": n.showCloseButton,
1857
+ "close-button-props": n.closeButtonProps,
1858
+ onClose: s.closePopover
1859
+ }, {
1860
+ content: u(() => [
1861
+ f(e.$slots, "headerContent", { close: s.closePopover })
1862
+ ]),
1863
+ _: 3
1864
+ }, 8, ["class", "content-class", "show-close-button", "close-button-props", "onClose"])) : g("", !0),
1865
+ S("div", {
1866
+ ref: "popover__content",
1867
+ "data-qa": "dt-popover-content",
1868
+ class: _([
1869
+ "d-popover__content",
1870
+ o.POPOVER_PADDING_CLASSES[n.padding],
1871
+ n.contentClass
1872
+ ])
1873
+ }, [
1874
+ f(e.$slots, "content", { close: s.closePopover })
1875
+ ], 2),
1876
+ o.hasSlotContent(e.$slots.footerContent) ? (a(), h(r, {
1877
+ key: 1,
1878
+ ref: "popover__footer",
1879
+ type: "footer",
1880
+ class: _(o.POPOVER_HEADER_FOOTER_PADDING_CLASSES[n.padding]),
1881
+ "content-class": n.footerClass
1882
+ }, {
1883
+ content: u(() => [
1884
+ f(e.$slots, "footerContent", { close: s.closePopover })
1885
+ ]),
1886
+ _: 3
1887
+ }, 8, ["class", "content-class"])) : g("", !0),
1888
+ e.showVisuallyHiddenClose ? (a(), h(c, {
1889
+ key: 2,
1890
+ "visually-hidden-close-label": e.visuallyHiddenCloseLabel,
1891
+ onClose: s.closePopover
1892
+ }, null, 8, ["visually-hidden-close-label", "onClose"])) : g("", !0)
1893
+ ]),
1894
+ _: 3
1895
+ }, 16, ["id", "role", "aria-hidden", "aria-labelledby", "aria-label", "aria-modal", "transition", "show", "appear", "class", "style", "css", "tabindex"])
1896
+ ]),
1897
+ _: 3
1898
+ }, 8, ["class"]))
1899
+ ]);
1900
+ }
1901
+ const In = /* @__PURE__ */ v(Sn, [["render", kn]]), wn = {
1902
+ name: "DtNotice",
1903
+ components: {
1904
+ DtNoticeIcon: xt,
1905
+ DtNoticeContent: Mt,
1906
+ DtNoticeAction: Wt
1907
+ },
1908
+ mixins: [$],
1909
+ props: {
1910
+ /**
1911
+ * Sets an ID on the title element of the component. Useful for aria-describedby
1912
+ * or aria-labelledby or any other reason you may need an id to refer to the title.
1913
+ */
1914
+ titleId: {
1915
+ type: String,
1916
+ default: void 0
1917
+ },
1918
+ /**
1919
+ * Sets an ID on the content element of the component. Useful for aria-describedby
1920
+ * or aria-labelledby or any other reason you may need an id to refer to the content.
1921
+ */
1922
+ contentId: {
1923
+ type: String,
1924
+ default: void 0
1925
+ },
1926
+ /**
1927
+ * Title header of the notice. This can be left blank to remove the title from the notice entirely.
1928
+ */
1929
+ title: {
1930
+ type: String,
1931
+ default: ""
1932
+ },
1933
+ /**
1934
+ * Provides a role for the notice. 'status' is used to communicate a message. 'alert' is used to communicate an
1935
+ * important message that does not contain any interactive elements. 'alertdialog' is used to communicate an
1936
+ * important message that does contain interactive elements.
1937
+ * @values alert, alertdialog, status
1938
+ */
1939
+ role: {
1940
+ type: String,
1941
+ default: "status",
1942
+ validate(e) {
1943
+ return At.includes(e);
1944
+ }
1945
+ },
1946
+ /**
1947
+ * Used in scenarios where the message needs to visually dominate the screen.
1948
+ * This will also change the aria role from status to alert.
1949
+ * @values true, false
1950
+ */
1951
+ important: {
1952
+ type: Boolean,
1953
+ default: !1
1954
+ },
1955
+ /**
1956
+ * Severity level of the notice, sets the icon and background
1957
+ * @values base, error, info, success, warning
1958
+ */
1959
+ kind: {
1960
+ type: String,
1961
+ default: "base",
1962
+ validate(e) {
1963
+ return z.includes(e);
1964
+ }
1965
+ },
1966
+ /**
1967
+ * Props for the notice close button.
1968
+ */
1969
+ closeButtonProps: {
1970
+ type: Object,
1971
+ default: () => ({})
1972
+ },
1973
+ /**
1974
+ * Hides the close button from the notice
1975
+ * @values true, false
1976
+ */
1977
+ hideClose: {
1978
+ type: Boolean,
1979
+ default: !1
1980
+ }
1981
+ },
1982
+ emits: [
1983
+ /**
1984
+ * Close button click event
1985
+ *
1986
+ * @event close
1987
+ */
1988
+ "close",
1989
+ /**
1990
+ * Native button click event
1991
+ *
1992
+ * @event click
1993
+ * @type {PointerEvent | KeyboardEvent}
1994
+ */
1995
+ "click"
1996
+ ],
1997
+ computed: {
1998
+ noticeClass() {
1999
+ return [
2000
+ "d-notice",
2001
+ {
2002
+ error: "d-notice--error",
2003
+ info: "d-notice--info",
2004
+ success: "d-notice--success",
2005
+ warning: "d-notice--warning",
2006
+ base: "d-notice--base"
2007
+ }[this.kind],
2008
+ { "d-notice--important": this.important }
2009
+ ];
2010
+ }
2011
+ }
2012
+ };
2013
+ function On(e, t, n, i, o, s) {
2014
+ const r = d("dt-notice-icon"), c = d("dt-notice-content"), b = d("dt-notice-action");
2015
+ return a(), p("aside", {
2016
+ class: _(s.noticeClass),
2017
+ "data-qa": "notice"
2018
+ }, [
2019
+ m(r, { kind: n.kind }, {
2020
+ default: u(() => [
2021
+ f(e.$slots, "icon")
2022
+ ]),
2023
+ _: 3
2024
+ }, 8, ["kind"]),
2025
+ m(c, {
2026
+ "title-id": n.titleId,
2027
+ "content-id": n.contentId,
2028
+ title: n.title,
2029
+ role: n.role
2030
+ }, {
2031
+ titleOverride: u(() => [
2032
+ f(e.$slots, "titleOverride")
2033
+ ]),
2034
+ default: u(() => [
2035
+ f(e.$slots, "default")
2036
+ ]),
2037
+ _: 3
2038
+ }, 8, ["title-id", "content-id", "title", "role"]),
2039
+ m(b, {
2040
+ "hide-close": n.hideClose,
2041
+ "close-button-props": n.closeButtonProps,
2042
+ "visually-hidden-close": e.visuallyHiddenClose,
2043
+ "visually-hidden-close-label": e.visuallyHiddenCloseLabel,
2044
+ onClose: t[0] || (t[0] = (y) => e.$emit("close"))
2045
+ }, {
2046
+ default: u(() => [
2047
+ f(e.$slots, "action")
2048
+ ]),
2049
+ _: 3
2050
+ }, 8, ["hide-close", "close-button-props", "visually-hidden-close", "visually-hidden-close-label"])
2051
+ ], 2);
2052
+ }
2053
+ const Tn = /* @__PURE__ */ v(wn, [["render", On]]);
2054
+ function Q(e) {
2055
+ return e === T.default;
2056
+ }
2057
+ function ee(e) {
2058
+ if (x(e) === "string")
2059
+ return Q(e) ? null : T[e];
2060
+ if (x(e) === "object") {
2061
+ const { default: t } = e;
2062
+ return Q(t) ? null : T[t];
2063
+ } else
2064
+ return null;
2065
+ }
2066
+ function x(e) {
2067
+ return typeof e;
2068
+ }
2069
+ function An(e) {
2070
+ return ee(e) ? `d-stack--${T[ee(e)]}` : null;
2071
+ }
2072
+ function Pn(e) {
2073
+ return x(e) === "object" ? [
2074
+ ..._e.map((t) => e[t] ? `d-stack--${t}--${e[t]}` : null)
2075
+ ] : null;
2076
+ }
2077
+ function Ln(e) {
2078
+ return W.includes(e) ? `d-stack--gap-${e}` : null;
2079
+ }
2080
+ function jn(e) {
2081
+ if (x(e) === "string")
2082
+ return Object.keys(T).includes(e);
2083
+ if (x(e) === "object") {
2084
+ const { default: t } = e;
2085
+ return Object.keys(T).includes(t);
2086
+ } else
2087
+ return null;
2088
+ }
2089
+ function Dn(e) {
2090
+ return W.includes(e);
2091
+ }
2092
+ const xn = {
2093
+ name: "DtStack",
2094
+ props: {
2095
+ /**
2096
+ * Set this prop to the direction to stack the items.
2097
+ * You can override the default direction with 'default' key.
2098
+ * All the undefined breakpoints will have 'default' value.
2099
+ * By default, for the column direction it will have `justify-content: flex-start`
2100
+ * and for the row direction `align-items: center`. This can be overriden
2101
+ * by utility classes.
2102
+ */
2103
+ direction: {
2104
+ type: [String, Object],
2105
+ default: "column",
2106
+ validator: (e) => jn(e)
2107
+ },
2108
+ /**
2109
+ * Set this prop to render stack as a specific HTML element.
2110
+ */
2111
+ as: {
2112
+ type: String,
2113
+ default: "div"
2114
+ },
2115
+ /**
2116
+ * Set this prop to have the space between each stack item
2117
+ * @values 0, 100, 200, 300, 400, 500, 600
2118
+ */
2119
+ gap: {
2120
+ type: String,
2121
+ default: "0",
2122
+ validator: (e) => Dn(e)
2123
+ }
2124
+ },
2125
+ data() {
2126
+ return {
2127
+ DT_STACK_DIRECTION: T,
2128
+ DT_STACK_GAP: W,
2129
+ DT_STACK_RESPONSIVE_BREAKPOINTS: _e
2130
+ };
2131
+ },
2132
+ computed: {
2133
+ stackGap() {
2134
+ return Ln(this.gap);
2135
+ },
2136
+ defaultDirection() {
2137
+ return An(this.direction);
2138
+ },
2139
+ stackResponsive() {
2140
+ return Pn(this.direction);
2141
+ }
2142
+ }
2143
+ };
2144
+ function Rn(e, t, n, i, o, s) {
2145
+ return a(), h(O(n.as), {
2146
+ class: _([
2147
+ "d-stack",
2148
+ s.defaultDirection,
2149
+ s.stackResponsive,
2150
+ s.stackGap
2151
+ ])
2152
+ }, {
2153
+ default: u(() => [
2154
+ f(e.$slots, "default")
2155
+ ]),
2156
+ _: 3
2157
+ }, 8, ["class"]);
2158
+ }
2159
+ const ve = /* @__PURE__ */ v(xn, [["render", Rn]]), Fn = {
2160
+ name: "EmojiComponent",
2161
+ components: {
2162
+ NodeViewWrapper: oe,
2163
+ DtEmoji: le
2164
+ },
2165
+ props: ie
2166
+ };
2167
+ function Nn(e, t, n, i, o, s) {
2168
+ const r = d("dt-emoji"), c = d("node-view-wrapper");
2169
+ return a(), h(c, { class: "d-d-inline-block" }, {
2170
+ default: u(() => [
2171
+ m(r, {
2172
+ size: "300",
2173
+ code: e.node.attrs.code
2174
+ }, null, 8, ["code"])
2175
+ ]),
2176
+ _: 1
2177
+ });
2178
+ }
2179
+ const Bn = /* @__PURE__ */ v(Fn, [["render", Nn]]);
2180
+ const Vn = {
2181
+ name: "SuggestionList",
2182
+ components: {
2183
+ DtListItem: un
2184
+ },
2185
+ props: {
2186
+ items: {
2187
+ type: Array,
2188
+ required: !0
2189
+ },
2190
+ command: {
2191
+ type: Function,
2192
+ required: !0
2193
+ },
2194
+ itemComponent: {
2195
+ type: Object,
2196
+ required: !0
2197
+ },
2198
+ itemType: {
2199
+ type: String,
2200
+ required: !0
2201
+ }
2202
+ },
2203
+ data() {
2204
+ return {
2205
+ selectedIndex: 0
2206
+ };
2207
+ },
2208
+ watch: {
2209
+ items() {
2210
+ this.selectedIndex = 0;
2211
+ }
2212
+ },
2213
+ methods: {
2214
+ onKeyDown({ event: e }) {
2215
+ return e.key === "ArrowUp" ? (this.upHandler(), !0) : e.key === "ArrowDown" ? (this.downHandler(), !0) : e.key === "Enter" ? (this.enterHandler(), !0) : !1;
2216
+ },
2217
+ upHandler() {
2218
+ this.selectedIndex = (this.selectedIndex + this.items.length - 1) % this.items.length, this.scrollActiveElementIntoView();
2219
+ },
2220
+ downHandler() {
2221
+ this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.scrollActiveElementIntoView();
2222
+ },
2223
+ scrollActiveElementIntoView() {
2224
+ const e = this.$refs.suggestionList.querySelector(".dt-list-item--highlighted");
2225
+ e && e.scrollIntoView({
2226
+ behaviour: "smooth",
2227
+ block: "center"
2228
+ });
2229
+ },
2230
+ enterHandler() {
2231
+ this.selectItem(this.selectedIndex);
2232
+ },
2233
+ selectItem(e) {
2234
+ const t = this.items[e];
2235
+ switch (this.itemType) {
2236
+ case "emoji":
2237
+ this.command(t);
2238
+ return;
2239
+ case "mention":
2240
+ this.command({ name: t.name, id: t.contactId, avatarSrc: t.avatarSrc });
2241
+ break;
2242
+ }
2243
+ }
2244
+ }
2245
+ }, Mn = { class: "d-popover__dialog" }, Hn = {
2246
+ ref: "suggestionList",
2247
+ class: "dt-suggestion-list"
2248
+ };
2249
+ function qn(e, t, n, i, o, s) {
2250
+ const r = d("dt-list-item");
2251
+ return a(), p("div", Mn, [
2252
+ Ue(S("ul", Hn, [
2253
+ (a(!0), p(me, null, ue(n.items, (c, b) => (a(), h(r, {
2254
+ key: c.id,
2255
+ class: _([
2256
+ "dt-suggestion-list--item",
2257
+ { "dt-list-item--highlighted": b === o.selectedIndex }
2258
+ ]),
2259
+ "navigation-type": "arrow-keys",
2260
+ onClick: (y) => s.selectItem(b),
2261
+ onKeydown: P(s.onKeyDown, ["prevent", "stop"])
2262
+ }, {
2263
+ default: u(() => [
2264
+ (a(), h(O(n.itemComponent), { item: c }, null, 8, ["item"]))
2265
+ ]),
2266
+ _: 2
2267
+ }, 1032, ["class", "onClick", "onKeydown"]))), 128))
2268
+ ], 512), [
2269
+ [Ge, n.items.length]
2270
+ ])
2271
+ ]);
2272
+ }
2273
+ const be = /* @__PURE__ */ v(Vn, [["render", qn]]), Kn = {
2274
+ name: "EmojiSuggestion",
2275
+ components: {
2276
+ DtEmoji: le,
2277
+ DtStack: ve
2278
+ },
2279
+ props: {
2280
+ item: {
2281
+ type: Object,
2282
+ required: !0
2283
+ }
2284
+ }
2285
+ };
2286
+ function zn(e, t, n, i, o, s) {
2287
+ const r = d("dt-emoji"), c = d("dt-stack");
2288
+ return a(), h(c, {
2289
+ direction: "row",
2290
+ gap: "400"
2291
+ }, {
2292
+ default: u(() => [
2293
+ m(r, {
2294
+ size: "200",
2295
+ code: n.item.code
2296
+ }, null, 8, ["code"]),
2297
+ R(" " + E(n.item.code), 1)
2298
+ ]),
2299
+ _: 1
2300
+ });
2301
+ }
2302
+ const $n = /* @__PURE__ */ v(Kn, [["render", zn]]), Wn = {
2303
+ items: ({ query: e }) => e.length < 2 ? [] : Object.values(He).filter(function(i) {
2304
+ return !!i.shortname.substring(1, i.shortname.length - 1).startsWith(e.toLowerCase());
2305
+ }).map((i) => ({ id: i.unicode_character, code: i.shortname })),
2306
+ command: ({ editor: e, range: t, props: n }) => {
2307
+ var s, r;
2308
+ const i = e.view.state.selection.$to.nodeAfter;
2309
+ ((s = i == null ? void 0 : i.text) == null ? void 0 : s.startsWith(" ")) && (t.to += 1), e.chain().focus().insertContentAt(t, [
2310
+ {
2311
+ type: "emoji",
2312
+ attrs: n
2313
+ },
2314
+ {
2315
+ type: "text",
2316
+ text: " "
2317
+ }
2318
+ ]).run(), (r = window.getSelection()) == null || r.collapseToEnd();
2319
+ },
2320
+ render: () => {
2321
+ let e, t;
2322
+ return {
2323
+ onStart: (n) => {
2324
+ e = new ae(be, {
2325
+ props: {
2326
+ itemComponent: pe($n),
2327
+ itemType: "emoji",
2328
+ ...n
2329
+ },
2330
+ editor: n.editor
2331
+ }), n.clientRect && (t = he("body", {
2332
+ getReferenceClientRect: n.clientRect,
2333
+ appendTo: () => document.body,
2334
+ content: e.element,
2335
+ showOnCreate: !0,
2336
+ interactive: !0,
2337
+ trigger: "manual",
2338
+ placement: "bottom-start",
2339
+ contentElement: null,
2340
+ zIndex: 650
2341
+ }));
2342
+ },
2343
+ onUpdate(n) {
2344
+ e.updateProps(n), n.clientRect && t[0].setProps({
2345
+ getReferenceClientRect: n.clientRect
2346
+ });
2347
+ },
2348
+ onKeyDown(n) {
2349
+ var i;
2350
+ return n.event.key === "Escape" ? (t[0].hide(), !0) : (i = e.ref) == null ? void 0 : i.onKeyDown(n);
2351
+ },
2352
+ onExit() {
2353
+ t[0].destroy(), e.destroy();
2354
+ }
2355
+ };
2356
+ }
2357
+ }, Un = new fe("emoji"), Gn = /:\w+:$/, Yn = /:\w+:/g, Zn = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/, Xn = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g, te = (e) => {
2358
+ if (e && de(e[0]))
2359
+ return {
2360
+ index: e.index,
2361
+ text: e[0],
2362
+ match: e
2363
+ };
2364
+ }, Jn = (e) => [...e.matchAll(Yn)].filter((n) => de(n[0])).map((n) => ({
2365
+ index: n.index,
2366
+ text: n[0],
2367
+ match: n
2368
+ })), Qn = je.create({
2369
+ addOptions() {
2370
+ return {
2371
+ HTMLAttributes: {},
2372
+ suggestion: {
2373
+ char: ":",
2374
+ pluginKey: Un
2375
+ }
2376
+ };
2377
+ },
2378
+ name: "emoji",
2379
+ group: "inline",
2380
+ inline: !0,
2381
+ selectable: !0,
2382
+ addNodeView() {
2383
+ return re(Bn);
2384
+ },
2385
+ addAttributes() {
2386
+ return {
2387
+ code: {
2388
+ default: null
2389
+ },
2390
+ id: {
2391
+ default: null
2392
+ }
2393
+ };
2394
+ },
2395
+ parseHTML() {
2396
+ return [
2397
+ {
2398
+ tag: "emoji-component"
2399
+ }
2400
+ ];
2401
+ },
2402
+ renderText({ node: e }) {
2403
+ return e.attrs.code;
2404
+ },
2405
+ renderHTML({ HTMLAttributes: e }) {
2406
+ return ["emoji-component", K(this.options.HTMLAttributes, e), 0];
2407
+ },
2408
+ addInputRules() {
2409
+ return [
2410
+ // shortcode input
2411
+ U({
2412
+ find: (e) => {
2413
+ const t = e.match(Gn);
2414
+ return te(t);
2415
+ },
2416
+ type: this.type,
2417
+ getAttributes(e) {
2418
+ return {
2419
+ code: e[0]
2420
+ };
2421
+ }
2422
+ }),
2423
+ U({
2424
+ find: (e) => {
2425
+ const t = e.match(Zn);
2426
+ return te(t);
2427
+ },
2428
+ type: this.type,
2429
+ getAttributes(e) {
2430
+ const t = qe(e[0]).unicode_output;
2431
+ return {
2432
+ code: String.fromCodePoint(parseInt(t, 16)),
2433
+ label: "emoji"
2434
+ };
2435
+ }
2436
+ })
2437
+ ];
2438
+ },
2439
+ addPasteRules() {
2440
+ return [
2441
+ G({
2442
+ find: Jn,
2443
+ type: this.type,
2444
+ getAttributes(e) {
2445
+ return {
2446
+ code: e[0]
2447
+ };
2448
+ }
2449
+ }),
2450
+ G({
2451
+ find: Xn,
2452
+ type: this.type,
2453
+ getAttributes(e) {
2454
+ return {
2455
+ code: e[0]
2456
+ };
2457
+ }
2458
+ })
2459
+ ];
2460
+ },
2461
+ addProseMirrorPlugins() {
2462
+ return [
2463
+ rt({
2464
+ editor: this.editor,
2465
+ ...this.options.suggestion,
2466
+ ...Wn
2467
+ })
2468
+ ];
2469
+ }
2470
+ });
2471
+ function es(e, t, n = () => !0) {
2472
+ const i = [];
2473
+ t.lastIndex = 0;
2474
+ let o;
2475
+ for (; o = t.exec(e); )
2476
+ n(e, o) && i.push(o);
2477
+ return i;
2478
+ }
2479
+ function ts(e, t) {
2480
+ return !["#", "@"].includes(e.charAt(t.index)) && !["#", "@"].includes(e.charAt(t.index - 1));
2481
+ }
2482
+ function ns(e) {
2483
+ const t = new RegExp(
2484
+ "(?:" + [
2485
+ `[!?.,:;'"]`,
2486
+ "(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"
2487
+ ].join("|"),
2488
+ "g"
2489
+ );
2490
+ return e.replace(t, "");
2491
+ }
2492
+ function ss(e, t) {
2493
+ const n = e.slice(0, t + 1).search(/\S+\s*$/), i = e.slice(t).search(/\s/);
2494
+ if (i < 0) {
2495
+ const o = e.slice(n);
2496
+ return {
2497
+ text: o,
2498
+ from: n,
2499
+ to: n + o.length
2500
+ };
2501
+ }
2502
+ return {
2503
+ text: e.slice(n, i + t),
2504
+ from: n,
2505
+ to: i + t
2506
+ };
2507
+ }
2508
+ function q(e, t, n, i) {
2509
+ const o = ss(e, t);
2510
+ if (i.lastIndex = 0, !i.test(o.text))
2511
+ return o;
2512
+ const s = n === "left" ? o.from - 1 : o.to + 1;
2513
+ return s <= 0 || s >= e.length || s === t ? o : q(e, s, n, i);
2514
+ }
2515
+ function os(e, t, n, i) {
2516
+ const o = Math.max(e.from - 1, 0), s = Math.min(e.to + 1, t.content.size), r = De(o, s, t);
2517
+ for (const c of r)
2518
+ c.mark.type === i && n.removeMark(c.from, c.to, i);
2519
+ }
2520
+ const ne = st(1, 15);
2521
+ function se(e, t, n, i, o, s) {
2522
+ if (!e)
2523
+ return;
2524
+ let r = n - t - 1;
2525
+ r = r < 0 ? 0 : r;
2526
+ const c = i - t, b = q(
2527
+ e,
2528
+ r,
2529
+ "left",
2530
+ ne
2531
+ ), y = q(
2532
+ e,
2533
+ c,
2534
+ "right",
2535
+ ne
2536
+ ), k = e.slice(b.from, y.to);
2537
+ es(k, ot, ts).forEach((j) => {
2538
+ const I = ns(j[0]), l = t + b.from + j.index + 1, Ce = l + I.length;
2539
+ o.addMark(l, Ce, s.create());
2540
+ });
2541
+ }
2542
+ function is(e) {
2543
+ let t = !1;
2544
+ return new at({
2545
+ key: new fe("autolink"),
2546
+ appendTransaction: (n, i, o) => {
2547
+ const s = n.some((k) => k.docChanged) && !i.doc.eq(o.doc);
2548
+ if (t && !s)
2549
+ return;
2550
+ const { tr: r } = o, { textContent: c } = o.doc;
2551
+ t || se(c, 0, 0, c.length, r, e.type), t = !0;
2552
+ const b = xe(
2553
+ i.doc,
2554
+ [...n]
2555
+ );
2556
+ return Re(b).forEach(({ oldRange: k, newRange: C }) => {
2557
+ os(C, o.doc, r, e.type), Fe(
2558
+ o.doc,
2559
+ C,
2560
+ (I) => I.isTextblock
2561
+ ).forEach(({ node: I, pos: l }) => {
2562
+ se(
2563
+ I.textContent,
2564
+ l,
2565
+ k.from,
2566
+ C.to,
2567
+ r,
2568
+ e.type
2569
+ );
2570
+ });
2571
+ }), r;
2572
+ }
2573
+ });
2574
+ }
2575
+ const as = {
2576
+ class: "d-link d-c-text d-d-inline-block",
2577
+ rel: "noopener noreferrer nofollow"
2578
+ }, rs = Ne.create({
2579
+ name: "Link",
2580
+ renderHTML({ HTMLAttributes: e }) {
2581
+ return [
2582
+ "a",
2583
+ K(
2584
+ this.options.HTMLAttributes,
2585
+ e,
2586
+ as
2587
+ ),
2588
+ 0
2589
+ ];
2590
+ },
2591
+ renderText({ node: e }) {
2592
+ return e.attrs.text;
2593
+ },
2594
+ addProseMirrorPlugins() {
2595
+ return [
2596
+ is({ type: this.type })
2597
+ ];
2598
+ }
2599
+ });
2600
+ const ls = {
2601
+ name: "MentionComponent",
2602
+ components: {
2603
+ NodeViewWrapper: oe,
2604
+ DtLink: Qt
2605
+ },
2606
+ props: ie,
2607
+ computed: {
2608
+ text() {
2609
+ return "@" + this.$props.node.attrs.name;
2610
+ }
2611
+ }
2612
+ };
2613
+ function ds(e, t, n, i, o, s) {
2614
+ const r = d("dt-link"), c = d("node-view-wrapper");
2615
+ return a(), h(c, { class: "d-d-inline-block" }, {
2616
+ default: u(() => [
2617
+ m(r, {
2618
+ kind: "inverted",
2619
+ class: "dt-link--mention",
2620
+ href: null
2621
+ }, {
2622
+ default: u(() => [
2623
+ R(E(s.text), 1)
2624
+ ]),
2625
+ _: 1
2626
+ })
2627
+ ]),
2628
+ _: 1
2629
+ });
2630
+ }
2631
+ const cs = /* @__PURE__ */ v(ls, [["render", ds]]), us = lt.extend({
2632
+ addNodeView() {
2633
+ return re(cs);
2634
+ },
2635
+ parseHTML() {
2636
+ return [
2637
+ {
2638
+ tag: "mention-component"
2639
+ }
2640
+ ];
2641
+ },
2642
+ addAttributes() {
2643
+ return {
2644
+ name: {
2645
+ default: ""
2646
+ },
2647
+ avatarSrc: {
2648
+ default: ""
2649
+ },
2650
+ id: {
2651
+ default: ""
2652
+ }
2653
+ };
2654
+ },
2655
+ renderText({ node: e }) {
2656
+ return "@ " + e.attrs.name;
2657
+ },
2658
+ renderHTML({ HTMLAttributes: e }) {
2659
+ return ["mention-component", K(this.options.HTMLAttributes, e), 0];
2660
+ }
2661
+ }), Se = [
2662
+ "text",
2663
+ "json",
2664
+ "html"
2665
+ ], Ee = [
2666
+ "start",
2667
+ "end",
2668
+ "all"
2669
+ ], ms = {
2670
+ name: "MentionSuggestion",
2671
+ components: {
2672
+ DtAvatar: Tt,
2673
+ DtStack: ve
2674
+ },
2675
+ props: {
2676
+ item: {
2677
+ type: Object,
2678
+ required: !0
2679
+ }
2680
+ },
2681
+ computed: {
2682
+ name() {
2683
+ return this.item.name;
2684
+ },
2685
+ avatarSrc() {
2686
+ return this.item.avatarSrc;
2687
+ }
2688
+ }
2689
+ };
2690
+ function ps(e, t, n, i, o, s) {
2691
+ const r = d("dt-avatar"), c = d("dt-stack");
2692
+ return a(), h(c, {
2693
+ direction: "row",
2694
+ gap: "400"
2695
+ }, {
2696
+ default: u(() => [
2697
+ m(r, {
2698
+ "full-name": s.name,
2699
+ "image-src": s.avatarSrc,
2700
+ size: "xs"
2701
+ }, null, 8, ["full-name", "image-src"]),
2702
+ R(" " + E(s.name), 1)
2703
+ ]),
2704
+ _: 1
2705
+ });
2706
+ }
2707
+ const fs = /* @__PURE__ */ v(ms, [["render", ps]]), hs = {
2708
+ // This function comes from the user and passed to the editor directly.
2709
+ // This will also activate the mention plugin on the editor
2710
+ // items: ({ query }) => { return [] },
2711
+ render: () => {
2712
+ let e, t;
2713
+ return {
2714
+ onStart: (n) => {
2715
+ e = new ae(be, {
2716
+ // // using vue 2:
2717
+ // parent: this,
2718
+ // propsData: props,
2719
+ // using vue 3:
2720
+ props: {
2721
+ itemComponent: pe(fs),
2722
+ itemType: "mention",
2723
+ ...n
2724
+ },
2725
+ editor: n.editor
2726
+ }), n.clientRect && (t = he("body", {
2727
+ getReferenceClientRect: n.clientRect,
2728
+ appendTo: () => document.body,
2729
+ content: e.element,
2730
+ showOnCreate: !0,
2731
+ interactive: !0,
2732
+ trigger: "manual",
2733
+ placement: "bottom-start"
2734
+ }));
2735
+ },
2736
+ onUpdate(n) {
2737
+ e.updateProps(n), n.clientRect && t[0].setProps({
2738
+ getReferenceClientRect: n.clientRect
2739
+ });
2740
+ },
2741
+ onKeyDown(n) {
2742
+ var i;
2743
+ return n.event.key === "Escape" ? (t[0].hide(), !0) : (i = e.ref) == null ? void 0 : i.onKeyDown(n);
2744
+ },
2745
+ onExit() {
2746
+ t[0].destroy(), e.destroy();
2747
+ }
2748
+ };
2749
+ }
2750
+ };
2751
+ const gs = {
2752
+ name: "DtRichTextEditor",
2753
+ components: {
2754
+ EditorContent: ke
2755
+ },
2756
+ props: {
2757
+ /**
2758
+ * Value of the input. The object format should match TipTap's JSON
2759
+ * document structure: https://tiptap.dev/guide/output#option-1-json
2760
+ */
2761
+ modelValue: {
2762
+ type: [Object, String],
2763
+ default: ""
2764
+ },
2765
+ /**
2766
+ * Whether the input is editable
2767
+ */
2768
+ editable: {
2769
+ type: Boolean,
2770
+ default: !0
2771
+ },
2772
+ /**
2773
+ * Descriptive label for the input element
2774
+ */
2775
+ inputAriaLabel: {
2776
+ type: String,
2777
+ required: !0
2778
+ },
2779
+ /**
2780
+ * Additional class name for the input element. Only accepts a String value
2781
+ * because this is passed to the editor via options. For multiple classes,
2782
+ * join them into one string, e.g. "d-p8 d-hmx96"
2783
+ */
2784
+ inputClass: {
2785
+ type: String,
2786
+ default: ""
2787
+ },
2788
+ /**
2789
+ * Whether the input should receive focus after the component has been
2790
+ * mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.
2791
+ * - `start` Sets the focus to the beginning of the input
2792
+ * - `end` Sets the focus to the end of the input
2793
+ * - `all` Selects the whole contents of the input
2794
+ * - `Number` Sets the focus to a specific position in the input
2795
+ * - `true` Defaults to `start`
2796
+ * - `false` Disables autofocus
2797
+ * @values true, false, start, end, all, number
2798
+ */
2799
+ autoFocus: {
2800
+ type: [Boolean, String, Number],
2801
+ default: !1,
2802
+ validator(e) {
2803
+ return typeof e == "string" ? Ee.includes(e) : !0;
2804
+ }
2805
+ },
2806
+ /**
2807
+ * The output format that the editor uses when emitting the "@input" event.
2808
+ * One of `text`, `json`, `html`. See https://tiptap.dev/guide/output for
2809
+ * examples.
2810
+ * @values text, json, html
2811
+ */
2812
+ outputFormat: {
2813
+ type: String,
2814
+ default: "text",
2815
+ validator(e) {
2816
+ return Se.includes(e);
2817
+ }
2818
+ },
2819
+ /**
2820
+ * Placeholder text
2821
+ */
2822
+ placeholder: {
2823
+ type: String,
2824
+ default: ""
2825
+ },
2826
+ /**
2827
+ * Enables the Link extension and optionally passes configurations to it
2828
+ */
2829
+ link: {
2830
+ type: [Boolean, Object],
2831
+ default: !1
2832
+ },
2833
+ /**
2834
+ * suggestion object containing the items query function.
2835
+ * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion
2836
+ *
2837
+ * The only required key is the items function which is used to query the contacts for suggestion.
2838
+ * items({ query }) => { return [ContactObject]; }
2839
+ * ContactObject format:
2840
+ * { name: string, avatarSrc: string, id: string }
2841
+ *
2842
+ * When null, it does not add the plugin.
2843
+ */
2844
+ mentionSuggestion: {
2845
+ type: Object,
2846
+ default: null
2847
+ }
2848
+ },
2849
+ emits: [
2850
+ /**
2851
+ * Editor input event
2852
+ * @event input
2853
+ * @type {String|JSON}
2854
+ */
2855
+ "input",
2856
+ /**
2857
+ * Event to sync the value with the parent
2858
+ * @event input
2859
+ * @type {String|JSON}
2860
+ */
2861
+ "update:modelValue",
2862
+ /**
2863
+ * Editor blur event
2864
+ * @event blur
2865
+ * @type {FocusEvent}
2866
+ */
2867
+ "blur",
2868
+ /**
2869
+ * Editor focus event
2870
+ * @event focus
2871
+ * @type {FocusEvent}
2872
+ */
2873
+ "focus"
2874
+ ],
2875
+ data() {
2876
+ return {
2877
+ editor: null,
2878
+ popoverOpened: !1
2879
+ };
2880
+ },
2881
+ computed: {
2882
+ extensions() {
2883
+ const e = [we, Oe, Ae, Le];
2884
+ if (this.link && e.push(this.getExtension(rs, this.link)), e.push(
2885
+ Pe.configure({ placeholder: this.placeholder })
2886
+ ), e.push(
2887
+ Te.extend({
2888
+ addKeyboardShortcuts() {
2889
+ return {
2890
+ Enter: () => !0,
2891
+ "Shift-Enter": () => this.editor.commands.first(({ commands: t }) => [
2892
+ () => t.newlineInCode(),
2893
+ () => t.createParagraphNear(),
2894
+ () => t.liftEmptyBlock(),
2895
+ () => t.splitBlock()
2896
+ ])
2897
+ };
2898
+ }
2899
+ })
2900
+ ), this.mentionSuggestion) {
2901
+ const t = { ...this.mentionSuggestion, ...hs };
2902
+ e.push(us.configure({ suggestion: t }));
2903
+ }
2904
+ return e.push(Qn), e;
2905
+ },
2906
+ inputAttrs() {
2907
+ const e = {
2908
+ "aria-label": this.inputAriaLabel,
2909
+ "aria-multiline": !0,
2910
+ role: "textbox"
2911
+ };
2912
+ return this.editable || (e["aria-readonly"] = !0), e;
2913
+ }
2914
+ },
2915
+ /**
2916
+ * Because the Editor instance is initialized when mounted it does not get
2917
+ * updated props automatically, so the ones that can change after mount have
2918
+ * to be hooked up to the Editor's own API.
2919
+ */
2920
+ watch: {
2921
+ editable(e) {
2922
+ this.editor.setEditable(e), this.updateEditorAttributes({ "aria-readonly": !e });
2923
+ },
2924
+ inputClass(e) {
2925
+ this.updateEditorAttributes({ class: e });
2926
+ },
2927
+ inputAriaLabel(e) {
2928
+ this.updateEditorAttributes({ "aria-label": e });
2929
+ },
2930
+ extensions() {
2931
+ this.destroyEditor(), this.createEditor();
2932
+ },
2933
+ modelValue(e) {
2934
+ let t = this.getOutput();
2935
+ this.outputFormat === "json" && (e = JSON.stringify(e), t = JSON.stringify(t)), e !== t && this.editor.commands.setContent(e, !1);
2936
+ }
2937
+ },
2938
+ created() {
2939
+ this.createEditor();
2940
+ },
2941
+ beforeUnmount() {
2942
+ this.destroyEditor();
2943
+ },
2944
+ methods: {
2945
+ createEditor() {
2946
+ this.editor = new Ie({
2947
+ autofocus: this.autoFocus,
2948
+ content: this.modelValue,
2949
+ editable: this.editable,
2950
+ extensions: this.extensions,
2951
+ editorProps: {
2952
+ attributes: {
2953
+ ...this.inputAttrs,
2954
+ class: this.inputClass
2955
+ }
2956
+ }
2957
+ }), this.addEditorListeners();
2958
+ },
2959
+ destroyEditor() {
2960
+ this.editor.destroy();
2961
+ },
2962
+ /**
2963
+ * The Editor exposes event hooks that we have to map our emits into. See
2964
+ * https://tiptap.dev/api/events for all events.
2965
+ */
2966
+ addEditorListeners() {
2967
+ this.editor.on("update", () => {
2968
+ const e = this.getOutput();
2969
+ this.$emit("input", e), this.$emit("update:modelValue", e);
2970
+ }), this.editor.on("focus", ({ event: e }) => {
2971
+ this.$emit("focus", e);
2972
+ }), this.editor.on("blur", ({ event: e }) => {
2973
+ this.$emit("blur", e);
2974
+ });
2975
+ },
2976
+ getOutput() {
2977
+ switch (this.outputFormat) {
2978
+ case "json":
2979
+ return this.editor.getJSON();
2980
+ case "html":
2981
+ return this.editor.getHTML();
2982
+ case "text":
2983
+ default:
2984
+ return this.editor.getText();
2985
+ }
2986
+ },
2987
+ getExtension(e, t) {
2988
+ var n;
2989
+ return typeof t == "boolean" ? e : (n = e.configure) == null ? void 0 : n.call(e, t);
2990
+ },
2991
+ updateEditorAttributes(e) {
2992
+ this.editor.setOptions({ editorProps: { attributes: e } });
2993
+ },
2994
+ focusEditor() {
2995
+ this.editor.commands.focus();
2996
+ }
2997
+ }
2998
+ };
2999
+ function ys(e, t, n, i, o, s) {
3000
+ const r = d("editor-content");
3001
+ return a(), h(r, {
3002
+ editor: o.editor,
3003
+ "data-qa": "dt-rich-text-editor"
3004
+ }, null, 8, ["editor"]);
3005
+ }
3006
+ const _s = /* @__PURE__ */ v(gs, [["render", ys]]);
3007
+ const vs = {
3008
+ name: "DtRecipeMessageInput",
3009
+ components: {
3010
+ DtButton: N,
3011
+ DtEmojiPicker: Ke,
3012
+ DtIcon: A,
3013
+ DtInput: ze,
3014
+ DtNotice: Tn,
3015
+ DtPopover: In,
3016
+ DtRichTextEditor: _s,
3017
+ DtTooltip: it
3018
+ },
3019
+ mixins: [],
3020
+ inheritAttrs: !1,
3021
+ props: {
3022
+ /**
3023
+ * Value of the input. The object format should match TipTap's JSON
3024
+ * document structure: https://tiptap.dev/guide/output#option-1-json
3025
+ */
3026
+ modelValue: {
3027
+ type: [Object, String],
3028
+ default: ""
3029
+ },
3030
+ /**
3031
+ * Whether the input is editable
3032
+ */
3033
+ editable: {
3034
+ type: Boolean,
3035
+ default: !0
3036
+ },
3037
+ /**
3038
+ * Descriptive label for the input element
3039
+ */
3040
+ inputAriaLabel: {
3041
+ type: String,
3042
+ required: !0,
3043
+ default: ""
3044
+ },
3045
+ /**
3046
+ * Additional class name for the input element. Only accepts a String value
3047
+ * because this is passed to the editor via options. For multiple classes,
3048
+ * join them into one string, e.g. "d-p8 d-hmx96"
3049
+ */
3050
+ inputClass: {
3051
+ type: String,
3052
+ default: ""
3053
+ },
3054
+ /**
3055
+ * Whether the input should receive focus after the component has been
3056
+ * mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.
3057
+ * - `start` Sets the focus to the beginning of the input
3058
+ * - `end` Sets the focus to the end of the input
3059
+ * - `all` Selects the whole contents of the input
3060
+ * - `Number` Sets the focus to a specific position in the input
3061
+ * - `true` Defaults to `start`
3062
+ * - `false` Disables autofocus
3063
+ * @values true, false, start, end, all, number
3064
+ */
3065
+ autoFocus: {
3066
+ type: [Boolean, String, Number],
3067
+ default: !1,
3068
+ validator(e) {
3069
+ return typeof e == "string" ? Ee.includes(e) : !0;
3070
+ }
3071
+ },
3072
+ /**
3073
+ * The output format that the editor uses when emitting the "@input" event.
3074
+ * One of `text`, `json`, `html`. See https://tiptap.dev/guide/output for
3075
+ * examples.
3076
+ * @values text, json, html
3077
+ */
3078
+ outputFormat: {
3079
+ type: String,
3080
+ default: "text",
3081
+ validator(e) {
3082
+ return Se.includes(e);
3083
+ }
3084
+ },
3085
+ /**
3086
+ * Enables the Link extension and optionally passes configurations to it
3087
+ */
3088
+ link: {
3089
+ type: [Boolean, Object],
3090
+ default: !1
3091
+ },
3092
+ /**
3093
+ * Placeholder text
3094
+ */
3095
+ placeholder: {
3096
+ type: String,
3097
+ default: ""
3098
+ },
3099
+ /**
3100
+ * Disable Send Button
3101
+ */
3102
+ disableSend: {
3103
+ type: Boolean,
3104
+ default: !1
3105
+ },
3106
+ // Character limit props
3107
+ /**
3108
+ * Enable character Limit warning
3109
+ */
3110
+ hasCharacterLimit: {
3111
+ type: Boolean,
3112
+ default: !0
3113
+ },
3114
+ /**
3115
+ * Max number of characters allowed
3116
+ */
3117
+ characterLimitCount: {
3118
+ type: Number,
3119
+ default: 1500
3120
+ },
3121
+ /**
3122
+ * Number after which warning for max limit appears
3123
+ */
3124
+ characterLimitWarning: {
3125
+ type: Number,
3126
+ default: 500
3127
+ },
3128
+ /**
3129
+ * Character limit warning message
3130
+ */
3131
+ characterLimitWarningMessage: {
3132
+ type: String,
3133
+ default: ""
3134
+ },
3135
+ // Error related props
3136
+ /**
3137
+ * Show error notice
3138
+ * This should be turned to false after notice-close event is fired.
3139
+ */
3140
+ showNotice: {
3141
+ type: Boolean,
3142
+ default: !1
3143
+ },
3144
+ /**
3145
+ * message in the notice
3146
+ */
3147
+ noticeMessage: {
3148
+ type: String,
3149
+ default: ""
3150
+ },
3151
+ /**
3152
+ * kind of notice to manage color
3153
+ * @values base, error, info, success, warning
3154
+ */
3155
+ noticeKind: {
3156
+ type: String,
3157
+ default: "error",
3158
+ validate(e) {
3159
+ return z.includes(e);
3160
+ }
3161
+ },
3162
+ /**
3163
+ * Content area needs to dynamically adjust height based on the conversation area height.
3164
+ * can be vh|px|rem|em|%
3165
+ */
3166
+ maxHeight: {
3167
+ type: String,
3168
+ default: "unset"
3169
+ },
3170
+ // Emoji picker props
3171
+ /**
3172
+ * tab labels for emoji
3173
+ */
3174
+ emojiTabSetLabels: {
3175
+ type: Array,
3176
+ default: () => [
3177
+ "Most recently used",
3178
+ "Smileys and people",
3179
+ "Nature",
3180
+ "Food",
3181
+ "Activity",
3182
+ "Travel",
3183
+ "Objects",
3184
+ "Symbols",
3185
+ "Flags"
3186
+ ]
3187
+ },
3188
+ emojiSkinSelectorButtonTooltipLabel: {
3189
+ type: String,
3190
+ default: "Change default skin tone"
3191
+ },
3192
+ emojiSearchNoResultsLabel: {
3193
+ type: String,
3194
+ default: "No results"
3195
+ },
3196
+ emojiSearchResultsLabel: {
3197
+ type: String,
3198
+ default: "Search results"
3199
+ },
3200
+ emojiSearchPlaceholderLabel: {
3201
+ type: String,
3202
+ default: "Search..."
3203
+ },
3204
+ /**
3205
+ * Emoji button tooltip label
3206
+ */
3207
+ emojiTooltipMessage: {
3208
+ type: String,
3209
+ default: "Emoji"
3210
+ },
3211
+ // Aria label for buttons
3212
+ /**
3213
+ * Emoji button aria label
3214
+ */
3215
+ emojiButtonAriaLabel: {
3216
+ type: String,
3217
+ default: "emoji button"
3218
+ },
3219
+ imageButtonAriaLabel: {
3220
+ type: String,
3221
+ default: "image button"
3222
+ },
3223
+ /**
3224
+ * Image button tooltip label
3225
+ */
3226
+ imageTooltipLabel: {
3227
+ type: String,
3228
+ default: "Attach Image"
3229
+ },
3230
+ sendButtonAriaLabel: {
3231
+ type: String,
3232
+ default: "send button"
3233
+ },
3234
+ /**
3235
+ * Send button tooltip label
3236
+ */
3237
+ sendTooltipLabel: {
3238
+ type: String,
3239
+ default: "Send"
3240
+ }
3241
+ },
3242
+ emits: [
3243
+ /**
3244
+ * Fires when send button is clicked
3245
+ *
3246
+ * @event submit
3247
+ * @type {String}
3248
+ */
3249
+ "submit",
3250
+ /**
3251
+ * Fires when media is selected from image button
3252
+ *
3253
+ * @event select-media
3254
+ * @type {Array}
3255
+ */
3256
+ "select-media",
3257
+ /**
3258
+ * Fires when media is dropped into the message input
3259
+ *
3260
+ * @event add-media
3261
+ * @type {Array}
3262
+ */
3263
+ "add-media",
3264
+ /**
3265
+ * Fires when notice is closed by user.
3266
+ * Listen to this event to toggle showNotice on usage.
3267
+ *
3268
+ * @event notice-close
3269
+ * @type {Boolean}
3270
+ */
3271
+ "notice-close"
3272
+ ],
3273
+ data() {
3274
+ return {
3275
+ skinTone: "Default",
3276
+ internalInputValue: this.modelValue,
3277
+ // internal input content
3278
+ hasFocus: !1,
3279
+ imagePickerFocus: !1,
3280
+ emojiPickerFocus: !1,
3281
+ sendButtonFocus: !1,
3282
+ emojiPickerOpened: !1
3283
+ };
3284
+ },
3285
+ computed: {
3286
+ inputLength() {
3287
+ return this.internalInputValue.length;
3288
+ },
3289
+ displayCharacterLimitWarning() {
3290
+ return this.hasCharacterLimit && this.characterLimitCount - this.inputLength <= this.characterLimitWarning;
3291
+ },
3292
+ isSendDisabled() {
3293
+ return this.inputLength === 0 || this.disableSend || this.hasCharacterLimit && this.inputLength > this.characterLimitCount;
3294
+ },
3295
+ computedCloseButtonProps() {
3296
+ return {
3297
+ ariaLabel: "Close"
3298
+ };
3299
+ },
3300
+ noticeClasses() {
3301
+ return [
3302
+ "dt-message-input-notice",
3303
+ "d-ps-relative",
3304
+ "d-t8",
3305
+ "d-bbr0",
3306
+ "d-pt4",
3307
+ "d-pb8",
3308
+ "d-pr12",
3309
+ "d-pl16",
3310
+ "d-bs-none",
3311
+ "d-fs-100",
3312
+ "d-wmx-unset"
3313
+ ];
3314
+ },
3315
+ emojiPickerHovered() {
3316
+ return this.emojiPickerFocus || this.emojiPickerOpened;
3317
+ }
3318
+ },
3319
+ watch: {
3320
+ modelValue(e) {
3321
+ this.internalInputValue = e;
3322
+ }
3323
+ },
3324
+ methods: {
3325
+ onDrag(e) {
3326
+ e.stopPropagation(), e.preventDefault();
3327
+ },
3328
+ onDrop(e) {
3329
+ e.stopPropagation(), e.preventDefault();
3330
+ const t = e.dataTransfer, i = Array.from(t.files).map((o) => o.name);
3331
+ this.$emit("add-media", i);
3332
+ },
3333
+ onSelectEmoji(e) {
3334
+ if (!e) {
3335
+ this.emojiPickerOpened = !1;
3336
+ return;
3337
+ }
3338
+ this.$refs.richTextEditor.editor.commands.insertContent({
3339
+ type: "emoji",
3340
+ attrs: {
3341
+ code: e.shortname
3342
+ }
3343
+ }), this.emojiPickerOpened = !1;
3344
+ },
3345
+ onSelectImage() {
3346
+ this.$refs.messageInputImageUpload.$refs.input.click();
3347
+ },
3348
+ onImageUpload(e) {
3349
+ this.$emit("select-media", e);
3350
+ },
3351
+ toggleEmojiPicker() {
3352
+ this.emojiPickerOpened = !this.emojiPickerOpened;
3353
+ },
3354
+ onSend() {
3355
+ this.isSendDisabled || this.$emit("submit", this.internalInputValue);
3356
+ },
3357
+ noticeClose() {
3358
+ this.$emit("notice-close", !0);
3359
+ },
3360
+ focus() {
3361
+ this.$refs.richTextEditor.focusEditor(), this.hasFocus = !0;
3362
+ }
3363
+ }
3364
+ }, bs = { class: "d-ps-relative d-bar8 d-bgc-white" }, Ss = { class: "d-d-flex d-jc-space-between d-mx8 d-my4" }, Es = { class: "d-d-flex" }, Cs = { class: "d-d-flex" }, ks = {
3365
+ key: 0,
3366
+ class: "d-fc-error d-mr16 d-as-center dt-message-input--remaining-char",
3367
+ "data-qa": "dt-message-input-character-limit"
3368
+ }, Is = { class: "d-d-flex d-jc-space-between d-h24 d-ai-center" }, ws = { "data-qa": "dt-message-input-footer-left" }, Os = { "data-qa": "dt-message-input-footer-right" };
3369
+ function Ts(e, t, n, i, o, s) {
3370
+ const r = d("dt-icon"), c = d("dt-notice"), b = d("dt-rich-text-editor"), y = d("dt-button"), k = d("dt-input"), C = d("dt-tooltip"), j = d("dt-emoji-picker"), I = d("dt-popover");
3371
+ return a(), p(me, null, [
3372
+ n.showNotice ? (a(), h(c, {
3373
+ key: 0,
3374
+ "data-qa": "dt-message-input-error-notice",
3375
+ class: _(s.noticeClasses),
3376
+ kind: n.noticeKind,
3377
+ "close-button-props": s.computedCloseButtonProps,
3378
+ onClose: s.noticeClose
3379
+ }, {
3380
+ icon: u(() => [
3381
+ m(r, {
3382
+ size: "300",
3383
+ name: "alert-circle"
3384
+ })
3385
+ ]),
3386
+ default: u(() => [
3387
+ R(E(n.noticeMessage) + " ", 1)
3388
+ ]),
3389
+ _: 1
3390
+ }, 8, ["class", "kind", "close-button-props", "onClose"])) : g("", !0),
3391
+ S("div", bs, [
3392
+ S("div", {
3393
+ "data-qa": "dt-message-input",
3394
+ role: "presentation",
3395
+ class: _(["d-d-flex d-fd-column d-bar8 d-baw1 d-ba d-c-text", { "d-bc-black-500 d-bs-sm": o.hasFocus, "d-bc-default": !o.hasFocus }]),
3396
+ onClick: t[17] || (t[17] = (l) => e.$refs.richTextEditor.focusEditor()),
3397
+ onDragEnter: t[18] || (t[18] = (...l) => s.onDrag && s.onDrag(...l)),
3398
+ onDragOver: t[19] || (t[19] = (...l) => s.onDrag && s.onDrag(...l)),
3399
+ onDrop: t[20] || (t[20] = (...l) => s.onDrop && s.onDrop(...l)),
3400
+ onKeydown: t[21] || (t[21] = w(P((...l) => s.onSend && s.onSend(...l), ["exact"]), ["enter"])),
3401
+ onFocusin: t[22] || (t[22] = (l) => o.hasFocus = !0),
3402
+ onFocusout: t[23] || (t[23] = (l) => o.hasFocus = !1)
3403
+ }, [
3404
+ S("div", {
3405
+ class: "d-of-auto d-mx16 d-mt8 d-mb4",
3406
+ style: Ye({ "max-height": n.maxHeight })
3407
+ }, [
3408
+ m(b, L({
3409
+ ref: "richTextEditor",
3410
+ modelValue: o.internalInputValue,
3411
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => o.internalInputValue = l),
3412
+ editable: n.editable,
3413
+ "input-aria-label": n.inputAriaLabel,
3414
+ "input-class": n.inputClass,
3415
+ "output-format": n.outputFormat,
3416
+ "auto-focus": n.autoFocus,
3417
+ link: n.link,
3418
+ placeholder: n.placeholder
3419
+ }, e.$attrs, {
3420
+ onFocus: t[1] || (t[1] = (l) => o.hasFocus = !0),
3421
+ onBlur: t[2] || (t[2] = (l) => o.hasFocus = !1)
3422
+ }), null, 16, ["modelValue", "editable", "input-aria-label", "input-class", "output-format", "auto-focus", "link", "placeholder"])
3423
+ ], 4),
3424
+ f(e.$slots, "middle"),
3425
+ S("section", Ss, [
3426
+ S("div", Es, [
3427
+ m(C, {
3428
+ placement: "top-start",
3429
+ message: n.imageTooltipLabel,
3430
+ offset: [-4, -4]
3431
+ }, {
3432
+ anchor: u(() => [
3433
+ m(y, {
3434
+ "data-qa": "dt-message-input-image-btn",
3435
+ size: "sm",
3436
+ circle: "",
3437
+ kind: o.imagePickerFocus ? "default" : "muted",
3438
+ importance: "clear",
3439
+ "aria-label": n.imageButtonAriaLabel,
3440
+ onClick: s.onSelectImage,
3441
+ onMouseenter: t[3] || (t[3] = (l) => o.imagePickerFocus = !0),
3442
+ onMouseleave: t[4] || (t[4] = (l) => o.imagePickerFocus = !1),
3443
+ onFocusin: t[5] || (t[5] = (l) => o.imagePickerFocus = !0),
3444
+ onFocusout: t[6] || (t[6] = (l) => o.imagePickerFocus = !1)
3445
+ }, {
3446
+ icon: u(() => [
3447
+ m(r, {
3448
+ name: "image",
3449
+ size: "300"
3450
+ })
3451
+ ]),
3452
+ _: 1
3453
+ }, 8, ["kind", "aria-label", "onClick"]),
3454
+ m(k, {
3455
+ ref: "messageInputImageUpload",
3456
+ "data-qa": "dt-message-input-image-input",
3457
+ type: "file",
3458
+ class: "d-ps-absolute",
3459
+ multiple: "",
3460
+ hidden: "",
3461
+ onInput: s.onImageUpload
3462
+ }, null, 8, ["onInput"])
3463
+ ]),
3464
+ _: 1
3465
+ }, 8, ["message"]),
3466
+ m(I, {
3467
+ "data-qa": "dt-message-input-emoji-picker-popover",
3468
+ open: o.emojiPickerOpened,
3469
+ "initial-focus-element": "#searchInput",
3470
+ padding: "none",
3471
+ onOpened: t[12] || (t[12] = (l) => {
3472
+ o.emojiPickerOpened = l;
3473
+ })
3474
+ }, {
3475
+ anchor: u(() => [
3476
+ m(C, {
3477
+ message: n.emojiTooltipMessage,
3478
+ offset: [0, -4]
3479
+ }, {
3480
+ anchor: u(() => [
3481
+ m(y, {
3482
+ "data-qa": "dt-message-input-emoji-picker-btn",
3483
+ size: "sm",
3484
+ circle: "",
3485
+ kind: s.emojiPickerHovered ? "default" : "muted",
3486
+ importance: "clear",
3487
+ "aria-label": n.emojiButtonAriaLabel,
3488
+ offset: [0, 0],
3489
+ onClick: s.toggleEmojiPicker,
3490
+ onMouseenter: t[7] || (t[7] = (l) => o.emojiPickerFocus = !0),
3491
+ onMouseleave: t[8] || (t[8] = (l) => o.emojiPickerFocus = !1),
3492
+ onFocusin: t[9] || (t[9] = (l) => o.emojiPickerFocus = !0),
3493
+ onFocusout: t[10] || (t[10] = (l) => o.emojiPickerFocus = !1)
3494
+ }, {
3495
+ icon: u(() => [
3496
+ m(r, {
3497
+ name: s.emojiPickerHovered ? "very-satisfied" : "satisfied",
3498
+ size: "300"
3499
+ }, null, 8, ["name"])
3500
+ ]),
3501
+ _: 1
3502
+ }, 8, ["kind", "aria-label", "onClick"])
3503
+ ]),
3504
+ _: 1
3505
+ }, 8, ["message"])
3506
+ ]),
3507
+ content: u(() => [
3508
+ m(j, {
3509
+ "tab-set-labels": n.emojiTabSetLabels,
3510
+ "skin-selector-button-tooltip-label": n.emojiSkinSelectorButtonTooltipLabel,
3511
+ "search-no-results-label": n.emojiSearchNoResultsLabel,
3512
+ "search-results-label": n.emojiSearchResultsLabel,
3513
+ "search-placeholder-label": n.emojiSearchPlaceholderLabel,
3514
+ "skin-tone": o.skinTone,
3515
+ onSkinTone: t[11] || (t[11] = (l) => o.skinTone = l),
3516
+ onSelectedEmoji: s.onSelectEmoji
3517
+ }, null, 8, ["tab-set-labels", "skin-selector-button-tooltip-label", "search-no-results-label", "search-results-label", "search-placeholder-label", "skin-tone", "onSelectedEmoji"])
3518
+ ]),
3519
+ _: 1
3520
+ }, 8, ["open"])
3521
+ ]),
3522
+ S("div", Cs, [
3523
+ s.displayCharacterLimitWarning ? (a(), h(C, {
3524
+ key: 0,
3525
+ enabled: n.characterLimitWarningMessage && n.characterLimitCount - s.inputLength < 0,
3526
+ placement: "top-end",
3527
+ message: n.characterLimitWarningMessage,
3528
+ offset: [10, -8]
3529
+ }, {
3530
+ anchor: u(() => [
3531
+ s.displayCharacterLimitWarning ? (a(), p("p", ks, E(n.characterLimitCount - s.inputLength), 1)) : g("", !0)
3532
+ ]),
3533
+ _: 1
3534
+ }, 8, ["enabled", "message"])) : g("", !0),
3535
+ m(C, {
3536
+ placement: "top-end",
3537
+ message: n.sendTooltipLabel,
3538
+ show: !s.isSendDisabled && o.sendButtonFocus,
3539
+ offset: [6, -4]
3540
+ }, {
3541
+ anchor: u(() => [
3542
+ m(y, {
3543
+ "data-qa": "dt-message-input-send-btn",
3544
+ size: "sm",
3545
+ kind: s.isSendDisabled ? "muted" : "default",
3546
+ circle: "",
3547
+ importance: "primary",
3548
+ class: _({
3549
+ "message-input-button__disabled d-fc-muted": s.isSendDisabled
3550
+ }),
3551
+ "aria-label": n.sendButtonAriaLabel,
3552
+ "aria-disabled": s.isSendDisabled,
3553
+ onClick: s.onSend,
3554
+ onMouseenter: t[13] || (t[13] = (l) => o.sendButtonFocus = !0),
3555
+ onMouseleave: t[14] || (t[14] = (l) => o.sendButtonFocus = !1),
3556
+ onFocusin: t[15] || (t[15] = (l) => o.sendButtonFocus = !0),
3557
+ onFocusout: t[16] || (t[16] = (l) => o.sendButtonFocus = !1)
3558
+ }, {
3559
+ icon: u(() => [
3560
+ m(r, {
3561
+ name: "send",
3562
+ size: "300"
3563
+ })
3564
+ ]),
3565
+ _: 1
3566
+ }, 8, ["kind", "class", "aria-label", "aria-disabled", "onClick"])
3567
+ ]),
3568
+ _: 1
3569
+ }, 8, ["message", "show"])
3570
+ ])
3571
+ ])
3572
+ ], 34),
3573
+ S("section", Is, [
3574
+ S("div", ws, [
3575
+ f(e.$slots, "footerLeft")
3576
+ ]),
3577
+ S("div", Os, [
3578
+ f(e.$slots, "footerRight")
3579
+ ])
3580
+ ])
3581
+ ])
3582
+ ], 64);
3583
+ }
3584
+ const Ws = /* @__PURE__ */ v(vs, [["render", Ts]]);
3585
+ export {
3586
+ V as A,
3587
+ xt as D,
3588
+ F as L,
3589
+ Yt as M,
3590
+ z as N,
3591
+ gn as P,
3592
+ $ as S,
3593
+ Mt as a,
3594
+ Wt as b,
3595
+ Qt as c,
3596
+ un as d,
3597
+ W as e,
3598
+ In as f,
3599
+ ge as g,
3600
+ fn as h,
3601
+ Tt as i,
3602
+ X as j,
3603
+ gt as k,
3604
+ yt as l,
3605
+ Y as m,
3606
+ _t as n,
3607
+ vt as o,
3608
+ Z as p,
3609
+ Tn as q,
3610
+ J as r,
3611
+ mn as s,
3612
+ pn as t,
3613
+ hn as u,
3614
+ ht as v,
3615
+ D as w,
3616
+ ct as x,
3617
+ ve as y,
3618
+ Ws as z
3619
+ };