@coveo/atomic-react 3.11.3 → 3.11.4

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.
@@ -8747,7 +8747,7 @@ function getWindow$1() {
8747
8747
  }
8748
8748
  function getAtomicEnvironment(headlessVersion) {
8749
8749
  return {
8750
- version: "3.52.0",
8750
+ version: "3.52.1",
8751
8751
  headlessVersion,
8752
8752
  };
8753
8753
  }
@@ -20703,31 +20703,14 @@ const renderGeneratingAnswerLabel = ({ props }) => {
20703
20703
  };
20704
20704
 
20705
20705
  /**
20706
- * Renders the answer content of a given generated answer including question, answer text, and citations.
20706
+ * Renders the answer content of a given generated answer including answer text and citations.
20707
20707
  */
20708
20708
  const renderAnswerContent = ({ props }) => {
20709
20709
  const { i18n, generatedAnswer, collapsible, renderFeedbackAndCopyButtonsSlot, renderCitationsSlot, onRetry, onClickShowButton, } = props;
20710
- const { answer, question, isStreaming, citations, answerContentFormat, expanded, error, } = generatedAnswer;
20711
- const isExpanded = collapsible ? expanded : true;
20712
- const trimmedQuestion = question.trim();
20710
+ const { answer, isStreaming, citations, answerContentFormat, expanded, error } = generatedAnswer;
20713
20711
  const hasRetryableError = error?.isRetryable === true;
20714
20712
  return lit.html `
20715
20713
  <div>
20716
- <div class="mt-6 flex gap-3">
20717
- <p
20718
- class="question-text min-w-0 flex-1 text-base font-semibold leading-6"
20719
- >
20720
- ${trimmedQuestion}
20721
- </p>
20722
- ${when_js.when(!hasRetryableError && isExpanded, () => lit.html `
20723
- <div
20724
- part="feedback-and-copy-buttons"
20725
- class="flex h-9 shrink-0 items-center justify-end gap-2"
20726
- >
20727
- ${renderFeedbackAndCopyButtonsSlot()}
20728
- </div>
20729
- `)}
20730
- </div>
20731
20714
  ${hasRetryableError
20732
20715
  ? renderRetryPrompt({
20733
20716
  props: {
@@ -20753,6 +20736,11 @@ const renderAnswerContent = ({ props }) => {
20753
20736
  })(renderCitationsSlot())}
20754
20737
  `)
20755
20738
  : lit.nothing}
