From 240e046e68869efe5b26ebd18d8ba8533b972ed9 Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Wed, 8 May 2024 14:26:52 +0200 Subject: [PATCH 01/11] refactor: migrate `FiltersInjection` mixin --- .../x-components/src/composables/index.ts | 1 + .../src/composables/use-filters-injection.ts | 76 ++++++++ .../x-components/src/views/home/aside.vue | 2 +- .../lists/exclude-filters-with-no-results.vue | 66 ++++--- .../facets/components/lists/filters-list.vue | 124 ++++++++----- .../components/lists/filters-search.vue | 171 +++++++++++------- .../components/lists/sliced-filters.vue | 170 ++++++++++------- .../components/lists/sorted-filters.vue | 74 +++++--- 8 files changed, 452 insertions(+), 232 deletions(-) create mode 100644 packages/x-components/src/composables/use-filters-injection.ts diff --git a/packages/x-components/src/composables/index.ts b/packages/x-components/src/composables/index.ts index 309944c00e..861553723d 100644 --- a/packages/x-components/src/composables/index.ts +++ b/packages/x-components/src/composables/index.ts @@ -7,3 +7,4 @@ export * from './use-store'; export * from './use-state'; export * from './use-getter'; export * from './use-alias-api'; +export * from './use-filters-injection'; diff --git a/packages/x-components/src/composables/use-filters-injection.ts b/packages/x-components/src/composables/use-filters-injection.ts new file mode 100644 index 0000000000..44b1ea762d --- /dev/null +++ b/packages/x-components/src/composables/use-filters-injection.ts @@ -0,0 +1,76 @@ +import { Filter, HierarchicalFilter, isHierarchicalFilter } from '@empathyco/x-types'; +import { computed, inject, Ref } from 'vue'; +import { isArrayEmpty } from '../utils/index'; + +/** + * Composable to share filters injection logic. + * + * @param props - Composable props. + * @returns An array of filters. + * + * @public + */ +export function useFiltersInjection(props: { + /** The list of filters to be rendered as slots. */ + filters?: Filter[] | undefined; + /** + This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary + to make the `renderedFilters` to return only the filters of each level of the hierarchy. + */ + parentId?: Filter['id'] | undefined; +}) { + /** + * The injected filters array. + * + * @public + */ + const injectedFilters = inject | undefined>('filters'); + + /** + * An array of filters formed by those that are passed through prop or injected. + * + * @returns An array of filters. + * + * @internal + */ + const propOrInjectedFilters = computed((): void | Filter[] => { + return ( + props.filters ?? + injectedFilters?.value ?? + //TODO: add here logger + //eslint-disable-next-line no-console + console.warn('It is necessary to pass a prop or inject the list of filters') + ); + }); + + /** + * In the case that the filters are {@link @empathyco/x-types#HierarchicalFilter}, this method + * removes from the filter list passed as a param, the filters that are not part of the level of + * the hierarchy, depending on the value of the `parentId` prop. In case this prop is undefined, + * then only the first level of filters hierarchy are returned. In the case the prop `parentId` is + * defined, then only the filters with the same `parentId` are returned. + * + * @param filters - The list of the filters to apply the filter. + * @returns The list of the filters filtered by parentId. + * @internal + */ + const filterByParentId = (filters: Filter[]): Filter[] => { + if (!isArrayEmpty(filters) && isHierarchicalFilter(filters[0])) { + return (filters as HierarchicalFilter[]).filter( + filter => filter.parentId === (props.parentId ?? null) + ); + } else { + return filters; + } + }; + + /** + * The prop or injected filters array, filtered by parentId if they are + * {@link @empathyco/x-types#HierarchicalFilter}. + * + * @returns An array of filters. + * + * @internal + */ + return computed(() => filterByParentId(propOrInjectedFilters.value as Filter[])); +} diff --git a/packages/x-components/src/views/home/aside.vue b/packages/x-components/src/views/home/aside.vue index 81ab1993e8..6b3ffade0e 100644 --- a/packages/x-components/src/views/home/aside.vue +++ b/packages/x-components/src/views/home/aside.vue @@ -35,7 +35,7 @@ - + import { Filter, isBooleanFilter } from '@empathyco/x-types'; - import { CreateElement, VNode } from 'vue'; - import { mixins } from 'vue-class-component'; - import { Component } from 'vue-property-decorator'; - import { xComponentMixin, XProvide } from '../../../../components'; + import { computed, CreateElement, defineComponent, PropType, provide, VNode } from 'vue'; import { facetsXModule } from '../../x-module'; - import FiltersInjectionMixin from './filters-injection.mixin'; + import { useRegisterXModule } from '../../../../composables/use-register-x-module'; + import { useFiltersInjection } from '../../../../composables/use-filters-injection'; /** * The `ExcludeFiltersWithNoResults` component filters the provided list of filters, excluding @@ -17,27 +15,51 @@ * * @public */ - @Component({ - mixins: [xComponentMixin(facetsXModule)] - }) - export default class ExcludeFiltersWithNoResults extends mixins(FiltersInjectionMixin) { - /** - * Removes the filters that have exactly 0 results associated. - * - * @returns A sublist of the filters prop, excluding the ones with no results. - * @internal - */ - @XProvide('filters') - public get filtersWithResults(): Filter[] { - return this.renderedFilters.filter( - filter => !isBooleanFilter(filter) || filter.totalResults !== 0 - ); - } + export default defineComponent({ + name: 'ExcludeFiltersWithNoResults', + xModule: facetsXModule.name, + props: { + /** + * The list of filters to be rendered as slots. + * + * @public + */ + filters: Array as PropType, + + /** + * This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary + * to make the `renderedFilters` to return only the filters of each level of the hierarchy. + * + * @public + */ + parentId: { + type: String as PropType, + required: false + } + }, + setup(props) { + useRegisterXModule(facetsXModule); + const renderedFilters = useFiltersInjection(props); + /** + * Removes the filters that have exactly 0 results associated. + * + * @returns A sublist of the filters prop, excluding the ones with no results. + * @internal + */ + const filtersWithResults = computed((): Filter[] => { + return renderedFilters.value.filter( + filter => !isBooleanFilter(filter) || filter.totalResults !== 0 + ); + }); + provide('filters', filtersWithResults); + + return { filtersWithResults }; + }, render(h: CreateElement): VNode { return this.$scopedSlots.default?.({ filters: this.filtersWithResults })?.[0] ?? h(); } - } + }); diff --git a/packages/x-components/src/x-modules/facets/components/lists/filters-list.vue b/packages/x-components/src/x-modules/facets/components/lists/filters-list.vue index edfd823626..e728365048 100644 --- a/packages/x-components/src/x-modules/facets/components/lists/filters-list.vue +++ b/packages/x-components/src/x-modules/facets/components/lists/filters-list.vue @@ -23,13 +23,13 @@ diff --git a/packages/_vue3-migration-test/src/x-modules/facets/index.ts b/packages/_vue3-migration-test/src/x-modules/facets/index.ts new file mode 100644 index 0000000000..38da673ebb --- /dev/null +++ b/packages/_vue3-migration-test/src/x-modules/facets/index.ts @@ -0,0 +1,2 @@ +export * from './components'; +export * from './x-module'; diff --git a/packages/_vue3-migration-test/src/x-modules/facets/x-module.ts b/packages/_vue3-migration-test/src/x-modules/facets/x-module.ts new file mode 100644 index 0000000000..46d8f02353 --- /dev/null +++ b/packages/_vue3-migration-test/src/x-modules/facets/x-module.ts @@ -0,0 +1,43 @@ +import { Facet } from '@empathyco/x-types'; +import { createSimpleFacetStub } from '../../../../x-components/src/__stubs__/facets-stubs.factory'; +import { PrivateXModuleOptions } from '../../../../x-components/src/plugins/x-plugin.types'; +import { arrayToObject } from '../../../../x-components/src/utils/array'; +import { FacetsXModule } from '../../../../x-components/src/x-modules/facets/x-module'; + +const facets: Record = { + gender: createSimpleFacetStub('gender', createFilter => [ + createFilter('Men', false), + createFilter('Women', true) + ]), + brand: createSimpleFacetStub('brand', createFilter => [ + createFilter('Audi', true), + createFilter('BMW', false) + ]), + color: createSimpleFacetStub('color', createFilter => [ + createFilter('red', true), + createFilter('blue', false) + ]), + category: createSimpleFacetStub('category', createFilter => [ + createFilter('dress', false), + createFilter('floral', false, 5), + createFilter('skirt', false, 9), + createFilter('print', false, 9), + createFilter('midi', false, 3), + createFilter('fitted', false, 0), + createFilter('short', false), + createFilter('long', false, 15) + ]) +}; +const filters = arrayToObject( + Object.values(facets).flatMap(facet => facet.filters), + 'id' +); + +export const facetsXModule: PrivateXModuleOptions = { + storeModule: { + state: { + facets, + filters + } + } +}; diff --git a/packages/_vue3-migration-test/src/x-modules/index.ts b/packages/_vue3-migration-test/src/x-modules/index.ts index 9eb244b491..56b46d9cb9 100644 --- a/packages/_vue3-migration-test/src/x-modules/index.ts +++ b/packages/_vue3-migration-test/src/x-modules/index.ts @@ -1,3 +1,4 @@ export * from './search'; export { default as TestElementsList } from './test-elements-list.vue'; export * from './scroll'; +export * from './facets'; From 0a6387e8b501a1f088b1d9b1f4cfc39458b5913c Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Thu, 9 May 2024 14:05:51 +0200 Subject: [PATCH 04/11] fix: remove extra import --- packages/_vue3-migration-test/src/x-modules/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/_vue3-migration-test/src/x-modules/index.ts b/packages/_vue3-migration-test/src/x-modules/index.ts index c0d3bd1d09..5c28632c91 100644 --- a/packages/_vue3-migration-test/src/x-modules/index.ts +++ b/packages/_vue3-migration-test/src/x-modules/index.ts @@ -3,4 +3,3 @@ export * from './next-queries'; export * from './search'; export { default as TestElementsList } from './test-elements-list.vue'; export * from './scroll'; -export * from './facets'; From 9f324bc3eef2b1501487fa1b5db201f9acabfea6 Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Thu, 9 May 2024 14:24:13 +0200 Subject: [PATCH 05/11] chore: remove mixin test and create test for the new composable --- .../__tests__/use-filters-injection.spec.ts} | 55 +++++++----- .../lists/filters-injection.mixin.ts | 88 ------------------- 2 files changed, 34 insertions(+), 109 deletions(-) rename packages/x-components/src/{x-modules/facets/components/lists/__tests__/filters-injection-mixin.spec.ts => composables/__tests__/use-filters-injection.spec.ts} (83%) delete mode 100644 packages/x-components/src/x-modules/facets/components/lists/filters-injection.mixin.ts diff --git a/packages/x-components/src/x-modules/facets/components/lists/__tests__/filters-injection-mixin.spec.ts b/packages/x-components/src/composables/__tests__/use-filters-injection.spec.ts similarity index 83% rename from packages/x-components/src/x-modules/facets/components/lists/__tests__/filters-injection-mixin.spec.ts rename to packages/x-components/src/composables/__tests__/use-filters-injection.spec.ts index bed0463913..69ae5cb052 100644 --- a/packages/x-components/src/x-modules/facets/components/lists/__tests__/filters-injection-mixin.spec.ts +++ b/packages/x-components/src/composables/__tests__/use-filters-injection.spec.ts @@ -1,29 +1,42 @@ +import Vue, { ComponentOptions, defineComponent, PropType, provide, ref } from 'vue'; import { Filter } from '@empathyco/x-types'; import { mount, Wrapper } from '@vue/test-utils'; -import Vue, { ComponentOptions } from 'vue'; -import { Component, Prop } from 'vue-property-decorator'; import { createHierarchicalFilter, createSimpleFilter -} from '../../../../../__stubs__/filters-stubs.factory'; -import { XProvide } from '../../../../../components/decorators/injection.decorators'; -import FiltersInjectionMixin from '../filters-injection.mixin'; - -@Component({ +} from '../../__stubs__/filters-stubs.factory'; +import { useFiltersInjection } from '../use-filters-injection'; + +const Provider = defineComponent({ + name: 'Provider', + props: { + injectedData: { + type: Array as PropType + } + }, + setup(props) { + const filters = ref(props.injectedData); + provide('filters', filters); + }, template: `
` -}) -class Provider extends Vue { - @Prop() - @XProvide('filters') - public injectedData!: any; -} +}); const Filters: ComponentOptions = { - mixins: [FiltersInjectionMixin], + props: { + filters: Array as PropType, + parentId: { + type: String as PropType, + required: false + } + }, + setup(props) { + const renderedFilters = useFiltersInjection(props); + return { renderedFilters }; + }, template: `
  • {{ filter.id }}
  • @@ -31,8 +44,8 @@ const Filters: ComponentOptions = { ` }; -describe('test filters injection mixin', () => { - function renderFiltersMixin({ +describe('test filters injection composable', () => { + function renderFiltersComposable({ propFilters, injectedFilters, parentId @@ -76,7 +89,7 @@ describe('test filters injection mixin', () => { const whiteFilter = createSimpleFilter('color', 'white'); const blackFilter = createSimpleFilter('color', 'black'); const blueFilter = createSimpleFilter('color', 'blue'); - const { setPropFilters, getRenderedFilterIds } = renderFiltersMixin({ + const { setPropFilters, getRenderedFilterIds } = renderFiltersComposable({ propFilters: [whiteFilter, blackFilter] }); let renderedIds = getRenderedFilterIds(); @@ -96,7 +109,7 @@ describe('test filters injection mixin', () => { const whiteFilter = createSimpleFilter('color', 'white'); const blackFilter = createSimpleFilter('color', 'black'); const blueFilter = createSimpleFilter('color', 'blue'); - const { getRenderedFilterIds } = renderFiltersMixin({ + const { getRenderedFilterIds } = renderFiltersComposable({ injectedFilters: [whiteFilter, blackFilter, blueFilter] }); const renderedIds = getRenderedFilterIds(); @@ -110,7 +123,7 @@ describe('test filters injection mixin', () => { const whiteFilter = createSimpleFilter('color', 'white'); const blackFilter = createSimpleFilter('color', 'black'); const blueFilter = createSimpleFilter('color', 'blue'); - const { getRenderedFilterIds } = renderFiltersMixin({ + const { getRenderedFilterIds } = renderFiltersComposable({ propFilters: [whiteFilter, blackFilter], injectedFilters: [blueFilter] }); @@ -137,7 +150,7 @@ describe('test filters injection mixin', () => { categoryShirts.parentId = categoryJeans.parentId = categoryMen.id; const categoryWomen = createHierarchicalFilter('category', 'women', false); - const { getRenderedFilterIds } = renderFiltersMixin({ + const { getRenderedFilterIds } = renderFiltersComposable({ propFilters: [categoryShirts, categoryJeans, categoryMen, categoryWomen] }); const renderedIds = getRenderedFilterIds(); @@ -164,7 +177,7 @@ describe('test filters injection mixin', () => { categoryShirts.parentId = categoryJeans.parentId = categoryMen.id; const categoryWomen = createHierarchicalFilter('category', 'women', false); - const { getRenderedFilterIds } = renderFiltersMixin({ + const { getRenderedFilterIds } = renderFiltersComposable({ propFilters: [categoryShirts, categoryJeans, categoryMen, categoryWomen], parentId: categoryMen.id }); diff --git a/packages/x-components/src/x-modules/facets/components/lists/filters-injection.mixin.ts b/packages/x-components/src/x-modules/facets/components/lists/filters-injection.mixin.ts deleted file mode 100644 index 4276f2f20c..0000000000 --- a/packages/x-components/src/x-modules/facets/components/lists/filters-injection.mixin.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Filter, HierarchicalFilter, isHierarchicalFilter } from '@empathyco/x-types'; -import Vue from 'vue'; -import Component from 'vue-class-component'; -import { Prop } from 'vue-property-decorator'; -import { XInject } from '../../../../components/decorators/injection.decorators'; -import { isArrayEmpty } from '../../../../utils/array'; - -/** - * Mixin to share filters injection logic. - * - * @public - */ -@Component -export default class FiltersInjectionMixin extends Vue { - /** - * The list of filters to be rendered as slots. - * - * @public - */ - @Prop() - protected filters!: Filter[]; - - /** - * This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary - * to make the `renderedFilters` to return only the filters of each level of the hierarchy. - * - * @public - */ - @Prop({ required: false }) - protected parentId?: Filter['id']; - - /** The injected filters array. - * - * @public - */ - @XInject('filters') - public injectedFilters!: Filter[]; - - /** - * The prop or injected filters array, filtered by parentId if they are - * {@link @empathyco/x-types#HierarchicalFilter}. - * - * @returns An array of filters. - * - * @internal - */ - protected get renderedFilters(): Filter[] { - return this.filterByParentId(this.propOrInjectedFilters); - } - - /** - * An array of filters formed by those that are passed through prop or injected. - * - * @returns An array of filters. - * - * @internal - */ - protected get propOrInjectedFilters(): Filter[] { - return ( - this.filters ?? - this.injectedFilters ?? - //TODO: add here logger - //eslint-disable-next-line no-console - console.warn('It is necessary to pass a prop or inject the list of filters') - ); - } - - /** - * In the case that the filters are {@link @empathyco/x-types#HierarchicalFilter}, this method - * removes from the filter list passed as a param, the filters that are not part of the level of - * the hierarchy, depending on the value of the `parentId` prop. In case this prop is undefined, - * then only the first level of filters hierarchy are returned. In the case the prop `parentId` is - * defined, then only the filters with the same `parentId` are returned. - * - * @param filters - The list of the filters to apply the filter. - * @returns The list of the filters filtered by parentId. - * @internal - */ - protected filterByParentId(filters: Filter[]): Filter[] { - if (!isArrayEmpty(filters) && isHierarchicalFilter(filters[0])) { - return (filters as HierarchicalFilter[]).filter( - filter => filter.parentId === (this.parentId ?? null) - ); - } else { - return filters; - } - } -} From a55d128fe34acc0ffde860eb4e1540047b6280fb Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Thu, 9 May 2024 14:28:38 +0200 Subject: [PATCH 06/11] chore: remove mixin import --- packages/x-components/src/x-modules/facets/components/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/x-components/src/x-modules/facets/components/index.ts b/packages/x-components/src/x-modules/facets/components/index.ts index 9b21fc831a..a41c4bc04d 100644 --- a/packages/x-components/src/x-modules/facets/components/index.ts +++ b/packages/x-components/src/x-modules/facets/components/index.ts @@ -14,7 +14,6 @@ export { default as PreselectedFilters } from './preselected-filters.vue'; // Lists // eslint-disable-next-line max-len export { default as ExcludeFiltersWithNoResults } from './lists/exclude-filters-with-no-results.vue'; -export { default as FiltersInjectionMixin } from './lists/filters-injection.mixin'; export { default as FiltersList } from './lists/filters-list.vue'; export { default as FiltersSearch } from './lists/filters-search.vue'; export { default as SelectedFilters } from './lists/selected-filters.vue'; From 6b1266bf85680362122230ba2aeab4cd974ee853 Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Mon, 13 May 2024 10:45:16 +0200 Subject: [PATCH 07/11] fix: assign a default value to the inject --- packages/x-components/src/composables/use-filters-injection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/x-components/src/composables/use-filters-injection.ts b/packages/x-components/src/composables/use-filters-injection.ts index 44b1ea762d..a581084a4b 100644 --- a/packages/x-components/src/composables/use-filters-injection.ts +++ b/packages/x-components/src/composables/use-filters-injection.ts @@ -24,7 +24,7 @@ export function useFiltersInjection(props: { * * @public */ - const injectedFilters = inject | undefined>('filters'); + const injectedFilters = inject | undefined>('filters', undefined); /** * An array of filters formed by those that are passed through prop or injected. From b85309ebebbaa42f1fde95442fcc9bec12d1308b Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Tue, 14 May 2024 08:55:47 +0200 Subject: [PATCH 08/11] fix: pr comments --- packages/_vue3-migration-test/src/router.ts | 8 +--- .../src/x-modules/facets/components/index.ts | 1 - .../facets/components/test-facets.vue | 36 ++++++++++++---- .../components/test-filters-injection.vue | 43 ------------------- .../src/composables/use-filters-injection.ts | 4 +- .../lists/exclude-filters-with-no-results.vue | 10 ++--- .../components/lists/filters-search.vue | 6 +-- .../components/lists/sorted-filters.vue | 7 +-- 8 files changed, 37 insertions(+), 78 deletions(-) delete mode 100644 packages/_vue3-migration-test/src/x-modules/facets/components/test-filters-injection.vue diff --git a/packages/_vue3-migration-test/src/router.ts b/packages/_vue3-migration-test/src/router.ts index 9d21e02df0..b0338e1304 100644 --- a/packages/_vue3-migration-test/src/router.ts +++ b/packages/_vue3-migration-test/src/router.ts @@ -14,8 +14,7 @@ import { TestScroll, TestSortDropdown, TestSortList, - TestSortPickerList, - TestFiltersInjection + TestSortPickerList } from './'; const routes = [ @@ -93,11 +92,6 @@ const routes = [ path: '/elements-list', name: 'ElementsList', component: TestElementsList - }, - { - path: '/filters-injection', - name: 'FiltersInjection', - component: TestFiltersInjection } ]; diff --git a/packages/_vue3-migration-test/src/x-modules/facets/components/index.ts b/packages/_vue3-migration-test/src/x-modules/facets/components/index.ts index b35b294264..82e5a09c6f 100644 --- a/packages/_vue3-migration-test/src/x-modules/facets/components/index.ts +++ b/packages/_vue3-migration-test/src/x-modules/facets/components/index.ts @@ -1,2 +1 @@ -export { default as TestFiltersInjection } from './test-filters-injection.vue'; export { default as TestFacets } from './test-facets.vue'; diff --git a/packages/_vue3-migration-test/src/x-modules/facets/components/test-facets.vue b/packages/_vue3-migration-test/src/x-modules/facets/components/test-facets.vue index 3874309a8a..b9f3dffde1 100644 --- a/packages/_vue3-migration-test/src/x-modules/facets/components/test-facets.vue +++ b/packages/_vue3-migration-test/src/x-modules/facets/components/test-facets.vue @@ -4,14 +4,27 @@

    SelectedFilters

    @@ -39,6 +52,11 @@ import Facets from '../../../../../x-components/src/x-modules/facets/components/facets/facets.vue'; import SelectedFilters from '../../../../../x-components/src/x-modules/facets/components/lists/selected-filters.vue'; import SelectedFiltersList from '../../../../../x-components/src/x-modules/facets/components/lists/selected-filters-list.vue'; + import SortedFilters from '../../../../../x-components/src/x-modules/facets/components/lists/sorted-filters.vue'; + import SlicedFilters from '../../../../../x-components/src/x-modules/facets/components/lists/sliced-filters.vue'; + import FiltersSearch from '../../../../../x-components/src/x-modules/facets/components/lists/filters-search.vue'; + import ExcludeFiltersWithNoResults from '../../../../../x-components/src/x-modules/facets/components/lists/exclude-filters-with-no-results.vue'; + import FiltersList from '../../../../../x-components/src/x-modules/facets/components/lists/filters-list.vue'; - const facetsIds = ['gender', 'brand']; + const facetsIds = ['gender', 'brand', 'category']; diff --git a/packages/_vue3-migration-test/src/x-modules/facets/components/test-filters-injection.vue b/packages/_vue3-migration-test/src/x-modules/facets/components/test-filters-injection.vue deleted file mode 100644 index c00f39a59c..0000000000 --- a/packages/_vue3-migration-test/src/x-modules/facets/components/test-filters-injection.vue +++ /dev/null @@ -1,43 +0,0 @@ - - - - - diff --git a/packages/x-components/src/composables/use-filters-injection.ts b/packages/x-components/src/composables/use-filters-injection.ts index a581084a4b..c647c5f5fd 100644 --- a/packages/x-components/src/composables/use-filters-injection.ts +++ b/packages/x-components/src/composables/use-filters-injection.ts @@ -1,6 +1,6 @@ import { Filter, HierarchicalFilter, isHierarchicalFilter } from '@empathyco/x-types'; import { computed, inject, Ref } from 'vue'; -import { isArrayEmpty } from '../utils/index'; +import { isArrayEmpty } from '../utils/array'; /** * Composable to share filters injection logic. @@ -12,7 +12,7 @@ import { isArrayEmpty } from '../utils/index'; */ export function useFiltersInjection(props: { /** The list of filters to be rendered as slots. */ - filters?: Filter[] | undefined; + filters?: Filter[]; /** This prop is used in the `HierarchicalFilter` component and only in that case. It is necessary to make the `renderedFilters` to return only the filters of each level of the hierarchy. diff --git a/packages/x-components/src/x-modules/facets/components/lists/exclude-filters-with-no-results.vue b/packages/x-components/src/x-modules/facets/components/lists/exclude-filters-with-no-results.vue index 9d2a3af97f..c2e2b1c2fd 100644 --- a/packages/x-components/src/x-modules/facets/components/lists/exclude-filters-with-no-results.vue +++ b/packages/x-components/src/x-modules/facets/components/lists/exclude-filters-with-no-results.vue @@ -1,6 +1,6 @@ diff --git a/packages/x-components/src/x-modules/facets/components/lists/filters-search.vue b/packages/x-components/src/x-modules/facets/components/lists/filters-search.vue index 5d76855ff9..9800792bfa 100644 --- a/packages/x-components/src/x-modules/facets/components/lists/filters-search.vue +++ b/packages/x-components/src/x-modules/facets/components/lists/filters-search.vue @@ -14,7 +14,7 @@ type="search" class="x-filters-search__input x-input" data-test="filters-search-input" - :aria-label="filtersSearchInputMessage" + :aria-label="'search into the filter values'" />