@empathyco/x-components 9.3.1 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/core/index.js +3 -1
  3. package/core/index.js.map +1 -1
  4. package/docs/API-reference/api/x-components.aicarousel.md +2 -2
  5. package/docs/API-reference/api/x-components.basecolumnpickerdropdown.md +2 -2
  6. package/docs/API-reference/api/x-components.basecolumnpickerlist.md +2 -2
  7. package/docs/API-reference/api/x-components.basecurrency.md +2 -0
  8. package/docs/API-reference/api/x-components.basedropdown.md +2 -2
  9. package/docs/API-reference/api/x-components.baseeventsmodalclose.md +2 -2
  10. package/docs/API-reference/api/x-components.baseeventsmodalopen.md +2 -2
  11. package/docs/API-reference/api/x-components.basemodal.md +2 -2
  12. package/docs/API-reference/api/x-components.basepricefilterlabel.md +2 -0
  13. package/docs/API-reference/api/x-components.baseresultcurrentprice.md +2 -0
  14. package/docs/API-reference/api/x-components.baseresultpreviousprice.md +2 -0
  15. package/docs/API-reference/api/x-components.clearhistoryqueries.md +2 -2
  16. package/docs/API-reference/api/x-components.deepmergewithdefaults.md +85 -0
  17. package/docs/API-reference/api/x-components.editablenumberrangefilter.md +2 -2
  18. package/docs/API-reference/api/x-components.facets.md +2 -2
  19. package/docs/API-reference/api/x-components.filterssearch.md +2 -2
  20. package/docs/API-reference/api/x-components.historyqueriesswitch.md +2 -2
  21. package/docs/API-reference/api/x-components.historyquery.md +2 -2
  22. package/docs/API-reference/api/x-components.md +30 -0
  23. package/docs/API-reference/api/x-components.pageloaderbutton.md +2 -2
  24. package/docs/API-reference/api/x-components.pageselector.md +2 -2
  25. package/docs/API-reference/api/x-components.removehistoryquery.md +2 -2
  26. package/docs/API-reference/api/x-components.scrolltotop.md +2 -2
  27. package/docs/API-reference/api/x-components.searchinput.md +2 -2
  28. package/docs/API-reference/api/x-components.sliderfilter.md +2 -2
  29. package/docs/API-reference/api/x-components.sortdropdown.md +2 -2
  30. package/docs/API-reference/api/x-components.useaccessibilitylabels.md +72 -0
  31. package/docs/API-reference/components/common/currency/x-components.base-currency.md +19 -0
  32. package/docs/API-reference/components/common/filters/labels/x-components.base-price-filter-label.md +37 -0
  33. package/docs/API-reference/components/common/result/x-components.base-result-current-price.md +21 -0
  34. package/docs/API-reference/components/common/result/x-components.base-result-previous-price.md +22 -0
  35. package/js/components/base-dropdown.vue.js.map +1 -1
  36. package/js/components/base-dropdown.vue2.js +11 -4
  37. package/js/components/base-dropdown.vue2.js.map +1 -1
  38. package/js/components/base-keyboard-navigation.vue2.js +1 -0
  39. package/js/components/base-keyboard-navigation.vue2.js.map +1 -1
  40. package/js/components/column-picker/base-column-picker-dropdown.vue.js.map +1 -1
  41. package/js/components/column-picker/base-column-picker-dropdown.vue2.js +10 -3
  42. package/js/components/column-picker/base-column-picker-dropdown.vue2.js.map +1 -1
  43. package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
  44. package/js/components/column-picker/base-column-picker-list.vue2.js +10 -3
  45. package/js/components/column-picker/base-column-picker-list.vue2.js.map +1 -1
  46. package/js/components/currency/base-currency.vue.js.map +1 -1
  47. package/js/components/currency/base-currency.vue2.js +8 -1
  48. package/js/components/currency/base-currency.vue2.js.map +1 -1
  49. package/js/components/display-click-provider.vue.js +2 -1
  50. package/js/components/display-click-provider.vue.js.map +1 -1
  51. package/js/components/filters/labels/base-price-filter-label.vue.js +8 -0
  52. package/js/components/filters/labels/base-price-filter-label.vue.js.map +1 -1
  53. package/js/components/highlight.vue2.js +1 -0
  54. package/js/components/highlight.vue2.js.map +1 -1
  55. package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
  56. package/js/components/modals/base-events-modal-close.vue2.js +10 -3
  57. package/js/components/modals/base-events-modal-close.vue2.js.map +1 -1
  58. package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
  59. package/js/components/modals/base-events-modal-open.vue2.js +10 -3
  60. package/js/components/modals/base-events-modal-open.vue2.js.map +1 -1
  61. package/js/components/modals/base-id-modal-close.vue2.js +2 -1
  62. package/js/components/modals/base-id-modal-close.vue2.js.map +1 -1
  63. package/js/components/modals/base-id-modal-open.vue2.js +2 -1
  64. package/js/components/modals/base-id-modal-open.vue2.js.map +1 -1
  65. package/js/components/modals/base-id-modal.vue2.js +2 -1
  66. package/js/components/modals/base-id-modal.vue2.js.map +1 -1
  67. package/js/components/modals/base-modal.vue.js.map +1 -1
  68. package/js/components/modals/base-modal.vue2.js +3 -3
  69. package/js/components/modals/base-modal.vue2.js.map +1 -1
  70. package/js/components/page-loader-button.vue.js.map +1 -1
  71. package/js/components/page-loader-button.vue2.js +3 -3
  72. package/js/components/page-loader-button.vue2.js.map +1 -1
  73. package/js/components/page-selector.vue.js.map +1 -1
  74. package/js/components/page-selector.vue2.js +3 -3
  75. package/js/components/page-selector.vue2.js.map +1 -1
  76. package/js/components/panels/base-id-toggle-panel-button.vue2.js +1 -0
  77. package/js/components/panels/base-id-toggle-panel-button.vue2.js.map +1 -1
  78. package/js/components/panels/base-id-toggle-panel.vue2.js +2 -1
  79. package/js/components/panels/base-id-toggle-panel.vue2.js.map +1 -1
  80. package/js/components/result/base-result-current-price.vue.js +3 -2
  81. package/js/components/result/base-result-current-price.vue.js.map +1 -1
  82. package/js/components/result/base-result-current-price.vue2.js +6 -0
  83. package/js/components/result/base-result-current-price.vue2.js.map +1 -1
  84. package/js/components/result/base-result-link.vue2.js +2 -1
  85. package/js/components/result/base-result-link.vue2.js.map +1 -1
  86. package/js/components/result/base-result-previous-price.vue.js +3 -2
  87. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  88. package/js/components/result/base-result-previous-price.vue2.js +6 -0
  89. package/js/components/result/base-result-previous-price.vue2.js.map +1 -1
  90. package/js/components/result/base-result-rating.vue2.js +2 -1
  91. package/js/components/result/base-result-rating.vue2.js.map +1 -1
  92. package/js/components/sort/sort-dropdown.vue.js.map +1 -1
  93. package/js/components/sort/sort-dropdown.vue2.js +10 -3
  94. package/js/components/sort/sort-dropdown.vue2.js.map +1 -1
  95. package/js/components/suggestions/base-suggestion.vue2.js +1 -0
  96. package/js/components/suggestions/base-suggestion.vue2.js.map +1 -1
  97. package/js/composables/use-accessibility-labels.js +40 -0
  98. package/js/composables/use-accessibility-labels.js.map +1 -0
  99. package/js/index.js +3 -1
  100. package/js/index.js.map +1 -1
  101. package/js/utils/accessibility.js +1 -19
  102. package/js/utils/accessibility.js.map +1 -1
  103. package/js/utils/deep-merge-with-defaults.js +47 -0
  104. package/js/utils/deep-merge-with-defaults.js.map +1 -0
  105. package/js/x-installer/x-installer.js +0 -4
  106. package/js/x-installer/x-installer.js.map +1 -1
  107. package/js/x-modules/ai/components/ai-carousel.vue.js.map +1 -1
  108. package/js/x-modules/ai/components/ai-carousel.vue2.js +3 -3
  109. package/js/x-modules/ai/components/ai-carousel.vue2.js.map +1 -1
  110. package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js +1 -0
  111. package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js.map +1 -1
  112. package/js/x-modules/empathize/components/empathize.vue2.js +2 -2
  113. package/js/x-modules/facets/components/facets/facets-provider.vue2.js +1 -0
  114. package/js/x-modules/facets/components/facets/facets-provider.vue2.js.map +1 -1
  115. package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
  116. package/js/x-modules/facets/components/facets/facets.vue2.js +9 -3
  117. package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
  118. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
  119. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js +3 -3
  120. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js.map +1 -1
  121. package/js/x-modules/facets/components/filters/slider-filter.vue.js.map +1 -1
  122. package/js/x-modules/facets/components/filters/slider-filter.vue2.js +3 -3
  123. package/js/x-modules/facets/components/filters/slider-filter.vue2.js.map +1 -1
  124. package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
  125. package/js/x-modules/facets/components/lists/filters-search.vue2.js +10 -3
  126. package/js/x-modules/facets/components/lists/filters-search.vue2.js.map +1 -1
  127. package/js/x-modules/facets/components/lists/sorted-filters.vue.js +1 -0
  128. package/js/x-modules/facets/components/lists/sorted-filters.vue.js.map +1 -1
  129. package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
  130. package/js/x-modules/history-queries/components/clear-history-queries.vue2.js +10 -3
  131. package/js/x-modules/history-queries/components/clear-history-queries.vue2.js.map +1 -1
  132. package/js/x-modules/history-queries/components/history-queries-switch.vue.js.map +1 -1
  133. package/js/x-modules/history-queries/components/history-queries-switch.vue2.js +10 -3
  134. package/js/x-modules/history-queries/components/history-queries-switch.vue2.js.map +1 -1
  135. package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
  136. package/js/x-modules/history-queries/components/history-query.vue2.js +10 -3
  137. package/js/x-modules/history-queries/components/history-query.vue2.js.map +1 -1
  138. package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
  139. package/js/x-modules/history-queries/components/remove-history-query.vue2.js +10 -3
  140. package/js/x-modules/history-queries/components/remove-history-query.vue2.js.map +1 -1
  141. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +1 -0
  142. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
  143. package/js/x-modules/queries-preview/components/query-preview.vue2.js +2 -2
  144. package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js +1 -0
  145. package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js.map +1 -1
  146. package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js +1 -0
  147. package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js.map +1 -1
  148. package/js/x-modules/recommendations/components/recommendations.vue2.js +1 -0
  149. package/js/x-modules/recommendations/components/recommendations.vue2.js.map +1 -1
  150. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +2 -1
  151. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -1
  152. package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
  153. package/js/x-modules/scroll/components/scroll-to-top.vue2.js +3 -3
  154. package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
  155. package/js/x-modules/search/wiring.js +1 -0
  156. package/js/x-modules/search/wiring.js.map +1 -1
  157. package/js/x-modules/search-box/components/search-input.vue.js.map +1 -1
  158. package/js/x-modules/search-box/components/search-input.vue2.js +11 -4
  159. package/js/x-modules/search-box/components/search-input.vue2.js.map +1 -1
  160. package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js +1 -0
  161. package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js.map +1 -1
  162. package/package.json +2 -2
  163. package/report/x-components.api.json +485 -52
  164. package/report/x-components.api.md +54 -43
  165. package/types/src/components/base-dropdown.vue.d.ts +2 -2
  166. package/types/src/components/column-picker/base-column-picker-dropdown.vue.d.ts +2 -2
  167. package/types/src/components/column-picker/base-column-picker-dropdown.vue.d.ts.map +1 -1
  168. package/types/src/components/column-picker/base-column-picker-list.vue.d.ts +2 -2
  169. package/types/src/components/column-picker/base-column-picker-list.vue.d.ts.map +1 -1
  170. package/types/src/components/currency/base-currency.vue.d.ts +12 -0
  171. package/types/src/components/currency/base-currency.vue.d.ts.map +1 -1
  172. package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts +12 -0
  173. package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts.map +1 -1
  174. package/types/src/components/modals/base-events-modal-close.vue.d.ts +2 -2
  175. package/types/src/components/modals/base-events-modal-close.vue.d.ts.map +1 -1
  176. package/types/src/components/modals/base-events-modal-open.vue.d.ts +2 -2
  177. package/types/src/components/modals/base-events-modal-open.vue.d.ts.map +1 -1
  178. package/types/src/components/modals/base-modal.vue.d.ts +2 -2
  179. package/types/src/components/modals/base-modal.vue.d.ts.map +1 -1
  180. package/types/src/components/page-loader-button.vue.d.ts +2 -2
  181. package/types/src/components/page-loader-button.vue.d.ts.map +1 -1
  182. package/types/src/components/page-selector.vue.d.ts +2 -2
  183. package/types/src/components/page-selector.vue.d.ts.map +1 -1
  184. package/types/src/components/result/base-result-current-price.vue.d.ts +12 -0
  185. package/types/src/components/result/base-result-current-price.vue.d.ts.map +1 -1
  186. package/types/src/components/result/base-result-previous-price.vue.d.ts +12 -0
  187. package/types/src/components/result/base-result-previous-price.vue.d.ts.map +1 -1
  188. package/types/src/components/sort/sort-dropdown.vue.d.ts +2 -2
  189. package/types/src/components/sort/sort-dropdown.vue.d.ts.map +1 -1
  190. package/types/src/composables/index.d.ts +1 -0
  191. package/types/src/composables/index.d.ts.map +1 -1
  192. package/types/src/composables/use-accessibility-labels.d.ts +31 -0
  193. package/types/src/composables/use-accessibility-labels.d.ts.map +1 -0
  194. package/types/src/utils/accessibility.d.ts +0 -10
  195. package/types/src/utils/accessibility.d.ts.map +1 -1
  196. package/types/src/utils/deep-merge-with-defaults.d.ts +28 -0
  197. package/types/src/utils/deep-merge-with-defaults.d.ts.map +1 -0
  198. package/types/src/utils/index.d.ts +1 -0
  199. package/types/src/utils/index.d.ts.map +1 -1
  200. package/types/src/x-installer/x-installer.d.ts.map +1 -1
  201. package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts +2 -2
  202. package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts.map +1 -1
  203. package/types/src/x-modules/facets/components/facets/facets.vue.d.ts +2 -2
  204. package/types/src/x-modules/facets/components/facets/facets.vue.d.ts.map +1 -1
  205. package/types/src/x-modules/facets/components/filters/editable-number-range-filter.vue.d.ts +2 -2
  206. package/types/src/x-modules/facets/components/filters/editable-number-range-filter.vue.d.ts.map +1 -1
  207. package/types/src/x-modules/facets/components/filters/slider-filter.vue.d.ts +2 -2
  208. package/types/src/x-modules/facets/components/filters/slider-filter.vue.d.ts.map +1 -1
  209. package/types/src/x-modules/facets/components/lists/filters-search.vue.d.ts +2 -2
  210. package/types/src/x-modules/facets/components/lists/filters-search.vue.d.ts.map +1 -1
  211. package/types/src/x-modules/history-queries/components/clear-history-queries.vue.d.ts +2 -2
  212. package/types/src/x-modules/history-queries/components/clear-history-queries.vue.d.ts.map +1 -1
  213. package/types/src/x-modules/history-queries/components/history-queries-switch.vue.d.ts +2 -2
  214. package/types/src/x-modules/history-queries/components/history-queries-switch.vue.d.ts.map +1 -1
  215. package/types/src/x-modules/history-queries/components/history-query.vue.d.ts +2 -2
  216. package/types/src/x-modules/history-queries/components/history-query.vue.d.ts.map +1 -1
  217. package/types/src/x-modules/history-queries/components/remove-history-query.vue.d.ts +2 -2
  218. package/types/src/x-modules/history-queries/components/remove-history-query.vue.d.ts.map +1 -1
  219. package/types/src/x-modules/scroll/components/scroll-to-top.vue.d.ts +2 -2
  220. package/types/src/x-modules/scroll/components/scroll-to-top.vue.d.ts.map +1 -1
  221. package/types/src/x-modules/search-box/components/search-input.vue.d.ts +2 -2
  222. package/types/src/x-modules/search-box/components/search-input.vue.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"base-column-picker-list.vue.js","sources":["../../../../src/components/column-picker/base-column-picker-list.vue"],"sourcesContent":["<template>\n <div class=\"x-column-picker-list xds:button-group\" data-test=\"column-picker-list\" role=\"list\">\n <template\n v-for=\"({ column, cssClasses, events, isSelected }, index) in columnsWithCssClasses\"\n :key=\"column\"\n >\n <BaseEventButton\n class=\"x-column-picker-list__button xds:button\"\n :class=\"[buttonClass, cssClasses]\"\n data-test=\"column-picker-button\"\n :aria-pressed=\"isSelected.toString()\"\n :events=\"events\"\n :aria-label=\"ariaLabels?.button!(column)\"\n role=\"listitem\"\n >\n <!--\n @slot Customized Column Picker Button content. Specifying a slot with the column value\n will result in the column using that slot composition to render.\n @binding {number} column - Columns Number to pick.\n @binding {boolean} isSelected - True if the columns number are the chosen value.\n -->\n <slot v-bind=\"{ column, isSelected }\">\n {{ column }}\n </slot>\n </BaseEventButton>\n\n <!--\n @slot Customized Column Picker divider. Specify an element to act as divider for\n the items in the column picker. Empty by default.\n -->\n <slot v-if=\"index !== columnsWithCssClasses.length - 1\" name=\"divider\"></slot>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../types'\nimport type { VueCSSClasses } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring'\nimport { computed, defineComponent, inject, onBeforeMount, ref, watch } from 'vue'\nimport { use$x } from '../../composables/use-$x'\nimport { ACCESSIBILITY_KEY } from '../../types'\nimport BaseEventButton from '../base-event-button.vue'\n\nexport interface ColumnPickerItem {\n column: number\n cssClasses: VueCSSClasses\n events: Partial<XEventsTypes>\n isSelected: boolean\n}\n\n/**\n * Column picker list component renders a list of buttons to choose the columns number.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'BaseColumnPickerList',\n components: { BaseEventButton },\n props: {\n /** An array of numbers that represents the number of columns to render. */\n columns: {\n type: Array as PropType<number[]>,\n required: true,\n },\n /** The value of the selected columns number. */\n modelValue: Number,\n /** Class inherited by each button. */\n buttonClass: String,\n },\n emits: ['update:modelValue'],\n setup(props, { emit }) {\n const $x = use$x()\n\n const { baseColumnPickerList: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n const providedSelectedColumns = computed(() => props.modelValue ?? props.columns[0])\n const selectedColumns = ref(providedSelectedColumns.value)\n\n /**\n * Assigns `selectedColumns` value and emits `ColumnsNumberProvided`.\n *\n * @param column - Column number provided.\n */\n function emitColumnsNumberProvided(column: number) {\n selectedColumns.value = column\n $x.emit('ColumnsNumberProvided', column)\n }\n\n /**\n * Emits `update:modelValue` with the column selected.\n *\n * @param column - Column number selected.\n */\n function emitUpdateModelValue(column: number) {\n if (props.modelValue !== column) {\n emit('update:modelValue', column)\n }\n }\n\n watch(providedSelectedColumns, emitColumnsNumberProvided)\n watch(selectedColumns, emitUpdateModelValue)\n\n $x.on('ColumnsNumberProvided', false).subscribe(column => (selectedColumns.value = column))\n\n /**\n * Synchronizes the columns number before mounting the component. If the real number of selected\n * columns equals the provided columns, it emits the event to sync it with every other component.\n * If it is not equal it means that the user has already selected a number of columns, so we emit\n * a `update:modelValue` event so developers can sync the provided value.\n */\n onBeforeMount(() => {\n if (selectedColumns.value === providedSelectedColumns.value) {\n emitColumnsNumberProvided(selectedColumns.value)\n } else {\n emitUpdateModelValue(selectedColumns.value)\n }\n })\n\n /**\n * Maps the column to an object containing: the `column` and `CSS classes`.\n *\n * @returns An array of objects containing the column number and CSS classes.\n */\n const columnsWithCssClasses = computed<ColumnPickerItem[]>(() =>\n props.columns.map(column => ({\n column,\n cssClasses: [\n `x-column-picker-list__button--${column}-cols`,\n { 'xds:selected': selectedColumns.value === column },\n ],\n isSelected: selectedColumns.value === column,\n events: {\n UserClickedColumnPicker: column,\n ColumnsNumberProvided: column,\n },\n })),\n )\n\n return { ariaLabels, columnsWithCssClasses }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis component renders a list of elements in different slots depending on the columns prop. Each\nbutton emits the needed events to sync other instances of column pickers or grids with the\nnumber of columns being selected when clicked.\n\n### Default usage\n\nIt is required to send the columns prop.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n### Using v-model\n\nIt is possible to do two-way binding in order to synchronize the value with the parent. It will be\nupdated if the value changes or if the parent changes it.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" v-model=\"selectedColumns\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\nconst selectedColumns = ref(4)\n</script>\n```\n\n### Customized usage\n\n#### Overriding the slots\n\nIt is possible to override the column picker button content.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\">\n <template #default=\"{ column, isSelected }\">\n <span>{{ column }} {{ isSelected ? '🟢' : '' }}</span>\n </template>\n </BaseColumnPickerList>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\nIt is also possible to add a divider element between the column picker buttons by overriding the\n`divider` slot.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\">\n <template #divider>\n <ChevronRightIcon aria-hidden=\"true\" />\n </template>\n </BaseColumnPickerList>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\nimport ChevronRightIcon from '@empathyco/x-components/js/components/icons/chevron-right.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n#### Customizing the buttons with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" buttonClass=\"xds:button-circle\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedColumnPicker`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks an item. The event payload is the number of columns\n that the clicked item represents.\n- [`ColumnsNumberProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted on component mount. The event payload is the current `selectedColumns` value.\n</docs>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_createVNode","_normalizeClass","_renderSlot","_mergeProps","_createTextVNode","_createCommentVNode"],"mappings":";;;;;EACO,KAAA,EAAM,uCAAA;AAAA,EAAwC,WAAA,EAAU,oBAAA;AAAA,EAAqB,IAAA,EAAK;;;;AAAvF,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CA+BM,OA/BN,UAAA,EA+BM;AAAA,KAAAD,SAAA,CAAA,IAAA,CAAA,EA9BJC,kBAAA;AAAA,MA6BWC,QAAA;AAAA,MAAA,IAAA;AAAA,MAAAC,UAAA,CA5BqD,4BAAqB,CAAA,EAAzE,MAAA,EAAQ,YAAY,MAAA,EAAQ,UAAA,IAAc,KAAA,KAAK;;;iBACnD,MAAA,EAAM;AAAA,UAAA;AAAA,YAEZC,WAAA,CAkBkB,0BAAA,EAAA;AAAA,cAjBhB,KAAA,EAAKC,cAAA,CAAA,CAAC,yCAAA,EAAyC,CACtC,kBAAa,UAAU,CAAA,CAAA,CAAA;AAAA,cAChC,WAAA,EAAU,sBAAA;AAAA,cACT,cAAA,EAAc,WAAW,QAAA,EAAQ;AAAA,cACjC,MAAA;AAAA,cACA,YAAA,EAAY,IAAA,CAAA,UAAA,EAAY,MAAA,CAAQ,MAAM,CAAA;AAAA,cACvC,IAAA,EAAK;AAAA,aAAA,EAAA;+BAQL,MAEO;AAAA,gBAFPC,WAEO,IAAA,CAAA,MAAA,EAAA,SAAA,EAFPC,UAAA,CAEO,qBAFS,MAAA,EAAQ,UAAA,KAAxB,MAEO;AAAA,kBAAAC,eAAA;oCADF,MAAM,CAAA;AAAA,oBAAA;AAAA;AAAA;AAAA,iBAAA;;;;;YAQD,KAAA,KAAU,IAAA,CAAA,qBAAA,CAAsB,MAAA,GAAM,CAAA,GAAlDF,UAAA,CAA8E,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,CAAA,GAAAG,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-column-picker-list.vue.js","sources":["../../../../src/components/column-picker/base-column-picker-list.vue"],"sourcesContent":["<template>\n <div class=\"x-column-picker-list xds:button-group\" data-test=\"column-picker-list\" role=\"list\">\n <template\n v-for=\"({ column, cssClasses, events, isSelected }, index) in columnsWithCssClasses\"\n :key=\"column\"\n >\n <BaseEventButton\n class=\"x-column-picker-list__button xds:button\"\n :class=\"[buttonClass, cssClasses]\"\n data-test=\"column-picker-button\"\n :aria-pressed=\"isSelected.toString()\"\n :events=\"events\"\n :aria-label=\"ariaLabels?.button!(column)\"\n role=\"listitem\"\n >\n <!--\n @slot Customized Column Picker Button content. Specifying a slot with the column value\n will result in the column using that slot composition to render.\n @binding {number} column - Columns Number to pick.\n @binding {boolean} isSelected - True if the columns number are the chosen value.\n -->\n <slot v-bind=\"{ column, isSelected }\">\n {{ column }}\n </slot>\n </BaseEventButton>\n\n <!--\n @slot Customized Column Picker divider. Specify an element to act as divider for\n the items in the column picker. Empty by default.\n -->\n <slot v-if=\"index !== columnsWithCssClasses.length - 1\" name=\"divider\"></slot>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring'\nimport { computed, defineComponent, onBeforeMount, ref, watch } from 'vue'\nimport { useAccessibilityLabels } from '../../composables'\nimport { use$x } from '../../composables/use-$x'\nimport BaseEventButton from '../base-event-button.vue'\n\nexport interface ColumnPickerItem {\n column: number\n cssClasses: VueCSSClasses\n events: Partial<XEventsTypes>\n isSelected: boolean\n}\n\n/**\n * Column picker list component renders a list of buttons to choose the columns number.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'BaseColumnPickerList',\n components: { BaseEventButton },\n props: {\n /** An array of numbers that represents the number of columns to render. */\n columns: {\n type: Array as PropType<number[]>,\n required: true,\n },\n /** The value of the selected columns number. */\n modelValue: Number,\n /** Class inherited by each button. */\n buttonClass: String,\n },\n emits: ['update:modelValue'],\n setup(props, { emit }) {\n const $x = use$x()\n\n const ariaLabels = useAccessibilityLabels('baseColumnPickerList')\n\n const providedSelectedColumns = computed(() => props.modelValue ?? props.columns[0])\n const selectedColumns = ref(providedSelectedColumns.value)\n\n /**\n * Assigns `selectedColumns` value and emits `ColumnsNumberProvided`.\n *\n * @param column - Column number provided.\n */\n function emitColumnsNumberProvided(column: number) {\n selectedColumns.value = column\n $x.emit('ColumnsNumberProvided', column)\n }\n\n /**\n * Emits `update:modelValue` with the column selected.\n *\n * @param column - Column number selected.\n */\n function emitUpdateModelValue(column: number) {\n if (props.modelValue !== column) {\n emit('update:modelValue', column)\n }\n }\n\n watch(providedSelectedColumns, emitColumnsNumberProvided)\n watch(selectedColumns, emitUpdateModelValue)\n\n $x.on('ColumnsNumberProvided', false).subscribe(column => (selectedColumns.value = column))\n\n /**\n * Synchronizes the columns number before mounting the component. If the real number of selected\n * columns equals the provided columns, it emits the event to sync it with every other component.\n * If it is not equal it means that the user has already selected a number of columns, so we emit\n * a `update:modelValue` event so developers can sync the provided value.\n */\n onBeforeMount(() => {\n if (selectedColumns.value === providedSelectedColumns.value) {\n emitColumnsNumberProvided(selectedColumns.value)\n } else {\n emitUpdateModelValue(selectedColumns.value)\n }\n })\n\n /**\n * Maps the column to an object containing: the `column` and `CSS classes`.\n *\n * @returns An array of objects containing the column number and CSS classes.\n */\n const columnsWithCssClasses = computed<ColumnPickerItem[]>(() =>\n props.columns.map(column => ({\n column,\n cssClasses: [\n `x-column-picker-list__button--${column}-cols`,\n { 'xds:selected': selectedColumns.value === column },\n ],\n isSelected: selectedColumns.value === column,\n events: {\n UserClickedColumnPicker: column,\n ColumnsNumberProvided: column,\n },\n })),\n )\n\n return { ariaLabels, columnsWithCssClasses }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis component renders a list of elements in different slots depending on the columns prop. Each\nbutton emits the needed events to sync other instances of column pickers or grids with the\nnumber of columns being selected when clicked.\n\n### Default usage\n\nIt is required to send the columns prop.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n### Using v-model\n\nIt is possible to do two-way binding in order to synchronize the value with the parent. It will be\nupdated if the value changes or if the parent changes it.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" v-model=\"selectedColumns\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\nconst selectedColumns = ref(4)\n</script>\n```\n\n### Customized usage\n\n#### Overriding the slots\n\nIt is possible to override the column picker button content.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\">\n <template #default=\"{ column, isSelected }\">\n <span>{{ column }} {{ isSelected ? '🟢' : '' }}</span>\n </template>\n </BaseColumnPickerList>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\nIt is also possible to add a divider element between the column picker buttons by overriding the\n`divider` slot.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\">\n <template #divider>\n <ChevronRightIcon aria-hidden=\"true\" />\n </template>\n </BaseColumnPickerList>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\nimport ChevronRightIcon from '@empathyco/x-components/js/components/icons/chevron-right.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n#### Customizing the buttons with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" buttonClass=\"xds:button-circle\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedColumnPicker`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks an item. The event payload is the number of columns\n that the clicked item represents.\n- [`ColumnsNumberProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted on component mount. The event payload is the current `selectedColumns` value.\n</docs>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_createVNode","_normalizeClass","_renderSlot","_mergeProps","_createTextVNode","_createCommentVNode"],"mappings":";;;;;EACO,KAAA,EAAM,uCAAA;AAAA,EAAwC,WAAA,EAAU,oBAAA;AAAA,EAAqB,IAAA,EAAK;;;;AAAvF,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CA+BM,OA/BN,UAAA,EA+BM;AAAA,KAAAD,SAAA,CAAA,IAAA,CAAA,EA9BJC,kBAAA;AAAA,MA6BWC,QAAA;AAAA,MAAA,IAAA;AAAA,MAAAC,UAAA,CA5BqD,4BAAqB,CAAA,EAAzE,MAAA,EAAQ,YAAY,MAAA,EAAQ,UAAA,IAAc,KAAA,KAAK;;;iBACnD,MAAA,EAAM;AAAA,UAAA;AAAA,YAEZC,WAAA,CAkBkB,0BAAA,EAAA;AAAA,cAjBhB,KAAA,EAAKC,cAAA,CAAA,CAAC,yCAAA,EAAyC,CACtC,kBAAa,UAAU,CAAA,CAAA,CAAA;AAAA,cAChC,WAAA,EAAU,sBAAA;AAAA,cACT,cAAA,EAAc,WAAW,QAAA,EAAQ;AAAA,cACjC,MAAA;AAAA,cACA,YAAA,EAAY,IAAA,CAAA,UAAA,EAAY,MAAA,CAAQ,MAAM,CAAA;AAAA,cACvC,IAAA,EAAK;AAAA,aAAA,EAAA;+BAQL,MAEO;AAAA,gBAFPC,WAEO,IAAA,CAAA,MAAA,EAAA,SAAA,EAFPC,UAAA,CAEO,qBAFS,MAAA,EAAQ,UAAA,KAAxB,MAEO;AAAA,kBAAAC,eAAA;oCADF,MAAM,CAAA;AAAA,oBAAA;AAAA;AAAA;AAAA,iBAAA;;;;;YAQD,KAAA,KAAU,IAAA,CAAA,qBAAA,CAAsB,MAAA,GAAM,CAAA,GAAlDF,UAAA,CAA8E,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,CAAA,GAAAG,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;;;;;;"}
