@empathyco/x-components 6.1.4 → 6.2.1
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 +22 -0
- package/ai/index.js +0 -1
- package/core/index.js.map +1 -1
- package/docs/API-reference/api/x-components.aicarousel.md +24 -28
- package/docs/API-reference/api/x-components.aimutations.md +1 -58
- package/docs/API-reference/api/x-components.aimutations.setexcludedresultids.md +1 -1
- package/docs/API-reference/api/x-components.aistate.md +0 -55
- package/docs/API-reference/api/x-components.aixevents.md +3 -3
- package/docs/API-reference/api/{x-components.aixevents.userclickedaioverviewexpandbutton.md → x-components.aixevents.userclickedanaicarouseladd2cart.md} +3 -3
- package/docs/API-reference/api/{x-components.aixevents.userclickedanaioverviewresult.md → x-components.aixevents.userclickedanaicarouselresult.md} +3 -3
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +2 -2
- package/docs/API-reference/api/x-components.md +0 -9
- package/docs/API-reference/api/x-components.simplefilter.md +2 -2
- package/docs/API-reference/api/x-components.slidingpanel.md +9 -0
- package/docs/API-reference/api/x-components.snippetcallbacks.md +2 -2
- package/docs/API-reference/components/ai/x-components.ai-carousel.md +9 -7
- package/docs/API-reference/components/ai/x-components.ai-grouped-carousel.md +25 -0
- package/docs/API-reference/components/common/x-components.display-click-provider.md +1 -1
- package/docs/API-reference/components/common/x-components.sliding-panel.md +1 -0
- package/js/components/display-click-provider.vue.js +3 -3
- package/js/components/display-click-provider.vue.js.map +1 -1
- package/js/components/icons/spinner.vue.js +2 -2
- package/js/components/sliding-panel.vue.js +1 -1
- package/js/components/sliding-panel.vue.js.map +1 -1
- package/js/components/sliding-panel.vue2.js +7 -0
- package/js/components/sliding-panel.vue2.js.map +1 -1
- package/js/index.js +0 -1
- package/js/index.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue.js +121 -66
- package/js/x-modules/ai/components/ai-carousel.vue.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue2.js +18 -17
- package/js/x-modules/ai/components/ai-carousel.vue2.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue3.js +1 -1
- package/js/x-modules/ai/components/ai-grouped-carousel.vue.js +68 -0
- package/js/x-modules/ai/components/ai-grouped-carousel.vue.js.map +1 -0
- package/js/x-modules/ai/components/{ai-overview.vue2.js → ai-grouped-carousel.vue2.js} +24 -86
- package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js.map +1 -0
- package/js/x-modules/ai/store/actions/fetch-and-save-ai-suggestions.action.js +2 -10
- package/js/x-modules/ai/store/actions/fetch-and-save-ai-suggestions.action.js.map +1 -1
- package/js/x-modules/ai/store/module.js +6 -18
- package/js/x-modules/ai/store/module.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js +2 -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.map +1 -1
- package/js/x-modules/tagging/wiring.js +2 -2
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/package.json +2 -3
- package/report/x-components.api.json +122 -711
- package/report/x-components.api.md +46 -128
- package/types/src/components/sliding-panel.vue.d.ts +15 -0
- package/types/src/components/sliding-panel.vue.d.ts.map +1 -1
- package/types/src/components/snippet-callbacks.vue.d.ts +2 -2
- package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts +24 -28
- package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts.map +1 -1
- package/types/src/x-modules/ai/components/ai-grouped-carousel.vue.d.ts +19 -0
- package/types/src/x-modules/ai/components/ai-grouped-carousel.vue.d.ts.map +1 -0
- package/types/src/x-modules/ai/components/index.d.ts +0 -1
- package/types/src/x-modules/ai/components/index.d.ts.map +1 -1
- package/types/src/x-modules/ai/events.types.d.ts +2 -2
- package/types/src/x-modules/ai/events.types.d.ts.map +1 -1
- package/types/src/x-modules/ai/store/actions/fetch-and-save-ai-suggestions.action.d.ts.map +1 -1
- package/types/src/x-modules/ai/store/module.d.ts.map +1 -1
- package/types/src/x-modules/ai/store/types.d.ts +6 -29
- package/types/src/x-modules/ai/store/types.d.ts.map +1 -1
- package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +2 -2
- package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts +2 -2
- package/types/src/x-modules/tagging/wiring.d.ts +2 -2
- package/docs/API-reference/api/x-components.aimutations.setisnoresults.md +0 -13
- package/docs/API-reference/api/x-components.aimutations.setresponsetext.md +0 -13
- package/docs/API-reference/api/x-components.aimutations.setsuggestiontext.md +0 -13
- package/docs/API-reference/api/x-components.aioverview.md +0 -88
- package/docs/API-reference/api/x-components.aistate.isnoresults.md +0 -13
- package/docs/API-reference/api/x-components.aistate.responsetext.md +0 -13
- package/docs/API-reference/api/x-components.aistate.suggestiontext.md +0 -11
- package/docs/API-reference/components/ai/x-components.ai-overview.md +0 -96
- package/js/x-modules/ai/components/ai-overview.vue.js +0 -267
- package/js/x-modules/ai/components/ai-overview.vue.js.map +0 -1
- package/js/x-modules/ai/components/ai-overview.vue2.js.map +0 -1
- package/js/x-modules/ai/components/ai-overview.vue3.js +0 -7
- package/js/x-modules/ai/components/ai-overview.vue3.js.map +0 -1
- package/types/src/x-modules/ai/components/ai-overview.vue.d.ts +0 -81
- package/types/src/x-modules/ai/components/ai-overview.vue.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliding-panel.vue.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"xds:sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <div\n ref=\"scrollContainerRef\"\n :class=\"scrollContainerClass\"\n class=\"x-sliding-panel__scroll xds:sliding-panel-fade\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <slot name=\"sliding-panel-addons\" :arrived-state=\"arrivedState\" :scroll=\"xScroll\" />\n <template v-if=\"showButtons\">\n <button\n class=\"xds:sliding-panel-button xds:sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"xScroll -= slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <button\n class=\"xds:sliding-panel-button xds:sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"xScroll += slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport {\n useElementBounding,\n useElementVisibility,\n useMutationObserver,\n useScroll,\n whenever,\n} from '@vueuse/core'\nimport { computed, defineComponent, ref } from 'vue'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n const scrollContainerRef = ref<HTMLDivElement>()\n\n const { width: slotContainerWidth } = useElementBounding(scrollContainerRef)\n const isVisible = useElementVisibility(scrollContainerRef)\n\n const {\n x: xScroll,\n arrivedState,\n measure,\n } = useScroll(scrollContainerRef, {\n behavior: 'smooth',\n })\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'xds:sliding-panel-at-start': arrivedState.left,\n 'xds:sliding-panel-at-end': arrivedState.right,\n }))\n\n if (props.resetOnContentChange) {\n useMutationObserver(\n scrollContainerRef,\n mutations => {\n if (mutations.length > 0) {\n xScroll.value = 0\n }\n },\n {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n },\n )\n }\n //ensure positions are right calculated as soon as the sliding panel is shown\n whenever(isVisible as any, measure)\n\n return {\n arrivedState,\n cssClasses,\n scrollContainerRef,\n slotContainerWidth,\n xScroll,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_Fragment","_createTextVNode"],"mappings":";;;;;;AACa,EAAA,OAAA,IAAA,CAAA,KAAA,CAAM,OAAA,IAAAA,SAAA,EAAA,EAAjBC,kBAAA;AAAA,IA+BM,KAAA;AAAA,IAAA;AAAA,MAAA,GAAA,EAAA,CAAA;MA/BoB,KAAA,EAAKC,cAAA,CAAA,CAAC,qBAA4B,IAAA,CAAA,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;;;AAE1C,UAAAH,kBAAA;AAAA,YAQS,QAAA;AAAA,YAAA;AAAA,cAPP,KAAA,EAAKD,cAAA,CAAA,CAAC,yDAAA,EACE,IAAA,CAAA,WAAW,CAAA,CAAA;AAAA,cACnB,WAAA,EAAU,4BAAA;AAAA,cACT,OAAA,EAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,OAAA,IAAW,IAAA,CAAA,kBAAA,GAAqB,IAAA,CAAA,YAAA;AAAA,aAAA;;AAGxC,cAAAE,UAAA,CAAgD,+CAAhD,MAAgD;AAAA,gBAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAE,eAAA;AAAR,kBAAA,GAAA;AAAA,kBAAC;AAAA;AAAA,iBAAA;AAAA,eAAA,EAAA,IAAA;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sliding-panel.vue.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"xds:sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <div\n ref=\"scrollContainerRef\"\n class=\"x-sliding-panel__scroll\"\n :class=\"[scrollContainerClass, { 'xds:sliding-panel-fade': fade }]\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <slot name=\"sliding-panel-addons\" :arrived-state=\"arrivedState\" :scroll=\"xScroll\" />\n <template v-if=\"showButtons\">\n <button\n class=\"xds:sliding-panel-button xds:sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"xScroll -= slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <button\n class=\"xds:sliding-panel-button xds:sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"xScroll += slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport {\n useElementBounding,\n useElementVisibility,\n useMutationObserver,\n useScroll,\n whenever,\n} from '@vueuse/core'\nimport { computed, defineComponent, ref } from 'vue'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, applies the design-system edge fade mask to the scroll container.\n */\n fade: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n const scrollContainerRef = ref<HTMLDivElement>()\n\n const { width: slotContainerWidth } = useElementBounding(scrollContainerRef)\n const isVisible = useElementVisibility(scrollContainerRef)\n\n const {\n x: xScroll,\n arrivedState,\n measure,\n } = useScroll(scrollContainerRef, {\n behavior: 'smooth',\n })\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'xds:sliding-panel-at-start': arrivedState.left,\n 'xds:sliding-panel-at-end': arrivedState.right,\n }))\n\n if (props.resetOnContentChange) {\n useMutationObserver(\n scrollContainerRef,\n mutations => {\n if (mutations.length > 0) {\n xScroll.value = 0\n }\n },\n {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n },\n )\n }\n //ensure positions are right calculated as soon as the sliding panel is shown\n whenever(isVisible as any, measure)\n\n return {\n arrivedState,\n cssClasses,\n scrollContainerRef,\n slotContainerWidth,\n xScroll,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_Fragment","_createTextVNode"],"mappings":";;;;;;AACa,EAAA,OAAA,IAAA,CAAA,KAAA,CAAM,OAAA,IAAAA,SAAA,EAAA,EAAjBC,kBAAA;AAAA,IA+BM,KAAA;AAAA,IAAA;AAAA,MAAA,GAAA,EAAA,CAAA;MA/BoB,KAAA,EAAKC,cAAA,CAAA,CAAC,qBAA4B,IAAA,CAAA,UAAU,CAAA,CAAA;AAAA,MAAE,WAAA,EAAU;AAAA,KAAA;;AAChF,MAAAC,kBAAA;AAAA,QAQM,KAAA;AAAA,QAAA;AAAA,UAPJ,GAAA,EAAI,oBAAA;AAAA,UACJ,OAAKD,cAAA,CAAA,CAAC,yBAAA,EAAyB,CACtB,IAAA,CAAA,oBAAA,EA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AA;AAAA,cACT,OAAA,EAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,OAAA,IAAW,IAAA,CAAA,kBAAA,GAAqB,IAAA,CAAA,YAAA;AAAA,aAAA;;AAGxC,cAAAE,UAAA,CAAgD,+CAAhD,MAAgD;AAAA,gBAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAE,eAAA;AAAR,kBAAA,GAAA;AAAA,kBAAC;AAAA;AAAA,iBAAA;AAAA,eAAA,EAAA,IAAA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -34,6 +34,13 @@ var _sfc_main = defineComponent({
|
|
|
34
34
|
type: Boolean,
|
|
35
35
|
default: true,
|
|
36
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* When true, applies the design-system edge fade mask to the scroll container.
|
|
39
|
+
*/
|
|
40
|
+
fade: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: true,
|
|
43
|
+
},
|
|
37
44
|
buttonClass: { type: [String, Object, Array] },
|
|
38
45
|
scrollContainerClass: { type: [String, Object, Array] },
|
|
39
46
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliding-panel.vue2.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"xds:sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <div\n ref=\"scrollContainerRef\"\n :class=\"scrollContainerClass\"\n class=\"x-sliding-panel__scroll xds:sliding-panel-fade\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <slot name=\"sliding-panel-addons\" :arrived-state=\"arrivedState\" :scroll=\"xScroll\" />\n <template v-if=\"showButtons\">\n <button\n class=\"xds:sliding-panel-button xds:sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"xScroll -= slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <button\n class=\"xds:sliding-panel-button xds:sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"xScroll += slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport {\n useElementBounding,\n useElementVisibility,\n useMutationObserver,\n useScroll,\n whenever,\n} from '@vueuse/core'\nimport { computed, defineComponent, ref } from 'vue'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n const scrollContainerRef = ref<HTMLDivElement>()\n\n const { width: slotContainerWidth } = useElementBounding(scrollContainerRef)\n const isVisible = useElementVisibility(scrollContainerRef)\n\n const {\n x: xScroll,\n arrivedState,\n measure,\n } = useScroll(scrollContainerRef, {\n behavior: 'smooth',\n })\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'xds:sliding-panel-at-start': arrivedState.left,\n 'xds:sliding-panel-at-end': arrivedState.right,\n }))\n\n if (props.resetOnContentChange) {\n useMutationObserver(\n scrollContainerRef,\n mutations => {\n if (mutations.length > 0) {\n xScroll.value = 0\n }\n },\n {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n },\n )\n }\n //ensure positions are right calculated as soon as the sliding panel is shown\n whenever(isVisible as any, measure)\n\n return {\n arrivedState,\n cssClasses,\n scrollContainerRef,\n slotContainerWidth,\n xScroll,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":[],"mappings":";;;AA+CA;;;;;;;;;AASE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAAG;AACb,SAAA;;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,oBAAoB,EAAE;AACpB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA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;YAClB,OAAO;YACP,KAAK;SACP;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"sliding-panel.vue2.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"xds:sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <div\n ref=\"scrollContainerRef\"\n class=\"x-sliding-panel__scroll\"\n :class=\"[scrollContainerClass, { 'xds:sliding-panel-fade': fade }]\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <slot name=\"sliding-panel-addons\" :arrived-state=\"arrivedState\" :scroll=\"xScroll\" />\n <template v-if=\"showButtons\">\n <button\n class=\"xds:sliding-panel-button xds:sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"xScroll -= slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <button\n class=\"xds:sliding-panel-button xds:sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"xScroll += slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport {\n useElementBounding,\n useElementVisibility,\n useMutationObserver,\n useScroll,\n whenever,\n} from '@vueuse/core'\nimport { computed, defineComponent, ref } from 'vue'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, applies the design-system edge fade mask to the scroll container.\n */\n fade: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n const scrollContainerRef = ref<HTMLDivElement>()\n\n const { width: slotContainerWidth } = useElementBounding(scrollContainerRef)\n const isVisible = useElementVisibility(scrollContainerRef)\n\n const {\n x: xScroll,\n arrivedState,\n measure,\n } = useScroll(scrollContainerRef, {\n behavior: 'smooth',\n })\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'xds:sliding-panel-at-start': arrivedState.left,\n 'xds:sliding-panel-at-end': arrivedState.right,\n }))\n\n if (props.resetOnContentChange) {\n useMutationObserver(\n scrollContainerRef,\n mutations => {\n if (mutations.length > 0) {\n xScroll.value = 0\n }\n },\n {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n },\n )\n }\n //ensure positions are right calculated as soon as the sliding panel is shown\n whenever(isVisible as any, measure)\n\n return {\n arrivedState,\n cssClasses,\n scrollContainerRef,\n slotContainerWidth,\n xScroll,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":[],"mappings":";;;AA+CA;;;;;;;;;AASE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAAG;AACb,SAAA;;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,oBAAoB,EAAE;AACpB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;AAEE;AACF,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;QACD,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAA8B;QACzE,oBAAoB,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAA8B;AACnF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,kBAAiB,GAAI,GAAG,EAAiB;QAE/C,MAAM,EAAE,KAAK,EAAE,kBAAiB,EAAE,GAAI,kBAAkB,CAAC,kBAAkB,CAAA;AAC3E,QAAA,MAAM,YAAY,oBAAoB,CAAC,kBAAkB,CAAA;AAEzD,QAAA,MAAM,EACJ,CAAC,EAAE,OAAO,EACV,YAAY,EACZ,OAAO,GACT,GAAI,SAAS,CAAC,kBAAkB,EAAE;AAChC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA,CAAA;;AAGD,QAAA,MAAM,UAAS,GAAI,QAAQ,CAAC,OAAO;YACjC,4BAA4B,EAAE,YAAY,CAAC,IAAI;YAC/C,0BAA0B,EAAE,YAAY,CAAC,KAAK;AAC/C,SAAA,CAAC,CAAA;AAEF,QAAA,IAAI,KAAK,CAAC,oBAAoB,EAAE;AAC9B,YAAA,mBAAmB,CACjB,kBAAkB,EAClB,SAAQ,IAAG;AACT,gBAAA,IAAI,SAAS,CAAC,MAAK,GAAI,CAAC,EAAE;AACxB,oBAAA,OAAO,CAAC,KAAI,GAAI,CAAA;gBAClB;AACF,YAAA,CAAC,EACD;AACE,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,SAAS,EAAE,IAAI;AACf,gBAAA,UAAU,EAAE,KAAK;AACjB,gBAAA,aAAa,EAAE,KAAK;AACrB,aAAA,CACH;QACF;;AAEA,QAAA,QAAQ,CAAC,SAAgB,EAAE,OAAO,CAAA;QAElC,OAAO;YACL,YAAY;YACZ,UAAU;YACV,kBAAkB;YAClB,kBAAkB;YAClB,OAAO;YACP,KAAK;SACP;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
package/js/index.js
CHANGED
|
@@ -201,7 +201,6 @@ export { BaseXPriorityQueue, BaseXPriorityQueueNode } from './x-bus/x-priority-q
|
|
|
201
201
|
export { BaseXAPI } from './x-installer/api/base-api.js';
|
|
202
202
|
export { XInstaller } from './x-installer/x-installer.js';
|
|
203
203
|
export { default as AiCarousel } from './x-modules/ai/components/ai-carousel.vue.js';
|
|
204
|
-
export { default as AiOverview } from './x-modules/ai/components/ai-overview.vue.js';
|
|
205
204
|
export { fetchAndSaveAiSuggestionsSearch } from './x-modules/ai/store/actions/fetch-and-save-ai-suggestions-search.action.js';
|
|
206
205
|
export { fetchAndSaveAiSuggestions } from './x-modules/ai/store/actions/fetch-and-save-ai-suggestions.action.js';
|
|
207
206
|
export { saveOrigin as saveAiOrigin } from './x-modules/ai/store/actions/save-origin.action.js';
|
package/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './ai-carousel.vue2.js';
|
|
2
|
-
import { resolveComponent, openBlock, createBlock, withCtx, createElementBlock, createVNode, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList } from 'vue';
|
|
2
|
+
import { resolveComponent, openBlock, createBlock, withCtx, createElementBlock, createVNode, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, createTextVNode } from 'vue';
|
|
3
3
|
import './ai-carousel.vue3.js';
|
|
4
4
|
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.js';
|
|
5
5
|
|
|
@@ -8,15 +8,26 @@ const _hoisted_1 = {
|
|
|
8
8
|
class: "x-ai-carousel"
|
|
9
9
|
};
|
|
10
10
|
const _hoisted_2 = ["aria-label"];
|
|
11
|
-
const _hoisted_3 = {
|
|
12
|
-
|
|
11
|
+
const _hoisted_3 = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "x-ai-carousel-suggestions",
|
|
14
|
+
"data-test": "ai-carousel-suggestions-container"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_4 = {
|
|
17
|
+
class: "x-ai-carousel-suggestion",
|
|
18
|
+
"data-test": "ai-carousel-suggestion"
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_5 = { class: "x-ai-carousel-suggestion-results" };
|
|
13
21
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
14
22
|
const _component_AIStarIcon = resolveComponent("AIStarIcon");
|
|
15
23
|
const _component_ChangeHeight = resolveComponent("ChangeHeight");
|
|
16
24
|
const _component_ChevronDownIcon = resolveComponent("ChevronDownIcon");
|
|
17
25
|
const _component_DisplayEmitter = resolveComponent("DisplayEmitter");
|
|
18
|
-
const
|
|
26
|
+
const _component_AiGroupedCarousel = resolveComponent("AiGroupedCarousel");
|
|
27
|
+
const _component_ArrowRightIcon = resolveComponent("ArrowRightIcon");
|
|
28
|
+
const _component_BaseEventButton = resolveComponent("BaseEventButton");
|
|
19
29
|
const _component_SlidingPanel = resolveComponent("SlidingPanel");
|
|
30
|
+
const _component_DisplayClickProvider = resolveComponent("DisplayClickProvider");
|
|
20
31
|
const _component_CollapseHeight = resolveComponent("CollapseHeight");
|
|
21
32
|
return openBlock(), createBlock(_component_CollapseHeight, null, {
|
|
22
33
|
default: withCtx(() => [
|
|
@@ -74,68 +85,112 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
74
85
|
_: 1
|
|
75
86
|
/* STABLE */
|
|
76
87
|
}, 8, ["payload", "event-metadata"]),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
88
|
+
_ctx.group ? (openBlock(), createBlock(_component_AiGroupedCarousel, { key: 0 }, {
|
|
89
|
+
"sliding-panel-addons": withCtx(({ arrivedState }) => [
|
|
90
|
+
renderSlot(_ctx.$slots, "sliding-panels-addons", { arrivedState })
|
|
91
|
+
]),
|
|
92
|
+
"sliding-panel-left-button": withCtx(() => [
|
|
93
|
+
renderSlot(_ctx.$slots, "sliding-panels-left-button")
|
|
94
|
+
]),
|
|
95
|
+
"sliding-panel-right-button": withCtx(() => [
|
|
96
|
+
renderSlot(_ctx.$slots, "sliding-panels-right-button")
|
|
97
|
+
]),
|
|
98
|
+
result: withCtx(({ result }) => [
|
|
99
|
+
renderSlot(_ctx.$slots, "result", { result })
|
|
100
|
+
]),
|
|
101
|
+
_: 3
|
|
102
|
+
/* FORWARDED */
|
|
103
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
104
|
+
(openBlock(true), createElementBlock(
|
|
105
|
+
Fragment,
|
|
106
|
+
null,
|
|
107
|
+
renderList(_ctx.suggestionsSearch, ({ query: suggestionQuery, results: queriesResults }) => {
|
|
108
|
+
return openBlock(), createBlock(_component_DisplayEmitter, {
|
|
109
|
+
key: suggestionQuery,
|
|
110
|
+
payload: _ctx.tagging?.searchQueries[suggestionQuery].toolingDisplay ?? _ctx.emptyTaggingRequest,
|
|
111
|
+
"event-metadata": {
|
|
112
|
+
feature: "ai_carousel",
|
|
113
|
+
displayOriginalQuery: _ctx.query || "ai-carousel-without-query",
|
|
114
|
+
replaceable: false
|
|
115
|
+
},
|
|
116
|
+
"data-test": "ai-carousel-query-display-emitter"
|
|
117
|
+
}, {
|
|
118
|
+
default: withCtx(() => [
|
|
119
|
+
createElementVNode("div", _hoisted_4, [
|
|
120
|
+
createVNode(_component_BaseEventButton, {
|
|
121
|
+
class: "x-ai-carousel-suggestion-query-btn",
|
|
122
|
+
events: { UserAcceptedAQuery: suggestionQuery }
|
|
123
|
+
}, {
|
|
124
|
+
default: withCtx(() => [
|
|
125
|
+
createTextVNode(
|
|
126
|
+
toDisplayString(suggestionQuery) + " ",
|
|
127
|
+
1
|
|
128
|
+
/* TEXT */
|
|
129
|
+
),
|
|
130
|
+
createVNode(_component_ArrowRightIcon, { class: "x-ai-carousel-suggestion-query-btn-icon" })
|
|
131
|
+
]),
|
|
132
|
+
_: 2
|
|
133
|
+
/* DYNAMIC */
|
|
134
|
+
}, 1032, ["events"]),
|
|
135
|
+
createVNode(_component_DisplayClickProvider, {
|
|
136
|
+
"tooling-display-tagging": _ctx.tagging?.searchQueries[suggestionQuery].toolingDisplayClick,
|
|
137
|
+
"tooling-add2-cart-tagging": _ctx.tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart,
|
|
138
|
+
"result-feature": "ai_carousel"
|
|
139
|
+
}, {
|
|
140
|
+
default: withCtx(() => [
|
|
141
|
+
renderSlot(_ctx.$slots, "sliding-panel", { results: queriesResults }, () => [
|
|
142
|
+
createVNode(_component_SlidingPanel, {
|
|
143
|
+
class: normalizeClass(_ctx.slidingPanelClasses),
|
|
144
|
+
"scroll-container-class": _ctx.slidingPanelContainerClasses,
|
|
145
|
+
"button-class": _ctx.slidingPanelButtonsClasses,
|
|
146
|
+
"reset-on-content-change": false
|
|
147
|
+
}, {
|
|
148
|
+
"sliding-panel-addons": withCtx(({ arrivedState }) => [
|
|
149
|
+
renderSlot(_ctx.$slots, "sliding-panels-addons", { arrivedState })
|
|
150
|
+
]),
|
|
151
|
+
"sliding-panel-left-button": withCtx(() => [
|
|
152
|
+
renderSlot(_ctx.$slots, "sliding-panels-left-button")
|
|
153
|
+
]),
|
|
154
|
+
"sliding-panel-right-button": withCtx(() => [
|
|
155
|
+
renderSlot(_ctx.$slots, "sliding-panels-right-button")
|
|
156
|
+
]),
|
|
157
|
+
default: withCtx(() => [
|
|
158
|
+
createElementVNode("ul", _hoisted_5, [
|
|
159
|
+
(openBlock(true), createElementBlock(
|
|
160
|
+
Fragment,
|
|
161
|
+
null,
|
|
162
|
+
renderList(queriesResults, (result) => {
|
|
163
|
+
return openBlock(), createElementBlock("li", {
|
|
164
|
+
key: result.id,
|
|
165
|
+
"data-test": "ai-carousel-suggestion-result"
|
|
166
|
+
}, [
|
|
167
|
+
renderSlot(_ctx.$slots, "result", { result })
|
|
168
|
+
]);
|
|
169
|
+
}),
|
|
170
|
+
128
|
|
171
|
+
/* KEYED_FRAGMENT */
|
|
172
|
+
))
|
|
173
|
+
])
|
|
174
|
+
]),
|
|
175
|
+
_: 2
|
|
176
|
+
/* DYNAMIC */
|
|
177
|
+
}, 1032, ["class", "scroll-container-class", "button-class"])
|
|
178
|
+
])
|
|
179
|
+
]),
|
|
180
|
+
_: 2
|
|
181
|
+
/* DYNAMIC */
|
|
182
|
+
}, 1032, ["tooling-display-tagging", "tooling-add2-cart-tagging"])
|
|
183
|
+
])
|
|
184
|
+
]),
|
|
185
|
+
_: 2
|
|
186
|
+
/* DYNAMIC */
|
|
187
|
+
}, 1032, ["payload", "event-metadata"]);
|
|
188
|
+
}),
|
|
189
|
+
128
|
|
190
|
+
/* KEYED_FRAGMENT */
|
|
191
|
+
)),
|
|
192
|
+
renderSlot(_ctx.$slots, "suggestions-extra-content")
|
|
193
|
+
])),
|
|
139
194
|
renderSlot(_ctx.$slots, "extra-content"),
|
|
140
195
|
renderSlot(_ctx.$slots, "cta-button")
|
|
141
196
|
])) : createCommentVNode("v-if", true)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-carousel.vue.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? 'Collapse' : 'Expand'\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n <slot name=\"sliding-panel\" :suggestions=\"suggestionsSearch\" :tagging=\"tagging\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <div class=\"x-ai-carousel-suggestion\">\n <ul class=\"x-ai-carousel-suggestion-results\">\n <DisplayClickProvider\n v-for=\"suggestion in suggestionsSearch\"\n :key=\"suggestion.query\"\n :tooling-display-tagging=\"\n tagging?.searchQueries[suggestion.query].toolingDisplayClick\n \"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestion.query].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <li\n v-for=\"result in suggestion.results\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </DisplayClickProvider>\n </ul>\n </div>\n </SlidingPanel>\n </slot>\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n SlidingPanel,\n} from '../../../components'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport { use$x, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n ChangeHeight,\n DisplayClickProvider,\n DisplayEmitter,\n CollapseHeight,\n AIStarIcon,\n ChevronDownIcon,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: {\n type: String,\n },\n /* The classes added to the sliding panel. */\n slidingPanelClasses: {\n type: String,\n },\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: {\n type: String,\n },\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: {\n type: String,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, isNoResults, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n emptyTaggingRequest,\n isNoResults,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["_createBlock","_withCtx","_openBlock","_createElementBlock","_createVNode","_createElementVNode","_normalizeClass","_renderSlot","_Fragment","_renderList","_createCommentVNode"],"mappings":";;;;;;;EAEyC,KAAA,EAAM;;;AAuDhC,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,0BAAA,EAA0B;AAC/B,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,kCAAA,EAAkC;;;;;;;;;sBAzDtDA,WAAA,CAqFiB,yBAAA,EAAA,IAAA,EAAA;AAAA,IAAA,OAAA,EAAAC,OAAA,CApFf,MAmFM;AAAA,MAnFK,IAAA,CAAA,iBAAA,CAAkB,MAAA,IAAAC,SAAA,EAAA,EAA7BC,kBAAA,CAmFM,KAAA,EAnFN,UAAA,EAmFM;AAAA,QAlFJC,WAAA,CAqCiB,yBAAA,EAAA;AAAA,UApCd,OAAA,EAAS,cAAS,cAAA,IAAkB,IAAA,CAAA,mBAAA;AAAA,UACpC,gBAA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AAA,CAAA,iBAAA,EAAiB,CAA/B,UAAA,KAAU;0CADnBT,WAAA,CAmBuB,+BAAA,EAAA;AAAA,wBAjBpB,KAAK,UAAA,CAAW,KAAA;AAAA,wBAChB,yBAAA,EAA4C,IAAA,CAAA,OAAA,EAAS,aAAA,CAAc,UAAA,CAAW,KAAK,CAAA,CAAE,mBAAA;AAAA,wBAGrF,2BAAA,EAA8C,IAAA,CAAA,OAAA,EAAS,aAAA,CAAc,UAAA,CAAW,KAAK,CAAA,CAAE,sBAAA;AAAA,wBAGxF,gBAAA,EAAe;AAAA,uBAAA,EAAA;yCAGb,MAAoC;AAAA,2BAAAE,SAAA,CAAA,IAAA,CAAA,EADtCC,kBAAA;AAAA,4BAOKK,QAAA;AAAA,4BAAA,IAAA;AAAA,4BAAAC,UAAA,CANc,UAAA,CAAW,OAAA,EAAO,CAA5B,MAAA,KAAM;kDADfN,kBAAA,CAOK,IAAA,EAAA;AAAA,gCALF,KAAK,MAAA,CAAO,EAAA;AAAA,gCACb,WAAA,EAAU;AAAA,+BAAA,EAAA;AAGV,gCAAAI,UAAA,CAAuC,yBAAlB,MAAA,EAAc;AAAA,+BAAA,CAAA;;;;;;;;;;;;;;;;;;;;QAO/CA,UAAA,CAA6B,IAAA,CAAA,MAAA,EAAA,eAAA,CAAA;AAAA,QAC7BA,UAAA,CAA0B,IAAA,CAAA,MAAA,EAAA,YAAA;AAAA,OAAA,CAAA,IAAAG,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ai-carousel.vue.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? 'Collapse' : 'Expand'\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n\n <AiGroupedCarousel v-if=\"group\">\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <template #result=\"{ result }\">\n <slot name=\"result\" :result=\"result\" />\n </template>\n </AiGroupedCarousel>\n\n <div v-else class=\"x-ai-carousel-suggestions\" data-test=\"ai-carousel-suggestions-container\">\n <DisplayEmitter\n v-for=\"{ query: suggestionQuery, results: queriesResults } in suggestionsSearch\"\n :key=\"suggestionQuery\"\n :payload=\"tagging?.searchQueries[suggestionQuery].toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-query-display-emitter\"\n >\n <div class=\"x-ai-carousel-suggestion\" data-test=\"ai-carousel-suggestion\">\n <BaseEventButton\n class=\"x-ai-carousel-suggestion-query-btn\"\n :events=\"{ UserAcceptedAQuery: suggestionQuery }\"\n >\n {{ suggestionQuery }}\n <ArrowRightIcon class=\"x-ai-carousel-suggestion-query-btn-icon\" />\n </BaseEventButton>\n\n <DisplayClickProvider\n :tooling-display-tagging=\"tagging?.searchQueries[suggestionQuery].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <slot name=\"sliding-panel\" :results=\"queriesResults\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <li\n v-for=\"result in queriesResults\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </ul>\n </SlidingPanel>\n </slot>\n </DisplayClickProvider>\n </div>\n </DisplayEmitter>\n <slot name=\"suggestions-extra-content\" />\n </div>\n\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n} from '../../../components'\nimport { use$x, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\nimport AiGroupedCarousel from './ai-grouped-carousel.vue'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n AIStarIcon,\n AiGroupedCarousel,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n /* Controls whether the carousel should group results or display N carousels per N queries. */\n group: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n emptyTaggingRequest,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-query-btn {\n border-color: transparent;\n background-color: transparent;\n margin-left: 1rem;\n margin-right: 1rem;\n font-weight: 700;\n width: fit-content;\n display: flex;\n align-items: center;\n gap: 1rem;\n cursor: pointer;\n}\n\n.x-ai-carousel-suggestion-query-btn-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["_createBlock","_withCtx","_openBlock","_createElementBlock","_createVNode","_createElementVNode","_normalizeClass","_renderSlot","_Fragment","_renderList","_createTextVNode","_toDisplayString","_createCommentVNode"],"mappings":";;;;;;;EAEyC,KAAA,EAAM;;;;;EAuD7B,KAAA,EAAM,2BAAA;AAAA,EAA4B,WAAA,EAAU;;;EAY/C,KAAA,EAAM,0BAAA;AAAA,EAA2B,WAAA,EAAU;;AAgCpC,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,kCAAA,EAAkC;;;;;;;;;;;;sBApG5DA,WAAA,CAyHiB,yBAAA,EAAA,IAAA,EAAA;AAAA,IAAA,OAAA,EAAAC,OAAA,CAxHf,MAuHM;AAAA,MAvHK,IAAA,CAAA,iBAAA,CAAkB,MAAA,IAAAC,SAAA,EAAA,EAA7BC,kBAAA,CAuHM,KAAA,EAvHN,UAAA,EAuHM;AAAA,QAtHJC,WAAA,CAqCiB,yBAAA,EAAA;AAAA,UApCd,OAAA,EAAS,cAAS,cAAA,IAAkB,IAAA,CAAA,mBAAA;AAAA,UACpC,gBAAA,EAAc;AAAA,YAAA,OAAA,EAAA,aAAA;kCAAsE,IAAA,CAAA,KAAA,IAAK,2BAAA;AAAA,YAAA,WAAA,EAAA;;UAK1F,WAAA,EAAU;AAAA,SAAA,EAAA;2BAEV,MA2BO;AAAA,YA3BPC,kBAAA;AAAA,cA2BO,MAAA;AAAA,cAAA;AAAA,gBA1BL,KAAA,EAAKC,cAAA,CAAA,CAAC,qBAAA,EAAqB,EAAA,+BAAA,EACgB,IAAA,CAAA,aAAA,EAAa,CAAA,CAAA;AAAA,gBACxD,WAAA,EAAU,mBAAA;AAAA,gBACT,SAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,oBAAA,IAAA,IAAA,CAAA,oBAAA,CAAA,GAAA,IAAA,CAAA;AAAA,eAAA;;gBAERF,WAAA,CAA+C,qBAAA,EAAA,EAAnC,OAAM,0BAAA,E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AAA,CANc,cAAA,EAAc,CAAxB,MAAA,KAAM;wDADfN,kBAAA,CAOK,IAAA,EAAA;AAAA,sCALF,KAAK,MAAA,CAAO,EAAA;AAAA,sCACb,WAAA,EAAU;AAAA,qCAAA,EAAA;AAGV,sCAAAI,UAAA,CAAuC,yBAAlB,MAAA,EAAc;AAAA,qCAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;UAQjDA,UAAA,CAAyC,IAAA,CAAA,MAAA,EAAA,2BAAA;AAAA,SAAA,CAAA,CAAA;QAG3CA,UAAA,CAA6B,IAAA,CAAA,MAAA,EAAA,eAAA,CAAA;AAAA,QAC7BA,UAAA,CAA0B,IAAA,CAAA,MAAA,EAAA,YAAA;AAAA,OAAA,CAAA,IAAAK,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;"}
|
|
@@ -22,7 +22,7 @@ import '../../../components/auto-progress-bar.vue2.js';
|
|
|
22
22
|
import '../../../components/auto-progress-bar.vue3.js';
|
|
23
23
|
import '../../../components/base-dropdown.vue2.js';
|
|
24
24
|
import '../../../components/base-dropdown.vue3.js';
|
|
25
|
-
import '../../../components/base-event-button.
|
|
25
|
+
import BaseEventButton from '../../../components/base-event-button.vue.js';
|
|
26
26
|
import '../../../components/base-grid.vue2.js';
|
|
27
27
|
import '../../../components/base-grid.vue3.js';
|
|
28
28
|
import '../../../components/base-keyboard-navigation.vue2.js';
|
|
@@ -44,6 +44,7 @@ import '../../../components/filters/labels/base-rating-filter-label.vue2.js';
|
|
|
44
44
|
import '../../../components/global-x-bus.vue.js';
|
|
45
45
|
import '../../../components/highlight.vue2.js';
|
|
46
46
|
import AIStarIcon from '../../../components/icons/ai-star.vue.js';
|
|
47
|
+
import ArrowRightIcon from '../../../components/icons/arrow-right.vue.js';
|
|
47
48
|
import ChevronDownIcon from '../../../components/icons/chevron-down.vue.js';
|
|
48
49
|
import '../../../components/items-list.vue2.js';
|
|
49
50
|
import '../../../components/location-provider.vue.js';
|
|
@@ -96,39 +97,40 @@ import '../../../plugins/x-plugin.js';
|
|
|
96
97
|
import 'rxjs';
|
|
97
98
|
import { useState } from '../../../composables/use-state.js';
|
|
98
99
|
import { aiXModule } from '../x-module.js';
|
|
100
|
+
import AiGroupedCarousel from './ai-grouped-carousel.vue.js';
|
|
99
101
|
|
|
100
102
|
var _sfc_main = defineComponent({
|
|
101
103
|
xModule: aiXModule.name,
|
|
102
104
|
components: {
|
|
105
|
+
AIStarIcon,
|
|
106
|
+
AiGroupedCarousel,
|
|
107
|
+
ArrowRightIcon,
|
|
108
|
+
BaseEventButton,
|
|
103
109
|
ChangeHeight,
|
|
110
|
+
ChevronDownIcon,
|
|
111
|
+
CollapseHeight,
|
|
104
112
|
DisplayClickProvider: _sfc_main$2,
|
|
105
113
|
DisplayEmitter: _sfc_main$1,
|
|
106
|
-
CollapseHeight,
|
|
107
|
-
AIStarIcon,
|
|
108
|
-
ChevronDownIcon,
|
|
109
114
|
SlidingPanel,
|
|
110
115
|
},
|
|
111
116
|
props: {
|
|
112
117
|
/* The title text displayed */
|
|
113
|
-
title:
|
|
114
|
-
type: String,
|
|
115
|
-
},
|
|
118
|
+
title: String,
|
|
116
119
|
/* The classes added to the sliding panel. */
|
|
117
|
-
slidingPanelClasses:
|
|
118
|
-
type: String,
|
|
119
|
-
},
|
|
120
|
+
slidingPanelClasses: String,
|
|
120
121
|
/* The classes added to the sliding panel container. */
|
|
121
|
-
slidingPanelContainerClasses:
|
|
122
|
-
type: String,
|
|
123
|
-
},
|
|
122
|
+
slidingPanelContainerClasses: String,
|
|
124
123
|
/* The classes added to the sliding panel buttons. */
|
|
125
|
-
slidingPanelButtonsClasses:
|
|
126
|
-
|
|
124
|
+
slidingPanelButtonsClasses: String,
|
|
125
|
+
/* Controls whether the carousel should group results or display N carousels per N queries. */
|
|
126
|
+
group: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: true,
|
|
127
129
|
},
|
|
128
130
|
},
|
|
129
131
|
setup(props) {
|
|
130
132
|
const $x = use$x();
|
|
131
|
-
const { query,
|
|
133
|
+
const { query, suggestionsSearch, queries, tagging } = useState('ai');
|
|
132
134
|
const emptyTaggingRequest = { url: '', params: {} };
|
|
133
135
|
const titleRef = ref(null);
|
|
134
136
|
const titleExpanded = ref(false);
|
|
@@ -173,7 +175,6 @@ var _sfc_main = defineComponent({
|
|
|
173
175
|
useResizeObserver(titleRef, updateTitleOverflow);
|
|
174
176
|
return {
|
|
175
177
|
emptyTaggingRequest,
|
|
176
|
-
isNoResults,
|
|
177
178
|
isTitleOverflowing,
|
|
178
179
|
queries,
|
|
179
180
|
query,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-carousel.vue2.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? 'Collapse' : 'Expand'\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n <slot name=\"sliding-panel\" :suggestions=\"suggestionsSearch\" :tagging=\"tagging\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <div class=\"x-ai-carousel-suggestion\">\n <ul class=\"x-ai-carousel-suggestion-results\">\n <DisplayClickProvider\n v-for=\"suggestion in suggestionsSearch\"\n :key=\"suggestion.query\"\n :tooling-display-tagging=\"\n tagging?.searchQueries[suggestion.query].toolingDisplayClick\n \"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestion.query].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <li\n v-for=\"result in suggestion.results\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </DisplayClickProvider>\n </ul>\n </div>\n </SlidingPanel>\n </slot>\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n SlidingPanel,\n} from '../../../components'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport { use$x, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n ChangeHeight,\n DisplayClickProvider,\n DisplayEmitter,\n CollapseHeight,\n AIStarIcon,\n ChevronDownIcon,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: {\n type: String,\n },\n /* The classes added to the sliding panel. */\n slidingPanelClasses: {\n type: String,\n },\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: {\n type: String,\n },\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: {\n type: String,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, isNoResults, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n emptyTaggingRequest,\n isNoResults,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["DisplayClickProvider","DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,gBAAe,eAAe,CAAC;IAC7B,OAAO,EAAE,SAAS,CAAC,IAAI;AACvB,IAAA,UAAU,EAAE;QACV,YAAY;8BACZA,WAAoB;wBACpBC,WAAc;QACd,cAAc;QACd,UAAU;QACV,eAAe;QACf,YAAY;AACb,KAAA;AACD,IAAA,KAAK,EAAE;;AAEL,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;;AAED,QAAA,mBAAmB,EAAE;AACnB,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;;AAED,Q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,iBAAA,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,KAAK,KAAK,CAAC,CAAA;gBACjD,OAAO,CAAA,cAAA,EAAiB,WAAW,CAAA,CAAC;YACtC;YACA,OAAO,KAAK,CAAC,KAAI;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,KAAK,CAAC,OAAO,EAAE,MAAI;YACjB,IAAI,OAAO,CAAC,KAAK,CAAC,MAAK,GAAI,CAAC,EAAE;AAC5B,gBAAA,EAAE,CAAC,IAAI,CAAC,mCAAmC,CAAA;YAC7C;AACF,QAAA,CAAC,CAAA;QAED,SAAS,CAAC,MAAI;AACZ,YAAA,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,aAAY,EAAG,CAAA;AACrE,QAAA,CAAC,CAAA;AAED,QAAA,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,CAAA;QAE/C,OAAO;YACL,mBAAmB;YACnB,WAAW;YACX,kBAAkB;YAClB,OAAO;YACP,KAAK;YACL,iBAAiB;YACjB,OAAO;YACP,KAAK;YACL,aAAa;YACb,QAAQ;YACR,oBAAoB;SACtB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"ai-carousel.vue2.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? 'Collapse' : 'Expand'\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n\n <AiGroupedCarousel v-if=\"group\">\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <template #result=\"{ result }\">\n <slot name=\"result\" :result=\"result\" />\n </template>\n </AiGroupedCarousel>\n\n <div v-else class=\"x-ai-carousel-suggestions\" data-test=\"ai-carousel-suggestions-container\">\n <DisplayEmitter\n v-for=\"{ query: suggestionQuery, results: queriesResults } in suggestionsSearch\"\n :key=\"suggestionQuery\"\n :payload=\"tagging?.searchQueries[suggestionQuery].toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-query-display-emitter\"\n >\n <div class=\"x-ai-carousel-suggestion\" data-test=\"ai-carousel-suggestion\">\n <BaseEventButton\n class=\"x-ai-carousel-suggestion-query-btn\"\n :events=\"{ UserAcceptedAQuery: suggestionQuery }\"\n >\n {{ suggestionQuery }}\n <ArrowRightIcon class=\"x-ai-carousel-suggestion-query-btn-icon\" />\n </BaseEventButton>\n\n <DisplayClickProvider\n :tooling-display-tagging=\"tagging?.searchQueries[suggestionQuery].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <slot name=\"sliding-panel\" :results=\"queriesResults\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <li\n v-for=\"result in queriesResults\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </ul>\n </SlidingPanel>\n </slot>\n </DisplayClickProvider>\n </div>\n </DisplayEmitter>\n <slot name=\"suggestions-extra-content\" />\n </div>\n\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n} from '../../../components'\nimport { use$x, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\nimport AiGroupedCarousel from './ai-grouped-carousel.vue'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n AIStarIcon,\n AiGroupedCarousel,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n /* Controls whether the carousel should group results or display N carousels per N queries. */\n group: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n emptyTaggingRequest,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-query-btn {\n border-color: transparent;\n background-color: transparent;\n margin-left: 1rem;\n margin-right: 1rem;\n font-weight: 700;\n width: fit-content;\n display: flex;\n align-items: center;\n gap: 1rem;\n cursor: pointer;\n}\n\n.x-ai-carousel-suggestion-query-btn-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["DisplayClickProvider","DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgJA,gBAAe,e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lighter:var(--x-ai-carousel-color-lighter,color-mix(in srgb,var(--color) 25%,#fff));background-color:var(--color-lighter);border-radius:1.5rem;padding:8px 0;position:relative}.x-ai-carousel-title{align-items:flex-start;cursor:pointer;display:flex;font-size:12px;gap:8px;margin:0 14px 8px}.x-ai-carousel-title-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x-ai-carousel-title-text--expanded{white-space:normal}.x-ai-carousel-title-icon{aspect-ratio:1/1;color:var(--color);flex-shrink:0;height:1rem;margin-bottom:auto}.x-ai-carousel-title-button{align-items:center;background:none;border:none;color:var(--color);cursor:pointer;display:flex;justify-content:center;margin-bottom:auto;padding:0}.x-ai-carousel-title-button-icon{aspect-ratio:1/1;height:1rem;transition:transform .3s ease}.x-ai-carousel-title-button-icon--expanded{transform:rotate(180deg)}.x-ai-carousel-suggestion{display:flex;gap:8px}.x-ai-carousel-suggestion-results{display:flex;gap:1rem;padding-left:1rem;padding-right:1rem}";
|
|
3
|
+
var css = ".x-ai-carousel{--color:var(--x-ai-carousel-color,#bbc9cf);--color-lighter:var(--x-ai-carousel-color-lighter,color-mix(in srgb,var(--color) 25%,#fff));background-color:var(--color-lighter);border-radius:1.5rem;padding:8px 0;position:relative}.x-ai-carousel-title{align-items:flex-start;cursor:pointer;display:flex;font-size:12px;gap:8px;margin:0 14px 8px}.x-ai-carousel-title-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x-ai-carousel-title-text--expanded{white-space:normal}.x-ai-carousel-title-icon{aspect-ratio:1/1;color:var(--color);flex-shrink:0;height:1rem;margin-bottom:auto}.x-ai-carousel-title-button{align-items:center;background:none;border:none;color:var(--color);cursor:pointer;display:flex;justify-content:center;margin-bottom:auto;padding:0}.x-ai-carousel-title-button-icon{aspect-ratio:1/1;height:1rem;transition:transform .3s ease}.x-ai-carousel-title-button-icon--expanded{transform:rotate(180deg)}.x-ai-carousel-suggestions{display:flex;flex-direction:column;gap:.5rem;padding-bottom:1rem}.x-ai-carousel-suggestion{display:flex;flex-direction:column;gap:8px}.x-ai-carousel-suggestion-query-btn{align-items:center;background-color:transparent;border-color:transparent;cursor:pointer;display:flex;font-weight:700;gap:1rem;margin-left:1rem;margin-right:1rem;width:fit-content}.x-ai-carousel-suggestion-query-btn-icon{aspect-ratio:1/1;height:1rem}.x-ai-carousel-suggestion-results{display:flex;gap:1rem;padding-left:1rem;padding-right:1rem}";
|
|
4
4
|
injectCss(css);
|
|
5
5
|
|
|
6
6
|
export { css };
|