@ubnt/store.core 10.20.0-alpha.27 → 10.20.0-alpha.29

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 (160) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/assets/ai-dome.jpg +0 -0
  3. package/lib/assets/ai-dome2.jpg +0 -0
  4. package/lib/assets/ai-dslr.jpg +0 -0
  5. package/lib/assets/ai-dslr2.jpg +0 -0
  6. package/lib/assets/ai-turret.jpg +0 -0
  7. package/lib/assets/ai-turret2.jpg +0 -0
  8. package/lib/assets/door-hub-mini.jpg +0 -0
  9. package/lib/assets/door-hub-mini2.jpg +0 -0
  10. package/lib/assets/door-hub.jpg +0 -0
  11. package/lib/assets/door-hub2.jpg +0 -0
  12. package/lib/assets/floodlight.svg +2 -9
  13. package/lib/assets/floodlight2.svg +9 -2
  14. package/lib/assets/g2-reader-pro.jpg +0 -0
  15. package/lib/assets/g2-reader-pro2.jpg +0 -0
  16. package/lib/assets/g3-reader-pro.jpg +0 -0
  17. package/lib/assets/g3-reader-pro2.jpg +0 -0
  18. package/lib/assets/g3-reader.jpg +0 -0
  19. package/lib/assets/g3-reader2.jpg +0 -0
  20. package/lib/assets/g3-starter-kit-pro.jpg +0 -0
  21. package/lib/assets/g3-starter-kit-pro2.jpg +0 -0
  22. package/lib/assets/g3-starter-kit.jpg +0 -0
  23. package/lib/assets/g3-starter-kit2.jpg +0 -0
  24. package/lib/assets/g5-dome.jpg +0 -0
  25. package/lib/assets/g5-dome2.jpg +0 -0
  26. package/lib/assets/globe.svg +2 -9
  27. package/lib/assets/globe2.svg +9 -2
  28. package/lib/assets/pause.svg +3 -3
  29. package/lib/assets/pause2.svg +3 -3
  30. package/lib/assets/power.svg +1 -4
  31. package/lib/assets/power2.svg +4 -1
  32. package/lib/assets/rack.svg +1 -4
  33. package/lib/assets/rack2.svg +4 -1
  34. package/lib/components/Header/Header.js +1 -1
  35. package/lib/components/Header/Header.mjs +1 -1
  36. package/lib/components/Header/ProHeader/ProHeader.js +1 -1
  37. package/lib/components/Header/ProHeader/ProHeader.mjs +1 -1
  38. package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.js +1 -1
  39. package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.mjs +1 -1
  40. package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.js +1 -1
  41. package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.mjs +1 -1
  42. package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.js +1 -1
  43. package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.mjs +2 -2
  44. package/lib/components/ModelCompareV4/CompareTable/CompareTable.styles.js.map +1 -1
  45. package/lib/components/ModelCompareV4/CompareTable/CompareTable.styles.mjs.map +1 -1
  46. package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/StickyGrid/StickyGridHeader.js +0 -3
  47. package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/StickyGrid/StickyGridHeader.js.map +1 -1
  48. package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/StickyGrid/StickyGridHeader.mjs +0 -3
  49. package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/StickyGrid/StickyGridHeader.mjs.map +1 -1
  50. package/lib/components/ModelCompareV4/ProductList/ProductList.js +0 -6
  51. package/lib/components/ModelCompareV4/ProductList/ProductList.js.map +1 -1
  52. package/lib/components/ModelCompareV4/ProductList/ProductList.mjs +0 -6
  53. package/lib/components/ModelCompareV4/ProductList/ProductList.mjs.map +1 -1
  54. package/lib/components/VideoPlayerNew/VideoPlayer.js +1 -1
  55. package/lib/components/VideoPlayerNew/VideoPlayer.mjs +1 -1
  56. package/lib/components/VideoPlayerNew/assets/pause.svg.js +1 -1
  57. package/lib/components/VideoPlayerNew/assets/pause.svg.mjs +2 -2
  58. package/lib/constants/icons/header/globe.svg.js +1 -1
  59. package/lib/constants/icons/header/globe.svg.mjs +2 -2
  60. package/lib/constants/icons/header/index.js +1 -1
  61. package/lib/constants/icons/header/index.mjs +1 -1
  62. package/lib/constants/icons/menu/floodlight.svg.js +5 -5
  63. package/lib/constants/icons/menu/floodlight.svg.mjs +2 -2
  64. package/lib/constants/icons/menu/index.js +9 -9
  65. package/lib/constants/icons/menu/index.mjs +3 -3
  66. package/lib/constants/icons/menu/power.svg.js +5 -5
  67. package/lib/constants/icons/menu/power.svg.mjs +2 -2
  68. package/lib/constants/icons/menu/rack.svg.js +5 -5
  69. package/lib/constants/icons/menu/rack.svg.mjs +2 -2
  70. package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.js +1 -1
  71. package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.mjs +2 -2
  72. package/lib/constants/modelCompareData/assets/DomeTurret/ai-dome.jpg.js +1 -1
  73. package/lib/constants/modelCompareData/assets/DomeTurret/ai-dome.jpg.mjs +2 -2
  74. package/lib/constants/modelCompareData/assets/DomeTurret/ai-turret.jpg.js +1 -1
  75. package/lib/constants/modelCompareData/assets/DomeTurret/ai-turret.jpg.mjs +2 -2
  76. package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.js +1 -1
  77. package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.mjs +2 -2
  78. package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.js +1 -1
  79. package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.mjs +2 -2
  80. package/lib/constants/modelCompareData/assets/DoorAccess/door-hub.jpg.js +1 -1
  81. package/lib/constants/modelCompareData/assets/DoorAccess/door-hub.jpg.mjs +2 -2
  82. package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader-pro.jpg.js +1 -1
  83. package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader-pro.jpg.mjs +2 -2
  84. package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader-pro.jpg.js +1 -1
  85. package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader-pro.jpg.mjs +2 -2
  86. package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader.jpg.js +1 -1
  87. package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader.jpg.mjs +2 -2
  88. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit-pro.jpg.js +1 -1
  89. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit-pro.jpg.mjs +2 -2
  90. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.js +1 -1
  91. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.mjs +2 -2
  92. package/lib/constants/modelCompareData/assets/floodlight.svg.js +1 -1
  93. package/lib/constants/modelCompareData/assets/floodlight.svg.mjs +2 -2
  94. package/lib/constants/modelCompareData/assets/globe.svg.js +1 -1
  95. package/lib/constants/modelCompareData/assets/globe.svg.mjs +2 -2
  96. package/lib/constants/modelCompareData/assets/power.svg.js +1 -1
  97. package/lib/constants/modelCompareData/assets/power.svg.mjs +2 -2
  98. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.js +1 -1
  99. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.mjs +2 -2
  100. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-dome.jpg.js +1 -1
  101. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-dome.jpg.mjs +2 -2
  102. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-turret.jpg.js +1 -1
  103. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-turret.jpg.mjs +2 -2
  104. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.js +1 -1
  105. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.mjs +2 -2
  106. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.js +1 -1
  107. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.mjs +2 -2
  108. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub.jpg.js +1 -1
  109. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub.jpg.mjs +2 -2
  110. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader-pro.jpg.js +1 -1
  111. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader-pro.jpg.mjs +2 -2
  112. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader-pro.jpg.js +1 -1
  113. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader-pro.jpg.mjs +2 -2
  114. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader.jpg.js +1 -1
  115. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader.jpg.mjs +2 -2
  116. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit-pro.jpg.js +1 -1
  117. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit-pro.jpg.mjs +2 -2
  118. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.js +1 -1
  119. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.mjs +2 -2
  120. package/lib/constants/modelCompareData/assets/rack.svg.js +1 -1
  121. package/lib/constants/modelCompareData/assets/rack.svg.mjs +2 -2
  122. package/lib/constants/modelCompareData/data/products/aiDome.js +2 -2
  123. package/lib/constants/modelCompareData/data/products/aiDome.mjs +2 -2
  124. package/lib/constants/modelCompareData/data/products/aiDslr.js +2 -2
  125. package/lib/constants/modelCompareData/data/products/aiDslr.mjs +2 -2
  126. package/lib/constants/modelCompareData/data/products/aiTurret.js +2 -2
  127. package/lib/constants/modelCompareData/data/products/aiTurret.mjs +2 -2
  128. package/lib/constants/modelCompareData/data/products/doorHub.js +2 -2
  129. package/lib/constants/modelCompareData/data/products/doorHub.mjs +2 -2
  130. package/lib/constants/modelCompareData/data/products/doorHubMini.js +2 -2
  131. package/lib/constants/modelCompareData/data/products/doorHubMini.mjs +2 -2
  132. package/lib/constants/modelCompareData/data/products/g2ReaderPro.js +2 -2
  133. package/lib/constants/modelCompareData/data/products/g2ReaderPro.mjs +2 -2
  134. package/lib/constants/modelCompareData/data/products/g3Reader.js +2 -2
  135. package/lib/constants/modelCompareData/data/products/g3Reader.mjs +2 -2
  136. package/lib/constants/modelCompareData/data/products/g3ReaderPro.js +2 -2
  137. package/lib/constants/modelCompareData/data/products/g3ReaderPro.mjs +2 -2
  138. package/lib/constants/modelCompareData/data/products/g3StarterKit.js +2 -2
  139. package/lib/constants/modelCompareData/data/products/g3StarterKit.mjs +2 -2
  140. package/lib/constants/modelCompareData/data/products/g3StarterKitPro.js +2 -2
  141. package/lib/constants/modelCompareData/data/products/g3StarterKitPro.mjs +2 -2
  142. package/lib/constants/modelCompareData/data/products/g5Dome.js +2 -2
  143. package/lib/constants/modelCompareData/data/products/g5Dome.mjs +2 -2
  144. package/lib/constants/modelCompareData/data/properties/accessPowerMethod.js +1 -1
  145. package/lib/constants/modelCompareData/data/properties/accessPowerMethod.mjs +1 -1
  146. package/lib/constants/modelCompareData/data/properties/availability.js +1 -1
  147. package/lib/constants/modelCompareData/data/properties/availability.mjs +1 -1
  148. package/lib/constants/modelCompareData/data/properties/builtInFloodlight.js +1 -1
  149. package/lib/constants/modelCompareData/data/properties/builtInFloodlight.mjs +1 -1
  150. package/lib/constants/modelCompareData/data/properties/dcPowerOutput.js +1 -1
  151. package/lib/constants/modelCompareData/data/properties/dcPowerOutput.mjs +1 -1
  152. package/lib/constants/modelCompareData/data/properties/mounting.js +1 -1
  153. package/lib/constants/modelCompareData/data/properties/mounting.mjs +1 -1
  154. package/lib/constants/modelCompareData/data/properties/webMode.js +1 -1
  155. package/lib/constants/modelCompareData/data/properties/webMode.mjs +1 -1
  156. package/lib/contexts/MenuContext/mapping.js +3 -3
  157. package/lib/contexts/MenuContext/mapping.mjs +2 -2
  158. package/lib/contexts/MicrositeMenuContext/mapping.js +3 -3
  159. package/lib/contexts/MicrositeMenuContext/mapping.mjs +2 -2
  160. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CompareTable.styles.mjs","sources":["../../../../src/components/ModelCompareV4/CompareTable/CompareTable.styles.tsx"],"sourcesContent":["import styled, { createGlobalStyle, css } from \"styled-components\";\n\nimport { BREAKPOINTS } from \"../../../constants/layout\";\nimport { theme } from \"../../../constants/theme\";\nimport type { LanguageDirectionType } from \"../../../contexts/MenuContext/utils\";\nimport { Badge as BadgeBase } from \"../../Badge\";\nimport { Button as ButtonBase } from \"../../Button\";\nimport { StyleableSvgImage } from \"../../StyleableSvgImage\";\nimport { StickyGridItem } from \"./CompareTableMarkup/components/StickyGrid\";\n\nexport const MOBILE_BREAKPOINT = 650;\n\nexport const TOOLTIP_CLASS_NAME = `model-compare-tooltip`;\n\nexport const PlaceholderGridItem = styled(StickyGridItem)`\n background: ${theme.colors.white};\n z-index: 3;\n`;\n\nexport const CenterPlaceholderGridItem = styled(StickyGridItem)``;\n\nexport const HEADER_GRID_ITEM_Y_PADDING = 16;\n\nexport const HEADER_GRID_ITEM_GAP_DESKTOP = 24;\nexport const HEADER_GRID_ITEM_GAP_MOBILE = 12;\n\nexport const HeaderGridItem = styled(StickyGridItem)`\n background: ${theme.colors.white};\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n text-align: center;\n padding: ${HEADER_GRID_ITEM_Y_PADDING}px 0;\n gap: ${HEADER_GRID_ITEM_GAP_DESKTOP}px;\n position: relative;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n gap: ${HEADER_GRID_ITEM_GAP_MOBILE}px;\n /* Need this padding-top so sticky offset looks good on mobile */\n padding: 25px 0 0;\n }\n`;\n\nexport const EmptyHeaderGridItem = styled(HeaderGridItem)`\n align-items: center;\n justify-content: center;\n`;\n\nexport const EmptyHeaderEmptyProductDescription = styled.div<{\n $headerItemsAreSticking: boolean;\n}>`\n width: 100%;\n height: 100%;\n\n ${({ $headerItemsAreSticking }) =>\n $headerItemsAreSticking &&\n css`\n display: none;\n `}\n`;\n\nexport const HeaderGridItemContainer = styled.div<{ $isStuck: boolean }>`\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n`;\n\nexport const RemoveProductButton = styled.button<{ $isSmallScreen: boolean }>`\n position: absolute;\n top: 25px;\n right: 25px;\n background: transparent;\n border: none;\n padding: 5px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 30px;\n color: #c2c6cb;\n\n ${({ $isSmallScreen }) =>\n $isSmallScreen &&\n css`\n top: 0;\n right: 4%;\n `}\n`;\n\nexport const ProductMeta = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n flex: 1;\n align-items: center;\n width: 100%;\n padding: 0 10px;\n\n @media (max-width: ${MOBILE_BREAKPOINT}px) {\n &::before {\n display: none;\n }\n &::after {\n display: none;\n }\n }\n`;\n\nconst productTitleStyles = css`\n font-size: 16px;\n font-weight: 700;\n line-height: normal;\n letter-spacing: -0.32px;\n`;\n\nexport const ProductTitle = styled.div`\n ${productTitleStyles}\n\n color: ${theme.colors.black};\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n font-size: 14px;\n }\n`;\n\nexport const ProductTitleLink = styled(ButtonBase)`\n ${productTitleStyles}\n color: ${theme.colors.primaryBlue};\n\n :focus,\n :hover {\n text-decoration: none;\n }\n\n :focus {\n color: ${theme.colors.primaryBlue};\n }\n`;\n\nexport const ProductDescription = styled.div<{\n $maxWidth?: number;\n $direction: LanguageDirectionType;\n}>`\n font-size: 14px;\n font-weight: 400;\n line-height: normal;\n margin-top: 6px;\n letter-spacing: -0.24px;\n color: ${theme.colors.black65};\n max-width: ${({ $maxWidth }) => ($maxWidth ? `${$maxWidth}px` : \"auto\")};\n direction: ${({ $direction }) => $direction && `${$direction}`};\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n margin: 4px auto 12px;\n font-size: 12px;\n }\n`;\n\nexport const SelectFromAboveIsStuckContainer = styled.div<{\n $isStuck: boolean;\n}>`\n display: none;\n flex-direction: column;\n height: 100%;\n justify-content: center;\n align-items: center;\n\n ${({ $isStuck }) =>\n $isStuck &&\n css`\n display: flex;\n `}\n`;\n\nexport const SelectFromAboveIsStuck = styled(ProductDescription)`\n margin: 0;\n`;\n\nexport const ProductNote = styled.div`\n color: ${theme.colors.black45};\n font-size: ${theme.font.size10};\n line-height: 16.8px;\n margin-top: 6px;\n text-align: center;\n`;\n\nexport const Badge = styled(BadgeBase)`\n margin: 10px 0 20px;\n`;\n\nexport const BadgeWrapper = styled.div`\n margin-top: auto;\n display: flex;\n gap: 10px;\n`;\n\nexport const PropertyTitleGridItem = styled(StickyGridItem)`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n border-bottom: 1px solid ${theme.colors.athensGreyDark};\n background: ${theme.colors.white};\n z-index: 1;\n overflow: hidden;\n`;\n\nexport const EmptyPropertyTitleGridItem = styled(StickyGridItem)`\n background: ${theme.colors.white};\n`;\n\nexport const PropertyTitleGridItemContent = styled(StickyGridItem)`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 16px 16px 16px 8px;\n width: 100%;\n gap: 8px;\n overflow: hidden;\n`;\n\nexport const PropertyTitle = styled.div`\n font-size: 14px;\n font-weight: ${theme.fontWeight.bold};\n color: ${theme.colors.black65};\n line-height: 16.8px;\n letter-spacing: -0.28px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n font-size: 12px;\n line-height: 14px;\n }\n`;\n\nexport const PropertyIcon = styled.div`\n width: 30px;\n height: 30px;\n color: ${theme.colors.shark};\n`;\n\nexport const SelectFromAboveIconCopyContainer = styled.div<{\n $isStuck: boolean;\n}>`\n display: flex;\n flex-direction: column;\n align-items: center;\n opacity: 1;\n\n ${({ $isStuck }) =>\n $isStuck &&\n css`\n opacity: 0;\n `}\n`;\n\nexport const ProductImage = styled.img`\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n -webkit-user-drag: none;\n`;\n\nexport const ProductImageWrap = styled.div<{ height: number }>`\n height: ${({ height }) => `${height}px`};\n display: flex;\n`;\n\nexport const PropertyTooltip = styled.div`\n height: 20px;\n`;\n\nexport const PropertyTooltipContent = styled.div`\n color: #fafafa;\n font-size: 12px;\n\n a {\n color: ${theme.colors.primaryBlue};\n }\n`;\n\nexport const TooltipIcon = styled(StyleableSvgImage)`\n color: ${theme.colors.primaryBlue};\n`;\n\nexport const ButtonWrap = styled.div`\n padding: 16px 0;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst buttonStyles = css`\n padding: 10px 15px;\n line-height: 20px;\n font-weight: ${theme.fontWeight.bold};\n margin: auto;\n :focus,\n :hover {\n text-decoration: none;\n }\n\n > * {\n position: static;\n }\n`;\n\nexport const Button = styled(ButtonBase)`\n ${buttonStyles};\n`;\n\n// Doesn't do anything, unless its used somewhere else?\nexport const ComingSoon = styled(ButtonBase)`\n ${buttonStyles};\n\n cursor: default;\n color: #445178;\n\n :focus,\n :hover {\n color: #445178;\n }\n`;\n\nexport const NotesWrap = styled.div`\n padding: 16px 10px 10px;\n text-wrap: pretty;\n display: flex;\n flex-direction: column;\n align-items: center;\n`;\n\nexport const Note = styled.div`\n font-size: 10px;\n line-height: ${17 / 10};\n color: ${theme.colors.black45};\n text-align: center;\n`;\n\nexport const FootnotesWrap = styled.div`\n padding: 0 0 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n`;\n\nexport const Footnote = styled.div`\n font-size: 10px;\n line-height: ${17 / 10};\n color: ${theme.colors.black45};\n text-align: center;\n`;\n\nexport const KitIncluded = styled.div`\n font-size: 14px;\n font-weight: 400;\n letter-spacing: -0.28px;\n line-height: 16.8px;\n color: ${theme.colors.black65};\n`;\n\nexport const TooltipStyles = createGlobalStyle<{ maxWidth?: number }>`\n .${TOOLTIP_CLASS_NAME} {\n box-shadow: 0 8px 24px 0 #00000014;\n max-width: ${({ maxWidth }) => maxWidth ?? 200}px;\n font-size: 12px;\n line-height: 16px;\n font-weight: 400;\n padding: 8px 16px;\n margin-top: -1.5px;\n\n &::before {\n box-shadow: 0 8px 24px 0 #00000014;\n }\n }\n`;\n"],"names":["MOBILE_BREAKPOINT","TOOLTIP_CLASS_NAME","PlaceholderGridItem","styled","StickyGridItem","theme","colors","white","CenterPlaceholderGridItem","HEADER_GRID_ITEM_Y_PADDING","HEADER_GRID_ITEM_GAP_DESKTOP","HEADER_GRID_ITEM_GAP_MOBILE","HeaderGridItem","BREAKPOINTS","MOBILE_AND_DOWN","EmptyHeaderGridItem","EmptyHeaderEmptyProductDescription","div","$headerItemsAreSticking","css","HeaderGridItemContainer","RemoveProductButton","button","$isSmallScreen","ProductMeta","productTitleStyles","ProductTitle","black","ProductTitleLink","ButtonBase","primaryBlue","ProductDescription","black65","$maxWidth","$direction","SelectFromAboveIsStuckContainer","$isStuck","SelectFromAboveIsStuck","ProductNote","black45","font","size10","Badge","BadgeBase","BadgeWrapper","PropertyTitleGridItem","athensGreyDark","EmptyPropertyTitleGridItem","PropertyTitleGridItemContent","PropertyTitle","fontWeight","bold","PropertyIcon","shark","SelectFromAboveIconCopyContainer","ProductImage","img","ProductImageWrap","height","PropertyTooltip","PropertyTooltipContent","TooltipIcon","StyleableSvgImage","ButtonWrap","buttonStyles","Button","ComingSoon","NotesWrap","Note","FootnotesWrap","Footnote","KitIncluded","TooltipStyles","createGlobalStyle","maxWidth"],"mappings":";;;;;;;;;;;;AAUO,MAAMA,iBAAoB,GAAA,GAAA;AAE1B,MAAMC,kBAAqB,GAAA,uBAAA;AAErB,MAAAC,mBAAA,GAAsBC,OAAOC,cAAc,CAAA;AAAA,gBACxCC,KAAA,CAAMC,OAAOC,KAAK;AAAA;AAAA,CAAA;AAIrB,MAAAC,yBAAA,GAA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.styles.mjs","sources":["../../../../src/components/ModelCompareV4/CompareTable/CompareTable.styles.tsx"],"sourcesContent":["import styled, { createGlobalStyle, css } from \"styled-components\";\n\nimport { BREAKPOINTS } from \"../../../constants/layout\";\nimport { theme } from \"../../../constants/theme\";\nimport type { LanguageDirectionType } from \"../../../contexts/MenuContext/utils\";\nimport { Badge as BadgeBase } from \"../../Badge\";\nimport { Button as ButtonBase } from \"../../Button\";\nimport { StyleableSvgImage } from \"../../StyleableSvgImage\";\nimport { StickyGridItem } from \"./CompareTableMarkup/components/StickyGrid\";\n\nexport const MOBILE_BREAKPOINT = 650;\n\nexport const TOOLTIP_CLASS_NAME = `model-compare-tooltip`;\n\nexport const PlaceholderGridItem = styled(StickyGridItem)`\n background: ${theme.colors.white};\n z-index: 3;\n`;\n\nexport const CenterPlaceholderGridItem = styled(StickyGridItem)``;\n\nexport const HEADER_GRID_ITEM_Y_PADDING = 16;\n\nexport const HEADER_GRID_ITEM_GAP_DESKTOP = 24;\nexport const HEADER_GRID_ITEM_GAP_MOBILE = 12;\n\nexport const HeaderGridItem = styled(StickyGridItem)`\n background: ${theme.colors.white};\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n text-align: center;\n padding: ${HEADER_GRID_ITEM_Y_PADDING}px 0;\n gap: ${HEADER_GRID_ITEM_GAP_DESKTOP}px;\n position: relative;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n gap: ${HEADER_GRID_ITEM_GAP_MOBILE}px;\n /* Need this padding-top so sticky offset looks good on mobile */\n padding: 25px 0 0;\n }\n`;\n\nexport const EmptyHeaderGridItem = styled(HeaderGridItem)`\n align-items: center;\n justify-content: center;\n`;\n\nexport const EmptyHeaderEmptyProductDescription = styled.div<{\n $headerItemsAreSticking: boolean;\n}>`\n width: 100%;\n height: 100%;\n\n ${({ $headerItemsAreSticking }) =>\n $headerItemsAreSticking &&\n css`\n display: none;\n `}\n`;\n\nexport const HeaderGridItemContainer = styled.div<{ $isStuck: boolean }>`\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n`;\n\nexport const RemoveProductButton = styled.button<{ $isSmallScreen: boolean }>`\n position: absolute;\n top: 25px;\n right: 25px;\n background: transparent;\n border: none;\n padding: 5px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 30px;\n color: #c2c6cb;\n\n ${({ $isSmallScreen }) =>\n $isSmallScreen &&\n css`\n top: 0;\n right: 4%;\n `}\n`;\n\nexport const ProductMeta = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n flex: 1;\n align-items: center;\n width: 100%;\n padding: 0 10px;\n\n @media (max-width: ${MOBILE_BREAKPOINT}px) {\n &::before {\n display: none;\n }\n &::after {\n display: none;\n }\n }\n`;\n\nconst productTitleStyles = css`\n font-size: 16px;\n font-weight: 700;\n line-height: normal;\n letter-spacing: -0.32px;\n`;\n\nexport const ProductTitle = styled.div`\n ${productTitleStyles}\n\n color: ${theme.colors.black};\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n font-size: 14px;\n }\n`;\n\nexport const ProductTitleLink = styled(ButtonBase)`\n ${productTitleStyles}\n color: ${theme.colors.primaryBlue};\n\n :focus,\n :hover {\n text-decoration: none;\n }\n\n :focus {\n color: ${theme.colors.primaryBlue};\n }\n`;\n\nexport const ProductDescription = styled.div<{\n $maxWidth?: number;\n $direction: LanguageDirectionType;\n}>`\n font-size: 14px;\n font-weight: 400;\n line-height: normal;\n margin-top: 6px;\n letter-spacing: -0.24px;\n color: ${theme.colors.black65};\n max-width: ${({ $maxWidth }) => ($maxWidth ? `${$maxWidth}px` : \"auto\")};\n direction: ${({ $direction }) => $direction && `${$direction}`};\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n margin: 4px auto 12px;\n font-size: 12px;\n }\n`;\n\nexport const SelectFromAboveIsStuckContainer = styled.div<{\n $isStuck: boolean;\n}>`\n display: none;\n flex-direction: column;\n height: 100%;\n justify-content: center;\n align-items: center;\n\n ${({ $isStuck }) =>\n $isStuck &&\n css`\n display: flex;\n `}\n`;\n\nexport const SelectFromAboveIsStuck = styled(ProductDescription)`\n margin: 0;\n`;\n\nexport const ProductNote = styled.div`\n color: ${theme.colors.black45};\n font-size: ${theme.font.size10};\n line-height: 16.8px;\n margin-top: 6px;\n text-align: center;\n`;\n\nexport const Badge = styled(BadgeBase)`\n margin: 10px 0 20px;\n`;\n\nexport const BadgeWrapper = styled.div`\n margin-top: auto;\n display: flex;\n gap: 10px;\n`;\n\nexport const PropertyTitleGridItem = styled(StickyGridItem)`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n border-bottom: 1px solid ${theme.colors.athensGreyDark};\n background: ${theme.colors.white};\n z-index: 1;\n overflow: hidden;\n`;\n\nexport const EmptyPropertyTitleGridItem = styled(StickyGridItem)`\n background: ${theme.colors.white};\n`;\n\nexport const PropertyTitleGridItemContent = styled(StickyGridItem)`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 16px 16px 16px 8px;\n width: 100%;\n gap: 8px;\n overflow: hidden;\n`;\n\nexport const PropertyTitle = styled.div`\n font-size: 14px;\n font-weight: ${theme.fontWeight.bold};\n color: ${theme.colors.black65};\n line-height: 16.8px;\n letter-spacing: -0.28px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n font-size: 12px;\n line-height: 14px;\n }\n`;\n\nexport const PropertyIcon = styled.div`\n width: 30px;\n height: 30px;\n color: ${theme.colors.shark};\n`;\n\nexport const SelectFromAboveIconCopyContainer = styled.div<{\n $isStuck: boolean;\n}>`\n display: flex;\n flex-direction: column;\n align-items: center;\n opacity: 1;\n\n ${({ $isStuck }) =>\n $isStuck &&\n css`\n opacity: 0;\n `}\n`;\n\nexport const ProductImage = styled.img`\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n -webkit-user-drag: none;\n`;\n\nexport const ProductImageWrap = styled.div<{ height: number }>`\n height: ${({ height }) => `${height}px`};\n display: flex;\n`;\n\nexport const PropertyTooltip = styled.div`\n height: 20px;\n`;\n\nexport const PropertyTooltipContent = styled.div`\n color: #fafafa;\n font-size: 12px;\n\n a {\n color: ${theme.colors.primaryBlue};\n }\n`;\n\nexport const TooltipIcon = styled(StyleableSvgImage)`\n color: ${theme.colors.primaryBlue};\n`;\n\nexport const ButtonWrap = styled.div`\n padding: 16px 0;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst buttonStyles = css`\n padding: 10px 15px;\n line-height: 20px;\n font-weight: ${theme.fontWeight.bold};\n margin: auto;\n :focus,\n :hover {\n text-decoration: none;\n }\n\n > * {\n position: static;\n }\n`;\n\nexport const Button = styled(ButtonBase)`\n ${buttonStyles};\n`;\n\n// TODO: remove if not used anywhere else in store.core\nexport const ComingSoon = styled(ButtonBase)`\n ${buttonStyles};\n\n cursor: default;\n color: #445178;\n\n :focus,\n :hover {\n color: #445178;\n }\n`;\n\nexport const NotesWrap = styled.div`\n padding: 16px 10px 10px;\n text-wrap: pretty;\n display: flex;\n flex-direction: column;\n align-items: center;\n`;\n\nexport const Note = styled.div`\n font-size: 10px;\n line-height: ${17 / 10};\n color: ${theme.colors.black45};\n text-align: center;\n`;\n\nexport const FootnotesWrap = styled.div`\n padding: 0 0 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n`;\n\nexport const Footnote = styled.div`\n font-size: 10px;\n line-height: ${17 / 10};\n color: ${theme.colors.black45};\n text-align: center;\n`;\n\nexport const KitIncluded = styled.div`\n font-size: 14px;\n font-weight: 400;\n letter-spacing: -0.28px;\n line-height: 16.8px;\n color: ${theme.colors.black65};\n`;\n\nexport const TooltipStyles = createGlobalStyle<{ maxWidth?: number }>`\n .${TOOLTIP_CLASS_NAME} {\n box-shadow: 0 8px 24px 0 #00000014;\n max-width: ${({ maxWidth }) => maxWidth ?? 200}px;\n font-size: 12px;\n line-height: 16px;\n font-weight: 400;\n padding: 8px 16px;\n margin-top: -1.5px;\n\n &::before {\n box-shadow: 0 8px 24px 0 #00000014;\n }\n }\n`;\n"],"names":["MOBILE_BREAKPOINT","TOOLTIP_CLASS_NAME","PlaceholderGridItem","styled","StickyGridItem","theme","colors","white","CenterPlaceholderGridItem","HEADER_GRID_ITEM_Y_PADDING","HEADER_GRID_ITEM_GAP_DESKTOP","HEADER_GRID_ITEM_GAP_MOBILE","HeaderGridItem","BREAKPOINTS","MOBILE_AND_DOWN","EmptyHeaderGridItem","EmptyHeaderEmptyProductDescription","div","$headerItemsAreSticking","css","HeaderGridItemContainer","RemoveProductButton","button","$isSmallScreen","ProductMeta","productTitleStyles","ProductTitle","black","ProductTitleLink","ButtonBase","primaryBlue","ProductDescription","black65","$maxWidth","$direction","SelectFromAboveIsStuckContainer","$isStuck","SelectFromAboveIsStuck","ProductNote","black45","font","size10","Badge","BadgeBase","BadgeWrapper","PropertyTitleGridItem","athensGreyDark","EmptyPropertyTitleGridItem","PropertyTitleGridItemContent","PropertyTitle","fontWeight","bold","PropertyIcon","shark","SelectFromAboveIconCopyContainer","ProductImage","img","ProductImageWrap","height","PropertyTooltip","PropertyTooltipContent","TooltipIcon","StyleableSvgImage","ButtonWrap","buttonStyles","Button","ComingSoon","NotesWrap","Note","FootnotesWrap","Footnote","KitIncluded","TooltipStyles","createGlobalStyle","maxWidth"],"mappings":";;;;;;;;;;;;AAUO,MAAMA,iBAAoB,GAAA,GAAA;AAE1B,MAAMC,kBAAqB,GAAA,uBAAA;AAErB,MAAAC,mBAAA,GAAsBC,OAAOC,cAAc,CAAA;AAAA,gBACxCC,KAAA,CAAMC,OAAOC,KAAK;AAAA;AAAA,CAAA;AAIrB,MAAAC,yBAAA,GAA4BL,OAAOC,cAAc,CAAA,EAAA;AAEvD,MAAMK,0BAA6B,GAAA,EAAA;AAEnC,MAAMC,4BAA+B,GAAA,EAAA;AACrC,MAAMC,2BAA8B,GAAA,EAAA;AAE9B,MAAAC,cAAA,GAAiBT,OAAOC,cAAc,CAAA;AAAA,gBACnCC,KAAA,CAAMC,OAAOC,KAAK;AAAA;AAAA;AAAA;AAAA;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AAA;AAAA,CAAA;AAYzB,MAAAc,MAAA,GAAS9D,OAAO0B,QAAU,CAAA;AAAA,IACnCmC,YAAY;AAAA,CAAA;AAIH,MAAAE,UAAA,GAAa/D,OAAO0B,QAAU,CAAA;AAAA,IACvCmC,YAAY;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAWT,MAAMG,YAAYhE,MAAO,CAAAc,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQzB,MAAMmD,OAAOjE,MAAO,CAAAc,GAAA;AAAA;AAAA,iBAEV,KAAK,EAAE;AAAA,WACbZ,KAAA,CAAMC,OAAOiC,OAAO;AAAA;AAAA,CAAA;AAIxB,MAAM8B,gBAAgBlE,MAAO,CAAAc,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAO7B,MAAMqD,WAAWnE,MAAO,CAAAc,GAAA;AAAA;AAAA,iBAEd,KAAK,EAAE;AAAA,WACbZ,KAAA,CAAMC,OAAOiC,OAAO;AAAA;AAAA,CAAA;AAIxB,MAAMgC,cAAcpE,MAAO,CAAAc,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAKvBZ,KAAA,CAAMC,OAAO0B,OAAO;AAAA,CAAA;AAGxB,MAAMwC,aAAgB,GAAAC,iBAAA;AAAA,KACxBxE,kBAAkB;AAAA;AAAA,iBAEN,CAAC;EAAEyE;CAAS,KAAMA,YAAY,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;"}
