@empathyco/x-components 6.0.0-alpha.75 → 6.0.0-alpha.77
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.
- package/CHANGELOG.md +18 -0
- package/design-system/deprecated-full-theme.css +1624 -1624
- package/docs/API-reference/api/x-components.allfilter.md +3 -3
- package/docs/API-reference/api/x-components.baseeventsmodalclose.md +3 -3
- package/docs/API-reference/api/x-components.baseeventsmodalopen.md +3 -3
- package/docs/API-reference/api/x-components.facets.md +3 -3
- package/docs/API-reference/api/x-components.globalxbus.md +4 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +2 -0
- package/docs/API-reference/api/x-components.historyqueries.md +1 -1
- package/docs/API-reference/api/x-components.historyquery.md +1 -1
- package/docs/API-reference/api/x-components.identifierresult.md +2 -2
- package/docs/API-reference/api/x-components.md +5 -3
- package/docs/API-reference/api/x-components.nextqueries.md +1 -1
- package/docs/API-reference/api/x-components.popularsearches.md +1 -1
- package/docs/API-reference/api/x-components.querysuggestion.md +1 -1
- package/docs/API-reference/api/x-components.querysuggestions.md +1 -1
- package/docs/API-reference/api/x-components.relatedpromptsxevents.md +2 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsresponsechanged.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsunmounted.md +13 -0
- package/docs/API-reference/api/x-components.semanticquery.md +1 -1
- package/docs/API-reference/api/x-components.simplefilter.md +2 -0
- package/docs/API-reference/api/x-components.snippetcallbacks.md +2 -0
- package/docs/API-reference/api/x-components.tracknoresultsquerywithfallbackwire.md +13 -0
- package/docs/API-reference/api/x-components.tracknoresultsquerywithfallbackwiredebounced.md +13 -0
- package/docs/API-reference/api/x-components.tracknoresultsquerywithsemanticswire.md +6 -1
- package/docs/API-reference/api/x-components.tracknoresultsquerywithsemanticswiredebounced.md +6 -1
- package/docs/API-reference/api/x-components.usegetter.md +3 -17
- package/js/composables/use-getter.js +11 -11
- package/js/composables/use-getter.js.map +1 -1
- package/js/index.js +1 -1
- package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue2.js +1 -1
- package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue2.js +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue2.js.map +1 -1
- package/js/x-modules/facets/composables/use-facets.js +1 -4
- package/js/x-modules/facets/composables/use-facets.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue2.js +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue2.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue2.js +1 -1
- package/js/x-modules/history-queries/components/history-query.vue2.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-result.vue.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-result.vue2.js +1 -3
- package/js/x-modules/identifier-results/components/identifier-result.vue2.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries-list.vue.js +1 -3
- package/js/x-modules/next-queries/components/next-queries-list.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue2.js +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue2.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue2.js +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue2.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +4 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/store/emitters.js +1 -0
- package/js/x-modules/related-prompts/store/emitters.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tags.vue2.js +1 -3
- package/js/x-modules/related-tags/components/related-tags.vue2.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-query.vue.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-query.vue2.js +2 -2
- package/js/x-modules/semantic-queries/components/semantic-query.vue2.js.map +1 -1
- package/js/x-modules/tagging/wiring.js +27 -8
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +293 -144
- package/report/x-components.api.md +42 -18
- package/tagging/index.js +1 -1
- package/types/components/global-x-bus.vue.d.ts +4 -0
- package/types/components/global-x-bus.vue.d.ts.map +1 -1
- package/types/components/modals/base-events-modal-close.vue.d.ts +3 -3
- package/types/components/modals/base-events-modal-open.vue.d.ts +3 -3
- package/types/components/snippet-callbacks.vue.d.ts +2 -0
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/composables/use-getter.d.ts +13 -3
- package/types/composables/use-getter.d.ts.map +1 -1
- package/types/x-modules/facets/components/facets/facets.vue.d.ts +4 -4
- package/types/x-modules/facets/components/facets/facets.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/all-filter.vue.d.ts +4 -4
- package/types/x-modules/facets/components/filters/all-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +2 -0
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +2 -0
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/history-queries.vue.d.ts +1 -1
- package/types/x-modules/history-queries/components/history-query.vue.d.ts +1 -1
- package/types/x-modules/identifier-results/components/identifier-result.vue.d.ts +3 -3
- package/types/x-modules/identifier-results/components/identifier-result.vue.d.ts.map +1 -1
- package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts.map +1 -1
- package/types/x-modules/next-queries/components/next-queries.vue.d.ts +1 -1
- package/types/x-modules/popular-searches/components/popular-searches.vue.d.ts +1 -1
- package/types/x-modules/query-suggestions/components/query-suggestion.vue.d.ts +1 -1
- package/types/x-modules/query-suggestions/components/query-suggestions.vue.d.ts +1 -1
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/events.types.d.ts +10 -1
- package/types/x-modules/related-prompts/events.types.d.ts.map +1 -1
- package/types/x-modules/related-prompts/store/emitters.d.ts +1 -0
- package/types/x-modules/related-prompts/store/emitters.d.ts.map +1 -1
- package/types/x-modules/related-tags/components/related-tags.vue.d.ts.map +1 -1
- package/types/x-modules/semantic-queries/components/semantic-query.vue.d.ts +1 -1
- package/types/x-modules/tagging/wiring.d.ts +23 -4
- package/types/x-modules/tagging/wiring.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-queries.vue.js","sources":["../../../../../src/x-modules/next-queries/components/next-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"renderedNextQueries\"\n data-test=\"next-queries\"\n class=\"x-next-queries\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Next Query item\n @binding {Object} v-bind - Next Query suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Next Query suggestion data<br /> - **index** <code>number</code> - Next Query suggestion index\n @binding {boolean} highlightCurated - True if the curated NQs should be highlighted\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope, highlightCurated }\">\n <NextQuery\n v-slot=\"nextQueryScope\"\n :suggestion=\"baseScope.suggestion\"\n :highlight-curated=\"highlightCurated\"\n class=\"x-next-queries__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Next Query content\n @binding {Object} v-bind - Next Query suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Next Query suggestion data<br /> - **index** <code>number</code> - Next Query suggestion index\n @binding {boolean} shouldHighlightCurated - True if the curated NQ should be highlighted\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...nextQueryScope }\" />\n </NextQuery>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport type { NextQuery as NextQueryModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { nextQueriesXModule } from '../x-module'\nimport NextQuery from './next-query.vue'\n\n/**\n * Simple next-queries component that renders a list of\n * [`BaseSuggestions`](./x-components.base-suggestions.md),\n * allowing the user to select one of them, and emitting the needed events. A next query is a\n * suggestion for a new search, related to your previous query. I.e. If people normally search\n * for `shirts`, and then `trousers`, `trousers` would be a next query of `shirts`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'NextQueries',\n xModule: nextQueriesXModule.name,\n components: {\n NextQuery,\n BaseSuggestions,\n },\n props: {\n /**\n * Flag to indicate if the curated next queries should be displayed different.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n /**\n * NextQueries list to be used instead of state NextQueries.\n *\n * @public\n */\n suggestions: Array as PropType<NextQueryModel[]>,\n },\n setup(props) {\n /**\n * The list of next queries from the state.\n *\n * @internal\n */\n const stateNextQueries = useGetter('nextQueries'
|
|
1
|
+
{"version":3,"file":"next-queries.vue.js","sources":["../../../../../src/x-modules/next-queries/components/next-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"renderedNextQueries\"\n data-test=\"next-queries\"\n class=\"x-next-queries\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Next Query item\n @binding {Object} v-bind - Next Query suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Next Query suggestion data<br /> - **index** <code>number</code> - Next Query suggestion index\n @binding {boolean} highlightCurated - True if the curated NQs should be highlighted\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope, highlightCurated }\">\n <NextQuery\n v-slot=\"nextQueryScope\"\n :suggestion=\"baseScope.suggestion\"\n :highlight-curated=\"highlightCurated\"\n class=\"x-next-queries__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Next Query content\n @binding {Object} v-bind - Next Query suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Next Query suggestion data<br /> - **index** <code>number</code> - Next Query suggestion index\n @binding {boolean} shouldHighlightCurated - True if the curated NQ should be highlighted\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...nextQueryScope }\" />\n </NextQuery>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport type { NextQuery as NextQueryModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { nextQueriesXModule } from '../x-module'\nimport NextQuery from './next-query.vue'\n\n/**\n * Simple next-queries component that renders a list of\n * [`BaseSuggestions`](./x-components.base-suggestions.md),\n * allowing the user to select one of them, and emitting the needed events. A next query is a\n * suggestion for a new search, related to your previous query. I.e. If people normally search\n * for `shirts`, and then `trousers`, `trousers` would be a next query of `shirts`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'NextQueries',\n xModule: nextQueriesXModule.name,\n components: {\n NextQuery,\n BaseSuggestions,\n },\n props: {\n /**\n * Flag to indicate if the curated next queries should be displayed different.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n /**\n * NextQueries list to be used instead of state NextQueries.\n *\n * @public\n */\n suggestions: Array as PropType<NextQueryModel[]>,\n },\n setup(props) {\n /**\n * The list of next queries from the state.\n *\n * @internal\n */\n const stateNextQueries = useGetter('nextQueries').nextQueries\n\n /**.\n * The list of next queries finally rendered\n *\n * @internal\n */\n const renderedNextQueries = computed(() => props.suggestions ?? stateNextQueries.value)\n\n return { renderedNextQueries }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Basic example\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any next\nqueries it will show them\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <NextQueries />\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { NextQueries } from '@empathyco/x-components/next-queries'\n\nexport default {\n name: 'NextQueriesDemo',\n components: {\n SearchInput,\n NextQueries,\n },\n}\n</script>\n```\n\nThe component has three optional props. `animation` to render the component with an animation,\n`maxItemsToRender` to limit the number of next queries will be rendered (by default it is 5) and\n`highlightCurated` to indicate if the curated Next Queries inside the list should be highlighted.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <NextQueries :animation=\"'FadeAndSlide'\" :maxItemsToRender=\"10\" :highlightCurated=\"true\" />\n </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { NextQueries } from '@empathyco/x-components/next-queries'\nimport { FadeAndSlide } from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('FadeAndSlide', FadeAndSlide)\nexport default {\n name: 'NextQueriesDemo',\n components: {\n SearchInput,\n NextQueries,\n },\n}\n</script>\n```\n\n### Overriding Next Queries' Content\n\nYou can use your custom implementation of the Next Query's content. In the example below, instead of\nusing the default Next Query's content, an icon is added, as well as a span with the query of the\nNext Query suggestion.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <NextQueries>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-next-query__query\">{{ suggestion.query }}</span>\n </template>\n </NextQueries>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { NextQueries } from '@empathyco/x-components/next-queries'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'NextQueriesDemo',\n components: {\n SearchInput,\n NextQueries,\n TrendingIcon,\n },\n}\n</script>\n```\n\n### Adding a custom next query component\n\nYou can use your custom implementation of a next query component. To work correctly, it should use\nthe `emitNextQuerySelected` function when the next query is selected. In the example below, instead\nof using the default `button` tag for a next query, an icon is added, and the text of the next query\nis wrapped in a `span`\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <NextQueries>\n <template #suggestion=\"{ suggestion }\">\n <NextQuery :suggestion=\"suggestion\" class=\"x-next-queries__suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-next-query__query\">{{ suggestion.query }}</span>\n </template>\n </NextQuery>\n <button>Custom Behaviour</button>\n </template>\n </NextQueries>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { NextQueries, NextQuery } from '@empathyco/x-components/next-queries'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'NextQueriesDemo',\n components: {\n SearchInput,\n NextQueries,\n NextQuery,\n TrendingIcon,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode","highlightCurated"],"mappings":";;;;;;AAgCoB,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AA7BhB,EAAA,OAAAC,SAAA,EAAwB,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IACxB,WAAM,EAAA,IAAA,CAAA,mBAAA;AAAA,IAAA,WAAA,EAAA,cAAA;IAEK,KAAO,EAAA,gBAAA;AAAA,GAAA,EAAA;aASdC,OAcY,CAAA,CAAA,SAAA,KAAA;AAAA,MAZTC,UAAA,CAAA,IAAA,CAAY,QAAS,YAAW,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,gBAAA,EAAA,IAAA,CAAA,gBAAA,EAAA,CAAA,CAAA,EAAA,MAAA;AAAA,QAAAC,WAAA,CAChC,oBAAmBC,EAAAA;AAAAA,UACpB,UAAM,EAAA,SAAA,CAAA,UAAA;AAAA,UAAA,mBAAA,EAAA,IAAA,CAAA,gBAAA;AAnBhB,UAAA,KAAA,EAAA,yCAAA;AAAA,SAAA,EAAA;;AAAA,YAAAJ,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,GAAA,cAAA,EAAA,CAAA,CAAA,CAAA;AAAA,WAAA,CAAA;;;;AAAA,OAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -43,7 +43,7 @@ var _sfc_main = defineComponent({
|
|
|
43
43
|
*
|
|
44
44
|
* @internal
|
|
45
45
|
*/
|
|
46
|
-
const stateNextQueries = useGetter('nextQueries'
|
|
46
|
+
const stateNextQueries = useGetter('nextQueries').nextQueries;
|
|
47
47
|
/**.
|
|
48
48
|
* The list of next queries finally rendered
|
|
49
49
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-queries.vue2.js","sources":["../../../../../src/x-modules/next-queries/components/next-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"renderedNextQueries\"\n data-test=\"next-queries\"\n class=\"x-next-queries\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Next Query item\n @binding {Object} v-bind - Next Query suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Next Query suggestion data<br /> - **index** <code>number</code> - Next Query suggestion index\n @binding {boolean} highlightCurated - True if the curated NQs should be highlighted\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope, highlightCurated }\">\n <NextQuery\n v-slot=\"nextQueryScope\"\n :suggestion=\"baseScope.suggestion\"\n :highlight-curated=\"highlightCurated\"\n class=\"x-next-queries__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Next Query content\n @binding {Object} v-bind - Next Query suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Next Query suggestion data<br /> - **index** <code>number</code> - Next Query suggestion index\n @binding {boolean} shouldHighlightCurated - True if the curated NQ should be highlighted\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...nextQueryScope }\" />\n </NextQuery>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport type { NextQuery as NextQueryModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { nextQueriesXModule } from '../x-module'\nimport NextQuery from './next-query.vue'\n\n/**\n * Simple next-queries component that renders a list of\n * [`BaseSuggestions`](./x-components.base-suggestions.md),\n * allowing the user to select one of them, and emitting the needed events. A next query is a\n * suggestion for a new search, related to your previous query. I.e. If people normally search\n * for `shirts`, and then `trousers`, `trousers` would be a next query of `shirts`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'NextQueries',\n xModule: nextQueriesXModule.name,\n components: {\n NextQuery,\n BaseSuggestions,\n },\n props: {\n /**\n * Flag to indicate if the curated next queries should be displayed different.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n /**\n * NextQueries list to be used instead of state NextQueries.\n *\n * @public\n */\n suggestions: Array as PropType<NextQueryModel[]>,\n },\n setup(props) {\n /**\n * The list of next queries from the state.\n *\n * @internal\n */\n const stateNextQueries = useGetter('nextQueries'
|
|
1
|
+
{"version":3,"file":"next-queries.vue2.js","sources":["../../../../../src/x-modules/next-queries/components/next-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"renderedNextQueries\"\n data-test=\"next-queries\"\n class=\"x-next-queries\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Next Query item\n @binding {Object} v-bind - Next Query suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Next Query suggestion data<br /> - **index** <code>number</code> - Next Query suggestion index\n @binding {boolean} highlightCurated - True if the curated NQs should be highlighted\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope, highlightCurated }\">\n <NextQuery\n v-slot=\"nextQueryScope\"\n :suggestion=\"baseScope.suggestion\"\n :highlight-curated=\"highlightCurated\"\n class=\"x-next-queries__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Next Query content\n @binding {Object} v-bind - Next Query suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Next Query suggestion data<br /> - **index** <code>number</code> - Next Query suggestion index\n @binding {boolean} shouldHighlightCurated - True if the curated NQ should be highlighted\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...nextQueryScope }\" />\n </NextQuery>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport type { NextQuery as NextQueryModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { nextQueriesXModule } from '../x-module'\nimport NextQuery from './next-query.vue'\n\n/**\n * Simple next-queries component that renders a list of\n * [`BaseSuggestions`](./x-components.base-suggestions.md),\n * allowing the user to select one of them, and emitting the needed events. A next query is a\n * suggestion for a new search, related to your previous query. I.e. If people normally search\n * for `shirts`, and then `trousers`, `trousers` would be a next query of `shirts`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'NextQueries',\n xModule: nextQueriesXModule.name,\n components: {\n NextQuery,\n BaseSuggestions,\n },\n props: {\n /**\n * Flag to indicate if the curated next queries should be displayed different.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n /**\n * NextQueries list to be used instead of state NextQueries.\n *\n * @public\n */\n suggestions: Array as PropType<NextQueryModel[]>,\n },\n setup(props) {\n /**\n * The list of next queries from the state.\n *\n * @internal\n */\n const stateNextQueries = useGetter('nextQueries').nextQueries\n\n /**.\n * The list of next queries finally rendered\n *\n * @internal\n */\n const renderedNextQueries = computed(() => props.suggestions ?? stateNextQueries.value)\n\n return { renderedNextQueries }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Basic example\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any next\nqueries it will show them\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <NextQueries />\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { NextQueries } from '@empathyco/x-components/next-queries'\n\nexport default {\n name: 'NextQueriesDemo',\n components: {\n SearchInput,\n NextQueries,\n },\n}\n</script>\n```\n\nThe component has three optional props. `animation` to render the component with an animation,\n`maxItemsToRender` to limit the number of next queries will be rendered (by default it is 5) and\n`highlightCurated` to indicate if the curated Next Queries inside the list should be highlighted.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <NextQueries :animation=\"'FadeAndSlide'\" :maxItemsToRender=\"10\" :highlightCurated=\"true\" />\n </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { NextQueries } from '@empathyco/x-components/next-queries'\nimport { FadeAndSlide } from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('FadeAndSlide', FadeAndSlide)\nexport default {\n name: 'NextQueriesDemo',\n components: {\n SearchInput,\n NextQueries,\n },\n}\n</script>\n```\n\n### Overriding Next Queries' Content\n\nYou can use your custom implementation of the Next Query's content. In the example below, instead of\nusing the default Next Query's content, an icon is added, as well as a span with the query of the\nNext Query suggestion.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <NextQueries>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-next-query__query\">{{ suggestion.query }}</span>\n </template>\n </NextQueries>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { NextQueries } from '@empathyco/x-components/next-queries'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'NextQueriesDemo',\n components: {\n SearchInput,\n NextQueries,\n TrendingIcon,\n },\n}\n</script>\n```\n\n### Adding a custom next query component\n\nYou can use your custom implementation of a next query component. To work correctly, it should use\nthe `emitNextQuerySelected` function when the next query is selected. In the example below, instead\nof using the default `button` tag for a next query, an icon is added, and the text of the next query\nis wrapped in a `span`\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <NextQueries>\n <template #suggestion=\"{ suggestion }\">\n <NextQuery :suggestion=\"suggestion\" class=\"x-next-queries__suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-next-query__query\">{{ suggestion.query }}</span>\n </template>\n </NextQuery>\n <button>Custom Behaviour</button>\n </template>\n </NextQueries>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { NextQueries, NextQuery } from '@empathyco/x-components/next-queries'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'NextQueriesDemo',\n components: {\n SearchInput,\n NextQueries,\n NextQuery,\n TrendingIcon,\n },\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;AA4CA;;;;;;;;AAQE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,kBAAkB,CAAC,IAAI;AAChC,IAAA,UAAU,EAAE;QACV,SAAS;QACT,eAAe;AAChB,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,WAAW,EAAE,KAAmC;AACjD,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;AAIE;QACF,MAAM,gBAAiB,GAAE,SAAS,CAAC,aAAa,CAAC,CAAC,WAAU,CAAA;AAE5D;;;;AAIE;AACF,QAAA,MAAM,mBAAkB,GAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,WAAY,IAAG,gBAAgB,CAAC,KAAK,CAAA,CAAA;QAEtF,OAAO,EAAE,mBAAoB,EAAA,CAAA;KAC9B;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popular-searches.vue.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches'
|
|
1
|
+
{"version":3,"file":"popular-searches.vue.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches')\n\n return { popularSearches }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Default Usage\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any popular\nsearches it will show them.\n\n```vue live\n<template>\n <PopularSearches />\n</template>\n\n<script>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n },\n}\n</script>\n```\n\nThe component has two optional props. `animation` to render the component with an animation and\n`maxItemsToRender` to limit the number of popular searches will be rendered (by default it is 5).\n\n```vue live\n<template>\n <PopularSearches :animation=\"'FadeAndSlide'\" :maxItemsToRender=\"10\" />\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport FadeAndSlide from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('FadeAndSlide', FadeAndSlide)\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n FadeAndSlide,\n },\n}\n</script>\n```\n\n### Overriding Popular Search's Content\n\nYou can use your custom implementation of the Popular Search's content. In the example below,\ninstead of using the default Popular Search's content, an icon is added, as well as a span with the\nquery of the Popular Search's suggestion.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearches>\n</template>\n\n<script>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n TrendingIcon,\n },\n}\n</script>\n```\n\n### Adding a Custom Popular Search Item\n\nYou can use your custom implementation for the whole Popular Search item. In the example below, we\nchange the default implementation of the Popular Search in Popular Searches. A custom Popular Search\nimplementation is added, it has an image and a span as content (as in the previous example). Also, a\nbutton with a user customized behaviour is added at the same hierarchical level as the Popular\nSearch component.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion=\"{ suggestion }\">\n <PopularSearch :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearch>\n <button>Custom Behaviour</button>\n </template>\n </PopularSearches>\n</template>\n\n<script>\nimport { PopularSearches, PopularSearch } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n PopularSearch,\n TrendingIcon,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;AA6BoB,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AA1BX,EAAA,OAAAC,SAAA,EAAqB,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IAC1B,WAAU,EAAA,IAAA,CAAA,eAAA;AAAA,IAAA,KAAA,EAAA,oBAAA;IAEC,WAAO,EAAA,kBAAA;AAAA,GAAA,EAAA;aAQdC,OAYgB,CAAA,CAAA,SAAA,KAAA;AAAA,MAVbC,UAAA,CAAA,IAAA,CAAY,QAAS,YAAW,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,CAAA,CAAA,EAAA,MAAA;AAAA,QAC3BC,WAAA,CAAA,wBAAA,EAAA;AAAA,UAAA,UAAA,EAAA,SAAA,CAAA,UAAA;AAjBhB,UAAA,KAAA,EAAA,6CAAA;AAAA,SAAA,EAAA;;AAAA,YAAAH,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,GAAA,kBAAA,EAAA,CAAA,CAAA,CAAA;AAAA,WAAA,CAAA;;;;AAAA,OAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popular-searches.vue2.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches'
|
|
1
|
+
{"version":3,"file":"popular-searches.vue2.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches')\n\n return { popularSearches }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Default Usage\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any popular\nsearches it will show them.\n\n```vue live\n<template>\n <PopularSearches />\n</template>\n\n<script>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n },\n}\n</script>\n```\n\nThe component has two optional props. `animation` to render the component with an animation and\n`maxItemsToRender` to limit the number of popular searches will be rendered (by default it is 5).\n\n```vue live\n<template>\n <PopularSearches :animation=\"'FadeAndSlide'\" :maxItemsToRender=\"10\" />\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport FadeAndSlide from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('FadeAndSlide', FadeAndSlide)\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n FadeAndSlide,\n },\n}\n</script>\n```\n\n### Overriding Popular Search's Content\n\nYou can use your custom implementation of the Popular Search's content. In the example below,\ninstead of using the default Popular Search's content, an icon is added, as well as a span with the\nquery of the Popular Search's suggestion.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearches>\n</template>\n\n<script>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n TrendingIcon,\n },\n}\n</script>\n```\n\n### Adding a Custom Popular Search Item\n\nYou can use your custom implementation for the whole Popular Search item. In the example below, we\nchange the default implementation of the Popular Search in Popular Searches. A custom Popular Search\nimplementation is added, it has an image and a span as content (as in the previous example). Also, a\nbutton with a user customized behaviour is added at the same hierarchical level as the Popular\nSearch component.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion=\"{ suggestion }\">\n <PopularSearch :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearch>\n <button>Custom Behaviour</button>\n </template>\n </PopularSearches>\n</template>\n\n<script>\nimport { PopularSearches, PopularSearch } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n PopularSearch,\n TrendingIcon,\n },\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;AAuCA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,sBAAsB,CAAC,IAAI;AACpC,IAAA,UAAU,EAAE;QACV,aAAa;QACb,eAAe;AAChB,KAAA;IACD,KAAK,GAAA;AACH;;;;AAIE;QACF,MAAM,EAAE,eAAc,EAAI,GAAE,SAAS,CAAC,iBAAiB,CAAA,CAAA;QAEvD,OAAO,EAAE,eAAgB,EAAA,CAAA;KAC1B;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-suggestion.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestion.vue"],"sourcesContent":["<template>\n <BaseSuggestion\n v-slot=\"baseScope\"\n v-bind=\"{ query, suggestion, suggestionSelectedEvents }\"\n class=\"x-query-suggestion\"\n data-test=\"query-suggestion\"\n feature=\"query_suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Query Suggestion 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 \\| undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n</template>\n\n<script lang=\"ts\">\nimport type { Suggestion } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\n\n/**\n * This component renders a suggestion for a query. A query suggestion is a recommended query\n * based on previous search queries. It contains the query itself and a set of filters associated.\n * For example, if you're searching for _shirt_, a query suggestion could be _long sleeve shirt_.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestion',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestion },\n props: {\n /** The suggestion to render. */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true,\n },\n },\n setup(props) {\n /** The normalized query of the query-suggestions module. */\n const query = useGetter('querySuggestions'
|
|
1
|
+
{"version":3,"file":"query-suggestion.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestion.vue"],"sourcesContent":["<template>\n <BaseSuggestion\n v-slot=\"baseScope\"\n v-bind=\"{ query, suggestion, suggestionSelectedEvents }\"\n class=\"x-query-suggestion\"\n data-test=\"query-suggestion\"\n feature=\"query_suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Query Suggestion 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 \\| undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n</template>\n\n<script lang=\"ts\">\nimport type { Suggestion } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\n\n/**\n * This component renders a suggestion for a query. A query suggestion is a recommended query\n * based on previous search queries. It contains the query itself and a set of filters associated.\n * For example, if you're searching for _shirt_, a query suggestion could be _long sleeve shirt_.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestion',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestion },\n props: {\n /** The suggestion to render. */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true,\n },\n },\n setup(props) {\n /** The normalized query of the query-suggestions module. */\n const query = useGetter('querySuggestions').normalizedQuery\n\n /**\n * Emits {@link QuerySuggestionsXEvents.UserSelectedAQuerySuggestion} with the suggestion as\n * payload when selecting the query suggestion.\n */\n const suggestionSelectedEvents = {\n UserSelectedAQuerySuggestion: props.suggestion,\n }\n\n return {\n query,\n suggestionSelectedEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserSelectedAQuerySuggestion`](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 query suggestion\n data.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you can see how a single query suggestion is rendered using the `suggestion` prop.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" />\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n}\n</script>\n```\n\n### Play with default slot\n\nIn this example, we are adding an emoji next to the suggestion.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n}\n</script>\n```\n\n### Play with events\n\nIn this example, when you click on the query suggestion, a message is displayed to illustrate that\nthe `UserSelectedAQuerySuggestion` event has been triggered.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" @UserSelectedAQuerySuggestion=\"alertSuggestion\" />\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n methods: {\n alertSuggestion(querySuggestion) {\n alert(`You have clicked the query suggestion: ${querySuggestion.query}`)\n },\n },\n}\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_mergeProps","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps"],"mappings":";;;;;AACE,EAAA,MAAA,yBAAA,GAAAA,gBAAA,CAciB,gBAdjB,CAAA,CAAA;SAIEC,SAAU,EAAA,EAAAC,WAAA;AAAA,IAAkB,yBAAA;AAAA,IAAAC,UAAA,CAAA,EAAA,KAAA,EAAA,IAAA,CAAA,KAAA,EAAA,UAAA,EAAA,IAAA,CAAA,UAAA,EAAA,wBAAA,EAAA,IAAA,CAAA,wBAAA,EAAA,EAAA;AAAA,MAC5B,KAAO,EAAA,oBAAA;AAAA,MAAA,WAAA,EAAA,kBAAA;AANX,MAAA,OAAA,EAAA,kBAAA;AAAA,KAAA,CAAA;AAcI,IAAA;AAAA,MAAA,OAAA,EAAAC,OAAA,CAAA,CAAA,SAAA,KAAA;AAdJ,QAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,CAAA,CAAA,CAAA;AAAA,OAAA,CAAA;;;;;;;;;;;;"}
|
|
@@ -34,7 +34,7 @@ var _sfc_main = defineComponent({
|
|
|
34
34
|
},
|
|
35
35
|
setup(props) {
|
|
36
36
|
/** The normalized query of the query-suggestions module. */
|
|
37
|
-
const query = useGetter('querySuggestions'
|
|
37
|
+
const query = useGetter('querySuggestions').normalizedQuery;
|
|
38
38
|
/**
|
|
39
39
|
* Emits {@link QuerySuggestionsXEvents.UserSelectedAQuerySuggestion} with the suggestion as
|
|
40
40
|
* payload when selecting the query suggestion.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-suggestion.vue2.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestion.vue"],"sourcesContent":["<template>\n <BaseSuggestion\n v-slot=\"baseScope\"\n v-bind=\"{ query, suggestion, suggestionSelectedEvents }\"\n class=\"x-query-suggestion\"\n data-test=\"query-suggestion\"\n feature=\"query_suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Query Suggestion 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 \\| undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n</template>\n\n<script lang=\"ts\">\nimport type { Suggestion } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\n\n/**\n * This component renders a suggestion for a query. A query suggestion is a recommended query\n * based on previous search queries. It contains the query itself and a set of filters associated.\n * For example, if you're searching for _shirt_, a query suggestion could be _long sleeve shirt_.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestion',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestion },\n props: {\n /** The suggestion to render. */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true,\n },\n },\n setup(props) {\n /** The normalized query of the query-suggestions module. */\n const query = useGetter('querySuggestions'
|
|
1
|
+
{"version":3,"file":"query-suggestion.vue2.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestion.vue"],"sourcesContent":["<template>\n <BaseSuggestion\n v-slot=\"baseScope\"\n v-bind=\"{ query, suggestion, suggestionSelectedEvents }\"\n class=\"x-query-suggestion\"\n data-test=\"query-suggestion\"\n feature=\"query_suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Query Suggestion 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 \\| undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n</template>\n\n<script lang=\"ts\">\nimport type { Suggestion } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\n\n/**\n * This component renders a suggestion for a query. A query suggestion is a recommended query\n * based on previous search queries. It contains the query itself and a set of filters associated.\n * For example, if you're searching for _shirt_, a query suggestion could be _long sleeve shirt_.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestion',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestion },\n props: {\n /** The suggestion to render. */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true,\n },\n },\n setup(props) {\n /** The normalized query of the query-suggestions module. */\n const query = useGetter('querySuggestions').normalizedQuery\n\n /**\n * Emits {@link QuerySuggestionsXEvents.UserSelectedAQuerySuggestion} with the suggestion as\n * payload when selecting the query suggestion.\n */\n const suggestionSelectedEvents = {\n UserSelectedAQuerySuggestion: props.suggestion,\n }\n\n return {\n query,\n suggestionSelectedEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserSelectedAQuerySuggestion`](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 query suggestion\n data.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you can see how a single query suggestion is rendered using the `suggestion` prop.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" />\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n}\n</script>\n```\n\n### Play with default slot\n\nIn this example, we are adding an emoji next to the suggestion.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n}\n</script>\n```\n\n### Play with events\n\nIn this example, when you click on the query suggestion, a message is displayed to illustrate that\nthe `UserSelectedAQuerySuggestion` event has been triggered.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" @UserSelectedAQuerySuggestion=\"alertSuggestion\" />\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n methods: {\n alertSuggestion(querySuggestion) {\n alert(`You have clicked the query suggestion: ${querySuggestion.query}`)\n },\n },\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA0BA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,uBAAuB,CAAC,IAAI;IACrC,UAAU,EAAE,EAAE,cAAa,EAAG;AAC9B,IAAA,KAAK,EAAE;;AAEL,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,MAA8B;AACpC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;;QAET,MAAM,KAAM,GAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC,eAAc,CAAA;AAE1D;;;AAGE;AACF,QAAA,MAAM,wBAAuB,GAAI;YAC/B,4BAA4B,EAAE,KAAK,CAAC,UAAU;SAChD,CAAA;QAEA,OAAO;YACL,KAAK;YACL,wBAAwB;SAC1B,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-suggestions.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions'
|
|
1
|
+
{"version":3,"file":"query-suggestions.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions')\n\n return { suggestions: querySuggestions }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ------------------------------------------- | -------- | ------- |\n| `animation` | Animation component for `QuerySuggestions`. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of query suggestions to be rendered. | `number` | |\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example, a list of query suggestions is displayed. See how the suggestions change as you\ntype “sandal”. If you click on a suggestion, the search term in the search input is updated and the\nquery suggestions are changed to reflect the new search term.\n\n_Type “sandal” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestions,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the\nmatching query suggestions are shuffled with a slight delay as more letters of the term are typed.\n\n_Type “lipstick” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions :animation=\"'StaggeredFadeAndSlide'\" />\n </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { StaggeredFadeAndSlide } from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide)\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestions,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with suggestion slot\n\nHere, the `suggestion` binding property passes the suggestion data.\n\n_Type “bag” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\nimport { QuerySuggestion, QuerySuggestions } from '@empathyco/x-components/query-suggestions'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestion,\n QuerySuggestions,\n },\n}\n</script>\n```\n\n<!-- prettier-ignore-start -->\n::: danger\nIf you're not using the [`QuerySuggestion`](./query-suggestion.md) component, then\nyou must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in\n`QuerySuggestions`.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <button @click=\"emitSuggestionClickedEvents($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\n import { QuerySuggestions } from '@empathyco/x-components/query-suggestions';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions\n },\n methods: {\n emitSuggestionClickedEvents(event, suggestion) {\n this.$x.emit('UserAcceptedAQuery', suggestion.query, {\n target: event.target\n });\n this.$x.emit('UserSelectedASuggestion', suggestion, {\n target: event.target\n });\n this.$x.emit('UserSelectedAQuerySuggestion', suggestion, {\n target: event.target\n });\n }\n }\n };\n</script>\n```\n\n:::\n<!-- prettier-ignore-end -->\n\n### Play with suggestion-content slot\n\nIn this example, the `suggestion` and `query` properties of the `suggestion-content` slot are used\nto paint a suggestion with an icon.\n\n_Type “trousers” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion-content=\"{ suggestion, query }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { Highlight } from '@empathyco/x-components'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions,\n Highlight,\n },\n}\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `QuerySuggestions`\ncomponent communicates with the [`SearchInput`](../search-box/x-components.search-input.md),\nupdating the term in the search input.\n\n_Type “pants” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;AA6BoB,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AA1BX,EAAA,OAAAC,SAAA,EAAsB,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IAC3B,WAAU,EAAA,IAAA,CAAA,WAAA;AAAA,IAAA,KAAA,EAAA,qBAAA;IAEC,WAAO,EAAA,mBAAA;AAAA,GAAA,EAAA;aAQdC,OAYkB,CAAA,CAAA,SAAA,KAAA;AAAA,MAVfC,UAAA,CAAA,IAAA,CAAY,QAAS,YAAW,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,CAAA,CAAA,EAAA,MAAA;AAAA,QAC3BC,WAAA,CAAA,0BAAA,EAAA;AAAA,UAAA,UAAA,EAAA,SAAA,CAAA,UAAA;AAjBhB,UAAA,KAAA,EAAA,8CAAA;AAAA,SAAA,EAAA;;AAAA,YAAAH,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,GAAA,oBAAA,EAAA,CAAA,CAAA,CAAA;AAAA,WAAA,CAAA;;;;AAAA,OAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -28,7 +28,7 @@ var _sfc_main = defineComponent({
|
|
|
28
28
|
components: { BaseSuggestions, QuerySuggestion },
|
|
29
29
|
setup() {
|
|
30
30
|
/** The module's list of suggestions. */
|
|
31
|
-
const { querySuggestions } = useGetter('querySuggestions'
|
|
31
|
+
const { querySuggestions } = useGetter('querySuggestions');
|
|
32
32
|
return { suggestions: querySuggestions };
|
|
33
33
|
},
|
|
34
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-suggestions.vue2.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions'
|
|
1
|
+
{"version":3,"file":"query-suggestions.vue2.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions')\n\n return { suggestions: querySuggestions }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ------------------------------------------- | -------- | ------- |\n| `animation` | Animation component for `QuerySuggestions`. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of query suggestions to be rendered. | `number` | |\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example, a list of query suggestions is displayed. See how the suggestions change as you\ntype “sandal”. If you click on a suggestion, the search term in the search input is updated and the\nquery suggestions are changed to reflect the new search term.\n\n_Type “sandal” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestions,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the\nmatching query suggestions are shuffled with a slight delay as more letters of the term are typed.\n\n_Type “lipstick” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions :animation=\"'StaggeredFadeAndSlide'\" />\n </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { StaggeredFadeAndSlide } from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide)\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestions,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with suggestion slot\n\nHere, the `suggestion` binding property passes the suggestion data.\n\n_Type “bag” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\nimport { QuerySuggestion, QuerySuggestions } from '@empathyco/x-components/query-suggestions'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestion,\n QuerySuggestions,\n },\n}\n</script>\n```\n\n<!-- prettier-ignore-start -->\n::: danger\nIf you're not using the [`QuerySuggestion`](./query-suggestion.md) component, then\nyou must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in\n`QuerySuggestions`.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <button @click=\"emitSuggestionClickedEvents($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\n import { QuerySuggestions } from '@empathyco/x-components/query-suggestions';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions\n },\n methods: {\n emitSuggestionClickedEvents(event, suggestion) {\n this.$x.emit('UserAcceptedAQuery', suggestion.query, {\n target: event.target\n });\n this.$x.emit('UserSelectedASuggestion', suggestion, {\n target: event.target\n });\n this.$x.emit('UserSelectedAQuerySuggestion', suggestion, {\n target: event.target\n });\n }\n }\n };\n</script>\n```\n\n:::\n<!-- prettier-ignore-end -->\n\n### Play with suggestion-content slot\n\nIn this example, the `suggestion` and `query` properties of the `suggestion-content` slot are used\nto paint a suggestion with an icon.\n\n_Type “trousers” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion-content=\"{ suggestion, query }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { Highlight } from '@empathyco/x-components'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions,\n Highlight,\n },\n}\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `QuerySuggestions`\ncomponent communicates with the [`SearchInput`](../search-box/x-components.search-input.md),\nupdating the term in the search input.\n\n_Type “pants” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions,\n },\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAuCA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,uBAAuB,CAAC,IAAI;AACrC,IAAA,UAAU,EAAE,EAAE,eAAe,EAAE,iBAAiB;IAChD,KAAK,GAAA;;QAEH,MAAM,EAAE,gBAAe,EAAI,GAAE,SAAS,CAAC,kBAAkB,CAAA,CAAA;AAEzD,QAAA,OAAO,EAAE,WAAW,EAAE,gBAAiB,EAAA,CAAA;KACxC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompts-tag-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n :show-buttons=\"showButtons && selectedPromptIndex === -1\"\n :scroll-container-class=\"[\n 'x-related-prompts-tag-list-scroll-container',\n scrollContainerClass || '',\n ]\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"{\n ...(selectedPromptIndex === index && { width: '100%' }),\n ...(isAnimating && { pointerEvents: 'none' }),\n }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :related-prompt=\"relatedPrompt\"\n :on-select=\"() => onSelect(index)\"\n :is-selected=\"selectedPromptIndex === index\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.tagging?.toolingDisplayTagging\"\n :event-metadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false,\n }\"\n >\n <RelatedPrompt\n :related-prompt=\"relatedPrompt\"\n :selected=\"selectedPromptIndex === index\"\n @click=\"onSelect(index)\"\n >\n <template #related-prompt-extra-content>\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n </template>\n </RelatedPrompt>\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, ref } from 'vue'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport SlidingPanel from '../../../components/sliding-panel.vue'\nimport { use$x, useState } from '../../../composables'\nimport { relatedPromptsXModule } from '../x-module'\nimport RelatedPrompt from './related-prompt.vue'\n\n/**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The boolean prop to handle the visiblity of sliding pannel buttons.\n *\n * @public\n */\n showButtons: { type: Boolean, default: true },\n /**\n * The CSS class for the wrapper of all the related prompt wrapper elements.\n *\n * @public\n */\n scrollContainerClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700,\n },\n },\n setup(props) {\n const x = use$x()\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts')\n\n const clickedListItemIndex = ref<number | null>(null)\n const initialOffsetLefts: Record<number, number> = {}\n const isAnimating = ref(false)\n const listItems = ref<HTMLElement[]>([])\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!),\n ),\n )\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length),\n )\n\n const indexRelatedPrompts = computed(() =>\n relatedPrompts.value.map((relatedPrompt, index) => ({ ...relatedPrompt, index })),\n )\n\n const visibleRelatedPrompts = computed(() =>\n selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value,\n )\n\n let timeOutId: number\n const resetTransitionStyle = (excludedProperties: Array<string> = ['width']) => {\n if (timeOutId) {\n clearTimeout(timeOutId)\n }\n\n isAnimating.value = true\n timeOutId = +setTimeout(() => {\n isAnimating.value = false\n clickedListItemIndex.value = null\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (!excludedProperties.includes(property)) {\n element.style.removeProperty(property)\n }\n })\n })\n }, props.animationDurationInMs)\n }\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle()\n\n clickedListItemIndex.value = selectedIndex\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex,\n )!\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n initialOffsetLefts[index] = element.offsetLeft\n element.style.left = `${element.offsetLeft}px`\n element.style.position = 'absolute'\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n\n if (index !== selectedIndex) {\n element.style.opacity = '1'\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`\n }\n })\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth\n\n selected.style.left = '0px'\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important',\n )\n })\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n selected.style.left = '0px'\n selected.style.position = 'absolute'\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width')\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`\n })\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex, {\n relatedPrompt: relatedPrompts.value[selectedIndex],\n selectedPrompt: selectedPromptIndex.value,\n })\n }\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Prepare the element for the enter animation\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n }\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1'\n element.style.position = 'absolute'\n element.style.transform = 'translateY(0)'\n })\n\n done()\n }\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n })\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs)\n }\n\n // Changing the request will trigger the appear animation, so we need to reset the\n // style after it finishes\n x.on('SearchRequestChanged', false).subscribe(() => {\n resetTransitionStyle([])\n })\n\n return {\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n}\n.x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n width: 100%;\n}\n.x-related-prompts-tag-list-item {\n height: 100%;\n flex-shrink: 0;\n}\n</style>\n"],"names":["_resolveComponent","_openBlock","_createBlock","buttonClass","showButtons","scrollContainerClass","_renderSlot","_withCtx","_createVNode","_TransitionGroup","onLeave","_createElementBlock","_Fragment","_renderList","_normalizeClass","selectedPromptIndex","isAnimating","_normalizeStyle","onSelect","x"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"related-prompts-tag-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n :show-buttons=\"showButtons && selectedPromptIndex === -1\"\n :scroll-container-class=\"[\n 'x-related-prompts-tag-list-scroll-container',\n scrollContainerClass || '',\n ]\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"{\n ...(selectedPromptIndex === index && { width: '100%' }),\n ...(isAnimating && { pointerEvents: 'none' }),\n }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :related-prompt=\"relatedPrompt\"\n :on-select=\"() => onSelect(index)\"\n :is-selected=\"selectedPromptIndex === index\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.tagging?.toolingDisplayTagging\"\n :event-metadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false,\n }\"\n >\n <RelatedPrompt\n :related-prompt=\"relatedPrompt\"\n :selected=\"selectedPromptIndex === index\"\n @click=\"onSelect(index)\"\n >\n <template #related-prompt-extra-content>\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n </template>\n </RelatedPrompt>\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, onBeforeUnmount, ref } from 'vue'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport SlidingPanel from '../../../components/sliding-panel.vue'\nimport { use$x, useState } from '../../../composables'\nimport { relatedPromptsXModule } from '../x-module'\nimport RelatedPrompt from './related-prompt.vue'\n\n/**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The boolean prop to handle the visiblity of sliding pannel buttons.\n *\n * @public\n */\n showButtons: { type: Boolean, default: true },\n /**\n * The CSS class for the wrapper of all the related prompt wrapper elements.\n *\n * @public\n */\n scrollContainerClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700,\n },\n },\n setup(props) {\n const x = use$x()\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts')\n\n const clickedListItemIndex = ref<number | null>(null)\n const initialOffsetLefts: Record<number, number> = {}\n const isAnimating = ref(false)\n const listItems = ref<HTMLElement[]>([])\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!),\n ),\n )\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length),\n )\n\n const indexRelatedPrompts = computed(() =>\n relatedPrompts.value.map((relatedPrompt, index) => ({ ...relatedPrompt, index })),\n )\n\n const visibleRelatedPrompts = computed(() =>\n selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value,\n )\n\n let timeOutId: number\n const resetTransitionStyle = (excludedProperties: Array<string> = ['width']) => {\n if (timeOutId) {\n clearTimeout(timeOutId)\n }\n\n isAnimating.value = true\n timeOutId = +setTimeout(() => {\n isAnimating.value = false\n clickedListItemIndex.value = null\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (!excludedProperties.includes(property)) {\n element.style.removeProperty(property)\n }\n })\n })\n }, props.animationDurationInMs)\n }\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle()\n\n clickedListItemIndex.value = selectedIndex\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex,\n )!\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n initialOffsetLefts[index] = element.offsetLeft\n element.style.left = `${element.offsetLeft}px`\n element.style.position = 'absolute'\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n\n if (index !== selectedIndex) {\n element.style.opacity = '1'\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`\n }\n })\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth\n\n selected.style.left = '0px'\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important',\n )\n })\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n selected.style.left = '0px'\n selected.style.position = 'absolute'\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width')\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`\n })\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex, {\n relatedPrompt: relatedPrompts.value[selectedIndex],\n selectedPrompt: selectedPromptIndex.value,\n })\n }\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Prepare the element for the enter animation\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n }\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1'\n element.style.position = 'absolute'\n element.style.transform = 'translateY(0)'\n })\n\n done()\n }\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n })\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs)\n }\n\n // Changing the request will trigger the appear animation, so we need to reset the\n // style after it finishes\n x.on('SearchRequestChanged', false).subscribe(() => {\n resetTransitionStyle([])\n })\n\n onBeforeUnmount(() => {\n x.emit('RelatedPromptsUnmounted')\n })\n\n return {\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n}\n.x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n width: 100%;\n}\n.x-related-prompts-tag-list-item {\n height: 100%;\n flex-shrink: 0;\n}\n</style>\n"],"names":["_resolveComponent","_openBlock","_createBlock","buttonClass","showButtons","scrollContainerClass","_renderSlot","_withCtx","_createVNode","_TransitionGroup","onLeave","_createElementBlock","_Fragment","_renderList","_normalizeClass","selectedPromptIndex","isAnimating","_normalizeStyle","onSelect","x"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, computed } from 'vue';
|
|
1
|
+
import { defineComponent, ref, computed, onBeforeUnmount } from 'vue';
|
|
2
2
|
import _sfc_main$1 from '../../../components/display-emitter.vue.js';
|
|
3
3
|
import SlidingPanel from '../../../components/sliding-panel.vue.js';
|
|
4
4
|
import '../../../composables/create-use-device.js';
|
|
@@ -198,6 +198,9 @@ var _sfc_main = defineComponent({
|
|
|
198
198
|
x.on('SearchRequestChanged', false).subscribe(() => {
|
|
199
199
|
resetTransitionStyle([]);
|
|
200
200
|
});
|
|
201
|
+
onBeforeUnmount(() => {
|
|
202
|
+
x.emit('RelatedPromptsUnmounted');
|
|
203
|
+
});
|
|
201
204
|
return {
|
|
202
205
|
onSelect,
|
|
203
206
|
onBeforeEnter,
|