@empathyco/x-components 9.3.1 → 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 (193) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/core/index.js +3 -1
  3. package/core/index.js.map +1 -1
  4. package/docs/API-reference/api/x-components.aicarousel.md +2 -2
  5. package/docs/API-reference/api/x-components.basecolumnpickerdropdown.md +2 -2
  6. package/docs/API-reference/api/x-components.basecolumnpickerlist.md +2 -2
  7. package/docs/API-reference/api/x-components.basedropdown.md +2 -2
  8. package/docs/API-reference/api/x-components.baseeventsmodalclose.md +2 -2
  9. package/docs/API-reference/api/x-components.baseeventsmodalopen.md +2 -2
  10. package/docs/API-reference/api/x-components.basemodal.md +2 -2
  11. package/docs/API-reference/api/x-components.clearhistoryqueries.md +2 -2
  12. package/docs/API-reference/api/x-components.deepmergewithdefaults.md +85 -0
  13. package/docs/API-reference/api/x-components.editablenumberrangefilter.md +2 -2
  14. package/docs/API-reference/api/x-components.facets.md +2 -2
  15. package/docs/API-reference/api/x-components.filterssearch.md +2 -2
  16. package/docs/API-reference/api/x-components.historyqueriesswitch.md +2 -2
  17. package/docs/API-reference/api/x-components.historyquery.md +2 -2
  18. package/docs/API-reference/api/x-components.md +30 -0
  19. package/docs/API-reference/api/x-components.pageloaderbutton.md +2 -2
  20. package/docs/API-reference/api/x-components.pageselector.md +2 -2
  21. package/docs/API-reference/api/x-components.removehistoryquery.md +2 -2
  22. package/docs/API-reference/api/x-components.scrolltotop.md +2 -2
  23. package/docs/API-reference/api/x-components.searchinput.md +2 -2
  24. package/docs/API-reference/api/x-components.sliderfilter.md +2 -2
  25. package/docs/API-reference/api/x-components.sortdropdown.md +2 -2
  26. package/docs/API-reference/api/x-components.useaccessibilitylabels.md +72 -0
  27. package/js/components/base-dropdown.vue.js.map +1 -1
  28. package/js/components/base-dropdown.vue2.js +11 -4
  29. package/js/components/base-dropdown.vue2.js.map +1 -1
  30. package/js/components/base-keyboard-navigation.vue2.js +1 -0
  31. package/js/components/base-keyboard-navigation.vue2.js.map +1 -1
  32. package/js/components/column-picker/base-column-picker-dropdown.vue.js.map +1 -1
  33. package/js/components/column-picker/base-column-picker-dropdown.vue2.js +10 -3
  34. package/js/components/column-picker/base-column-picker-dropdown.vue2.js.map +1 -1
  35. package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
  36. package/js/components/column-picker/base-column-picker-list.vue2.js +10 -3
  37. package/js/components/column-picker/base-column-picker-list.vue2.js.map +1 -1
  38. package/js/components/display-click-provider.vue.js +2 -1
  39. package/js/components/display-click-provider.vue.js.map +1 -1
  40. package/js/components/highlight.vue2.js +1 -0
  41. package/js/components/highlight.vue2.js.map +1 -1
  42. package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
  43. package/js/components/modals/base-events-modal-close.vue2.js +10 -3
  44. package/js/components/modals/base-events-modal-close.vue2.js.map +1 -1
  45. package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
  46. package/js/components/modals/base-events-modal-open.vue2.js +10 -3
  47. package/js/components/modals/base-events-modal-open.vue2.js.map +1 -1
  48. package/js/components/modals/base-id-modal-close.vue2.js +2 -1
  49. package/js/components/modals/base-id-modal-close.vue2.js.map +1 -1
  50. package/js/components/modals/base-id-modal-open.vue2.js +2 -1
  51. package/js/components/modals/base-id-modal-open.vue2.js.map +1 -1
  52. package/js/components/modals/base-id-modal.vue2.js +2 -1
  53. package/js/components/modals/base-id-modal.vue2.js.map +1 -1
  54. package/js/components/modals/base-modal.vue.js.map +1 -1
  55. package/js/components/modals/base-modal.vue2.js +3 -3
  56. package/js/components/modals/base-modal.vue2.js.map +1 -1
  57. package/js/components/page-loader-button.vue.js.map +1 -1
  58. package/js/components/page-loader-button.vue2.js +3 -3
  59. package/js/components/page-loader-button.vue2.js.map +1 -1
  60. package/js/components/page-selector.vue.js.map +1 -1
  61. package/js/components/page-selector.vue2.js +3 -3
  62. package/js/components/page-selector.vue2.js.map +1 -1
  63. package/js/components/panels/base-id-toggle-panel-button.vue2.js +1 -0
  64. package/js/components/panels/base-id-toggle-panel-button.vue2.js.map +1 -1
  65. package/js/components/panels/base-id-toggle-panel.vue2.js +2 -1
  66. package/js/components/panels/base-id-toggle-panel.vue2.js.map +1 -1
  67. package/js/components/result/base-result-link.vue2.js +2 -1
  68. package/js/components/result/base-result-link.vue2.js.map +1 -1
  69. package/js/components/result/base-result-rating.vue2.js +2 -1
  70. package/js/components/result/base-result-rating.vue2.js.map +1 -1
  71. package/js/components/sort/sort-dropdown.vue.js.map +1 -1
  72. package/js/components/sort/sort-dropdown.vue2.js +10 -3
  73. package/js/components/sort/sort-dropdown.vue2.js.map +1 -1
  74. package/js/components/suggestions/base-suggestion.vue2.js +1 -0
  75. package/js/components/suggestions/base-suggestion.vue2.js.map +1 -1
  76. package/js/composables/use-accessibility-labels.js +40 -0
  77. package/js/composables/use-accessibility-labels.js.map +1 -0
  78. package/js/index.js +3 -1
  79. package/js/index.js.map +1 -1
  80. package/js/utils/accessibility.js +1 -19
  81. package/js/utils/accessibility.js.map +1 -1
  82. package/js/utils/deep-merge-with-defaults.js +47 -0
  83. package/js/utils/deep-merge-with-defaults.js.map +1 -0
  84. package/js/x-installer/x-installer.js +0 -4
  85. package/js/x-installer/x-installer.js.map +1 -1
  86. package/js/x-modules/ai/components/ai-carousel.vue.js.map +1 -1
  87. package/js/x-modules/ai/components/ai-carousel.vue2.js +3 -3
  88. package/js/x-modules/ai/components/ai-carousel.vue2.js.map +1 -1
  89. package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js +1 -0
  90. package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js.map +1 -1
  91. package/js/x-modules/empathize/components/empathize.vue2.js +2 -2
  92. package/js/x-modules/facets/components/facets/facets-provider.vue2.js +1 -0
  93. package/js/x-modules/facets/components/facets/facets-provider.vue2.js.map +1 -1
  94. package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
  95. package/js/x-modules/facets/components/facets/facets.vue2.js +9 -3
  96. package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
  97. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
  98. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js +3 -3
  99. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js.map +1 -1
  100. package/js/x-modules/facets/components/filters/slider-filter.vue.js.map +1 -1
  101. package/js/x-modules/facets/components/filters/slider-filter.vue2.js +3 -3
  102. package/js/x-modules/facets/components/filters/slider-filter.vue2.js.map +1 -1
  103. package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
  104. package/js/x-modules/facets/components/lists/filters-search.vue2.js +10 -3
  105. package/js/x-modules/facets/components/lists/filters-search.vue2.js.map +1 -1
  106. package/js/x-modules/facets/components/lists/sorted-filters.vue.js +1 -0
  107. package/js/x-modules/facets/components/lists/sorted-filters.vue.js.map +1 -1
  108. package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
  109. package/js/x-modules/history-queries/components/clear-history-queries.vue2.js +10 -3
  110. package/js/x-modules/history-queries/components/clear-history-queries.vue2.js.map +1 -1
  111. package/js/x-modules/history-queries/components/history-queries-switch.vue.js.map +1 -1
  112. package/js/x-modules/history-queries/components/history-queries-switch.vue2.js +10 -3
  113. package/js/x-modules/history-queries/components/history-queries-switch.vue2.js.map +1 -1
  114. package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
  115. package/js/x-modules/history-queries/components/history-query.vue2.js +10 -3
  116. package/js/x-modules/history-queries/components/history-query.vue2.js.map +1 -1
  117. package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
  118. package/js/x-modules/history-queries/components/remove-history-query.vue2.js +10 -3
  119. package/js/x-modules/history-queries/components/remove-history-query.vue2.js.map +1 -1
  120. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +1 -0
  121. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
  122. package/js/x-modules/queries-preview/components/query-preview.vue2.js +2 -2
  123. package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js +1 -0
  124. package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js.map +1 -1
  125. package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js +1 -0
  126. package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js.map +1 -1
  127. package/js/x-modules/recommendations/components/recommendations.vue2.js +1 -0
  128. package/js/x-modules/recommendations/components/recommendations.vue2.js.map +1 -1
  129. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +2 -1
  130. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -1
  131. package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
  132. package/js/x-modules/scroll/components/scroll-to-top.vue2.js +3 -3
  133. package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
  134. package/js/x-modules/search/wiring.js +1 -0
  135. package/js/x-modules/search/wiring.js.map +1 -1
  136. package/js/x-modules/search-box/components/search-input.vue.js.map +1 -1
  137. package/js/x-modules/search-box/components/search-input.vue2.js +11 -4
  138. package/js/x-modules/search-box/components/search-input.vue2.js.map +1 -1
  139. package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js +1 -0
  140. package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js.map +1 -1
  141. package/package.json +2 -2
  142. package/report/x-components.api.json +401 -40
  143. package/report/x-components.api.md +46 -43
  144. package/types/src/components/base-dropdown.vue.d.ts +2 -2
  145. package/types/src/components/column-picker/base-column-picker-dropdown.vue.d.ts +2 -2
  146. package/types/src/components/column-picker/base-column-picker-dropdown.vue.d.ts.map +1 -1
  147. package/types/src/components/column-picker/base-column-picker-list.vue.d.ts +2 -2
  148. package/types/src/components/column-picker/base-column-picker-list.vue.d.ts.map +1 -1
  149. package/types/src/components/modals/base-events-modal-close.vue.d.ts +2 -2
  150. package/types/src/components/modals/base-events-modal-close.vue.d.ts.map +1 -1
  151. package/types/src/components/modals/base-events-modal-open.vue.d.ts +2 -2
  152. package/types/src/components/modals/base-events-modal-open.vue.d.ts.map +1 -1
  153. package/types/src/components/modals/base-modal.vue.d.ts +2 -2
  154. package/types/src/components/modals/base-modal.vue.d.ts.map +1 -1
  155. package/types/src/components/page-loader-button.vue.d.ts +2 -2
  156. package/types/src/components/page-loader-button.vue.d.ts.map +1 -1
  157. package/types/src/components/page-selector.vue.d.ts +2 -2
  158. package/types/src/components/page-selector.vue.d.ts.map +1 -1
  159. package/types/src/components/sort/sort-dropdown.vue.d.ts +2 -2
  160. package/types/src/components/sort/sort-dropdown.vue.d.ts.map +1 -1
  161. package/types/src/composables/index.d.ts +1 -0
  162. package/types/src/composables/index.d.ts.map +1 -1
  163. package/types/src/composables/use-accessibility-labels.d.ts +31 -0
  164. package/types/src/composables/use-accessibility-labels.d.ts.map +1 -0
  165. package/types/src/utils/accessibility.d.ts +0 -10
  166. package/types/src/utils/accessibility.d.ts.map +1 -1
  167. package/types/src/utils/deep-merge-with-defaults.d.ts +28 -0
  168. package/types/src/utils/deep-merge-with-defaults.d.ts.map +1 -0
  169. package/types/src/utils/index.d.ts +1 -0
  170. package/types/src/utils/index.d.ts.map +1 -1
  171. package/types/src/x-installer/x-installer.d.ts.map +1 -1
  172. package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts +2 -2
  173. package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts.map +1 -1
  174. package/types/src/x-modules/facets/components/facets/facets.vue.d.ts +2 -2
  175. package/types/src/x-modules/facets/components/facets/facets.vue.d.ts.map +1 -1
  176. package/types/src/x-modules/facets/components/filters/editable-number-range-filter.vue.d.ts +2 -2
  177. package/types/src/x-modules/facets/components/filters/editable-number-range-filter.vue.d.ts.map +1 -1
  178. package/types/src/x-modules/facets/components/filters/slider-filter.vue.d.ts +2 -2
  179. package/types/src/x-modules/facets/components/filters/slider-filter.vue.d.ts.map +1 -1
  180. package/types/src/x-modules/facets/components/lists/filters-search.vue.d.ts +2 -2
  181. package/types/src/x-modules/facets/components/lists/filters-search.vue.d.ts.map +1 -1
  182. package/types/src/x-modules/history-queries/components/clear-history-queries.vue.d.ts +2 -2
  183. package/types/src/x-modules/history-queries/components/clear-history-queries.vue.d.ts.map +1 -1
  184. package/types/src/x-modules/history-queries/components/history-queries-switch.vue.d.ts +2 -2
  185. package/types/src/x-modules/history-queries/components/history-queries-switch.vue.d.ts.map +1 -1
  186. package/types/src/x-modules/history-queries/components/history-query.vue.d.ts +2 -2
  187. package/types/src/x-modules/history-queries/components/history-query.vue.d.ts.map +1 -1
  188. package/types/src/x-modules/history-queries/components/remove-history-query.vue.d.ts +2 -2
  189. package/types/src/x-modules/history-queries/components/remove-history-query.vue.d.ts.map +1 -1
  190. package/types/src/x-modules/scroll/components/scroll-to-top.vue.d.ts +2 -2
  191. package/types/src/x-modules/scroll/components/scroll-to-top.vue.d.ts.map +1 -1
  192. package/types/src/x-modules/search-box/components/search-input.vue.d.ts +2 -2
  193. package/types/src/x-modules/search-box/components/search-input.vue.d.ts.map +1 -1