@@ -84,9 +84,6 @@ function StickyGridHeader({
84
84
  const HeaderWrap = styled__default["default"].div`
85
85
  width: 100%;
86
86
  position: sticky;
87
- top: -${({
88
- $stickOffset
89
- }) => $stickOffset ?? 0}px;
90
87
  z-index: 2;
91
88
  transition: box-shadow 0.25s;
92
89
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"StickyGridHeader.js","sources":["../../../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/StickyGrid/StickyGridHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport styled from \"styled-components\";\n\nimport { useScrollGroupItem } from \"../ScrollGroup\";\nimport type { StickyGridContextType } from \"./context\";\nimport { useStickyGrid } from \"./context\";\n\nexport function StickyGridHeader({\n children,\n nonScrollChildren,\n stickOffset,\n onStickyStateChange,\n}: {\n children: ReactNode;\n nonScrollChildren?: (context: {\n grid: StickyGridContextType;\n isStuck: boolean;\n }) => ReactNode;\n stickOffset?: number;\n onStickyStateChange?: (isStuck: boolean) => void;\n}) {\n const grid = useStickyGrid();\n const { templateColumns, gap } = grid;\n const wrapperRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n useScrollGroupItem({ refObject: contentRef });\n const [elementHeight, setElementHeight] = useState<number | null>(null);\n const [isStuck, setIsStuck] = useState(false);\n\n useEffect(() => {\n onStickyStateChange?.(isStuck);\n }, [isStuck, onStickyStateChange]);\n\n // We need this so we can update the value of element.offsetHeight, which allows StickyGridHeader to set isStuck at the correct scroll position no matter where the observer is painted on the layout\n useEffect(() => {\n const element = wrapperRef.current;\n if (!element) return;\n\n const updateHeight = () => setElementHeight(element.offsetHeight);\n\n const resizeObserver = new ResizeObserver(updateHeight);\n\n resizeObserver.observe(element);\n\n // Set initial height immediately\n updateHeight();\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [wrapperRef]);\n\n const THRESHOLD = useMemo(() => {\n if (!elementHeight || !stickOffset) return 1;\n const value = (elementHeight - stickOffset) / elementHeight;\n const INTERSECTION_RATIO_BUFFER = 1.00001; // `value` is very accurate, but is consistently lesser than entry.intersectionRatio. This constant slightly increases the value of `THRESHOLD` so that `THRESHOLD` can be greater than entry.intersectionRatio\n\n return Math.max(0, Math.min(1, value * INTERSECTION_RATIO_BUFFER)); // We need to return a value between 0 and 1\n }, [elementHeight, stickOffset]);\n\n useEffect(() => {\n if (!wrapperRef.current) {\n setIsStuck(false);\n return;\n }\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (!entry) return;\n setIsStuck(entry.intersectionRatio < THRESHOLD);\n },\n { threshold: THRESHOLD },\n );\n\n observer.observe(wrapperRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [THRESHOLD]);\n\n return (\n <HeaderWrap ref={wrapperRef} $stickOffset={stickOffset}>\n <StyledStickyHeader\n ref={contentRef}\n $templateColumns={templateColumns}\n $gap={gap}\n >\n {children}\n </StyledStickyHeader>\n {nonScrollChildren?.({ grid, isStuck })}\n </HeaderWrap>\n );\n}\n\nconst HeaderWrap = styled.div<{\n $stickOffset?: number;\n}>`\n width: 100%;\n position: sticky;\n top: -${({ $stickOffset }) => $stickOffset ?? 0}px;\n z-index: 2;\n transition: box-shadow 0.25s;\n`;\n\nconst StyledStickyHeader = styled.div<{\n $templateColumns: string;\n $gap?: string;\n}>`\n display: grid;\n\n gap: ${({ $gap }) => $gap ?? 0};\n grid-template-columns: ${({ $templateColumns }) => $templateColumns};\n width: 100%;\n position: sticky;\n z-index: 2;\n\n transition: box-shadow 0.25s;\n\n overflow: auto;\n overscroll-behavior-x: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n`;\n"],"names":["StickyGridHeader","children","nonScrollChildren","stickOffset","onStickyStateChange","grid","useStickyGrid","templateColumns","gap","wrapperRef","useRef","contentRef","useScrollGroupItem","refObject","elementHeight","setElementHeight","useState","isStuck","setIsStuck","useEffect","element","current","updateHeight","offsetHeight","resizeObserver","ResizeObserver","observe","disconnect","THRESHOLD","useMemo","value","INTERSECTION_RATIO_BUFFER","Math","max","min","observer","IntersectionObserver","entry","intersectionRatio","threshold","jsxs","HeaderWrap","ref","$stickOffset","jsx","StyledStickyHeader","$templateColumns","$gap","styled","div"],"mappings":";;;;;;;;;;;;;;;AAQO,SAASA,gBAAiBA,CAAA;EAC/BC,QAAA;EACAC,iBAAA;EACAC,WAAA;EACAC;AACF,CAQG,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AMzB,CAAC;EAAEF;CAAK,KAAMA,QAAQ,CAAC;AAAA,2BACL,CAAC;EAAED;AAAiB,CAAA,KAAMA,gBAAgB;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;"}
1
+ {"version":3,"file":"StickyGridHeader.js","sources":["../../../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/StickyGrid/StickyGridHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport styled from \"styled-components\";\n\nimport { useScrollGroupItem } from \"../ScrollGroup\";\nimport type { StickyGridContextType } from \"./context\";\nimport { useStickyGrid } from \"./context\";\n\nexport function StickyGridHeader({\n children,\n nonScrollChildren,\n stickOffset,\n onStickyStateChange,\n}: {\n children: ReactNode;\n nonScrollChildren?: (context: {\n grid: StickyGridContextType;\n isStuck: boolean;\n }) => ReactNode;\n stickOffset?: number;\n onStickyStateChange?: (isStuck: boolean) => void;\n}) {\n const grid = useStickyGrid();\n const { templateColumns, gap } = grid;\n const wrapperRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n useScrollGroupItem({ refObject: contentRef });\n const [elementHeight, setElementHeight] = useState<number | null>(null);\n const [isStuck, setIsStuck] = useState(false);\n\n useEffect(() => {\n onStickyStateChange?.(isStuck);\n }, [isStuck, onStickyStateChange]);\n\n // We need this so we can update the value of element.offsetHeight, which allows StickyGridHeader to set isStuck at the correct scroll position no matter where the observer is painted on the layout\n useEffect(() => {\n const element = wrapperRef.current;\n if (!element) return;\n\n const updateHeight = () => setElementHeight(element.offsetHeight);\n\n const resizeObserver = new ResizeObserver(updateHeight);\n\n resizeObserver.observe(element);\n\n // Set initial height immediately\n updateHeight();\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [wrapperRef]);\n\n const THRESHOLD = useMemo(() => {\n if (!elementHeight || !stickOffset) return 1;\n const value = (elementHeight - stickOffset) / elementHeight;\n const INTERSECTION_RATIO_BUFFER = 1.00001; // `value` is very accurate, but is consistently lesser than entry.intersectionRatio. This constant slightly increases the value of `THRESHOLD` so that `THRESHOLD` can be greater than entry.intersectionRatio\n\n return Math.max(0, Math.min(1, value * INTERSECTION_RATIO_BUFFER)); // We need to return a value between 0 and 1\n }, [elementHeight, stickOffset]);\n\n useEffect(() => {\n if (!wrapperRef.current) {\n setIsStuck(false);\n return;\n }\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (!entry) return;\n setIsStuck(entry.intersectionRatio < THRESHOLD);\n },\n { threshold: THRESHOLD },\n );\n\n observer.observe(wrapperRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [THRESHOLD]);\n\n return (\n <HeaderWrap ref={wrapperRef} $stickOffset={stickOffset}>\n <StyledStickyHeader\n ref={contentRef}\n $templateColumns={templateColumns}\n $gap={gap}\n >\n {children}\n </StyledStickyHeader>\n {nonScrollChildren?.({ grid, isStuck })}\n </HeaderWrap>\n );\n}\n\nconst HeaderWrap = styled.div<{\n $stickOffset?: number;\n}>`\n width: 100%;\n position: sticky;\n z-index: 2;\n transition: box-shadow 0.25s;\n`;\n\nconst StyledStickyHeader = styled.div<{\n $templateColumns: string;\n $gap?: string;\n}>`\n display: grid;\n\n gap: ${({ $gap }) => $gap ?? 0};\n grid-template-columns: ${({ $templateColumns }) => $templateColumns};\n width: 100%;\n position: sticky;\n z-index: 2;\n\n transition: box-shadow 0.25s;\n\n overflow: auto;\n overscroll-behavior-x: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n`;\n"],"names":["StickyGridHeader","children","nonScrollChildren","stickOffset","onStickyStateChange","grid","useStickyGrid","templateColumns","gap","wrapperRef","useRef","contentRef","useScrollGroupItem","refObject","elementHeight","setElementHeight","useState","isStuck","setIsStuck","useEffect","element","current","updateHeight","offsetHeight","resizeObserver","ResizeObserver","observe","disconnect","THRESHOLD","useMemo","value","INTERSECTION_RATIO_BUFFER","Math","max","min","observer","IntersectionObserver","entry","intersectionRatio","threshold","jsxs","HeaderWrap","ref","$stickOffset","jsx","StyledStickyHeader","$templateColumns","$gap","styled","div"],"mappings":";;;;;;;;;;;;;;;AAQO,SAASA,gBAAiBA,CAAA;EAC/BC,QAAA;EACAC,iBAAA;EACAC,WAAA;EACAC;AACF,CAQG,EAAA;EACD,MAAMC,OAAOC,OAAAA,CAAAA,aAAc,CAAA,CAAA;EACrB,MAAA;IAAEC,eAAiB;IAAAC;EAAA,CAAQ,GAAAH,IAAA;EAC3B,MAAAI,UAAA,GAAaC,aAAuB,IAAI,CAAA;EACxC,MAAAC,UAAA,GAAaD,aAAuB,IAAI,CAAA;EAC3BE,qCAAA,CAAA;IAAEC,SAAW,EAAAF;GAAY,CAAA;EAC5C,MAAM,CAACG,aAAA,EAAeC,gBAAgB,CAAA,GAAIC,KAAAA,CAAAA,SAAwB,IAAI,CAAA;EACtE,MAAM,CAACC,OAAA,EAASC,UAAU,CAAA,GAAIF,KAAAA,CAAAA,SAAS,KAAK,CAAA;EAE5CG,KAAAA,CAAAA,SAAA,CAAU,MAAM;IACdf,mBAAA,GAAsBa,OAAO,CAAA;EAAA,CAC5B,EAAA,CAACA,OAAS,EAAAb,mBAAmB,CAAC,CAAA;EAGjCe,KAAAA,CAAAA,SAAA,CAAU,MAAM;IACd,MAAMC,UAAUX,UAAW,CAAAY,OAAA;IAC3B,IAAI,CAACD,OAAS,EAAA;IAEd,MAAME,YAAe,GAAAA,CAAA,KAAMP,gBAAiB,CAAAK,OAAA,CAAQG,YAAY,CAAA;IAE1D,MAAAC,cAAA,GAAiB,IAAIC,cAAA,CAAeH,YAAY,CAAA;IAEtDE,cAAA,CAAeE,QAAQN,OAAO,CAAA;IAGjBE,YAAA,CAAA,CAAA;IAEb,OAAO,MAAM;MACXE,cAAA,CAAeG,UAAW,CAAA,CAAA;IAC5B,CAAA;EAAA,CACF,EAAG,CAAClB,UAAU,CAAC,CAAA;EAET,MAAAmB,SAAA,GAAYC,KA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AaO,eAAO,CAAA,SAAA,CAAA,CAAAC,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAS1B,MAAMJ,qBAAqBG,eAAO,CAAA,SAAA,CAAA,CAAAC,GAAA;AAAA;;AAAA,SAMzB,CAAC;EAAEF;CAAK,KAAMA,QAAQ,CAAC;AAAA,2BACL,CAAC;EAAED;AAAiB,CAAA,KAAMA,gBAAgB;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;"}
@@ -76,9 +76,6 @@ function StickyGridHeader({
76
76
  const HeaderWrap = styled.div`
77
77
  width: 100%;
78
78
  position: sticky;
79
- top: -${({
80
- $stickOffset
81
- }) => $stickOffset ?? 0}px;
82
79
  z-index: 2;
83
80
  transition: box-shadow 0.25s;
84
81
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"StickyGridHeader.mjs","sources":["../../../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/StickyGrid/StickyGridHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport styled from \"styled-components\";\n\nimport { useScrollGroupItem } from \"../ScrollGroup\";\nimport type { StickyGridContextType } from \"./context\";\nimport { useStickyGrid } from \"./context\";\n\nexport function StickyGridHeader({\n children,\n nonScrollChildren,\n stickOffset,\n onStickyStateChange,\n}: {\n children: ReactNode;\n nonScrollChildren?: (context: {\n grid: StickyGridContextType;\n isStuck: boolean;\n }) => ReactNode;\n stickOffset?: number;\n onStickyStateChange?: (isStuck: boolean) => void;\n}) {\n const grid = useStickyGrid();\n const { templateColumns, gap } = grid;\n const wrapperRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n useScrollGroupItem({ refObject: contentRef });\n const [elementHeight, setElementHeight] = useState<number | null>(null);\n const [isStuck, setIsStuck] = useState(false);\n\n useEffect(() => {\n onStickyStateChange?.(isStuck);\n }, [isStuck, onStickyStateChange]);\n\n // We need this so we can update the value of element.offsetHeight, which allows StickyGridHeader to set isStuck at the correct scroll position no matter where the observer is painted on the layout\n useEffect(() => {\n const element = wrapperRef.current;\n if (!element) return;\n\n const updateHeight = () => setElementHeight(element.offsetHeight);\n\n const resizeObserver = new ResizeObserver(updateHeight);\n\n resizeObserver.observe(element);\n\n // Set initial height immediately\n updateHeight();\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [wrapperRef]);\n\n const THRESHOLD = useMemo(() => {\n if (!elementHeight || !stickOffset) return 1;\n const value = (elementHeight - stickOffset) / elementHeight;\n const INTERSECTION_RATIO_BUFFER = 1.00001; // `value` is very accurate, but is consistently lesser than entry.intersectionRatio. This constant slightly increases the value of `THRESHOLD` so that `THRESHOLD` can be greater than entry.intersectionRatio\n\n return Math.max(0, Math.min(1, value * INTERSECTION_RATIO_BUFFER)); // We need to return a value between 0 and 1\n }, [elementHeight, stickOffset]);\n\n useEffect(() => {\n if (!wrapperRef.current) {\n setIsStuck(false);\n return;\n }\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (!entry) return;\n setIsStuck(entry.intersectionRatio < THRESHOLD);\n },\n { threshold: THRESHOLD },\n );\n\n observer.observe(wrapperRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [THRESHOLD]);\n\n return (\n <HeaderWrap ref={wrapperRef} $stickOffset={stickOffset}>\n <StyledStickyHeader\n ref={contentRef}\n $templateColumns={templateColumns}\n $gap={gap}\n >\n {children}\n </StyledStickyHeader>\n {nonScrollChildren?.({ grid, isStuck })}\n </HeaderWrap>\n );\n}\n\nconst HeaderWrap = styled.div<{\n $stickOffset?: number;\n}>`\n width: 100%;\n position: sticky;\n top: -${({ $stickOffset }) => $stickOffset ?? 0}px;\n z-index: 2;\n transition: box-shadow 0.25s;\n`;\n\nconst StyledStickyHeader = styled.div<{\n $templateColumns: string;\n $gap?: string;\n}>`\n display: grid;\n\n gap: ${({ $gap }) => $gap ?? 0};\n grid-template-columns: ${({ $templateColumns }) => $templateColumns};\n width: 100%;\n position: sticky;\n z-index: 2;\n\n transition: box-shadow 0.25s;\n\n overflow: auto;\n overscroll-behavior-x: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n`;\n"],"names":["StickyGridHeader","children","nonScrollChildren","stickOffset","onStickyStateChange","grid","useStickyGrid","templateColumns","gap","wrapperRef","useRef","contentRef","useScrollGroupItem","refObject","elementHeight","setElementHeight","useState","isStuck","setIsStuck","useEffect","element","current","updateHeight","offsetHeight","resizeObserver","ResizeObserver","observe","disconnect","THRESHOLD","useMemo","value","INTERSECTION_RATIO_BUFFER","Math","max","min","observer","IntersectionObserver","entry","intersectionRatio","threshold","jsxs","HeaderWrap","ref","$stickOffset","jsx","StyledStickyHeader","$templateColumns","$gap","styled","div"],"mappings":";;;;;;;AAQO,SAASA,gBAAiBA,CAAA;EAC/BC,QAAA;EACAC,iBAAA;EACAC,WAAA;EACAC;AACF,CAQG,EAAA;EACD,MAAMC,OAAOC,aAAc,CAAA,CAAA;EACrB,MAAA;IAAEC,eAAiB;IAAAC;EAAA,CAAQ,GAAAH,IAAA;EAC3B,MAAAI,UAAA,GAAaC,OAAuB,IAAI,CAAA;EACxC,MAAAC,UAAA,GAAaD,OAAuB,IAAI,CAAA;EAC3BE,kBAAA,CAAA;IAAEC,SAAW,EAAAF;GAAY,CAAA;EAC5C,MAAM,CAACG,aAAA,EAAeC,gBAAgB,CAAA,GAAIC,SAAwB,IAAI,CAAA;EACtE,MAAM,CAACC,OAAA,EAASC,UAAU,CAAA,GAAIF,SAAS,KAAK,CAAA;EAE5CG,SAAA,CAAU,MAAM;IACdf,mBAAA,GAAsBa,OAAO,CAAA;EAAA,CAC5B,EAAA,CAACA,OAAS,EAAAb,mBAAmB,CAAC,CAAA;EAGjCe,SAAA,CAAU,MAAM;IACd,MAAMC,UAAUX,UAAW,CAAAY,OAAA;IAC3B,IAAI,CAACD,OAAS,EAAA;IAEd,MAAME,YAAe,GAAAA,CAAA,KAAMP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A,EAAA,CAAA,eAAA2C,GAAA,CAACC,kBAAA,EAAA;MACCH,GAAK,EAAA/B,UAAA;MACLmC,gBAAkB,EAAAvC,eAAA;MAClBwC,IAAM,EAAAvC,GAAA;MAELP;IAAA,CACH,CAAA,EACCC,iBAAoB,GAAA;MAAEG,IAAM;MAAAY;IAAS,CAAA,CAAA;GACxC,CAAA;AAEJ;AAEA,MAAMwB,aAAaO,MAAO,CAAAC,GAAA;AAAA;AAAA;AAAA,UAKhB,CAAC;EAAEN;CAAa,KAAMA,gBAAgB,CAAC;AAAA;AAAA;AAAA,CAAA;AAKjD,MAAME,qBAAqBG,MAAO,CAAAC,GAAA;AAAA;;AAAA,SAMzB,CAAC;EAAEF;CAAK,KAAMA,QAAQ,CAAC;AAAA,2BACL,CAAC;EAAED;AAAiB,CAAA,KAAMA,gBAAgB;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;"}
1
+ {"version":3,"file":"StickyGridHeader.mjs","sources":["../../../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/StickyGrid/StickyGridHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport styled from \"styled-components\";\n\nimport { useScrollGroupItem } from \"../ScrollGroup\";\nimport type { StickyGridContextType } from \"./context\";\nimport { useStickyGrid } from \"./context\";\n\nexport function StickyGridHeader({\n children,\n nonScrollChildren,\n stickOffset,\n onStickyStateChange,\n}: {\n children: ReactNode;\n nonScrollChildren?: (context: {\n grid: StickyGridContextType;\n isStuck: boolean;\n }) => ReactNode;\n stickOffset?: number;\n onStickyStateChange?: (isStuck: boolean) => void;\n}) {\n const grid = useStickyGrid();\n const { templateColumns, gap } = grid;\n const wrapperRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n useScrollGroupItem({ refObject: contentRef });\n const [elementHeight, setElementHeight] = useState<number | null>(null);\n const [isStuck, setIsStuck] = useState(false);\n\n useEffect(() => {\n onStickyStateChange?.(isStuck);\n }, [isStuck, onStickyStateChange]);\n\n // We need this so we can update the value of element.offsetHeight, which allows StickyGridHeader to set isStuck at the correct scroll position no matter where the observer is painted on the layout\n useEffect(() => {\n const element = wrapperRef.current;\n if (!element) return;\n\n const updateHeight = () => setElementHeight(element.offsetHeight);\n\n const resizeObserver = new ResizeObserver(updateHeight);\n\n resizeObserver.observe(element);\n\n // Set initial height immediately\n updateHeight();\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [wrapperRef]);\n\n const THRESHOLD = useMemo(() => {\n if (!elementHeight || !stickOffset) return 1;\n const value = (elementHeight - stickOffset) / elementHeight;\n const INTERSECTION_RATIO_BUFFER = 1.00001; // `value` is very accurate, but is consistently lesser than entry.intersectionRatio. This constant slightly increases the value of `THRESHOLD` so that `THRESHOLD` can be greater than entry.intersectionRatio\n\n return Math.max(0, Math.min(1, value * INTERSECTION_RATIO_BUFFER)); // We need to return a value between 0 and 1\n }, [elementHeight, stickOffset]);\n\n useEffect(() => {\n if (!wrapperRef.current) {\n setIsStuck(false);\n return;\n }\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (!entry) return;\n setIsStuck(entry.intersectionRatio < THRESHOLD);\n },\n { threshold: THRESHOLD },\n );\n\n observer.observe(wrapperRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [THRESHOLD]);\n\n return (\n <HeaderWrap ref={wrapperRef} $stickOffset={stickOffset}>\n <StyledStickyHeader\n ref={contentRef}\n $templateColumns={templateColumns}\n $gap={gap}\n >\n {children}\n </StyledStickyHeader>\n {nonScrollChildren?.({ grid, isStuck })}\n </HeaderWrap>\n );\n}\n\nconst HeaderWrap = styled.div<{\n $stickOffset?: number;\n}>`\n width: 100%;\n position: sticky;\n z-index: 2;\n transition: box-shadow 0.25s;\n`;\n\nconst StyledStickyHeader = styled.div<{\n $templateColumns: string;\n $gap?: string;\n}>`\n display: grid;\n\n gap: ${({ $gap }) => $gap ?? 0};\n grid-template-columns: ${({ $templateColumns }) => $templateColumns};\n width: 100%;\n position: sticky;\n z-index: 2;\n\n transition: box-shadow 0.25s;\n\n overflow: auto;\n overscroll-behavior-x: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n`;\n"],"names":["StickyGridHeader","children","nonScrollChildren","stickOffset","onStickyStateChange","grid","useStickyGrid","templateColumns","gap","wrapperRef","useRef","contentRef","useScrollGroupItem","refObject","elementHeight","setElementHeight","useState","isStuck","setIsStuck","useEffect","element","current","updateHeight","offsetHeight","resizeObserver","ResizeObserver","observe","disconnect","THRESHOLD","useMemo","value","INTERSECTION_RATIO_BUFFER","Math","max","min","observer","IntersectionObserver","entry","intersectionRatio","threshold","jsxs","HeaderWrap","ref","$stickOffset","jsx","StyledStickyHeader","$templateColumns","$gap","styled","div"],"mappings":";;;;;;;AAQO,SAASA,gBAAiBA,CAAA;EAC/BC,QAAA;EACAC,iBAAA;EACAC,WAAA;EACAC;AACF,CAQG,EAAA;EACD,MAAMC,OAAOC,aAAc,CAAA,CAAA;EACrB,MAAA;IAAEC,eAAiB;IAAAC;EAAA,CAAQ,GAAAH,IAAA;EAC3B,MAAAI,UAAA,GAAaC,OAAuB,IAAI,CAAA;EACxC,MAAAC,UAAA,GAAaD,OAAuB,IAAI,CAAA;EAC3BE,kBAAA,CAAA;IAAEC,SAAW,EAAAF;GAAY,CAAA;EAC5C,MAAM,CAACG,aAAA,EAAeC,gBAAgB,CAAA,GAAIC,SAAwB,IAAI,CAAA;EACtE,MAAM,CAACC,OAAA,EAASC,UAAU,CAAA,GAAIF,SAAS,KAAK,CAAA;EAE5CG,SAAA,CAAU,MAAM;IACdf,mBAAA,GAAsBa,OAAO,CAAA;EAAA,CAC5B,EAAA,CAACA,OAAS,EAAAb,mBAAmB,CAAC,CAAA;EAGjCe,SAAA,CAAU,MAAM;IACd,MAAMC,UAAUX,UAAW,CAAAY,OAAA;IAC3B,IAAI,CAACD,OAAS,EAAA;IAE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IAAYkC,cAAcxC,WACzC;IAAAF,QAAA,EAAA,CAAA,eAAA2C,GAAA,CAACC,kBAAA,EAAA;MACCH,GAAK,EAAA/B,UAAA;MACLmC,gBAAkB,EAAAvC,eAAA;MAClBwC,IAAM,EAAAvC,GAAA;MAELP;IAAA,CACH,CAAA,EACCC,iBAAoB,GAAA;MAAEG,IAAM;MAAAY;IAAS,CAAA,CAAA;GACxC,CAAA;AAEJ;AAEA,MAAMwB,aAAaO,MAAO,CAAAC,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAS1B,MAAMJ,qBAAqBG,MAAO,CAAAC,GAAA;AAAA;;AAAA,SAMzB,CAAC;EAAEF;CAAK,KAAMA,QAAQ,CAAC;AAAA,2BACL,CAAC;EAAED;AAAiB,CAAA,KAAMA,gBAAgB;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;"}
@@ -86,12 +86,6 @@ const ProductList = ({
86
86
  document.addEventListener("mouseup", mouseUpHandler);
87
87
  }
88
88
  }, [dragHandler, mouseUpHandler]);
