@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
|
@@ -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
|
}
|
|
@@ -18625,8 +18669,7 @@ const customRenderer = {
|
|
|
18625
18669
|
return `<em part="answer-emphasis">${text}</em>`;
|
|
18626
18670
|
},
|
|
18627
18671
|
heading (text, level) {
|
|
18628
|
-
|
|
18629
|
-
return `<div part="answer-heading-${level}" aria-label="${plainText}">${text}</div>`;
|
|
18672
|
+
return `<div part="answer-heading-${level}" role="heading" aria-level="${level}">${text}</div>`;
|
|
18630
18673
|
},
|
|
18631
18674
|
html (text) {
|
|
18632
18675
|
return escapeHtml(text);
|
|
@@ -19285,6 +19328,37 @@ const generated_answer_tw_css = [
|
|
|
19285
19328
|
|
|
19286
19329
|
const atomic_generated_answer_tw_css = generated_answer_tw_css;
|
|
19287
19330
|
|
|
19331
|
+
const SILENT = {
|
|
19332
|
+
message: '',
|
|
19333
|
+
assertive: false
|
|
19334
|
+
};
|
|
19335
|
+
const getAnswerAnnouncement = (answer, i18n)=>{
|
|
19336
|
+
if (!answer) return SILENT;
|
|
19337
|
+
if (answer.error) {
|
|
19338
|
+
const errorMessageKey = answer.error.isSseTurnLimitReachedError?.() ? 'generated-answer-error-turn-limit-reached' : 'generated-answer-error-generic';
|
|
19339
|
+
return {
|
|
19340
|
+
message: i18n.t(errorMessageKey),
|
|
19341
|
+
assertive: true
|
|
19342
|
+
};
|
|
19343
|
+
}
|
|
19344
|
+
if (answer.cannotAnswer) return {
|
|
19345
|
+
message: i18n.t('generated-answer-cannot-generate-answer'),
|
|
19346
|
+
assertive: true
|
|
19347
|
+
};
|
|
19348
|
+
if (answer.isStreaming || answer.isLoading) return {
|
|
19349
|
+
message: i18n.t('generating-answer'),
|
|
19350
|
+
assertive: false
|
|
19351
|
+
};
|
|
19352
|
+
if (answer.answer?.trim()) return {
|
|
19353
|
+
message: i18n.t('answer-generated', {
|
|
19354
|
+
answer: markdownToPlainText(answer.answer)
|
|
19355
|
+
}),
|
|
19356
|
+
assertive: false
|
|
19357
|
+
};
|
|
19358
|
+
return SILENT;
|
|
19359
|
+
};
|
|
19360
|
+
const isSettledAnswer = (answer)=>Boolean(answer && !answer.isStreaming && !answer.isLoading && !answer.error && !answer.cannotAnswer && answer.answer?.trim());
|
|
19361
|
+
|
|
19288
19362
|
const styles$8 = lit.css`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */:host{display:inline}a{color:var(--atomic-primary);text-decoration-line:none}a [part=answer-link-text]{text-decoration-line:underline}.icon-wrapper{vertical-align:text-bottom;width:1em;height:1em;display:inline-block}`;
|
|
19289
19363
|
const atomic_generated_answer_inline_link_tw_css = styles$8;
|
|
19290
19364
|
|
|
@@ -19423,7 +19497,11 @@ const renderGeneratedTextContent = ({ props })=>lit.html`
|
|
|
19423
19497
|
`;
|
|
19424
19498
|
|
|
19425
19499
|
const renderGeneratedContentContainer = ({ props })=>(children)=>lit.html`
|
|
19426
|
-
<div
|
|
19500
|
+
<div
|
|
19501
|
+
part="generated-container"
|
|
19502
|
+
id=${ifDefined_js.ifDefined(props.id)}
|
|
19503
|
+
aria-busy=${props.isStreaming ? 'true' : 'false'}
|
|
19504
|
+
>
|
|
19427
19505
|
${'text/markdown' === props.answerContentFormat ? renderGeneratedMarkdownContent({
|
|
19428
19506
|
props: {
|
|
19429
19507
|
answer: props.answer,
|
|
@@ -19451,6 +19529,7 @@ const renderCopyButton = ({ props })=>{
|
|
|
19451
19529
|
return renderButton({
|
|
19452
19530
|
props: {
|
|
19453
19531
|
title: props.title,
|
|
19532
|
+
ariaLabel: props.title,
|
|
19454
19533
|
part: 'copy-button',
|
|
19455
19534
|
style: 'text-transparent',
|
|
19456
19535
|
class: classes.join(' '),
|
|
@@ -19458,7 +19537,7 @@ const renderCopyButton = ({ props })=>{
|
|
|
19458
19537
|
}
|
|
19459
19538
|
})(lit.html`
|
|
19460
19539
|
<div class="icon-container text-neutral-dark">
|
|
19461
|
-
<atomic-icon class="w-5" .icon=${copy}></atomic-icon>
|
|
19540
|
+
<atomic-icon class="w-5" .icon=${copy} aria-hidden="true"></atomic-icon>
|
|
19462
19541
|
</div>
|
|
19463
19542
|
`);
|
|
19464
19543
|
};
|
|
@@ -19487,6 +19566,7 @@ const renderFeedbackButton = ({ props })=>{
|
|
|
19487
19566
|
return lit.html`<button
|
|
19488
19567
|
type="button"
|
|
19489
19568
|
title=${props.title}
|
|
19569
|
+
aria-label=${props.title}
|
|
19490
19570
|
part="feedback-button"
|
|
19491
19571
|
class=${classNames}
|
|
19492
19572
|
aria-pressed=${props.active ? 'true' : 'false'}
|
|
@@ -19495,7 +19575,7 @@ const renderFeedbackButton = ({ props })=>{
|
|
|
19495
19575
|
})}
|
|
19496
19576
|
@click=${props.onClick}
|
|
19497
19577
|
>
|
|
19498
|
-
<atomic-icon class=${iconClassNames} .icon=${thumbs}></atomic-icon>
|
|
19578
|
+
<atomic-icon class=${iconClassNames} .icon=${thumbs} aria-hidden="true"></atomic-icon>
|
|
19499
19579
|
</button>`;
|
|
19500
19580
|
};
|
|
19501
19581
|
|
|
@@ -19609,6 +19689,24 @@ class AtomicGeneratedAnswerContent extends lit.LitElement {
|
|
|
19609
19689
|
</div>
|
|
19610
19690
|
`;
|
|
19611
19691
|
}
|
|
19692
|
+
updated() {
|
|
19693
|
+
this.announceAnswerStatus();
|
|
19694
|
+
}
|
|
19695
|
+
announceAnswerStatus() {
|
|
19696
|
+
if (!this.i18n || !this.generatedAnswer) return;
|
|
19697
|
+
const { message, assertive } = getAnswerAnnouncement(this.generatedAnswer, this.i18n);
|
|
19698
|
+
if (!this.hasObservedAnswer) {
|
|
19699
|
+
this.hasObservedAnswer = true;
|
|
19700
|
+
if (isSettledAnswer(this.generatedAnswer)) {
|
|
19701
|
+
this.lastAnnouncedMessage = message;
|
|
19702
|
+
return;
|
|
19703
|
+
}
|
|
19704
|
+
}
|
|
19705
|
+
if (message === this.lastAnnouncedMessage) return;
|
|
19706
|
+
this.lastAnnouncedMessage = message;
|
|
19707
|
+
if (assertive) this.ariaErrorMessage.message = message;
|
|
19708
|
+
else this.ariaMessage.message = message;
|
|
19709
|
+
}
|
|
19612
19710
|
renderFeedbackAndCopyButtons(answerId) {
|
|
19613
19711
|
return lit.html`
|
|
19614
19712
|
<div class="mt-4" part="feedback-and-copy-buttons">
|
|
@@ -19639,9 +19737,11 @@ class AtomicGeneratedAnswerContent extends lit.LitElement {
|
|
|
19639
19737
|
try {
|
|
19640
19738
|
await navigator.clipboard.writeText(answer);
|
|
19641
19739
|
this.copyState = 'success';
|
|
19740
|
+
this.ariaCopyMessage.message = this.i18n.t('generated-answer-copied');
|
|
19642
19741
|
this.onCopyToClipboard(answerId);
|
|
19643
19742
|
} catch (error) {
|
|
19644
19743
|
this.copyState = 'error';
|
|
19744
|
+
this.ariaCopyMessage.message = this.i18n.t('failed-to-copy-generated-answer');
|
|
19645
19745
|
console.error(`Failed to copy to clipboard: ${error}`);
|
|
19646
19746
|
}
|
|
19647
19747
|
this.scheduleCopyReset();
|
|
@@ -19678,7 +19778,7 @@ class AtomicGeneratedAnswerContent extends lit.LitElement {
|
|
|
19678
19778
|
`;
|
|
19679
19779
|
}
|
|
19680
19780
|
constructor(...args){
|
|
19681
|
-
super(...args), this.answerId = '', this.renderCitations = ()=>lit.html``, this.onClickLike = ()=>{}, this.onClickDislike = ()=>{}, this.onCopyToClipboard = ()=>{}, this.copyState = 'idle';
|
|
19781
|
+
super(...args), this.answerId = '', this.renderCitations = ()=>lit.html``, this.onClickLike = ()=>{}, this.onClickDislike = ()=>{}, this.onCopyToClipboard = ()=>{}, this.copyState = 'idle', this.ariaMessage = new AriaLiveRegionController(this, 'generated-answer', false, true), this.ariaErrorMessage = new AriaLiveRegionController(this, 'generated-answer-error', true), this.ariaCopyMessage = new AriaLiveRegionController(this, 'generated-answer-copy', true), this.hasObservedAnswer = false;
|
|
19682
19782
|
}
|
|
19683
19783
|
}
|
|
19684
19784
|
AtomicGeneratedAnswerContent.styles = [
|
|
@@ -20277,7 +20377,7 @@ class AtomicGeneratedAnswerThreadItem extends lit.LitElement {
|
|
|
20277
20377
|
const timelineConnectorClasses = "relative h-full w-px bg-neutral transition-colors duration-150 group-hover:bg-neutral-dark before:absolute before:left-0 before:top-[-8px] before:h-[8px] before:w-px before:bg-neutral before:transition-colors before:duration-150 group-hover:before:bg-neutral-dark before:content-[''] after:absolute after:bottom-[-8px] after:left-0 after:h-[8px] after:w-px after:bg-neutral after:transition-colors after:duration-150 group-hover:after:bg-neutral-dark after:content-['']";
|
|
20278
20378
|
return lit.html`
|
|
20279
20379
|
<div class="group/title grid min-w-0 grid-cols-[10px_1fr] gap-x-3">
|
|
20280
|
-
<div class="row-span-2 flex flex-col items-center">
|
|
20380
|
+
<div class="row-span-2 flex flex-col items-center" aria-hidden="true">
|
|
20281
20381
|
<div class=${timelineDotToggleClasses}>
|
|
20282
20382
|
${when_js.when(this.showTimelineDot, ()=>lit.html`
|
|
20283
20383
|
<span
|
|
@@ -20311,8 +20411,9 @@ class AtomicGeneratedAnswerThreadItem extends lit.LitElement {
|
|
|
20311
20411
|
>${this.title}</span
|
|
20312
20412
|
>`)}
|
|
20313
20413
|
</div>
|
|
20314
|
-
<div
|
|
20414
|
+
<div class="min-w-0 pl-2 py-1.5">
|
|
20315
20415
|
<div
|
|
20416
|
+
id=${this.contentId}
|
|
20316
20417
|
class="mb-2"
|
|
20317
20418
|
?hidden=${!this.isExpanded}
|
|
20318
20419
|
aria-hidden=${this.isExpanded ? 'false' : 'true'}
|
|
@@ -20473,7 +20574,7 @@ class AtomicGeneratedAnswerThread extends lit.LitElement {
|
|
|
20473
20574
|
`;
|
|
20474
20575
|
return lit.html`
|
|
20475
20576
|
<li class="group/title grid min-w-0 grid-cols-[10px_1fr] gap-x-3">
|
|
20476
|
-
<div class="row-span-2 flex flex-col items-center">
|
|
20577
|
+
<div class="row-span-2 flex flex-col items-center" aria-hidden="true">
|
|
20477
20578
|
<div class="flex justify-center items-center text-base h-[1lh] my-1.5">
|
|
20478
20579
|
<span class=${timelineDotClasses}></span>
|
|
20479
20580
|
</div>
|
|
@@ -22119,6 +22220,7 @@ const renderShowButton = ({ props })=>lit.html`${renderButton({
|
|
|
22119
22220
|
part: 'answer-show-button',
|
|
22120
22221
|
class: 'hidden items-center hover:bg-transparent',
|
|
22121
22222
|
ariaExpanded: props.isCollapsed ? 'false' : 'true',
|
|
22223
|
+
ariaControls: props.controlsId,
|
|
22122
22224
|
onClick: props.onClick
|
|
22123
22225
|
}
|
|
22124
22226
|
})(lit.html`
|
|
@@ -22149,6 +22251,7 @@ const renderGeneratingAnswerLabel = ({ props })=>{
|
|
|
22149
22251
|
`)}`;
|
|
22150
22252
|
};
|
|
22151
22253
|
|
|
22254
|
+
const GENERATED_CONTENT_ID = 'generated-answer-content';
|
|
22152
22255
|
const renderAnswerContent = ({ props })=>{
|
|
22153
22256
|
const { i18n, generatedAnswer, collapsible, renderFeedbackAndCopyButtonsSlot, renderCitationsSlot, onRetry, onClickShowButton } = props;
|
|
22154
22257
|
const { answer, isStreaming, citations, answerContentFormat, expanded, error } = generatedAnswer;
|
|
@@ -22166,7 +22269,8 @@ const renderAnswerContent = ({ props })=>{
|
|
|
22166
22269
|
props: {
|
|
22167
22270
|
answer,
|
|
22168
22271
|
answerContentFormat,
|
|
22169
|
-
isStreaming: !!isStreaming
|
|
22272
|
+
isStreaming: !!isStreaming,
|
|
22273
|
+
id: collapsible ? GENERATED_CONTENT_ID : void 0
|
|
22170
22274
|
}
|
|
22171
22275
|
})(lit.html`
|
|
22172
22276
|
${renderSourceCitations({
|
|
@@ -22194,7 +22298,8 @@ const renderAnswerContent = ({ props })=>{
|
|
|
22194
22298
|
props: {
|
|
22195
22299
|
i18n,
|
|
22196
22300
|
onClick: onClickShowButton,
|
|
22197
|
-
isCollapsed: !expanded
|
|
22301
|
+
isCollapsed: !expanded,
|
|
22302
|
+
controlsId: GENERATED_CONTENT_ID
|
|
22198
22303
|
}
|
|
22199
22304
|
}) : lit.nothing}
|
|
22200
22305
|
</div>
|
|
@@ -25800,6 +25905,21 @@ let AtomicCategoryFacet$1 = class AtomicCategoryFacet extends lit.LitElement {
|
|
|
25800
25905
|
}
|
|
25801
25906
|
});
|
|
25802
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
|
+
}
|
|
25803
25923
|
renderValuesTree(valuesAsTrees, isRoot) {
|
|
25804
25924
|
if (!this.hasParents) return this.renderChildren();
|
|
25805
25925
|
if (isRoot) return renderCategoryFacetTreeValueContainer()(lit.html`
|
|
@@ -25844,16 +25964,12 @@ let AtomicCategoryFacet$1 = class AtomicCategoryFacet extends lit.LitElement {
|
|
|
25844
25964
|
const activeParent = valuesAsTrees[0];
|
|
25845
25965
|
const activeParentDisplayValue = getFieldValueCaption(this.field, activeParent.value, this.bindings.i18n);
|
|
25846
25966
|
return lit.html`
|
|
25847
|
-
${
|
|
25967
|
+
${renderCategoryFacetActiveValue({
|
|
25848
25968
|
props: {
|
|
25849
25969
|
displayValue: activeParentDisplayValue,
|
|
25850
25970
|
numberOfResults: activeParent.numberOfResults,
|
|
25851
25971
|
i18n: this.bindings.i18n,
|
|
25852
25972
|
isLeafValue: activeParent.isLeafValue,
|
|
25853
|
-
onClick: ()=>{
|
|
25854
|
-
this.focusTargets.activeValueFocus.focusAfterSearch();
|
|
25855
|
-
this.facet.deselectAll();
|
|
25856
|
-
},
|
|
25857
25973
|
searchQuery: this.facetState.facetSearch.query,
|
|
25858
25974
|
setRef: (el)=>{
|
|
25859
25975
|
this.focusTargets.activeValueFocus.setTarget(el);
|
|
@@ -25876,7 +25992,6 @@ let AtomicCategoryFacet$1 = class AtomicCategoryFacet extends lit.LitElement {
|
|
|
25876
25992
|
this.focusTargets.activeValueFocus.focusAfterSearch();
|
|
25877
25993
|
this.facet.toggleSelect(facetValue);
|
|
25878
25994
|
},
|
|
25879
|
-
isParent: false,
|
|
25880
25995
|
isSelected,
|
|
25881
25996
|
searchQuery: this.facetState.facetSearch.query,
|
|
25882
25997
|
isLeafValue: facetValue.isLeafValue,
|
|
@@ -25958,7 +26073,7 @@ let AtomicCategoryFacet$1 = class AtomicCategoryFacet extends lit.LitElement {
|
|
|
25958
26073
|
return renderFacetContainer()(lit.html`
|
|
25959
26074
|
${this.renderHeader()}
|
|
25960
26075
|
${when_js.when(!this.isCollapsed, ()=>lit.html`
|
|
25961
|
-
${this.renderSearchInput()}
|
|
26076
|
+
${this.renderSearchInput()} ${this.renderSelectedValue()}
|
|
25962
26077
|
${when_js.when(shouldDisplaySearchResults(facetSearch), ()=>lit.html`
|
|
25963
26078
|
${when_js.when(facetSearch.values.length > 0, ()=>renderFacetValuesGroup({
|
|
25964
26079
|
props: {
|
|
@@ -28602,6 +28717,7 @@ let AtomicGeneratedAnswer$1 = class AtomicGeneratedAnswer extends lit.LitElement
|
|
|
28602
28717
|
'generated-answer-content-background': this.areFollowUpsEnabled,
|
|
28603
28718
|
'agent-scrollable': this.areFollowUpsEnabled
|
|
28604
28719
|
})}
|
|
28720
|
+
tabindex=${this.areFollowUpsEnabled ? '0' : lit.nothing}
|
|
28605
28721
|
>
|
|
28606
28722
|
<article>${this.renderAnswerContent()}</article>
|
|
28607
28723
|
</div>
|
|
@@ -28626,6 +28742,9 @@ let AtomicGeneratedAnswer$1 = class AtomicGeneratedAnswer extends lit.LitElement
|
|
|
28626
28742
|
</div>
|
|
28627
28743
|
`;
|
|
28628
28744
|
}
|
|
28745
|
+
get shouldAnnounceAnswerStatus() {
|
|
28746
|
+
return !this.areFollowUpsEnabled;
|
|
28747
|
+
}
|
|
28629
28748
|
get hasNoAnswerGenerated() {
|
|
28630
28749
|
return this.controller.hasNoAnswerGenerated;
|
|
28631
28750
|
}
|
|
@@ -28650,11 +28769,13 @@ let AtomicGeneratedAnswer$1 = class AtomicGeneratedAnswer extends lit.LitElement
|
|
|
28650
28769
|
async copyToClipboard(answer) {
|
|
28651
28770
|
await this.controller.copyToClipboard(answer, ()=>{
|
|
28652
28771
|
this.copied = true;
|
|
28772
|
+
this.ariaCopyMessage.message = this.bindings.i18n.t('generated-answer-copied');
|
|
28653
28773
|
setTimeout(()=>{
|
|
28654
28774
|
this.copied = false;
|
|
28655
28775
|
}, 2000);
|
|
28656
28776
|
}, ()=>{
|
|
28657
28777
|
this.copyError = true;
|
|
28778
|
+
this.ariaCopyMessage.message = this.bindings.i18n.t('failed-to-copy-generated-answer');
|
|
28658
28779
|
setTimeout(()=>{
|
|
28659
28780
|
this.copyError = false;
|
|
28660
28781
|
}, 2000);
|
|
@@ -28849,7 +28970,7 @@ let AtomicGeneratedAnswer$1 = class AtomicGeneratedAnswer extends lit.LitElement
|
|
|
28849
28970
|
constructor(){
|
|
28850
28971
|
super(), this.DEFAULT_COLLAPSED_HEIGHT = 16, this.MAX_COLLAPSED_HEIGHT = 32, this.MIN_COLLAPSED_HEIGHT = 9, this.REQUIRED_FIELDS_TO_INCLUDE_IN_CITATIONS = [
|
|
28851
28972
|
'filetype'
|
|
28852
|
-
], this.withToggle = false, this.collapsible = false, this.maxCollapsedHeight = this.DEFAULT_COLLAPSED_HEIGHT, this.disableCitationAnchoring = false, this.tabsIncluded = [], this.tabsExcluded = [], this.copied = false, this.copyError = false, this.ariaMessage = new AriaLiveRegionController(this, 'generated-answer', false, true), this.ariaErrorMessage = new AriaLiveRegionController(this, 'generated-answer-error', true), this.onGeneratedAnswerStateUpdate = ()=>{
|
|
28973
|
+
], this.withToggle = false, this.collapsible = false, this.maxCollapsedHeight = this.DEFAULT_COLLAPSED_HEIGHT, this.disableCitationAnchoring = false, this.tabsIncluded = [], this.tabsExcluded = [], this.copied = false, this.copyError = false, this.ariaMessage = new AriaLiveRegionController(this, 'generated-answer', false, true), this.ariaErrorMessage = new AriaLiveRegionController(this, 'generated-answer-error', true), this.ariaCopyMessage = new AriaLiveRegionController(this, 'generated-answer-copy', true), this.onGeneratedAnswerStateUpdate = ()=>{
|
|
28853
28974
|
if (this.generatedAnswerState.isVisible !== this.controller.data.isVisible) {
|
|
28854
28975
|
this.controller.data = {
|
|
28855
28976
|
...this.controller.data,
|
|
@@ -28857,6 +28978,7 @@ let AtomicGeneratedAnswer$1 = class AtomicGeneratedAnswer extends lit.LitElement
|
|
|
28857
28978
|
};
|
|
28858
28979
|
this.controller.writeStoredData(this.controller.data);
|
|
28859
28980
|
}
|
|
28981
|
+
if (!this.shouldAnnounceAnswerStatus) return;
|
|
28860
28982
|
const status = this.controller.getGeneratedAnswerStatus();
|
|
28861
28983
|
if (this.controller.isStatusAssertive()) {
|
|
28862
28984
|
this.ariaMessage.message = '';
|