@coveo/atomic-react 3.11.44 → 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 +227 -105
- 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 +227 -105
- package/dist/cjs/recommendation/atomic-react.cjs.map +1 -1
- package/package.json +5 -5
|
@@ -4987,6 +4987,46 @@ const booleanConverter = {
|
|
|
4987
4987
|
}
|
|
4988
4988
|
};
|
|
4989
4989
|
|
|
4990
|
+
const renderFacetValueLabelHighlight = ({ props })=>{
|
|
4991
|
+
const classNames = tw({
|
|
4992
|
+
'value-label peer-hover:text-error truncate': true,
|
|
4993
|
+
'font-bold': props.isSelected || !!props.isExcluded
|
|
4994
|
+
});
|
|
4995
|
+
return lit.html`<span
|
|
4996
|
+
title=${props.displayValue}
|
|
4997
|
+
part="value-label"
|
|
4998
|
+
class=${multiClassMap(classNames)}
|
|
4999
|
+
.innerHTML=${highlightSearchResult(props.displayValue, props.searchQuery)}
|
|
5000
|
+
></span>`;
|
|
5001
|
+
};
|
|
5002
|
+
|
|
5003
|
+
const renderCategoryFacetActiveValue = ({ props: { displayValue, numberOfResults, i18n, searchQuery, isLeafValue, setRef } })=>(children)=>{
|
|
5004
|
+
const count = numberOfResults.toLocaleString(i18n.language);
|
|
5005
|
+
return lit.html`${keyed_js.keyed(displayValue, lit.html`<li class="contents">
|
|
5006
|
+
<span
|
|
5007
|
+
part="active-parent ${isLeafValue ? 'leaf-value' : 'node-value'}"
|
|
5008
|
+
class="text-primary flex w-full items-center truncate px-2 py-2.5 text-left"
|
|
5009
|
+
aria-current="true"
|
|
5010
|
+
tabindex="-1"
|
|
5011
|
+
${ref_js.ref(setRef)}
|
|
5012
|
+
>
|
|
5013
|
+
${renderFacetValueLabelHighlight({
|
|
5014
|
+
props: {
|
|
5015
|
+
displayValue,
|
|
5016
|
+
searchQuery,
|
|
5017
|
+
isSelected: true
|
|
5018
|
+
}
|
|
5019
|
+
})}
|
|
5020
|
+
<span part="value-count" class="value-count">
|
|
5021
|
+
${i18n.t('between-parentheses', {
|
|
5022
|
+
text: count
|
|
5023
|
+
})}
|
|
5024
|
+
</span>
|
|
5025
|
+
</span>
|
|
5026
|
+
${children}
|
|
5027
|
+
</li>`)}`;
|
|
5028
|
+
};
|
|
5029
|
+
|
|
4990
5030
|
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>";
|
|
4991
5031
|
|
|
4992
5032
|
const getAllCategoriesLocalizedLabel = ({ facetId, field, i18n })=>{
|
|
@@ -5047,91 +5087,6 @@ const renderCategoryFacetParentButton = ({ props })=>{
|
|
|
5047
5087
|
`);
|
|
5048
5088
|
};
|
|
5049
5089
|
|
|
5050
|
-
const renderFacetValueLabelHighlight = ({ props })=>{
|
|
5051
|
-
const classNames = tw({
|
|
5052
|
-
'value-label peer-hover:text-error truncate': true,
|
|
5053
|
-
'font-bold': props.isSelected || !!props.isExcluded
|
|
5054
|
-
});
|
|
5055
|
-
return lit.html`<span
|
|
5056
|
-
title=${props.displayValue}
|
|
5057
|
-
part="value-label"
|
|
5058
|
-
class=${multiClassMap(classNames)}
|
|
5059
|
-
.innerHTML=${highlightSearchResult(props.displayValue, props.searchQuery)}
|
|
5060
|
-
></span>`;
|
|
5061
|
-
};
|
|
5062
|
-
|
|
5063
|
-
const renderFacetValueLink = ({ props })=>(children)=>{
|
|
5064
|
-
const count = props.numberOfResults.toLocaleString(props.i18n.language);
|
|
5065
|
-
const ariaLabel = props.i18n.t('facet-value', {
|
|
5066
|
-
value: props.displayValue,
|
|
5067
|
-
count: props.numberOfResults,
|
|
5068
|
-
formattedCount: count,
|
|
5069
|
-
interpolation: {
|
|
5070
|
-
escapeValue: false
|
|
5071
|
-
}
|
|
5072
|
-
});
|
|
5073
|
-
let part = props.part ?? `value-link${props.isSelected ? ' value-link-selected' : ''}`;
|
|
5074
|
-
if (props.additionalPart) part += ` ${props.additionalPart}`;
|
|
5075
|
-
return lit.html`
|
|
5076
|
-
${keyed_js.keyed(props.displayValue, lit.html`<li class=${ifDefined_js.ifDefined(props.class)}>
|
|
5077
|
-
${renderButton({
|
|
5078
|
-
props: {
|
|
5079
|
-
style: 'text-neutral',
|
|
5080
|
-
part,
|
|
5081
|
-
onClick: ()=>props.onClick(),
|
|
5082
|
-
class: 'group flex w-full items-center truncate px-2 py-2.5 text-left focus-visible:outline-none',
|
|
5083
|
-
ariaPressed: props.isSelected ? 'true' : 'false',
|
|
5084
|
-
ariaLabel,
|
|
5085
|
-
ref: props.buttonRef
|
|
5086
|
-
}
|
|
5087
|
-
})(lit.html`${children}<span part="value-count" class="value-count">
|
|
5088
|
-
${props.i18n.t('between-parentheses', {
|
|
5089
|
-
text: count
|
|
5090
|
-
})}
|
|
5091
|
-
</span>`)}
|
|
5092
|
-
${props.subList}
|
|
5093
|
-
</li>`)}
|
|
5094
|
-
`;
|
|
5095
|
-
};
|
|
5096
|
-
|
|
5097
|
-
const renderCategoryFacetValueLink = ({ props: { displayValue, numberOfResults, i18n, onClick, isParent, isSelected, searchQuery, isLeafValue, setRef } })=>(children)=>{
|
|
5098
|
-
const partNames = [];
|
|
5099
|
-
if (isParent) partNames.push('active-parent');
|
|
5100
|
-
else partNames.push(`value-link${isSelected ? ' value-link-selected' : ''}`);
|
|
5101
|
-
if (isLeafValue) partNames.push('leaf-value');
|
|
5102
|
-
else partNames.push('node-value');
|
|
5103
|
-
return lit.html`${renderFacetValueLink({
|
|
5104
|
-
props: {
|
|
5105
|
-
displayValue,
|
|
5106
|
-
numberOfResults,
|
|
5107
|
-
i18n,
|
|
5108
|
-
onClick,
|
|
5109
|
-
isSelected,
|
|
5110
|
-
searchQuery,
|
|
5111
|
-
part: partNames.join(' '),
|
|
5112
|
-
class: 'contents',
|
|
5113
|
-
buttonRef: (element)=>{
|
|
5114
|
-
setRef?.(element);
|
|
5115
|
-
},
|
|
5116
|
-
subList: children
|
|
5117
|
-
}
|
|
5118
|
-
})(renderFacetValueLabelHighlight({
|
|
5119
|
-
props: {
|
|
5120
|
-
displayValue,
|
|
5121
|
-
searchQuery,
|
|
5122
|
-
isSelected
|
|
5123
|
-
}
|
|
5124
|
-
}))}`;
|
|
5125
|
-
};
|
|
5126
|
-
|
|
5127
|
-
const renderCategoryFacetParentValueLink = ({ props })=>renderCategoryFacetValueLink({
|
|
5128
|
-
props: {
|
|
5129
|
-
...props,
|
|
5130
|
-
isParent: true,
|
|
5131
|
-
isSelected: true
|
|
5132
|
-
}
|
|
5133
|
-
});
|
|
5134
|
-
|
|
5135
5090
|
const renderCategoryFacetSearchResultsContainer = ()=>(children)=>lit.html`<ul part="search-results" class="mt-3">
|
|
5136
5091
|
${children}
|
|
5137
5092
|
</ul>`;
|
|
@@ -5226,8 +5181,97 @@ const renderCategoryFacetSearchValue = ({ props })=>{
|
|
|
5226
5181
|
</li>`;
|
|
5227
5182
|
};
|
|
5228
5183
|
|
|
5184
|
+
const renderCategoryFacetSelectedValue = ({ props: { displayValue, label, i18n, onClearFilters } })=>lit.html`<div part="selected-value" class="mt-3 flex items-center justify-between gap-2">
|
|
5185
|
+
<span
|
|
5186
|
+
part="selected-value-pill"
|
|
5187
|
+
title=${displayValue}
|
|
5188
|
+
class="bg-neutral-light truncate rounded-md px-2 py-1 text-sm"
|
|
5189
|
+
>${displayValue}</span
|
|
5190
|
+
>
|
|
5191
|
+
${renderButton({
|
|
5192
|
+
props: {
|
|
5193
|
+
part: 'selected-value-clear-button',
|
|
5194
|
+
style: 'text-primary',
|
|
5195
|
+
class: 'flex shrink-0 items-center p-1 text-sm',
|
|
5196
|
+
ariaLabel: i18n.t('clear-filters-for-facet', {
|
|
5197
|
+
count: 1,
|
|
5198
|
+
label: i18n.t(label)
|
|
5199
|
+
}),
|
|
5200
|
+
onClick: onClearFilters
|
|
5201
|
+
}
|
|
5202
|
+
})(lit.html`<atomic-icon
|
|
5203
|
+
part="selected-value-clear-button-icon"
|
|
5204
|
+
class="mr-1 h-2 w-2"
|
|
5205
|
+
.icon=${images_close}
|
|
5206
|
+
></atomic-icon>
|
|
5207
|
+
<span>${i18n.t('clear')}</span>`)}
|
|
5208
|
+
</div>`;
|
|
5209
|
+
|
|
5229
5210
|
const renderCategoryFacetTreeValueContainer = ()=>(children)=>lit.html`<li class="contents">${children}</li>`;
|
|
5230
5211
|
|
|
5212
|
+
const renderFacetValueLink = ({ props })=>(children)=>{
|
|
5213
|
+
const count = props.numberOfResults.toLocaleString(props.i18n.language);
|
|
5214
|
+
const ariaLabel = props.i18n.t('facet-value', {
|
|
5215
|
+
value: props.displayValue,
|
|
5216
|
+
count: props.numberOfResults,
|
|
5217
|
+
formattedCount: count,
|
|
5218
|
+
interpolation: {
|
|
5219
|
+
escapeValue: false
|
|
5220
|
+
}
|
|
5221
|
+
});
|
|
5222
|
+
let part = props.part ?? `value-link${props.isSelected ? ' value-link-selected' : ''}`;
|
|
5223
|
+
if (props.additionalPart) part += ` ${props.additionalPart}`;
|
|
5224
|
+
return lit.html`
|
|
5225
|
+
${keyed_js.keyed(props.displayValue, lit.html`<li class=${ifDefined_js.ifDefined(props.class)}>
|
|
5226
|
+
${renderButton({
|
|
5227
|
+
props: {
|
|
5228
|
+
style: 'text-neutral',
|
|
5229
|
+
part,
|
|
5230
|
+
onClick: ()=>props.onClick(),
|
|
5231
|
+
class: 'group flex w-full items-center truncate px-2 py-2.5 text-left focus-visible:outline-none',
|
|
5232
|
+
ariaPressed: props.isSelected ? 'true' : 'false',
|
|
5233
|
+
ariaLabel,
|
|
5234
|
+
ref: props.buttonRef
|
|
5235
|
+
}
|
|
5236
|
+
})(lit.html`${children}<span part="value-count" class="value-count">
|
|
5237
|
+
${props.i18n.t('between-parentheses', {
|
|
5238
|
+
text: count
|
|
5239
|
+
})}
|
|
5240
|
+
</span>`)}
|
|
5241
|
+
${props.subList}
|
|
5242
|
+
</li>`)}
|
|
5243
|
+
`;
|
|
5244
|
+
};
|
|
5245
|
+
|
|
5246
|
+
const renderCategoryFacetValueLink = ({ props: { displayValue, numberOfResults, i18n, onClick, isSelected, searchQuery, isLeafValue, setRef } })=>(children)=>{
|
|
5247
|
+
const partNames = [
|
|
5248
|
+
`value-link${isSelected ? ' value-link-selected' : ''}`,
|
|
5249
|
+
isLeafValue ? 'leaf-value' : 'node-value'
|
|
5250
|
+
];
|
|
5251
|
+
return lit.html`${renderFacetValueLink({
|
|
5252
|
+
props: {
|
|
5253
|
+
displayValue,
|
|
5254
|
+
numberOfResults,
|
|
5255
|
+
i18n,
|
|
5256
|
+
onClick,
|
|
5257
|
+
isSelected,
|
|
5258
|
+
searchQuery,
|
|
5259
|
+
part: partNames.join(' '),
|
|
5260
|
+
class: 'contents',
|
|
5261
|
+
buttonRef: (element)=>{
|
|
5262
|
+
setRef?.(element);
|
|
5263
|
+
},
|
|
5264
|
+
subList: children
|
|
5265
|
+
}
|
|
5266
|
+
})(renderFacetValueLabelHighlight({
|
|
5267
|
+
props: {
|
|
5268
|
+
displayValue,
|
|
5269
|
+
searchQuery,
|
|
5270
|
+
isSelected
|
|
5271
|
+
}
|
|
5272
|
+
}))}`;
|
|
5273
|
+
};
|
|
5274
|
+
|
|
5231
5275
|
const styles$e = 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}`;
|
|
5232
5276
|
const facet_common_tw_css = styles$e;
|
|
5233
5277
|
|
|
@@ -5298,6 +5342,21 @@ let AtomicCommerceCategoryFacet$1 = class AtomicCommerceCategoryFacet extends li
|
|
|
5298
5342
|
}
|
|
5299
5343
|
});
|
|
5300
5344
|
}
|
|
5345
|
+
renderSelectedValue() {
|
|
5346
|
+
const activeValue = this.facetState.selectedValueAncestry?.at(-1);
|
|
5347
|
+
if (!activeValue) return lit.nothing;
|
|
5348
|
+
return renderCategoryFacetSelectedValue({
|
|
5349
|
+
props: {
|
|
5350
|
+
displayValue: getFieldValueCaption(this.facetState.field, activeValue.value, this.bindings.i18n),
|
|
5351
|
+
label: this.displayName,
|
|
5352
|
+
i18n: this.bindings.i18n,
|
|
5353
|
+
onClearFilters: ()=>{
|
|
5354
|
+
this.focusTargets.activeValueFocus.focusAfterSearch();
|
|
5355
|
+
this.facet.deselectAll();
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5358
|
+
});
|
|
5359
|
+
}
|
|
5301
5360
|
renderValuesTree(parents, isRoot) {
|
|
5302
5361
|
if (!this.hasParents) return this.renderChildren();
|
|
5303
5362
|
if (isRoot) return renderCategoryFacetTreeValueContainer()(lit.html`
|
|
@@ -5342,16 +5401,12 @@ let AtomicCommerceCategoryFacet$1 = class AtomicCommerceCategoryFacet extends li
|
|
|
5342
5401
|
const activeParent = parents[0];
|
|
5343
5402
|
const activeParentDisplayValue = getFieldValueCaption(this.facetState?.field, activeParent.value, this.bindings.i18n);
|
|
5344
5403
|
return lit.html`
|
|
5345
|
-
${
|
|
5404
|
+
${renderCategoryFacetActiveValue({
|
|
5346
5405
|
props: {
|
|
5347
5406
|
displayValue: activeParentDisplayValue,
|
|
5348
5407
|
numberOfResults: activeParent.numberOfResults,
|
|
5349
5408
|
i18n: this.bindings.i18n,
|
|
5350
5409
|
isLeafValue: activeParent.isLeafValue,
|
|
5351
|
-
onClick: ()=>{
|
|
5352
|
-
this.focusTargets.activeValueFocus.focusAfterSearch();
|
|
5353
|
-
this.facet.deselectAll();
|
|
5354
|
-
},
|
|
5355
5410
|
searchQuery: this.facetState.facetSearch.query,
|
|
5356
5411
|
setRef: (el)=>{
|
|
5357
5412
|
this.focusTargets.activeValueFocus.setTarget(el);
|
|
@@ -5376,7 +5431,6 @@ let AtomicCommerceCategoryFacet$1 = class AtomicCommerceCategoryFacet extends li
|
|
|
5376
5431
|
this.focusTargets.activeValueFocus.focusAfterSearch();
|
|
5377
5432
|
this.facet.toggleSelect(facetValue);
|
|
5378
5433
|
},
|
|
5379
|
-
isParent: false,
|
|
5380
5434
|
isSelected,
|
|
5381
5435
|
searchQuery: this.facetState.facetSearch.query,
|
|
5382
5436
|
isLeafValue: facetValue.isLeafValue,
|
|
@@ -5451,6 +5505,7 @@ let AtomicCommerceCategoryFacet$1 = class AtomicCommerceCategoryFacet extends li
|
|
|
5451
5505
|
onClear: ()=>this.facet.facetSearch.clear()
|
|
5452
5506
|
}
|
|
5453
5507
|
})}
|
|
5508
|
+
${this.renderSelectedValue()}
|
|
5454
5509
|
${when_js.when(shouldDisplaySearchResults(facetSearch), ()=>lit.html`
|
|
5455
5510
|
${when_js.when(facetSearch.values.length > 0, ()=>renderFacetValuesGroup({
|
|
5456
5511
|
props: {
|
|
@@ -9781,7 +9836,7 @@ function getWindow() {
|
|
|
9781
9836
|
}
|
|
9782
9837
|
function getAtomicEnvironment(headlessVersion) {
|
|
9783
9838
|
return {
|
|
9784
|
-
version: "3.
|
|
9839
|
+
version: "3.62.0",
|
|
9785
9840
|
headlessVersion
|
|
9786
9841
|
};
|
|
9787
9842
|
}
|