@empathyco/x-components 9.3.0 → 9.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/core/index.js +4 -0
  3. package/core/index.js.map +1 -1
  4. package/docs/API-reference/api/x-components.accessibility_key.md +11 -0
  5. package/docs/API-reference/api/x-components.aicarousel.md +4 -0
  6. package/docs/API-reference/api/x-components.arialabels.aicarousel.md +14 -0
  7. package/docs/API-reference/api/x-components.arialabels.basecolumnpickerdropdown.md +13 -0
  8. package/docs/API-reference/api/x-components.arialabels.basecolumnpickerlist.md +13 -0
  9. package/docs/API-reference/api/x-components.arialabels.basedropdown.md +13 -0
  10. package/docs/API-reference/api/x-components.arialabels.baseeventsmodalclose.md +13 -0
  11. package/docs/API-reference/api/x-components.arialabels.baseeventsmodalopen.md +13 -0
  12. package/docs/API-reference/api/x-components.arialabels.basemodal.md +13 -0
  13. package/docs/API-reference/api/x-components.arialabels.clearhistoryqueries.md +13 -0
  14. package/docs/API-reference/api/x-components.arialabels.editablenumberrangefilter.md +14 -0
  15. package/docs/API-reference/api/x-components.arialabels.facets.md +13 -0
  16. package/docs/API-reference/api/x-components.arialabels.filterssearch.md +13 -0
  17. package/docs/API-reference/api/x-components.arialabels.historyqueriesswitch.md +13 -0
  18. package/docs/API-reference/api/x-components.arialabels.historyquery.md +13 -0
  19. package/docs/API-reference/api/x-components.arialabels.md +419 -0
  20. package/docs/API-reference/api/x-components.arialabels.pageloaderbutton.md +13 -0
  21. package/docs/API-reference/api/x-components.arialabels.pageselector.md +16 -0
  22. package/docs/API-reference/api/x-components.arialabels.removehistoryquery.md +13 -0
  23. package/docs/API-reference/api/x-components.arialabels.scrolltotop.md +13 -0
  24. package/docs/API-reference/api/x-components.arialabels.searchinput.md +13 -0
  25. package/docs/API-reference/api/x-components.arialabels.sliderfilter.md +14 -0
  26. package/docs/API-reference/api/x-components.arialabels.sortdropdown.md +13 -0
  27. package/docs/API-reference/api/x-components.basecolumnpickerdropdown.md +3 -0
  28. package/docs/API-reference/api/x-components.basecolumnpickerlist.md +3 -0
  29. package/docs/API-reference/api/x-components.basedropdown.md +3 -2
  30. package/docs/API-reference/api/x-components.baseeventsmodalclose.md +3 -0
  31. package/docs/API-reference/api/x-components.baseeventsmodalopen.md +3 -0
  32. package/docs/API-reference/api/x-components.basemodal.md +3 -0
  33. package/docs/API-reference/api/x-components.clearhistoryqueries.md +3 -0
  34. package/docs/API-reference/api/x-components.deepmergewithdefaults.md +85 -0
  35. package/docs/API-reference/api/x-components.editablenumberrangefilter.md +4 -2
  36. package/docs/API-reference/api/x-components.facets.md +3 -0
  37. package/docs/API-reference/api/x-components.filterssearch.md +3 -0
  38. package/docs/API-reference/api/x-components.historyqueriesswitch.md +3 -0
  39. package/docs/API-reference/api/x-components.historyquery.md +3 -0
  40. package/docs/API-reference/api/x-components.md +50 -0
  41. package/docs/API-reference/api/x-components.pageloaderbutton.md +3 -0
  42. package/docs/API-reference/api/x-components.pageselector.md +6 -0
  43. package/docs/API-reference/api/x-components.removehistoryquery.md +3 -0
  44. package/docs/API-reference/api/x-components.scrolltotop.md +3 -0
  45. package/docs/API-reference/api/x-components.searchinput.md +3 -0
  46. package/docs/API-reference/api/x-components.sliderfilter.md +4 -0
  47. package/docs/API-reference/api/x-components.sortdropdown.md +3 -0
  48. package/docs/API-reference/api/x-components.useaccessibilitylabels.md +72 -0
  49. package/docs/API-reference/components/common/x-components.base-dropdown.md +0 -1
  50. package/js/components/base-dropdown.vue.js +1 -1
  51. package/js/components/base-dropdown.vue.js.map +1 -1
  52. package/js/components/base-dropdown.vue2.js +11 -3
  53. package/js/components/base-dropdown.vue2.js.map +1 -1
  54. package/js/components/base-keyboard-navigation.vue2.js +1 -0
  55. package/js/components/base-keyboard-navigation.vue2.js.map +1 -1
  56. package/js/components/column-picker/base-column-picker-dropdown.vue.js +2 -2
  57. package/js/components/column-picker/base-column-picker-dropdown.vue.js.map +1 -1
  58. package/js/components/column-picker/base-column-picker-dropdown.vue2.js +10 -0
  59. package/js/components/column-picker/base-column-picker-dropdown.vue2.js.map +1 -1
  60. package/js/components/column-picker/base-column-picker-list.vue.js +1 -1
  61. package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
  62. package/js/components/column-picker/base-column-picker-list.vue2.js +10 -1
  63. package/js/components/column-picker/base-column-picker-list.vue2.js.map +1 -1
  64. package/js/components/display-click-provider.vue.js +2 -1
  65. package/js/components/display-click-provider.vue.js.map +1 -1
  66. package/js/components/highlight.vue2.js +1 -0
  67. package/js/components/highlight.vue2.js.map +1 -1
  68. package/js/components/modals/base-events-modal-close.vue.js +2 -2
  69. package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
  70. package/js/components/modals/base-events-modal-close.vue2.js +10 -0
  71. package/js/components/modals/base-events-modal-close.vue2.js.map +1 -1
  72. package/js/components/modals/base-events-modal-open.vue.js +2 -2
  73. package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
  74. package/js/components/modals/base-events-modal-open.vue2.js +10 -0
  75. package/js/components/modals/base-events-modal-open.vue2.js.map +1 -1
  76. package/js/components/modals/base-id-modal-close.vue2.js +2 -1
  77. package/js/components/modals/base-id-modal-close.vue2.js.map +1 -1
  78. package/js/components/modals/base-id-modal-open.vue2.js +2 -1
  79. package/js/components/modals/base-id-modal-open.vue2.js.map +1 -1
  80. package/js/components/modals/base-id-modal.vue2.js +2 -1
  81. package/js/components/modals/base-id-modal.vue2.js.map +1 -1
  82. package/js/components/modals/base-modal.vue.js +11 -16
  83. package/js/components/modals/base-modal.vue.js.map +1 -1
  84. package/js/components/modals/base-modal.vue2.js +3 -0
  85. package/js/components/modals/base-modal.vue2.js.map +1 -1
  86. package/js/components/page-loader-button.vue.js +2 -2
  87. package/js/components/page-loader-button.vue.js.map +1 -1
  88. package/js/components/page-loader-button.vue2.js +3 -0
  89. package/js/components/page-loader-button.vue2.js.map +1 -1
  90. package/js/components/page-selector.vue.js +12 -12
  91. package/js/components/page-selector.vue.js.map +1 -1
  92. package/js/components/page-selector.vue2.js +3 -0
  93. package/js/components/page-selector.vue2.js.map +1 -1
  94. package/js/components/panels/base-id-toggle-panel-button.vue2.js +1 -0
  95. package/js/components/panels/base-id-toggle-panel-button.vue2.js.map +1 -1
  96. package/js/components/panels/base-id-toggle-panel.vue2.js +2 -1
  97. package/js/components/panels/base-id-toggle-panel.vue2.js.map +1 -1
  98. package/js/components/result/base-result-link.vue2.js +2 -1
  99. package/js/components/result/base-result-link.vue2.js.map +1 -1
  100. package/js/components/result/base-result-rating.vue2.js +2 -1
  101. package/js/components/result/base-result-rating.vue2.js.map +1 -1
  102. package/js/components/sort/sort-dropdown.vue.js +2 -2
  103. package/js/components/sort/sort-dropdown.vue.js.map +1 -1
  104. package/js/components/sort/sort-dropdown.vue2.js +10 -0
  105. package/js/components/sort/sort-dropdown.vue2.js.map +1 -1
  106. package/js/components/suggestions/base-suggestion.vue2.js +1 -0
  107. package/js/components/suggestions/base-suggestion.vue2.js.map +1 -1
  108. package/js/composables/use-accessibility-labels.js +40 -0
  109. package/js/composables/use-accessibility-labels.js.map +1 -0
  110. package/js/index.js +4 -0
  111. package/js/index.js.map +1 -1
  112. package/js/types/accessibility.js +4 -0
  113. package/js/types/accessibility.js.map +1 -0
  114. package/js/utils/accessibility.js +37 -0
  115. package/js/utils/accessibility.js.map +1 -0
  116. package/js/utils/deep-merge-with-defaults.js +47 -0
  117. package/js/utils/deep-merge-with-defaults.js.map +1 -0
  118. package/js/x-modules/ai/components/ai-carousel.vue.js +1 -1
  119. package/js/x-modules/ai/components/ai-carousel.vue.js.map +1 -1
  120. package/js/x-modules/ai/components/ai-carousel.vue2.js +3 -0
  121. package/js/x-modules/ai/components/ai-carousel.vue2.js.map +1 -1
  122. package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js +1 -0
  123. package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js.map +1 -1
  124. package/js/x-modules/empathize/components/empathize.vue2.js +2 -2
  125. package/js/x-modules/facets/components/facets/facets-provider.vue2.js +1 -0
  126. package/js/x-modules/facets/components/facets/facets-provider.vue2.js.map +1 -1
  127. package/js/x-modules/facets/components/facets/facets.vue.js +57 -51
  128. package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
  129. package/js/x-modules/facets/components/facets/facets.vue2.js +9 -0
  130. package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
  131. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js +2 -2
  132. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
  133. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js +3 -4
  134. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js.map +1 -1
  135. package/js/x-modules/facets/components/filters/slider-filter.vue.js +4 -4
  136. package/js/x-modules/facets/components/filters/slider-filter.vue.js.map +1 -1
  137. package/js/x-modules/facets/components/filters/slider-filter.vue2.js +3 -0
  138. package/js/x-modules/facets/components/filters/slider-filter.vue2.js.map +1 -1
  139. package/js/x-modules/facets/components/lists/filters-search.vue.js +2 -2
  140. package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
  141. package/js/x-modules/facets/components/lists/filters-search.vue2.js +10 -0
  142. package/js/x-modules/facets/components/lists/filters-search.vue2.js.map +1 -1
  143. package/js/x-modules/facets/components/lists/sorted-filters.vue.js +1 -0
  144. package/js/x-modules/facets/components/lists/sorted-filters.vue.js.map +1 -1
  145. package/js/x-modules/history-queries/components/clear-history-queries.vue.js +2 -2
  146. package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
  147. package/js/x-modules/history-queries/components/clear-history-queries.vue2.js +10 -0
  148. package/js/x-modules/history-queries/components/clear-history-queries.vue2.js.map +1 -1
  149. package/js/x-modules/history-queries/components/history-queries-switch.vue.js +2 -2
  150. package/js/x-modules/history-queries/components/history-queries-switch.vue.js.map +1 -1
  151. package/js/x-modules/history-queries/components/history-queries-switch.vue2.js +10 -0
  152. package/js/x-modules/history-queries/components/history-queries-switch.vue2.js.map +1 -1
  153. package/js/x-modules/history-queries/components/history-query.vue.js +2 -1
  154. package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
  155. package/js/x-modules/history-queries/components/history-query.vue2.js +10 -0
  156. package/js/x-modules/history-queries/components/history-query.vue2.js.map +1 -1
  157. package/js/x-modules/history-queries/components/remove-history-query.vue.js +2 -2
  158. package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
  159. package/js/x-modules/history-queries/components/remove-history-query.vue2.js +10 -0
  160. package/js/x-modules/history-queries/components/remove-history-query.vue2.js.map +1 -1
  161. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +1 -0
  162. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
  163. package/js/x-modules/queries-preview/components/query-preview.vue2.js +2 -2
  164. package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js +1 -0
  165. package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js.map +1 -1
  166. package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js +1 -0
  167. package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js.map +1 -1
  168. package/js/x-modules/recommendations/components/recommendations.vue2.js +1 -0
  169. package/js/x-modules/recommendations/components/recommendations.vue2.js.map +1 -1
  170. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +2 -1
  171. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -1
  172. package/js/x-modules/scroll/components/scroll-to-top.vue.js +2 -2
  173. package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
  174. package/js/x-modules/scroll/components/scroll-to-top.vue2.js +3 -0
  175. package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
  176. package/js/x-modules/search/wiring.js +1 -0
  177. package/js/x-modules/search/wiring.js.map +1 -1
  178. package/js/x-modules/search-box/components/search-input.vue.js +2 -2
  179. package/js/x-modules/search-box/components/search-input.vue.js.map +1 -1
  180. package/js/x-modules/search-box/components/search-input.vue2.js +11 -1
  181. package/js/x-modules/search-box/components/search-input.vue2.js.map +1 -1
  182. package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js +1 -0
  183. package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js.map +1 -1
  184. package/package.json +2 -2
  185. package/report/x-components.api.json +1148 -210
  186. package/report/x-components.api.md +176 -11
  187. package/types/src/components/base-dropdown.vue.d.ts +3 -4
  188. package/types/src/components/base-dropdown.vue.d.ts.map +1 -1
  189. package/types/src/components/column-picker/base-column-picker-dropdown.vue.d.ts +3 -0
  190. package/types/src/components/column-picker/base-column-picker-dropdown.vue.d.ts.map +1 -1
  191. package/types/src/components/column-picker/base-column-picker-list.vue.d.ts +3 -0
  192. package/types/src/components/column-picker/base-column-picker-list.vue.d.ts.map +1 -1
  193. package/types/src/components/modals/base-events-modal-close.vue.d.ts +3 -0
  194. package/types/src/components/modals/base-events-modal-close.vue.d.ts.map +1 -1
  195. package/types/src/components/modals/base-events-modal-open.vue.d.ts +3 -0
  196. package/types/src/components/modals/base-events-modal-open.vue.d.ts.map +1 -1
  197. package/types/src/components/modals/base-modal.vue.d.ts +3 -0
  198. package/types/src/components/modals/base-modal.vue.d.ts.map +1 -1
  199. package/types/src/components/page-loader-button.vue.d.ts +3 -0
  200. package/types/src/components/page-loader-button.vue.d.ts.map +1 -1
  201. package/types/src/components/page-selector.vue.d.ts +6 -0
  202. package/types/src/components/page-selector.vue.d.ts.map +1 -1
  203. package/types/src/components/sort/sort-dropdown.vue.d.ts +3 -0
  204. package/types/src/components/sort/sort-dropdown.vue.d.ts.map +1 -1
  205. package/types/src/composables/index.d.ts +1 -0
  206. package/types/src/composables/index.d.ts.map +1 -1
  207. package/types/src/composables/use-accessibility-labels.d.ts +31 -0
  208. package/types/src/composables/use-accessibility-labels.d.ts.map +1 -0
  209. package/types/src/types/accessibility.d.ts +79 -0
  210. package/types/src/types/accessibility.d.ts.map +1 -0
  211. package/types/src/types/index.d.ts +1 -0
  212. package/types/src/types/index.d.ts.map +1 -1
  213. package/types/src/utils/accessibility.d.ts +10 -0
  214. package/types/src/utils/accessibility.d.ts.map +1 -0
  215. package/types/src/utils/deep-merge-with-defaults.d.ts +28 -0
  216. package/types/src/utils/deep-merge-with-defaults.d.ts.map +1 -0
  217. package/types/src/utils/index.d.ts +2 -0
  218. package/types/src/utils/index.d.ts.map +1 -1
  219. package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts +4 -0
  220. package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts.map +1 -1
  221. package/types/src/x-modules/facets/components/facets/facets.vue.d.ts +3 -0
  222. package/types/src/x-modules/facets/components/facets/facets.vue.d.ts.map +1 -1
  223. package/types/src/x-modules/facets/components/filters/editable-number-range-filter.vue.d.ts +4 -2
  224. package/types/src/x-modules/facets/components/filters/editable-number-range-filter.vue.d.ts.map +1 -1
  225. package/types/src/x-modules/facets/components/filters/slider-filter.vue.d.ts +4 -0
  226. package/types/src/x-modules/facets/components/filters/slider-filter.vue.d.ts.map +1 -1
  227. package/types/src/x-modules/facets/components/lists/filters-search.vue.d.ts +3 -0
  228. package/types/src/x-modules/facets/components/lists/filters-search.vue.d.ts.map +1 -1
  229. package/types/src/x-modules/history-queries/components/clear-history-queries.vue.d.ts +3 -0
  230. package/types/src/x-modules/history-queries/components/clear-history-queries.vue.d.ts.map +1 -1
  231. package/types/src/x-modules/history-queries/components/history-queries-switch.vue.d.ts +3 -0
  232. package/types/src/x-modules/history-queries/components/history-queries-switch.vue.d.ts.map +1 -1
  233. package/types/src/x-modules/history-queries/components/history-query.vue.d.ts +3 -0
  234. package/types/src/x-modules/history-queries/components/history-query.vue.d.ts.map +1 -1
  235. package/types/src/x-modules/history-queries/components/remove-history-query.vue.d.ts +3 -0
  236. package/types/src/x-modules/history-queries/components/remove-history-query.vue.d.ts.map +1 -1
  237. package/types/src/x-modules/scroll/components/scroll-to-top.vue.d.ts +3 -0
  238. package/types/src/x-modules/scroll/components/scroll-to-top.vue.d.ts.map +1 -1
  239. package/types/src/x-modules/search-box/components/search-input.vue.d.ts +3 -0
  240. package/types/src/x-modules/search-box/components/search-input.vue.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"editable-number-range-filter.vue2.js","sources":["../../../../../../src/x-modules/facets/components/filters/editable-number-range-filter.vue"],"sourcesContent":["<template>\n <div\n class=\"x-editable-number-range-filter\"\n :class=\"cssClasses\"\n data-test=\"editable-number-range-filter\"\n >\n <!--\n @slot Empty slot used to customize the whole component.\n @binding {min} number - Component min value.\n @binding {max} number - Component max value.\n @binding {setMin} function - Component min setter.\n @binding {setMax} function - Component max setter.\n @binding {emitUserModifiedFilter} function - It emits the\n `UserModifiedEditableNumberRangeFilter` X event.\n @binding {clearValues} function - It sets component min and max values to null.\n @binding {hasError} boolean - Returns true when there is an error with component values.\n -->\n <slot\n v-bind=\"{\n min,\n max,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n isAnyRange,\n }\"\n >\n <!-- eslint-disable max-len -->\n <input\n name=\"min\"\n type=\"number\"\n class=\"x-editable-number-range-filter__input x-editable-number-range-filter__input--min xds:input\"\n :class=\"inputsClass\"\n :value=\"!isAnyRange ? min : null\"\n data-test=\"range-min\"\n :aria-label=\"rangeFilterMin\"\n @change=\"setMin(($event?.target as HTMLInputElement)?.valueAsNumber)\"\n />\n\n <input\n name=\"max\"\n type=\"number\"\n class=\"x-editable-number-range-filter__input x-editable-number-range-filter__input--max xds:input\"\n :class=\"inputsClass\"\n :value=\"max\"\n data-test=\"range-max\"\n :aria-label=\"rangeFilterMax\"\n @change=\"setMax(($event?.target as HTMLInputElement)?.valueAsNumber)\"\n />\n <!-- eslint-enable max-len -->\n\n <button\n v-if=\"!isInstant\"\n class=\"x-editable-number-range-filter__apply xds:button\"\n :class=\"buttonsClass\"\n :disabled=\"hasError\"\n data-test=\"range-apply\"\n @click=\"emitUserModifiedFilter\"\n >\n <!--\n @slot Slot used to customize the apply button content.\n -->\n <slot name=\"apply-content\">✓</slot>\n </button>\n\n <button\n v-if=\"renderClearButton\"\n class=\"x-editable-number-range-filter__clear xds:button\"\n :class=\"buttonsClass\"\n data-test=\"range-clear\"\n @click=\"clearValues\"\n >\n <!--\n @slot Slot used to customize the clear button content.\n -->\n <slot name=\"clear-content\">𐄂</slot>\n </button>\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type {\n EditableNumberRangeFilter as EditableNumberRangeFilterModel,\n RangeValue,\n} from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { use$x } from '../../../../composables'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders an editable number range filter. It has two input fields to handle min and max values,\n * emitting the needed events when clicked.\n *\n * It provides a default slot, with some utils bind, to customize the whole component; and two\n * named slots `apply-content` and `clear-content` to override each button content.\n *\n * If `instant` prop is true, the needed events are emitted immediately; else, apply button is\n * rendered to confirm to do it. False by default.\n *\n * If `clear` prop is true, clear button, which sets to null component min and max values, is\n * rendered. True by default.\n *\n * @public\n */\nexport default defineComponent({\n name: 'EditableNumberRangeFilter',\n xModule: facetsXModule.name,\n props: {\n /**\n * The filter data to render and edit.\n *\n * @public\n */\n filter: {\n type: Object as PropType<EditableNumberRangeFilterModel>,\n required: true,\n },\n /**\n * If `instant` prop is true, the needed events are emitted immediately; else, apply button is\n * rendered to confirm to do it. False by default.\n *\n * @public\n */\n isInstant: Boolean,\n /**\n * If `clear` prop is true, clear button, which sets to null component min and max values, is\n * rendered. True by default.\n *\n * @public\n */\n hasClearButton: {\n type: Boolean,\n default: true,\n },\n /** Class inherited by content element. */\n inputsClass: String,\n /** Class inherited by content element. */\n buttonsClass: String,\n },\n setup(props) {\n const $x = use$x()\n\n const rangeFilterMin = 'minimum amount'\n const rangeFilterMax = 'maximum amount'\n /**\n * Component min value.\n *\n * @internal\n */\n const min: Ref<RangeValue['min']> = ref(null)\n /**\n * Component max value.\n *\n * @internal\n */\n const max: Ref<RangeValue['max']> = ref(null)\n\n /**\n * Returns {@link @empathyco/x-types#RangeValue} with component min and max\n * values.\n *\n * @returns Range value object with component values.\n *\n * @internal\n */\n const range = computed((): RangeValue => {\n return { min: min.value, max: max.value }\n })\n\n /**\n * It checks if component min and max values are valid.\n *\n * @returns True if there is any error in the component min and max values.\n *\n * @internal\n */\n const hasError = computed(\n () => min.value !== null && max.value !== null && min.value > max.value,\n )\n\n /**\n * It checks if component min and max values are different from the ones within the filter\n * provided as property.\n *\n * @returns True if they are different.\n *\n * @internal\n */\n const areValuesDifferent = computed(\n () => min.value !== props.filter.range.min || max.value !== props.filter.range.max,\n )\n\n /**\n * Dynamic CSS classes.\n *\n * @returns Object which contains dynamic CSS classes.\n *\n * @internal\n */\n const cssClasses = computed(() => {\n return { 'x-editable-number-range-filter--error': hasError.value }\n })\n\n /**\n * Checks if the range of the filter allows any value, which happens when the min is\n * null or 0 and the max is null.\n *\n * @returns True if the range of the filter allows any value.\n *\n * @internal\n */\n const isAnyRange = computed(() => !min.value && max.value === null)\n\n /**\n * It returns true if the property `hasClearButton` is true and there are values to clear.\n *\n * @returns True if the clear button has to be rendered.\n *\n * @internal\n */\n const renderClearButton = computed(() => props.hasClearButton && !isAnyRange.value)\n\n /**\n * It emits {@link FacetsXEvents.UserModifiedEditableNumberRangeFilter} event if there are no\n * errors and component `min` and `max` values are different than `filter.range` ones.\n *\n * @internal\n */\n const emitUserModifiedFilter = () => {\n if (!hasError.value && areValuesDifferent.value) {\n $x.emit('UserModifiedEditableNumberRangeFilter', {\n ...props.filter,\n range: range.value,\n })\n }\n }\n\n /**\n * It returns the number if possible or null otherwise.\n *\n * @param value - Value.\n * @returns The element value as a number if possible or null.\n *\n * @internal\n */\n const parseRangeValue = (value: number) => (Number.isNaN(value) ? null : value)\n\n /**\n * `min` setter.\n *\n * @param value - The component `min` value to be set.\n *\n * @internal\n */\n const setMin = (value: number) => {\n min.value = parseRangeValue(value)\n }\n\n /**\n * `max` setter.\n *\n * @param value - The component `max` value to be set.\n *\n * @internal\n */\n const setMax = (value: number) => {\n max.value = parseRangeValue(value)\n }\n\n /**\n * It sets component `min` and `max` values to null , and it emits the change if component is\n * working in instant mode.\n *\n * @internal\n */\n const clearValues = () => {\n min.value = null\n max.value = null\n }\n\n /**\n * It resets the min/max range values to null if the\n * {@link FacetsXEvents.UserClickedClearAllFilters} event is fired.\n *\n * @public\n */\n $x.on('UserClickedClearAllFilters', false).subscribe(clearValues)\n\n /**\n * It watches the filter range values passed as property and updates component range values if\n * they change.\n *\n * @param newRange - New range value.\n *\n * @internal\n */\n watch(\n () => props.filter.range,\n (newRange: RangeValue) => {\n min.value = newRange.min\n max.value = newRange.max\n },\n { immediate: true, deep: true },\n )\n\n /**\n * It watches range values in order to emit the event with the change if `isInstant`\n * property is true.\n *\n * @internal\n */\n watch(\n range,\n () => {\n if (props.isInstant) {\n emitUserModifiedFilter()\n }\n },\n { deep: true },\n )\n\n return {\n rangeFilterMin,\n rangeFilterMax,\n cssClasses,\n min,\n max,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n isAnyRange,\n renderClearButton,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-editable-number-range-filter--error .x-editable-number-range-filter__input {\n border-color: red;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserModifiedEditableNumberRangeFilter`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n this event is emitted instantly after typing the value or clicking the submit button. The event\n payload in both cases is an object containing the filter and the new value for the range.\n\n## Example\n\nRenders an editable number range filter. It has two input fields to handle min and max values,\nemitting the needed events when clicked.\n\nIt provides a default slot, with some utils bind, to customize the whole component; and two named\nslots `apply-content` and `clear-content` to override each button content.\n\nIf `instant` prop is true, the needed events are emitted immediately; else, apply button is rendered\nto confirm to do it. False by default.\n\nIf `clear` prop is true, clear button, which sets to null component min and max values, is rendered.\nTrue by default.\n\n### Basic usage\n\n```vue\n<template>\n <EditableNumberRangeFilter :filter=\"editableFilter\" />\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n\n### Properties\n\n```vue\n<template>\n <EditableNumberRangeFilter :filter=\"editableFilter\" :isInstant=\"true\" :hasClearButton=\"false\" />\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n\n### Customizing content slots\n\n```vue\n<template>\n <EditableNumberRangeFilter :filter=\"editableFilter\">\n <template #apply-content>Apply</template>\n <template #clear-content>Clear</template>\n </EditableNumberRangeFilter>\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n\n### Customizing default slot\n\n```vue\n<template>\n <EditableNumberRangeFilter\n :filter=\"editableFilter\"\n #default=\"{\n min,\n max,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n isAnyRange,\n }\"\n >\n <button @click=\"emitUserModifiedFilter\">✅ Apply!</button>\n <button @click=\"clearValues\">🗑 Clear!</button>\n <input :value=\"!isAnyRange ? min : null\" @change=\"setMin($event.target.valueAsNumber)\" />\n <input :value=\"max\" @change=\"setMax($event.target.valueAsNumber)\" />\n <div class=\"has-error\" v-if=\"hasError\">⚠️ Invalid range values</div>\n </EditableNumberRangeFilter>\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n\n### Customizing the items with classes\n\nThe `buttonsClass` and `inputsClass` props can be used to add classes to the inputs and buttons of\nthe component.\n\n```\n<template>\n <EditableNumberRangeFilter\n :filter=\"editableFilter\"\n :inputsClass=\"'my-inputs-class'\"\n :buttonsClass=\"'my-buttons-class'\"\n />\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;AA6FA;;;;;;;;;;;;;;AAcE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAkD;AACxD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;;AAKE;AACF,QAAA,SAAS,EAAE,OAAO;AAClB;;;;;AAKE;AACF,QAAA,cAAc,EAAE;AACd,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;;AAED,QAAA,WAAW,EAAE,MAAM;;AAEnB,QAAA,YAAY,EAAE,MAAM;AACrB,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;QAEjB,MAAM,cAAa,GAAI,gBAAe;QACtC,MAAM,cAAa,GAAI,gBAAe;AACtC;;;;AAIE;A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sB,EAAC;YACzB;AACF,QAAA,CAAC,EACD,EAAE,IAAI,EAAE,IAAG,EAAG,CAChB;QAEA,OAAO;YACL,cAAc;YACd,cAAc;YACd,UAAU;YACV,GAAG;YACH,GAAG;YACH,MAAM;YACN,MAAM;YACN,sBAAsB;YACtB,WAAW;YACX,QAAQ;YACR,UAAU;YACV,iBAAiB;SACnB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"editable-number-range-filter.vue2.js","sources":["../../../../../../src/x-modules/facets/components/filters/editable-number-range-filter.vue"],"sourcesContent":["<template>\n <div\n class=\"x-editable-number-range-filter\"\n :class=\"cssClasses\"\n data-test=\"editable-number-range-filter\"\n >\n <!--\n @slot Empty slot used to customize the whole component.\n @binding {min} number - Component min value.\n @binding {max} number - Component max value.\n @binding {setMin} function - Component min setter.\n @binding {setMax} function - Component max setter.\n @binding {emitUserModifiedFilter} function - It emits the\n `UserModifiedEditableNumberRangeFilter` X event.\n @binding {clearValues} function - It sets component min and max values to null.\n @binding {hasError} boolean - Returns true when there is an error with component values.\n -->\n <slot\n v-bind=\"{\n min,\n max,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n isAnyRange,\n }\"\n >\n <!-- eslint-disable max-len -->\n <input\n name=\"min\"\n type=\"number\"\n class=\"x-editable-number-range-filter__input x-editable-number-range-filter__input--min xds:input\"\n :class=\"inputsClass\"\n :value=\"!isAnyRange ? min : null\"\n data-test=\"range-min\"\n :aria-label=\"ariaLabels?.min\"\n @change=\"setMin(($event?.target as HTMLInputElement)?.valueAsNumber)\"\n />\n\n <input\n name=\"max\"\n type=\"number\"\n class=\"x-editable-number-range-filter__input x-editable-number-range-filter__input--max xds:input\"\n :class=\"inputsClass\"\n :value=\"max\"\n data-test=\"range-max\"\n :aria-label=\"ariaLabels?.max\"\n @change=\"setMax(($event?.target as HTMLInputElement)?.valueAsNumber)\"\n />\n <!-- eslint-enable max-len -->\n\n <button\n v-if=\"!isInstant\"\n class=\"x-editable-number-range-filter__apply xds:button\"\n :class=\"buttonsClass\"\n :disabled=\"hasError\"\n data-test=\"range-apply\"\n @click=\"emitUserModifiedFilter\"\n >\n <!--\n @slot Slot used to customize the apply button content.\n -->\n <slot name=\"apply-content\">✓</slot>\n </button>\n\n <button\n v-if=\"renderClearButton\"\n class=\"x-editable-number-range-filter__clear xds:button\"\n :class=\"buttonsClass\"\n data-test=\"range-clear\"\n @click=\"clearValues\"\n >\n <!--\n @slot Slot used to customize the clear button content.\n -->\n <slot name=\"clear-content\">𐄂</slot>\n </button>\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type {\n EditableNumberRangeFilter as EditableNumberRangeFilterModel,\n RangeValue,\n} from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { use$x, useAccessibilityLabels } from '../../../../composables'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders an editable number range filter. It has two input fields to handle min and max values,\n * emitting the needed events when clicked.\n *\n * It provides a default slot, with some utils bind, to customize the whole component; and two\n * named slots `apply-content` and `clear-content` to override each button content.\n *\n * If `instant` prop is true, the needed events are emitted immediately; else, apply button is\n * rendered to confirm to do it. False by default.\n *\n * If `clear` prop is true, clear button, which sets to null component min and max values, is\n * rendered. True by default.\n *\n * @public\n */\nexport default defineComponent({\n name: 'EditableNumberRangeFilter',\n xModule: facetsXModule.name,\n props: {\n /**\n * The filter data to render and edit.\n *\n * @public\n */\n filter: {\n type: Object as PropType<EditableNumberRangeFilterModel>,\n required: true,\n },\n /**\n * If `instant` prop is true, the needed events are emitted immediately; else, apply button is\n * rendered to confirm to do it. False by default.\n *\n * @public\n */\n isInstant: Boolean,\n /**\n * If `clear` prop is true, clear button, which sets to null component min and max values, is\n * rendered. True by default.\n *\n * @public\n */\n hasClearButton: {\n type: Boolean,\n default: true,\n },\n /** Class inherited by content element. */\n inputsClass: String,\n /** Class inherited by content element. */\n buttonsClass: String,\n },\n setup(props) {\n const $x = use$x()\n\n const ariaLabels = useAccessibilityLabels('editableNumberRangeFilter')\n\n /**\n * Component min value.\n *\n * @internal\n */\n const min: Ref<RangeValue['min']> = ref(null)\n /**\n * Component max value.\n *\n * @internal\n */\n const max: Ref<RangeValue['max']> = ref(null)\n\n /**\n * Returns {@link @empathyco/x-types#RangeValue} with component min and max\n * values.\n *\n * @returns Range value object with component values.\n *\n * @internal\n */\n const range = computed((): RangeValue => {\n return { min: min.value, max: max.value }\n })\n\n /**\n * It checks if component min and max values are valid.\n *\n * @returns True if there is any error in the component min and max values.\n *\n * @internal\n */\n const hasError = computed(\n () => min.value !== null && max.value !== null && min.value > max.value,\n )\n\n /**\n * It checks if component min and max values are different from the ones within the filter\n * provided as property.\n *\n * @returns True if they are different.\n *\n * @internal\n */\n const areValuesDifferent = computed(\n () => min.value !== props.filter.range.min || max.value !== props.filter.range.max,\n )\n\n /**\n * Dynamic CSS classes.\n *\n * @returns Object which contains dynamic CSS classes.\n *\n * @internal\n */\n const cssClasses = computed(() => {\n return { 'x-editable-number-range-filter--error': hasError.value }\n })\n\n /**\n * Checks if the range of the filter allows any value, which happens when the min is\n * null or 0 and the max is null.\n *\n * @returns True if the range of the filter allows any value.\n *\n * @internal\n */\n const isAnyRange = computed(() => !min.value && max.value === null)\n\n /**\n * It returns true if the property `hasClearButton` is true and there are values to clear.\n *\n * @returns True if the clear button has to be rendered.\n *\n * @internal\n */\n const renderClearButton = computed(() => props.hasClearButton && !isAnyRange.value)\n\n /**\n * It emits {@link FacetsXEvents.UserModifiedEditableNumberRangeFilter} event if there are no\n * errors and component `min` and `max` values are different than `filter.range` ones.\n *\n * @internal\n */\n const emitUserModifiedFilter = () => {\n if (!hasError.value && areValuesDifferent.value) {\n $x.emit('UserModifiedEditableNumberRangeFilter', {\n ...props.filter,\n range: range.value,\n })\n }\n }\n\n /**\n * It returns the number if possible or null otherwise.\n *\n * @param value - Value.\n * @returns The element value as a number if possible or null.\n *\n * @internal\n */\n const parseRangeValue = (value: number) => (Number.isNaN(value) ? null : value)\n\n /**\n * `min` setter.\n *\n * @param value - The component `min` value to be set.\n *\n * @internal\n */\n const setMin = (value: number) => {\n min.value = parseRangeValue(value)\n }\n\n /**\n * `max` setter.\n *\n * @param value - The component `max` value to be set.\n *\n * @internal\n */\n const setMax = (value: number) => {\n max.value = parseRangeValue(value)\n }\n\n /**\n * It sets component `min` and `max` values to null , and it emits the change if component is\n * working in instant mode.\n *\n * @internal\n */\n const clearValues = () => {\n min.value = null\n max.value = null\n }\n\n /**\n * It resets the min/max range values to null if the\n * {@link FacetsXEvents.UserClickedClearAllFilters} event is fired.\n *\n * @public\n */\n $x.on('UserClickedClearAllFilters', false).subscribe(clearValues)\n\n /**\n * It watches the filter range values passed as property and updates component range values if\n * they change.\n *\n * @param newRange - New range value.\n *\n * @internal\n */\n watch(\n () => props.filter.range,\n (newRange: RangeValue) => {\n min.value = newRange.min\n max.value = newRange.max\n },\n { immediate: true, deep: true },\n )\n\n /**\n * It watches range values in order to emit the event with the change if `isInstant`\n * property is true.\n *\n * @internal\n */\n watch(\n range,\n () => {\n if (props.isInstant) {\n emitUserModifiedFilter()\n }\n },\n { deep: true },\n )\n\n return {\n ariaLabels,\n cssClasses,\n min,\n max,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n isAnyRange,\n renderClearButton,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-editable-number-range-filter--error .x-editable-number-range-filter__input {\n border-color: red;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserModifiedEditableNumberRangeFilter`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n this event is emitted instantly after typing the value or clicking the submit button. The event\n payload in both cases is an object containing the filter and the new value for the range.\n\n## Example\n\nRenders an editable number range filter. It has two input fields to handle min and max values,\nemitting the needed events when clicked.\n\nIt provides a default slot, with some utils bind, to customize the whole component; and two named\nslots `apply-content` and `clear-content` to override each button content.\n\nIf `instant` prop is true, the needed events are emitted immediately; else, apply button is rendered\nto confirm to do it. False by default.\n\nIf `clear` prop is true, clear button, which sets to null component min and max values, is rendered.\nTrue by default.\n\n### Basic usage\n\n```vue\n<template>\n <EditableNumberRangeFilter :filter=\"editableFilter\" />\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n\n### Properties\n\n```vue\n<template>\n <EditableNumberRangeFilter :filter=\"editableFilter\" :isInstant=\"true\" :hasClearButton=\"false\" />\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n\n### Customizing content slots\n\n```vue\n<template>\n <EditableNumberRangeFilter :filter=\"editableFilter\">\n <template #apply-content>Apply</template>\n <template #clear-content>Clear</template>\n </EditableNumberRangeFilter>\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n\n### Customizing default slot\n\n```vue\n<template>\n <EditableNumberRangeFilter\n :filter=\"editableFilter\"\n #default=\"{\n min,\n max,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n isAnyRange,\n }\"\n >\n <button @click=\"emitUserModifiedFilter\">✅ Apply!</button>\n <button @click=\"clearValues\">🗑 Clear!</button>\n <input :value=\"!isAnyRange ? min : null\" @change=\"setMin($event.target.valueAsNumber)\" />\n <input :value=\"max\" @change=\"setMax($event.target.valueAsNumber)\" />\n <div class=\"has-error\" v-if=\"hasError\">⚠️ Invalid range values</div>\n </EditableNumberRangeFilter>\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n\n### Customizing the items with classes\n\nThe `buttonsClass` and `inputsClass` props can be used to add classes to the inputs and buttons of\nthe component.\n\n```\n<template>\n <EditableNumberRangeFilter\n :filter=\"editableFilter\"\n :inputsClass=\"'my-inputs-class'\"\n :buttonsClass=\"'my-buttons-class'\"\n />\n</template>\n\n<script setup>\nimport { EditableNumberRangeFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst editableFilter = ref({\n facetId: 'age',\n id: 'age:primary',\n label: 'primary',\n modelName: 'EditableNumberRangeFilter',\n range: {\n min: null,\n max: null,\n },\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;AA6FA;;;;;;;;;;;;;;AAcE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAkD;AACxD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;;AAKE;AACF,QAAA,SAAS,EAAE,OAAO;AAClB;;;;;AAKE;AACF,QAAA,cAAc,EAAE;AACd,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;;AAED,QAAA,WAAW,EAAE,MAAM;;AAEnB,QAAA,YAAY,EAAE,MAAM;AACrB,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;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jC;AAEA;;;;;AAKE;AACF,QAAA,KAAK,CACH,KAAK,EACL,MAAI;AACF,YAAA,IAAI,KAAK,CAAC,SAAS,EAAE;AACnB,gBAAA,sBAAsB,EAAC;YACzB;AACF,QAAA,CAAC,EACD,EAAE,IAAI,EAAE,IAAG,EAAG,CAChB;QAEA,OAAO;YACL,UAAU;YACV,UAAU;YACV,GAAG;YACH,GAAG;YACH,MAAM;YACN,MAAM;YACN,sBAAsB;YACtB,WAAW;YACX,QAAQ;YACR,UAAU;YACV,iBAAiB;SACnB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -3,8 +3,8 @@ import { resolveComponent, openBlock, createBlock, normalizeClass, withCtx, rend
3
3
  import './slider-filter.vue3.js';
4
4
  import _export_sfc from '../../../../_virtual/_plugin-vue_export-helper.js';
5
5
 
6
- const _hoisted_1 = ["value", "min", "max"];
7
- const _hoisted_2 = ["value", "min", "max"];
6
+ const _hoisted_1 = ["value", "min", "max", "aria-label"];
7
+ const _hoisted_2 = ["value", "min", "max", "aria-label"];
8
8
  const _hoisted_3 = ["disabled"];
9
9
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
10
10
  const _component_BaseSlider = resolveComponent("BaseSlider");
@@ -34,7 +34,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
34
34
  min: _ctx.threshold.min,
35
35
  max: _ctx.threshold.max,
36
36
  "data-test": "slider-filter-input-min",
37
- "aria-label": "minimum amount",
37
+ "aria-label": _ctx.ariaLabels?.min,
38
38
  onChange: _cache[0] || (_cache[0] = ($event) => _ctx.setMin($event.target.value))
39
39
  }, null, 40, _hoisted_1),