20739
+ ${when_js.when(!hasRetryableError && (collapsible ? expanded : true), () => lit.html `
20740
+ <div class="mt-4" part="feedback-and-copy-buttons">
20741
+ ${renderFeedbackAndCopyButtonsSlot()}
20742
+ </div>
20743
+ `)}
20756
20744
  ${!hasRetryableError
20757
20745
  ? lit.html `
20758
20746
  <div part="generated-answer-footer" class="mt-6">
@@ -21075,7 +21063,7 @@ const styles$8 = lit.css`.feedback-buttons [part=feedback-button]{height:2.2rem;
21075
21063
 
21076
21064
  const styles$7 = lit.css`[part=generated-text]{font-size:1.125rem;line-height:1.75rem}[part=generated-text].cursor:after{animation:cursor-blink 1.5s steps(2) infinite;background-color:var(--atomic-neutral-dark);content:"";display:inline-block;height:1em;margin-left:.1em;vertical-align:text-bottom;width:8px}`;
21077
21065
 
21078
- const baseStyle = lit.css`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@keyframes cursor-blink{0%{opacity:0}}[part=container]{contain:layout;container-type:inline-size}.footer{display:flex}.footer .source-citations{margin-right:calc(var(--spacing, .25rem)*2)}@container (max-width: 37.5rem){.footer{flex-direction:column;gap:calc(var(--spacing, .25rem)*4)}.footer .source-citations{margin-right:calc(var(--spacing, .25rem)*0)}[part=generated-answer-footer]{flex-direction:column;gap:calc(var(--spacing, .25rem)*1)}}@media not all and (width >= 768px){.footer{flex-direction:column;gap:calc(var(--spacing, .25rem)*4)}.footer .source-citations{margin-right:calc(var(--spacing, .25rem)*0)}[part=generated-answer-footer]{flex-direction:column;gap:calc(var(--spacing, .25rem)*1)}}@container (max-width: 25rem){.footer{margin-top:calc(var(--spacing, .25rem)*4)}.footer .feedback-buttons{position:relative;right:calc(var(--spacing, .25rem)*0);top:calc(var(--spacing, .25rem)*0)}}.is-collapsible{justify-content:space-between}.is-collapsible [part=answer-show-button]{display:flex}[part=header-icon]{color:var(--atomic-primary)}[part=feedback-and-copy-buttons]{min-width:var(--atomic-generated-answer-actions-reserved-width,8rem)}[part=header-icon] svg,[part=header-icon] svg *{fill:currentColor;stroke:currentColor}.generating-label-visible [part=is-generating]{display:flex}[part=generated-container].answer-collapsed{max-height:var(--atomic-crga-collapsed-height,16rem);overflow:hidden;position:relative}[part=generated-container].answer-collapsed:before{background:linear-gradient(transparent calc(var(--atomic-crga-collapsed-height, 16rem)*.7),var(--atomic-background));content:"";height:100%;left:calc(var(--spacing, .25rem)*0);position:absolute;top:calc(var(--spacing, .25rem)*0);width:100%}[part=generated-container].answer-collapsed .feedback-buttons{display:none}[part=generated-content-container] .agent-scrollable{height:var(--atomic-generated-answer-content-fixed-height,50vh);overflow-y:auto}.query-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}`;
21066
+ const baseStyle = lit.css`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@keyframes cursor-blink{0%{opacity:0}}@keyframes generation-steps-rolodex{0%{opacity:.75;transform:translateY(105%) rotateX(-82deg)}to{opacity:1;transform:translateY(0) rotateX(0deg)}}[part=container]{contain:layout;container-type:inline-size}.footer{display:flex}.footer .source-citations{margin-right:calc(var(--spacing, .25rem)*2)}@container (max-width: 37.5rem){.footer{flex-direction:column;gap:calc(var(--spacing, .25rem)*4)}.footer .source-citations{margin-right:calc(var(--spacing, .25rem)*0)}[part=generated-answer-footer]{flex-direction:column;gap:calc(var(--spacing, .25rem)*1)}}@media not all and (width >= 768px){.footer{flex-direction:column;gap:calc(var(--spacing, .25rem)*4)}.footer .source-citations{margin-right:calc(var(--spacing, .25rem)*0)}[part=generated-answer-footer]{flex-direction:column;gap:calc(var(--spacing, .25rem)*1)}}@container (max-width: 25rem){.footer{margin-top:calc(var(--spacing, .25rem)*4)}.footer .feedback-buttons{position:relative;right:calc(var(--spacing, .25rem)*0);top:calc(var(--spacing, .25rem)*0)}}.is-collapsible{justify-content:space-between}.is-collapsible [part=answer-show-button]{display:flex}[part=header-icon]{color:var(--atomic-primary)}[part=feedback-and-copy-buttons]{min-width:var(--atomic-generated-answer-actions-reserved-width,8rem)}[part=header-icon] svg,[part=header-icon] svg *{fill:currentColor;stroke:currentColor}.generating-label-visible [part=is-generating]{display:flex}[part=agent-generation-status] .generation-steps-container{display:inline-flex;overflow:hidden;perspective:700px}[part=agent-generation-status] .generation-steps-value{animation:generation-steps-rolodex 1s cubic-bezier(.22,.9,.26,1) both;backface-visibility:hidden;display:inline-block;transform-origin:50% 100%;white-space:nowrap;will-change:transform}[part=generated-container].answer-collapsed{max-height:var(--atomic-crga-collapsed-height,16rem);overflow:hidden;position:relative}[part=generated-container].answer-collapsed:before{background:linear-gradient(transparent calc(var(--atomic-crga-collapsed-height, 16rem)*.7),var(--atomic-background));content:"";height:100%;left:calc(var(--spacing, .25rem)*0);position:absolute;top:calc(var(--spacing, .25rem)*0);width:100%}[part=generated-container].answer-collapsed .feedback-buttons{display:none}[part=generated-content-container] .agent-scrollable{height:var(--atomic-generated-answer-content-fixed-height,50vh);overflow-y:auto}.query-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}`;
21079
21067
  var generatedAnswer = [
21080
21068
  baseStyle,
21081
21069
  styles$7,
@@ -27948,7 +27936,11 @@ let AtomicGeneratedAnswer$1 = AtomicGeneratedAnswer_1 = class AtomicGeneratedAns
27948
27936
  ?.getBoundingClientRect().height;
27949
27937
  if (answerHeight) {
27950
27938
  const rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
27951
- this.fullAnswerHeight = answerHeight / rootFontSize;
27939
+ const nextFullAnswerHeight = answerHeight / rootFontSize;
27940
+ if (this.fullAnswerHeight !== nextFullAnswerHeight) {
27941
+ this.fullAnswerHeight = nextFullAnswerHeight;
27942
+ this.requestUpdate();
27943
+ }
27952
27944
  this.updateAnswerHeight();
27953
27945
  }
27954
27946
  }
@@ -28025,13 +28017,13 @@ let AtomicGeneratedAnswer$1 = AtomicGeneratedAnswer_1 = class AtomicGeneratedAns
28025
28017
  });
