@dialpad/dialtone-vue 3.96.3 → 3.98.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 (34) hide show
  1. package/CHANGELOG.json +1 -1
  2. package/CHANGELOG.md +24 -0
  3. package/README.md +13 -15
  4. package/dist/dialtone-vue.cjs +5 -5
  5. package/dist/dialtone-vue.js +2295 -1944
  6. package/dist/emoji.cjs +1 -1
  7. package/dist/emoji.js +18 -17
  8. package/dist/emoji_picker-_P3IH5Mx.js +967 -0
  9. package/dist/emoji_picker-x6wk4x21.cjs +1 -0
  10. package/dist/message_input.cjs +13 -13
  11. package/dist/message_input.js +2121 -2244
  12. package/dist/stack-2vhLbADY.cjs +2 -0
  13. package/dist/{stack-q9VLdD1J.js → stack-FkIoaXcJ.js} +394 -739
  14. package/dist/style.css +1 -1
  15. package/dist/types/components/emoji_picker/composables/useKeyboardNavigation.d.ts +3 -4
  16. package/dist/types/components/emoji_picker/composables/useKeyboardNavigation.d.ts.map +1 -1
  17. package/dist/types/components/emoji_picker/emoji_picker_constants.d.ts +6 -0
  18. package/dist/types/components/emoji_picker/emoji_picker_constants.d.ts.map +1 -1
  19. package/dist/types/components/emoji_picker/modules/emoji_selector.vue.d.ts +3 -1
  20. package/dist/types/components/emoji_picker/modules/emoji_selector.vue.d.ts.map +1 -1
  21. package/dist/types/components/emoji_picker/modules/emoji_skin_selector.vue.d.ts +1 -1
  22. package/dist/types/components/emoji_picker/modules/emoji_skin_selector.vue.d.ts.map +1 -1
  23. package/dist/types/components/emoji_picker/modules/emoji_tabset.vue.d.ts +1 -1
  24. package/dist/types/components/emoji_picker/modules/emoji_tabset.vue.d.ts.map +1 -1
  25. package/dist/types/recipes/conversation_view/feed_item_row/feed_item_row.vue.d.ts +15 -0
  26. package/dist/types/recipes/conversation_view/feed_item_row/feed_item_row.vue.d.ts.map +1 -1
  27. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +67 -203
  28. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  29. package/package.json +3 -3
  30. package/dist/emoji_picker-MrGLDXUn.js +0 -921
  31. package/dist/emoji_picker-gkXbSV3i.cjs +0 -1
  32. package/dist/stack-_FIkvuMY.cjs +0 -2
  33. package/dist/types/components/emoji_picker/composables/useEmojiSelector.d.ts +0 -5
  34. package/dist/types/components/emoji_picker/composables/useEmojiSelector.d.ts.map +0 -1
