@adyen/bento-vue2 1.63.0 → 1.63.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 (50) hide show
  1. package/dist/@types/index.d.ts +3 -9
  2. package/dist/action-bar.js +1 -1
  3. package/dist/assets/accordion-item.css +1 -1
  4. package/dist/assets/action-bar.css +1 -1
  5. package/dist/assets/base-modal.css +1 -1
  6. package/dist/assets/card.css +1 -1
  7. package/dist/assets/data-grid.css +1 -1
  8. package/dist/assets/date-picker.css +1 -1
  9. package/dist/assets/dialog-page.css +1 -1
  10. package/dist/assets/file-uploader.css +1 -1
  11. package/dist/assets/inspector.css +1 -1
  12. package/dist/assets/menu.css +1 -1
  13. package/dist/assets/modal-fullscreen.css +1 -1
  14. package/dist/assets/popover.css +1 -1
  15. package/dist/assets/sidepanel.css +1 -1
  16. package/dist/chunks/{action-bar.Dsp7iRxz.js → action-bar.DHdrZtmW.js} +2 -2
  17. package/dist/chunks/{action-bar.Dsp7iRxz.js.map → action-bar.DHdrZtmW.js.map} +1 -1
  18. package/dist/chunks/{button-actions-with-menu.CtW_16tY.js → button-actions-with-menu.CYkEoiee.js} +2 -2
  19. package/dist/chunks/{button-actions-with-menu.CtW_16tY.js.map → button-actions-with-menu.CYkEoiee.js.map} +1 -1
  20. package/dist/chunks/{dashboard-section.CspNW0CA.js → dashboard-section.Bz54Z6Hh.js} +2 -2
  21. package/dist/chunks/{dashboard-section.CspNW0CA.js.map → dashboard-section.Bz54Z6Hh.js.map} +1 -1
  22. package/dist/chunks/{data-grid-template.BhzgqkZp.js → data-grid-template.DtFRjaR8.js} +2 -2
  23. package/dist/chunks/{data-grid-template.BhzgqkZp.js.map → data-grid-template.DtFRjaR8.js.map} +1 -1
  24. package/dist/chunks/{data-grid.BfsBhYpW.js → data-grid.Cep-0zsO.js} +4 -4
  25. package/dist/chunks/{data-grid.BfsBhYpW.js.map → data-grid.Cep-0zsO.js.map} +1 -1
  26. package/dist/chunks/{date-picker.CPQ6WLZE.js → date-picker.D65ieFdN.js} +20 -20
  27. package/dist/chunks/{date-picker.CPQ6WLZE.js.map → date-picker.D65ieFdN.js.map} +1 -1
  28. package/dist/chunks/{filter-bar.D6HeYnzZ.js → filter-bar.DjUN3PeJ.js} +2 -2
  29. package/dist/chunks/{filter-bar.D6HeYnzZ.js.map → filter-bar.DjUN3PeJ.js.map} +1 -1
  30. package/dist/chunks/{header-with-views.Dkn8IDew.js → header-with-views.Csgl4PSQ.js} +3 -3
  31. package/dist/chunks/{header-with-views.Dkn8IDew.js.map → header-with-views.Csgl4PSQ.js.map} +1 -1
  32. package/dist/chunks/{header.DNzQO7u-.js → header.Cb644uAi.js} +2 -2
  33. package/dist/chunks/{header.DNzQO7u-.js.map → header.Cb644uAi.js.map} +1 -1
  34. package/dist/chunks/{menu.W_kuhRKI.js → menu.BCD4FW54.js} +2 -2
  35. package/dist/chunks/{menu.W_kuhRKI.js.map → menu.BCD4FW54.js.map} +1 -1
  36. package/dist/chunks/{tutorial.BNZh6N3h.js → tutorial.DJ_Cwp9i.js} +2 -2
  37. package/dist/chunks/{tutorial.BNZh6N3h.js.map → tutorial.DJ_Cwp9i.js.map} +1 -1
  38. package/dist/dashboard-template.js +1 -1
  39. package/dist/data-grid-template.js +1 -1
  40. package/dist/data-grid.js +1 -1
  41. package/dist/date-picker.js +1 -1
  42. package/dist/filter-bar.js +1 -1
  43. package/dist/header-with-views.js +1 -1
  44. package/dist/header.js +1 -1
  45. package/dist/index.js +10 -10
  46. package/dist/internal.js +1 -1
  47. package/dist/menu.js +1 -1
  48. package/dist/tutorial.js +1 -1
  49. package/dist/web-types.json +2 -2
  50. package/package.json +4 -4
@@ -4,7 +4,7 @@ import { u as x } from "./use-has-slot.C9lQZ6nz.js";
4
4
  import { B as E, a as O, c as M } from "./typography.J1v_SPG3.js";
5
5
  import { u as P } from "./i18n.BQkEbtPM.js";
6
6
  import { r as m, t as d, l as B, a as T, g as U } from "./get-date-locale.BN8xEjY0.js";
7
- import { B as A } from "./button-actions-with-menu.CtW_16tY.js";
7
+ import { B as A } from "./button-actions-with-menu.CYkEoiee.js";
8
8
  import { c as X } from "./index.DD7TppDb.js";
9
9
  import { d as w } from "./index.BDuTpjD8.js";
10
10
  import { c as R } from "./index.BxBB1rsx.js";
@@ -184,4 +184,4 @@ const pt = Z.exports;
184
184
  export {
185
185
  pt as B
186
186
  };
