@dialpad/dialtone-vue 3.123.2 → 3.123.4

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 (39) hide show
  1. package/README.md +18 -0
  2. package/dist/common/emoji.cjs +4 -1
  3. package/dist/common/emoji.cjs.map +1 -1
  4. package/dist/common/emoji.js +4 -1
  5. package/dist/common/emoji.js.map +1 -1
  6. package/dist/dialtone-vue.cjs +1 -0
  7. package/dist/dialtone-vue.cjs.map +1 -1
  8. package/dist/dialtone-vue.js +2 -1
  9. package/dist/lib/datepicker.cjs +8 -4
  10. package/dist/lib/datepicker.cjs.map +1 -1
  11. package/dist/lib/datepicker.js +8 -4
  12. package/dist/lib/datepicker.js.map +1 -1
  13. package/dist/lib/message-input.cjs +32 -3
  14. package/dist/lib/message-input.cjs.map +1 -1
  15. package/dist/lib/message-input.js +32 -3
  16. package/dist/lib/message-input.js.map +1 -1
  17. package/dist/lib/rich-text-editor.cjs +271 -35
  18. package/dist/lib/rich-text-editor.cjs.map +1 -1
  19. package/dist/lib/rich-text-editor.js +272 -36
  20. package/dist/lib/rich-text-editor.js.map +1 -1
  21. package/dist/types/common/emoji/index.d.ts +1 -0
  22. package/dist/types/common/emoji/index.d.ts.map +1 -1
  23. package/dist/types/components/rich_text_editor/extensions/emoji/emoji.d.ts +0 -1
  24. package/dist/types/components/rich_text_editor/extensions/emoji/emoji.d.ts.map +1 -1
  25. package/dist/types/components/rich_text_editor/extensions/slash_command/SlashCommandComponent.vue.d.ts +73 -0
  26. package/dist/types/components/rich_text_editor/extensions/slash_command/SlashCommandComponent.vue.d.ts.map +1 -0
  27. package/dist/types/components/rich_text_editor/extensions/slash_command/SlashCommandSuggestion.vue.d.ts +17 -0
  28. package/dist/types/components/rich_text_editor/extensions/slash_command/SlashCommandSuggestion.vue.d.ts.map +1 -0
  29. package/dist/types/components/rich_text_editor/extensions/slash_command/slash_command.d.ts +2 -0
  30. package/dist/types/components/rich_text_editor/extensions/slash_command/slash_command.d.ts.map +1 -0
  31. package/dist/types/components/rich_text_editor/extensions/slash_command/suggestion.d.ts +12 -0
  32. package/dist/types/components/rich_text_editor/extensions/slash_command/suggestion.d.ts.map +1 -0
  33. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +38 -1
  34. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  35. package/dist/types/components/rich_text_editor/slash_command_suggestion.d.ts +15 -0
  36. package/dist/types/components/rich_text_editor/slash_command_suggestion.d.ts.map +1 -0
  37. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +38 -1
  38. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  39. package/package.json +6 -6
package/README.md CHANGED
@@ -32,6 +32,24 @@ or
32
32
  @import '@dialpad/dialtone-css';
33
33
  ```
34
34
 
35
+ And then import Dialtone Vue css for either Vue 2 or Vue 3:
36
+
37
+ - CSS
38
+
39
+ ```css
40
+ @import "@dialpad/dialtone/vue2/css";
41
+ /* Or */
42
+ @import "@dialpad/dialtone/vue3/css";
43
+ ```
44
+
45
+ - Javascript
46
+
47
+ ```js
48
+ import "@dialpad/dialtone/vue2/css";
49
+ /* Or */
50
+ import "@dialpad/dialtone/vue3/css";
51
+ ```
52
+
35
53
  Dialtone Vue components can be imported directly from the package. Some components also export named constants, which can be imported as well:
36
54
 
37
55
  ```js
@@ -10,6 +10,7 @@ exports.emojiFileExtensionSmall = ".png";
10
10
  exports.emojiImageUrlLarge = defaultEmojiAssetUrl;
11
11
  exports.emojiFileExtensionLarge = ".png";
12
12
  const emojiJson = dialtoneEmojis.emojisIndexed;
13
+ const emojiShortCodeRegex = new RegExp("(^| |(?<=:))(:\\w+:)", "g");
13
14
  function getEmojiData() {
14
15
  return emojiJson;
15
16
  }
@@ -121,6 +122,7 @@ function stringToUnicode(str) {
121
122
  return result;
122
123
  }
