@dialpad/dialtone 9.84.0 → 9.84.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/tokens/doc.json +11941 -11941
  2. package/dist/vue2/common/emoji.cjs +6 -0
  3. package/dist/vue2/common/emoji.cjs.map +1 -1
  4. package/dist/vue2/common/emoji.js +6 -0
  5. package/dist/vue2/common/emoji.js.map +1 -1
  6. package/dist/vue2/components/emoji_text_wrapper/emoji_text_wrapper.vue.cjs +7 -5
  7. package/dist/vue2/components/emoji_text_wrapper/emoji_text_wrapper.vue.cjs.map +1 -1
  8. package/dist/vue2/components/emoji_text_wrapper/emoji_text_wrapper.vue.js +8 -6
  9. package/dist/vue2/components/emoji_text_wrapper/emoji_text_wrapper.vue.js.map +1 -1
  10. package/dist/vue2/dialtone-vue.cjs +1 -0
  11. package/dist/vue2/dialtone-vue.cjs.map +1 -1
  12. package/dist/vue2/dialtone-vue.js +2 -1
  13. package/dist/vue2/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.cjs +2 -1
  14. package/dist/vue2/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.cjs.map +1 -1
  15. package/dist/vue2/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.js +2 -1
  16. package/dist/vue2/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.js.map +1 -1
  17. package/dist/vue2/style.css +9 -9
  18. package/dist/vue2/types/common/emoji/index.d.ts +1 -0
  19. package/dist/vue2/types/common/emoji/index.d.ts.map +1 -1
  20. package/dist/vue2/types/components/emoji_text_wrapper/emoji_text_wrapper.vue.d.ts.map +1 -1
  21. package/dist/vue3/common/emoji.cjs +6 -0
  22. package/dist/vue3/common/emoji.cjs.map +1 -1
  23. package/dist/vue3/common/emoji.js +6 -0
  24. package/dist/vue3/common/emoji.js.map +1 -1
  25. package/dist/vue3/components/emoji_text_wrapper/emoji_text_wrapper.vue.cjs +7 -5
  26. package/dist/vue3/components/emoji_text_wrapper/emoji_text_wrapper.vue.cjs.map +1 -1
  27. package/dist/vue3/components/emoji_text_wrapper/emoji_text_wrapper.vue.js +8 -6
  28. package/dist/vue3/components/emoji_text_wrapper/emoji_text_wrapper.vue.js.map +1 -1
  29. package/dist/vue3/dialtone-vue.cjs +1 -0
  30. package/dist/vue3/dialtone-vue.cjs.map +1 -1
  31. package/dist/vue3/dialtone-vue.js +2 -1
  32. package/dist/vue3/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.cjs +2 -1
  33. package/dist/vue3/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.cjs.map +1 -1
  34. package/dist/vue3/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.js +2 -1
  35. package/dist/vue3/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.js.map +1 -1
  36. package/dist/vue3/style.css +9 -9
  37. package/dist/vue3/types/common/emoji/index.d.ts +1 -0
  38. package/dist/vue3/types/common/emoji/index.d.ts.map +1 -1
  39. package/dist/vue3/types/components/emoji_text_wrapper/emoji_text_wrapper.vue.d.ts.map +1 -1
  40. package/package.json +3 -3
@@ -140,6 +140,11 @@ function filterValidShortCodes(shortcodes) {
140
140
  const filtered = shortcodes ? shortcodes.filter((code) => shortcodeToEmojiData(code)) : [];
141
141
  return new Set(filtered);
142
142
  }
143
+ function findEmojis(textContent) {
144
+ const matches = [...textContent.matchAll(emojiRegex)];
145
+ const emojis = matches.length ? matches.map((match) => match[0]) : [];
146
+ return new Set(emojis);
147
+ }
143
148
  exports.codeToEmojiData = codeToEmojiData;
144
149
  exports.defaultEmojiAssetUrl = defaultEmojiAssetUrl;
145
150
  exports.emojiJson = emojiJson;
@@ -147,6 +152,7 @@ exports.emojiRegex = emojiRegex;
147
152
  exports.emojiShortCodeRegex = emojiShortCodeRegex;
148
153
  exports.emojiVersion = emojiVersion;
149
154
  exports.filterValidShortCodes = filterValidShortCodes;
155
+ exports.findEmojis = findEmojis;
150
156
  exports.findShortCodes = findShortCodes;
151
157
  exports.getEmojiData = getEmojiData;
152
158
  exports.setCustomEmojiJson = setCustomEmojiJson;
