@coveo/quantic 3.44.1 → 3.44.3

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.
Files changed (207) hide show
  1. package/README.md +12 -3
  2. package/force-app/main/default/classes/OrganizationEndpointsTest.cls +71 -15
  3. package/force-app/main/default/classes/RecommendationsControllerTest.cls +1 -1
  4. package/force-app/main/default/lwc/quanticCitation/quanticCitation.js +2 -2
  5. package/force-app/main/default/lwc/quanticHeadlessLoader/quanticHeadlessLoader.js +158 -87
  6. package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.js +148 -125
  7. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  8. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  9. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  10. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
  11. package/force-app/main/default/staticresources/dompurify/purify.min.js +2 -2
  12. package/package.json +43 -41
  13. package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
  14. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
  15. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
  16. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
  17. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  18. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
  19. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  20. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  21. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  22. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  23. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  24. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  25. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
  26. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
  27. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
  28. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
  29. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
  30. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
  31. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  32. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
  33. package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
  34. package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
  35. package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
  36. package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
  37. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
  38. package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
  39. package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
  40. package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
  41. package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
  42. package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
  43. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
  44. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
  45. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
  46. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
  47. package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
  48. package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
  49. package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
  50. package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
  51. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  52. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  53. package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
  54. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
  55. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  56. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  57. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
  58. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  59. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  60. package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
  61. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
  62. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
  63. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
  64. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
  65. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
  66. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  67. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
  68. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
  69. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
  70. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
  71. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
  72. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
  73. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
  74. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
  75. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
  76. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
  77. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
  78. package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
  79. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  80. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  81. package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
  82. package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
  83. package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
  84. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
  85. package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
  86. package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
  87. package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
  88. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
  89. package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
  90. package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
  91. package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
  92. package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
  93. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
  94. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
  95. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  96. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
  97. package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
  98. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  99. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  100. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  101. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  102. package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
  103. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
  104. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
  105. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
  106. package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
  107. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
  108. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
  109. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
  110. package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
  111. package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
  112. package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
  113. package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
  114. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
  115. package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
  116. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  117. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  118. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  119. package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
  120. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
  121. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
  122. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
  123. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  124. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  125. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  126. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
  127. package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
  128. package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
  129. package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
  130. package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
  131. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  132. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  133. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  134. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
  135. package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
  136. package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
  137. package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
  138. package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
  139. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  140. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
  141. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
  142. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  143. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  144. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
  145. package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
  146. package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
  147. package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
  148. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
  149. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
  150. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
  151. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
  152. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
  153. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  154. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  155. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
  156. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  157. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  158. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  159. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  160. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  161. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  162. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
  163. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  164. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  165. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  166. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
  167. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
  168. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
  169. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
  170. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
  171. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
  172. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
  173. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
  174. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  175. package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
  176. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
  177. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
  178. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
  179. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
  180. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  181. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
  182. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  183. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
  184. package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
  185. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
  186. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
  187. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
  188. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
  189. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
  190. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  191. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  192. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  193. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  194. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  195. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  196. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  197. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  198. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  199. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  200. package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
  201. package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
  202. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  203. package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
  204. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
  205. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
  206. package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
  207. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,5 +1,4 @@
1
1
  import more from '@salesforce/label/c.quantic_More';
2
- import {getAbsoluteWidth} from 'c/quanticUtils';
3
2
  import {LightningElement, api} from 'lwc';
4
3
 
5
4
  /**
@@ -39,11 +38,25 @@ export default class QuanticTabBar extends LightningElement {
39
38
  maxMoreButtonWidth = 0;
40
39
  /** @type {boolean} */
41
40
  expandedMoreButton = true;