28026
28018
  }
28027
28019
  renderAnswerContent() {
28028
- const generatedAnswer = {
28029
- ...this.generatedAnswerState,
28030
- question: this.bindings.engine.state.query?.q ?? '',
28031
- };
28032
28020
  if (this.areFollowUpsEnabled) {
28021
+ const generatedAnswerWithQuestion = {
28022
+ ...this.generatedAnswerState,
28023
+ question: this.bindings.engine.state.query?.q ?? '',
28024
+ };
28033
28025
  const allGeneratedAnswers = [
28034
- generatedAnswer,
28026
+ generatedAnswerWithQuestion,
28035
28027
  ...(this.generatedAnswerWithFollowUps?.state.followUpAnswers
28036
28028
  .followUpAnswers ?? []),
28037
28029
  ];
@@ -28047,10 +28039,10 @@ let AtomicGeneratedAnswer$1 = AtomicGeneratedAnswer_1 = class AtomicGeneratedAns
28047
28039
  return renderAnswerContent({
28048
28040
  props: {
28049
28041
  i18n: this.bindings.i18n,
28050
- generatedAnswer: generatedAnswer,
28042
+ generatedAnswer: this.generatedAnswerState,
28051
28043
  collapsible: this.isCollapsibleEnabled,
28052
28044
  renderFeedbackAndCopyButtonsSlot: () => this.renderFeedbackAndCopyButtonsWrapper(),
28053
- renderCitationsSlot: () => lit.html `${this.renderCitationsList(generatedAnswer.citations)}`,
28045
+ renderCitationsSlot: () => lit.html `${this.renderCitationsList(this.generatedAnswerState.citations)}`,
28054
28046
  onRetry: () => this.generatedAnswer?.retry(),
28055
28047
  onClickShowButton: () => this.clickOnShowButton(),
28056
28048
  },
@@ -28072,7 +28064,9 @@ let AtomicGeneratedAnswer$1 = AtomicGeneratedAnswer_1 = class AtomicGeneratedAns
28072
28064
  true);
28073
28065
  }
28074
28066
  get isCollapsibleEnabled() {
28075
- return this.collapsible && !this.areFollowUpsEnabled;
28067
+ return (this.collapsible &&
28068
+ !this.areFollowUpsEnabled &&
28069
+ (this.fullAnswerHeight ?? 0) > this.validateMaxCollapsedHeight());
28076
28070
  }
28077
28071
  resetCollapsibleStyles() {
28078
28072
  const container = this.getAnswerContainer();