@coveo/atomic-react 3.11.45 → 3.11.46
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/cjs/atomic-react.cjs +147 -93
- package/dist/cjs/atomic-react.cjs.map +1 -1
- package/dist/cjs/commerce/atomic-react.cjs +147 -92
- package/dist/cjs/commerce/atomic-react.cjs.map +1 -1
- package/dist/cjs/recommendation/atomic-react.cjs +147 -93
- package/dist/cjs/recommendation/atomic-react.cjs.map +1 -1
- package/package.json +3 -3
|
@@ -4910,6 +4910,46 @@ const booleanConverter = {
|
|
|
4910
4910
|
}
|
|
4911
4911
|
};
|
|
4912
4912
|
|
|
4913
|
+
const renderFacetValueLabelHighlight = ({ props })=>{
|
|
4914
|
+
const classNames = tw({
|
|
4915
|
+
'value-label peer-hover:text-error truncate': true,
|
|
4916
|
+
'font-bold': props.isSelected || !!props.isExcluded
|
|
4917
|
+
});
|
|
4918
|
+
return lit.html`<span
|
|
4919
|
+
title=${props.displayValue}
|
|
4920
|
+
part="value-label"
|
|
4921
|
+
class=${multiClassMap(classNames)}
|
|
4922
|
+
.innerHTML=${highlightSearchResult(props.displayValue, props.searchQuery)}
|
|
4923
|
+
></span>`;
|
|
4924
|
+
};
|
|
4925
|
+
|
|
4926
|
+
const renderCategoryFacetActiveValue = ({ props: { displayValue, numberOfResults, i18n, searchQuery, isLeafValue, setRef } })=>(children)=>{
|
|
4927
|
+
const count = numberOfResults.toLocaleString(i18n.language);
|
|
4928
|
+
return lit.html`${keyed_js.keyed(displayValue, lit.html`<li class="contents">
|
|
4929
|
+
<span
|
|
4930
|
+
part="active-parent ${isLeafValue ? 'leaf-value' : 'node-value'}"
|
|
4931
|
+
class="text-primary flex w-full items-center truncate px-2 py-2.5 text-left"
|
|
4932
|
+
aria-current="true"
|
|
4933
|
+
tabindex="-1"
|
|
4934
|
+
${ref_js.ref(setRef)}
|
|
4935
|
+
>
|
|
4936
|
+
${renderFacetValueLabelHighlight({
|
|
4937
|
+
props: {
|
|
4938
|
+
displayValue,
|
|
4939
|
+
searchQuery,
|
|
4940
|
+
isSelected: true
|
|
4941
|
+
}
|
|
4942
|
+
})}
|
|
4943
|
+
<span part="value-count" class="value-count">
|
|
4944
|
+
${i18n.t('between-parentheses', {
|
|
4945
|
+
text: count
|
|
4946
|
+
})}
|
|
4947
|
+
</span>
|
|
4948
|
+
</span>
|
|
4949
|
+
${children}
|
|
4950
|
+
</li>`)}`;
|
|
4951
|
+
};
|
|
4952
|
+
|
|
4913
4953
|
var arrow_left_rounded = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m11.5 4.8-4.3 4.5c-.3.4-.3.9 0 1.3l4.3 4.6c.3.4.9.4 1.2 0s.3-.9 0-1.3l-3.7-4 3.7-3.9c.3-.4.3-.9 0-1.3-.3-.3-.9-.3-1.2.1z\"/></svg>";
|
|
4914
4954
|
|
|
4915
4955
|
const getAllCategoriesLocalizedLabel = ({ facetId, field, i18n })=>{
|
|
@@ -4970,91 +5010,6 @@ const renderCategoryFacetParentButton = ({ props })=>{
|
|
|
4970
5010
|
`);
|
|
4971
5011
|
};
|
|
4972
5012
|
|
|
4973
|
-
const renderFacetValueLabelHighlight = ({ props })=>{
|
|
4974
|
-
const classNames = tw({
|
|
4975
|
-
'value-label peer-hover:text-error truncate': true,
|
|
4976
|
-
'font-bold': props.isSelected || !!props.isExcluded
|
|
4977
|
-
});
|
|
4978
|
-
return lit.html`<span
|
|
4979
|
-
title=${props.displayValue}
|
|
4980
|
-
part="value-label"
|
|
4981
|
-
class=${multiClassMap(classNames)}
|
|
4982
|
-
.innerHTML=${highlightSearchResult(props.displayValue, props.searchQuery)}
|
|
4983
|
-
></span>`;
|
|
4984
|
-
};
|
|
4985
|
-
|
|
4986
|
-
const renderFacetValueLink = ({ props })=>(children)=>{
|
|
4987
|
-
const count = props.numberOfResults.toLocaleString(props.i18n.language);
|
|
4988
|
-
const ariaLabel = props.i18n.t('facet-value', {
|
|
4989
|
-
value: props.displayValue,
|
|
4990
|
-
count: props.numberOfResults,
|
|
4991
|
-
formattedCount: count,
|
|
4992
|
-
interpolation: {
|
|
4993
|
-
escapeValue: false
|
|
4994
|
-
}
|
|
4995
|
-
});
|
|
4996
|
-
let part = props.part ?? `value-link${props.isSelected ? ' value-link-selected' : ''}`;
|
|
4997
|
-
if (props.additionalPart) part += ` ${props.additionalPart}`;
|
|
4998
|
-
return lit.html`
|
|
4999
|
-
${keyed_js.keyed(props.displayValue, lit.html`<li class=${ifDefined_js.ifDefined(props.class)}>
|
|
5000
|
-
${renderButton({
|
|
5001
|
-
props: {
|
|
5002
|
-
style: 'text-neutral',
|
|
5003
|
-
part,
|
|
5004
|
-
onClick: ()=>props.onClick(),
|
|
5005
|
-
class: 'group flex w-full items-center truncate px-2 py-2.5 text-left focus-visible:outline-none',
|
|
5006
|
-
ariaPressed: props.isSelected ? 'true' : 'false',
|
|
5007
|
-
ariaLabel,
|
|
5008
|
-
ref: props.buttonRef
|
|
5009
|
-
}
|
|
5010
|
-
})(lit.html`${children}<span part="value-count" class="value-count">
|
|
5011
|
-
${props.i18n.t('between-parentheses', {
|
|
5012
|
-
text: count
|
|
5013
|
-
})}
|
|
5014
|
-
</span>`)}
|
|
5015
|
-
${props.subList}
|
|
5016
|
-
</li>`)}
|
|
5017
|
-
`;
|
|
5018
|
-
};
|
|
5019
|
-
|
|
5020
|
-
const renderCategoryFacetValueLink = ({ props: { displayValue, numberOfResults, i18n, onClick, isParent, isSelected, searchQuery, isLeafValue, setRef } })=>(children)=>{
|
|
5021
|
-
const partNames = [];
|
|
5022
|
-
if (isParent) partNames.push('active-parent');
|
|
5023
|
-
else partNames.push(`value-link${isSelected ? ' value-link-selected' : ''}`);
|
|
5024
|
-
if (isLeafValue) partNames.push('leaf-value');
|
|
5025
|
-
else partNames.push('node-value');
|
|
5026
|
-
return lit.html`${renderFacetValueLink({
|
|
5027
|
-
props: {
|
|
5028
|
-
displayValue,
|
|
5029
|
-
numberOfResults,
|
|
5030
|
-
i18n,
|
|
5031
|
-
onClick,
|
|
5032
|
-
isSelected,
|
|
5033
|
-
searchQuery,
|
|
5034
|
-
part: partNames.join(' '),
|
|
5035
|
-
class: 'contents',
|
|
5036
|
-
buttonRef: (element)=>{
|
|
5037
|
-
setRef?.(element);
|
|
5038
|
-
},
|
|
5039
|
-
subList: children
|
|
5040
|
-
}
|
|
5041
|
-
})(renderFacetValueLabelHighlight({
|
|
5042
|
-
props: {
|
|
5043
|
-
displayValue,
|
|
5044
|
-
searchQuery,
|
|
5045
|
-
isSelected
|
|
5046
|
-
}
|
|
5047
|
-
}))}`;
|
|
5048
|
-
};
|
|
5049
|
-
|
|
5050
|
-
const renderCategoryFacetParentValueLink = ({ props })=>renderCategoryFacetValueLink({
|
|
5051
|
-
props: {
|
|
5052
|
-
...props,
|
|
5053
|
-
isParent: true,
|
|
5054
|
-
isSelected: true
|
|
5055
|
-
}
|
|
5056
|
-
});
|
|
5057
|
-
|
|
5058
5013
|
const renderCategoryFacetSearchResultsContainer = ()=>(children)=>lit.html`<ul part="search-results" class="mt-3">
|
|
5059
5014
|
${children}
|
|
5060
5015
|
</ul>`;
|
|
@@ -5149,8 +5104,97 @@ const renderCategoryFacetSearchValue = ({ props })=>{
|
|
|
5149
5104
|
</li>`;
|
|
5150
5105
|
};
|
|
5151
5106
|
|
|
5107
|
+
const renderCategoryFacetSelectedValue = ({ props: { displayValue, label, i18n, onClearFilters } })=>lit.html`<div part="selected-value" class="mt-3 flex items-center justify-between gap-2">
|
|
5108
|
+
<span
|
|
5109
|
+
part="selected-value-pill"
|
|
5110
|
+
title=${displayValue}
|
|
5111
|
+
class="bg-neutral-light truncate rounded-md px-2 py-1 text-sm"
|
|
5112
|
+
>${displayValue}</span
|
|
5113
|
+
>
|
|
5114
|
+
${renderButton({
|
|
5115
|
+
props: {
|
|
5116
|
+
part: 'selected-value-clear-button',
|
|
5117
|
+
style: 'text-primary',
|
|
5118
|
+
class: 'flex shrink-0 items-center p-1 text-sm',
|
|
5119
|
+
ariaLabel: i18n.t('clear-filters-for-facet', {
|
|
5120
|
+
count: 1,
|
|
5121
|
+
label: i18n.t(label)
|
|
5122
|
+
}),
|
|
5123
|
+
onClick: onClearFilters
|
|
5124
|
+
}
|
|
5125
|
+
})(lit.html`<atomic-icon
|
|
5126
|
+
part="selected-value-clear-button-icon"
|
|
5127
|
+
class="mr-1 h-2 w-2"
|
|
5128
|
+
.icon=${images_close}
|
|
5129
|
+
></atomic-icon>
|
|
5130
|
+
<span>${i18n.t('clear')}</span>`)}
|
|
5131
|
+
</div>`;
|
|
5132
|
+
|
|
5152
5133
|
const renderCategoryFacetTreeValueContainer = ()=>(children)=>lit.html`<li class="contents">${children}</li>`;
|
|
5153
5134
|
|
|
5135
|
+
const renderFacetValueLink = ({ props })=>(children)=>{
|
|
5136
|
+
const count = props.numberOfResults.toLocaleString(props.i18n.language);
|
|
5137
|
+
const ariaLabel = props.i18n.t('facet-value', {
|
|
5138
|
+
value: props.displayValue,
|
|
5139
|
+
count: props.numberOfResults,
|
|
5140
|
+
formattedCount: count,
|
|
5141
|
+
interpolation: {
|
|
5142
|
+
escapeValue: false
|
|
5143
|
+
}
|
|
5144
|
+
});
|
|
5145
|
+
let part = props.part ?? `value-link${props.isSelected ? ' value-link-selected' : ''}`;
|
|
5146
|
+
if (props.additionalPart) part += ` ${props.additionalPart}`;
|
|
5147
|
+
return lit.html`
|
|
5148
|
+
${keyed_js.keyed(props.displayValue, lit.html`<li class=${ifDefined_js.ifDefined(props.class)}>
|
|
5149
|
+
${renderButton({
|
|
5150
|
+
props: {
|
|
5151
|
+
style: 'text-neutral',
|
|
5152
|
+
part,
|
|
5153
|
+
onClick: ()=>props.onClick(),
|
|
5154
|
+
class: 'group flex w-full items-center truncate px-2 py-2.5 text-left focus-visible:outline-none',
|
|
5155
|
+
ariaPressed: props.isSelected ? 'true' : 'false',
|
|
5156
|
+
ariaLabel,
|
|
5157
|
+
ref: props.buttonRef
|
|
5158
|
+
}
|
|
5159
|
+
})(lit.html`${children}<span part="value-count" class="value-count">
|
|
5160
|
+
${props.i18n.t('between-parentheses', {
|
|
5161
|
+
text: count
|
|
5162
|
+
})}
|
|
5163
|
+
</span>`)}
|
|
5164
|
+
${props.subList}
|
|
5165
|
+
</li>`)}
|
|
5166
|
+
`;
|
|
5167
|
+
};
|
|
5168
|
+
|
|
5169
|
+
const renderCategoryFacetValueLink = ({ props: { displayValue, numberOfResults, i18n, onClick, isSelected, searchQuery, isLeafValue, setRef } })=>(children)=>{
|
|
5170
|
+
const partNames = [
|
|
5171
|
+
`value-link${isSelected ? ' value-link-selected' : ''}`,
|
|
5172
|
+
isLeafValue ? 'leaf-value' : 'node-value'
|
|
5173
|
+
];
|
|
5174
|
+
return lit.html`${renderFacetValueLink({
|
|
5175
|
+
props: {
|
|
5176
|
+
displayValue,
|
|
5177
|
+
numberOfResults,
|
|
5178
|
+
i18n,
|
|
5179
|
+
onClick,
|
|
5180
|
+
isSelected,
|
|
5181
|
+
searchQuery,
|
|
5182
|
+
part: partNames.join(' '),
|
|
5183
|
+
class: 'contents',
|
|
5184
|
+
buttonRef: (element)=>{
|
|
5185
|
+
setRef?.(element);
|
|
5186
|
+
},
|
|
5187
|
+
subList: children
|
|
5188
|
+
}
|
|
5189
|
+
})(renderFacetValueLabelHighlight({
|
|
5190
|
+
props: {
|
|
5191
|
+
displayValue,
|
|
5192
|
+
searchQuery,
|
|
5193
|
+
isSelected
|
|
5194
|
+
}
|
|
5195
|
+
}))}`;
|
|
5196
|
+
};
|
|
5197
|
+
|
|
5154
5198
|
const styles$r = lit.css`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}.value-count{margin-left:calc(var(--spacing,.25rem)*1.5);color:var(--atomic-neutral-dark)}[part=value-exclude-button]+.value-count{margin-right:calc(var(--spacing,.25rem)*2)}:host(:state(hidden)){display:none}:host(.popover-nested){min-width:var(--container-2xs,18rem)}:host(.popover-nested)::part(label-button){display:none}:host(.popover-nested)::part(facet){--tw-shadow:0px 2px 8px var(--tw-shadow-color,#e5e8e8bf);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}:host(.popover-nested)::part(values){max-height:calc(var(--spacing,.25rem)*96);margin-top:0;overflow-y:auto}:host(.popover-nested)::part(search-wrapper){margin-bottom:calc(var(--spacing,.25rem)*2)}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}`;
|
|
5155
5199
|
const facet_common_tw_css = styles$r;
|
|
5156
5200
|
|
|
@@ -8361,7 +8405,7 @@ function getWindow$1() {
|
|
|
8361
8405
|
}
|
|
8362
8406
|
function getAtomicEnvironment(headlessVersion) {
|
|
8363
8407
|
return {
|
|
8364
|
-
version: "3.
|
|
8408
|
+
version: "3.62.0",
|
|
8365
8409
|
headlessVersion
|
|
8366
8410
|
};
|
|
8367
8411
|
}
|
|
@@ -25861,6 +25905,21 @@ let AtomicCategoryFacet$1 = class AtomicCategoryFacet extends lit.LitElement {
|
|
|
25861
25905
|
}
|
|
25862
25906
|
});
|
|
25863
25907
|
}
|
|
25908
|
+
renderSelectedValue() {
|
|
25909
|
+
const activeValue = this.facetState.selectedValueAncestry.at(-1);
|
|
25910
|
+
if (!activeValue) return lit.nothing;
|
|
25911
|
+
return renderCategoryFacetSelectedValue({
|
|
25912
|
+
props: {
|
|
25913
|
+
displayValue: getFieldValueCaption(this.field, activeValue.value, this.bindings.i18n),
|
|
25914
|
+
label: this.label,
|
|
25915
|
+
i18n: this.bindings.i18n,
|
|
25916
|
+
onClearFilters: ()=>{
|
|
25917
|
+
this.focusTargets.activeValueFocus.focusAfterSearch();
|
|
25918
|
+
this.facet.deselectAll();
|
|
25919
|
+
}
|
|
25920
|
+
}
|
|
25921
|
+
});
|
|
25922
|
+
}
|
|
25864
25923
|
renderValuesTree(valuesAsTrees, isRoot) {
|
|
25865
25924
|
if (!this.hasParents) return this.renderChildren();
|
|
25866
25925
|
if (isRoot) return renderCategoryFacetTreeValueContainer()(lit.html`
|
|
@@ -25905,16 +25964,12 @@ let AtomicCategoryFacet$1 = class AtomicCategoryFacet extends lit.LitElement {
|
|
|
25905
25964
|
const activeParent = valuesAsTrees[0];
|
|
25906
25965
|
const activeParentDisplayValue = getFieldValueCaption(this.field, activeParent.value, this.bindings.i18n);
|
|
25907
25966
|
return lit.html`
|
|
25908
|
-
${
|
|
25967
|
+
${renderCategoryFacetActiveValue({
|
|
25909
25968
|
props: {
|
|
25910
25969
|
displayValue: activeParentDisplayValue,
|
|
25911
25970
|
numberOfResults: activeParent.numberOfResults,
|
|
25912
25971
|
i18n: this.bindings.i18n,
|
|
25913
25972
|
isLeafValue: activeParent.isLeafValue,
|
|
25914
|
-
onClick: ()=>{
|
|
25915
|
-
this.focusTargets.activeValueFocus.focusAfterSearch();
|
|
25916
|
-
this.facet.deselectAll();
|
|
25917
|
-
},
|
|
25918
25973
|
searchQuery: this.facetState.facetSearch.query,
|
|
25919
25974
|
setRef: (el)=>{
|
|
25920
25975
|
this.focusTargets.activeValueFocus.setTarget(el);
|
|
@@ -25937,7 +25992,6 @@ let AtomicCategoryFacet$1 = class AtomicCategoryFacet extends lit.LitElement {
|
|
|
25937
25992
|
this.focusTargets.activeValueFocus.focusAfterSearch();
|
|
25938
25993
|
this.facet.toggleSelect(facetValue);
|
|
25939
25994
|
},
|
|
25940
|
-
isParent: false,
|
|
25941
25995
|
isSelected,
|
|
25942
25996
|
searchQuery: this.facetState.facetSearch.query,
|
|
25943
25997
|
isLeafValue: facetValue.isLeafValue,
|
|
@@ -26019,7 +26073,7 @@ let AtomicCategoryFacet$1 = class AtomicCategoryFacet extends lit.LitElement {
|
|
|
26019
26073
|
return renderFacetContainer()(lit.html`
|
|
26020
26074
|
${this.renderHeader()}
|
|
26021
26075
|
${when_js.when(!this.isCollapsed, ()=>lit.html`
|
|
26022
|
-
${this.renderSearchInput()}
|
|
26076
|
+
${this.renderSearchInput()} ${this.renderSelectedValue()}
|
|
26023
26077
|
${when_js.when(shouldDisplaySearchResults(facetSearch), ()=>lit.html`
|
|
26024
26078
|
${when_js.when(facetSearch.values.length > 0, ()=>renderFacetValuesGroup({
|
|
26025
26079
|
props: {
|