89
- React.useEffect(() => {
90
- return () => {
91
- document.removeEventListener("mousemove", dragHandler);
92
- document.removeEventListener("mouseup", mouseUpHandler);
93
- };
94
- }, [dragHandler, mouseUpHandler]);
95
89
  React.useEffect(() => {
96
90
  const container = containerRef.current;
97
91
  if (!container) return;
@@ -1 +1 @@
1
- {"version":3,"file":"ProductList.js","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useEffectOnce, useHoverDirty } from \"react-use\";\n\nimport type {\n ProductId,\n ProductListGroupId,\n} from \"../../../constants/modelCompareData/types\";\nimport { ButtonGroup } from \"./components/ButtonGroup\";\nimport { Product } from \"./components/Product/Product\";\nimport { groupProducts } from \"./components/ProductGroups/groupProducts\";\nimport { ProductGroups } from \"./components/ProductGroups/ProductGroups\";\nimport { ScrollButton } from \"./components/ScrollButton/ScrollButton\";\nimport * as S from \"./ProductList.styles\";\nimport type { ProductListProps } from \"./ProductList.types\";\nimport { useIsAtMaxScroll } from \"./useIsAtMaxScroll\";\n\nconst CHECK_FOR_SCROLL_TIMEOUT = 150;\n\nexport const ProductList = ({\n products,\n selectedProducts,\n setSelectedProducts,\n hasBeenObserved,\n selectedProductsLimit,\n initialActiveGroup,\n setExternalState,\n showProductGroups,\n isOverviewPage,\n}: ProductListProps) => {\n const groupedGroups = useMemo(() => groupProducts(products), [products]);\n const moreThanOneGroupExists = groupedGroups.length > 1;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const productListRef = useRef<HTMLDivElement>(null);\n\n const [buttonHasBeenClick, setButtonHasBeenClicked] = useState(false);\n const [activeGroup, setActiveGroup] = useState(initialActiveGroup);\n const [playAnimation, setPlayAnimation] = useState(false);\n const isHovering = useHoverDirty(containerRef);\n const [isDragging, setIsDragging] = useState(false);\n const [overflowExists, setOverflowExists] = useState(true);\n const [endPosition, setEndPosition] = useState<number>(0);\n\n useEffectOnce(() => {\n const refsExist = containerRef.current && productListRef.current;\n if (\n refsExist &&\n containerRef.current?.getBoundingClientRect().width <\n productListRef.current?.getBoundingClientRect().width\n ) {\n setOverflowExists(true);\n } else {\n setOverflowExists(false);\n }\n });\n\n // TODO: figure out how to remove this TODO. Currently, without this `useEffect` `activeGroup` isn't updating when toggling between different tables (`Section`s).\n // ModelCompareV4 is sometimes used to toggle between sets of data of type Section. In this situation, we need the initial active group to be updated when the new data is passed to ModelCompareV4\n useEffect(() => {\n setActiveGroup(products[0]?.productListGroup?.id as ProductListGroupId);\n }, [products]);\n\n // #############################################################################\n // Scroll-Specific useEffects\n // #############################################################################\n\n // if there aren't any product list group buttons then the ending state of the animations need to exist on the initial render\n useEffect(() => {\n if (!showProductGroups && hasBeenObserved) {\n setPlayAnimation(true);\n }\n }, [hasBeenObserved, setPlayAnimation, showProductGroups]);\n\n // plays animation when no scroll has occurred on the initial observe\n useEffect(() => {\n const productListInitialPosition =\n productListRef.current?.getBoundingClientRect().left;\n\n let timeoutId: NodeJS.Timeout;\n\n if (hasBeenObserved || buttonHasBeenClick) {\n timeoutId = setTimeout(() => {\n const currentPosition =\n productListRef.current?.getBoundingClientRect().left;\n if (productListInitialPosition === currentPosition) {\n return setPlayAnimation(true);\n }\n }, CHECK_FOR_SCROLL_TIMEOUT);\n }\n\n return () => {\n clearTimeout(timeoutId);\n };\n }, [hasBeenObserved, setPlayAnimation, buttonHasBeenClick]);\n\n // #############################################################################\n // Drag Logic\n // #############################################################################\n const dragStartingPosition = useRef(0);\n const scrollAmount = useRef(0);\n\n const dragHandler = useCallback(\n (event: MouseEvent) => {\n scrollAmount.current = dragStartingPosition.current - event.clientX;\n containerRef.current?.scrollTo(endPosition + scrollAmount.current, 0);\n },\n [endPosition],\n );\n\n const mouseUpHandler = useCallback(() => {\n setIsDragging(false);\n setEndPosition(containerRef.current?.scrollLeft ?? 0);\n document.removeEventListener(\"mousemove\", dragHandler);\n document.removeEventListener(\"mouseup\", mouseUpHandler);\n }, [dragHandler]);\n\n const mouseDownHandler = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>) => {\n if (event.buttons === 1) {\n dragStartingPosition.current = event.clientX;\n setIsDragging(true);\n document.addEventListener(\"mousemove\", dragHandler);\n document.addEventListener(\"mouseup\", mouseUpHandler);\n }\n },\n [dragHandler, mouseUpHandler],\n );\n\n // Add cleanup for drag handlers on unmount\n useEffect(() => {\n return () => {\n document.removeEventListener(\"mousemove\", dragHandler);\n document.removeEventListener(\"mouseup\", mouseUpHandler);\n };\n }, [dragHandler, mouseUpHandler]);\n\n useEffect(() => {\n const container = containerRef.current;\n\n if (!container) return;\n\n let isScrolling: NodeJS.Timeout;\n\n const checkIsScrolling = () => {\n window.clearTimeout(isScrolling);\n\n // if scrolling occurs, animations are played after scrolling has completed\n // if scrolling occurs, the container's end position is tracked in state after scrolling has completed\n isScrolling = setTimeout(function () {\n setPlayAnimation(true);\n setEndPosition(containerRef.current?.scrollLeft as number);\n }, CHECK_FOR_SCROLL_TIMEOUT);\n };\n\n (containerRef.current as HTMLDivElement).addEventListener(\n \"scroll\",\n checkIsScrolling,\n );\n\n return () => {\n window.removeEventListener(\"resize\", checkIsScrolling);\n };\n }, []); // Empty dependency array since we want this to run once\n\n // #############################################################################\n // Click to Scroll Logic\n // #############################################################################\n\n const tabClickHandler = useCallback(\n ({ groupId }: { groupId: ProductListGroupId }) => {\n const initialScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n const checkForScroll = () => {\n const currentScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n return currentScrollPosition === initialScrollPosition;\n };\n\n const element = document.getElementById(groupId) as HTMLDivElement;\n\n setPlayAnimation(false);\n setActiveGroup(groupId);\n setButtonHasBeenClicked(true);\n element?.scrollIntoView({\n behavior: \"smooth\",\n inline: \"start\",\n block: \"nearest\",\n });\n\n // if no scroll occurs animations are played\n setTimeout(() => {\n if (checkForScroll()) {\n setPlayAnimation(true);\n }\n }, CHECK_FOR_SCROLL_TIMEOUT);\n },\n [containerRef, setPlayAnimation, setActiveGroup],\n );\n\n const scrollButtonHandler = ({ isLeftArrow }: { isLeftArrow?: boolean }) => {\n if (containerRef.current) {\n const currentScrollPosition = containerRef.current?.scrollLeft;\n\n const scrollLength = isLeftArrow\n ? currentScrollPosition - S.PRODUCT_CARD_WIDTH - S.PRODUCT_LIST_GRID_GAP\n : currentScrollPosition +\n S.PRODUCT_CARD_WIDTH +\n S.PRODUCT_LIST_GRID_GAP;\n\n containerRef.current?.scrollTo(scrollLength, 0);\n }\n };\n\n const { isMaxLeft, isMaxRight } = useIsAtMaxScroll(containerRef);\n\n return (\n <S.Wrapper>\n {showProductGroups && moreThanOneGroupExists && (\n <ButtonGroup\n items={groupedGroups.map((group) => group.productListGroup)}\n activeButton={activeGroup as string}\n onClick={(id) => {\n tabClickHandler({ groupId: id as ProductListGroupId });\n }}\n />\n )}\n <S.Container\n ref={containerRef}\n $isHovering={isHovering}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n $isDragging={isDragging}\n >\n <S.ProductGroupProductListContainer>\n {moreThanOneGroupExists && (\n <ProductGroups\n products={products}\n activeGroup={activeGroup as ProductListGroupId}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n showProductGroups={showProductGroups}\n />\n )}\n <S.ProductList\n $columns={products.length}\n $isDragging={isDragging}\n $overflowExists={overflowExists}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n onMouseDown={(event) => mouseDownHandler(event)}\n onMouseUp={mouseUpHandler}\n ref={productListRef}\n >\n <ScrollButton\n color=\"white\"\n rotationDegrees={180}\n isVisible={!isMaxLeft}\n onClick={() => scrollButtonHandler({ isLeftArrow: true })}\n />\n <ScrollButton\n color=\"white\"\n rotationDegrees={0}\n isVisible={isMaxRight}\n isRightButton\n onClick={() => scrollButtonHandler({ isLeftArrow: false })}\n />\n {products.map((product, productsArrayIndex) => {\n const groupIsActive =\n product.productListGroup?.id === activeGroup;\n\n const productListGroup = products.filter(\n (product) => activeGroup === product.productListGroup?.id,\n );\n\n const groupIndex = productListGroup.findIndex(\n (item) => item.id === product.id,\n );\n\n return (\n <Product\n onClick={() =>\n setActiveGroup(\n product.productListGroup?.id as ProductListGroupId,\n )\n }\n key={product.id}\n groupIndex={groupIndex}\n groupLength={productListGroup.length}\n id={product?.id as ProductId}\n groupId={product.productListGroup?.id as ProductListGroupId}\n image={product.image ?? { src: \"\", width: 0, height: 0 }}\n name={product.title}\n description={product.description}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalState}\n groupIsActive={groupIsActive}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n isStaticProduct={productsArrayIndex === 0}\n isOverviewPage={isOverviewPage}\n />\n );\n })}\n </S.ProductList>\n </S.ProductGroupProductListContainer>\n </S.Container>\n </S.Wrapper>\n );\n};\n"],"names":["CHECK_FOR_SCROLL_TIMEOUT","ProductList","products","selectedProducts","setSelectedProducts","hasBeenObserved","selectedProductsLimit","initialActiveGroup","setExternalState","showProductGroups","isOverviewPage","groupedGroups","useMemo","groupProducts","moreThanOneGroupExists","length","containerRef","useRef","productListRef","buttonHasBeenClick","setButtonHasBeenClicked","useState","activeGroup","setActiveGroup","playAnimation","setPlayAnimation","isHovering","useHoverDirty","isDragging","setIsDragging","overflowExists","setOverflowExists","endPosition","setEndPosition","useEffectOnce","refsExist","current","getBoundingClientRect","width","useEffect","productListGroup","id","productListInitialPosition","left","timeoutId","setTimeout","currentPosition","clearTimeout","dragStartingPosition","scrollAmount","dragHandler","useCallback","event","clientX","scrollTo","mouseUpHandler","scrollLeft","document","removeEventListener","mouseDownHandler","buttons","addEventListener","container","isScrolling","checkIsScrolling","window","tabClickHandler","groupId","initialScrollPosition","checkForScroll","currentScrollPosition","element","getElementById","scrollIntoView","behavior","inline","block","scrollButtonHandler","isLeftArrow","scrollLength","S.PRODUCT_CARD_WIDTH","PRODUCT_CARD_WIDTH","S.PRODUCT_LIST_GRID_GAP","PRODUCT_LIST_GRID_GAP","isMaxLeft","isMaxRight","useIsAtMaxScroll","jsxs","S.Wrapper","children","jsx","ButtonGroup","items","map","group","activeButton","onClick","S.Container","Container","ref","$isHovering","$moreThanOneGroupExists","$isDragging","S.ProductGroupProductListContainer","ProductGroups","canPlayAniimation","S.ProductList","$columns","$overflowExists","onMouseDown","onMouseUp","ScrollButton","color","rotationDegrees","isVisible","isRightButton","product","productsArrayIndex","groupIsActive","filter","groupIndex","findIndex","item","Product","groupLength","image","src","height","name","title","description","isStaticProduct"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMA,wBAA2B,GAAA,GAAA;AAE1B,MAAMC,cAAcA,CAAC;EAC1BC,QAAA;EACAC,gBAAA;EACAC,mBAAA;EACAC,eAAA;EACAC,qBAAA;EACAC,kBAAA;EACAC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,CAAAA,GAAA,CAACiC,OAAA,CAAAA,OAAA,EAAA;cACC3B,SAASA,CAAA,KACPzE,cAAA,CACE6F,QAAQ5E,gBAAkB,EAAAC,EAC5B,CAAA;cAGF+E,UAAA;cACAI,aAAapF,gBAAiB,CAAAzB,MAAA;cAC9B0B,IAAI2E,OAAS,EAAA3E,EAAA;cACb0B,OAAA,EAASiD,QAAQ5E,gBAAkB,EAAAC,EAAA;cACnCoF,KAAA,EAAOT,QAAQS,KAAS,IAAA;gBAAEC,KAAK,EAAI;gBAAAxF,KAAA,EAAO,CAAG;gBAAAyF,MAAA,EAAQ;cAAE,CAAA;cACvDC,MAAMZ,OAAQ,CAAAa,KAAA;cACdC,aAAad,OAAQ,CAAAc,WAAA;cACrB/H,gBAAA;cACAC,mBAAA;cACAI,gBAAA;cACA8G,aAAA;cACA9F,aAAA;cACAiF,mBAAmBpG,eAAmB,IAAAc,kBAAA;cACtCb,qBAAA;cACAG,iBAAA;cACA0H,iBAAiBd,kBAAuB,KAAA,CAAA;cACxC3G;YAAA,CAAA,EAjBK0G,OAAQ,CAAA3E,EAkBf,CAAA;UAEH,CAAA,CAAA;QAAA,CAAA,CAAA;MAEL,CAAA;IAAA,CAAA,CAAA;GAEJ,CAAA;AAEJ,CAAA;"}
1
+ {"version":3,"file":"ProductList.js","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useEffectOnce, useHoverDirty } from \"react-use\";\n\nimport type {\n ProductId,\n ProductListGroupId,\n} from \"../../../constants/modelCompareData/types\";\nimport { ButtonGroup } from \"./components/ButtonGroup\";\nimport { Product } from \"./components/Product/Product\";\nimport { groupProducts } from \"./components/ProductGroups/groupProducts\";\nimport { ProductGroups } from \"./components/ProductGroups/ProductGroups\";\nimport { ScrollButton } from \"./components/ScrollButton/ScrollButton\";\nimport * as S from \"./ProductList.styles\";\nimport type { ProductListProps } from \"./ProductList.types\";\nimport { useIsAtMaxScroll } from \"./useIsAtMaxScroll\";\n\nconst CHECK_FOR_SCROLL_TIMEOUT = 150;\n\nexport const ProductList = ({\n products,\n selectedProducts,\n setSelectedProducts,\n hasBeenObserved,\n selectedProductsLimit,\n initialActiveGroup,\n setExternalState,\n showProductGroups,\n isOverviewPage,\n}: ProductListProps) => {\n const groupedGroups = useMemo(() => groupProducts(products), [products]);\n const moreThanOneGroupExists = groupedGroups.length > 1;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const productListRef = useRef<HTMLDivElement>(null);\n\n const [buttonHasBeenClick, setButtonHasBeenClicked] = useState(false);\n const [activeGroup, setActiveGroup] = useState(initialActiveGroup);\n const [playAnimation, setPlayAnimation] = useState(false);\n const isHovering = useHoverDirty(containerRef);\n const [isDragging, setIsDragging] = useState(false);\n const [overflowExists, setOverflowExists] = useState(true);\n const [endPosition, setEndPosition] = useState<number>(0);\n\n useEffectOnce(() => {\n const refsExist = containerRef.current && productListRef.current;\n if (\n refsExist &&\n containerRef.current?.getBoundingClientRect().width <\n productListRef.current?.getBoundingClientRect().width\n ) {\n setOverflowExists(true);\n } else {\n setOverflowExists(false);\n }\n });\n\n // TODO: figure out how to remove this TODO. Currently, without this `useEffect` `activeGroup` isn't updating when toggling between different tables (`Section`s).\n // ModelCompareV4 is sometimes used to toggle between sets of data of type Section. In this situation, we need the initial active group to be updated when the new data is passed to ModelCompareV4\n useEffect(() => {\n setActiveGroup(products[0]?.productListGroup?.id as ProductListGroupId);\n }, [products]);\n\n // #############################################################################\n // Scroll-Specific useEffects\n // #############################################################################\n\n // if there aren't any product list group buttons then the ending state of the animations need to exist on the initial render\n useEffect(() => {\n if (!showProductGroups && hasBeenObserved) {\n setPlayAnimation(true);\n }\n }, [hasBeenObserved, setPlayAnimation, showProductGroups]);\n\n // plays animation when no scroll has occurred on the initial observe\n useEffect(() => {\n const productListInitialPosition =\n productListRef.current?.getBoundingClientRect().left;\n\n let timeoutId: NodeJS.Timeout;\n\n if (hasBeenObserved || buttonHasBeenClick) {\n timeoutId = setTimeout(() => {\n const currentPosition =\n productListRef.current?.getBoundingClientRect().left;\n if (productListInitialPosition === currentPosition) {\n return setPlayAnimation(true);\n }\n }, CHECK_FOR_SCROLL_TIMEOUT);\n }\n\n return () => {\n clearTimeout(timeoutId);\n };\n }, [hasBeenObserved, setPlayAnimation, buttonHasBeenClick]);\n\n // #############################################################################\n // Drag Logic\n // #############################################################################\n const dragStartingPosition = useRef(0);\n const scrollAmount = useRef(0);\n\n const dragHandler = useCallback(\n (event: MouseEvent) => {\n scrollAmount.current = dragStartingPosition.current - event.clientX;\n containerRef.current?.scrollTo(endPosition + scrollAmount.current, 0);\n },\n [endPosition],\n );\n\n const mouseUpHandler = useCallback(() => {\n setIsDragging(false);\n setEndPosition(containerRef.current?.scrollLeft ?? 0);\n document.removeEventListener(\"mousemove\", dragHandler);\n document.removeEventListener(\"mouseup\", mouseUpHandler);\n }, [dragHandler]);\n\n const mouseDownHandler = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>) => {\n if (event.buttons === 1) {\n dragStartingPosition.current = event.clientX;\n setIsDragging(true);\n document.addEventListener(\"mousemove\", dragHandler);\n document.addEventListener(\"mouseup\", mouseUpHandler);\n }\n },\n [dragHandler, mouseUpHandler],\n );\n\n useEffect(() => {\n const container = containerRef.current;\n\n if (!container) return;\n\n let isScrolling: NodeJS.Timeout;\n\n const checkIsScrolling = () => {\n window.clearTimeout(isScrolling);\n\n // if scrolling occurs, animations are played after scrolling has completed\n // if scrolling occurs, the container's end position is tracked in state after scrolling has completed\n isScrolling = setTimeout(function () {\n setPlayAnimation(true);\n setEndPosition(containerRef.current?.scrollLeft as number);\n }, CHECK_FOR_SCROLL_TIMEOUT);\n };\n\n (containerRef.current as HTMLDivElement).addEventListener(\n \"scroll\",\n checkIsScrolling,\n );\n\n return () => {\n window.removeEventListener(\"resize\", checkIsScrolling);\n };\n }, []); // Empty dependency array since we want this to run once\n\n // #############################################################################\n // Click to Scroll Logic\n // #############################################################################\n\n const tabClickHandler = useCallback(\n ({ groupId }: { groupId: ProductListGroupId }) => {\n const initialScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n const checkForScroll = () => {\n const currentScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n return currentScrollPosition === initialScrollPosition;\n };\n\n const element = document.getElementById(groupId) as HTMLDivElement;\n\n setPlayAnimation(false);\n setActiveGroup(groupId);\n setButtonHasBeenClicked(true);\n element?.scrollIntoView({\n behavior: \"smooth\",\n inline: \"start\",\n block: \"nearest\",\n });\n\n // if no scroll occurs animations are played\n setTimeout(() => {\n if (checkForScroll()) {\n setPlayAnimation(true);\n }\n }, CHECK_FOR_SCROLL_TIMEOUT);\n },\n [containerRef, setPlayAnimation, setActiveGroup],\n );\n\n const scrollButtonHandler = ({ isLeftArrow }: { isLeftArrow?: boolean }) => {\n if (containerRef.current) {\n const currentScrollPosition = containerRef.current?.scrollLeft;\n\n const scrollLength = isLeftArrow\n ? currentScrollPosition - S.PRODUCT_CARD_WIDTH - S.PRODUCT_LIST_GRID_GAP\n : currentScrollPosition +\n S.PRODUCT_CARD_WIDTH +\n S.PRODUCT_LIST_GRID_GAP;\n\n containerRef.current?.scrollTo(scrollLength, 0);\n }\n };\n\n const { isMaxLeft, isMaxRight } = useIsAtMaxScroll(containerRef);\n\n return (\n <S.Wrapper>\n {showProductGroups && moreThanOneGroupExists && (\n <ButtonGroup\n items={groupedGroups.map((group) => group.productListGroup)}\n activeButton={activeGroup as string}\n onClick={(id) => {\n tabClickHandler({ groupId: id as ProductListGroupId });\n }}\n />\n )}\n <S.Container\n ref={containerRef}\n $isHovering={isHovering}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n $isDragging={isDragging}\n >\n <S.ProductGroupProductListContainer>\n {moreThanOneGroupExists && (\n <ProductGroups\n products={products}\n activeGroup={activeGroup as ProductListGroupId}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n showProductGroups={showProductGroups}\n />\n )}\n <S.ProductList\n $columns={products.length}\n $isDragging={isDragging}\n $overflowExists={overflowExists}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n onMouseDown={(event) => mouseDownHandler(event)}\n onMouseUp={mouseUpHandler}\n ref={productListRef}\n >\n <ScrollButton\n color=\"white\"\n rotationDegrees={180}\n isVisible={!isMaxLeft}\n onClick={() => scrollButtonHandler({ isLeftArrow: true })}\n />\n <ScrollButton\n color=\"white\"\n rotationDegrees={0}\n isVisible={isMaxRight}\n isRightButton\n onClick={() => scrollButtonHandler({ isLeftArrow: false })}\n />\n {products.map((product, productsArrayIndex) => {\n const groupIsActive =\n product.productListGroup?.id === activeGroup;\n\n const productListGroup = products.filter(\n (product) => activeGroup === product.productListGroup?.id,\n );\n\n const groupIndex = productListGroup.findIndex(\n (item) => item.id === product.id,\n );\n\n return (\n <Product\n onClick={() =>\n setActiveGroup(\n product.productListGroup?.id as ProductListGroupId,\n )\n }\n key={product.id}\n groupIndex={groupIndex}\n groupLength={productListGroup.length}\n id={product?.id as ProductId}\n groupId={product.productListGroup?.id as ProductListGroupId}\n image={product.image ?? { src: \"\", width: 0, height: 0 }}\n name={product.title}\n description={product.description}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalState}\n groupIsActive={groupIsActive}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n isStaticProduct={productsArrayIndex === 0}\n isOverviewPage={isOverviewPage}\n />\n );\n })}\n </S.ProductList>\n </S.ProductGroupProductListContainer>\n </S.Container>\n </S.Wrapper>\n );\n};\n"],"names":["CHECK_FOR_SCROLL_TIMEOUT","ProductList","products","selectedProducts","setSelectedProducts","hasBeenObserved","selectedProductsLimit","initialActiveGroup","setExternalState","showProductGroups","isOverviewPage","groupedGroups","useMemo","groupProducts","moreThanOneGroupExists","length","containerRef","useRef","productListRef","buttonHasBeenClick","setButtonHasBeenClicked","useState","activeGroup","setActiveGroup","playAnimation","setPlayAnimation","isHovering","useHoverDirty","isDragging","setIsDragging","overflowExists","setOverflowExists","endPosition","setEndPosition","useEffectOnce","refsExist","current","getBoundingClientRect","width","useEffect","productListGroup","id","productListInitialPosition","left","timeoutId","setTimeout","currentPosition","clearTimeout","dragStartingPosition","scrollAmount","dragHandler","useCallback","event","clientX","scrollTo","mouseUpHandler","scrollLeft","document","removeEventListener","mouseDownHandler","buttons","addEventListener","container","isScrolling","checkIsScrolling","window","tabClickHandler","groupId","initialScrollPosition","checkForScroll","currentScrollPosition","element","getElementById","scrollIntoView","behavior","inline","block","scrollButtonHandler","isLeftArrow","scrollLength","S.PRODUCT_CARD_WIDTH","PRODUCT_CARD_WIDTH","S.PRODUCT_LIST_GRID_GAP","PRODUCT_LIST_GRID_GAP","isMaxLeft","isMaxRight","useIsAtMaxScroll","jsxs","S.Wrapper","children","jsx","ButtonGroup","items","map","group","activeButton","onClick","S.Container","Container","ref","$isHovering","$moreThanOneGroupExists","$isDragging","S.ProductGroupProductListContainer","ProductGroups","canPlayAniimation","S.ProductList","$columns","$overflowExists","onMouseDown","onMouseUp","ScrollButton","color","rotationDegrees","isVisible","isRightButton","product","productsArrayIndex","groupIsActive","filter","groupIndex","findIndex","item","Product","groupLength","image","src","height","name","title","description","isStaticProduct"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMA,wBAA2B,GAAA,GAAA;AAE1B,MAAMC,cAAcA,CAAC;EAC1BC,QAAA;EACAC,gBAAA;EACAC,mBAAA;EACAC,eAAA;EACAC,qBAAA;EACAC,kBAAA;EACAC,gBAAA;EACAC,iBAAA;EACAC;AACF,CAAwB,KAAA;EAChB,MAAAC,aAAA,GAAgBC,KAAAA,CAAAA,QAAQ,MAAMC,aAAAA,CAAAA,aAAA,CAAcX,QAAQ,CAAG,EAAA,CAACA,QAAQ,CAAC,CAAA;EACjE,MAAAY,sBAAA,GAAyBH,cAAcI,MAAS,GAAA,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A;cACrB/H,gBAAA;cACAC,mBAAA;cACAI,gBAAA;cACA8G,aAAA;cACA9F,aAAA;cACAiF,mBAAmBpG,eAAmB,IAAAc,kBAAA;cACtCb,qBAAA;cACAG,iBAAA;cACA0H,iBAAiBd,kBAAuB,KAAA,CAAA;cACxC3G;YAAA,CAAA,EAjBK0G,OAAQ,CAAA3E,EAkBf,CAAA;UAEH,CAAA,CAAA;QAAA,CAAA,CAAA;MAEL,CAAA;IAAA,CAAA,CAAA;GAEJ,CAAA;AAEJ,CAAA;"}
@@ -84,12 +84,6 @@ const ProductList = ({
84
84
  document.addEventListener("mouseup", mouseUpHandler);
85
85
  }
86
86
  }, [dragHandler, mouseUpHandler]);
87
- useEffect(() => {
88
- return () => {
89
- document.removeEventListener("mousemove", dragHandler);
90
- document.removeEventListener("mouseup", mouseUpHandler);
91
- };
92
- }, [dragHandler, mouseUpHandler]);
93
87
  useEffect(() => {
94
88
  const container = containerRef.current;
95
89
  if (!container) return;
@@ -1 +1 @@
1
- {"version":3,"file":"ProductList.mjs","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useEffectOnce, useHoverDirty } from \"react-use\";\n\nimport type {\n ProductId,\n ProductListGroupId,\n} from \"../../../constants/modelCompareData/types\";\nimport { ButtonGroup } from \"./components/ButtonGroup\";\nimport { Product } from \"./components/Product/Product\";\nimport { groupProducts } from \"./components/ProductGroups/groupProducts\";\nimport { ProductGroups } from \"./components/ProductGroups/ProductGroups\";\nimport { ScrollButton } from \"./components/ScrollButton/ScrollButton\";\nimport * as S from \"./ProductList.styles\";\nimport type { ProductListProps } from \"./ProductList.types\";\nimport { useIsAtMaxScroll } from \"./useIsAtMaxScroll\";\n\nconst CHECK_FOR_SCROLL_TIMEOUT = 150;\n\nexport const ProductList = ({\n products,\n selectedProducts,\n setSelectedProducts,\n hasBeenObserved,\n selectedProductsLimit,\n initialActiveGroup,\n setExternalState,\n showProductGroups,\n isOverviewPage,\n}: ProductListProps) => {\n const groupedGroups = useMemo(() => groupProducts(products), [products]);\n const moreThanOneGroupExists = groupedGroups.length > 1;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const productListRef = useRef<HTMLDivElement>(null);\n\n const [buttonHasBeenClick, setButtonHasBeenClicked] = useState(false);\n const [activeGroup, setActiveGroup] = useState(initialActiveGroup);\n const [playAnimation, setPlayAnimation] = useState(false);\n const isHovering = useHoverDirty(containerRef);\n const [isDragging, setIsDragging] = useState(false);\n const [overflowExists, setOverflowExists] = useState(true);\n const [endPosition, setEndPosition] = useState<number>(0);\n\n useEffectOnce(() => {\n const refsExist = containerRef.current && productListRef.current;\n if (\n refsExist &&\n containerRef.current?.getBoundingClientRect().width <\n productListRef.current?.getBoundingClientRect().width\n ) {\n setOverflowExists(true);\n } else {\n setOverflowExists(false);\n }\n });\n\n // TODO: figure out how to remove this TODO. Currently, without this `useEffect` `activeGroup` isn't updating when toggling between different tables (`Section`s).\n // ModelCompareV4 is sometimes used to toggle between sets of data of type Section. In this situation, we need the initial active group to be updated when the new data is passed to ModelCompareV4\n useEffect(() => {\n setActiveGroup(products[0]?.productListGroup?.id as ProductListGroupId);\n }, [products]);\n\n // #############################################################################\n // Scroll-Specific useEffects\n // #############################################################################\n\n // if there aren't any product list group buttons then the ending state of the animations need to exist on the initial render\n useEffect(() => {\n if (!showProductGroups && hasBeenObserved) {\n setPlayAnimation(true);\n }\n }, [hasBeenObserved, setPlayAnimation, showProductGroups]);\n\n // plays animation when no scroll has occurred on the initial observe\n useEffect(() => {\n const productListInitialPosition =\n productListRef.current?.getBoundingClientRect().left;\n\n let timeoutId: NodeJS.Timeout;\n\n if (hasBeenObserved || buttonHasBeenClick) {\n timeoutId = setTimeout(() => {\n const currentPosition =\n productListRef.current?.getBoundingClientRect().left;\n if (productListInitialPosition === currentPosition) {\n return setPlayAnimation(true);\n }\n }, CHECK_FOR_SCROLL_TIMEOUT);\n }\n\n return () => {\n clearTimeout(timeoutId);\n };\n }, [hasBeenObserved, setPlayAnimation, buttonHasBeenClick]);\n\n // #############################################################################\n // Drag Logic\n // #############################################################################\n const dragStartingPosition = useRef(0);\n const scrollAmount = useRef(0);\n\n const dragHandler = useCallback(\n (event: MouseEvent) => {\n scrollAmount.current = dragStartingPosition.current - event.clientX;\n containerRef.current?.scrollTo(endPosition + scrollAmount.current, 0);\n },\n [endPosition],\n );\n\n const mouseUpHandler = useCallback(() => {\n setIsDragging(false);\n setEndPosition(containerRef.current?.scrollLeft ?? 0);\n document.removeEventListener(\"mousemove\", dragHandler);\n document.removeEventListener(\"mouseup\", mouseUpHandler);\n }, [dragHandler]);\n\n const mouseDownHandler = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>) => {\n if (event.buttons === 1) {\n dragStartingPosition.current = event.clientX;\n setIsDragging(true);\n document.addEventListener(\"mousemove\", dragHandler);\n document.addEventListener(\"mouseup\", mouseUpHandler);\n }\n },\n [dragHandler, mouseUpHandler],\n );\n\n // Add cleanup for drag handlers on unmount\n useEffect(() => {\n return () => {\n document.removeEventListener(\"mousemove\", dragHandler);\n document.removeEventListener(\"mouseup\", mouseUpHandler);\n };\n }, [dragHandler, mouseUpHandler]);\n\n useEffect(() => {\n const container = containerRef.current;\n\n if (!container) return;\n\n let isScrolling: NodeJS.Timeout;\n\n const checkIsScrolling = () => {\n window.clearTimeout(isScrolling);\n\n // if scrolling occurs, animations are played after scrolling has completed\n // if scrolling occurs, the container's end position is tracked in state after scrolling has completed\n isScrolling = setTimeout(function () {\n setPlayAnimation(true);\n setEndPosition(containerRef.current?.scrollLeft as number);\n }, CHECK_FOR_SCROLL_TIMEOUT);\n };\n\n (containerRef.current as HTMLDivElement).addEventListener(\n \"scroll\",\n checkIsScrolling,\n );\n\n return () => {\n window.removeEventListener(\"resize\", checkIsScrolling);\n };\n }, []); // Empty dependency array since we want this to run once\n\n // #############################################################################\n // Click to Scroll Logic\n // #############################################################################\n\n const tabClickHandler = useCallback(\n ({ groupId }: { groupId: ProductListGroupId }) => {\n const initialScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n const checkForScroll = () => {\n const currentScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n return currentScrollPosition === initialScrollPosition;\n };\n\n const element = document.getElementById(groupId) as HTMLDivElement;\n\n setPlayAnimation(false);\n setActiveGroup(groupId);\n setButtonHasBeenClicked(true);\n element?.scrollIntoView({\n behavior: \"smooth\",\n inline: \"start\",\n block: \"nearest\",\n });\n\n // if no scroll occurs animations are played\n setTimeout(() => {\n if (checkForScroll()) {\n setPlayAnimation(true);\n }\n }, CHECK_FOR_SCROLL_TIMEOUT);\n },\n [containerRef, setPlayAnimation, setActiveGroup],\n );\n\n const scrollButtonHandler = ({ isLeftArrow }: { isLeftArrow?: boolean }) => {\n if (containerRef.current) {\n const currentScrollPosition = containerRef.current?.scrollLeft;\n\n const scrollLength = isLeftArrow\n ? currentScrollPosition - S.PRODUCT_CARD_WIDTH - S.PRODUCT_LIST_GRID_GAP\n : currentScrollPosition +\n S.PRODUCT_CARD_WIDTH +\n S.PRODUCT_LIST_GRID_GAP;\n\n containerRef.current?.scrollTo(scrollLength, 0);\n }\n };\n\n const { isMaxLeft, isMaxRight } = useIsAtMaxScroll(containerRef);\n\n return (\n <S.Wrapper>\n {showProductGroups && moreThanOneGroupExists && (\n <ButtonGroup\n items={groupedGroups.map((group) => group.productListGroup)}\n activeButton={activeGroup as string}\n onClick={(id) => {\n tabClickHandler({ groupId: id as ProductListGroupId });\n }}\n />\n )}\n <S.Container\n ref={containerRef}\n $isHovering={isHovering}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n $isDragging={isDragging}\n >\n <S.ProductGroupProductListContainer>\n {moreThanOneGroupExists && (\n <ProductGroups\n products={products}\n activeGroup={activeGroup as ProductListGroupId}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n showProductGroups={showProductGroups}\n />\n )}\n <S.ProductList\n $columns={products.length}\n $isDragging={isDragging}\n $overflowExists={overflowExists}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n onMouseDown={(event) => mouseDownHandler(event)}\n onMouseUp={mouseUpHandler}\n ref={productListRef}\n >\n <ScrollButton\n color=\"white\"\n rotationDegrees={180}\n isVisible={!isMaxLeft}\n onClick={() => scrollButtonHandler({ isLeftArrow: true })}\n />\n <ScrollButton\n color=\"white\"\n rotationDegrees={0}\n isVisible={isMaxRight}\n isRightButton\n onClick={() => scrollButtonHandler({ isLeftArrow: false })}\n />\n {products.map((product, productsArrayIndex) => {\n const groupIsActive =\n product.productListGroup?.id === activeGroup;\n\n const productListGroup = products.filter(\n (product) => activeGroup === product.productListGroup?.id,\n );\n\n const groupIndex = productListGroup.findIndex(\n (item) => item.id === product.id,\n );\n\n return (\n <Product\n onClick={() =>\n setActiveGroup(\n product.productListGroup?.id as ProductListGroupId,\n )\n }\n key={product.id}\n groupIndex={groupIndex}\n groupLength={productListGroup.length}\n id={product?.id as ProductId}\n groupId={product.productListGroup?.id as ProductListGroupId}\n image={product.image ?? { src: \"\", width: 0, height: 0 }}\n name={product.title}\n description={product.description}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalState}\n groupIsActive={groupIsActive}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n isStaticProduct={productsArrayIndex === 0}\n isOverviewPage={isOverviewPage}\n />\n );\n })}\n </S.ProductList>\n </S.ProductGroupProductListContainer>\n </S.Container>\n </S.Wrapper>\n );\n};\n"],"names":["CHECK_FOR_SCROLL_TIMEOUT","ProductList","products","selectedProducts","setSelectedProducts","hasBeenObserved","selectedProductsLimit","initialActiveGroup","setExternalState","showProductGroups","isOverviewPage","groupedGroups","useMemo","groupProducts","moreThanOneGroupExists","length","containerRef","useRef","productListRef","buttonHasBeenClick","setButtonHasBeenClicked","useState","activeGroup","setActiveGroup","playAnimation","setPlayAnimation","isHovering","useHoverDirty","isDragging","setIsDragging","overflowExists","setOverflowExists","endPosition","setEndPosition","useEffectOnce","refsExist","current","getBoundingClientRect","width","useEffect","productListGroup","id","productListInitialPosition","left","timeoutId","setTimeout","currentPosition","clearTimeout","dragStartingPosition","scrollAmount","dragHandler","useCallback","event","clientX","scrollTo","mouseUpHandler","scrollLeft","document","removeEventListener","mouseDownHandler","buttons","addEventListener","container","isScrolling","checkIsScrolling","window","tabClickHandler","groupId","initialScrollPosition","checkForScroll","currentScrollPosition","element","getElementById","scrollIntoView","behavior","inline","block","scrollButtonHandler","isLeftArrow","scrollLength","S.PRODUCT_CARD_WIDTH","S.PRODUCT_LIST_GRID_GAP","isMaxLeft","isMaxRight","useIsAtMaxScroll","jsxs","S.Wrapper","children","jsx","ButtonGroup","items","map","group","activeButton","onClick","S.Container","ref","$isHovering","$moreThanOneGroupExists","$isDragging","S.ProductGroupProductListContainer","ProductGroups","canPlayAniimation","S.ProductList","$columns","$overflowExists","onMouseDown","onMouseUp","ScrollButton","color","rotationDegrees","isVisible","isRightButton","product","productsArrayIndex","groupIsActive","filter","groupIndex","findIndex","item","Product","groupLength","image","src","height","name","title","description","isStaticProduct"],"mappings":";;;;;;;;;;;;AAgBA,MAAMA,wBAA2B,GAAA,GAAA;AAE1B,MAAMC,cAAcA,CAAC;EAC1BC,QAAA;EACAC,gBAAA;EACAC,mBAAA;EACAC,eAAA;EACAC,qBAAA;EACAC,kBAAA;EACAC,gBAAA;EACAC,iBAAA;EACAC;AACF,CAAwB,KAAA;EAChB,MAAAC,aAAA,GAAgBC,QAAQ,MAAMC,aAAA,CAAcX,QAAQ,CAAG,EAAA,CAACA,QAAQ,CAAC,CAAA;EACjE,MAAAY,sBAAA,GAAyBH,cAAcI,MAAS,GAAA,CAAA;EAEhD,MAAAC,YAAA,GAAeC,OAAuB,IAAI,CAAA;EAC1C,MAAAC,cAAA,GAAiBD,OAAuB,IAAI,CAAA;EAElD,M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ProductList.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useEffectOnce, useHoverDirty } from \"react-use\";\n\nimport type {\n ProductId,\n ProductListGroupId,\n} from \"../../../constants/modelCompareData/types\";\nimport { ButtonGroup } from \"./components/ButtonGroup\";\nimport { Product } from \"./components/Product/Product\";\nimport { groupProducts } from \"./components/ProductGroups/groupProducts\";\nimport { ProductGroups } from \"./components/ProductGroups/ProductGroups\";\nimport { ScrollButton } from \"./components/ScrollButton/ScrollButton\";\nimport * as S from \"./ProductList.styles\";\nimport type { ProductListProps } from \"./ProductList.types\";\nimport { useIsAtMaxScroll } from \"./useIsAtMaxScroll\";\n\nconst CHECK_FOR_SCROLL_TIMEOUT = 150;\n\nexport const ProductList = ({\n products,\n selectedProducts,\n setSelectedProducts,\n hasBeenObserved,\n selectedProductsLimit,\n initialActiveGroup,\n setExternalState,\n showProductGroups,\n isOverviewPage,\n}: ProductListProps) => {\n const groupedGroups = useMemo(() => groupProducts(products), [products]);\n const moreThanOneGroupExists = groupedGroups.length > 1;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const productListRef = useRef<HTMLDivElement>(null);\n\n const [buttonHasBeenClick, setButtonHasBeenClicked] = useState(false);\n const [activeGroup, setActiveGroup] = useState(initialActiveGroup);\n const [playAnimation, setPlayAnimation] = useState(false);\n const isHovering = useHoverDirty(containerRef);\n const [isDragging, setIsDragging] = useState(false);\n const [overflowExists, setOverflowExists] = useState(true);\n const [endPosition, setEndPosition] = useState<number>(0);\n\n useEffectOnce(() => {\n const refsExist = containerRef.current && productListRef.current;\n if (\n refsExist &&\n containerRef.current?.getBoundingClientRect().width <\n productListRef.current?.getBoundingClientRect().width\n ) {\n setOverflowExists(true);\n } else {\n setOverflowExists(false);\n }\n });\n\n // TODO: figure out how to remove this TODO. Currently, without this `useEffect` `activeGroup` isn't updating when toggling between different tables (`Section`s).\n // ModelCompareV4 is sometimes used to toggle between sets of data of type Section. In this situation, we need the initial active group to be updated when the new data is passed to ModelCompareV4\n useEffect(() => {\n setActiveGroup(products[0]?.productListGroup?.id as ProductListGroupId);\n }, [products]);\n\n // #############################################################################\n // Scroll-Specific useEffects\n // #############################################################################\n\n // if there aren't any product list group buttons then the ending state of the animations need to exist on the initial render\n useEffect(() => {\n if (!showProductGroups && hasBeenObserved) {\n setPlayAnimation(true);\n }\n }, [hasBeenObserved, setPlayAnimation, showProductGroups]);\n\n // plays animation when no scroll has occurred on the initial observe\n useEffect(() => {\n const productListInitialPosition =\n productListRef.current?.getBoundingClientRect().left;\n\n let timeoutId: NodeJS.Timeout;\n\n if (hasBeenObserved || buttonHasBeenClick) {\n timeoutId = setTimeout(() => {\n const currentPosition =\n productListRef.current?.getBoundingClientRect().left;\n if (productListInitialPosition === currentPosition) {\n return setPlayAnimation(true);\n }\n }, CHECK_FOR_SCROLL_TIMEOUT);\n }\n\n return () => {\n clearTimeout(timeoutId);\n };\n }, [hasBeenObserved, setPlayAnimation, buttonHasBeenClick]);\n\n // #############################################################################\n // Drag Logic\n // #############################################################################\n const dragStartingPosition = useRef(0);\n const scrollAmount = useRef(0);\n\n const dragHandler = useCallback(\n (event: MouseEvent) => {\n scrollAmount.current = dragStartingPosition.current - event.clientX;\n containerRef.current?.scrollTo(endPosition + scrollAmount.current, 0);\n },\n [endPosition],\n );\n\n const mouseUpHandler = useCallback(() => {\n setIsDragging(false);\n setEndPosition(containerRef.current?.scrollLeft ?? 0);\n document.removeEventListener(\"mousemove\", dragHandler);\n document.removeEventListener(\"mouseup\", mouseUpHandler);\n }, [dragHandler]);\n\n const mouseDownHandler = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>) => {\n if (event.buttons === 1) {\n dragStartingPosition.current = event.clientX;\n setIsDragging(true);\n document.addEventListener(\"mousemove\", dragHandler);\n document.addEventListener(\"mouseup\", mouseUpHandler);\n }\n },\n [dragHandler, mouseUpHandler],\n );\n\n useEffect(() => {\n const container = containerRef.current;\n\n if (!container) return;\n\n let isScrolling: NodeJS.Timeout;\n\n const checkIsScrolling = () => {\n window.clearTimeout(isScrolling);\n\n // if scrolling occurs, animations are played after scrolling has completed\n // if scrolling occurs, the container's end position is tracked in state after scrolling has completed\n isScrolling = setTimeout(function () {\n setPlayAnimation(true);\n setEndPosition(containerRef.current?.scrollLeft as number);\n }, CHECK_FOR_SCROLL_TIMEOUT);\n };\n\n (containerRef.current as HTMLDivElement).addEventListener(\n \"scroll\",\n checkIsScrolling,\n );\n\n return () => {\n window.removeEventListener(\"resize\", checkIsScrolling);\n };\n }, []); // Empty dependency array since we want this to run once\n\n // #############################################################################\n // Click to Scroll Logic\n // #############################################################################\n\n const tabClickHandler = useCallback(\n ({ groupId }: { groupId: ProductListGroupId }) => {\n const initialScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n const checkForScroll = () => {\n const currentScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n return currentScrollPosition === initialScrollPosition;\n };\n\n const element = document.getElementById(groupId) as HTMLDivElement;\n\n setPlayAnimation(false);\n setActiveGroup(groupId);\n setButtonHasBeenClicked(true);\n element?.scrollIntoView({\n behavior: \"smooth\",\n inline: \"start\",\n block: \"nearest\",\n });\n\n // if no scroll occurs animations are played\n setTimeout(() => {\n if (checkForScroll()) {\n setPlayAnimation(true);\n }\n }, CHECK_FOR_SCROLL_TIMEOUT);\n },\n [containerRef, setPlayAnimation, setActiveGroup],\n );\n\n const scrollButtonHandler = ({ isLeftArrow }: { isLeftArrow?: boolean }) => {\n if (containerRef.current) {\n const currentScrollPosition = containerRef.current?.scrollLeft;\n\n const scrollLength = isLeftArrow\n ? currentScrollPosition - S.PRODUCT_CARD_WIDTH - S.PRODUCT_LIST_GRID_GAP\n : currentScrollPosition +\n S.PRODUCT_CARD_WIDTH +\n S.PRODUCT_LIST_GRID_GAP;\n\n containerRef.current?.scrollTo(scrollLength, 0);\n }\n };\n\n const { isMaxLeft, isMaxRight } = useIsAtMaxScroll(containerRef);\n\n return (\n <S.Wrapper>\n {showProductGroups && moreThanOneGroupExists && (\n <ButtonGroup\n items={groupedGroups.map((group) => group.productListGroup)}\n activeButton={activeGroup as string}\n onClick={(id) => {\n tabClickHandler({ groupId: id as ProductListGroupId });\n }}\n />\n )}\n <S.Container\n ref={containerRef}\n $isHovering={isHovering}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n $isDragging={isDragging}\n >\n <S.ProductGroupProductListContainer>\n {moreThanOneGroupExists && (\n <ProductGroups\n products={products}\n activeGroup={activeGroup as ProductListGroupId}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n showProductGroups={showProductGroups}\n />\n )}\n <S.ProductList\n $columns={products.length}\n $isDragging={isDragging}\n $overflowExists={overflowExists}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n onMouseDown={(event) => mouseDownHandler(event)}\n onMouseUp={mouseUpHandler}\n ref={productListRef}\n >\n <ScrollButton\n color=\"white\"\n rotationDegrees={180}\n isVisible={!isMaxLeft}\n onClick={() => scrollButtonHandler({ isLeftArrow: true })}\n />\n <ScrollButton\n color=\"white\"\n rotationDegrees={0}\n isVisible={isMaxRight}\n isRightButton\n onClick={() => scrollButtonHandler({ isLeftArrow: false })}\n />\n {products.map((product, productsArrayIndex) => {\n const groupIsActive =\n product.productListGroup?.id === activeGroup;\n\n const productListGroup = products.filter(\n (product) => activeGroup === product.productListGroup?.id,\n );\n\n const groupIndex = productListGroup.findIndex(\n (item) => item.id === product.id,\n );\n\n return (\n <Product\n onClick={() =>\n setActiveGroup(\n product.productListGroup?.id as ProductListGroupId,\n )\n }\n key={product.id}\n groupIndex={groupIndex}\n groupLength={productListGroup.length}\n id={product?.id as ProductId}\n groupId={product.productListGroup?.id as ProductListGroupId}\n image={product.image ?? { src: \"\", width: 0, height: 0 }}\n name={product.title}\n description={product.description}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalState}\n groupIsActive={groupIsActive}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n isStaticProduct={productsArrayIndex === 0}\n isOverviewPage={isOverviewPage}\n />\n );\n })}\n </S.ProductList>\n </S.ProductGroupProductListContainer>\n </S.Container>\n </S.Wrapper>\n );\n};\n"],"names":["CHECK_FOR_SCROLL_TIMEOUT","ProductList","products","selectedProducts","setSelectedProducts","hasBeenObserved","selectedProductsLimit","initialActiveGroup","setExternalState","showProductGroups","isOverviewPage","groupedGroups","useMemo","groupProducts","moreThanOneGroupExists","length","containerRef","useRef","productListRef","buttonHasBeenClick","setButtonHasBeenClicked","useState","activeGroup","setActiveGroup","playAnimation","setPlayAnimation","isHovering","useHoverDirty","isDragging","setIsDragging","overflowExists","setOverflowExists","endPosition","setEndPosition","useEffectOnce","refsExist","current","getBoundingClientRect","width","useEffect","productListGroup","id","productListInitialPosition","left","timeoutId","setTimeout","currentPosition","clearTimeout","dragStartingPosition","scrollAmount","dragHandler","useCallback","event","clientX","scrollTo","mouseUpHandler","scrollLeft","document","removeEventListener","mouseDownHandler","buttons","addEventListener","container","isScrolling","checkIsScrolling","window","tabClickHandler","groupId","initialScrollPosition","checkForScroll","currentScrollPosition","element","getElementById","scrollIntoView","behavior","inline","block","scrollButtonHandler","isLeftArrow","scrollLength","S.PRODUCT_CARD_WIDTH","S.PRODUCT_LIST_GRID_GAP","isMaxLeft","isMaxRight","useIsAtMaxScroll","jsxs","S.Wrapper","children","jsx","ButtonGroup","items","map","group","activeButton","onClick","S.Container","ref","$isHovering","$moreThanOneGroupExists","$isDragging","S.ProductGroupProductListContainer","ProductGroups","canPlayAniimation","S.ProductList","$columns","$overflowExists","onMouseDown","onMouseUp","ScrollButton","color","rotationDegrees","isVisible","isRightButton","product","productsArrayIndex","groupIsActive","filter","groupIndex","findIndex","item","Product","groupLength","image","src","height","name","title","description","isStaticProduct"],"mappings":";;;;;;;;;;;;AAgBA,MAAMA,wBAA2B,GAAA,GA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AA,EAjBKuG,OAAQ,CAAAxE,EAkBf,CAAA;UAEH,CAAA,CAAA;QAAA,CAAA,CAAA;MAEL,CAAA;IAAA,CAAA,CAAA;GAEJ,CAAA;AAEJ,CAAA;"}
@@ -14,7 +14,7 @@ require('./assets/volume-on.svg.js');
14
14
  var VideoPlayer_styles = require('./VideoPlayer.styles.js');
15
15
  var CloseIcon = require("../../assets/close2.svg");
16
16
  var BackIcon = require("../../assets/back.svg");
17
- var PauseIcon = require("../../assets/pause2.svg");
17
+ var PauseIcon = require("../../assets/pause.svg");
18
18
  var PlayIcon = require("../../assets/play.svg");
19
19
  var VolumeOffIcon = require("../../assets/volume-off.svg");
20
20
  var VolumeOnIcon = require("../../assets/volume-on.svg");
@@ -12,7 +12,7 @@ import './assets/volume-on.svg.mjs';
12
12
  import { Wrap, IconWrap, Icon, Video, ControlWrap, TimelineWrap, Timeline, Controls, LeftSide, IconButton, VolumeWrap, VolumeSliderWrap, VolumeSlider, Time, Center, RightSide } from './VideoPlayer.styles.mjs';
13
13
  import CloseIcon__default from "../../assets/close2.svg";
14
14
  import BackIcon__default from "../../assets/back.svg";
15
- import PauseIcon__default from "../../assets/pause2.svg";
15
+ import PauseIcon__default from "../../assets/pause.svg";
16
16
  import PlayIcon__default from "../../assets/play.svg";
17
17
  import VolumeOffIcon__default from "../../assets/volume-off.svg";
18
18
  import VolumeOnIcon__default from "../../assets/volume-on.svg";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', {
4
4
  value: true
5
5
  });
6
- var PauseIcon = require("../../../assets/pause2.svg");
6
+ var PauseIcon = require("../../../assets/pause.svg");
7
7
  function _interopDefault(e) {
8
8
  return e && e.__esModule ? e : {
9
9
  default: e
@@ -1,3 +1,3 @@
1
- export * from "../../../assets/pause2.svg";
2
- export { default } from "../../../assets/pause2.svg";
1
+ export * from "../../../assets/pause.svg";
2
+ export { default } from "../../../assets/pause.svg";
3
3
  //# sourceMappingURL=pause.svg.mjs.map
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', {
4
4
  value: true
5
5
  });
6
- var globe = require("../../../assets/globe2.svg");
6
+ var globe = require("../../../assets/globe.svg");
7
7
  function _interopDefault(e) {
8
8
  return e && e.__esModule ? e : {
9
9
  default: e
@@ -1,3 +1,3 @@
1
- export * from "../../../assets/globe2.svg";
2
- export { default } from "../../../assets/globe2.svg";
1
+ export * from "../../../assets/globe.svg";
2
+ export { default } from "../../../assets/globe.svg";
3
3
  //# sourceMappingURL=globe.svg.mjs.map
@@ -7,7 +7,7 @@ require('./logoUnifi.svg.js');
7
7
  require('./logoUisp.svg.js');
8
8
  require('./arrow.svg.js');
9
9
  var accountLogo = require("../../../assets/account.svg");
10
- var globe = require("../../../assets/globe2.svg");
10
+ var globe = require("../../../assets/globe.svg");
11
11
  var _externalAssets_BPYvPCPi = require("../../../assets/logo.svg");
12
12
  var logoUnifi = require("../../../assets/logoUnifi.svg");
13
13
  var _externalAssets_TKrekyEi = require("../../../assets/logoUisp.svg");
@@ -5,7 +5,7 @@ import './logoUnifi.svg.mjs';
5
5
  import './logoUisp.svg.mjs';
6
6
  import './arrow.svg.mjs';
7
7
  export { default as account } from "../../../assets/account.svg";
8
- export { default as globe } from "../../../assets/globe2.svg";
8
+ export { default as globe } from "../../../assets/globe.svg";
9
9
  export { default as logo } from "../../../assets/logo.svg";
10
10
  export { default as logoUnifi } from "../../../assets/logoUnifi.svg";
11
11
  export { default as logoUisp } from "../../../assets/logoUisp.svg";
@@ -3,24 +3,24 @@
3
3
  Object.defineProperty(exports, '__esModule', {
4
4
  value: true
5
5
  });
6
- var _externalAssets_CtJPud52 = require("../../../assets/floodlight2.svg");
6
+ var _externalAssets_D9OBvcup = require("../../../assets/floodlight.svg");
7
7
  function _interopDefault(e) {
8
8
  return e && e.__esModule ? e : {
9
9
  default: e
10
10
  };
11
11
  }
12
- var _externalAssets_CtJPud52__default = /*#__PURE__*/_interopDefault(_externalAssets_CtJPud52);
12
+ var _externalAssets_D9OBvcup__default = /*#__PURE__*/_interopDefault(_externalAssets_D9OBvcup);
13
13
  Object.defineProperty(exports, "default", {
14
14
  enumerable: true,
15
15
  get: function () {
16
- return _externalAssets_CtJPud52__default["default"];
16
+ return _externalAssets_D9OBvcup__default["default"];
17
17
  }
18
18
  });
19
- Object.keys(_externalAssets_CtJPud52).forEach(function (k) {
19
+ Object.keys(_externalAssets_D9OBvcup).forEach(function (k) {
20
20
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
21
21
  enumerable: true,
22
22
  get: function () {
23
- return _externalAssets_CtJPud52[k];
23
+ return _externalAssets_D9OBvcup[k];
24
24
  }
25
25
  });
26
26
  });
@@ -1,3 +1,3 @@
1
- export * from "../../../assets/floodlight2.svg";
2
- export { default } from "../../../assets/floodlight2.svg";
1
+ export * from "../../../assets/floodlight.svg";
2
+ export { default } from "../../../assets/floodlight.svg";
3
3
  //# sourceMappingURL=floodlight.svg.mjs.map