40
40
  createElementVNode("input", {
@@ -46,7 +46,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
46
46
  min: _ctx.threshold.min,
47
47
  max: _ctx.threshold.max,
48
48
  "data-test": "slider-filter-input-max",
49
- "aria-label": "maximum amount",
49
+ "aria-label": _ctx.ariaLabels?.max,
50
50
  onChange: _cache[1] || (_cache[1] = ($event) => _ctx.setMax($event.target.value))
51
51
  }, null, 40, _hoisted_2),
52
52
  !_ctx.isInstant ? (openBlock(), createElementBlock("button", {
@@ -1 +1 @@
1
- {"version":3,"file":"slider-filter.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/slider-filter.vue"],"sourcesContent":["<template>\n <BaseSlider\n v-model=\"selectedRange\"\n :threshold=\"threshold\"\n class=\"x-slider-filter\"\n :class=\"{ 'x-slider-filter--error': hasError }\"\n >\n <!--\n @slot Slot used to customize the whole component.\n\n @binding {selectedRange} RangeValue - Current selected minimum and maximum values.\n @binding {threshold} RangeValue - Minimum and maximum boundaries of the slider.\n @binding {setMin} function - Sets the selected minimum value.\n @binding {setMax} function - Sets the selected maximum value.\n @binding {emitUserModifiedFilter} function - Emits the `UserModifiedSliderFilter` event.\n @binding {clearValues} function - Resets the selected range to the slider boundaries.\n @binding {hasError} boolean - Whether the selected range is invalid.\n -->\n <slot\n v-bind=\"{\n threshold,\n selectedRange,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n }\"\n >\n <div>\n <input\n name=\"min\"\n type=\"number\"\n inputmode=\"decimal\"\n class=\"x-slider-filter__input x-slider-filter__input--min xds:input\"\n :value=\"selectedRange.min\"\n :min=\"threshold.min\"\n :max=\"threshold.max\"\n data-test=\"slider-filter-input-min\"\n aria-label=\"minimum amount\"\n @change=\"setMin(($event.target as HTMLInputElement).value)\"\n />\n\n <input\n name=\"max\"\n type=\"number\"\n inputmode=\"decimal\"\n class=\"x-slider-filter__input x-slider-filter__input--max xds:input\"\n :value=\"selectedRange.max\"\n :min=\"threshold.min\"\n :max=\"threshold.max\"\n data-test=\"slider-filter-input-max\"\n aria-label=\"maximum amount\"\n @change=\"setMax(($event.target as HTMLInputElement).value)\"\n />\n\n <button\n v-if=\"!isInstant\"\n class=\"x-slider-filter__apply xds:button\"\n :disabled=\"hasError\"\n data-test=\"slider-filter-apply\"\n @click=\"emitUserModifiedFilter\"\n >\n ✓\n </button>\n\n <button\n class=\"x-slider-filter__clear xds:button\"\n data-test=\"slider-filter-clear\"\n @click=\"clearValues\"\n >\n 𐄂\n </button>\n </div>\n </slot>\n </BaseSlider>\n</template>\n\n<script lang=\"ts\">\nimport type { SliderFilter as SliderFilterModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport BaseSlider from '../../../../components/base-slider.vue'\nimport { use$x } from '../../../../composables'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders a slider filter with editable minimum and maximum values.\n *\n * Users can select a range using the slider or by entering the minimum and\n * maximum values directly.\n *\n * In instant mode, valid changes are emitted automatically. Otherwise, the\n * apply button is rendered and changes are emitted when it is clicked.\n *\n * The clear action resets the selected range to the slider boundaries.\n *\n * The default slot exposes the selected range, slider boundaries, validation\n * state, and methods to update, apply, or clear the selected values.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SliderFilter',\n xModule: facetsXModule.name,\n components: {\n BaseSlider,\n },\n props: {\n /**\n * The slider filter data to render and edit.\n *\n * @public\n */\n filter: {\n type: Object as PropType<SliderFilterModel>,\n required: true,\n },\n /**\n * Whether changes should be emitted immediately.\n *\n * When false, the apply button is rendered and changes are emitted when\n * the user clicks it.\n *\n * @default false\n * @public\n */\n isInstant: Boolean,\n },\n\n setup(props) {\n const $x = use$x()\n\n /**\n * Current selected minimum and maximum values.\n *\n * Values that are not selected are initialized to the corresponding\n * slider boundaries.\n *\n * @internal\n */\n const selectedRange = ref({\n min: props.filter.selectedRange.min ?? props.filter.range.min,\n max: props.filter.selectedRange.max ?? props.filter.range.max,\n })\n\n /**\n * Minimum and maximum boundaries of the slider.\n *\n * @internal\n */\n const threshold = computed(() => ({\n min: props.filter.range.min,\n max: props.filter.range.max,\n }))\n\n /**\n * Whether the selected range is invalid because its minimum is greater\n * than its maximum.\n *\n * @internal\n */\n const hasError = computed(\n () =>\n selectedRange.value.min !== null &&\n selectedRange.value.max !== null &&\n selectedRange.value.min > selectedRange.value.max,\n )\n\n /**\n * Whether the selected range differs from the range currently applied\n * to the filter.\n *\n * @internal\n */\n const areValuesDifferent = computed(\n () =>\n selectedRange.value.min !== (props.filter.selectedRange.min ?? props.filter.range.min) ||\n selectedRange.value.max !== (props.filter.selectedRange.max ?? props.filter.range.max),\n )\n\n /**\n * Emits the `UserModifiedSliderFilter` event when the selected range is\n * valid and differs from the currently applied filter range.\n *\n * @internal\n */\n const emitUserModifiedFilter = () => {\n if (hasError.value || !areValuesDifferent.value) {\n return\n }\n\n $x.emit('UserModifiedSliderFilter', {\n ...props.filter,\n selectedRange: selectedRange.value,\n })\n }\n\n /**\n * Sets one of the selected range values from a raw input value.\n *\n * Empty or invalid values are reset to the corresponding slider boundary.\n *\n * @param key - Range boundary to update.\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setRangeValue = (key: 'min' | 'max', rawValue: string) => {\n const value = Number(rawValue)\n\n selectedRange.value[key] =\n rawValue === '' || Number.isNaN(value) ? threshold.value[key] : value\n }\n\n /**\n * Sets the selected minimum value.\n *\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setMin = (rawValue: string) => {\n setRangeValue('min', rawValue)\n }\n\n /**\n * Sets the selected maximum value.\n *\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setMax = (rawValue: string) => {\n setRangeValue('max', rawValue)\n }\n\n /**\n * Resets the selected range to the slider boundaries.\n *\n * @internal\n */\n const clearValues = () => {\n selectedRange.value = {\n min: threshold.value.min,\n max: threshold.value.max,\n }\n }\n\n /**\n * Resets the selected range when all filters, or the filters of this facet, are cleared.\n *\n * @public\n */\n $x.on('UserClickedClearAllFilters', false).subscribe(facetsIds => {\n if (!facetsIds || facetsIds.includes(props.filter.facetId)) {\n clearValues()\n }\n })\n\n /**\n * Updates the local selected range when the filter selected range changes,\n * but only if the values actually differ from the current local ones.\n *\n * @internal\n */\n watch(\n () => props.filter.selectedRange,\n newRange => {\n const min = newRange.min ?? props.filter.range.min\n const max = newRange.max ?? props.filter.range.max\n\n if (min !== selectedRange.value.min || max !== selectedRange.value.max) {\n selectedRange.value = { min, max }\n }\n },\n )\n\n /**\n * Emits the filter modification automatically when instant mode is enabled\n * and the selected range values (min or max) change.\n *\n * Replacing the selected range with an object holding the same values does\n * not trigger the emit.\n *\n * @internal\n */\n watch([() => selectedRange.value.min, () => selectedRange.value.max], () => {\n if (props.isInstant) {\n emitUserModifiedFilter()\n }\n })\n\n return {\n selectedRange,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n threshold,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-slider-filter--error .x-slider-filter__input {\n border-color: red;\n}\n</style>\n"],"names":["_createBlock","_normalizeClass","_renderSlot","_normalizeProps","_guardReactiveProps","_createElementVNode","_openBlock","_createElementBlock","_createCommentVNode"],"mappings":";;;;;;;;;;sBACEA,WAAA,CA0Ea,qBAAA,EAAA;AAAA,IAAA,UAAA,EAzEF,IAAA,CAAA,aAAA;AAAA,IAAA,qBAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,aAAA,GAAa,MAAA,CAAA;AAAA,IACrB,SAAA,EAAW,IAAA,CAAA,SAAA;AAAA,IACZ,KAAA,EAAKC,cAAA,CAAA,CAAC,iBAAA,EAAiB,EAAA,wBAAA,EACa,IAAA,CAAA,QAAA,EAAQ,CAAA;AAAA,GAAA,EAAA;qBAa5C,MAwDO;AAAA,MAxDPC,UAAA,CAwDO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA;AAAA,QAAA,SAAA,EAvDa,IAAA,CAAA,SAAA;AAAA,QAAA,aAAA,EAAmB,IAAA,CAAA,aAAA;AAAA,QAAA,MAAA,EAAuB,IAAA,CAAA,MAAA;AAAA,QAAA,MAAA,EAAgB,IAAA,CAAA,MAAA;AAAA,QAAA,sBAA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AA,CAAA,MAAA,CAAQ,MAAA,CAAO,OAA4B,KAAK,CAAA;AAAA,WAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,CAAA;AAIlD,UAAA,CAAA,IAAA,CAAA,SAAA,IAAAC,SAAA,EAAA,EADTC,kBAAA,CAQS,QAAA,EAAA;AAAA,YAAA,GAAA,EAAA,CAAA;YANP,KAAA,EAAM,mCAAA;AAAA,YACL,QAAA,EAAU,IAAA,CAAA,QAAA;AAAA,YACX,WAAA,EAAU,qBAAA;AAAA,YACT,SAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,sBAAA,IAAA,IAAA,CAAA,sBAAA,CAAA,GAAA,IAAA,CAAA;AAAA,WAAA,EACT,KAAA,EAED,CAAA,EAAA,UAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;UAEAH,kBAAA,CAMS,QAAA,EAAA;AAAA,YALP,KAAA,EAAM,mCAAA;AAAA,YACN,WAAA,EAAU,qBAAA;AAAA,YACT,SAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,WAAA,IAAA,IAAA,CAAA,WAAA,CAAA,GAAA,IAAA,CAAA;AAAA,WAAA,EACT,MAED;AAAA,SAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"slider-filter.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/slider-filter.vue"],"sourcesContent":["<template>\n <BaseSlider\n v-model=\"selectedRange\"\n :threshold=\"threshold\"\n class=\"x-slider-filter\"\n :class=\"{ 'x-slider-filter--error': hasError }\"\n >\n <!--\n @slot Slot used to customize the whole component.\n\n @binding {selectedRange} RangeValue - Current selected minimum and maximum values.\n @binding {threshold} RangeValue - Minimum and maximum boundaries of the slider.\n @binding {setMin} function - Sets the selected minimum value.\n @binding {setMax} function - Sets the selected maximum value.\n @binding {emitUserModifiedFilter} function - Emits the `UserModifiedSliderFilter` event.\n @binding {clearValues} function - Resets the selected range to the slider boundaries.\n @binding {hasError} boolean - Whether the selected range is invalid.\n -->\n <slot\n v-bind=\"{\n threshold,\n selectedRange,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n }\"\n >\n <div>\n <input\n name=\"min\"\n type=\"number\"\n inputmode=\"decimal\"\n class=\"x-slider-filter__input x-slider-filter__input--min xds:input\"\n :value=\"selectedRange.min\"\n :min=\"threshold.min\"\n :max=\"threshold.max\"\n data-test=\"slider-filter-input-min\"\n :aria-label=\"ariaLabels?.min\"\n @change=\"setMin(($event.target as HTMLInputElement).value)\"\n />\n\n <input\n name=\"max\"\n type=\"number\"\n inputmode=\"decimal\"\n class=\"x-slider-filter__input x-slider-filter__input--max xds:input\"\n :value=\"selectedRange.max\"\n :min=\"threshold.min\"\n :max=\"threshold.max\"\n data-test=\"slider-filter-input-max\"\n :aria-label=\"ariaLabels?.max\"\n @change=\"setMax(($event.target as HTMLInputElement).value)\"\n />\n\n <button\n v-if=\"!isInstant\"\n class=\"x-slider-filter__apply xds:button\"\n :disabled=\"hasError\"\n data-test=\"slider-filter-apply\"\n @click=\"emitUserModifiedFilter\"\n >\n ✓\n </button>\n\n <button\n class=\"x-slider-filter__clear xds:button\"\n data-test=\"slider-filter-clear\"\n @click=\"clearValues\"\n >\n 𐄂\n </button>\n </div>\n </slot>\n </BaseSlider>\n</template>\n\n<script lang=\"ts\">\nimport type { SliderFilter as SliderFilterModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport BaseSlider from '../../../../components/base-slider.vue'\nimport { use$x, useAccessibilityLabels } from '../../../../composables'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders a slider filter with editable minimum and maximum values.\n *\n * Users can select a range using the slider or by entering the minimum and\n * maximum values directly.\n *\n * In instant mode, valid changes are emitted automatically. Otherwise, the\n * apply button is rendered and changes are emitted when it is clicked.\n *\n * The clear action resets the selected range to the slider boundaries.\n *\n * The default slot exposes the selected range, slider boundaries, validation\n * state, and methods to update, apply, or clear the selected values.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SliderFilter',\n xModule: facetsXModule.name,\n components: {\n BaseSlider,\n },\n props: {\n /**\n * The slider filter data to render and edit.\n *\n * @public\n */\n filter: {\n type: Object as PropType<SliderFilterModel>,\n required: true,\n },\n /**\n * Whether changes should be emitted immediately.\n *\n * When false, the apply button is rendered and changes are emitted when\n * the user clicks it.\n *\n * @default false\n * @public\n */\n isInstant: Boolean,\n },\n\n setup(props) {\n const $x = use$x()\n\n const ariaLabels = useAccessibilityLabels('sliderFilter')\n\n /**\n * Current selected minimum and maximum values.\n *\n * Values that are not selected are initialized to the corresponding\n * slider boundaries.\n *\n * @internal\n */\n const selectedRange = ref({\n min: props.filter.selectedRange.min ?? props.filter.range.min,\n max: props.filter.selectedRange.max ?? props.filter.range.max,\n })\n\n /**\n * Minimum and maximum boundaries of the slider.\n *\n * @internal\n */\n const threshold = computed(() => ({\n min: props.filter.range.min,\n max: props.filter.range.max,\n }))\n\n /**\n * Whether the selected range is invalid because its minimum is greater\n * than its maximum.\n *\n * @internal\n */\n const hasError = computed(\n () =>\n selectedRange.value.min !== null &&\n selectedRange.value.max !== null &&\n selectedRange.value.min > selectedRange.value.max,\n )\n\n /**\n * Whether the selected range differs from the range currently applied\n * to the filter.\n *\n * @internal\n */\n const areValuesDifferent = computed(\n () =>\n selectedRange.value.min !== (props.filter.selectedRange.min ?? props.filter.range.min) ||\n selectedRange.value.max !== (props.filter.selectedRange.max ?? props.filter.range.max),\n )\n\n /**\n * Emits the `UserModifiedSliderFilter` event when the selected range is\n * valid and differs from the currently applied filter range.\n *\n * @internal\n */\n const emitUserModifiedFilter = () => {\n if (hasError.value || !areValuesDifferent.value) {\n return\n }\n\n $x.emit('UserModifiedSliderFilter', {\n ...props.filter,\n selectedRange: selectedRange.value,\n })\n }\n\n /**\n * Sets one of the selected range values from a raw input value.\n *\n * Empty or invalid values are reset to the corresponding slider boundary.\n *\n * @param key - Range boundary to update.\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setRangeValue = (key: 'min' | 'max', rawValue: string) => {\n const value = Number(rawValue)\n\n selectedRange.value[key] =\n rawValue === '' || Number.isNaN(value) ? threshold.value[key] : value\n }\n\n /**\n * Sets the selected minimum value.\n *\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setMin = (rawValue: string) => {\n setRangeValue('min', rawValue)\n }\n\n /**\n * Sets the selected maximum value.\n *\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setMax = (rawValue: string) => {\n setRangeValue('max', rawValue)\n }\n\n /**\n * Resets the selected range to the slider boundaries.\n *\n * @internal\n */\n const clearValues = () => {\n selectedRange.value = {\n min: threshold.value.min,\n max: threshold.value.max,\n }\n }\n\n /**\n * Resets the selected range when all filters, or the filters of this facet, are cleared.\n *\n * @public\n */\n $x.on('UserClickedClearAllFilters', false).subscribe(facetsIds => {\n if (!facetsIds || facetsIds.includes(props.filter.facetId)) {\n clearValues()\n }\n })\n\n /**\n * Updates the local selected range when the filter selected range changes,\n * but only if the values actually differ from the current local ones.\n *\n * @internal\n */\n watch(\n () => props.filter.selectedRange,\n newRange => {\n const min = newRange.min ?? props.filter.range.min\n const max = newRange.max ?? props.filter.range.max\n\n if (min !== selectedRange.value.min || max !== selectedRange.value.max) {\n selectedRange.value = { min, max }\n }\n },\n )\n\n /**\n * Emits the filter modification automatically when instant mode is enabled\n * and the selected range values (min or max) change.\n *\n * Replacing the selected range with an object holding the same values does\n * not trigger the emit.\n *\n * @internal\n */\n watch([() => selectedRange.value.min, () => selectedRange.value.max], () => {\n if (props.isInstant) {\n emitUserModifiedFilter()\n }\n })\n\n return {\n ariaLabels,\n selectedRange,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n threshold,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-slider-filter--error .x-slider-filter__input {\n border-color: red;\n}\n</style>\n"],"names":["_createBlock","_normalizeClass","_renderSlot","_normalizeProps","_guardReactiveProps","_createElementVNode","_openBlock","_createElementBlock","_createCommentVNode"],"mappings":";;;;;;;;;;sBACEA,WAAA,CA0Ea,qBAAA,EAAA;AAAA,IAAA,UAAA,EAzEF,IAAA,CAAA,aAAA;AAAA,IAAA,qBAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,aAAA,GAAa,MAAA,CAAA;AAAA,IACrB,SAAA,EAAW,IAAA,CAAA,SAAA;AAAA,IACZ,KAAA,EAAKC,cAAA,CAAA,CAAC,iBAAA,EAAiB,EAAA,wBAAA,EACa,IAAA,CAAA,QAAA,EAAQ,CAAA;AAAA,GAAA,EAAA;qBAa5C,MAwDO;AAAA,MAxDPC,UAAA,CAwDO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA;AAAA,QAAA,SAAA,EAvDa,IAAA,CAAA,SAAA;AAAA,QAAA,aAAA,EAAmB,IAAA,CAAA,aAAA;AAAA,QAAA,MAAA,EAAuB,IAAA,CAAA,MAAA;AAAA,QAAA,MAAA,EAAgB,IAAA,CAAA,MAAA;AAAA,QAAA,sBAAA,EAAgB,IAAA,CAAA,sBAAA;AAAA,QAAA,WAAA,EAAgC,IAAA,CAAA,WAAA;AAAA,QAAA,QAAA,EAAqB,IAAA,CAAA;AAAA,OAAA,CAAA,CAAA,EADnJ,MAwDO;AAAA,QA7CLC,kBAAA,CA4CM,KAAA,EAAA,IAAA,EAAA;AAAA,UA3CJA,kBAAA,CAWE,OAAA,EAAA;AAAA,YAVA,IAAA,EAAK,KAAA;AAAA,YACL,IAAA,EAAK,QAAA;AAAA,YACL,SAAA,EAAU,SAAA;AAAA,YACV,KAAA,EAAM,8DAAA;AAAA,YACL,OAAO,IAAA,CA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A,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,sBAAA,IAAA,IAAA,CAAA,sBAAA,CAAA,GAAA,IAAA,CAAA;AAAA,WAAA,EACT,KAAA,EAED,CAAA,EAAA,UAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;UAEAH,kBAAA,CAMS,QAAA,EAAA;AAAA,YALP,KAAA,EAAM,mCAAA;AAAA,YACN,WAAA,EAAU,qBAAA;AAAA,YACT,SAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,WAAA,IAAA,IAAA,CAAA,WAAA,CAAA,GAAA,IAAA,CAAA;AAAA,WAAA,EACT,MAED;AAAA,SAAA;;;;;;;;;;;"}
@@ -2,6 +2,7 @@ import { defineComponent, ref, computed, watch } from 'vue';
2
2
  import BaseSlider from '../../../../components/base-slider.vue.js';
3
3
  import '../../../../composables/create-use-device.js';
4
4
  import { use$x } from '../../../../composables/use-_x.js';
5
+ import { useAccessibilityLabels } from '../../../../composables/use-accessibility-labels.js';
5
6
  import 'vuex';
6
7
  import '../../../../plugins/x-bus.js';
7
8
  import '@empathyco/x-utils';
@@ -55,6 +56,7 @@ var _sfc_main = defineComponent({
55
56
  },
56
57
  setup(props) {
57
58
  const $x = use$x();
59
+ const ariaLabels = useAccessibilityLabels('sliderFilter');
58
60
  /**
59
61
  * Current selected minimum and maximum values.
60
62
  *
@@ -192,6 +194,7 @@ var _sfc_main = defineComponent({
192
194
  }
193
195
  });
194
196
  return {
197
+ ariaLabels,
195
198
  selectedRange,
196
199
  setMin,
197
200
  setMax,
@@ -1 +1 @@
1
- {"version":3,"file":"slider-filter.vue2.js","sources":["../../../../../../src/x-modules/facets/components/filters/slider-filter.vue"],"sourcesContent":["<template>\n <BaseSlider\n v-model=\"selectedRange\"\n :threshold=\"threshold\"\n class=\"x-slider-filter\"\n :class=\"{ 'x-slider-filter--error': hasError }\"\n >\n <!--\n @slot Slot used to customize the whole component.\n\n @binding {selectedRange} RangeValue - Current selected minimum and maximum values.\n @binding {threshold} RangeValue - Minimum and maximum boundaries of the slider.\n @binding {setMin} function - Sets the selected minimum value.\n @binding {setMax} function - Sets the selected maximum value.\n @binding {emitUserModifiedFilter} function - Emits the `UserModifiedSliderFilter` event.\n @binding {clearValues} function - Resets the selected range to the slider boundaries.\n @binding {hasError} boolean - Whether the selected range is invalid.\n -->\n <slot\n v-bind=\"{\n threshold,\n selectedRange,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n }\"\n >\n <div>\n <input\n name=\"min\"\n type=\"number\"\n inputmode=\"decimal\"\n class=\"x-slider-filter__input x-slider-filter__input--min xds:input\"\n :value=\"selectedRange.min\"\n :min=\"threshold.min\"\n :max=\"threshold.max\"\n data-test=\"slider-filter-input-min\"\n aria-label=\"minimum amount\"\n @change=\"setMin(($event.target as HTMLInputElement).value)\"\n />\n\n <input\n name=\"max\"\n type=\"number\"\n inputmode=\"decimal\"\n class=\"x-slider-filter__input x-slider-filter__input--max xds:input\"\n :value=\"selectedRange.max\"\n :min=\"threshold.min\"\n :max=\"threshold.max\"\n data-test=\"slider-filter-input-max\"\n aria-label=\"maximum amount\"\n @change=\"setMax(($event.target as HTMLInputElement).value)\"\n />\n\n <button\n v-if=\"!isInstant\"\n class=\"x-slider-filter__apply xds:button\"\n :disabled=\"hasError\"\n data-test=\"slider-filter-apply\"\n @click=\"emitUserModifiedFilter\"\n >\n ✓\n </button>\n\n <button\n class=\"x-slider-filter__clear xds:button\"\n data-test=\"slider-filter-clear\"\n @click=\"clearValues\"\n >\n 𐄂\n </button>\n </div>\n </slot>\n </BaseSlider>\n</template>\n\n<script lang=\"ts\">\nimport type { SliderFilter as SliderFilterModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport BaseSlider from '../../../../components/base-slider.vue'\nimport { use$x } from '../../../../composables'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders a slider filter with editable minimum and maximum values.\n *\n * Users can select a range using the slider or by entering the minimum and\n * maximum values directly.\n *\n * In instant mode, valid changes are emitted automatically. Otherwise, the\n * apply button is rendered and changes are emitted when it is clicked.\n *\n * The clear action resets the selected range to the slider boundaries.\n *\n * The default slot exposes the selected range, slider boundaries, validation\n * state, and methods to update, apply, or clear the selected values.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SliderFilter',\n xModule: facetsXModule.name,\n components: {\n BaseSlider,\n },\n props: {\n /**\n * The slider filter data to render and edit.\n *\n * @public\n */\n filter: {\n type: Object as PropType<SliderFilterModel>,\n required: true,\n },\n /**\n * Whether changes should be emitted immediately.\n *\n * When false, the apply button is rendered and changes are emitted when\n * the user clicks it.\n *\n * @default false\n * @public\n */\n isInstant: Boolean,\n },\n\n setup(props) {\n const $x = use$x()\n\n /**\n * Current selected minimum and maximum values.\n *\n * Values that are not selected are initialized to the corresponding\n * slider boundaries.\n *\n * @internal\n */\n const selectedRange = ref({\n min: props.filter.selectedRange.min ?? props.filter.range.min,\n max: props.filter.selectedRange.max ?? props.filter.range.max,\n })\n\n /**\n * Minimum and maximum boundaries of the slider.\n *\n * @internal\n */\n const threshold = computed(() => ({\n min: props.filter.range.min,\n max: props.filter.range.max,\n }))\n\n /**\n * Whether the selected range is invalid because its minimum is greater\n * than its maximum.\n *\n * @internal\n */\n const hasError = computed(\n () =>\n selectedRange.value.min !== null &&\n selectedRange.value.max !== null &&\n selectedRange.value.min > selectedRange.value.max,\n )\n\n /**\n * Whether the selected range differs from the range currently applied\n * to the filter.\n *\n * @internal\n */\n const areValuesDifferent = computed(\n () =>\n selectedRange.value.min !== (props.filter.selectedRange.min ?? props.filter.range.min) ||\n selectedRange.value.max !== (props.filter.selectedRange.max ?? props.filter.range.max),\n )\n\n /**\n * Emits the `UserModifiedSliderFilter` event when the selected range is\n * valid and differs from the currently applied filter range.\n *\n * @internal\n */\n const emitUserModifiedFilter = () => {\n if (hasError.value || !areValuesDifferent.value) {\n return\n }\n\n $x.emit('UserModifiedSliderFilter', {\n ...props.filter,\n selectedRange: selectedRange.value,\n })\n }\n\n /**\n * Sets one of the selected range values from a raw input value.\n *\n * Empty or invalid values are reset to the corresponding slider boundary.\n *\n * @param key - Range boundary to update.\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setRangeValue = (key: 'min' | 'max', rawValue: string) => {\n const value = Number(rawValue)\n\n selectedRange.value[key] =\n rawValue === '' || Number.isNaN(value) ? threshold.value[key] : value\n }\n\n /**\n * Sets the selected minimum value.\n *\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setMin = (rawValue: string) => {\n setRangeValue('min', rawValue)\n }\n\n /**\n * Sets the selected maximum value.\n *\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setMax = (rawValue: string) => {\n setRangeValue('max', rawValue)\n }\n\n /**\n * Resets the selected range to the slider boundaries.\n *\n * @internal\n */\n const clearValues = () => {\n selectedRange.value = {\n min: threshold.value.min,\n max: threshold.value.max,\n }\n }\n\n /**\n * Resets the selected range when all filters, or the filters of this facet, are cleared.\n *\n * @public\n */\n $x.on('UserClickedClearAllFilters', false).subscribe(facetsIds => {\n if (!facetsIds || facetsIds.includes(props.filter.facetId)) {\n clearValues()\n }\n })\n\n /**\n * Updates the local selected range when the filter selected range changes,\n * but only if the values actually differ from the current local ones.\n *\n * @internal\n */\n watch(\n () => props.filter.selectedRange,\n newRange => {\n const min = newRange.min ?? props.filter.range.min\n const max = newRange.max ?? props.filter.range.max\n\n if (min !== selectedRange.value.min || max !== selectedRange.value.max) {\n selectedRange.value = { min, max }\n }\n },\n )\n\n /**\n * Emits the filter modification automatically when instant mode is enabled\n * and the selected range values (min or max) change.\n *\n * Replacing the selected range with an object holding the same values does\n * not trigger the emit.\n *\n * @internal\n */\n watch([() => selectedRange.value.min, () => selectedRange.value.max], () => {\n if (props.isInstant) {\n emitUserModifiedFilter()\n }\n })\n\n return {\n selectedRange,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n threshold,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-slider-filter--error .x-slider-filter__input {\n border-color: red;\n}\n</style>\n"],"names":[],"mappings":";;;;;;;;;;;;AAsFA;;;;;;;;;;;;;;;AAeE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,UAAU,EAAE;QACV,UAAU;AACX,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAqC;AAC3C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;;;;;AAQE;AACF,QAAA,SAAS,EAAE,OAAO;AACnB,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;;;;AAOE;QACF,MAAM,gBAAgB,GAAG,CAAC;AACxB,YAAA,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,GAAE,IAAK,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG;AAC7D,YAAA,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,GAAE,IAAK,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG;AAC9D,SAAA,CAAA;AAED;;;;AAIE;AACF,QAAA,MAAM,SAAQ,GAAI,QAAQ,CAAC,OAAO;AAChC,YAAA,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG;AAC3B,YAAA,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG;AAC5B,SAAA,CAAC,CAAA;AAEF;;;;;AAKE;AACF,QAAA,MAAM,QAAO,GAAI,QAAQ,CACvB,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KAAK,CAAC,SAAS,EAAE;AACnB,gBAAA,sBAAsB,EAAC;YACzB;AACF,QAAA,CAAC,CAAA;QAED,OAAO;YACL,aAAa;YACb,MAAM;YACN,MAAM;YACN,sBAAsB;YACtB,WAAW;YACX,QAAQ;YACR,SAAS;SACX;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"slider-filter.vue2.js","sources":["../../../../../../src/x-modules/facets/components/filters/slider-filter.vue"],"sourcesContent":["<template>\n <BaseSlider\n v-model=\"selectedRange\"\n :threshold=\"threshold\"\n class=\"x-slider-filter\"\n :class=\"{ 'x-slider-filter--error': hasError }\"\n >\n <!--\n @slot Slot used to customize the whole component.\n\n @binding {selectedRange} RangeValue - Current selected minimum and maximum values.\n @binding {threshold} RangeValue - Minimum and maximum boundaries of the slider.\n @binding {setMin} function - Sets the selected minimum value.\n @binding {setMax} function - Sets the selected maximum value.\n @binding {emitUserModifiedFilter} function - Emits the `UserModifiedSliderFilter` event.\n @binding {clearValues} function - Resets the selected range to the slider boundaries.\n @binding {hasError} boolean - Whether the selected range is invalid.\n -->\n <slot\n v-bind=\"{\n threshold,\n selectedRange,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n }\"\n >\n <div>\n <input\n name=\"min\"\n type=\"number\"\n inputmode=\"decimal\"\n class=\"x-slider-filter__input x-slider-filter__input--min xds:input\"\n :value=\"selectedRange.min\"\n :min=\"threshold.min\"\n :max=\"threshold.max\"\n data-test=\"slider-filter-input-min\"\n :aria-label=\"ariaLabels?.min\"\n @change=\"setMin(($event.target as HTMLInputElement).value)\"\n />\n\n <input\n name=\"max\"\n type=\"number\"\n inputmode=\"decimal\"\n class=\"x-slider-filter__input x-slider-filter__input--max xds:input\"\n :value=\"selectedRange.max\"\n :min=\"threshold.min\"\n :max=\"threshold.max\"\n data-test=\"slider-filter-input-max\"\n :aria-label=\"ariaLabels?.max\"\n @change=\"setMax(($event.target as HTMLInputElement).value)\"\n />\n\n <button\n v-if=\"!isInstant\"\n class=\"x-slider-filter__apply xds:button\"\n :disabled=\"hasError\"\n data-test=\"slider-filter-apply\"\n @click=\"emitUserModifiedFilter\"\n >\n ✓\n </button>\n\n <button\n class=\"x-slider-filter__clear xds:button\"\n data-test=\"slider-filter-clear\"\n @click=\"clearValues\"\n >\n 𐄂\n </button>\n </div>\n </slot>\n </BaseSlider>\n</template>\n\n<script lang=\"ts\">\nimport type { SliderFilter as SliderFilterModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport BaseSlider from '../../../../components/base-slider.vue'\nimport { use$x, useAccessibilityLabels } from '../../../../composables'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders a slider filter with editable minimum and maximum values.\n *\n * Users can select a range using the slider or by entering the minimum and\n * maximum values directly.\n *\n * In instant mode, valid changes are emitted automatically. Otherwise, the\n * apply button is rendered and changes are emitted when it is clicked.\n *\n * The clear action resets the selected range to the slider boundaries.\n *\n * The default slot exposes the selected range, slider boundaries, validation\n * state, and methods to update, apply, or clear the selected values.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SliderFilter',\n xModule: facetsXModule.name,\n components: {\n BaseSlider,\n },\n props: {\n /**\n * The slider filter data to render and edit.\n *\n * @public\n */\n filter: {\n type: Object as PropType<SliderFilterModel>,\n required: true,\n },\n /**\n * Whether changes should be emitted immediately.\n *\n * When false, the apply button is rendered and changes are emitted when\n * the user clicks it.\n *\n * @default false\n * @public\n */\n isInstant: Boolean,\n },\n\n setup(props) {\n const $x = use$x()\n\n const ariaLabels = useAccessibilityLabels('sliderFilter')\n\n /**\n * Current selected minimum and maximum values.\n *\n * Values that are not selected are initialized to the corresponding\n * slider boundaries.\n *\n * @internal\n */\n const selectedRange = ref({\n min: props.filter.selectedRange.min ?? props.filter.range.min,\n max: props.filter.selectedRange.max ?? props.filter.range.max,\n })\n\n /**\n * Minimum and maximum boundaries of the slider.\n *\n * @internal\n */\n const threshold = computed(() => ({\n min: props.filter.range.min,\n max: props.filter.range.max,\n }))\n\n /**\n * Whether the selected range is invalid because its minimum is greater\n * than its maximum.\n *\n * @internal\n */\n const hasError = computed(\n () =>\n selectedRange.value.min !== null &&\n selectedRange.value.max !== null &&\n selectedRange.value.min > selectedRange.value.max,\n )\n\n /**\n * Whether the selected range differs from the range currently applied\n * to the filter.\n *\n * @internal\n */\n const areValuesDifferent = computed(\n () =>\n selectedRange.value.min !== (props.filter.selectedRange.min ?? props.filter.range.min) ||\n selectedRange.value.max !== (props.filter.selectedRange.max ?? props.filter.range.max),\n )\n\n /**\n * Emits the `UserModifiedSliderFilter` event when the selected range is\n * valid and differs from the currently applied filter range.\n *\n * @internal\n */\n const emitUserModifiedFilter = () => {\n if (hasError.value || !areValuesDifferent.value) {\n return\n }\n\n $x.emit('UserModifiedSliderFilter', {\n ...props.filter,\n selectedRange: selectedRange.value,\n })\n }\n\n /**\n * Sets one of the selected range values from a raw input value.\n *\n * Empty or invalid values are reset to the corresponding slider boundary.\n *\n * @param key - Range boundary to update.\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setRangeValue = (key: 'min' | 'max', rawValue: string) => {\n const value = Number(rawValue)\n\n selectedRange.value[key] =\n rawValue === '' || Number.isNaN(value) ? threshold.value[key] : value\n }\n\n /**\n * Sets the selected minimum value.\n *\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setMin = (rawValue: string) => {\n setRangeValue('min', rawValue)\n }\n\n /**\n * Sets the selected maximum value.\n *\n * @param rawValue - Raw input value.\n *\n * @internal\n */\n const setMax = (rawValue: string) => {\n setRangeValue('max', rawValue)\n }\n\n /**\n * Resets the selected range to the slider boundaries.\n *\n * @internal\n */\n const clearValues = () => {\n selectedRange.value = {\n min: threshold.value.min,\n max: threshold.value.max,\n }\n }\n\n /**\n * Resets the selected range when all filters, or the filters of this facet, are cleared.\n *\n * @public\n */\n $x.on('UserClickedClearAllFilters', false).subscribe(facetsIds => {\n if (!facetsIds || facetsIds.includes(props.filter.facetId)) {\n clearValues()\n }\n })\n\n /**\n * Updates the local selected range when the filter selected range changes,\n * but only if the values actually differ from the current local ones.\n *\n * @internal\n */\n watch(\n () => props.filter.selectedRange,\n newRange => {\n const min = newRange.min ?? props.filter.range.min\n const max = newRange.max ?? props.filter.range.max\n\n if (min !== selectedRange.value.min || max !== selectedRange.value.max) {\n selectedRange.value = { min, max }\n }\n },\n )\n\n /**\n * Emits the filter modification automatically when instant mode is enabled\n * and the selected range values (min or max) change.\n *\n * Replacing the selected range with an object holding the same values does\n * not trigger the emit.\n *\n * @internal\n */\n watch([() => selectedRange.value.min, () => selectedRange.value.max], () => {\n if (props.isInstant) {\n emitUserModifiedFilter()\n }\n })\n\n return {\n ariaLabels,\n selectedRange,\n setMin,\n setMax,\n emitUserModifiedFilter,\n clearValues,\n hasError,\n threshold,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-slider-filter--error .x-slider-filter__input {\n border-color: red;\n}\n</style>\n"],"names":[],"mappings":";;;;;;;;;;;;;AAsFA;;;;;;;;;;;;;;;AAeE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,UAAU,EAAE;QACV,UAAU;AACX,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAqC;AAC3C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;;;;;AAQE;AACF,QAAA,SAAS,EAAE,OAAO;AACnB,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,cAAc,CAAA;AAExD;;;;;;;AAOE;QACF,MAAM,gBAAgB,GAAG,CAAC;AACxB,YAAA,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,aAA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,CAAC,KAAK,CAAC,GAAE;AACjD,YAAA,MAAM,MAAM,QAAQ,CAAC,GAAE,IAAK,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE;AAEjD,YAAA,IAAI,GAAE,KAAM,aAAa,CAAC,KAAK,CAAC,GAAE,IAAK,GAAE,KAAM,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE;gBACtE,aAAa,CAAC,KAAI,GAAI,EAAE,GAAG,EAAE,GAAE,EAAE;YACnC;AACF,QAAA,CAAC,CACH;AAEA;;;;;;;;AAQE;QACF,KAAK,CAAC,CAAC,MAAM,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAI;AACxE,YAAA,IAAI,KAAK,CAAC,SAAS,EAAE;AACnB,gBAAA,sBAAsB,EAAC;YACzB;AACF,QAAA,CAAC,CAAA;QAED,OAAO;YACL,UAAU;YACV,aAAa;YACb,MAAM;YACN,MAAM;YACN,sBAAsB;YACtB,WAAW;YACX,QAAQ;YACR,SAAS;SACX;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -3,7 +3,7 @@ import { openBlock, createElementBlock, normalizeClass, renderSlot, normalizePro
3
3
  import './filters-search.vue3.js';
4
4
  import _export_sfc from '../../../../_virtual/_plugin-vue_export-helper.js';
5
5
 
6
- const _hoisted_1 = ["value"];
6
+ const _hoisted_1 = ["value", "aria-label"];
7
7
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
8
8
  return openBlock(), createElementBlock(
9
9
  "div",
@@ -18,7 +18,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
18
18
  type: "search",
19
19
  class: "x-filters-search__input xds:input",
20
20
  "data-test": "filters-search-input",
21
- "aria-label": "search into the filter values",
21
+ "aria-label": _ctx.ariaLabels?.input,
22
22
  onInput: _cache[0] || (_cache[0] = ($event) => _ctx.setQuery($event?.target?.value))
23
23
  }, null, 40, _hoisted_1)
24
24
  ], true),
@@ -1 +1 @@
1
- {"version":3,"file":"filters-search.vue.js","sources":["../../../../../../src/x-modules/facets/components/lists/filters-search.vue"],"sourcesContent":["<template>\n <div class=\"x-filters-search\" :class=\"cssClasses\" data-test=\"filters-search\">\n <!--\n @slot Search content. It is the content which triggers the filters sifting.\n @binding {string} query - The query to search in filters.\n @binding {Function} setQuery - The function to set the query. The query is passed as\n parameter.\n @binding {Function} clearQuery - The function to clear the query.\n -->\n <slot name=\"search\" v-bind=\"{ query, setQuery, clearQuery }\">\n <input\n :value=\"query\"\n type=\"search\"\n class=\"x-filters-search__input xds:input\"\n data-test=\"filters-search-input\"\n aria-label=\"search into the filter values\"\n @input=\"setQuery(($event?.target as HTMLInputElement)?.value)\"\n />\n </slot>\n <!--\n @slot (Required) Sifted filters content.\n @binding {Filter[]} siftedFilters - Sifted filters data.\n -->\n <slot :sifted-filters=\"siftedFilters\"></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { DebouncedFunction, VueCSSClasses } from '../../../../utils/types'\nimport { isBooleanFilter } from '@empathyco/x-types'\nimport { computed, defineComponent, provide, ref, watch } from 'vue'\nimport { debounce } from '../../../../utils/debounce'\nimport { normalizeString } from '../../../../utils/normalize'\nimport { useFiltersInjection } from '../../composables/use-filters-injection'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders the filters sifted with the input query.\n *\n * @public\n */\nexport default defineComponent({\n name: 'FiltersSearch',\n xModule: facetsXModule.name,\n props: {\n /**\n * The list of filters to be rendered as slots.\n *\n * @public\n */\n filters: Array as PropType<Filter[]>,\n\n /**\n * This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary\n * to make the `renderedFilters` to return only the filters of each level of the hierarchy.\n *\n * @public\n */\n parentId: {\n type: String as PropType<Filter['id']>,\n required: false,\n },\n\n /** The debounce time for applying the filter sifting. */\n debounceInMs: {\n type: Number,\n default: 200,\n },\n },\n setup(props) {\n const renderedFilters = useFiltersInjection(props)\n\n const query = ref('')\n let setQueryDebounced: DebouncedFunction<[string]>\n\n const debounceInMs = computed(() => props.debounceInMs)\n\n /**\n * Set the debounce function for setting the query debounced.\n *\n * @internal\n */\n const updateSetQueryDebounced = () => {\n setQueryDebounced = debounce(queryDebounced => {\n query.value = queryDebounced\n }, props.debounceInMs)\n }\n watch(debounceInMs, updateSetQueryDebounced, { immediate: true })\n\n /**\n * Sift the array of filters which matches with the query.\n *\n * @returns Array of sifted filters.\n * @internal\n */\n const siftedFilters = computed((): Filter[] => {\n const normalizedQuery = normalizeString(query.value)\n return renderedFilters.value.filter(\n filter =>\n isBooleanFilter(filter) && normalizeString(filter.label).includes(normalizedQuery),\n )\n })\n provide('filters', siftedFilters)\n\n /**\n * Adds the dynamic css classes to the component.\n *\n * @returns The class to be added to the component.\n * @internal\n */\n const cssClasses = computed((): VueCSSClasses => {\n return { 'x-filters-search--is-sifted': !!query.value }\n })\n\n /**\n * Set the query through the debounced function.\n *\n * @param query - The query to sift filters.\n * @internal\n */\n const setQuery = (query: string): void => {\n setQueryDebounced(query)\n }\n\n /**\n * Clear the query.\n *\n * @internal\n */\n const clearQuery = (): void => {\n query.value = ''\n }\n\n return {\n clearQuery,\n setQuery,\n cssClasses,\n siftedFilters,\n query,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-filters-search {\n display: flex;\n flex-flow: column nowrap;\n}\n\n.x-filters-search__input::-ms-clear {\n display: none;\n width: 0;\n height: 0;\n}\n\n.x-filters-search__input::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n}\n\n.x-filters-search__input::-webkit-search-decoration,\n.x-filters-search__input::-webkit-search-cancel-button,\n.x-filters-search__input::-webkit-search-results-button,\n.x-filters-search__input::-webkit-search-results-decoration {\n display: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nIt renders an input and a list of filters passed as prop or being injected. The list of filters can\nbe sifted with the query typed in the input. This component has also a debounce prop to set the time\nin milliseconds to apply the filters search. Moreover, it has two scoped slots. The first one for\ncustomize the search triggering with three slot props; the query, a function to set the query by\nsifting and a third one for cleaning the query. The second scoped slot is required and it is for\ndisplaying the list of filters sifted. It has a slot prop with these filters sifted.\n\n### Important\n\nThe component has two ways of receive the filters list, it can be injected by another component or\nbe send it as a prop. If the component doesnt have a parent component that receive and exposed a\nfilters list to their children, it is mandatory to send it as prop.\n\n### Basic usage\n\nUsing default and required slot:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\" v-slot=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\nSetting debounce time:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\" :debounceInMs=\"500\" v-slot=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\nReplacing search triggering:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\">\n <template #search=\"{ query, setQuery, clearQuery }\">\n <input\n @input=\"setQuery($event.target.value)\"\n :value=\"query\"\n class=\"x-input x-filters-search__input\"\n :aria-label=\"filtersSearchInputMessage\"\n />\n <button @click=\"clearQuery\">X</button>\n </template>\n <template #default=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </template>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\n> **Using injection**: It can receive the filters list by injection. It only works if it has a\n> parent component that receives and exposes the filters list. Using the injection, It is not\n> necessary to send the prop to the child components, it has to be send it in the parent component,\n> the rest of components will inject this list.\n\n```vue\n<template>\n <Facets v-slot=\"{ facet }\">\n <SlicedFilters :filters=\"facet.filters\" :max=\"8\">\n <FiltersSearch>\n <Filters v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" data-test=\"brand-filter\" />\n </Filters>\n </FiltersSearch>\n </SlicedFilters>\n </Facets>\n</template>\n\n<script setup>\nimport { Facets } from '@empathyco/x-components/facets'\nimport { SlicedFilters, FiltersSearch, Filters, SimpleFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst facet = ref({\n filters: [\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n ],\n})\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createElementVNode"],"mappings":";;;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAuBM,KAAA;AAAA,IAAA;AAAA,MAvBD,KAAA,EAAKC,cAAA,CAAA,CAAC,kBAAA,EAA2B,IAAA,CAAA,UAAU,CAAA,CAAA;AAAA,MAAE,WAAA,EAAU;AAAA,KAAA;;AAQ1D,MAAAC,UAAA,CASO,kEATuB,IAAA,CAAA,KAAA,EAAK,QAAA,EAAE,eAAQ,UAAA,EAAE,IAAA,CAAA,UAAA,MAA/C,MASO;AAAA,QARLC,kBAAA,CAOE,OAAA,EAAA;AAAA,UANC,KAAA,EAAO,IAAA,CAAA,KAAA;AAAA,UACR,IAAA,EAAK,QAAA;AAAA,UACL,KAAA,EAAM,mCAAA;AAAA,UACN,WAAA,EAAU,sBAAA;AAAA,UACV,YAAA,EAAW,+BAAA;AAAA,UACV,OAAA,EAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,QAAA,CAAU,MAAA,EAAQ,QAA6B,KAAK,CAAA;AAAA,SAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA;;MAOhED,UAAA,CAA6C,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAtC,eAAgB,IAAA,CAAA,aAAA,EAAa,EAAA,MAAA,EAAA,IAAA;AAAA,KAAA;;;;;;;;;"}
1
+ {"version":3,"file":"filters-search.vue.js","sources":["../../../../../../src/x-modules/facets/components/lists/filters-search.vue"],"sourcesContent":["<template>\n <div class=\"x-filters-search\" :class=\"cssClasses\" data-test=\"filters-search\">\n <!--\n @slot Search content. It is the content which triggers the filters sifting.\n @binding {string} query - The query to search in filters.\n @binding {Function} setQuery - The function to set the query. The query is passed as\n parameter.\n @binding {Function} clearQuery - The function to clear the query.\n -->\n <slot name=\"search\" v-bind=\"{ query, setQuery, clearQuery }\">\n <input\n :value=\"query\"\n type=\"search\"\n class=\"x-filters-search__input xds:input\"\n data-test=\"filters-search-input\"\n :aria-label=\"ariaLabels?.input\"\n @input=\"setQuery(($event?.target as HTMLInputElement)?.value)\"\n />\n </slot>\n <!--\n @slot (Required) Sifted filters content.\n @binding {Filter[]} siftedFilters - Sifted filters data.\n -->\n <slot :sifted-filters=\"siftedFilters\"></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { DebouncedFunction, VueCSSClasses } from '../../../../utils/types'\nimport { isBooleanFilter } from '@empathyco/x-types'\nimport { computed, defineComponent, provide, ref, watch } from 'vue'\nimport { useAccessibilityLabels } from '../../../../composables'\nimport { debounce } from '../../../../utils/debounce'\nimport { normalizeString } from '../../../../utils/normalize'\nimport { useFiltersInjection } from '../../composables/use-filters-injection'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders the filters sifted with the input query.\n *\n * @public\n */\nexport default defineComponent({\n name: 'FiltersSearch',\n xModule: facetsXModule.name,\n props: {\n /**\n * The list of filters to be rendered as slots.\n *\n * @public\n */\n filters: Array as PropType<Filter[]>,\n\n /**\n * This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary\n * to make the `renderedFilters` to return only the filters of each level of the hierarchy.\n *\n * @public\n */\n parentId: {\n type: String as PropType<Filter['id']>,\n required: false,\n },\n\n /** The debounce time for applying the filter sifting. */\n debounceInMs: {\n type: Number,\n default: 200,\n },\n },\n setup(props) {\n const renderedFilters = useFiltersInjection(props)\n\n const ariaLabels = useAccessibilityLabels('filtersSearch')\n\n const query = ref('')\n let setQueryDebounced: DebouncedFunction<[string]>\n\n const debounceInMs = computed(() => props.debounceInMs)\n\n /**\n * Set the debounce function for setting the query debounced.\n *\n * @internal\n */\n const updateSetQueryDebounced = () => {\n setQueryDebounced = debounce(queryDebounced => {\n query.value = queryDebounced\n }, props.debounceInMs)\n }\n watch(debounceInMs, updateSetQueryDebounced, { immediate: true })\n\n /**\n * Sift the array of filters which matches with the query.\n *\n * @returns Array of sifted filters.\n * @internal\n */\n const siftedFilters = computed((): Filter[] => {\n const normalizedQuery = normalizeString(query.value)\n return renderedFilters.value.filter(\n filter =>\n isBooleanFilter(filter) && normalizeString(filter.label).includes(normalizedQuery),\n )\n })\n provide('filters', siftedFilters)\n\n /**\n * Adds the dynamic css classes to the component.\n *\n * @returns The class to be added to the component.\n * @internal\n */\n const cssClasses = computed((): VueCSSClasses => {\n return { 'x-filters-search--is-sifted': !!query.value }\n })\n\n /**\n * Set the query through the debounced function.\n *\n * @param query - The query to sift filters.\n * @internal\n */\n const setQuery = (query: string): void => {\n setQueryDebounced(query)\n }\n\n /**\n * Clear the query.\n *\n * @internal\n */\n const clearQuery = (): void => {\n query.value = ''\n }\n\n return {\n ariaLabels,\n clearQuery,\n setQuery,\n cssClasses,\n siftedFilters,\n query,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-filters-search {\n display: flex;\n flex-flow: column nowrap;\n}\n\n.x-filters-search__input::-ms-clear {\n display: none;\n width: 0;\n height: 0;\n}\n\n.x-filters-search__input::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n}\n\n.x-filters-search__input::-webkit-search-decoration,\n.x-filters-search__input::-webkit-search-cancel-button,\n.x-filters-search__input::-webkit-search-results-button,\n.x-filters-search__input::-webkit-search-results-decoration {\n display: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nIt renders an input and a list of filters passed as prop or being injected. The list of filters can\nbe sifted with the query typed in the input. This component has also a debounce prop to set the time\nin milliseconds to apply the filters search. Moreover, it has two scoped slots. The first one for\ncustomize the search triggering with three slot props; the query, a function to set the query by\nsifting and a third one for cleaning the query. The second scoped slot is required and it is for\ndisplaying the list of filters sifted. It has a slot prop with these filters sifted.\n\n### Important\n\nThe component has two ways of receive the filters list, it can be injected by another component or\nbe send it as a prop. If the component doesnt have a parent component that receive and exposed a\nfilters list to their children, it is mandatory to send it as prop.\n\n### Basic usage\n\nUsing default and required slot:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\" v-slot=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\nSetting debounce time:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\" :debounceInMs=\"500\" v-slot=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\nReplacing search triggering:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\">\n <template #search=\"{ query, setQuery, clearQuery }\">\n <input\n @input=\"setQuery($event.target.value)\"\n :value=\"query\"\n class=\"x-input x-filters-search__input\"\n :aria-label=\"filtersSearchInputMessage\"\n />\n <button @click=\"clearQuery\">X</button>\n </template>\n <template #default=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </template>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\n> **Using injection**: It can receive the filters list by injection. It only works if it has a\n> parent component that receives and exposes the filters list. Using the injection, It is not\n> necessary to send the prop to the child components, it has to be send it in the parent component,\n> the rest of components will inject this list.\n\n```vue\n<template>\n <Facets v-slot=\"{ facet }\">\n <SlicedFilters :filters=\"facet.filters\" :max=\"8\">\n <FiltersSearch>\n <Filters v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" data-test=\"brand-filter\" />\n </Filters>\n </FiltersSearch>\n </SlicedFilters>\n </Facets>\n</template>\n\n<script setup>\nimport { Facets } from '@empathyco/x-components/facets'\nimport { SlicedFilters, FiltersSearch, Filters, SimpleFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst facet = ref({\n filters: [\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n ],\n})\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createElementVNode"],"mappings":";;;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAuBM,KAAA;AAAA,IAAA;AAAA,MAvBD,KAAA,EAAKC,cAAA,CAAA,CAAC,kBAAA,EAA2B,IAAA,CAAA,UAAU,CAAA,CAAA;AAAA,MAAE,WAAA,EAAU;AAAA,KAAA;;AAQ1D,MAAAC,UAAA,CASO,kEATuB,IAAA,CAAA,KAAA,EAAK,QAAA,EAAE,eAAQ,UAAA,EAAE,IAAA,CAAA,UAAA,MAA/C,MASO;AAAA,QARLC,kBAAA,CAOE,OAAA,EAAA;AAAA,UANC,KAAA,EAAO,IAAA,CAAA,KAAA;AAAA,UACR,IAAA,EAAK,QAAA;AAAA,UACL,KAAA,EAAM,mCAAA;AAAA,UACN,WAAA,EAAU,sBAAA;AAAA,UACT,cAAY,IAAA,CAAA,UAAA,EAAY,KAAA;AAAA,UACxB,OAAA,EAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,QAAA,CAAU,MAAA,EAAQ,QAA6B,KAAK,CAAA;AAAA,SAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA;;MAOhED,UAAA,CAA6C,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAtC,eAAgB,IAAA,CAAA,aAAA,EAAa,EAAA,MAAA,EAAA,IAAA;AAAA,KAAA;;;;;;;;;"}
@@ -1,6 +1,14 @@
1
1
  import { isBooleanFilter } from '@empathyco/x-types';
2
2
  import { defineComponent, ref, computed, watch, provide } from 'vue';
3
+ import '../../../../composables/create-use-device.js';
4
+ import 'vuex';
5
+ import '../../../../plugins/x-bus.js';
6
+ import '@empathyco/x-utils';
7
+ import '../../../../plugins/x-plugin.js';
8
+ import 'rxjs';
9
+ import { useAccessibilityLabels } from '../../../../composables/use-accessibility-labels.js';
3
10
  import { debounce } from '../../../../utils/debounce.js';
11
+ import '@vueuse/core';
4
12
  import { normalizeString } from '../../../../utils/normalize.js';
5
13
  import { useFiltersInjection } from '../../composables/use-filters-injection.js';
6
14
  import { facetsXModule } from '../../x-module.js';
@@ -38,6 +46,7 @@ var _sfc_main = defineComponent({
38
46
  },
39
47
  setup(props) {
40
48
  const renderedFilters = useFiltersInjection(props);
49
+ const ariaLabels = useAccessibilityLabels('filtersSearch');
41
50
  const query = ref('');
42
51
  let setQueryDebounced;
43
52
  const debounceInMs = computed(() => props.debounceInMs);
@@ -90,6 +99,7 @@ var _sfc_main = defineComponent({
90
99
  query.value = '';
91
100
  };
92
101
  return {
102
+ ariaLabels,
93
103
  clearQuery,
94
104
  setQuery,
95
105
  cssClasses,
@@ -1 +1 @@
1
- {"version":3,"file":"filters-search.vue2.js","sources":["../../../../../../src/x-modules/facets/components/lists/filters-search.vue"],"sourcesContent":["<template>\n <div class=\"x-filters-search\" :class=\"cssClasses\" data-test=\"filters-search\">\n <!--\n @slot Search content. It is the content which triggers the filters sifting.\n @binding {string} query - The query to search in filters.\n @binding {Function} setQuery - The function to set the query. The query is passed as\n parameter.\n @binding {Function} clearQuery - The function to clear the query.\n -->\n <slot name=\"search\" v-bind=\"{ query, setQuery, clearQuery }\">\n <input\n :value=\"query\"\n type=\"search\"\n class=\"x-filters-search__input xds:input\"\n data-test=\"filters-search-input\"\n aria-label=\"search into the filter values\"\n @input=\"setQuery(($event?.target as HTMLInputElement)?.value)\"\n />\n </slot>\n <!--\n @slot (Required) Sifted filters content.\n @binding {Filter[]} siftedFilters - Sifted filters data.\n -->\n <slot :sifted-filters=\"siftedFilters\"></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { DebouncedFunction, VueCSSClasses } from '../../../../utils/types'\nimport { isBooleanFilter } from '@empathyco/x-types'\nimport { computed, defineComponent, provide, ref, watch } from 'vue'\nimport { debounce } from '../../../../utils/debounce'\nimport { normalizeString } from '../../../../utils/normalize'\nimport { useFiltersInjection } from '../../composables/use-filters-injection'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders the filters sifted with the input query.\n *\n * @public\n */\nexport default defineComponent({\n name: 'FiltersSearch',\n xModule: facetsXModule.name,\n props: {\n /**\n * The list of filters to be rendered as slots.\n *\n * @public\n */\n filters: Array as PropType<Filter[]>,\n\n /**\n * This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary\n * to make the `renderedFilters` to return only the filters of each level of the hierarchy.\n *\n * @public\n */\n parentId: {\n type: String as PropType<Filter['id']>,\n required: false,\n },\n\n /** The debounce time for applying the filter sifting. */\n debounceInMs: {\n type: Number,\n default: 200,\n },\n },\n setup(props) {\n const renderedFilters = useFiltersInjection(props)\n\n const query = ref('')\n let setQueryDebounced: DebouncedFunction<[string]>\n\n const debounceInMs = computed(() => props.debounceInMs)\n\n /**\n * Set the debounce function for setting the query debounced.\n *\n * @internal\n */\n const updateSetQueryDebounced = () => {\n setQueryDebounced = debounce(queryDebounced => {\n query.value = queryDebounced\n }, props.debounceInMs)\n }\n watch(debounceInMs, updateSetQueryDebounced, { immediate: true })\n\n /**\n * Sift the array of filters which matches with the query.\n *\n * @returns Array of sifted filters.\n * @internal\n */\n const siftedFilters = computed((): Filter[] => {\n const normalizedQuery = normalizeString(query.value)\n return renderedFilters.value.filter(\n filter =>\n isBooleanFilter(filter) && normalizeString(filter.label).includes(normalizedQuery),\n )\n })\n provide('filters', siftedFilters)\n\n /**\n * Adds the dynamic css classes to the component.\n *\n * @returns The class to be added to the component.\n * @internal\n */\n const cssClasses = computed((): VueCSSClasses => {\n return { 'x-filters-search--is-sifted': !!query.value }\n })\n\n /**\n * Set the query through the debounced function.\n *\n * @param query - The query to sift filters.\n * @internal\n */\n const setQuery = (query: string): void => {\n setQueryDebounced(query)\n }\n\n /**\n * Clear the query.\n *\n * @internal\n */\n const clearQuery = (): void => {\n query.value = ''\n }\n\n return {\n clearQuery,\n setQuery,\n cssClasses,\n siftedFilters,\n query,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-filters-search {\n display: flex;\n flex-flow: column nowrap;\n}\n\n.x-filters-search__input::-ms-clear {\n display: none;\n width: 0;\n height: 0;\n}\n\n.x-filters-search__input::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n}\n\n.x-filters-search__input::-webkit-search-decoration,\n.x-filters-search__input::-webkit-search-cancel-button,\n.x-filters-search__input::-webkit-search-results-button,\n.x-filters-search__input::-webkit-search-results-decoration {\n display: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nIt renders an input and a list of filters passed as prop or being injected. The list of filters can\nbe sifted with the query typed in the input. This component has also a debounce prop to set the time\nin milliseconds to apply the filters search. Moreover, it has two scoped slots. The first one for\ncustomize the search triggering with three slot props; the query, a function to set the query by\nsifting and a third one for cleaning the query. The second scoped slot is required and it is for\ndisplaying the list of filters sifted. It has a slot prop with these filters sifted.\n\n### Important\n\nThe component has two ways of receive the filters list, it can be injected by another component or\nbe send it as a prop. If the component doesnt have a parent component that receive and exposed a\nfilters list to their children, it is mandatory to send it as prop.\n\n### Basic usage\n\nUsing default and required slot:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\" v-slot=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\nSetting debounce time:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\" :debounceInMs=\"500\" v-slot=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\nReplacing search triggering:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\">\n <template #search=\"{ query, setQuery, clearQuery }\">\n <input\n @input=\"setQuery($event.target.value)\"\n :value=\"query\"\n class=\"x-input x-filters-search__input\"\n :aria-label=\"filtersSearchInputMessage\"\n />\n <button @click=\"clearQuery\">X</button>\n </template>\n <template #default=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </template>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\n> **Using injection**: It can receive the filters list by injection. It only works if it has a\n> parent component that receives and exposes the filters list. Using the injection, It is not\n> necessary to send the prop to the child components, it has to be send it in the parent component,\n> the rest of components will inject this list.\n\n```vue\n<template>\n <Facets v-slot=\"{ facet }\">\n <SlicedFilters :filters=\"facet.filters\" :max=\"8\">\n <FiltersSearch>\n <Filters v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" data-test=\"brand-filter\" />\n </Filters>\n </FiltersSearch>\n </SlicedFilters>\n </Facets>\n</template>\n\n<script setup>\nimport { Facets } from '@empathyco/x-components/facets'\nimport { SlicedFilters, FiltersSearch, Filters, SimpleFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst facet = ref({\n filters: [\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n ],\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;AAsCA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,OAAO,EAAE,KAA2B;AAEpC;;;;;AAKE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAgC;AACtC,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA;;AAGD,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAAG;AACb,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,eAAc,GAAI,mBAAmB,CAAC,KAAK,CAAA;AAEjD,QAAA,MAAM,KAAI,GAAI,GAAG,CAAC,EAAE,CAAA;AACpB,QAAA,IAAI,iBAA6C;QAEjD,MAAM,YAAW,GAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,YAAY,CAAA;AAEtD;;;;AAIE;QACF,MAAM,uBAAsB,GAAI,MAAI;AAClC,YAAA,iBAAgB,GAAI,QAAQ,CAAC,cAAa,IAAG;AAC3C,gBAAA,KAAK,CAAC,KAAI,GAAI,cAAa;AAC7B,YAAA,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;AACvB,QAAA,CAAA;QACA,KAAK,CAAC,YAAY,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAG,EAAG,CAAA;AAEhE;;;;;AAKE;AACF,QAAA,MAAM,gBAAgB,QAAQ,CAAC,MAAc;YAC3C,MAAM,eAAc,GAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAAA;YACnD,OAAO,eAAe,CAAC,KAAK,CAAC,MAAM,CACjC,UACE,eAAe,CAAC,MAAM,CAAA,IAAK,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CACtF;AACF,QAAA,CAAC,CAAA;AACD,QAAA,OAAO,CAAC,SAAS,EAAE,aAAa,CAAA;AAEhC;;;;;AAKE;AACF,QAAA,MAAM,UAAS,GAAI,QAAQ,CAAC,MAAmB;YAC7C,OAAO,EAAE,6BAA6B,EAAE,CAAC,CAAC,KAAK,CAAC,KAAI,EAAE;AACxD,QAAA,CAAC,CAAA;AAED;;;;;AAKE;AACF,QAAA,MAAM,QAAO,GAAI,CAAC,KAAa,KAAS;YACtC,iBAAiB,CAAC,KAAK,CAAA;AACzB,QAAA,CAAA;AAEA;;;;AAIE;QACF,MAAM,UAAS,GAAI,MAAU;AAC3B,YAAA,KAAK,CAAC,KAAI,GAAI,EAAC;AACjB,QAAA,CAAA;QAEA,OAAO;YACL,UAAU;YACV,QAAQ;YACR,UAAU;YACV,aAAa;YACb,KAAK;SACP;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"filters-search.vue2.js","sources":["../../../../../../src/x-modules/facets/components/lists/filters-search.vue"],"sourcesContent":["<template>\n <div class=\"x-filters-search\" :class=\"cssClasses\" data-test=\"filters-search\">\n <!--\n @slot Search content. It is the content which triggers the filters sifting.\n @binding {string} query - The query to search in filters.\n @binding {Function} setQuery - The function to set the query. The query is passed as\n parameter.\n @binding {Function} clearQuery - The function to clear the query.\n -->\n <slot name=\"search\" v-bind=\"{ query, setQuery, clearQuery }\">\n <input\n :value=\"query\"\n type=\"search\"\n class=\"x-filters-search__input xds:input\"\n data-test=\"filters-search-input\"\n :aria-label=\"ariaLabels?.input\"\n @input=\"setQuery(($event?.target as HTMLInputElement)?.value)\"\n />\n </slot>\n <!--\n @slot (Required) Sifted filters content.\n @binding {Filter[]} siftedFilters - Sifted filters data.\n -->\n <slot :sifted-filters=\"siftedFilters\"></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { DebouncedFunction, VueCSSClasses } from '../../../../utils/types'\nimport { isBooleanFilter } from '@empathyco/x-types'\nimport { computed, defineComponent, provide, ref, watch } from 'vue'\nimport { useAccessibilityLabels } from '../../../../composables'\nimport { debounce } from '../../../../utils/debounce'\nimport { normalizeString } from '../../../../utils/normalize'\nimport { useFiltersInjection } from '../../composables/use-filters-injection'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Renders the filters sifted with the input query.\n *\n * @public\n */\nexport default defineComponent({\n name: 'FiltersSearch',\n xModule: facetsXModule.name,\n props: {\n /**\n * The list of filters to be rendered as slots.\n *\n * @public\n */\n filters: Array as PropType<Filter[]>,\n\n /**\n * This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary\n * to make the `renderedFilters` to return only the filters of each level of the hierarchy.\n *\n * @public\n */\n parentId: {\n type: String as PropType<Filter['id']>,\n required: false,\n },\n\n /** The debounce time for applying the filter sifting. */\n debounceInMs: {\n type: Number,\n default: 200,\n },\n },\n setup(props) {\n const renderedFilters = useFiltersInjection(props)\n\n const ariaLabels = useAccessibilityLabels('filtersSearch')\n\n const query = ref('')\n let setQueryDebounced: DebouncedFunction<[string]>\n\n const debounceInMs = computed(() => props.debounceInMs)\n\n /**\n * Set the debounce function for setting the query debounced.\n *\n * @internal\n */\n const updateSetQueryDebounced = () => {\n setQueryDebounced = debounce(queryDebounced => {\n query.value = queryDebounced\n }, props.debounceInMs)\n }\n watch(debounceInMs, updateSetQueryDebounced, { immediate: true })\n\n /**\n * Sift the array of filters which matches with the query.\n *\n * @returns Array of sifted filters.\n * @internal\n */\n const siftedFilters = computed((): Filter[] => {\n const normalizedQuery = normalizeString(query.value)\n return renderedFilters.value.filter(\n filter =>\n isBooleanFilter(filter) && normalizeString(filter.label).includes(normalizedQuery),\n )\n })\n provide('filters', siftedFilters)\n\n /**\n * Adds the dynamic css classes to the component.\n *\n * @returns The class to be added to the component.\n * @internal\n */\n const cssClasses = computed((): VueCSSClasses => {\n return { 'x-filters-search--is-sifted': !!query.value }\n })\n\n /**\n * Set the query through the debounced function.\n *\n * @param query - The query to sift filters.\n * @internal\n */\n const setQuery = (query: string): void => {\n setQueryDebounced(query)\n }\n\n /**\n * Clear the query.\n *\n * @internal\n */\n const clearQuery = (): void => {\n query.value = ''\n }\n\n return {\n ariaLabels,\n clearQuery,\n setQuery,\n cssClasses,\n siftedFilters,\n query,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-filters-search {\n display: flex;\n flex-flow: column nowrap;\n}\n\n.x-filters-search__input::-ms-clear {\n display: none;\n width: 0;\n height: 0;\n}\n\n.x-filters-search__input::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n}\n\n.x-filters-search__input::-webkit-search-decoration,\n.x-filters-search__input::-webkit-search-cancel-button,\n.x-filters-search__input::-webkit-search-results-button,\n.x-filters-search__input::-webkit-search-results-decoration {\n display: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nIt renders an input and a list of filters passed as prop or being injected. The list of filters can\nbe sifted with the query typed in the input. This component has also a debounce prop to set the time\nin milliseconds to apply the filters search. Moreover, it has two scoped slots. The first one for\ncustomize the search triggering with three slot props; the query, a function to set the query by\nsifting and a third one for cleaning the query. The second scoped slot is required and it is for\ndisplaying the list of filters sifted. It has a slot prop with these filters sifted.\n\n### Important\n\nThe component has two ways of receive the filters list, it can be injected by another component or\nbe send it as a prop. If the component doesnt have a parent component that receive and exposed a\nfilters list to their children, it is mandatory to send it as prop.\n\n### Basic usage\n\nUsing default and required slot:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\" v-slot=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\nSetting debounce time:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\" :debounceInMs=\"500\" v-slot=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\nReplacing search triggering:\n\n```vue\n<template>\n <FiltersSearch :filters=\"filters\">\n <template #search=\"{ query, setQuery, clearQuery }\">\n <input\n @input=\"setQuery($event.target.value)\"\n :value=\"query\"\n class=\"x-input x-filters-search__input\"\n :aria-label=\"filtersSearchInputMessage\"\n />\n <button @click=\"clearQuery\">X</button>\n </template>\n <template #default=\"{ siftedFilters }\">\n <ul v-for=\"filter in siftedFilters\">\n <li :key=\"filter.id\">{{ filter.label }}</li>\n </ul>\n </template>\n </FiltersSearch>\n</template>\n\n<script setup>\nimport { FiltersSearch } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst filters = ref([\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n])\n</script>\n```\n\n> **Using injection**: It can receive the filters list by injection. It only works if it has a\n> parent component that receives and exposes the filters list. Using the injection, It is not\n> necessary to send the prop to the child components, it has to be send it in the parent component,\n> the rest of components will inject this list.\n\n```vue\n<template>\n <Facets v-slot=\"{ facet }\">\n <SlicedFilters :filters=\"facet.filters\" :max=\"8\">\n <FiltersSearch>\n <Filters v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" data-test=\"brand-filter\" />\n </Filters>\n </FiltersSearch>\n </SlicedFilters>\n </Facets>\n</template>\n\n<script setup>\nimport { Facets } from '@empathyco/x-components/facets'\nimport { SlicedFilters, FiltersSearch, Filters, SimpleFilter } from '@empathyco/x-components/facets'\nimport { ref } from 'vue'\n\nconst facet = ref({\n filters: [\n { id: '1', label: 'Filter 1', modelName: 'SimpleFilter', selected: false },\n { id: '2', label: 'Filter 2', modelName: 'SimpleFilter', selected: false },\n ],\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuCA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,OAAO,EAAE,KAA2B;AAEpC;;;;;AAKE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAgC;AACtC,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA;;AAGD,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAAG;AACb,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,eAAc,GAAI,mBAAmB,CAAC,KAAK,CAAA;AAEjD,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,eAAe,CAAA;AAEzD,QAAA,MAAM,KAAI,GAAI,GAAG,CAAC,EAAE,CAAA;AACpB,QAAA,IAAI,iBAA6C;QAEjD,MAAM,YAAW,GAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,YAAY,CAAA;AAEtD;;;;AAIE;QACF,MAAM,uBAAsB,GAAI,MAAI;AAClC,YAAA,iBAAgB,GAAI,QAAQ,CAAC,cAAa,IAAG;AAC3C,gBAAA,KAAK,CAAC,KAAI,GAAI,cAAa;AAC7B,YAAA,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;AACvB,QAAA,CAAA;QACA,KAAK,CAAC,YAAY,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAG,EAAG,CAAA;AAEhE;;;;;AAKE;AACF,QAAA,MAAM,gBAAgB,QAAQ,CAAC,MAAc;YAC3C,MAAM,eAAc,GAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAAA;YACnD,OAAO,eAAe,CAAC,KAAK,CAAC,MAAM,CACjC,UACE,eAAe,CAAC,MAAM,CAAA,IAAK,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CACtF;AACF,QAAA,CAAC,CAAA;AACD,QAAA,OAAO,CAAC,SAAS,EAAE,aAAa,CAAA;AAEhC;;;;;AAKE;AACF,QAAA,MAAM,UAAS,GAAI,QAAQ,CAAC,MAAmB;YAC7C,OAAO,EAAE,6BAA6B,EAAE,CAAC,CAAC,KAAK,CAAC,KAAI,EAAE;AACxD,QAAA,CAAC,CAAA;AAED;;;;;AAKE;AACF,QAAA,MAAM,QAAO,GAAI,CAAC,KAAa,KAAS;YACtC,iBAAiB,CAAC,KAAK,CAAA;AACzB,QAAA,CAAA;AAEA;;;;AAIE;QACF,MAAM,UAAS,GAAI,MAAU;AAC3B,YAAA,KAAK,CAAC,KAAI,GAAI,EAAC;AACjB,QAAA,CAAA;QAEA,OAAO;YACL,UAAU;YACV,UAAU;YACV,QAAQ;YACR,UAAU;YACV,aAAa;YACb,KAAK;SACP;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { isBooleanFilter } from '@empathyco/x-types';
2
2
  import { defineComponent, computed, provide } from 'vue';
3
3
  import { isArrayEmpty } from '../../../../utils/array.js';
4
+ import '@empathyco/x-utils';
4
5
  import '../../../../utils/storage.js';
5
6
  import { useFiltersInjection } from '../../composables/use-filters-injection.js';
6
7
  import { facetsXModule } from '../../x-module.js';
@@ -1 +1 @@
1
- {"version":3,"file":"sorted-filters.vue.js","sources":["../../../../../../src/x-modules/facets/components/lists/sorted-filters.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { BooleanFilter, Filter } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { isBooleanFilter } from '@empathyco/x-types'\nimport { computed, defineComponent, provide } from 'vue'\nimport { isArrayEmpty } from '../../../../utils'\nimport { useFiltersInjection } from '../../composables/use-filters-injection'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Component that sorts a list of filters and returns them using the default scoped slot.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SortedFilters',\n xModule: facetsXModule.name,\n props: {\n /**\n * The list of filters to be rendered as slots.\n *\n * @public\n */\n filters: Array as PropType<Filter[]>,\n\n /**\n * This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary\n * to make the `renderedFilters` to return only the filters of each level of the hierarchy.\n *\n * @public\n */\n parentId: {\n type: String as PropType<Filter['id']>,\n required: false,\n },\n },\n setup(props, { slots }) {\n const renderedFilters = useFiltersInjection(props)\n\n /**\n * An array of filters with the selected filters at the beginning of the list.\n *\n * @returns Array of filters.\n * @internal\n */\n const sortedFilters = computed((): Filter[] => {\n if (!isArrayEmpty(renderedFilters.value) && isBooleanFilter(renderedFilters.value[0])) {\n return ([...renderedFilters.value] as BooleanFilter[]).sort(({ selected }) => {\n return selected ? -1 : 1\n })\n }\n\n return renderedFilters.value\n })\n provide('filters', sortedFilters)\n\n return () => slots.default?.({ filters: sortedFilters.value })[0] ?? ''\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nThe sorted filters component takes a list of filters and returns this new filters list sorted by the\n`selected` filter property.\n\n### Remarks\n\n- The component can receive the filters list by property or using the XInjection feature.\n- It also provides the resultant list bound in the default slot or with the XProvide feature.\n\nBoth XInjection and XProvide features are from the extended FiltersInjectionMixin. You don't have to\nuse XInjection and XProvide together, e.g. you can use pass the filters using a prop and then\nreturns the result with XProvide.\n\n### Basic usage\n\n#### Using props and binding the result\n\n```vue\n<template>\n <Facets v-slot=\"{ facet }\">\n <SortedFilters :filters=\"facet.filters\" #default=\"{ filters }\">\n <Filters :items=\"filters\" v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" />\n </Filters>\n </SortedFilters>\n </Facets>\n</template>\n\n<script setup>\nimport { Facets, SortedFilters, Filters, SimpleFilter } from '@empathyco/x-components'\n</script>\n```\n\n#### Using XInject and XProvide\n\n```vue\n<template>\n <Facets v-slot=\"{ facet }\">\n <FiltersSearch :filters=\"facet.filters\">\n <SortedFilters>\n <Filters v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" />\n </Filters>\n </SortedFilters>\n </FiltersSearch>\n </Facets>\n</template>\n\n<script setup>\nimport {\n Facets,\n FiltersSearch,\n SortedFilters,\n Filters,\n SimpleFilter,\n} from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;AASA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,OAAO,EAAE,KAA2B;AAEpC;;;;;AAKE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAgC;AACtC,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,eAAc,GAAI,mBAAmB,CAAC,KAAK,CAAA;AAEjD;;;;;AAKE;AACF,QAAA,MAAM,gBAAgB,QAAQ,CAAC,MAAc;AAC3C,YAAA,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,KAAK,KAAK,eAAe,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;AACrF,gBAAA,OAAQ,CAAC,GAAG,eAAe,CAAC,KAAK,CAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,QAAO,EAAG,KAAG;oBAC1E,OAAO,QAAO,GAAI,KAAK,CAAA;AACzB,gBAAA,CAAC,CAAA;YACH;YAEA,OAAO,eAAe,CAAC,KAAI;AAC7B,QAAA,CAAC,CAAA;AACD,QAAA,OAAO,CAAC,SAAS,EAAE,aAAa,CAAA;QAEhC,OAAO,MAAM,KAAK,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,aAAa,CAAC,KAAI,EAAG,CAAC,CAAC,CAAC,CAAA,IAAK,EAAC;IACxE,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"sorted-filters.vue.js","sources":["../../../../../../src/x-modules/facets/components/lists/sorted-filters.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { BooleanFilter, Filter } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { isBooleanFilter } from '@empathyco/x-types'\nimport { computed, defineComponent, provide } from 'vue'\nimport { isArrayEmpty } from '../../../../utils'\nimport { useFiltersInjection } from '../../composables/use-filters-injection'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Component that sorts a list of filters and returns them using the default scoped slot.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SortedFilters',\n xModule: facetsXModule.name,\n props: {\n /**\n * The list of filters to be rendered as slots.\n *\n * @public\n */\n filters: Array as PropType<Filter[]>,\n\n /**\n * This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary\n * to make the `renderedFilters` to return only the filters of each level of the hierarchy.\n *\n * @public\n */\n parentId: {\n type: String as PropType<Filter['id']>,\n required: false,\n },\n },\n setup(props, { slots }) {\n const renderedFilters = useFiltersInjection(props)\n\n /**\n * An array of filters with the selected filters at the beginning of the list.\n *\n * @returns Array of filters.\n * @internal\n */\n const sortedFilters = computed((): Filter[] => {\n if (!isArrayEmpty(renderedFilters.value) && isBooleanFilter(renderedFilters.value[0])) {\n return ([...renderedFilters.value] as BooleanFilter[]).sort(({ selected }) => {\n return selected ? -1 : 1\n })\n }\n\n return renderedFilters.value\n })\n provide('filters', sortedFilters)\n\n return () => slots.default?.({ filters: sortedFilters.value })[0] ?? ''\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nThe sorted filters component takes a list of filters and returns this new filters list sorted by the\n`selected` filter property.\n\n### Remarks\n\n- The component can receive the filters list by property or using the XInjection feature.\n- It also provides the resultant list bound in the default slot or with the XProvide feature.\n\nBoth XInjection and XProvide features are from the extended FiltersInjectionMixin. You don't have to\nuse XInjection and XProvide together, e.g. you can use pass the filters using a prop and then\nreturns the result with XProvide.\n\n### Basic usage\n\n#### Using props and binding the result\n\n```vue\n<template>\n <Facets v-slot=\"{ facet }\">\n <SortedFilters :filters=\"facet.filters\" #default=\"{ filters }\">\n <Filters :items=\"filters\" v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" />\n </Filters>\n </SortedFilters>\n </Facets>\n</template>\n\n<script setup>\nimport { Facets, SortedFilters, Filters, SimpleFilter } from '@empathyco/x-components'\n</script>\n```\n\n#### Using XInject and XProvide\n\n```vue\n<template>\n <Facets v-slot=\"{ facet }\">\n <FiltersSearch :filters=\"facet.filters\">\n <SortedFilters>\n <Filters v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" />\n </Filters>\n </SortedFilters>\n </FiltersSearch>\n </Facets>\n</template>\n\n<script setup>\nimport {\n Facets,\n FiltersSearch,\n SortedFilters,\n Filters,\n SimpleFilter,\n} from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;AASA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,OAAO,EAAE,KAA2B;AAEpC;;;;;AAKE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAgC;AACtC,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,eAAc,GAAI,mBAAmB,CAAC,KAAK,CAAA;AAEjD;;;;;AAKE;AACF,QAAA,MAAM,gBAAgB,QAAQ,CAAC,MAAc;AAC3C,YAAA,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,KAAK,KAAK,eAAe,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;AACrF,gBAAA,OAAQ,CAAC,GAAG,eAAe,CAAC,KAAK,CAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,QAAO,EAAG,KAAG;oBAC1E,OAAO,QAAO,GAAI,KAAK,CAAA;AACzB,gBAAA,CAAC,CAAA;YACH;YAEA,OAAO,eAAe,CAAC,KAAI;AAC7B,QAAA,CAAC,CAAA;AACD,QAAA,OAAO,CAAC,SAAS,EAAE,aAAa,CAAA;QAEhC,OAAO,MAAM,KAAK,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,aAAa,CAAC,KAAI,EAAG,CAAC,CAAC,CAAC,CAAA,IAAK,EAAC;IACxE,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -9,7 +9,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
9
9
  disabled: _ctx.isHistoryQueriesEmpty,
10
10
  events: _ctx.clearHistoryQueriesEvents,
11
11
  "data-test": "clear-history-queries",
12
- "aria-label": "Clear all"
12
+ "aria-label": _ctx.ariaLabels?.button
13
13
  }, {
14
14
  default: withCtx(() => [
15
15
  renderSlot(_ctx.$slots, "default", {}, () => [
@@ -22,7 +22,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
22
22
  ]),
23
23
  _: 3
24
24
  /* FORWARDED */
25
- }, 8, ["class", "disabled", "events"]);
25
+ }, 8, ["class", "disabled", "events", "aria-label"]);
26
26
  }
27
27
  var clearHistoryQueries = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
28
28
 
@@ -1 +1 @@
1
- {"version":3,"file":"clear-history-queries.vue.js","sources":["../../../../../src/x-modules/history-queries/components/clear-history-queries.vue"],"sourcesContent":["<template>\n <BaseEventButton\n class=\"x-clear-history-queries xds:button\"\n :class=\"dynamicClasses\"\n :disabled=\"isHistoryQueriesEmpty\"\n :events=\"clearHistoryQueriesEvents\"\n data-test=\"clear-history-queries\"\n aria-label=\"Clear all\"\n >\n <!-- @slot (Required) Button content with a message, an icon or both -->\n <slot>✕</slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport BaseEventButton from '../../../components/base-event-button.vue'\nimport { useState } from '../../../composables/use-state'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * A button that when is pressed, emits the\n * {@link HistoryQueriesXEvents.UserPressedClearHistoryQueries} event, expressing the user\n * intention to clear the whole history of queries.\n *\n * @public\n */\nexport default defineComponent({\n name: 'ClearHistoryQueries',\n xModule: historyQueriesXModule.name,\n components: {\n BaseEventButton,\n },\n setup() {\n /**\n * The whole history queries.\n *\n * @internal\n */\n const { historyQueries } = useState('historyQueries')\n\n /**\n * Returns if the array of history queries is empty.\n *\n * @returns `true` if the {@link historyQueries} array is empty, `false` otherwise.\n * @internal\n */\n const isHistoryQueriesEmpty = computed(() => historyQueries.value.length === 0)\n\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add, and the boolean value\n * tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed(\n (): VueCSSClasses => ({\n 'x-clear-history-queries--is-empty': isHistoryQueriesEmpty.value,\n }),\n )\n\n /**\n * The list of events that are going to be emitted when the button is pressed.\n *\n * @internal\n */\n const clearHistoryQueriesEvents: Partial<XEventsTypes> = {\n UserPressedClearHistoryQueries: undefined,\n }\n\n return {\n dynamicClasses,\n clearHistoryQueriesEvents,\n isHistoryQueriesEmpty,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserPressedClearHistoryQueries`](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\n### Basic example\n\nThe component exposes a single default slot, where you can add icons or text.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ClearHistoryQueries>Clear history queries</ClearHistoryQueries>\n <HistoryQueries :animation=\"animation\" :maxItemsToRender=\"10\" />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { HistoryQueries, ClearHistoryQueries } from '@empathyco/x-components/history-queries'\nimport { FadeAndSlide } from '@empathyco/x-components'\n\nconst animation = FadeAndSlide\n</script>\n```\n</docs>\n"],"names":["_createBlock","_normalizeClass","_renderSlot","_createTextVNode"],"mappings":";;;;;;sBACEA,WAAA,CAUkB,0BAAA,EAAA;AAAA,IAThB,KAAA,EAAKC,cAAA,CAAA,CAAC,oCAAA,EACE,IAAA,CAAA,cAAc,CAAA,CAAA;AAAA,IACrB,QAAA,EAAU,IAAA,CAAA,qBAAA;AAAA,IACV,MAAA,EAAQ,IAAA,CAAA,yBAAA;AAAA,IACT,WAAA,EAAU,uBAAA;AAAA,IACV,YAAA,EAAW;AAAA,GAAA,EAAA;qBAGX,MAAc;AAAA,MAAdC,UAAA,CAAc,4BAAd,MAAc;AAAA,QAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAC,eAAA;AAAR,UAAA,GAAA;AAAA,UAAC;AAAA;AAAA,SAAA;AAAA,OAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"clear-history-queries.vue.js","sources":["../../../../../src/x-modules/history-queries/components/clear-history-queries.vue"],"sourcesContent":["<template>\n <BaseEventButton\n class=\"x-clear-history-queries xds:button\"\n :class=\"dynamicClasses\"\n :disabled=\"isHistoryQueriesEmpty\"\n :events=\"clearHistoryQueriesEvents\"\n data-test=\"clear-history-queries\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a message, an icon or both -->\n <slot>✕</slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport BaseEventButton from '../../../components/base-event-button.vue'\nimport { useAccessibilityLabels } from '../../../composables'\nimport { useState } from '../../../composables/use-state'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * A button that when is pressed, emits the\n * {@link HistoryQueriesXEvents.UserPressedClearHistoryQueries} event, expressing the user\n * intention to clear the whole history of queries.\n *\n * @public\n */\nexport default defineComponent({\n name: 'ClearHistoryQueries',\n xModule: historyQueriesXModule.name,\n components: {\n BaseEventButton,\n },\n setup() {\n const ariaLabels = useAccessibilityLabels('clearHistoryQueries')\n\n /**\n * The whole history queries.\n *\n * @internal\n */\n const { historyQueries } = useState('historyQueries')\n\n /**\n * Returns if the array of history queries is empty.\n *\n * @returns `true` if the {@link historyQueries} array is empty, `false` otherwise.\n * @internal\n */\n const isHistoryQueriesEmpty = computed(() => historyQueries.value.length === 0)\n\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add, and the boolean value\n * tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed(\n (): VueCSSClasses => ({\n 'x-clear-history-queries--is-empty': isHistoryQueriesEmpty.value,\n }),\n )\n\n /**\n * The list of events that are going to be emitted when the button is pressed.\n *\n * @internal\n */\n const clearHistoryQueriesEvents: Partial<XEventsTypes> = {\n UserPressedClearHistoryQueries: undefined,\n }\n\n return {\n ariaLabels,\n dynamicClasses,\n clearHistoryQueriesEvents,\n isHistoryQueriesEmpty,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserPressedClearHistoryQueries`](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\n### Basic example\n\nThe component exposes a single default slot, where you can add icons or text.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ClearHistoryQueries>Clear history queries</ClearHistoryQueries>\n <HistoryQueries :animation=\"animation\" :maxItemsToRender=\"10\" />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { HistoryQueries, ClearHistoryQueries } from '@empathyco/x-components/history-queries'\nimport { FadeAndSlide } from '@empathyco/x-components'\n\nconst animation = FadeAndSlide\n</script>\n```\n</docs>\n"],"names":["_createBlock","_normalizeClass","_renderSlot","_createTextVNode"],"mappings":";;;;;;sBACEA,WAAA,CAUkB,0BAAA,EAAA;AAAA,IAThB,KAAA,EAAKC,cAAA,CAAA,CAAC,oCAAA,EACE,IAAA,CAAA,cAAc,CAAA,CAAA;AAAA,IACrB,QAAA,EAAU,IAAA,CAAA,qBAAA;AAAA,IACV,MAAA,EAAQ,IAAA,CAAA,yBAAA;AAAA,IACT,WAAA,EAAU,uBAAA;AAAA,IACT,cAAY,IAAA,CAAA,UAAA,EAAY;AAAA,GAAA,EAAA;qBAGzB,MAAc;AAAA,MAAdC,UAAA,CAAc,4BAAd,MAAc;AAAA,QAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAC,eAAA;AAAR,UAAA,GAAA;AAAA,UAAC;AAAA;AAAA,SAAA;AAAA,OAAA;;;;;;;;;;"}
@@ -1,5 +1,13 @@
1
1
  import { defineComponent, computed } from 'vue';
2
2
  import BaseEventButton from '../../../components/base-event-button.vue.js';
3
+ import '../../../composables/create-use-device.js';
4
+ import 'vuex';
5
+ import '../../../plugins/x-bus.js';
6
+ import '@empathyco/x-utils';
7
+ import '../../../plugins/x-plugin.js';
8
+ import 'rxjs';
9
+ import { useAccessibilityLabels } from '../../../composables/use-accessibility-labels.js';
10
+ import '@vueuse/core';
3
11
  import { useState } from '../../../composables/use-state.js';
4
12
  import { historyQueriesXModule } from '../x-module.js';
5
13
 
@@ -17,6 +25,7 @@ var _sfc_main = defineComponent({
17
25
  BaseEventButton,
18
26
  },
19
27
  setup() {
28
+ const ariaLabels = useAccessibilityLabels('clearHistoryQueries');
20
29
  /**
21
30
  * The whole history queries.
22
31
  *
@@ -49,6 +58,7 @@ var _sfc_main = defineComponent({
49
58
  UserPressedClearHistoryQueries: undefined,
50
59
  };
51
60
  return {
61
+ ariaLabels,
52
62
  dynamicClasses,
53
63
  clearHistoryQueriesEvents,
54
64
  isHistoryQueriesEmpty,
@@ -1 +1 @@
1
- {"version":3,"file":"clear-history-queries.vue2.js","sources":["../../../../../src/x-modules/history-queries/components/clear-history-queries.vue"],"sourcesContent":["<template>\n <BaseEventButton\n class=\"x-clear-history-queries xds:button\"\n :class=\"dynamicClasses\"\n :disabled=\"isHistoryQueriesEmpty\"\n :events=\"clearHistoryQueriesEvents\"\n data-test=\"clear-history-queries\"\n aria-label=\"Clear all\"\n >\n <!-- @slot (Required) Button content with a message, an icon or both -->\n <slot>✕</slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport BaseEventButton from '../../../components/base-event-button.vue'\nimport { useState } from '../../../composables/use-state'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * A button that when is pressed, emits the\n * {@link HistoryQueriesXEvents.UserPressedClearHistoryQueries} event, expressing the user\n * intention to clear the whole history of queries.\n *\n * @public\n */\nexport default defineComponent({\n name: 'ClearHistoryQueries',\n xModule: historyQueriesXModule.name,\n components: {\n BaseEventButton,\n },\n setup() {\n /**\n * The whole history queries.\n *\n * @internal\n */\n const { historyQueries } = useState('historyQueries')\n\n /**\n * Returns if the array of history queries is empty.\n *\n * @returns `true` if the {@link historyQueries} array is empty, `false` otherwise.\n * @internal\n */\n const isHistoryQueriesEmpty = computed(() => historyQueries.value.length === 0)\n\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add, and the boolean value\n * tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed(\n (): VueCSSClasses => ({\n 'x-clear-history-queries--is-empty': isHistoryQueriesEmpty.value,\n }),\n )\n\n /**\n * The list of events that are going to be emitted when the button is pressed.\n *\n * @internal\n */\n const clearHistoryQueriesEvents: Partial<XEventsTypes> = {\n UserPressedClearHistoryQueries: undefined,\n }\n\n return {\n dynamicClasses,\n clearHistoryQueriesEvents,\n isHistoryQueriesEmpty,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserPressedClearHistoryQueries`](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\n### Basic example\n\nThe component exposes a single default slot, where you can add icons or text.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ClearHistoryQueries>Clear history queries</ClearHistoryQueries>\n <HistoryQueries :animation=\"animation\" :maxItemsToRender=\"10\" />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { HistoryQueries, ClearHistoryQueries } from '@empathyco/x-components/history-queries'\nimport { FadeAndSlide } from '@empathyco/x-components'\n\nconst animation = FadeAndSlide\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAsBA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,qBAAqB;IAC3B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE;QACV,eAAe;AAChB,KAAA;IACD,KAAK,GAAA;AACH;;;;AAIE;QACF,MAAM,EAAE,cAAa,KAAM,QAAQ,CAAC,gBAAgB,CAAA;AAEpD;;;;;AAKE;AACF,QAAA,MAAM,qBAAoB,GAAI,QAAQ,CAAC,MAAM,cAAc,CAAC,KAAK,CAAC,MAAK,KAAM,CAAC,CAAA;AAE9E;;;;;;AAME;AACF,QAAA,MAAM,cAAa,GAAI,QAAQ,CAC7B,OAAsB;YACpB,mCAAmC,EAAE,qBAAqB,CAAC,KAAK;AACjE,SAAA,CAAC,CACJ;AAEA;;;;AAIE;AACF,QAAA,MAAM,yBAAyB,GAA0B;AACvD,YAAA,8BAA8B,EAAE,SAAS;SAC3C;QAEA,OAAO;YACL,cAAc;YACd,yBAAyB;YACzB,qBAAqB;SACvB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"clear-history-queries.vue2.js","sources":["../../../../../src/x-modules/history-queries/components/clear-history-queries.vue"],"sourcesContent":["<template>\n <BaseEventButton\n class=\"x-clear-history-queries xds:button\"\n :class=\"dynamicClasses\"\n :disabled=\"isHistoryQueriesEmpty\"\n :events=\"clearHistoryQueriesEvents\"\n data-test=\"clear-history-queries\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a message, an icon or both -->\n <slot>✕</slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport BaseEventButton from '../../../components/base-event-button.vue'\nimport { useAccessibilityLabels } from '../../../composables'\nimport { useState } from '../../../composables/use-state'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * A button that when is pressed, emits the\n * {@link HistoryQueriesXEvents.UserPressedClearHistoryQueries} event, expressing the user\n * intention to clear the whole history of queries.\n *\n * @public\n */\nexport default defineComponent({\n name: 'ClearHistoryQueries',\n xModule: historyQueriesXModule.name,\n components: {\n BaseEventButton,\n },\n setup() {\n const ariaLabels = useAccessibilityLabels('clearHistoryQueries')\n\n /**\n * The whole history queries.\n *\n * @internal\n */\n const { historyQueries } = useState('historyQueries')\n\n /**\n * Returns if the array of history queries is empty.\n *\n * @returns `true` if the {@link historyQueries} array is empty, `false` otherwise.\n * @internal\n */\n const isHistoryQueriesEmpty = computed(() => historyQueries.value.length === 0)\n\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add, and the boolean value\n * tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed(\n (): VueCSSClasses => ({\n 'x-clear-history-queries--is-empty': isHistoryQueriesEmpty.value,\n }),\n )\n\n /**\n * The list of events that are going to be emitted when the button is pressed.\n *\n * @internal\n */\n const clearHistoryQueriesEvents: Partial<XEventsTypes> = {\n UserPressedClearHistoryQueries: undefined,\n }\n\n return {\n ariaLabels,\n dynamicClasses,\n clearHistoryQueriesEvents,\n isHistoryQueriesEmpty,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserPressedClearHistoryQueries`](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\n### Basic example\n\nThe component exposes a single default slot, where you can add icons or text.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ClearHistoryQueries>Clear history queries</ClearHistoryQueries>\n <HistoryQueries :animation=\"animation\" :maxItemsToRender=\"10\" />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { HistoryQueries, ClearHistoryQueries } from '@empathyco/x-components/history-queries'\nimport { FadeAndSlide } from '@empathyco/x-components'\n\nconst animation = FadeAndSlide\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,qBAAqB;IAC3B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE;QACV,eAAe;AAChB,KAAA;IACD,KAAK,GAAA;AACH,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,qBAAqB,CAAA;AAE/D;;;;AAIE;QACF,MAAM,EAAE,cAAa,KAAM,QAAQ,CAAC,gBAAgB,CAAA;AAEpD;;;;;AAKE;AACF,QAAA,MAAM,qBAAoB,GAAI,QAAQ,CAAC,MAAM,cAAc,CAAC,KAAK,CAAC,MAAK,KAAM,CAAC,CAAA;AAE9E;;;;;;AAME;AACF,QAAA,MAAM,cAAa,GAAI,QAAQ,CAC7B,OAAsB;YACpB,mCAAmC,EAAE,qBAAqB,CAAC,KAAK;AACjE,SAAA,CAAC,CACJ;AAEA;;;;AAIE;AACF,QAAA,MAAM,yBAAyB,GAA0B;AACvD,YAAA,8BAA8B,EAAE,SAAS;SAC3C;QAEA,OAAO;YACL,UAAU;YACV,cAAc;YACd,yBAAyB;YACzB,qBAAqB;SACvB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -6,9 +6,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
6
6
  const _component_BaseSwitch = resolveComponent("BaseSwitch");
7
7
  return openBlock(), createBlock(_component_BaseSwitch, {
8
8
  "model-value": _ctx.isEnabled,
9
- "aria-label": "Queries' history",
9
+ "aria-label": _ctx.ariaLabels?.root,
10
10
  "onUpdate:modelValue": _ctx.toggle
11
- }, null, 8, ["model-value", "onUpdate:modelValue"]);
11
+ }, null, 8, ["model-value", "aria-label", "onUpdate:modelValue"]);
12
12
  }
13
13
  var historyQueriesSwitch = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
14
14