@@ -1 +1 @@
1
- {"version":3,"file":"emoji.cjs","sources":["../../common/emoji/index.js"],"sourcesContent":["import { emojiPattern } from 'regex-combined-emojis';\nimport emojiJsonLocal from 'emoji-toolkit/emoji_strategy.json' with { type: 'json' };\n\nexport const emojiRegex = new RegExp(emojiPattern, 'g');\nexport const emojiVersion = '8.0';\nexport const defaultEmojiAssetUrl = 'https://cdn.jsdelivr.net/joypixels/assets/' + emojiVersion + '/png/unicode/32/';\nexport let customEmojiAssetUrl = null;\n\n// Used for emoji 16px and smaller\nexport let emojiImageUrlSmall = defaultEmojiAssetUrl;\nexport let emojiFileExtensionSmall = '.png';\n\n// Used for emoji larger than 16px\nexport let emojiImageUrlLarge = defaultEmojiAssetUrl;\nexport let emojiFileExtensionLarge = '.png';\n\nexport const emojiJson = emojiJsonLocal;\n\nexport const emojiShortCodeRegex = /(^| |(?<=:))(:\\w+:)/g;\n\nexport function getEmojiData () {\n return emojiJson;\n}\n\nexport function setEmojiAssetUrlSmall (url, fileExtension = '.png') {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n emojiImageUrlSmall = url;\n emojiFileExtensionSmall = fileExtension;\n}\n\nexport function setEmojiAssetUrlLarge (url, fileExtension = '.svg') {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n emojiImageUrlLarge = url;\n emojiFileExtensionLarge = fileExtension;\n}\n\nexport function setCustomEmojiUrl (url) {\n customEmojiAssetUrl = url;\n}\n\nexport function setCustomEmojiJson (json) {\n validateCustomEmojiJson(json);\n}\n\n/**\n * Validate custom emoji json\n */\nexport function validateCustomEmojiJson (json) {\n const customEmojiProps = ['extension', 'custom'];\n const customEmojiRequiredProps = [\n 'name',\n 'category',\n 'shortname',\n 'extension',\n 'custom',\n ];\n\n /**\n * Update single emoji properties.\n * If the property exists in emojiData, it'll add the values if the property is an array, otherwise will overwrite.\n * If not exists, will add the property to the emojiData object.\n */\n const _updateNativeEmojiData = (emojiData, propName, propValue) => {\n if (emojiData[propName] === undefined) {\n if (!customEmojiProps.includes(propName)) {\n return;\n }\n\n // new property to add\n emojiData[propName] = propValue;\n } else {\n if (Array.isArray(emojiData[propName])) {\n emojiData[propName] = emojiData[propName].concat(propValue);\n } else {\n emojiData[propName] = propValue;\n }\n }\n };\n\n Object.entries(json).forEach((item) => {\n const [customEmojiKey, customEmojiValue] = item;\n\n if (customEmojiKey in emojiJson) {\n // custom emoji exists in emoji json which means to update some data in the native emoji\n const emojiData = emojiJson[customEmojiKey];\n\n for (const customEmojiPropertyName in customEmojiValue) {\n const customEmojiPropertyValue = customEmojiValue[customEmojiPropertyName];\n\n _updateNativeEmojiData(emojiData, customEmojiPropertyName, customEmojiPropertyValue);\n }\n } else {\n // new custom emoji\n const _validateRequiredProps = () =>\n customEmojiRequiredProps.every((val) => {\n return customEmojiValue[val] !== undefined;\n });\n\n if (_validateRequiredProps()) {\n emojiJson[customEmojiKey] = customEmojiValue;\n } else {\n console.error(\n 'The following custom emoji doesn\\'t contain the required properties:',\n customEmojiValue,\n );\n }\n }\n });\n}\n\n// recursively searches the emoji data object containing data for all emojis\n// and returns the object with the specified shortcode.\nexport function shortcodeToEmojiData (shortcode) {\n // eslint-disable-next-line complexity\n function f (o, key) {\n if (!o || typeof o !== 'object') {\n return;\n }\n if ('shortname' in o) {\n if (o.shortname === shortcode || o.shortname_alternates.includes(shortcode)) {\n o.key = key;\n reference = o;\n return true;\n }\n }\n Object.keys(o).some(function (k) {\n return f(o[k], k);\n });\n }\n\n let reference;\n f(getEmojiData(), null);\n return reference;\n}\n\n// Takes in an emoji unicode character(s) and converts it to an emoji string in the format the emoji data object expects\n// as a key. There can be multiple unicode characters in an emoji to denote the emoji itself, skin tone, gender\n// and such. Note that this function does NOT return variation selectors (fe0f) or zero width joiners (200d), as these\n// are not included as part of the key in the emoji.json.\n//\n// Example:\n// return value for smile emoji (no skin tone): 1f600\n// return value for left facing fist (light skin tone): 1f91b-1f3fb\nexport function unicodeToString (emoji) {\n let key = '';\n for (const codePoint of emoji) {\n const codepoint = codePoint.codePointAt(0).toString(16).padStart(4, '0');\n\n // skip 200d and fe0f as these are not included in emoji_strategy.json keys\n if (['200d', 'fe0f'].includes(codepoint)) continue;\n if (key !== '') { key = key + '-'; }\n key = key + codepoint;\n }\n return key;\n}\n\n// Takes in unicode in string form ex: '1f91b-1f3fb' and converts it to an actual unicode character.\nexport function stringToUnicode (str) {\n const uChars = str.split('-');\n let result = '';\n uChars.forEach((uChar) => {\n result = result + String.fromCodePoint(parseInt(uChar, 16));\n });\n return result;\n}\n\n// Takes in a code (which could be unicode or shortcode) and returns the emoji data for it.\nexport function codeToEmojiData (code) {\n code = code?.trim();\n if (code.startsWith(':') && code.endsWith(':')) {\n return shortcodeToEmojiData(code);\n } else {\n const unicodeString = unicodeToString(code);\n const result = emojiJson[unicodeString];\n if (result) result.key = unicodeString;\n return result;\n }\n}\n\n// Finds every shortcode in slot text\n// filters only the existing codes in emojiJson\n// removes duplicates.\n// @returns {string[]}\nexport function findShortCodes (textContent) {\n const shortcodes = (\n textContent.match(emojiShortCodeRegex) || []\n ).map(code => code.trim());\n return filterValidShortCodes(shortcodes);\n}\n\nexport function filterValidShortCodes (shortcodes) {\n const filtered = shortcodes ? shortcodes.filter(code => shortcodeToEmojiData(code)) : [];\n return new Set(filtered);\n}\n"],"names":["emojiPattern","customEmojiAssetUrl","emojiImageUrlSmall","emojiFileExtensionSmall","emojiImageUrlLarge","emojiFileExtensionLarge"],"mappings":";;;;AAGY,MAAC,aAAa,IAAI,OAAOA,oBAAY,cAAE,GAAG;AAC1C,MAAC,eAAe;AAChB,MAAC,uBAAuB,+CAA+C,eAAe;AACvFC,QAAAA,sBAAsB;AAGtBC,QAAAA,qBAAqB;AACrBC,QAAAA,0BAA0B;AAG1BC,QAAAA,qBAAqB;AACrBC,QAAAA,0BAA0B;AAEzB,MAAC,YAAY;AAEb,MAAC,sBA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,OAAO,cAAc,SAAS,OAAO,EAAE,CAAC;AAAA,EAC9D,CAAG;AACD,SAAO;AACT;AAGO,SAAS,gBAAiB,MAAM;AACrC,SAAO,6BAAM;AACb,MAAI,KAAK,WAAW,GAAG,KAAK,KAAK,SAAS,GAAG,GAAG;AAC9C,WAAO,qBAAqB,IAAI;AAAA,EACpC,OAAS;AACL,UAAM,gBAAgB,gBAAgB,IAAI;AAC1C,UAAM,SAAS,UAAU,aAAa;AACtC,QAAI,OAAQ,QAAO,MAAM;AACzB,WAAO;AAAA,EACR;AACH;AAMO,SAAS,eAAgB,aAAa;AAC3C,QAAM,cACJ,YAAY,MAAM,mBAAmB,KAAK,CAAE,GAC5C,IAAI,UAAQ,KAAK,KAAM,CAAA;AACzB,SAAO,sBAAsB,UAAU;AACzC;AAEO,SAAS,sBAAuB,YAAY;AACjD,QAAM,WAAW,aAAa,WAAW,OAAO,UAAQ,qBAAqB,IAAI,CAAC,IAAI;AACtF,SAAO,IAAI,IAAI,QAAQ;AACzB;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"emoji.cjs","sources":["../../common/emoji/index.js"],"sourcesContent":["import { emojiPattern } from 'regex-combined-emojis';\nimport emojiJsonLocal from 'emoji-toolkit/emoji_strategy.json' with { type: 'json' };\n\nexport const emojiRegex = new RegExp(emojiPattern, 'g');\nexport const emojiVersion = '8.0';\nexport const defaultEmojiAssetUrl = 'https://cdn.jsdelivr.net/joypixels/assets/' + emojiVersion + '/png/unicode/32/';\nexport let customEmojiAssetUrl = null;\n\n// Used for emoji 16px and smaller\nexport let emojiImageUrlSmall = defaultEmojiAssetUrl;\nexport let emojiFileExtensionSmall = '.png';\n\n// Used for emoji larger than 16px\nexport let emojiImageUrlLarge = defaultEmojiAssetUrl;\nexport let emojiFileExtensionLarge = '.png';\n\nexport const emojiJson = emojiJsonLocal;\n\nexport const emojiShortCodeRegex = /(^| |(?<=:))(:\\w+:)/g;\n\nexport function getEmojiData () {\n return emojiJson;\n}\n\nexport function setEmojiAssetUrlSmall (url, fileExtension = '.png') {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n emojiImageUrlSmall = url;\n emojiFileExtensionSmall = fileExtension;\n}\n\nexport function setEmojiAssetUrlLarge (url, fileExtension = '.svg') {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n emojiImageUrlLarge = url;\n emojiFileExtensionLarge = fileExtension;\n}\n\nexport function setCustomEmojiUrl (url) {\n customEmojiAssetUrl = url;\n}\n\nexport function setCustomEmojiJson (json) {\n validateCustomEmojiJson(json);\n}\n\n/**\n * Validate custom emoji json\n */\nexport function validateCustomEmojiJson (json) {\n const customEmojiProps = ['extension', 'custom'];\n const customEmojiRequiredProps = [\n 'name',\n 'category',\n 'shortname',\n 'extension',\n 'custom',\n ];\n\n /**\n * Update single emoji properties.\n * If the property exists in emojiData, it'll add the values if the property is an array, otherwise will overwrite.\n * If not exists, will add the property to the emojiData object.\n */\n const _updateNativeEmojiData = (emojiData, propName, propValue) => {\n if (emojiData[propName] === undefined) {\n if (!customEmojiProps.includes(propName)) {\n return;\n }\n\n // new property to add\n emojiData[propName] = propValue;\n } else {\n if (Array.isArray(emojiData[propName])) {\n emojiData[propName] = emojiData[propName].concat(propValue);\n } else {\n emojiData[propName] = propValue;\n }\n }\n };\n\n Object.entries(json).forEach((item) => {\n const [customEmojiKey, customEmojiValue] = item;\n\n if (customEmojiKey in emojiJson) {\n // custom emoji exists in emoji json which means to update some data in the native emoji\n const emojiData = emojiJson[customEmojiKey];\n\n for (const customEmojiPropertyName in customEmojiValue) {\n const customEmojiPropertyValue = customEmojiValue[customEmojiPropertyName];\n\n _updateNativeEmojiData(emojiData, customEmojiPropertyName, customEmojiPropertyValue);\n }\n } else {\n // new custom emoji\n const _validateRequiredProps = () =>\n customEmojiRequiredProps.every((val) => {\n return customEmojiValue[val] !== undefined;\n });\n\n if (_validateRequiredProps()) {\n emojiJson[customEmojiKey] = customEmojiValue;\n } else {\n console.error(\n 'The following custom emoji doesn\\'t contain the required properties:',\n customEmojiValue,\n );\n }\n }\n });\n}\n\n// recursively searches the emoji data object containing data for all emojis\n// and returns the object with the specified shortcode.\nexport function shortcodeToEmojiData (shortcode) {\n // eslint-disable-next-line complexity\n function f (o, key) {\n if (!o || typeof o !== 'object') {\n return;\n }\n if ('shortname' in o) {\n if (o.shortname === shortcode || o.shortname_alternates.includes(shortcode)) {\n o.key = key;\n reference = o;\n return true;\n }\n }\n Object.keys(o).some(function (k) {\n return f(o[k], k);\n });\n }\n\n let reference;\n f(getEmojiData(), null);\n return reference;\n}\n\n// Takes in an emoji unicode character(s) and converts it to an emoji string in the format the emoji data object expects\n// as a key. There can be multiple unicode characters in an emoji to denote the emoji itself, skin tone, gender\n// and such. Note that this function does NOT return variation selectors (fe0f) or zero width joiners (200d), as these\n// are not included as part of the key in the emoji.json.\n//\n// Example:\n// return value for smile emoji (no skin tone): 1f600\n// return value for left facing fist (light skin tone): 1f91b-1f3fb\nexport function unicodeToString (emoji) {\n let key = '';\n for (const codePoint of emoji) {\n const codepoint = codePoint.codePointAt(0).toString(16).padStart(4, '0');\n\n // skip 200d and fe0f as these are not included in emoji_strategy.json keys\n if (['200d', 'fe0f'].includes(codepoint)) continue;\n if (key !== '') { key = key + '-'; }\n key = key + codepoint;\n }\n return key;\n}\n\n// Takes in unicode in string form ex: '1f91b-1f3fb' and converts it to an actual unicode character.\nexport function stringToUnicode (str) {\n const uChars = str.split('-');\n let result = '';\n uChars.forEach((uChar) => {\n result = result + String.fromCodePoint(parseInt(uChar, 16));\n });\n return result;\n}\n\n// Takes in a code (which could be unicode or shortcode) and returns the emoji data for it.\nexport function codeToEmojiData (code) {\n code = code?.trim();\n if (code.startsWith(':') && code.endsWith(':')) {\n return shortcodeToEmojiData(code);\n } else {\n const unicodeString = unicodeToString(code);\n const result = emojiJson[unicodeString];\n if (result) result.key = unicodeString;\n return result;\n }\n}\n\n// Finds every shortcode in slot text\n// filters only the existing codes in emojiJson\n// removes duplicates.\n// @returns {string[]}\nexport function findShortCodes (textContent) {\n const shortcodes = (\n textContent.match(emojiShortCodeRegex) || []\n ).map(code => code.trim());\n return filterValidShortCodes(shortcodes);\n}\n\nexport function filterValidShortCodes (shortcodes) {\n const filtered = shortcodes ? shortcodes.filter(code => shortcodeToEmojiData(code)) : [];\n return new Set(filtered);\n}\n\n// Finds every emoji in slot text\n// removes duplicates\n// @returns {string[]}\nexport function findEmojis (textContent) {\n const matches = [...textContent.matchAll(emojiRegex)];\n const emojis = matches.length ? matches.map(match => match[0]) : [];\n return new Set(emojis);\n}\n"],"names":["emojiPattern","customEmojiAssetUrl","emojiImageUrlSmall","emojiFileExtensionSmall","emojiImageUrlLarge","emojiFileExtensionLarge"],"mappings":";;;;AAGY,MAAC,aAAa,IAAI,OAAOA,oBAAY,cAAE,GAAG;AAC1C,MAAC,eAAe;AAChB,MAAC,uBAAuB,+CAA+C,eAAe;AACvFC,QAAAA,sBAAsB;AAGtBC,QAAAA,qBAAqB;AACrBC,QAAAA,0BAA0B;AAG1BC,QAAAA,qBAAqB;AACrBC,QAAAA,0BAA0B;AAEzB,MAAC,YAAY;AAEb,MAAC,sBAAsB,WAAuB,wBAAA,GAAA;AAEnD,SAAS,eAAgB;AAC9B,SAAO;AACT;AAEO,SAAS,sBAAuB,KAAK,gBAAgB,QAAQ;AAClE,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACtB,UAAM,MAAM;AAAA,EACb;AACDH,UAAAA,qBAAqB;AACrBC,UAAAA,0BAA0B;AAC5B;AAEO,SAAS,sBAAuB,KAAK,gBAAgB,QAAQ;AAClE,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACtB,UAAM,MAAM;AAAA,EACb;AACDC,UAAAA,qBAAqB;AACrBC,UAAAA,0BAA0B;AAC5B;AAEO,SAAS,kBAAmB,KAAK;AACtCJ,UAAAA,sBAAsB;AACxB;AAEO,SAAS,mBAAoB,MAAM;AACxC,0BAAwB,IAAI;AAC9B;AAKO,SAAS,wBAAyB,MAAM;A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,WAAW,aAAa,WAAW,OAAO,UAAQ,qBAAqB,IAAI,CAAC,IAAI;AACtF,SAAO,IAAI,IAAI,QAAQ;AACzB;AAKO,SAAS,WAAY,aAAa;AACvC,QAAM,UAAU,CAAC,GAAG,YAAY,SAAS,UAAU,CAAC;AACpD,QAAM,SAAS,QAAQ,SAAS,QAAQ,IAAI,WAAS,MAAM,CAAC,CAAC,IAAI;AACjE,SAAO,IAAI,IAAI,MAAM;AACvB;;;;;;;;;;;;;;;;;;;"}
@@ -138,6 +138,11 @@ function filterValidShortCodes(shortcodes) {
138
138
  const filtered = shortcodes ? shortcodes.filter((code) => shortcodeToEmojiData(code)) : [];
139
139
  return new Set(filtered);
140
140
  }
141
+ function findEmojis(textContent) {
142
+ const matches = [...textContent.matchAll(emojiRegex)];
143
+ const emojis = matches.length ? matches.map((match) => match[0]) : [];
144
+ return new Set(emojis);
145
+ }
141
146
  export {
142
147
  codeToEmojiData,
143
148
  customEmojiAssetUrl,
@@ -151,6 +156,7 @@ export {
151
156
  emojiShortCodeRegex,
152
157
  emojiVersion,
153
158
  filterValidShortCodes,
159
+ findEmojis,
154
160
  findShortCodes,
155
161
  getEmojiData,
156
162
  setCustomEmojiJson,
@@ -1 +1 @@
1
- {"version":3,"file":"emoji.js","sources":["../../common/emoji/index.js"],"sourcesContent":["import { emojiPattern } from 'regex-combined-emojis';\nimport emojiJsonLocal from 'emoji-toolkit/emoji_strategy.json' with { type: 'json' };\n\nexport const emojiRegex = new RegExp(emojiPattern, 'g');\nexport const emojiVersion = '8.0';\nexport const defaultEmojiAssetUrl = 'https://cdn.jsdelivr.net/joypixels/assets/' + emojiVersion + '/png/unicode/32/';\nexport let customEmojiAssetUrl = null;\n\n// Used for emoji 16px and smaller\nexport let emojiImageUrlSmall = defaultEmojiAssetUrl;\nexport let emojiFileExtensionSmall = '.png';\n\n// Used for emoji larger than 16px\nexport let emojiImageUrlLarge = defaultEmojiAssetUrl;\nexport let emojiFileExtensionLarge = '.png';\n\nexport const emojiJson = emojiJsonLocal;\n\nexport const emojiShortCodeRegex = /(^| |(?<=:))(:\\w+:)/g;\n\nexport function getEmojiData () {\n return emojiJson;\n}\n\nexport function setEmojiAssetUrlSmall (url, fileExtension = '.png') {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n emojiImageUrlSmall = url;\n emojiFileExtensionSmall = fileExtension;\n}\n\nexport function setEmojiAssetUrlLarge (url, fileExtension = '.svg') {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n emojiImageUrlLarge = url;\n emojiFileExtensionLarge = fileExtension;\n}\n\nexport function setCustomEmojiUrl (url) {\n customEmojiAssetUrl = url;\n}\n\nexport function setCustomEmojiJson (json) {\n validateCustomEmojiJson(json);\n}\n\n/**\n * Validate custom emoji json\n */\nexport function validateCustomEmojiJson (json) {\n const customEmojiProps = ['extension', 'custom'];\n const customEmojiRequiredProps = [\n 'name',\n 'category',\n 'shortname',\n 'extension',\n 'custom',\n ];\n\n /**\n * Update single emoji properties.\n * If the property exists in emojiData, it'll add the values if the property is an array, otherwise will overwrite.\n * If not exists, will add the property to the emojiData object.\n */\n const _updateNativeEmojiData = (emojiData, propName, propValue) => {\n if (emojiData[propName] === undefined) {\n if (!customEmojiProps.includes(propName)) {\n return;\n }\n\n // new property to add\n emojiData[propName] = propValue;\n } else {\n if (Array.isArray(emojiData[propName])) {\n emojiData[propName] = emojiData[propName].concat(propValue);\n } else {\n emojiData[propName] = propValue;\n }\n }\n };\n\n Object.entries(json).forEach((item) => {\n const [customEmojiKey, customEmojiValue] = item;\n\n if (customEmojiKey in emojiJson) {\n // custom emoji exists in emoji json which means to update some data in the native emoji\n const emojiData = emojiJson[customEmojiKey];\n\n for (const customEmojiPropertyName in customEmojiValue) {\n const customEmojiPropertyValue = customEmojiValue[customEmojiPropertyName];\n\n _updateNativeEmojiData(emojiData, customEmojiPropertyName, customEmojiPropertyValue);\n }\n } else {\n // new custom emoji\n const _validateRequiredProps = () =>\n customEmojiRequiredProps.every((val) => {\n return customEmojiValue[val] !== undefined;\n });\n\n if (_validateRequiredProps()) {\n emojiJson[customEmojiKey] = customEmojiValue;\n } else {\n console.error(\n 'The following custom emoji doesn\\'t contain the required properties:',\n customEmojiValue,\n );\n }\n }\n });\n}\n\n// recursively searches the emoji data object containing data for all emojis\n// and returns the object with the specified shortcode.\nexport function shortcodeToEmojiData (shortcode) {\n // eslint-disable-next-line complexity\n function f (o, key) {\n if (!o || typeof o !== 'object') {\n return;\n }\n if ('shortname' in o) {\n if (o.shortname === shortcode || o.shortname_alternates.includes(shortcode)) {\n o.key = key;\n reference = o;\n return true;\n }\n }\n Object.keys(o).some(function (k) {\n return f(o[k], k);\n });\n }\n\n let reference;\n f(getEmojiData(), null);\n return reference;\n}\n\n// Takes in an emoji unicode character(s) and converts it to an emoji string in the format the emoji data object expects\n// as a key. There can be multiple unicode characters in an emoji to denote the emoji itself, skin tone, gender\n// and such. Note that this function does NOT return variation selectors (fe0f) or zero width joiners (200d), as these\n// are not included as part of the key in the emoji.json.\n//\n// Example:\n// return value for smile emoji (no skin tone): 1f600\n// return value for left facing fist (light skin tone): 1f91b-1f3fb\nexport function unicodeToString (emoji) {\n let key = '';\n for (const codePoint of emoji) {\n const codepoint = codePoint.codePointAt(0).toString(16).padStart(4, '0');\n\n // skip 200d and fe0f as these are not included in emoji_strategy.json keys\n if (['200d', 'fe0f'].includes(codepoint)) continue;\n if (key !== '') { key = key + '-'; }\n key = key + codepoint;\n }\n return key;\n}\n\n// Takes in unicode in string form ex: '1f91b-1f3fb' and converts it to an actual unicode character.\nexport function stringToUnicode (str) {\n const uChars = str.split('-');\n let result = '';\n uChars.forEach((uChar) => {\n result = result + String.fromCodePoint(parseInt(uChar, 16));\n });\n return result;\n}\n\n// Takes in a code (which could be unicode or shortcode) and returns the emoji data for it.\nexport function codeToEmojiData (code) {\n code = code?.trim();\n if (code.startsWith(':') && code.endsWith(':')) {\n return shortcodeToEmojiData(code);\n } else {\n const unicodeString = unicodeToString(code);\n const result = emojiJson[unicodeString];\n if (result) result.key = unicodeString;\n return result;\n }\n}\n\n// Finds every shortcode in slot text\n// filters only the existing codes in emojiJson\n// removes duplicates.\n// @returns {string[]}\nexport function findShortCodes (textContent) {\n const shortcodes = (\n textContent.match(emojiShortCodeRegex) || []\n ).map(code => code.trim());\n return filterValidShortCodes(shortcodes);\n}\n\nexport function filterValidShortCodes (shortcodes) {\n const filtered = shortcodes ? shortcodes.filter(code => shortcodeToEmojiData(code)) : [];\n return new Set(filtered);\n}\n"],"names":[],"mappings":";;AAGY,MAAC,aAAa,IAAI,OAAO,cAAc,GAAG;AAC1C,MAAC,eAAe;AAChB,MAAC,uBAAuB,+CAA+C,eAAe;AACxF,IAAC,sBAAsB;AAGvB,IAAC,qBAAqB;AACtB,IAAC,0BAA0B;AAG3B,IAAC,qBAAqB;AACtB,IAAC,0BAA0B;AAEzB,MAAC,YAAY;AAEb,MAAC,sBAAsB,WAAuB,wBAAA,GAAA;AAEnD,SAAS,eAAgB;AAC9B,SAAO;AACT;AAEO,SAAS,sBAAuB,KAAK,gBAAgB,QAAQ;AAClE,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACtB,UAAM,MAAM;AAAA,EACb;AACD,uBAAqB;AACrB,4BAA0B;AAC5B;AAEO,SAAS,sBAAuB,KAAK,gBAAgB,QAAQ;AAClE,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACtB,UAAM,MAAM;AAAA,EACb;AACD,uBAAqB;AACrB,4BAA0B;AAC5B;AAEO,SAAS,kBAAmB,KAAK;AACtC,wBAAsB;AACxB;AAEO,SAAS,mBAAoB,MAAM;AACxC,0BAAwB,IAAI;AAC9B;AAKO,SAAS,wBAAyB,MAAM;AAC7C,QAAM,mBAAmB,CAAC,aAAa,QAAQ;AAC/C,QAAM,2BAA2B;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAOE,QAAM,yBAAyB,CAAC,WAAW,UAAU,cAAc;AACjE,QAAI,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AA,IACtB,CAAK;AAAA,EACF;AAED,MAAI;AACJ,IAAE,gBAAgB,IAAI;AACtB,SAAO;AACT;AAUO,SAAS,gBAAiB,OAAO;AACtC,MAAI,MAAM;AACV,aAAW,aAAa,OAAO;AAC7B,UAAM,YAAY,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAGvE,QAAI,CAAC,QAAQ,MAAM,EAAE,SAAS,SAAS,EAAG;AAC1C,QAAI,QAAQ,IAAI;AAAE,YAAM,MAAM;AAAA,IAAM;AACpC,UAAM,MAAM;AAAA,EACb;AACD,SAAO;AACT;AAGO,SAAS,gBAAiB,KAAK;AACpC,QAAM,SAAS,IAAI,MAAM,GAAG;AAC5B,MAAI,SAAS;AACb,SAAO,QAAQ,CAAC,UAAU;AACxB,aAAS,SAAS,OAAO,cAAc,SAAS,OAAO,EAAE,CAAC;AAAA,EAC9D,CAAG;AACD,SAAO;AACT;AAGO,SAAS,gBAAiB,MAAM;AACrC,SAAO,6BAAM;AACb,MAAI,KAAK,WAAW,GAAG,KAAK,KAAK,SAAS,GAAG,GAAG;AAC9C,WAAO,qBAAqB,IAAI;AAAA,EACpC,OAAS;AACL,UAAM,gBAAgB,gBAAgB,IAAI;AAC1C,UAAM,SAAS,UAAU,aAAa;AACtC,QAAI,OAAQ,QAAO,MAAM;AACzB,WAAO;AAAA,EACR;AACH;AAMO,SAAS,eAAgB,aAAa;AAC3C,QAAM,cACJ,YAAY,MAAM,mBAAmB,KAAK,CAAE,GAC5C,IAAI,UAAQ,KAAK,KAAM,CAAA;AACzB,SAAO,sBAAsB,UAAU;AACzC;AAEO,SAAS,sBAAuB,YAAY;AACjD,QAAM,WAAW,aAAa,WAAW,OAAO,UAAQ,qBAAqB,IAAI,CAAC,IAAI;AACtF,SAAO,IAAI,IAAI,QAAQ;AACzB;"}
1
+ {"version":3,"file":"emoji.js","sources":["../../common/emoji/index.js"],"sourcesContent":["import { emojiPattern } from 'regex-combined-emojis';\nimport emojiJsonLocal from 'emoji-toolkit/emoji_strategy.json' with { type: 'json' };\n\nexport const emojiRegex = new RegExp(emojiPattern, 'g');\nexport const emojiVersion = '8.0';\nexport const defaultEmojiAssetUrl = 'https://cdn.jsdelivr.net/joypixels/assets/' + emojiVersion + '/png/unicode/32/';\nexport let customEmojiAssetUrl = null;\n\n// Used for emoji 16px and smaller\nexport let emojiImageUrlSmall = defaultEmojiAssetUrl;\nexport let emojiFileExtensionSmall = '.png';\n\n// Used for emoji larger than 16px\nexport let emojiImageUrlLarge = defaultEmojiAssetUrl;\nexport let emojiFileExtensionLarge = '.png';\n\nexport const emojiJson = emojiJsonLocal;\n\nexport const emojiShortCodeRegex = /(^| |(?<=:))(:\\w+:)/g;\n\nexport function getEmojiData () {\n return emojiJson;\n}\n\nexport function setEmojiAssetUrlSmall (url, fileExtension = '.png') {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n emojiImageUrlSmall = url;\n emojiFileExtensionSmall = fileExtension;\n}\n\nexport function setEmojiAssetUrlLarge (url, fileExtension = '.svg') {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n emojiImageUrlLarge = url;\n emojiFileExtensionLarge = fileExtension;\n}\n\nexport function setCustomEmojiUrl (url) {\n customEmojiAssetUrl = url;\n}\n\nexport function setCustomEmojiJson (json) {\n validateCustomEmojiJson(json);\n}\n\n/**\n * Validate custom emoji json\n */\nexport function validateCustomEmojiJson (json) {\n const customEmojiProps = ['extension', 'custom'];\n const customEmojiRequiredProps = [\n 'name',\n 'category',\n 'shortname',\n 'extension',\n 'custom',\n ];\n\n /**\n * Update single emoji properties.\n * If the property exists in emojiData, it'll add the values if the property is an array, otherwise will overwrite.\n * If not exists, will add the property to the emojiData object.\n */\n const _updateNativeEmojiData = (emojiData, propName, propValue) => {\n if (emojiData[propName] === undefined) {\n if (!customEmojiProps.includes(propName)) {\n return;\n }\n\n // new property to add\n emojiData[propName] = propValue;\n } else {\n if (Array.isArray(emojiData[propName])) {\n emojiData[propName] = emojiData[propName].concat(propValue);\n } else {\n emojiData[propName] = propValue;\n }\n }\n };\n\n Object.entries(json).forEach((item) => {\n const [customEmojiKey, customEmojiValue] = item;\n\n if (customEmojiKey in emojiJson) {\n // custom emoji exists in emoji json which means to update some data in the native emoji\n const emojiData = emojiJson[customEmojiKey];\n\n for (const customEmojiPropertyName in customEmojiValue) {\n const customEmojiPropertyValue = customEmojiValue[customEmojiPropertyName];\n\n _updateNativeEmojiData(emojiData, customEmojiPropertyName, customEmojiPropertyValue);\n }\n } else {\n // new custom emoji\n const _validateRequiredProps = () =>\n customEmojiRequiredProps.every((val) => {\n return customEmojiValue[val] !== undefined;\n });\n\n if (_validateRequiredProps()) {\n emojiJson[customEmojiKey] = customEmojiValue;\n } else {\n console.error(\n 'The following custom emoji doesn\\'t contain the required properties:',\n customEmojiValue,\n );\n }\n }\n });\n}\n\n// recursively searches the emoji data object containing data for all emojis\n// and returns the object with the specified shortcode.\nexport function shortcodeToEmojiData (shortcode) {\n // eslint-disable-next-line complexity\n function f (o, key) {\n if (!o || typeof o !== 'object') {\n return;\n }\n if ('shortname' in o) {\n if (o.shortname === shortcode || o.shortname_alternates.includes(shortcode)) {\n o.key = key;\n reference = o;\n return true;\n }\n }\n Object.keys(o).some(function (k) {\n return f(o[k], k);\n });\n }\n\n let reference;\n f(getEmojiData(), null);\n return reference;\n}\n\n// Takes in an emoji unicode character(s) and converts it to an emoji string in the format the emoji data object expects\n// as a key. There can be multiple unicode characters in an emoji to denote the emoji itself, skin tone, gender\n// and such. Note that this function does NOT return variation selectors (fe0f) or zero width joiners (200d), as these\n// are not included as part of the key in the emoji.json.\n//\n// Example:\n// return value for smile emoji (no skin tone): 1f600\n// return value for left facing fist (light skin tone): 1f91b-1f3fb\nexport function unicodeToString (emoji) {\n let key = '';\n for (const codePoint of emoji) {\n const codepoint = codePoint.codePointAt(0).toString(16).padStart(4, '0');\n\n // skip 200d and fe0f as these are not included in emoji_strategy.json keys\n if (['200d', 'fe0f'].includes(codepoint)) continue;\n if (key !== '') { key = key + '-'; }\n key = key + codepoint;\n }\n return key;\n}\n\n// Takes in unicode in string form ex: '1f91b-1f3fb' and converts it to an actual unicode character.\nexport function stringToUnicode (str) {\n const uChars = str.split('-');\n let result = '';\n uChars.forEach((uChar) => {\n result = result + String.fromCodePoint(parseInt(uChar, 16));\n });\n return result;\n}\n\n// Takes in a code (which could be unicode or shortcode) and returns the emoji data for it.\nexport function codeToEmojiData (code) {\n code = code?.trim();\n if (code.startsWith(':') && code.endsWith(':')) {\n return shortcodeToEmojiData(code);\n } else {\n const unicodeString = unicodeToString(code);\n const result = emojiJson[unicodeString];\n if (result) result.key = unicodeString;\n return result;\n }\n}\n\n// Finds every shortcode in slot text\n// filters only the existing codes in emojiJson\n// removes duplicates.\n// @returns {string[]}\nexport function findShortCodes (textContent) {\n const shortcodes = (\n textContent.match(emojiShortCodeRegex) || []\n ).map(code => code.trim());\n return filterValidShortCodes(shortcodes);\n}\n\nexport function filterValidShortCodes (shortcodes) {\n const filtered = shortcodes ? shortcodes.filter(code => shortcodeToEmojiData(code)) : [];\n return new Set(filtered);\n}\n\n// Finds every emoji in slot text\n// removes duplicates\n// @returns {string[]}\nexport function findEmojis (textContent) {\n const matches = [...textContent.matchAll(emojiRegex)];\n const emojis = matches.length ? matches.map(match => match[0]) : [];\n return new Set(emojis);\n}\n"],"names":[],"mappings":";;AAGY,MAAC,aAAa,IAAI,OAAO,cAAc,GAAG;AAC1C,MAAC,eAAe;AAChB,MAAC,uBAAuB,+CAA+C,eAAe;AACxF,IAAC,sBAAsB;AAGvB,IAAC,qBAAqB;AACtB,IAAC,0BAA0B;AAG3B,IAAC,qBAAqB;AACtB,IAAC,0BAA0B;AAEzB,MAAC,YAAY;AAEb,MAAC,sBAAsB,WAAuB,wBAAA,GAAA;AAEnD,SAAS,eAAgB;AAC9B,SAAO;AACT;AAEO,SAAS,sBAAuB,KAAK,gBAAgB,QAAQ;AAClE,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG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qBAAqB,IAAI;AAAA,EACpC,OAAS;AACL,UAAM,gBAAgB,gBAAgB,IAAI;AAC1C,UAAM,SAAS,UAAU,aAAa;AACtC,QAAI,OAAQ,QAAO,MAAM;AACzB,WAAO;AAAA,EACR;AACH;AAMO,SAAS,eAAgB,aAAa;AAC3C,QAAM,cACJ,YAAY,MAAM,mBAAmB,KAAK,CAAE,GAC5C,IAAI,UAAQ,KAAK,KAAM,CAAA;AACzB,SAAO,sBAAsB,UAAU;AACzC;AAEO,SAAS,sBAAuB,YAAY;AACjD,QAAM,WAAW,aAAa,WAAW,OAAO,UAAQ,qBAAqB,IAAI,CAAC,IAAI;AACtF,SAAO,IAAI,IAAI,QAAQ;AACzB;AAKO,SAAS,WAAY,aAAa;AACvC,QAAM,UAAU,CAAC,GAAG,YAAY,SAAS,UAAU,CAAC;AACpD,QAAM,SAAS,QAAQ,SAAS,QAAQ,IAAI,WAAS,MAAM,CAAC,CAAC,IAAI;AACjE,SAAO,IAAI,IAAI,MAAM;AACvB;"}
@@ -2,7 +2,6 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const common_emoji = require("../../common/emoji.cjs");
4
4
  const icon_constants = require("../icon/icon_constants.cjs");
5
- const regexCombinedEmojis = require("regex-combined-emojis");
6
5
  const _pluginVue2_normalizer = require("../../_virtual/_plugin-vue2_normalizer.cjs");
7
6
  const emoji = require("../emoji/emoji.vue.cjs");
8
7
  const _sfc_main = {
@@ -42,11 +41,13 @@ const _sfc_main = {
42
41
  */
43
42
  replaceDtEmojis(replaceList, textContent) {
44
43
  if (!replaceList.length) return textContent;
45
- const regexp = new RegExp(`(${replaceList.join("|")})`, "g");
44
+ const escapedReplaceList = replaceList.map(
45
+ (item) => item.replace(/\*/g, "\\*")
46
+ );
47
+ const regexp = new RegExp(`(${escapedReplaceList.join("|")})`, "g");
46
48
  const items = textContent.split(regexp);
47
49
  return items.filter((item) => item.trim() !== "").map((item) => {
48
- regexp.lastIndex = 0;
49
- if (replaceList.includes(item) || regexp.test(item)) {
50
+ if (replaceList.includes(item)) {
50
51
  return this.$createElement(emoji.default, {
51
52
  props: { code: item, size: this.size }
52
53
  });
@@ -76,7 +77,8 @@ const _sfc_main = {
76
77
  */
77
78
  searchCodes(textContent) {
78
79
  const shortcodes = common_emoji.findShortCodes(textContent);
79
- const replaceList = [...shortcodes, regexCombinedEmojis.emojiPattern];
80
+ const emojis = common_emoji.findEmojis(textContent);
81
+ const replaceList = [...shortcodes, ...emojis];
80
82
  return this.replaceDtEmojis(replaceList, textContent);
81
83
  }
82
84
  },
@@ -1 +1 @@
1
- {"version":3,"file":"emoji_text_wrapper.vue.cjs","sources":["../../../components/emoji_text_wrapper/emoji_text_wrapper.vue"],"sourcesContent":["<script>\nimport { DtEmoji } from '../emoji';\nimport { findShortCodes } from '@/common/emoji';\nimport { ICON_SIZE_MODIFIERS } from '@/components/icon/icon_constants';\nimport { emojiPattern } from 'regex-combined-emojis';\n\n/**\n * Wrapper to find and replace shortcodes like :smile: or unicode chars such as 😄 with our custom Emojis implementation.\n * @see https://dialtone.dialpad.com/components/emoji_text_wrapper.html\n */\nexport default {\n name: 'DtEmojiTextWrapper',\n\n components: {\n DtEmoji,\n },\n\n props: {\n /**\n * Element type (tag name) to use for the wrapper.\n */\n elementType: {\n type: String,\n default: 'div',\n },\n\n /**\n * The icon size to render the emojis at: 100 to 800\n */\n size: {\n type: String,\n default: '500',\n validator: (t) => Object.keys(ICON_SIZE_MODIFIERS).includes(t),\n },\n },\n\n data () {\n return {\n loadingEmojiJson: true,\n };\n },\n\n async created () {\n this.loadingEmojiJson = false;\n },\n\n methods: {\n /**\n * Replaces the valid codes from the text content with a DtEmoji component.\n * @returns {Array<VNode|string>}\n */\n replaceDtEmojis (replaceList, textContent) {\n if (!replaceList.length) return textContent;\n\n const regexp = new RegExp(`(${replaceList.join('|')})`, 'g');\n const items = textContent.split(regexp);\n\n return items\n .filter(item => item.trim() !== '')\n .map((item) => {\n // Reset the regexp index to 0 to start from the beginning\n // Otherwise, it will start from the last index\n regexp.lastIndex = 0;\n if (replaceList.includes(item) || regexp.test(item)) {\n return this.$createElement(DtEmoji, {\n props: { code: item, size: this.size },\n });\n }\n return this.$createElement('span', { class: 'd-emoji-text-wrapper__text' }, item);\n });\n },\n\n /**\n * Recursively search the Vue virtual DOM to find text\n * @param VNode\n * @returns {VNode|*}\n */\n searchVNodes (VNode) {\n // If VNode has no tag, it is a text node\n if (!VNode.tag && VNode.text) {\n return this.searchCodes(VNode.text);\n }\n\n const children = VNode.children ? VNode.children.map(VNodeChild => this.searchVNodes(VNodeChild)) : [];\n return this.$createElement(VNode.tag, VNode.data, children);\n },\n\n // TODO: Find a way to crawl vue components\n replaceVueComponentVNodeContent (VNode) {\n //\n },\n\n /**\n * Find codes in text.\n * @param textContent string\n * @returns {Array<VNode|string>|string}\n */\n searchCodes (textContent) {\n const shortcodes = findShortCodes(textContent);\n const replaceList = [...shortcodes, emojiPattern];\n return this.replaceDtEmojis(replaceList, textContent);\n },\n },\n\n render (h) {\n const defaultSlotContent = this.$slots.default || [];\n return h(\n this.elementType,\n {\n 'data-qa': 'emoji-text-wrapper',\n class: 'd-emoji-text-wrapper',\n },\n this.loadingEmojiJson\n ? defaultSlotContent\n : defaultSlotContent.map(VNode => this.searchVNodes(VNode)),\n );\n },\n};\n</script>\n"],"names":["DtEmoji","ICON_SIZE_MODIFIERS","findShortCodes","emojiPattern"],"mappings":";;;;;;;AAUA,MAAA,YAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,SAAAA,MAAA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA,CAAA,MAAA,OAAA,KAAAC,kCAAA,EAAA,SAAA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AA,IACA;AAAA,EACA;AAAA,EAEA,OAAA,GAAA;AACA,UAAA,qBAAA,KAAA,OAAA,WAAA,CAAA;AACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,QACA,WAAA;AAAA,QACA,OAAA;AAAA,MACA;AAAA,MACA,KAAA,mBACA,qBACA,mBAAA,IAAA,WAAA,KAAA,aAAA,KAAA,CAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"emoji_text_wrapper.vue.cjs","sources":["../../../components/emoji_text_wrapper/emoji_text_wrapper.vue"],"sourcesContent":["<script>\nimport { DtEmoji } from '../emoji';\nimport { findEmojis, findShortCodes } from '@/common/emoji';\nimport { ICON_SIZE_MODIFIERS } from '@/components/icon/icon_constants';\n\n/**\n * Wrapper to find and replace shortcodes like :smile: or unicode chars such as 😄 with our custom Emojis implementation.\n * @see https://dialtone.dialpad.com/components/emoji_text_wrapper.html\n */\nexport default {\n name: 'DtEmojiTextWrapper',\n\n components: {\n DtEmoji,\n },\n\n props: {\n /**\n * Element type (tag name) to use for the wrapper.\n */\n elementType: {\n type: String,\n default: 'div',\n },\n\n /**\n * The icon size to render the emojis at: 100 to 800\n */\n size: {\n type: String,\n default: '500',\n validator: (t) => Object.keys(ICON_SIZE_MODIFIERS).includes(t),\n },\n },\n\n data () {\n return {\n loadingEmojiJson: true,\n };\n },\n\n async created () {\n this.loadingEmojiJson = false;\n },\n\n methods: {\n /**\n * Replaces the valid codes from the text content with a DtEmoji component.\n * @returns {Array<VNode|string>}\n */\n replaceDtEmojis (replaceList, textContent) {\n if (!replaceList.length) return textContent;\n // Escape the asterisk to avoid breaking the regex for the asterisk emoji\n const escapedReplaceList = replaceList.map(item =>\n item.replace(/\\*/g, '\\\\*'),\n );\n\n const regexp = new RegExp(`(${escapedReplaceList.join('|')})`, 'g');\n const items = textContent.split(regexp);\n\n return items\n .filter(item => item.trim() !== '')\n .map((item) => {\n if (replaceList.includes(item)) {\n return this.$createElement(DtEmoji, {\n props: { code: item, size: this.size },\n });\n }\n return this.$createElement('span', { class: 'd-emoji-text-wrapper__text' }, item);\n });\n },\n\n /**\n * Recursively search the Vue virtual DOM to find text\n * @param VNode\n * @returns {VNode|*}\n */\n searchVNodes (VNode) {\n // If VNode has no tag, it is a text node\n if (!VNode.tag && VNode.text) {\n return this.searchCodes(VNode.text);\n }\n\n const children = VNode.children ? VNode.children.map(VNodeChild => this.searchVNodes(VNodeChild)) : [];\n return this.$createElement(VNode.tag, VNode.data, children);\n },\n\n // TODO: Find a way to crawl vue components\n replaceVueComponentVNodeContent (VNode) {\n //\n },\n\n /**\n * Find codes in text.\n * @param textContent string\n * @returns {Array<VNode|string>|string}\n */\n searchCodes (textContent) {\n const shortcodes = findShortCodes(textContent);\n const emojis = findEmojis(textContent);\n\n const replaceList = [...shortcodes, ...emojis];\n return this.replaceDtEmojis(replaceList, textContent);\n },\n },\n\n render (h) {\n const defaultSlotContent = this.$slots.default || [];\n return h(\n this.elementType,\n {\n 'data-qa': 'emoji-text-wrapper',\n class: 'd-emoji-text-wrapper',\n },\n this.loadingEmojiJson\n ? defaultSlotContent\n : defaultSlotContent.map(VNode => this.searchVNodes(VNode)),\n );\n },\n};\n</script>\n"],"names":["DtEmoji","ICON_SIZE_MODIFIERS","findShortCodes","findEmojis"],"mappings":";;;;;;AASA,MAAA,YAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,SAAAA,MAAA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA,CAAA,MAAA,OAAA,KAAAC,kCAAA,EAAA,SAAA,CAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,kBAAA;AAAA,IACA;AA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A,EAEA,OAAA,GAAA;AACA,UAAA,qBAAA,KAAA,OAAA,WAAA,CAAA;AACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,QACA,WAAA;AAAA,QACA,OAAA;AAAA,MACA;AAAA,MACA,KAAA,mBACA,qBACA,mBAAA,IAAA,WAAA,KAAA,aAAA,KAAA,CAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;"}
@@ -1,6 +1,5 @@
1
- import { findShortCodes } from "../../common/emoji.js";
1
+ import { findShortCodes, findEmojis } from "../../common/emoji.js";
2
2
  import { ICON_SIZE_MODIFIERS } from "../icon/icon_constants.js";
3
- import { emojiPattern } from "regex-combined-emojis";
4
3
  import normalizeComponent from "../../_virtual/_plugin-vue2_normalizer.js";
5
4
  import DtEmoji from "../emoji/emoji.vue.js";
6
5
  const _sfc_main = {
@@ -40,11 +39,13 @@ const _sfc_main = {
40
39
  */
41
40
  replaceDtEmojis(replaceList, textContent) {
42
41
  if (!replaceList.length) return textContent;
43
- const regexp = new RegExp(`(${replaceList.join("|")})`, "g");
42
+ const escapedReplaceList = replaceList.map(
43
+ (item) => item.replace(/\*/g, "\\*")
44
+ );
45
+ const regexp = new RegExp(`(${escapedReplaceList.join("|")})`, "g");
44
46
  const items = textContent.split(regexp);
45
47
  return items.filter((item) => item.trim() !== "").map((item) => {
46
- regexp.lastIndex = 0;
47
- if (replaceList.includes(item) || regexp.test(item)) {
48
+ if (replaceList.includes(item)) {
48
49
  return this.$createElement(DtEmoji, {
49
50
  props: { code: item, size: this.size }
50
51
  });
@@ -74,7 +75,8 @@ const _sfc_main = {
74
75
  */
75
76
  searchCodes(textContent) {
76
77
  const shortcodes = findShortCodes(textContent);
77
- const replaceList = [...shortcodes, emojiPattern];
78
+ const emojis = findEmojis(textContent);
79
+ const replaceList = [...shortcodes, ...emojis];
78
80
  return this.replaceDtEmojis(replaceList, textContent);
79
81
  }
80
82
  },
@@ -1 +1 @@
1
- {"version":3,"file":"emoji_text_wrapper.vue.js","sources":["../../../components/emoji_text_wrapper/emoji_text_wrapper.vue"],"sourcesContent":["<script>\nimport { DtEmoji } from '../emoji';\nimport { findShortCodes } from '@/common/emoji';\nimport { ICON_SIZE_MODIFIERS } from '@/components/icon/icon_constants';\nimport { emojiPattern } from 'regex-combined-emojis';\n\n/**\n * Wrapper to find and replace shortcodes like :smile: or unicode chars such as 😄 with our custom Emojis implementation.\n * @see https://dialtone.dialpad.com/components/emoji_text_wrapper.html\n */\nexport default {\n name: 'DtEmojiTextWrapper',\n\n components: {\n DtEmoji,\n },\n\n props: {\n /**\n * Element type (tag name) to use for the wrapper.\n */\n elementType: {\n type: String,\n default: 'div',\n },\n\n /**\n * The icon size to render the emojis at: 100 to 800\n */\n size: {\n type: String,\n default: '500',\n validator: (t) => Object.keys(ICON_SIZE_MODIFIERS).includes(t),\n },\n },\n\n data () {\n return {\n loadingEmojiJson: true,\n };\n },\n\n async created () {\n this.loadingEmojiJson = false;\n },\n\n methods: {\n /**\n * Replaces the valid codes from the text content with a DtEmoji component.\n * @returns {Array<VNode|string>}\n */\n replaceDtEmojis (replaceList, textContent) {\n if (!replaceList.length) return textContent;\n\n const regexp = new RegExp(`(${replaceList.join('|')})`, 'g');\n const items = textContent.split(regexp);\n\n return items\n .filter(item => item.trim() !== '')\n .map((item) => {\n // Reset the regexp index to 0 to start from the beginning\n // Otherwise, it will start from the last index\n regexp.lastIndex = 0;\n if (replaceList.includes(item) || regexp.test(item)) {\n return this.$createElement(DtEmoji, {\n props: { code: item, size: this.size },\n });\n }\n return this.$createElement('span', { class: 'd-emoji-text-wrapper__text' }, item);\n });\n },\n\n /**\n * Recursively search the Vue virtual DOM to find text\n * @param VNode\n * @returns {VNode|*}\n */\n searchVNodes (VNode) {\n // If VNode has no tag, it is a text node\n if (!VNode.tag && VNode.text) {\n return this.searchCodes(VNode.text);\n }\n\n const children = VNode.children ? VNode.children.map(VNodeChild => this.searchVNodes(VNodeChild)) : [];\n return this.$createElement(VNode.tag, VNode.data, children);\n },\n\n // TODO: Find a way to crawl vue components\n replaceVueComponentVNodeContent (VNode) {\n //\n },\n\n /**\n * Find codes in text.\n * @param textContent string\n * @returns {Array<VNode|string>|string}\n */\n searchCodes (textContent) {\n const shortcodes = findShortCodes(textContent);\n const replaceList = [...shortcodes, emojiPattern];\n return this.replaceDtEmojis(replaceList, textContent);\n },\n },\n\n render (h) {\n const defaultSlotContent = this.$slots.default || [];\n return h(\n this.elementType,\n {\n 'data-qa': 'emoji-text-wrapper',\n class: 'd-emoji-text-wrapper',\n },\n this.loadingEmojiJson\n ? defaultSlotContent\n : defaultSlotContent.map(VNode => this.searchVNodes(VNode)),\n );\n },\n};\n</script>\n"],"names":[],"mappings":";;;;;AAUA,MAAA,YAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA,CAAA,MAAA,OAAA,KAAA,mBAAA,EAAA,SAAA,CAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,kBAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,MAAA,UAAA;AACA,SAAA,mBAAA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,gBAAA,aAAA,aAAA;AACA,UAAA,CAAA,YAAA,OAAA,QAAA;AAEA,YAAA,SAAA,IAAA,OAAA,IAAA,YAAA,KAAA,GAAA,CAAA,KAAA,GAAA;AACA,YAAA,QAAA,YAAA,MAAA,MAAA;AAEA,aAAA,MACA,OAAA,UAAA,KAAA,KAAA,MAAA,EAAA,EACA,IAAA,CAAA,SAAA;AAGA,eAAA,YAAA;AACA,YAAA,YAAA,SAAA,IAAA,KAAA,OAAA,KAAA,IAAA,GAAA;AACA,iBAAA,KAAA,eAAA,SAAA;AAAA,YACA,OAAA,EAAA,MAAA,MAAA,MAAA,KAAA,KAAA;AAAA,UACA,CAAA;AAAA,QACA;AACA,eAAA,KAAA,eAAA,QAAA,EAAA,OAAA,6BAAA,GAAA,IAAA;AAAA,MACA,CAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,aAAA,OAAA;AAEA,UAAA,CAAA,MAAA,OAAA,MAAA,MAAA;AACA,eAAA,KAAA,YAAA,MAAA,IAAA;AAAA,MACA;AAEA,YAAA,WAAA,MAAA,WAAA,MAAA,SAAA,IAAA,gBAAA,KAAA,aAAA,UAAA,CAAA,IAAA,CAAA;AACA,aAAA,KAAA,eAAA,MAAA,KAAA,MAAA,MAAA,QAAA;AAAA,IACA;AAAA;AAAA,IAGA,gCAAA,OAAA;AAAA,IAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,YAAA,aAAA;AACA,YAAA,aAAA,eAAA,WAAA;AACA,YAAA,cAAA,CAAA,GAAA,YAAA,YAAA;AACA,aAAA,KAAA,gBAAA,aAAA,WAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA,GAAA;AACA,UAAA,qBAAA,KAAA,OAAA,WAAA,CAAA;AACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,QACA,WAAA;AAAA,QACA,OAAA;AAAA,MACA;AAAA,MACA,KAAA,mBACA,qBACA,mBAAA,IAAA,WAAA,KAAA,aAAA,KAAA,CAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;"}
1
+ {"version":3,"file":"emoji_text_wrapper.vue.js","sources":["../../../components/emoji_text_wrapper/emoji_text_wrapper.vue"],"sourcesContent":["<script>\nimport { DtEmoji } from '../emoji';\nimport { findEmojis, findShortCodes } from '@/common/emoji';\nimport { ICON_SIZE_MODIFIERS } from '@/components/icon/icon_constants';\n\n/**\n * Wrapper to find and replace shortcodes like :smile: or unicode chars such as 😄 with our custom Emojis implementation.\n * @see https://dialtone.dialpad.com/components/emoji_text_wrapper.html\n */\nexport default {\n name: 'DtEmojiTextWrapper',\n\n components: {\n DtEmoji,\n },\n\n props: {\n /**\n * Element type (tag name) to use for the wrapper.\n */\n elementType: {\n type: String,\n default: 'div',\n },\n\n /**\n * The icon size to render the emojis at: 100 to 800\n */\n size: {\n type: String,\n default: '500',\n validator: (t) => Object.keys(ICON_SIZE_MODIFIERS).includes(t),\n },\n },\n\n data () {\n return {\n loadingEmojiJson: true,\n };\n },\n\n async created () {\n this.loadingEmojiJson = false;\n },\n\n methods: {\n /**\n * Replaces the valid codes from the text content with a DtEmoji component.\n * @returns {Array<VNode|string>}\n */\n replaceDtEmojis (replaceList, textContent) {\n if (!replaceList.length) return textContent;\n // Escape the asterisk to avoid breaking the regex for the asterisk emoji\n const escapedReplaceList = replaceList.map(item =>\n item.replace(/\\*/g, '\\\\*'),\n );\n\n const regexp = new RegExp(`(${escapedReplaceList.join('|')})`, 'g');\n const items = textContent.split(regexp);\n\n return items\n .filter(item => item.trim() !== '')\n .map((item) => {\n if (replaceList.includes(item)) {\n return this.$createElement(DtEmoji, {\n props: { code: item, size: this.size },\n });\n }\n return this.$createElement('span', { class: 'd-emoji-text-wrapper__text' }, item);\n });\n },\n\n /**\n * Recursively search the Vue virtual DOM to find text\n * @param VNode\n * @returns {VNode|*}\n */\n searchVNodes (VNode) {\n // If VNode has no tag, it is a text node\n if (!VNode.tag && VNode.text) {\n return this.searchCodes(VNode.text);\n }\n\n const children = VNode.children ? VNode.children.map(VNodeChild => this.searchVNodes(VNodeChild)) : [];\n return this.$createElement(VNode.tag, VNode.data, children);\n },\n\n // TODO: Find a way to crawl vue components\n replaceVueComponentVNodeContent (VNode) {\n //\n },\n\n /**\n * Find codes in text.\n * @param textContent string\n * @returns {Array<VNode|string>|string}\n */\n searchCodes (textContent) {\n const shortcodes = findShortCodes(textContent);\n const emojis = findEmojis(textContent);\n\n const replaceList = [...shortcodes, ...emojis];\n return this.replaceDtEmojis(replaceList, textContent);\n },\n },\n\n render (h) {\n const defaultSlotContent = this.$slots.default || [];\n return h(\n this.elementType,\n {\n 'data-qa': 'emoji-text-wrapper',\n class: 'd-emoji-text-wrapper',\n },\n this.loadingEmojiJson\n ? defaultSlotContent\n : defaultSlotContent.map(VNode => this.searchVNodes(VNode)),\n );\n },\n};\n</script>\n"],"names":[],"mappings":";;;;AASA,MAAA,YAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA,CAAA,MAAA,OAAA,KAAA,mBAAA,EAAA,SAAA,CAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,kBAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,MAAA,UAAA;AACA,SAAA,mBAAA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,gBAAA,aAAA,aAAA;AACA,UAAA,CAAA,YAAA,OAAA,QAAA;AAEA,YAAA,qBAAA,YAAA;AAAA,QAAA,UACA,KAAA,QAAA,OAAA,KAAA;AAAA,MACA;AAEA,YAAA,SAAA,IAAA,OAAA,IAAA,mBAAA,KAAA,GAAA,CAAA,KAAA,GAAA;AACA,YAAA,QAAA,YAAA,MAAA,MAAA;AAEA,aAAA,MACA,OAAA,UAAA,KAAA,KAAA,MAAA,EAAA,EACA,IAAA,CAAA,SAAA;AACA,YAAA,YAAA,SAAA,IAAA,GAAA;AACA,iBAAA,KAAA,eAAA,SAAA;AAAA,YACA,OAAA,EAAA,MAAA,MAAA,MAAA,KAAA,KAAA;AAAA,UACA,CAAA;AAAA,QACA;AACA,eAAA,KAAA,eAAA,QAAA,EAAA,OAAA,6BAAA,GAAA,IAAA;AAAA,MACA,CAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,aAAA,OAAA;AAEA,UAAA,CAAA,MAAA,OAAA,MAAA,MAAA;AACA,eAAA,KAAA,YAAA,MAAA,IAAA;AAAA,MACA;AAEA,YAAA,WAAA,MAAA,WAAA,MAAA,SAAA,IAAA,gBAAA,KAAA,aAAA,UAAA,CAAA,IAAA,CAAA;AACA,aAAA,KAAA,eAAA,MAAA,KAAA,MAAA,MAAA,QAAA;AAAA,IACA;AAAA;AAAA,IAGA,gCAAA,OAAA;AAAA,IAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,YAAA,aAAA;AACA,YAAA,aAAA,eAAA,WAAA;AACA,YAAA,SAAA,WAAA,WAAA;AAEA,YAAA,cAAA,CAAA,GAAA,YAAA,GAAA,MAAA;AACA,aAAA,KAAA,gBAAA,aAAA,WAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA,GAAA;AACA,UAAA,qBAAA,KAAA,OAAA,WAAA,CAAA;AACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,QACA,WAAA;AAAA,QACA,OAAA;AAAA,MACA;AAAA,MACA,KAAA,mBACA,qBACA,mBAAA,IAAA,WAAA,KAAA,aAAA,KAAA,CAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;"}
@@ -177,6 +177,7 @@ exports.emojiRegex = common_emoji.emojiRegex;
177
177
  exports.emojiShortCodeRegex = common_emoji.emojiShortCodeRegex;
178
178
  exports.emojiVersion = common_emoji.emojiVersion;
179
179
  exports.filterValidShortCodes = common_emoji.filterValidShortCodes;
180
+ exports.findEmojis = common_emoji.findEmojis;
180
181
  exports.findShortCodes = common_emoji.findShortCodes;
181
182
  exports.getEmojiData = common_emoji.getEmojiData;
182
183
  exports.setCustomEmojiJson = common_emoji.setCustomEmojiJson;
@@ -1 +1 @@
1
- {"version":3,"file":"dialtone-vue.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"dialtone-vue.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import { DEFAULT_VALIDATION_MESSAGE_TYPE, DESCRIPTION_SIZE_TYPES, VALIDATION_MES
2
2
  import { validationMessageValidator } from "./common/validators.js";
3
3
  import { disableRootScrolling, enableRootScrolling, filterFormattedMessages, formatMessages, getUniqueString, getValidationState } from "./common/utils.js";
4
4
  import { durationInHHMM, getDateMedium, relativeDate, setDateLocale } from "./common/dates.js";
5
- import { codeToEmojiData, customEmojiAssetUrl, defaultEmojiAssetUrl, emojiFileExtensionLarge, emojiFileExtensionSmall, emojiImageUrlLarge, emojiImageUrlSmall, emojiJson, emojiRegex, emojiShortCodeRegex, emojiVersion, filterValidShortCodes, findShortCodes, getEmojiData, setCustomEmojiJson, setCustomEmojiUrl, setEmojiAssetUrlLarge, setEmojiAssetUrlSmall, shortcodeToEmojiData, stringToUnicode, unicodeToString, validateCustomEmojiJson } from "./common/emoji.js";
5
+ import { codeToEmojiData, customEmojiAssetUrl, defaultEmojiAssetUrl, emojiFileExtensionLarge, emojiFileExtensionSmall, emojiImageUrlLarge, emojiImageUrlSmall, emojiJson, emojiRegex, emojiShortCodeRegex, emojiVersion, filterValidShortCodes, findEmojis, findShortCodes, getEmojiData, setCustomEmojiJson, setCustomEmojiUrl, setEmojiAssetUrlLarge, setEmojiAssetUrlSmall, shortcodeToEmojiData, stringToUnicode, unicodeToString, validateCustomEmojiJson } from "./common/emoji.js";
6
6
  import { CheckableMixin, GroupableMixin, InputMixin } from "./common/mixins/input.js";
7
7
  import { InputGroupMixin } from "./common/mixins/input_group.js";
8
8
  import { default as default2 } from "./common/mixins/keyboard_list_navigation.js";
@@ -358,6 +358,7 @@ export {
358
358
  enableRootScrolling,
359
359
  filterFormattedMessages,
360
360
  filterValidShortCodes,
361
+ findEmojis,
361
362
  findShortCodes,
362
363
  formatLong,
363
364
  formatMedium,
@@ -382,6 +382,7 @@ const _sfc_main = {
382
382
  (_a = this.$refs.input) == null ? void 0 : _a.focus();
383
383
  },
384
384
  onComboboxSelect(i) {
385
+ if (this.loading) return;
385
386
  this.value = "";
386
387
  this.$emit("select", i);
387
388
  },
@@ -577,7 +578,7 @@ var __component__ = /* @__PURE__ */ _pluginVue2_normalizer.default(
577
578
  _sfc_staticRenderFns,
578
579
  false,
579
580
  null,
580
- "08fa3e85"
581
+ "7eac7e22"
581
582
  );
582
583
  const combobox_multi_select = __component__.exports;
583
584
  exports.default = combobox_multi_select;
@@ -1 +1 @@
1
- {"version":3,"file":"combobox_multi_select.vue.cjs","sources":["../../../../recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue"],"sourcesContent":["<!-- eslint-disable vue/no-static-inline-styles -->\n<template>\n <dt-recipe-combobox-with-popover\n ref=\"comboboxWithPopover\"\n :label=\"label\"\n :show-list=\"showList\"\n :max-height=\"listMaxHeight\"\n :max-width=\"listMaxWidth\"\n :popover-offset=\"popoverOffset\"\n :has-suggestion-list=\"hasSuggestionList\"\n :visually-hidden-close-label=\"visuallyHiddenCloseLabel\"\n :visually-hidden-close=\"visuallyHiddenClose\"\n content-width=\"anchor\"\n :append-to=\"appendTo\"\n :transition=\"transition\"\n @select=\"onComboboxSelect\"\n @highlight=\"comboboxHighlight\"\n >\n <template #input=\"{ onInput }\">\n <span\n ref=\"inputSlotWrapper\"\n class=\"combobox__input-wrapper\"\n @focusin=\"handleInputFocusIn\"\n @focusout=\"handleInputFocusOut\"\n >\n <span\n ref=\"chipsWrapper\"\n :class=\"['combobox__chip-wrapper', chipWrapperClass]\"\n >\n <dt-chip\n v-for=\"({ item, key }) in selectedItemsWithKeys\"\n ref=\"chips\"\n :key=\"key\"\n :label-class=\"['d-chip__label']\"\n :class=\"['combobox__chip', { 'combobox__chip--truncate': !!chipMaxWidth }]\"\n :style=\"{ maxWidth: chipMaxWidth }\"\n :close-button-props=\"{ ariaLabel: 'close' }\"\n :size=\"CHIP_SIZES[size]\"\n v-on=\"chipListeners\"\n @keyup.backspace=\"onChipRemove(item)\"\n @close=\"onChipRemove(item)\"\n >\n {{ item }}\n </dt-chip>\n </span>\n\n <dt-input\n ref=\"input\"\n v-model=\"value\"\n class=\"combobox__input\"\n :input-class=\"[inputClass, { 'd-fc-transparent': hideInputText }]\"\n :input-wrapper-class=\"inputWrapperClass\"\n :aria-label=\"label\"\n :label=\"labelVisible ? label : ''\"\n :description=\"description\"\n :placeholder=\"inputPlaceHolder\"\n :show-messages=\"showInputMessages\"\n :messages=\"inputMessages\"\n :size=\"size\"\n v-on=\"inputListeners\"\n @input=\"onInput\"\n />\n\n <dt-validation-messages\n :validation-messages=\"maxSelectedMessage\"\n :show-messages=\"showValidationMessages\"\n />\n </span>\n </template>\n\n <!-- @slot slot for popover header -->\n <template\n v-if=\"$slots.header\"\n #header\n >\n <div ref=\"header\">\n <slot name=\"header\" />\n </div>\n </template>\n\n <!-- @slot slot for popover list -->\n <template #list>\n <div\n ref=\"list\"\n @mousedown.prevent\n >\n <slot\n v-if=\"!loading\"\n name=\"list\"\n />\n <div\n v-else\n class=\"combobox__list--loading\"\n >\n {{ loadingMessage }}\n </div>\n </div>\n </template>\n\n <!-- @slot slot for popover footer -->\n <template\n v-if=\"$slots.footer\"\n #footer\n >\n <div ref=\"footer\">\n <slot name=\"footer\" />\n </div>\n </template>\n </dt-recipe-combobox-with-popover>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport DtRecipeComboboxWithPopover from '@/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue';\nimport DtInput from '@/components/input/input.vue';\nimport DtChip from '@/components/chip/chip.vue';\nimport DtValidationMessages from '@/components/validation_messages/validation_messages.vue';\nimport { validationMessageValidator } from '@/common/validators';\nimport {\n POPOVER_APPEND_TO_VALUES,\n} from '@/components/popover/popover_constants';\nimport {\n MULTI_SELECT_SIZES,\n CHIP_SIZES,\n CHIP_TOP_POSITION,\n} from './combobox_multi_select_constants';\nimport SrOnlyCloseButtonMixin from '@/common/mixins/sr_only_close_button';\nimport { getUniqueString } from '@/common/utils';\n\nexport default {\n name: 'DtRecipeComboboxMultiSelect',\n\n components: {\n DtRecipeComboboxWithPopover,\n DtInput,\n DtChip,\n DtValidationMessages,\n },\n\n mixins: [SrOnlyCloseButtonMixin],\n\n props: {\n /**\n * String to use for the input label.\n */\n label: {\n type: String,\n required: true,\n },\n\n /**\n * Determines visibility of input label.\n * @values true, false\n */\n labelVisible: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Description for the input\n */\n description: {\n type: String,\n default: '',\n },\n\n /**\n * Input placeholder\n */\n placeholder: {\n type: String,\n default: 'Select one or start typing',\n },\n\n /**\n * Input validation messages\n */\n inputMessages: {\n type: Array,\n default: () => [],\n validator: inputMessages => {\n return validationMessageValidator(inputMessages);\n },\n },\n\n /**\n * Show input validation message\n */\n showInputMessages: {\n type: Boolean,\n default: true,\n },\n\n // @TODO: https://dialpad.atlassian.net/browse/DP-52324\n // type: {\n // type: String,\n // values: ['input', 'select'],\n // default: 'select',\n // },\n\n /**\n * Determines if the list is loading\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The message when the list is loading\n */\n loadingMessage: {\n type: String,\n default: 'loading...',\n },\n\n /**\n * Determines when to show the list element and also controls the aria-expanded attribute.\n * Leaving this null will have the combobox trigger on input focus by default.\n * If you set this value, the default trigger behavior will be disabled and you can\n * control it as you need.\n */\n showList: {\n type: Boolean,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n listMaxHeight: {\n type: String,\n default: '300px',\n },\n\n /**\n * The selected items\n */\n selectedItems: {\n type: Array,\n default: function () { return []; },\n },\n\n /**\n * Would be the maximum number of selections you can make. 0 is unlimited\n */\n maxSelected: {\n type: Number,\n default: 0,\n },\n\n /**\n * Max select message when the max selections is exceeded with the structure:\n * `[{\"message\": string, \"type\": VALIDATION_MESSAGE_TYPES }]`\n */\n maxSelectedMessage: {\n type: Array,\n default: function () { return []; },\n },\n\n /**\n * Displays the list when the combobox is focused, before the user has typed anything.\n * When this is enabled the list will not close after selection.\n */\n hasSuggestionList: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Size of the chip, one of `xs`, `sm`, `md`\n */\n size: {\n type: String,\n default: 'md',\n validator: (t) => Object.values(MULTI_SELECT_SIZES).includes(t),\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n\n /**\n * Determines whether the combobox should collapse to a single when losing focus.\n * @type {boolean}\n */\n collapseOnFocusOut: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|em\n */\n listMaxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Amount of reserved space (in px) on the right side of the input\n * before the chips and the input caret jump to the next line.\n * default is 64\n */\n reservedRightSpace: {\n type: Number,\n default: 64,\n },\n\n /**\n * Determines the maximum width of a single chip. If the text within this chip exceeds the value\n * it will be truncated with ellipses.\n * Possible units rem|px|em\n */\n chipMaxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Additional class name for the input element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n inputClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the input wrapper element.\n * Can accept all of String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n inputWrapperClass: {\n type: [String, Object, Array],\n default: '',\n },\n },\n\n emits: [\n /**\n * Native input event\n *\n * @event input\n * @type {String }\n */\n 'input',\n\n /**\n * Event fired when item selected\n *\n * @event select\n * @type {Number}\n */\n 'select',\n\n /**\n * Event fired when item removed\n *\n * @event remove\n * @type {String}\n */\n 'remove',\n\n /**\n * Event fired when max selected items limit is reached\n *\n * @event max-selected\n * @type {Object}\n */\n 'max-selected',\n\n /**\n * Native keyup event\n *\n * @event keyup\n * @type {KeyboardEvent}\n */\n 'keyup',\n\n /**\n * Event fired when combobox item is highlighted\n *\n * @event combobox-highlight\n * @type {Object}\n */\n 'combobox-highlight',\n ],\n\n data () {\n return {\n value: '',\n popoverOffset: [0, 4],\n showValidationMessages: false,\n resizeWindowObserver: null,\n initialInputHeight: null,\n CHIP_SIZES,\n inputFocused: false,\n hideInputText: false,\n };\n },\n\n computed: {\n inputPlaceHolder () {\n return this.selectedItems?.length > 0 ? '' : this.placeholder;\n },\n\n chipListeners () {\n return {\n ...this.$listeners,\n keyup: event => {\n this.onChipKeyup(event);\n this.$emit('keyup', event);\n },\n };\n },\n\n inputListeners () {\n return {\n ...this.$listeners,\n input: event => {\n this.$emit('input', event);\n if (this.hasSuggestionList) {\n this.showComboboxList();\n }\n },\n\n keyup: event => {\n this.onInputKeyup(event);\n this.$emit('keyup', event);\n },\n\n click: event => {\n if (this.hasSuggestionList) {\n this.showComboboxList();\n }\n },\n };\n },\n\n selectedItemsWithKeys () {\n return this.selectedItems.map(selectedItem => ({\n item: selectedItem,\n key: getUniqueString(selectedItem),\n }));\n },\n\n chipWrapperClass () {\n return {\n [`combobox__chip-wrapper-${this.size}--collapsed`]: !this.inputFocused && this.collapseOnFocusOut,\n };\n },\n },\n\n watch: {\n selectedItems: {\n async handler () {\n this.initSelectedItems();\n },\n },\n\n chipMaxWidth: {\n async handler () {\n this.initSelectedItems();\n },\n },\n\n async label () {\n await this.$nextTick();\n // Adjust the chips position if label changed\n this.setChipsTopPosition();\n },\n\n async description () {\n await this.$nextTick();\n // Adjust the chips position if description changed\n this.setChipsTopPosition();\n },\n\n size: {\n async handler () {\n await this.$nextTick();\n const input = this.getInput();\n this.revertInputPadding(input);\n this.initialInputHeight = input.getBoundingClientRect().height;\n this.setInputPadding();\n this.setChipsTopPosition();\n },\n },\n },\n\n mounted () {\n this.setInitialInputHeight();\n // Recalculate chip position and input padding when resizing window\n this.resizeWindowObserver = new ResizeObserver(async () => {\n this.setChipsTopPosition();\n this.setInputPadding();\n });\n this.resizeWindowObserver.observe(document.body);\n\n this.initSelectedItems();\n },\n\n beforeDestroy () {\n this.resizeWindowObserver?.unobserve(document.body);\n },\n\n methods: {\n comboboxHighlight (highlightIndex) {\n this.$emit('combobox-highlight', highlightIndex);\n },\n\n async initSelectedItems () {\n await this.$nextTick();\n this.setInputPadding();\n this.setChipsTopPosition();\n this.setInputMinWidth();\n this.checkMaxSelected();\n },\n\n onChipRemove (item) {\n this.$emit('remove', item);\n this.$refs.input?.focus();\n },\n\n onComboboxSelect (i) {\n this.value = '';\n this.$emit('select', i);\n },\n\n showComboboxList () {\n if (this.showList != null) { return; }\n this.$refs.comboboxWithPopover?.showComboboxList();\n },\n\n closeComboboxList () {\n if (this.showList != null) { return; }\n this.$refs.comboboxWithPopover?.closeComboboxList();\n },\n\n getChipButtons () {\n return this.$refs.chips && this.$refs.chips.map(chip => chip.$el.querySelector('button'));\n },\n\n getChips () {\n return this.$refs.chips && this.$refs.chips.map(chip => chip.$el);\n },\n\n getLastChipButton () {\n return this.$refs.chips && this.getChipButtons()[this.getChipButtons().length - 1];\n },\n\n getLastChip () {\n return this.$refs.chips && this.getChips()[this.getChips().length - 1];\n },\n\n getFirstChip () {\n return this.$refs.chips && this.getChips()[0];\n },\n\n getInput () {\n return this.$refs.input?.$refs.input;\n },\n\n onChipKeyup (event) {\n const key = event.code?.toLowerCase();\n if (key === 'arrowleft') {\n // Move to the previous chip\n this.navigateBetweenChips(event.target, true);\n } else if (key === 'arrowright') {\n if (event.target.id === this.getLastChipButton().id) {\n // Move to the input if it's the last chip\n this.moveFromChipToInput();\n } else {\n // Move to the next chip\n this.navigateBetweenChips(event.target, false);\n }\n }\n },\n\n onInputKeyup (event) {\n const key = event.code?.toLowerCase();\n // If the cursor is at the start of the text,\n // press 'backspace' or 'left' focuses the last chip\n if (this.selectedItems.length > 0 && event.target.selectionStart === 0) {\n if (key === 'backspace' || key === 'arrowleft') {\n this.moveFromInputToChip();\n }\n }\n },\n\n moveFromInputToChip () {\n this.getLastChipButton().focus();\n this.$refs.input?.blur();\n this.closeComboboxList();\n },\n\n moveFromChipToInput () {\n this.getLastChipButton().blur();\n this.$refs.input?.focus();\n this.showComboboxList();\n },\n\n navigateBetweenChips (target, toLeft) {\n const from = this.getChipButtons().indexOf(target);\n const to = toLeft ? from - 1 : from + 1;\n if (to < 0 || to >= this.$refs.chips?.length) {\n return;\n }\n this.getChipButtons()[from].blur();\n this.getChipButtons()[to].focus();\n this.closeComboboxList();\n },\n\n setChipsTopPosition () {\n // To place the chips in the input box\n // The chip \"top\" position should be the same line as the input box\n const input = this.getInput();\n if (!input) return;\n const inputSlotWrapper = this.$refs.inputSlotWrapper;\n const top = input.getBoundingClientRect().top -\n inputSlotWrapper.getBoundingClientRect().top;\n const chipsWrapper = this.$refs.chipsWrapper;\n chipsWrapper.style.top = (top - CHIP_TOP_POSITION[this.size]) + 'px';\n },\n\n setInputPadding () {\n const lastChip = this.getLastChip();\n const input = this.getInput();\n const chipsWrapper = this.$refs.chipsWrapper;\n if (!input) return;\n this.revertInputPadding(input);\n this.popoverOffset = [0, 4];\n if (!lastChip) return;\n // Avoid adding extra padding when the input is not focused if collapseOnFocusOut is true\n // This ensures the input returns to its original state when resizing\n if (this.collapseOnFocusOut && !this.inputFocused) return;\n\n // Get the position of the last chip\n // The input cursor should be the same \"top\" as that chip and next besides it\n const left = lastChip.offsetLeft + this.getFullWidth(lastChip);\n const spaceLeft = input.getBoundingClientRect().width - left;\n // input.style.paddingLeft = left + 'px';\n\n if (spaceLeft > this.reservedRightSpace) {\n input.style.paddingLeft = left + 'px';\n } else {\n input.style.paddingLeft = '4px';\n }\n\n // Get the chip wrapper height minus the 4px padding\n const chipsWrapperHeight = chipsWrapper.getBoundingClientRect().height - 4;\n const lastChipHeight = lastChip.getBoundingClientRect().height - 4;\n\n // Get lastChip offsetTop plus 2px of the input padding.\n const top = spaceLeft > this.reservedRightSpace\n ? lastChip.offsetTop + 2\n : (chipsWrapperHeight + lastChipHeight - 9);\n\n input.style.paddingTop = `${top}px`;\n },\n\n revertInputPadding (input) {\n input.style.paddingLeft = '';\n input.style.paddingTop = '';\n input.style.paddingBottom = '';\n },\n\n getFullWidth (el) {\n const styles = window.getComputedStyle(el);\n return el.offsetWidth + parseInt(styles.marginLeft) + parseInt(styles.marginRight);\n },\n\n setInputMinWidth () {\n // Ensure the width of the input is \"slightly bigger\" than the width of a single chip\n const firstChip = this.getFirstChip();\n const input = this.getInput();\n if (!input) return;\n if (firstChip) {\n // Add 4px buffer for typing room\n input.style.minWidth = (this.getFullWidth(firstChip) + 4) + 'px';\n } else {\n input.style.minWidth = '';\n }\n },\n\n checkMaxSelected () {\n if (this.maxSelected === 0) return;\n if (this.selectedItems.length > this.maxSelected) {\n this.showValidationMessages = true;\n this.$emit('max-selected');\n } else {\n this.showValidationMessages = false;\n }\n },\n\n setInitialInputHeight () {\n const input = this.getInput();\n if (!input) return;\n this.initialInputHeight = input.getBoundingClientRect().height;\n },\n\n async handleInputFocusIn () {\n this.inputFocused = true;\n if (this.collapseOnFocusOut) {\n await this.$nextTick();\n this.setInputPadding();\n this.hideInputText = false;\n }\n },\n\n async handleInputFocusOut () {\n this.inputFocused = false;\n if (this.collapseOnFocusOut) {\n const input = this.getInput();\n if (!input) return;\n // Hide the input text when is not on first line\n if (!input.style.paddingTop) {\n return;\n }\n this.hideInputText = true;\n this.revertInputPadding(input);\n }\n },\n },\n};\n</script>\n\n<style scoped lang=\"less\">\n.combobox__input-wrapper {\n position: relative;\n display: block;\n}\n\n.combobox__chip-wrapper {\n position: absolute;\n margin-left: var(--dt-space-200);\n margin-right: var(--dt-space-200);\n padding-left: var(--dt-space-100);\n max-width: calc(var(--dt-size-100-percent) - var(--dt-space-400));\n max-height: initial;\n overflow-y: visible;\n}\n\n.combobox__chip-wrapper-md--collapsed {\n max-height: 2.8rem;\n overflow-y: hidden;\n}\n\n.combobox__chip-wrapper-sm--collapsed,\n.combobox__chip-wrapper-xs--collapsed {\n max-height: 2.5rem;\n overflow-y: hidden;\n}\n\n.combobox__chip {\n margin-top: var(--dt-space-300);\n margin-left: var(--dt-space-200);\n margin-right: var(--dt-space-200);\n z-index: var(--zi-base1);\n max-width: var(--dt-size-100-percent);\n}\n\n.combobox__input {\n flex-grow: 1;\n}\n\n.combobox__list--loading {\n text-align: center;\n padding-top: var(--dt-space-500);\n padding-bottom: var(--dt-space-500);\n}\n\n.combobox__chip--truncate {\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n</style>\n"],"names":["DtRecipeComboboxWithPopover","DtInput","DtChip","DtValidationMessages","SrOnlyCloseButtonMixin","validationMessageValidator","MULTI_SELECT_SIZES","POPOVER_APPEND_TO_VALUES","CHIP_SIZES","getUniqueString","input","chip","CHIP_TOP_POSITION"],"mappings":";;;;;;;;;;;;;AAiIA,MAAA,YAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,6BAAAA,sBAAA;AAAA,IACA,SAAAC,MAAA;AAAA,IACA,QAAAC,KAAA;AAAA,IACA,sBAAAC,oBAAA;AAAA,EACA;AAAA,EAEA,QAAA,CAAAC,qBAAAA,OAAA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,cAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,eAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,MAAA,CAAA;AAAA,MACA,WAAA,mBAAA;AACA,eAAAC,kBAAAA,2BAAA,aAAA;AAAA,MACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,mBAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA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SAAA,OAAA,iBAAA,EAAA;AACA,aAAA,GAAA,cAAA,SAAA,OAAA,UAAA,IAAA,SAAA,OAAA,WAAA;AAAA,IACA;AAAA,IAEA,mBAAA;AAEA,YAAA,YAAA,KAAA;AACA,YAAAA,SAAA,KAAA;AACA,UAAA,CAAAA,OAAA;AACA,UAAA,WAAA;AAEA,QAAAA,OAAA,MAAA,WAAA,KAAA,aAAA,SAAA,IAAA,IAAA;AAAA,MACA,OAAA;AACA,QAAAA,OAAA,MAAA,WAAA;AAAA,MACA;AAAA,IACA;AAAA,IAEA,mBAAA;AACA,UAAA,KAAA,gBAAA,EAAA;AACA,UAAA,KAAA,cAAA,SAAA,KAAA,aAAA;AACA,aAAA,yBAAA;AACA,aAAA,MAAA,cAAA;AAAA,MACA,OAAA;AACA,aAAA,yBAAA;AAAA,MACA;AAAA,IACA;AAAA,IAEA,wBAAA;AACA,YAAAA,SAAA,KAAA;AACA,UAAA,CAAAA,OAAA;AACA,WAAA,qBAAAA,OAAA,sBAAA,EAAA;AAAA,IACA;AAAA,IAEA,MAAA,qBAAA;AACA,WAAA,eAAA;AACA,UAAA,KAAA,oBAAA;AACA,cAAA,KAAA;AACA,aAAA,gBAAA;AACA,aAAA,gBAAA;AAAA,MACA;AAAA,IACA;AAAA,IAEA,MAAA,sBAAA;AACA,WAAA,eAAA;AACA,UAAA,KAAA,oBAAA;AACA,cAAAA,SAAA,KAAA;AACA,YAAA,CAAAA,OAAA;AAEA,YAAA,CAAAA,OAAA,MAAA,YAAA;AACA;AAAA,QACA;AACA,aAAA,gBAAA;AACA,aAAA,mBAAAA,MAAA;AAAA,MACA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"combobox_multi_select.vue.cjs","sources":["../../../../recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue"],"sourcesContent":["<!-- eslint-disable vue/no-static-inline-styles -->\n<template>\n <dt-recipe-combobox-with-popover\n ref=\"comboboxWithPopover\"\n :label=\"label\"\n :show-list=\"showList\"\n :max-height=\"listMaxHeight\"\n :max-width=\"listMaxWidth\"\n :popover-offset=\"popoverOffset\"\n :has-suggestion-list=\"hasSuggestionList\"\n :visually-hidden-close-label=\"visuallyHiddenCloseLabel\"\n :visually-hidden-close=\"visuallyHiddenClose\"\n content-width=\"anchor\"\n :append-to=\"appendTo\"\n :transition=\"transition\"\n @select=\"onComboboxSelect\"\n @highlight=\"comboboxHighlight\"\n >\n <template #input=\"{ onInput }\">\n <span\n ref=\"inputSlotWrapper\"\n class=\"combobox__input-wrapper\"\n @focusin=\"handleInputFocusIn\"\n @focusout=\"handleInputFocusOut\"\n >\n <span\n ref=\"chipsWrapper\"\n :class=\"['combobox__chip-wrapper', chipWrapperClass]\"\n >\n <dt-chip\n v-for=\"({ item, key }) in selectedItemsWithKeys\"\n ref=\"chips\"\n :key=\"key\"\n :label-class=\"['d-chip__label']\"\n :class=\"['combobox__chip', { 'combobox__chip--truncate': !!chipMaxWidth }]\"\n :style=\"{ maxWidth: chipMaxWidth }\"\n :close-button-props=\"{ ariaLabel: 'close' }\"\n :size=\"CHIP_SIZES[size]\"\n v-on=\"chipListeners\"\n @keyup.backspace=\"onChipRemove(item)\"\n @close=\"onChipRemove(item)\"\n >\n {{ item }}\n </dt-chip>\n </span>\n\n <dt-input\n ref=\"input\"\n v-model=\"value\"\n class=\"combobox__input\"\n :input-class=\"[inputClass, { 'd-fc-transparent': hideInputText }]\"\n :input-wrapper-class=\"inputWrapperClass\"\n :aria-label=\"label\"\n :label=\"labelVisible ? label : ''\"\n :description=\"description\"\n :placeholder=\"inputPlaceHolder\"\n :show-messages=\"showInputMessages\"\n :messages=\"inputMessages\"\n :size=\"size\"\n v-on=\"inputListeners\"\n @input=\"onInput\"\n />\n\n <dt-validation-messages\n :validation-messages=\"maxSelectedMessage\"\n :show-messages=\"showValidationMessages\"\n />\n </span>\n </template>\n\n <!-- @slot slot for popover header -->\n <template\n v-if=\"$slots.header\"\n #header\n >\n <div ref=\"header\">\n <slot name=\"header\" />\n </div>\n </template>\n\n <!-- @slot slot for popover list -->\n <template #list>\n <div\n ref=\"list\"\n @mousedown.prevent\n >\n <slot\n v-if=\"!loading\"\n name=\"list\"\n />\n <div\n v-else\n class=\"combobox__list--loading\"\n >\n {{ loadingMessage }}\n </div>\n </div>\n </template>\n\n <!-- @slot slot for popover footer -->\n <template\n v-if=\"$slots.footer\"\n #footer\n >\n <div ref=\"footer\">\n <slot name=\"footer\" />\n </div>\n </template>\n </dt-recipe-combobox-with-popover>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport DtRecipeComboboxWithPopover from '@/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue';\nimport DtInput from '@/components/input/input.vue';\nimport DtChip from '@/components/chip/chip.vue';\nimport DtValidationMessages from '@/components/validation_messages/validation_messages.vue';\nimport { validationMessageValidator } from '@/common/validators';\nimport {\n POPOVER_APPEND_TO_VALUES,\n} from '@/components/popover/popover_constants';\nimport {\n MULTI_SELECT_SIZES,\n CHIP_SIZES,\n CHIP_TOP_POSITION,\n} from './combobox_multi_select_constants';\nimport SrOnlyCloseButtonMixin from '@/common/mixins/sr_only_close_button';\nimport { getUniqueString } from '@/common/utils';\n\nexport default {\n name: 'DtRecipeComboboxMultiSelect',\n\n components: {\n DtRecipeComboboxWithPopover,\n DtInput,\n DtChip,\n DtValidationMessages,\n },\n\n mixins: [SrOnlyCloseButtonMixin],\n\n props: {\n /**\n * String to use for the input label.\n */\n label: {\n type: String,\n required: true,\n },\n\n /**\n * Determines visibility of input label.\n * @values true, false\n */\n labelVisible: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Description for the input\n */\n description: {\n type: String,\n default: '',\n },\n\n /**\n * Input placeholder\n */\n placeholder: {\n type: String,\n default: 'Select one or start typing',\n },\n\n /**\n * Input validation messages\n */\n inputMessages: {\n type: Array,\n default: () => [],\n validator: inputMessages => {\n return validationMessageValidator(inputMessages);\n },\n },\n\n /**\n * Show input validation message\n */\n showInputMessages: {\n type: Boolean,\n default: true,\n },\n\n // @TODO: https://dialpad.atlassian.net/browse/DP-52324\n // type: {\n // type: String,\n // values: ['input', 'select'],\n // default: 'select',\n // },\n\n /**\n * Determines if the list is loading\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The message when the list is loading\n */\n loadingMessage: {\n type: String,\n default: 'loading...',\n },\n\n /**\n * Determines when to show the list element and also controls the aria-expanded attribute.\n * Leaving this null will have the combobox trigger on input focus by default.\n * If you set this value, the default trigger behavior will be disabled and you can\n * control it as you need.\n */\n showList: {\n type: Boolean,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n listMaxHeight: {\n type: String,\n default: '300px',\n },\n\n /**\n * The selected items\n */\n selectedItems: {\n type: Array,\n default: function () { return []; },\n },\n\n /**\n * Would be the maximum number of selections you can make. 0 is unlimited\n */\n maxSelected: {\n type: Number,\n default: 0,\n },\n\n /**\n * Max select message when the max selections is exceeded with the structure:\n * `[{\"message\": string, \"type\": VALIDATION_MESSAGE_TYPES }]`\n */\n maxSelectedMessage: {\n type: Array,\n default: function () { return []; },\n },\n\n /**\n * Displays the list when the combobox is focused, before the user has typed anything.\n * When this is enabled the list will not close after selection.\n */\n hasSuggestionList: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Size of the chip, one of `xs`, `sm`, `md`\n */\n size: {\n type: String,\n default: 'md',\n validator: (t) => Object.values(MULTI_SELECT_SIZES).includes(t),\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n\n /**\n * Determines whether the combobox should collapse to a single when losing focus.\n * @type {boolean}\n */\n collapseOnFocusOut: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|em\n */\n listMaxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Amount of reserved space (in px) on the right side of the input\n * before the chips and the input caret jump to the next line.\n * default is 64\n */\n reservedRightSpace: {\n type: Number,\n default: 64,\n },\n\n /**\n * Determines the maximum width of a single chip. If the text within this chip exceeds the value\n * it will be truncated with ellipses.\n * Possible units rem|px|em\n */\n chipMaxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Additional class name for the input element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n inputClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the input wrapper element.\n * Can accept all of String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n inputWrapperClass: {\n type: [String, Object, Array],\n default: '',\n },\n },\n\n emits: [\n /**\n * Native input event\n *\n * @event input\n * @type {String }\n */\n 'input',\n\n /**\n * Event fired when item selected\n *\n * @event select\n * @type {Number}\n */\n 'select',\n\n /**\n * Event fired when item removed\n *\n * @event remove\n * @type {String}\n */\n 'remove',\n\n /**\n * Event fired when max selected items limit is reached\n *\n * @event max-selected\n * @type {Object}\n */\n 'max-selected',\n\n /**\n * Native keyup event\n *\n * @event keyup\n * @type {KeyboardEvent}\n */\n 'keyup',\n\n /**\n * Event fired when combobox item is highlighted\n *\n * @event combobox-highlight\n * @type {Object}\n */\n 'combobox-highlight',\n ],\n\n data () {\n return {\n value: '',\n popoverOffset: [0, 4],\n showValidationMessages: false,\n resizeWindowObserver: null,\n initialInputHeight: null,\n CHIP_SIZES,\n inputFocused: false,\n hideInputText: false,\n };\n },\n\n computed: {\n inputPlaceHolder () {\n return this.selectedItems?.length > 0 ? '' : this.placeholder;\n },\n\n chipListeners () {\n return {\n ...this.$listeners,\n keyup: event => {\n this.onChipKeyup(event);\n this.$emit('keyup', event);\n },\n };\n },\n\n inputListeners () {\n return {\n ...this.$listeners,\n input: event => {\n this.$emit('input', event);\n if (this.hasSuggestionList) {\n this.showComboboxList();\n }\n },\n\n keyup: event => {\n this.onInputKeyup(event);\n this.$emit('keyup', event);\n },\n\n click: event => {\n if (this.hasSuggestionList) {\n this.showComboboxList();\n }\n },\n };\n },\n\n selectedItemsWithKeys () {\n return this.selectedItems.map(selectedItem => ({\n item: selectedItem,\n key: getUniqueString(selectedItem),\n }));\n },\n\n chipWrapperClass () {\n return {\n [`combobox__chip-wrapper-${this.size}--collapsed`]: !this.inputFocused && this.collapseOnFocusOut,\n };\n },\n },\n\n watch: {\n selectedItems: {\n async handler () {\n this.initSelectedItems();\n },\n },\n\n chipMaxWidth: {\n async handler () {\n this.initSelectedItems();\n },\n },\n\n async label () {\n await this.$nextTick();\n // Adjust the chips position if label changed\n this.setChipsTopPosition();\n },\n\n async description () {\n await this.$nextTick();\n // Adjust the chips position if description changed\n this.setChipsTopPosition();\n },\n\n size: {\n async handler () {\n await this.$nextTick();\n const input = this.getInput();\n this.revertInputPadding(input);\n this.initialInputHeight = input.getBoundingClientRect().height;\n this.setInputPadding();\n this.setChipsTopPosition();\n },\n },\n },\n\n mounted () {\n this.setInitialInputHeight();\n // Recalculate chip position and input padding when resizing window\n this.resizeWindowObserver = new ResizeObserver(async () => {\n this.setChipsTopPosition();\n this.setInputPadding();\n });\n this.resizeWindowObserver.observe(document.body);\n\n this.initSelectedItems();\n },\n\n beforeDestroy () {\n this.resizeWindowObserver?.unobserve(document.body);\n },\n\n methods: {\n comboboxHighlight (highlightIndex) {\n this.$emit('combobox-highlight', highlightIndex);\n },\n\n async initSelectedItems () {\n await this.$nextTick();\n this.setInputPadding();\n this.setChipsTopPosition();\n this.setInputMinWidth();\n this.checkMaxSelected();\n },\n\n onChipRemove (item) {\n this.$emit('remove', item);\n this.$refs.input?.focus();\n },\n\n onComboboxSelect (i) {\n if (this.loading) return;\n this.value = '';\n this.$emit('select', i);\n },\n\n showComboboxList () {\n if (this.showList != null) { return; }\n this.$refs.comboboxWithPopover?.showComboboxList();\n },\n\n closeComboboxList () {\n if (this.showList != null) { return; }\n this.$refs.comboboxWithPopover?.closeComboboxList();\n },\n\n getChipButtons () {\n return this.$refs.chips && this.$refs.chips.map(chip => chip.$el.querySelector('button'));\n },\n\n getChips () {\n return this.$refs.chips && this.$refs.chips.map(chip => chip.$el);\n },\n\n getLastChipButton () {\n return this.$refs.chips && this.getChipButtons()[this.getChipButtons().length - 1];\n },\n\n getLastChip () {\n return this.$refs.chips && this.getChips()[this.getChips().length - 1];\n },\n\n getFirstChip () {\n return this.$refs.chips && this.getChips()[0];\n },\n\n getInput () {\n return this.$refs.input?.$refs.input;\n },\n\n onChipKeyup (event) {\n const key = event.code?.toLowerCase();\n if (key === 'arrowleft') {\n // Move to the previous chip\n this.navigateBetweenChips(event.target, true);\n } else if (key === 'arrowright') {\n if (event.target.id === this.getLastChipButton().id) {\n // Move to the input if it's the last chip\n this.moveFromChipToInput();\n } else {\n // Move to the next chip\n this.navigateBetweenChips(event.target, false);\n }\n }\n },\n\n onInputKeyup (event) {\n const key = event.code?.toLowerCase();\n // If the cursor is at the start of the text,\n // press 'backspace' or 'left' focuses the last chip\n if (this.selectedItems.length > 0 && event.target.selectionStart === 0) {\n if (key === 'backspace' || key === 'arrowleft') {\n this.moveFromInputToChip();\n }\n }\n },\n\n moveFromInputToChip () {\n this.getLastChipButton().focus();\n this.$refs.input?.blur();\n this.closeComboboxList();\n },\n\n moveFromChipToInput () {\n this.getLastChipButton().blur();\n this.$refs.input?.focus();\n this.showComboboxList();\n },\n\n navigateBetweenChips (target, toLeft) {\n const from = this.getChipButtons().indexOf(target);\n const to = toLeft ? from - 1 : from + 1;\n if (to < 0 || to >= this.$refs.chips?.length) {\n return;\n }\n this.getChipButtons()[from].blur();\n this.getChipButtons()[to].focus();\n this.closeComboboxList();\n },\n\n setChipsTopPosition () {\n // To place the chips in the input box\n // The chip \"top\" position should be the same line as the input box\n const input = this.getInput();\n if (!input) return;\n const inputSlotWrapper = this.$refs.inputSlotWrapper;\n const top = input.getBoundingClientRect().top -\n inputSlotWrapper.getBoundingClientRect().top;\n const chipsWrapper = this.$refs.chipsWrapper;\n chipsWrapper.style.top = (top - CHIP_TOP_POSITION[this.size]) + 'px';\n },\n\n setInputPadding () {\n const lastChip = this.getLastChip();\n const input = this.getInput();\n const chipsWrapper = this.$refs.chipsWrapper;\n if (!input) return;\n this.revertInputPadding(input);\n this.popoverOffset = [0, 4];\n if (!lastChip) return;\n // Avoid adding extra padding when the input is not focused if collapseOnFocusOut is true\n // This ensures the input returns to its original state when resizing\n if (this.collapseOnFocusOut && !this.inputFocused) return;\n\n // Get the position of the last chip\n // The input cursor should be the same \"top\" as that chip and next besides it\n const left = lastChip.offsetLeft + this.getFullWidth(lastChip);\n const spaceLeft = input.getBoundingClientRect().width - left;\n // input.style.paddingLeft = left + 'px';\n\n if (spaceLeft > this.reservedRightSpace) {\n input.style.paddingLeft = left + 'px';\n } else {\n input.style.paddingLeft = '4px';\n }\n\n // Get the chip wrapper height minus the 4px padding\n const chipsWrapperHeight = chipsWrapper.getBoundingClientRect().height - 4;\n const lastChipHeight = lastChip.getBoundingClientRect().height - 4;\n\n // Get lastChip offsetTop plus 2px of the input padding.\n const top = spaceLeft > this.reservedRightSpace\n ? lastChip.offsetTop + 2\n : (chipsWrapperHeight + lastChipHeight - 9);\n\n input.style.paddingTop = `${top}px`;\n },\n\n revertInputPadding (input) {\n input.style.paddingLeft = '';\n input.style.paddingTop = '';\n input.style.paddingBottom = '';\n },\n\n getFullWidth (el) {\n const styles = window.getComputedStyle(el);\n return el.offsetWidth + parseInt(styles.marginLeft) + parseInt(styles.marginRight);\n },\n\n setInputMinWidth () {\n // Ensure the width of the input is \"slightly bigger\" than the width of a single chip\n const firstChip = this.getFirstChip();\n const input = this.getInput();\n if (!input) return;\n if (firstChip) {\n // Add 4px buffer for typing room\n input.style.minWidth = (this.getFullWidth(firstChip) + 4) + 'px';\n } else {\n input.style.minWidth = '';\n }\n },\n\n checkMaxSelected () {\n if (this.maxSelected === 0) return;\n if (this.selectedItems.length > this.maxSelected) {\n this.showValidationMessages = true;\n this.$emit('max-selected');\n } else {\n this.showValidationMessages = false;\n }\n },\n\n setInitialInputHeight () {\n const input = this.getInput();\n if (!input) return;\n this.initialInputHeight = input.getBoundingClientRect().height;\n },\n\n async handleInputFocusIn () {\n this.inputFocused = true;\n if (this.collapseOnFocusOut) {\n await this.$nextTick();\n this.setInputPadding();\n this.hideInputText = false;\n }\n },\n\n async handleInputFocusOut () {\n this.inputFocused = false;\n if (this.collapseOnFocusOut) {\n const input = this.getInput();\n if (!input) return;\n // Hide the input text when is not on first line\n if (!input.style.paddingTop) {\n return;\n }\n this.hideInputText = true;\n this.revertInputPadding(input);\n }\n },\n },\n};\n</script>\n\n<style scoped lang=\"less\">\n.combobox__input-wrapper {\n position: relative;\n display: block;\n}\n\n.combobox__chip-wrapper {\n position: absolute;\n margin-left: var(--dt-space-200);\n margin-right: var(--dt-space-200);\n padding-left: var(--dt-space-100);\n max-width: calc(var(--dt-size-100-percent) - var(--dt-space-400));\n max-height: initial;\n overflow-y: visible;\n}\n\n.combobox__chip-wrapper-md--collapsed {\n max-height: 2.8rem;\n overflow-y: hidden;\n}\n\n.combobox__chip-wrapper-sm--collapsed,\n.combobox__chip-wrapper-xs--collapsed {\n max-height: 2.5rem;\n overflow-y: hidden;\n}\n\n.combobox__chip {\n margin-top: var(--dt-space-300);\n margin-left: var(--dt-space-200);\n margin-right: var(--dt-space-200);\n z-index: var(--zi-base1);\n max-width: var(--dt-size-100-percent);\n}\n\n.combobox__input {\n flex-grow: 1;\n}\n\n.combobox__list--loading {\n text-align: center;\n padding-top: var(--dt-space-500);\n padding-bottom: var(--dt-space-500);\n}\n\n.combobox__chip--truncate {\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n</style>\n"],"names":["DtRecipeComboboxWithPopover","DtInput","DtChip","DtValidationMessages","SrOnlyCloseButtonMixin","validationMessageValidator","MULTI_SELECT_SIZES","POPOVER_APPEND_TO_VALUES","CHIP_SIZES","getUniqueString","input","chip","CHIP_TOP_POSITION"],"mappings":";;;;;;;;;;;;;AAiIA,MAAA,YAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,6BAAAA,sBAAA;AAAA,IACA,SAAAC,MAAA;AAAA,IACA,QAAAC,KAAA;AAAA,IACA,sBAAAC,oBAAA;AAAA,EACA;AAAA,EAEA,QAAA,CAAAC,qBAAAA,OAAA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,cAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,eAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,MAAA,CAAA;AAAA,MACA,WAAA,mBAAA;AACA,eAAAC,kBAAAA,2BAAA,aAAA;AAAA,MACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,mBAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYA,SAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,gBAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,UAAA;AAAA,MACA,MAAA;AAAA,MACA,SA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AAA;AAAA,MACA,OAAA;AACA,QAAAA,OAAA,MAAA,WAAA;AAAA,MACA;AAAA,IACA;AAAA,IAEA,mBAAA;AACA,UAAA,KAAA,gBAAA,EAAA;AACA,UAAA,KAAA,cAAA,SAAA,KAAA,aAAA;AACA,aAAA,yBAAA;AACA,aAAA,MAAA,cAAA;AAAA,MACA,OAAA;AACA,aAAA,yBAAA;AAAA,MACA;AAAA,IACA;AAAA,IAEA,wBAAA;AACA,YAAAA,SAAA,KAAA;AACA,UAAA,CAAAA,OAAA;AACA,WAAA,qBAAAA,OAAA,sBAAA,EAAA;AAAA,IACA;AAAA,IAEA,MAAA,qBAAA;AACA,WAAA,eAAA;AACA,UAAA,KAAA,oBAAA;AACA,cAAA,KAAA;AACA,aAAA,gBAAA;AACA,aAAA,gBAAA;AAAA,MACA;AAAA,IACA;AAAA,IAEA,MAAA,sBAAA;AACA,WAAA,eAAA;AACA,UAAA,KAAA,oBAAA;AACA,cAAAA,SAAA,KAAA;AACA,YAAA,CAAAA,OAAA;AAEA,YAAA,CAAAA,OAAA,MAAA,YAAA;AACA;AAAA,QACA;AACA,aAAA,gBAAA;AACA,aAAA,mBAAAA,MAAA;AAAA,MACA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -380,6 +380,7 @@ const _sfc_main = {
380
380
  (_a = this.$refs.input) == null ? void 0 : _a.focus();
381
381
  },
382
382
  onComboboxSelect(i) {
383
+ if (this.loading) return;
383
384
  this.value = "";
384
385
  this.$emit("select", i);
385
386
  },
@@ -575,7 +576,7 @@ var __component__ = /* @__PURE__ */ normalizeComponent(
575
576
  _sfc_staticRenderFns,
576
577
  false,
577
578
  null,
578
- "08fa3e85"
579
+ "7eac7e22"
579
580
  );
580
581
  const combobox_multi_select = __component__.exports;
581
582
  export {