41
+ /** @type {Array<Element>} */
42
+ _overflowingTabs = [];
43
+ /** @type {Array<Element>} */
44
+ _displayedTabs = [];
45
+ /** @type {boolean} */
46
+ _updateDisplayDirty = false;
47
+ /** @type {boolean} */
48
+ _updateScheduled = false;
49
+
50
+ /**
51
+ * Rects captured for the current layout pass.
52
+ * @type {{container: DOMRect, moreButton: DOMRect, tabs: Map<Element, DOMRect>}|null}
53
+ */
54
+ _layoutRects = null;
42
55
 
43
56
  connectedCallback() {
44
57
  window.addEventListener('click', this.closeDropdown);
45
58
  window.addEventListener('resize', this.updateTabsDisplay);
46
- this.addEventListener('quantic__tabrendered', this.updateTabsDisplay);
59
+ this.addEventListener('quantic__tabrendered', this.handleTabRendered);
47
60
  }
48
61
 
49
62
  renderedCallback() {
@@ -53,25 +66,118 @@ export default class QuanticTabBar extends LightningElement {
53
66
  }
54
67
  }
55
68
 
69
+ handleTabRendered = () => {
70
+ this._updateDisplayDirty = true;
71
+
72
+ if (this._updateScheduled) {
73
+ return;
74
+ }
75
+ this._updateScheduled = true;
76
+ // eslint-disable-next-line @lwc/lwc/no-async-operation
77
+ requestAnimationFrame(() => {
78
+ this._updateScheduled = false;
79
+ if (this._updateDisplayDirty) {
80
+ this._updateDisplayDirty = false;
81
+ this.updateTabsDisplay();
82
+ }
83
+ });
84
+ };
85
+
56
86
  /**
57
87
  * Updates the display of the tabs.
88
+ * Computes a single layout snapshot up front to avoid redundant `getBoundingClientRect` reads.
58
89
  * @returns {void}
59
90
  */
60
91
  updateTabsDisplay = () => {
61
- this.updateMoreButtonVisibility(this.isOverflow);
62
- this.updateTabVisibility(this.overflowingTabs, false);
63
- this.updateTabVisibility(this.displayedTabs, true);
64
- this.updateDropdownOptions();
65
- this.updateMoreButtonPosition();
92
+ const tabElements = this.getTabsFromSlot();
93
+ this._layoutRects = {
94
+ container: this.container.getBoundingClientRect(),
95
+ moreButton: this.moreButton?.getBoundingClientRect(),
96
+ tabs: new Map(
97
+ tabElements.map((tab) => [tab, tab.getBoundingClientRect()])
98
+ ),
99
+ };
100
+
101
+ const containerWidth = this._layoutRects.container.width;
102
+ const slotContentWidth = this.computeSlotContentWidth(tabElements);
103
+ const tabsCount = tabElements.length;
104
+ const isOverflow = slotContentWidth > containerWidth;
105
+ // Must run before categorizeTabsVisibility: while display:none, moreButtonWidth reads as 0.
106
+ this.updateMoreButtonVisibility(isOverflow);
107
+ this._layoutRects.moreButton = this.moreButton?.getBoundingClientRect();
108
+ this.updateMoreButtonState();
109
+
110
+ const {overflowingTabs, displayedTabs} = this.categorizeTabsVisibility(
111
+ tabElements,
112
+ isOverflow
113
+ );
114
+ this._overflowingTabs = overflowingTabs;
115
+ this._displayedTabs = displayedTabs;
116
+
117
+ this.updateTabVisibility(overflowingTabs, false, tabsCount);
118
+ this.updateTabVisibility(displayedTabs, true, tabsCount);
119
+ this.updateDropdownOptions(overflowingTabs);
120
+ this.updateMoreButtonPosition(displayedTabs);
66
121
  this.isDropdownOpen = false;
122
+ this._layoutRects = null;
67
123
  };
68
124
 