123
124
  function codeToEmojiData(code) {
125
+ code = code == null ? void 0 : code.trim();
124
126
  if (code.startsWith(":") && code.endsWith(":")) {
125
127
  return shortcodeToEmojiData(code);
126
128
  } else {
@@ -132,7 +134,7 @@ function codeToEmojiData(code) {
132
134
  }
133
135
  }
134
136
  function findShortCodes(textContent) {
135
- const shortcodes = textContent.match(/:\w+:/g);
137
+ const shortcodes = (textContent.match(emojiShortCodeRegex) || []).map((code) => code.trim());
136
138
  return filterValidShortCodes(shortcodes);
137
139
  }
138
140
  function filterValidShortCodes(shortcodes) {
@@ -147,6 +149,7 @@ function findEmojis(textContent) {
147
149
  exports.codeToEmojiData = codeToEmojiData;
148
150
  exports.defaultEmojiAssetUrl = defaultEmojiAssetUrl;
149
151
  exports.emojiJson = emojiJson;
152
+ exports.emojiShortCodeRegex = emojiShortCodeRegex;
150
153
  exports.emojiVersion = emojiVersion;
151
154
  exports.filterValidShortCodes = filterValidShortCodes;
152
155
  exports.findEmojis = findEmojis;
@@ -1 +1 @@
1
- {"version":3,"file":"emoji.cjs","sources":["../../common/emoji/index.js"],"sourcesContent":["import emojiRegex from 'emoji-regex';\nimport { emojisIndexed } from '@dialpad/dialtone-emojis';\n\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 = emojisIndexed;\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 if (code.startsWith(':') && code.endsWith(':')) {\n return shortcodeToEmojiData(code);\n } else {\n const unicodeString = unicodeToString(code);\n\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 = textContent.match(/:\\w+:/g);\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":["customEmojiAssetUrl","emojiImageUrlSmall","emojiFileExtensionSmall","emojiImageUrlLarge","emojiFileExtensionLarge","emojisIndexed"],"mappings":";;;;AAGY,MAAC,eAAe;AAChB,MAAC,uBAAuB,+CAA+C,eAAe;AACvFA,QAAAA,sBAAsB;AAGtBC,QAAAA,qBAAqB;AACrBC,QAAAA,0BAA0B;AAG1BC,QAAAA,qBAAqB;AACrBC,QAAAA,0BAA0B;AAEzB,MAAC,YAAYC,eAAc;AAEhC,SAAS,eAAgB;AAC9B,SAAO;AACT;AAEO,SAAS,sBAAuB,KAAK,gBAAgB,QAAQ;AAClE,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACtB,UAAM,MAAM;AAAA,EACb;AACDJ,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;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,UAAU,QAAQ,MAAM,QAAW;AACrC,UAAI,CAAC,iBAAiB,SAAS,QAAQ,GAAG;AACxC;AAAA,MACD;AAGD,gBAAU,QAAQ,IAAI;AAAA,IAC5B,OAA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ji-regex';\nimport { emojisIndexed } from '@dialpad/dialtone-emojis';\n\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 = emojisIndexed;\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\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":["customEmojiAssetUrl","emojiImageUrlSmall","emojiFileExtensionSmall","emojiImageUrlLarge","emojiFileExtensionLarge","emojisIndexed"],"mappings":";;;;AAGY,MAAC,eAAe;AAChB,MAAC,uBAAuB,+CAA+C,eAAe;AACvFA,QAAAA,sBAAsB;AAGtBC,QAAAA,qBAAqB;AACrBC,QAAAA,0BAA0B;AAG1BC,QAAAA,qBAAqB;AACrBC,QAAAA,0BAA0B;AAEzB,MAAC,YAAYC,eAAc;AAE3B,MAAC,sBAAsB,WAAuB,wBAAA,GAAA;AAEnD,SAAS,eAAgB;AAC9B,SAAO;AACT;AAEO,SAAS,sBAAuB,KAAK,gBAAgB,QAAQ;AAClE,MAAI,CAAC,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MAAI,KAAK,WAAW,GAAG,KAAK,KAAK,SAAS,GAAG,GAAG;AAC9C,WAAO,qBAAqB,IAAI;AAAA,EACpC,OAAS;AACL,UAAM,gBAAgB,gBAAgB,IAAI;AAE1C,UAAM,SAAS,UAAU,aAAa;AACtC,QAAI;AAAQ,aAAO,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,WAAY,CAAA,CAAC;AACtD,QAAM,SAAS,QAAQ,SAAS,QAAQ,IAAI,WAAS,MAAM,CAAC,CAAC,IAAI;AACjE,SAAO,IAAI,IAAI,MAAM;AACvB;;;;;;;;;;;;;;;;;;"}
@@ -8,6 +8,7 @@ let emojiFileExtensionSmall = ".png";
8
8
  let emojiImageUrlLarge = defaultEmojiAssetUrl;
9
9
  let emojiFileExtensionLarge = ".png";
10
10
  const emojiJson = emojisIndexed;
11
+ const emojiShortCodeRegex = new RegExp("(^| |(?<=:))(:\\w+:)", "g");
11
12
  function getEmojiData() {
12
13
  return emojiJson;
13
14
  }
@@ -119,6 +120,7 @@ function stringToUnicode(str) {
119
120
  return result;
120
121
  }
121
122
  function codeToEmojiData(code) {
123
+ code = code == null ? void 0 : code.trim();
122
124
  if (code.startsWith(":") && code.endsWith(":")) {
123
125
  return shortcodeToEmojiData(code);
124
126
  } else {
@@ -130,7 +132,7 @@ function codeToEmojiData(code) {
130
132
  }
131
133
  }
132
134
  function findShortCodes(textContent) {
133
- const shortcodes = textContent.match(/:\w+:/g);
135
+ const shortcodes = (textContent.match(emojiShortCodeRegex) || []).map((code) => code.trim());
134
136
  return filterValidShortCodes(shortcodes);
135
137
  }
136
138
  function filterValidShortCodes(shortcodes) {
@@ -151,6 +153,7 @@ export {
151
153
  emojiImageUrlLarge,
152
154
  emojiImageUrlSmall,
153
155
  emojiJson,
156
+ emojiShortCodeRegex,
154
157
  emojiVersion,
155
158
  filterValidShortCodes,
156
159
  findEmojis,
@@ -1 +1 @@
1
- {"version":3,"file":"emoji.js","sources":["../../common/emoji/index.js"],"sourcesContent":["import emojiRegex from 'emoji-regex';\nimport { emojisIndexed } from '@dialpad/dialtone-emojis';\n\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 = emojisIndexed;\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 if (code.startsWith(':') && code.endsWith(':')) {\n return shortcodeToEmojiData(code);\n } else {\n const unicodeString = unicodeToString(code);\n\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 = textContent.match(/:\\w+:/g);\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,eAAe;AAChB,MAAC,uBAAuB,+CAA+C,eAAe;AACxF,IAAC,sBAAsB;AAGvB,IAAC,qBAAqB;AACtB,IAAC,0BAA0B;AAG3B,IAAC,qBAAqB;AACtB,IAAC,0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EAC9D,CAAG;AACD,SAAO;AACT;AAGO,SAAS,gBAAiB,MAAM;AACrC,MAAI,KAAK,WAAW,GAAG,KAAK,KAAK,SAAS,GAAG,GAAG;AAC9C,WAAO,qBAAqB,IAAI;AAAA,EACpC,OAAS;AACL,UAAM,gBAAgB,gBAAgB,IAAI;AAE1C,UAAM,SAAS,UAAU,aAAa;AACtC,QAAI;AAAQ,aAAO,MAAM;AACzB,WAAO;AAAA,EACR;AACH;AAMO,SAAS,eAAgB,aAAa;AAC3C,QAAM,aAAa,YAAY,MAAM,QAAQ;AAC7C,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,WAAY,CAAA,CAAC;AACtD,QAAM,SAAS,QAAQ,SAAS,QAAQ,IAAI,WAAS,MAAM,CAAC,CAAC,IAAI;AACjE,SAAO,IAAI,IAAI,MAAM;AACvB;"}
1
+ {"version":3,"file":"emoji.js","sources":["../../common/emoji/index.js"],"sourcesContent":["import emojiRegex from 'emoji-regex';\nimport { emojisIndexed } from '@dialpad/dialtone-emojis';\n\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 = emojisIndexed;\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\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,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,UAA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M,SAAS,QAAQ,SAAS,QAAQ,IAAI,WAAS,MAAM,CAAC,CAAC,IAAI;AACjE,SAAO,IAAI,IAAI,MAAM;AACvB;"}
@@ -156,6 +156,7 @@ Object.defineProperty(exports, "emojiImageUrlSmall", {
156
156
  get: () => common_emoji.emojiImageUrlSmall
157
157
  });
158
158
  exports.emojiJson = common_emoji.emojiJson;
159
+ exports.emojiShortCodeRegex = common_emoji.emojiShortCodeRegex;
159
160
  exports.emojiVersion = common_emoji.emojiVersion;
160
161
  exports.filterValidShortCodes = common_emoji.filterValidShortCodes;
161
162
  exports.findEmojis = common_emoji.findEmojis;
@@ -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 { 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, emojiVersion, filterValidShortCodes, findEmojis, findShortCodes, getEmojiData, setCustomEmojiJson, setCustomEmojiUrl, setEmojiAssetUrlLarge, setEmojiAssetUrlSmall, shortcodeToEmojiData, stringToUnicode, unicodeToString, validateCustomEmojiJson } from "./common/emoji.js";
5
+ import { codeToEmojiData, customEmojiAssetUrl, defaultEmojiAssetUrl, emojiFileExtensionLarge, emojiFileExtensionSmall, emojiImageUrlLarge, emojiImageUrlSmall, emojiJson, 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 "./chunks/input-NmYDD5bn.js";
7
7
  import { InputGroupMixin } from "./chunks/input_group-jWnq2DJT.js";
8
8
  import { KeyboardNavigation } from "./chunks/keyboard_list_navigation-ScXhrxya.js";
@@ -331,6 +331,7 @@ export {
331
331
  emojiImageUrlLarge,
332
332
  emojiImageUrlSmall,
333
333
  emojiJson,
334
+ emojiShortCodeRegex,
334
335
  emojiVersion,
335
336
  filterFormattedMessages,
336
337
  filterValidShortCodes,
@@ -298,7 +298,8 @@ const _sfc_main$2 = {
298
298
  default: vue.withCtx(() => [
299
299
  vue.createVNode(vue.unref(lib_tooltip.DtTooltip), {
300
300
  message: __props.prevYearLabel,
301
- placement: "top"
301
+ placement: "top",
302
+ "fallback-placements": ["top-start", "auto"]
302
303
  }, {
303
304
  anchor: vue.withCtx(() => [
304
305
  vue.createVNode(vue.unref(lib_button.DtButton), {
@@ -330,7 +331,8 @@ const _sfc_main$2 = {
330
331
  }, 8, ["message"]),
331
332
  vue.createVNode(vue.unref(lib_tooltip.DtTooltip), {
332
333
  message: __props.prevMonthLabel,
333
- placement: "top"
334
+ placement: "top",
335
+ "fallback-placements": ["top-end", "auto"]
334
336
  }, {
335
337
  anchor: vue.withCtx(() => [
336
338
  vue.createVNode(vue.unref(lib_button.DtButton), {
@@ -373,7 +375,8 @@ const _sfc_main$2 = {
373
375
  default: vue.withCtx(() => [
374
376
  vue.createVNode(vue.unref(lib_tooltip.DtTooltip), {
375
377
  message: __props.nextMonthLabel,
376
- placement: "top"
378
+ placement: "top",
379
+ "fallback-placements": ["top-start", "auto"]
377
380
  }, {
378
381
  anchor: vue.withCtx(() => [
379
382
  vue.createVNode(vue.unref(lib_button.DtButton), {
@@ -405,7 +408,8 @@ const _sfc_main$2 = {
405
408
  }, 8, ["message"]),
406
409
  vue.createVNode(vue.unref(lib_tooltip.DtTooltip), {
407
410
  message: __props.nextYearLabel,
408
- placement: "top"
411
+ placement: "top",
412
+ "fallback-placements": ["top-end", "auto"]
409
413
  }, {
410
414
  anchor: vue.withCtx(() => [
411
415
  vue.createVNode(vue.unref(lib_button.DtButton), {
@@ -1 +1 @@
1
- {"version":3,"file":"datepicker.cjs","sources":["../../components/datepicker/datepicker_constants.js","../../components/datepicker/utils.js","../../components/datepicker/composables/useMonthYearPicker.js","../../components/datepicker/modules/month-year-picker.vue","../../components/datepicker/composables/useCalendar.js","../../components/datepicker/modules/calendar.vue","../../components/datepicker/datepicker.vue","../../components/datepicker/formatUtils.js"],"sourcesContent":["/**\n * Week start day\n * 0 - Sunday\n * 1 - Monday\n */\nexport const WEEK_START = 0;\n\nexport const MONTH_FORMAT = 'MMMM';\n\nexport const INTL_MONTH_FORMAT = 'long';\n","import {\n startOfWeek, addDays, getMonth, isEqual,\n addMonths, startOfMonth, getDay, getDate,\n subMonths, endOfMonth,\n} from 'date-fns';\nimport { WEEK_START } from '@/components/datepicker/datepicker_constants.js';\n\nconst _parsedGetDate = (value) => (value ? new Date(value) : new Date());\n\n/**\n * Get 7 days from the provided start date, month is used to check\n * whether the date is from the specified month or in the offset\n */\nconst getWeekDays = (startDay, month, selectedDay) => {\n const startDate = _parsedGetDate(JSON.parse(JSON.stringify(startDay)));\n const dates = [];\n for (let i = 0; i < 7; i++) {\n const next = addDays(startDate, i);\n const isNext = getMonth(next) !== month;\n dates.push({\n text: next.getDate(),\n value: next,\n currentMonth: !isNext,\n isFirstDayOfMonth: next.getDate() === 1 && !isNext,\n // will be selected if the date is the same as the selected day and is from the current month\n selected: selectedDay ? (next.getDate() === selectedDay && !isNext) : false,\n });\n }\n return dates;\n};\n\nconst isDateEqual = (date, dateToCompare) => {\n if (!date || !dateToCompare) {\n return false;\n }\n return isEqual(date, dateToCompare);\n};\n\n/**\n * Get days for the calendar to be displayed in a table grouped by weeks\n */\nexport const getCalendarDays = (month, year, selectedDay) => {\n const weeks = [];\n const firstDate = _parsedGetDate(new Date(year, month));\n const lastDate = _parsedGetDate(new Date(year, month + 1, 0));\n\n const weekStartsOn = WEEK_START;\n\n const firstDateInCalendar = startOfWeek(firstDate, { weekStartsOn });\n\n const addDaysToWeek = (date) => {\n const days = getWeekDays(date, month, selectedDay);\n\n weeks.push({ days });\n\n if (\n !weeks[weeks.length - 1].days.some((day) =>\n isDateEqual(day.value, lastDate),\n )\n ) {\n const nextDate = addDays(date, 7);\n addDaysToWeek(nextDate);\n }\n };\n\n addDaysToWeek(firstDateInCalendar);\n\n return weeks;\n};\n\n/**\n * Generate week day names based on locale and in order specified in week start\n */\nexport const getWeekDayNames = (locale, weekStart) => {\n // Get list in order from sun ... sat\n const days = [1, 2, 3, 4, 5, 6, 7].map((day) => {\n return new Intl.DateTimeFormat(locale, { weekday: 'short', timeZone: 'UTC' })\n .format(new Date(`2017-01-0${day}T00:00:00+00:00`))\n .slice(0, 2);\n });\n\n // Get days that are in order before specified week start\n const beforeWeekStart = days.slice(0, weekStart);\n // Get days that are in order after specified week start\n const afterWeekStart = days.slice(weekStart + 1, days.length);\n\n // return them in correct order\n return [days[weekStart]].concat(...afterWeekStart).concat(...beforeWeekStart);\n};\n\nexport const formatMonth = (month, monthFormat, locale) => {\n return new Intl.DateTimeFormat(locale, { month: monthFormat }).format(new Date(2000, month, 1));\n};\n\nexport const calculateNextFocusDate = (currentDate) => {\n const date = new Date(currentDate);\n const currentWeekday = getDay(date);\n const nextMonthDate = addMonths(date, 1);\n const nextMonthStart = startOfMonth(nextMonthDate);\n const nextMonthStartWeekday = getDay(nextMonthStart);\n\n const dayDifference = (currentWeekday - nextMonthStartWeekday + 7) % 7;\n\n // Add the difference in days to the first day of the next month\n const focusDate = addDays(nextMonthStart, dayDifference);\n\n // Returns only the day of the month\n return getDate(focusDate);\n};\n\nexport const calculatePrevFocusDate = (currentDate) => {\n const date = new Date(currentDate);\n const currentWeekday = getDay(date);\n\n // Move to the last day of the previous month\n const lastDayOfPrevMonth = endOfMonth(subMonths(date, 1));\n let focusDate = lastDayOfPrevMonth;\n\n // Adjust to the same weekday in the last week of the previous month\n while (getDay(focusDate) !== currentWeekday) {\n focusDate = addDays(focusDate, -1);\n }\n\n // Returns only the day of the month\n return getDate(focusDate);\n};\n","import { computed, ref, watch } from 'vue';\nimport { addMonths, getDate, getMonth, getYear, set, subMonths } from 'date-fns';\nimport { formatMonth, getCalendarDays } from '@/components/datepicker/utils.js';\n\nexport function useMonthYearPicker (props, emits) {\n const selectMonth = ref(getMonth(props.selectedDate));\n const selectYear = ref(getYear(props.selectedDate));\n const highlightedDay = ref(null);\n const focusPicker = ref(0);\n const focusRefs = ref([]);\n\n const calendarDays = computed(() => {\n return getCalendarDays(selectMonth.value, selectYear.value, highlightedDay.value);\n });\n\n const formattedMonth = computed(() => {\n return (month, format, locale) => formatMonth(month, format, locale);\n });\n\n watch(selectMonth, () => {\n highlightDay();\n emits('calendar-days', calendarDays.value);\n }, { immediate: true });\n\n watch(selectYear, () => {\n highlightDay();\n emits('calendar-days', calendarDays.value);\n }, { immediate: true });\n\n function setDayRef (el) {\n if (!focusRefs.value.includes(el)) {\n focusRefs.value.push(el);\n }\n }\n\n function focusMonthYearPicker () {\n focusRefs.value[0].$el.focus();\n }\n\n function handleKeyDown (event) {\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n if (focusPicker.value === 0) {\n focusPicker.value = 3;\n focusRefs.value[focusPicker.value].$el.focus();\n } else {\n focusPicker.value--;\n focusRefs.value[focusPicker.value].$el.focus();\n }\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (focusPicker.value === 3) {\n focusPicker.value = 0;\n focusRefs.value[focusPicker.value].$el.focus();\n } else {\n focusPicker.value++;\n focusRefs.value[focusPicker.value].$el.focus();\n }\n break;\n\n case 'ArrowDown':\n event.preventDefault();\n emits('focus-first-day');\n break;\n\n case 'Tab':\n event.preventDefault();\n emits('focus-first-day');\n break;\n\n case 'Escape':\n emits('close-datepicker');\n break;\n }\n }\n\n function highlightDay () {\n const year = getYear(props.selectedDate);\n const month = getMonth(props.selectedDate);\n\n if (year !== selectYear.value || month !== selectMonth.value) {\n highlightedDay.value = null;\n } else {\n highlightedDay.value = getDate(props.selectedDate);\n }\n }\n\n function changeMonth (value) {\n // Adjust year when changing from January to December or vice versa\n if ((selectMonth.value === 0 && value === -1) || (selectMonth.value === 11 && value === 1)) {\n selectYear.value += value;\n }\n\n // Calculate the new date by adding or subtracting months\n const initialDate = set(props.selectedDate, { month: selectMonth.value, year: selectYear.value });\n const newDate = value === 1 ? addMonths(initialDate, 1) : subMonths(initialDate, 1);\n\n // Update the selected month\n selectMonth.value = getMonth(newDate);\n }\n\n function changeYear (value) {\n selectYear.value = selectYear.value + value;\n }\n\n function goToNextMonth () {\n changeMonth(1);\n }\n\n function goToPrevMonth () {\n changeMonth(-1);\n }\n\n return {\n selectMonth,\n selectYear,\n formattedMonth,\n setDayRef,\n focusMonthYearPicker,\n handleKeyDown,\n changeMonth,\n changeYear,\n goToNextMonth,\n goToPrevMonth,\n };\n}\n","<template>\n <dt-stack\n direction=\"row\"\n class=\"d-datepicker__month-year\"\n gap=\"300\"\n >\n <dt-stack\n as=\"nav\"\n direction=\"row\"\n gap=\"200\"\n class=\"d-datepicker__nav\"\n >\n <dt-tooltip\n :message=\"prevYearLabel\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"prevYearButton\"\n :ref=\"el => { if (el) setDayRef(el) }\"\n size=\"xs\"\n importance=\"clear\"\n kind=\"muted\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n type=\"button\"\n :aria-label=\"`${changeToLabel} ${prevYearLabel} ${selectYear - 1}`\"\n @click=\"changeYear(-1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon\n name=\"chevrons-left\"\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n <dt-tooltip\n :message=\"prevMonthLabel\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"prevMonthButton\"\n :ref=\"el => { if (el) setDayRef(el) }\"\n size=\"xs\"\n importance=\"clear\"\n kind=\"muted\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n type=\"button\"\n :aria-label=\"\n `${changeToLabel} ${prevMonthLabel} ${formattedMonth(selectMonth - 1, INTL_MONTH_FORMAT, locale)}`\n \"\n @click=\"changeMonth(-1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon\n name=\"chevron-left\"\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n </dt-stack>\n <div\n id=\"calendar-heading\"\n class=\"d-datepicker__month-year-title\"\n >\n {{ formattedMonth(selectMonth, INTL_MONTH_FORMAT, locale) }}\n\n {{ selectYear }}\n </div>\n <dt-stack\n as=\"nav\"\n direction=\"row\"\n gap=\"200\"\n class=\"d-datepicker__nav\"\n >\n <dt-tooltip\n :message=\"nextMonthLabel\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"nextMonthButton\"\n :ref=\"el => { if (el) setDayRef(el) }\"\n size=\"xs\"\n importance=\"clear\"\n kind=\"muted\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n type=\"button\"\n :aria-label=\"\n `${changeToLabel} ${nextMonthLabel} ${formattedMonth(selectMonth + 1, INTL_MONTH_FORMAT, locale)}`\n \"\n @click=\"changeMonth(1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon\n name=\"chevron-right\"\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n <dt-tooltip\n :message=\"nextYearLabel\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"nextYearButton\"\n :ref=\"el => { if (el) setDayRef(el) }\"\n size=\"xs\"\n importance=\"clear\"\n kind=\"muted\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n type=\"button\"\n :aria-label=\"`${changeToLabel} ${nextYearLabel} ${selectYear + 1}`\"\n @click=\"changeYear(1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon\n name=\"chevrons-right\"\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n </dt-stack>\n </dt-stack>\n</template>\n\n<script setup>\nimport { DtIcon } from '@/components/icon';\nimport { DtStack } from '@/components/stack';\nimport { DtButton } from '@/components/button';\nimport { DtTooltip } from '@/components/tooltip';\nimport { INTL_MONTH_FORMAT } from '../datepicker_constants';\nimport { onMounted } from 'vue';\nimport { useMonthYearPicker } from '@/components/datepicker/composables/useMonthYearPicker.js';\n\nconst props = defineProps({\n locale: {\n type: String,\n required: true,\n },\n\n prevMonthLabel: {\n type: String,\n required: true,\n },\n\n nextMonthLabel: {\n type: String,\n required: true,\n },\n\n prevYearLabel: {\n type: String,\n required: true,\n },\n\n nextYearLabel: {\n type: String,\n required: true,\n },\n\n changeToLabel: {\n type: String,\n required: true,\n },\n\n selectedDate: {\n type: Date,\n required: true,\n },\n});\nconst emits = defineEmits([\n /**\n * Will retrieve the calendar days of the given date\n *\n * @event calendar-days\n * @type {Array}\n */\n 'calendar-days',\n\n /**\n * Will focus first day in calendar\n *\n * @event focus-first-day\n */\n 'focus-first-day',\n\n /**\n * Will focus last day in calendar\n *\n * @event focus-last-day\n */\n 'focus-last-day',\n\n /**\n * Will close the datepicker\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n]);\n\nconst {\n selectMonth,\n selectYear,\n formattedMonth,\n setDayRef,\n focusMonthYearPicker,\n handleKeyDown,\n changeMonth,\n changeYear,\n goToNextMonth,\n goToPrevMonth,\n} = useMonthYearPicker(props, emits);\n\nonMounted(() => {\n focusMonthYearPicker();\n});\n\ndefineExpose({\n focusMonthYearPicker,\n goToNextMonth,\n goToPrevMonth,\n});\n</script>\n","import { computed, ref, watch, nextTick } from 'vue';\nimport { getWeekDayNames, calculateNextFocusDate, calculatePrevFocusDate } from '@/components/datepicker/utils.js';\nimport { MONTH_FORMAT, WEEK_START } from '@/components/datepicker/datepicker_constants.js';\nimport { format, getYear } from 'date-fns';\n\nexport function useCalendar (props, emits) {\n const selectedDay = ref(null);\n const focusDay = ref(0);\n const daysRef = ref([]);\n\n const weekDays = computed(() => {\n return getWeekDayNames(props.locale, WEEK_START);\n });\n\n watch(() => props.calendarDays, () => {\n focusDay.value = 0;\n daysRef.value = [];\n selectedDay.value = null;\n });\n\n function dayAriaLabel (day) {\n return `${props.selectDayLabel} ${day.text} ${format(day.value, MONTH_FORMAT)} ${getYear(day.value)}`;\n }\n\n function setDayRef (el, day) {\n if (!daysRef.value.some(day => day.el === el) && day.currentMonth) {\n daysRef.value.push({ el, day });\n }\n }\n\n function handleKeyDown (event) {\n switch (event.key) {\n case 'ArrowUp':\n event.preventDefault();\n focusDay.value -= 7;\n try {\n daysRef.value[focusDay.value].el.$el.focus();\n } catch (error) {\n const prevFocusDate = calculatePrevFocusDate(daysRef.value[focusDay.value + 7].day.value);\n emits('go-to-prev-month');\n\n nextTick(() => {\n daysRef.value[prevFocusDate - 1].el.$el.focus();\n focusDay.value += prevFocusDate - 1;\n });\n }\n break;\n\n case 'ArrowDown':\n event.preventDefault();\n focusDay.value += 7;\n try {\n daysRef.value[focusDay.value].el.$el.focus();\n } catch (error) {\n const nextFocusDate = calculateNextFocusDate(daysRef.value[focusDay.value - 7].day.value);\n emits('go-to-next-month');\n\n nextTick(() => {\n daysRef.value[nextFocusDate - 1].el.$el.focus();\n focusDay.value += nextFocusDate - 1;\n });\n }\n break;\n\n case 'ArrowLeft':\n event.preventDefault();\n if (focusDay.value > 0) {\n focusDay.value -= 1;\n daysRef.value[focusDay.value].el.$el.focus();\n } else {\n // if we are on month first day, jump to last day of prev month\n emits('go-to-prev-month');\n focusLastDay();\n }\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (focusDay.value < daysRef.value.length - 1) {\n focusDay.value += 1;\n daysRef.value[focusDay.value].el.$el.focus();\n } else {\n // if we are on month last day, jump to first day of next month\n emits('go-to-next-month');\n\n focusFirstDay();\n }\n break;\n\n case 'Tab':\n event.preventDefault();\n emits('focus-month-year-picker');\n break;\n\n case 'Escape':\n emits('close-datepicker');\n break;\n }\n }\n\n function focusFirstDay () {\n focusDay.value = 0;\n\n nextTick(() => {\n daysRef.value[focusDay.value].el.$el.focus();\n });\n }\n\n function focusLastDay () {\n nextTick(() => {\n focusDay.value = daysRef.value.length - 1;\n daysRef.value[focusDay.value].el.$el.focus();\n });\n }\n\n function selectDay (day) {\n if (!day.currentMonth) { return; }\n\n // local selectedDay is updated when a day is selected\n selectedDay.value = day.text;\n emits('select-date', day.value);\n }\n\n return {\n selectedDay,\n weekDays,\n dayAriaLabel,\n setDayRef,\n handleKeyDown,\n focusFirstDay,\n selectDay,\n };\n}\n","<!-- eslint-disable vue/multi-word-component-names -->\n<template>\n <table\n class=\"d-datepicker__calendar\"\n aria-labelledby=\"calendar-heading\"\n >\n <thead>\n <tr>\n <th\n v-for=\"day in weekDays\"\n :key=\"day\"\n scope=\"col\"\n class=\"d-datepicker__cell d-datepicker__cell--header\"\n >\n <span\n class=\"d-datepicker__weekday\"\n :title=\"day\"\n :aria-label=\"day\"\n > {{ day }}</span>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n v-for=\"(week, indexWeek) in calendarDays\"\n :key=\"indexWeek\"\n >\n <td\n v-for=\"(day, indexDays) in week.days\"\n :key=\"indexWeek + indexDays\"\n class=\"d-datepicker__cell\"\n role=\"listbox\"\n >\n <dt-button\n :ref=\"el => { if (el) setDayRef(el, day) }\"\n class=\"d-datepicker__day\"\n :circle=\"true\"\n size=\"sm\"\n importance=\"clear\"\n :disabled=\"!day.currentMonth\"\n :class=\"{\n 'd-datepicker__day--disabled': !day.currentMonth,\n 'd-datepicker__day--selected': selectedDay\n ? ((day.text === selectedDay) && day.currentMonth)\n : day.selected,\n }\"\n type=\"button\"\n :aria-selected=\"!!selectedDay ? ((day.text === selectedDay) && day.currentMonth) : day.selected\"\n :aria-label=\"dayAriaLabel(day)\"\n role=\"option\"\n @click=\"selectDay(day)\"\n @keydown=\"handleKeyDown($event)\"\n >\n {{ day.text }}\n </dt-button>\n </td>\n </tr>\n </tbody>\n </table>\n</template>\n\n<script setup>\nimport { useCalendar } from '@/components/datepicker/composables/useCalendar.js';\nimport { DtButton } from '@/components/button';\n\nconst props = defineProps({\n calendarDays: {\n type: Array,\n required: true,\n },\n\n locale: {\n type: String,\n required: true,\n },\n\n selectDayLabel: {\n type: String,\n required: true,\n },\n});\n\nconst emits = defineEmits([\n /**\n * Event fired when a date is selected\n *\n * @event select-date\n * @type {Date}\n */\n 'select-date',\n\n /**\n * Will focus the month and year picker\n *\n * @event focus-month-year-picker\n */\n 'focus-month-year-picker',\n\n /**\n * Will close the datepicker\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n\n /**\n * Will go to the next month\n *\n * @event go-to-next-month\n */\n 'go-to-next-month',\n\n /**\n * Will go to the previous month\n *\n * @event go-to-prev-month\n */\n 'go-to-prev-month',\n]);\n\nconst {\n selectedDay,\n weekDays,\n dayAriaLabel,\n setDayRef,\n handleKeyDown,\n focusFirstDay,\n selectDay,\n} = useCalendar(props, emits);\n\ndefineExpose({\n focusFirstDay,\n});\n</script>\n","<!-- eslint-disable vue/multi-word-component-names -->\n<template>\n <dt-stack\n class=\"d-datepicker\"\n gap=\"400\"\n >\n <div class=\"d-datepicker__hd\">\n <month-year-picker\n ref=\"monthYearPicker\"\n :locale=\"locale\"\n :prev-month-label=\"prevMonthLabel\"\n :next-month-label=\"nextMonthLabel\"\n :prev-year-label=\"prevYearLabel\"\n :next-year-label=\"nextYearLabel\"\n :change-to-label=\"changeToLabel\"\n :selected-date=\"selectedDate\"\n @calendar-days=\"updateCalendarDays\"\n @focus-first-day=\"$refs.calendar.focusFirstDay()\"\n @focus-last-day=\"$refs.calendar.focusLastDay()\"\n @close-datepicker=\"$emit('close-datepicker')\"\n />\n </div>\n <div class=\"d-datepicker__bd\">\n <calendar\n ref=\"calendar\"\n :locale=\"locale\"\n :calendar-days=\"calendarDays\"\n :select-day-label=\"selectDayLabel\"\n @select-date=\"$emit('selected-date', $event)\"\n @focus-month-year-picker=\"$refs.monthYearPicker.focusMonthYearPicker()\"\n @close-datepicker=\"$emit('close-datepicker')\"\n @go-to-next-month=\"$refs.monthYearPicker.goToNextMonth()\"\n @go-to-prev-month=\"$refs.monthYearPicker.goToPrevMonth()\"\n />\n </div>\n </dt-stack>\n</template>\n\n<script setup>\nimport MonthYearPicker from './modules/month-year-picker.vue';\nimport Calendar from './modules/calendar.vue';\nimport { DtStack } from '@/components/stack';\n\nimport { ref } from 'vue';\n\ndefineProps({\n /**\n * Label for the previous month button\n *\n * @type {String}\n * @example 'Previous month'\n */\n prevMonthLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the next month button\n *\n * @type {String}\n * @example 'Next month'\n */\n nextMonthLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the previous year button\n *\n * @type {String}\n * @example 'Previous year'\n */\n prevYearLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the next year button\n *\n * @type {String}\n * @example 'Next year'\n */\n nextYearLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the select day button\n *\n * @type {String}\n * @example 'Select day'\n */\n selectDayLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the change to button\n *\n * @type {String}\n * @example 'Change to'\n */\n changeToLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Locale for the calendar\n *\n * @type {String}\n */\n locale: {\n type: String,\n default: 'en-US',\n },\n\n /**\n * Selected date\n *\n * @type {Date}\n */\n selectedDate: {\n type: Date,\n default: () => (new Date()),\n },\n});\n\ndefineEmits([\n /**\n * Event fired when a date is selected\n *\n * @event selected-date\n * @type {Date}\n */\n 'selected-date',\n\n /**\n * Event fired when user presses the esc key\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n]);\n\nconst calendarDays = ref([]);\n\nfunction updateCalendarDays (days) {\n calendarDays.value = days;\n}\n</script>\n","export function formatLong (date, locale = 'default') {\n return new Intl.DateTimeFormat(locale, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }).format(date);\n}\n\nexport function formatMedium (date, locale = 'default') {\n return new Intl.DateTimeFormat(locale, { year: 'numeric', month: 'long', day: 'numeric' }).format(date);\n}\n\nexport function formatShort (date, locale = 'default', showWeekday = true) {\n const options = showWeekday ? { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' } : { year: 'numeric', month: 'short', day: 'numeric' };\n return new Intl.DateTimeFormat(locale, options).format(date);\n}\n\nexport function formatNoYear (date, locale = 'default', abbreviated = false) {\n const monthFormat = abbreviated ? 'short' : 'long';\n return new Intl.DateTimeFormat(locale, { month: monthFormat, day: 'numeric' }).format(date);\n}\n\nexport function formatNumerical (date, locale = 'default') {\n return new Intl.DateTimeFormat(locale, { year: '2-digit', month: '2-digit', day: '2-digit' }).format(date);\n}\n\nexport default {\n formatLong,\n formatMedium,\n formatShort,\n formatNoYear,\n formatNumerical,\n};\n"],"names":["addDays","getMonth","isEqual","startOfWeek","getDay","addMonths","startOfMonth","getDate","endOfMonth","subMonths","ref","getYear","computed","watch","set","onMounted","format","day","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;AAKO,MAAM,aAAa;AAEnB,MAAM,eAAe;AAErB,MAAM,oBAAoB;ACFjC,MAAM,iBAAiB,CAAC,UAAW,QAAQ,IAAI,KAAK,KAAK,IAAI,oBAAI,KAAI;AAMrE,MAAM,cAAc,CAAC,UAAU,OAAO,gBAAgB;AACpD,QAAM,YAAY,eAAe,KAAK,MAAM,KAAK,UAAU,QAAQ,CAAC,CAAC;AACrE,QAAM,QAAQ,CAAA;AACd,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,UAAM,OAAOA,QAAAA,QAAQ,WAAW,CAAC;AACjC,UAAM,SAASC,QAAAA,SAAS,IAAI,MAAM;AAClC,UAAM,KAAK;AAAA,MACT,MAAM,KAAK,QAAS;AAAA,MACpB,OAAO;AAAA,MACP,cAAc,CAAC;AAAA,MACf,mBAAmB,KAAK,cAAc,KAAK,CAAC;AAAA;AAAA,MAE5C,UAAU,cAAe,KAAK,QAAS,MAAK,eAAe,CAAC,SAAU;AAAA,IAC5E,CAAK;AAAA,EACF;AACD,SAAO;AACT;AAEA,MAAM,cAAc,CAAC,MAAM,kBAAkB;AAC3C,MAAI,CAAC,QAAQ,CAAC,eAAe;AAC3B,WAAO;AAAA,EACR;AACD,SAAOC,QAAO,QAAC,MAAM,aAAa;AACpC;AAKO,MAAM,kBAAkB,CAAC,O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O,SAAS,KAAK,UAAW,IAAG,EAAE,MAAM,WAAW,OAAO,SAAS,KAAK;AAC9I,SAAO,IAAI,KAAK,eAAe,QAAQ,OAAO,EAAE,OAAO,IAAI;AAC7D;AAEO,SAAS,aAAc,MAAM,SAAS,WAAW,cAAc,OAAO;AAC3E,QAAM,cAAc,cAAc,UAAU;AAC5C,SAAO,IAAI,KAAK,eAAe,QAAQ,EAAE,OAAO,aAAa,KAAK,UAAW,CAAA,EAAE,OAAO,IAAI;AAC5F;AAEO,SAAS,gBAAiB,MAAM,SAAS,WAAW;AACzD,SAAO,IAAI,KAAK,eAAe,QAAQ,EAAE,MAAM,WAAW,OAAO,WAAW,KAAK,UAAS,CAAE,EAAE,OAAO,IAAI;AAC3G;;;;;;;"}
1
+ {"version":3,"file":"datepicker.cjs","sources":["../../components/datepicker/datepicker_constants.js","../../components/datepicker/utils.js","../../components/datepicker/composables/useMonthYearPicker.js","../../components/datepicker/modules/month-year-picker.vue","../../components/datepicker/composables/useCalendar.js","../../components/datepicker/modules/calendar.vue","../../components/datepicker/datepicker.vue","../../components/datepicker/formatUtils.js"],"sourcesContent":["/**\n * Week start day\n * 0 - Sunday\n * 1 - Monday\n */\nexport const WEEK_START = 0;\n\nexport const MONTH_FORMAT = 'MMMM';\n\nexport const INTL_MONTH_FORMAT = 'long';\n","import {\n startOfWeek, addDays, getMonth, isEqual,\n addMonths, startOfMonth, getDay, getDate,\n subMonths, endOfMonth,\n} from 'date-fns';\nimport { WEEK_START } from '@/components/datepicker/datepicker_constants.js';\n\nconst _parsedGetDate = (value) => (value ? new Date(value) : new Date());\n\n/**\n * Get 7 days from the provided start date, month is used to check\n * whether the date is from the specified month or in the offset\n */\nconst getWeekDays = (startDay, month, selectedDay) => {\n const startDate = _parsedGetDate(JSON.parse(JSON.stringify(startDay)));\n const dates = [];\n for (let i = 0; i < 7; i++) {\n const next = addDays(startDate, i);\n const isNext = getMonth(next) !== month;\n dates.push({\n text: next.getDate(),\n value: next,\n currentMonth: !isNext,\n isFirstDayOfMonth: next.getDate() === 1 && !isNext,\n // will be selected if the date is the same as the selected day and is from the current month\n selected: selectedDay ? (next.getDate() === selectedDay && !isNext) : false,\n });\n }\n return dates;\n};\n\nconst isDateEqual = (date, dateToCompare) => {\n if (!date || !dateToCompare) {\n return false;\n }\n return isEqual(date, dateToCompare);\n};\n\n/**\n * Get days for the calendar to be displayed in a table grouped by weeks\n */\nexport const getCalendarDays = (month, year, selectedDay) => {\n const weeks = [];\n const firstDate = _parsedGetDate(new Date(year, month));\n const lastDate = _parsedGetDate(new Date(year, month + 1, 0));\n\n const weekStartsOn = WEEK_START;\n\n const firstDateInCalendar = startOfWeek(firstDate, { weekStartsOn });\n\n const addDaysToWeek = (date) => {\n const days = getWeekDays(date, month, selectedDay);\n\n weeks.push({ days });\n\n if (\n !weeks[weeks.length - 1].days.some((day) =>\n isDateEqual(day.value, lastDate),\n )\n ) {\n const nextDate = addDays(date, 7);\n addDaysToWeek(nextDate);\n }\n };\n\n addDaysToWeek(firstDateInCalendar);\n\n return weeks;\n};\n\n/**\n * Generate week day names based on locale and in order specified in week start\n */\nexport const getWeekDayNames = (locale, weekStart) => {\n // Get list in order from sun ... sat\n const days = [1, 2, 3, 4, 5, 6, 7].map((day) => {\n return new Intl.DateTimeFormat(locale, { weekday: 'short', timeZone: 'UTC' })\n .format(new Date(`2017-01-0${day}T00:00:00+00:00`))\n .slice(0, 2);\n });\n\n // Get days that are in order before specified week start\n const beforeWeekStart = days.slice(0, weekStart);\n // Get days that are in order after specified week start\n const afterWeekStart = days.slice(weekStart + 1, days.length);\n\n // return them in correct order\n return [days[weekStart]].concat(...afterWeekStart).concat(...beforeWeekStart);\n};\n\nexport const formatMonth = (month, monthFormat, locale) => {\n return new Intl.DateTimeFormat(locale, { month: monthFormat }).format(new Date(2000, month, 1));\n};\n\nexport const calculateNextFocusDate = (currentDate) => {\n const date = new Date(currentDate);\n const currentWeekday = getDay(date);\n const nextMonthDate = addMonths(date, 1);\n const nextMonthStart = startOfMonth(nextMonthDate);\n const nextMonthStartWeekday = getDay(nextMonthStart);\n\n const dayDifference = (currentWeekday - nextMonthStartWeekday + 7) % 7;\n\n // Add the difference in days to the first day of the next month\n const focusDate = addDays(nextMonthStart, dayDifference);\n\n // Returns only the day of the month\n return getDate(focusDate);\n};\n\nexport const calculatePrevFocusDate = (currentDate) => {\n const date = new Date(currentDate);\n const currentWeekday = getDay(date);\n\n // Move to the last day of the previous month\n const lastDayOfPrevMonth = endOfMonth(subMonths(date, 1));\n let focusDate = lastDayOfPrevMonth;\n\n // Adjust to the same weekday in the last week of the previous month\n while (getDay(focusDate) !== currentWeekday) {\n focusDate = addDays(focusDate, -1);\n }\n\n // Returns only the day of the month\n return getDate(focusDate);\n};\n","import { computed, ref, watch } from 'vue';\nimport { addMonths, getDate, getMonth, getYear, set, subMonths } from 'date-fns';\nimport { formatMonth, getCalendarDays } from '@/components/datepicker/utils.js';\n\nexport function useMonthYearPicker (props, emits) {\n const selectMonth = ref(getMonth(props.selectedDate));\n const selectYear = ref(getYear(props.selectedDate));\n const highlightedDay = ref(null);\n const focusPicker = ref(0);\n const focusRefs = ref([]);\n\n const calendarDays = computed(() => {\n return getCalendarDays(selectMonth.value, selectYear.value, highlightedDay.value);\n });\n\n const formattedMonth = computed(() => {\n return (month, format, locale) => formatMonth(month, format, locale);\n });\n\n watch(selectMonth, () => {\n highlightDay();\n emits('calendar-days', calendarDays.value);\n }, { immediate: true });\n\n watch(selectYear, () => {\n highlightDay();\n emits('calendar-days', calendarDays.value);\n }, { immediate: true });\n\n function setDayRef (el) {\n if (!focusRefs.value.includes(el)) {\n focusRefs.value.push(el);\n }\n }\n\n function focusMonthYearPicker () {\n focusRefs.value[0].$el.focus();\n }\n\n function handleKeyDown (event) {\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n if (focusPicker.value === 0) {\n focusPicker.value = 3;\n focusRefs.value[focusPicker.value].$el.focus();\n } else {\n focusPicker.value--;\n focusRefs.value[focusPicker.value].$el.focus();\n }\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (focusPicker.value === 3) {\n focusPicker.value = 0;\n focusRefs.value[focusPicker.value].$el.focus();\n } else {\n focusPicker.value++;\n focusRefs.value[focusPicker.value].$el.focus();\n }\n break;\n\n case 'ArrowDown':\n event.preventDefault();\n emits('focus-first-day');\n break;\n\n case 'Tab':\n event.preventDefault();\n emits('focus-first-day');\n break;\n\n case 'Escape':\n emits('close-datepicker');\n break;\n }\n }\n\n function highlightDay () {\n const year = getYear(props.selectedDate);\n const month = getMonth(props.selectedDate);\n\n if (year !== selectYear.value || month !== selectMonth.value) {\n highlightedDay.value = null;\n } else {\n highlightedDay.value = getDate(props.selectedDate);\n }\n }\n\n function changeMonth (value) {\n // Adjust year when changing from January to December or vice versa\n if ((selectMonth.value === 0 && value === -1) || (selectMonth.value === 11 && value === 1)) {\n selectYear.value += value;\n }\n\n // Calculate the new date by adding or subtracting months\n const initialDate = set(props.selectedDate, { month: selectMonth.value, year: selectYear.value });\n const newDate = value === 1 ? addMonths(initialDate, 1) : subMonths(initialDate, 1);\n\n // Update the selected month\n selectMonth.value = getMonth(newDate);\n }\n\n function changeYear (value) {\n selectYear.value = selectYear.value + value;\n }\n\n function goToNextMonth () {\n changeMonth(1);\n }\n\n function goToPrevMonth () {\n changeMonth(-1);\n }\n\n return {\n selectMonth,\n selectYear,\n formattedMonth,\n setDayRef,\n focusMonthYearPicker,\n handleKeyDown,\n changeMonth,\n changeYear,\n goToNextMonth,\n goToPrevMonth,\n };\n}\n","<template>\n <dt-stack\n direction=\"row\"\n class=\"d-datepicker__month-year\"\n gap=\"300\"\n >\n <dt-stack\n as=\"nav\"\n direction=\"row\"\n gap=\"200\"\n class=\"d-datepicker__nav\"\n >\n <dt-tooltip\n :message=\"prevYearLabel\"\n placement=\"top\"\n :fallback-placements=\"['top-start', 'auto']\"\n >\n <template #anchor>\n <dt-button\n id=\"prevYearButton\"\n :ref=\"el => { if (el) setDayRef(el) }\"\n size=\"xs\"\n importance=\"clear\"\n kind=\"muted\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n type=\"button\"\n :aria-label=\"`${changeToLabel} ${prevYearLabel} ${selectYear - 1}`\"\n @click=\"changeYear(-1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon\n name=\"chevrons-left\"\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n <dt-tooltip\n :message=\"prevMonthLabel\"\n placement=\"top\"\n :fallback-placements=\"['top-end', 'auto']\"\n >\n <template #anchor>\n <dt-button\n id=\"prevMonthButton\"\n :ref=\"el => { if (el) setDayRef(el) }\"\n size=\"xs\"\n importance=\"clear\"\n kind=\"muted\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n type=\"button\"\n :aria-label=\"\n `${changeToLabel} ${prevMonthLabel} ${formattedMonth(selectMonth - 1, INTL_MONTH_FORMAT, locale)}`\n \"\n @click=\"changeMonth(-1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon\n name=\"chevron-left\"\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n </dt-stack>\n <div\n id=\"calendar-heading\"\n class=\"d-datepicker__month-year-title\"\n >\n {{ formattedMonth(selectMonth, INTL_MONTH_FORMAT, locale) }}\n\n {{ selectYear }}\n </div>\n <dt-stack\n as=\"nav\"\n direction=\"row\"\n gap=\"200\"\n class=\"d-datepicker__nav\"\n >\n <dt-tooltip\n :message=\"nextMonthLabel\"\n placement=\"top\"\n :fallback-placements=\"['top-start', 'auto']\"\n >\n <template #anchor>\n <dt-button\n id=\"nextMonthButton\"\n :ref=\"el => { if (el) setDayRef(el) }\"\n size=\"xs\"\n importance=\"clear\"\n kind=\"muted\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n type=\"button\"\n :aria-label=\"\n `${changeToLabel} ${nextMonthLabel} ${formattedMonth(selectMonth + 1, INTL_MONTH_FORMAT, locale)}`\n \"\n @click=\"changeMonth(1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon\n name=\"chevron-right\"\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n <dt-tooltip\n :message=\"nextYearLabel\"\n placement=\"top\"\n :fallback-placements=\"['top-end', 'auto']\"\n >\n <template #anchor>\n <dt-button\n id=\"nextYearButton\"\n :ref=\"el => { if (el) setDayRef(el) }\"\n size=\"xs\"\n importance=\"clear\"\n kind=\"muted\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n type=\"button\"\n :aria-label=\"`${changeToLabel} ${nextYearLabel} ${selectYear + 1}`\"\n @click=\"changeYear(1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon\n name=\"chevrons-right\"\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n </dt-stack>\n </dt-stack>\n</template>\n\n<script setup>\nimport { DtIcon } from '@/components/icon';\nimport { DtStack } from '@/components/stack';\nimport { DtButton } from '@/components/button';\nimport { DtTooltip } from '@/components/tooltip';\nimport { INTL_MONTH_FORMAT } from '../datepicker_constants';\nimport { onMounted } from 'vue';\nimport { useMonthYearPicker } from '@/components/datepicker/composables/useMonthYearPicker.js';\n\nconst props = defineProps({\n locale: {\n type: String,\n required: true,\n },\n\n prevMonthLabel: {\n type: String,\n required: true,\n },\n\n nextMonthLabel: {\n type: String,\n required: true,\n },\n\n prevYearLabel: {\n type: String,\n required: true,\n },\n\n nextYearLabel: {\n type: String,\n required: true,\n },\n\n changeToLabel: {\n type: String,\n required: true,\n },\n\n selectedDate: {\n type: Date,\n required: true,\n },\n});\nconst emits = defineEmits([\n /**\n * Will retrieve the calendar days of the given date\n *\n * @event calendar-days\n * @type {Array}\n */\n 'calendar-days',\n\n /**\n * Will focus first day in calendar\n *\n * @event focus-first-day\n */\n 'focus-first-day',\n\n /**\n * Will focus last day in calendar\n *\n * @event focus-last-day\n */\n 'focus-last-day',\n\n /**\n * Will close the datepicker\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n]);\n\nconst {\n selectMonth,\n selectYear,\n formattedMonth,\n setDayRef,\n focusMonthYearPicker,\n handleKeyDown,\n changeMonth,\n changeYear,\n goToNextMonth,\n goToPrevMonth,\n} = useMonthYearPicker(props, emits);\n\nonMounted(() => {\n focusMonthYearPicker();\n});\n\ndefineExpose({\n focusMonthYearPicker,\n goToNextMonth,\n goToPrevMonth,\n});\n</script>\n","import { computed, ref, watch, nextTick } from 'vue';\nimport { getWeekDayNames, calculateNextFocusDate, calculatePrevFocusDate } from '@/components/datepicker/utils.js';\nimport { MONTH_FORMAT, WEEK_START } from '@/components/datepicker/datepicker_constants.js';\nimport { format, getYear } from 'date-fns';\n\nexport function useCalendar (props, emits) {\n const selectedDay = ref(null);\n const focusDay = ref(0);\n const daysRef = ref([]);\n\n const weekDays = computed(() => {\n return getWeekDayNames(props.locale, WEEK_START);\n });\n\n watch(() => props.calendarDays, () => {\n focusDay.value = 0;\n daysRef.value = [];\n selectedDay.value = null;\n });\n\n function dayAriaLabel (day) {\n return `${props.selectDayLabel} ${day.text} ${format(day.value, MONTH_FORMAT)} ${getYear(day.value)}`;\n }\n\n function setDayRef (el, day) {\n if (!daysRef.value.some(day => day.el === el) && day.currentMonth) {\n daysRef.value.push({ el, day });\n }\n }\n\n function handleKeyDown (event) {\n switch (event.key) {\n case 'ArrowUp':\n event.preventDefault();\n focusDay.value -= 7;\n try {\n daysRef.value[focusDay.value].el.$el.focus();\n } catch (error) {\n const prevFocusDate = calculatePrevFocusDate(daysRef.value[focusDay.value + 7].day.value);\n emits('go-to-prev-month');\n\n nextTick(() => {\n daysRef.value[prevFocusDate - 1].el.$el.focus();\n focusDay.value += prevFocusDate - 1;\n });\n }\n break;\n\n case 'ArrowDown':\n event.preventDefault();\n focusDay.value += 7;\n try {\n daysRef.value[focusDay.value].el.$el.focus();\n } catch (error) {\n const nextFocusDate = calculateNextFocusDate(daysRef.value[focusDay.value - 7].day.value);\n emits('go-to-next-month');\n\n nextTick(() => {\n daysRef.value[nextFocusDate - 1].el.$el.focus();\n focusDay.value += nextFocusDate - 1;\n });\n }\n break;\n\n case 'ArrowLeft':\n event.preventDefault();\n if (focusDay.value > 0) {\n focusDay.value -= 1;\n daysRef.value[focusDay.value].el.$el.focus();\n } else {\n // if we are on month first day, jump to last day of prev month\n emits('go-to-prev-month');\n focusLastDay();\n }\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (focusDay.value < daysRef.value.length - 1) {\n focusDay.value += 1;\n daysRef.value[focusDay.value].el.$el.focus();\n } else {\n // if we are on month last day, jump to first day of next month\n emits('go-to-next-month');\n\n focusFirstDay();\n }\n break;\n\n case 'Tab':\n event.preventDefault();\n emits('focus-month-year-picker');\n break;\n\n case 'Escape':\n emits('close-datepicker');\n break;\n }\n }\n\n function focusFirstDay () {\n focusDay.value = 0;\n\n nextTick(() => {\n daysRef.value[focusDay.value].el.$el.focus();\n });\n }\n\n function focusLastDay () {\n nextTick(() => {\n focusDay.value = daysRef.value.length - 1;\n daysRef.value[focusDay.value].el.$el.focus();\n });\n }\n\n function selectDay (day) {\n if (!day.currentMonth) { return; }\n\n // local selectedDay is updated when a day is selected\n selectedDay.value = day.text;\n emits('select-date', day.value);\n }\n\n return {\n selectedDay,\n weekDays,\n dayAriaLabel,\n setDayRef,\n handleKeyDown,\n focusFirstDay,\n selectDay,\n };\n}\n","<!-- eslint-disable vue/multi-word-component-names -->\n<template>\n <table\n class=\"d-datepicker__calendar\"\n aria-labelledby=\"calendar-heading\"\n >\n <thead>\n <tr>\n <th\n v-for=\"day in weekDays\"\n :key=\"day\"\n scope=\"col\"\n class=\"d-datepicker__cell d-datepicker__cell--header\"\n >\n <span\n class=\"d-datepicker__weekday\"\n :title=\"day\"\n :aria-label=\"day\"\n > {{ day }}</span>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n v-for=\"(week, indexWeek) in calendarDays\"\n :key=\"indexWeek\"\n >\n <td\n v-for=\"(day, indexDays) in week.days\"\n :key=\"indexWeek + indexDays\"\n class=\"d-datepicker__cell\"\n role=\"listbox\"\n >\n <dt-button\n :ref=\"el => { if (el) setDayRef(el, day) }\"\n class=\"d-datepicker__day\"\n :circle=\"true\"\n size=\"sm\"\n importance=\"clear\"\n :disabled=\"!day.currentMonth\"\n :class=\"{\n 'd-datepicker__day--disabled': !day.currentMonth,\n 'd-datepicker__day--selected': selectedDay\n ? ((day.text === selectedDay) && day.currentMonth)\n : day.selected,\n }\"\n type=\"button\"\n :aria-selected=\"!!selectedDay ? ((day.text === selectedDay) && day.currentMonth) : day.selected\"\n :aria-label=\"dayAriaLabel(day)\"\n role=\"option\"\n @click=\"selectDay(day)\"\n @keydown=\"handleKeyDown($event)\"\n >\n {{ day.text }}\n </dt-button>\n </td>\n </tr>\n </tbody>\n </table>\n</template>\n\n<script setup>\nimport { useCalendar } from '@/components/datepicker/composables/useCalendar.js';\nimport { DtButton } from '@/components/button';\n\nconst props = defineProps({\n calendarDays: {\n type: Array,\n required: true,\n },\n\n locale: {\n type: String,\n required: true,\n },\n\n selectDayLabel: {\n type: String,\n required: true,\n },\n});\n\nconst emits = defineEmits([\n /**\n * Event fired when a date is selected\n *\n * @event select-date\n * @type {Date}\n */\n 'select-date',\n\n /**\n * Will focus the month and year picker\n *\n * @event focus-month-year-picker\n */\n 'focus-month-year-picker',\n\n /**\n * Will close the datepicker\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n\n /**\n * Will go to the next month\n *\n * @event go-to-next-month\n */\n 'go-to-next-month',\n\n /**\n * Will go to the previous month\n *\n * @event go-to-prev-month\n */\n 'go-to-prev-month',\n]);\n\nconst {\n selectedDay,\n weekDays,\n dayAriaLabel,\n setDayRef,\n handleKeyDown,\n focusFirstDay,\n selectDay,\n} = useCalendar(props, emits);\n\ndefineExpose({\n focusFirstDay,\n});\n</script>\n","<!-- eslint-disable vue/multi-word-component-names -->\n<template>\n <dt-stack\n class=\"d-datepicker\"\n gap=\"400\"\n >\n <div class=\"d-datepicker__hd\">\n <month-year-picker\n ref=\"monthYearPicker\"\n :locale=\"locale\"\n :prev-month-label=\"prevMonthLabel\"\n :next-month-label=\"nextMonthLabel\"\n :prev-year-label=\"prevYearLabel\"\n :next-year-label=\"nextYearLabel\"\n :change-to-label=\"changeToLabel\"\n :selected-date=\"selectedDate\"\n @calendar-days=\"updateCalendarDays\"\n @focus-first-day=\"$refs.calendar.focusFirstDay()\"\n @focus-last-day=\"$refs.calendar.focusLastDay()\"\n @close-datepicker=\"$emit('close-datepicker')\"\n />\n </div>\n <div class=\"d-datepicker__bd\">\n <calendar\n ref=\"calendar\"\n :locale=\"locale\"\n :calendar-days=\"calendarDays\"\n :select-day-label=\"selectDayLabel\"\n @select-date=\"$emit('selected-date', $event)\"\n @focus-month-year-picker=\"$refs.monthYearPicker.focusMonthYearPicker()\"\n @close-datepicker=\"$emit('close-datepicker')\"\n @go-to-next-month=\"$refs.monthYearPicker.goToNextMonth()\"\n @go-to-prev-month=\"$refs.monthYearPicker.goToPrevMonth()\"\n />\n </div>\n </dt-stack>\n</template>\n\n<script setup>\nimport MonthYearPicker from './modules/month-year-picker.vue';\nimport Calendar from './modules/calendar.vue';\nimport { DtStack } from '@/components/stack';\n\nimport { ref } from 'vue';\n\ndefineProps({\n /**\n * Label for the previous month button\n *\n * @type {String}\n * @example 'Previous month'\n */\n prevMonthLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the next month button\n *\n * @type {String}\n * @example 'Next month'\n */\n nextMonthLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the previous year button\n *\n * @type {String}\n * @example 'Previous year'\n */\n prevYearLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the next year button\n *\n * @type {String}\n * @example 'Next year'\n */\n nextYearLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the select day button\n *\n * @type {String}\n * @example 'Select day'\n */\n selectDayLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Label for the change to button\n *\n * @type {String}\n * @example 'Change to'\n */\n changeToLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Locale for the calendar\n *\n * @type {String}\n */\n locale: {\n type: String,\n default: 'en-US',\n },\n\n /**\n * Selected date\n *\n * @type {Date}\n */\n selectedDate: {\n type: Date,\n default: () => (new Date()),\n },\n});\n\ndefineEmits([\n /**\n * Event fired when a date is selected\n *\n * @event selected-date\n * @type {Date}\n */\n 'selected-date',\n\n /**\n * Event fired when user presses the esc key\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n]);\n\nconst calendarDays = ref([]);\n\nfunction updateCalendarDays (days) {\n calendarDays.value = days;\n}\n</script>\n","export function formatLong (date, locale = 'default') {\n return new Intl.DateTimeFormat(locale, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }).format(date);\n}\n\nexport function formatMedium (date, locale = 'default') {\n return new Intl.DateTimeFormat(locale, { year: 'numeric', month: 'long', day: 'numeric' }).format(date);\n}\n\nexport function formatShort (date, locale = 'default', showWeekday = true) {\n const options = showWeekday ? { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' } : { year: 'numeric', month: 'short', day: 'numeric' };\n return new Intl.DateTimeFormat(locale, options).format(date);\n}\n\nexport function formatNoYear (date, locale = 'default', abbreviated = false) {\n const monthFormat = abbreviated ? 'short' : 'long';\n return new Intl.DateTimeFormat(locale, { month: monthFormat, day: 'numeric' }).format(date);\n}\n\nexport function formatNumerical (date, locale = 'default') {\n return new Intl.DateTimeFormat(locale, { year: '2-digit', month: '2-digit', day: '2-digit' }).format(date);\n}\n\nexport default {\n formatLong,\n formatMedium,\n formatShort,\n formatNoYear,\n formatNumerical,\n};\n"],"names":["addDays","getMonth","isEqual","startOfWeek","getDay","addMonths","startOfMonth","getDate","endOfMonth","subMonths","ref","getYear","computed","watch","set","onMounted","format","day","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;AAKO,MAAM,aAAa;AAEnB,MAAM,eAAe;AAErB,MAAM,oBAAoB;ACFjC,MAAM,iBAAiB,CAAC,UAAW,QAAQ,IAAI,KAAK,KAAK,IAAI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297
  createVNode(unref(DtTooltip), {
298
298
  message: __props.prevYearLabel,
299
- placement: "top"
299
+ placement: "top",
300
+ "fallback-placements": ["top-start", "auto"]
300
301
  }, {
301
302
  anchor: withCtx(() => [
302
303
  createVNode(unref(DtButton), {
@@ -328,7 +329,8 @@ const _sfc_main$2 = {
328
329
  }, 8, ["message"]),
329
330
  createVNode(unref(DtTooltip), {
330
331
  message: __props.prevMonthLabel,
331
- placement: "top"
332
+ placement: "top",
333
+ "fallback-placements": ["top-end", "auto"]
332
334
  }, {
333
335
  anchor: withCtx(() => [
334
336
  createVNode(unref(DtButton), {
@@ -371,7 +373,8 @@ const _sfc_main$2 = {
371
373
  default: withCtx(() => [
372
374
  createVNode(unref(DtTooltip), {
373
375
  message: __props.nextMonthLabel,
374
- placement: "top"
376
+ placement: "top",
377
+ "fallback-placements": ["top-start", "auto"]
375
378
  }, {
376
379
  anchor: withCtx(() => [
377
380
  createVNode(unref(DtButton), {
@@ -403,7 +406,8 @@ const _sfc_main$2 = {
403
406
  }, 8, ["message"]),
404
407
  createVNode(unref(DtTooltip), {
405
408
  message: __props.nextYearLabel,
406
- placement: "top"
409
+ placement: "top",
410
+ "fallback-placements": ["top-end", "auto"]
407
411
  }, {
408
412
  anchor: withCtx(() => [
409
413
  createVNode(unref(DtButton), {