@@ -0,0 +1,967 @@
1
+ import { ref as h, onMounted as re, openBlock as y, createElementBlock as _, createVNode as F, unref as T, withKeys as U, withModifiers as ue, createSlots as Se, withCtx as H, createElementVNode as w, computed as P, toRefs as _e, watch as W, Fragment as z, renderList as Y, createBlock as Re, nextTick as x, onUnmounted as je, toDisplayString as J, withDirectives as oe, createCommentVNode as le, vShow as se, normalizeClass as ce, watchEffect as ae, createTextVNode as fe } from "vue";
2
+ import { t as Te, w as ne, x as we, y as Ee, z as I } from "./emoji-64scMQZS.js";
3
+ import { D as $e } from "./tooltip-H27s49LR.js";
4
+ const Le = { class: "d-emoji-picker__search d-emoji-picker__alignment" }, Ae = ["onKeydown"], Ie = {
5
+ __name: "emoji_search",
6
+ props: {
7
+ searchPlaceholderLabel: {
8
+ type: String,
9
+ required: !0
10
+ },
11
+ modelValue: {
12
+ type: String,
13
+ default: ""
14
+ }
15
+ },
16
+ emits: ["update:modelValue", "focus-emoji-selector", "focus-tabset", "select-first-emoji"],
17
+ setup(o, { expose: k, emit: L }) {
18
+ const i = L, u = h(null);
19
+ function j() {
20
+ i("update:modelValue", ""), p();
21
+ }
22
+ function p() {
23
+ u.value.focus();
24
+ }
25
+ return re(() => {
26
+ p();
27
+ }), k({
28
+ focusSearchInput: p
29
+ }), (S, c) => (y(), _("div", Le, [
30
+ F(T(Te), {
31
+ id: "searchInput",
32
+ ref_key: "searchInput",
33
+ ref: u,
34
+ placeholder: o.searchPlaceholderLabel,
35
+ "model-value": o.modelValue,
36
+ "onUpdate:modelValue": c[0] || (c[0] = (s) => S.$emit("update:modelValue", s)),
37
+ onKeydown: [
38
+ c[1] || (c[1] = U((s) => S.$emit("focus-tabset"), ["up"])),
39
+ c[2] || (c[2] = U(ue((s) => S.$emit("focus-emoji-selector"), ["prevent"]), ["down"])),
40
+ c[3] || (c[3] = U((s) => S.$emit("select-first-emoji"), ["enter"]))
41
+ ]
42
+ }, Se({
43
+ leftIcon: H(() => [
44
+ F(T(ne), { name: "search" })
45
+ ]),
46
+ _: 2
47
+ }, [
48
+ o.modelValue.length > 0 ? {
49
+ name: "rightIcon",
50
+ fn: H(() => [
51
+ w("button", {
52
+ class: "d-emoji-picker__search-button",
53
+ onClick: j,
54
+ onKeydown: U(j, ["enter"])
55
+ }, [
56
+ F(T(ne), { name: "close" })
57
+ ], 40, Ae)
58
+ ]),
59
+ key: "0"
60
+ } : void 0
61
+ ]), 1032, ["placeholder", "model-value"])
62
+ ]));
63
+ }
64
+ }, Fe = { class: "d-emoji-picker__tabset" }, De = {
65
+ __name: "emoji_tabset",
66
+ props: {
67
+ /**
68
+ * Whether to show the recently used tab or not
69
+ * @type {Boolean}
70
+ * @default false
71
+ */
72
+ showRecentlyUsedTab: {
73
+ type: Boolean,
74
+ default: !1
75
+ },
76
+ scrollIntoTab: {
77
+ type: Number,
78
+ required: !0
79
+ },
80
+ isScrolling: {
81
+ type: Boolean,
82
+ default: !1
83
+ },
84
+ emojiFilter: {
85
+ type: String,
86
+ default: ""
87
+ },
88
+ /**
89
+ * The labels for the aria-label
90
+ * @type {Array}
91
+ * @required
92
+ */
93
+ tabsetLabels: {
94
+ type: Array,
95
+ required: !0
96
+ }
97
+ },
98
+ emits: [
99
+ /**
100
+ * Emitted when a tab is selected
101
+ * @event selected-tabset
102
+ * @param {String} tabId - The name of the tab that was selected
103
+ */
104
+ "selected-tabset",
105
+ "focus-search-input",
106
+ "focus-skin-selector"
107
+ ],
108
+ setup(o, { expose: k, emit: L }) {
109
+ const i = o, u = L, j = [
110
+ { label: K.MOST_RECENTLY_USED, icon: "clock" },
111
+ { label: K.SMILEYS_AND_PEOPLE, icon: "satisfied" },
112
+ { label: K.NATURE, icon: "living-thing" },
113
+ { label: K.FOOD, icon: "food" },
114
+ { label: K.ACTIVITY, icon: "object" },
115
+ { label: K.TRAVEL, icon: "transportation" },
116
+ { label: K.OBJECTS, icon: "lightbulb" },
117
+ { label: K.SYMBOLS, icon: "heart" },
118
+ { label: K.FLAGS, icon: "flag" }
119
+ ], p = P(() => (i.showRecentlyUsedTab ? j : j.slice(1)).map((t, a) => ({
120
+ ...t,
121
+ label: i.tabsetLabels[a],
122
+ id: (a + 1).toString(),
123
+ panelId: (a + 1).toString()
124
+ }))), S = P(() => i.emojiFilter.length > 0), c = h("1"), { isScrolling: s } = _e(i), g = h([]);
125
+ W(
126
+ () => i.scrollIntoTab,
127
+ () => {
128
+ !s.value && !S.value && (c.value = (i.scrollIntoTab + 1).toString());
129
+ }
130
+ ), W(
131
+ S,
132
+ () => {
133
+ S.value && (c.value = null);
134
+ }
135
+ );
136
+ function D(e) {
137
+ s.value || (c.value = e), u("selected-tabset", e);
138
+ }
139
+ function O(e) {
140
+ g.value.push(e.$el);
141
+ }
142
+ function A() {
143
+ g.value[0].focus();
144
+ }
145
+ function l(e, t) {
146
+ e.key === "Enter" && (D(t), g.value[t - 1].blur()), e.key === "Tab" && (e.preventDefault(), e.shiftKey ? u("focus-skin-selector") : u("focus-search-input")), e.key === "ArrowDown" && u("focus-search-input");
147
+ }
148
+ return k({
149
+ focusTabset: A
150
+ }), (e, t) => (y(), _("div", Fe, [
151
+ F(T(we), {
152
+ "tab-list-class": "d-emoji-picker__tabset-list",
153
+ selected: c.value
154
+ }, {
155
+ tabs: H(() => [
156
+ (y(!0), _(z, null, Y(p.value, (a, f) => (y(), Re(T(Ee), {
157
+ id: a.id,
158
+ ref_for: !0,
159
+ ref: (b) => {
160
+ b && O(b);
161
+ },
162
+ key: a.id,
163
+ "panel-id": a.panelId,
164
+ label: a.label,
165
+ "aria-controls": "d-emoji-picker-list",
166
+ tabindex: f + 1,
167
+ onClickCapture: ue((b) => D(a.id), ["stop"]),
168
+ onKeydown: (b) => l(b, a.id)
169
+ }, {
170
+ default: H(() => [
171
+ F(T(ne), {
172
+ size: "400",
173
+ name: a.icon
174
+ }, null, 8, ["name"])
175
+ ]),
176
+ _: 2
177
+ }, 1032, ["id", "panel-id", "label", "tabindex", "onClickCapture", "onKeydown"]))), 128))
178
+ ]),
179
+ _: 1
180
+ }, 8, ["selected"])
181
+ ]));
182
+ }
183
+ }, G = {
184
+ ARROW_UP: "ArrowUp",
185
+ ARROW_DOWN: "ArrowDown",
186
+ ARROW_LEFT: "ArrowLeft",
187
+ ARROW_RIGHT: "ArrowRight"
188
+ }, Q = "https://static.dialpadcdn.com/joypixels/png/unicode/32/", $ = 9, q = {
189
+ DEFAULT: "Default",
190
+ LIGHT: "Light",
191
+ MEDIUM_LIGHT: "MediumLight",
192
+ MEDIUM: "Medium",
193
+ MEDIUM_DARK: "MediumDark",
194
+ DARK: "Dark"
195
+ }, K = {
196
+ MOST_RECENTLY_USED: "Most recently used",
197
+ SMILEYS_AND_PEOPLE: "Smileys and people",
198
+ NATURE: "Nature",
199
+ FOOD: "Food",
200
+ ACTIVITY: "Activity",
201
+ TRAVEL: "Travel",
202
+ OBJECTS: "Objects",
203
+ SYMBOLS: "Symbols",
204
+ FLAGS: "Flags"
205
+ };
206
+ function Oe() {
207
+ const o = h([]), k = h([]), L = h(!1), i = h(!0);
208
+ function u(l, e) {
209
+ s(l, e - 1) || (o.value[l - 1] ? s(l - 1, o.value[l - 1].length - 1) : s(o.value.length - 1, o.value[o.value.length - 1].length - 1));
210
+ }
211
+ function j(l, e) {
212
+ s(l, e + 1) || s(l + 1, 0) || s(0, 0);
213
+ }
214
+ function p(l, e) {
215
+ s(0, e - 1) || s(0, k.value.length - 1);
216
+ }
217
+ function S(l, e) {
218
+ s(0, e + 1) || s(0, 0);
219
+ }
220
+ function c(l, e, t) {
221
+ L.value ? l === "left" ? p(e, t) : l === "right" && S(e, t) : l === "left" ? u(e, t) : l === "right" && j(e, t);
222
+ }
223
+ function s(l, e) {
224
+ var a, f, b;
225
+ const t = L.value ? (a = k.value) == null ? void 0 : a[e] : (b = (f = o.value) == null ? void 0 : f[l]) == null ? void 0 : b[e];
226
+ return t ? (t.focus(), !0) : !1;
227
+ }
228
+ function g(l, e, t) {
229
+ o.value[e] || (o.value[e] = []), o.value[e][t] = l;
230
+ }
231
+ function D(l, e) {
232
+ k.value[e] = l;
233
+ }
234
+ function O(l, e) {
235
+ var t;
236
+ if (i.value = !1, l === G.ARROW_UP) {
237
+ const a = e % $;
238
+ if (!s(0, e - $)) {
239
+ const f = k.value.length - k.value.length % $ + a;
240
+ s(0, f), s(0, f) || s(0, k.value.length - 1);
241
+ }
242
+ }
243
+ if (l === G.ARROW_DOWN && !s(0, e + $)) {
244
+ const a = e % $;
245
+ (t = k.value) != null && t[e + ($ - a)] ? s(0, k.value.length - 1) : s(0, a);
246
+ }
247
+ l === G.ARROW_LEFT && c("left", 0, e), l === G.ARROW_RIGHT && c("right", 0, e);
248
+ }
249
+ function A(l, e, t) {
250
+ var a, f;
251
+ if (l === "ArrowUp") {
252
+ const b = t % $;
253
+ if (e === 0) {
254
+ const R = $ - o.value[o.value.length - 1].length % $, C = o.value[o.value.length - 1].length + R - ($ - b);
255
+ s(o.value.length - 1, C) || s(o.value.length - 1, o.value[o.value.length - 1].length - 1);
256
+ return;
257
+ }
258
+ if (!s(e, t - $)) {
259
+ const R = e - 1 < 0 ? 0 : e - 1, C = o.value[R].length, ee = C - C % $ + b;
260
+ s(R, ee) || s(e - 1, o.value[e - 1].length - 1);
261
+ }
262
+ }
263
+ if (l === "ArrowDown" && !s(e, t + $)) {
264
+ const b = t % $;
265
+ (f = (a = o.value) == null ? void 0 : a[e]) != null && f[t + ($ - b)] ? s(e, o.value[e].length - 1) : s(e + 1, b) || s(0, b) || s(0, o.value[0].length - 1);
266
+ }
267
+ l === "ArrowLeft" && c("left", e, t), l === "ArrowRight" && c("right", e, t);
268
+ }
269
+ return {
270
+ emojiFilteredRefs: k,
271
+ isFiltering: L,
272
+ hoverFirstEmoji: i,
273
+ setEmojiRef: g,
274
+ setFilteredRef: D,
275
+ focusEmoji: s,
276
+ handleArrowNavigationFiltered: O,
277
+ handleArrowNavigation: A
278
+ };
279
+ }
280
+ const Ce = { class: "d-emoji-picker__selector" }, Me = {
281
+ key: 0,
282
+ class: "d-emoji-picker__search-label d-emoji-picker__alignment"
283
+ }, Ke = { key: 0 }, Ne = { class: "d-emoji-picker__tab" }, Ue = ["aria-label", "onClick", "onFocusin", "onMouseover", "onKeydown"], Be = ["alt", "aria-label", "title", "src"], Pe = {
284
+ key: 2,
285
+ class: "d-emoji-picker__alignment"
286
+ }, Ve = {
287
+ class: "d-emoji-picker__tab",
288
+ "data-qa": "filtered-emojis"
289
+ }, qe = ["aria-label", "onClick", "onFocusin", "onMouseover", "onKeydown"], We = ["alt", "aria-label", "title", "src"], Ge = {
290
+ __name: "emoji_selector",
291
+ props: {
292
+ /**
293
+ * The filter to apply to the emoji list
294
+ * @type {String}
295
+ * @default ''
296
+ */
297
+ emojiFilter: {
298
+ type: String,
299
+ default: ""
300
+ },
301
+ /**
302
+ * The skin tone to apply to the emoji list
303
+ * @type {String}
304
+ * @required
305
+ */
306
+ skinTone: {
307
+ type: String,
308
+ required: !0
309
+ },
310
+ /**
311
+ * The labels for the tabset
312
+ * @type {Array}
313
+ * @required
314
+ */
315
+ tabsetLabels: {
316
+ type: Array,
317
+ required: !0
318
+ },
319
+ selectedTabset: {
320
+ type: Object,
321
+ required: !0
322
+ },
323
+ /**
324
+ * The label for the search results tab
325
+ * @type {String}
326
+ * @required
327
+ */
328
+ searchResultsLabel: {
329
+ type: String,
330
+ required: !0
331
+ },
332
+ searchNoResultsLabel: {
333
+ type: String,
334
+ required: !0
335
+ },
336
+ /**
337
+ * The list of recently used emojis
338
+ * @type {Array}
339
+ */
340
+ recentlyUsedEmojis: {
341
+ type: Array,
342
+ default: () => []
343
+ }
344
+ },
345
+ emits: [
346
+ /**
347
+ * Emitted when the user hover over an emoji
348
+ * @event highlighted-emoji
349
+ * @param {Object} emoji - The emoji data that was hovered
350
+ */
351
+ "highlighted-emoji",
352
+ /**
353
+ * Emitted when the user select an emoji
354
+ * @event selected-emoji
355
+ * @param {Object} emoji - The emoji data that was selected
356
+ */
357
+ "selected-emoji",
358
+ /**
359
+ * Emitted when the user scroll into an emoji tab
360
+ * @event scroll-into-tab
361
+ * @param {Number} tab-index - The tab that was scrolled into
362
+ */
363
+ "scroll-into-tab",
364
+ /**
365
+ * Emitted when the scrollTo function starts scrolling and stops scrolling
366
+ * @event is-scrolling
367
+ * @param {Boolean} is-scrolling - Whether the user is scrolling with the scroll-to
368
+ */
369
+ "is-scrolling",
370
+ /**
371
+ * Emitted when the user reach the end of the emoji list
372
+ * @event focus-skin-selector
373
+ */
374
+ "focus-skin-selector",
375
+ /**
376
+ * Emitted when the user shift tab in first tab of emoji selector
377
+ * @event focus-search-input
378
+ */
379
+ "focus-search-input"
380
+ ],
381
+ setup(o, { expose: k, emit: L }) {
382
+ const i = o, u = L, {
383
+ emojiFilteredRefs: j,
384
+ isFiltering: p,
385
+ hoverFirstEmoji: S,
386
+ setEmojiRef: c,
387
+ setFilteredRef: s,
388
+ focusEmoji: g,
389
+ handleArrowNavigationFiltered: D,
390
+ handleArrowNavigation: O
391
+ } = Oe(), A = h(null), l = h(null), e = h(null), t = ["Recently used", "People", "Nature", "Food", "Activity", "Travel", "Objects", "Symbols", "Flags"], a = P(() => i.recentlyUsedEmojis.length ? i.tabsetLabels.map((n) => ({ label: n, ref: h(null) })) : i.tabsetLabels.slice(1).map((n) => ({ label: n, ref: h(null) }))), f = h(a.value[0].label), b = P(() => i.recentlyUsedEmojis.length ? t : t.slice(1)), R = h([]), C = P(() => [
392
+ ...I[`People${i.skinTone}`],
393
+ ...I.Nature,
394
+ ...I.Food,
395
+ ...I[`Activity${i.skinTone}`],
396
+ ...I.Travel,
397
+ ...I[`Objects${i.skinTone}`],
398
+ ...I.Symbols,
399
+ ...I.Flags
400
+ ]), ee = de(() => {
401
+ j.value = [], ie();
402
+ });
403
+ W(C, () => {
404
+ ie();
405
+ }, { immediate: !0 }), W(
406
+ () => i.recentlyUsedEmojis,
407
+ () => {
408
+ I["Recently used"] = i.recentlyUsedEmojis;
409
+ },
410
+ { immediate: !0 }
411
+ ), W(() => i.emojiFilter, () => {
412
+ be(), i.emojiFilter ? p.value = !0 : (p.value = !1, B(null)), ee();
413
+ }), W(
414
+ () => i.selectedTabset,
415
+ (n) => {
416
+ X(n.tabId);
417
+ },
418
+ { deep: !0 }
419
+ );
420
+ function te(n, r = !1) {
421
+ S.value = r, u("highlighted-emoji", n);
422
+ }
423
+ function ie() {
424
+ const n = i.emojiFilter.toLowerCase();
425
+ R.value = C.value.filter((r) => {
426
+ const m = r.name.toLowerCase().includes(n), v = r.keywords.some((d) => d.toLowerCase().includes(n));
427
+ return m || v;
428
+ }), x(() => {
429
+ n && te(R.value[0], !0);
430
+ });
431
+ }
432
+ function de(n, r = 300) {
433
+ let m;
434
+ return (...v) => {
435
+ clearTimeout(m), m = setTimeout(() => n(...v), r);
436
+ };
437
+ }
438
+ function me(n) {
439
+ return `${Q + n}.png`;
440
+ }
441
+ function ve(n) {
442
+ n.target.parentNode.style.display = "none";
443
+ }
444
+ function X(n, r = !0) {
445
+ const v = a.value[n - 1].ref.value[0];
446
+ x(() => {
447
+ const d = l.value, M = n === "1" ? 0 : v.offsetTop - 20;
448
+ let E = !0, V = d.scrollTop;
449
+ u("is-scrolling", !0), d.addEventListener("scroll", () => {
450
+ if (E) {
451
+ const N = d.scrollTop;
452
+ (V < N && N >= M || V > N && N <= M) && (E = !1, u("is-scrolling", !1)), V = N;
453
+ }
454
+ }), d.scrollTop = M, r && g(n - 1, 0);
455
+ });
456
+ }
457
+ function be() {
458
+ const n = l.value;
459
+ n.scrollTop = 0;
460
+ }
461
+ function he() {
462
+ e.value = new IntersectionObserver((n) => {
463
+ n.forEach((r) => {
464
+ var d, M, E, V, N;
465
+ const { target: m } = r, v = parseInt(m.dataset.index);
466
+ r.isIntersecting && m.offsetTop <= A.value.offsetTop + 50 ? (f.value = ((d = a.value[v - 1]) == null ? void 0 : d.label) ?? ((M = a.value[0]) == null ? void 0 : M.label), u("scroll-into-tab", v - 1)) : r.boundingClientRect.bottom <= ((E = A.value) == null ? void 0 : E.getBoundingClientRect().bottom) ? (u("scroll-into-tab", v), f.value = (V = a.value[v]) == null ? void 0 : V.label) : v === 1 && (u("scroll-into-tab", v), f.value = (N = a.value[0]) == null ? void 0 : N.label);
467
+ });
468
+ }), e.value.observe(A.value), Array.from(l.value.children).forEach((n, r) => {
469
+ e.value.observe(n), n.dataset.index = r;
470
+ });
471
+ }
472
+ const pe = (n, r, m) => {
473
+ if (n.preventDefault(), Object.values(G).includes(n.key)) {
474
+ D(n.key, r);
475
+ return;
476
+ }
477
+ switch (n.key) {
478
+ case "Tab":
479
+ u("focus-skin-selector");
480
+ break;
481
+ case "Enter":
482
+ Z(m);
483
+ break;
484
+ }
485
+ }, ge = (n, r, m, v) => {
486
+ if (n.preventDefault(), Object.values(G).includes(n.key)) {
487
+ O(n.key, r, m);
488
+ return;
489
+ }
490
+ switch (n.key) {
491
+ case "Tab":
492
+ n.shiftKey ? g(r, 0) && r > 0 ? X(r, !0) : (X(1, !1), u("focus-search-input")) : g(r + 1, 0) ? X(r + 1 + 1, !1) : u("focus-skin-selector");
493
+ break;
494
+ case "Enter":
495
+ Z(v);
496
+ break;
497
+ }
498
+ };
499
+ function Z(n) {
500
+ u("selected-emoji", n);
501
+ }
502
+ function B(n) {
503
+ u("highlighted-emoji", n);
504
+ }
505
+ function ke() {
506
+ g(0, 0);
507
+ }
508
+ function ye() {
509
+ g(b.value.length - 1, 0);
510
+ }
511
+ return re(() => {
512
+ he();
513
+ }), je(() => {
514
+ e.value.disconnect();
515
+ }), k({
516
+ focusEmojiSelector: ke,
517
+ focusLastEmoji: ye
518
+ }), (n, r) => (y(), _("div", Ce, [
519
+ w("div", {
520
+ id: "d-emoji-picker-list",
521
+ ref_key: "listRef",
522
+ ref: l,
523
+ class: "d-emoji-picker__list"
524
+ }, [
525
+ o.emojiFilter ? (y(), _("p", Me, J(R.value.length > 0 ? o.searchResultsLabel : o.searchNoResultsLabel), 1)) : (y(), _("div", {
526
+ key: 1,
527
+ ref_key: "tabCategoryRef",
528
+ ref: A,
529
+ class: "d-emoji-picker__category d-emoji-picker__alignment"
530
+ }, [
531
+ w("p", null, J(f.value), 1)
532
+ ], 512)),
533
+ (y(!0), _(z, null, Y(a.value, (m, v) => oe((y(), _("div", {
534
+ key: v,
535
+ ref_for: !0,
536
+ ref: m.ref,
537
+ class: "d-emoji-picker__alignment"
538
+ }, [
539
+ v ? (y(), _("p", Ke, J(m.label), 1)) : le("", !0),
540
+ w("div", Ne, [
541
+ (y(!0), _(z, null, Y(T(I)[b.value[v] + o.skinTone] ? T(I)[b.value[v] + o.skinTone] : T(I)[b.value[v]], (d, M) => (y(), _("button", {
542
+ key: d.shortname,
543
+ ref_for: !0,
544
+ ref: (E) => {
545
+ E && T(c)(E, v, M);
546
+ },
547
+ type: "button",
548
+ "aria-label": d.name,
549
+ onClick: (E) => Z(d),
550
+ onFocusin: (E) => B(d),
551
+ onFocusout: r[0] || (r[0] = (E) => B(null)),
552
+ onMouseover: (E) => B(d),
553
+ onMouseleave: r[1] || (r[1] = (E) => B(null)),
554
+ onKeydown: (E) => ge(E, v, M, d)
555
+ }, [
556
+ w("img", {
557
+ class: "d-icon d-icon--size-500",
558
+ alt: d.name,
559
+ "aria-label": d.name,
560
+ title: d.name,
561
+ src: me(d.unicode_character),
562
+ onError: ve
563
+ }, null, 40, Be)
564
+ ], 40, Ue))), 128))
565
+ ])
566
+ ])), [
567
+ [se, !o.emojiFilter]
568
+ ])), 128)),
569
+ o.emojiFilter ? (y(), _("div", Pe, [
570
+ w("div", Ve, [
571
+ (y(!0), _(z, null, Y(R.value, (m, v) => (y(), _("button", {
572
+ key: m.shortname,
573
+ ref_for: !0,
574
+ ref: (d) => {
575
+ d && T(s)(d, v);
576
+ },
577
+ type: "button",
578
+ "aria-label": m.name,
579
+ class: ce({
580
+ "hover-emoji": v === 0 && T(S)
581
+ }),
582
+ onClick: (d) => Z(m),
583
+ onFocusin: (d) => B(m),
584
+ onFocusout: r[2] || (r[2] = (d) => B(null)),
585
+ onMouseover: (d) => te(m),
586
+ onMouseleave: r[3] || (r[3] = (d) => te(null)),
587
+ onKeydown: (d) => pe(d, v, m)
588
+ }, [
589
+ w("img", {
590
+ class: "d-icon d-icon--size-500",
591
+ alt: m.name,
592
+ "aria-label": m.name,
593
+ title: m.name,
594
+ src: `${T(Q) + m.unicode_character}.png`
595
+ }, null, 8, We)
596
+ ], 42, qe))), 128))
597
+ ])
598
+ ])) : le("", !0)
599
+ ], 512)
600
+ ]));
601
+ }
602
+ }, He = { "data-qa": "skin-selector" }, ze = { class: "d-emoji-picker__skin-list" }, Ye = ["onKeydown", "onClick"], Je = ["alt", "aria-label", "title", "src"], Qe = { class: "d-emoji-picker__skin-selected" }, Xe = ["aria-label"], Ze = ["alt", "aria-label", "title", "src"], xe = {
603
+ __name: "emoji_skin_selector",
604
+ props: {
605
+ /**
606
+ * The skin tone to apply to the emoji list
607
+ * @type {String}
608
+ * @required
609
+ */
610
+ skinTone: {
611
+ type: String,
612
+ required: !0
613
+ },
614
+ isHovering: {
615
+ type: Boolean,
616
+ default: !1
617
+ },
618
+ skinSelectorButtonTooltipLabel: {
619
+ type: String,
620
+ required: !0
621
+ }
622
+ },
623
+ emits: [
624
+ /**
625
+ * The skin tone that was selected
626
+ * @event skin-tone
627
+ * @type {Number}
628
+ */
629
+ "skin-tone",
630
+ "focus-tabset",
631
+ "focus-last-emoji"
632
+ ],
633
+ setup(o, { expose: k, emit: L }) {
634
+ const i = o, u = L, j = [
635
+ {
636
+ name: ":wave_tone1:",
637
+ unicode_output: "1f44b-1f3fb",
638
+ skinTone: q.LIGHT,
639
+ skinCode: "_tone1"
640
+ },
641
+ {
642
+ name: ":wave_tone2:",
643
+ unicode_output: "1f44b-1f3fc",
644
+ skinTone: q.MEDIUM_LIGHT,
645
+ skinCode: "_tone2"
646
+ },
647
+ {
648
+ name: ":wave_tone3:",
649
+ unicode_output: "1f44b-1f3fd",
650
+ skinTone: q.MEDIUM,
651
+ skinCode: "_tone3"
652
+ },
653
+ {
654
+ name: ":wave_tone4:",
655
+ unicode_output: "1f44b-1f3fe",
656
+ skinTone: q.MEDIUM_DARK,
657
+ skinCode: "_tone4"
658
+ },
659
+ {
660
+ name: ":wave_tone5:",
661
+ unicode_output: "1f44b-1f3ff",
662
+ skinTone: q.DARK,
663
+ skinCode: "_tone5"
664
+ },
665
+ {
666
+ name: ":wave:",
667
+ unicode_output: "1f44b",
668
+ skinTone: q.DEFAULT,
669
+ skinCode: ""
670
+ }
671
+ ], p = h(!1), S = h(null), c = h([]);
672
+ ae(
673
+ () => i.isHovering && (p.value = !1)
674
+ );
675
+ const s = P(() => j.find((t) => t.skinTone === i.skinTone)), g = h(s.value);
676
+ ae(() => s.value && (g.value = s.value));
677
+ function D(t) {
678
+ c.value.push(t);
679
+ }
680
+ function O() {
681
+ S.value.focus();
682
+ }
683
+ function A(t) {
684
+ g.value = t, p.value = !1, u("skin-tone", t.skinTone), x(() => O());
685
+ }
686
+ const l = (t, a, f) => {
687
+ var b, R, C;
688
+ t.preventDefault(), t.key === "ArrowLeft" && (f === 0 && ((b = c.value[c.value.length - 1]) == null || b.focus()), (R = c.value[f - 1]) == null || R.focus()), t.key === "ArrowRight" && ((C = c.value[f + 1]) == null || C.focus()), t.key === "Enter" && (a ? A(a) : e()), t.key === "Tab" && (t.shiftKey ? u("focus-last-emoji") : u("focus-tabset"));
689
+ };
690
+ function e() {
691
+ p.value = !p.value, x(() => c.value[0].focus());
692
+ }
693
+ return k({
694
+ focusSkinSelector: O
695
+ }), (t, a) => (y(), _("div", He, [
696
+ oe(w("div", ze, [
697
+ (y(), _(z, null, Y(j, (f, b) => w("button", {
698
+ ref_for: !0,
699
+ ref: (R) => {
700
+ R && D(R);
701
+ },
702
+ key: f.name,
703
+ class: ce({
704
+ selected: g.value.skinCode === f.skinCode
705
+ }),
706
+ onKeydown: (R) => l(R, f, b),
707
+ onClick: (R) => A(f)
708
+ }, [
709
+ w("img", {
710
+ class: "d-icon d-icon--size-500",
711
+ alt: f.name,
712
+ "aria-label": f.name,
713
+ title: f.name,
714
+ src: `${T(Q) + f.unicode_output}.png`
715
+ }, null, 8, Je)
716
+ ], 42, Ye)), 64))
717
+ ], 512), [
718
+ [se, p.value]
719
+ ]),
720
+ oe(w("div", Qe, [
721
+ F(T($e), { placement: "top-end" }, {
722
+ anchor: H(() => [
723
+ w("button", {
724
+ ref_key: "skinSelectorRef",
725
+ ref: S,
726
+ "aria-label": o.skinSelectorButtonTooltipLabel,
727
+ tabindex: "-1",
728
+ onClick: e,
729
+ onKeydown: a[0] || (a[0] = (f) => l(f))
730
+ }, [
731
+ w("img", {
732
+ class: "d-icon d-icon--size-500",
733
+ alt: g.value.name,
734
+ "aria-label": g.value.name,
735
+ title: g.value.name,
736
+ src: `${T(Q) + g.value.unicode_output}.png`
737
+ }, null, 8, Ze)
738
+ ], 40, Xe)
739
+ ]),
740
+ default: H(() => [
741
+ fe(J(o.skinSelectorButtonTooltipLabel) + " ", 1)
742
+ ]),
743
+ _: 1
744
+ })
745
+ ], 512), [
746
+ [se, !p.value]
747
+ ])
748
+ ]));
749
+ }
750
+ }, et = { class: "d-emoji-picker__data" }, tt = ["alt", "aria-label", "title", "src"], ot = {
751
+ __name: "emoji_description",
752
+ props: {
753
+ /**
754
+ * Emoji data
755
+ * @type {Object}
756
+ * @default null
757
+ */
758
+ emoji: {
759
+ type: Object,
760
+ default: null
761
+ }
762
+ },
763
+ setup(o) {
764
+ return (k, L) => {
765
+ var i;
766
+ return y(), _("div", et, [
767
+ o.emoji ? (y(), _("img", {
768
+ key: 0,
769
+ class: "d-icon d-icon--size-500",
770
+ alt: o.emoji.name,
771
+ "aria-label": o.emoji.name,
772
+ title: o.emoji.name,
773
+ src: `${T(Q) + o.emoji.unicode_character}.png`
774
+ }, null, 8, tt)) : le("", !0),
775
+ fe(" " + J((i = o.emoji) == null ? void 0 : i.name), 1)
776
+ ]);
777
+ };
778
+ }
779
+ }, lt = { class: "d-emoji-picker" }, st = { class: "d-emoji-picker--header" }, nt = { class: "d-emoji-picker--body" }, it = { class: "d-emoji-picker--footer" }, ct = {
780
+ __name: "emoji_picker",
781
+ props: {
782
+ /**
783
+ * The array with recently used emoji object
784
+ * This list is necessary to fill the recently used tab
785
+ * @type {Array}
786
+ * @default []
787
+ * @example
788
+ * <dt-emoji-picker :recentlyUsedEmojis="[emojiObject, emojiObject]" />
789
+ */
790
+ // TODO try to simplify this to achieve an array of unicode characters and not an entire emoji data object
791
+ recentlyUsedEmojis: {
792
+ type: Array,
793
+ default: () => []
794
+ },
795
+ /**
796
+ * The placeholder text for the search input
797
+ * @type {String}
798
+ * @required
799
+ * @example
800
+ * <dt-emoji-picker :searchPlaceholderLabel="'Search...'" />
801
+ */
802
+ searchPlaceholderLabel: {
803
+ type: String,
804
+ required: !0
805
+ },
806
+ /**
807
+ * The label for the search results tab
808
+ * @type {String}
809
+ * @required
810
+ * @example
811
+ * <dt-emoji-picker :searchResultsLabel="'Search results'" />
812
+ */
813
+ searchResultsLabel: {
814
+ type: String,
815
+ required: !0
816
+ },
817
+ /**
818
+ * The label for the search no results
819
+ * @type {String}
820
+ * @required
821
+ * @example
822
+ * <dt-emoji-picker :searchNoResultsLabel="'No results'" />
823
+ */
824
+ searchNoResultsLabel: {
825
+ type: String,
826
+ required: !0
827
+ },
828
+ /**
829
+ * The list of tabsets to show, it is necessary to be updated with the correct language
830
+ * It must respect the provided order.
831
+ * @type {Array}
832
+ * @required
833
+ * @example
834
+ * <dt-emoji-picker
835
+ * :tabSetLabels="['Most recently used', 'Smileys and people', 'Nature',
836
+ * 'Food', 'Activity', 'Travel', 'Objects', 'Symbols', 'Flags']" />
837
+ */
838
+ tabSetLabels: {
839
+ type: Array,
840
+ required: !0
841
+ },
842
+ /**
843
+ * The skin tone to show the emojis
844
+ * This prop gives the possibility to use the skin tone selected by the user previously
845
+ * @type {String}
846
+ * @default 'Default'
847
+ * @values 'Default', 'Light', 'MediumLight', 'Medium', 'MediumDark', 'Dark'
848
+ * @example
849
+ * <dt-emoji-picker :skinTone="'Default'" />
850
+ */
851
+ skinTone: {
852
+ type: String,
853
+ default: "Default"
854
+ },
855
+ /**
856
+ * Tooltip shown when skin selector button is hovered.
857
+ * @type {String}
858
+ * @required
859
+ * @example
860
+ * <dt-emoji-picker :skin-selector-button-tooltip-label="'Change default skin tone'" />
861
+ */
862
+ skinSelectorButtonTooltipLabel: {
863
+ type: String,
864
+ required: !0
865
+ }
866
+ },
867
+ emits: [
868
+ /**
869
+ * It will emit the selected emoji
870
+ * @event selected-emoji
871
+ * @param {Object} emoji - The selected emoji from the emoji selector
872
+ */
873
+ "selected-emoji",
874
+ /**
875
+ * It will emit the selected skin tone
876
+ * @event skin-tone
877
+ * @param {String} skin - The selected skin tone from the skin selector
878
+ */
879
+ "skin-tone",
880
+ /**
881
+ * Since the keyboard events are encapsulated, we emit this event to close the picker
882
+ * @event close
883
+ */
884
+ "close"
885
+ ],
886
+ setup(o, { emit: k }) {
887
+ const L = o, i = k, u = h(""), j = h(null), p = h({}), S = h(0), c = h(!1), s = P(() => L.recentlyUsedEmojis.length > 0);
888
+ function g(l) {
889
+ u.value = "", p.value = l, p.value = { ...p.value, tabId: l };
890
+ }
891
+ function D(l) {
892
+ S.value = l;
893
+ }
894
+ function O(l) {
895
+ c.value = l;
896
+ }
897
+ function A(l) {
898
+ j.value = l;
899
+ }
900
+ return (l, e) => (y(), _("div", lt, [
901
+ w("div", st, [
902
+ F(De, {
903
+ ref: "tabsetRef",
904
+ "emoji-filter": u.value,
905
+ "show-recently-used-tab": s.value,
906
+ "scroll-into-tab": S.value,
907
+ "tabset-labels": o.tabSetLabels,
908
+ "is-scrolling": c.value,
909
+ onFocusSearchInput: e[0] || (e[0] = (t) => l.$refs.searchInputRef.focusSearchInput()),
910
+ onFocusSkinSelector: e[1] || (e[1] = (t) => l.$refs.skinSelectorRef.focusSkinSelector()),
911
+ onSelectedTabset: g,
912
+ onKeydown: e[2] || (e[2] = U((t) => i("close"), ["esc"]))
913
+ }, null, 8, ["emoji-filter", "show-recently-used-tab", "scroll-into-tab", "tabset-labels", "is-scrolling"])
914
+ ]),
915
+ w("div", nt, [
916
+ F(Ie, {
917
+ ref: "searchInputRef",
918
+ modelValue: u.value,
919
+ "onUpdate:modelValue": e[3] || (e[3] = (t) => u.value = t),
920
+ "search-placeholder-label": o.searchPlaceholderLabel,
921
+ onSelectFirstEmoji: e[4] || (e[4] = (t) => i("selected-emoji", j.value)),
922
+ onFocusTabset: e[5] || (e[5] = (t) => l.$refs.tabsetRef.focusTabset()),
923
+ onFocusEmojiSelector: e[6] || (e[6] = (t) => l.$refs.emojiSelectorRef.focusEmojiSelector()),
924
+ onKeydown: e[7] || (e[7] = U((t) => i("close"), ["esc"]))
925
+ }, null, 8, ["modelValue", "search-placeholder-label"]),
926
+ F(Ge, {
927
+ ref: "emojiSelectorRef",
928
+ "emoji-filter": u.value,
929
+ "skin-tone": o.skinTone,
930
+ "tabset-labels": o.tabSetLabels,
931
+ "search-results-label": o.searchResultsLabel,
932
+ "search-no-results-label": o.searchNoResultsLabel,
933
+ "recently-used-emojis": o.recentlyUsedEmojis,
934
+ "selected-tabset": p.value,
935
+ onScrollIntoTab: D,
936
+ onIsScrolling: O,
937
+ onHighlightedEmoji: A,
938
+ onSelectedEmoji: e[8] || (e[8] = (t) => i("selected-emoji", t)),
939
+ onFocusSkinSelector: e[9] || (e[9] = (t) => l.$refs.skinSelectorRef.focusSkinSelector()),
940
+ onFocusSearchInput: e[10] || (e[10] = (t) => l.$refs.searchInputRef.focusSearchInput()),
941
+ onKeydown: e[11] || (e[11] = U((t) => i("close"), ["esc"]))
942
+ }, null, 8, ["emoji-filter", "skin-tone", "tabset-labels", "search-results-label", "search-no-results-label", "recently-used-emojis", "selected-tabset"])
943
+ ]),
944
+ w("div", it, [
945
+ F(ot, { emoji: j.value }, null, 8, ["emoji"]),
946
+ F(xe, {
947
+ ref: "skinSelectorRef",
948
+ "is-hovering": !!j.value,
949
+ "skin-selector-button-tooltip-label": o.skinSelectorButtonTooltipLabel,
950
+ "skin-tone": o.skinTone,
951
+ onSkinTone: e[12] || (e[12] = (t) => i("skin-tone", t)),
952
+ onFocusTabset: e[13] || (e[13] = (t) => l.$refs.tabsetRef.focusTabset()),
953
+ onFocusLastEmoji: e[14] || (e[14] = (t) => l.$refs.emojiSelectorRef.focusLastEmoji()),
954
+ onKeydown: e[15] || (e[15] = U((t) => i("close"), ["esc"]))
955
+ }, null, 8, ["is-hovering", "skin-selector-button-tooltip-label", "skin-tone"])
956
+ ])
957
+ ]));
958
+ }
959
+ };
960
+ export {
961
+ G as A,
962
+ Q as C,
963
+ $ as E,
964
+ ct as _,
965
+ q as a,
966
+ K as b
967
+ };