125
+ /**
126
+ * Computes, in a single pass, all the layout values needed to update the tabs display.
127
+ * @param {Array<Element>} tabElements
128
+ * @param {boolean} isOverflow Whether the tabs overflow the container.
129
+ * @returns {{overflowingTabs: Array<Element>, displayedTabs: Array<Element>}}
130
+ */
131
+ categorizeTabsVisibility(tabElements, isOverflow) {
132
+ // @ts-ignore
133
+ const selectedTab = tabElements.find((el) => el.isActive);
134
+ const selectedTabWidth = Math.ceil(
135
+ this._layoutRects.tabs.get(selectedTab)?.width ?? 0
136
+ );
137
+ const moreButton = this.moreButton?.querySelector('button');
138
+ const moreButtonWidth = Math.max(
139
+ this._layoutRects.moreButton?.width ?? 0,
140
+ moreButton?.offsetWidth ?? 0,
141
+ moreButton?.scrollWidth ?? 0
142
+ );
143
+ const containerWidth = this._layoutRects.container.width;
144
+ const displayedTabs = [];
145
+ const overflowingTabs = [];
146
+ let displayedTabsWidth = 0;
147
+ let selectedTabDisplayed = false;
148
+
149
+ tabElements.forEach((tab) => {
150
+ const tabWidth = Math.ceil(this._layoutRects.tabs.get(tab)?.width ?? 0);
151
+ // @ts-ignore
152
+ if (tab.isActive) {
153
+ displayedTabs.push(tab);
154
+ displayedTabsWidth += tabWidth;
155
+ selectedTabDisplayed = true;
156
+ return;
157
+ }
158
+
159
+ const reservedWidth = isOverflow
160
+ ? moreButtonWidth + (selectedTabDisplayed ? 0 : selectedTabWidth)
161
+ : 0;
162
+ if (displayedTabsWidth + tabWidth + reservedWidth <= containerWidth) {
163
+ displayedTabs.push(tab);
164
+ displayedTabsWidth += tabWidth;
165
+ } else {
166
+ overflowingTabs.push(tab);
167
+ }
168
+ });
169
+
170
+ return {overflowingTabs, displayedTabs};
171
+ }
172
+
69
173
  /**
70
174
  * Updates the dropdown options.
175
+ * @param {Array<Element>} [overflowingTabs]
71
176
  * @returns {void}
72
177
  */