@@ -1,6 +1,13 @@
1
- import { defineComponent, inject, computed, ref, watch, onBeforeMount } from 'vue';
1
+ import { defineComponent, computed, ref, watch, onBeforeMount } from 'vue';
2
+ import '../../composables/create-use-device.js';
2
3
  import { use$x } from '../../composables/use-_x.js';
3
- import { ACCESSIBILITY_KEY } from '../../types/accessibility.js';
4
+ import { useAccessibilityLabels } from '../../composables/use-accessibility-labels.js';
5
+ import 'vuex';
6
+ import '../../plugins/x-bus.js';
7
+ import '@empathyco/x-utils';
8
+ import '../../plugins/x-plugin.js';
9
+ import '@vueuse/core';
10
+ import 'rxjs';
4
11
  import BaseEventButton from '../base-event-button.vue.js';
5
12
 
6
13
  /**
@@ -28,7 +35,7 @@ var _sfc_main = defineComponent({
28
35
  emits: ['update:modelValue'],
29
36
  setup(props, { emit }) {
30
37
  const $x = use$x();
31
- const { baseColumnPickerList: ariaLabels } = inject(ACCESSIBILITY_KEY);
38
+ const ariaLabels = useAccessibilityLabels('baseColumnPickerList');
32
39
  const providedSelectedColumns = computed(() => props.modelValue ?? props.columns[0]);
33
40
  const selectedColumns = ref(providedSelectedColumns.value);
34
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"base-column-picker-list.vue2.js","sources":["../../../../src/components/column-picker/base-column-picker-list.vue"],"sourcesContent":["<template>\n <div class=\"x-column-picker-list xds:button-group\" data-test=\"column-picker-list\" role=\"list\">\n <template\n v-for=\"({ column, cssClasses, events, isSelected }, index) in columnsWithCssClasses\"\n :key=\"column\"\n >\n <BaseEventButton\n class=\"x-column-picker-list__button xds:button\"\n :class=\"[buttonClass, cssClasses]\"\n data-test=\"column-picker-button\"\n :aria-pressed=\"isSelected.toString()\"\n :events=\"events\"\n :aria-label=\"ariaLabels?.button!(column)\"\n role=\"listitem\"\n >\n <!--\n @slot Customized Column Picker Button content. Specifying a slot with the column value\n will result in the column using that slot composition to render.\n @binding {number} column - Columns Number to pick.\n @binding {boolean} isSelected - True if the columns number are the chosen value.\n -->\n <slot v-bind=\"{ column, isSelected }\">\n {{ column }}\n </slot>\n </BaseEventButton>\n\n <!--\n @slot Customized Column Picker divider. Specify an element to act as divider for\n the items in the column picker. Empty by default.\n -->\n <slot v-if=\"index !== columnsWithCssClasses.length - 1\" name=\"divider\"></slot>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../types'\nimport type { VueCSSClasses } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring'\nimport { computed, defineComponent, inject, onBeforeMount, ref, watch } from 'vue'\nimport { use$x } from '../../composables/use-$x'\nimport { ACCESSIBILITY_KEY } from '../../types'\nimport BaseEventButton from '../base-event-button.vue'\n\nexport interface ColumnPickerItem {\n column: number\n cssClasses: VueCSSClasses\n events: Partial<XEventsTypes>\n isSelected: boolean\n}\n\n/**\n * Column picker list component renders a list of buttons to choose the columns number.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'BaseColumnPickerList',\n components: { BaseEventButton },\n props: {\n /** An array of numbers that represents the number of columns to render. */\n columns: {\n type: Array as PropType<number[]>,\n required: true,\n },\n /** The value of the selected columns number. */\n modelValue: Number,\n /** Class inherited by each button. */\n buttonClass: String,\n },\n emits: ['update:modelValue'],\n setup(props, { emit }) {\n const $x = use$x()\n\n const { baseColumnPickerList: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n const providedSelectedColumns = computed(() => props.modelValue ?? props.columns[0])\n const selectedColumns = ref(providedSelectedColumns.value)\n\n /**\n * Assigns `selectedColumns` value and emits `ColumnsNumberProvided`.\n *\n * @param column - Column number provided.\n */\n function emitColumnsNumberProvided(column: number) {\n selectedColumns.value = column\n $x.emit('ColumnsNumberProvided', column)\n }\n\n /**\n * Emits `update:modelValue` with the column selected.\n *\n * @param column - Column number selected.\n */\n function emitUpdateModelValue(column: number) {\n if (props.modelValue !== column) {\n emit('update:modelValue', column)\n }\n }\n\n watch(providedSelectedColumns, emitColumnsNumberProvided)\n watch(selectedColumns, emitUpdateModelValue)\n\n $x.on('ColumnsNumberProvided', false).subscribe(column => (selectedColumns.value = column))\n\n /**\n * Synchronizes the columns number before mounting the component. If the real number of selected\n * columns equals the provided columns, it emits the event to sync it with every other component.\n * If it is not equal it means that the user has already selected a number of columns, so we emit\n * a `update:modelValue` event so developers can sync the provided value.\n */\n onBeforeMount(() => {\n if (selectedColumns.value === providedSelectedColumns.value) {\n emitColumnsNumberProvided(selectedColumns.value)\n } else {\n emitUpdateModelValue(selectedColumns.value)\n }\n })\n\n /**\n * Maps the column to an object containing: the `column` and `CSS classes`.\n *\n * @returns An array of objects containing the column number and CSS classes.\n */\n const columnsWithCssClasses = computed<ColumnPickerItem[]>(() =>\n props.columns.map(column => ({\n column,\n cssClasses: [\n `x-column-picker-list__button--${column}-cols`,\n { 'xds:selected': selectedColumns.value === column },\n ],\n isSelected: selectedColumns.value === column,\n events: {\n UserClickedColumnPicker: column,\n ColumnsNumberProvided: column,\n },\n })),\n )\n\n return { ariaLabels, columnsWithCssClasses }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis component renders a list of elements in different slots depending on the columns prop. Each\nbutton emits the needed events to sync other instances of column pickers or grids with the\nnumber of columns being selected when clicked.\n\n### Default usage\n\nIt is required to send the columns prop.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n### Using v-model\n\nIt is possible to do two-way binding in order to synchronize the value with the parent. It will be\nupdated if the value changes or if the parent changes it.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" v-model=\"selectedColumns\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\nconst selectedColumns = ref(4)\n</script>\n```\n\n### Customized usage\n\n#### Overriding the slots\n\nIt is possible to override the column picker button content.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\">\n <template #default=\"{ column, isSelected }\">\n <span>{{ column }} {{ isSelected ? '🟢' : '' }}</span>\n </template>\n </BaseColumnPickerList>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\nIt is also possible to add a divider element between the column picker buttons by overriding the\n`divider` slot.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\">\n <template #divider>\n <ChevronRightIcon aria-hidden=\"true\" />\n </template>\n </BaseColumnPickerList>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\nimport ChevronRightIcon from '@empathyco/x-components/js/components/icons/chevron-right.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n#### Customizing the buttons with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" buttonClass=\"xds:button-circle\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedColumnPicker`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks an item. The event payload is the number of columns\n that the clicked item represents.\n- [`ColumnsNumberProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted on component mount. The event payload is the current `selectedColumns` value.\n</docs>\n"],"names":[],"mappings":";;;;;AAoDA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,sBAAsB;IAC5B,UAAU,EAAE,EAAE,eAAc,EAAG;AAC/B,IAAA,KAAK,EAAE;;AAEL,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,KAA2B;AACjC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;;AAED,QAAA,UAAU,EAAE,MAAM;;AAElB,QAAA,WAAW,EAAE,MAAM;AACpB,KAAA;IACD,KAAK,EAAE,CAAC,mBAAmB,CAAC;AAC5B,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,IAAG,EAAG,EAAA;AACnB,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;QAEjB,MAAM,EAAE,oBAAoB,EAAE,UAAS,EAAE,GAAI,MAAM,CAAC,iBAAiB,CAAc;AAEnF,QAAA,MAAM,uBAAsB,GAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,UAAS,IAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QACnF,MAAM,eAAc,GAAI,GAAG,CAAC,uBAAuB,CAAC,KAAK,CAAA;AAEzD;;;;AAIE;QACF,SAAS,yBAAyB,CAAC,MAAc,EAAA;AAC/C,YAAA,eAAe,CAAC,KAAI,GAAI,MAAK;AAC7B,YAAA,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAA;QACzC;AAEA;;;;AAIE;QACF,SAAS,oBAAoB,CAAC,MAAc,EAAA;AAC1C,YAAA,IAAI,KAAK,CAAC,UAAS,KAAM,MAAM,EAAE;AAC/B,gBAAA,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAA;YAClC;QACF;AAEA,QAAA,KAAK,CAAC,uBAAuB,EAAE,yBAAyB,CAAA;AACxD,QAAA,KAAK,CAAC,eAAe,EAAE,oBAAoB,CAAA;QAE3C,EAAE,CAAC,EAAE,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,SAAS,CAAC,MAAK,KAAM,eAAe,CAAC,KAAI,GAAI,MAAM,CAAC,CAAA;AAE1F;;;;;AAKE;QACF,aAAa,CAAC,MAAI;YAChB,IAAI,eAAe,CAAC,KAAI,KAAM,uBAAuB,CAAC,KAAK,EAAE;AAC3D,gBAAA,yBAAyB,CAAC,eAAe,CAAC,KAAK,CAAA;YACjD;iBAAO;AACL,gBAAA,oBAAoB,CAAC,eAAe,CAAC,KAAK,CAAA;YAC5C;AACF,QAAA,CAAC,CAAA;AAED;;;;AAIE;AACF,QAAA,MAAM,qBAAoB,GAAI,QAAQ,CAAqB,MACzD,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAK,KAAM;YAC3B,MAAM;AACN,YAAA,UAAU,EAAE;AACV,gBAAA,CAAA,8BAAA,EAAiC,MAAM,CAAA,KAAA,CAAO;AAC9C,gBAAA,EAAE,cAAc,EAAE,eAAe,CAAC,KAAI,KAAM,MAAK,EAAG;AACrD,aAAA;AACD,YAAA,UAAU,EAAE,eAAe,CAAC,KAAI,KAAM,MAAM;AAC5C,YAAA,MAAM,EAAE;AACN,gBAAA,uBAAuB,EAAE,MAAM;AAC/B,gBAAA,qBAAqB,EAAE,MAAM;AAC9B,aAAA;SACF,CAAC,CAAC,CACL;AAEA,QAAA,OAAO,EAAE,UAAU,EAAE,qBAAoB,EAAE;IAC7C,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-column-picker-list.vue2.js","sources":["../../../../src/components/column-picker/base-column-picker-list.vue"],"sourcesContent":["<template>\n <div class=\"x-column-picker-list xds:button-group\" data-test=\"column-picker-list\" role=\"list\">\n <template\n v-for=\"({ column, cssClasses, events, isSelected }, index) in columnsWithCssClasses\"\n :key=\"column\"\n >\n <BaseEventButton\n class=\"x-column-picker-list__button xds:button\"\n :class=\"[buttonClass, cssClasses]\"\n data-test=\"column-picker-button\"\n :aria-pressed=\"isSelected.toString()\"\n :events=\"events\"\n :aria-label=\"ariaLabels?.button!(column)\"\n role=\"listitem\"\n >\n <!--\n @slot Customized Column Picker Button content. Specifying a slot with the column value\n will result in the column using that slot composition to render.\n @binding {number} column - Columns Number to pick.\n @binding {boolean} isSelected - True if the columns number are the chosen value.\n -->\n <slot v-bind=\"{ column, isSelected }\">\n {{ column }}\n </slot>\n </BaseEventButton>\n\n <!--\n @slot Customized Column Picker divider. Specify an element to act as divider for\n the items in the column picker. Empty by default.\n -->\n <slot v-if=\"index !== columnsWithCssClasses.length - 1\" name=\"divider\"></slot>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring'\nimport { computed, defineComponent, onBeforeMount, ref, watch } from 'vue'\nimport { useAccessibilityLabels } from '../../composables'\nimport { use$x } from '../../composables/use-$x'\nimport BaseEventButton from '../base-event-button.vue'\n\nexport interface ColumnPickerItem {\n column: number\n cssClasses: VueCSSClasses\n events: Partial<XEventsTypes>\n isSelected: boolean\n}\n\n/**\n * Column picker list component renders a list of buttons to choose the columns number.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'BaseColumnPickerList',\n components: { BaseEventButton },\n props: {\n /** An array of numbers that represents the number of columns to render. */\n columns: {\n type: Array as PropType<number[]>,\n required: true,\n },\n /** The value of the selected columns number. */\n modelValue: Number,\n /** Class inherited by each button. */\n buttonClass: String,\n },\n emits: ['update:modelValue'],\n setup(props, { emit }) {\n const $x = use$x()\n\n const ariaLabels = useAccessibilityLabels('baseColumnPickerList')\n\n const providedSelectedColumns = computed(() => props.modelValue ?? props.columns[0])\n const selectedColumns = ref(providedSelectedColumns.value)\n\n /**\n * Assigns `selectedColumns` value and emits `ColumnsNumberProvided`.\n *\n * @param column - Column number provided.\n */\n function emitColumnsNumberProvided(column: number) {\n selectedColumns.value = column\n $x.emit('ColumnsNumberProvided', column)\n }\n\n /**\n * Emits `update:modelValue` with the column selected.\n *\n * @param column - Column number selected.\n */\n function emitUpdateModelValue(column: number) {\n if (props.modelValue !== column) {\n emit('update:modelValue', column)\n }\n }\n\n watch(providedSelectedColumns, emitColumnsNumberProvided)\n watch(selectedColumns, emitUpdateModelValue)\n\n $x.on('ColumnsNumberProvided', false).subscribe(column => (selectedColumns.value = column))\n\n /**\n * Synchronizes the columns number before mounting the component. If the real number of selected\n * columns equals the provided columns, it emits the event to sync it with every other component.\n * If it is not equal it means that the user has already selected a number of columns, so we emit\n * a `update:modelValue` event so developers can sync the provided value.\n */\n onBeforeMount(() => {\n if (selectedColumns.value === providedSelectedColumns.value) {\n emitColumnsNumberProvided(selectedColumns.value)\n } else {\n emitUpdateModelValue(selectedColumns.value)\n }\n })\n\n /**\n * Maps the column to an object containing: the `column` and `CSS classes`.\n *\n * @returns An array of objects containing the column number and CSS classes.\n */\n const columnsWithCssClasses = computed<ColumnPickerItem[]>(() =>\n props.columns.map(column => ({\n column,\n cssClasses: [\n `x-column-picker-list__button--${column}-cols`,\n { 'xds:selected': selectedColumns.value === column },\n ],\n isSelected: selectedColumns.value === column,\n events: {\n UserClickedColumnPicker: column,\n ColumnsNumberProvided: column,\n },\n })),\n )\n\n return { ariaLabels, columnsWithCssClasses }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis component renders a list of elements in different slots depending on the columns prop. Each\nbutton emits the needed events to sync other instances of column pickers or grids with the\nnumber of columns being selected when clicked.\n\n### Default usage\n\nIt is required to send the columns prop.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n### Using v-model\n\nIt is possible to do two-way binding in order to synchronize the value with the parent. It will be\nupdated if the value changes or if the parent changes it.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" v-model=\"selectedColumns\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\nconst selectedColumns = ref(4)\n</script>\n```\n\n### Customized usage\n\n#### Overriding the slots\n\nIt is possible to override the column picker button content.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\">\n <template #default=\"{ column, isSelected }\">\n <span>{{ column }} {{ isSelected ? '🟢' : '' }}</span>\n </template>\n </BaseColumnPickerList>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\nIt is also possible to add a divider element between the column picker buttons by overriding the\n`divider` slot.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\">\n <template #divider>\n <ChevronRightIcon aria-hidden=\"true\" />\n </template>\n </BaseColumnPickerList>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\nimport ChevronRightIcon from '@empathyco/x-components/js/components/icons/chevron-right.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n#### Customizing the buttons with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\n```vue live\n<template>\n <BaseColumnPickerList :columns=\"columns\" buttonClass=\"xds:button-circle\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport BaseColumnPickerList from '@empathyco/x-components/js/components/column-picker/base-column-picker-list.vue'\n\nconst columns = ref([2, 4, 6])\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedColumnPicker`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks an item. The event payload is the number of columns\n that the clicked item represents.\n- [`ColumnsNumberProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted on component mount. The event payload is the current `selectedColumns` value.\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;AAmDA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,sBAAsB;IAC5B,UAAU,EAAE,EAAE,eAAc,EAAG;AAC/B,IAAA,KAAK,EAAE;;AAEL,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,KAA2B;AACjC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;;AAED,QAAA,UAAU,EAAE,MAAM;;AAElB,QAAA,WAAW,EAAE,MAAM;AACpB,KAAA;IACD,KAAK,EAAE,CAAC,mBAAmB,CAAC;AAC5B,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,IAAG,EAAG,EAAA;AACnB,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,sBAAsB,CAAA;AAEhE,QAAA,MAAM,uBAAsB,GAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,UAAS,IAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QACnF,MAAM,eAAc,GAAI,GAAG,CAAC,uBAAuB,CAAC,KAAK,CAAA;AAEzD;;;;AAIE;QACF,SAAS,yBAAyB,CAAC,MAAc,EAAA;AAC/C,YAAA,eAAe,CAAC,KAAI,GAAI,MAAK;AAC7B,YAAA,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAA;QACzC;AAEA;;;;AAIE;QACF,SAAS,oBAAoB,CAAC,MAAc,EAAA;AAC1C,YAAA,IAAI,KAAK,CAAC,UAAS,KAAM,MAAM,EAAE;AAC/B,gBAAA,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAA;YAClC;QACF;AAEA,QAAA,KAAK,CAAC,uBAAuB,EAAE,yBAAyB,CAAA;AACxD,QAAA,KAAK,CAAC,eAAe,EAAE,oBAAoB,CAAA;QAE3C,EAAE,CAAC,EAAE,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,SAAS,CAAC,MAAK,KAAM,eAAe,CAAC,KAAI,GAAI,MAAM,CAAC,CAAA;AAE1F;;;;;AAKE;QACF,aAAa,CAAC,MAAI;YAChB,IAAI,eAAe,CAAC,KAAI,KAAM,uBAAuB,CAAC,KAAK,EAAE;AAC3D,gBAAA,yBAAyB,CAAC,eAAe,CAAC,KAAK,CAAA;YACjD;iBAAO;AACL,gBAAA,oBAAoB,CAAC,eAAe,CAAC,KAAK,CAAA;YAC5C;AACF,QAAA,CAAC,CAAA;AAED;;;;AAIE;AACF,QAAA,MAAM,qBAAoB,GAAI,QAAQ,CAAqB,MACzD,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAK,KAAM;YAC3B,MAAM;AACN,YAAA,UAAU,EAAE;AACV,gBAAA,CAAA,8BAAA,EAAiC,MAAM,CAAA,KAAA,CAAO;AAC9C,gBAAA,EAAE,cAAc,EAAE,eAAe,CAAC,KAAI,KAAM,MAAK,EAAG;AACrD,aAAA;AACD,YAAA,UAAU,EAAE,eAAe,CAAC,KAAI,KAAM,MAAM;AAC5C,YAAA,MAAM,EAAE;AACN,gBAAA,uBAAuB,EAAE,MAAM;AAC/B,gBAAA,qBAAqB,EAAE,MAAM;AAC9B,aAAA;SACF,CAAC,CAAC,CACL;AAEA,QAAA,OAAO,EAAE,UAAU,EAAE,qBAAoB,EAAE;IAC7C,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span class=\"x-currency\">{{ currencyText }}</span>\n</template>\n\n<script lang=\"ts\">\nimport type { SnippetConfig } from '@x/x-installer'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\n\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The ISO 4217 currency value. If not specified we use snippetConfig.currency\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n * Note: 'currency' and 'style' options are managed internally.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n\n setup(props) {\n const snippetConfig = inject<SnippetConfig>('snippetConfig')\n\n const currencyText = computed<string>(() => {\n const currency = props.currency ?? snippetConfig?.currency ?? 'EUR'\n return Intl.NumberFormat(snippetConfig?.uiLang, {\n style: 'currency',\n ...props.format,\n currency,\n }).format(props.value)\n })\n\n return {\n currencyText,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, formatted\nusing the Intl.NumberFormat API with ISO 4217 currency codes. The rendered tag is a span in order\nto render a default inline HTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" currency=\"EUR\" />\n <!-- output depends on locale, e.g., '12.345.678,88 €' for es-ES -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Customizing decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87654321\"\n currency=\"USD\"\n :format=\"{ minimumFractionDigits: 3, maximumFractionDigits: 3 }\"\n />\n <!-- output: '$12,345,678.877' for en-US locale -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### No decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n />\n <!-- output: '12.345.679 €' for es-ES locale (rounds up) -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using different currencies\n\n```vue\n<template>\n <div>\n <BaseCurrency :value=\"1234.56\" currency=\"USD\" />\n <!-- output: '$1,234.56' for en-US -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n <!-- output: '1.234,56 €' for es-ES -->\n <BaseCurrency :value=\"1234.56\" currency=\"GBP\" />\n <!-- output: '£1,234.56' for en-GB -->\n <BaseCurrency :value=\"1234.56\" currency=\"JPY\" />\n <!-- output: '¥1,235' for ja-JP -->\n </div>\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Advanced formatting options\n\nYou can pass any valid Intl.NumberFormatOptions (except 'currency' and 'style' which are managed\ninternally):\n\n```vue\n<template>\n <BaseCurrency\n :value=\"1234567.89\"\n currency=\"EUR\"\n :format=\"{\n minimumFractionDigits: 2,\n maximumFractionDigits: 4,\n useGrouping: true,\n }\"\n />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString"],"mappings":";;;;AACQ,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,YAAA,EAAY;;AAAxB,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAAkD,MAAA;AAAA,IAAlD,UAAA;AAAA,IAAkDC,gBAAtB,IAAA,CAAA,YAAY,CAAA;AAAA,IAAA;AAAA;AAAA,GAAA;;;;;;"}
1
+ {"version":3,"file":"base-currency.vue.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span class=\"x-currency\">{{ currencyText }}</span>\n</template>\n\n<script lang=\"ts\">\nimport type { SnippetConfig } from '@x/x-installer'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\n\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The ISO 4217 currency value. If not specified we use snippetConfig.currency\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n * Note: 'currency' and 'style' options are managed internally.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n /**\n * Locale used to format the value. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n },\n\n setup(props) {\n const snippetConfig = inject<SnippetConfig>('snippetConfig')\n\n const currencyText = computed<string>(() => {\n const currency = props.currency ?? snippetConfig?.currency ?? 'EUR'\n const locale = props.locale ?? snippetConfig?.uiLang\n return Intl.NumberFormat(locale, {\n style: 'currency',\n ...props.format,\n currency,\n }).format(props.value)\n })\n\n return {\n currencyText,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, formatted\nusing the Intl.NumberFormat API with ISO 4217 currency codes. The rendered tag is a span in order\nto render a default inline HTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" currency=\"EUR\" />\n <!-- output depends on locale, e.g., '12.345.678,88 €' for es-ES -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Customizing decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87654321\"\n currency=\"USD\"\n :format=\"{ minimumFractionDigits: 3, maximumFractionDigits: 3 }\"\n />\n <!-- output: '$12,345,678.877' for en-US locale -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### No decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n />\n <!-- output: '12.345.679 €' for es-ES locale (rounds up) -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using different currencies\n\n```vue\n<template>\n <div>\n <BaseCurrency :value=\"1234.56\" currency=\"USD\" />\n <!-- output: '$1,234.56' for en-US -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n <!-- output: '1.234,56 €' for es-ES -->\n <BaseCurrency :value=\"1234.56\" currency=\"GBP\" />\n <!-- output: '£1,234.56' for en-GB -->\n <BaseCurrency :value=\"1234.56\" currency=\"JPY\" />\n <!-- output: '¥1,235' for ja-JP -->\n </div>\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Advanced formatting options\n\nYou can pass any valid Intl.NumberFormatOptions (except 'currency' and 'style' which are managed\ninternally):\n\n```vue\n<template>\n <BaseCurrency\n :value=\"1234567.89\"\n currency=\"EUR\"\n :format=\"{\n minimumFractionDigits: 2,\n maximumFractionDigits: 4,\n useGrouping: true,\n }\"\n />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using a different locale\n\nBy default the currency is formatted using the `uiLang` of the `snippetConfig`. You can format\nthe value in a different locale using the `locale` prop:\n\n```vue\n<template>\n <!-- output: '€1,234.56' even if snippetConfig.uiLang is 'es-ES' -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" locale=\"en-US\" />\n <!-- output: '1234,56 €' for snippetConfig.uiLang 'es-ES' -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString"],"mappings":";;;;AACQ,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,YAAA,EAAY;;AAAxB,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAAkD,MAAA;AAAA,IAAlD,UAAA;AAAA,IAAkDC,gBAAtB,IAAA,CAAA,YAAY,CAAA;AAAA,IAAA;AAAA;AAAA,GAAA;;;;;;"}
@@ -31,12 +31,19 @@ var _sfc_main = defineComponent({
31
31
  type: Object,
32
32
  default: () => ({}),
33
33
  },
34
+ /**
35
+ * Locale used to format the value. If not specified we use snippetConfig.uiLang
36
+ *
37
+ * @public
38
+ */
39
+ locale: String,
34
40
  },
35
41
  setup(props) {
36
42
  const snippetConfig = inject('snippetConfig');
37
43
  const currencyText = computed(() => {
38
44
  const currency = props.currency ?? snippetConfig?.currency ?? 'EUR';
39
- return Intl.NumberFormat(snippetConfig?.uiLang, {
45
+ const locale = props.locale ?? snippetConfig?.uiLang;
46
+ return Intl.NumberFormat(locale, {
40
47
  style: 'currency',
41
48
  ...props.format,
42
49
  currency,
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue2.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span class=\"x-currency\">{{ currencyText }}</span>\n</template>\n\n<script lang=\"ts\">\nimport type { SnippetConfig } from '@x/x-installer'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\n\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The ISO 4217 currency value. If not specified we use snippetConfig.currency\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n * Note: 'currency' and 'style' options are managed internally.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n\n setup(props) {\n const snippetConfig = inject<SnippetConfig>('snippetConfig')\n\n const currencyText = computed<string>(() => {\n const currency = props.currency ?? snippetConfig?.currency ?? 'EUR'\n return Intl.NumberFormat(snippetConfig?.uiLang, {\n style: 'currency',\n ...props.format,\n currency,\n }).format(props.value)\n })\n\n return {\n currencyText,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, formatted\nusing the Intl.NumberFormat API with ISO 4217 currency codes. The rendered tag is a span in order\nto render a default inline HTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" currency=\"EUR\" />\n <!-- output depends on locale, e.g., '12.345.678,88 €' for es-ES -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Customizing decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87654321\"\n currency=\"USD\"\n :format=\"{ minimumFractionDigits: 3, maximumFractionDigits: 3 }\"\n />\n <!-- output: '$12,345,678.877' for en-US locale -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### No decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n />\n <!-- output: '12.345.679 €' for es-ES locale (rounds up) -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using different currencies\n\n```vue\n<template>\n <div>\n <BaseCurrency :value=\"1234.56\" currency=\"USD\" />\n <!-- output: '$1,234.56' for en-US -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n <!-- output: '1.234,56 €' for es-ES -->\n <BaseCurrency :value=\"1234.56\" currency=\"GBP\" />\n <!-- output: '£1,234.56' for en-GB -->\n <BaseCurrency :value=\"1234.56\" currency=\"JPY\" />\n <!-- output: '¥1,235' for ja-JP -->\n </div>\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Advanced formatting options\n\nYou can pass any valid Intl.NumberFormatOptions (except 'currency' and 'style' which are managed\ninternally):\n\n```vue\n<template>\n <BaseCurrency\n :value=\"1234567.89\"\n currency=\"EUR\"\n :format=\"{\n minimumFractionDigits: 2,\n maximumFractionDigits: 4,\n useGrouping: true,\n }\"\n />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;AASA,gBAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;;;;AAOE;AACF,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;;AAME;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAwE;AAC9E,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,aAAY,GAAI,MAAM,CAAgB,eAAe,CAAA;AAE3D,QAAA,MAAM,eAAe,QAAQ,CAAS,MAAI;YACxC,MAAM,QAAO,GAAI,KAAK,CAAC,QAAO,IAAK,aAAa,EAAE,QAAO,IAAK,KAAI;AAClE,YAAA,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE;AAC9C,gBAAA,KAAK,EAAE,UAAU;gBACjB,GAAG,KAAK,CAAC,MAAM;gBACf,QAAQ;AACT,aAAA,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAA;AACvB,QAAA,CAAC,CAAA;QAED,OAAO;YACL,YAAY;SACd;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-currency.vue2.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span class=\"x-currency\">{{ currencyText }}</span>\n</template>\n\n<script lang=\"ts\">\nimport type { SnippetConfig } from '@x/x-installer'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\n\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The ISO 4217 currency value. If not specified we use snippetConfig.currency\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n * Note: 'currency' and 'style' options are managed internally.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n /**\n * Locale used to format the value. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n },\n\n setup(props) {\n const snippetConfig = inject<SnippetConfig>('snippetConfig')\n\n const currencyText = computed<string>(() => {\n const currency = props.currency ?? snippetConfig?.currency ?? 'EUR'\n const locale = props.locale ?? snippetConfig?.uiLang\n return Intl.NumberFormat(locale, {\n style: 'currency',\n ...props.format,\n currency,\n }).format(props.value)\n })\n\n return {\n currencyText,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, formatted\nusing the Intl.NumberFormat API with ISO 4217 currency codes. The rendered tag is a span in order\nto render a default inline HTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" currency=\"EUR\" />\n <!-- output depends on locale, e.g., '12.345.678,88 €' for es-ES -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Customizing decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87654321\"\n currency=\"USD\"\n :format=\"{ minimumFractionDigits: 3, maximumFractionDigits: 3 }\"\n />\n <!-- output: '$12,345,678.877' for en-US locale -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### No decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n />\n <!-- output: '12.345.679 €' for es-ES locale (rounds up) -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using different currencies\n\n```vue\n<template>\n <div>\n <BaseCurrency :value=\"1234.56\" currency=\"USD\" />\n <!-- output: '$1,234.56' for en-US -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n <!-- output: '1.234,56 €' for es-ES -->\n <BaseCurrency :value=\"1234.56\" currency=\"GBP\" />\n <!-- output: '£1,234.56' for en-GB -->\n <BaseCurrency :value=\"1234.56\" currency=\"JPY\" />\n <!-- output: '¥1,235' for ja-JP -->\n </div>\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Advanced formatting options\n\nYou can pass any valid Intl.NumberFormatOptions (except 'currency' and 'style' which are managed\ninternally):\n\n```vue\n<template>\n <BaseCurrency\n :value=\"1234567.89\"\n currency=\"EUR\"\n :format=\"{\n minimumFractionDigits: 2,\n maximumFractionDigits: 4,\n useGrouping: true,\n }\"\n />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using a different locale\n\nBy default the currency is formatted using the `uiLang` of the `snippetConfig`. You can format\nthe value in a different locale using the `locale` prop:\n\n```vue\n<template>\n <!-- output: '€1,234.56' even if snippetConfig.uiLang is 'es-ES' -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" locale=\"en-US\" />\n <!-- output: '1234,56 €' for snippetConfig.uiLang 'es-ES' -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;AASA,gBAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;;;;AAOE;AACF,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;;AAME;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAwE;AAC9E,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE,MAAM;AACf,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,aAAY,GAAI,MAAM,CAAgB,eAAe,CAAA;AAE3D,QAAA,MAAM,eAAe,QAAQ,CAAS,MAAI;YACxC,MAAM,QAAO,GAAI,KAAK,CAAC,QAAO,IAAK,aAAa,EAAE,QAAO,IAAK,KAAI;YAClE,MAAM,MAAK,GAAI,KAAK,CAAC,UAAU,aAAa,EAAE,MAAK;AACnD,YAAA,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;AAC/B,gBAAA,KAAK,EAAE,UAAU;gBACjB,GAAG,KAAK,CAAC,MAAM;gBACf,QAAQ;AACT,aAAA,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAA;AACvB,QAAA,CAAC,CAAA;QAED,OAAO;YACL,YAAY;SACd;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1,9 +1,10 @@
1
1
  import { defineComponent, computed, provide } from 'vue';
2
2
  import '../composables/create-use-device.js';
3
3
  import { use$x } from '../composables/use-_x.js';
4
+ import '@empathyco/x-utils';
5
+ import '../utils/storage.js';
4
6
  import 'vuex';
5
7
  import '../plugins/x-bus.js';
6
- import '@empathyco/x-utils';
7
8
  import '../plugins/x-plugin.js';
8
9
  import '@vueuse/core';
9
10
  import 'rxjs';
@@ -1 +1 @@
1
- {"version":3,"file":"display-click-provider.vue.js","sources":["../../../src/components/display-click-provider.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\n\nimport type { ResultFeature } from '../types/index'\nimport type { DisplayWireMetadata } from '../wiring/index'\nimport { computed, defineComponent, provide } from 'vue'\nimport { use$x } from '../composables/index'\n\nexport default defineComponent({\n name: 'DisplayClickProvider',\n props: {\n resultFeature: {\n type: String as PropType<ResultFeature>,\n required: true,\n },\n ignoreResultClickEvent: {\n type: Boolean,\n default: false,\n },\n toolingDisplayTagging: {\n type: Object as PropType<TaggingRequest>,\n required: false,\n default: undefined,\n },\n toolingAdd2CartTagging: {\n type: Object as PropType<TaggingRequest>,\n required: false,\n default: undefined,\n },\n queryTagging: {\n type: Object as PropType<TaggingRequest>,\n required: false,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const x = use$x()\n\n const displayClickMetadata = computed<Partial<DisplayWireMetadata>>(() => ({\n displayOriginalQuery: x.query.search,\n feature: props.resultFeature,\n queryTagging: props.queryTagging,\n toolingTagging: props.toolingDisplayTagging,\n toolingAdd2CartTagging: props.toolingAdd2CartTagging,\n }))\n\n const resultAddToCartExtraEventsMap: Partial<Record<ResultFeature, string>> = {\n related_prompts: 'UserClickedARelatedPromptAdd2Cart',\n ai_carousel: 'UserClickedAnAiCarouselAdd2Cart',\n }\n\n const resultClickExtraEventsMap: Partial<Record<ResultFeature, string>> = {\n related_prompts: 'UserClickedARelatedPromptResult',\n ai_carousel: 'UserClickedAnAiCarouselResult',\n }\n\n provide('resultAddToCartExtraEvents', [resultAddToCartExtraEventsMap[props.resultFeature]])\n provide('resultAddToCartExtraEventsMetadata', {\n toolingAdd2CartTagging: props.toolingAdd2CartTagging,\n })\n\n provide('resultClickExtraEvents', [\n resultClickExtraEventsMap[props.resultFeature],\n 'UserClickedADisplayResult',\n ])\n provide('resultLinkMetadataPerEvent', {\n UserClickedARelatedPromptResult: displayClickMetadata.value,\n UserClickedAnAiCarouselResult: displayClickMetadata.value,\n UserClickedADisplayResult: displayClickMetadata.value,\n ...(props.ignoreResultClickEvent && {\n UserClickedAResult: {\n ignoreInModules: ['tagging'],\n },\n }),\n })\n\n return () => slots.default?.()[0] ?? ''\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Usage\n\nThe `DisplayClickProvider` component is used to provide context and event metadata for display result clicks and add-to-cart actions. It should wrap the content that needs to access these events and metadata via Vue's provide/inject mechanism.\n\n### Basic example\n\n```vue\n<template>\n <DisplayClickProvider :resultFeature=\"'related_prompts'\">\n <ResultCard :result=\"result\" />\n </DisplayClickProvider>\n</template>\n\n<script setup>\nimport { DisplayClickProvider } from '@empathyco/x-components'\nimport ResultCard from './ResultCard.vue'\nconst result = {\n /* ...result data... */\n}\n</script>\n```\n\n### With tagging and ignoring result click event\n\n```vue\n<template>\n <DisplayClickProvider\n :resultFeature=\"'related_prompts'\"\n :toolingDisplayTagging=\"displayTagging\"\n :toolingAdd2CartTagging=\"add2CartTagging\"\n :queryTagging=\"queryTagging\"\n :ignoreResultClickEvent=\"true\"\n >\n <ResultCard :result=\"result\" />\n </DisplayClickProvider>\n</template>\n\n<script setup>\nimport { DisplayClickProvider } from '@empathyco/x-components'\nimport ResultCard from './ResultCard.vue'\nconst result = {\n /* ...result data... */\n}\nconst displayTagging = {\n /* ...tagging data... */\n}\nconst add2CartTagging = {\n /* ...tagging data... */\n}\nconst queryTagging = {\n /* ...tagging data... */\n}\n</script>\n```\n\n### Notes\n\n- The component uses Vue 3's provide/inject API and is intended for use in Vue 3 projects.\n- All props are reactive and can be updated dynamically.\n- The default slot is required and should contain the content that will use the provided context.\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;AASA,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,sBAAsB;AAC5B,IAAA,KAAK,EAAE;AACL,QAAA,aAAa,EAAE;AACb,YAAA,IAAI,EAAE,MAAiC;AACvC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,sBAAsB,EAAE;AACtB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;AACD,QAAA,qBAAqB,EAAE;AACrB,YAAA,IAAI,EAAE,MAAkC;AACxC,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD,QAAA,sBAAsB,EAAE;AACtB,YAAA,IAAI,EAAE,MAAkC;AACxC,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAkC;AACxC,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,CAAA,GAAI,KAAK,EAAC;AAEhB,QAAA,MAAM,oBAAmB,GAAI,QAAQ,CAA+B,OAAO;AACzE,YAAA,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM;YACpC,OAAO,EAAE,KAAK,CAAC,aAAa;YAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,cAAc,EAAE,KAAK,CAAC,qBAAqB;YAC3C,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;AACrD,SAAA,CAAC,CAAA;AAEF,QAAA,MAAM,6BAA6B,GAA2C;AAC5E,YAAA,eAAe,EAAE,mCAAmC;AACpD,YAAA,WAAW,EAAE,iCAAiC;SAChD;AAEA,QAAA,MAAM,yBAAyB,GAA2C;AACxE,YAAA,eAAe,EAAE,iCAAiC;AAClD,YAAA,WAAW,EAAE,+BAA+B;SAC9C;AAEA,QAAA,OAAO,CAAC,4BAA4B,EAAE,CAAC,6BAA6B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAA;QAC1F,OAAO,CAAC,oCAAoC,EAAE;YAC5C,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;AACrD,SAAA,CAAA;QAED,OAAO,CAAC,wBAAwB,EAAE;AAChC,YAAA,yBAAyB,CAAC,KAAK,CAAC,aAAa,CAAC;YAC9C,2BAA2B;AAC5B,SAAA,CAAA;QACD,OAAO,CAAC,4BAA4B,EAAE;YACpC,+BAA+B,EAAE,oBAAoB,CAAC,KAAK;YAC3D,6BAA6B,EAAE,oBAAoB,CAAC,KAAK;YACzD,yBAAyB,EAAE,oBAAoB,CAAC,KAAK;AACrD,YAAA,IAAI,KAAK,CAAC,sBAAqB,IAAK;AAClC,gBAAA,kBAAkB,EAAE;oBAClB,eAAe,EAAE,CAAC,SAAS,CAAC;AAC7B,iBAAA;aACF,CAAC;AACH,SAAA,CAAA;AAED,QAAA,OAAO,MAAM,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,CAAA,IAAK,EAAC;IACxC,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"display-click-provider.vue.js","sources":["../../../src/components/display-click-provider.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\n\nimport type { ResultFeature } from '../types/index'\nimport type { DisplayWireMetadata } from '../wiring/index'\nimport { computed, defineComponent, provide } from 'vue'\nimport { use$x } from '../composables/index'\n\nexport default defineComponent({\n name: 'DisplayClickProvider',\n props: {\n resultFeature: {\n type: String as PropType<ResultFeature>,\n required: true,\n },\n ignoreResultClickEvent: {\n type: Boolean,\n default: false,\n },\n toolingDisplayTagging: {\n type: Object as PropType<TaggingRequest>,\n required: false,\n default: undefined,\n },\n toolingAdd2CartTagging: {\n type: Object as PropType<TaggingRequest>,\n required: false,\n default: undefined,\n },\n queryTagging: {\n type: Object as PropType<TaggingRequest>,\n required: false,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const x = use$x()\n\n const displayClickMetadata = computed<Partial<DisplayWireMetadata>>(() => ({\n displayOriginalQuery: x.query.search,\n feature: props.resultFeature,\n queryTagging: props.queryTagging,\n toolingTagging: props.toolingDisplayTagging,\n toolingAdd2CartTagging: props.toolingAdd2CartTagging,\n }))\n\n const resultAddToCartExtraEventsMap: Partial<Record<ResultFeature, string>> = {\n related_prompts: 'UserClickedARelatedPromptAdd2Cart',\n ai_carousel: 'UserClickedAnAiCarouselAdd2Cart',\n }\n\n const resultClickExtraEventsMap: Partial<Record<ResultFeature, string>> = {\n related_prompts: 'UserClickedARelatedPromptResult',\n ai_carousel: 'UserClickedAnAiCarouselResult',\n }\n\n provide('resultAddToCartExtraEvents', [resultAddToCartExtraEventsMap[props.resultFeature]])\n provide('resultAddToCartExtraEventsMetadata', {\n toolingAdd2CartTagging: props.toolingAdd2CartTagging,\n })\n\n provide('resultClickExtraEvents', [\n resultClickExtraEventsMap[props.resultFeature],\n 'UserClickedADisplayResult',\n ])\n provide('resultLinkMetadataPerEvent', {\n UserClickedARelatedPromptResult: displayClickMetadata.value,\n UserClickedAnAiCarouselResult: displayClickMetadata.value,\n UserClickedADisplayResult: displayClickMetadata.value,\n ...(props.ignoreResultClickEvent && {\n UserClickedAResult: {\n ignoreInModules: ['tagging'],\n },\n }),\n })\n\n return () => slots.default?.()[0] ?? ''\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Usage\n\nThe `DisplayClickProvider` component is used to provide context and event metadata for display result clicks and add-to-cart actions. It should wrap the content that needs to access these events and metadata via Vue's provide/inject mechanism.\n\n### Basic example\n\n```vue\n<template>\n <DisplayClickProvider :resultFeature=\"'related_prompts'\">\n <ResultCard :result=\"result\" />\n </DisplayClickProvider>\n</template>\n\n<script setup>\nimport { DisplayClickProvider } from '@empathyco/x-components'\nimport ResultCard from './ResultCard.vue'\nconst result = {\n /* ...result data... */\n}\n</script>\n```\n\n### With tagging and ignoring result click event\n\n```vue\n<template>\n <DisplayClickProvider\n :resultFeature=\"'related_prompts'\"\n :toolingDisplayTagging=\"displayTagging\"\n :toolingAdd2CartTagging=\"add2CartTagging\"\n :queryTagging=\"queryTagging\"\n :ignoreResultClickEvent=\"true\"\n >\n <ResultCard :result=\"result\" />\n </DisplayClickProvider>\n</template>\n\n<script setup>\nimport { DisplayClickProvider } from '@empathyco/x-components'\nimport ResultCard from './ResultCard.vue'\nconst result = {\n /* ...result data... */\n}\nconst displayTagging = {\n /* ...tagging data... */\n}\nconst add2CartTagging = {\n /* ...tagging data... */\n}\nconst queryTagging = {\n /* ...tagging data... */\n}\n</script>\n```\n\n### Notes\n\n- The component uses Vue 3's provide/inject API and is intended for use in Vue 3 projects.\n- All props are reactive and can be updated dynamically.\n- The default slot is required and should contain the content that will use the provided context.\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;AASA,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,sBAAsB;AAC5B,IAAA,KAAK,EAAE;AACL,QAAA,aAAa,EAAE;AACb,YAAA,IAAI,EAAE,MAAiC;AACvC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,sBAAsB,EAAE;AACtB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;AACD,QAAA,qBAAqB,EAAE;AACrB,YAAA,IAAI,EAAE,MAAkC;AACxC,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD,QAAA,sBAAsB,EAAE;AACtB,YAAA,IAAI,EAAE,MAAkC;AACxC,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAkC;AACxC,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,CAAA,GAAI,KAAK,EAAC;AAEhB,QAAA,MAAM,oBAAmB,GAAI,QAAQ,CAA+B,OAAO;AACzE,YAAA,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM;YACpC,OAAO,EAAE,KAAK,CAAC,aAAa;YAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,cAAc,EAAE,KAAK,CAAC,qBAAqB;YAC3C,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;AACrD,SAAA,CAAC,CAAA;AAEF,QAAA,MAAM,6BAA6B,GAA2C;AAC5E,YAAA,eAAe,EAAE,mCAAmC;AACpD,YAAA,WAAW,EAAE,iCAAiC;SAChD;AAEA,QAAA,MAAM,yBAAyB,GAA2C;AACxE,YAAA,eAAe,EAAE,iCAAiC;AAClD,YAAA,WAAW,EAAE,+BAA+B;SAC9C;AAEA,QAAA,OAAO,CAAC,4BAA4B,EAAE,CAAC,6BAA6B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAA;QAC1F,OAAO,CAAC,oCAAoC,EAAE;YAC5C,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;AACrD,SAAA,CAAA;QAED,OAAO,CAAC,wBAAwB,EAAE;AAChC,YAAA,yBAAyB,CAAC,KAAK,CAAC,aAAa,CAAC;YAC9C,2BAA2B;AAC5B,SAAA,CAAA;QACD,OAAO,CAAC,4BAA4B,EAAE;YACpC,+BAA+B,EAAE,oBAAoB,CAAC,KAAK;YAC3D,6BAA6B,EAAE,oBAAoB,CAAC,KAAK;YACzD,yBAAyB,EAAE,oBAAoB,CAAC,KAAK;AACrD,YAAA,IAAI,KAAK,CAAC,sBAAqB,IAAK;AAClC,gBAAA,kBAAkB,EAAE;oBAClB,eAAe,EAAE,CAAC,SAAS,CAAC;AAC7B,iBAAA;aACF,CAAC;AACH,SAAA,CAAA;AAED,QAAA,OAAO,MAAM,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,CAAA,IAAK,EAAC;IACxC,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -28,6 +28,12 @@ var _sfc_main = defineComponent({
28
28
  * @public
29
29
  */
30
30
  format: Object,
31
+ /**
32
+ * Locale used to format the currency. If not specified we use snippetConfig.uiLang
33
+ *
34
+ * @public
35
+ */
36
+ locale: String,
31
37
  /**
32
38
  * Message shown when the filter hasn't got the min value defined.
33
39
  *
@@ -78,6 +84,7 @@ var _sfc_main = defineComponent({
78
84
  value: props.filter.range.min,
79
85
  currency: props.currency,
80
86
  format: props.format,
87
+ locale: props.locale,
81
88
  });
82
89
  }
83
90
  else if (partMessage === '{max}') {
@@ -85,6 +92,7 @@ var _sfc_main = defineComponent({
85
92
  value: props.filter.range.max,
86
93
  currency: props.currency,
87
94
  format: props.format,
95
+ locale: props.locale,
88
96
  });
89
97
  }
90
98
  return partMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"base-price-filter-label.vue.js","sources":["../../../../../src/components/filters/labels/base-price-filter-label.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { RangeValue } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h } from 'vue'\nimport BaseCurrency from '../../currency/base-currency.vue'\n\n/**\n * Renders a label for a price filter, allowing to select different messages depending on the\n * value of the filter.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /** The filter data for get min and max value. */\n filter: {\n type: Object as PropType<{ range: RangeValue }>,\n required: true,\n },\n /**\n * An ISO 4217 currency value.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n /**\n * Message shown when the filter hasn't got the min value defined.\n *\n * @public\n */\n lessThan: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter has both the min and max values defined.\n *\n * @public\n */\n fromTo: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter hasn't got max value defined.\n *\n * @public\n */\n from: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n /**\n * The active label, retrieved from the provided props.\n * It depends on the min and max values of the filter.\n *\n * @returns The active label to be formatted with the min and max values of the filter.\n */\n const label = computed<string>(() => {\n return props.filter.range.min === null\n ? props.lessThan\n : props.filter.range.max === null\n ? props.from\n : props.fromTo\n })\n\n return () => {\n const labelParts = label.value.split(/(\\{min\\}|\\{max\\})/)\n\n const children = labelParts.map(partMessage => {\n if (partMessage === '{min}') {\n return h(BaseCurrency, {\n value: props.filter.range.min as number,\n currency: props.currency,\n format: props.format,\n })\n } else if (partMessage === '{max}') {\n return h(BaseCurrency, {\n value: props.filter.range.max as number,\n currency: props.currency,\n format: props.format,\n })\n }\n return partMessage\n })\n\n return h('span', { class: 'x-price-filter-label' }, children)\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders a label for a price filter, allowing to select different messages depending on the value of\nthe filter.\n\n- When the `min` value property isn't defined in the filter, you can show a message like\n `Less than $10` by using the `lessThan` prop, combined with the `{max}` placeholder.\n- When the `max` value property isn't defined in the filter, you can show a message like\n `More than $300` by using the `from` prop, combined with the `{min}` placeholder.\n- If both the `min` and `max` values of the filter are defined, you can show a message like\n `$10 - $300` by using the `fromTo` prop.\n\nThis component uses internally the `BaseCurrency` one, so you can pass the same props to configure\nhow the price should look like.\n\n### Basic usage\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"USD\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAMA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;;AAEL,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAyC;AAC/C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE,MAAwE;AAChF;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;AAKE;AACF,QAAA,MAAM,KAAI,GAAI,QAAQ,CAAS,MAAI;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;kBAC9B,KAAK,CAAC;kBACN,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;sBACzB,KAAK,CAAC;AACR,sBAAE,KAAK,CAAC,MAAK;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,OAAO,MAAI;YACT,MAAM,UAAS,GAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAA;YAExD,MAAM,WAAW,UAAU,CAAC,GAAG,CAAC,WAAU,IAAG;AAC3C,gBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAC3B,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AAAO,qBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAClC,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AACA,gBAAA,OAAO,WAAU;AACnB,YAAA,CAAC,CAAA;AAED,YAAA,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAqB,EAAG,EAAE,QAAQ,CAAA;AAC9D,QAAA,CAAA;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-price-filter-label.vue.js","sources":["../../../../../src/components/filters/labels/base-price-filter-label.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { RangeValue } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h } from 'vue'\nimport BaseCurrency from '../../currency/base-currency.vue'\n\n/**\n * Renders a label for a price filter, allowing to select different messages depending on the\n * value of the filter.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /** The filter data for get min and max value. */\n filter: {\n type: Object as PropType<{ range: RangeValue }>,\n required: true,\n },\n /**\n * An ISO 4217 currency value.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n /**\n * Locale used to format the currency. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n /**\n * Message shown when the filter hasn't got the min value defined.\n *\n * @public\n */\n lessThan: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter has both the min and max values defined.\n *\n * @public\n */\n fromTo: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter hasn't got max value defined.\n *\n * @public\n */\n from: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n /**\n * The active label, retrieved from the provided props.\n * It depends on the min and max values of the filter.\n *\n * @returns The active label to be formatted with the min and max values of the filter.\n */\n const label = computed<string>(() => {\n return props.filter.range.min === null\n ? props.lessThan\n : props.filter.range.max === null\n ? props.from\n : props.fromTo\n })\n\n return () => {\n const labelParts = label.value.split(/(\\{min\\}|\\{max\\})/)\n\n const children = labelParts.map(partMessage => {\n if (partMessage === '{min}') {\n return h(BaseCurrency, {\n value: props.filter.range.min as number,\n currency: props.currency,\n format: props.format,\n locale: props.locale,\n })\n } else if (partMessage === '{max}') {\n return h(BaseCurrency, {\n value: props.filter.range.max as number,\n currency: props.currency,\n format: props.format,\n locale: props.locale,\n })\n }\n return partMessage\n })\n\n return h('span', { class: 'x-price-filter-label' }, children)\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders a label for a price filter, allowing to select different messages depending on the value of\nthe filter.\n\n- When the `min` value property isn't defined in the filter, you can show a message like\n `Less than $10` by using the `lessThan` prop, combined with the `{max}` placeholder.\n- When the `max` value property isn't defined in the filter, you can show a message like\n `More than $300` by using the `from` prop, combined with the `{min}` placeholder.\n- If both the `min` and `max` values of the filter are defined, you can show a message like\n `$10 - $300` by using the `fromTo` prop.\n\nThis component uses internally the `BaseCurrency` one, so you can pass the same props to configure\nhow the price should look like.\n\n### Basic usage\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"USD\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n\n### Using a different locale\n\nBy default the prices are formatted using the `uiLang` of the `snippetConfig`. If you want to\nformat them in a different locale, you can pass the `locale` prop:\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <!-- output: 'From $10.00 to $300.00' even if snippetConfig.uiLang is 'es-ES' -->\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"USD\"\n locale=\"en-US\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAMA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;;AAEL,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAyC;AAC/C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE,MAAwE;AAChF;;;;AAIE;AACF,QAAA,MAAM,EAAE,MAAM;AACd;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;AAKE;AACF,QAAA,MAAM,KAAI,GAAI,QAAQ,CAAS,MAAI;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;kBAC9B,KAAK,CAAC;kBACN,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;sBACzB,KAAK,CAAC;AACR,sBAAE,KAAK,CAAC,MAAK;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,OAAO,MAAI;YACT,MAAM,UAAS,GAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAA;YAExD,MAAM,WAAW,UAAU,CAAC,GAAG,CAAC,WAAU,IAAG;AAC3C,gBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAC3B,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AAAO,qBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAClC,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AACA,gBAAA,OAAO,WAAU;AACnB,YAAA,CAAC,CAAA;AAED,YAAA,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAqB,EAAG,EAAE,QAAQ,CAAA;AAC9D,QAAA,CAAA;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { defineComponent, computed } from 'vue';
2
+ import '@empathyco/x-utils';
2
3
  import { normalizeString } from '../utils/normalize.js';
3
4
  import '../utils/storage.js';
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"highlight.vue2.js","sources":["../../../src/components/highlight.vue"],"sourcesContent":["<template>\n <span class=\"x-highlight\" :class=\"dynamicCSSClasses\">\n <span\n v-if=\"matchParts.start\"\n class=\"x-highlight__text\"\n data-test=\"highlight-start\"\n v-text=\"matchParts.start\"\n />\n <span\n v-if=\"hasMatch\"\n class=\"x-highlight__text xds:highlight-text-match\"\n :class=\"matchingPartClass\"\n data-test=\"matching-part\"\n v-text=\"matchParts.match\"\n />\n <span\n v-if=\"matchParts.end\"\n class=\"x-highlight__text\"\n data-test=\"highlight-end\"\n v-text=\"matchParts.end\"\n />\n </span>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent } from 'vue'\nimport { normalizeString } from '../utils'\n\n/**\n * Highlights the given part of the text. The component is smart enough to do matches\n * between special characters like tilde, cedilla, eñe, capital letters...\n *\n * @public\n */\nexport default defineComponent({\n name: 'Highlight',\n props: {\n /** The text to highlight some part of it. */\n text: {\n type: String,\n default: '',\n },\n /** The part of the text to be highlighted. */\n highlight: {\n type: String,\n default: '',\n },\n /** CSS Class to add when the `text` string contains the `highlight` string. */\n matchClass: {\n type: String,\n default: '',\n },\n /** CSS Class to add when the given `text` doesn't contain the `highlight` string. */\n noMatchClass: {\n type: String,\n default: '',\n },\n /** CSS Class to add to the matching text. */\n matchingPartClass: {\n type: String,\n default: '',\n },\n },\n setup(props, { slots }) {\n /**\n * Splits the label in three parts based on two indexes.\n *\n * @param label - The string that will be divided in three parts.\n * @param start - The first index that the label will be divided by.\n * @param end - The second index that the label will be divided by.\n *\n * @returns The three parts of the divided label.\n */\n function splitAt(label: string, start: number, end: number) {\n return {\n start: label.substring(0, start),\n match: label.substring(start, end),\n end: label.substring(end),\n }\n }\n\n /**\n * Splits the text to highlight into 3 parts: a starting part, the matching part\n * and the ending part. If there is no match between the text and the highlight, the `start`\n * property will contain the whole text.\n *\n * @returns An object containing the different parts of the text.\n */\n const matchParts = computed(() => {\n const matcherIndex = normalizeString(props.text).indexOf(normalizeString(props.highlight))\n return matcherIndex !== -1 && props.highlight\n ? splitAt(props.text.trim(), matcherIndex, matcherIndex + props.highlight.trim().length)\n : { start: props.text, match: '', end: '' }\n })\n\n /**\n * Checks if the normalized suggestion query matches with the module's query, so it has a\n * matching part.\n *\n * @returns True if there is a match between the text and the highlight strings.\n */\n const hasMatch = computed(() => !!matchParts.value.match)\n\n /**\n * CSS classes to add depending on the component state.\n *\n * @remarks\n * `x-highlight--has-match`: When there is a match between the text and the part to highlight.\n * `[matchClass]`: When there is a match between the text and\n * the part to highlight.\n * `[noMatchClass]`: when there is no match between the text to highlight.\n * @returns The CSS classes.\n */\n const dynamicCSSClasses = computed(() => {\n const classes = {\n 'x-highlight--has-match': hasMatch.value,\n 'xds:highlight-text': hasMatch.value,\n [props.matchClass]: hasMatch.value,\n }\n if (props.noMatchClass) {\n classes[props.noMatchClass] = !hasMatch.value\n }\n return classes\n })\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot.\n */\n function renderDefaultSlot() {\n const slotProps = {\n text: props.text,\n hasMatch: hasMatch.value,\n ...matchParts.value,\n }\n return slots.default?.(slotProps)[0]\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasMatch, matchParts, dynamicCSSClasses }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nHere you have a basic example of how the highlight component is rendered.\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <input v-model=\"highlight\" />\n <Highlight :highlight=\"highlight\" text=\"milanesa\" />\n </div>\n</template>\n\n<script setup>\nimport { Highlight } from '@empathyco/x-components'\nimport { ref } from 'vue'\nconst highlight = ref('')\n</script>\n```\n\n### Customise the layout\n\nThis component allows to customise the whole layout.\n\n```vue live\n<template>\n <div>\n <input v-model=\"highlight\" />\n <Highlight\n :highlight=\"highlight\"\n text=\"Entraña\"\n #default=\"{ hasMatch, start, match, end, text }\"\n >\n <span class=\"custom-layout\" v-if=\"hasMatch\">\n <strong>{{ start }}</strong>\n {{ match }}\n <strong>{{ end }}</strong>\n </span>\n <span v-else>{{ text }}</span>\n </Highlight>\n </div>\n</template>\n\n<script setup>\nimport { Highlight } from '@empathyco/x-components'\nimport { ref } from 'vue'\nconst highlight = ref('entran')\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AA4BA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE;;AAEL,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;;AAED,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;;AAED,QAAA,iBAAiB,EAAE;AACjB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB;;;;;;;;AAQE;AACF,QAAA,SAAS,OAAO,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW,EAAA;YACxD,OAAO;gBACL,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC;gBAChC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;AAClC,gBAAA,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC;aAC3B;QACF;AAEA;;;;;;AAME;AACF,QAAA,MAAM,UAAS,GAAI,QAAQ,CAAC,MAAI;AAC9B,YAAA,MAAM,YAAW,GAAI,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AACzF,YAAA,OAAO,YAAW,KAAM,EAAC,IAAK,KAAK,CAAC;kBAChC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,EAAE,YAAW,GAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM;AACvF,kBAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAC,EAAE;AAC9C,QAAA,CAAC,CAAA;AAED;;;;;AAKE;AACF,QAAA,MAAM,WAAW,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAA;AAExD;;;;;;;;;AASE;AACF,QAAA,MAAM,iBAAgB,GAAI,QAAQ,CAAC,MAAI;AACrC,YAAA,MAAM,OAAM,GAAI;gBACd,wBAAwB,EAAE,QAAQ,CAAC,KAAK;gBACxC,oBAAoB,EAAE,QAAQ,CAAC,KAAK;AACpC,gBAAA,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK;aACpC;AACA,YAAA,IAAI,KAAK,CAAC,YAAY,EAAE;gBACtB,OAAO,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,QAAQ,CAAC,KAAI;YAC9C;AACA,YAAA,OAAO,OAAM;AACf,QAAA,CAAC,CAAA;AAED;;;;;;;;AAQE;AACF,QAAA,SAAS,iBAAiB,GAAA;AACxB,YAAA,MAAM,YAAY;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,QAAQ,EAAE,QAAQ,CAAC,KAAK;gBACxB,GAAG,UAAU,CAAC,KAAK;aACrB;YACA,OAAO,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;QACrC;AAEA;AAC+E;QAC/E,MAAM,cAAa,GAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAgB,EAAE;AACjE,QAAA,QAAQ,KAAK,CAAC,OAAM,GAAI,iBAAgB,GAAI,cAAc;IAC5D,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"highlight.vue2.js","sources":["../../../src/components/highlight.vue"],"sourcesContent":["<template>\n <span class=\"x-highlight\" :class=\"dynamicCSSClasses\">\n <span\n v-if=\"matchParts.start\"\n class=\"x-highlight__text\"\n data-test=\"highlight-start\"\n v-text=\"matchParts.start\"\n />\n <span\n v-if=\"hasMatch\"\n class=\"x-highlight__text xds:highlight-text-match\"\n :class=\"matchingPartClass\"\n data-test=\"matching-part\"\n v-text=\"matchParts.match\"\n />\n <span\n v-if=\"matchParts.end\"\n class=\"x-highlight__text\"\n data-test=\"highlight-end\"\n v-text=\"matchParts.end\"\n />\n </span>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent } from 'vue'\nimport { normalizeString } from '../utils'\n\n/**\n * Highlights the given part of the text. The component is smart enough to do matches\n * between special characters like tilde, cedilla, eñe, capital letters...\n *\n * @public\n */\nexport default defineComponent({\n name: 'Highlight',\n props: {\n /** The text to highlight some part of it. */\n text: {\n type: String,\n default: '',\n },\n /** The part of the text to be highlighted. */\n highlight: {\n type: String,\n default: '',\n },\n /** CSS Class to add when the `text` string contains the `highlight` string. */\n matchClass: {\n type: String,\n default: '',\n },\n /** CSS Class to add when the given `text` doesn't contain the `highlight` string. */\n noMatchClass: {\n type: String,\n default: '',\n },\n /** CSS Class to add to the matching text. */\n matchingPartClass: {\n type: String,\n default: '',\n },\n },\n setup(props, { slots }) {\n /**\n * Splits the label in three parts based on two indexes.\n *\n * @param label - The string that will be divided in three parts.\n * @param start - The first index that the label will be divided by.\n * @param end - The second index that the label will be divided by.\n *\n * @returns The three parts of the divided label.\n */\n function splitAt(label: string, start: number, end: number) {\n return {\n start: label.substring(0, start),\n match: label.substring(start, end),\n end: label.substring(end),\n }\n }\n\n /**\n * Splits the text to highlight into 3 parts: a starting part, the matching part\n * and the ending part. If there is no match between the text and the highlight, the `start`\n * property will contain the whole text.\n *\n * @returns An object containing the different parts of the text.\n */\n const matchParts = computed(() => {\n const matcherIndex = normalizeString(props.text).indexOf(normalizeString(props.highlight))\n return matcherIndex !== -1 && props.highlight\n ? splitAt(props.text.trim(), matcherIndex, matcherIndex + props.highlight.trim().length)\n : { start: props.text, match: '', end: '' }\n })\n\n /**\n * Checks if the normalized suggestion query matches with the module's query, so it has a\n * matching part.\n *\n * @returns True if there is a match between the text and the highlight strings.\n */\n const hasMatch = computed(() => !!matchParts.value.match)\n\n /**\n * CSS classes to add depending on the component state.\n *\n * @remarks\n * `x-highlight--has-match`: When there is a match between the text and the part to highlight.\n * `[matchClass]`: When there is a match between the text and\n * the part to highlight.\n * `[noMatchClass]`: when there is no match between the text to highlight.\n * @returns The CSS classes.\n */\n const dynamicCSSClasses = computed(() => {\n const classes = {\n 'x-highlight--has-match': hasMatch.value,\n 'xds:highlight-text': hasMatch.value,\n [props.matchClass]: hasMatch.value,\n }\n if (props.noMatchClass) {\n classes[props.noMatchClass] = !hasMatch.value\n }\n return classes\n })\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot.\n */\n function renderDefaultSlot() {\n const slotProps = {\n text: props.text,\n hasMatch: hasMatch.value,\n ...matchParts.value,\n }\n return slots.default?.(slotProps)[0]\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasMatch, matchParts, dynamicCSSClasses }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nHere you have a basic example of how the highlight component is rendered.\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <input v-model=\"highlight\" />\n <Highlight :highlight=\"highlight\" text=\"milanesa\" />\n </div>\n</template>\n\n<script setup>\nimport { Highlight } from '@empathyco/x-components'\nimport { ref } from 'vue'\nconst highlight = ref('')\n</script>\n```\n\n### Customise the layout\n\nThis component allows to customise the whole layout.\n\n```vue live\n<template>\n <div>\n <input v-model=\"highlight\" />\n <Highlight\n :highlight=\"highlight\"\n text=\"Entraña\"\n #default=\"{ hasMatch, start, match, end, text }\"\n >\n <span class=\"custom-layout\" v-if=\"hasMatch\">\n <strong>{{ start }}</strong>\n {{ match }}\n <strong>{{ end }}</strong>\n </span>\n <span v-else>{{ text }}</span>\n </Highlight>\n </div>\n</template>\n\n<script setup>\nimport { Highlight } from '@empathyco/x-components'\nimport { ref } from 'vue'\nconst highlight = ref('entran')\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AA4BA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE;;AAEL,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;;AAED,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;;AAED,QAAA,iBAAiB,EAAE;AACjB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB;;;;;;;;AAQE;AACF,QAAA,SAAS,OAAO,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW,EAAA;YACxD,OAAO;gBACL,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC;gBAChC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;AAClC,gBAAA,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC;aAC3B;QACF;AAEA;;;;;;AAME;AACF,QAAA,MAAM,UAAS,GAAI,QAAQ,CAAC,MAAI;AAC9B,YAAA,MAAM,YAAW,GAAI,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AACzF,YAAA,OAAO,YAAW,KAAM,EAAC,IAAK,KAAK,CAAC;kBAChC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,EAAE,YAAW,GAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM;AACvF,kBAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAC,EAAE;AAC9C,QAAA,CAAC,CAAA;AAED;;;;;AAKE;AACF,QAAA,MAAM,WAAW,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAA;AAExD;;;;;;;;;AASE;AACF,QAAA,MAAM,iBAAgB,GAAI,QAAQ,CAAC,MAAI;AACrC,YAAA,MAAM,OAAM,GAAI;gBACd,wBAAwB,EAAE,QAAQ,CAAC,KAAK;gBACxC,oBAAoB,EAAE,QAAQ,CAAC,KAAK;AACpC,gBAAA,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK;aACpC;AACA,YAAA,IAAI,KAAK,CAAC,YAAY,EAAE;gBACtB,OAAO,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,QAAQ,CAAC,KAAI;YAC9C;AACA,YAAA,OAAO,OAAM;AACf,QAAA,CAAC,CAAA;AAED;;;;;;;;AAQE;AACF,QAAA,SAAS,iBAAiB,GAAA;AACxB,YAAA,MAAM,YAAY;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,QAAQ,EAAE,QAAQ,CAAC,KAAK;gBACxB,GAAG,UAAU,CAAC,KAAK;aACrB;YACA,OAAO,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;QACrC;AAEA;AAC+E;QAC/E,MAAM,cAAa,GAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAgB,EAAE;AACjE,QAAA,QAAQ,KAAK,CAAC,OAAM,GAAI,iBAAgB,GAAI,cAAc;IAC5D,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"base-events-modal-close.vue.js","sources":["../../../../src/components/modals/base-events-modal-close.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-events-modal-close-button xds:button\"\n data-test=\"close-modal\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../types'\nimport type { PropsWithType } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport { ACCESSIBILITY_KEY } from '../../types'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Component contains an event button that emits {@link XEventsTypes.UserClickedCloseEventsModal}\n * when clicked. It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * Event name to use for closing the modal.\n *\n * @public\n */\n closingEvent: {\n type: String as PropType<PropsWithType<XEventsTypes, void>>,\n default: 'UserClickedCloseEventsModal',\n },\n },\n setup(props) {\n const events = computed<Partial<XEventsTypes>>(() => ({ [props.closingEvent]: undefined }))\n const { baseEventsModalClose: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n return {\n ariaLabels,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedCloseEventsModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button.\n\n## Examples\n\nThe `BaseEventsModalClose` component can be used to close the `BaseEventsModal` component.\n\n### Basic example\n\nOn click, the component closes the `BaseEventsModal`. The only required part is the content that\nthe button should render, which can be anything: text, image, icon, or a combination.\n\n```vue\n<template>\n <BaseEventsModalClose>\n <img src=\"./close-button-icon.svg\" />\n </BaseEventsModalClose>\n</template>\n\n<script setup>\nimport { BaseEventsModalClose } from '@empathyco/x-components'\n</script>\n```\n\n### Defining another event to emit when clicking the button\n\nBy default, it uses the same `closingEvent` that the `BaseEventsModal` is listening to. This event can be changed using the `closingEvent` prop.\n\n```vue\n<template>\n <BaseEventsModalClose closingEvent=\"UserClosedEmpathize\">×</BaseEventsModalClose>\n</template>\n\n<script setup>\nimport { BaseEventsModalClose } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAAA,CAQkB,0BAAA,EAAA;AAAA,IAPf,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,IACT,KAAA,EAAM,wCAAA;AAAA,IACN,WAAA,EAAU,aAAA;AAAA,IACT,cAAY,IAAA,CAAA,UAAA,EAAY;AAAA,GAAA,EAAA;qBAGzB,MAAQ;AAAA,MAARC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
1
+ {"version":3,"file":"base-events-modal-close.vue.js","sources":["../../../../src/components/modals/base-events-modal-close.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-events-modal-close-button xds:button\"\n data-test=\"close-modal\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport { useAccessibilityLabels } from '../../composables'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Component contains an event button that emits {@link XEventsTypes.UserClickedCloseEventsModal}\n * when clicked. It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * Event name to use for closing the modal.\n *\n * @public\n */\n closingEvent: {\n type: String as PropType<PropsWithType<XEventsTypes, void>>,\n default: 'UserClickedCloseEventsModal',\n },\n },\n setup(props) {\n const events = computed<Partial<XEventsTypes>>(() => ({ [props.closingEvent]: undefined }))\n const ariaLabels = useAccessibilityLabels('baseEventsModalClose')\n\n return {\n ariaLabels,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedCloseEventsModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button.\n\n## Examples\n\nThe `BaseEventsModalClose` component can be used to close the `BaseEventsModal` component.\n\n### Basic example\n\nOn click, the component closes the `BaseEventsModal`. The only required part is the content that\nthe button should render, which can be anything: text, image, icon, or a combination.\n\n```vue\n<template>\n <BaseEventsModalClose>\n <img src=\"./close-button-icon.svg\" />\n </BaseEventsModalClose>\n</template>\n\n<script setup>\nimport { BaseEventsModalClose } from '@empathyco/x-components'\n</script>\n```\n\n### Defining another event to emit when clicking the button\n\nBy default, it uses the same `closingEvent` that the `BaseEventsModal` is listening to. This event can be changed using the `closingEvent` prop.\n\n```vue\n<template>\n <BaseEventsModalClose closingEvent=\"UserClosedEmpathize\">×</BaseEventsModalClose>\n</template>\n\n<script setup>\nimport { BaseEventsModalClose } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAAA,CAQkB,0BAAA,EAAA;AAAA,IAPf,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,IACT,KAAA,EAAM,wCAAA;AAAA,IACN,WAAA,EAAU,aAAA;AAAA,IACT,cAAY,IAAA,CAAA,UAAA,EAAY;AAAA,GAAA,EAAA;qBAGzB,MAAQ;AAAA,MAARC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
@@ -1,5 +1,12 @@
1
- import { defineComponent, computed, inject } from 'vue';
2
- import { ACCESSIBILITY_KEY } from '../../types/accessibility.js';
1
+ import { defineComponent, computed } from 'vue';
2
+ import '../../composables/create-use-device.js';
3
+ import 'vuex';
4
+ import '../../plugins/x-bus.js';
5
+ import '@empathyco/x-utils';
6
+ import '../../plugins/x-plugin.js';
7
+ import 'rxjs';
8
+ import { useAccessibilityLabels } from '../../composables/use-accessibility-labels.js';
9
+ import '@vueuse/core';
3
10
  import BaseEventButton from '../base-event-button.vue.js';
4
11
 
5
12
  /**
@@ -25,7 +32,7 @@ var _sfc_main = defineComponent({
25
32
  },
26
33
  setup(props) {
27
34
  const events = computed(() => ({ [props.closingEvent]: undefined }));
28
- const { baseEventsModalClose: ariaLabels } = inject(ACCESSIBILITY_KEY);
35
+ const ariaLabels = useAccessibilityLabels('baseEventsModalClose');
29
36
  return {
30
37
  ariaLabels,
31
38
  events,
@@ -1 +1 @@
1
- {"version":3,"file":"base-events-modal-close.vue2.js","sources":["../../../../src/components/modals/base-events-modal-close.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-events-modal-close-button xds:button\"\n data-test=\"close-modal\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../types'\nimport type { PropsWithType } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport { ACCESSIBILITY_KEY } from '../../types'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Component contains an event button that emits {@link XEventsTypes.UserClickedCloseEventsModal}\n * when clicked. It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * Event name to use for closing the modal.\n *\n * @public\n */\n closingEvent: {\n type: String as PropType<PropsWithType<XEventsTypes, void>>,\n default: 'UserClickedCloseEventsModal',\n },\n },\n setup(props) {\n const events = computed<Partial<XEventsTypes>>(() => ({ [props.closingEvent]: undefined }))\n const { baseEventsModalClose: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n return {\n ariaLabels,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedCloseEventsModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button.\n\n## Examples\n\nThe `BaseEventsModalClose` component can be used to close the `BaseEventsModal` component.\n\n### Basic example\n\nOn click, the component closes the `BaseEventsModal`. The only required part is the content that\nthe button should render, which can be anything: text, image, icon, or a combination.\n\n```vue\n<template>\n <BaseEventsModalClose>\n <img src=\"./close-button-icon.svg\" />\n </BaseEventsModalClose>\n</template>\n\n<script setup>\nimport { BaseEventsModalClose } from '@empathyco/x-components'\n</script>\n```\n\n### Defining another event to emit when clicking the button\n\nBy default, it uses the same `closingEvent` that the `BaseEventsModal` is listening to. This event can be changed using the `closingEvent` prop.\n\n```vue\n<template>\n <BaseEventsModalClose closingEvent=\"UserClosedEmpathize\">×</BaseEventsModalClose>\n</template>\n\n<script setup>\nimport { BaseEventsModalClose } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAqBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,UAAU,EAAE;QACV,eAAe;AAChB,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAqD;AAC3D,YAAA,OAAO,EAAE,6BAA6B;AACvC,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,MAAK,GAAI,QAAQ,CAAwB,OAAO,EAAE,CAAC,KAAK,CAAC,YAAY,GAAG,SAAQ,EAAG,CAAC,CAAA;QAC1F,MAAM,EAAE,oBAAoB,EAAE,UAAS,EAAE,GAAI,MAAM,CAAC,iBAAiB,CAAc;QAEnF,OAAO;YACL,UAAU;YACV,MAAM;SACR;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-events-modal-close.vue2.js","sources":["../../../../src/components/modals/base-events-modal-close.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-events-modal-close-button xds:button\"\n data-test=\"close-modal\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport { useAccessibilityLabels } from '../../composables'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Component contains an event button that emits {@link XEventsTypes.UserClickedCloseEventsModal}\n * when clicked. It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * Event name to use for closing the modal.\n *\n * @public\n */\n closingEvent: {\n type: String as PropType<PropsWithType<XEventsTypes, void>>,\n default: 'UserClickedCloseEventsModal',\n },\n },\n setup(props) {\n const events = computed<Partial<XEventsTypes>>(() => ({ [props.closingEvent]: undefined }))\n const ariaLabels = useAccessibilityLabels('baseEventsModalClose')\n\n return {\n ariaLabels,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedCloseEventsModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button.\n\n## Examples\n\nThe `BaseEventsModalClose` component can be used to close the `BaseEventsModal` component.\n\n### Basic example\n\nOn click, the component closes the `BaseEventsModal`. The only required part is the content that\nthe button should render, which can be anything: text, image, icon, or a combination.\n\n```vue\n<template>\n <BaseEventsModalClose>\n <img src=\"./close-button-icon.svg\" />\n </BaseEventsModalClose>\n</template>\n\n<script setup>\nimport { BaseEventsModalClose } from '@empathyco/x-components'\n</script>\n```\n\n### Defining another event to emit when clicking the button\n\nBy default, it uses the same `closingEvent` that the `BaseEventsModal` is listening to. This event can be changed using the `closingEvent` prop.\n\n```vue\n<template>\n <BaseEventsModalClose closingEvent=\"UserClosedEmpathize\">×</BaseEventsModalClose>\n</template>\n\n<script setup>\nimport { BaseEventsModalClose } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;AAoBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,UAAU,EAAE;QACV,eAAe;AAChB,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAqD;AAC3D,YAAA,OAAO,EAAE,6BAA6B;AACvC,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,MAAK,GAAI,QAAQ,CAAwB,OAAO,EAAE,CAAC,KAAK,CAAC,YAAY,GAAG,SAAQ,EAAG,CAAC,CAAA;AAC1F,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,sBAAsB,CAAA;QAEhE,OAAO;YACL,UAAU;YACV,MAAM;SACR;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"base-events-modal-open.vue.js","sources":["../../../../src/components/modals/base-events-modal-open.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-events-modal-open-button xds:button\"\n data-test=\"open-modal\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../types'\nimport type { PropsWithType } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport { ACCESSIBILITY_KEY } from '../../types'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Component contains an event button that emits {@link XEventsTypes.UserClickedOpenEventsModal}\n * when clicked. It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * Event name to use for opening the modal.\n *\n * @public\n */\n openingEvent: {\n type: String as PropType<PropsWithType<XEventsTypes, void>>,\n default: 'UserClickedOpenEventsModal',\n },\n },\n setup(props) {\n const events = computed<Partial<XEventsTypes>>(() => ({ [props.openingEvent]: undefined }))\n const { baseEventsModalOpen: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n return {\n ariaLabels,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedOpenEventsModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button.\n\n## Examples\n\nThis component serves to open the `BaseEventsModal`.\n\n### Basic example\n\nOn click, the component opens the `BaseEventsModal`. The only required part is the content that\nthe button should render, which can be anything: text, image, icon, or a combination.\n\n```vue\n<template>\n <BaseEventsModalOpen>\n <img src=\"./open-button-icon.svg\" />\n <span>Open</span>\n </BaseEventsModalOpen>\n</template>\n\n<script setup>\nimport { BaseEventsModalOpen } from '@empathyco/x-components'\n</script>\n```\n\n### Defining another event to emit when clicking the button\n\nBy default, it uses the same `openingEvent` that the `BaseEventsModal` is listening to by default.\nThis event can be changed using the `openingEvent` prop, but remember to change it in the target `BaseEventsModal` too.\n\n```vue\n<template>\n <BaseEventsModalOpen openingEvent=\"UserOpenedEmpathize\">\n <span>Open</span>\n </BaseEventsModalOpen>\n</template>\n\n<script setup>\nimport { BaseEventsModalOpen } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAAA,CAQkB,0BAAA,EAAA;AAAA,IAPf,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,IACT,KAAA,EAAM,uCAAA;AAAA,IACN,WAAA,EAAU,YAAA;AAAA,IACT,cAAY,IAAA,CAAA,UAAA,EAAY;AAAA,GAAA,EAAA;qBAGzB,MAAQ;AAAA,MAARC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
1
+ {"version":3,"file":"base-events-modal-open.vue.js","sources":["../../../../src/components/modals/base-events-modal-open.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-events-modal-open-button xds:button\"\n data-test=\"open-modal\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport { useAccessibilityLabels } from '../../composables'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Component contains an event button that emits {@link XEventsTypes.UserClickedOpenEventsModal}\n * when clicked. It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * Event name to use for opening the modal.\n *\n * @public\n */\n openingEvent: {\n type: String as PropType<PropsWithType<XEventsTypes, void>>,\n default: 'UserClickedOpenEventsModal',\n },\n },\n setup(props) {\n const events = computed<Partial<XEventsTypes>>(() => ({ [props.openingEvent]: undefined }))\n const ariaLabels = useAccessibilityLabels('baseEventsModalOpen')\n\n return {\n ariaLabels,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedOpenEventsModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button.\n\n## Examples\n\nThis component serves to open the `BaseEventsModal`.\n\n### Basic example\n\nOn click, the component opens the `BaseEventsModal`. The only required part is the content that\nthe button should render, which can be anything: text, image, icon, or a combination.\n\n```vue\n<template>\n <BaseEventsModalOpen>\n <img src=\"./open-button-icon.svg\" />\n <span>Open</span>\n </BaseEventsModalOpen>\n</template>\n\n<script setup>\nimport { BaseEventsModalOpen } from '@empathyco/x-components'\n</script>\n```\n\n### Defining another event to emit when clicking the button\n\nBy default, it uses the same `openingEvent` that the `BaseEventsModal` is listening to by default.\nThis event can be changed using the `openingEvent` prop, but remember to change it in the target `BaseEventsModal` too.\n\n```vue\n<template>\n <BaseEventsModalOpen openingEvent=\"UserOpenedEmpathize\">\n <span>Open</span>\n </BaseEventsModalOpen>\n</template>\n\n<script setup>\nimport { BaseEventsModalOpen } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAAA,CAQkB,0BAAA,EAAA;AAAA,IAPf,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,IACT,KAAA,EAAM,uCAAA;AAAA,IACN,WAAA,EAAU,YAAA;AAAA,IACT,cAAY,IAAA,CAAA,UAAA,EAAY;AAAA,GAAA,EAAA;qBAGzB,MAAQ;AAAA,MAARC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
@@ -1,5 +1,12 @@
1
- import { defineComponent, computed, inject } from 'vue';
2
- import { ACCESSIBILITY_KEY } from '../../types/accessibility.js';
1
+ import { defineComponent, computed } from 'vue';
2
+ import '../../composables/create-use-device.js';
3
+ import 'vuex';
4
+ import '../../plugins/x-bus.js';
5
+ import '@empathyco/x-utils';
6
+ import '../../plugins/x-plugin.js';
7
+ import 'rxjs';
8
+ import { useAccessibilityLabels } from '../../composables/use-accessibility-labels.js';
9
+ import '@vueuse/core';
3
10
  import BaseEventButton from '../base-event-button.vue.js';
4
11
 
5
12
  /**
@@ -25,7 +32,7 @@ var _sfc_main = defineComponent({
25
32
  },
26
33
  setup(props) {
27
34
  const events = computed(() => ({ [props.openingEvent]: undefined }));
28
- const { baseEventsModalOpen: ariaLabels } = inject(ACCESSIBILITY_KEY);
35
+ const ariaLabels = useAccessibilityLabels('baseEventsModalOpen');
29
36
  return {
30
37
  ariaLabels,
31
38
  events,
@@ -1 +1 @@
1
- {"version":3,"file":"base-events-modal-open.vue2.js","sources":["../../../../src/components/modals/base-events-modal-open.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-events-modal-open-button xds:button\"\n data-test=\"open-modal\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../types'\nimport type { PropsWithType } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport { ACCESSIBILITY_KEY } from '../../types'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Component contains an event button that emits {@link XEventsTypes.UserClickedOpenEventsModal}\n * when clicked. It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * Event name to use for opening the modal.\n *\n * @public\n */\n openingEvent: {\n type: String as PropType<PropsWithType<XEventsTypes, void>>,\n default: 'UserClickedOpenEventsModal',\n },\n },\n setup(props) {\n const events = computed<Partial<XEventsTypes>>(() => ({ [props.openingEvent]: undefined }))\n const { baseEventsModalOpen: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n return {\n ariaLabels,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedOpenEventsModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button.\n\n## Examples\n\nThis component serves to open the `BaseEventsModal`.\n\n### Basic example\n\nOn click, the component opens the `BaseEventsModal`. The only required part is the content that\nthe button should render, which can be anything: text, image, icon, or a combination.\n\n```vue\n<template>\n <BaseEventsModalOpen>\n <img src=\"./open-button-icon.svg\" />\n <span>Open</span>\n </BaseEventsModalOpen>\n</template>\n\n<script setup>\nimport { BaseEventsModalOpen } from '@empathyco/x-components'\n</script>\n```\n\n### Defining another event to emit when clicking the button\n\nBy default, it uses the same `openingEvent` that the `BaseEventsModal` is listening to by default.\nThis event can be changed using the `openingEvent` prop, but remember to change it in the target `BaseEventsModal` too.\n\n```vue\n<template>\n <BaseEventsModalOpen openingEvent=\"UserOpenedEmpathize\">\n <span>Open</span>\n </BaseEventsModalOpen>\n</template>\n\n<script setup>\nimport { BaseEventsModalOpen } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAqBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,UAAU,EAAE;QACV,eAAe;AAChB,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAqD;AAC3D,YAAA,OAAO,EAAE,4BAA4B;AACtC,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,MAAK,GAAI,QAAQ,CAAwB,OAAO,EAAE,CAAC,KAAK,CAAC,YAAY,GAAG,SAAQ,EAAG,CAAC,CAAA;QAC1F,MAAM,EAAE,mBAAmB,EAAE,UAAS,EAAE,GAAI,MAAM,CAAC,iBAAiB,CAAc;QAElF,OAAO;YACL,UAAU;YACV,MAAM;SACR;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-events-modal-open.vue2.js","sources":["../../../../src/components/modals/base-events-modal-open.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-events-modal-open-button xds:button\"\n data-test=\"open-modal\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport { useAccessibilityLabels } from '../../composables'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Component contains an event button that emits {@link XEventsTypes.UserClickedOpenEventsModal}\n * when clicked. It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * Event name to use for opening the modal.\n *\n * @public\n */\n openingEvent: {\n type: String as PropType<PropsWithType<XEventsTypes, void>>,\n default: 'UserClickedOpenEventsModal',\n },\n },\n setup(props) {\n const events = computed<Partial<XEventsTypes>>(() => ({ [props.openingEvent]: undefined }))\n const ariaLabels = useAccessibilityLabels('baseEventsModalOpen')\n\n return {\n ariaLabels,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedOpenEventsModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button.\n\n## Examples\n\nThis component serves to open the `BaseEventsModal`.\n\n### Basic example\n\nOn click, the component opens the `BaseEventsModal`. The only required part is the content that\nthe button should render, which can be anything: text, image, icon, or a combination.\n\n```vue\n<template>\n <BaseEventsModalOpen>\n <img src=\"./open-button-icon.svg\" />\n <span>Open</span>\n </BaseEventsModalOpen>\n</template>\n\n<script setup>\nimport { BaseEventsModalOpen } from '@empathyco/x-components'\n</script>\n```\n\n### Defining another event to emit when clicking the button\n\nBy default, it uses the same `openingEvent` that the `BaseEventsModal` is listening to by default.\nThis event can be changed using the `openingEvent` prop, but remember to change it in the target `BaseEventsModal` too.\n\n```vue\n<template>\n <BaseEventsModalOpen openingEvent=\"UserOpenedEmpathize\">\n <span>Open</span>\n </BaseEventsModalOpen>\n</template>\n\n<script setup>\nimport { BaseEventsModalOpen } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;AAoBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,UAAU,EAAE;QACV,eAAe;AAChB,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAqD;AAC3D,YAAA,OAAO,EAAE,4BAA4B;AACtC,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,MAAK,GAAI,QAAQ,CAAwB,OAAO,EAAE,CAAC,KAAK,CAAC,YAAY,GAAG,SAAQ,EAAG,CAAC,CAAA;AAC1F,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,qBAAqB,CAAA;QAE/D,OAAO;YACL,UAAU;YACV,MAAM;SACR;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1,9 +1,10 @@
1
1
  import { defineComponent } from 'vue';
2
2
  import '../../composables/create-use-device.js';
3
3
  import { use$x } from '../../composables/use-_x.js';
4
+ import '@empathyco/x-utils';
5
+ import '../../utils/storage.js';
4
6
  import 'vuex';
5
7
  import '../../plugins/x-bus.js';
6
- import '@empathyco/x-utils';
7
8
  import '../../plugins/x-plugin.js';
8
9
  import '@vueuse/core';
9
10
  import 'rxjs';
@@ -1 +1 @@
1
- {"version":3,"file":"base-id-modal-close.vue2.js","sources":["../../../../src/components/modals/base-id-modal-close.vue"],"sourcesContent":["<template>\n <button\n class=\"x-events-modal-id-close-button xds:button\"\n data-test=\"close-modal-id\"\n @click=\"closeModal\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </button>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport { use$x } from '../../composables'\n\n/**\n * Component that allows to close a modal by emitting\n * {@link XEventsTypes.UserClickedCloseModal}.\n * It allows full customization with the 'closing-element' slot and exposes the 'closeModal'\n * function.\n *\n * @public\n */\nexport default defineComponent({\n name: 'BaseIdModalClose',\n props: {\n /** The modalId of the modal that will be closed. */\n modalId: {\n type: String,\n required: true,\n },\n },\n setup(props, { slots }) {\n const $x = use$x()\n\n /**\n * Emits the {@link XEventsTypes.UserClickedCloseModal} event with the modalId as payload.\n *\n * @param event - The event triggering the function.\n * @param event.target - Event target.\n */\n function closeModal({ target }: Event) {\n $x.emit('UserClickedCloseModal', props.modalId, { target: target as HTMLElement })\n }\n\n /* Hack to render through a render-function, the `closing-element` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const innerProps = { closeModal }\n return (\n slots['closing-element'] ? () => slots['closing-element']?.(innerProps)[0] : innerProps\n ) as typeof innerProps\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedCloseModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the id of the modal\n that is going to be closed.\n\n## Examples\n\nComponent containing an event button that emits `UserClickedCloseModal` when clicked with the\nmodalId as payload. It has a default slot to customize its contents and can also be fully\ncustomized, replacing the default button with any other element.\n\n### Basic example\n\nThe component renders whatever is passed to it in the default slot inside the button and closes the\nmodal with modalId `my-modal`.\n\n```vue\n<template>\n <BaseIdModalClose modalId=\"my-modal\">\n <img src=\"./close-button-icon.svg\" />\n </BaseIdModalClose>\n</template>\n\n<script setup>\nimport { BaseIdModalClose } from '@empathyco/x-components'\n</script>\n```\n\n### Replacing the default button\n\nThe component renders whatever element is passed, replacing the default button and exposing the\nfunction to close the modal with modalId `my-modal`.\n\n```vue\n<template>\n <BaseIdModalClose modalId=\"my-modal\">\n <template #closing-element=\"{ closeModal }\">\n <ul>\n <li @click=\"closeModal\">Close here</li>\n <li>Not here</li>\n </ul>\n </template>\n </BaseIdModalClose>\n</template>\n\n<script setup>\nimport { BaseIdModalClose } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;AAeA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,kBAAkB;AACxB,IAAA,KAAK,EAAE;;AAEL,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;;AAKE;AACF,QAAA,SAAS,UAAU,CAAC,EAAE,MAAK,EAAU,EAAA;AACnC,YAAA,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAuB,CAAA;QACnF;AAEA;AAC+E;AAC/E,QAAA,MAAM,UAAS,GAAI,EAAE,UAAS,EAAE;QAChC,QACE,KAAK,CAAC,iBAAiB,CAAA,GAAI,MAAM,KAAK,CAAC,iBAAiB,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA,GAAI,UAAS;IAE1F,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-id-modal-close.vue2.js","sources":["../../../../src/components/modals/base-id-modal-close.vue"],"sourcesContent":["<template>\n <button\n class=\"x-events-modal-id-close-button xds:button\"\n data-test=\"close-modal-id\"\n @click=\"closeModal\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </button>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport { use$x } from '../../composables'\n\n/**\n * Component that allows to close a modal by emitting\n * {@link XEventsTypes.UserClickedCloseModal}.\n * It allows full customization with the 'closing-element' slot and exposes the 'closeModal'\n * function.\n *\n * @public\n */\nexport default defineComponent({\n name: 'BaseIdModalClose',\n props: {\n /** The modalId of the modal that will be closed. */\n modalId: {\n type: String,\n required: true,\n },\n },\n setup(props, { slots }) {\n const $x = use$x()\n\n /**\n * Emits the {@link XEventsTypes.UserClickedCloseModal} event with the modalId as payload.\n *\n * @param event - The event triggering the function.\n * @param event.target - Event target.\n */\n function closeModal({ target }: Event) {\n $x.emit('UserClickedCloseModal', props.modalId, { target: target as HTMLElement })\n }\n\n /* Hack to render through a render-function, the `closing-element` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const innerProps = { closeModal }\n return (\n slots['closing-element'] ? () => slots['closing-element']?.(innerProps)[0] : innerProps\n ) as typeof innerProps\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedCloseModal`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the id of the modal\n that is going to be closed.\n\n## Examples\n\nComponent containing an event button that emits `UserClickedCloseModal` when clicked with the\nmodalId as payload. It has a default slot to customize its contents and can also be fully\ncustomized, replacing the default button with any other element.\n\n### Basic example\n\nThe component renders whatever is passed to it in the default slot inside the button and closes the\nmodal with modalId `my-modal`.\n\n```vue\n<template>\n <BaseIdModalClose modalId=\"my-modal\">\n <img src=\"./close-button-icon.svg\" />\n </BaseIdModalClose>\n</template>\n\n<script setup>\nimport { BaseIdModalClose } from '@empathyco/x-components'\n</script>\n```\n\n### Replacing the default button\n\nThe component renders whatever element is passed, replacing the default button and exposing the\nfunction to close the modal with modalId `my-modal`.\n\n```vue\n<template>\n <BaseIdModalClose modalId=\"my-modal\">\n <template #closing-element=\"{ closeModal }\">\n <ul>\n <li @click=\"closeModal\">Close here</li>\n <li>Not here</li>\n </ul>\n </template>\n </BaseIdModalClose>\n</template>\n\n<script setup>\nimport { BaseIdModalClose } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;AAeA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,kBAAkB;AACxB,IAAA,KAAK,EAAE;;AAEL,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;;AAKE;AACF,QAAA,SAAS,UAAU,CAAC,EAAE,MAAK,EAAU,EAAA;AACnC,YAAA,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAuB,CAAA;QACnF;AAEA;AAC+E;AAC/E,QAAA,MAAM,UAAS,GAAI,EAAE,UAAS,EAAE;QAChC,QACE,KAAK,CAAC,iBAAiB,CAAA,GAAI,MAAM,KAAK,CAAC,iBAAiB,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA,GAAI,UAAS;IAE1F,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1,9 +1,10 @@
1
1
  import { defineComponent } from 'vue';
2
2
  import '../../composables/create-use-device.js';
3
3
  import { use$x } from '../../composables/use-_x.js';
4
+ import '@empathyco/x-utils';
5
+ import '../../utils/storage.js';
4
6
  import 'vuex';
5
7
  import '../../plugins/x-bus.js';
6
- import '@empathyco/x-utils';
7
8
  import '../../plugins/x-plugin.js';
8
9
  import '@vueuse/core';
9
10
  import 'rxjs';