@@ -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=\"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 { AriaLabels } from '../../../../types'\nimport type { DebouncedFunction, VueCSSClasses } from '../../../../utils/types'\nimport { isBooleanFilter } from '@empathyco/x-types'\nimport { computed, defineComponent, inject, provide, ref, watch } from 'vue'\nimport { ACCESSIBILITY_KEY } from '../../../../types'\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 { filtersSearch: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\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":";;;;;;;;AAwCA;;;;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;QAEjD,MAAM,EAAE,aAAa,EAAE,UAAS,EAAE,GAAI,MAAM,CAAC,iBAAiB,CAAc;AAE5E,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
+ {"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;;;;"}
@@ -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=\"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 { AriaLabels } from '../../../types'\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../../../components/base-event-button.vue'\nimport { useState } from '../../../composables/use-state'\nimport { ACCESSIBILITY_KEY } from '../../../types'\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 { clearHistoryQueries: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\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
+ {"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,7 +1,14 @@
1
- import { defineComponent, inject, computed } from 'vue';
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
- import { ACCESSIBILITY_KEY } from '../../../types/accessibility.js';
5
12
  import { historyQueriesXModule } from '../x-module.js';
6
13
 
7
14
  /**
@@ -18,7 +25,7 @@ var _sfc_main = defineComponent({
18
25
  BaseEventButton,
19
26
  },
20
27
  setup() {
21
- const { clearHistoryQueries: ariaLabels } = inject(ACCESSIBILITY_KEY);
28
+ const ariaLabels = useAccessibilityLabels('clearHistoryQueries');
22
29
  /**
23
30
  * The whole history queries.
24
31
  *
@@ -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=\"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 { AriaLabels } from '../../../types'\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../../../components/base-event-button.vue'\nimport { useState } from '../../../composables/use-state'\nimport { ACCESSIBILITY_KEY } from '../../../types'\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 { clearHistoryQueries: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\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":";;;;;;AAwBA;;;;;;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;QACH,MAAM,EAAE,mBAAmB,EAAE,UAAS,EAAE,GAAI,MAAM,CAAC,iBAAiB,CAAc;AAElF;;;;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;;;;"}
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;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"history-queries-switch.vue.js","sources":["../../../../../src/x-modules/history-queries/components/history-queries-switch.vue"],"sourcesContent":["<template>\n <BaseSwitch\n :model-value=\"isEnabled\"\n :aria-label=\"ariaLabels?.root\"\n @update:model-value=\"toggle\"\n />\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery } from '@empathyco/x-types'\nimport type { AriaLabels } from '../../../types'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseSwitch from '../../../components/base-switch.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { ACCESSIBILITY_KEY } from '../../../types'\nimport { isArrayEmpty } from '../../../utils/array'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * History Queries Switch is a component to activate or deactivate the history queries.\n * This component emits events depending on the `isEnabled` value.\n *\n * @public\n */\nexport default defineComponent({\n name: 'HistoryQueriesSwitch',\n xModule: historyQueriesXModule.name,\n components: {\n BaseSwitch,\n },\n setup() {\n const { historyQueriesSwitch: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n const $x = use$x()\n\n /**\n * An object with the isEnabled value and the history queries coming from the store state.\n *\n * @internal\n */\n const { isEnabled, historyQueries } = useState('historyQueries')\n\n /**\n * Checks if there are history queries.\n *\n * @returns True if there are history queries; false otherwise.\n */\n const hasHistoryQueries = computed(() => !isArrayEmpty(historyQueries.value as HistoryQuery[]))\n\n const disableEvent = computed(() =>\n hasHistoryQueries.value\n ? 'UserClickedDisableHistoryQueries'\n : 'UserClickedConfirmDisableHistoryQueries',\n )\n\n /**\n * Emits an event based on the switch state.\n *\n * @internal\n */\n const toggle = (): void => {\n $x.emit(isEnabled.value ? disableEvent.value : 'UserClickedEnableHistoryQueries')\n }\n\n return {\n ariaLabels,\n toggle,\n isEnabled,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedEnableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch and the history queries are deactivated.\n- [`UserClickedDisableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch when the history queries are activated\n and the list of history queries is not empty.\n- [`UserClickedConfirmDisableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch when the history queries are activated\n and the list of history queries is empty.\n\n## See it in action\n\nHere you have a basic example of how the switch is rendered.\n\n_Try clicking it to see how it changes its state_\n\n```vue live\n<template>\n <HistoryQueriesSwitch />\n</template>\n\n<script setup>\nimport { HistoryQueriesSwitch } from '@empathyco/x-components/history-queries'\n</script>\n```\n\nHere you have a more complex example.\n\n```vue live\n<template>\n <div>\n <div>\n <SearchInput :instant=\"false\" />\n <SearchButton>Search</SearchButton>\n </div>\n <label>\n History queries:\n <HistoryQueriesSwitch />\n <HistoryQueries />\n <BaseEventsModal :eventsToOpenModal=\"eventsToOpenModal\">\n <BaseEventButton :events=\"disableEvents\">Disable</BaseEventButton>\n <BaseEventButton :events=\"cancelEvents\">Cancel</BaseEventButton>\n </BaseEventsModal>\n </label>\n </div>\n</template>\n\n<script setup>\nimport { BaseEventButton, BaseEventsModal } from '@empathyco/x-components'\nimport { HistoryQueriesSwitch, HistoryQueries } from '@empathyco/x-components/history-queries'\nimport { SearchInput, SearchButton } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst eventsToOpenModal = ref(['UserClickedDisableHistoryQueries'])\nconst disableEvents = ref({\n UserClickedConfirmDisableHistoryQueries: undefined,\n UserClickedCloseEventsModal: undefined,\n})\nconst cancelEvents = ref({\n UserClickedCloseEventsModal: undefined,\n})\n</script>\n```\n</docs>\n"],"names":["_createBlock"],"mappings":";;;;;;sBACEA,WAAA,CAIE,qBAAA,EAAA;AAAA,IAHC,aAAA,EAAa,IAAA,CAAA,SAAA;AAAA,IACb,cAAY,IAAA,CAAA,UAAA,EAAY,IAAA;AAAA,IACxB,qBAAA,EAAoB,IAAA,CAAA;AAAA,GAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,aAAA,EAAA,YAAA,EAAA,qBAAA,CAAA,CAAA;;;;;;"}
1
+ {"version":3,"file":"history-queries-switch.vue.js","sources":["../../../../../src/x-modules/history-queries/components/history-queries-switch.vue"],"sourcesContent":["<template>\n <BaseSwitch\n :model-value=\"isEnabled\"\n :aria-label=\"ariaLabels?.root\"\n @update:model-value=\"toggle\"\n />\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery } from '@empathyco/x-types'\nimport { computed, defineComponent } from 'vue'\nimport BaseSwitch from '../../../components/base-switch.vue'\nimport { useAccessibilityLabels } from '../../../composables'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { isArrayEmpty } from '../../../utils/array'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * History Queries Switch is a component to activate or deactivate the history queries.\n * This component emits events depending on the `isEnabled` value.\n *\n * @public\n */\nexport default defineComponent({\n name: 'HistoryQueriesSwitch',\n xModule: historyQueriesXModule.name,\n components: {\n BaseSwitch,\n },\n setup() {\n const ariaLabels = useAccessibilityLabels('historyQueriesSwitch')\n\n const $x = use$x()\n\n /**\n * An object with the isEnabled value and the history queries coming from the store state.\n *\n * @internal\n */\n const { isEnabled, historyQueries } = useState('historyQueries')\n\n /**\n * Checks if there are history queries.\n *\n * @returns True if there are history queries; false otherwise.\n */\n const hasHistoryQueries = computed(() => !isArrayEmpty(historyQueries.value as HistoryQuery[]))\n\n const disableEvent = computed(() =>\n hasHistoryQueries.value\n ? 'UserClickedDisableHistoryQueries'\n : 'UserClickedConfirmDisableHistoryQueries',\n )\n\n /**\n * Emits an event based on the switch state.\n *\n * @internal\n */\n const toggle = (): void => {\n $x.emit(isEnabled.value ? disableEvent.value : 'UserClickedEnableHistoryQueries')\n }\n\n return {\n ariaLabels,\n toggle,\n isEnabled,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedEnableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch and the history queries are deactivated.\n- [`UserClickedDisableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch when the history queries are activated\n and the list of history queries is not empty.\n- [`UserClickedConfirmDisableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch when the history queries are activated\n and the list of history queries is empty.\n\n## See it in action\n\nHere you have a basic example of how the switch is rendered.\n\n_Try clicking it to see how it changes its state_\n\n```vue live\n<template>\n <HistoryQueriesSwitch />\n</template>\n\n<script setup>\nimport { HistoryQueriesSwitch } from '@empathyco/x-components/history-queries'\n</script>\n```\n\nHere you have a more complex example.\n\n```vue live\n<template>\n <div>\n <div>\n <SearchInput :instant=\"false\" />\n <SearchButton>Search</SearchButton>\n </div>\n <label>\n History queries:\n <HistoryQueriesSwitch />\n <HistoryQueries />\n <BaseEventsModal :eventsToOpenModal=\"eventsToOpenModal\">\n <BaseEventButton :events=\"disableEvents\">Disable</BaseEventButton>\n <BaseEventButton :events=\"cancelEvents\">Cancel</BaseEventButton>\n </BaseEventsModal>\n </label>\n </div>\n</template>\n\n<script setup>\nimport { BaseEventButton, BaseEventsModal } from '@empathyco/x-components'\nimport { HistoryQueriesSwitch, HistoryQueries } from '@empathyco/x-components/history-queries'\nimport { SearchInput, SearchButton } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst eventsToOpenModal = ref(['UserClickedDisableHistoryQueries'])\nconst disableEvents = ref({\n UserClickedConfirmDisableHistoryQueries: undefined,\n UserClickedCloseEventsModal: undefined,\n})\nconst cancelEvents = ref({\n UserClickedCloseEventsModal: undefined,\n})\n</script>\n```\n</docs>\n"],"names":["_createBlock"],"mappings":";;;;;;sBACEA,WAAA,CAIE,qBAAA,EAAA;AAAA,IAHC,aAAA,EAAa,IAAA,CAAA,SAAA;AAAA,IACb,cAAY,IAAA,CAAA,UAAA,EAAY,IAAA;AAAA,IACxB,qBAAA,EAAoB,IAAA,CAAA;AAAA,GAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,aAAA,EAAA,YAAA,EAAA,qBAAA,CAAA,CAAA;;;;;;"}
@@ -1,8 +1,15 @@
1
- import { defineComponent, inject, computed } from 'vue';
1
+ import { defineComponent, computed } from 'vue';
2
2
  import BaseSwitch from '../../../components/base-switch.vue.js';
3
+ import '../../../composables/create-use-device.js';
3
4
  import { use$x } from '../../../composables/use-_x.js';
5
+ import { useAccessibilityLabels } from '../../../composables/use-accessibility-labels.js';
6
+ import 'vuex';
7
+ import '../../../plugins/x-bus.js';
8
+ import '@empathyco/x-utils';
9
+ import '../../../plugins/x-plugin.js';
10
+ import '@vueuse/core';
11
+ import 'rxjs';
4
12
  import { useState } from '../../../composables/use-state.js';
5
- import { ACCESSIBILITY_KEY } from '../../../types/accessibility.js';
6
13
  import { isArrayEmpty } from '../../../utils/array.js';
7
14
  import { historyQueriesXModule } from '../x-module.js';
8
15
 
@@ -19,7 +26,7 @@ var _sfc_main = defineComponent({
19
26
  BaseSwitch,
20
27
  },
21
28
  setup() {
22
- const { historyQueriesSwitch: ariaLabels } = inject(ACCESSIBILITY_KEY);
29
+ const ariaLabels = useAccessibilityLabels('historyQueriesSwitch');
23
30
  const $x = use$x();
24
31
  /**
25
32
  * An object with the isEnabled value and the history queries coming from the store state.
@@ -1 +1 @@
1
- {"version":3,"file":"history-queries-switch.vue2.js","sources":["../../../../../src/x-modules/history-queries/components/history-queries-switch.vue"],"sourcesContent":["<template>\n <BaseSwitch\n :model-value=\"isEnabled\"\n :aria-label=\"ariaLabels?.root\"\n @update:model-value=\"toggle\"\n />\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery } from '@empathyco/x-types'\nimport type { AriaLabels } from '../../../types'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseSwitch from '../../../components/base-switch.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { ACCESSIBILITY_KEY } from '../../../types'\nimport { isArrayEmpty } from '../../../utils/array'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * History Queries Switch is a component to activate or deactivate the history queries.\n * This component emits events depending on the `isEnabled` value.\n *\n * @public\n */\nexport default defineComponent({\n name: 'HistoryQueriesSwitch',\n xModule: historyQueriesXModule.name,\n components: {\n BaseSwitch,\n },\n setup() {\n const { historyQueriesSwitch: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n const $x = use$x()\n\n /**\n * An object with the isEnabled value and the history queries coming from the store state.\n *\n * @internal\n */\n const { isEnabled, historyQueries } = useState('historyQueries')\n\n /**\n * Checks if there are history queries.\n *\n * @returns True if there are history queries; false otherwise.\n */\n const hasHistoryQueries = computed(() => !isArrayEmpty(historyQueries.value as HistoryQuery[]))\n\n const disableEvent = computed(() =>\n hasHistoryQueries.value\n ? 'UserClickedDisableHistoryQueries'\n : 'UserClickedConfirmDisableHistoryQueries',\n )\n\n /**\n * Emits an event based on the switch state.\n *\n * @internal\n */\n const toggle = (): void => {\n $x.emit(isEnabled.value ? disableEvent.value : 'UserClickedEnableHistoryQueries')\n }\n\n return {\n ariaLabels,\n toggle,\n isEnabled,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedEnableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch and the history queries are deactivated.\n- [`UserClickedDisableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch when the history queries are activated\n and the list of history queries is not empty.\n- [`UserClickedConfirmDisableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch when the history queries are activated\n and the list of history queries is empty.\n\n## See it in action\n\nHere you have a basic example of how the switch is rendered.\n\n_Try clicking it to see how it changes its state_\n\n```vue live\n<template>\n <HistoryQueriesSwitch />\n</template>\n\n<script setup>\nimport { HistoryQueriesSwitch } from '@empathyco/x-components/history-queries'\n</script>\n```\n\nHere you have a more complex example.\n\n```vue live\n<template>\n <div>\n <div>\n <SearchInput :instant=\"false\" />\n <SearchButton>Search</SearchButton>\n </div>\n <label>\n History queries:\n <HistoryQueriesSwitch />\n <HistoryQueries />\n <BaseEventsModal :eventsToOpenModal=\"eventsToOpenModal\">\n <BaseEventButton :events=\"disableEvents\">Disable</BaseEventButton>\n <BaseEventButton :events=\"cancelEvents\">Cancel</BaseEventButton>\n </BaseEventsModal>\n </label>\n </div>\n</template>\n\n<script setup>\nimport { BaseEventButton, BaseEventsModal } from '@empathyco/x-components'\nimport { HistoryQueriesSwitch, HistoryQueries } from '@empathyco/x-components/history-queries'\nimport { SearchInput, SearchButton } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst eventsToOpenModal = ref(['UserClickedDisableHistoryQueries'])\nconst disableEvents = ref({\n UserClickedConfirmDisableHistoryQueries: undefined,\n UserClickedCloseEventsModal: undefined,\n})\nconst cancelEvents = ref({\n UserClickedCloseEventsModal: undefined,\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;AAmBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE;QACV,UAAU;AACX,KAAA;IACD,KAAK,GAAA;QACH,MAAM,EAAE,oBAAoB,EAAE,UAAS,EAAE,GAAI,MAAM,CAAC,iBAAiB,CAAc;AAEnF,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;AAIE;QACF,MAAM,EAAE,SAAS,EAAE,cAAa,EAAE,GAAI,QAAQ,CAAC,gBAAgB,CAAA;AAE/D;;;;AAIE;AACF,QAAA,MAAM,iBAAgB,GAAI,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,KAAuB,CAAC,CAAA;QAE9F,MAAM,YAAW,GAAI,QAAQ,CAAC,MAC5B,iBAAiB,CAAC;AAChB,cAAE;cACA,yCAAyC,CAC/C;AAEA;;;;AAIE;QACF,MAAM,SAAS,MAAU;AACvB,YAAA,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAI,GAAI,YAAY,CAAC,KAAI,GAAI,iCAAiC,CAAA;AAClF,QAAA,CAAA;QAEA,OAAO;YACL,UAAU;YACV,MAAM;YACN,SAAS;SACX;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"history-queries-switch.vue2.js","sources":["../../../../../src/x-modules/history-queries/components/history-queries-switch.vue"],"sourcesContent":["<template>\n <BaseSwitch\n :model-value=\"isEnabled\"\n :aria-label=\"ariaLabels?.root\"\n @update:model-value=\"toggle\"\n />\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery } from '@empathyco/x-types'\nimport { computed, defineComponent } from 'vue'\nimport BaseSwitch from '../../../components/base-switch.vue'\nimport { useAccessibilityLabels } from '../../../composables'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { isArrayEmpty } from '../../../utils/array'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * History Queries Switch is a component to activate or deactivate the history queries.\n * This component emits events depending on the `isEnabled` value.\n *\n * @public\n */\nexport default defineComponent({\n name: 'HistoryQueriesSwitch',\n xModule: historyQueriesXModule.name,\n components: {\n BaseSwitch,\n },\n setup() {\n const ariaLabels = useAccessibilityLabels('historyQueriesSwitch')\n\n const $x = use$x()\n\n /**\n * An object with the isEnabled value and the history queries coming from the store state.\n *\n * @internal\n */\n const { isEnabled, historyQueries } = useState('historyQueries')\n\n /**\n * Checks if there are history queries.\n *\n * @returns True if there are history queries; false otherwise.\n */\n const hasHistoryQueries = computed(() => !isArrayEmpty(historyQueries.value as HistoryQuery[]))\n\n const disableEvent = computed(() =>\n hasHistoryQueries.value\n ? 'UserClickedDisableHistoryQueries'\n : 'UserClickedConfirmDisableHistoryQueries',\n )\n\n /**\n * Emits an event based on the switch state.\n *\n * @internal\n */\n const toggle = (): void => {\n $x.emit(isEnabled.value ? disableEvent.value : 'UserClickedEnableHistoryQueries')\n }\n\n return {\n ariaLabels,\n toggle,\n isEnabled,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedEnableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch and the history queries are deactivated.\n- [`UserClickedDisableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch when the history queries are activated\n and the list of history queries is not empty.\n- [`UserClickedConfirmDisableHistoryQueries`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted whenever the user clicks the switch when the history queries are activated\n and the list of history queries is empty.\n\n## See it in action\n\nHere you have a basic example of how the switch is rendered.\n\n_Try clicking it to see how it changes its state_\n\n```vue live\n<template>\n <HistoryQueriesSwitch />\n</template>\n\n<script setup>\nimport { HistoryQueriesSwitch } from '@empathyco/x-components/history-queries'\n</script>\n```\n\nHere you have a more complex example.\n\n```vue live\n<template>\n <div>\n <div>\n <SearchInput :instant=\"false\" />\n <SearchButton>Search</SearchButton>\n </div>\n <label>\n History queries:\n <HistoryQueriesSwitch />\n <HistoryQueries />\n <BaseEventsModal :eventsToOpenModal=\"eventsToOpenModal\">\n <BaseEventButton :events=\"disableEvents\">Disable</BaseEventButton>\n <BaseEventButton :events=\"cancelEvents\">Cancel</BaseEventButton>\n </BaseEventsModal>\n </label>\n </div>\n</template>\n\n<script setup>\nimport { BaseEventButton, BaseEventsModal } from '@empathyco/x-components'\nimport { HistoryQueriesSwitch, HistoryQueries } from '@empathyco/x-components/history-queries'\nimport { SearchInput, SearchButton } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst eventsToOpenModal = ref(['UserClickedDisableHistoryQueries'])\nconst disableEvents = ref({\n UserClickedConfirmDisableHistoryQueries: undefined,\n UserClickedCloseEventsModal: undefined,\n})\nconst cancelEvents = ref({\n UserClickedCloseEventsModal: undefined,\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAkBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE;QACV,UAAU;AACX,KAAA;IACD,KAAK,GAAA;AACH,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,sBAAsB,CAAA;AAEhE,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;AAIE;QACF,MAAM,EAAE,SAAS,EAAE,cAAa,EAAE,GAAI,QAAQ,CAAC,gBAAgB,CAAA;AAE/D;;;;AAIE;AACF,QAAA,MAAM,iBAAgB,GAAI,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,KAAuB,CAAC,CAAA;QAE9F,MAAM,YAAW,GAAI,QAAQ,CAAC,MAC5B,iBAAiB,CAAC;AAChB,cAAE;cACA,yCAAyC,CAC/C;AAEA;;;;AAIE;QACF,MAAM,SAAS,MAAU;AACvB,YAAA,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAI,GAAI,YAAY,CAAC,KAAI,GAAI,iCAAiC,CAAA;AAClF,QAAA,CAAA;QAEA,OAAO;YACL,UAAU;YACV,MAAM;YACN,SAAS;SACX;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"history-query.vue.js","sources":["../../../../../src/x-modules/history-queries/components/history-query.vue"],"sourcesContent":["<template>\n <div class=\"x-history-query xds:suggestion-group\">\n <!--\n Click on the History Query suggestion\n @event click\n @property {Suggestion} suggestion - History Query suggestion data\n @property {MouseEvent} event - The original mouse event\n -->\n <BaseSuggestion\n v-slot=\"baseScope\"\n class=\"x-history-query__suggestion\"\n :class=\"suggestionClass\"\n v-bind=\"{ suggestion, suggestionSelectedEvents, query }\"\n data-test=\"history-query\"\n feature=\"history_query\"\n @click=\"$emit('click', suggestion, $event)\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot History Query content\n @binding {Object} v-bind - `BaseSuggestion` default slot scope: **suggestion** <code>Suggestion</code> - Suggestion data<br /> **query** <code>string</code> - The query that the suggestion belongs to<br /> **filter** <code>Filter or undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n <RemoveHistoryQuery\n class=\"x-history-query__remove xds:suggestion-group-button\"\n :class=\"removeButtonClass\"\n :history-query=\"suggestion\"\n :aria-label=\"ariaLabels?.removeButton\"\n data-test=\"remove-history-query\"\n >\n <!--\n @slot History Query remove button content\n @binding {Suggestion} suggestion - History Query suggestion data\n -->\n <slot name=\"remove-button-content\" v-bind=\"{ suggestion }\">✕</slot>\n </RemoveHistoryQuery>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery as HistoryQueryModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../../types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { ACCESSIBILITY_KEY } from '../../../types'\nimport { historyQueriesXModule } from '../x-module'\nimport RemoveHistoryQuery from './remove-history-query.vue'\n\n/**\n * This component renders a history query suggestion combining two buttons: one for selecting this\n * suggestion as the search query, and another one to remove this query suggestion from the\n * history queries.\n *\n * @public\n */\nexport default defineComponent({\n name: 'HistoryQuery',\n xModule: historyQueriesXModule.name,\n components: { RemoveHistoryQuery, BaseSuggestion },\n props: {\n /**\n * The history query suggestion to render.\n *\n * @public\n */\n suggestion: {\n type: Object as PropType<HistoryQueryModel>,\n required: true,\n },\n /** Class inherited by content element. */\n removeButtonClass: String,\n /** Class inherited by content element. */\n suggestionClass: String,\n },\n emits: ['click'],\n setup(props) {\n const { historyQuery: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n /**\n * The normalized query of the history-queries module.\n *\n * @internal\n */\n const query = useGetter('historyQueries').normalizedQuery\n\n /**\n * The list of events that are going to be emitted when the suggestion button is pressed.\n *\n * @internal\n * @returns The {@link XEvent} to emit.\n */\n const suggestionSelectedEvents = computed(\n (): Partial<XEventsTypes> => ({\n UserSelectedAHistoryQuery: props.suggestion,\n }),\n )\n\n return {\n ariaLabels,\n query,\n suggestionSelectedEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserSelectedAHistoryQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the history query\n data.\n\n## Examples\n\n### Basic usage\n\nThis component only requires a prop called `suggestion`.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\n### Customizing slots content\n\nSuggestion and remove buttons contents can be customized.\n\nThe default slot allows you to replace the content of the suggestion button. It has two properties,\nthe suggestion itself, and a `string` of HTML with the matched query.\n\nThe other slot is called `remove-button-content`, and allows you to set the content of the button\nthat serves to remove this query from the history. This slot only has one property, the suggestion.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <HistoryIcon />\n <Highlight highlight=\"tro\" :text=\"suggestion.query\" />\n </template>\n\n <template #remove-button-content=\"{ suggestion }\">\n <CrossIcon />\n </template>\n </HistoryQuery>\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { HistoryIcon, CrossIcon, Highlight } from '@empathyco/x-components'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\n### Customizing the content with classes\n\nThe `suggestionClass` prop can be used to add classes to the history query suggestion.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" suggestionClass=\"x-custom-class\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\nThe `removeButtonClass` prop can be used to add classes to the remove history query.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" removeButtonClass=\"x-custom-class\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_createVNode","_mergeProps","_withCtx","_renderSlot","_normalizeClass","_normalizeProps","_guardReactiveProps","_createTextVNode"],"mappings":";;;;AACO,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,sCAAA,EAAsC;;;;AAAjD,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAqCM,OArCN,UAAA,EAqCM;AAAA,IA9BJC,WAAA,CAgBiB,2BAhBjBC,UAAA,CAgBiB;AAAA,MAdf,KAAA,EAAK,CAAC,6BAAA,EACE,IAAA,CAAA,eAAe;AAAA,KAAA,EAAA,EAAA,UAAA,EACb,IAAA,CAAA,UAAA,EAAU,wBAAA,EAAE,IAAA,CAAA,wBAAA,EAAwB,KAAA,EAAE,IAAA,CAAA,KAAA,EAAK,EAAA;AAAA,MACrD,WAAA,EAAU,eAAA;AAAA,MACV,OAAA,EAAQ,eAAA;AAAA,MACP,OAAA,EAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,KAAA,CAAK,OAAA,EAAU,iBAAY,MAAM,CAAA;AAAA,KAAA,CAAA,EAAA;AAQzC,MAAA,OAAA,EAAAC,OAAA,CAAA,CAAkC,SAAA,KAdjB;AAAA,QAcjBC,UAAA,CAAkC,+DAAf,SAAA,EAAS,CAAA,CAAA;AAAA,OAAA,CAAA;;;;IAE9BH,WAAA,CAYqB,6BAAA,EAAA;AAAA,MAXnB,KAAA,EAAKI,cAAA,CAAA,CAAC,qDAAA,EACE,IAAA,CAAA,iBAAiB,CAAA,CAAA;AAAA,MACxB,eAAA,EAAe,IAAA,CAAA,UAAA;AAAA,MACf,cAAY,IAAA,CAAA,UAAA,EAAY,YAAA;AAAA,MACzB,WAAA,EAAU;AAAA,KAAA,EAAA;uBAMV,MAAmE;AAAA,QAAnED,UAAA,CAAmE,IAAA,CAAA,MAAA,EAAA,uBAAA,EAAAE,cAAA,CAAAC,kBAAA,CAAA,EAAA,UAAA,EAAtB,IAAA,CAAA,UAAA,EAAU,CAAA,CAAA,EAAvD,MAAmE;AAAA,UAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAC,eAAA;AAAR,YAAA,GAAA;AAAA,YAAC;AAAA;AAAA,WAAA;AAAA,SAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"history-query.vue.js","sources":["../../../../../src/x-modules/history-queries/components/history-query.vue"],"sourcesContent":["<template>\n <div class=\"x-history-query xds:suggestion-group\">\n <!--\n Click on the History Query suggestion\n @event click\n @property {Suggestion} suggestion - History Query suggestion data\n @property {MouseEvent} event - The original mouse event\n -->\n <BaseSuggestion\n v-slot=\"baseScope\"\n class=\"x-history-query__suggestion\"\n :class=\"suggestionClass\"\n v-bind=\"{ suggestion, suggestionSelectedEvents, query }\"\n data-test=\"history-query\"\n feature=\"history_query\"\n @click=\"$emit('click', suggestion, $event)\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot History Query content\n @binding {Object} v-bind - `BaseSuggestion` default slot scope: **suggestion** <code>Suggestion</code> - Suggestion data<br /> **query** <code>string</code> - The query that the suggestion belongs to<br /> **filter** <code>Filter or undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n <RemoveHistoryQuery\n class=\"x-history-query__remove xds:suggestion-group-button\"\n :class=\"removeButtonClass\"\n :history-query=\"suggestion\"\n :aria-label=\"ariaLabels?.removeButton\"\n data-test=\"remove-history-query\"\n >\n <!--\n @slot History Query remove button content\n @binding {Suggestion} suggestion - History Query suggestion data\n -->\n <slot name=\"remove-button-content\" v-bind=\"{ suggestion }\">✕</slot>\n </RemoveHistoryQuery>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery as HistoryQueryModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useAccessibilityLabels } from '../../../composables'\nimport { useGetter } from '../../../composables/use-getter'\nimport { historyQueriesXModule } from '../x-module'\nimport RemoveHistoryQuery from './remove-history-query.vue'\n\n/**\n * This component renders a history query suggestion combining two buttons: one for selecting this\n * suggestion as the search query, and another one to remove this query suggestion from the\n * history queries.\n *\n * @public\n */\nexport default defineComponent({\n name: 'HistoryQuery',\n xModule: historyQueriesXModule.name,\n components: { RemoveHistoryQuery, BaseSuggestion },\n props: {\n /**\n * The history query suggestion to render.\n *\n * @public\n */\n suggestion: {\n type: Object as PropType<HistoryQueryModel>,\n required: true,\n },\n /** Class inherited by content element. */\n removeButtonClass: String,\n /** Class inherited by content element. */\n suggestionClass: String,\n },\n emits: ['click'],\n setup(props) {\n const ariaLabels = useAccessibilityLabels('historyQuery')\n\n /**\n * The normalized query of the history-queries module.\n *\n * @internal\n */\n const query = useGetter('historyQueries').normalizedQuery\n\n /**\n * The list of events that are going to be emitted when the suggestion button is pressed.\n *\n * @internal\n * @returns The {@link XEvent} to emit.\n */\n const suggestionSelectedEvents = computed(\n (): Partial<XEventsTypes> => ({\n UserSelectedAHistoryQuery: props.suggestion,\n }),\n )\n\n return {\n ariaLabels,\n query,\n suggestionSelectedEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserSelectedAHistoryQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the history query\n data.\n\n## Examples\n\n### Basic usage\n\nThis component only requires a prop called `suggestion`.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\n### Customizing slots content\n\nSuggestion and remove buttons contents can be customized.\n\nThe default slot allows you to replace the content of the suggestion button. It has two properties,\nthe suggestion itself, and a `string` of HTML with the matched query.\n\nThe other slot is called `remove-button-content`, and allows you to set the content of the button\nthat serves to remove this query from the history. This slot only has one property, the suggestion.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <HistoryIcon />\n <Highlight highlight=\"tro\" :text=\"suggestion.query\" />\n </template>\n\n <template #remove-button-content=\"{ suggestion }\">\n <CrossIcon />\n </template>\n </HistoryQuery>\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { HistoryIcon, CrossIcon, Highlight } from '@empathyco/x-components'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\n### Customizing the content with classes\n\nThe `suggestionClass` prop can be used to add classes to the history query suggestion.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" suggestionClass=\"x-custom-class\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\nThe `removeButtonClass` prop can be used to add classes to the remove history query.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" removeButtonClass=\"x-custom-class\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_createVNode","_mergeProps","_withCtx","_renderSlot","_normalizeClass","_normalizeProps","_guardReactiveProps","_createTextVNode"],"mappings":";;;;AACO,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,sCAAA,EAAsC;;;;AAAjD,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAqCM,OArCN,UAAA,EAqCM;AAAA,IA9BJC,WAAA,CAgBiB,2BAhBjBC,UAAA,CAgBiB;AAAA,MAdf,KAAA,EAAK,CAAC,6BAAA,EACE,IAAA,CAAA,eAAe;AAAA,KAAA,EAAA,EAAA,UAAA,EACb,IAAA,CAAA,UAAA,EAAU,wBAAA,EAAE,IAAA,CAAA,wBAAA,EAAwB,KAAA,EAAE,IAAA,CAAA,KAAA,EAAK,EAAA;AAAA,MACrD,WAAA,EAAU,eAAA;AAAA,MACV,OAAA,EAAQ,eAAA;AAAA,MACP,OAAA,EAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,KAAA,CAAK,OAAA,EAAU,iBAAY,MAAM,CAAA;AAAA,KAAA,CAAA,EAAA;AAQzC,MAAA,OAAA,EAAAC,OAAA,CAAA,CAAkC,SAAA,KAdjB;AAAA,QAcjBC,UAAA,CAAkC,+DAAf,SAAA,EAAS,CAAA,CAAA;AAAA,OAAA,CAAA;;;;IAE9BH,WAAA,CAYqB,6BAAA,EAAA;AAAA,MAXnB,KAAA,EAAKI,cAAA,CAAA,CAAC,qDAAA,EACE,IAAA,CAAA,iBAAiB,CAAA,CAAA;AAAA,MACxB,eAAA,EAAe,IAAA,CAAA,UAAA;AAAA,MACf,cAAY,IAAA,CAAA,UAAA,EAAY,YAAA;AAAA,MACzB,WAAA,EAAU;AAAA,KAAA,EAAA;uBAMV,MAAmE;AAAA,QAAnED,UAAA,CAAmE,IAAA,CAAA,MAAA,EAAA,uBAAA,EAAAE,cAAA,CAAAC,kBAAA,CAAA,EAAA,UAAA,EAAtB,IAAA,CAAA,UAAA,EAAU,CAAA,CAAA,EAAvD,MAAmE;AAAA,UAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAC,eAAA;AAAR,YAAA,GAAA;AAAA,YAAC;AAAA;AAAA,WAAA;AAAA,SAAA;;;;;;;;;;;"}
@@ -1,7 +1,14 @@
1
- import { defineComponent, inject, computed } from 'vue';
1
+ import { defineComponent, computed } from 'vue';
2
2
  import BaseSuggestion from '../../../components/suggestions/base-suggestion.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';
3
10
  import { useGetter } from '../../../composables/use-getter.js';
4
- import { ACCESSIBILITY_KEY } from '../../../types/accessibility.js';
11
+ import '@vueuse/core';
5
12
  import { historyQueriesXModule } from '../x-module.js';
6
13
  import RemoveHistoryQuery from './remove-history-query.vue.js';
7
14
 
@@ -33,7 +40,7 @@ var _sfc_main = defineComponent({
33
40
  },
34
41
  emits: ['click'],
35
42
  setup(props) {
36
- const { historyQuery: ariaLabels } = inject(ACCESSIBILITY_KEY);
43
+ const ariaLabels = useAccessibilityLabels('historyQuery');
37
44
  /**
38
45
  * The normalized query of the history-queries module.
39
46
  *
@@ -1 +1 @@
1
- {"version":3,"file":"history-query.vue2.js","sources":["../../../../../src/x-modules/history-queries/components/history-query.vue"],"sourcesContent":["<template>\n <div class=\"x-history-query xds:suggestion-group\">\n <!--\n Click on the History Query suggestion\n @event click\n @property {Suggestion} suggestion - History Query suggestion data\n @property {MouseEvent} event - The original mouse event\n -->\n <BaseSuggestion\n v-slot=\"baseScope\"\n class=\"x-history-query__suggestion\"\n :class=\"suggestionClass\"\n v-bind=\"{ suggestion, suggestionSelectedEvents, query }\"\n data-test=\"history-query\"\n feature=\"history_query\"\n @click=\"$emit('click', suggestion, $event)\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot History Query content\n @binding {Object} v-bind - `BaseSuggestion` default slot scope: **suggestion** <code>Suggestion</code> - Suggestion data<br /> **query** <code>string</code> - The query that the suggestion belongs to<br /> **filter** <code>Filter or undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n <RemoveHistoryQuery\n class=\"x-history-query__remove xds:suggestion-group-button\"\n :class=\"removeButtonClass\"\n :history-query=\"suggestion\"\n :aria-label=\"ariaLabels?.removeButton\"\n data-test=\"remove-history-query\"\n >\n <!--\n @slot History Query remove button content\n @binding {Suggestion} suggestion - History Query suggestion data\n -->\n <slot name=\"remove-button-content\" v-bind=\"{ suggestion }\">✕</slot>\n </RemoveHistoryQuery>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery as HistoryQueryModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../../types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { ACCESSIBILITY_KEY } from '../../../types'\nimport { historyQueriesXModule } from '../x-module'\nimport RemoveHistoryQuery from './remove-history-query.vue'\n\n/**\n * This component renders a history query suggestion combining two buttons: one for selecting this\n * suggestion as the search query, and another one to remove this query suggestion from the\n * history queries.\n *\n * @public\n */\nexport default defineComponent({\n name: 'HistoryQuery',\n xModule: historyQueriesXModule.name,\n components: { RemoveHistoryQuery, BaseSuggestion },\n props: {\n /**\n * The history query suggestion to render.\n *\n * @public\n */\n suggestion: {\n type: Object as PropType<HistoryQueryModel>,\n required: true,\n },\n /** Class inherited by content element. */\n removeButtonClass: String,\n /** Class inherited by content element. */\n suggestionClass: String,\n },\n emits: ['click'],\n setup(props) {\n const { historyQuery: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n /**\n * The normalized query of the history-queries module.\n *\n * @internal\n */\n const query = useGetter('historyQueries').normalizedQuery\n\n /**\n * The list of events that are going to be emitted when the suggestion button is pressed.\n *\n * @internal\n * @returns The {@link XEvent} to emit.\n */\n const suggestionSelectedEvents = computed(\n (): Partial<XEventsTypes> => ({\n UserSelectedAHistoryQuery: props.suggestion,\n }),\n )\n\n return {\n ariaLabels,\n query,\n suggestionSelectedEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserSelectedAHistoryQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the history query\n data.\n\n## Examples\n\n### Basic usage\n\nThis component only requires a prop called `suggestion`.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\n### Customizing slots content\n\nSuggestion and remove buttons contents can be customized.\n\nThe default slot allows you to replace the content of the suggestion button. It has two properties,\nthe suggestion itself, and a `string` of HTML with the matched query.\n\nThe other slot is called `remove-button-content`, and allows you to set the content of the button\nthat serves to remove this query from the history. This slot only has one property, the suggestion.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <HistoryIcon />\n <Highlight highlight=\"tro\" :text=\"suggestion.query\" />\n </template>\n\n <template #remove-button-content=\"{ suggestion }\">\n <CrossIcon />\n </template>\n </HistoryQuery>\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { HistoryIcon, CrossIcon, Highlight } from '@empathyco/x-components'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\n### Customizing the content with classes\n\nThe `suggestionClass` prop can be used to add classes to the history query suggestion.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" suggestionClass=\"x-custom-class\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\nThe `removeButtonClass` prop can be used to add classes to the remove history query.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" removeButtonClass=\"x-custom-class\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;AAqDA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE,EAAE,kBAAkB,EAAE,gBAAgB;AAClD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,MAAqC;AAC3C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;;AAED,QAAA,iBAAiB,EAAE,MAAM;;AAEzB,QAAA,eAAe,EAAE,MAAM;AACxB,KAAA;IACD,KAAK,EAAE,CAAC,OAAO,CAAC;AAChB,IAAA,KAAK,CAAC,KAAK,EAAA;QACT,MAAM,EAAE,YAAY,EAAE,UAAS,EAAE,GAAI,MAAM,CAAC,iBAAiB,CAAc;AAE3E;;;;AAIE;QACF,MAAM,KAAI,GAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC,eAAc;AAExD;;;;;AAKE;AACF,QAAA,MAAM,wBAAuB,GAAI,QAAQ,CACvC,OAA8B;YAC5B,yBAAyB,EAAE,KAAK,CAAC,UAAU;AAC5C,SAAA,CAAC,CACJ;QAEA,OAAO;YACL,UAAU;YACV,KAAK;YACL,wBAAwB;SAC1B;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"history-query.vue2.js","sources":["../../../../../src/x-modules/history-queries/components/history-query.vue"],"sourcesContent":["<template>\n <div class=\"x-history-query xds:suggestion-group\">\n <!--\n Click on the History Query suggestion\n @event click\n @property {Suggestion} suggestion - History Query suggestion data\n @property {MouseEvent} event - The original mouse event\n -->\n <BaseSuggestion\n v-slot=\"baseScope\"\n class=\"x-history-query__suggestion\"\n :class=\"suggestionClass\"\n v-bind=\"{ suggestion, suggestionSelectedEvents, query }\"\n data-test=\"history-query\"\n feature=\"history_query\"\n @click=\"$emit('click', suggestion, $event)\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot History Query content\n @binding {Object} v-bind - `BaseSuggestion` default slot scope: **suggestion** <code>Suggestion</code> - Suggestion data<br /> **query** <code>string</code> - The query that the suggestion belongs to<br /> **filter** <code>Filter or undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n <RemoveHistoryQuery\n class=\"x-history-query__remove xds:suggestion-group-button\"\n :class=\"removeButtonClass\"\n :history-query=\"suggestion\"\n :aria-label=\"ariaLabels?.removeButton\"\n data-test=\"remove-history-query\"\n >\n <!--\n @slot History Query remove button content\n @binding {Suggestion} suggestion - History Query suggestion data\n -->\n <slot name=\"remove-button-content\" v-bind=\"{ suggestion }\">✕</slot>\n </RemoveHistoryQuery>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery as HistoryQueryModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useAccessibilityLabels } from '../../../composables'\nimport { useGetter } from '../../../composables/use-getter'\nimport { historyQueriesXModule } from '../x-module'\nimport RemoveHistoryQuery from './remove-history-query.vue'\n\n/**\n * This component renders a history query suggestion combining two buttons: one for selecting this\n * suggestion as the search query, and another one to remove this query suggestion from the\n * history queries.\n *\n * @public\n */\nexport default defineComponent({\n name: 'HistoryQuery',\n xModule: historyQueriesXModule.name,\n components: { RemoveHistoryQuery, BaseSuggestion },\n props: {\n /**\n * The history query suggestion to render.\n *\n * @public\n */\n suggestion: {\n type: Object as PropType<HistoryQueryModel>,\n required: true,\n },\n /** Class inherited by content element. */\n removeButtonClass: String,\n /** Class inherited by content element. */\n suggestionClass: String,\n },\n emits: ['click'],\n setup(props) {\n const ariaLabels = useAccessibilityLabels('historyQuery')\n\n /**\n * The normalized query of the history-queries module.\n *\n * @internal\n */\n const query = useGetter('historyQueries').normalizedQuery\n\n /**\n * The list of events that are going to be emitted when the suggestion button is pressed.\n *\n * @internal\n * @returns The {@link XEvent} to emit.\n */\n const suggestionSelectedEvents = computed(\n (): Partial<XEventsTypes> => ({\n UserSelectedAHistoryQuery: props.suggestion,\n }),\n )\n\n return {\n ariaLabels,\n query,\n suggestionSelectedEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserSelectedAHistoryQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the history query\n data.\n\n## Examples\n\n### Basic usage\n\nThis component only requires a prop called `suggestion`.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\n### Customizing slots content\n\nSuggestion and remove buttons contents can be customized.\n\nThe default slot allows you to replace the content of the suggestion button. It has two properties,\nthe suggestion itself, and a `string` of HTML with the matched query.\n\nThe other slot is called `remove-button-content`, and allows you to set the content of the button\nthat serves to remove this query from the history. This slot only has one property, the suggestion.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <HistoryIcon />\n <Highlight highlight=\"tro\" :text=\"suggestion.query\" />\n </template>\n\n <template #remove-button-content=\"{ suggestion }\">\n <CrossIcon />\n </template>\n </HistoryQuery>\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { HistoryIcon, CrossIcon, Highlight } from '@empathyco/x-components'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\n### Customizing the content with classes\n\nThe `suggestionClass` prop can be used to add classes to the history query suggestion.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" suggestionClass=\"x-custom-class\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n\nThe `removeButtonClass` prop can be used to add classes to the remove history query.\n\n```vue live\n<template>\n <HistoryQuery :suggestion=\"suggestion\" removeButtonClass=\"x-custom-class\" />\n</template>\n\n<script setup>\nimport { HistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst suggestion = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAoDA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE,EAAE,kBAAkB,EAAE,gBAAgB;AAClD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,MAAqC;AAC3C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;;AAED,QAAA,iBAAiB,EAAE,MAAM;;AAEzB,QAAA,eAAe,EAAE,MAAM;AACxB,KAAA;IACD,KAAK,EAAE,CAAC,OAAO,CAAC;AAChB,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,cAAc,CAAA;AAExD;;;;AAIE;QACF,MAAM,KAAI,GAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC,eAAc;AAExD;;;;;AAKE;AACF,QAAA,MAAM,wBAAuB,GAAI,QAAQ,CACvC,OAA8B;YAC5B,yBAAyB,EAAE,KAAK,CAAC,UAAU;AAC5C,SAAA,CAAC,CACJ;QAEA,OAAO;YACL,UAAU;YACV,KAAK;YACL,wBAAwB;SAC1B;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"remove-history-query.vue.js","sources":["../../../../../src/x-modules/history-queries/components/remove-history-query.vue"],"sourcesContent":["<template>\n <BaseEventButton\n class=\"x-remove-history-query\"\n :events=\"removeHistoryQueryEvent\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../../types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../../../components/base-event-button.vue'\nimport { ACCESSIBILITY_KEY } from '../../../types'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * Button that when it is pressed emits the\n * {@link HistoryQueriesXEvents.UserPressedRemoveHistoryQuery} event, expressing the user\n * intention to remove a query in the history.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RemoveHistoryQuery',\n xModule: historyQueriesXModule.name,\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * The historyQuery that will be removed when clicking the clear button.\n *\n * @public\n */\n historyQuery: {\n type: Object as PropType<HistoryQuery>,\n required: true,\n },\n },\n setup(props) {\n const { removeHistoryQuery: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n /**\n * The event handler that will be triggered when clicking on the clear history query button.\n *\n * @remarks\n * {@link HistoryQueriesXEvents.UserPressedRemoveHistoryQuery}: historyQuery\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const removeHistoryQueryEvent = computed(\n (): Partial<XEventsTypes> => ({ UserPressedRemoveHistoryQuery: props.historyQuery }),\n )\n\n return {\n ariaLabels,\n removeHistoryQueryEvent,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserPressedRemoveHistoryQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the history query\n data.\n\n## Examples\n\n### Basic Example\n\nYou can customize the content that this component renders. To do so, simply use the default slot.\n\n```vue\n<template>\n <RemoveHistoryQuery :historyQuery=\"historyQuery\">\n <img class=\"x-history-query__icon\" src=\"./my-awesome-clear-icon.svg\" />\n </RemoveHistoryQuery>\n</template>\n\n<script setup>\nimport { RemoveHistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst historyQuery = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAAA,CAOkB,0BAAA,EAAA;AAAA,IANhB,KAAA,EAAM,wBAAA;AAAA,IACL,MAAA,EAAQ,IAAA,CAAA,uBAAA;AAAA,IACR,cAAY,IAAA,CAAA,UAAA,EAAY;AAAA,GAAA,EAAA;qBAGzB,MAAQ;AAAA,MAARC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
1
+ {"version":3,"file":"remove-history-query.vue.js","sources":["../../../../../src/x-modules/history-queries/components/remove-history-query.vue"],"sourcesContent":["<template>\n <BaseEventButton\n class=\"x-remove-history-query\"\n :events=\"removeHistoryQueryEvent\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\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 { historyQueriesXModule } from '../x-module'\n\n/**\n * Button that when it is pressed emits the\n * {@link HistoryQueriesXEvents.UserPressedRemoveHistoryQuery} event, expressing the user\n * intention to remove a query in the history.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RemoveHistoryQuery',\n xModule: historyQueriesXModule.name,\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * The historyQuery that will be removed when clicking the clear button.\n *\n * @public\n */\n historyQuery: {\n type: Object as PropType<HistoryQuery>,\n required: true,\n },\n },\n setup(props) {\n const ariaLabels = useAccessibilityLabels('removeHistoryQuery')\n\n /**\n * The event handler that will be triggered when clicking on the clear history query button.\n *\n * @remarks\n * {@link HistoryQueriesXEvents.UserPressedRemoveHistoryQuery}: historyQuery\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const removeHistoryQueryEvent = computed(\n (): Partial<XEventsTypes> => ({ UserPressedRemoveHistoryQuery: props.historyQuery }),\n )\n\n return {\n ariaLabels,\n removeHistoryQueryEvent,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserPressedRemoveHistoryQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the history query\n data.\n\n## Examples\n\n### Basic Example\n\nYou can customize the content that this component renders. To do so, simply use the default slot.\n\n```vue\n<template>\n <RemoveHistoryQuery :historyQuery=\"historyQuery\">\n <img class=\"x-history-query__icon\" src=\"./my-awesome-clear-icon.svg\" />\n </RemoveHistoryQuery>\n</template>\n\n<script setup>\nimport { RemoveHistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst historyQuery = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAAA,CAOkB,0BAAA,EAAA;AAAA,IANhB,KAAA,EAAM,wBAAA;AAAA,IACL,MAAA,EAAQ,IAAA,CAAA,uBAAA;AAAA,IACR,cAAY,IAAA,CAAA,UAAA,EAAY;AAAA,GAAA,EAAA;qBAGzB,MAAQ;AAAA,MAARC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
@@ -1,6 +1,13 @@
1
- import { defineComponent, inject, computed } from 'vue';
1
+ import { defineComponent, computed } from 'vue';
2
2
  import BaseEventButton from '../../../components/base-event-button.vue.js';
3
- import { ACCESSIBILITY_KEY } from '../../../types/accessibility.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';
4
11
  import { historyQueriesXModule } from '../x-module.js';
5
12
 
6
13
  /**
@@ -28,7 +35,7 @@ var _sfc_main = defineComponent({
28
35
  },
29
36
  },
30
37
  setup(props) {
31
- const { removeHistoryQuery: ariaLabels } = inject(ACCESSIBILITY_KEY);
38
+ const ariaLabels = useAccessibilityLabels('removeHistoryQuery');
32
39
  /**
33
40
  * The event handler that will be triggered when clicking on the clear history query button.
34
41
  *
@@ -1 +1 @@
1
- {"version":3,"file":"remove-history-query.vue2.js","sources":["../../../../../src/x-modules/history-queries/components/remove-history-query.vue"],"sourcesContent":["<template>\n <BaseEventButton\n class=\"x-remove-history-query\"\n :events=\"removeHistoryQueryEvent\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { AriaLabels } from '../../../types'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../../../components/base-event-button.vue'\nimport { ACCESSIBILITY_KEY } from '../../../types'\nimport { historyQueriesXModule } from '../x-module'\n\n/**\n * Button that when it is pressed emits the\n * {@link HistoryQueriesXEvents.UserPressedRemoveHistoryQuery} event, expressing the user\n * intention to remove a query in the history.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RemoveHistoryQuery',\n xModule: historyQueriesXModule.name,\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * The historyQuery that will be removed when clicking the clear button.\n *\n * @public\n */\n historyQuery: {\n type: Object as PropType<HistoryQuery>,\n required: true,\n },\n },\n setup(props) {\n const { removeHistoryQuery: ariaLabels } = inject(ACCESSIBILITY_KEY) as AriaLabels\n\n /**\n * The event handler that will be triggered when clicking on the clear history query button.\n *\n * @remarks\n * {@link HistoryQueriesXEvents.UserPressedRemoveHistoryQuery}: historyQuery\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const removeHistoryQueryEvent = computed(\n (): Partial<XEventsTypes> => ({ UserPressedRemoveHistoryQuery: props.historyQuery }),\n )\n\n return {\n ariaLabels,\n removeHistoryQueryEvent,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserPressedRemoveHistoryQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the history query\n data.\n\n## Examples\n\n### Basic Example\n\nYou can customize the content that this component renders. To do so, simply use the default slot.\n\n```vue\n<template>\n <RemoveHistoryQuery :historyQuery=\"historyQuery\">\n <img class=\"x-history-query__icon\" src=\"./my-awesome-clear-icon.svg\" />\n </RemoveHistoryQuery>\n</template>\n\n<script setup>\nimport { RemoveHistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst historyQuery = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAqBA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE;QACV,eAAe;AAChB,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAgC;AACtC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;QACT,MAAM,EAAE,kBAAkB,EAAE,UAAS,EAAE,GAAI,MAAM,CAAC,iBAAiB,CAAc;AAEjF;;;;;;;;AAQE;AACF,QAAA,MAAM,uBAAsB,GAAI,QAAQ,CACtC,OAA8B,EAAE,6BAA6B,EAAE,KAAK,CAAC,YAAW,EAAG,CAAC,CACtF;QAEA,OAAO;YACL,UAAU;YACV,uBAAuB;SACzB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"remove-history-query.vue2.js","sources":["../../../../../src/x-modules/history-queries/components/remove-history-query.vue"],"sourcesContent":["<template>\n <BaseEventButton\n class=\"x-remove-history-query\"\n :events=\"removeHistoryQueryEvent\"\n :aria-label=\"ariaLabels?.button\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { HistoryQuery } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\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 { historyQueriesXModule } from '../x-module'\n\n/**\n * Button that when it is pressed emits the\n * {@link HistoryQueriesXEvents.UserPressedRemoveHistoryQuery} event, expressing the user\n * intention to remove a query in the history.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RemoveHistoryQuery',\n xModule: historyQueriesXModule.name,\n components: {\n BaseEventButton,\n },\n props: {\n /**\n * The historyQuery that will be removed when clicking the clear button.\n *\n * @public\n */\n historyQuery: {\n type: Object as PropType<HistoryQuery>,\n required: true,\n },\n },\n setup(props) {\n const ariaLabels = useAccessibilityLabels('removeHistoryQuery')\n\n /**\n * The event handler that will be triggered when clicking on the clear history query button.\n *\n * @remarks\n * {@link HistoryQueriesXEvents.UserPressedRemoveHistoryQuery}: historyQuery\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const removeHistoryQueryEvent = computed(\n (): Partial<XEventsTypes> => ({ UserPressedRemoveHistoryQuery: props.historyQuery }),\n )\n\n return {\n ariaLabels,\n removeHistoryQueryEvent,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserPressedRemoveHistoryQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the history query\n data.\n\n## Examples\n\n### Basic Example\n\nYou can customize the content that this component renders. To do so, simply use the default slot.\n\n```vue\n<template>\n <RemoveHistoryQuery :historyQuery=\"historyQuery\">\n <img class=\"x-history-query__icon\" src=\"./my-awesome-clear-icon.svg\" />\n </RemoveHistoryQuery>\n</template>\n\n<script setup>\nimport { RemoveHistoryQuery } from '@empathyco/x-components/history-queries'\nimport { ref } from 'vue'\n\nconst historyQuery = ref({\n modelName: 'HistoryQuery',\n query: 'trousers',\n facets: [],\n})\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;AAoBA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE;QACV,eAAe;AAChB,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAgC;AACtC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,aAAa,sBAAsB,CAAC,oBAAoB,CAAA;AAE9D;;;;;;;;AAQE;AACF,QAAA,MAAM,uBAAsB,GAAI,QAAQ,CACtC,OAA8B,EAAE,6BAA6B,EAAE,KAAK,CAAC,YAAW,EAAG,CAAC,CACtF;QAEA,OAAO;YACL,UAAU;YACV,uBAAuB;SACzB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -5,6 +5,7 @@ import '../../../plugins/x-bus.js';
5
5
  import '@empathyco/x-utils';
6
6
  import '../../../plugins/x-plugin.js';
7
7
  import 'rxjs';
8
+ import '../../../utils/storage.js';
8
9
  import '@vueuse/core';
9
10
  import { useState } from '../../../composables/use-state.js';
10
11
  import { AnimationProp } from '../../../types/animation-prop.js';
@@ -1 +1 @@
1
- {"version":3,"file":"query-preview-list.vue2.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-list.vue"],"sourcesContent":["<template>\n <component :is=\"animation\" class=\"x-query-preview-list\" tag=\"ul\">\n <li\n v-for=\"(queryPreview, index) in renderedQueryPreviews\"\n :key=\"index\"\n :class=\"{ 'padding-block-1': loadWhenVisible }\"\n :data-query-preview-hash=\"\n getHashFromQueryPreviewInfo(queryPreview, { ...params, ...queryPreview.extraParams })\n \"\n data-test=\"query-preview-item\"\n >\n <QueryPreview\n :debounce-time-ms=\"debounceTimeMs\"\n :load-when-visible=\"loadWhenVisible\"\n :max-items-to-render=\"maxItemsToRender\"\n :persist-in-cache=\"persistInCache\"\n :query-feature=\"queryFeature\"\n :query-preview-info=\"queryPreview\"\n @load=\"flagAsLoaded\"\n @error=\"flagAsFailed\"\n >\n <template v-for=\"(_, slotName) in $slots\" #[slotName]=\"scope\">\n <slot :name=\"slotName\" v-bind=\"scope\" />\n </template>\n </QueryPreview>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { RequestStatus } from '../../../store'\nimport type { QueryFeature } from '../../../types'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { useState } from '../../../composables/index'\nimport { AnimationProp } from '../../../types'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\nimport QueryPreview from './query-preview.vue'\n\ninterface QueryPreviewStatusRecord {\n [query: string]: RequestStatus\n}\n\n/**\n * Renders the results previews of a list of objects with the information about the query preview,\n * and exposes the {@link QueryPreview} slots to modify the content.\n * The requests are made in sequential order.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewList',\n xModule: queriesPreviewXModule.name,\n components: { QueryPreview },\n props: {\n /**\n * The list of queries preview to render.\n *\n * @public\n */\n queriesPreviewInfo: {\n type: Array as PropType<QueryPreviewInfo[]>,\n required: true,\n },\n /**\n * The origin property for the request on each query preview.\n *\n * @public\n */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /**\n * Number of query preview results to be rendered on each query preview.\n *\n * @public\n */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Controls whether the query preview requests should be triggered when the component is visible in the viewport.\n *\n * @public\n */\n loadWhenVisible: {\n type: Boolean,\n default: false,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests\n * on each query preview.\n *\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether all the QueryPreview should be removed from the state\n * when the component is destroyed.\n *\n * @public\n */\n persistInCache: Boolean,\n /**\n * Animation component that will be used to animate the elements.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n },\n setup(props) {\n const { params } = useState('queriesPreview')\n\n /**\n * Contains the status of the preview requests, indexed by query.\n */\n const queriesStatus = ref<QueryPreviewStatusRecord>({})\n\n /**\n * The list of queries to preview.\n *\n * @returns The list of queries in the queriesPreviewInfo list.\n * @internal\n */\n const queries = computed((): string[] =>\n props.queriesPreviewInfo.map(item =>\n getHashFromQueryPreviewInfo(item, { ...params.value, ...item.extraParams }),\n ),\n )\n\n /**\n * Gets all the queries to render, that are those that don't have an `error` status.\n *\n * @returns A list of queries.\n * @internal\n */\n const renderedQueryPreviews = computed((): QueryPreviewInfo[] => {\n return props.queriesPreviewInfo.filter(item => {\n const queryPreviewHash = getHashFromQueryPreviewInfo(item, {\n ...params.value,\n ...item.extraParams,\n })\n return (\n queriesStatus.value[queryPreviewHash] === 'success' ||\n queriesStatus.value[queryPreviewHash] === 'loading'\n )\n })\n })\n\n /**\n * Tries to load the next query.\n *\n * @internal\n */\n const loadNext = (): void => {\n const queryToLoad = queries.value.find(query => !(query in queriesStatus.value))\n if (queryToLoad) {\n queriesStatus.value[queryToLoad] = 'loading'\n }\n }\n\n /**\n * Resets the status of all queries if they change.\n *\n * @param newQueries - The new queries.\n * @param oldQueries - The old queries.\n * @internal\n */\n watch(\n queries,\n (newQueries: string[], oldQueries: string[] | undefined) => {\n if (newQueries.toString() !== oldQueries?.toString()) {\n for (const key of Object.keys(queriesStatus.value)) {\n if (!newQueries.includes(key)) {\n delete queriesStatus.value[key]\n }\n }\n loadNext()\n }\n },\n { immediate: true, deep: true },\n )\n\n /**\n * Sets the status of a given query to `success`.\n *\n * @param loadedQuery - The query to flag as loaded.\n * @internal\n */\n const flagAsLoaded = (loadedQuery: string): void => {\n queriesStatus.value[loadedQuery] = 'success'\n loadNext()\n }\n\n /**\n * Sets the status of a given query to `error`.\n *\n * @param failedQuery - The query to flag as failed.\n * @internal\n */\n const flagAsFailed = (failedQuery: string): void => {\n queriesStatus.value[failedQuery] = 'error'\n loadNext()\n }\n\n return {\n params,\n renderedQueryPreviews,\n flagAsFailed,\n flagAsLoaded,\n getHashFromQueryPreviewInfo,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.padding-block-1 {\n padding-block: 1px;\n}\n</style>\n\n<docs lang=\"mdx\">\n## See it in action\n\nHere you have a basic example of how the QueryPreviewList is rendered. Keep in mind that this\ncomponent is intended to be used overriding its default slot. By default it will only render the\nnames of the results.\n\n```vue live\n<template>\n <QueryPreviewList :queriesPreviewInfo=\"queriesPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queriesPreviewInfo = reactive([\n { query: 'sandals' },\n { query: 'tshirt' },\n { query: 'jacket' },\n])\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreviewList\n :queriesPreviewInfo=\"queriesPreviewInfo\"\n #default=\"{ queryPreviewInfo, totalResults, results }\"\n >\n <div class=\"x-flex x-flex-col x-gap-8 x-mb-16\">\n <h1 class=\"x-title2\">{{ queryPreviewInfo.query }} ({{ totalResults }})</h1>\n <SlidingPanel :resetOnContentChange=\"false\">\n <div class=\"x-flex x-gap-8\">\n <Result\n v-for=\"result in results\"\n :key=\"result.id\"\n :result=\"result\"\n style=\"max-width: 180px\"\n />\n </div>\n </SlidingPanel>\n </div>\n </QueryPreviewList>\n</template>\n\n<script setup>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport SlidingPanel from '@empathyco/x-components/sliding-panel.vue'\nimport Result from '@empathyco/x-components/result.vue'\nimport { reactive } from 'vue'\nconst queriesPreviewInfo = reactive([\n { query: 'sandals' },\n { query: 'tshirt' },\n { query: 'jacket' },\n])\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreviewList\n class=\"x-flex x-gap-8\"\n :queriesPreviewInfo=\"queriesPreviewInfo\"\n #result=\"{ result }\"\n >\n <span class=\"x-font-bold\">{{ result.id }}:</span>\n <span>{{ result.name }}</span>\n </QueryPreviewList>\n</template>\n\n<script setup>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queriesPreviewInfo = reactive([\n { query: 'sandals' },\n { query: 'tshirt' },\n { query: 'jacket' },\n])\n</script>\n```\n\n### Play with vendor results and vendor banners\n\nThe `VendorResultsList` and `VendorBannersList` components can be used inside the default slot of\nthe `QueryPreviewList`, so the vendor results and vendor banners provided for each query are\ninserted within its results. The order of the nested components defines the merge strategy.\n\n```vue\n<template>\n <QueryPreviewList :queriesPreviewInfo=\"queriesPreviewInfo\" #default=\"{ queryPreviewHash }\">\n <VendorResultsList :queryPreviewHash=\"queryPreviewHash\">\n <VendorBannersList :queryPreviewHash=\"queryPreviewHash\">\n <BaseGrid>\n <template #result=\"{ item }\">\n <span>Result: {{ item.id }}</span>\n </template>\n <template #vendor-result=\"{ item }\">\n <span>Vendor result: {{ item.id }}</span>\n </template>\n <template #vendor-banner=\"{ item }\">\n <span>Vendor banner: {{ item.id }}</span>\n </template>\n </BaseGrid>\n </VendorBannersList>\n </VendorResultsList>\n </QueryPreviewList>\n</template>\n\n<script setup>\nimport { BaseGrid } from '@empathyco/x-components'\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport { VendorBannersList, VendorResultsList } from '@empathyco/x-components/vendor'\nimport { reactive } from 'vue'\nconst queriesPreviewInfo = reactive([\n { query: 'sandals' },\n { query: 'tshirt' },\n { query: 'jacket' },\n])\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA6CA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,qBAAqB,CAAC,IAAI;IACnC,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,kBAAkB,EAAE;AAClB,YAAA,IAAI,EAAE,KAAqC;AAC3C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAgC;AACvC,SAAA;AACD;;;;AAIE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACD;;;;AAIE;AACF,QAAA,eAAe,EAAE;AACf,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;AACD;;;;;;AAME;AACF,QAAA,cAAc,EAAE;AACd,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;AACD;;;;;AAKE;AACF,QAAA,cAAc,EAAE,OAAO;AACvB;;;;AAIE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;QACT,MAAM,EAAE,QAAO,GAAI,QAAQ,CAAC,gBAAgB,CAAA;AAE5C;;AAEE;AACF,QAAA,MAAM,aAAY,GAAI,GAAG,CAA2B,EAAE,CAAA;AAEtD;;;;;AAKE;AACF,QAAA,MAAM,OAAM,GAAI,QAAQ,CAAC,MACvB,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAC3B,2BAA2B,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,WAAU,EAAG,CAAC,CAC5E,CACH;AAEA;;;;;AAKE;AACF,QAAA,MAAM,qBAAoB,GAAI,QAAQ,CAAC,MAAwB;YAC7D,OAAO,KAAK,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAG,IAAG;AAC3C,gBAAA,MAAM,mBAAmB,2BAA2B,CAAC,IAAI,EAAE;oBACzD,GAAG,MAAM,CAAC,KAAK;oBACf,GAAG,IAAI,CAAC,WAAW;AACpB,iBAAA,CAAA;gBACD,QACE,aAAa,CAAC,KAAK,CAAC,gBAAgB,CAAA,KAAM,SAAQ;oBAClD,aAAa,CAAC,KAAK,CAAC,gBAAgB,MAAM,SAAQ;AAEtD,YAAA,CAAC,CAAA;AACH,QAAA,CAAC,CAAA;AAED;;;;AAIE;QACF,MAAM,QAAO,GAAI,MAAU;YACzB,MAAM,WAAU,GAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAI,IAAK,EAAE,KAAI,IAAK,aAAa,CAAC,KAAK,CAAC,CAAA;YAC/E,IAAI,WAAW,EAAE;AACf,gBAAA,aAAa,CAAC,KAAK,CAAC,WAAW,CAAA,GAAI,SAAQ;YAC7C;AACF,QAAA,CAAA;AAEA;;;;;;AAME;QACF,KAAK,CACH,OAAO,EACP,CAAC,UAAoB,EAAE,UAAgC,KAAG;YACxD,IAAI,UAAU,CAAC,QAAQ,EAAC,KAAM,UAAU,EAAE,QAAQ,EAAE,EAAE;AACpD,gBAAA,KAAK,MAAM,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;oBAClD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC7B,wBAAA,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAA;oBAChC;gBACF;AACA,gBAAA,QAAQ,EAAC;YACX;QACF,CAAC,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAG,EAAG,CACjC;AAEA;;;;;AAKE;AACF,QAAA,MAAM,eAAe,CAAC,WAAmB,KAAS;AAChD,YAAA,aAAa,CAAC,KAAK,CAAC,WAAW,CAAA,GAAI,SAAQ;AAC3C,YAAA,QAAQ,EAAC;AACX,QAAA,CAAA;AAEA;;;;;AAKE;AACF,QAAA,MAAM,eAAe,CAAC,WAAmB,KAAS;AAChD,YAAA,aAAa,CAAC,KAAK,CAAC,WAAW,IAAI,OAAM;AACzC,YAAA,QAAQ,EAAC;AACX,QAAA,CAAA;QAEA,OAAO;YACL,MAAM;YACN,qBAAqB;YACrB,YAAY;YACZ,YAAY;YACZ,2BAA2B;SAC7B;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"query-preview-list.vue2.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-list.vue"],"sourcesContent":["<template>\n <component :is=\"animation\" class=\"x-query-preview-list\" tag=\"ul\">\n <li\n v-for=\"(queryPreview, index) in renderedQueryPreviews\"\n :key=\"index\"\n :class=\"{ 'padding-block-1': loadWhenVisible }\"\n :data-query-preview-hash=\"\n getHashFromQueryPreviewInfo(queryPreview, { ...params, ...queryPreview.extraParams })\n \"\n data-test=\"query-preview-item\"\n >\n <QueryPreview\n :debounce-time-ms=\"debounceTimeMs\"\n :load-when-visible=\"loadWhenVisible\"\n :max-items-to-render=\"maxItemsToRender\"\n :persist-in-cache=\"persistInCache\"\n :query-feature=\"queryFeature\"\n :query-preview-info=\"queryPreview\"\n @load=\"flagAsLoaded\"\n @error=\"flagAsFailed\"\n >\n <template v-for=\"(_, slotName) in $slots\" #[slotName]=\"scope\">\n <slot :name=\"slotName\" v-bind=\"scope\" />\n </template>\n </QueryPreview>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { RequestStatus } from '../../../store'\nimport type { QueryFeature } from '../../../types'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { useState } from '../../../composables/index'\nimport { AnimationProp } from '../../../types'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\nimport QueryPreview from './query-preview.vue'\n\ninterface QueryPreviewStatusRecord {\n [query: string]: RequestStatus\n}\n\n/**\n * Renders the results previews of a list of objects with the information about the query preview,\n * and exposes the {@link QueryPreview} slots to modify the content.\n * The requests are made in sequential order.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewList',\n xModule: queriesPreviewXModule.name,\n components: { QueryPreview },\n props: {\n /**\n * The list of queries preview to render.\n *\n * @public\n */\n queriesPreviewInfo: {\n type: Array as PropType<QueryPreviewInfo[]>,\n required: true,\n },\n /**\n * The origin property for the request on each query preview.\n *\n * @public\n */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /**\n * Number of query preview results to be rendered on each query preview.\n *\n * @public\n */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Controls whether the query preview requests should be triggered when the component is visible in the viewport.\n *\n * @public\n */\n loadWhenVisible: {\n type: Boolean,\n default: false,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests\n * on each query preview.\n *\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether all the QueryPreview should be removed from the state\n * when the component is destroyed.\n *\n * @public\n */\n persistInCache: Boolean,\n /**\n * Animation component that will be used to animate the elements.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n },\n setup(props) {\n const { params } = useState('queriesPreview')\n\n /**\n * Contains the status of the preview requests, indexed by query.\n */\n const queriesStatus = ref<QueryPreviewStatusRecord>({})\n\n /**\n * The list of queries to preview.\n *\n * @returns The list of queries in the queriesPreviewInfo list.\n * @internal\n */\n const queries = computed((): string[] =>\n props.queriesPreviewInfo.map(item =>\n getHashFromQueryPreviewInfo(item, { ...params.value, ...item.extraParams }),\n ),\n )\n\n /**\n * Gets all the queries to render, that are those that don't have an `error` status.\n *\n * @returns A list of queries.\n * @internal\n */\n const renderedQueryPreviews = computed((): QueryPreviewInfo[] => {\n return props.queriesPreviewInfo.filter(item => {\n const queryPreviewHash = getHashFromQueryPreviewInfo(item, {\n ...params.value,\n ...item.extraParams,\n })\n return (\n queriesStatus.value[queryPreviewHash] === 'success' ||\n queriesStatus.value[queryPreviewHash] === 'loading'\n )\n })\n })\n\n /**\n * Tries to load the next query.\n *\n * @internal\n */\n const loadNext = (): void => {\n const queryToLoad = queries.value.find(query => !(query in queriesStatus.value))\n if (queryToLoad) {\n queriesStatus.value[queryToLoad] = 'loading'\n }\n }\n\n /**\n * Resets the status of all queries if they change.\n *\n * @param newQueries - The new queries.\n * @param oldQueries - The old queries.\n * @internal\n */\n watch(\n queries,\n (newQueries: string[], oldQueries: string[] | undefined) => {\n if (newQueries.toString() !== oldQueries?.toString()) {\n for (const key of Object.keys(queriesStatus.value)) {\n if (!newQueries.includes(key)) {\n delete queriesStatus.value[key]\n }\n }\n loadNext()\n }\n },\n { immediate: true, deep: true },\n )\n\n /**\n * Sets the status of a given query to `success`.\n *\n * @param loadedQuery - The query to flag as loaded.\n * @internal\n */\n const flagAsLoaded = (loadedQuery: string): void => {\n queriesStatus.value[loadedQuery] = 'success'\n loadNext()\n }\n\n /**\n * Sets the status of a given query to `error`.\n *\n * @param failedQuery - The query to flag as failed.\n * @internal\n */\n const flagAsFailed = (failedQuery: string): void => {\n queriesStatus.value[failedQuery] = 'error'\n loadNext()\n }\n\n return {\n params,\n renderedQueryPreviews,\n flagAsFailed,\n flagAsLoaded,\n getHashFromQueryPreviewInfo,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.padding-block-1 {\n padding-block: 1px;\n}\n</style>\n\n<docs lang=\"mdx\">\n## See it in action\n\nHere you have a basic example of how the QueryPreviewList is rendered. Keep in mind that this\ncomponent is intended to be used overriding its default slot. By default it will only render the\nnames of the results.\n\n```vue live\n<template>\n <QueryPreviewList :queriesPreviewInfo=\"queriesPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queriesPreviewInfo = reactive([\n { query: 'sandals' },\n { query: 'tshirt' },\n { query: 'jacket' },\n])\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreviewList\n :queriesPreviewInfo=\"queriesPreviewInfo\"\n #default=\"{ queryPreviewInfo, totalResults, results }\"\n >\n <div class=\"x-flex x-flex-col x-gap-8 x-mb-16\">\n <h1 class=\"x-title2\">{{ queryPreviewInfo.query }} ({{ totalResults }})</h1>\n <SlidingPanel :resetOnContentChange=\"false\">\n <div class=\"x-flex x-gap-8\">\n <Result\n v-for=\"result in results\"\n :key=\"result.id\"\n :result=\"result\"\n style=\"max-width: 180px\"\n />\n </div>\n </SlidingPanel>\n </div>\n </QueryPreviewList>\n</template>\n\n<script setup>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport SlidingPanel from '@empathyco/x-components/sliding-panel.vue'\nimport Result from '@empathyco/x-components/result.vue'\nimport { reactive } from 'vue'\nconst queriesPreviewInfo = reactive([\n { query: 'sandals' },\n { query: 'tshirt' },\n { query: 'jacket' },\n])\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreviewList\n class=\"x-flex x-gap-8\"\n :queriesPreviewInfo=\"queriesPreviewInfo\"\n #result=\"{ result }\"\n >\n <span class=\"x-font-bold\">{{ result.id }}:</span>\n <span>{{ result.name }}</span>\n </QueryPreviewList>\n</template>\n\n<script setup>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queriesPreviewInfo = reactive([\n { query: 'sandals' },\n { query: 'tshirt' },\n { query: 'jacket' },\n])\n</script>\n```\n\n### Play with vendor results and vendor banners\n\nThe `VendorResultsList` and `VendorBannersList` components can be used inside the default slot of\nthe `QueryPreviewList`, so the vendor results and vendor banners provided for each query are\ninserted within its results. The order of the nested components defines the merge strategy.\n\n```vue\n<template>\n <QueryPreviewList :queriesPreviewInfo=\"queriesPreviewInfo\" #default=\"{ queryPreviewHash }\">\n <VendorResultsList :queryPreviewHash=\"queryPreviewHash\">\n <VendorBannersList :queryPreviewHash=\"queryPreviewHash\">\n <BaseGrid>\n <template #result=\"{ item }\">\n <span>Result: {{ item.id }}</span>\n </template>\n <template #vendor-result=\"{ item }\">\n <span>Vendor result: {{ item.id }}</span>\n </template>\n <template #vendor-banner=\"{ item }\">\n <span>Vendor banner: {{ item.id }}</span>\n </template>\n </BaseGrid>\n </VendorBannersList>\n </VendorResultsList>\n </QueryPreviewList>\n</template>\n\n<script setup>\nimport { BaseGrid } from '@empathyco/x-components'\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport { VendorBannersList, VendorResultsList } from '@empathyco/x-components/vendor'\nimport { reactive } from 'vue'\nconst queriesPreviewInfo = reactive([\n { query: 'sandals' },\n { query: 'tshirt' },\n { query: 'jacket' },\n])\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA6CA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,qBAAqB,CAAC,IAAI;IACnC,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,kBAAkB,EAAE;AAClB,YAAA,IAAI,EAAE,KAAqC;AAC3C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAgC;AACvC,SAAA;AACD;;;;AAIE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACD;;;;AAIE;AACF,QAAA,eAAe,EAAE;AACf,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;AACD;;;;;;AAME;AACF,QAAA,cAAc,EAAE;AACd,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;AACD;;;;;AAKE;AACF,QAAA,cAAc,EAAE,OAAO;AACvB;;;;AAIE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;QACT,MAAM,EAAE,QAAO,GAAI,QAAQ,CAAC,gBAAgB,CAAA;AAE5C;;AAEE;AACF,QAAA,MAAM,aAAY,GAAI,GAAG,CAA2B,EAAE,CAAA;AAEtD;;;;;AAKE;AACF,QAAA,MAAM,OAAM,GAAI,QAAQ,CAAC,MACvB,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAC3B,2BAA2B,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,WAAU,EAAG,CAAC,CAC5E,CACH;AAEA;;;;;AAKE;AACF,QAAA,MAAM,qBAAoB,GAAI,QAAQ,CAAC,MAAwB;YAC7D,OAAO,KAAK,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAG,IAAG;AAC3C,gBAAA,MAAM,mBAAmB,2BAA2B,CAAC,IAAI,EAAE;oBACzD,GAAG,MAAM,CAAC,KAAK;oBACf,GAAG,IAAI,CAAC,WAAW;AACpB,iBAAA,CAAA;gBACD,QACE,aAAa,CAAC,KAAK,CAAC,gBAAgB,CAAA,KAAM,SAAQ;oBAClD,aAAa,CAAC,KAAK,CAAC,gBAAgB,MAAM,SAAQ;AAEtD,YAAA,CAAC,CAAA;AACH,QAAA,CAAC,CAAA;AAED;;;;AAIE;QACF,MAAM,QAAO,GAAI,MAAU;YACzB,MAAM,WAAU,GAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAI,IAAK,EAAE,KAAI,IAAK,aAAa,CAAC,KAAK,CAAC,CAAA;YAC/E,IAAI,WAAW,EAAE;AACf,gBAAA,aAAa,CAAC,KAAK,CAAC,WAAW,CAAA,GAAI,SAAQ;YAC7C;AACF,QAAA,CAAA;AAEA;;;;;;AAME;QACF,KAAK,CACH,OAAO,EACP,CAAC,UAAoB,EAAE,UAAgC,KAAG;YACxD,IAAI,UAAU,CAAC,QAAQ,EAAC,KAAM,UAAU,EAAE,QAAQ,EAAE,EAAE;AACpD,gBAAA,KAAK,MAAM,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;oBAClD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC7B,wBAAA,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAA;oBAChC;gBACF;AACA,gBAAA,QAAQ,EAAC;YACX;QACF,CAAC,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAG,EAAG,CACjC;AAEA;;;;;AAKE;AACF,QAAA,MAAM,eAAe,CAAC,WAAmB,KAAS;AAChD,YAAA,aAAa,CAAC,KAAK,CAAC,WAAW,CAAA,GAAI,SAAQ;AAC3C,YAAA,QAAQ,EAAC;AACX,QAAA,CAAA;AAEA;;;;;AAKE;AACF,QAAA,MAAM,eAAe,CAAC,WAAmB,KAAS;AAChD,YAAA,aAAa,CAAC,KAAK,CAAC,WAAW,IAAI,OAAM;AACzC,YAAA,QAAQ,EAAC;AACX,QAAA,CAAA;QAEA,OAAO;YACL,MAAM;YACN,qBAAqB;YACrB,YAAY;YACZ,YAAY;YACZ,2BAA2B;SAC7B;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -99,11 +99,11 @@ import '../../../components/suggestions/base-suggestions.vue2.js';
99
99
  import '../../../components/suggestions/base-suggestions.vue3.js';
100
100
  import '../../../composables/create-use-device.js';
101
101
  import { debounce } from '../../../utils/debounce.js';
102
- import { useOnDisplay } from '../../../composables/use-on-display.js';
103
- import { useState } from '../../../composables/use-state.js';
104
102
  import { createRawFilters } from '../../../utils/filters.js';
105
103
  import { createOrigin } from '../../../utils/origin.js';
106
104
  import '../../../utils/storage.js';
105
+ import { useOnDisplay } from '../../../composables/use-on-display.js';
106
+ import { useState } from '../../../composables/use-state.js';
107
107
  import { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview.js';
108
108
  import { queriesPreviewXModule } from '../x-module.js';
109
109
 
@@ -6,6 +6,7 @@ import '../../../plugins/x-bus.js';
6
6
  import '@empathyco/x-utils';
7
7
  import '../../../plugins/x-plugin.js';
8
8
  import 'rxjs';
9
+ import '../../../utils/storage.js';
9
10
  import { useGetter } from '../../../composables/use-getter.js';
10
11
  import '@vueuse/core';
11
12
  import { querySuggestionsXModule } from '../x-module.js';