73
- updateDropdownOptions() {
74
- this.tabsInDropdown = this.overflowingTabs.map((el, index) => ({
178
+ updateDropdownOptions(overflowingTabs) {
179
+ // @ts-ignore
180
+ this.tabsInDropdown = overflowingTabs.map((el, index) => ({
75
181
  id: index,
76
182
  // @ts-ignore
77
183
  label: el.label,
@@ -82,14 +188,19 @@ export default class QuanticTabBar extends LightningElement {
82
188
 
83
189
  /**
84
190
  * Updates the position of the "More" button element.
85
- * We need to update the position of the "More" button so that it is always to the right of the last tab displayed, as hidden tabs are just hidden visually but there is always space allocated for them.
191
+ * The displayed tabs are assigned contiguous flex orders below, so their widths determine the
192
+ * position of More even before the browser applies the new order.
193
+ * @param {Array<Element>} [displayedTabs] Optionally pass a pre-computed list of displayed tabs
194
+ * to avoid recomputing it from the live DOM.
86
195
  * @returns {void}
87
196
  */
88
- updateMoreButtonPosition() {
89
- this.moreButton?.style.setProperty(
90
- 'left',
91
- `${this.displayedTabs.length ? this.lastVisibleTabRightPosition : 0}px`
197
+ updateMoreButtonPosition(displayedTabs) {
198
+ const position = displayedTabs.reduce(
199
+ (total, tab) =>
200
+ total + Math.ceil(this._layoutRects.tabs.get(tab)?.width ?? 0),
201
+ 0
92
202
  );
203
+ this.moreButton?.style.setProperty('left', `${position}px`);
93
204
  }
94
205
 
95
206
  /**
@@ -98,12 +209,18 @@ export default class QuanticTabBar extends LightningElement {
98
209
  */
99
210
  updateMoreButtonState() {
100
211
  if (this.hasRendered) {
101
- if (this.maxMoreButtonWidth < this.moreButtonWidth) {
102
- this.maxMoreButtonWidth = this.moreButtonWidth;
212
+ const moreButtonWidth = this._layoutRects.moreButton?.width ?? 0;
213
+ const selectedTabWidth = Math.ceil(
214
+ this._layoutRects.tabs.get(this.selectedTab)?.width ?? 0
215
+ );
216
+
217
+ if (this.maxMoreButtonWidth < moreButtonWidth) {
218
+ this.maxMoreButtonWidth = moreButtonWidth;
103
219
  }
104
220
 
105
221
  this.expandedMoreButton =
106
- this.containerWidth > this.maxMoreButtonWidth + this.selectedTabWidth;
222
+ this._layoutRects.container.width >
223
+ this.maxMoreButtonWidth + selectedTabWidth;
107
224
  }
108
225
  }
109
226
 
@@ -120,28 +237,24 @@ export default class QuanticTabBar extends LightningElement {
120
237
  * Updates the tabs visibility.
121
238
  * @param {Array<Element>} tabElements
122
239
  * @param {boolean} isVisible
240
+ * @param {number} [totalTabsCount] Optionally pass the total tab count to avoid recomputing it from the live DOM.
123
241
  */
124
- updateTabVisibility(tabElements, isVisible) {
242
+ updateTabVisibility(
243
+ tabElements,
244
+ isVisible,
245
+ totalTabsCount = this.getTabsFromSlot().length
246
+ ) {
125
247
  tabElements.forEach((tab, index) => {
126
- const tabsCount = this.getTabsFromSlot().length;
127
248
  // @ts-ignore
128
249
  tab.style.setProperty(
129
250
  'order',
130
- isVisible ? index + 1 : tabsCount - tabElements.length + index + 1
251
+ isVisible ? index + 1 : totalTabsCount - tabElements.length + index + 1
131
252
  );
132
253
  // @ts-ignore
133
254
  tab.style.setProperty('visibility', isVisible ? 'visible' : 'hidden');
134
255
  });
135
256
  }
136
257
 
137
- /**
138
- * Indicates whether the tabs are causing an overflow.
139
- * @returns {boolean}
140
- */
141
- get isOverflow() {
142
- return this.slotContentWidth > this.containerWidth;
143
- }
144
-
145
258
  /**
146
259
  * Returns the tab bar container element.
147
260
  * @returns {Element}
@@ -151,80 +264,18 @@ export default class QuanticTabBar extends LightningElement {
151
264
  }
152
265
 
153
266
  /**
154
- * Returns the container's width.
155
- * @returns {number}
156
- */
157
- get containerWidth() {
158
- return getAbsoluteWidth(this.container);
159
- }
160
-
161
- /**
162
- * returns the width of the content of the slot.
267
+ * Computes the total rendered width of the given tab elements.
268
+ * @param {Array<Element>} tabElements
163
269
  * @returns {number}
164
270
  */
165
- get slotContentWidth() {
166
- return this.getTabsFromSlot().reduce(
167
- (total, el) => total + getAbsoluteWidth(el),
271
+ computeSlotContentWidth(tabElements) {
272
+ return tabElements.reduce(
273
+ (total, el) =>
274
+ total + Math.ceil(this._layoutRects.tabs.get(el)?.width ?? 0),
168
275
  0
169
276
  );
170
277
  }
171
278
 
172
- /**
173
- * returns the width of the more button.
174
- * @returns {number}
175
- */
176
- get moreButtonWidth() {
177
- return this.moreButton ? getAbsoluteWidth(this.moreButton) : 0;
178
- }
179
-
180
- /**
181
- * returns the width of the currently selected tab.
182
- * @returns {number}
183
- */
184
- get selectedTabWidth() {
185
- return getAbsoluteWidth(this.selectedTab);
186
- }
187
-
188
- /**
189
- * Returns the overflowing tabs.
190
- * We compare the right position of each tab to the right position of the tab container to find the tabs that overflow.
191
- * We include in our calculations the minimum width needed to display the elements that should always be displayed, namely the More button and the currently selected tab.
192
- * @returns {Array<Element>}
193
- */
194
- get overflowingTabs() {
195
- const containerRelativeRightPosition =
196
- this.container.getBoundingClientRect().right;
197
- const selectedTabRelativeRightPosition =
198
- this.selectedTab?.getBoundingClientRect().right;
199
-
200
- return this.getTabsFromSlot().filter((element) => {
201
- const tabPositionedBeforeSelectedTab =
202
- selectedTabRelativeRightPosition >
203
- element.getBoundingClientRect().right;
204
- const minimumWidthNeeded = tabPositionedBeforeSelectedTab
205
- ? this.moreButtonWidth + this.selectedTabWidth
206
- : this.moreButtonWidth;
207
- const rightPositionLimit = !this.isOverflow
208
- ? containerRelativeRightPosition
209
- : containerRelativeRightPosition - minimumWidthNeeded;
210
- return (
211
- element.getBoundingClientRect().right > rightPositionLimit &&
212
- // @ts-ignore
213
- !element.isActive
214
- );
215
- });
216
- }
217
-
218
- /**
219
- * Returns the displayed tabs.
220
- * @returns {Array<Element>}
221
- */
222
- get displayedTabs() {
223
- return this.getTabsFromSlot().filter(
224
- (el) => !this.overflowingTabs.includes(el)
225
- );
226
- }
227
-
228
279
  /**
229
280
  * Returns the CSS classes of the dropdown list.
230
281
  * @returns {string}
@@ -266,18 +317,9 @@ export default class QuanticTabBar extends LightningElement {
266
317
  * @returns {string}
267
318
  */
268
319
  get moreButtonLabel() {
269
- this.updateMoreButtonState();
270
320
  return this.expandedMoreButton ? this.labels.more : '';
271
321
  }
272
322
 
273
- /**
274
- * Returns the last visible tab element.
275
- * @returns {Element}
276
- */
277
- get lastVisibleTab() {
278
- return this.displayedTabs[this.displayedTabs.length - 1];
279
- }
280
-
281
323
  /**
282
324
  * Returns the currently selected tab element.
283
325
  * @returns {Element}
@@ -287,25 +329,6 @@ export default class QuanticTabBar extends LightningElement {
287
329
  return this.getTabsFromSlot().find((el) => el.isActive);
288
330
  }
289
331
 
290
- /**
291
- * Returns the tab bar list container element.
292
- * @returns {Element}
293
- */
294
- get tabBarListContainer() {
295
- return this.template.querySelector('.tab-bar_list-container');
296
- }
297
-
298
- /**
299
- * Returns the right position of the last visible tab.
300
- * @returns {number}
301
- */
302
- get lastVisibleTabRightPosition() {
303
- return (
304
- this.lastVisibleTab.getBoundingClientRect().right -
305
- this.tabBarListContainer.getBoundingClientRect().left
306
- );
307
- }
308
-
309
332
  /**
310
333
  * Returns the CSS classes of the tab bar container.
311
334
  * @returns {string}
@@ -343,7 +366,7 @@ export default class QuanticTabBar extends LightningElement {
343
366
  event.stopPropagation();
344
367
  const targetValue = event.currentTarget.getAttribute('data-value');
345
368
  const targetLabel = event.currentTarget.getAttribute('data-label');
346
- const clickedtab = this.overflowingTabs.find(
369
+ const clickedtab = this._overflowingTabs.find(
347
370
  // @ts-ignore
348
371
  (tab) => tab.expression === targetValue && tab.label === targetLabel
349
372
  );