@coveo/atomic 3.33.8-pre.bfb642d322 → 3.33.8-pre.c54adf6755
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/dist/atomic/_atomic.esm.js +1 -1
- package/dist/atomic/atomic.esm.js.map +1 -1
- package/dist/atomic/components/_index.d.ts +0 -2
- package/dist/atomic/components/_index.js +2 -2
- package/dist/atomic/components/analytics-config.js +1 -1
- package/dist/atomic/components/atomic-insight-search-box.js +32 -6
- package/dist/atomic/components/atomic-insight-search-box.js.map +1 -1
- package/dist/atomic/components/atomic-search-box-instant-results.js +2 -2
- package/dist/atomic/components/atomic-search-box-instant-results.js.map +1 -1
- package/dist/atomic/components/atomic-search-box-recent-queries2.js +2 -2
- package/dist/atomic/components/atomic-search-box-recent-queries2.js.map +1 -1
- package/dist/atomic/components/atomic-search-box.js +6 -13
- package/dist/atomic/components/atomic-search-box.js.map +1 -1
- package/dist/atomic/components/atomic-smart-snippet-feedback-modal2.js +2 -2
- package/dist/atomic/components/atomic-suggestion-renderer2.js +1 -1
- package/dist/atomic/components/atomic-suggestion-renderer2.js.map +1 -1
- package/dist/atomic/components/atomic-tab-manager.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.js +18 -11
- package/dist/atomic/components/components/commerce/atomic-commerce-interface/atomic-commerce-interface.js +2 -7
- package/dist/atomic/components/components/commerce/atomic-commerce-layout/atomic-commerce-layout.js +19 -10
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box-instant-products/atomic-commerce-search-box-instant-products.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box-query-suggestions/atomic-commerce-search-box-query-suggestions.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.js +1 -1
- package/dist/atomic/components/components/common/layout/layout-styles-controller.js +40 -0
- package/dist/atomic/components/components/common/layout/mobile-breakpoint-controller.js +26 -0
- package/dist/atomic/components/components/common/suggestions/suggestion-manager.js +1 -1
- package/dist/atomic/components/components/common/suggestions/{suggestions-common.js → suggestions-events.js} +16 -18
- package/dist/atomic/components/components/common/suggestions/suggestions-types.js +1 -0
- package/dist/atomic/components/components/common/suggestions/suggestions-utils.js +18 -0
- package/dist/atomic/components/components/search/atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.js +121 -0
- package/dist/atomic/components/components/search/index.js +1 -0
- package/dist/atomic/components/components/search/lazy-index.js +1 -0
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/stencil-suggestion-manager.js +20 -2
- package/dist/atomic/components/stencil-suggestion-manager.js.map +1 -1
- package/dist/atomic/components/{suggestions-common.js → suggestions-events.js} +18 -20
- package/dist/atomic/components/suggestions-events.js.map +1 -0
- package/dist/atomic/index.esm.js +1 -1
- package/dist/atomic/index.esm.js.map +1 -1
- package/dist/atomic/p-0a051b8d.js +2 -0
- package/dist/atomic/p-0a051b8d.js.map +1 -0
- package/dist/atomic/p-16f4ce98.js +2 -0
- package/dist/atomic/p-16f4ce98.js.map +1 -0
- package/dist/atomic/{p-aa2a81fd.entry.js → p-39e63678.entry.js} +2 -2
- package/dist/atomic/p-4b7a19db.js +2 -0
- package/dist/atomic/p-4b7a19db.js.map +1 -0
- package/dist/atomic/p-7a06a356.entry.js +2 -0
- package/dist/atomic/p-7a06a356.entry.js.map +1 -0
- package/dist/atomic/{p-aa8e0616.entry.js → p-9b24788e.entry.js} +2 -2
- package/dist/atomic/{p-7a625c7e.entry.js → p-ae98c582.entry.js} +2 -2
- package/dist/atomic/{p-a09b4db4.entry.js → p-be8d7ee7.entry.js} +2 -2
- package/dist/atomic/{p-83e20cc3.entry.js → p-c1384fa7.entry.js} +2 -2
- package/dist/atomic/{p-94b5f495.js → p-c81ba3db.js} +2 -2
- package/dist/atomic/{p-3d847e45.entry.js → p-c88a3d2d.entry.js} +2 -2
- package/dist/atomic/p-c88a3d2d.entry.js.map +1 -0
- package/dist/atomic/{p-36e71b99.entry.js → p-d0f47b33.entry.js} +2 -2
- package/dist/atomic/p-d0f47b33.entry.js.map +1 -0
- package/dist/atomic/p-d2b14ff1.entry.js +2 -0
- package/dist/atomic/p-d2b14ff1.entry.js.map +1 -0
- package/dist/atomic/{p-aa4224ea.entry.js → p-fbfe913d.entry.js} +2 -2
- package/dist/atomic/p-fbfe913d.entry.js.map +1 -0
- package/dist/cjs/_index.cjs.js +5 -2
- package/dist/cjs/_loader.cjs.js +1 -1
- package/dist/cjs/{analytics-config-b8fab215.js → analytics-config-f6473d68.js} +2 -2
- package/dist/cjs/{analytics-config-b8fab215.js.map → analytics-config-f6473d68.js.map} +1 -1
- package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-search-box.cjs.entry.js +35 -9
- package/dist/cjs/atomic-insight-search-box.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-search-box-instant-results.cjs.entry.js +3 -3
- package/dist/cjs/atomic-search-box-instant-results.cjs.entry.js.map +1 -1
- package/dist/cjs/{atomic-search-box-query-suggestions_2.cjs.entry.js → atomic-search-box-recent-queries.cjs.entry.js} +6 -69
- package/dist/cjs/atomic-search-box-recent-queries.cjs.entry.js.map +1 -0
- package/dist/cjs/atomic-search-box.cjs.entry.js +7 -7
- package/dist/cjs/atomic-search-box.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-search-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +2 -2
- package/dist/cjs/atomic-suggestion-renderer.cjs.entry.js +1 -1
- package/dist/cjs/atomic-suggestion-renderer.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
- package/dist/cjs/atomic.cjs.js +1 -1
- package/dist/cjs/index-757bc886.js +2 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{stencil-suggestion-manager-c0878ef2.js → stencil-suggestion-manager-2cba6d69.js} +4 -4
- package/dist/cjs/{stencil-suggestion-manager-c0878ef2.js.map → stencil-suggestion-manager-2cba6d69.js.map} +1 -1
- package/dist/cjs/{suggestions-common-5097a362.js → suggestions-events-63dd0640.js} +17 -21
- package/dist/cjs/suggestions-events-63dd0640.js.map +1 -0
- package/dist/cjs/suggestions-utils-61000808.js +25 -0
- package/dist/cjs/suggestions-utils-61000808.js.map +1 -0
- package/dist/cjs/version.cjs.js +2 -2
- package/dist/esm/_index.js +2 -1
- package/dist/esm/_loader.js +1 -1
- package/dist/esm/{analytics-config-d0c5b639.js → analytics-config-b49fc947.js} +2 -2
- package/dist/esm/{analytics-config-d0c5b639.js.map → analytics-config-b49fc947.js.map} +1 -1
- package/dist/esm/atomic-insight-interface.entry.js +1 -1
- package/dist/esm/atomic-insight-search-box.entry.js +33 -7
- package/dist/esm/atomic-insight-search-box.entry.js.map +1 -1
- package/dist/esm/atomic-recs-interface.entry.js +1 -1
- package/dist/esm/atomic-search-box-instant-results.entry.js +2 -2
- package/dist/esm/atomic-search-box-instant-results.entry.js.map +1 -1
- package/dist/esm/{atomic-search-box-query-suggestions_2.entry.js → atomic-search-box-recent-queries.entry.js} +8 -70
- package/dist/esm/atomic-search-box-recent-queries.entry.js.map +1 -0
- package/dist/esm/atomic-search-box.entry.js +6 -6
- package/dist/esm/atomic-search-box.entry.js.map +1 -1
- package/dist/esm/atomic-search-interface.entry.js +1 -1
- package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +2 -2
- package/dist/esm/atomic-suggestion-renderer.entry.js +1 -1
- package/dist/esm/atomic-suggestion-renderer.entry.js.map +1 -1
- package/dist/esm/atomic-tab-manager.entry.js +1 -1
- package/dist/esm/atomic.js +1 -1
- package/dist/esm/index-3f35faca.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{stencil-suggestion-manager-486094dd.js → stencil-suggestion-manager-376f83e8.js} +2 -2
- package/dist/esm/{stencil-suggestion-manager-486094dd.js.map → stencil-suggestion-manager-376f83e8.js.map} +1 -1
- package/dist/esm/{suggestions-common-2b20db26.js → suggestions-events-b7a6f007.js} +18 -20
- package/dist/esm/suggestions-events-b7a6f007.js.map +1 -0
- package/dist/esm/suggestions-utils-591559a0.js +22 -0
- package/dist/esm/suggestions-utils-591559a0.js.map +1 -0
- package/dist/esm/version.js +2 -2
- package/dist/types/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.d.ts +2 -1
- package/dist/types/components/commerce/atomic-commerce-interface/atomic-commerce-interface.d.ts +0 -1
- package/dist/types/components/commerce/atomic-commerce-layout/atomic-commerce-layout.d.ts +3 -3
- package/dist/types/components/commerce/atomic-commerce-search-box-instant-products/atomic-commerce-search-box-instant-products.d.ts +1 -1
- package/dist/types/components/commerce/atomic-commerce-search-box-query-suggestions/atomic-commerce-search-box-query-suggestions.d.ts +1 -1
- package/dist/types/components/commerce/atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.d.ts +1 -1
- package/dist/types/components/common/atomic-suggestion-renderer/atomic-suggestion-renderer.d.ts +1 -1
- package/dist/types/components/common/layout/layout-styles-controller.d.ts +22 -0
- package/dist/types/components/common/layout/mobile-breakpoint-controller.d.ts +18 -0
- package/dist/types/components/common/suggestions/instant-item.d.ts +1 -1
- package/dist/types/components/common/suggestions/query-suggestions.d.ts +1 -1
- package/dist/types/components/common/suggestions/recent-queries.d.ts +1 -1
- package/dist/types/components/common/suggestions/stencil-instant-item.d.ts +1 -1
- package/dist/types/components/common/suggestions/stencil-query-suggestions.d.ts +1 -1
- package/dist/types/components/common/suggestions/stencil-recent-queries.d.ts +1 -1
- package/dist/types/components/common/suggestions/stencil-suggestion-manager.d.ts +1 -1
- package/dist/types/components/common/suggestions/suggestion-manager.d.ts +1 -1
- package/dist/types/components/common/suggestions/suggestions-events.d.ts +14 -0
- package/dist/types/components/common/suggestions/{suggestions-common.d.ts → suggestions-types.d.ts} +6 -16
- package/dist/types/components/common/suggestions/suggestions-utils.d.ts +15 -0
- package/dist/types/components/search/atomic-search-box/atomic-search-box.d.ts +1 -1
- package/dist/types/components/search/{search-box-suggestions/atomic-search-box-query-suggestions → atomic-search-box-query-suggestions}/atomic-search-box-query-suggestions.d.ts +17 -8
- package/dist/types/components/search/index.d.ts +1 -0
- package/dist/types/components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results.d.ts +1 -1
- package/dist/types/components.d.ts +2 -51
- package/dist/types/decorators/types.d.ts +1 -1
- package/dist/types/index.d.ts +3 -1
- package/docs/atomic-docs.json +5 -104
- package/package.json +4 -4
- package/dist/atomic/components/atomic-search-box-query-suggestions.d.ts +0 -11
- package/dist/atomic/components/atomic-search-box-query-suggestions.js +0 -8
- package/dist/atomic/components/atomic-search-box-query-suggestions.js.map +0 -1
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js +0 -89
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js.map +0 -1
- package/dist/atomic/components/stencil-query-suggestions.js +0 -33
- package/dist/atomic/components/stencil-query-suggestions.js.map +0 -1
- package/dist/atomic/components/suggestions-common.js.map +0 -1
- package/dist/atomic/p-29fd6768.js +0 -2
- package/dist/atomic/p-29fd6768.js.map +0 -1
- package/dist/atomic/p-36e71b99.entry.js.map +0 -1
- package/dist/atomic/p-3d847e45.entry.js.map +0 -1
- package/dist/atomic/p-7601c3de.js +0 -2
- package/dist/atomic/p-7601c3de.js.map +0 -1
- package/dist/atomic/p-8867af82.entry.js +0 -2
- package/dist/atomic/p-8867af82.entry.js.map +0 -1
- package/dist/atomic/p-aa4224ea.entry.js.map +0 -1
- package/dist/atomic/p-af93b44c.js +0 -2
- package/dist/atomic/p-af93b44c.js.map +0 -1
- package/dist/atomic/p-c1bf43cf.entry.js +0 -2
- package/dist/atomic/p-c1bf43cf.entry.js.map +0 -1
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js.map +0 -1
- package/dist/cjs/stencil-query-suggestions-03268ecc.js +0 -38
- package/dist/cjs/stencil-query-suggestions-03268ecc.js.map +0 -1
- package/dist/cjs/suggestions-common-5097a362.js.map +0 -1
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js.map +0 -1
- package/dist/esm/stencil-query-suggestions-5d6a46d7.js +0 -33
- package/dist/esm/stencil-query-suggestions-5d6a46d7.js.map +0 -1
- package/dist/esm/suggestions-common-2b20db26.js.map +0 -1
- /package/dist/atomic/{p-aa2a81fd.entry.js.map → p-39e63678.entry.js.map} +0 -0
- /package/dist/atomic/{p-aa8e0616.entry.js.map → p-9b24788e.entry.js.map} +0 -0
- /package/dist/atomic/{p-7a625c7e.entry.js.map → p-ae98c582.entry.js.map} +0 -0
- /package/dist/atomic/{p-a09b4db4.entry.js.map → p-be8d7ee7.entry.js.map} +0 -0
- /package/dist/atomic/{p-83e20cc3.entry.js.map → p-c1384fa7.entry.js.map} +0 -0
- /package/dist/atomic/{p-94b5f495.js.map → p-c81ba3db.js.map} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-suggestion-renderer2.js","mappings":";;SAgBgB,OAAO;;IAErB,OAAO,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;SAEe,WAAW;IACzB,OAAO,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AACzD;;MCNa,wBAAwB;;;;;;;;;;;;;;;IAYnC,IAAY,KAAK;QACf,IAAI,IAAI,GAAG,YAAY,CAAC;QACxB,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,IAAI,oBAAoB,CAAC;SAC9B;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;YACzB,IAAI,IAAI,wBAAwB,CAAC;SAClC;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACxB,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,C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AG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,EACxB,IAAI,EAAE,IAAI,CAAC,KAAK,EAChB,KAAK,EAAE,IAAI,CAAC,OAAO,gBACP,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EACpC,GAAG,EAAE,CAAC,EAAE;gBACN,IAAI,CAAC,EAAE,EAAE;oBACP,OAAO;iBACR;gBACD,IAAI,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;aAC7C,IAEA,IAAI,CAAC,OAAO,CACR,CACR,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/utils/device-utils.ts","src/components/common/atomic-suggestion-renderer/atomic-suggestion-renderer.tsx"],"sourcesContent":["export function isIOS() {\n // Source: https://stackoverflow.com/a/62094756\n const iosQuirkPresent = () => {\n const audio = new Audio();\n\n audio.volume = 0.5;\n return audio.volume === 1; // volume cannot be changed from \"1\" on iOS 12 and below\n };\n\n const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);\n const isAppleDevice = navigator.userAgent.includes('Macintosh');\n const isTouchScreen = navigator.maxTouchPoints >= 1; // true for iOS 13 (and hopefully beyond)\n\n return isIOS || (isAppleDevice && (isTouchScreen || iosQuirkPresent()));\n}\n\nexport function isMacOS() {\n // Source: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform#examples\n return navigator.platform.startsWith('Mac');\n}\n\nexport function hasKeyboard() {\n return window.matchMedia('(any-hover: hover)').matches;\n}\n","import {isMacOS} from '@/src/utils/device-utils';\nimport {Component, Fragment, Host, Prop, VNode, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {SearchBoxSuggestionElement} from '../suggestions/suggestions-
|
1
|
+
{"file":"atomic-suggestion-renderer2.js","mappings":";;SAgBgB,OAAO;;IAErB,OAAO,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;SAEe,WAAW;IACzB,OAAO,MAAM,CAAC,UAAU,CA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,CAAC,CAAC,EACxC,WAAW,EAAE,CAAC,CAAQ,KAAK,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,gBACpC,IAAI,CAAC,UAAU,CAAC,KAAK,gBACrB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EACpC,GAAG,EAAE,CAAC,EAAE;gBACN,IAAI,CAAC,EAAE,EAAE;oBACP,OAAO;iBACR;gBACD,IAAI,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;aAC7C,IAEA,IAAI,CAAC,OAAO,CACN,KAET,YACE,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,EACxB,IAAI,EAAE,IAAI,CAAC,KAAK,EAChB,KAAK,EAAE,IAAI,CAAC,OAAO,gBACP,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EACpC,GAAG,EAAE,CAAC,EAAE;gBACN,IAAI,CAAC,EAAE,EAAE;oBACP,OAAO;iBACR;gBACD,IAAI,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;aAC7C,IAEA,IAAI,CAAC,OAAO,CACR,CACR,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/utils/device-utils.ts","src/components/common/atomic-suggestion-renderer/atomic-suggestion-renderer.tsx"],"sourcesContent":["export function isIOS() {\n // Source: https://stackoverflow.com/a/62094756\n const iosQuirkPresent = () => {\n const audio = new Audio();\n\n audio.volume = 0.5;\n return audio.volume === 1; // volume cannot be changed from \"1\" on iOS 12 and below\n };\n\n const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);\n const isAppleDevice = navigator.userAgent.includes('Macintosh');\n const isTouchScreen = navigator.maxTouchPoints >= 1; // true for iOS 13 (and hopefully beyond)\n\n return isIOS || (isAppleDevice && (isTouchScreen || iosQuirkPresent()));\n}\n\nexport function isMacOS() {\n // Source: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform#examples\n return navigator.platform.startsWith('Mac');\n}\n\nexport function hasKeyboard() {\n return window.matchMedia('(any-hover: hover)').matches;\n}\n","import {isMacOS} from '@/src/utils/device-utils';\nimport {Component, Fragment, Host, Prop, VNode, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {SearchBoxSuggestionElement} from '../suggestions/suggestions-types';\n\n/**\n * The `atomic-suggestion-renderer` component is used to render individual suggestions. It was created to isolate\n * the rendering logic of the 'content' property of the `SearchBoxSuggestionElement` interface. This property can be Stencil\n * VNode or native Element so there must be a Stencil component to render it. For Lit components using this component, they will\n * use native Elements.\n *\n * @internal\n */\n@Component({\n tag: 'atomic-suggestion-renderer',\n shadow: false,\n})\nexport class AtomicSuggestionRenderer {\n @Prop() public i18n!: i18n;\n @Prop() public id!: string;\n @Prop() public suggestion!: SearchBoxSuggestionElement;\n @Prop() public isSelected!: boolean;\n @Prop() public side!: 'left' | 'right';\n @Prop() public index!: number;\n @Prop() public lastIndex!: number;\n @Prop() public isDoubleList!: boolean;\n @Prop() public onClick?: (e: Event) => void;\n @Prop() public onMouseOver?: (e: Event) => void;\n\n private get parts() {\n let part = 'suggestion';\n if (this.isSelected) {\n part += ' active-suggestion';\n }\n if (this.suggestion.query) {\n part += ' suggestion-with-query';\n }\n if (this.suggestion.part) {\n part += ` ${this.suggestion.part}`;\n }\n return part;\n }\n\n private get classes() {\n return `flex px-4 min-h-10 items-center text-left text-neutral-dark cursor-pointer ${\n this.isSelected ? 'bg-neutral-light' : ''\n }`;\n }\n\n private get content() {\n return this.isHTMLElement(this.suggestion.content) ? (\n <Fragment></Fragment>\n ) : (\n this.suggestion.content\n );\n }\n\n private ariaLabel(isButton: boolean) {\n const contentLabel =\n this.suggestion.ariaLabel ??\n this.suggestion.query ??\n this.i18n.t('no-title');\n\n const labelWithType =\n isMacOS() && isButton\n ? this.i18n.t('search-suggestion-button', {\n label: contentLabel,\n interpolation: {escapeValue: false},\n })\n : contentLabel;\n\n const position = this.index + 1;\n const count = this.lastIndex + 1;\n\n if (!this.isDoubleList) {\n return this.i18n.t('search-suggestion-single-list', {\n label: labelWithType,\n position,\n count,\n interpolation: {escapeValue: false},\n });\n }\n\n return this.i18n.t('search-suggestion-double-list', {\n label: labelWithType,\n position,\n count,\n side: this.i18n.t(this.side === 'left' ? 'left' : 'right'),\n interpolation: {escapeValue: false},\n });\n }\n\n private ensureContentForRenderedSuggestion(element: HTMLElement) {\n if (this.isHTMLElement(this.suggestion.content)) {\n element.replaceChildren(this.suggestion.content);\n }\n }\n\n private isHTMLElement(el: VNode | Element): el is HTMLElement {\n return el instanceof HTMLElement;\n }\n\n render() {\n const isButton = !!(this.suggestion.onSelect || this.suggestion.query);\n\n return (\n <Host class=\"contents\">\n {isButton ? (\n <button\n id={this.id}\n key={this.suggestion.key}\n part={this.parts}\n class={this.classes}\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e: Event) => this.onClick?.(e)}\n onMouseOver={(e: Event) => this.onMouseOver?.(e)}\n data-query={this.suggestion.query}\n aria-label={this.ariaLabel(isButton)}\n ref={(el) => {\n if (!el) {\n return;\n }\n this.ensureContentForRenderedSuggestion(el);\n }}\n >\n {this.content}\n </button>\n ) : (\n <span\n id={this.id}\n key={this.suggestion.key}\n part={this.parts}\n class={this.classes}\n aria-label={this.ariaLabel(isButton)}\n ref={(el) => {\n if (!el) {\n return;\n }\n this.ensureContentForRenderedSuggestion(el);\n }}\n >\n {this.content}\n </span>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
@@ -59,7 +59,7 @@ const AtomicTabManager$1 = /*@__PURE__*/ proxyCustomElement(class AtomicTabManag
|
|
59
59
|
});
|
60
60
|
}
|
61
61
|
render() {
|
62
|
-
return (h(Host, { key: '
|
62
|
+
return (h(Host, { key: '6e72dfdd25eae1cd7fac4e91535654c8659e96a2' }, h("atomic-tab-bar", { key: '2afb27ff6773d7e31100aff97594f06c55264844' }, h("div", { key: 'bcd422b9454a9dfe3480c8cc4e09535dae266f10', role: "list", "aria-label": "tab-area", part: "tab-area", class: "border-neutral mb-2 flex w-full flex-row border-b" }, this.tabs.map((tab) => (h("atomic-tab-button", { active: this.tabManagerState.activeTab === tab.name, label: this.bindings.i18n.t(tab.label, {
|
63
63
|
defaultValue: tab.label,
|
64
64
|
}), select: () => {
|
65
65
|
if (!tab.tabController.state.isActive) {
|
@@ -115,23 +115,30 @@ let AtomicCommerceBreadbox = class AtomicCommerceBreadbox extends LitElement {
|
|
115
115
|
this.breadcrumbShowMoreFocus = new FocusTargetController(this, this.bindings);
|
116
116
|
this.breadcrumbShowLessFocus = new FocusTargetController(this, this.bindings);
|
117
117
|
}
|
118
|
-
|
119
|
-
super.updated(changedProperties);
|
118
|
+
willUpdate(changedProperties) {
|
120
119
|
if (changedProperties.has('pathLimit')) {
|
121
120
|
this.validateProps();
|
122
121
|
}
|
122
|
+
}
|
123
|
+
updated() {
|
123
124
|
this.adaptBreadcrumbs();
|
124
125
|
}
|
125
126
|
validateProps() {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
127
|
+
try {
|
128
|
+
new Schema({
|
129
|
+
pathLimit: new NumberValue({
|
130
|
+
default: 3,
|
131
|
+
min: 1,
|
132
|
+
required: false,
|
133
|
+
}),
|
134
|
+
}).validate({
|
135
|
+
pathLimit: this.pathLimit,
|
136
|
+
});
|
137
|
+
}
|
138
|
+
catch (error) {
|
139
|
+
this.error = error;
|
140
|
+
return;
|
141
|
+
}
|
135
142
|
}
|
136
143
|
disconnectedCallback() {
|
137
144
|
this.resizeObserver?.disconnect();
|
@@ -9,6 +9,7 @@ import { provide } from '@lit/context';
|
|
9
9
|
import i18next from 'i18next';
|
10
10
|
import { css, html, LitElement } from 'lit';
|
11
11
|
import { customElement, property, state } from 'lit/decorators.js';
|
12
|
+
import { MobileBreakpointController } from "../../common/layout/mobile-breakpoint-controller";
|
12
13
|
import { booleanConverter } from "../../../converters/boolean-converter";
|
13
14
|
import { errorGuard } from "../../../decorators/error-guard";
|
14
15
|
import { watch } from "../../../decorators/watch";
|
@@ -85,6 +86,7 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
|
|
85
86
|
this.urlManager.synchronize(this.fragment);
|
86
87
|
};
|
87
88
|
this.store = createCommerceStore(this.type);
|
89
|
+
new MobileBreakpointController(this, this.store);
|
88
90
|
const { promise, resolve } = Promise.withResolvers();
|
89
91
|
this.i18Initialized = promise;
|
90
92
|
this.i18n = i18next.createInstance(undefined, resolve);
|
@@ -92,7 +94,6 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
|
|
92
94
|
connectedCallback() {
|
93
95
|
super.connectedCallback();
|
94
96
|
this.store.setLoadingFlag(FirstRequestExecutedFlag);
|
95
|
-
this.updateMobileBreakpoint();
|
96
97
|
this.addEventListener('atomic/initializeComponent', this.handleInitialization);
|
97
98
|
this.addEventListener('atomic/scrollToTop', this.scrollToTop);
|
98
99
|
}
|
@@ -285,12 +286,6 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
|
|
285
286
|
history.pushState(null, document.title, `#${newFragment}`);
|
286
287
|
this.bindings.engine.logger.info(`History pushState #${newFragment}`);
|
287
288
|
}
|
288
|
-
updateMobileBreakpoint() {
|
289
|
-
const breakpoint = this.querySelector('atomic-commerce-layout')?.mobileBreakpoint;
|
290
|
-
if (breakpoint) {
|
291
|
-
this.store.state.mobileBreakpoint = breakpoint;
|
292
|
-
}
|
293
|
-
}
|
294
289
|
};
|
295
290
|
AtomicCommerceInterface.styles = [
|
296
291
|
css`:host{display:block;height:inherit;width:inherit;&>slot{height:inherit}}`,
|
package/dist/atomic/components/components/commerce/atomic-commerce-layout/atomic-commerce-layout.js
CHANGED
@@ -4,11 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
6
|
};
|
7
|
-
import { LitElement
|
7
|
+
import { LitElement } from 'lit';
|
8
8
|
import { customElement, property, state } from 'lit/decorators.js';
|
9
|
+
import { LayoutStylesController } from "../../common/layout/layout-styles-controller";
|
10
|
+
import { watch } from "../../../decorators/watch";
|
9
11
|
import { ChildrenUpdateCompleteMixin } from "../../../mixins/children-update-complete-mixin";
|
10
12
|
import { LightDomMixin } from "../../../mixins/light-dom";
|
11
|
-
import { randomID } from "../../../utils/utils";
|
12
13
|
import { DEFAULT_MOBILE_BREAKPOINT } from '../../../utils/replace-breakpoint-utils';
|
13
14
|
import styles from './atomic-commerce-layout.tw.css';
|
14
15
|
import { buildCommerceLayout } from './commerce-layout';
|
@@ -18,8 +19,6 @@ import { buildCommerceLayout } from './commerce-layout';
|
|
18
19
|
* @cssprop --atomic-layout-max-search-box-input-width: The maximum width that the search box input will take.
|
19
20
|
* @cssprop --atomic-layout-max-search-box-double-suggestions-width: The maximum width that the search box suggestions will take when displaying a double list.
|
20
21
|
* @cssprop --atomic-layout-search-box-left-suggestions-width: The width of the left list when displaying a double list.
|
21
|
-
*
|
22
|
-
* @slot default - The default slot for the layout content.
|
23
22
|
*/
|
24
23
|
let AtomicCommerceLayout = class AtomicCommerceLayout extends LightDomMixin(ChildrenUpdateCompleteMixin(LitElement)) {
|
25
24
|
constructor() {
|
@@ -29,15 +28,22 @@ let AtomicCommerceLayout = class AtomicCommerceLayout extends LightDomMixin(Chil
|
|
29
28
|
* E.g., 800px, 65rem.
|
30
29
|
*/
|
31
30
|
this.mobileBreakpoint = DEFAULT_MOBILE_BREAKPOINT;
|
32
|
-
|
33
|
-
async addStyles() {
|
34
|
-
await this.getUpdateComplete();
|
35
|
-
this.injectStyles(unsafeCSS(buildCommerceLayout(this, this.mobileBreakpoint)));
|
31
|
+
this.layoutStylesController = new LayoutStylesController(this, buildCommerceLayout, 'atomic-commerce-layout-');
|
36
32
|
}
|
37
33
|
connectedCallback() {
|
38
34
|
super.connectedCallback();
|
39
|
-
this.
|
40
|
-
|
35
|
+
this.emitBreakpointChangeEvent();
|
36
|
+
}
|
37
|
+
emitBreakpointChangeEvent() {
|
38
|
+
this.dispatchEvent(new CustomEvent('atomic-layout-breakpoint-change', {
|
39
|
+
detail: { breakpoint: this.mobileBreakpoint },
|
40
|
+
bubbles: true,
|
41
|
+
composed: true,
|
42
|
+
}));
|
43
|
+
}
|
44
|
+
onMobileBreakpointChange() {
|
45
|
+
this.layoutStylesController.updateStyles();
|
46
|
+
this.emitBreakpointChangeEvent();
|
41
47
|
}
|
42
48
|
};
|
43
49
|
AtomicCommerceLayout.styles = [styles];
|
@@ -47,6 +53,9 @@ __decorate([
|
|
47
53
|
__decorate([
|
48
54
|
property({ type: String, reflect: true, attribute: 'mobile-breakpoint' })
|
49
55
|
], AtomicCommerceLayout.prototype, "mobileBreakpoint", void 0);
|
56
|
+
__decorate([
|
57
|
+
watch('mobileBreakpoint')
|
58
|
+
], AtomicCommerceLayout.prototype, "onMobileBreakpointChange", null);
|
50
59
|
AtomicCommerceLayout = __decorate([
|
51
60
|
customElement('atomic-commerce-layout')
|
52
61
|
], AtomicCommerceLayout);
|
@@ -25,7 +25,7 @@ import { renderSearchBoxWrapper } from '../../common/search-box/search-box-wrapp
|
|
25
25
|
import { renderSearchBoxTextArea } from '../../common/search-box/search-text-area';
|
26
26
|
import { renderSubmitButton } from '../../common/search-box/submit-button';
|
27
27
|
import { SuggestionManager } from '../../common/suggestions/suggestion-manager';
|
28
|
-
import { elementHasQuery
|
28
|
+
import { elementHasQuery } from '../../common/suggestions/suggestions-utils';
|
29
29
|
import '../atomic-commerce-search-box-instant-products/atomic-commerce-search-box-instant-products';
|
30
30
|
import '../atomic-commerce-search-box-query-suggestions/atomic-commerce-search-box-query-suggestions';
|
31
31
|
import '../atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries';
|
@@ -9,7 +9,7 @@ import { html, LitElement, nothing, render } from 'lit';
|
|
9
9
|
import { customElement, property, state } from 'lit/decorators.js';
|
10
10
|
import { keyed } from 'lit/directives/keyed.js';
|
11
11
|
import { getPartialInstantItemElement, getPartialInstantItemShowAllElement, renderInstantItemShowAllButton, } from "../../common/suggestions/instant-item";
|
12
|
-
import { dispatchSearchBoxSuggestionsEvent
|
12
|
+
import { dispatchSearchBoxSuggestionsEvent } from "../../common/suggestions/suggestions-events";
|
13
13
|
import { errorGuard } from "../../../decorators/error-guard";
|
14
14
|
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
|
15
15
|
import { encodeForDomAttribute } from "../../../utils/string-utils";
|
@@ -8,7 +8,7 @@ import { loadQuerySuggestActions, } from '@coveo/headless/commerce';
|
|
8
8
|
import { html, LitElement, nothing } from 'lit';
|
9
9
|
import { customElement, property, state } from 'lit/decorators.js';
|
10
10
|
import { getPartialSearchBoxSuggestionElement, renderQuerySuggestion, } from "../../common/suggestions/query-suggestions";
|
11
|
-
import { dispatchSearchBoxSuggestionsEvent
|
11
|
+
import { dispatchSearchBoxSuggestionsEvent } from "../../common/suggestions/suggestions-events";
|
12
12
|
import { errorGuard } from "../../../decorators/error-guard";
|
13
13
|
const SearchIcon = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m6.4 0c3.5 0 6.4 2.9 6.4 6.4 0 1.4-.4 2.7-1.2 3.7l4 4c.4.4.4 1 .1 1.5l-.1.1c-.2.2-.5.3-.8.3s-.6-.1-.8-.3l-4-4c-1 .7-2.3 1.2-3.7 1.2-3.4-.1-6.3-3-6.3-6.5s2.9-6.4 6.4-6.4zm0 2.1c-2.3 0-4.3 1.9-4.3 4.3s1.9 4.3 4.3 4.3 4.3-1.9 4.3-4.3-1.9-4.3-4.3-4.3z\"/></svg>";
|
14
14
|
/**
|
@@ -12,7 +12,7 @@ import { SafeStorage, StorageItems } from "../../../utils/local-storage-utils";
|
|
12
12
|
import { once } from "../../../utils/utils";
|
13
13
|
const Clock = "<svg fill=\"none\" stroke=\"currentColor\" stroke-linejoin=\"round\" stroke-linecap=\"round\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"8\" cy=\"8\" r=\"7.5\"/><path d=\"m8.5 4.5v4\"/><path d=\"m10.3066 10.1387-1.80932-1.5768\"/></svg>";
|
14
14
|
import { getPartialRecentQueryClearElement, getPartialRecentQueryElement, renderRecentQuery, renderRecentQueryClear, } from '../../common/suggestions/recent-queries';
|
15
|
-
import { dispatchSearchBoxSuggestionsEvent
|
15
|
+
import { dispatchSearchBoxSuggestionsEvent } from '../../common/suggestions/suggestions-events';
|
16
16
|
/**
|
17
17
|
* The `atomic-commerce-search-box-recent-queries` component can be added as a child of an `atomic-commerce-search-box` component, allowing for the configuration of recent query suggestions.
|
18
18
|
*/
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { randomID } from "../../../utils/utils";
|
2
|
+
/**
|
3
|
+
* A reactive controller that manages dynamic layout styles.
|
4
|
+
*/
|
5
|
+
export class LayoutStylesController {
|
6
|
+
constructor(host, stylesBuilder, componentPrefix) {
|
7
|
+
this.dynamicStyleSheet = null;
|
8
|
+
this.host = host;
|
9
|
+
this.stylesBuilder = stylesBuilder;
|
10
|
+
this.componentPrefix = componentPrefix;
|
11
|
+
this.host.addController(this);
|
12
|
+
}
|
13
|
+
hostConnected() {
|
14
|
+
if (!this.host.id) {
|
15
|
+
this.host.id = randomID(this.componentPrefix);
|
16
|
+
}
|
17
|
+
this.host.updateComplete.then(() => this.updateStyles());
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* Updates the dynamic styles based on the current mobile breakpoint
|
21
|
+
*/
|
22
|
+
updateStyles() {
|
23
|
+
const parent = this.host.getRootNode();
|
24
|
+
const isDocumentOrShadowRoot = parent instanceof Document || parent instanceof ShadowRoot;
|
25
|
+
if (!isDocumentOrShadowRoot) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
const newStylesCSS = this.stylesBuilder(this.host, this.host.mobileBreakpoint);
|
29
|
+
if (!this.dynamicStyleSheet) {
|
30
|
+
this.dynamicStyleSheet = new CSSStyleSheet();
|
31
|
+
this.dynamicStyleSheet.replaceSync(newStylesCSS);
|
32
|
+
parent.adoptedStyleSheets = [
|
33
|
+
...parent.adoptedStyleSheets,
|
34
|
+
this.dynamicStyleSheet,
|
35
|
+
];
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
this.dynamicStyleSheet.replaceSync(newStylesCSS);
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* A reactive controller that manages mobile breakpoint changes through event communication.
|
3
|
+
* This controller listens for 'atomic-layout-breakpoint-change' events and updates a store
|
4
|
+
* with the new breakpoint value.
|
5
|
+
*/
|
6
|
+
export class MobileBreakpointController {
|
7
|
+
constructor(host, store) {
|
8
|
+
this.host = host;
|
9
|
+
this.store = store;
|
10
|
+
this.eventListener = this.handleBreakpointChange.bind(this);
|
11
|
+
this.host.addController(this);
|
12
|
+
}
|
13
|
+
hostConnected() {
|
14
|
+
this.host.addEventListener('atomic-layout-breakpoint-change', this.eventListener);
|
15
|
+
}
|
16
|
+
hostDisconnected() {
|
17
|
+
this.host.removeEventListener('atomic-layout-breakpoint-change', this.eventListener);
|
18
|
+
}
|
19
|
+
handleBreakpointChange(e) {
|
20
|
+
const customEvent = e;
|
21
|
+
const newBreakpoint = customEvent.detail?.breakpoint;
|
22
|
+
if (newBreakpoint && this.store.state.mobileBreakpoint !== newBreakpoint) {
|
23
|
+
this.store.state.mobileBreakpoint = newBreakpoint;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
@@ -2,7 +2,7 @@ import { isNullOrUndefined } from '@coveo/bueno';
|
|
2
2
|
import DOMPurify from 'dompurify';
|
3
3
|
import { debounce } from '../../../utils/debounce-utils';
|
4
4
|
import { promiseTimeout } from '../../../utils/promise-utils';
|
5
|
-
import { elementHasNoQuery, elementHasQuery
|
5
|
+
import { elementHasNoQuery, elementHasQuery } from './suggestions-utils';
|
6
6
|
export class SuggestionManager {
|
7
7
|
constructor(ownerSearchBoxProps) {
|
8
8
|
this.ownerSearchBoxProps = ownerSearchBoxProps;
|
@@ -1,5 +1,21 @@
|
|
1
1
|
import { closest } from '../../../utils/dom-utils';
|
2
2
|
import { buildCustomEvent } from '../../../utils/event-utils';
|
3
|
+
/**
|
4
|
+
* Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.
|
5
|
+
*
|
6
|
+
* @param event Event sent from the registered query suggestions to the parent search box
|
7
|
+
* @param element Element on which to dispatch the event, which must be the child of a configured search box
|
8
|
+
* @param allowedSearchBoxElements Optional array of allowed search box element selectors
|
9
|
+
*
|
10
|
+
* @throws Error if the element is not a child of an allowed search box element
|
11
|
+
*/
|
12
|
+
export const dispatchSearchBoxSuggestionsEvent = (event, element, allowedSearchBoxElements = searchBoxElements) => {
|
13
|
+
const interfaceElement = closest(element, searchBoxElements.join(', '));
|
14
|
+
if (!interfaceElement) {
|
15
|
+
throw new Error(`The "${element.nodeName.toLowerCase()}" component was not handled, as it is not a child of the following elements: ${allowedSearchBoxElements.join(', ')}`);
|
16
|
+
}
|
17
|
+
void dispatchSearchBoxSuggestionsEventEventually(interfaceElement, element, event);
|
18
|
+
};
|
3
19
|
const searchBoxElements = [
|
4
20
|
'atomic-search-box',
|
5
21
|
'atomic-insight-search-box',
|
@@ -17,21 +33,3 @@ const dispatchSearchBoxSuggestionsEventEventually = async (interfaceElement, ele
|
|
17
33
|
}
|
18
34
|
element.dispatchEvent(buildCustomEvent('atomic/searchBoxSuggestion/register', event));
|
19
35
|
};
|
20
|
-
/**
|
21
|
-
* Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.
|
22
|
-
* @param event Event sent from the registered query suggestions to the parent search box.
|
23
|
-
* @param element Element on which to dispatch the event, which must be the child of a configured search box.
|
24
|
-
*/
|
25
|
-
export const dispatchSearchBoxSuggestionsEvent = (event, element, allowedSearchBoxElements = searchBoxElements) => {
|
26
|
-
const interfaceElement = closest(element, searchBoxElements.join(', '));
|
27
|
-
if (!interfaceElement) {
|
28
|
-
throw new Error(`The "${element.nodeName.toLowerCase()}" component was not handled, as it is not a child of the following elements: ${allowedSearchBoxElements.join(', ')}`);
|
29
|
-
}
|
30
|
-
void dispatchSearchBoxSuggestionsEventEventually(interfaceElement, element, event);
|
31
|
-
};
|
32
|
-
export function elementHasNoQuery(el) {
|
33
|
-
return !el.query || el.query.trim() === '';
|
34
|
-
}
|
35
|
-
export function elementHasQuery(el) {
|
36
|
-
return !!el.query && el.query.trim() !== '';
|
37
|
-
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Checks if a search box suggestion element has no query.
|
3
|
+
*
|
4
|
+
* @param el - The search box suggestion element to check
|
5
|
+
* @returns True if the element has no query or the query is whitespace-only
|
6
|
+
*/
|
7
|
+
export function elementHasNoQuery(el) {
|
8
|
+
return !el.query || el.query.trim() === '';
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* Checks if a search box suggestion element has a query.
|
12
|
+
*
|
13
|
+
* @param el - The search box suggestion element to check
|
14
|
+
* @returns True if the element has a non-empty, non-whitespace query
|
15
|
+
*/
|
16
|
+
export function elementHasQuery(el) {
|
17
|
+
return !!el.query && el.query.trim() !== '';
|
18
|
+
}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
import { loadQuerySuggestActions, } from '@coveo/headless';
|
8
|
+
import { html, LitElement, nothing } from 'lit';
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
10
|
+
import { bindings } from "../../../decorators/bindings";
|
11
|
+
import { errorGuard } from "../../../decorators/error-guard";
|
12
|
+
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
|
13
|
+
const SearchIcon = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m6.4 0c3.5 0 6.4 2.9 6.4 6.4 0 1.4-.4 2.7-1.2 3.7l4 4c.4.4.4 1 .1 1.5l-.1.1c-.2.2-.5.3-.8.3s-.6-.1-.8-.3l-4-4c-1 .7-2.3 1.2-3.7 1.2-3.4-.1-6.3-3-6.3-6.5s2.9-6.4 6.4-6.4zm0 2.1c-2.3 0-4.3 1.9-4.3 4.3s1.9 4.3 4.3 4.3 4.3-1.9 4.3-4.3-1.9-4.3-4.3-4.3z\"/></svg>";
|
14
|
+
import { getPartialSearchBoxSuggestionElement, renderQuerySuggestion, } from '../../common/suggestions/query-suggestions';
|
15
|
+
import { dispatchSearchBoxSuggestionsEvent } from '../../common/suggestions/suggestions-events';
|
16
|
+
/**
|
17
|
+
* The `atomic-search-box-query-suggestions` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of query suggestion behavior.
|
18
|
+
*/
|
19
|
+
let AtomicSearchBoxQuerySuggestions = class AtomicSearchBoxQuerySuggestions extends LitElement {
|
20
|
+
constructor() {
|
21
|
+
super(...arguments);
|
22
|
+
/**
|
23
|
+
* The maximum number of suggestions that will be displayed if the user has typed something into the input field.
|
24
|
+
*/
|
25
|
+
this.maxWithQuery = 3;
|
26
|
+
/**
|
27
|
+
* The maximum number of suggestions that will be displayed initially when the input field is empty.
|
28
|
+
*/
|
29
|
+
this.maxWithoutQuery = 0;
|
30
|
+
}
|
31
|
+
initialize() {
|
32
|
+
this.initializeQuerySuggestions();
|
33
|
+
}
|
34
|
+
connectedCallback() {
|
35
|
+
super.connectedCallback();
|
36
|
+
try {
|
37
|
+
dispatchSearchBoxSuggestionsEvent((bindings) => {
|
38
|
+
this.suggestionsBindings = bindings;
|
39
|
+
return this.initializeQuerySuggestions();
|
40
|
+
}, this, ['atomic-search-box']);
|
41
|
+
}
|
42
|
+
catch (error) {
|
43
|
+
this.error = error;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
initializeQuerySuggestions() {
|
47
|
+
const engine = this.suggestionsBindings.engine;
|
48
|
+
const { registerQuerySuggest, fetchQuerySuggestions } = loadQuerySuggestActions(engine);
|
49
|
+
const numberOfQueries = this.suggestionsBindings.numberOfQueries;
|
50
|
+
const maxWithQuery = this.maxWithQuery;
|
51
|
+
if (numberOfQueries < maxWithQuery) {
|
52
|
+
const logger = this.suggestionsBindings.engine.logger;
|
53
|
+
logger.warn(`Query suggestions configuration mismatch: atomic-search-box has number-of-queries="${numberOfQueries}" but atomic-search-box-query-suggestions has max-with-query="${maxWithQuery}". ` +
|
54
|
+
`This may cause inconsistent behavior where the search box requests ${numberOfQueries} suggestions but the component tries to display up to ${maxWithQuery}. ` +
|
55
|
+
`Consider updating max-with-query to ${numberOfQueries} or increasing number-of-queries to ${maxWithQuery}.`);
|
56
|
+
}
|
57
|
+
engine.dispatch(registerQuerySuggest({
|
58
|
+
id: this.suggestionsBindings.id,
|
59
|
+
count: this.suggestionsBindings.numberOfQueries,
|
60
|
+
}));
|
61
|
+
return {
|
62
|
+
position: Array.from(this.parentNode.children).indexOf(this),
|
63
|
+
onInput: () => engine.dispatch(fetchQuerySuggestions({
|
64
|
+
id: this.suggestionsBindings.id,
|
65
|
+
})),
|
66
|
+
renderItems: () => this.renderItems(),
|
67
|
+
};
|
68
|
+
}
|
69
|
+
renderItems() {
|
70
|
+
const hasQuery = this.suggestionsBindings.searchBoxController.state.value !== '';
|
71
|
+
const max = hasQuery ? this.maxWithQuery : this.maxWithoutQuery;
|
72
|
+
return this.suggestionsBindings.searchBoxController.state.suggestions
|
73
|
+
.slice(0, max)
|
74
|
+
.map((suggestion) => this.renderItem(suggestion));
|
75
|
+
}
|
76
|
+
renderItem(suggestion) {
|
77
|
+
const partialItem = getPartialSearchBoxSuggestionElement(suggestion, this.suggestionsBindings.i18n);
|
78
|
+
const icon = this.icon || SearchIcon;
|
79
|
+
const hasQuery = this.suggestionsBindings.searchBoxController.state.value !== '';
|
80
|
+
const hasMultipleKindOfSuggestions = this.suggestionsBindings.getSuggestions().length > 1;
|
81
|
+
return {
|
82
|
+
...partialItem,
|
83
|
+
content: renderQuerySuggestion({
|
84
|
+
icon,
|
85
|
+
hasQuery,
|
86
|
+
suggestion,
|
87
|
+
hasMultipleKindOfSuggestions,
|
88
|
+
}),
|
89
|
+
onSelect: () => {
|
90
|
+
this.suggestionsBindings.searchBoxController.selectSuggestion(suggestion.rawValue);
|
91
|
+
},
|
92
|
+
};
|
93
|
+
}
|
94
|
+
render() {
|
95
|
+
return html `${nothing}`;
|
96
|
+
}
|
97
|
+
};
|
98
|
+
__decorate([
|
99
|
+
state()
|
100
|
+
], AtomicSearchBoxQuerySuggestions.prototype, "error", void 0);
|
101
|
+
__decorate([
|
102
|
+
state()
|
103
|
+
], AtomicSearchBoxQuerySuggestions.prototype, "bindings", void 0);
|
104
|
+
__decorate([
|
105
|
+
property()
|
106
|
+
], AtomicSearchBoxQuerySuggestions.prototype, "icon", void 0);
|
107
|
+
__decorate([
|
108
|
+
property({ type: Number, attribute: 'max-with-query', reflect: true })
|
109
|
+
], AtomicSearchBoxQuerySuggestions.prototype, "maxWithQuery", void 0);
|
110
|
+
__decorate([
|
111
|
+
property({ type: Number, attribute: 'max-without-query', reflect: true })
|
112
|
+
], AtomicSearchBoxQuerySuggestions.prototype, "maxWithoutQuery", void 0);
|
113
|
+
__decorate([
|
114
|
+
errorGuard()
|
115
|
+
], AtomicSearchBoxQuerySuggestions.prototype, "render", null);
|
116
|
+
AtomicSearchBoxQuerySuggestions = __decorate([
|
117
|
+
customElement('atomic-search-box-query-suggestions'),
|
118
|
+
withTailwindStyles,
|
119
|
+
bindings()
|
120
|
+
], AtomicSearchBoxQuerySuggestions);
|
121
|
+
export { AtomicSearchBoxQuerySuggestions };
|
@@ -1,4 +1,5 @@
|
|
1
1
|
// Auto-generated file
|
2
2
|
export { AtomicQuerySummary } from './atomic-query-summary/atomic-query-summary.js';
|
3
3
|
export { AtomicResultsPerPage } from './atomic-results-per-page/atomic-results-per-page.js';
|
4
|
+
export { AtomicSearchBoxQuerySuggestions } from './atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.js';
|
4
5
|
export { AtomicSearchLayout } from './atomic-search-layout/atomic-search-layout.js';
|
@@ -2,5 +2,6 @@
|
|
2
2
|
export default {
|
3
3
|
'atomic-query-summary': async () => await import('./atomic-query-summary/atomic-query-summary.js'),
|
4
4
|
'atomic-results-per-page': async () => await import('./atomic-results-per-page/atomic-results-per-page.js'),
|
5
|
+
'atomic-search-box-query-suggestions': async () => await import('./atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.js'),
|
5
6
|
'atomic-search-layout': async () => await import('./atomic-search-layout/atomic-search-layout.js'),
|
6
7
|
};
|
@@ -3,7 +3,25 @@ import { B as Button } from './stencil-button.js';
|
|
3
3
|
import { isNullOrUndefined } from '@coveo/bueno';
|
4
4
|
import { D as DOMPurify } from './purify.js';
|
5
5
|
import { d as debounce } from './debounce-utils.js';
|
6
|
-
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Checks if a search box suggestion element has no query.
|
9
|
+
*
|
10
|
+
* @param el - The search box suggestion element to check
|
11
|
+
* @returns True if the element has no query or the query is whitespace-only
|
12
|
+
*/
|
13
|
+
function elementHasNoQuery(el) {
|
14
|
+
return !el.query || el.query.trim() === '';
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* Checks if a search box suggestion element has a query.
|
18
|
+
*
|
19
|
+
* @param el - The search box suggestion element to check
|
20
|
+
* @returns True if the element has a non-empty, non-whitespace query
|
21
|
+
*/
|
22
|
+
function elementHasQuery(el) {
|
23
|
+
return !!el.query && el.query.trim() !== '';
|
24
|
+
}
|
7
25
|
|
8
26
|
const SearchSlimIcon = `<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
9
27
|
<circle cx="7" cy="7" r="6.5" stroke="currentColor"/>
|
@@ -409,6 +427,6 @@ class SuggestionManager {
|
|
409
427
|
}
|
410
428
|
}
|
411
429
|
|
412
|
-
export { SuggestionManager as S,
|
430
|
+
export { SuggestionManager as S, elementHasQuery as a, SearchSlimIcon as b, SearchBoxWrapper as c, SearchTextArea as d, elementHasNoQuery as e };
|
413
431
|
|
414
432
|
//# sourceMappingURL=stencil-suggestion-manager.js.map
|