@ubnt/store.core 11.6.0-nj.0 → 11.6.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +895 -21
- package/lib/assets/ai-turret.jpg +0 -0
- package/lib/assets/ai-turret2.jpg +0 -0
- package/lib/assets/attention.svg +5 -5
- package/lib/assets/attention2.svg +5 -5
- package/lib/assets/compact.svg +2 -2
- package/lib/assets/compact2.svg +2 -2
- package/lib/assets/door-hub-mini.jpg +0 -0
- package/lib/assets/door-hub-mini2.jpg +0 -0
- package/lib/assets/g2-reader.jpg +0 -0
- package/lib/assets/g2-reader2.jpg +0 -0
- package/lib/assets/g3-reader.jpg +0 -0
- package/lib/assets/g3-reader2.jpg +0 -0
- package/lib/assets/g5-bullet.jpg +0 -0
- package/lib/assets/g5-bullet2.jpg +0 -0
- package/lib/assets/g5-dome.jpg +0 -0
- package/lib/assets/g5-dome2.jpg +0 -0
- package/lib/assets/g5-flex.jpg +0 -0
- package/lib/assets/g5-flex2.jpg +0 -0
- package/lib/assets/g5-ptz.jpg +0 -0
- package/lib/assets/g5-ptz2.jpg +0 -0
- package/lib/assets/intercom.jpg +0 -0
- package/lib/assets/intercom2.jpg +0 -0
- package/lib/assets/ptz2.svg +2 -2
- package/lib/assets/ptz3.svg +2 -2
- package/lib/components/CategoryTabs/CategoryTabs.d.ts +1 -1
- package/lib/components/CategoryTabs/CategoryTabs.js +18 -4
- package/lib/components/CategoryTabs/CategoryTabs.js.map +1 -1
- package/lib/components/CategoryTabs/CategoryTabs.mjs +19 -5
- package/lib/components/CategoryTabs/CategoryTabs.mjs.map +1 -1
- package/lib/components/CategoryTabs/CategoryTabs.stories.d.ts +5 -0
- package/lib/components/CategoryTabs/CategoryTabs.styles.d.ts +22 -4
- package/lib/components/CategoryTabs/CategoryTabs.styles.js +123 -22
- package/lib/components/CategoryTabs/CategoryTabs.styles.js.map +1 -1
- package/lib/components/CategoryTabs/CategoryTabs.styles.mjs +122 -23
- package/lib/components/CategoryTabs/CategoryTabs.styles.mjs.map +1 -1
- package/lib/components/CategoryTabs/CategoryTabs.types.d.ts +8 -0
- package/lib/components/Header/AccountFrame/AccountFrame.js +0 -1
- package/lib/components/Header/AccountFrame/AccountFrame.js.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.mjs +0 -1
- package/lib/components/Header/AccountFrame/AccountFrame.mjs.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.styles.d.ts +4 -8
- package/lib/components/Header/AccountFrame/AccountFrame.styles.js +7 -2
- package/lib/components/Header/AccountFrame/AccountFrame.styles.js.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.styles.mjs +7 -2
- package/lib/components/Header/AccountFrame/AccountFrame.styles.mjs.map +1 -1
- package/lib/components/Header/Header.stories.d.ts +2 -2
- package/lib/components/Header/Header.types.d.ts +2 -2
- package/lib/components/Header/Header.types.js.map +1 -1
- package/lib/components/Header/Header.types.mjs.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.js +19 -8
- package/lib/components/Header/LanguageFrame/LanguageFrame.js.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.mjs +20 -9
- package/lib/components/Header/LanguageFrame/LanguageFrame.mjs.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.styles.d.ts +1 -0
- package/lib/components/Header/LanguageFrame/LanguageFrame.styles.js +8 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.styles.js.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.styles.mjs +8 -2
- package/lib/components/Header/LanguageFrame/LanguageFrame.styles.mjs.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.types.d.ts +1 -1
- package/lib/components/Header/MenuItem/MenuItem.js +8 -0
- package/lib/components/Header/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/Header/MenuItem/MenuItem.mjs +8 -0
- package/lib/components/Header/MenuItem/MenuItem.mjs.map +1 -1
- package/lib/components/Header/MenuItem/MenuItem.types.d.ts +1 -1
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.styles.js +1 -0
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.styles.js.map +1 -1
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.styles.mjs +1 -0
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.styles.mjs.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.d.ts +1 -1
- package/lib/components/Header/ProHeader/ProHeader.js +2 -0
- package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.mjs +2 -0
- package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.d.ts +4 -2
- package/lib/components/Header/ProHeader/ProHeader.styles.js +8 -0
- package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.mjs +8 -0
- package/lib/components/Header/ProHeader/ProHeader.styles.mjs.map +1 -1
- package/lib/components/MicrositeHeader/MicrositeHeader.types.d.ts +4 -2
- package/lib/components/MicrositeHeader/components/DropdownMenu/DropdownMenu.js +28 -0
- package/lib/components/MicrositeHeader/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/lib/components/MicrositeHeader/components/DropdownMenu/DropdownMenu.mjs +28 -0
- package/lib/components/MicrositeHeader/components/DropdownMenu/DropdownMenu.mjs.map +1 -1
- package/lib/components/MicrositeHeader/components/DropdownMenu/DropdownMenu.styles.js +13 -2
- package/lib/components/MicrositeHeader/components/DropdownMenu/DropdownMenu.styles.js.map +1 -1
- package/lib/components/MicrositeHeader/components/DropdownMenu/DropdownMenu.styles.mjs +13 -2
- package/lib/components/MicrositeHeader/components/DropdownMenu/DropdownMenu.styles.mjs.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.js +25 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.js.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.mjs +26 -2
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.mjs.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.styles.js +20 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.styles.js.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.styles.mjs +20 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.styles.mjs.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/NavigationItem/NavigationItem.d.ts +3 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/NavigationItem/NavigationItem.js +16 -0
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/NavigationItem/NavigationItem.js.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/NavigationItem/NavigationItem.mjs +16 -0
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/NavigationItem/NavigationItem.mjs.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.d.ts +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.js +12 -0
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.js.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.mjs +12 -0
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.mjs.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.styles.js +3 -0
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.styles.js.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.styles.mjs +3 -0
- package/lib/components/MicrositeHeader/components/HeaderContent/_components/SubNavigation/SubNavigation.styles.mjs.map +1 -1
- package/lib/components/ModelCompareV4/CompareTable/CompareTable.styles.d.ts +2 -1
- package/lib/components/ModelCompareV4/CompareTable/CompareTable.styles.js +14 -3
- package/lib/components/ModelCompareV4/CompareTable/CompareTable.styles.js.map +1 -1
- package/lib/components/ModelCompareV4/CompareTable/CompareTable.styles.mjs +15 -5
- package/lib/components/ModelCompareV4/CompareTable/CompareTable.styles.mjs.map +1 -1
- package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/CompareTableMarkup.js +3 -3
- package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/CompareTableMarkup.js.map +1 -1
- package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/CompareTableMarkup.mjs +4 -4
- package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/CompareTableMarkup.mjs.map +1 -1
- package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/ProductHeader/ProductHeader.js +4 -3
- package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/ProductHeader/ProductHeader.js.map +1 -1
- package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/ProductHeader/ProductHeader.mjs +5 -4
- package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/ProductHeader/ProductHeader.mjs.map +1 -1
- package/lib/components/ModelCompareV4/ModelCompareV4.d.ts +1 -1
- package/lib/components/ModelCompareV4/ModelCompareV4.js +1 -1
- package/lib/components/ModelCompareV4/ModelCompareV4.js.map +1 -1
- package/lib/components/ModelCompareV4/ModelCompareV4.mjs +1 -1
- package/lib/components/ModelCompareV4/ModelCompareV4.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/Bullet/g5-bullet.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/Bullet/g5-bullet.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/Compact/g5-flex.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/Compact/g5-flex.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DomeTurret/ai-turret.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DomeTurret/ai-turret.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/intercom.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/intercom.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/PTZ/g5-ptz.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/PTZ/g5-ptz.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/compact.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/compact.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/g5-bullet.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/g5-bullet.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/compact/g5-flex.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/compact/g5-flex.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-turret.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-turret.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/intercom.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/intercom.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g5-ptz.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g5-ptz.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/compact.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/compact.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/ptz.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/ptz.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/ptz.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/ptz.svg.mjs +2 -2
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Compact.js +1 -1
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Compact.mjs +1 -1
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Ptz.js +1 -1
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Ptz.mjs +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/compact.js +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/compact.mjs +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/ptz.js +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/ptz.mjs +1 -1
- package/lib/constants/modelCompareData/data/products/aiTurret.js +2 -2
- package/lib/constants/modelCompareData/data/products/aiTurret.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/doorHubMini.js +2 -2
- package/lib/constants/modelCompareData/data/products/doorHubMini.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g2Reader.js +2 -2
- package/lib/constants/modelCompareData/data/products/g2Reader.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g3Reader.js +2 -2
- package/lib/constants/modelCompareData/data/products/g3Reader.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g5Bullet.js +2 -2
- package/lib/constants/modelCompareData/data/products/g5Bullet.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g5Dome.js +2 -2
- package/lib/constants/modelCompareData/data/products/g5Dome.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g5Flex.js +2 -2
- package/lib/constants/modelCompareData/data/products/g5Flex.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g5Ptz.js +2 -2
- package/lib/constants/modelCompareData/data/products/g5Ptz.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/intercom.js +2 -2
- package/lib/constants/modelCompareData/data/products/intercom.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/ucCastLite.js.map +1 -1
- package/lib/constants/modelCompareData/data/products/ucCastLite.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/ar.json.js +0 -2
- package/lib/constants/modelCompareData/translations/ar.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/ar.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/ar.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/de.json.js +0 -2
- package/lib/constants/modelCompareData/translations/de.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/de.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/de.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/el.json.js +0 -2
- package/lib/constants/modelCompareData/translations/el.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/el.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/el.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/es.json.js +0 -2
- package/lib/constants/modelCompareData/translations/es.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/es.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/es.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/fr.json.js +0 -2
- package/lib/constants/modelCompareData/translations/fr.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/fr.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/fr.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/it.json.js +0 -2
- package/lib/constants/modelCompareData/translations/it.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/it.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/it.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/ja.json.js +0 -2
- package/lib/constants/modelCompareData/translations/ja.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/ja.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/ja.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/pt-BR.json.js +0 -2
- package/lib/constants/modelCompareData/translations/pt-BR.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/pt-BR.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/pt-BR.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/zh-Hans.json.js +0 -2
- package/lib/constants/modelCompareData/translations/zh-Hans.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/zh-Hans.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/zh-Hans.json.mjs.map +1 -1
- package/lib/constants/modelCompareData/translations/zh-Hant-TW.json.js +0 -2
- package/lib/constants/modelCompareData/translations/zh-Hant-TW.json.js.map +1 -1
- package/lib/constants/modelCompareData/translations/zh-Hant-TW.json.mjs +0 -2
- package/lib/constants/modelCompareData/translations/zh-Hant-TW.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.js +4 -5
- package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.mjs +4 -5
- package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
- package/lib/contexts/MenuContext/utils.d.ts +10 -0
- package/lib/contexts/MenuContext/utils.js +28 -0
- package/lib/contexts/MenuContext/utils.js.map +1 -1
- package/lib/contexts/MenuContext/utils.mjs +27 -1
- package/lib/contexts/MenuContext/utils.mjs.map +1 -1
- package/lib/utils/phoneNumber.js +2 -2
- package/lib/utils/phoneNumber.js.map +1 -1
- package/lib/utils/phoneNumber.mjs +1 -1
- package/lib/utils/phoneNumber.mjs.map +1 -1
- package/package.json +1 -1
package/lib/components/ModelCompareV4/CompareTable/CompareTableMarkup/CompareTableMarkup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompareTableMarkup.mjs","sources":["../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/CompareTableMarkup.tsx"],"sourcesContent":["import { Tooltip } from \"@ubnt/ui-components/Tooltip\";\nimport { Fragment, useCallback, useMemo, useState } from \"react\";\nimport { useWindowSize } from \"react-use\";\n\nimport { CONTAINER_WIDTH } from \"../../../../constants/layout\";\nimport tooltipIcon from \"../../../../constants/modelCompareData/assets/tooltip-info.svg\";\nimport { emptyColumn } from \"../../../../constants/modelCompareData/data/products/emptyColumn\";\nimport { useModelCompareTranslation } from \"../../../../constants/modelCompareData/translations/useModelCompareTranslation\";\nimport type { MutatedProduct } from \"../../../../constants/modelCompareData/types\";\nimport { useMenu } from \"../../../../contexts/MenuContext\";\nimport { LanguageDirectionType } from \"../../../../contexts/MenuContext/utils\";\nimport { StyleableSvgImage } from \"../../../StyleableSvgImage\";\nimport * as S from \"../CompareTable.styles\";\nimport { TOOLTIP_CLASS_NAME } from \"../CompareTable.styles\";\nimport { getNumberOfColumns } from \"../helpers/getNumberOfColumns\";\nimport { useButtonRenderer } from \"../helpers/RenderButton\";\nimport type { CompareTableMarkupProps } from \"./CompareTableMarkup.types\";\nimport { ModelCompareOverflowScrollButton } from \"./components/CompareTableOverflowScrollButton\";\nimport { EmptyColumnHeader } from \"./components/EmptyColumnHeader/EmptyColumnHeader\";\nimport { FootNotes } from \"./components/FootNotes/FootNotes\";\nimport { HeaderShadow } from \"./components/HeaderShadow\";\nimport { Notes } from \"./components/Notes/Notes\";\nimport { ProductHeader } from \"./components/ProductHeader/ProductHeader\";\nimport { PropertyValueGridItem } from \"./components/PropertyValueGridItem\";\nimport {\n StickyGrid,\n StickyGridBody,\n StickyGridHeader,\n StickyGridOverlay,\n} from \"./components/StickyGrid\";\n\nconst SMOOTH_SIZE_REDUCTION = 4;\n\nexport const CompareTableMarkup = ({\n products,\n properties,\n columnWidth = 338,\n propertyColumnWidth = 230,\n headerStickOffset,\n overlayTopOffset,\n showBuyButton,\n onLinkClick,\n linkToStoreTitleClick,\n showBadges,\n setSelectedProducts,\n hasBeenObserved,\n selectedProductsLimit,\n setExternalState,\n selectedProducts,\n currAvailableProducts,\n isOverviewPage,\n isStaticTable,\n}: CompareTableMarkupProps) => {\n const { storeId } = useMenu();\n const { formatMessage } = useModelCompareTranslation();\n const renderButton = useButtonRenderer();\n const { width: screenWidth } = useWindowSize();\n const isLessThanOrEqualToFiveProducts = currAvailableProducts.length <= 5;\n const [headerItemsAreSticking, setHeaderItemsAreSticking] = useState(false);\n\n // #############################################################################\n // Grid calculations\n // #############################################################################\n const isSmallScreen = useMemo(\n () => screenWidth < S.MOBILE_BREAKPOINT,\n [screenWidth],\n );\n const isGreaterThanDesktopWidth = useMemo(\n () => screenWidth > CONTAINER_WIDTH.DESKTOP,\n [screenWidth],\n );\n\n const leftColumnWidth = useMemo(\n () =>\n isSmallScreen\n ? 0\n : Math.min(screenWidth / SMOOTH_SIZE_REDUCTION, propertyColumnWidth),\n [isSmallScreen, propertyColumnWidth, screenWidth],\n );\n\n const maxImageHeight = useMemo(\n () => Math.max(...products.map(({ image }) => image.height)),\n [products],\n );\n\n const stickOffset = useMemo(\n () => (headerStickOffset ? headerStickOffset({ maxImageHeight }) : 0),\n [headerStickOffset, maxImageHeight],\n );\n\n const numberOfColumns = useMemo(\n () =>\n isStaticTable\n ? products.length\n : getNumberOfColumns({\n selectedProducts,\n selectedProductsLimit,\n products,\n }),\n [selectedProducts, selectedProductsLimit, products, isStaticTable],\n );\n\n const templateColumnWidth = useMemo(() => {\n if (isSmallScreen) return \"100%\";\n if (isGreaterThanDesktopWidth) return \"1fr\";\n return `${columnWidth}px`;\n }, [isSmallScreen, columnWidth, isGreaterThanDesktopWidth]);\n\n // const twoColumns = 2;\n /**\n * 1 sticky left column\n * N non-sticky product columns\n */\n const templateColumns = useMemo(\n () =>\n `${leftColumnWidth}px repeat(${numberOfColumns}, ${templateColumnWidth})`,\n [leftColumnWidth, numberOfColumns, templateColumnWidth],\n );\n\n const hasNotes = useMemo(() => {\n return products.some(({ notes }) => !!notes?.length);\n }, [products]);\n\n const hasFootnotes = useMemo(() => {\n return products.some(({ footnotes }) => footnotes?.length);\n }, [products]);\n\n // #############################################################################\n // Column button\n // #############################################################################\n const getComingSoonButtonText = useCallback(\n (product: MutatedProduct) => {\n const buttonText = product.comingSoonButtonText;\n\n if (typeof buttonText === \"string\") {\n return formatMessage(buttonText);\n }\n\n if (typeof buttonText === \"function\" && !!buttonText(storeId)) {\n const foundKey = buttonText(storeId);\n\n if (foundKey) {\n return formatMessage(foundKey);\n }\n }\n\n return formatMessage(\"Coming Soon\");\n },\n [formatMessage, storeId],\n );\n\n const hasMultipleProductsSelected = useMemo(\n () => products.filter(({ id }) => id !== emptyColumn.id).length > 1,\n [products],\n );\n\n return (\n // APPLY left to right override in all cases rather than redo the model compare for Arabic\n <section dir={LanguageDirectionType.ltr}>\n <StickyGrid templateColumns={templateColumns}>\n <StickyGridHeader\n stickOffset={stickOffset}\n onStickyStateChange={setHeaderItemsAreSticking}\n nonScrollChildren={({ grid: { isAtMinX }, isStuck }) => {\n return (\n <HeaderShadow\n leftColumnWidth={leftColumnWidth}\n shadowLeftColumn={isAtMinX}\n show={isStuck}\n />\n );\n }}\n >\n <S.PlaceholderGridItem stickX />\n {products.map((product, index) =>\n product.propertyValues.length ? (\n <ProductHeader\n key={`${product.id}-${index}`}\n isStaticProduct={\n isStaticTable || (!isOverviewPage && index === 0)\n }\n product={product}\n setSelectedProducts={setSelectedProducts}\n index={index}\n setExternalState={setExternalState}\n selectedProducts={selectedProducts}\n linkToStoreTitleClick={linkToStoreTitleClick}\n hasBeenObserved={hasBeenObserved}\n isLessThanOrEqualToFiveProducts={\n isLessThanOrEqualToFiveProducts\n }\n hasMultipleProductsSelected={hasMultipleProductsSelected}\n isSmallScreen={isSmallScreen}\n onLinkClick={onLinkClick}\n showBadges={showBadges}\n />\n ) : (\n <EmptyColumnHeader\n key={`${product.id}-${index}`}\n product={product}\n index={index}\n hasBeenObserved={hasBeenObserved}\n maxImageHeight={maxImageHeight}\n headerItemsAreSticking={headerItemsAreSticking}\n />\n ),\n )}\n </StickyGridHeader>\n\n <StickyGridBody>\n {properties.map((property) => (\n <Fragment key={property.id}>\n <S.PropertyTitleGridItem stickX>\n {!!leftColumnWidth && (\n <S.PropertyTitleGridItemContent>\n <S.PropertyIcon>\n <StyleableSvgImage\n width={30}\n height={30}\n src={property.icon}\n />\n </S.PropertyIcon>\n <S.PropertyTitle>\n {property.title.split(\"\\n\").map((part, i, arr) => (\n <Fragment key={i}>\n {part}\n {i < arr.length - 1 && <br />}\n </Fragment>\n ))}\n </S.PropertyTitle>\n {property.tooltip && (\n <S.PropertyTooltip>\n <S.TooltipStyles maxWidth={property.tooltipWidth} />\n <Tooltip\n tooltipClassName={TOOLTIP_CLASS_NAME}\n description={\n <S.PropertyTooltipContent\n dangerouslySetInnerHTML={{\n __html: property.tooltip,\n }}\n />\n }\n portal\n motif=\"dark\"\n isInteractive\n position=\"right\"\n width={property.tooltipWidth}\n >\n <S.TooltipIcon\n width={20}\n height={20}\n src={tooltipIcon}\n />\n </Tooltip>\n </S.PropertyTooltip>\n )}\n </S.PropertyTitleGridItemContent>\n )}\n </S.PropertyTitleGridItem>\n\n {products.map((product, index) => {\n const isLastProduct = index === products.length - 1;\n const productProperty = product.propertyValues?.find(\n (product) => product.propertyId === property.id,\n );\n\n return (\n <PropertyValueGridItem\n isLastProduct={isLastProduct}\n key={`${product.id}-${index}`}\n productProperty={productProperty}\n property={property}\n includeProperty={isSmallScreen}\n index={index}\n />\n );\n })}\n </Fragment>\n ))}\n\n {/**\n * Notes\n */}\n {hasNotes && <Notes products={products} />}\n\n {/**\n * Buy button\n */}\n <S.EmptyPropertyTitleGridItem stickX />\n {products.map((product, index) =>\n renderButton({\n product,\n index,\n getComingSoonButtonText,\n showBuyButton,\n onLinkClick,\n }),\n )}\n\n {/**\n * Footnotes\n */}\n {hasFootnotes && <FootNotes products={products} />}\n </StickyGridBody>\n\n <StickyGridOverlay\n style={{ left: `${leftColumnWidth}px` }}\n topOffset={overlayTopOffset}\n >\n {({ isAtMinX }) => (\n <ModelCompareOverflowScrollButton\n isVisible={!isAtMinX}\n color={leftColumnWidth > 0 ? \"rgb(23 49 73 / 0.1)\" : \"white\"}\n rotationDegrees={180}\n onClickColumnDiff={-1}\n totalColumns={products.length}\n totalDeadSpace={leftColumnWidth}\n isSmallScreen={isSmallScreen}\n />\n )}\n </StickyGridOverlay>\n\n <StickyGridOverlay style={{ right: 0 }} topOffset={overlayTopOffset}>\n {({ isAtMaxX }) => (\n <ModelCompareOverflowScrollButton\n isVisible={!isAtMaxX}\n color=\"white\"\n rotationDegrees={0}\n onClickColumnDiff={1}\n totalColumns={products.length}\n totalDeadSpace={leftColumnWidth}\n isSmallScreen={isSmallScreen}\n />\n )}\n </StickyGridOverlay>\n </StickyGrid>\n </section>\n );\n};\n"],"names":["SMOOTH_SIZE_REDUCTION","CompareTableMarkup","products","properties","columnWidth","propertyColumnWidth","headerStickOffset","overlayTopOffset","showBuyButton","onLinkClick","linkToStoreTitleClick","showBadges","setSelectedProducts","hasBeenObserved","selectedProductsLimit","setExternalState","selectedProducts","currAvailableProducts","isOverviewPage","isStaticTable","storeId","useMenu","formatMessage","useModelCompareTranslation","renderButton","useButtonRenderer","width","screenWidth","useWindowSize","isLessThanOrEqualToFiveProducts","length","headerItemsAreSticking","setHeaderItemsAreSticking","useState","isSmallScreen","useMemo","S.MOBILE_BREAKPOINT","isGreaterThanDesktopWidth","CONTAINER_WIDTH","DESKTOP","leftColumnWidth","Math","min","maxImageHeight","max","map","image","height","stickOffset","numberOfColumns","getNumberOfColumns","templateColumnWidth","templateColumns","hasNotes","some","notes","hasFootnotes","footnotes","getComingSoonButtonText","useCallback","product","buttonText","comingSoonButtonText","foundKey","hasMultipleProductsSelected","filter","id","emptyColumn","dir","LanguageDirectionType","ltr","children","jsxs","StickyGrid","StickyGridHeader","onStickyStateChange","nonScrollChildren","grid","isAtMinX","isStuck","jsx","HeaderShadow","shadowLeftColumn","show","S.PlaceholderGridItem","stickX","index","propertyValues","ProductHeader","isStaticProduct","EmptyColumnHeader","StickyGridBody","property","Fragment","S.PropertyTitleGridItem","S.PropertyTitleGridItemContent","S.PropertyIcon","StyleableSvgImage","src","icon","S.PropertyTitle","title","split","part","i","arr","tooltip","S.PropertyTooltip","S.TooltipStyles","maxWidth","tooltipWidth","Tooltip","tooltipClassName","TOOLTIP_CLASS_NAME","description","S.PropertyTooltipContent","dangerouslySetInnerHTML","__html","portal","motif","isInteractive","position","S.TooltipIcon","tooltipIcon","isLastProduct","productProperty","find","propertyId","PropertyValueGridItem","includeProperty","Notes","S.EmptyPropertyTitleGridItem","FootNotes","StickyGridOverlay","style","left","topOffset","ModelCompareOverflowScrollButton","isVisible","color","rotationDegrees","onClickColumnDiff","totalColumns","totalDeadSpace","right","isAtMaxX"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAMA,qBAAwB,GAAA,CAAA;AAEvB,MAAMC,qBAAqBA,CAAC;EACjCC,QAAA;EACAC,UAAA;EACAC,WAAc,GAAA,GAAA;EACdC,mBAAsB,GAAA,GAAA;EACtBC,iBAAA;EACAC,gBAAA;EACAC,aAAA;EACAC,WAAA;EACAC,qBAAA;EACAC,UAAA;EACAC,mBAAA;EACAC,eAAA;EACAC,qBAAA;EACAC,gBAAA;EACAC,gBAAA;EACAC,qBAAA;EACAC,cAAA;EACAC;AACF,CAA+B,KAAA;EACvB,MAAA;IAAEC;EAAQ,CAAA,GAAIC,OAAQ,CAAA,CAAA;EACtB,MAAA;IAAEC;EAAc,CAAA,GAAIC,0BAA2B,CAAA,CAAA;EACrD,MAAMC,eAAeC,iBAAkB,CAAA,CAAA;EACvC,MAAM;IAAEC,KAAA,EAAOC;EAAY,CAAA,GAAIC,aAAc,CAAA,CAAA;EACvC,MAAAC,+BAAA,GAAkCZ,sBAAsBa,MAAU,IAAA,CAAA;EACxE,MAAM,CAACC,sBA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AEA8E,GAAA,CAACqD,iBAAA,EAAA;UACCC,KAAO,EAAA;YAAEC,IAAM,EAAA,GAAG/F,eAAe;UAAK,CAAA;UACtCgG,SAAW,EAAAjI,gBAAA;UAEVgE,QAAA,EAAAA,CAAC;YAAEO;UAAA,CACF,oBAAAE,GAAA,CAACyD,gCAAA,EAAA;YACCC,WAAW,CAAC5D,QAAA;YACZ6D,KAAA,EAAOnG,eAAkB,GAAA,CAAA,GAAI,qBAAwB,GAAA,OAAA;YACrDoG,eAAiB,EAAA,GAAA;YACjBC,iBAAmB,EAAA,CAAA,CAAA;YACnBC,cAAc5I,QAAS,CAAA4B,MAAA;YACvBiH,cAAgB,EAAAvG,eAAA;YAChBN;UAAA,CAAA;QACF,CAEJ,CAAA,EAEC,eAAA8C,GAAA,CAAAqD,iBAAA,EAAA;UAAkBC,KAAO,EAAA;YAAEU,KAAO,EAAA;UAAA,CAAK;UAAAR,SAAA,EAAWjI,gBAChD;UAAAgE,QAAA,EAAAA,CAAC;YAAE0E;UACF,CAAA,KAAA,eAAAjE,GAAA,CAACyD,gCAAA,EAAA;YACCC,WAAW,CAACO,QAAA;YACZN,KAAM,EAAA,OAAA;YACNC,eAAiB,EAAA,CAAA;YACjBC,iBAAmB,EAAA,CAAA;YACnBC,cAAc5I,QAAS,CAAA4B,MAAA;YACvBiH,cAAgB,EAAAvG,eAAA;YAChBN;UAAA,CAAA;QAGN,CAAA,CAAA;MAAA,CACF;IACF,CAAA;EAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"CompareTableMarkup.mjs","sources":["../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/CompareTableMarkup.tsx"],"sourcesContent":["import { Tooltip } from \"@ubnt/ui-components/Tooltip\";\nimport { Fragment, useCallback, useMemo, useState } from \"react\";\nimport { useWindowSize } from \"react-use\";\n\nimport { CONTAINER_WIDTH } from \"../../../../constants/layout\";\nimport tooltipIcon from \"../../../../constants/modelCompareData/assets/tooltip-info.svg\";\nimport { emptyColumn } from \"../../../../constants/modelCompareData/data/products/emptyColumn\";\nimport { useModelCompareTranslation } from \"../../../../constants/modelCompareData/translations/useModelCompareTranslation\";\nimport type { MutatedProduct } from \"../../../../constants/modelCompareData/types\";\nimport { useMenu } from \"../../../../contexts/MenuContext\";\nimport { LanguageDirectionType } from \"../../../../contexts/MenuContext/utils\";\nimport { StyleableSvgImage } from \"../../../StyleableSvgImage\";\nimport * as S from \"../CompareTable.styles\";\nimport { TOOLTIP_CLASS_NAME } from \"../CompareTable.styles\";\nimport { getNumberOfColumns } from \"../helpers/getNumberOfColumns\";\nimport { useButtonRenderer } from \"../helpers/RenderButton\";\nimport type { CompareTableMarkupProps } from \"./CompareTableMarkup.types\";\nimport { ModelCompareOverflowScrollButton } from \"./components/CompareTableOverflowScrollButton\";\nimport { EmptyColumnHeader } from \"./components/EmptyColumnHeader/EmptyColumnHeader\";\nimport { FootNotes } from \"./components/FootNotes/FootNotes\";\nimport { HeaderShadow } from \"./components/HeaderShadow\";\nimport { Notes } from \"./components/Notes/Notes\";\nimport { ProductHeader } from \"./components/ProductHeader/ProductHeader\";\nimport { PropertyValueGridItem } from \"./components/PropertyValueGridItem\";\nimport {\n StickyGrid,\n StickyGridBody,\n StickyGridHeader,\n StickyGridOverlay,\n} from \"./components/StickyGrid\";\n\nconst SMOOTH_SIZE_REDUCTION = 4;\n\nexport const CompareTableMarkup = ({\n products,\n properties,\n columnWidth = 338,\n propertyColumnWidth = 230,\n headerStickOffset,\n overlayTopOffset,\n showBuyButton,\n onLinkClick,\n linkToStoreTitleClick,\n showBadges,\n setSelectedProducts,\n hasBeenObserved,\n selectedProductsLimit,\n setExternalState,\n selectedProducts,\n currAvailableProducts,\n isOverviewPage,\n isStaticTable,\n}: CompareTableMarkupProps) => {\n const { storeId } = useMenu();\n const { formatMessage } = useModelCompareTranslation();\n const renderButton = useButtonRenderer();\n const { width: screenWidth } = useWindowSize();\n const isLessThanOrEqualToFiveProducts = currAvailableProducts.length <= 5;\n const [headerItemsAreSticking, setHeaderItemsAreSticking] = useState(false);\n\n // #############################################################################\n // Grid calculations\n // #############################################################################\n const isSmallScreen = useMemo(\n () => screenWidth < S.MOBILE_BREAKPOINT,\n [screenWidth],\n );\n const isGreaterThanDesktopWidth = useMemo(\n () => screenWidth > CONTAINER_WIDTH.DESKTOP,\n [screenWidth],\n );\n\n const leftColumnWidth = useMemo(\n () =>\n isSmallScreen\n ? 0\n : Math.min(screenWidth / SMOOTH_SIZE_REDUCTION, propertyColumnWidth),\n [isSmallScreen, propertyColumnWidth, screenWidth],\n );\n\n const maxImageHeight = useMemo(\n () => Math.max(...products.map(({ image }) => image.height)),\n [products],\n );\n\n const stickOffset = useMemo(\n () => (headerStickOffset ? headerStickOffset({ maxImageHeight }) : 0),\n [headerStickOffset, maxImageHeight],\n );\n\n const numberOfColumns = useMemo(\n () =>\n isStaticTable\n ? products.length\n : getNumberOfColumns({\n selectedProducts,\n selectedProductsLimit,\n products,\n }),\n [selectedProducts, selectedProductsLimit, products, isStaticTable],\n );\n\n const templateColumnWidth = useMemo(() => {\n if (isSmallScreen) return \"100%\";\n if (isGreaterThanDesktopWidth) return \"1fr\";\n return `${columnWidth}px`;\n }, [isSmallScreen, columnWidth, isGreaterThanDesktopWidth]);\n\n // const twoColumns = 2;\n /**\n * 1 sticky left column\n * N non-sticky product columns\n */\n const templateColumns = useMemo(\n () =>\n `${leftColumnWidth}px repeat(${numberOfColumns}, ${templateColumnWidth})`,\n [leftColumnWidth, numberOfColumns, templateColumnWidth],\n );\n\n const hasNotes = useMemo(() => {\n return products.some(({ notes }) => !!notes?.length);\n }, [products]);\n\n const hasFootnotes = useMemo(() => {\n return products.some(({ footnotes }) => footnotes?.length);\n }, [products]);\n\n // #############################################################################\n // Column button\n // #############################################################################\n const getComingSoonButtonText = useCallback(\n (product: MutatedProduct) => {\n const buttonText = product.comingSoonButtonText;\n\n if (typeof buttonText === \"string\") {\n return formatMessage(buttonText);\n }\n\n if (typeof buttonText === \"function\" && !!buttonText(storeId)) {\n const foundKey = buttonText(storeId);\n\n if (foundKey) {\n return formatMessage(foundKey);\n }\n }\n\n return formatMessage(\"Coming Soon\");\n },\n [formatMessage, storeId],\n );\n\n const hasMultipleProductsSelected = useMemo(\n () => products.filter(({ id }) => id !== emptyColumn.id).length > 1,\n [products],\n );\n\n return (\n // APPLY left to right override in all cases rather than redo the model compare for Arabic\n <section dir={LanguageDirectionType.ltr}>\n <StickyGrid templateColumns={templateColumns}>\n <StickyGridHeader\n stickOffset={stickOffset}\n onStickyStateChange={setHeaderItemsAreSticking}\n nonScrollChildren={({ grid: { isAtMinX }, isStuck }) => {\n return (\n <HeaderShadow\n leftColumnWidth={leftColumnWidth}\n shadowLeftColumn={isAtMinX}\n show={isStuck}\n />\n );\n }}\n >\n <S.PlaceholderGridItem stickX />\n {products.map((product, index) =>\n product.propertyValues.length ? (\n <ProductHeader\n key={`${product.id}-${index}`}\n isStaticProduct={\n isStaticTable || (!isOverviewPage && index === 0)\n }\n product={product}\n setSelectedProducts={setSelectedProducts}\n index={index}\n setExternalState={setExternalState}\n selectedProducts={selectedProducts}\n linkToStoreTitleClick={linkToStoreTitleClick}\n hasBeenObserved={hasBeenObserved}\n isLessThanOrEqualToFiveProducts={\n isLessThanOrEqualToFiveProducts\n }\n hasMultipleProductsSelected={hasMultipleProductsSelected}\n isSmallScreen={isSmallScreen}\n onLinkClick={onLinkClick}\n showBadges={showBadges}\n />\n ) : (\n <EmptyColumnHeader\n key={`${product.id}-${index}`}\n product={product}\n index={index}\n hasBeenObserved={hasBeenObserved}\n maxImageHeight={maxImageHeight}\n headerItemsAreSticking={headerItemsAreSticking}\n />\n ),\n )}\n </StickyGridHeader>\n\n <StickyGridBody>\n {properties.map((property) => (\n <Fragment key={property.id}>\n <S.PropertyTitleGridItem stickX>\n {!!leftColumnWidth && (\n <S.PropertyTitleGridItemContent>\n <S.PropertyIcon>\n <StyleableSvgImage\n width={30}\n height={30}\n src={property.icon}\n />\n </S.PropertyIcon>\n <S.PropertyTitle>\n {property.title.split(\"\\n\").map((part, i, arr) => (\n <Fragment key={i}>\n {part}\n {i < arr.length - 1 && <br />}\n </Fragment>\n ))}\n </S.PropertyTitle>\n {property.tooltip && (\n <S.PropertyTooltip>\n <S.TooltipStyles maxWidth={property.tooltipWidth} />\n <Tooltip\n tooltipClassName={TOOLTIP_CLASS_NAME}\n description={\n <S.PropertyTooltipContent\n dangerouslySetInnerHTML={{\n __html: property.tooltip,\n }}\n />\n }\n portal\n motif=\"dark\"\n isInteractive\n position=\"right\"\n width={property.tooltipWidth}\n >\n <S.PropertyTooltipHoverArea />\n <S.TooltipIcon\n width={20}\n height={20}\n src={tooltipIcon}\n />\n </Tooltip>\n </S.PropertyTooltip>\n )}\n </S.PropertyTitleGridItemContent>\n )}\n </S.PropertyTitleGridItem>\n\n {products.map((product, index) => {\n const isLastProduct = index === products.length - 1;\n const productProperty = product.propertyValues?.find(\n (product) => product.propertyId === property.id,\n );\n\n return (\n <PropertyValueGridItem\n isLastProduct={isLastProduct}\n key={`${product.id}-${index}`}\n productProperty={productProperty}\n property={property}\n includeProperty={isSmallScreen}\n index={index}\n />\n );\n })}\n </Fragment>\n ))}\n\n {/**\n * Notes\n */}\n {hasNotes && <Notes products={products} />}\n\n {/**\n * Buy button\n */}\n <S.EmptyPropertyTitleGridItem stickX />\n {products.map((product, index) =>\n renderButton({\n product,\n index,\n getComingSoonButtonText,\n showBuyButton,\n onLinkClick,\n }),\n )}\n\n {/**\n * Footnotes\n */}\n {hasFootnotes && <FootNotes products={products} />}\n </StickyGridBody>\n\n <StickyGridOverlay\n style={{ left: `${leftColumnWidth}px` }}\n topOffset={overlayTopOffset}\n >\n {({ isAtMinX }) => (\n <ModelCompareOverflowScrollButton\n isVisible={!isAtMinX}\n color={leftColumnWidth > 0 ? \"rgb(23 49 73 / 0.1)\" : \"white\"}\n rotationDegrees={180}\n onClickColumnDiff={-1}\n totalColumns={products.length}\n totalDeadSpace={leftColumnWidth}\n isSmallScreen={isSmallScreen}\n />\n )}\n </StickyGridOverlay>\n\n <StickyGridOverlay style={{ right: 0 }} topOffset={overlayTopOffset}>\n {({ isAtMaxX }) => (\n <ModelCompareOverflowScrollButton\n isVisible={!isAtMaxX}\n color=\"white\"\n rotationDegrees={0}\n onClickColumnDiff={1}\n totalColumns={products.length}\n totalDeadSpace={leftColumnWidth}\n isSmallScreen={isSmallScreen}\n />\n )}\n </StickyGridOverlay>\n </StickyGrid>\n </section>\n );\n};\n"],"names":["SMOOTH_SIZE_REDUCTION","CompareTableMarkup","products","properties","columnWidth","propertyColumnWidth","headerStickOffset","overlayTopOffset","showBuyButton","onLinkClick","linkToStoreTitleClick","showBadges","setSelectedProducts","hasBeenObserved","selectedProductsLimit","setExternalState","selectedProducts","currAvailableProducts","isOverviewPage","isStaticTable","storeId","useMenu","formatMessage","useModelCompareTranslation","renderButton","useButtonRenderer","width","screenWidth","useWindowSize","isLessThanOrEqualToFiveProducts","length","headerItemsAreSticking","setHeaderItemsAreSticking","useState","isSmallScreen","useMemo","S.MOBILE_BREAKPOINT","isGreaterThanDesktopWidth","CONTAINER_WIDTH","DESKTOP","leftColumnWidth","Math","min","maxImageHeight","max","map","image","height","stickOffset","numberOfColumns","getNumberOfColumns","templateColumnWidth","templateColumns","hasNotes","some","notes","hasFootnotes","footnotes","getComingSoonButtonText","useCallback","product","buttonText","comingSoonButtonText","foundKey","hasMultipleProductsSelected","filter","id","emptyColumn","dir","LanguageDirectionType","ltr","children","jsxs","StickyGrid","StickyGridHeader","onStickyStateChange","nonScrollChildren","grid","isAtMinX","isStuck","jsx","HeaderShadow","shadowLeftColumn","show","S.PlaceholderGridItem","stickX","index","propertyValues","ProductHeader","isStaticProduct","EmptyColumnHeader","StickyGridBody","property","Fragment","S.PropertyTitleGridItem","S.PropertyTitleGridItemContent","S.PropertyIcon","StyleableSvgImage","src","icon","S.PropertyTitle","title","split","part","i","arr","tooltip","S.PropertyTooltip","S.TooltipStyles","maxWidth","tooltipWidth","Tooltip","tooltipClassName","TOOLTIP_CLASS_NAME","description","S.PropertyTooltipContent","dangerouslySetInnerHTML","__html","portal","motif","isInteractive","position","S.PropertyTooltipHoverArea","S.TooltipIcon","tooltipIcon","isLastProduct","productProperty","find","propertyId","PropertyValueGridItem","includeProperty","Notes","S.EmptyPropertyTitleGridItem","FootNotes","StickyGridOverlay","style","left","topOffset","ModelCompareOverflowScrollButton","isVisible","color","rotationDegrees","onClickColumnDiff","totalColumns","totalDeadSpace","right","isAtMaxX"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAMA,qBAAwB,GAAA,CAAA;AAEvB,MAAMC,qBAAqBA,CAAC;EACjCC,QAAA;EACAC,UAAA;EACAC,WAAc,GAAA,GAAA;EACdC,mBAAsB,GAAA,GAAA;EACtBC,iBAAA;EACAC,gBAAA;EACAC,aAAA;EACAC,WAAA;EACAC,qBAAA;EACAC,UAAA;EACAC,mBAAA;EACAC,eAAA;EACAC,qBAAA;EACAC,gBAAA;EACAC,gBAAA;EACAC,qBAAA;EACAC,cAAA;EACAC;AACF,CAA+B,KAAA;EACvB,MAAA;IAAEC;EAAQ,CAAA,GAAIC,OAAQ,CAAA,CAAA;EACtB,MAAA;IAAEC;EAAc,CAAA,GAAIC,0BAA2B,CAAA,CAAA;EACrD,MAAMC,eAAeC,iBAAkB,CAAA,CAAA;EACvC,MAAM;IAAEC,KAAA,EAAOC;EAAY,CAAA,GAAIC,aAAc,CAAA,CAAA;EACvC,MAAAC,+BAAA,GAAkCZ,sBAAsBa,MAAU,IAAA,CAAA;EACxE,MAAM,CAACC,sBAAA,EAAwBC,yBAAyB,CAAA,GAAIC,SAAS,KAAK,CAAA;EAK1E,MAAMC,aAAgB,GAAAC,OAAA,CACpB,MAAMR,cAAcS,iBAAE,EACtB,CAACT,WAAW,CACd,CAAA;EACA,MAAMU,yBAA4B,GAAAF,OAAA,CAChC,MAAMR,cAAcW,eAAgB,CAAAC,OAAA,EACpC,CAACZ,WAAW,CACd,C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AAAE,GAAA,CAAC0D,gCAAA,EAAA;YACCC,WAAW,CAAC7D,QAAA;YACZ8D,KAAA,EAAOpG,eAAkB,GAAA,CAAA,GAAI,qBAAwB,GAAA,OAAA;YACrDqG,eAAiB,EAAA,GAAA;YACjBC,iBAAmB,EAAA,CAAA,CAAA;YACnBC,cAAc7I,QAAS,CAAA4B,MAAA;YACvBkH,cAAgB,EAAAxG,eAAA;YAChBN;UAAA,CAAA;QACF,CAEJ,CAAA,EAEC,eAAA8C,GAAA,CAAAsD,iBAAA,EAAA;UAAkBC,KAAO,EAAA;YAAEU,KAAO,EAAA;UAAA,CAAK;UAAAR,SAAA,EAAWlI,gBAChD;UAAAgE,QAAA,EAAAA,CAAC;YAAE2E;UACF,CAAA,KAAA,eAAAlE,GAAA,CAAC0D,gCAAA,EAAA;YACCC,WAAW,CAACO,QAAA;YACZN,KAAM,EAAA,OAAA;YACNC,eAAiB,EAAA,CAAA;YACjBC,iBAAmB,EAAA,CAAA;YACnBC,cAAc7I,QAAS,CAAA4B,MAAA;YACvBkH,cAAgB,EAAAxG,eAAA;YAChBN;UAAA,CAAA;QAGN,CAAA,CAAA;MAAA,CACF;IACF,CAAA;EAAA;AAEJ,CAAA;"}
|
|
@@ -102,11 +102,12 @@ const ProductHeader = ({
|
|
|
102
102
|
})
|
|
103
103
|
}), /* @__PURE__ */jsxRuntime.jsxs(CompareTable_styles.ProductMeta, {
|
|
104
104
|
ref: productMetaRef,
|
|
105
|
-
children: [linkToStoreTitleClick && storeHref || !linkToStoreTitleClick && techspecsHref ? /* @__PURE__ */jsxRuntime.
|
|
106
|
-
children: /* @__PURE__ */jsxRuntime.jsxs(Tooltip.Tooltip, {
|
|
105
|
+
children: [linkToStoreTitleClick && storeHref || !linkToStoreTitleClick && techspecsHref ? /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
106
|
+
children: [/* @__PURE__ */jsxRuntime.jsx(CompareTable_styles.ProductHeaderTooltipStyles, {}), /* @__PURE__ */jsxRuntime.jsxs(Tooltip.Tooltip, {
|
|
107
107
|
motif: "light",
|
|
108
108
|
position: toolTipIsPositionedTop ? "top" : "bottom",
|
|
109
109
|
tooltipClassName: CompareTable_styles.PRODUCT_HEADER_TOOLTIP_CLASSNAME,
|
|
110
|
+
portal: true,
|
|
110
111
|
isInteractive: true,
|
|
111
112
|
description: /* @__PURE__ */jsxRuntime.jsxs(CompareTable_styles.ProductHeaderTooltipLink, {
|
|
112
113
|
href: productTitleHref,
|
|
@@ -122,7 +123,7 @@ const ProductHeader = ({
|
|
|
122
123
|
ref: productTitleRef,
|
|
123
124
|
children: formatMessage(product.title)
|
|
124
125
|
})]
|
|
125
|
-
}, `tooltip-${product.id}`)
|
|
126
|
+
}, `tooltip-${product.id}`)]
|
|
126
127
|
}) : /* @__PURE__ */jsxRuntime.jsx(CompareTable_styles.ProductTitle, {
|
|
127
128
|
children: formatMessage(product.title)
|
|
128
129
|
}), !!product?.productNote && /* @__PURE__ */jsxRuntime.jsx(CompareTable_styles.ProductNote, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductHeader.js","sources":["../../../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/ProductHeader/ProductHeader.tsx"],"sourcesContent":["import { Tooltip } from \"@ubnt/ui-components/Tooltip\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport closeIcon from \"../../../../../../constants/modelCompareData/assets/close.svg\";\nimport { useModelCompareTranslation } from \"../../../../../../constants/modelCompareData/translations/useModelCompareTranslation\";\nimport { useMenu } from \"../../../../../../contexts/MenuContext/context\";\nimport { imageSrc } from \"../../../../../../utils/asset\";\nimport { HEADER_HEIGHT } from \"../../../../../Header/Header.styles\";\nimport { Reveal } from \"../../../../../Reveal/Reveal\";\nimport { StyleableSvgImage } from \"../../../../../StyleableSvgImage\";\nimport * as S from \"../../../CompareTable.styles\";\nimport { getStoreHref } from \"../../../helpers/getStoreHref\";\nimport { Badges } from \"../Badges/Badges\";\nimport type { ProductHeaderProps } from \"./ProductHeader.types\";\n\nexport const ProductHeader = ({\n product,\n setSelectedProducts,\n index,\n setExternalState,\n selectedProducts,\n linkToStoreTitleClick,\n hasBeenObserved,\n isLessThanOrEqualToFiveProducts,\n hasMultipleProductsSelected,\n isSmallScreen,\n showBadges,\n isStaticProduct,\n}: ProductHeaderProps) => {\n const { formatMessage } = useModelCompareTranslation();\n const { createSiteUrl, languageDirection, storeId } = useMenu();\n const [productTitleWidth, setProductTitleWidth] = useState<\n number | undefined\n >(undefined);\n const [toolTipIsPositionedTop, setToolTipIsPositionedTop] = useState(true);\n\n const productTitleRef = useRef<HTMLAnchorElement | HTMLButtonElement | null>(\n null,\n );\n const productMetaRef = useRef<HTMLDivElement | null>(null);\n\n const storeHref = useMemo(\n () => getStoreHref({ product, createSiteUrl, storeId }),\n [product, createSiteUrl, storeId],\n );\n\n const techspecsHref = useMemo(\n () => product.techspecsPath && createSiteUrl(product.techspecsPath),\n [createSiteUrl, product.techspecsPath],\n );\n\n const productTitleHref = useMemo(\n () => (linkToStoreTitleClick ? storeHref : techspecsHref),\n [linkToStoreTitleClick, storeHref, techspecsHref],\n );\n\n const removeHandler = useCallback(() => {\n const updatedProducts =\n selectedProducts &&\n selectedProducts.filter(\n (selectedProduct) => selectedProduct.productId !== product.id,\n );\n\n if (setExternalState && updatedProducts) {\n setExternalState(updatedProducts);\n }\n\n if (updatedProducts && setSelectedProducts) {\n setSelectedProducts(updatedProducts);\n }\n }, [product.id, selectedProducts, setExternalState, setSelectedProducts]);\n\n useEffect(() => {\n if (!productTitleRef.current) return;\n\n setProductTitleWidth(productTitleRef.current.getBoundingClientRect().width);\n }, [productTitleRef]);\n\n useEffect(() => {\n const scrollHandler = () => {\n const APPROXIMATE_TOOLTIP_HEIGHT = 45;\n if (productMetaRef.current)\n setToolTipIsPositionedTop(\n productMetaRef.current.getBoundingClientRect().top >\n HEADER_HEIGHT + APPROXIMATE_TOOLTIP_HEIGHT,\n );\n };\n\n document.addEventListener(\"scroll\", scrollHandler);\n\n return () => {\n document.removeEventListener(\"scroll\", scrollHandler);\n };\n }, []);\n\n return (\n <Reveal index={index} playAnimation={hasBeenObserved}>\n <S.HeaderGridItem>\n {!isLessThanOrEqualToFiveProducts &&\n hasMultipleProductsSelected &&\n !isStaticProduct && (\n <S.RemoveProductButton\n type=\"button\"\n $isSmallScreen={isSmallScreen}\n onClick={removeHandler}\n >\n <StyleableSvgImage src={closeIcon} width={16} height={16} />\n </S.RemoveProductButton>\n )}\n <S.ProductImageWrap height={product.image.height}>\n <S.ProductImage\n loading=\"lazy\"\n decoding=\"async\"\n src={imageSrc(product.image.src)}\n width={product.image.width}\n alt={formatMessage(product.title)}\n />\n </S.ProductImageWrap>\n <S.ProductMeta ref={productMetaRef}>\n {(linkToStoreTitleClick && storeHref) ||\n (!linkToStoreTitleClick && techspecsHref) ? (\n <S.ProductHeaderTooltipStyles>\n <Tooltip\n key={`tooltip-${product.id}`}\n motif=\"light\"\n position={toolTipIsPositionedTop ? \"top\" : \"bottom\"}\n tooltipClassName={S.PRODUCT_HEADER_TOOLTIP_CLASSNAME}\n isInteractive\n description={\n <S.ProductHeaderTooltipLink\n href={productTitleHref}\n target=\"__blank\"\n >\n {formatMessage(\"modelCompare.reviewIn.tooltip\")} Tech Specs\n </S.ProductHeaderTooltipLink>\n }\n >\n <S.ProductHeaderTooltipHoverArea\n $width={productTitleWidth}\n $tooltipIsPositionedTop={toolTipIsPositionedTop}\n />\n <S.ProductTitleLink variant=\"link\" anchor ref={productTitleRef}>\n {formatMessage(product.title)}\n </S.ProductTitleLink>\n </Tooltip>\n </S.ProductHeaderTooltipStyles>\n ) : (\n <S.ProductTitle>{formatMessage(product.title)}</S.ProductTitle>\n )}\n {!!product?.productNote && (\n <S.ProductNote>{formatMessage(product.productNote)}</S.ProductNote>\n )}\n {product.description ? (\n <S.ProductDescription\n $maxWidth={product.descriptionMaxWidth}\n $direction={languageDirection}\n >\n {formatMessage(product.description)}\n </S.ProductDescription>\n ) : null}\n {showBadges && (\n <S.BadgeWrapper>{<Badges product={product} />}</S.BadgeWrapper>\n )}\n </S.ProductMeta>\n </S.HeaderGridItem>\n </Reveal>\n );\n};\n"],"names":["ProductHeader","product","setSelectedProducts","index","setExternalState","selectedProducts","linkToStoreTitleClick","hasBeenObserved","isLessThanOrEqualToFiveProducts","hasMultipleProductsSelected","isSmallScreen","showBadges","isStaticProduct","formatMessage","useModelCompareTranslation","createSiteUrl","languageDirection","storeId","useMenu","productTitleWidth","setProductTitleWidth","useState","toolTipIsPositionedTop","setToolTipIsPositionedTop","productTitleRef","useRef","productMetaRef","storeHref","useMemo","getStoreHref","techspecsHref","techspecsPath","productTitleHref","removeHandler","useCallback","updatedProducts","filter","selectedProduct","productId","id","useEffect","current","getBoundingClientRect","width","scrollHandler","APPROXIMATE_TOOLTIP_HEIGHT","top","HEADER_HEIGHT","document","addEventListener","removeEventListener","jsx","Reveal","playAnimation","children","jsxs","S.HeaderGridItem","S.RemoveProductButton","RemoveProductButton","type","$isSmallScreen","onClick","StyleableSvgImage","src","closeIcon","height","S.ProductImageWrap","ProductImageWrap","image","S.ProductImage","ProductImage","loading","decoding","imageSrc","alt","title","S.ProductMeta","ref","S.ProductHeaderTooltipStyles","Tooltip","motif","position","tooltipClassName","S.PRODUCT_HEADER_TOOLTIP_CLASSNAME","PRODUCT_HEADER_TOOLTIP_CLASSNAME","isInteractive","description","S.ProductHeaderTooltipLink","ProductHeaderTooltipLink","href","target","S.ProductHeaderTooltipHoverArea","ProductHeaderTooltipHoverArea","$width","$tooltipIsPositionedTop","S.ProductTitleLink","variant","anchor","S.ProductTitle","productNote","S.ProductNote","ProductNote","S.ProductDescription","ProductDescription","$maxWidth","descriptionMaxWidth","$direction","S.BadgeWrapper","Badges"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAeO,MAAMA,gBAAgBA,CAAC;EAC5BC,OAAA;EACAC,mBAAA;EACAC,KAAA;EACAC,gBAAA;EACAC,gB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ACF;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ProductHeader.js","sources":["../../../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/ProductHeader/ProductHeader.tsx"],"sourcesContent":["import { Tooltip } from \"@ubnt/ui-components/Tooltip\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport closeIcon from \"../../../../../../constants/modelCompareData/assets/close.svg\";\nimport { useModelCompareTranslation } from \"../../../../../../constants/modelCompareData/translations/useModelCompareTranslation\";\nimport { useMenu } from \"../../../../../../contexts/MenuContext/context\";\nimport { imageSrc } from \"../../../../../../utils/asset\";\nimport { HEADER_HEIGHT } from \"../../../../../Header/Header.styles\";\nimport { Reveal } from \"../../../../../Reveal/Reveal\";\nimport { StyleableSvgImage } from \"../../../../../StyleableSvgImage\";\nimport * as S from \"../../../CompareTable.styles\";\nimport { getStoreHref } from \"../../../helpers/getStoreHref\";\nimport { Badges } from \"../Badges/Badges\";\nimport type { ProductHeaderProps } from \"./ProductHeader.types\";\n\nexport const ProductHeader = ({\n product,\n setSelectedProducts,\n index,\n setExternalState,\n selectedProducts,\n linkToStoreTitleClick,\n hasBeenObserved,\n isLessThanOrEqualToFiveProducts,\n hasMultipleProductsSelected,\n isSmallScreen,\n showBadges,\n isStaticProduct,\n}: ProductHeaderProps) => {\n const { formatMessage } = useModelCompareTranslation();\n const { createSiteUrl, languageDirection, storeId } = useMenu();\n const [productTitleWidth, setProductTitleWidth] = useState<\n number | undefined\n >(undefined);\n const [toolTipIsPositionedTop, setToolTipIsPositionedTop] = useState(true);\n\n const productTitleRef = useRef<HTMLAnchorElement | HTMLButtonElement | null>(\n null,\n );\n const productMetaRef = useRef<HTMLDivElement | null>(null);\n\n const storeHref = useMemo(\n () => getStoreHref({ product, createSiteUrl, storeId }),\n [product, createSiteUrl, storeId],\n );\n\n const techspecsHref = useMemo(\n () => product.techspecsPath && createSiteUrl(product.techspecsPath),\n [createSiteUrl, product.techspecsPath],\n );\n\n const productTitleHref = useMemo(\n () => (linkToStoreTitleClick ? storeHref : techspecsHref),\n [linkToStoreTitleClick, storeHref, techspecsHref],\n );\n\n const removeHandler = useCallback(() => {\n const updatedProducts =\n selectedProducts &&\n selectedProducts.filter(\n (selectedProduct) => selectedProduct.productId !== product.id,\n );\n\n if (setExternalState && updatedProducts) {\n setExternalState(updatedProducts);\n }\n\n if (updatedProducts && setSelectedProducts) {\n setSelectedProducts(updatedProducts);\n }\n }, [product.id, selectedProducts, setExternalState, setSelectedProducts]);\n\n useEffect(() => {\n if (!productTitleRef.current) return;\n\n setProductTitleWidth(productTitleRef.current.getBoundingClientRect().width);\n }, [productTitleRef]);\n\n useEffect(() => {\n const scrollHandler = () => {\n const APPROXIMATE_TOOLTIP_HEIGHT = 45;\n if (productMetaRef.current)\n setToolTipIsPositionedTop(\n productMetaRef.current.getBoundingClientRect().top >\n HEADER_HEIGHT + APPROXIMATE_TOOLTIP_HEIGHT,\n );\n };\n\n document.addEventListener(\"scroll\", scrollHandler);\n\n return () => {\n document.removeEventListener(\"scroll\", scrollHandler);\n };\n }, []);\n\n return (\n <Reveal index={index} playAnimation={hasBeenObserved}>\n <S.HeaderGridItem>\n {!isLessThanOrEqualToFiveProducts &&\n hasMultipleProductsSelected &&\n !isStaticProduct && (\n <S.RemoveProductButton\n type=\"button\"\n $isSmallScreen={isSmallScreen}\n onClick={removeHandler}\n >\n <StyleableSvgImage src={closeIcon} width={16} height={16} />\n </S.RemoveProductButton>\n )}\n <S.ProductImageWrap height={product.image.height}>\n <S.ProductImage\n loading=\"lazy\"\n decoding=\"async\"\n src={imageSrc(product.image.src)}\n width={product.image.width}\n alt={formatMessage(product.title)}\n />\n </S.ProductImageWrap>\n <S.ProductMeta ref={productMetaRef}>\n {(linkToStoreTitleClick && storeHref) ||\n (!linkToStoreTitleClick && techspecsHref) ? (\n <>\n {/* Instantiates global styles for ProductHeader's tooltip */}\n <S.ProductHeaderTooltipStyles />\n <Tooltip\n key={`tooltip-${product.id}`}\n motif=\"light\"\n position={toolTipIsPositionedTop ? \"top\" : \"bottom\"}\n tooltipClassName={S.PRODUCT_HEADER_TOOLTIP_CLASSNAME}\n portal\n isInteractive\n description={\n <S.ProductHeaderTooltipLink\n href={productTitleHref}\n target=\"__blank\"\n >\n {formatMessage(\"modelCompare.reviewIn.tooltip\")} Tech Specs\n </S.ProductHeaderTooltipLink>\n }\n >\n <S.ProductHeaderTooltipHoverArea\n $width={productTitleWidth}\n $tooltipIsPositionedTop={toolTipIsPositionedTop}\n />\n <S.ProductTitleLink variant=\"link\" anchor ref={productTitleRef}>\n {formatMessage(product.title)}\n </S.ProductTitleLink>\n </Tooltip>\n </>\n ) : (\n <S.ProductTitle>{formatMessage(product.title)}</S.ProductTitle>\n )}\n {!!product?.productNote && (\n <S.ProductNote>{formatMessage(product.productNote)}</S.ProductNote>\n )}\n {product.description ? (\n <S.ProductDescription\n $maxWidth={product.descriptionMaxWidth}\n $direction={languageDirection}\n >\n {formatMessage(product.description)}\n </S.ProductDescription>\n ) : null}\n {showBadges && (\n <S.BadgeWrapper>{<Badges product={product} />}</S.BadgeWrapper>\n )}\n </S.ProductMeta>\n </S.HeaderGridItem>\n </Reveal>\n );\n};\n"],"names":["ProductHeader","product","setSelectedProducts","index","setExternalState","selectedProducts","linkToStoreTitleClick","hasBeenObserved","isLessThanOrEqualToFiveProducts","hasMultipleProductsSelected","isSmallScreen","showBadges","isStaticProduct","formatMessage","useModelCompareTranslation","createSiteUrl","languageDirection","storeId","useMenu","productTitleWidth","setProductTitleWidth","useState","toolTipIsPositionedTop","setToolTipIsPositionedTop","productTitleRef","useRef","productMetaRef","storeHref","useMemo","getStoreHref","techspecsHref","techspecsPath","productTitleHref","removeHandler","useCallback","updatedProducts","filter","selectedProduct","productId","id","useEffect","current","getBoundingClientRect","width","scrollHandler","APPROXIMATE_TOOLTIP_HEIGHT","top","HEADER_HEIGHT","document","addEventListener","removeEventListener","jsx","Reveal","playAnimation","children","jsxs","S.HeaderGridItem","S.RemoveProductButton","RemoveProductButton","type","$isSmallScreen","onClick","StyleableSvgImage","src","closeIcon","height","S.ProductImageWrap","ProductImageWrap","image","S.ProductImage","ProductImage","loading","decoding","imageSrc","alt","title","S.ProductMeta","ref","Fragment","S.ProductHeaderTooltipStyles","Tooltip","motif","position","tooltipClassName","S.PRODUCT_HEADER_TOOLTIP_CLASSNAME","PRODUCT_HEADER_TOOLTIP_CLASSNAME","portal","isInteractive","description","S.ProductHeaderTooltipLink","ProductHeaderTooltipLink","href","target","S.ProductHeaderTooltipHoverArea","ProductHeaderTooltipHoverArea","$width","$tooltipIsPositionedTop","S.ProductTitleLink","variant","anchor","S.ProductTitle","productNote","S.ProductNote","ProductNote","S.ProductDescription","ProductDescription","$maxWidth","descriptionMaxWidth","$direction","S.BadgeWrapper","Badges"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAeO,MAAMA,gBAAgBA,CAAC;EAC5BC,OAAA;EACAC,mBAAA;EACAC,KAAA;EACAC,gBAAA;EACAC,gBAAA;EACAC,qBAAA;EACAC,eAAA;EACAC,+BAAA;EACAC,2BAAA;EACAC,aAAA;EACAC,UAAA;EACAC;AACF,CAA0B,KAAA;EAClB,MAAA;IAAEC;EAAc,CAAA,GAAIC,qDAA2B,CAAA,CAAA;EACrD,MAAM;IAAEC,aAAA;IAAeC,iBAAmB;IAAAC;EAAA,IAAYC,OAAAA,CAAAA,OAAQ,CAAA,CAAA;EAC9D,MAAM,CAACC,iBAAA,EAAmBC,oBAAoB,CAAA,GAAIC,eAEhD,KAAS,CAAA,CAAA;EACX,MAAM,CAACC,sBAAA,EAAwBC,yBAAyB,CAAA,GAAIF,KAAAA,CAAAA,SAAS,IAAI,CAAA;EAEzE,MAAMG,eAAkB,GAAAC,KAAA,CAAAA,MAAA,CACtB,IACF,CAAA;EACM,MAAAC,cAAA,GAAiBD,aAA8B,IAAI,CAAA;EAEzD,MAAME,SAAY,GAAAC,KAAA,CAAAA,OAAA,CAChB,MA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AAQsC,EAAE,EAAA,CAAA;SAuB9B,CAAA,GAAA,8BAEC6D,gCAAE,EAAF;UAAgB9C,QAAc,EAAAzC,aAAA,CAAAZ,OAAA,CAAQ0E,KAAK;SAAE,CAAA,EAE/C,CAAC,CAAC1E,OAAA,EAASoG,WACV,IAAAlD,eAAAA,UAAAA,CAAAA,GAAA,CAACmD,mBAAE,CAAAC,WAAA,EAAF;UAAejD,QAAA,EAAAzC,aAAA,CAAcZ,OAAQ,CAAAoG,WAAW;SAAE,CAAA,EAEpDpG,QAAQuF,WACP,GAAA,eAAArC,UAAA,CAAAA,GAAA,CAACqD,mBAAE,CAAAC,kBAAA,EAAF;UACCC,WAAWzG,OAAQ,CAAA0G,mBAAA;UACnBC,UAAY,EAAA5F,iBAAA;UAEXsC,QAAA,EAAAzC,aAAA,CAAcZ,QAAQuF,WAAW;QAAA,CAAA,CAElC,GAAA,IAAA,EACH7E,UAAA,kCACEkG,mBAAAA,CAAAA,YAAE,EAAF;UAAgBvD,QAAC,EAAAH,eAAAA,UAAAA,CAAAA,GAAA,CAAA2D,MAAA,CAAAA,MAAA,EAAA;YAAO7G;WAAkB;QAAG,CAAA,CAAA;MAElD,CAAA,CAAA;IAAA,CACF;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { Tooltip } from '@ubnt/ui-components/Tooltip';
|
|
3
3
|
import { useState, useRef, useMemo, useCallback, useEffect } from 'react';
|
|
4
4
|
import '../../../../../../constants/modelCompareData/assets/close.svg.mjs';
|
|
@@ -94,11 +94,12 @@ const ProductHeader = ({
|
|
|
94
94
|
})
|
|
95
95
|
}), /* @__PURE__ */jsxs(ProductMeta, {
|
|
96
96
|
ref: productMetaRef,
|
|
97
|
-
children: [linkToStoreTitleClick && storeHref || !linkToStoreTitleClick && techspecsHref ? /* @__PURE__ */
|
|
98
|
-
children: /* @__PURE__ */jsxs(Tooltip, {
|
|
97
|
+
children: [linkToStoreTitleClick && storeHref || !linkToStoreTitleClick && techspecsHref ? /* @__PURE__ */jsxs(Fragment, {
|
|
98
|
+
children: [/* @__PURE__ */jsx(ProductHeaderTooltipStyles, {}), /* @__PURE__ */jsxs(Tooltip, {
|
|
99
99
|
motif: "light",
|
|
100
100
|
position: toolTipIsPositionedTop ? "top" : "bottom",
|
|
101
101
|
tooltipClassName: PRODUCT_HEADER_TOOLTIP_CLASSNAME,
|
|
102
|
+
portal: true,
|
|
102
103
|
isInteractive: true,
|
|
103
104
|
description: /* @__PURE__ */jsxs(ProductHeaderTooltipLink, {
|
|
104
105
|
href: productTitleHref,
|
|
@@ -114,7 +115,7 @@ const ProductHeader = ({
|
|
|
114
115
|
ref: productTitleRef,
|
|
115
116
|
children: formatMessage(product.title)
|
|
116
117
|
})]
|
|
117
|
-
}, `tooltip-${product.id}`)
|
|
118
|
+
}, `tooltip-${product.id}`)]
|
|
118
119
|
}) : /* @__PURE__ */jsx(ProductTitle, {
|
|
119
120
|
children: formatMessage(product.title)
|
|
120
121
|
}), !!product?.productNote && /* @__PURE__ */jsx(ProductNote, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductHeader.mjs","sources":["../../../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/ProductHeader/ProductHeader.tsx"],"sourcesContent":["import { Tooltip } from \"@ubnt/ui-components/Tooltip\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport closeIcon from \"../../../../../../constants/modelCompareData/assets/close.svg\";\nimport { useModelCompareTranslation } from \"../../../../../../constants/modelCompareData/translations/useModelCompareTranslation\";\nimport { useMenu } from \"../../../../../../contexts/MenuContext/context\";\nimport { imageSrc } from \"../../../../../../utils/asset\";\nimport { HEADER_HEIGHT } from \"../../../../../Header/Header.styles\";\nimport { Reveal } from \"../../../../../Reveal/Reveal\";\nimport { StyleableSvgImage } from \"../../../../../StyleableSvgImage\";\nimport * as S from \"../../../CompareTable.styles\";\nimport { getStoreHref } from \"../../../helpers/getStoreHref\";\nimport { Badges } from \"../Badges/Badges\";\nimport type { ProductHeaderProps } from \"./ProductHeader.types\";\n\nexport const ProductHeader = ({\n product,\n setSelectedProducts,\n index,\n setExternalState,\n selectedProducts,\n linkToStoreTitleClick,\n hasBeenObserved,\n isLessThanOrEqualToFiveProducts,\n hasMultipleProductsSelected,\n isSmallScreen,\n showBadges,\n isStaticProduct,\n}: ProductHeaderProps) => {\n const { formatMessage } = useModelCompareTranslation();\n const { createSiteUrl, languageDirection, storeId } = useMenu();\n const [productTitleWidth, setProductTitleWidth] = useState<\n number | undefined\n >(undefined);\n const [toolTipIsPositionedTop, setToolTipIsPositionedTop] = useState(true);\n\n const productTitleRef = useRef<HTMLAnchorElement | HTMLButtonElement | null>(\n null,\n );\n const productMetaRef = useRef<HTMLDivElement | null>(null);\n\n const storeHref = useMemo(\n () => getStoreHref({ product, createSiteUrl, storeId }),\n [product, createSiteUrl, storeId],\n );\n\n const techspecsHref = useMemo(\n () => product.techspecsPath && createSiteUrl(product.techspecsPath),\n [createSiteUrl, product.techspecsPath],\n );\n\n const productTitleHref = useMemo(\n () => (linkToStoreTitleClick ? storeHref : techspecsHref),\n [linkToStoreTitleClick, storeHref, techspecsHref],\n );\n\n const removeHandler = useCallback(() => {\n const updatedProducts =\n selectedProducts &&\n selectedProducts.filter(\n (selectedProduct) => selectedProduct.productId !== product.id,\n );\n\n if (setExternalState && updatedProducts) {\n setExternalState(updatedProducts);\n }\n\n if (updatedProducts && setSelectedProducts) {\n setSelectedProducts(updatedProducts);\n }\n }, [product.id, selectedProducts, setExternalState, setSelectedProducts]);\n\n useEffect(() => {\n if (!productTitleRef.current) return;\n\n setProductTitleWidth(productTitleRef.current.getBoundingClientRect().width);\n }, [productTitleRef]);\n\n useEffect(() => {\n const scrollHandler = () => {\n const APPROXIMATE_TOOLTIP_HEIGHT = 45;\n if (productMetaRef.current)\n setToolTipIsPositionedTop(\n productMetaRef.current.getBoundingClientRect().top >\n HEADER_HEIGHT + APPROXIMATE_TOOLTIP_HEIGHT,\n );\n };\n\n document.addEventListener(\"scroll\", scrollHandler);\n\n return () => {\n document.removeEventListener(\"scroll\", scrollHandler);\n };\n }, []);\n\n return (\n <Reveal index={index} playAnimation={hasBeenObserved}>\n <S.HeaderGridItem>\n {!isLessThanOrEqualToFiveProducts &&\n hasMultipleProductsSelected &&\n !isStaticProduct && (\n <S.RemoveProductButton\n type=\"button\"\n $isSmallScreen={isSmallScreen}\n onClick={removeHandler}\n >\n <StyleableSvgImage src={closeIcon} width={16} height={16} />\n </S.RemoveProductButton>\n )}\n <S.ProductImageWrap height={product.image.height}>\n <S.ProductImage\n loading=\"lazy\"\n decoding=\"async\"\n src={imageSrc(product.image.src)}\n width={product.image.width}\n alt={formatMessage(product.title)}\n />\n </S.ProductImageWrap>\n <S.ProductMeta ref={productMetaRef}>\n {(linkToStoreTitleClick && storeHref) ||\n (!linkToStoreTitleClick && techspecsHref) ? (\n <S.ProductHeaderTooltipStyles>\n <Tooltip\n key={`tooltip-${product.id}`}\n motif=\"light\"\n position={toolTipIsPositionedTop ? \"top\" : \"bottom\"}\n tooltipClassName={S.PRODUCT_HEADER_TOOLTIP_CLASSNAME}\n isInteractive\n description={\n <S.ProductHeaderTooltipLink\n href={productTitleHref}\n target=\"__blank\"\n >\n {formatMessage(\"modelCompare.reviewIn.tooltip\")} Tech Specs\n </S.ProductHeaderTooltipLink>\n }\n >\n <S.ProductHeaderTooltipHoverArea\n $width={productTitleWidth}\n $tooltipIsPositionedTop={toolTipIsPositionedTop}\n />\n <S.ProductTitleLink variant=\"link\" anchor ref={productTitleRef}>\n {formatMessage(product.title)}\n </S.ProductTitleLink>\n </Tooltip>\n </S.ProductHeaderTooltipStyles>\n ) : (\n <S.ProductTitle>{formatMessage(product.title)}</S.ProductTitle>\n )}\n {!!product?.productNote && (\n <S.ProductNote>{formatMessage(product.productNote)}</S.ProductNote>\n )}\n {product.description ? (\n <S.ProductDescription\n $maxWidth={product.descriptionMaxWidth}\n $direction={languageDirection}\n >\n {formatMessage(product.description)}\n </S.ProductDescription>\n ) : null}\n {showBadges && (\n <S.BadgeWrapper>{<Badges product={product} />}</S.BadgeWrapper>\n )}\n </S.ProductMeta>\n </S.HeaderGridItem>\n </Reveal>\n );\n};\n"],"names":["ProductHeader","product","setSelectedProducts","index","setExternalState","selectedProducts","linkToStoreTitleClick","hasBeenObserved","isLessThanOrEqualToFiveProducts","hasMultipleProductsSelected","isSmallScreen","showBadges","isStaticProduct","formatMessage","useModelCompareTranslation","createSiteUrl","languageDirection","storeId","useMenu","productTitleWidth","setProductTitleWidth","useState","toolTipIsPositionedTop","setToolTipIsPositionedTop","productTitleRef","useRef","productMetaRef","storeHref","useMemo","getStoreHref","techspecsHref","techspecsPath","productTitleHref","removeHandler","useCallback","updatedProducts","filter","selectedProduct","productId","id","useEffect","current","getBoundingClientRect","width","scrollHandler","APPROXIMATE_TOOLTIP_HEIGHT","top","HEADER_HEIGHT","document","addEventListener","removeEventListener","jsx","Reveal","playAnimation","children","jsxs","S.HeaderGridItem","S.RemoveProductButton","type","$isSmallScreen","onClick","StyleableSvgImage","src","closeIcon","height","S.ProductImageWrap","image","S.ProductImage","loading","decoding","imageSrc","alt","title","S.ProductMeta","ref","S.ProductHeaderTooltipStyles","Tooltip","motif","position","tooltipClassName","S.PRODUCT_HEADER_TOOLTIP_CLASSNAME","isInteractive","description","S.ProductHeaderTooltipLink","href","target","S.ProductHeaderTooltipHoverArea","$width","$tooltipIsPositionedTop","S.ProductTitleLink","variant","anchor","S.ProductTitle","productNote","S.ProductNote","S.ProductDescription","$maxWidth","descriptionMaxWidth","$direction","S.BadgeWrapper","Badges"],"mappings":";;;;;;;;;;;;;;;;AAeO,MAAMA,gBAAgBA,CAAC;EAC5BC,OAAA;EACAC,mBAAA;EACAC,KAAA;EACAC,gBAAA;EACAC,gBAAA;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CAAA,EApBK,WAAWvE,QAAQsC,EAAE,EAAA;SAsB9B,mBAECY,GAAA,CAAAyC,cAAA;UAAgBtC,QAAA,EAAAzC,aAAA,CAAcZ,OAAQ,CAAAuE,KAAK;SAAE,CAAA,EAE/C,CAAC,CAACvE,OAAA,EAAS4F,WACV,IAAA,eAAA1C,GAAA,CAAC2C,WAAE,EAAF;UAAexC,QAAA,EAAAzC,aAAA,CAAcZ,OAAQ,CAAA4F,WAAW;SAAE,CAAA,EAEpD5F,QAAQiF,WACP,GAAA,eAAA/B,GAAA,CAAC4C,kBAAE,EAAF;UACCC,WAAW/F,OAAQ,CAAAgG,mBAAA;UACnBC,UAAY,EAAAlF,iBAAA;UAEXsC,QAAA,EAAAzC,aAAA,CAAcZ,QAAQiF,WAAW;QAAA,CAAA,CAElC,GAAA,IAAA,EACHvE,UAAA,uBACEwF,YAAE,EAAF;UAAgB7C,QAAC,EAAA,eAAAH,GAAA,CAAAiD,MAAA,EAAA;YAAOnG;WAAkB;QAAG,CAAA,CAAA;MAElD,CAAA,CAAA;IAAA,CACF;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ProductHeader.mjs","sources":["../../../../../../../src/components/ModelCompareV4/CompareTable/CompareTableMarkup/components/ProductHeader/ProductHeader.tsx"],"sourcesContent":["import { Tooltip } from \"@ubnt/ui-components/Tooltip\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport closeIcon from \"../../../../../../constants/modelCompareData/assets/close.svg\";\nimport { useModelCompareTranslation } from \"../../../../../../constants/modelCompareData/translations/useModelCompareTranslation\";\nimport { useMenu } from \"../../../../../../contexts/MenuContext/context\";\nimport { imageSrc } from \"../../../../../../utils/asset\";\nimport { HEADER_HEIGHT } from \"../../../../../Header/Header.styles\";\nimport { Reveal } from \"../../../../../Reveal/Reveal\";\nimport { StyleableSvgImage } from \"../../../../../StyleableSvgImage\";\nimport * as S from \"../../../CompareTable.styles\";\nimport { getStoreHref } from \"../../../helpers/getStoreHref\";\nimport { Badges } from \"../Badges/Badges\";\nimport type { ProductHeaderProps } from \"./ProductHeader.types\";\n\nexport const ProductHeader = ({\n product,\n setSelectedProducts,\n index,\n setExternalState,\n selectedProducts,\n linkToStoreTitleClick,\n hasBeenObserved,\n isLessThanOrEqualToFiveProducts,\n hasMultipleProductsSelected,\n isSmallScreen,\n showBadges,\n isStaticProduct,\n}: ProductHeaderProps) => {\n const { formatMessage } = useModelCompareTranslation();\n const { createSiteUrl, languageDirection, storeId } = useMenu();\n const [productTitleWidth, setProductTitleWidth] = useState<\n number | undefined\n >(undefined);\n const [toolTipIsPositionedTop, setToolTipIsPositionedTop] = useState(true);\n\n const productTitleRef = useRef<HTMLAnchorElement | HTMLButtonElement | null>(\n null,\n );\n const productMetaRef = useRef<HTMLDivElement | null>(null);\n\n const storeHref = useMemo(\n () => getStoreHref({ product, createSiteUrl, storeId }),\n [product, createSiteUrl, storeId],\n );\n\n const techspecsHref = useMemo(\n () => product.techspecsPath && createSiteUrl(product.techspecsPath),\n [createSiteUrl, product.techspecsPath],\n );\n\n const productTitleHref = useMemo(\n () => (linkToStoreTitleClick ? storeHref : techspecsHref),\n [linkToStoreTitleClick, storeHref, techspecsHref],\n );\n\n const removeHandler = useCallback(() => {\n const updatedProducts =\n selectedProducts &&\n selectedProducts.filter(\n (selectedProduct) => selectedProduct.productId !== product.id,\n );\n\n if (setExternalState && updatedProducts) {\n setExternalState(updatedProducts);\n }\n\n if (updatedProducts && setSelectedProducts) {\n setSelectedProducts(updatedProducts);\n }\n }, [product.id, selectedProducts, setExternalState, setSelectedProducts]);\n\n useEffect(() => {\n if (!productTitleRef.current) return;\n\n setProductTitleWidth(productTitleRef.current.getBoundingClientRect().width);\n }, [productTitleRef]);\n\n useEffect(() => {\n const scrollHandler = () => {\n const APPROXIMATE_TOOLTIP_HEIGHT = 45;\n if (productMetaRef.current)\n setToolTipIsPositionedTop(\n productMetaRef.current.getBoundingClientRect().top >\n HEADER_HEIGHT + APPROXIMATE_TOOLTIP_HEIGHT,\n );\n };\n\n document.addEventListener(\"scroll\", scrollHandler);\n\n return () => {\n document.removeEventListener(\"scroll\", scrollHandler);\n };\n }, []);\n\n return (\n <Reveal index={index} playAnimation={hasBeenObserved}>\n <S.HeaderGridItem>\n {!isLessThanOrEqualToFiveProducts &&\n hasMultipleProductsSelected &&\n !isStaticProduct && (\n <S.RemoveProductButton\n type=\"button\"\n $isSmallScreen={isSmallScreen}\n onClick={removeHandler}\n >\n <StyleableSvgImage src={closeIcon} width={16} height={16} />\n </S.RemoveProductButton>\n )}\n <S.ProductImageWrap height={product.image.height}>\n <S.ProductImage\n loading=\"lazy\"\n decoding=\"async\"\n src={imageSrc(product.image.src)}\n width={product.image.width}\n alt={formatMessage(product.title)}\n />\n </S.ProductImageWrap>\n <S.ProductMeta ref={productMetaRef}>\n {(linkToStoreTitleClick && storeHref) ||\n (!linkToStoreTitleClick && techspecsHref) ? (\n <>\n {/* Instantiates global styles for ProductHeader's tooltip */}\n <S.ProductHeaderTooltipStyles />\n <Tooltip\n key={`tooltip-${product.id}`}\n motif=\"light\"\n position={toolTipIsPositionedTop ? \"top\" : \"bottom\"}\n tooltipClassName={S.PRODUCT_HEADER_TOOLTIP_CLASSNAME}\n portal\n isInteractive\n description={\n <S.ProductHeaderTooltipLink\n href={productTitleHref}\n target=\"__blank\"\n >\n {formatMessage(\"modelCompare.reviewIn.tooltip\")} Tech Specs\n </S.ProductHeaderTooltipLink>\n }\n >\n <S.ProductHeaderTooltipHoverArea\n $width={productTitleWidth}\n $tooltipIsPositionedTop={toolTipIsPositionedTop}\n />\n <S.ProductTitleLink variant=\"link\" anchor ref={productTitleRef}>\n {formatMessage(product.title)}\n </S.ProductTitleLink>\n </Tooltip>\n </>\n ) : (\n <S.ProductTitle>{formatMessage(product.title)}</S.ProductTitle>\n )}\n {!!product?.productNote && (\n <S.ProductNote>{formatMessage(product.productNote)}</S.ProductNote>\n )}\n {product.description ? (\n <S.ProductDescription\n $maxWidth={product.descriptionMaxWidth}\n $direction={languageDirection}\n >\n {formatMessage(product.description)}\n </S.ProductDescription>\n ) : null}\n {showBadges && (\n <S.BadgeWrapper>{<Badges product={product} />}</S.BadgeWrapper>\n )}\n </S.ProductMeta>\n </S.HeaderGridItem>\n </Reveal>\n );\n};\n"],"names":["ProductHeader","product","setSelectedProducts","index","setExternalState","selectedProducts","linkToStoreTitleClick","hasBeenObserved","isLessThanOrEqualToFiveProducts","hasMultipleProductsSelected","isSmallScreen","showBadges","isStaticProduct","formatMessage","useModelCompareTranslation","createSiteUrl","languageDirection","storeId","useMenu","productTitleWidth","setProductTitleWidth","useState","toolTipIsPositionedTop","setToolTipIsPositionedTop","productTitleRef","useRef","productMetaRef","storeHref","useMemo","getStoreHref","techspecsHref","techspecsPath","productTitleHref","removeHandler","useCallback","updatedProducts","filter","selectedProduct","productId","id","useEffect","current","getBoundingClientRect","width","scrollHandler","APPROXIMATE_TOOLTIP_HEIGHT","top","HEADER_HEIGHT","document","addEventListener","removeEventListener","jsx","Reveal","playAnimation","children","jsxs","S.HeaderGridItem","S.RemoveProductButton","type","$isSmallScreen","onClick","StyleableSvgImage","src","closeIcon","height","S.ProductImageWrap","image","S.ProductImage","loading","decoding","imageSrc","alt","title","S.ProductMeta","ref","Fragment","S.ProductHeaderTooltipStyles","Tooltip","motif","position","tooltipClassName","S.PRODUCT_HEADER_TOOLTIP_CLASSNAME","portal","isInteractive","description","S.ProductHeaderTooltipLink","href","target","S.ProductHeaderTooltipHoverArea","$width","$tooltipIsPositionedTop","S.ProductTitleLink","variant","anchor","S.ProductTitle","productNote","S.ProductNote","S.ProductDescription","$maxWidth","descriptionMaxWidth","$direction","S.BadgeWrapper","Badges"],"mappings":";;;;;;;;;;;;;;;;AAeO,MAAMA,gBAAgBA,CAAC;EAC5BC,OAAA;EACAC,mBAAA;EACAC,KAAA;EACAC,gBAAA;EACAC,gBAAA;EACAC,qBAAA;EACAC,eAAA;EACAC,+BAAA;EACAC,2BAA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AZ,OAAA,CAAQuE,KAAK;YAC9B,CAAA,CAAA;UAAA,CAAA,EArBK,WAAWvE,QAAQsC,EAAE,EAAA,CAAA;SAuB9B,CAAA,GAAA,mBAECuD,YAAE,EAAF;UAAgBxC,QAAc,EAAAzC,aAAA,CAAAZ,OAAA,CAAQuE,KAAK;SAAE,CAAA,EAE/C,CAAC,CAACvE,OAAA,EAAS8F,WACV,IAAA,eAAA5C,GAAA,CAAC6C,WAAE,EAAF;UAAe1C,QAAA,EAAAzC,aAAA,CAAcZ,OAAQ,CAAA8F,WAAW;SAAE,CAAA,EAEpD9F,QAAQmF,WACP,GAAA,eAAAjC,GAAA,CAAC8C,kBAAE,EAAF;UACCC,WAAWjG,OAAQ,CAAAkG,mBAAA;UACnBC,UAAY,EAAApF,iBAAA;UAEXsC,QAAA,EAAAzC,aAAA,CAAcZ,QAAQmF,WAAW;QAAA,CAAA,CAElC,GAAA,IAAA,EACHzE,UAAA,uBACE0F,YAAE,EAAF;UAAgB/C,QAAC,EAAA,eAAAH,GAAA,CAAAmD,MAAA,EAAA;YAAOrG;WAAkB;QAAG,CAAA,CAAA;MAElD,CAAA,CAAA;IAAA,CACF;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ModelCompareV4Props } from "./ModelCompareV4.types";
|
|
2
|
-
export declare const MODEL_COMPARE_V4_ANCHOR = "compare
|
|
2
|
+
export declare const MODEL_COMPARE_V4_ANCHOR = "compare";
|
|
3
3
|
export declare const ModelCompareV4: ({ headerStickOffset, overlayTopOffset, showBuyButton, onLinkClick, linkToStoreTitleClick, additionalProductData, section, defaultSelectedProductsCount, selectedProducts: externalSelectedProducts, setSelectedProducts: setExternalSelectedProducts, }: ModelCompareV4Props) => JSX.Element;
|
|
@@ -8,7 +8,7 @@ var constants = require('./constants.js');
|
|
|
8
8
|
var ModelCompareV4_styles = require('./ModelCompareV4.styles.js');
|
|
9
9
|
var ProductList = require('./ProductList/ProductList.js');
|
|
10
10
|
"use strict";
|
|
11
|
-
const MODEL_COMPARE_V4_ANCHOR = "compare
|
|
11
|
+
const MODEL_COMPARE_V4_ANCHOR = "compare";
|
|
12
12
|
const INTERSECTION_OBSERVER_THRESHOLD = 0.35;
|
|
13
13
|
const ModelCompareV4 = ({
|
|
14
14
|
headerStickOffset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelCompareV4.js","sources":["../../../src/components/ModelCompareV4/ModelCompareV4.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useWindowScroll } from \"react-use\";\n\nimport type {\n ProductListGroupId,\n SelectedProduct,\n} from \"../../constants/modelCompareData/types\";\nimport { CompareTable } from \"./CompareTable/CompareTable\";\nimport { SELECTED_PRODUCTS_LIMIT } from \"./constants\";\nimport * as S from \"./ModelCompareV4.styles\";\nimport type { ModelCompareV4Props } from \"./ModelCompareV4.types\";\nimport { ProductList } from \"./ProductList/ProductList\";\n\nexport const MODEL_COMPARE_V4_ANCHOR = \"compare-table-v4\";\n\nconst INTERSECTION_OBSERVER_THRESHOLD = 0.35;\n\nexport const ModelCompareV4 = ({\n headerStickOffset,\n overlayTopOffset,\n showBuyButton,\n onLinkClick,\n linkToStoreTitleClick,\n additionalProductData,\n section,\n defaultSelectedProductsCount = 2,\n selectedProducts: externalSelectedProducts,\n setSelectedProducts: setExternalSelectedProducts,\n}: ModelCompareV4Props) => {\n const hasProductList = useMemo(\n () => section.products.length > 5 && !section.isStaticTable,\n [section.products, section.isStaticTable],\n );\n\n const intersectionObserverObjectRef = useRef<HTMLDivElement | null>(null);\n\n const { y: scrollPositionY } = useWindowScroll();\n\n const userIsUnderneathIntersectionObserver = useMemo(() => {\n if (!intersectionObserverObjectRef.current) return false;\n\n return (\n intersectionObserverObjectRef.current.getBoundingClientRect().bottom <\n scrollPositionY\n );\n }, [scrollPositionY]);\n\n /**\n * TODO: Improve the name and logic of this variable and related code.\n * Currently, this variable is used whether ModelCompareV4 has a product list or not.\n * It should only be used if hasProductList is `true`. Why? Because if hasProductList\n * is `false` then selecting/deselecting products isn't possible. The gap between the\n * name of the variable and what it does can be confusing for future devs.\n */\n const defaultSelectedProducts = useMemo(\n () =>\n section.products\n .map((product) => ({ productId: product.id }))\n .slice(\n 0,\n hasProductList\n ? defaultSelectedProductsCount\n : section.products.length,\n ),\n [defaultSelectedProductsCount, hasProductList, section.products],\n );\n /**\n * TODO: rewrite the \"default selected products\" feature so we don't need to use a `useEffect`\n * to update the state of V4. We'll be able to remove this hackie `useRef` as a side-effect.\n */\n const defaultSelectedProductsRef = useRef(defaultSelectedProducts);\n\n const selectedProductsLimit = useMemo(() => {\n return section.products.length < SELECTED_PRODUCTS_LIMIT\n ? section.products.length\n : SELECTED_PRODUCTS_LIMIT;\n }, [section.products.length]);\n\n const [selectedProducts, setSelectedProducts] = useState<SelectedProduct[]>(\n [],\n );\n\n const [hasBeenObserved, setHasBeenObserved] = useState(false);\n\n const showProductGroups = section.showProductGroups !== false;\n\n // #############################################################################\n // Sets selectedProducts value\n // #############################################################################\n\n useEffect(() => {\n defaultSelectedProductsRef.current = defaultSelectedProducts;\n }, [defaultSelectedProducts]);\n\n useEffect(() => {\n setSelectedProducts(\n externalSelectedProducts ||\n (defaultSelectedProductsRef.current as SelectedProduct[]),\n );\n }, [section, externalSelectedProducts]);\n\n // #############################################################################\n // Intersection Observer Logic\n // #############################################################################\n const observerCallback = useCallback<IntersectionObserverCallback>(\n (entries) => {\n entries.forEach(\n (entry) =>\n entry.isIntersecting && !hasBeenObserved && setHasBeenObserved(true),\n );\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [setHasBeenObserved],\n );\n\n useEffect(() => {\n const observer = new IntersectionObserver(observerCallback, {\n threshold: hasProductList ? INTERSECTION_OBSERVER_THRESHOLD : 0,\n });\n\n const intersectionObserverObjectRefCurrent =\n intersectionObserverObjectRef.current;\n\n if (intersectionObserverObjectRefCurrent)\n observer.observe(intersectionObserverObjectRefCurrent);\n\n return () => {\n if (intersectionObserverObjectRefCurrent) {\n observer.unobserve(intersectionObserverObjectRefCurrent);\n observer.disconnect();\n }\n };\n }, [observerCallback, hasProductList]);\n\n return (\n <S.Container>\n {hasProductList && (\n <ProductList\n isOverviewPage={Boolean(section.isOverviewPage)}\n initialActiveGroup={\n section.products[0]?.productListGroup?.id as ProductListGroupId\n }\n products={section.products}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalSelectedProducts}\n // TODO: rename this property now that `userIsUnderneathIntersectionObserver` has been added\n hasBeenObserved={\n hasBeenObserved || userIsUnderneathIntersectionObserver\n }\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n />\n )}\n <CompareTable\n headerStickOffset={headerStickOffset}\n overlayTopOffset={overlayTopOffset}\n showBuyButton={showBuyButton}\n onLinkClick={onLinkClick}\n linkToStoreTitleClick={linkToStoreTitleClick}\n additionalProductData={additionalProductData}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalSelectedProducts={setExternalSelectedProducts}\n section={section}\n products={section.products}\n // TODO: rename this property now that `userIsUnderneathIntersectionObserver` has been added\n hasBeenObserved={\n hasBeenObserved || userIsUnderneathIntersectionObserver\n }\n selectedProductsLimit={selectedProductsLimit}\n isOverviewPage={Boolean(section.isOverviewPage)}\n isStaticTable={Boolean(section.isStaticTable)}\n />\n <S.InterSectionObserverObject\n ref={intersectionObserverObjectRef}\n // $hasProductList={hasProductList}\n />\n </S.Container>\n );\n};\n"],"names":["MODEL_COMPARE_V4_ANCHOR","INTERSECTION_OBSERVER_THRESHOLD","ModelCompareV4","headerStickOffset","overlayTopOffset","showBuyButton","onLinkClick","linkToStoreTitleClick","additionalProductData","section","defaultSelectedProductsCount","selectedProducts","externalSelectedProducts","setSelectedProducts","setExternalSelectedProducts","hasProductList","useMemo","products","length","isStaticTable","intersectionObserverObjectRef","useRef","y","scrollPositionY","useWindowScroll","userIsUnderneathIntersectionObserver","current","getBoundingClientRect","bottom","defaultSelectedProducts","map","product","productId","id","slice","defaultSelectedProductsRef","selectedProductsLimit","SELECTED_PRODUCTS_LIMIT","useState","hasBeenObserved","setHasBeenObserved","showProductGroups","useEffect","observerCallback","useCallback","entries","forEach","entry","isIntersecting","observer","IntersectionObserver","threshold","intersectionObserverObjectRefCurrent","observe","unobserve","disconnect","jsxs","S.Container","children","jsx","ProductList","isOverviewPage","Boolean","initialActiveGroup","productListGroup","setExternalState","CompareTable","S.InterSectionObserverObject","InterSectionObserverObject","ref"],"mappings":";;;;;;;;;;AAaO,MAAMA,uBAA0B,GAAA,kBAAA;AAEvC,MAAMC,+BAAkC,GAAA,IAAA;AAEjC,MAAMC,iBAAiBA,CAAC;EAC7BC,iBAAA;EACAC,gBAAA;EACAC,aAAA;EACAC,WAAA;EACAC,qBAAA;EACAC,qBAAA;EACAC,OAAA;EACAC,4BAA+B,GAAA,CAAA;EAC/BC,gBAAkB,EAAAC,wBAAA;EAClBC,mBAAqB,EAAAC;AACvB,CAA2B,KAAA;EACzB,MAAMC,cAAiB,GAAAC,KAAA,CAAAA,OAAA,CACrB,MAAMP,OAAQ,CAAAQ,QAAA,CAASC,MAAS,GAAA,CAAA,IAAK,CAACT,OAAQ,CAAAU,aAAA,EAC9C,CAACV,OAAA,CAAQQ,QAAU,EAAAR,OAAA,CAAQU,aAAa,CAC1C,CAAA;EAEM,MAAAC,6BAAA,GAAgCC,aAA8B,IAAI,CAAA;EAExE,MAAM;IAAEC,CAAA,EAAGC;EAAgB,CAAA,GAAIC,wBAAgB,CAAA,CAAA;EAEzC,MAAAC,oCAAA,GAAuCT,KAAAA,CAAAA,QAAQ,MAAM;IACrD,IAAA,CAACI,6BAA8B,CAAAM,OAAA,EAAgB,OAAA,KAAA;IAEnD,OACEN,6BAA8B,CAAAM,OAAA,CAAQC,qBAAsB,CAAA,CAAA,CAAEC,MAC9D,GAAAL,eAAA;EAAA,CAEJ,EAAG,CAACA,eAAe,CAAC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MACAC,WAAA;MACAC,qBAAA;MACAC,qBAAA;MACAG,gBAAA;MACAE,mBAAA;MACAC,2BAAA;MACAL,OAAA;MACAQ,UAAUR,OAAQ,CAAAQ,QAAA;MAElBsB,iBACEA,eAAmB,IAAAd,oCAAA;MAErBW,qBAAA;MACAyB,cAAA,EAAgBC,OAAQ,CAAArD,OAAA,CAAQoD,cAAc,CAAA;MAC9C1C,aAAA,EAAe2C,OAAQ,CAAArD,OAAA,CAAQU,aAAa;IAAA,CAC9C,CAAA,EAAA,eACAwC,UAAA,CAAAA,GAAA,CAACQ,qBAAE,CAAAC,0BAAA,EAAF;MACCC,GAAK,EAAAjD;IAAA,CAAA,CAAA;GAGT,CAAA;AAEJ,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"ModelCompareV4.js","sources":["../../../src/components/ModelCompareV4/ModelCompareV4.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useWindowScroll } from \"react-use\";\n\nimport type {\n ProductListGroupId,\n SelectedProduct,\n} from \"../../constants/modelCompareData/types\";\nimport { CompareTable } from \"./CompareTable/CompareTable\";\nimport { SELECTED_PRODUCTS_LIMIT } from \"./constants\";\nimport * as S from \"./ModelCompareV4.styles\";\nimport type { ModelCompareV4Props } from \"./ModelCompareV4.types\";\nimport { ProductList } from \"./ProductList/ProductList\";\n\nexport const MODEL_COMPARE_V4_ANCHOR = \"compare\";\n\nconst INTERSECTION_OBSERVER_THRESHOLD = 0.35;\n\nexport const ModelCompareV4 = ({\n headerStickOffset,\n overlayTopOffset,\n showBuyButton,\n onLinkClick,\n linkToStoreTitleClick,\n additionalProductData,\n section,\n defaultSelectedProductsCount = 2,\n selectedProducts: externalSelectedProducts,\n setSelectedProducts: setExternalSelectedProducts,\n}: ModelCompareV4Props) => {\n const hasProductList = useMemo(\n () => section.products.length > 5 && !section.isStaticTable,\n [section.products, section.isStaticTable],\n );\n\n const intersectionObserverObjectRef = useRef<HTMLDivElement | null>(null);\n\n const { y: scrollPositionY } = useWindowScroll();\n\n const userIsUnderneathIntersectionObserver = useMemo(() => {\n if (!intersectionObserverObjectRef.current) return false;\n\n return (\n intersectionObserverObjectRef.current.getBoundingClientRect().bottom <\n scrollPositionY\n );\n }, [scrollPositionY]);\n\n /**\n * TODO: Improve the name and logic of this variable and related code.\n * Currently, this variable is used whether ModelCompareV4 has a product list or not.\n * It should only be used if hasProductList is `true`. Why? Because if hasProductList\n * is `false` then selecting/deselecting products isn't possible. The gap between the\n * name of the variable and what it does can be confusing for future devs.\n */\n const defaultSelectedProducts = useMemo(\n () =>\n section.products\n .map((product) => ({ productId: product.id }))\n .slice(\n 0,\n hasProductList\n ? defaultSelectedProductsCount\n : section.products.length,\n ),\n [defaultSelectedProductsCount, hasProductList, section.products],\n );\n /**\n * TODO: rewrite the \"default selected products\" feature so we don't need to use a `useEffect`\n * to update the state of V4. We'll be able to remove this hackie `useRef` as a side-effect.\n */\n const defaultSelectedProductsRef = useRef(defaultSelectedProducts);\n\n const selectedProductsLimit = useMemo(() => {\n return section.products.length < SELECTED_PRODUCTS_LIMIT\n ? section.products.length\n : SELECTED_PRODUCTS_LIMIT;\n }, [section.products.length]);\n\n const [selectedProducts, setSelectedProducts] = useState<SelectedProduct[]>(\n [],\n );\n\n const [hasBeenObserved, setHasBeenObserved] = useState(false);\n\n const showProductGroups = section.showProductGroups !== false;\n\n // #############################################################################\n // Sets selectedProducts value\n // #############################################################################\n\n useEffect(() => {\n defaultSelectedProductsRef.current = defaultSelectedProducts;\n }, [defaultSelectedProducts]);\n\n useEffect(() => {\n setSelectedProducts(\n externalSelectedProducts ||\n (defaultSelectedProductsRef.current as SelectedProduct[]),\n );\n }, [section, externalSelectedProducts]);\n\n // #############################################################################\n // Intersection Observer Logic\n // #############################################################################\n const observerCallback = useCallback<IntersectionObserverCallback>(\n (entries) => {\n entries.forEach(\n (entry) =>\n entry.isIntersecting && !hasBeenObserved && setHasBeenObserved(true),\n );\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [setHasBeenObserved],\n );\n\n useEffect(() => {\n const observer = new IntersectionObserver(observerCallback, {\n threshold: hasProductList ? INTERSECTION_OBSERVER_THRESHOLD : 0,\n });\n\n const intersectionObserverObjectRefCurrent =\n intersectionObserverObjectRef.current;\n\n if (intersectionObserverObjectRefCurrent)\n observer.observe(intersectionObserverObjectRefCurrent);\n\n return () => {\n if (intersectionObserverObjectRefCurrent) {\n observer.unobserve(intersectionObserverObjectRefCurrent);\n observer.disconnect();\n }\n };\n }, [observerCallback, hasProductList]);\n\n return (\n <S.Container>\n {hasProductList && (\n <ProductList\n isOverviewPage={Boolean(section.isOverviewPage)}\n initialActiveGroup={\n section.products[0]?.productListGroup?.id as ProductListGroupId\n }\n products={section.products}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalSelectedProducts}\n // TODO: rename this property now that `userIsUnderneathIntersectionObserver` has been added\n hasBeenObserved={\n hasBeenObserved || userIsUnderneathIntersectionObserver\n }\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n />\n )}\n <CompareTable\n headerStickOffset={headerStickOffset}\n overlayTopOffset={overlayTopOffset}\n showBuyButton={showBuyButton}\n onLinkClick={onLinkClick}\n linkToStoreTitleClick={linkToStoreTitleClick}\n additionalProductData={additionalProductData}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalSelectedProducts={setExternalSelectedProducts}\n section={section}\n products={section.products}\n // TODO: rename this property now that `userIsUnderneathIntersectionObserver` has been added\n hasBeenObserved={\n hasBeenObserved || userIsUnderneathIntersectionObserver\n }\n selectedProductsLimit={selectedProductsLimit}\n isOverviewPage={Boolean(section.isOverviewPage)}\n isStaticTable={Boolean(section.isStaticTable)}\n />\n <S.InterSectionObserverObject\n ref={intersectionObserverObjectRef}\n // $hasProductList={hasProductList}\n />\n </S.Container>\n );\n};\n"],"names":["MODEL_COMPARE_V4_ANCHOR","INTERSECTION_OBSERVER_THRESHOLD","ModelCompareV4","headerStickOffset","overlayTopOffset","showBuyButton","onLinkClick","linkToStoreTitleClick","additionalProductData","section","defaultSelectedProductsCount","selectedProducts","externalSelectedProducts","setSelectedProducts","setExternalSelectedProducts","hasProductList","useMemo","products","length","isStaticTable","intersectionObserverObjectRef","useRef","y","scrollPositionY","useWindowScroll","userIsUnderneathIntersectionObserver","current","getBoundingClientRect","bottom","defaultSelectedProducts","map","product","productId","id","slice","defaultSelectedProductsRef","selectedProductsLimit","SELECTED_PRODUCTS_LIMIT","useState","hasBeenObserved","setHasBeenObserved","showProductGroups","useEffect","observerCallback","useCallback","entries","forEach","entry","isIntersecting","observer","IntersectionObserver","threshold","intersectionObserverObjectRefCurrent","observe","unobserve","disconnect","jsxs","S.Container","children","jsx","ProductList","isOverviewPage","Boolean","initialActiveGroup","productListGroup","setExternalState","CompareTable","S.InterSectionObserverObject","InterSectionObserverObject","ref"],"mappings":";;;;;;;;;;AAaO,MAAMA,uBAA0B,GAAA,SAAA;AAEvC,MAAMC,+BAAkC,GAAA,IAAA;AAEjC,MAAMC,iBAAiBA,CAAC;EAC7BC,iBAAA;EACAC,gBAAA;EACAC,aAAA;EACAC,WAAA;EACAC,qBAAA;EACAC,qBAAA;EACAC,OAAA;EACAC,4BAA+B,GAAA,CAAA;EAC/BC,gBAAkB,EAAAC,wBAAA;EAClBC,mBAAqB,EAAAC;AACvB,CAA2B,KAAA;EACzB,MAAMC,cAAiB,GAAAC,KAAA,CAAAA,OAAA,CACrB,MAAMP,OAAQ,CAAAQ,QAAA,CAASC,MAAS,GAAA,CAAA,IAAK,CAACT,OAAQ,CAAAU,aAAA,EAC9C,CAACV,OAAA,CAAQQ,QAAU,EAAAR,OAAA,CAAQU,aAAa,CAC1C,CAAA;EAEM,MAAAC,6BAAA,GAAgCC,aAA8B,IAAI,CAAA;EAExE,MAAM;IAAEC,CAAA,EAAGC;EAAgB,CAAA,GAAIC,wBAAgB,CAAA,CAAA;EAEzC,MAAAC,oCAAA,GAAuCT,K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A;MACAoD,gBAAkB,EAAAnD,2BAAA;MAElByB,iBACEA,eAAmB,IAAAd,oCAAA;MAErBW,qBAAA;MACAK;IAAA,CACF,CAAA,EAAA,eAEFkB,UAAA,CAAAA,GAAA,CAACO,YAAA,CAAAA,YAAA,EAAA;MACC/D,iBAAA;MACAC,gBAAA;MACAC,aAAA;MACAC,WAAA;MACAC,qBAAA;MACAC,qBAAA;MACAG,gBAAA;MACAE,mBAAA;MACAC,2BAAA;MACAL,OAAA;MACAQ,UAAUR,OAAQ,CAAAQ,QAAA;MAElBsB,iBACEA,eAAmB,IAAAd,oCAAA;MAErBW,qBAAA;MACAyB,cAAA,EAAgBC,OAAQ,CAAArD,OAAA,CAAQoD,cAAc,CAAA;MAC9C1C,aAAA,EAAe2C,OAAQ,CAAArD,OAAA,CAAQU,aAAa;IAAA,CAC9C,CAAA,EAAA,eACAwC,UAAA,CAAAA,GAAA,CAACQ,qBAAE,CAAAC,0BAAA,EAAF;MACCC,GAAK,EAAAjD;IAAA,CAAA,CAAA;GAGT,CAAA;AAEJ,CAAA;;"}
|
|
@@ -6,7 +6,7 @@ import { SELECTED_PRODUCTS_LIMIT } from './constants.mjs';
|
|
|
6
6
|
import { Container, InterSectionObserverObject } from './ModelCompareV4.styles.mjs';
|
|
7
7
|
import { ProductList } from './ProductList/ProductList.mjs';
|
|
8
8
|
"use strict";
|
|
9
|
-
const MODEL_COMPARE_V4_ANCHOR = "compare
|
|
9
|
+
const MODEL_COMPARE_V4_ANCHOR = "compare";
|
|
10
10
|
const INTERSECTION_OBSERVER_THRESHOLD = 0.35;
|
|
11
11
|
const ModelCompareV4 = ({
|
|
12
12
|
headerStickOffset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelCompareV4.mjs","sources":["../../../src/components/ModelCompareV4/ModelCompareV4.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useWindowScroll } from \"react-use\";\n\nimport type {\n ProductListGroupId,\n SelectedProduct,\n} from \"../../constants/modelCompareData/types\";\nimport { CompareTable } from \"./CompareTable/CompareTable\";\nimport { SELECTED_PRODUCTS_LIMIT } from \"./constants\";\nimport * as S from \"./ModelCompareV4.styles\";\nimport type { ModelCompareV4Props } from \"./ModelCompareV4.types\";\nimport { ProductList } from \"./ProductList/ProductList\";\n\nexport const MODEL_COMPARE_V4_ANCHOR = \"compare-table-v4\";\n\nconst INTERSECTION_OBSERVER_THRESHOLD = 0.35;\n\nexport const ModelCompareV4 = ({\n headerStickOffset,\n overlayTopOffset,\n showBuyButton,\n onLinkClick,\n linkToStoreTitleClick,\n additionalProductData,\n section,\n defaultSelectedProductsCount = 2,\n selectedProducts: externalSelectedProducts,\n setSelectedProducts: setExternalSelectedProducts,\n}: ModelCompareV4Props) => {\n const hasProductList = useMemo(\n () => section.products.length > 5 && !section.isStaticTable,\n [section.products, section.isStaticTable],\n );\n\n const intersectionObserverObjectRef = useRef<HTMLDivElement | null>(null);\n\n const { y: scrollPositionY } = useWindowScroll();\n\n const userIsUnderneathIntersectionObserver = useMemo(() => {\n if (!intersectionObserverObjectRef.current) return false;\n\n return (\n intersectionObserverObjectRef.current.getBoundingClientRect().bottom <\n scrollPositionY\n );\n }, [scrollPositionY]);\n\n /**\n * TODO: Improve the name and logic of this variable and related code.\n * Currently, this variable is used whether ModelCompareV4 has a product list or not.\n * It should only be used if hasProductList is `true`. Why? Because if hasProductList\n * is `false` then selecting/deselecting products isn't possible. The gap between the\n * name of the variable and what it does can be confusing for future devs.\n */\n const defaultSelectedProducts = useMemo(\n () =>\n section.products\n .map((product) => ({ productId: product.id }))\n .slice(\n 0,\n hasProductList\n ? defaultSelectedProductsCount\n : section.products.length,\n ),\n [defaultSelectedProductsCount, hasProductList, section.products],\n );\n /**\n * TODO: rewrite the \"default selected products\" feature so we don't need to use a `useEffect`\n * to update the state of V4. We'll be able to remove this hackie `useRef` as a side-effect.\n */\n const defaultSelectedProductsRef = useRef(defaultSelectedProducts);\n\n const selectedProductsLimit = useMemo(() => {\n return section.products.length < SELECTED_PRODUCTS_LIMIT\n ? section.products.length\n : SELECTED_PRODUCTS_LIMIT;\n }, [section.products.length]);\n\n const [selectedProducts, setSelectedProducts] = useState<SelectedProduct[]>(\n [],\n );\n\n const [hasBeenObserved, setHasBeenObserved] = useState(false);\n\n const showProductGroups = section.showProductGroups !== false;\n\n // #############################################################################\n // Sets selectedProducts value\n // #############################################################################\n\n useEffect(() => {\n defaultSelectedProductsRef.current = defaultSelectedProducts;\n }, [defaultSelectedProducts]);\n\n useEffect(() => {\n setSelectedProducts(\n externalSelectedProducts ||\n (defaultSelectedProductsRef.current as SelectedProduct[]),\n );\n }, [section, externalSelectedProducts]);\n\n // #############################################################################\n // Intersection Observer Logic\n // #############################################################################\n const observerCallback = useCallback<IntersectionObserverCallback>(\n (entries) => {\n entries.forEach(\n (entry) =>\n entry.isIntersecting && !hasBeenObserved && setHasBeenObserved(true),\n );\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [setHasBeenObserved],\n );\n\n useEffect(() => {\n const observer = new IntersectionObserver(observerCallback, {\n threshold: hasProductList ? INTERSECTION_OBSERVER_THRESHOLD : 0,\n });\n\n const intersectionObserverObjectRefCurrent =\n intersectionObserverObjectRef.current;\n\n if (intersectionObserverObjectRefCurrent)\n observer.observe(intersectionObserverObjectRefCurrent);\n\n return () => {\n if (intersectionObserverObjectRefCurrent) {\n observer.unobserve(intersectionObserverObjectRefCurrent);\n observer.disconnect();\n }\n };\n }, [observerCallback, hasProductList]);\n\n return (\n <S.Container>\n {hasProductList && (\n <ProductList\n isOverviewPage={Boolean(section.isOverviewPage)}\n initialActiveGroup={\n section.products[0]?.productListGroup?.id as ProductListGroupId\n }\n products={section.products}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalSelectedProducts}\n // TODO: rename this property now that `userIsUnderneathIntersectionObserver` has been added\n hasBeenObserved={\n hasBeenObserved || userIsUnderneathIntersectionObserver\n }\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n />\n )}\n <CompareTable\n headerStickOffset={headerStickOffset}\n overlayTopOffset={overlayTopOffset}\n showBuyButton={showBuyButton}\n onLinkClick={onLinkClick}\n linkToStoreTitleClick={linkToStoreTitleClick}\n additionalProductData={additionalProductData}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalSelectedProducts={setExternalSelectedProducts}\n section={section}\n products={section.products}\n // TODO: rename this property now that `userIsUnderneathIntersectionObserver` has been added\n hasBeenObserved={\n hasBeenObserved || userIsUnderneathIntersectionObserver\n }\n selectedProductsLimit={selectedProductsLimit}\n isOverviewPage={Boolean(section.isOverviewPage)}\n isStaticTable={Boolean(section.isStaticTable)}\n />\n <S.InterSectionObserverObject\n ref={intersectionObserverObjectRef}\n // $hasProductList={hasProductList}\n />\n </S.Container>\n );\n};\n"],"names":["MODEL_COMPARE_V4_ANCHOR","INTERSECTION_OBSERVER_THRESHOLD","ModelCompareV4","headerStickOffset","overlayTopOffset","showBuyButton","onLinkClick","linkToStoreTitleClick","additionalProductData","section","defaultSelectedProductsCount","selectedProducts","externalSelectedProducts","setSelectedProducts","setExternalSelectedProducts","hasProductList","useMemo","products","length","isStaticTable","intersectionObserverObjectRef","useRef","y","scrollPositionY","useWindowScroll","userIsUnderneathIntersectionObserver","current","getBoundingClientRect","bottom","defaultSelectedProducts","map","product","productId","id","slice","defaultSelectedProductsRef","selectedProductsLimit","SELECTED_PRODUCTS_LIMIT","useState","hasBeenObserved","setHasBeenObserved","showProductGroups","useEffect","observerCallback","useCallback","entries","forEach","entry","isIntersecting","observer","IntersectionObserver","threshold","intersectionObserverObjectRefCurrent","observe","unobserve","disconnect","jsxs","S.Container","children","jsx","ProductList","isOverviewPage","Boolean","initialActiveGroup","productListGroup","setExternalState","CompareTable","S.InterSectionObserverObject","ref"],"mappings":";;;;;;;;AAaO,MAAMA,uBAA0B,GAAA,kBAAA;AAEvC,MAAMC,+BAAkC,GAA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AExB,CAAA;EAAA,CACC,EAAA,CAACZ,gBAAkB,EAAA5B,cAAc,CAAC,CAAA;EAGnC,sBAAAyC,IAAA,CAACC,SAAE,EAAF;IACEC,QAAA,EAAA,CACC3C,cAAA,mBAAA4C,GAAA,CAACC,WAAA,EAAA;MACCC,cAAA,EAAgBC,OAAQ,CAAArD,OAAA,CAAQoD,cAAc,CAAA;MAC9CE,kBACE,EAAAtD,OAAA,CAAQQ,QAAS,CAAA,CAAC,GAAG+C,gBAAkB,EAAA/B,EAAA;MAEzChB,UAAUR,OAAQ,CAAAQ,QAAA;MAClBN,gBAAA;MACAE,mBAAA;MACAoD,gBAAkB,EAAAnD,2BAAA;MAElByB,iBACEA,eAAmB,IAAAd,oCAAA;MAErBW,qBAAA;MACAK;IAAA,CACF,CAAA,EAAA,eAEFkB,GAAA,CAACO,YAAA,EAAA;MACC/D,iBAAA;MACAC,gBAAA;MACAC,aAAA;MACAC,WAAA;MACAC,qBAAA;MACAC,qBAAA;MACAG,gBAAA;MACAE,mBAAA;MACAC,2BAAA;MACAL,OAAA;MACAQ,UAAUR,OAAQ,CAAAQ,QAAA;MAElBsB,iBACEA,eAAmB,IAAAd,oCAAA;MAErBW,qBAAA;MACAyB,cAAA,EAAgBC,OAAQ,CAAArD,OAAA,CAAQoD,cAAc,CAAA;MAC9C1C,aAAA,EAAe2C,OAAQ,CAAArD,OAAA,CAAQU,aAAa;IAAA,CAC9C,CAAA,EAAA,eACAwC,GAAA,CAACQ,0BAAE,EAAF;MACCC,GAAK,EAAAhD;IAAA,CAAA,CAAA;GAGT,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ModelCompareV4.mjs","sources":["../../../src/components/ModelCompareV4/ModelCompareV4.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useWindowScroll } from \"react-use\";\n\nimport type {\n ProductListGroupId,\n SelectedProduct,\n} from \"../../constants/modelCompareData/types\";\nimport { CompareTable } from \"./CompareTable/CompareTable\";\nimport { SELECTED_PRODUCTS_LIMIT } from \"./constants\";\nimport * as S from \"./ModelCompareV4.styles\";\nimport type { ModelCompareV4Props } from \"./ModelCompareV4.types\";\nimport { ProductList } from \"./ProductList/ProductList\";\n\nexport const MODEL_COMPARE_V4_ANCHOR = \"compare\";\n\nconst INTERSECTION_OBSERVER_THRESHOLD = 0.35;\n\nexport const ModelCompareV4 = ({\n headerStickOffset,\n overlayTopOffset,\n showBuyButton,\n onLinkClick,\n linkToStoreTitleClick,\n additionalProductData,\n section,\n defaultSelectedProductsCount = 2,\n selectedProducts: externalSelectedProducts,\n setSelectedProducts: setExternalSelectedProducts,\n}: ModelCompareV4Props) => {\n const hasProductList = useMemo(\n () => section.products.length > 5 && !section.isStaticTable,\n [section.products, section.isStaticTable],\n );\n\n const intersectionObserverObjectRef = useRef<HTMLDivElement | null>(null);\n\n const { y: scrollPositionY } = useWindowScroll();\n\n const userIsUnderneathIntersectionObserver = useMemo(() => {\n if (!intersectionObserverObjectRef.current) return false;\n\n return (\n intersectionObserverObjectRef.current.getBoundingClientRect().bottom <\n scrollPositionY\n );\n }, [scrollPositionY]);\n\n /**\n * TODO: Improve the name and logic of this variable and related code.\n * Currently, this variable is used whether ModelCompareV4 has a product list or not.\n * It should only be used if hasProductList is `true`. Why? Because if hasProductList\n * is `false` then selecting/deselecting products isn't possible. The gap between the\n * name of the variable and what it does can be confusing for future devs.\n */\n const defaultSelectedProducts = useMemo(\n () =>\n section.products\n .map((product) => ({ productId: product.id }))\n .slice(\n 0,\n hasProductList\n ? defaultSelectedProductsCount\n : section.products.length,\n ),\n [defaultSelectedProductsCount, hasProductList, section.products],\n );\n /**\n * TODO: rewrite the \"default selected products\" feature so we don't need to use a `useEffect`\n * to update the state of V4. We'll be able to remove this hackie `useRef` as a side-effect.\n */\n const defaultSelectedProductsRef = useRef(defaultSelectedProducts);\n\n const selectedProductsLimit = useMemo(() => {\n return section.products.length < SELECTED_PRODUCTS_LIMIT\n ? section.products.length\n : SELECTED_PRODUCTS_LIMIT;\n }, [section.products.length]);\n\n const [selectedProducts, setSelectedProducts] = useState<SelectedProduct[]>(\n [],\n );\n\n const [hasBeenObserved, setHasBeenObserved] = useState(false);\n\n const showProductGroups = section.showProductGroups !== false;\n\n // #############################################################################\n // Sets selectedProducts value\n // #############################################################################\n\n useEffect(() => {\n defaultSelectedProductsRef.current = defaultSelectedProducts;\n }, [defaultSelectedProducts]);\n\n useEffect(() => {\n setSelectedProducts(\n externalSelectedProducts ||\n (defaultSelectedProductsRef.current as SelectedProduct[]),\n );\n }, [section, externalSelectedProducts]);\n\n // #############################################################################\n // Intersection Observer Logic\n // #############################################################################\n const observerCallback = useCallback<IntersectionObserverCallback>(\n (entries) => {\n entries.forEach(\n (entry) =>\n entry.isIntersecting && !hasBeenObserved && setHasBeenObserved(true),\n );\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [setHasBeenObserved],\n );\n\n useEffect(() => {\n const observer = new IntersectionObserver(observerCallback, {\n threshold: hasProductList ? INTERSECTION_OBSERVER_THRESHOLD : 0,\n });\n\n const intersectionObserverObjectRefCurrent =\n intersectionObserverObjectRef.current;\n\n if (intersectionObserverObjectRefCurrent)\n observer.observe(intersectionObserverObjectRefCurrent);\n\n return () => {\n if (intersectionObserverObjectRefCurrent) {\n observer.unobserve(intersectionObserverObjectRefCurrent);\n observer.disconnect();\n }\n };\n }, [observerCallback, hasProductList]);\n\n return (\n <S.Container>\n {hasProductList && (\n <ProductList\n isOverviewPage={Boolean(section.isOverviewPage)}\n initialActiveGroup={\n section.products[0]?.productListGroup?.id as ProductListGroupId\n }\n products={section.products}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalSelectedProducts}\n // TODO: rename this property now that `userIsUnderneathIntersectionObserver` has been added\n hasBeenObserved={\n hasBeenObserved || userIsUnderneathIntersectionObserver\n }\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n />\n )}\n <CompareTable\n headerStickOffset={headerStickOffset}\n overlayTopOffset={overlayTopOffset}\n showBuyButton={showBuyButton}\n onLinkClick={onLinkClick}\n linkToStoreTitleClick={linkToStoreTitleClick}\n additionalProductData={additionalProductData}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalSelectedProducts={setExternalSelectedProducts}\n section={section}\n products={section.products}\n // TODO: rename this property now that `userIsUnderneathIntersectionObserver` has been added\n hasBeenObserved={\n hasBeenObserved || userIsUnderneathIntersectionObserver\n }\n selectedProductsLimit={selectedProductsLimit}\n isOverviewPage={Boolean(section.isOverviewPage)}\n isStaticTable={Boolean(section.isStaticTable)}\n />\n <S.InterSectionObserverObject\n ref={intersectionObserverObjectRef}\n // $hasProductList={hasProductList}\n />\n </S.Container>\n );\n};\n"],"names":["MODEL_COMPARE_V4_ANCHOR","INTERSECTION_OBSERVER_THRESHOLD","ModelCompareV4","headerStickOffset","overlayTopOffset","showBuyButton","onLinkClick","linkToStoreTitleClick","additionalProductData","section","defaultSelectedProductsCount","selectedProducts","externalSelectedProducts","setSelectedProducts","setExternalSelectedProducts","hasProductList","useMemo","products","length","isStaticTable","intersectionObserverObjectRef","useRef","y","scrollPositionY","useWindowScroll","userIsUnderneathIntersectionObserver","current","getBoundingClientRect","bottom","defaultSelectedProducts","map","product","productId","id","slice","defaultSelectedProductsRef","selectedProductsLimit","SELECTED_PRODUCTS_LIMIT","useState","hasBeenObserved","setHasBeenObserved","showProductGroups","useEffect","observerCallback","useCallback","entries","forEach","entry","isIntersecting","observer","IntersectionObserver","threshold","intersectionObserverObjectRefCurrent","observe","unobserve","disconnect","jsxs","S.Container","children","jsx","ProductList","isOverviewPage","Boolean","initialActiveGroup","productListGroup","setExternalState","CompareTable","S.InterSectionObserverObject","ref"],"mappings":";;;;;;;;AAaO,MAAMA,uBAA0B,GAAA,SAAA;AAEvC,MAAMC,+BAAkC,GAAA,IAAA;AAEjC,MAAMC,iBAAiBA,CAAC;EAC7BC,iBAAA;EACAC,gBAA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AAA;EAGnC,sBAAAyC,IAAA,CAACC,SAAE,EAAF;IACEC,QAAA,EAAA,CACC3C,cAAA,mBAAA4C,GAAA,CAACC,WAAA,EAAA;MACCC,cAAA,EAAgBC,OAAQ,CAAArD,OAAA,CAAQoD,cAAc,CAAA;MAC9CE,kBACE,EAAAtD,OAAA,CAAQQ,QAAS,CAAA,CAAC,GAAG+C,gBAAkB,EAAA/B,EAAA;MAEzChB,UAAUR,OAAQ,CAAAQ,QAAA;MAClBN,gBAAA;MACAE,mBAAA;MACAoD,gBAAkB,EAAAnD,2BAAA;MAElByB,iBACEA,eAAmB,IAAAd,oCAAA;MAErBW,qBAAA;MACAK;IAAA,CACF,CAAA,EAAA,eAEFkB,GAAA,CAACO,YAAA,EAAA;MACC/D,iBAAA;MACAC,gBAAA;MACAC,aAAA;MACAC,WAAA;MACAC,qBAAA;MACAC,qBAAA;MACAG,gBAAA;MACAE,mBAAA;MACAC,2BAAA;MACAL,OAAA;MACAQ,UAAUR,OAAQ,CAAAQ,QAAA;MAElBsB,iBACEA,eAAmB,IAAAd,oCAAA;MAErBW,qBAAA;MACAyB,cAAA,EAAgBC,OAAQ,CAAArD,OAAA,CAAQoD,cAAc,CAAA;MAC9C1C,aAAA,EAAe2C,OAAQ,CAAArD,OAAA,CAAQU,aAAa;IAAA,CAC9C,CAAA,EAAA,eACAwC,GAAA,CAACQ,0BAAE,EAAF;MACCC,GAAK,EAAAhD;IAAA,CAAA,CAAA;GAGT,CAAA;AAEJ,CAAA;"}
|
|
@@ -12,7 +12,7 @@ require('./assets/attention.svg.js');
|
|
|
12
12
|
var InputCard_styles = require('./InputCard.styles.js');
|
|
13
13
|
require('./InputSections/index.js');
|
|
14
14
|
var CustomImage = require('../../../../CustomImage/CustomImage.js');
|
|
15
|
-
var attentionIcon = require("../../../../../assets/
|
|
15
|
+
var attentionIcon = require("../../../../../assets/attention.svg");
|
|
16
16
|
var OptionSelectSection = require('./InputSections/OptionSelectSection.js');
|
|
17
17
|
var SliderSection = require('./InputSections/SliderSection.js');
|
|
18
18
|
var CounterSection = require('./InputSections/CounterSection.js');
|
|
@@ -10,7 +10,7 @@ import './assets/attention.svg.mjs';
|
|
|
10
10
|
import { Card, Header, HeaderHeadingSection, HeadingIcon, HeadingTitle, HeaderActionSection, SubduedInfo, OverlayFilter, NotAvailableNoteWrap, NotAvailableNoteIcon, InputBody, InputSectionSpacing, Footer, FooterContent, FooterNote } from './InputCard.styles.mjs';
|
|
11
11
|
import './InputSections/index.mjs';
|
|
12
12
|
import { CustomImage } from '../../../../CustomImage/CustomImage.mjs';
|
|
13
|
-
import attentionIcon__default from "../../../../../assets/
|
|
13
|
+
import attentionIcon__default from "../../../../../assets/attention.svg";
|
|
14
14
|
import { OptionSelectSection } from './InputSections/OptionSelectSection.mjs';
|
|
15
15
|
import { SliderSection } from './InputSections/SliderSection.mjs';
|
|
16
16
|
import { CounterSection } from './InputSections/CounterSection.mjs';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var attentionIcon = require("../../../../../../assets/
|
|
6
|
+
var attentionIcon = require("../../../../../../assets/attention.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/
|
|
2
|
-
export { default } from "../../../../../../assets/
|
|
1
|
+
export * from "../../../../../../assets/attention.svg";
|
|
2
|
+
export { default } from "../../../../../../assets/attention.svg";
|
|
3
3
|
//# sourceMappingURL=attention.svg.mjs.map
|
|
@@ -6,7 +6,7 @@ var asset = require('../../../../../utils/asset.js');
|
|
|
6
6
|
require('./assets/attention.svg.js');
|
|
7
7
|
var Part = require('./Part.js');
|
|
8
8
|
var ProgressBarChart_styles = require('./ProgressBarChart.styles.js');
|
|
9
|
-
var attentionIcon = require("../../../../../assets/
|
|
9
|
+
var attentionIcon = require("../../../../../assets/attention2.svg");
|
|
10
10
|
function _interopDefault(e) {
|
|
11
11
|
return e && e.__esModule ? e : {
|
|
12
12
|
default: e
|
|
@@ -4,7 +4,7 @@ import { imageSrc } from '../../../../../utils/asset.mjs';
|
|
|
4
4
|
import './assets/attention.svg.mjs';
|
|
5
5
|
import { PART_GAP_PX, PART_WIDTH_PX, Part } from './Part.mjs';
|
|
6
6
|
import { ProgressBarChartContainer, ProgressBarChartHeader, ProgressBarChartTitle, ProgressBarWrapper, ProgressBarPartsContainer, ProgressBarAttentionLabel, ProgressBarAttentionLabelIcon } from './ProgressBarChart.styles.mjs';
|
|
7
|
-
import attentionIcon__default from "../../../../../assets/
|
|
7
|
+
import attentionIcon__default from "../../../../../assets/attention2.svg";
|
|
8
8
|
"use strict";
|
|
9
9
|
const ProgressBarChart = ({
|
|
10
10
|
title,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var attentionIcon = require("../../../../../../assets/
|
|
6
|
+
var attentionIcon = require("../../../../../../assets/attention2.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/
|
|
2
|
-
export { default } from "../../../../../../assets/
|
|
1
|
+
export * from "../../../../../../assets/attention2.svg";
|
|
2
|
+
export { default } from "../../../../../../assets/attention2.svg";
|
|
3
3
|
//# sourceMappingURL=attention.svg.mjs.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var v3Image = require("../../../../assets/g5-
|
|
6
|
+
var v3Image = require("../../../../assets/g5-bullet2.jpg");
|
|
7
7
|
function _interopDefault(e) {
|
|
8
8
|
return e && e.__esModule ? e : {
|
|
9
9
|
default: e
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "../../../../assets/g5-
|
|
2
|
-
export { default } from "../../../../assets/g5-
|
|
1
|
+
export * from "../../../../assets/g5-bullet2.jpg";
|
|
2
|
+
export { default } from "../../../../assets/g5-bullet2.jpg";
|
|
3
3
|
//# sourceMappingURL=g5-bullet.jpg.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "../../../../assets/g5-
|
|
2
|
-
export { default } from "../../../../assets/g5-
|
|
1
|
+
export * from "../../../../assets/g5-flex2.jpg";
|
|
2
|
+
export { default } from "../../../../assets/g5-flex2.jpg";
|
|
3
3
|
//# sourceMappingURL=g5-flex.jpg.mjs.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var v3Image = require("../../../../assets/ai-
|
|
6
|
+
var v3Image = require("../../../../assets/ai-turret2.jpg");
|
|
7
7
|
function _interopDefault(e) {
|
|
8
8
|
return e && e.__esModule ? e : {
|
|
9
9
|
default: e
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "../../../../assets/ai-
|
|
2
|
-
export { default } from "../../../../assets/ai-
|
|
1
|
+
export * from "../../../../assets/ai-turret2.jpg";
|
|
2
|
+
export { default } from "../../../../assets/ai-turret2.jpg";
|
|
3
3
|
//# sourceMappingURL=ai-turret.jpg.mjs.map
|