187
- //# sourceMappingURL=header.DNzQO7u-.js.map
187
+ //# sourceMappingURL=header.Cb644uAi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"header.DNzQO7u-.js","sources":["../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/differenceInMilliseconds/index.js","../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/roundingMethods/index.js","../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/differenceInSeconds/index.js","../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/formatDistance/index.js","../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/formatDistanceToNow/index.js","../../src/components/header/header.types.ts","../../src/components/header/header.vue"],"sourcesContent":["import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of milliseconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\n\nexport default function differenceInMilliseconds(dateLeft, dateRight) {\n requiredArgs(2, arguments);\n return toDate(dateLeft).getTime() - toDate(dateRight).getTime();\n}","var roundingMap = {\n ceil: Math.ceil,\n round: Math.round,\n floor: Math.floor,\n trunc: function (value) {\n return value < 0 ? Math.ceil(value) : Math.floor(value);\n } // Math.trunc is not supported by IE\n\n};\nvar defaultRoundingMethod = 'trunc';\nexport function getRoundingMethod(method) {\n return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];\n}","import differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of seconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * const result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\n\nexport default function differenceInSeconds(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}","import compareAsc from \"../compareAsc/index.js\";\nimport differenceInMonths from \"../differenceInMonths/index.js\";\nimport differenceInSeconds from \"../differenceInSeconds/index.js\";\nimport defaultLocale from \"../locale/en-US/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport cloneObject from \"../_lib/cloneObject/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MINUTES_IN_DAY = 1440;\nvar MINUTES_IN_ALMOST_TWO_DAYS = 2520;\nvar MINUTES_IN_MONTH = 43200;\nvar MINUTES_IN_TWO_MONTHS = 86400;\n/**\n * @name formatDistance\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words.\n *\n * | Distance between dates | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance between dates | Result |\n * |------------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWords ` to `formatDistance`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * - The order of arguments is swapped to make the function\n * consistent with `differenceIn...` functions.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWords(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 11, 32, 0),\n * { addSuffix: true }\n * ) //=> 'in about 1 hour'\n *\n * // v2.0.0 onward\n *\n * formatDistance(\n * new Date(1986, 3, 4, 11, 32, 0),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { addSuffix: true }\n * ) //=> 'in about 1 hour'\n * ```\n *\n * @param {Date|Number} date - the date\n * @param {Date|Number} baseDate - the date to compare with\n * @param {Object} [options] - an object with options.\n * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed\n * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `baseDate` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00, including seconds?\n * const result = formatDistance(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0),\n * { includeSeconds: true }\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> 'about 1 year ago'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> 'pli ol 1 jaro'\n */\n\nexport default function formatDistance(dirtyDate, dirtyBaseDate) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n requiredArgs(2, arguments);\n var locale = options.locale || defaultLocale;\n\n if (!locale.formatDistance) {\n throw new RangeError('locale must contain formatDistance property');\n }\n\n var comparison = compareAsc(dirtyDate, dirtyBaseDate);\n\n if (isNaN(comparison)) {\n throw new RangeError('Invalid time value');\n }\n\n var localizeOptions = cloneObject(options);\n localizeOptions.addSuffix = Boolean(options.addSuffix);\n localizeOptions.comparison = comparison;\n var dateLeft;\n var dateRight;\n\n if (comparison > 0) {\n dateLeft = toDate(dirtyBaseDate);\n dateRight = toDate(dirtyDate);\n } else {\n dateLeft = toDate(dirtyDate);\n dateRight = toDate(dirtyBaseDate);\n }\n\n var seconds = differenceInSeconds(dateRight, dateLeft);\n var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1000;\n var minutes = Math.round((seconds - offsetInSeconds) / 60);\n var months; // 0 up to 2 mins\n\n if (minutes < 2) {\n if (options.includeSeconds) {\n if (seconds < 5) {\n return locale.formatDistance('lessThanXSeconds', 5, localizeOptions);\n } else if (seconds < 10) {\n return locale.formatDistance('lessThanXSeconds', 10, localizeOptions);\n } else if (seconds < 20) {\n return locale.formatDistance('lessThanXSeconds', 20, localizeOptions);\n } else if (seconds < 40) {\n return locale.formatDistance('halfAMinute', null, localizeOptions);\n } else if (seconds < 60) {\n return locale.formatDistance('lessThanXMinutes', 1, localizeOptions);\n } else {\n return locale.formatDistance('xMinutes', 1, localizeOptions);\n }\n } else {\n if (minutes === 0) {\n return locale.formatDistance('lessThanXMinutes', 1, localizeOptions);\n } else {\n return locale.formatDistance('xMinutes', minutes, localizeOptions);\n }\n } // 2 mins up to 0.75 hrs\n\n } else if (minutes < 45) {\n return locale.formatDistance('xMinutes', minutes, localizeOptions); // 0.75 hrs up to 1.5 hrs\n } else if (minutes < 90) {\n return locale.formatDistance('aboutXHours', 1, localizeOptions); // 1.5 hrs up to 24 hrs\n } else if (minutes < MINUTES_IN_DAY) {\n var hours = Math.round(minutes / 60);\n return locale.formatDistance('aboutXHours', hours, localizeOptions); // 1 day up to 1.75 days\n } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {\n return locale.formatDistance('xDays', 1, localizeOptions); // 1.75 days up to 30 days\n } else if (minutes < MINUTES_IN_MONTH) {\n var days = Math.round(minutes / MINUTES_IN_DAY);\n return locale.formatDistance('xDays', days, localizeOptions); // 1 month up to 2 months\n } else if (minutes < MINUTES_IN_TWO_MONTHS) {\n months = Math.round(minutes / MINUTES_IN_MONTH);\n return locale.formatDistance('aboutXMonths', months, localizeOptions);\n }\n\n months = differenceInMonths(dateRight, dateLeft); // 2 months up to 12 months\n\n if (months < 12) {\n var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);\n return locale.formatDistance('xMonths', nearestMonth, localizeOptions); // 1 year up to max Date\n } else {\n var monthsSinceStartOfYear = months % 12;\n var years = Math.floor(months / 12); // N years up to 1 years 3 months\n\n if (monthsSinceStartOfYear < 3) {\n return locale.formatDistance('aboutXYears', years, localizeOptions); // N years 3 months up to N years 9 months\n } else if (monthsSinceStartOfYear < 9) {\n return locale.formatDistance('overXYears', years, localizeOptions); // N years 9 months up to N year 12 months\n } else {\n return locale.formatDistance('almostXYears', years + 1, localizeOptions);\n }\n }\n}","import distanceInWords from \"../formatDistance/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name formatDistanceToNow\n * @category Common Helpers\n * @summary Return the distance between the given date and now in words.\n * @pure false\n *\n * @description\n * Return the distance between the given date and now in words.\n *\n * | Distance to now | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance to now | Result |\n * |---------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * > ⚠️ Please note that this function is not present in the FP submodule as\n * > it uses `Date.now()` internally hence impure and can't be safely curried.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWordsToNow ` to `formatDistanceToNow`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsToNow(new Date(2014, 6, 2), { addSuffix: true })\n * //=> 'in 6 months'\n *\n * // v2.0.0 onward\n *\n * formatDistanceToNow(new Date(2014, 6, 2), { addSuffix: true })\n * //=> 'in 6 months'\n * ```\n *\n * @param {Date|Number} date - the given date\n * @param {Object} [options] - the object with options\n * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed\n * @param {Boolean} [options.addSuffix=false] - result specifies if now is earlier or later than the passed date\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `formatDistance` property\n *\n * @example\n * // If today is 1 January 2015, what is the distance to 2 July 2014?\n * var result = formatDistanceToNow(\n * new Date(2014, 6, 2)\n * )\n * //=> '6 months'\n *\n * @example\n * // If now is 1 January 2015 00:00:00,\n * // what is the distance to 1 January 2015 00:00:15, including seconds?\n * var result = formatDistanceToNow(\n * new Date(2015, 0, 1, 0, 0, 15),\n * {includeSeconds: true}\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 January 2016, with a suffix?\n * var result = formatDistanceToNow(\n * new Date(2016, 0, 1),\n * {addSuffix: true}\n * )\n * //=> 'in about 1 year'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 August 2016 in Esperanto?\n * var eoLocale = require('date-fns/locale/eo')\n * var result = formatDistanceToNow(\n * new Date(2016, 7, 1),\n * {locale: eoLocale}\n * )\n * //=> 'pli ol 1 jaro'\n */\n\nexport default function formatDistanceToNow(dirtyDate, dirtyOptions) {\n requiredArgs(1, arguments);\n return distanceInWords(dirtyDate, Date.now(), dirtyOptions);\n}","import { BentoLoadingButtonState } from '@/core/components/loading-button/loading-button.types';\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoHeaderVariant {\n PAGE = 'page',\n COMPONENT = 'component',\n}\n\nexport interface BentoHeaderReloadButton {\n title: string;\n event?: (event: Event) => void;\n state?: `${BentoLoadingButtonState}`;\n}\n","<template>\n <header class=\"b-header\" :class=\"conditionalClasses\">\n <div class=\"b-header__wrapper\">\n <div class=\"b-header__title\">\n <div>\n <bento-typography v-bind=\"typography\" class=\"b-header__text\">{{ title }}</bento-typography>\n <info-icon-with-popover\n v-if=\"infoIconTooltipText || hasSlot('infoIconTooltipContent')\"\n class=\"b-header__tooltip\"\n :popover-text=\"infoIconTooltipText\"\n >\n <template v-if=\"hasSlot('infoIconTooltipContent')\" #default\n ><slot name=\"infoIconTooltipContent\"\n /></template>\n </info-icon-with-popover>\n </div>\n </div>\n <div v-if=\"description || lastUpdated\" class=\"b-header__meta-container\">\n <bento-typography v-if=\"description\" class=\"b-header__description\" el=\"div\">\n {{ description }}\n </bento-typography>\n <div v-if=\"lastUpdated\" class=\"b-header__timestamp-section\">\n <bento-typography class=\"b-header__timestamp\" el=\"div\">\n {{ timestamp }}\n </bento-typography>\n <bento-loading-button\n v-if=\"reloadButton\"\n variant=\"tertiary\"\n :state=\"reloadButton.state\"\n @click=\"reloadButton.event\"\n ><template #iconLeft><reload-icon aria-hidden=\"true\" /></template\n >{{ reloadButton.title }}</bento-loading-button\n >\n </div>\n </div>\n <button-actions-with-menu\n v-if=\"actions\"\n :actions=\"actions\"\n :displayed-actions=\"2\"\n class=\"b-header__actions\"\n />\n </div>\n </header>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import ReloadIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import { InfoIconWithPopover } from '@/internal';\n import { BentoButtonActionsList, BentoLoadingButton } from '@/components/button';\n import { useHasSlot } from '@/composables';\n import { BentoHeaderReloadButton, BentoHeaderVariant } from './header.types';\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '@/components/typography';\n import { useI18n } from '@/utils/ts/i18n';\n import { getDateLocale } from '@/utils/ts/get-date-locale/get-date-locale';\n import ButtonActionsWithMenu from '../internal/button-actions-with-menu/button-actions-with-menu.vue';\n\n import formatDistanceToNow from 'date-fns/formatDistanceToNow';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n export default defineComponent({\n i18n: { messages },\n name: 'bento-header',\n components: {\n BentoTypography,\n ButtonActionsWithMenu,\n BentoLoadingButton,\n InfoIconWithPopover,\n ReloadIcon,\n },\n props: {\n /**\n * Array of BentoButtonActionsList to show to the right of the title\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * Text showed under the title\n */\n description: { type: String, default: null },\n\n /**\n * Text showed in the info-icon tooltip on hover\n */\n infoIconTooltipText: { type: InfoIconWithPopover.props.popoverText.type, default: null },\n\n /**\n * Popover position of the info icon text.\n */\n infoIconPopoverPosition: {\n type: InfoIconWithPopover.props.popoverPosition.type,\n default: InfoIconWithPopover.props.popoverPosition.default,\n validator: InfoIconWithPopover.props.popoverPosition.validator,\n },\n\n /**\n * JavaScript \"Date\" object for when the content was last updated\n */\n lastUpdated: { type: [Date, Number], default: null },\n\n /**\n * Variant represents type of Header\n * @values page, component\n */\n variant: {\n type: String as PropType<BentoHeaderVariant | `${BentoHeaderVariant}`>,\n default: BentoHeaderVariant.PAGE,\n validator: (value: BentoHeaderVariant) => Object.values(BentoHeaderVariant).includes(value),\n },\n\n /**\n * Text used as a title\n */\n title: { type: String, required: true },\n\n /**\n * Reload button which shows next to the header's timestamp\n * {@see BentoHeaderReloadButton}\n */\n reloadButton: {\n type: Object as PropType<BentoHeaderReloadButton>,\n default: null,\n },\n },\n emits: ['reload'],\n setup(props, { slots }) {\n const { t, locale } = useI18n<{ message: MessageSchema }>({ messages });\n // TODO to replace with dynamic import\n const locales = getDateLocale();\n\n const conditionalClasses = computed(() => ({\n 'b-header--component': props.variant === BentoHeaderVariant.COMPONENT,\n }));\n\n const typography = computed(() => ({\n el: props.variant === BentoHeaderVariant.PAGE ? BentoTypographyElement.H1 : BentoTypographyElement.H2,\n variant: BentoTypographyVariant.TITLE,\n medium: props.variant === BentoHeaderVariant.COMPONENT,\n large: props.variant === BentoHeaderVariant.PAGE,\n }));\n\n const timestamp = computed(() =>\n props.lastUpdated\n ? t('lastUpdated', {\n date: formatDistanceToNow(props.lastUpdated, {\n locale: locales[locale.value.substring(0, 2)] || locales.enUS,\n }),\n })\n : null\n );\n return {\n hasSlot: useHasSlot(slots),\n conditionalClasses,\n timestamp,\n typography,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./header.scss\" />\n"],"names":["differenceInMilliseconds","dateLeft","dateRight","requiredArgs","toDate","roundingMap","value","defaultRoundingMethod","getRoundingMethod","method","differenceInSeconds","options","diff","MINUTES_IN_DAY","MINUTES_IN_ALMOST_TWO_DAYS","MINUTES_IN_MONTH","MINUTES_IN_TWO_MONTHS","formatDistance","dirtyDate","dirtyBaseDate","locale$1","locale","comparison","compareAsc","localizeOptions","cloneObject","seconds","offsetInSeconds","getTimezoneOffsetInMilliseconds","minutes","months","hours","days","differenceInMonths","nearestMonth","monthsSinceStartOfYear","years","formatDistanceToNow","dirtyOptions","BentoHeaderVariant","BentoHeaderVariant2","_sfc_main","defineComponent","messages","BentoTypography","ButtonActionsWithMenu","BentoLoadingButton","InfoIconWithPopover","RefreshIcon","props","slots","t","useI18n","locales","getDateLocale","conditionalClasses","computed","typography","BentoTypographyElement","BentoTypographyVariant","timestamp","useHasSlot"],"mappings":";;;;;;;;;;;;;;AA6Be,SAAAA,EAAAC,GAAAC,GAAA;AACf,SAAAC,EAAA,GAAA,SAAA,GACAC,EAAAH,CAAA,EAAA,QAAA,IAAAG,EAAAF,CAAA,EAAA,QAAA;AACA;AChCA,IAAAG,IAAA;AAAA,EACA,MA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AA,QAAA,UAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,cAAA;AAAA,MAMA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,OAAA,CAAA,QAAA;AAAA,EACA,MAAA2C,GAAA,EAAA,OAAAC,EAAA,GAAA;AAEA,UAAA,EAAA,GAAAC,GAAA,QAAA9B,EAAA,IAAA+B,EAAA,GAEAC,IAAAC,EAAA,GAEAC,IAAAC,EAAA,OAAA;AAAA,MAAA,uBAAAP,EAAA,YAAAV,EAAA;AAAA,IACA,EAAA,GAGAkB,IAAAD,EAAA,OAAA;AAAA,MAAA,IAAAP,EAAA,YAAAV,EAAA,OAAAmB,EAAA,KAAAA,EAAA;AAAA,MACA,SAAAC,EAAA;AAAA,MACA,QAAAV,EAAA,YAAAV,EAAA;AAAA,MACA,OAAAU,EAAA,YAAAV,EAAA;AAAA,IACA,EAAA,GAGAqB,IAAAJ;AAAA,MAAA,MAAAP,EAAA,cAAAE,EAAA,eAAA;AAAA,QAEA,MAAAd,EAAAY,EAAA,aAAA;AAAA,UACA,QAAAI,EAAAhC,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAgC,EAAA;AAAA,QACA,CAAA;AAAA,MACA,CAAA,IAAA;AAAA,IAEA;AAEA,WAAA;AAAA,MAAA,SAAAQ,EAAAX,CAAA;AAAA,MACA,oBAAAK;AAAA,MACA,WAAAK;AAAA,MACA,YAAAH;AAAA,IACA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4]}
1
+ {"version":3,"file":"header.Cb644uAi.js","sources":["../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/differenceInMilliseconds/index.js","../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/roundingMethods/index.js","../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/differenceInSeconds/index.js","../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/formatDistance/index.js","../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/formatDistanceToNow/index.js","../../src/components/header/header.types.ts","../../src/components/header/header.vue"],"sourcesContent":["import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of milliseconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\n\nexport default function differenceInMilliseconds(dateLeft, dateRight) {\n requiredArgs(2, arguments);\n return toDate(dateLeft).getTime() - toDate(dateRight).getTime();\n}","var roundingMap = {\n ceil: Math.ceil,\n round: Math.round,\n floor: Math.floor,\n trunc: function (value) {\n return value < 0 ? Math.ceil(value) : Math.floor(value);\n } // Math.trunc is not supported by IE\n\n};\nvar defaultRoundingMethod = 'trunc';\nexport function getRoundingMethod(method) {\n return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];\n}","import differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of seconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * const result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\n\nexport default function differenceInSeconds(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}","import compareAsc from \"../compareAsc/index.js\";\nimport differenceInMonths from \"../differenceInMonths/index.js\";\nimport differenceInSeconds from \"../differenceInSeconds/index.js\";\nimport defaultLocale from \"../locale/en-US/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport cloneObject from \"../_lib/cloneObject/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MINUTES_IN_DAY = 1440;\nvar MINUTES_IN_ALMOST_TWO_DAYS = 2520;\nvar MINUTES_IN_MONTH = 43200;\nvar MINUTES_IN_TWO_MONTHS = 86400;\n/**\n * @name formatDistance\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words.\n *\n * | Distance between dates | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance between dates | Result |\n * |------------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWords ` to `formatDistance`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * - The order of arguments is swapped to make the function\n * consistent with `differenceIn...` functions.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWords(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 11, 32, 0),\n * { addSuffix: true }\n * ) //=> 'in about 1 hour'\n *\n * // v2.0.0 onward\n *\n * formatDistance(\n * new Date(1986, 3, 4, 11, 32, 0),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { addSuffix: true }\n * ) //=> 'in about 1 hour'\n * ```\n *\n * @param {Date|Number} date - the date\n * @param {Date|Number} baseDate - the date to compare with\n * @param {Object} [options] - an object with options.\n * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed\n * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `baseDate` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00, including seconds?\n * const result = formatDistance(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0),\n * { includeSeconds: true }\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> 'about 1 year ago'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> 'pli ol 1 jaro'\n */\n\nexport default function formatDistance(dirtyDate, dirtyBaseDate) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n requiredArgs(2, arguments);\n var locale = options.locale || defaultLocale;\n\n if (!locale.formatDistance) {\n throw new RangeError('locale must contain formatDistance property');\n }\n\n var comparison = compareAsc(dirtyDate, dirtyBaseDate);\n\n if (isNaN(comparison)) {\n throw new RangeError('Invalid time value');\n }\n\n var localizeOptions = cloneObject(options);\n localizeOptions.addSuffix = Boolean(options.addSuffix);\n localizeOptions.comparison = comparison;\n var dateLeft;\n var dateRight;\n\n if (comparison > 0) {\n dateLeft = toDate(dirtyBaseDate);\n dateRight = toDate(dirtyDate);\n } else {\n dateLeft = toDate(dirtyDate);\n dateRight = toDate(dirtyBaseDate);\n }\n\n var seconds = differenceInSeconds(dateRight, dateLeft);\n var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1000;\n var minutes = Math.round((seconds - offsetInSeconds) / 60);\n var months; // 0 up to 2 mins\n\n if (minutes < 2) {\n if (options.includeSeconds) {\n if (seconds < 5) {\n return locale.formatDistance('lessThanXSeconds', 5, localizeOptions);\n } else if (seconds < 10) {\n return locale.formatDistance('lessThanXSeconds', 10, localizeOptions);\n } else if (seconds < 20) {\n return locale.formatDistance('lessThanXSeconds', 20, localizeOptions);\n } else if (seconds < 40) {\n return locale.formatDistance('halfAMinute', null, localizeOptions);\n } else if (seconds < 60) {\n return locale.formatDistance('lessThanXMinutes', 1, localizeOptions);\n } else {\n return locale.formatDistance('xMinutes', 1, localizeOptions);\n }\n } else {\n if (minutes === 0) {\n return locale.formatDistance('lessThanXMinutes', 1, localizeOptions);\n } else {\n return locale.formatDistance('xMinutes', minutes, localizeOptions);\n }\n } // 2 mins up to 0.75 hrs\n\n } else if (minutes < 45) {\n return locale.formatDistance('xMinutes', minutes, localizeOptions); // 0.75 hrs up to 1.5 hrs\n } else if (minutes < 90) {\n return locale.formatDistance('aboutXHours', 1, localizeOptions); // 1.5 hrs up to 24 hrs\n } else if (minutes < MINUTES_IN_DAY) {\n var hours = Math.round(minutes / 60);\n return locale.formatDistance('aboutXHours', hours, localizeOptions); // 1 day up to 1.75 days\n } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {\n return locale.formatDistance('xDays', 1, localizeOptions); // 1.75 days up to 30 days\n } else if (minutes < MINUTES_IN_MONTH) {\n var days = Math.round(minutes / MINUTES_IN_DAY);\n return locale.formatDistance('xDays', days, localizeOptions); // 1 month up to 2 months\n } else if (minutes < MINUTES_IN_TWO_MONTHS) {\n months = Math.round(minutes / MINUTES_IN_MONTH);\n return locale.formatDistance('aboutXMonths', months, localizeOptions);\n }\n\n months = differenceInMonths(dateRight, dateLeft); // 2 months up to 12 months\n\n if (months < 12) {\n var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);\n return locale.formatDistance('xMonths', nearestMonth, localizeOptions); // 1 year up to max Date\n } else {\n var monthsSinceStartOfYear = months % 12;\n var years = Math.floor(months / 12); // N years up to 1 years 3 months\n\n if (monthsSinceStartOfYear < 3) {\n return locale.formatDistance('aboutXYears', years, localizeOptions); // N years 3 months up to N years 9 months\n } else if (monthsSinceStartOfYear < 9) {\n return locale.formatDistance('overXYears', years, localizeOptions); // N years 9 months up to N year 12 months\n } else {\n return locale.formatDistance('almostXYears', years + 1, localizeOptions);\n }\n }\n}","import distanceInWords from \"../formatDistance/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name formatDistanceToNow\n * @category Common Helpers\n * @summary Return the distance between the given date and now in words.\n * @pure false\n *\n * @description\n * Return the distance between the given date and now in words.\n *\n * | Distance to now | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance to now | Result |\n * |---------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * > ⚠️ Please note that this function is not present in the FP submodule as\n * > it uses `Date.now()` internally hence impure and can't be safely curried.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWordsToNow ` to `formatDistanceToNow`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsToNow(new Date(2014, 6, 2), { addSuffix: true })\n * //=> 'in 6 months'\n *\n * // v2.0.0 onward\n *\n * formatDistanceToNow(new Date(2014, 6, 2), { addSuffix: true })\n * //=> 'in 6 months'\n * ```\n *\n * @param {Date|Number} date - the given date\n * @param {Object} [options] - the object with options\n * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed\n * @param {Boolean} [options.addSuffix=false] - result specifies if now is earlier or later than the passed date\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `formatDistance` property\n *\n * @example\n * // If today is 1 January 2015, what is the distance to 2 July 2014?\n * var result = formatDistanceToNow(\n * new Date(2014, 6, 2)\n * )\n * //=> '6 months'\n *\n * @example\n * // If now is 1 January 2015 00:00:00,\n * // what is the distance to 1 January 2015 00:00:15, including seconds?\n * var result = formatDistanceToNow(\n * new Date(2015, 0, 1, 0, 0, 15),\n * {includeSeconds: true}\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 January 2016, with a suffix?\n * var result = formatDistanceToNow(\n * new Date(2016, 0, 1),\n * {addSuffix: true}\n * )\n * //=> 'in about 1 year'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 August 2016 in Esperanto?\n * var eoLocale = require('date-fns/locale/eo')\n * var result = formatDistanceToNow(\n * new Date(2016, 7, 1),\n * {locale: eoLocale}\n * )\n * //=> 'pli ol 1 jaro'\n */\n\nexport default function formatDistanceToNow(dirtyDate, dirtyOptions) {\n requiredArgs(1, arguments);\n return distanceInWords(dirtyDate, Date.now(), dirtyOptions);\n}","import { BentoLoadingButtonState } from '@/core/components/loading-button/loading-button.types';\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoHeaderVariant {\n PAGE = 'page',\n COMPONENT = 'component',\n}\n\nexport interface BentoHeaderReloadButton {\n title: string;\n event?: (event: Event) => void;\n state?: `${BentoLoadingButtonState}`;\n}\n","<template>\n <header class=\"b-header\" :class=\"conditionalClasses\">\n <div class=\"b-header__wrapper\">\n <div class=\"b-header__title\">\n <div>\n <bento-typography v-bind=\"typography\" class=\"b-header__text\">{{ title }}</bento-typography>\n <info-icon-with-popover\n v-if=\"infoIconTooltipText || hasSlot('infoIconTooltipContent')\"\n class=\"b-header__tooltip\"\n :popover-text=\"infoIconTooltipText\"\n >\n <template v-if=\"hasSlot('infoIconTooltipContent')\" #default\n ><slot name=\"infoIconTooltipContent\"\n /></template>\n </info-icon-with-popover>\n </div>\n </div>\n <div v-if=\"description || lastUpdated\" class=\"b-header__meta-container\">\n <bento-typography v-if=\"description\" class=\"b-header__description\" el=\"div\">\n {{ description }}\n </bento-typography>\n <div v-if=\"lastUpdated\" class=\"b-header__timestamp-section\">\n <bento-typography class=\"b-header__timestamp\" el=\"div\">\n {{ timestamp }}\n </bento-typography>\n <bento-loading-button\n v-if=\"reloadButton\"\n variant=\"tertiary\"\n :state=\"reloadButton.state\"\n @click=\"reloadButton.event\"\n ><template #iconLeft><reload-icon aria-hidden=\"true\" /></template\n >{{ reloadButton.title }}</bento-loading-button\n >\n </div>\n </div>\n <button-actions-with-menu\n v-if=\"actions\"\n :actions=\"actions\"\n :displayed-actions=\"2\"\n class=\"b-header__actions\"\n />\n </div>\n </header>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import ReloadIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import { InfoIconWithPopover } from '@/internal';\n import { BentoButtonActionsList, BentoLoadingButton } from '@/components/button';\n import { useHasSlot } from '@/composables';\n import { BentoHeaderReloadButton, BentoHeaderVariant } from './header.types';\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '@/components/typography';\n import { useI18n } from '@/utils/ts/i18n';\n import { getDateLocale } from '@/utils/ts/get-date-locale/get-date-locale';\n import ButtonActionsWithMenu from '../internal/button-actions-with-menu/button-actions-with-menu.vue';\n\n import formatDistanceToNow from 'date-fns/formatDistanceToNow';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n export default defineComponent({\n i18n: { messages },\n name: 'bento-header',\n components: {\n BentoTypography,\n ButtonActionsWithMenu,\n BentoLoadingButton,\n InfoIconWithPopover,\n ReloadIcon,\n },\n props: {\n /**\n * Array of BentoButtonActionsList to show to the right of the title\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * Text showed under the title\n */\n description: { type: String, default: null },\n\n /**\n * Text showed in the info-icon tooltip on hover\n */\n infoIconTooltipText: { type: InfoIconWithPopover.props.popoverText.type, default: null },\n\n /**\n * Popover position of the info icon text.\n */\n infoIconPopoverPosition: {\n type: InfoIconWithPopover.props.popoverPosition.type,\n default: InfoIconWithPopover.props.popoverPosition.default,\n validator: InfoIconWithPopover.props.popoverPosition.validator,\n },\n\n /**\n * JavaScript \"Date\" object for when the content was last updated\n */\n lastUpdated: { type: [Date, Number], default: null },\n\n /**\n * Variant represents type of Header\n * @values page, component\n */\n variant: {\n type: String as PropType<BentoHeaderVariant | `${BentoHeaderVariant}`>,\n default: BentoHeaderVariant.PAGE,\n validator: (value: BentoHeaderVariant) => Object.values(BentoHeaderVariant).includes(value),\n },\n\n /**\n * Text used as a title\n */\n title: { type: String, required: true },\n\n /**\n * Reload button which shows next to the header's timestamp\n * {@see BentoHeaderReloadButton}\n */\n reloadButton: {\n type: Object as PropType<BentoHeaderReloadButton>,\n default: null,\n },\n },\n emits: ['reload'],\n setup(props, { slots }) {\n const { t, locale } = useI18n<{ message: MessageSchema }>({ messages });\n // TODO to replace with dynamic import\n const locales = getDateLocale();\n\n const conditionalClasses = computed(() => ({\n 'b-header--component': props.variant === BentoHeaderVariant.COMPONENT,\n }));\n\n const typography = computed(() => ({\n el: props.variant === BentoHeaderVariant.PAGE ? BentoTypographyElement.H1 : BentoTypographyElement.H2,\n variant: BentoTypographyVariant.TITLE,\n medium: props.variant === BentoHeaderVariant.COMPONENT,\n large: props.variant === BentoHeaderVariant.PAGE,\n }));\n\n const timestamp = computed(() =>\n props.lastUpdated\n ? t('lastUpdated', {\n date: formatDistanceToNow(props.lastUpdated, {\n locale: locales[locale.value.substring(0, 2)] || locales.enUS,\n }),\n })\n : null\n );\n return {\n hasSlot: useHasSlot(slots),\n conditionalClasses,\n timestamp,\n typography,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./header.scss\" />\n"],"names":["differenceInMilliseconds","dateLeft","dateRight","requiredArgs","toDate","roundingMap","value","defaultRoundingMethod","getRoundingMethod","method","differenceInSeconds","options","diff","MINUTES_IN_DAY","MINUTES_IN_ALMOST_TWO_DAYS","MINUTES_IN_MONTH","MINUTES_IN_TWO_MONTHS","formatDistance","dirtyDate","dirtyBaseDate","locale$1","locale","comparison","compareAsc","localizeOptions","cloneObject","seconds","offsetInSeconds","getTimezoneOffsetInMilliseconds","minutes","months","hours","days","differenceInMonths","nearestMonth","monthsSinceStartOfYear","years","formatDistanceToNow","dirtyOptions","BentoHeaderVariant","BentoHeaderVariant2","_sfc_main","defineComponent","messages","BentoTypography","ButtonActionsWithMenu","BentoLoadingButton","InfoIconWithPopover","RefreshIcon","props","slots","t","useI18n","locales","getDateLocale","conditionalClasses","computed","typography","BentoTypographyElement","BentoTypographyVariant","timestamp","useHasSlot"],"mappings":";;;;;;;;;;;;;;AA6Be,SAAAA,EAAAC,GAAAC,GAAA;AACf,SAAAC,EAAA,GAAA,SAAA,GACAC,EAAAH,CAAA,EAAA,QAAA,IAAAG,EAAAF,CAAA,EAAA,QAAA;AACA;AChCA,IAAAG,IAAA;AAAA,EACA,MAAA,KAAA;AAAA,EACA,OAAA,KAAA;AAAA,EACA,OAAA,KAAA;AAAA,EACA,OAAA,SAAAC,GAAA;AACA,WAAAA,IAAA,IAAA,KAAA,KAAAA,CAAA,IAAA,KAAA,MAAAA,CAAA;AAAA,EACA;AAAA;AAEA,GACAC,IAAA;AACO,SAAAC,EAAAC,GAAA;AACP,SAAAJ,EAAAE,CAAA;AACA;ACoBe,SAAAG,EAAAT,GAAAC,GAAAS,GAAA;AACf,EAAAR,EAAA,GAAA,SAAA;AACA,MAAAS,IAAAZ,EAAAC,GAAAC,CAAA,IAAA;AACA,SAAAM,EAAA,EAAAI,CAAA;AACA;AC5BA,IAAAC,IAAA,MACAC,IAAA,MACAC,IAAA,OACAC,IAAA;AA8Ge,SAAAC,EAAAC,GAAAC,GAAA;AACf,MAAAR,IAAA,UAAA,SAAA,KAAA,UAAA,CAAA,MAAA,SAAA,UAAA,CAAA,IAAA,CAAA;AACA,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AAAJ;AAAA,MAAA,MAAAP,EAAA,cAAAE,EAAA,eAAA;AAAA,QAEA,MAAAd,EAAAY,EAAA,aAAA;AAAA,UACA,QAAAI,EAAAhC,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAgC,EAAA;AAAA,QACA,CAAA;AAAA,MACA,CAAA,IAAA;AAAA,IAEA;AAEA,WAAA;AAAA,MAAA,SAAAQ,EAAAX,CAAA;AAAA,MACA,oBAAAK;AAAA,MACA,WAAAK;AAAA,MACA,YAAAH;AAAA,IACA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4]}
@@ -501,7 +501,7 @@ var Ne = function() {
501
501
  Pe,
502
502
  !1,
503
503
  null,
504
- "08ba868c"
504
+ "f7030411"
505
505
  );
506
506
  const tt = Ae.exports;
507
507
  export {
@@ -511,4 +511,4 @@ export {
511
511
  fe as O,
512
512
  C as a
513
513
  };
514
- //# sourceMappingURL=menu.W_kuhRKI.js.map
514
+ //# sourceMappingURL=menu.BCD4FW54.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu.W_kuhRKI.js","sources":["../../src/components/menu/menu.keys.ts","../../../ui-assets/icons-16/dist/vue/options-vertical.vue","../../src/components/menu/components/menu-item/menu-item.vue","../../src/components/menu/menu.types.ts","../../src/components/data-grid/components/data-grid-cell/data-grid-cell.keys.ts","../../src/components/menu/components/menu-list-container/menu-list-container.vue","../../src/components/menu/components/sub-menu-item-list/sub-menu-item-list.vue","../../src/components/menu/composables/use-dynamic-menu-size/use-dynamic-menu-size.ts","../../src/components/menu/components/menu-item-list/menu-item-list.vue","../../src/components/menu/menu.vue"],"sourcesContent":["export const MENU_INVERSE_INJECTION_KEY = Symbol('menu inverse style injection key');\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#001222\" d=\"M8 4C8.29667 4 8.58668 3.91203 8.83335 3.74721C9.08003 3.58238 9.27229 3.34811 9.38582 3.07403C9.49935 2.79994 9.52906 2.49834 9.47118 2.20737C9.4133 1.91639 9.27044 1.64912 9.06066 1.43934C8.85088 1.22956 8.58361 1.0867 8.29264 1.02882C8.00167 0.970945 7.70006 1.00065 7.42598 1.11418C7.15189 1.22771 6.91762 1.41997 6.7528 1.66665C6.58797 1.91332 6.5 2.20333 6.5 2.5C6.5 2.89783 6.65803 3.27936 6.93934 3.56066C7.22064 3.84197 7.60218 4 8 4Z\"/><path fill=\"#001222\" d=\"M8 15C8.29667 15 8.58668 14.912 8.83335 14.7472C9.08003 14.5824 9.27229 14.3481 9.38582 14.074C9.49935 13.7999 9.52906 13.4983 9.47118 13.2074C9.4133 12.9164 9.27044 12.6491 9.06066 12.4393C8.85088 12.2296 8.58361 12.0867 8.29264 12.0288C8.00167 11.9709 7.70006 12.0007 7.42598 12.1142C7.15189 12.2277 6.91762 12.42 6.7528 12.6666C6.58797 12.9133 6.5 13.2033 6.5 13.5C6.5 13.8978 6.65803 14.2794 6.93934 14.5607C7.22064 14.842 7.60218 15 8 15Z\"/><path fill=\"#001222\" d=\"M8.83335 9.24721C8.58668 9.41203 8.29667 9.5 8 9.5C7.60218 9.5 7.22064 9.34197 6.93934 9.06066C6.65803 8.77936 6.5 8.39783 6.5 8C6.5 7.70333 6.58797 7.41332 6.7528 7.16665C6.91762 6.91997 7.15189 6.72771 7.42598 6.61418C7.70006 6.50065 8.00167 6.47094 8.29264 6.52882C8.58361 6.5867 8.85088 6.72956 9.06066 6.93934C9.27044 7.14912 9.4133 7.41639 9.47118 7.70737C9.52906 7.99834 9.49935 8.29994 9.38582 8.57403C9.27229 8.84811 9.08003 9.08238 8.83335 9.24721Z\"/></svg>\n</template>\n<script>\n import '../css/main.css';\n\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n","<template>\n <base-button\n class=\"b-menu-item\"\n role=\"menuitem\"\n :class=\"conditionalClasses\"\n :disabled=\"disabled\"\n tabindex=\"-1\"\n @click=\"onClick\"\n >\n <template v-if=\"icon\" #iconLeft>\n <component :is=\"icon\" class=\"b-menu-item__icon-left\" aria-hidden=\"true\" />\n </template>\n <template #default>\n <bento-typography el=\"span\" variant=\"body\" :stronger=\"isTitle\" class=\"b-menu-item__primary-text\">\n {{ text }}\n </bento-typography>\n <bento-typography v-if=\"computedSecondaryText\" el=\"span\" variant=\"body\" class=\"b-menu-item__secondary-text\">\n {{ computedSecondaryText }}\n </bento-typography>\n </template>\n <template v-if=\"chevron\" #iconRight><chevron-right-icon aria-hidden=\"true\" /></template>\n </base-button>\n</template>\n\n<script lang=\"ts\">\n import { BaseButton, BentoBaseButtonEvent } from '@/components/internal/base-button';\n import { BentoTypography } from '@/components/typography';\n import { truncate } from '@/utils/ts/truncate';\n import ChevronRightIcon from '@adyen/ui-assets-icons-16/vue/chevron-right';\n import { computed, defineComponent, PropType } from 'vue';\n import { BentoMenuItem } from './menu-item.types';\n\n /**\n * Menu item component to render items in a menu. For internal use only.\n */\n export default defineComponent({\n name: 'menu-item',\n components: { BaseButton, BentoTypography, ChevronRightIcon },\n props: {\n /**\n * menu-item text that gets displayed as the main label\n */\n text: {\n type: String,\n required: true,\n },\n /**\n * menu-item action that gets executed when the MeniItem is clicked\n */\n handler: {\n type: Function as PropType<BentoMenuItem['handler']>,\n required: true,\n },\n /**\n * menu-item text that gets displayed as the secondary label\n */\n secondaryText: {\n type: String,\n default: null,\n },\n /**\n * Optional chevron icon displayed to the right of the menu-item\n */\n chevron: {\n type: Boolean,\n default: false,\n },\n /**\n * Optional icon displayed to the left of the menu-item\n */\n icon: {\n // Types for Vue2 (Object) and Vue3 (Function)\n // TODO: Remove Object when fully migrated to Vue3\n type: [Object, Function] as PropType<BentoMenuItem['icon']>,\n default: null,\n },\n /**\n * Disables menu-item button functionality\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays an indent variant od the menu-item\n */\n indent: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays menu-item button as critical\n */\n critical: {\n type: Boolean,\n default: false,\n },\n /**\n * Renders the text in a bold variant\n */\n isTitle: {\n type: Boolean,\n default: false,\n },\n },\n emits: [BentoBaseButtonEvent.CLICK],\n setup(props, { emit }) {\n const MAX_SECONDARY_TEXT_LENGTH = 10;\n\n const conditionalClasses = computed(() => ({\n 'b-menu-item--critical': props.critical,\n 'b-menu-item--indent': props.indent,\n }));\n\n const computedSecondaryText = computed(() => truncate(props.secondaryText, MAX_SECONDARY_TEXT_LENGTH));\n\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n props.handler();\n emit(BentoBaseButtonEvent.CLICK);\n };\n\n return {\n // Values\n conditionalClasses,\n computedSecondaryText,\n\n // Methods\n onClick,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./menu-item.scss\" />\n","import { OnClickOutsideOptions } from '@/directives/click-outside/types';\nimport { BentoButton } from '../button';\nimport { BentoPopoverPositions } from '../popover';\nimport { BentoMenuItem } from './components';\n\nexport * from './components/menu-item/menu-item.types';\n\nexport enum BentoMenuEvent {\n BACK = 'back',\n CLOSE = 'close',\n OPEN = 'open',\n}\n\ntype ButtonProps = InstanceType<typeof BentoButton>['$props'];\n\nexport type BentoMenuButtonProps = {\n variant?: ButtonProps['variant'];\n condensed?: ButtonProps['condensed'];\n disabled?: ButtonProps['disabled'];\n};\n\nexport interface BentoMenuProps {\n /**\n * Object containing props to change the menu button appearance. Accepts the same props present in BentoButton.\n */\n button?: BentoMenuButtonProps;\n /**\n * Controls if the menu should close when an item is clicked.\n * Defaults to `true`.\n */\n closeMenuOnItemSelect?: boolean;\n /**\n * The data to be displayed in the list\n */\n data: BentoMenuItem[];\n /**\n * Disables opening the menu when the down arrow key is pressed.\n */\n disableArrowDownOpeningMenu?: boolean;\n /**\n * The position of where the menu should open.\n */\n menuPosition?: BentoPopoverPositions | `${BentoPopoverPositions}`;\n /**\n * Instructs the menu popover to be visible outside of the containing container.\n * @see {@link https://floating-ui.com/docs/usefloating#strategy}\n */\n menuFixedPositioning?: boolean;\n /**\n * Sets a custom width for the menu popover.\n */\n menuWidth?: number;\n /**\n * Returns focus to the menu button after popover is closed.\n * Disable if focus management is delegated to the parent component.\n * Defaults to `true`.\n */\n revertFocusToButton?: boolean;\n /**\n * Can be used to set the inner teleport component to render the menu's popover in the root `body` DOM node\n * (or `dialog` if popover is inside a dialog).\n */\n teleport?: boolean;\n /**\n * Can be used to set the inner teleport component to render the menu's popover in the root `body` DOM node\n * (or `dialog` if popover is inside a dialog).\n *\n * @see {@link OnClickOutsideOptions}\n */\n closeOnClickOutsideOptions?: OnClickOutsideOptions;\n}\n","export const DATA_GRID_CELL_MENU_REGISTERING_INJECTION_KEY = Symbol('menu registering injection key');\n","<template>\n <div\n ref=\"menuListContainerRef\"\n class=\"b-menu-list-container\"\n data-testid=\"menu-list-container\"\n v-on=\"menuListContainerEvents\"\n ><slot></slot\n ></div>\n</template>\n\n<script setup lang=\"ts\">\n import { DATA_GRID_CELL_MENU_REGISTERING_INJECTION_KEY } from '@/components/data-grid/components/data-grid-cell/data-grid-cell.keys';\n import { inject, ref } from 'vue';\n import type { DataGridCellRegisterMenu } from '@/components/data-grid/components/data-grid-cell/data-grid-cell.types';\n\n const menuListContainerRef = ref<HTMLDivElement>();\n const menuListContainerEvents = ref({});\n const registeringAndMousingOut = inject<DataGridCellRegisterMenu | false>(\n DATA_GRID_CELL_MENU_REGISTERING_INJECTION_KEY,\n false\n );\n\n // This is needed by the DataGridCell component in order to keep track of if a teleported menu\n // is being hovered over in the DataGridCellActions.\n if (registeringAndMousingOut) {\n const { registerMenuContainerElement } = registeringAndMousingOut;\n registerMenuContainerElement(menuListContainerRef);\n menuListContainerEvents.value = {\n mouseleave: registeringAndMousingOut?.menuMouseLeave,\n };\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Menu list container component to set the correct styling in a menu list. For internal use only.\n */\n export default {\n name: 'bento-menu-list-container',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./menu-list-container.scss\" />\n","<template>\n <transition name=\"b-sub-menu-item-list__transition\" appear>\n <menu-list-container class=\"b-sub-menu-item-list\">\n <ul\n ref=\"subMenuItemListRefLocal\"\n role=\"menu\"\n class=\"b-sub-menu-item-list__list\"\n @keydown.down.stop=\"focusNext\"\n @keydown.up.stop=\"focusPrevious\"\n @keydown.esc.stop=\"onBackButton\"\n >\n <li v-for=\"(item, index) in computedItems\" :key=\"`sub-menu-item-list-item-${index}`\" role=\"none\">\n <menu-item\n :text=\"item.text\"\n :handler=\"item.handler\"\n :secondary-text=\"item.secondaryText\"\n :icon=\"item.icon\"\n :is-title=\"item.isTitle\"\n :disabled=\"item.disabled\"\n :critical=\"item.critical\"\n :indent=\"item.indent\"\n :tabindex=\"index === subMenuFocusedIndex ? '0' : '-1'\"\n @click=\"item.clickHandler\"\n />\n <bento-divider v-if=\"item.addDivider\" class=\"b-sub-menu-item-list__divider\" />\n </li>\n </ul>\n </menu-list-container>\n </transition>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, PropType, ref } from 'vue';\n import { BentoDivider } from '@/components/divider';\n import { BentoMenuItem, MenuItem } from '../menu-item';\n import MenuListContainer from '../menu-list-container/menu-list-container.vue';\n import ChevronLeftIcon from '@adyen/ui-assets-icons-16/vue/chevron-left';\n import { BentoMenuEvent } from '../../menu.types';\n import messages from '../../messages.json';\n\n /**\n * SubMenuItemList component to render a submenu with the sliding transition. For internal use only.\n */\n export default defineComponent({\n i18n: { messages },\n name: 'sub-menu-item-list',\n components: { BentoDivider, MenuItem, MenuListContainer },\n props: {\n items: {\n type: Array as PropType<BentoMenuItem[]>,\n required: true,\n },\n title: {\n type: String,\n required: true,\n },\n },\n emits: [BentoMenuEvent.CLOSE, BentoMenuEvent.BACK],\n setup(props, { emit }) {\n const subMenuItemListRefLocal = ref(null);\n const subMenuFocusedIndex = ref(0);\n const numberOfItems = ref(props.items.length);\n\n const closeMenu = () => emit(BentoMenuEvent.CLOSE);\n\n const onBackButton = () => emit(BentoMenuEvent.BACK);\n\n const computedItems = computed(() => {\n const items = props.items?.map(el => ({\n ...el,\n indent: !el.icon,\n isTitle: false,\n clickHandler: closeMenu,\n }));\n return [\n {\n text: props.title,\n secondaryText: null,\n critical: false,\n icon: ChevronLeftIcon,\n isTitle: true,\n disabled: false,\n indent: false,\n handler: onBackButton,\n clickHandler: onBackButton,\n addDivider: true,\n },\n ...items,\n ];\n });\n\n const focusItem = async () => {\n subMenuItemListRefLocal.value?.children?.[subMenuFocusedIndex.value]?.children?.[0]?.focus();\n };\n\n onMounted(async () => {\n // Using setTimeout otherwise the sliding animation doesn't work anymore. The timeout imer is the same as the transition time (0.15s)\n setTimeout(() => focusItem(), 150);\n });\n\n const focusPrevious = () => {\n if (subMenuFocusedIndex.value > 0) {\n subMenuFocusedIndex.value -= 1;\n if (computedItems.value[subMenuFocusedIndex.value].disabled) {\n focusPrevious();\n }\n } else {\n subMenuFocusedIndex.value = numberOfItems.value;\n }\n focusItem();\n };\n\n const focusNext = () => {\n if (subMenuFocusedIndex.value < numberOfItems.value) {\n subMenuFocusedIndex.value += 1;\n if (computedItems.value[subMenuFocusedIndex.value].disabled) {\n focusNext();\n }\n } else {\n subMenuFocusedIndex.value = 0;\n }\n focusItem();\n };\n\n return {\n // Enums\n BentoMenuEvent,\n\n // Values\n subMenuItemListRefLocal,\n subMenuFocusedIndex,\n ChevronLeftIcon,\n computedItems,\n\n // Methods\n closeMenu,\n onBackButton,\n focusPrevious,\n focusNext,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./sub-menu-item-list.scss\" />\n","import { computed, type CSSProperties, nextTick, type Ref, ref, watch } from 'vue';\n\n// Helper type for the expected shape of the sub-menu ref\ninterface SubMenuRef {\n $el: HTMLElement;\n}\n\n/**\n * A composable that dynamically calculates the width and height for a menu container\n * based on the content of a conditionally rendered sub-menu.\n *\n * @param subMenuItemListRef A ref to the sub-menu component instance(s).\n * @param visibleSubMenuIndex A ref indicating which sub-menu is visible.\n * @param showSubMenu A ref indicating if any sub-menu is visible.\n * @returns A computed style object to be bound to the menu container.\n */\nexport function useDynamicMenuSize(\n subMenuItemListRef: Ref<SubMenuRef[] | null>,\n visibleSubMenuIndex: Ref<number | null>,\n showSubMenu: Ref<boolean>\n) {\n const MAX_MENU_WIDTH = 350;\n const MIN_MENU_WIDTH = 150;\n\n const subMenuWidth = ref(0);\n const subMenuHeight = ref(0);\n\n /**\n * Calculates an element's dimensions in stages using an invisible clone\n * to prevent visual flicker.\n *\n * 1. **Clone**: Creates a 'ghost' copy of the element and adds it to the\n * DOM invisibly.\n * 2. **Measure Ideal Width**: Sets the ghost's width to 'max-content' to find\n * its natural, unwrapped width.\n * 3. **Calculate Final Width**: Clamps the ideal width between the defined\n * MIN and MAX constants.\n * 4. **Measure Final Height**: Applies the final clamped width to the ghost,\n * allowing content to wrap, and then measures the resulting height.\n * 5. **Cleanup**: Removes the ghost element from the DOM.\n */\n const measureSubMenuStyle = (element: HTMLElement) => {\n if (!element || !element.parentElement) {\n return;\n }\n\n // Mount it on the parent element to allow proper height size, otherwise it will be 0\n const parent = element.parentElement;\n\n // Measure the unwrapped width\n const ghost = element.cloneNode(true) as HTMLElement;\n ghost.style.position = 'absolute';\n ghost.style.visibility = 'hidden';\n parent.appendChild(ghost);\n\n // Measure the unwrapped width\n ghost.style.width = 'max-content';\n const unwrappedWidth = ghost.offsetWidth;\n\n // Calculate and store the FINAL clamped width\n const clampedWidth = Math.max(MIN_MENU_WIDTH, Math.min(unwrappedWidth, MAX_MENU_WIDTH));\n subMenuWidth.value = clampedWidth;\n\n // Measure the wrapped height using the final width\n ghost.style.width = `${clampedWidth}px`;\n const height = ghost.offsetHeight;\n\n // Update the height ref with the correct, wrapped height\n subMenuHeight.value = height;\n\n parent.removeChild(ghost);\n // Update the height ref with the correct, wrapped height\n subMenuHeight.value = height;\n };\n\n watch([visibleSubMenuIndex, showSubMenu], async ([newIndex]) => {\n if (newIndex !== null) {\n await nextTick();\n\n const subMenuElement = subMenuItemListRef.value?.[0]?.$el;\n if (subMenuElement) {\n measureSubMenuStyle(subMenuElement);\n }\n } else {\n subMenuWidth.value = 0;\n subMenuHeight.value = 0;\n }\n });\n\n const computedStyle = computed<CSSProperties>(() => {\n const style: CSSProperties = { width: 'max-content' };\n\n if (showSubMenu.value) {\n if (subMenuHeight.value > 0) {\n style.height = `${subMenuHeight.value}px`;\n }\n if (subMenuWidth.value > 0) {\n style.width = `${subMenuWidth.value}px`;\n }\n }\n\n return style;\n });\n\n return { computedStyle };\n}\n","<template>\n <menu-list-container ref=\"menuItemListWrapperRef\" :style=\"computedStyle\">\n <ul\n ref=\"menuItemListRef\"\n class=\"b-menu-item-list\"\n role=\"menu\"\n @keydown.down=\"focusNext\"\n @keydown.up=\"focusPrevious\"\n @keydown.esc=\"closeMenu\"\n @keydown.tab=\"closeMenu\"\n >\n <li\n v-for=\"(item, index) in computedData\"\n :key=\"`menu-item-${index}`\"\n ref=\"menuItemRef\"\n class=\"b-menu-item-list__item\"\n role=\"none\"\n @keydown.right=\"focusRight(item, index)\"\n @keydown.left=\"focusLeft()\"\n >\n <menu-item\n :text=\"item.text\"\n :handler=\"!item.items?.length ? item.handler : () => null\"\n :secondary-text=\"item.secondaryText\"\n :icon=\"item.icon\"\n :chevron=\"!!item.items?.length\"\n :disabled=\"item.disabled\"\n :critical=\"item.critical\"\n :indent=\"item.indent\"\n :tabindex=\"index === subMenuFocusedIndex ? '0' : '-1'\"\n :aria-haspopup=\"!!item.items?.length\"\n :aria-expanded=\"showSubMenu && visibleSubMenuIndex === index\"\n @click=\"menuItemClick(item, index)\"\n />\n <bento-divider v-if=\"item.addDivider\" class=\"b-menu-item-list__divider\" />\n <sub-menu-item-list\n v-if=\"item.items?.length && showSubMenu && visibleSubMenuIndex === index\"\n ref=\"subMenuItemListRef\"\n :items=\"item.items\"\n :title=\"item.text\"\n @back=\"onBackButton\"\n @close=\"closeMenu\"\n />\n </li>\n </ul>\n </menu-list-container>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, ref } from 'vue';\n import { isVue3 } from 'vue-demi';\n import { BentoDivider } from '@/components/divider';\n import { BentoMenuItem, MenuItem } from '../menu-item';\n import { BentoMenuEvent } from '../../menu.types';\n import MenuListContainer from '../menu-list-container/menu-list-container.vue';\n import SubMenuItemList from '../sub-menu-item-list/sub-menu-item-list.vue';\n import { useDynamicMenuSize } from '../../composables';\n\n /**\n * MenuItem list to be used in the Menu component. For internal use only.\n */\n export default defineComponent({\n name: 'menu-item-list',\n components: { BentoDivider, MenuItem, MenuListContainer, SubMenuItemList },\n props: {\n /**\n * The data to be displayed in the list\n */\n data: {\n type: Array as PropType<BentoMenuItem[]>,\n required: true,\n },\n /**\n * Displays the menu-items of the list in the indent variant. Only applies to elements that don't have an icon to their left.\n */\n indentItems: {\n type: Boolean,\n default: false,\n },\n /**\n * If set to true, focuses the last item on the list instead of the first. Used for accessibility purposes when the menu is opened with the 'up' arrow key.\n */\n focusLastElement: {\n type: Boolean,\n default: false,\n },\n /**\n * If set to true, closes the menu when an item is clicked.\n */\n closeMenuOnItemSelect: {\n type: Boolean,\n default: true,\n },\n },\n emits: [BentoMenuEvent.CLOSE, 'menu-item-click'],\n setup(props, { emit, expose }) {\n const menuItemRef = ref(null);\n const menuItemListRef = ref(null);\n const menuItemListWrapperRef = ref(null);\n const subMenuItemListRef = ref(null);\n const showSubMenu = ref(false);\n const visibleSubMenuIndex = ref(null);\n const focusedIndex = ref(props.focusLastElement ? props.data.length - 1 : 0);\n const subMenuFocusedIndex = ref(0);\n const numberOfItems = ref(props.data.length - 1);\n const hasMenuItemsWithIcon = computed(() => props.data.some(el => el.icon));\n\n const computedData = computed(() => {\n if (props.indentItems || hasMenuItemsWithIcon.value) {\n return props.data.map(el => {\n let indent = false;\n if (!el.icon) {\n indent = true;\n }\n return {\n ...el,\n indent,\n };\n });\n }\n return props.data;\n });\n\n const focusItem = async () => {\n // vue 3 requires nextTick to be called before an item can be focused\n // this function does not need to be awaited itself\n\n if (isVue3) {\n await nextTick();\n }\n\n menuItemListRef.value?.children[focusedIndex.value]?.children[0]?.focus();\n };\n\n const closeMenu = () => emit(BentoMenuEvent.CLOSE);\n\n const menuItemClick = (item: BentoMenuItem, index: number) => {\n if (item.items) {\n visibleSubMenuIndex.value = index;\n showSubMenu.value = true;\n\n return;\n }\n\n visibleSubMenuIndex.value = index;\n showSubMenu.value = false;\n\n if (!item.skipClose && props.closeMenuOnItemSelect !== false) {\n closeMenu();\n }\n\n emit('menu-item-click');\n };\n\n const focusPrevious = () => {\n if (focusedIndex.value > 0) {\n focusedIndex.value -= 1;\n if (computedData.value[focusedIndex.value].disabled) {\n focusPrevious();\n }\n } else {\n focusedIndex.value = numberOfItems.value;\n }\n focusItem();\n };\n\n const focusNext = () => {\n if (focusedIndex.value < numberOfItems.value) {\n focusedIndex.value += 1;\n if (computedData.value[focusedIndex.value].disabled) {\n focusNext();\n }\n } else {\n focusedIndex.value = 0;\n }\n focusItem();\n };\n\n const focusRight = (item, index) => {\n if (item?.items?.length) {\n visibleSubMenuIndex.value = index;\n showSubMenu.value = true;\n }\n };\n\n const focusLeft = () => {\n if (visibleSubMenuIndex.value && showSubMenu.value) {\n visibleSubMenuIndex.value = null;\n showSubMenu.value = false;\n }\n };\n\n const onBackButton = () => {\n showSubMenu.value = false;\n visibleSubMenuIndex.value = null;\n // Focus the right element\n focusItem();\n };\n\n expose({\n focusItem,\n });\n\n const { computedStyle } = useDynamicMenuSize(subMenuItemListRef, visibleSubMenuIndex, showSubMenu);\n\n return {\n // Values\n menuItemListRef,\n menuItemListWrapperRef,\n subMenuItemListRef,\n menuItemRef,\n\n computedData,\n computedStyle,\n\n focusedIndex,\n subMenuFocusedIndex,\n\n showSubMenu,\n visibleSubMenuIndex,\n\n // Methods\n menuItemClick,\n closeMenu,\n focusPrevious,\n focusNext,\n focusRight,\n focusLeft,\n onBackButton,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./menu-item-list.scss\" />\n","<template>\n <div\n :class=\"computedClasses\"\n class=\"b-menu\"\n data-testid=\"menu\"\n @keydown.down=\"onKeyDown\"\n @keydown.up=\"onKeyUp\"\n @keydown.esc=\"closeMenu()\"\n >\n <bento-toggle-button\n ref=\"menuButtonRef\"\n aria-haspopup=\"true\"\n v-bind=\"computedButtonPropsWithDefaults\"\n :aria-controls=\"showMenu ? menuId : null\"\n :toggled=\"showMenu\"\n :inverse=\"isInverseColorSet\"\n @click=\"toggleShowMenu\"\n >\n <template v-if=\"!hasSlot('default') || hasSlot('iconLeft')\" #iconLeft>\n <slot name=\"iconLeft\">\n <options-vertical-icon :title=\"t('menuButton')\" />\n </slot>\n </template>\n <template v-if=\"hasSlot('default')\" #default>\n <slot />\n </template>\n <template v-if=\"hasSlot('default')\" #iconRight>\n <chevron-down-icon />\n </template>\n </bento-toggle-button>\n\n <bento-teleport v-if=\"menuButtonRef\" :disabled=\"!teleport\">\n <bento-popover\n v-if=\"menuButtonRef\"\n :id=\"menuId\"\n ref=\"popoverRef\"\n :role=\"null\"\n :open=\"showMenu\"\n class=\"b-menu__popover\"\n :style=\"computedMenuWidth\"\n :target-element=\"menuButtonRef\"\n :position=\"menuPosition\"\n :fixed-positioning=\"menuFixedPositioning\"\n :fallback-position=\"[\n 'bottom-start',\n 'bottom-end',\n 'top-start',\n 'top-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n ]\"\n :teleport=\"teleport\"\n without-space\n >\n <menu-item-list\n ref=\"menuItemListRef\"\n :close-menu-on-item-select=\"closeMenuOnItemSelect\"\n :data=\"data\"\n :focus-last-element=\"isLastElementFocused\"\n @close=\"closeMenu\"\n @menu-item-click=\"menuItemClick\"\n />\n </bento-popover>\n </bento-teleport>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoToggleButton } from '@/components/button';\n import { DIVIDER_INVERSE_INJECTION_KEY } from '@/components/divider/divider.keys';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { useClickOutside, useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { BentoTeleport } from '@/internal';\n import { useI18n } from '@/utils/ts/i18n';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import OptionsVerticalIcon from '@adyen/ui-assets-icons-16/vue/options-vertical';\n import { computed, inject, nextTick, onMounted, provide, ref, useSlots } from 'vue';\n import { MenuItemList } from './components';\n import { MENU_INVERSE_INJECTION_KEY } from './menu.keys';\n import { BentoMenuButtonProps, BentoMenuEvent, BentoMenuProps } from './menu.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n button: { default: () => ({\n variant: 'secondary',\n }) },\n closeMenuOnItemSelect: { type: Boolean, default: true },\n data: null,\n disableArrowDownOpeningMenu: { type: Boolean, default: false },\n menuPosition: { default: BentoPopoverPositions.BOTTOM_START },\n menuFixedPositioning: { type: Boolean, default: false },\n menuWidth: { default: null },\n revertFocusToButton: { type: Boolean, default: true },\n teleport: { type: Boolean, default: false },\n closeOnClickOutsideOptions: { default: undefined }\n});\n\n const emit = defineEmits([\"menu-item-click\", \"click-outside\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const menuButtonRef = ref(null);\n const menuItemListRef = ref(null);\n const showMenu = ref(false);\n const isLastElementFocused = ref(false);\n const popoverRef = ref<HTMLElement>(null);\n const menuId = generateUid('menu');\n\n const isInverseColorSet = inject(MENU_INVERSE_INJECTION_KEY, ref(false));\n provide(DIVIDER_INVERSE_INJECTION_KEY, isInverseColorSet);\n\n const computedClasses = computed(() => ({\n 'b-menu--inverse': isInverseColorSet.value,\n }));\n\n const computedMenuWidth = computed(() => (props.menuWidth ? { width: `${props.menuWidth}px` } : null));\n const computedButtonPropsWithDefaults = computed<BentoMenuButtonProps>(() => {\n if (!props?.button) {\n return undefined;\n }\n return {\n variant: 'secondary',\n ...props.button,\n };\n });\n\n const openMenu = () => {\n showMenu.value = true;\n emit(BentoMenuEvent.OPEN);\n };\n\n const closeMenu = async (revertFocus = props.revertFocusToButton) => {\n if (!showMenu.value) {\n return;\n }\n\n showMenu.value = false;\n\n if (revertFocus) {\n // ensure that menu is closed and re-rendering is completed before focusing\n await nextTick();\n\n menuButtonRef.value?.$el?.focus();\n }\n\n emit(BentoMenuEvent.CLOSE);\n };\n\n const toggleShowMenu = (e: MouseEvent) => {\n e.stopPropagation();\n if (!showMenu.value) {\n openMenu();\n } else {\n closeMenu();\n }\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n event.preventDefault();\n\n isLastElementFocused.value = false;\n if (!props.disableArrowDownOpeningMenu) {\n openMenu();\n }\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n event.preventDefault();\n\n isLastElementFocused.value = true;\n openMenu();\n };\n\n const menuItemClick = () => {\n emit('menu-item-click');\n };\n\n // Ignore the events inside the Button and the Popover\n useClickOutside(\n popoverRef,\n () => {\n closeMenu();\n emit('click-outside');\n },\n {\n ...props.closeOnClickOutsideOptions,\n ignore: [menuButtonRef, ...(props.closeOnClickOutsideOptions?.ignore ?? [])],\n }\n );\n\n defineExpose({\n /**\n * Control to enable programmatic closing of the menu\n */\n closeMenu,\n });\n\n onMounted(() => {\n if (hasSlot('iconRight')) {\n printDevelopmentWarning(\n '\"bento-menu\" no longer supports the \"iconRight\" slot. The right-aligned icon is now fixed by design.'\n );\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Menu component to render a series of buttons. Csan render nested submenus.\n *\n * @example\n * import { BentoMenu } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoMenu },\n * template: `\n * <bento-menu\n * :data=[\n * { text: 'Menu item text', handler: () => { some code here } },\n * { text: 'Another menu item text', handler: () => { some other code here }, critical: true }\n * ]\n * />\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-menu',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./menu.scss\" />\n"],"names":["MENU_INVERSE_INJECTION_KEY","uuid","_sfc_main$5","_sfc_main$4","defineComponent","BaseButton","BentoTypography","ChevronRightIcon","BentoBaseButtonEvent","props","emit","conditionalClasses","computed","computedSecondaryText","truncate","e","BentoMenuEvent","BentoMenuEvent2","DATA_GRID_CELL_MENU_REGISTERING_INJECTION_KEY","__default__$1","menuListContainerRef","ref","menuListContainerEvents","registeringAndMousingOut","inject","registerMenuContainerElement","_sfc_main$2","messages","BentoDivider","MenuItem","MenuListContainer","subMenuItemListRefLocal","subMenuFocusedIndex","numberOfItems","closeMenu","onBackButton","computedItems","items","_a","el","ChevronLeftIcon","focusItem","_e","_d","_c","_b","onMounted","focusPrevious","focusNext","useDynamicMenuSize","subMenuItemListRef","visibleSubMenuIndex","showSubMenu","subMenuWidth","subMenuHeight","measureSubMenuStyle","element","parent","ghost","unwrappedWidth","clampedWidth","height","watch","newIndex","nextTick","subMenuElement","style","_sfc_main$1","SubMenuItemList","expose","menuItemRef","menuItemListRef","menuItemListWrapperRef","focusedIndex","hasMenuItemsWithIcon","computedData","indent","menuItemClick","item","index","focusRight","focusLeft","computedStyle","__default__","slots","useSlots","hasSlot","useHasSlot","t","useI18n","menuButtonRef","showMenu","isLastElementFocused","popoverRef","menuId","generateUid","isInverseColorSet","provide","DIVIDER_INVERSE_INJECTION_KEY","computedClasses","computedMenuWidth","computedButtonPropsWithDefaults","openMenu","revertFocus","toggleShowMenu","onKeyDown","event","onKeyUp","useClickOutside","printDevelopmentWarning"],"mappings":";;;;;;;;;;;;;;;;;;AAAa,MAAAA,KAAA,OAAA,kCAAA;ACOb,IAAAC,IAAA;AAEA,MAAAC,KAAA;AAAA,EACA,eAAA;AACA,SAAA,OAAAD,EAAA,SAAA,GACAA,KAAA;AAAA,EACA;AACA;;;;;;;;;;;;uBCqBAE,KAA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AAA;AAAA,IAAwB,GAG5BkB,IAAA,OAAAqE,IAAA9F,EAAA,wBAAA;;AACI,MAAAkF,EAAA,UAIAA,EAAA,QAAA,IAEAY,MAEI,MAAAvC,EAAA,IAEAnB,KAAAP,IAAAoD,EAAA,UAAA,gBAAApD,EAAA,QAAA,QAAAO,EAAA,UAGJnC,EAAAM,EAAA,KAAA;AAAA,IAAyB,GAG7BwF,IAAA,CAAAzF,MAAA;AACI,MAAAA,EAAA,gBAAA,GACA4E,EAAA,QAGIzD,EAAA,IAFAoE,EAAA;AAAA,IAGJ,GAGJG,IAAA,CAAAC,MAAA;AACI,MAAAA,EAAA,eAAA,GAEAd,EAAA,QAAA,IACAnF,EAAA,+BACI6F,EAAA;AAAA,IACJ,GAGJK,IAAA,CAAAD,MAAA;AACI,MAAAA,EAAA,eAAA,GAEAd,EAAA,QAAA,IACAU,EAAA;AAAA,IAAS,GAGbzB,IAAA,MAAA;AACI,MAAAnE,EAAA,iBAAA;AAAA,IAAsB;AAI1B,WAAAkG;AAAA,MAAAf;AAAA,MACI,MAAA;AAEI,QAAA3D,EAAA,GACAxB,EAAA,eAAA;AAAA,MAAoB;AAAA,MACxB;AAAA,QACA,GAAAD,EAAA;AAAA,QACa,QAAA,CAAAiF,GAAA,KAAApD,IAAA7B,EAAA,+BAAA,gBAAA6B,EAAA,WAAA,CAAA,CAAA;AAAA,MACkE;AAAA,IAC/E,GAGJ+B,EAAA;AAAA;AAAA;AAAA;AAAA,MAAa,WAAAnC;AAAA,IAIT,CAAA,GAGJY,EAAA,MAAA;AACI,MAAAwC,EAAA,WAAA,KACIuB;AAAA,QAAA;AAAA,MACI;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"menu.BCD4FW54.js","sources":["../../src/components/menu/menu.keys.ts","../../../ui-assets/icons-16/dist/vue/options-vertical.vue","../../src/components/menu/components/menu-item/menu-item.vue","../../src/components/menu/menu.types.ts","../../src/components/data-grid/components/data-grid-cell/data-grid-cell.keys.ts","../../src/components/menu/components/menu-list-container/menu-list-container.vue","../../src/components/menu/components/sub-menu-item-list/sub-menu-item-list.vue","../../src/components/menu/composables/use-dynamic-menu-size/use-dynamic-menu-size.ts","../../src/components/menu/components/menu-item-list/menu-item-list.vue","../../src/components/menu/menu.vue"],"sourcesContent":["export const MENU_INVERSE_INJECTION_KEY = Symbol('menu inverse style injection key');\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#001222\" d=\"M8 4C8.29667 4 8.58668 3.91203 8.83335 3.74721C9.08003 3.58238 9.27229 3.34811 9.38582 3.07403C9.49935 2.79994 9.52906 2.49834 9.47118 2.20737C9.4133 1.91639 9.27044 1.64912 9.06066 1.43934C8.85088 1.22956 8.58361 1.0867 8.29264 1.02882C8.00167 0.970945 7.70006 1.00065 7.42598 1.11418C7.15189 1.22771 6.91762 1.41997 6.7528 1.66665C6.58797 1.91332 6.5 2.20333 6.5 2.5C6.5 2.89783 6.65803 3.27936 6.93934 3.56066C7.22064 3.84197 7.60218 4 8 4Z\"/><path fill=\"#001222\" d=\"M8 15C8.29667 15 8.58668 14.912 8.83335 14.7472C9.08003 14.5824 9.27229 14.3481 9.38582 14.074C9.49935 13.7999 9.52906 13.4983 9.47118 13.2074C9.4133 12.9164 9.27044 12.6491 9.06066 12.4393C8.85088 12.2296 8.58361 12.0867 8.29264 12.0288C8.00167 11.9709 7.70006 12.0007 7.42598 12.1142C7.15189 12.2277 6.91762 12.42 6.7528 12.6666C6.58797 12.9133 6.5 13.2033 6.5 13.5C6.5 13.8978 6.65803 14.2794 6.93934 14.5607C7.22064 14.842 7.60218 15 8 15Z\"/><path fill=\"#001222\" d=\"M8.83335 9.24721C8.58668 9.41203 8.29667 9.5 8 9.5C7.60218 9.5 7.22064 9.34197 6.93934 9.06066C6.65803 8.77936 6.5 8.39783 6.5 8C6.5 7.70333 6.58797 7.41332 6.7528 7.16665C6.91762 6.91997 7.15189 6.72771 7.42598 6.61418C7.70006 6.50065 8.00167 6.47094 8.29264 6.52882C8.58361 6.5867 8.85088 6.72956 9.06066 6.93934C9.27044 7.14912 9.4133 7.41639 9.47118 7.70737C9.52906 7.99834 9.49935 8.29994 9.38582 8.57403C9.27229 8.84811 9.08003 9.08238 8.83335 9.24721Z\"/></svg>\n</template>\n<script>\n import '../css/main.css';\n\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n","<template>\n <base-button\n class=\"b-menu-item\"\n role=\"menuitem\"\n :class=\"conditionalClasses\"\n :disabled=\"disabled\"\n tabindex=\"-1\"\n @click=\"onClick\"\n >\n <template v-if=\"icon\" #iconLeft>\n <component :is=\"icon\" class=\"b-menu-item__icon-left\" aria-hidden=\"true\" />\n </template>\n <template #default>\n <bento-typography el=\"span\" variant=\"body\" :stronger=\"isTitle\" class=\"b-menu-item__primary-text\">\n {{ text }}\n </bento-typography>\n <bento-typography v-if=\"computedSecondaryText\" el=\"span\" variant=\"body\" class=\"b-menu-item__secondary-text\">\n {{ computedSecondaryText }}\n </bento-typography>\n </template>\n <template v-if=\"chevron\" #iconRight><chevron-right-icon aria-hidden=\"true\" /></template>\n </base-button>\n</template>\n\n<script lang=\"ts\">\n import { BaseButton, BentoBaseButtonEvent } from '@/components/internal/base-button';\n import { BentoTypography } from '@/components/typography';\n import { truncate } from '@/utils/ts/truncate';\n import ChevronRightIcon from '@adyen/ui-assets-icons-16/vue/chevron-right';\n import { computed, defineComponent, PropType } from 'vue';\n import { BentoMenuItem } from './menu-item.types';\n\n /**\n * Menu item component to render items in a menu. For internal use only.\n */\n export default defineComponent({\n name: 'menu-item',\n components: { BaseButton, BentoTypography, ChevronRightIcon },\n props: {\n /**\n * menu-item text that gets displayed as the main label\n */\n text: {\n type: String,\n required: true,\n },\n /**\n * menu-item action that gets executed when the MeniItem is clicked\n */\n handler: {\n type: Function as PropType<BentoMenuItem['handler']>,\n required: true,\n },\n /**\n * menu-item text that gets displayed as the secondary label\n */\n secondaryText: {\n type: String,\n default: null,\n },\n /**\n * Optional chevron icon displayed to the right of the menu-item\n */\n chevron: {\n type: Boolean,\n default: false,\n },\n /**\n * Optional icon displayed to the left of the menu-item\n */\n icon: {\n // Types for Vue2 (Object) and Vue3 (Function)\n // TODO: Remove Object when fully migrated to Vue3\n type: [Object, Function] as PropType<BentoMenuItem['icon']>,\n default: null,\n },\n /**\n * Disables menu-item button functionality\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays an indent variant od the menu-item\n */\n indent: {\n type: Boolean,\n default: false,\n },\n /**\n * Displays menu-item button as critical\n */\n critical: {\n type: Boolean,\n default: false,\n },\n /**\n * Renders the text in a bold variant\n */\n isTitle: {\n type: Boolean,\n default: false,\n },\n },\n emits: [BentoBaseButtonEvent.CLICK],\n setup(props, { emit }) {\n const MAX_SECONDARY_TEXT_LENGTH = 10;\n\n const conditionalClasses = computed(() => ({\n 'b-menu-item--critical': props.critical,\n 'b-menu-item--indent': props.indent,\n }));\n\n const computedSecondaryText = computed(() => truncate(props.secondaryText, MAX_SECONDARY_TEXT_LENGTH));\n\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n props.handler();\n emit(BentoBaseButtonEvent.CLICK);\n };\n\n return {\n // Values\n conditionalClasses,\n computedSecondaryText,\n\n // Methods\n onClick,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./menu-item.scss\" />\n","import { OnClickOutsideOptions } from '@/directives/click-outside/types';\nimport { BentoButton } from '../button';\nimport { BentoPopoverPositions } from '../popover';\nimport { BentoMenuItem } from './components';\n\nexport * from './components/menu-item/menu-item.types';\n\nexport enum BentoMenuEvent {\n BACK = 'back',\n CLOSE = 'close',\n OPEN = 'open',\n}\n\ntype ButtonProps = InstanceType<typeof BentoButton>['$props'];\n\nexport type BentoMenuButtonProps = {\n variant?: ButtonProps['variant'];\n condensed?: ButtonProps['condensed'];\n disabled?: ButtonProps['disabled'];\n};\n\nexport interface BentoMenuProps {\n /**\n * Object containing props to change the menu button appearance. Accepts the same props present in BentoButton.\n */\n button?: BentoMenuButtonProps;\n /**\n * Controls if the menu should close when an item is clicked.\n * Defaults to `true`.\n */\n closeMenuOnItemSelect?: boolean;\n /**\n * The data to be displayed in the list\n */\n data: BentoMenuItem[];\n /**\n * Disables opening the menu when the down arrow key is pressed.\n */\n disableArrowDownOpeningMenu?: boolean;\n /**\n * The position of where the menu should open.\n */\n menuPosition?: BentoPopoverPositions | `${BentoPopoverPositions}`;\n /**\n * Instructs the menu popover to be visible outside of the containing container.\n * @see {@link https://floating-ui.com/docs/usefloating#strategy}\n */\n menuFixedPositioning?: boolean;\n /**\n * Sets a custom width for the menu popover.\n */\n menuWidth?: number;\n /**\n * Returns focus to the menu button after popover is closed.\n * Disable if focus management is delegated to the parent component.\n * Defaults to `true`.\n */\n revertFocusToButton?: boolean;\n /**\n * Can be used to set the inner teleport component to render the menu's popover in the root `body` DOM node\n * (or `dialog` if popover is inside a dialog).\n */\n teleport?: boolean;\n /**\n * Can be used to set the inner teleport component to render the menu's popover in the root `body` DOM node\n * (or `dialog` if popover is inside a dialog).\n *\n * @see {@link OnClickOutsideOptions}\n */\n closeOnClickOutsideOptions?: OnClickOutsideOptions;\n}\n","export const DATA_GRID_CELL_MENU_REGISTERING_INJECTION_KEY = Symbol('menu registering injection key');\n","<template>\n <div\n ref=\"menuListContainerRef\"\n class=\"b-menu-list-container\"\n data-testid=\"menu-list-container\"\n v-on=\"menuListContainerEvents\"\n ><slot></slot\n ></div>\n</template>\n\n<script setup lang=\"ts\">\n import { DATA_GRID_CELL_MENU_REGISTERING_INJECTION_KEY } from '@/components/data-grid/components/data-grid-cell/data-grid-cell.keys';\n import { inject, ref } from 'vue';\n import type { DataGridCellRegisterMenu } from '@/components/data-grid/components/data-grid-cell/data-grid-cell.types';\n\n const menuListContainerRef = ref<HTMLDivElement>();\n const menuListContainerEvents = ref({});\n const registeringAndMousingOut = inject<DataGridCellRegisterMenu | false>(\n DATA_GRID_CELL_MENU_REGISTERING_INJECTION_KEY,\n false\n );\n\n // This is needed by the DataGridCell component in order to keep track of if a teleported menu\n // is being hovered over in the DataGridCellActions.\n if (registeringAndMousingOut) {\n const { registerMenuContainerElement } = registeringAndMousingOut;\n registerMenuContainerElement(menuListContainerRef);\n menuListContainerEvents.value = {\n mouseleave: registeringAndMousingOut?.menuMouseLeave,\n };\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Menu list container component to set the correct styling in a menu list. For internal use only.\n */\n export default {\n name: 'bento-menu-list-container',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./menu-list-container.scss\" />\n","<template>\n <transition name=\"b-sub-menu-item-list__transition\" appear>\n <menu-list-container class=\"b-sub-menu-item-list\">\n <ul\n ref=\"subMenuItemListRefLocal\"\n role=\"menu\"\n class=\"b-sub-menu-item-list__list\"\n @keydown.down.stop=\"focusNext\"\n @keydown.up.stop=\"focusPrevious\"\n @keydown.esc.stop=\"onBackButton\"\n >\n <li v-for=\"(item, index) in computedItems\" :key=\"`sub-menu-item-list-item-${index}`\" role=\"none\">\n <menu-item\n :text=\"item.text\"\n :handler=\"item.handler\"\n :secondary-text=\"item.secondaryText\"\n :icon=\"item.icon\"\n :is-title=\"item.isTitle\"\n :disabled=\"item.disabled\"\n :critical=\"item.critical\"\n :indent=\"item.indent\"\n :tabindex=\"index === subMenuFocusedIndex ? '0' : '-1'\"\n @click=\"item.clickHandler\"\n />\n <bento-divider v-if=\"item.addDivider\" class=\"b-sub-menu-item-list__divider\" />\n </li>\n </ul>\n </menu-list-container>\n </transition>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, onMounted, PropType, ref } from 'vue';\n import { BentoDivider } from '@/components/divider';\n import { BentoMenuItem, MenuItem } from '../menu-item';\n import MenuListContainer from '../menu-list-container/menu-list-container.vue';\n import ChevronLeftIcon from '@adyen/ui-assets-icons-16/vue/chevron-left';\n import { BentoMenuEvent } from '../../menu.types';\n import messages from '../../messages.json';\n\n /**\n * SubMenuItemList component to render a submenu with the sliding transition. For internal use only.\n */\n export default defineComponent({\n i18n: { messages },\n name: 'sub-menu-item-list',\n components: { BentoDivider, MenuItem, MenuListContainer },\n props: {\n items: {\n type: Array as PropType<BentoMenuItem[]>,\n required: true,\n },\n title: {\n type: String,\n required: true,\n },\n },\n emits: [BentoMenuEvent.CLOSE, BentoMenuEvent.BACK],\n setup(props, { emit }) {\n const subMenuItemListRefLocal = ref(null);\n const subMenuFocusedIndex = ref(0);\n const numberOfItems = ref(props.items.length);\n\n const closeMenu = () => emit(BentoMenuEvent.CLOSE);\n\n const onBackButton = () => emit(BentoMenuEvent.BACK);\n\n const computedItems = computed(() => {\n const items = props.items?.map(el => ({\n ...el,\n indent: !el.icon,\n isTitle: false,\n clickHandler: closeMenu,\n }));\n return [\n {\n text: props.title,\n secondaryText: null,\n critical: false,\n icon: ChevronLeftIcon,\n isTitle: true,\n disabled: false,\n indent: false,\n handler: onBackButton,\n clickHandler: onBackButton,\n addDivider: true,\n },\n ...items,\n ];\n });\n\n const focusItem = async () => {\n subMenuItemListRefLocal.value?.children?.[subMenuFocusedIndex.value]?.children?.[0]?.focus();\n };\n\n onMounted(async () => {\n // Using setTimeout otherwise the sliding animation doesn't work anymore. The timeout imer is the same as the transition time (0.15s)\n setTimeout(() => focusItem(), 150);\n });\n\n const focusPrevious = () => {\n if (subMenuFocusedIndex.value > 0) {\n subMenuFocusedIndex.value -= 1;\n if (computedItems.value[subMenuFocusedIndex.value].disabled) {\n focusPrevious();\n }\n } else {\n subMenuFocusedIndex.value = numberOfItems.value;\n }\n focusItem();\n };\n\n const focusNext = () => {\n if (subMenuFocusedIndex.value < numberOfItems.value) {\n subMenuFocusedIndex.value += 1;\n if (computedItems.value[subMenuFocusedIndex.value].disabled) {\n focusNext();\n }\n } else {\n subMenuFocusedIndex.value = 0;\n }\n focusItem();\n };\n\n return {\n // Enums\n BentoMenuEvent,\n\n // Values\n subMenuItemListRefLocal,\n subMenuFocusedIndex,\n ChevronLeftIcon,\n computedItems,\n\n // Methods\n closeMenu,\n onBackButton,\n focusPrevious,\n focusNext,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./sub-menu-item-list.scss\" />\n","import { computed, type CSSProperties, nextTick, type Ref, ref, watch } from 'vue';\n\n// Helper type for the expected shape of the sub-menu ref\ninterface SubMenuRef {\n $el: HTMLElement;\n}\n\n/**\n * A composable that dynamically calculates the width and height for a menu container\n * based on the content of a conditionally rendered sub-menu.\n *\n * @param subMenuItemListRef A ref to the sub-menu component instance(s).\n * @param visibleSubMenuIndex A ref indicating which sub-menu is visible.\n * @param showSubMenu A ref indicating if any sub-menu is visible.\n * @returns A computed style object to be bound to the menu container.\n */\nexport function useDynamicMenuSize(\n subMenuItemListRef: Ref<SubMenuRef[] | null>,\n visibleSubMenuIndex: Ref<number | null>,\n showSubMenu: Ref<boolean>\n) {\n const MAX_MENU_WIDTH = 350;\n const MIN_MENU_WIDTH = 150;\n\n const subMenuWidth = ref(0);\n const subMenuHeight = ref(0);\n\n /**\n * Calculates an element's dimensions in stages using an invisible clone\n * to prevent visual flicker.\n *\n * 1. **Clone**: Creates a 'ghost' copy of the element and adds it to the\n * DOM invisibly.\n * 2. **Measure Ideal Width**: Sets the ghost's width to 'max-content' to find\n * its natural, unwrapped width.\n * 3. **Calculate Final Width**: Clamps the ideal width between the defined\n * MIN and MAX constants.\n * 4. **Measure Final Height**: Applies the final clamped width to the ghost,\n * allowing content to wrap, and then measures the resulting height.\n * 5. **Cleanup**: Removes the ghost element from the DOM.\n */\n const measureSubMenuStyle = (element: HTMLElement) => {\n if (!element || !element.parentElement) {\n return;\n }\n\n // Mount it on the parent element to allow proper height size, otherwise it will be 0\n const parent = element.parentElement;\n\n // Measure the unwrapped width\n const ghost = element.cloneNode(true) as HTMLElement;\n ghost.style.position = 'absolute';\n ghost.style.visibility = 'hidden';\n parent.appendChild(ghost);\n\n // Measure the unwrapped width\n ghost.style.width = 'max-content';\n const unwrappedWidth = ghost.offsetWidth;\n\n // Calculate and store the FINAL clamped width\n const clampedWidth = Math.max(MIN_MENU_WIDTH, Math.min(unwrappedWidth, MAX_MENU_WIDTH));\n subMenuWidth.value = clampedWidth;\n\n // Measure the wrapped height using the final width\n ghost.style.width = `${clampedWidth}px`;\n const height = ghost.offsetHeight;\n\n // Update the height ref with the correct, wrapped height\n subMenuHeight.value = height;\n\n parent.removeChild(ghost);\n // Update the height ref with the correct, wrapped height\n subMenuHeight.value = height;\n };\n\n watch([visibleSubMenuIndex, showSubMenu], async ([newIndex]) => {\n if (newIndex !== null) {\n await nextTick();\n\n const subMenuElement = subMenuItemListRef.value?.[0]?.$el;\n if (subMenuElement) {\n measureSubMenuStyle(subMenuElement);\n }\n } else {\n subMenuWidth.value = 0;\n subMenuHeight.value = 0;\n }\n });\n\n const computedStyle = computed<CSSProperties>(() => {\n const style: CSSProperties = { width: 'max-content' };\n\n if (showSubMenu.value) {\n if (subMenuHeight.value > 0) {\n style.height = `${subMenuHeight.value}px`;\n }\n if (subMenuWidth.value > 0) {\n style.width = `${subMenuWidth.value}px`;\n }\n }\n\n return style;\n });\n\n return { computedStyle };\n}\n","<template>\n <menu-list-container ref=\"menuItemListWrapperRef\" :style=\"computedStyle\">\n <ul\n ref=\"menuItemListRef\"\n class=\"b-menu-item-list\"\n role=\"menu\"\n @keydown.down=\"focusNext\"\n @keydown.up=\"focusPrevious\"\n @keydown.esc=\"closeMenu\"\n @keydown.tab=\"closeMenu\"\n >\n <li\n v-for=\"(item, index) in computedData\"\n :key=\"`menu-item-${index}`\"\n ref=\"menuItemRef\"\n class=\"b-menu-item-list__item\"\n role=\"none\"\n @keydown.right=\"focusRight(item, index)\"\n @keydown.left=\"focusLeft()\"\n >\n <menu-item\n :text=\"item.text\"\n :handler=\"!item.items?.length ? item.handler : () => null\"\n :secondary-text=\"item.secondaryText\"\n :icon=\"item.icon\"\n :chevron=\"!!item.items?.length\"\n :disabled=\"item.disabled\"\n :critical=\"item.critical\"\n :indent=\"item.indent\"\n :tabindex=\"index === subMenuFocusedIndex ? '0' : '-1'\"\n :aria-haspopup=\"!!item.items?.length\"\n :aria-expanded=\"showSubMenu && visibleSubMenuIndex === index\"\n @click=\"menuItemClick(item, index)\"\n />\n <bento-divider v-if=\"item.addDivider\" class=\"b-menu-item-list__divider\" />\n <sub-menu-item-list\n v-if=\"item.items?.length && showSubMenu && visibleSubMenuIndex === index\"\n ref=\"subMenuItemListRef\"\n :items=\"item.items\"\n :title=\"item.text\"\n @back=\"onBackButton\"\n @close=\"closeMenu\"\n />\n </li>\n </ul>\n </menu-list-container>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, ref } from 'vue';\n import { isVue3 } from 'vue-demi';\n import { BentoDivider } from '@/components/divider';\n import { BentoMenuItem, MenuItem } from '../menu-item';\n import { BentoMenuEvent } from '../../menu.types';\n import MenuListContainer from '../menu-list-container/menu-list-container.vue';\n import SubMenuItemList from '../sub-menu-item-list/sub-menu-item-list.vue';\n import { useDynamicMenuSize } from '../../composables';\n\n /**\n * MenuItem list to be used in the Menu component. For internal use only.\n */\n export default defineComponent({\n name: 'menu-item-list',\n components: { BentoDivider, MenuItem, MenuListContainer, SubMenuItemList },\n props: {\n /**\n * The data to be displayed in the list\n */\n data: {\n type: Array as PropType<BentoMenuItem[]>,\n required: true,\n },\n /**\n * Displays the menu-items of the list in the indent variant. Only applies to elements that don't have an icon to their left.\n */\n indentItems: {\n type: Boolean,\n default: false,\n },\n /**\n * If set to true, focuses the last item on the list instead of the first. Used for accessibility purposes when the menu is opened with the 'up' arrow key.\n */\n focusLastElement: {\n type: Boolean,\n default: false,\n },\n /**\n * If set to true, closes the menu when an item is clicked.\n */\n closeMenuOnItemSelect: {\n type: Boolean,\n default: true,\n },\n },\n emits: [BentoMenuEvent.CLOSE, 'menu-item-click'],\n setup(props, { emit, expose }) {\n const menuItemRef = ref(null);\n const menuItemListRef = ref(null);\n const menuItemListWrapperRef = ref(null);\n const subMenuItemListRef = ref(null);\n const showSubMenu = ref(false);\n const visibleSubMenuIndex = ref(null);\n const focusedIndex = ref(props.focusLastElement ? props.data.length - 1 : 0);\n const subMenuFocusedIndex = ref(0);\n const numberOfItems = ref(props.data.length - 1);\n const hasMenuItemsWithIcon = computed(() => props.data.some(el => el.icon));\n\n const computedData = computed(() => {\n if (props.indentItems || hasMenuItemsWithIcon.value) {\n return props.data.map(el => {\n let indent = false;\n if (!el.icon) {\n indent = true;\n }\n return {\n ...el,\n indent,\n };\n });\n }\n return props.data;\n });\n\n const focusItem = async () => {\n // vue 3 requires nextTick to be called before an item can be focused\n // this function does not need to be awaited itself\n\n if (isVue3) {\n await nextTick();\n }\n\n menuItemListRef.value?.children[focusedIndex.value]?.children[0]?.focus();\n };\n\n const closeMenu = () => emit(BentoMenuEvent.CLOSE);\n\n const menuItemClick = (item: BentoMenuItem, index: number) => {\n if (item.items) {\n visibleSubMenuIndex.value = index;\n showSubMenu.value = true;\n\n return;\n }\n\n visibleSubMenuIndex.value = index;\n showSubMenu.value = false;\n\n if (!item.skipClose && props.closeMenuOnItemSelect !== false) {\n closeMenu();\n }\n\n emit('menu-item-click');\n };\n\n const focusPrevious = () => {\n if (focusedIndex.value > 0) {\n focusedIndex.value -= 1;\n if (computedData.value[focusedIndex.value].disabled) {\n focusPrevious();\n }\n } else {\n focusedIndex.value = numberOfItems.value;\n }\n focusItem();\n };\n\n const focusNext = () => {\n if (focusedIndex.value < numberOfItems.value) {\n focusedIndex.value += 1;\n if (computedData.value[focusedIndex.value].disabled) {\n focusNext();\n }\n } else {\n focusedIndex.value = 0;\n }\n focusItem();\n };\n\n const focusRight = (item, index) => {\n if (item?.items?.length) {\n visibleSubMenuIndex.value = index;\n showSubMenu.value = true;\n }\n };\n\n const focusLeft = () => {\n if (visibleSubMenuIndex.value && showSubMenu.value) {\n visibleSubMenuIndex.value = null;\n showSubMenu.value = false;\n }\n };\n\n const onBackButton = () => {\n showSubMenu.value = false;\n visibleSubMenuIndex.value = null;\n // Focus the right element\n focusItem();\n };\n\n expose({\n focusItem,\n });\n\n const { computedStyle } = useDynamicMenuSize(subMenuItemListRef, visibleSubMenuIndex, showSubMenu);\n\n return {\n // Values\n menuItemListRef,\n menuItemListWrapperRef,\n subMenuItemListRef,\n menuItemRef,\n\n computedData,\n computedStyle,\n\n focusedIndex,\n subMenuFocusedIndex,\n\n showSubMenu,\n visibleSubMenuIndex,\n\n // Methods\n menuItemClick,\n closeMenu,\n focusPrevious,\n focusNext,\n focusRight,\n focusLeft,\n onBackButton,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./menu-item-list.scss\" />\n","<template>\n <div\n :class=\"computedClasses\"\n class=\"b-menu\"\n data-testid=\"menu\"\n @keydown.down=\"onKeyDown\"\n @keydown.up=\"onKeyUp\"\n @keydown.esc=\"closeMenu()\"\n >\n <bento-toggle-button\n ref=\"menuButtonRef\"\n aria-haspopup=\"true\"\n v-bind=\"computedButtonPropsWithDefaults\"\n :aria-controls=\"showMenu ? menuId : null\"\n :toggled=\"showMenu\"\n :inverse=\"isInverseColorSet\"\n @click=\"toggleShowMenu\"\n >\n <template v-if=\"!hasSlot('default') || hasSlot('iconLeft')\" #iconLeft>\n <slot name=\"iconLeft\">\n <options-vertical-icon :title=\"t('menuButton')\" />\n </slot>\n </template>\n <template v-if=\"hasSlot('default')\" #default>\n <slot />\n </template>\n <template v-if=\"hasSlot('default')\" #iconRight>\n <chevron-down-icon />\n </template>\n </bento-toggle-button>\n\n <bento-teleport v-if=\"menuButtonRef\" :disabled=\"!teleport\">\n <bento-popover\n v-if=\"menuButtonRef\"\n :id=\"menuId\"\n ref=\"popoverRef\"\n :role=\"null\"\n :open=\"showMenu\"\n class=\"b-menu__popover\"\n :style=\"computedMenuWidth\"\n :target-element=\"menuButtonRef\"\n :position=\"menuPosition\"\n :fixed-positioning=\"menuFixedPositioning\"\n :fallback-position=\"[\n 'bottom-start',\n 'bottom-end',\n 'top-start',\n 'top-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n ]\"\n :teleport=\"teleport\"\n without-space\n >\n <menu-item-list\n ref=\"menuItemListRef\"\n :close-menu-on-item-select=\"closeMenuOnItemSelect\"\n :data=\"data\"\n :focus-last-element=\"isLastElementFocused\"\n @close=\"closeMenu\"\n @menu-item-click=\"menuItemClick\"\n />\n </bento-popover>\n </bento-teleport>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoToggleButton } from '@/components/button';\n import { DIVIDER_INVERSE_INJECTION_KEY } from '@/components/divider/divider.keys';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { useClickOutside, useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { BentoTeleport } from '@/internal';\n import { useI18n } from '@/utils/ts/i18n';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import OptionsVerticalIcon from '@adyen/ui-assets-icons-16/vue/options-vertical';\n import { computed, inject, nextTick, onMounted, provide, ref, useSlots } from 'vue';\n import { MenuItemList } from './components';\n import { MENU_INVERSE_INJECTION_KEY } from './menu.keys';\n import { BentoMenuButtonProps, BentoMenuEvent, BentoMenuProps } from './menu.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n button: { default: () =>\n ({\n variant: 'secondary',\n }) as BentoMenuButtonProps },\n closeMenuOnItemSelect: { type: Boolean, default: true },\n data: null,\n disableArrowDownOpeningMenu: { type: Boolean, default: false },\n menuPosition: { default: BentoPopoverPositions.BOTTOM_START },\n menuFixedPositioning: { type: Boolean, default: false },\n menuWidth: { default: null },\n revertFocusToButton: { type: Boolean, default: true },\n teleport: { type: Boolean, default: false },\n closeOnClickOutsideOptions: { default: undefined }\n});\n\n const emit = defineEmits([\"menu-item-click\", \"click-outside\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const menuButtonRef = ref(null);\n const menuItemListRef = ref(null);\n const showMenu = ref(false);\n const isLastElementFocused = ref(false);\n const popoverRef = ref<HTMLElement>(null);\n const menuId = generateUid('menu');\n\n const isInverseColorSet = inject(MENU_INVERSE_INJECTION_KEY, ref(false));\n provide(DIVIDER_INVERSE_INJECTION_KEY, isInverseColorSet);\n\n const computedClasses = computed(() => ({\n 'b-menu--inverse': isInverseColorSet.value,\n }));\n\n const computedMenuWidth = computed(() => (props.menuWidth ? { width: `${props.menuWidth}px` } : null));\n const computedButtonPropsWithDefaults = computed<BentoMenuButtonProps>(() => {\n if (!props?.button) {\n return undefined;\n }\n return {\n variant: 'secondary',\n ...props.button,\n };\n });\n\n const openMenu = () => {\n showMenu.value = true;\n emit(BentoMenuEvent.OPEN);\n };\n\n const closeMenu = async (revertFocus = props.revertFocusToButton) => {\n if (!showMenu.value) {\n return;\n }\n\n showMenu.value = false;\n\n if (revertFocus) {\n // ensure that menu is closed and re-rendering is completed before focusing\n await nextTick();\n\n menuButtonRef.value?.$el?.focus();\n }\n\n emit(BentoMenuEvent.CLOSE);\n };\n\n const toggleShowMenu = (e: MouseEvent) => {\n e.stopPropagation();\n if (!showMenu.value) {\n openMenu();\n } else {\n closeMenu();\n }\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n event.preventDefault();\n\n isLastElementFocused.value = false;\n if (!props.disableArrowDownOpeningMenu) {\n openMenu();\n }\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n event.preventDefault();\n\n isLastElementFocused.value = true;\n openMenu();\n };\n\n const menuItemClick = () => {\n emit('menu-item-click');\n };\n\n // Ignore the events inside the Button and the Popover\n useClickOutside(\n popoverRef,\n () => {\n closeMenu();\n emit('click-outside');\n },\n {\n ...props.closeOnClickOutsideOptions,\n ignore: [menuButtonRef, ...(props.closeOnClickOutsideOptions?.ignore ?? [])],\n }\n );\n\n defineExpose({\n /**\n * Control to enable programmatic closing of the menu\n */\n closeMenu,\n });\n\n onMounted(() => {\n if (hasSlot('iconRight')) {\n printDevelopmentWarning(\n '\"bento-menu\" no longer supports the \"iconRight\" slot. The right-aligned icon is now fixed by design.'\n );\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Menu component to render a series of buttons. Csan render nested submenus.\n *\n * @example\n * import { BentoMenu } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoMenu },\n * template: `\n * <bento-menu\n * :data=[\n * { text: 'Menu item text', handler: () => { some code here } },\n * { text: 'Another menu item text', handler: () => { some other code here }, critical: true }\n * ]\n * />\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-menu',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./menu.scss\" />\n"],"names":["MENU_INVERSE_INJECTION_KEY","uuid","_sfc_main$5","_sfc_main$4","defineComponent","BaseButton","BentoTypography","ChevronRightIcon","BentoBaseButtonEvent","props","emit","conditionalClasses","computed","computedSecondaryText","truncate","e","BentoMenuEvent","BentoMenuEvent2","DATA_GRID_CELL_MENU_REGISTERING_INJECTION_KEY","__default__$1","menuListContainerRef","ref","menuListContainerEvents","registeringAndMousingOut","inject","registerMenuContainerElement","_sfc_main$2","messages","BentoDivider","MenuItem","MenuListContainer","subMenuItemListRefLocal","subMenuFocusedIndex","numberOfItems","closeMenu","onBackButton","computedItems","items","_a","el","ChevronLeftIcon","focusItem","_e","_d","_c","_b","onMounted","focusPrevious","focusNext","useDynamicMenuSize","subMenuItemListRef","visibleSubMenuIndex","showSubMenu","subMenuWidth","subMenuHeight","measureSubMenuStyle","element","parent","ghost","unwrappedWidth","clampedWidth","height","watch","newIndex","nextTick","subMenuElement","style","_sfc_main$1","SubMenuItemList","expose","menuItemRef","menuItemListRef","menuItemListWrapperRef","focusedIndex","hasMenuItemsWithIcon","computedData","indent","menuItemClick","item","index","focusRight","focusLeft","computedStyle","__default__","slots","useSlots","hasSlot","useHasSlot","t","useI18n","menuButtonRef","showMenu","isLastElementFocused","popoverRef","menuId","generateUid","isInverseColorSet","provide","DIVIDER_INVERSE_INJECTION_KEY","computedClasses","computedMenuWidth","computedButtonPropsWithDefaults","openMenu","revertFocus","toggleShowMenu","onKeyDown","event","onKeyUp","useClickOutside","printDevelopmentWarning"],"mappings":";;;;;;;;;;;;;;;;;;AAAa,MAAAA,KAAA,OAAA,kCAAA;ACOb,IAAAC,IAAA;AAEA,MAAAC,KAAA;AAAA,EACA,eAAA;AACA,SAAA,OAAAD,EAAA,SAAA,GACAA,KAAA;AAAA,EACA;AACA;;;;;;;;;;;;uBCqBAE,KAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,YAAAC,IAAA,iBAAAC,GAAA,kBAAAC,GAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,MAAA;AAAA,MAIA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,SAAA;AAAA,MAIA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,eAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,SAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,MAAA;AAAA;AAAA;AAAA,MAIA,MAAA,CAAA,QAAA,QAAA;AAAA,MAGA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,QAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;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+BAAA,gBAAA6B,EAAA,WAAA,CAAA,CAAA;AAAA,MACkE;AAAA,IAC/E,GAGJ+B,EAAA;AAAA;AAAA;AAAA;AAAA,MAAa,WAAAnC;AAAA,IAIT,CAAA,GAGJY,EAAA,MAAA;AACI,MAAAwC,EAAA,WAAA,KACIuB;AAAA,QAAA;AAAA,MACI;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as h, ref as f, computed as a, isRef as F, watch as g, nextTick as $ } from "vue";
2
- import { B as k } from "./menu.W_kuhRKI.js";
2
+ import { B as k } from "./menu.BCD4FW54.js";
3
3
  import { a as S, B as I } from "./popover.B05xkQ4e.js";
4
4
  import { B as w } from "./typography.J1v_SPG3.js";
5
5
  import { B as N } from "./image.C2D2hKat.js";
@@ -345,4 +345,4 @@ const yt = lt.exports;
345
345
  export {
346
346
  yt as t
347
347
  };
348
- //# sourceMappingURL=tutorial.BNZh6N3h.js.map
348
+ //# sourceMappingURL=tutorial.DJ_Cwp9i.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tutorial.BNZh6N3h.js","sources":["../../src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue","../../../ui-assets/icons-16/dist/vue/blocked.vue","../../src/components/tutorial/components/tutorial-popover/tutorial-popover.vue","../../src/components/tutorial/tutorial.vue"],"sourcesContent":["<template>\n <popper-container\n :target-element=\"targetElement\"\n :middleware=\"middleware\"\n position=\"top-start\"\n fixed-positioning\n disabled-focus-trap\n class=\"b-tutorial-indicator\"\n data-testid=\"tutorial-indicator\"\n >\n <div class=\"b-tutorial-indicator__highlight\" :style=\"computedStyles\"></div>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { hide, type Middleware, offset } from '@floating-ui/vue';\n import { PopperContainer } from '@/components/popper-container';\n\n const BORDER_OFFSET = 2;\n\n defineProps({\n /**\n * Tutorial indicator's target element.\n * The indicator will position itself around the target element.\n */\n targetElement: {\n type: PopperContainer.props?.targetElement.type,\n required: true,\n },\n });\n\n const computedStyles = ref({\n width: '0',\n height: '0',\n borderRadius: '0',\n });\n\n function getBorderRadius(element: HTMLElement) {\n try {\n const radius = parseFloat(getComputedStyle(element).getPropertyValue('border-radius'));\n return Number.isNaN(radius) ? '' : `${radius + 2 * BORDER_OFFSET}px`;\n } catch {\n return '';\n }\n }\n\n const middleware = [\n hide(),\n offset({\n mainAxis: BORDER_OFFSET,\n alignmentAxis: -BORDER_OFFSET,\n }),\n {\n name: 'updateIndicatorSize',\n fn: ({ x, y, elements }) => {\n const target = elements.reference as HTMLElement;\n computedStyles.value.width = `${target.offsetWidth + 4 * BORDER_OFFSET}px`;\n computedStyles.value.height = `${target.offsetHeight + 4 * BORDER_OFFSET}px`;\n computedStyles.value.borderRadius = getBorderRadius(target);\n return { x, y };\n },\n } as Middleware,\n ];\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-indicator.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-ui-assets/icons-16-blocked__a' + uuid + ')'\"><path fill=\"#001222\" d=\"M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z\"/></g><defs><clipPath :id=\"'uia-ui-assets/icons-16-blocked__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script>\n import '../css/main.css';\n\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n","<template>\n <div v-if=\"active && targetElement\">\n <tutorial-indicator v-if=\"isIndicatorVisible && targetElement\" :target-element=\"targetElement\" />\n\n <bento-popover\n :target-element=\"targetElement\"\n :position=\"position\"\n :open=\"isPopoverOpen\"\n :aria-label=\"title\"\n fixed-positioning\n class=\"b-tutorial-popover\"\n @keydown.esc.native=\"emit('finish')\"\n >\n <template v-if=\"image\" #image>\n <bento-image v-bind=\"image\" aspect-ratio=\"landscape\" class=\"b-tutorial-popover__image\" />\n </template>\n\n <div aria-hidden=\"true\" class=\"b-tutorial-popover__ripple\"></div>\n\n <div class=\"b-tutorial-popover__header\">\n <bento-typography variant=\"title\" el=\"span\"> {{ title }} </bento-typography>\n\n <bento-typography v-if=\"showSteps\" el=\"span\" class=\"b-tutorial-popover__steps\">\n {{ t('stepsOfTotal', { step, totalSteps }) }}\n </bento-typography>\n </div>\n\n <bento-typography>\n <slot />\n </bento-typography>\n\n <div class=\"b-tutorial-popover__footer\">\n <bento-menu\n v-if=\"!isFirstStep\"\n :data=\"menuData\"\n class=\"b-tutorial-popover__menu\"\n data-testid=\"menu-button\"\n />\n <div class=\"b-tutorial-popover__actions\">\n <bento-button-actions :actions=\"computedActions\" layout=\"buttons-end\" />\n </div>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, isRef, nextTick, PropType, ref, type default as Vue, watch } from 'vue';\n import { BentoMenu } from '@/components/menu';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { type BentoButtonActionObject, BentoButtonActions } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { TutorialIndicator } from './components/tutorial-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import type { BentoMenuItem } from '@/components/menu/components';\n import type { VueNodeElement } from '@/types';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from '../../tutorial.types';\n import RefreshIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import BlockedIcon from '@adyen/ui-assets-icons-16/vue/blocked';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_SCROLL_OPTIONS: BentoTutorialScrollOptions = { behavior: 'smooth' };\n\n const props = defineProps({\n /**\n * Optional configuration for the secondary action.\n * In tour tutorials, this is ignored for the introductory step.\n */\n action: {\n type: Object as PropType<BentoButtonActionObject>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is the active step (and should be visible).\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Optional illustration to display at the top of the popover.\n */\n image: {\n type: Object as PropType<BentoTutorialStep['image']>,\n default: null,\n },\n\n /**\n * Popover's position relative to the target element.\n * Possible values are:\n * 'auto', 'auto-start', 'auto-end',\n * 'top', 'top-start', 'top-end'\n * 'right', 'right-start', 'right-end'\n * 'bottom', 'bottom-start', 'bottom-end'\n * 'left', 'left-start', 'left-end'\n */\n position: {\n type: String as PropType<`${BentoPopoverPositions}`>,\n default: BentoPopoverPositions.BOTTOM_START,\n validator: (value: BentoPopoverPositions) => Object.values(BentoPopoverPositions).includes(value),\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is a single tutorial or a tour.\n */\n single: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The tutorial step number.\n * In tour tutorials, `0` is the introductory step, and is displayed next\n * to the title.\n */\n step: {\n type: Number,\n default: null,\n },\n\n /**\n * Tutorial popover's target element.\n * The popover will position itself relatively to target element.\n */\n targetElement: {\n type: [Element, Object] as PropType<VueNodeElement>,\n required: true,\n },\n\n /**\n * The tutorial step title.\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Total count of steps.\n * In tour tutorials, this does not include the introductory step, and is\n * displayed next to the title.\n */\n totalSteps: {\n type: Number,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const emit = defineEmits([\"next\", \"finish\", \"restart\"]);\n\n const ACTION_SKIP = computed<BentoButtonActionObject>(() => ({\n title: t('skipTour') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_START = computed<BentoButtonActionObject>(() => ({\n title: t('startTour') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_NEXT = computed<BentoButtonActionObject>(() => ({\n title: t('next') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_FINISH = computed<BentoButtonActionObject>(() => ({\n title: t('finish') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_OK = computed<BentoButtonActionObject>(() => ({\n title: t('ok') as string,\n event: () => emit('finish'),\n }));\n\n const isPopoverOpen = ref(false);\n const isIndicatorVisible = ref(false);\n\n const targetElement = computed(() => {\n if (isRef(props.targetElement)) {\n return ((props.targetElement.value as Vue)?.$el || props.targetElement.value) as HTMLElement;\n }\n return ((props.targetElement as Vue).$el || props.targetElement) as HTMLElement;\n });\n\n const isFirstStep = computed(() => props.step === 0);\n const isLastStep = computed(() => props.step === props.totalSteps);\n\n const showSteps = computed(() => !isFirstStep.value);\n\n const menuData = computed<BentoMenuItem[]>(() => [\n {\n text: t('restartTour'),\n handler: () => emit('restart'),\n icon: RefreshIcon,\n },\n ...(isLastStep.value\n ? []\n : [\n {\n text: t('skipTour'),\n handler: () => emit('finish'),\n icon: BlockedIcon,\n },\n ]),\n ]);\n\n const computedActions = computed(() => {\n let primaryAction: BentoButtonActionObject;\n if (isFirstStep.value) {\n primaryAction = props.single ? ACTION_OK.value : ACTION_START.value;\n } else if (isLastStep.value) {\n primaryAction = ACTION_FINISH.value;\n } else {\n primaryAction = ACTION_NEXT.value;\n }\n\n const actions = [primaryAction];\n if (isFirstStep.value && !props.single) {\n actions.push(ACTION_SKIP.value);\n } else if (props.action) {\n actions.push(props.action);\n }\n\n return actions;\n });\n\n watch(\n () => props.active,\n async isActive => {\n if (isActive && targetElement.value?.scrollIntoView) {\n targetElement.value?.scrollIntoView(\n props.scrollOptions != null ? props.scrollOptions : DEFAULT_SCROLL_OPTIONS\n );\n\n // Skip to next tick to preserve popover appear animation\n await nextTick();\n }\n\n isPopoverOpen.value = isActive;\n isIndicatorVisible.value = isActive;\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-popover.scss\" />\n","<template>\n <div class=\"b-tutorial\">\n <tutorial-popover\n v-for=\"(step, i) in steps\"\n v-bind=\"getPopoverProps(step, i)\"\n :key=\"step.title\"\n @finish=\"currentStep = -1\"\n @next=\"currentStep += 1\"\n @restart=\"currentStep = 0\"\n >\n {{ step.description }}\n </tutorial-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType, ref, watch } from 'vue';\n import { TutorialPopover } from './components/tutorial-popover';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from './tutorial.types';\n\n const props = defineProps({\n /**\n * The current step index. If provided, will start the tutorial in that step.\n */\n index: {\n type: Number,\n default: null,\n },\n\n /**\n * The steps configuration for the tutorial.\n *\n */\n steps: {\n type: Array as PropType<BentoTutorialStep[]>,\n required: true,\n validator: (value: BentoTutorialStep[]) => value.length > 0,\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n });\n\n const emit = defineEmits([\"update:index\"]);\n\n const currentStep = ref(props.index || 0);\n\n const totalSteps = computed(() => props.steps.length - 1);\n const isSingleTutorial = computed(() => totalSteps.value === 0);\n\n function getPopoverProps(step: BentoTutorialStep, index: number) {\n return {\n // Visual\n targetElement: step.target,\n image: step.image,\n title: step.title,\n step: index,\n totalSteps: totalSteps.value,\n action: step.action,\n scrollOptions: props.scrollOptions,\n\n // Config\n active: index === currentStep.value,\n single: isSingleTutorial.value,\n position: step.position,\n };\n }\n\n watch(currentStep, step => {\n emit('update:index', step);\n });\n\n watch(\n () => props.index,\n value => {\n if (value >= -1 && value <= totalSteps.value) {\n currentStep.value = value;\n }\n }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * The Tutorial is a temporary popover that should be used to educate users about\n * new or unfamiliar features or experiences.\n *\n * You can use single tutorial or chain them into a tour.\n *\n * Only use this component for new features/experiences that are not obvious and\n * self-explanatory on their own.\n *\n * @example\n * import { BentoTutorial } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTutorial },\n * template: `\n * <bento-tutorial\n * :steps=\"[\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * image: { src: imageSource, alt: 'Alt text' }\n * },\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * action: { title: 'Action label', event: () => {} }\n * },\n * ]\"\n * />\n * `\n * }\n */\n export default {};\n</script>\n"],"names":["computedStyles","ref","getBorderRadius","element","radius","middleware","hide","offset","x","y","elements","target","uuid","_sfc_main$2","__default__$1","messages","DEFAULT_SCROLL_OPTIONS","t","useI18n","ACTION_SKIP","computed","emit","ACTION_START","ACTION_NEXT","ACTION_FINISH","ACTION_OK","isPopoverOpen","isIndicatorVisible","targetElement","isRef","props","_a","isFirstStep","isLastStep","showSteps","menuData","RefreshIcon","BlockedIcon","computedActions","primaryAction","actions","watch","isActive","_b","nextTick","__default__","currentStep","totalSteps","isSingleTutorial","getPopoverProps","step","index","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgCI,UAAAA,IAAAC,EAAA;AAAA,MAA2B,OAAA;AAAA,MAChB,QAAA;AAAA,MACC,cAAA;AAAA,IACM,CAAA;AAGlB,aAAAC,EAAAC,GAAA;AACI,UAAA;AACI,cAAAC,IAAA,WAAA,iBAAAD,CAAA,EAAA,iBAAA,eAAA,CAAA;AACA,eAAA,OAAA,MAAAC,CAAA,IAAA,KAAA,GAAAA,IAAA,IAAA,CAAA;AAAA,MAAgE,QAAA;AAEhE,eAAA;AAAA,MAAO;AAAA,IACX;AAGJ,UAAAC,IAAA;AAAA,MAAmBC,EAAA;AAAA,MACVC,EAAA;AAAA,QACE,UAAA;AAAA,QACO,eAAA;AAAA,MACM,CAAA;AAAA,MACnB;AAAA,QACD,MAAA;AAAA,QACU,IAAA,CAAA,EAAA,GAAAC,GAAA,GAAAC,GAAA,UAAAC,EAAA,MAAA;AAEF,gBAAAC,IAAAD,EAAA;AACA,iBAAAV,EAAA,MAAA,QAAA,GAAAW,EAAA,cAAA,IAAA,CAAA,MACAX,EAAA,MAAA,SAAA,GAAAW,EAAA,eAAA,IAAA,CAAA,MACAX,EAAA,MAAA,eAAAE,EAAAS,CAAA,GACA,EAAA,GAAAH,GAAA,GAAAC,EAAA;AAAA,QAAc;AAAA,MACl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,IAAA7C,EAAA6B,EAAA,SAAA,CAAA,GAEAiB,IAAA3B,EAAA,MAAAU,EAAA,MAAA,SAAA,CAAA,GACAkB,IAAA5B,EAAA,MAAA2B,EAAA,UAAA,CAAA;AAEA,aAAAE,EAAAC,GAAAC,GAAA;AACI,aAAA;AAAA;AAAA,QAAO,eAAAD,EAAA;AAAA,QAEiB,OAAAA,EAAA;AAAA,QACR,OAAAA,EAAA;AAAA,QACA,MAAAC;AAAA,QACN,YAAAJ,EAAA;AAAA,QACiB,QAAAG,EAAA;AAAA,QACV,eAAApB,EAAA;AAAA;AAAA,QACQ,QAAAqB,MAAAL,EAAA;AAAA,QAGS,QAAAE,EAAA;AAAA,QACL,UAAAE,EAAA;AAAA,MACV;AAAA,IACnB;AAGJ,WAAAT,EAAAK,GAAA,CAAAI,MAAA;AACI,MAAA7B,EAAA,gBAAA6B,CAAA;AAAA,IAAyB,CAAA,GAG7BT;AAAA,MAAA,MAAAX,EAAA;AAAA,MACgB,CAAAsB,MAAA;AAER,QAAAA,KAAA,MAAAA,KAAAL,EAAA,UACID,EAAA,QAAAM;AAAA,MACJ;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"tutorial.DJ_Cwp9i.js","sources":["../../src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue","../../../ui-assets/icons-16/dist/vue/blocked.vue","../../src/components/tutorial/components/tutorial-popover/tutorial-popover.vue","../../src/components/tutorial/tutorial.vue"],"sourcesContent":["<template>\n <popper-container\n :target-element=\"targetElement\"\n :middleware=\"middleware\"\n position=\"top-start\"\n fixed-positioning\n disabled-focus-trap\n class=\"b-tutorial-indicator\"\n data-testid=\"tutorial-indicator\"\n >\n <div class=\"b-tutorial-indicator__highlight\" :style=\"computedStyles\"></div>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { hide, type Middleware, offset } from '@floating-ui/vue';\n import { PopperContainer } from '@/components/popper-container';\n\n const BORDER_OFFSET = 2;\n\n defineProps({\n /**\n * Tutorial indicator's target element.\n * The indicator will position itself around the target element.\n */\n targetElement: {\n type: PopperContainer.props?.targetElement.type,\n required: true,\n },\n });\n\n const computedStyles = ref({\n width: '0',\n height: '0',\n borderRadius: '0',\n });\n\n function getBorderRadius(element: HTMLElement) {\n try {\n const radius = parseFloat(getComputedStyle(element).getPropertyValue('border-radius'));\n return Number.isNaN(radius) ? '' : `${radius + 2 * BORDER_OFFSET}px`;\n } catch {\n return '';\n }\n }\n\n const middleware = [\n hide(),\n offset({\n mainAxis: BORDER_OFFSET,\n alignmentAxis: -BORDER_OFFSET,\n }),\n {\n name: 'updateIndicatorSize',\n fn: ({ x, y, elements }) => {\n const target = elements.reference as HTMLElement;\n computedStyles.value.width = `${target.offsetWidth + 4 * BORDER_OFFSET}px`;\n computedStyles.value.height = `${target.offsetHeight + 4 * BORDER_OFFSET}px`;\n computedStyles.value.borderRadius = getBorderRadius(target);\n return { x, y };\n },\n } as Middleware,\n ];\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-indicator.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-ui-assets/icons-16-blocked__a' + uuid + ')'\"><path fill=\"#001222\" d=\"M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z\"/></g><defs><clipPath :id=\"'uia-ui-assets/icons-16-blocked__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script>\n import '../css/main.css';\n\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n","<template>\n <div v-if=\"active && targetElement\">\n <tutorial-indicator v-if=\"isIndicatorVisible && targetElement\" :target-element=\"targetElement\" />\n\n <bento-popover\n :target-element=\"targetElement\"\n :position=\"position\"\n :open=\"isPopoverOpen\"\n :aria-label=\"title\"\n fixed-positioning\n class=\"b-tutorial-popover\"\n @keydown.esc.native=\"emit('finish')\"\n >\n <template v-if=\"image\" #image>\n <bento-image v-bind=\"image\" aspect-ratio=\"landscape\" class=\"b-tutorial-popover__image\" />\n </template>\n\n <div aria-hidden=\"true\" class=\"b-tutorial-popover__ripple\"></div>\n\n <div class=\"b-tutorial-popover__header\">\n <bento-typography variant=\"title\" el=\"span\"> {{ title }} </bento-typography>\n\n <bento-typography v-if=\"showSteps\" el=\"span\" class=\"b-tutorial-popover__steps\">\n {{ t('stepsOfTotal', { step, totalSteps }) }}\n </bento-typography>\n </div>\n\n <bento-typography>\n <slot />\n </bento-typography>\n\n <div class=\"b-tutorial-popover__footer\">\n <bento-menu\n v-if=\"!isFirstStep\"\n :data=\"menuData\"\n class=\"b-tutorial-popover__menu\"\n data-testid=\"menu-button\"\n />\n <div class=\"b-tutorial-popover__actions\">\n <bento-button-actions :actions=\"computedActions\" layout=\"buttons-end\" />\n </div>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, isRef, nextTick, PropType, ref, type default as Vue, watch } from 'vue';\n import { BentoMenu } from '@/components/menu';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { type BentoButtonActionObject, BentoButtonActions } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { TutorialIndicator } from './components/tutorial-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import type { BentoMenuItem } from '@/components/menu/components';\n import type { VueNodeElement } from '@/types';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from '../../tutorial.types';\n import RefreshIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import BlockedIcon from '@adyen/ui-assets-icons-16/vue/blocked';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_SCROLL_OPTIONS: BentoTutorialScrollOptions = { behavior: 'smooth' };\n\n const props = defineProps({\n /**\n * Optional configuration for the secondary action.\n * In tour tutorials, this is ignored for the introductory step.\n */\n action: {\n type: Object as PropType<BentoButtonActionObject>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is the active step (and should be visible).\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Optional illustration to display at the top of the popover.\n */\n image: {\n type: Object as PropType<BentoTutorialStep['image']>,\n default: null,\n },\n\n /**\n * Popover's position relative to the target element.\n * Possible values are:\n * 'auto', 'auto-start', 'auto-end',\n * 'top', 'top-start', 'top-end'\n * 'right', 'right-start', 'right-end'\n * 'bottom', 'bottom-start', 'bottom-end'\n * 'left', 'left-start', 'left-end'\n */\n position: {\n type: String as PropType<`${BentoPopoverPositions}`>,\n default: BentoPopoverPositions.BOTTOM_START,\n validator: (value: BentoPopoverPositions) => Object.values(BentoPopoverPositions).includes(value),\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is a single tutorial or a tour.\n */\n single: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The tutorial step number.\n * In tour tutorials, `0` is the introductory step, and is displayed next\n * to the title.\n */\n step: {\n type: Number,\n default: null,\n },\n\n /**\n * Tutorial popover's target element.\n * The popover will position itself relatively to target element.\n */\n targetElement: {\n type: [Element, Object] as PropType<VueNodeElement>,\n required: true,\n },\n\n /**\n * The tutorial step title.\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Total count of steps.\n * In tour tutorials, this does not include the introductory step, and is\n * displayed next to the title.\n */\n totalSteps: {\n type: Number,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const emit = defineEmits([\"next\", \"finish\", \"restart\"]);\n\n const ACTION_SKIP = computed<BentoButtonActionObject>(() => ({\n title: t('skipTour') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_START = computed<BentoButtonActionObject>(() => ({\n title: t('startTour') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_NEXT = computed<BentoButtonActionObject>(() => ({\n title: t('next') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_FINISH = computed<BentoButtonActionObject>(() => ({\n title: t('finish') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_OK = computed<BentoButtonActionObject>(() => ({\n title: t('ok') as string,\n event: () => emit('finish'),\n }));\n\n const isPopoverOpen = ref(false);\n const isIndicatorVisible = ref(false);\n\n const targetElement = computed(() => {\n if (isRef(props.targetElement)) {\n return ((props.targetElement.value as Vue)?.$el || props.targetElement.value) as HTMLElement;\n }\n return ((props.targetElement as Vue).$el || props.targetElement) as HTMLElement;\n });\n\n const isFirstStep = computed(() => props.step === 0);\n const isLastStep = computed(() => props.step === props.totalSteps);\n\n const showSteps = computed(() => !isFirstStep.value);\n\n const menuData = computed<BentoMenuItem[]>(() => [\n {\n text: t('restartTour'),\n handler: () => emit('restart'),\n icon: RefreshIcon,\n },\n ...(isLastStep.value\n ? []\n : [\n {\n text: t('skipTour'),\n handler: () => emit('finish'),\n icon: BlockedIcon,\n },\n ]),\n ]);\n\n const computedActions = computed(() => {\n let primaryAction: BentoButtonActionObject;\n if (isFirstStep.value) {\n primaryAction = props.single ? ACTION_OK.value : ACTION_START.value;\n } else if (isLastStep.value) {\n primaryAction = ACTION_FINISH.value;\n } else {\n primaryAction = ACTION_NEXT.value;\n }\n\n const actions = [primaryAction];\n if (isFirstStep.value && !props.single) {\n actions.push(ACTION_SKIP.value);\n } else if (props.action) {\n actions.push(props.action);\n }\n\n return actions;\n });\n\n watch(\n () => props.active,\n async isActive => {\n if (isActive && targetElement.value?.scrollIntoView) {\n targetElement.value?.scrollIntoView(\n props.scrollOptions != null ? props.scrollOptions : DEFAULT_SCROLL_OPTIONS\n );\n\n // Skip to next tick to preserve popover appear animation\n await nextTick();\n }\n\n isPopoverOpen.value = isActive;\n isIndicatorVisible.value = isActive;\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-popover.scss\" />\n","<template>\n <div class=\"b-tutorial\">\n <tutorial-popover\n v-for=\"(step, i) in steps\"\n v-bind=\"getPopoverProps(step, i)\"\n :key=\"step.title\"\n @finish=\"currentStep = -1\"\n @next=\"currentStep += 1\"\n @restart=\"currentStep = 0\"\n >\n {{ step.description }}\n </tutorial-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType, ref, watch } from 'vue';\n import { TutorialPopover } from './components/tutorial-popover';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from './tutorial.types';\n\n const props = defineProps({\n /**\n * The current step index. If provided, will start the tutorial in that step.\n */\n index: {\n type: Number,\n default: null,\n },\n\n /**\n * The steps configuration for the tutorial.\n *\n */\n steps: {\n type: Array as PropType<BentoTutorialStep[]>,\n required: true,\n validator: (value: BentoTutorialStep[]) => value.length > 0,\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n });\n\n const emit = defineEmits([\"update:index\"]);\n\n const currentStep = ref(props.index || 0);\n\n const totalSteps = computed(() => props.steps.length - 1);\n const isSingleTutorial = computed(() => totalSteps.value === 0);\n\n function getPopoverProps(step: BentoTutorialStep, index: number) {\n return {\n // Visual\n targetElement: step.target,\n image: step.image,\n title: step.title,\n step: index,\n totalSteps: totalSteps.value,\n action: step.action,\n scrollOptions: props.scrollOptions,\n\n // Config\n active: index === currentStep.value,\n single: isSingleTutorial.value,\n position: step.position,\n };\n }\n\n watch(currentStep, step => {\n emit('update:index', step);\n });\n\n watch(\n () => props.index,\n value => {\n if (value >= -1 && value <= totalSteps.value) {\n currentStep.value = value;\n }\n }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * The Tutorial is a temporary popover that should be used to educate users about\n * new or unfamiliar features or experiences.\n *\n * You can use single tutorial or chain them into a tour.\n *\n * Only use this component for new features/experiences that are not obvious and\n * self-explanatory on their own.\n *\n * @example\n * import { BentoTutorial } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTutorial },\n * template: `\n * <bento-tutorial\n * :steps=\"[\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * image: { src: imageSource, alt: 'Alt text' }\n * },\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * action: { title: 'Action label', event: () => {} }\n * },\n * ]\"\n * />\n * `\n * }\n */\n export default {};\n</script>\n"],"names":["computedStyles","ref","getBorderRadius","element","radius","middleware","hide","offset","x","y","elements","target","uuid","_sfc_main$2","__default__$1","messages","DEFAULT_SCROLL_OPTIONS","t","useI18n","ACTION_SKIP","computed","emit","ACTION_START","ACTION_NEXT","ACTION_FINISH","ACTION_OK","isPopoverOpen","isIndicatorVisible","targetElement","isRef","props","_a","isFirstStep","isLastStep","showSteps","menuData","RefreshIcon","BlockedIcon","computedActions","primaryAction","actions","watch","isActive","_b","nextTick","__default__","currentStep","totalSteps","isSingleTutorial","getPopoverProps","step","index","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgCI,UAAAA,IAAAC,EAAA;AAAA,MAA2B,OAAA;AAAA,MAChB,QAAA;AAAA,MACC,cAAA;AAAA,IACM,CAAA;AAGlB,aAAAC,EAAAC,GAAA;AACI,UAAA;AACI,cAAAC,IAAA,WAAA,iBAAAD,CAAA,EAAA,iBAAA,eAAA,CAAA;AACA,eAAA,OAAA,MAAAC,CAAA,IAAA,KAAA,GAAAA,IAAA,IAAA,CAAA;AAAA,MAAgE,QAAA;AAEhE,eAAA;AAAA,MAAO;AAAA,IACX;AAGJ,UAAAC,IAAA;AAAA,MAAmBC,EAAA;AAAA,MACVC,EAAA;AAAA,QACE,UAAA;AAAA,QACO,eAAA;AAAA,MACM,CAAA;AAAA,MACnB;AAAA,QACD,MAAA;AAAA,QACU,IAAA,CAAA,EAAA,GAAAC,GAAA,GAAAC,GAAA,UAAAC,EAAA,MAAA;AAEF,gBAAAC,IAAAD,EAAA;AACA,iBAAAV,EAAA,MAAA,QAAA,GAAAW,EAAA,cAAA,IAAA,CAAA,MACAX,EAAA,MAAA,SAAA,GAAAW,EAAA,eAAA,IAAA,CAAA,MACAX,EAAA,MAAA,eAAAE,EAAAS,CAAA,GACA,EA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CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAxEAC,IAAA7C,EAAA6B,EAAA,SAAA,CAAA,GAEAiB,IAAA3B,EAAA,MAAAU,EAAA,MAAA,SAAA,CAAA,GACAkB,IAAA5B,EAAA,MAAA2B,EAAA,UAAA,CAAA;AAEA,aAAAE,EAAAC,GAAAC,GAAA;AACI,aAAA;AAAA;AAAA,QAAO,eAAAD,EAAA;AAAA,QAEiB,OAAAA,EAAA;AAAA,QACR,OAAAA,EAAA;AAAA,QACA,MAAAC;AAAA,QACN,YAAAJ,EAAA;AAAA,QACiB,QAAAG,EAAA;AAAA,QACV,eAAApB,EAAA;AAAA;AAAA,QACQ,QAAAqB,MAAAL,EAAA;AAAA,QAGS,QAAAE,EAAA;AAAA,QACL,UAAAE,EAAA;AAAA,MACV;AAAA,IACnB;AAGJ,WAAAT,EAAAK,GAAA,CAAAI,MAAA;AACI,MAAA7B,EAAA,gBAAA6B,CAAA;AAAA,IAAyB,CAAA,GAG7BT;AAAA,MAAA,MAAAX,EAAA;AAAA,MACgB,CAAAsB,MAAA;AAER,QAAAA,KAAA,MAAAA,KAAAL,EAAA,UACID,EAAA,QAAAM;AAAA,MACJ;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { a as e, d as t } from "./chunks/dashboard-section.CspNW0CA.js";
1
+ import { a as e, d as t } from "./chunks/dashboard-section.Bz54Z6Hh.js";
2
2
  export {
3
3
  e as BentoDashboardSection,
4
4
  t as BentoDashboardTemplate
@@ -1,4 +1,4 @@
1
- import { d as t } from "./chunks/data-grid-template.BhzgqkZp.js";
1
+ import { d as t } from "./chunks/data-grid-template.DtFRjaR8.js";
2
2
  export {
3
3
  t as BentoDataGridTemplate
4
4
  };