@ubnt/store.core 10.17.0-alpha.32 → 10.17.0-alpha.34
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 +8 -0
- package/lib/assets/ai-360.jpg +0 -0
- package/lib/assets/ai-3602.jpg +0 -0
- package/lib/assets/ai-dome.jpg +0 -0
- package/lib/assets/ai-dome2.jpg +0 -0
- package/lib/assets/ai-dslr.jpg +0 -0
- package/lib/assets/ai-dslr2.jpg +0 -0
- package/lib/assets/ai-lpr.jpg +0 -0
- package/lib/assets/ai-lpr2.jpg +0 -0
- package/lib/assets/ai-theta.jpg +0 -0
- package/lib/assets/ai-theta2.jpg +0 -0
- 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/bullet2.svg +2 -4
- package/lib/assets/bullet3.svg +4 -2
- 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-pro.jpg +0 -0
- package/lib/assets/g2-reader-pro2.jpg +0 -0
- package/lib/assets/g3-reader-flex.jpg +0 -0
- package/lib/assets/g3-reader-flex2.jpg +0 -0
- package/lib/assets/g3-starter-kit.jpg +0 -0
- package/lib/assets/g3-starter-kit2.jpg +0 -0
- package/lib/assets/g4-instant.jpg +0 -0
- package/lib/assets/g4-instant2.jpg +0 -0
- package/lib/assets/g5-bullet.jpg +0 -0
- package/lib/assets/g5-bullet2.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/components/MicrositeHeader/components/HeaderContent/HeaderContent.js +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.js.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.mjs +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.mjs.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.styles.js +22 -5
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.styles.js.map +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.styles.mjs +22 -5
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.styles.mjs.map +1 -1
- package/lib/components/ModelCompareV4/ProductList/ProductList.js +34 -3
- package/lib/components/ModelCompareV4/ProductList/ProductList.js.map +1 -1
- package/lib/components/ModelCompareV4/ProductList/ProductList.mjs +35 -4
- package/lib/components/ModelCompareV4/ProductList/ProductList.mjs.map +1 -1
- package/lib/components/ModelCompareV4/ProductList/ProductList.styles.d.ts +3 -0
- package/lib/components/ModelCompareV4/ProductList/ProductList.styles.js +19 -5
- package/lib/components/ModelCompareV4/ProductList/ProductList.styles.js.map +1 -1
- package/lib/components/ModelCompareV4/ProductList/ProductList.styles.mjs +18 -6
- package/lib/components/ModelCompareV4/ProductList/ProductList.styles.mjs.map +1 -1
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.d.ts +7 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.js +58 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.js.map +1 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.mjs +50 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.mjs.map +1 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.styles.d.ts +11 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.styles.js +77 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.styles.js.map +1 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.styles.mjs +68 -0
- package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.styles.mjs.map +1 -0
- package/lib/components/ModelCompareV4/ProductList/useIsAtMaxScroll.d.ts +5 -0
- package/lib/components/ModelCompareV4/ProductList/useIsAtMaxScroll.js +22 -0
- package/lib/components/ModelCompareV4/ProductList/useIsAtMaxScroll.js.map +1 -0
- package/lib/components/ModelCompareV4/ProductList/useIsAtMaxScroll.mjs +20 -0
- package/lib/components/ModelCompareV4/ProductList/useIsAtMaxScroll.mjs.map +1 -0
- 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/ai-dslr.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/Bullet/ai-lpr.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/Bullet/ai-lpr.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/Bullet/bullet.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/Bullet/bullet.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/g4-instant.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/Compact/g4-instant.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DomeTurret/ai-360.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DomeTurret/ai-360.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DomeTurret/ai-dome.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DomeTurret/ai-dome.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/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-pro.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader-pro.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader-flex.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader-flex.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.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/Interior/ai-theta.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/Interior/ai-theta.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/bullet.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/bullet.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-lpr.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-lpr.jpg.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/g4-instant.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/compact/g4-instant.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-360.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-360.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-dome.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-dome.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/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-pro.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader-pro.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader-flex.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader-flex.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.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/interior-design/ai-theta.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/interior-design/ai-theta.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/data/product-groups/cameraSecurity/Bullet.js +1 -1
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Bullet.mjs +1 -1
- 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-list-groups/bullet.js +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/bullet.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/products/ai360.js +2 -2
- package/lib/constants/modelCompareData/data/products/ai360.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/aiDome.js +2 -2
- package/lib/constants/modelCompareData/data/products/aiDome.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/aiDslr.js +2 -2
- package/lib/constants/modelCompareData/data/products/aiDslr.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/aiLpr.js +2 -2
- package/lib/constants/modelCompareData/data/products/aiLpr.mjs +2 -2
- 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/g2ReaderPro.js +2 -2
- package/lib/constants/modelCompareData/data/products/g2ReaderPro.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g3ReaderFlex.js +2 -2
- package/lib/constants/modelCompareData/data/products/g3ReaderFlex.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g3StarterKit.js +2 -2
- package/lib/constants/modelCompareData/data/products/g3StarterKit.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g4Instant.js +2 -2
- package/lib/constants/modelCompareData/data/products/g4Instant.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/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/theta.js +2 -2
- package/lib/constants/modelCompareData/data/products/theta.mjs +2 -2
- package/package.json +1 -1
|
@@ -5,7 +5,9 @@ import './components/ButtonGroup/index.mjs';
|
|
|
5
5
|
import { Product } from './components/Product/Product.mjs';
|
|
6
6
|
import { groupProducts } from './components/ProductGroups/groupProducts.mjs';
|
|
7
7
|
import { ProductGroups } from './components/ProductGroups/ProductGroups.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { ScrollButton } from './components/ScrollButton/ScrollButton.mjs';
|
|
9
|
+
import { PRODUCT_CARD_WIDTH, PRODUCT_LIST_GRID_GAP, Wrapper, Container, ProductGroupProductListContainer, ProductList as ProductList$1 } from './ProductList.styles.mjs';
|
|
10
|
+
import { useIsAtMaxScroll } from './useIsAtMaxScroll.mjs';
|
|
9
11
|
import { ButtonGroup } from './components/ButtonGroup/ButtonGroup.mjs';
|
|
10
12
|
"use strict";
|
|
11
13
|
const ProductList = ({
|
|
@@ -110,6 +112,19 @@ const ProductList = ({
|
|
|
110
112
|
}
|
|
111
113
|
}, checkForScrollTimeout);
|
|
112
114
|
}, [containerRef, setPlayAnimation, setActiveGroup, checkForScrollTimeout]);
|
|
115
|
+
const scrollButtonHandler = ({
|
|
116
|
+
isLeftArrow
|
|
117
|
+
}) => {
|
|
118
|
+
if (containerRef.current) {
|
|
119
|
+
const currentScrollPosition = containerRef.current?.scrollLeft;
|
|
120
|
+
const scrollLength = isLeftArrow ? currentScrollPosition - PRODUCT_CARD_WIDTH - PRODUCT_LIST_GRID_GAP : currentScrollPosition + PRODUCT_CARD_WIDTH + PRODUCT_LIST_GRID_GAP;
|
|
121
|
+
containerRef.current?.scrollTo(scrollLength, 0);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const {
|
|
125
|
+
isMaxLeft,
|
|
126
|
+
isMaxRight
|
|
127
|
+
} = useIsAtMaxScroll(containerRef);
|
|
113
128
|
return /* @__PURE__ */jsxs(Wrapper, {
|
|
114
129
|
children: [showProductGroups && moreThanOneGroupExists && /* @__PURE__ */jsx(ButtonGroup, {
|
|
115
130
|
items: groupedGroups.map(group => group.productListGroup),
|
|
@@ -123,6 +138,7 @@ const ProductList = ({
|
|
|
123
138
|
ref: containerRef,
|
|
124
139
|
$isHovering: isHovering,
|
|
125
140
|
$moreThanOneGroupExists: moreThanOneGroupExists,
|
|
141
|
+
$isDragging: isDragging,
|
|
126
142
|
children: /* @__PURE__ */jsxs(ProductGroupProductListContainer, {
|
|
127
143
|
children: [moreThanOneGroupExists && /* @__PURE__ */jsx(ProductGroups, {
|
|
128
144
|
products,
|
|
@@ -130,7 +146,7 @@ const ProductList = ({
|
|
|
130
146
|
playAnimation,
|
|
131
147
|
canPlayAniimation: hasBeenObserved || buttonHasBeenClick,
|
|
132
148
|
showProductGroups
|
|
133
|
-
}), /* @__PURE__ */
|
|
149
|
+
}), /* @__PURE__ */jsxs(ProductList$1, {
|
|
134
150
|
$columns: products.length,
|
|
135
151
|
$isDragging: isDragging,
|
|
136
152
|
$overflowExists: overflowExists,
|
|
@@ -138,7 +154,22 @@ const ProductList = ({
|
|
|
138
154
|
onMouseDown: event => mouseDownHandler(event),
|
|
139
155
|
onMouseUp: mouseUpHandler,
|
|
140
156
|
ref: productListRef,
|
|
141
|
-
children:
|
|
157
|
+
children: [/* @__PURE__ */jsx(ScrollButton, {
|
|
158
|
+
color: "white",
|
|
159
|
+
rotationDegrees: 180,
|
|
160
|
+
isVisible: !isMaxLeft,
|
|
161
|
+
onClick: () => scrollButtonHandler({
|
|
162
|
+
isLeftArrow: true
|
|
163
|
+
})
|
|
164
|
+
}), /* @__PURE__ */jsx(ScrollButton, {
|
|
165
|
+
color: "white",
|
|
166
|
+
rotationDegrees: 0,
|
|
167
|
+
isVisible: isMaxRight,
|
|
168
|
+
isRightButton: true,
|
|
169
|
+
onClick: () => scrollButtonHandler({
|
|
170
|
+
isLeftArrow: false
|
|
171
|
+
})
|
|
172
|
+
}), products.map((product, productsArrayIndex) => {
|
|
142
173
|
const groupIsActive = product.productListGroup?.id === activeGroup;
|
|
143
174
|
const productListGroup = products.filter(product2 => activeGroup === product2.productListGroup?.id);
|
|
144
175
|
const groupIndex = productListGroup.findIndex(item => item.id === product.id);
|
|
@@ -166,7 +197,7 @@ const ProductList = ({
|
|
|
166
197
|
isStaticProduct: productsArrayIndex === 0,
|
|
167
198
|
isOverviewPage
|
|
168
199
|
}, product.id);
|
|
169
|
-
})
|
|
200
|
+
})]
|
|
170
201
|
})]
|
|
171
202
|
})
|
|
172
203
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductList.mjs","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useEffectOnce, useHoverDirty } from \"react-use\";\n\nimport type {\n ProductId,\n ProductListGroupId,\n} from \"../../../constants/modelCompareData/types\";\nimport { ButtonGroup } from \"./components/ButtonGroup\";\nimport { Product } from \"./components/Product/Product\";\nimport { groupProducts } from \"./components/ProductGroups/groupProducts\";\nimport { ProductGroups } from \"./components/ProductGroups/ProductGroups\";\nimport * as S from \"./ProductList.styles\";\nimport type { ProductListProps } from \"./ProductList.types\";\n\nexport const ProductList = ({\n products,\n selectedProducts,\n setSelectedProducts,\n hasBeenObserved,\n selectedProductsLimit,\n initialActiveGroup,\n setExternalState,\n showProductGroups,\n isOverviewPage,\n}: ProductListProps) => {\n const groupedGroups = groupProducts(products);\n const moreThanOneGroupExists = groupedGroups.length > 1;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const productListRef = useRef<HTMLDivElement>(null);\n\n const [buttonHasBeenClick, setButtonHasBeenClicked] = useState(false);\n const [activeGroup, setActiveGroup] = useState(initialActiveGroup);\n const [playAnimation, setPlayAnimation] = useState(false);\n const isHovering = useHoverDirty(containerRef);\n const [isDragging, setIsDragging] = useState(false);\n const [overflowExists, setOverflowExists] = useState(true);\n const [endPosition, setEndPosition] = useState<number>(0);\n const checkForScrollTimeout = 150;\n\n useEffectOnce(() => {\n const refsExist = containerRef.current && productListRef.current;\n if (\n refsExist &&\n containerRef.current?.getBoundingClientRect().width <\n productListRef.current?.getBoundingClientRect().width\n ) {\n setOverflowExists(true);\n } else {\n setOverflowExists(false);\n }\n });\n\n // TODO: figure out how to remove this TODO. Currently, without this `useEffect` `activeGroup` isn't updating when toggling between different tables (`Section`s).\n // ModelCompareV4 is sometimes used to toggle between sets of data of type Section. In this situation, we need the initial active group to be updated when the new data is passed to ModelCompareV4\n useEffect(() => {\n setActiveGroup(products[0]?.productListGroup?.id as ProductListGroupId);\n }, [products]);\n\n // #############################################################################\n // Scroll-Specific useEffects\n // #############################################################################\n\n // if there aren't any product list group buttons then the ending state of the animations need to exist on the initial render\n useEffect(() => {\n if (!showProductGroups && hasBeenObserved) {\n setPlayAnimation(true);\n }\n }, [hasBeenObserved, setPlayAnimation, showProductGroups]);\n\n // plays animation when no scroll has occurred on the initial observe\n useEffect(() => {\n const productListInitialPosition =\n productListRef.current?.getBoundingClientRect().left;\n\n if (hasBeenObserved || buttonHasBeenClick) {\n setTimeout(() => {\n const currentPosition =\n productListRef.current?.getBoundingClientRect().left;\n if (productListInitialPosition === currentPosition) {\n return setPlayAnimation(true);\n }\n }, checkForScrollTimeout);\n }\n }, [hasBeenObserved, setPlayAnimation, buttonHasBeenClick]);\n\n // #############################################################################\n // Drag Logic\n // #############################################################################\n const dragStartingPosition = useRef(0);\n const scrollAmount = useRef(0);\n\n const dragHandler = useCallback(\n (event: MouseEvent) => {\n scrollAmount.current = dragStartingPosition.current - event.clientX;\n containerRef.current?.scrollTo(endPosition + scrollAmount.current, 0);\n },\n [endPosition],\n );\n\n const mouseUpHandler = useCallback(() => {\n setIsDragging(false);\n setEndPosition(containerRef.current?.scrollLeft as number);\n document.removeEventListener(\"mousemove\", dragHandler);\n }, [dragHandler]);\n\n const mouseDownHandler = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>) => {\n if (event.buttons === 1) {\n dragStartingPosition.current = event.clientX;\n setIsDragging(true);\n document.addEventListener(\"mousemove\", dragHandler);\n document.addEventListener(\"mouseup\", mouseUpHandler);\n }\n },\n [dragHandler, mouseUpHandler],\n );\n\n useEffectOnce(() => {\n let isScrolling: NodeJS.Timeout;\n (containerRef.current as HTMLDivElement).addEventListener(\n \"scroll\",\n function () {\n window.clearTimeout(isScrolling);\n\n // if scrolling occurs, animations are played after scrolling has completed\n // if scrolling occurs, the container's end position is track in state after scrolling has completed\n isScrolling = setTimeout(function () {\n setPlayAnimation(true);\n setEndPosition(containerRef.current?.scrollLeft as number);\n }, checkForScrollTimeout);\n },\n );\n });\n\n // #############################################################################\n // Click to Scroll Logic\n // #############################################################################\n\n const tabClickHandler = useCallback(\n ({ groupId }: { groupId: ProductListGroupId }) => {\n const initialScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n const checkForScroll = () => {\n const currentScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n return currentScrollPosition === initialScrollPosition;\n };\n\n const element = document.getElementById(groupId) as HTMLDivElement;\n\n setPlayAnimation(false);\n setActiveGroup(groupId);\n setButtonHasBeenClicked(true);\n element?.scrollIntoView({\n behavior: \"smooth\",\n inline: \"start\",\n block: \"nearest\",\n });\n\n // if no scroll occurs animations are played\n setTimeout(() => {\n if (checkForScroll()) {\n setPlayAnimation(true);\n }\n }, checkForScrollTimeout);\n },\n [containerRef, setPlayAnimation, setActiveGroup, checkForScrollTimeout],\n );\n\n return (\n <S.Wrapper>\n {showProductGroups && moreThanOneGroupExists && (\n <ButtonGroup\n items={groupedGroups.map((group) => group.productListGroup)}\n activeButton={activeGroup as string}\n onClick={(id) => {\n tabClickHandler({ groupId: id as ProductListGroupId });\n }}\n />\n )}\n <S.Container\n ref={containerRef}\n $isHovering={isHovering}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n >\n <S.ProductGroupProductListContainer>\n {moreThanOneGroupExists && (\n <ProductGroups\n products={products}\n activeGroup={activeGroup as ProductListGroupId}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n showProductGroups={showProductGroups}\n />\n )}\n <S.ProductList\n $columns={products.length}\n $isDragging={isDragging}\n $overflowExists={overflowExists}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n onMouseDown={(event) => mouseDownHandler(event)}\n onMouseUp={mouseUpHandler}\n ref={productListRef}\n >\n {products.map((product, productsArrayIndex) => {\n const groupIsActive =\n product.productListGroup?.id === activeGroup;\n\n const productListGroup = products.filter(\n (product) => activeGroup === product.productListGroup?.id,\n );\n\n const groupIndex = productListGroup.findIndex(\n (item) => item.id === product.id,\n );\n\n return (\n <Product\n onClick={() =>\n setActiveGroup(\n product.productListGroup?.id as ProductListGroupId,\n )\n }\n key={product.id}\n groupIndex={groupIndex}\n groupLength={productListGroup.length}\n id={product?.id as ProductId}\n groupId={product.productListGroup?.id as ProductListGroupId}\n image={product.image ?? { src: \"\", width: 0, height: 0 }}\n name={product.title}\n description={product.description}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalState}\n groupIsActive={groupIsActive}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n isStaticProduct={productsArrayIndex === 0}\n isOverviewPage={isOverviewPage}\n />\n );\n })}\n </S.ProductList>\n </S.ProductGroupProductListContainer>\n </S.Container>\n </S.Wrapper>\n );\n};\n"],"names":["ProductList","products","selectedProducts","setSelectedProducts","hasBeenObserved","selectedProductsLimit","initialActiveGroup","setExternalState","showProductGroups","isOverviewPage","groupedGroups","groupProducts","moreThanOneGroupExists","length","containerRef","useRef","productListRef","buttonHasBeenClick","setButtonHasBeenClicked","useState","activeGroup","setActiveGroup","playAnimation","setPlayAnimation","isHovering","useHoverDirty","isDragging","setIsDragging","overflowExists","setOverflowExists","endPosition","setEndPosition","checkForScrollTimeout","useEffectOnce","refsExist","current","getBoundingClientRect","width","useEffect","productListGroup","id","productListInitialPosition","left","setTimeout","currentPosition","dragStartingPosition","scrollAmount","dragHandler","useCallback","event","clientX","scrollTo","mouseUpHandler","scrollLeft","document","removeEventListener","mouseDownHandler","buttons","addEventListener","isScrolling","window","clearTimeout","tabClickHandler","groupId","initialScrollPosition","checkForScroll","currentScrollPosition","element","getElementById","scrollIntoView","behavior","inline","block","jsxs","S.Wrapper","children","jsx","ButtonGroup","items","map","group","activeButton","onClick","S.Container","ref","$isHovering","$moreThanOneGroupExists","S.ProductGroupProductListContainer","ProductGroups","canPlayAniimation","S.ProductList","$columns","$isDragging","$overflowExists","onMouseDown","onMouseUp","product","productsArrayIndex","groupIsActive","filter","groupIndex","findIndex","item","Product","groupLength","image","src","height","name","title","description","isStaticProduct"],"mappings":";;;;;;;;;;AAcO,MAAMA,cAAcA,CAAC;EAC1BC,QAAA;EACAC,gBAAA;EACAC,mBAAA;EACAC,eAAA;EACAC,qBAAA;EACAC,kBAAA;EACAC,gBAAA;EACAC,iBAAA;EACAC;AACF,CAAwB,KAAA;EAChB,MAAAC,aAAA,GAAgBC,cAAcV,QAAQ,CAAA;EACtC,MAAAW,sBAAA,GAAyBF,cAAcG,MAAS,GAAA,CAAA;EAEhD,MAAAC,YAAA,GAAeC,OAAuB,IAAI,CAAA;EAC1C,MAAAC,cAAA,GAAiBD,OAAuB,IAAI,CAAA;EAElD,MAAM,CAACE,kBAAA,EAAoBC,uBAAuB,CAAA,GAAIC,SAAS,KAAK,CAAA;EACpE,MAAM,CAACC,WAAA,EAAaC,cAAc,CAAA,GAAIF,SAASb,kBAAkB,CAAA;EACjE,MAAM,CAACgB,aAAA,EAAeC,gBAAgB,CAAA,GAAIJ,SAAS,KAAK,CAAA;EAClD,MAAAK,UAAA,GAAaC,cAAcX,YAAY,CAAA;EAC7C,MAAM,CAACY,UAAA,EAAYC,aAAa,CAAA,GAAIR,SAAS,KAAK,CAAA;EAClD,MAAM,CAACS,cAAA,EAAgBC,iBAAiB,CAAA,GAAIV,SAAS,IAAI,CAAA;EACzD,MAAM,CAACW,WAAA,EAAaC,cAAc,CAAA,GAAIZ,SAAiB,CAAC,CAAA;EACxD,MAAM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AAI;gBAAArE,KAAA,EAAO,CAAG;gBAAAsE,MAAA,EAAQ;cAAE,CAAA;cACvDC,MAAMZ,OAAQ,CAAAa,KAAA;cACdC,aAAad,OAAQ,CAAAc,WAAA;cACrB5G,gBAAA;cACAC,mBAAA;cACAI,gBAAA;cACA2F,aAAA;cACA5E,aAAA;cACAmE,mBAAmBrF,eAAmB,IAAAa,kBAAA;cACtCZ,qBAAA;cACAG,iBAAA;cACAuG,iBAAiBd,kBAAuB,KAAA,CAAA;cACxCxF;YAAA,CAAA,EAjBKuF,OAAQ,CAAAxD,EAkBf,CAAA;UAEH,CAAA;QAAA,CAAA,CAAA;MAEL,CAAA;IAAA,CAAA,CAAA;GAEJ,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ProductList.mjs","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useEffectOnce, useHoverDirty } from \"react-use\";\n\nimport type {\n ProductId,\n ProductListGroupId,\n} from \"../../../constants/modelCompareData/types\";\nimport { ButtonGroup } from \"./components/ButtonGroup\";\nimport { Product } from \"./components/Product/Product\";\nimport { groupProducts } from \"./components/ProductGroups/groupProducts\";\nimport { ProductGroups } from \"./components/ProductGroups/ProductGroups\";\nimport { ScrollButton } from \"./components/ScrollButton/ScrollButton\";\nimport * as S from \"./ProductList.styles\";\nimport type { ProductListProps } from \"./ProductList.types\";\nimport { useIsAtMaxScroll } from \"./useIsAtMaxScroll\";\n\nexport const ProductList = ({\n products,\n selectedProducts,\n setSelectedProducts,\n hasBeenObserved,\n selectedProductsLimit,\n initialActiveGroup,\n setExternalState,\n showProductGroups,\n isOverviewPage,\n}: ProductListProps) => {\n const groupedGroups = groupProducts(products);\n const moreThanOneGroupExists = groupedGroups.length > 1;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const productListRef = useRef<HTMLDivElement>(null);\n\n const [buttonHasBeenClick, setButtonHasBeenClicked] = useState(false);\n const [activeGroup, setActiveGroup] = useState(initialActiveGroup);\n const [playAnimation, setPlayAnimation] = useState(false);\n const isHovering = useHoverDirty(containerRef);\n const [isDragging, setIsDragging] = useState(false);\n const [overflowExists, setOverflowExists] = useState(true);\n const [endPosition, setEndPosition] = useState<number>(0);\n const checkForScrollTimeout = 150;\n\n useEffectOnce(() => {\n const refsExist = containerRef.current && productListRef.current;\n if (\n refsExist &&\n containerRef.current?.getBoundingClientRect().width <\n productListRef.current?.getBoundingClientRect().width\n ) {\n setOverflowExists(true);\n } else {\n setOverflowExists(false);\n }\n });\n\n // TODO: figure out how to remove this TODO. Currently, without this `useEffect` `activeGroup` isn't updating when toggling between different tables (`Section`s).\n // ModelCompareV4 is sometimes used to toggle between sets of data of type Section. In this situation, we need the initial active group to be updated when the new data is passed to ModelCompareV4\n useEffect(() => {\n setActiveGroup(products[0]?.productListGroup?.id as ProductListGroupId);\n }, [products]);\n\n // #############################################################################\n // Scroll-Specific useEffects\n // #############################################################################\n\n // if there aren't any product list group buttons then the ending state of the animations need to exist on the initial render\n useEffect(() => {\n if (!showProductGroups && hasBeenObserved) {\n setPlayAnimation(true);\n }\n }, [hasBeenObserved, setPlayAnimation, showProductGroups]);\n\n // plays animation when no scroll has occurred on the initial observe\n useEffect(() => {\n const productListInitialPosition =\n productListRef.current?.getBoundingClientRect().left;\n\n if (hasBeenObserved || buttonHasBeenClick) {\n setTimeout(() => {\n const currentPosition =\n productListRef.current?.getBoundingClientRect().left;\n if (productListInitialPosition === currentPosition) {\n return setPlayAnimation(true);\n }\n }, checkForScrollTimeout);\n }\n }, [hasBeenObserved, setPlayAnimation, buttonHasBeenClick]);\n\n // #############################################################################\n // Drag Logic\n // #############################################################################\n const dragStartingPosition = useRef(0);\n const scrollAmount = useRef(0);\n\n const dragHandler = useCallback(\n (event: MouseEvent) => {\n scrollAmount.current = dragStartingPosition.current - event.clientX;\n containerRef.current?.scrollTo(endPosition + scrollAmount.current, 0);\n },\n [endPosition],\n );\n\n const mouseUpHandler = useCallback(() => {\n setIsDragging(false);\n setEndPosition(containerRef.current?.scrollLeft as number);\n document.removeEventListener(\"mousemove\", dragHandler);\n }, [dragHandler]);\n\n const mouseDownHandler = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>) => {\n if (event.buttons === 1) {\n dragStartingPosition.current = event.clientX;\n setIsDragging(true);\n document.addEventListener(\"mousemove\", dragHandler);\n document.addEventListener(\"mouseup\", mouseUpHandler);\n }\n },\n [dragHandler, mouseUpHandler],\n );\n\n useEffectOnce(() => {\n let isScrolling: NodeJS.Timeout;\n (containerRef.current as HTMLDivElement).addEventListener(\n \"scroll\",\n function () {\n window.clearTimeout(isScrolling);\n\n // if scrolling occurs, animations are played after scrolling has completed\n // if scrolling occurs, the container's end position is track in state after scrolling has completed\n isScrolling = setTimeout(function () {\n setPlayAnimation(true);\n setEndPosition(containerRef.current?.scrollLeft as number);\n }, checkForScrollTimeout);\n },\n );\n });\n\n // #############################################################################\n // Click to Scroll Logic\n // #############################################################################\n\n const tabClickHandler = useCallback(\n ({ groupId }: { groupId: ProductListGroupId }) => {\n const initialScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n const checkForScroll = () => {\n const currentScrollPosition = (containerRef.current as HTMLDivElement)\n .scrollLeft;\n\n return currentScrollPosition === initialScrollPosition;\n };\n\n const element = document.getElementById(groupId) as HTMLDivElement;\n\n setPlayAnimation(false);\n setActiveGroup(groupId);\n setButtonHasBeenClicked(true);\n element?.scrollIntoView({\n behavior: \"smooth\",\n inline: \"start\",\n block: \"nearest\",\n });\n\n // if no scroll occurs animations are played\n setTimeout(() => {\n if (checkForScroll()) {\n setPlayAnimation(true);\n }\n }, checkForScrollTimeout);\n },\n [containerRef, setPlayAnimation, setActiveGroup, checkForScrollTimeout],\n );\n\n const scrollButtonHandler = ({ isLeftArrow }: { isLeftArrow?: boolean }) => {\n if (containerRef.current) {\n const currentScrollPosition = containerRef.current?.scrollLeft;\n\n const scrollLength = isLeftArrow\n ? currentScrollPosition - S.PRODUCT_CARD_WIDTH - S.PRODUCT_LIST_GRID_GAP\n : currentScrollPosition +\n S.PRODUCT_CARD_WIDTH +\n S.PRODUCT_LIST_GRID_GAP;\n\n containerRef.current?.scrollTo(scrollLength, 0);\n }\n };\n\n const { isMaxLeft, isMaxRight } = useIsAtMaxScroll(containerRef);\n\n return (\n <S.Wrapper>\n {showProductGroups && moreThanOneGroupExists && (\n <ButtonGroup\n items={groupedGroups.map((group) => group.productListGroup)}\n activeButton={activeGroup as string}\n onClick={(id) => {\n tabClickHandler({ groupId: id as ProductListGroupId });\n }}\n />\n )}\n <S.Container\n ref={containerRef}\n $isHovering={isHovering}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n $isDragging={isDragging}\n >\n <S.ProductGroupProductListContainer>\n {moreThanOneGroupExists && (\n <ProductGroups\n products={products}\n activeGroup={activeGroup as ProductListGroupId}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n showProductGroups={showProductGroups}\n />\n )}\n <S.ProductList\n $columns={products.length}\n $isDragging={isDragging}\n $overflowExists={overflowExists}\n $moreThanOneGroupExists={moreThanOneGroupExists}\n onMouseDown={(event) => mouseDownHandler(event)}\n onMouseUp={mouseUpHandler}\n ref={productListRef}\n >\n <ScrollButton\n color=\"white\"\n rotationDegrees={180}\n isVisible={!isMaxLeft}\n onClick={() => scrollButtonHandler({ isLeftArrow: true })}\n />\n <ScrollButton\n color=\"white\"\n rotationDegrees={0}\n isVisible={isMaxRight}\n isRightButton\n onClick={() => scrollButtonHandler({ isLeftArrow: false })}\n />\n {products.map((product, productsArrayIndex) => {\n const groupIsActive =\n product.productListGroup?.id === activeGroup;\n\n const productListGroup = products.filter(\n (product) => activeGroup === product.productListGroup?.id,\n );\n\n const groupIndex = productListGroup.findIndex(\n (item) => item.id === product.id,\n );\n\n return (\n <Product\n onClick={() =>\n setActiveGroup(\n product.productListGroup?.id as ProductListGroupId,\n )\n }\n key={product.id}\n groupIndex={groupIndex}\n groupLength={productListGroup.length}\n id={product?.id as ProductId}\n groupId={product.productListGroup?.id as ProductListGroupId}\n image={product.image ?? { src: \"\", width: 0, height: 0 }}\n name={product.title}\n description={product.description}\n selectedProducts={selectedProducts}\n setSelectedProducts={setSelectedProducts}\n setExternalState={setExternalState}\n groupIsActive={groupIsActive}\n playAnimation={playAnimation}\n canPlayAniimation={hasBeenObserved || buttonHasBeenClick}\n selectedProductsLimit={selectedProductsLimit}\n showProductGroups={showProductGroups}\n isStaticProduct={productsArrayIndex === 0}\n isOverviewPage={isOverviewPage}\n />\n );\n })}\n </S.ProductList>\n </S.ProductGroupProductListContainer>\n </S.Container>\n </S.Wrapper>\n );\n};\n"],"names":["ProductList","products","selectedProducts","setSelectedProducts","hasBeenObserved","selectedProductsLimit","initialActiveGroup","setExternalState","showProductGroups","isOverviewPage","groupedGroups","groupProducts","moreThanOneGroupExists","length","containerRef","useRef","productListRef","buttonHasBeenClick","setButtonHasBeenClicked","useState","activeGroup","setActiveGroup","playAnimation","setPlayAnimation","isHovering","useHoverDirty","isDragging","setIsDragging","overflowExists","setOverflowExists","endPosition","setEndPosition","checkForScrollTimeout","useEffectOnce","refsExist","current","getBoundingClientRect","width","useEffect","productListGroup","id","productListInitialPosition","left","setTimeout","currentPosition","dragStartingPosition","scrollAmount","dragHandler","useCallback","event","clientX","scrollTo","mouseUpHandler","scrollLeft","document","removeEventListener","mouseDownHandler","buttons","addEventListener","isScrolling","window","clearTimeout","tabClickHandler","groupId","initialScrollPosition","checkForScroll","currentScrollPosition","element","getElementById","scrollIntoView","behavior","inline","block","scrollButtonHandler","isLeftArrow","scrollLength","S.PRODUCT_CARD_WIDTH","S.PRODUCT_LIST_GRID_GAP","isMaxLeft","isMaxRight","useIsAtMaxScroll","jsxs","S.Wrapper","children","jsx","ButtonGroup","items","map","group","activeButton","onClick","S.Container","ref","$isHovering","$moreThanOneGroupExists","$isDragging","S.ProductGroupProductListContainer","ProductGroups","canPlayAniimation","S.ProductList","$columns","$overflowExists","onMouseDown","onMouseUp","ScrollButton","color","rotationDegrees","isVisible","isRightButton","product","productsArrayIndex","groupIsActive","filter","groupIndex","findIndex","item","Product","groupLength","image","src","height","name","title","description","isStaticProduct"],"mappings":";;;;;;;;;;;;AAgBO,MAAMA,cAAcA,CAAC;EAC1BC,QAAA;EACAC,gBAAA;EACAC,mBAAA;EACAC,eAAA;EACAC,qBAAA;EACAC,kBAAA;EACAC,gBAAA;EACAC,iBAAA;EACAC;AACF,CAAwB,KAAA;EAChB,MAAAC,aAAA,GAAgBC,cAAcV,QAAQ,CAAA;EACtC,MAAAW,sBAAA,GAAyBF,cAAcG,MAAS,GAAA,CAAA;EAEhD,MAAAC,YAAA,GAAeC,OAAuB,IAAI,CAAA;EAC1C,MAAAC,cAAA,GAAiBD,OAAuB,IAAI,CAAA;EAElD,MAAM,CAACE,kBAAA,EAAoBC,uBAAuB,CAAA,GAAIC,SAAS,KAAK,CAAA;EACpE,MAAM,CAACC,WAAA,EAAaC,cAAc,CAAA,GAAIF,SAASb,kBAAkB,CAAA;EACjE,MAAM,CAACgB,aAAA,EAAeC,gBAAgB,CAAA,GAAIJ,SAAS,KAAK,CAAA;EAClD,MAAAK,UAAA,GAAaC,cAAcX,YAAY,CAAA;EAC7C,MAAM,CAACY,UAAA,EAAYC,aAAa,CAAA,GAAIR,SAAS,KAAK,CAAA;EAClD,MAAM,CAACS,cAAA,EAAgBC,iBAAiB,CAAA,GAAIV,SAAS,IAAI,CAAA;EACzD,MAAM,CAACW,WAAA,EAAaC,cAAc,CAAA,GAAIZ,SAAiB,CAAC,CAAA;EACxD,MAAMa,qBAAwB,GAAA,GAAA;EAE9BC,aAAA,CAAc,MAAM;IACZ,MAAAC,SAAA,GAAYpB,YAAa,CAAAqB,OAAA,IAAWnB,cAAe,CAAAmB,OAAA;IAEvD,IAAAD,SAAA,IACApB,YAAa,CAAAqB,OAAA,EAASC,qBAAsB,CAAA,CAAA,CAAEC,QAC5CrB,cAAe,CAAAmB,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ID_GAP = 10;
|
|
1
3
|
export declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
4
|
export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
5
|
$isHovering: boolean;
|
|
4
6
|
$moreThanOneGroupExists: boolean;
|
|
7
|
+
$isDragging: boolean;
|
|
5
8
|
}>> & string;
|
|
6
9
|
export declare const ProductGroupProductListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
10
|
export declare const ProductGroups: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
@@ -14,6 +14,8 @@ var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
|
14
14
|
"use strict";
|
|
15
15
|
const scrollBarHeight = 16;
|
|
16
16
|
const PRODUCT_CLICKABLE_AREA_Z_INDEX = 1;
|
|
17
|
+
const PRODUCT_CARD_WIDTH = 205;
|
|
18
|
+
const PRODUCT_LIST_GRID_GAP = 10;
|
|
17
19
|
const productCardAnimation = styled.keyframes`
|
|
18
20
|
50% {
|
|
19
21
|
transform: scale(1.025);
|
|
@@ -56,6 +58,10 @@ const Wrapper = styled__default["default"].div`
|
|
|
56
58
|
const Container = styled__default["default"].div`
|
|
57
59
|
overflow-x: auto;
|
|
58
60
|
padding-bottom: 30px;
|
|
61
|
+
scroll-behavior: smooth;
|
|
62
|
+
scroll-behavior: ${({
|
|
63
|
+
$isDragging
|
|
64
|
+
}) => $isDragging ? "unset" : "smooth"};
|
|
59
65
|
|
|
60
66
|
${({
|
|
61
67
|
$moreThanOneGroupExists
|
|
@@ -120,9 +126,12 @@ const ProductGroups = styled__default["default"].div`
|
|
|
120
126
|
min-width: 100%;
|
|
121
127
|
display: grid;
|
|
122
128
|
gap: 0 10px;
|
|
123
|
-
grid-template-columns: repeat(
|
|
129
|
+
grid-template-columns: repeat(
|
|
130
|
+
${({
|
|
124
131
|
$columns
|
|
125
|
-
}) => $columns},
|
|
132
|
+
}) => $columns},
|
|
133
|
+
${PRODUCT_CARD_WIDTH}px
|
|
134
|
+
);
|
|
126
135
|
padding: 0 0 10px 10px;
|
|
127
136
|
|
|
128
137
|
@media ${layout.BREAKPOINTS.MOBILE_AND_DOWN} {
|
|
@@ -180,11 +189,14 @@ const ProductGroupLabelLine = styled__default["default"].div`
|
|
|
180
189
|
`;
|
|
181
190
|
const ProductList = styled__default["default"].div`
|
|
182
191
|
display: grid;
|
|
183
|
-
grid-template-columns: repeat(
|
|
192
|
+
grid-template-columns: repeat(
|
|
193
|
+
${({
|
|
184
194
|
$columns
|
|
185
|
-
}) => $columns},
|
|
195
|
+
}) => $columns},
|
|
196
|
+
${PRODUCT_CARD_WIDTH}px
|
|
197
|
+
);
|
|
186
198
|
align-items: flex-end;
|
|
187
|
-
gap: 0
|
|
199
|
+
gap: 0 ${PRODUCT_LIST_GRID_GAP}px;
|
|
188
200
|
padding: 0 10px;
|
|
189
201
|
|
|
190
202
|
@media ${layout.BREAKPOINTS.MOBILE_AND_DOWN} {
|
|
@@ -351,6 +363,8 @@ exports.Description = Description;
|
|
|
351
363
|
exports.DescriptionButtonContainer = DescriptionButtonContainer;
|
|
352
364
|
exports.Image = Image;
|
|
353
365
|
exports.Name = Name;
|
|
366
|
+
exports.PRODUCT_CARD_WIDTH = PRODUCT_CARD_WIDTH;
|
|
367
|
+
exports.PRODUCT_LIST_GRID_GAP = PRODUCT_LIST_GRID_GAP;
|
|
354
368
|
exports.Product = Product;
|
|
355
369
|
exports.ProductCardOnClickArea = ProductCardOnClickArea;
|
|
356
370
|
exports.ProductGroupLabel = ProductGroupLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductList.styles.js","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.styles.tsx"],"sourcesContent":["import styled, { css, keyframes } from \"styled-components\";\n\nimport { BREAKPOINTS } from \"../../../constants/layout\";\nimport { theme } from \"../../../constants/theme\";\nimport { StyleableSvgImage } from \"../../StyleableSvgImage\";\n\nconst scrollBarHeight = 16;\nconst PRODUCT_CLICKABLE_AREA_Z_INDEX = 1;\n\nconst productCardAnimation = keyframes`\n50% {\n transform: scale(1.025);\n}\n 100% {\n box-shadow: 0 0 13px -1px rgb(33 35 39 / 0.174);\n /* we can't return to scale(1) because this creates a bug where the contents of the product card slightly shift on hover */\n transform: scale(0.999);\n }\n`;\n\nconst productGroupLineAnimation = keyframes`\n 25% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1);\n }\n\n 50% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1.5);\n }\n\n 70% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1.5);\n width: 100%;\n }\n\n 100% {\n background: rgba(0, 111, 255, 0.00);\n transform: scaleY(1);\n width: 100%;\n }\n`;\n\n// seconds\nconst productGroupAnimationDuration = 0.125;\n\n// seconds\nconst productCardAnimationDuration = 0.25;\n\nexport const Wrapper = styled.div`\n position: relative;\n margin-bottom: 20px;\n`;\n\nexport const Container = styled.div<{\n $isHovering: boolean;\n $moreThanOneGroupExists: boolean;\n}>`\n overflow-x: auto;\n padding-bottom: 30px;\n\n ${({ $moreThanOneGroupExists }) =>\n !$moreThanOneGroupExists &&\n css`\n padding-top: 7px;\n `}\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n /* We need the x-padding so the shadows of the cards aren't clipped */\n padding: 0 5px 24px;\n }\n\n /**\n * We cannot define padding on some of these scroll bar\n * elements. Because of this, we're defining scroll bar colors\n * with linear-gradient so users don't have to be very\n * accurate when clicking the scroll bar while keeping the\n * styles of the scroll bar slim.\n */\n\n &::-webkit-scrollbar {\n height: ${scrollBarHeight}px;\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 6px,\n #eeeff1 6px,\n #eeeff1 8px,\n transparent 8px\n );\n }\n\n &::-webkit-scrollbar-thumb {\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 6px,\n ${theme.colors.primaryBlue} 6px,\n ${theme.colors.primaryBlue} 8px,\n transparent 8px\n );\n\n ${({ $isHovering }) =>\n $isHovering &&\n css`\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 5px,\n ${theme.colors.primaryBlue} 5px,\n ${theme.colors.primaryBlue} 9px,\n transparent 9px\n );\n `}\n }\n`;\n\nexport const ProductGroupProductListContainer = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n`;\n\nexport const ProductGroups = styled.div<{ $columns: number }>`\n min-width: 100%;\n display: grid;\n gap: 0 10px;\n grid-template-columns: repeat(${({ $columns }) => $columns}, 205px);\n padding: 0 0 10px 10px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n padding-left: 0;\n }\n`;\n\nexport const ProductGroupLabelContainer = styled.div<{ $span: number }>`\n display: flex;\n grid-column: span ${({ $span }) => $span ?? 1};\n gap: 0 20px;\n`;\n\nexport const ProductGroupLabel = styled.span<{\n $isActive: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n color: #808893;\n font-size: 18px;\n font-weight: 700;\n scroll-margin-left: 10px;\n white-space: nowrap;\n\n ${({ $isActive, $productGroupsSelectorExists }) =>\n ($isActive || !$productGroupsSelectorExists) &&\n css`\n color: ${theme.colors.primaryBlue};\n `}\n`;\n\nexport const ProductGroupLabelLineContainer = styled.div`\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n`;\n\nexport const ProductGroupLabelGrayLine = styled.div`\n width: 100%;\n height: 1px;\n background: #eeeff1;\n`;\n\nexport const ProductGroupLabelLine = styled.div<{\n $isActive: boolean;\n $playAnimation: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n width: 0;\n height: 1px;\n background: #eeeff1;\n\n ${({ $isActive, $playAnimation, $productGroupsSelectorExists }) =>\n !$productGroupsSelectorExists\n ? css`\n animation: ${productGroupLineAnimation} ease-in-out 1 forwards;\n `\n : $isActive &&\n $playAnimation &&\n css`\n animation: ${productGroupLineAnimation}\n ${productGroupAnimationDuration + productCardAnimationDuration}s\n ease-in-out 1 forwards;\n `}\n`;\n\nexport const ProductList = styled.div<{\n $columns: number;\n $isDragging: boolean;\n $overflowExists: boolean;\n $moreThanOneGroupExists: boolean;\n}>`\n display: grid;\n grid-template-columns: repeat(${({ $columns }) => $columns}, 205px);\n align-items: flex-end;\n gap: 0 10px;\n padding: 0 10px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n padding-left: 6px;\n }\n\n ${({ $overflowExists }) =>\n $overflowExists &&\n css`\n cursor: grab;\n `}\n\n ${({ $isDragging, $overflowExists }) =>\n $overflowExists &&\n $isDragging &&\n css`\n cursor: grabbing;\n `}\n\n ${({ $moreThanOneGroupExists }) =>\n !$moreThanOneGroupExists &&\n css`\n margin-top: 5px;\n `}\n`;\n\nexport const ProductCardOnClickArea = styled.div`\n position: absolute;\n z-index: ${PRODUCT_CLICKABLE_AREA_Z_INDEX};\n width: 100%;\n height: 100%;\n`;\n\nexport const Product = styled.div<{\n $isActive: boolean;\n $groupIndex: number;\n $playAnimation: boolean;\n $groupLength: number;\n $canPlayAniimation: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-end;\n background: ${theme.colors.white};\n padding: 20px 10px;\n border-radius: 6px;\n height: 100%;\n min-height: 100%;\n -webkit-user-drag: none;\n user-select: none;\n /* can't use scale(1) because the content slightly shifts on hover */\n transform: scale(0.999);\n\n ${({\n $isActive,\n $groupIndex,\n $playAnimation,\n $groupLength,\n $canPlayAniimation,\n $productGroupsSelectorExists,\n }) =>\n !$productGroupsSelectorExists\n ? css`\n animation: ${productCardAnimation} ease-in-out 1 forwards;\n `\n : $canPlayAniimation &&\n $isActive &&\n $playAnimation &&\n css`\n animation: ${productCardAnimation} ${productCardAnimationDuration}s\n ease-in-out\n ${(productGroupAnimationDuration / $groupLength) * $groupIndex}s 1\n forwards;\n `}\n`;\n\nexport const Image = styled.img`\n -webkit-user-drag: none;\n user-select: none;\n`;\n\nexport const DescriptionButtonContainer = styled.div`\n display: flex;\n flex-direction: column;\n user-select: none;\n\n justify-content: space-between;\n flex-grow: 1;\n`;\n\nexport const Name = styled.div`\n color: #212427;\n text-align: center;\n font-size: 16px;\n font-weight: 700;\n letter-spacing: -0.32px;\n line-height: normal;\n\n display: flex;\n justify-content: center;\n`;\n\nexport const Description = styled.div`\n text-align: center;\n font-size: 14px;\n font-weight: 400;\n line-height: normal;\n letter-spacing: -0.28px;\n color: rgb(0 0 0 / 0.65);\n display: flex;\n justify-content: center;\n margin-top: 6px;\n`;\n\nexport const ButtonIcon = styled(StyleableSvgImage)<{ $isSelected: boolean }>`\n transition: transform 0.125s ease-in-out;\n ${({ $isSelected }) =>\n $isSelected &&\n css`\n transform: rotate(45deg);\n `}\n`;\n\nexport const Button = styled.button<{\n $isStaticProduct: boolean;\n $isSelected: boolean;\n $disabled: boolean;\n}>`\n align-items: center;\n background: transparent;\n border-radius: 4px;\n border: 1px solid #808893;\n color: #808893;\n cursor: pointer;\n display: flex;\n gap: 4px;\n margin: 12px auto 0;\n min-width: 110px;\n padding: 10px 15px;\n transition: 0.3s;\n z-index: ${PRODUCT_CLICKABLE_AREA_Z_INDEX};\n\n &:hover {\n background: #80889310;\n }\n\n ${({ $isSelected }) =>\n $isSelected &&\n css`\n background: ${theme.colors.primaryBlue};\n border: 1px solid ${theme.colors.primaryBlue};\n color: ${theme.colors.white};\n\n &:hover {\n background: ${theme.colors.dodgerblue};\n }\n `}\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n cursor: not-allowed !important;\n `}\n\n ${({ $isStaticProduct }) =>\n $isStaticProduct &&\n css`\n visibility: hidden;\n pointer-events: none;\n `}\n`;\n\nexport const CopyWhiteSpace = styled.span`\n display: inline-block;\n width: 5px;\n`;\n\nexport const ButtonCopy = styled.span`\n font-size: 14px;\n font-weight: 700;\n`;\n"],"names":["scrollBarHeight","PRODUCT_CLICKABLE_AREA_Z_INDEX","productCardAnimation","keyframes","productGroupLineAnimation","theme","colors","primaryBlue","productGroupAnimationDuration","productCardAnimationDuration","Wrapper","styled","div","Container","$moreThanOneGroupExists","css","BREAKPOINTS","MOBILE_AND_DOWN","$isHovering","ProductGroupProductListContainer","ProductGroups","$columns","ProductGroupLabelContainer","$span","ProductGroupLabel","span","$isActive","$productGroupsSelectorExists","ProductGroupLabelLineContainer","ProductGroupLabelGrayLine","ProductGroupLabelLine","$playAnimation","ProductList","$overflowExists","$isDragging","ProductCardOnClickArea","Product","white","$groupIndex","$groupLength","$canPlayAniimation","Image","img","DescriptionButtonContainer","Name","Description","ButtonIcon","StyleableSvgImage","$isSelected","Button","button","dodgerblue","$disabled","$isStaticProduct","CopyWhiteSpace","ButtonCopy"],"mappings":";;;;;;;;;;;;;;AAMA,MAAMA,eAAkB,GAAA,EAAA;AACxB,MAAMC,8BAAiC,GAAA,CAAA;AAEvC,MAAMC,oBAAuB,GAAAC,MAAA,CAAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAW7B,MAAMC,yBAA4B,GAAAD,MAAA,CAAAA,SAAA;AAAA;AAAA,sBAEZE,KAAA,CAAAA,KAAA,CAAMC,OAAOC,WAAW;AAAA;AAAA;;AAAA;AAAA,oBAK1BF,KAAA,CAAAA,KAAA,CAAMC,OAAOC,WAAW;AAAA;AAAA;;AAAA;AAAA,oBAKxBF,KAAA,CAAAA,KAAA,CAAMC,OAAOC,W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styles.js","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.styles.tsx"],"sourcesContent":["import styled, { css, keyframes } from \"styled-components\";\n\nimport { BREAKPOINTS } from \"../../../constants/layout\";\nimport { theme } from \"../../../constants/theme\";\nimport { StyleableSvgImage } from \"../../StyleableSvgImage\";\n\nconst scrollBarHeight = 16;\nconst PRODUCT_CLICKABLE_AREA_Z_INDEX = 1;\nexport const PRODUCT_CARD_WIDTH = 205;\nexport const PRODUCT_LIST_GRID_GAP = 10;\n\nconst productCardAnimation = keyframes`\n50% {\n transform: scale(1.025);\n}\n 100% {\n box-shadow: 0 0 13px -1px rgb(33 35 39 / 0.174);\n /* we can't return to scale(1) because this creates a bug where the contents of the product card slightly shift on hover */\n transform: scale(0.999);\n }\n`;\n\nconst productGroupLineAnimation = keyframes`\n 25% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1);\n }\n\n 50% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1.5);\n }\n\n 70% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1.5);\n width: 100%;\n }\n\n 100% {\n background: rgba(0, 111, 255, 0.00);\n transform: scaleY(1);\n width: 100%;\n }\n`;\n\n// seconds\nconst productGroupAnimationDuration = 0.125;\n\n// seconds\nconst productCardAnimationDuration = 0.25;\n\nexport const Wrapper = styled.div`\n position: relative;\n margin-bottom: 20px;\n`;\n\nexport const Container = styled.div<{\n $isHovering: boolean;\n $moreThanOneGroupExists: boolean;\n $isDragging: boolean;\n}>`\n overflow-x: auto;\n padding-bottom: 30px;\n scroll-behavior: smooth;\n scroll-behavior: ${({ $isDragging }) => ($isDragging ? \"unset\" : \"smooth\")};\n\n ${({ $moreThanOneGroupExists }) =>\n !$moreThanOneGroupExists &&\n css`\n padding-top: 7px;\n `}\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n /* We need the x-padding so the shadows of the cards aren't clipped */\n padding: 0 5px 24px;\n }\n\n /**\n * We cannot define padding on some of these scroll bar\n * elements. Because of this, we're defining scroll bar colors\n * with linear-gradient so users don't have to be very\n * accurate when clicking the scroll bar while keeping the\n * styles of the scroll bar slim.\n */\n\n &::-webkit-scrollbar {\n height: ${scrollBarHeight}px;\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 6px,\n #eeeff1 6px,\n #eeeff1 8px,\n transparent 8px\n );\n }\n\n &::-webkit-scrollbar-thumb {\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 6px,\n ${theme.colors.primaryBlue} 6px,\n ${theme.colors.primaryBlue} 8px,\n transparent 8px\n );\n\n ${({ $isHovering }) =>\n $isHovering &&\n css`\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 5px,\n ${theme.colors.primaryBlue} 5px,\n ${theme.colors.primaryBlue} 9px,\n transparent 9px\n );\n `}\n }\n`;\n\nexport const ProductGroupProductListContainer = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n`;\n\nexport const ProductGroups = styled.div<{ $columns: number }>`\n min-width: 100%;\n display: grid;\n gap: 0 10px;\n grid-template-columns: repeat(\n ${({ $columns }) => $columns},\n ${PRODUCT_CARD_WIDTH}px\n );\n padding: 0 0 10px 10px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n padding-left: 0;\n }\n`;\n\nexport const ProductGroupLabelContainer = styled.div<{ $span: number }>`\n display: flex;\n grid-column: span ${({ $span }) => $span ?? 1};\n gap: 0 20px;\n`;\n\nexport const ProductGroupLabel = styled.span<{\n $isActive: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n color: #808893;\n font-size: 18px;\n font-weight: 700;\n scroll-margin-left: 10px;\n white-space: nowrap;\n\n ${({ $isActive, $productGroupsSelectorExists }) =>\n ($isActive || !$productGroupsSelectorExists) &&\n css`\n color: ${theme.colors.primaryBlue};\n `}\n`;\n\nexport const ProductGroupLabelLineContainer = styled.div`\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n`;\n\nexport const ProductGroupLabelGrayLine = styled.div`\n width: 100%;\n height: 1px;\n background: #eeeff1;\n`;\n\nexport const ProductGroupLabelLine = styled.div<{\n $isActive: boolean;\n $playAnimation: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n width: 0;\n height: 1px;\n background: #eeeff1;\n\n ${({ $isActive, $playAnimation, $productGroupsSelectorExists }) =>\n !$productGroupsSelectorExists\n ? css`\n animation: ${productGroupLineAnimation} ease-in-out 1 forwards;\n `\n : $isActive &&\n $playAnimation &&\n css`\n animation: ${productGroupLineAnimation}\n ${productGroupAnimationDuration + productCardAnimationDuration}s\n ease-in-out 1 forwards;\n `}\n`;\n\nexport const ProductList = styled.div<{\n $columns: number;\n $isDragging: boolean;\n $overflowExists: boolean;\n $moreThanOneGroupExists: boolean;\n}>`\n display: grid;\n grid-template-columns: repeat(\n ${({ $columns }) => $columns},\n ${PRODUCT_CARD_WIDTH}px\n );\n align-items: flex-end;\n gap: 0 ${PRODUCT_LIST_GRID_GAP}px;\n padding: 0 10px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n padding-left: 6px;\n }\n\n ${({ $overflowExists }) =>\n $overflowExists &&\n css`\n cursor: grab;\n `}\n\n ${({ $isDragging, $overflowExists }) =>\n $overflowExists &&\n $isDragging &&\n css`\n cursor: grabbing;\n `}\n\n ${({ $moreThanOneGroupExists }) =>\n !$moreThanOneGroupExists &&\n css`\n margin-top: 5px;\n `}\n`;\n\nexport const ProductCardOnClickArea = styled.div`\n position: absolute;\n z-index: ${PRODUCT_CLICKABLE_AREA_Z_INDEX};\n width: 100%;\n height: 100%;\n`;\n\nexport const Product = styled.div<{\n $isActive: boolean;\n $groupIndex: number;\n $playAnimation: boolean;\n $groupLength: number;\n $canPlayAniimation: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-end;\n background: ${theme.colors.white};\n padding: 20px 10px;\n border-radius: 6px;\n height: 100%;\n min-height: 100%;\n -webkit-user-drag: none;\n user-select: none;\n /* can't use scale(1) because the content slightly shifts on hover */\n transform: scale(0.999);\n\n ${({\n $isActive,\n $groupIndex,\n $playAnimation,\n $groupLength,\n $canPlayAniimation,\n $productGroupsSelectorExists,\n }) =>\n !$productGroupsSelectorExists\n ? css`\n animation: ${productCardAnimation} ease-in-out 1 forwards;\n `\n : $canPlayAniimation &&\n $isActive &&\n $playAnimation &&\n css`\n animation: ${productCardAnimation} ${productCardAnimationDuration}s\n ease-in-out\n ${(productGroupAnimationDuration / $groupLength) * $groupIndex}s 1\n forwards;\n `}\n`;\n\nexport const Image = styled.img`\n -webkit-user-drag: none;\n user-select: none;\n`;\n\nexport const DescriptionButtonContainer = styled.div`\n display: flex;\n flex-direction: column;\n user-select: none;\n\n justify-content: space-between;\n flex-grow: 1;\n`;\n\nexport const Name = styled.div`\n color: #212427;\n text-align: center;\n font-size: 16px;\n font-weight: 700;\n letter-spacing: -0.32px;\n line-height: normal;\n\n display: flex;\n justify-content: center;\n`;\n\nexport const Description = styled.div`\n text-align: center;\n font-size: 14px;\n font-weight: 400;\n line-height: normal;\n letter-spacing: -0.28px;\n color: rgb(0 0 0 / 0.65);\n display: flex;\n justify-content: center;\n margin-top: 6px;\n`;\n\nexport const ButtonIcon = styled(StyleableSvgImage)<{ $isSelected: boolean }>`\n transition: transform 0.125s ease-in-out;\n ${({ $isSelected }) =>\n $isSelected &&\n css`\n transform: rotate(45deg);\n `}\n`;\n\nexport const Button = styled.button<{\n $isStaticProduct: boolean;\n $isSelected: boolean;\n $disabled: boolean;\n}>`\n align-items: center;\n background: transparent;\n border-radius: 4px;\n border: 1px solid #808893;\n color: #808893;\n cursor: pointer;\n display: flex;\n gap: 4px;\n margin: 12px auto 0;\n min-width: 110px;\n padding: 10px 15px;\n transition: 0.3s;\n z-index: ${PRODUCT_CLICKABLE_AREA_Z_INDEX};\n\n &:hover {\n background: #80889310;\n }\n\n ${({ $isSelected }) =>\n $isSelected &&\n css`\n background: ${theme.colors.primaryBlue};\n border: 1px solid ${theme.colors.primaryBlue};\n color: ${theme.colors.white};\n\n &:hover {\n background: ${theme.colors.dodgerblue};\n }\n `}\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n cursor: not-allowed !important;\n `}\n\n ${({ $isStaticProduct }) =>\n $isStaticProduct &&\n css`\n visibility: hidden;\n pointer-events: none;\n `}\n`;\n\nexport const CopyWhiteSpace = styled.span`\n display: inline-block;\n width: 5px;\n`;\n\nexport const ButtonCopy = styled.span`\n font-size: 14px;\n font-weight: 700;\n`;\n"],"names":["scrollBarHeight","PRODUCT_CLICKABLE_AREA_Z_INDEX","PRODUCT_CARD_WIDTH","PRODUCT_LIST_GRID_GAP","productCardAnimation","keyframes","productGroupLineAnimation","theme","colors","primaryBlue","productGroupAnimationDuration","productCardAnimationDuration","Wrapper","styled","div","Container","$isDragging","$moreThanOneGroupExists","css","BREAKPOINTS","MOBILE_AND_DOWN","$isHovering","ProductGroupProductListContainer","ProductGroups","$columns","ProductGroupLabelContainer","$span","ProductGroupLabel","span","$isActive","$productGroupsSelectorExists","ProductGroupLabelLineContainer","ProductGroupLabelGrayLine","ProductGroupLabelLine","$playAnimation","ProductList","$overflowExists","ProductCardOnClickArea","Product","white","$groupIndex","$groupLength","$canPlayAniimation","Image","img","DescriptionButtonContainer","Name","Description","ButtonIcon","StyleableSvgImage","$isSelected","Button","button","dodgerblue","$disabled","$isStaticProduct","CopyWhiteSpace","ButtonCopy"],"mappings":";;;;;;;;;;;;;;AAMA,MAAMA,eAAkB,GAAA,EAAA;AACxB,MAAMC,8BAAiC,GAAA,CAAA;AAChC,MAAMC,kBAAqB,GAAA,GAAA;AAC3B,MAAMC,qBAAwB,GAAA,EAAA;AAErC,MAAMC,oBAAuB,GAAAC,MAAA,CAAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAW7B,MAAMC,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;CAAU,KACbA,SACA,IAAApC,MAAA,CAAAA,GAAA;AAAA;AAAA,KAEC;;AAAA,MAEC,CAAC;EAAEqC;CAAiB,KACtBA,gBACA,IAAArC,MAAA,CAAAA,GAAA;AAAA;AAAA;AAAA,KAGC;AAAA,CAAA;AAGE,MAAMsC,iBAAiB3C,eAAO,CAAA,SAAA,CAAA,CAAAe,IAAA;AAAA;AAAA;AAAA,CAAA;AAK9B,MAAM6B,aAAa5C,eAAO,CAAA,SAAA,CAAA,CAAAe,IAAA;AAAA;AAAA;AAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,6 +6,8 @@ import { StyleableSvgImage } from '../../StyleableSvgImage/StyleableSvgImage.mjs
|
|
|
6
6
|
"use strict";
|
|
7
7
|
const scrollBarHeight = 16;
|
|
8
8
|
const PRODUCT_CLICKABLE_AREA_Z_INDEX = 1;
|
|
9
|
+
const PRODUCT_CARD_WIDTH = 205;
|
|
10
|
+
const PRODUCT_LIST_GRID_GAP = 10;
|
|
9
11
|
const productCardAnimation = keyframes`
|
|
10
12
|
50% {
|
|
11
13
|
transform: scale(1.025);
|
|
@@ -48,6 +50,10 @@ const Wrapper = styled.div`
|
|
|
48
50
|
const Container = styled.div`
|
|
49
51
|
overflow-x: auto;
|
|
50
52
|
padding-bottom: 30px;
|
|
53
|
+
scroll-behavior: smooth;
|
|
54
|
+
scroll-behavior: ${({
|
|
55
|
+
$isDragging
|
|
56
|
+
}) => $isDragging ? "unset" : "smooth"};
|
|
51
57
|
|
|
52
58
|
${({
|
|
53
59
|
$moreThanOneGroupExists
|
|
@@ -112,9 +118,12 @@ const ProductGroups = styled.div`
|
|
|
112
118
|
min-width: 100%;
|
|
113
119
|
display: grid;
|
|
114
120
|
gap: 0 10px;
|
|
115
|
-
grid-template-columns: repeat(
|
|
121
|
+
grid-template-columns: repeat(
|
|
122
|
+
${({
|
|
116
123
|
$columns
|
|
117
|
-
}) => $columns},
|
|
124
|
+
}) => $columns},
|
|
125
|
+
${PRODUCT_CARD_WIDTH}px
|
|
126
|
+
);
|
|
118
127
|
padding: 0 0 10px 10px;
|
|
119
128
|
|
|
120
129
|
@media ${BREAKPOINTS.MOBILE_AND_DOWN} {
|
|
@@ -172,11 +181,14 @@ const ProductGroupLabelLine = styled.div`
|
|
|
172
181
|
`;
|
|
173
182
|
const ProductList = styled.div`
|
|
174
183
|
display: grid;
|
|
175
|
-
grid-template-columns: repeat(
|
|
184
|
+
grid-template-columns: repeat(
|
|
185
|
+
${({
|
|
176
186
|
$columns
|
|
177
|
-
}) => $columns},
|
|
187
|
+
}) => $columns},
|
|
188
|
+
${PRODUCT_CARD_WIDTH}px
|
|
189
|
+
);
|
|
178
190
|
align-items: flex-end;
|
|
179
|
-
gap: 0
|
|
191
|
+
gap: 0 ${PRODUCT_LIST_GRID_GAP}px;
|
|
180
192
|
padding: 0 10px;
|
|
181
193
|
|
|
182
194
|
@media ${BREAKPOINTS.MOBILE_AND_DOWN} {
|
|
@@ -334,5 +346,5 @@ const ButtonCopy = styled.span`
|
|
|
334
346
|
font-size: 14px;
|
|
335
347
|
font-weight: 700;
|
|
336
348
|
`;
|
|
337
|
-
export { Button, ButtonCopy, ButtonIcon, Container, CopyWhiteSpace, Description, DescriptionButtonContainer, Image, Name, Product, ProductCardOnClickArea, ProductGroupLabel, ProductGroupLabelContainer, ProductGroupLabelGrayLine, ProductGroupLabelLine, ProductGroupLabelLineContainer, ProductGroupProductListContainer, ProductGroups, ProductList, Wrapper };
|
|
349
|
+
export { Button, ButtonCopy, ButtonIcon, Container, CopyWhiteSpace, Description, DescriptionButtonContainer, Image, Name, PRODUCT_CARD_WIDTH, PRODUCT_LIST_GRID_GAP, Product, ProductCardOnClickArea, ProductGroupLabel, ProductGroupLabelContainer, ProductGroupLabelGrayLine, ProductGroupLabelLine, ProductGroupLabelLineContainer, ProductGroupProductListContainer, ProductGroups, ProductList, Wrapper };
|
|
338
350
|
//# sourceMappingURL=ProductList.styles.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductList.styles.mjs","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.styles.tsx"],"sourcesContent":["import styled, { css, keyframes } from \"styled-components\";\n\nimport { BREAKPOINTS } from \"../../../constants/layout\";\nimport { theme } from \"../../../constants/theme\";\nimport { StyleableSvgImage } from \"../../StyleableSvgImage\";\n\nconst scrollBarHeight = 16;\nconst PRODUCT_CLICKABLE_AREA_Z_INDEX = 1;\n\nconst productCardAnimation = keyframes`\n50% {\n transform: scale(1.025);\n}\n 100% {\n box-shadow: 0 0 13px -1px rgb(33 35 39 / 0.174);\n /* we can't return to scale(1) because this creates a bug where the contents of the product card slightly shift on hover */\n transform: scale(0.999);\n }\n`;\n\nconst productGroupLineAnimation = keyframes`\n 25% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1);\n }\n\n 50% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1.5);\n }\n\n 70% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1.5);\n width: 100%;\n }\n\n 100% {\n background: rgba(0, 111, 255, 0.00);\n transform: scaleY(1);\n width: 100%;\n }\n`;\n\n// seconds\nconst productGroupAnimationDuration = 0.125;\n\n// seconds\nconst productCardAnimationDuration = 0.25;\n\nexport const Wrapper = styled.div`\n position: relative;\n margin-bottom: 20px;\n`;\n\nexport const Container = styled.div<{\n $isHovering: boolean;\n $moreThanOneGroupExists: boolean;\n}>`\n overflow-x: auto;\n padding-bottom: 30px;\n\n ${({ $moreThanOneGroupExists }) =>\n !$moreThanOneGroupExists &&\n css`\n padding-top: 7px;\n `}\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n /* We need the x-padding so the shadows of the cards aren't clipped */\n padding: 0 5px 24px;\n }\n\n /**\n * We cannot define padding on some of these scroll bar\n * elements. Because of this, we're defining scroll bar colors\n * with linear-gradient so users don't have to be very\n * accurate when clicking the scroll bar while keeping the\n * styles of the scroll bar slim.\n */\n\n &::-webkit-scrollbar {\n height: ${scrollBarHeight}px;\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 6px,\n #eeeff1 6px,\n #eeeff1 8px,\n transparent 8px\n );\n }\n\n &::-webkit-scrollbar-thumb {\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 6px,\n ${theme.colors.primaryBlue} 6px,\n ${theme.colors.primaryBlue} 8px,\n transparent 8px\n );\n\n ${({ $isHovering }) =>\n $isHovering &&\n css`\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 5px,\n ${theme.colors.primaryBlue} 5px,\n ${theme.colors.primaryBlue} 9px,\n transparent 9px\n );\n `}\n }\n`;\n\nexport const ProductGroupProductListContainer = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n`;\n\nexport const ProductGroups = styled.div<{ $columns: number }>`\n min-width: 100%;\n display: grid;\n gap: 0 10px;\n grid-template-columns: repeat(${({ $columns }) => $columns}, 205px);\n padding: 0 0 10px 10px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n padding-left: 0;\n }\n`;\n\nexport const ProductGroupLabelContainer = styled.div<{ $span: number }>`\n display: flex;\n grid-column: span ${({ $span }) => $span ?? 1};\n gap: 0 20px;\n`;\n\nexport const ProductGroupLabel = styled.span<{\n $isActive: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n color: #808893;\n font-size: 18px;\n font-weight: 700;\n scroll-margin-left: 10px;\n white-space: nowrap;\n\n ${({ $isActive, $productGroupsSelectorExists }) =>\n ($isActive || !$productGroupsSelectorExists) &&\n css`\n color: ${theme.colors.primaryBlue};\n `}\n`;\n\nexport const ProductGroupLabelLineContainer = styled.div`\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n`;\n\nexport const ProductGroupLabelGrayLine = styled.div`\n width: 100%;\n height: 1px;\n background: #eeeff1;\n`;\n\nexport const ProductGroupLabelLine = styled.div<{\n $isActive: boolean;\n $playAnimation: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n width: 0;\n height: 1px;\n background: #eeeff1;\n\n ${({ $isActive, $playAnimation, $productGroupsSelectorExists }) =>\n !$productGroupsSelectorExists\n ? css`\n animation: ${productGroupLineAnimation} ease-in-out 1 forwards;\n `\n : $isActive &&\n $playAnimation &&\n css`\n animation: ${productGroupLineAnimation}\n ${productGroupAnimationDuration + productCardAnimationDuration}s\n ease-in-out 1 forwards;\n `}\n`;\n\nexport const ProductList = styled.div<{\n $columns: number;\n $isDragging: boolean;\n $overflowExists: boolean;\n $moreThanOneGroupExists: boolean;\n}>`\n display: grid;\n grid-template-columns: repeat(${({ $columns }) => $columns}, 205px);\n align-items: flex-end;\n gap: 0 10px;\n padding: 0 10px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n padding-left: 6px;\n }\n\n ${({ $overflowExists }) =>\n $overflowExists &&\n css`\n cursor: grab;\n `}\n\n ${({ $isDragging, $overflowExists }) =>\n $overflowExists &&\n $isDragging &&\n css`\n cursor: grabbing;\n `}\n\n ${({ $moreThanOneGroupExists }) =>\n !$moreThanOneGroupExists &&\n css`\n margin-top: 5px;\n `}\n`;\n\nexport const ProductCardOnClickArea = styled.div`\n position: absolute;\n z-index: ${PRODUCT_CLICKABLE_AREA_Z_INDEX};\n width: 100%;\n height: 100%;\n`;\n\nexport const Product = styled.div<{\n $isActive: boolean;\n $groupIndex: number;\n $playAnimation: boolean;\n $groupLength: number;\n $canPlayAniimation: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-end;\n background: ${theme.colors.white};\n padding: 20px 10px;\n border-radius: 6px;\n height: 100%;\n min-height: 100%;\n -webkit-user-drag: none;\n user-select: none;\n /* can't use scale(1) because the content slightly shifts on hover */\n transform: scale(0.999);\n\n ${({\n $isActive,\n $groupIndex,\n $playAnimation,\n $groupLength,\n $canPlayAniimation,\n $productGroupsSelectorExists,\n }) =>\n !$productGroupsSelectorExists\n ? css`\n animation: ${productCardAnimation} ease-in-out 1 forwards;\n `\n : $canPlayAniimation &&\n $isActive &&\n $playAnimation &&\n css`\n animation: ${productCardAnimation} ${productCardAnimationDuration}s\n ease-in-out\n ${(productGroupAnimationDuration / $groupLength) * $groupIndex}s 1\n forwards;\n `}\n`;\n\nexport const Image = styled.img`\n -webkit-user-drag: none;\n user-select: none;\n`;\n\nexport const DescriptionButtonContainer = styled.div`\n display: flex;\n flex-direction: column;\n user-select: none;\n\n justify-content: space-between;\n flex-grow: 1;\n`;\n\nexport const Name = styled.div`\n color: #212427;\n text-align: center;\n font-size: 16px;\n font-weight: 700;\n letter-spacing: -0.32px;\n line-height: normal;\n\n display: flex;\n justify-content: center;\n`;\n\nexport const Description = styled.div`\n text-align: center;\n font-size: 14px;\n font-weight: 400;\n line-height: normal;\n letter-spacing: -0.28px;\n color: rgb(0 0 0 / 0.65);\n display: flex;\n justify-content: center;\n margin-top: 6px;\n`;\n\nexport const ButtonIcon = styled(StyleableSvgImage)<{ $isSelected: boolean }>`\n transition: transform 0.125s ease-in-out;\n ${({ $isSelected }) =>\n $isSelected &&\n css`\n transform: rotate(45deg);\n `}\n`;\n\nexport const Button = styled.button<{\n $isStaticProduct: boolean;\n $isSelected: boolean;\n $disabled: boolean;\n}>`\n align-items: center;\n background: transparent;\n border-radius: 4px;\n border: 1px solid #808893;\n color: #808893;\n cursor: pointer;\n display: flex;\n gap: 4px;\n margin: 12px auto 0;\n min-width: 110px;\n padding: 10px 15px;\n transition: 0.3s;\n z-index: ${PRODUCT_CLICKABLE_AREA_Z_INDEX};\n\n &:hover {\n background: #80889310;\n }\n\n ${({ $isSelected }) =>\n $isSelected &&\n css`\n background: ${theme.colors.primaryBlue};\n border: 1px solid ${theme.colors.primaryBlue};\n color: ${theme.colors.white};\n\n &:hover {\n background: ${theme.colors.dodgerblue};\n }\n `}\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n cursor: not-allowed !important;\n `}\n\n ${({ $isStaticProduct }) =>\n $isStaticProduct &&\n css`\n visibility: hidden;\n pointer-events: none;\n `}\n`;\n\nexport const CopyWhiteSpace = styled.span`\n display: inline-block;\n width: 5px;\n`;\n\nexport const ButtonCopy = styled.span`\n font-size: 14px;\n font-weight: 700;\n`;\n"],"names":["scrollBarHeight","PRODUCT_CLICKABLE_AREA_Z_INDEX","productCardAnimation","keyframes","productGroupLineAnimation","theme","colors","primaryBlue","productGroupAnimationDuration","productCardAnimationDuration","Wrapper","styled","div","Container","$moreThanOneGroupExists","css","BREAKPOINTS","MOBILE_AND_DOWN","$isHovering","ProductGroupProductListContainer","ProductGroups","$columns","ProductGroupLabelContainer","$span","ProductGroupLabel","span","$isActive","$productGroupsSelectorExists","ProductGroupLabelLineContainer","ProductGroupLabelGrayLine","ProductGroupLabelLine","$playAnimation","ProductList","$overflowExists","$isDragging","ProductCardOnClickArea","Product","white","$groupIndex","$groupLength","$canPlayAniimation","Image","img","DescriptionButtonContainer","Name","Description","ButtonIcon","StyleableSvgImage","$isSelected","Button","button","dodgerblue","$disabled","$isStaticProduct","CopyWhiteSpace","ButtonCopy"],"mappings":";;;;;;AAMA,MAAMA,eAAkB,GAAA,EAAA;AACxB,MAAMC,8BAAiC,GAAA,CAAA;AAEvC,MAAMC,oBAAuB,GAAAC,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAW7B,MAAMC,yBAA4B,GAAAD,SAAA;AAAA;AAAA,sBAEZE,KAAA,CAAMC,OAAOC,WAAW;AAAA;AAAA;;AAAA;AAAA,oBAK1BF,KAAA,CAAMC,OAAOC,WAAW;AAAA;AAAA;;AAAA;AAAA,oBAKxBF,KAAA,CAAMC,OAAOC,WAAW;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAa5C,MAAMC,6BAAgC,GAAA,KAAA;AAGtC,MAAMC,4BAA+B,GAAA,IA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AO6C,UAAU;AAAA;AAAA,KAExC;;AAAA,IAED,CAAC;EAAEC;CAAU,KACbA,SACA,IAAArC,GAAA;AAAA;AAAA,KAEC;;AAAA,MAEC,CAAC;EAAEsC;CAAiB,KACtBA,gBACA,IAAAtC,GAAA;AAAA;AAAA;AAAA,KAGC;AAAA,CAAA;AAGE,MAAMuC,iBAAiB3C,MAAO,CAAAc,IAAA;AAAA;AAAA;AAAA,CAAA;AAK9B,MAAM8B,aAAa5C,MAAO,CAAAc,IAAA;AAAA;AAAA;AAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ProductList.styles.mjs","sources":["../../../../src/components/ModelCompareV4/ProductList/ProductList.styles.tsx"],"sourcesContent":["import styled, { css, keyframes } from \"styled-components\";\n\nimport { BREAKPOINTS } from \"../../../constants/layout\";\nimport { theme } from \"../../../constants/theme\";\nimport { StyleableSvgImage } from \"../../StyleableSvgImage\";\n\nconst scrollBarHeight = 16;\nconst PRODUCT_CLICKABLE_AREA_Z_INDEX = 1;\nexport const PRODUCT_CARD_WIDTH = 205;\nexport const PRODUCT_LIST_GRID_GAP = 10;\n\nconst productCardAnimation = keyframes`\n50% {\n transform: scale(1.025);\n}\n 100% {\n box-shadow: 0 0 13px -1px rgb(33 35 39 / 0.174);\n /* we can't return to scale(1) because this creates a bug where the contents of the product card slightly shift on hover */\n transform: scale(0.999);\n }\n`;\n\nconst productGroupLineAnimation = keyframes`\n 25% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1);\n }\n\n 50% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1.5);\n }\n\n 70% {\n background: ${theme.colors.primaryBlue};\n transform: scaleY(1.5);\n width: 100%;\n }\n\n 100% {\n background: rgba(0, 111, 255, 0.00);\n transform: scaleY(1);\n width: 100%;\n }\n`;\n\n// seconds\nconst productGroupAnimationDuration = 0.125;\n\n// seconds\nconst productCardAnimationDuration = 0.25;\n\nexport const Wrapper = styled.div`\n position: relative;\n margin-bottom: 20px;\n`;\n\nexport const Container = styled.div<{\n $isHovering: boolean;\n $moreThanOneGroupExists: boolean;\n $isDragging: boolean;\n}>`\n overflow-x: auto;\n padding-bottom: 30px;\n scroll-behavior: smooth;\n scroll-behavior: ${({ $isDragging }) => ($isDragging ? \"unset\" : \"smooth\")};\n\n ${({ $moreThanOneGroupExists }) =>\n !$moreThanOneGroupExists &&\n css`\n padding-top: 7px;\n `}\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n /* We need the x-padding so the shadows of the cards aren't clipped */\n padding: 0 5px 24px;\n }\n\n /**\n * We cannot define padding on some of these scroll bar\n * elements. Because of this, we're defining scroll bar colors\n * with linear-gradient so users don't have to be very\n * accurate when clicking the scroll bar while keeping the\n * styles of the scroll bar slim.\n */\n\n &::-webkit-scrollbar {\n height: ${scrollBarHeight}px;\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 6px,\n #eeeff1 6px,\n #eeeff1 8px,\n transparent 8px\n );\n }\n\n &::-webkit-scrollbar-thumb {\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 6px,\n ${theme.colors.primaryBlue} 6px,\n ${theme.colors.primaryBlue} 8px,\n transparent 8px\n );\n\n ${({ $isHovering }) =>\n $isHovering &&\n css`\n /* at the top of this componnent's definition is a note on why we're defining colors this way */\n background-image: linear-gradient(\n to bottom,\n transparent 5px,\n ${theme.colors.primaryBlue} 5px,\n ${theme.colors.primaryBlue} 9px,\n transparent 9px\n );\n `}\n }\n`;\n\nexport const ProductGroupProductListContainer = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n`;\n\nexport const ProductGroups = styled.div<{ $columns: number }>`\n min-width: 100%;\n display: grid;\n gap: 0 10px;\n grid-template-columns: repeat(\n ${({ $columns }) => $columns},\n ${PRODUCT_CARD_WIDTH}px\n );\n padding: 0 0 10px 10px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n padding-left: 0;\n }\n`;\n\nexport const ProductGroupLabelContainer = styled.div<{ $span: number }>`\n display: flex;\n grid-column: span ${({ $span }) => $span ?? 1};\n gap: 0 20px;\n`;\n\nexport const ProductGroupLabel = styled.span<{\n $isActive: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n color: #808893;\n font-size: 18px;\n font-weight: 700;\n scroll-margin-left: 10px;\n white-space: nowrap;\n\n ${({ $isActive, $productGroupsSelectorExists }) =>\n ($isActive || !$productGroupsSelectorExists) &&\n css`\n color: ${theme.colors.primaryBlue};\n `}\n`;\n\nexport const ProductGroupLabelLineContainer = styled.div`\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n`;\n\nexport const ProductGroupLabelGrayLine = styled.div`\n width: 100%;\n height: 1px;\n background: #eeeff1;\n`;\n\nexport const ProductGroupLabelLine = styled.div<{\n $isActive: boolean;\n $playAnimation: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n width: 0;\n height: 1px;\n background: #eeeff1;\n\n ${({ $isActive, $playAnimation, $productGroupsSelectorExists }) =>\n !$productGroupsSelectorExists\n ? css`\n animation: ${productGroupLineAnimation} ease-in-out 1 forwards;\n `\n : $isActive &&\n $playAnimation &&\n css`\n animation: ${productGroupLineAnimation}\n ${productGroupAnimationDuration + productCardAnimationDuration}s\n ease-in-out 1 forwards;\n `}\n`;\n\nexport const ProductList = styled.div<{\n $columns: number;\n $isDragging: boolean;\n $overflowExists: boolean;\n $moreThanOneGroupExists: boolean;\n}>`\n display: grid;\n grid-template-columns: repeat(\n ${({ $columns }) => $columns},\n ${PRODUCT_CARD_WIDTH}px\n );\n align-items: flex-end;\n gap: 0 ${PRODUCT_LIST_GRID_GAP}px;\n padding: 0 10px;\n\n @media ${BREAKPOINTS.MOBILE_AND_DOWN} {\n padding-left: 6px;\n }\n\n ${({ $overflowExists }) =>\n $overflowExists &&\n css`\n cursor: grab;\n `}\n\n ${({ $isDragging, $overflowExists }) =>\n $overflowExists &&\n $isDragging &&\n css`\n cursor: grabbing;\n `}\n\n ${({ $moreThanOneGroupExists }) =>\n !$moreThanOneGroupExists &&\n css`\n margin-top: 5px;\n `}\n`;\n\nexport const ProductCardOnClickArea = styled.div`\n position: absolute;\n z-index: ${PRODUCT_CLICKABLE_AREA_Z_INDEX};\n width: 100%;\n height: 100%;\n`;\n\nexport const Product = styled.div<{\n $isActive: boolean;\n $groupIndex: number;\n $playAnimation: boolean;\n $groupLength: number;\n $canPlayAniimation: boolean;\n $productGroupsSelectorExists: boolean;\n}>`\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-end;\n background: ${theme.colors.white};\n padding: 20px 10px;\n border-radius: 6px;\n height: 100%;\n min-height: 100%;\n -webkit-user-drag: none;\n user-select: none;\n /* can't use scale(1) because the content slightly shifts on hover */\n transform: scale(0.999);\n\n ${({\n $isActive,\n $groupIndex,\n $playAnimation,\n $groupLength,\n $canPlayAniimation,\n $productGroupsSelectorExists,\n }) =>\n !$productGroupsSelectorExists\n ? css`\n animation: ${productCardAnimation} ease-in-out 1 forwards;\n `\n : $canPlayAniimation &&\n $isActive &&\n $playAnimation &&\n css`\n animation: ${productCardAnimation} ${productCardAnimationDuration}s\n ease-in-out\n ${(productGroupAnimationDuration / $groupLength) * $groupIndex}s 1\n forwards;\n `}\n`;\n\nexport const Image = styled.img`\n -webkit-user-drag: none;\n user-select: none;\n`;\n\nexport const DescriptionButtonContainer = styled.div`\n display: flex;\n flex-direction: column;\n user-select: none;\n\n justify-content: space-between;\n flex-grow: 1;\n`;\n\nexport const Name = styled.div`\n color: #212427;\n text-align: center;\n font-size: 16px;\n font-weight: 700;\n letter-spacing: -0.32px;\n line-height: normal;\n\n display: flex;\n justify-content: center;\n`;\n\nexport const Description = styled.div`\n text-align: center;\n font-size: 14px;\n font-weight: 400;\n line-height: normal;\n letter-spacing: -0.28px;\n color: rgb(0 0 0 / 0.65);\n display: flex;\n justify-content: center;\n margin-top: 6px;\n`;\n\nexport const ButtonIcon = styled(StyleableSvgImage)<{ $isSelected: boolean }>`\n transition: transform 0.125s ease-in-out;\n ${({ $isSelected }) =>\n $isSelected &&\n css`\n transform: rotate(45deg);\n `}\n`;\n\nexport const Button = styled.button<{\n $isStaticProduct: boolean;\n $isSelected: boolean;\n $disabled: boolean;\n}>`\n align-items: center;\n background: transparent;\n border-radius: 4px;\n border: 1px solid #808893;\n color: #808893;\n cursor: pointer;\n display: flex;\n gap: 4px;\n margin: 12px auto 0;\n min-width: 110px;\n padding: 10px 15px;\n transition: 0.3s;\n z-index: ${PRODUCT_CLICKABLE_AREA_Z_INDEX};\n\n &:hover {\n background: #80889310;\n }\n\n ${({ $isSelected }) =>\n $isSelected &&\n css`\n background: ${theme.colors.primaryBlue};\n border: 1px solid ${theme.colors.primaryBlue};\n color: ${theme.colors.white};\n\n &:hover {\n background: ${theme.colors.dodgerblue};\n }\n `}\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n cursor: not-allowed !important;\n `}\n\n ${({ $isStaticProduct }) =>\n $isStaticProduct &&\n css`\n visibility: hidden;\n pointer-events: none;\n `}\n`;\n\nexport const CopyWhiteSpace = styled.span`\n display: inline-block;\n width: 5px;\n`;\n\nexport const ButtonCopy = styled.span`\n font-size: 14px;\n font-weight: 700;\n`;\n"],"names":["scrollBarHeight","PRODUCT_CLICKABLE_AREA_Z_INDEX","PRODUCT_CARD_WIDTH","PRODUCT_LIST_GRID_GAP","productCardAnimation","keyframes","productGroupLineAnimation","theme","colors","primaryBlue","productGroupAnimationDuration","productCardAnimationDuration","Wrapper","styled","div","Container","$isDragging","$moreThanOneGroupExists","css","BREAKPOINTS","MOBILE_AND_DOWN","$isHovering","ProductGroupProductListContainer","ProductGroups","$columns","ProductGroupLabelContainer","$span","ProductGroupLabel","span","$isActive","$productGroupsSelectorExists","ProductGroupLabelLineContainer","ProductGroupLabelGrayLine","ProductGroupLabelLine","$playAnimation","ProductList","$overflowExists","ProductCardOnClickArea","Product","white","$groupIndex","$groupLength","$canPlayAniimation","Image","img","DescriptionButtonContain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|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var reactUse = require('react-use');
|
|
6
|
+
require('../../../../../constants/modelCompareData/assets/arrow-right.svg.js');
|
|
7
|
+
require('../../../../StyleableSvgImage/index.js');
|
|
8
|
+
var CompareTable_styles = require('../../../CompareTable/CompareTable.styles.js');
|
|
9
|
+
var ScrollButton_styles = require('./ScrollButton.styles.js');
|
|
10
|
+
var arrowRightIcon = require("../../../../../assets/arrowRight.svg");
|
|
11
|
+
var StyleableSvgImage = require('../../../../StyleableSvgImage/StyleableSvgImage.js');
|
|
12
|
+
function _interopDefault(e) {
|
|
13
|
+
return e && e.__esModule ? e : {
|
|
14
|
+
default: e
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
var arrowRightIcon__default = /*#__PURE__*/_interopDefault(arrowRightIcon);
|
|
18
|
+
"use strict";
|
|
19
|
+
const icon = typeof arrowRightIcon__default["default"] === "string" ? arrowRightIcon__default["default"] : arrowRightIcon__default["default"].src;
|
|
20
|
+
const ScrollButton = ({
|
|
21
|
+
color,
|
|
22
|
+
rotationDegrees,
|
|
23
|
+
isVisible,
|
|
24
|
+
isRightButton,
|
|
25
|
+
onClick
|
|
26
|
+
}) => {
|
|
27
|
+
const {
|
|
28
|
+
width: screenWidth
|
|
29
|
+
} = reactUse.useWindowSize();
|
|
30
|
+
const isSmallScreen = screenWidth < CompareTable_styles.MOBILE_BREAKPOINT;
|
|
31
|
+
const placeButtonsOverCards = screenWidth < 1450;
|
|
32
|
+
const arrowOffset = React.useMemo(() => {
|
|
33
|
+
if (isSmallScreen) {
|
|
34
|
+
return rotationDegrees < 180 ? -5 : 0;
|
|
35
|
+
}
|
|
36
|
+
return -15;
|
|
37
|
+
}, [isSmallScreen, rotationDegrees]);
|
|
38
|
+
return /* @__PURE__ */jsxRuntime.jsx(ScrollButton_styles.Button, {
|
|
39
|
+
$color: color,
|
|
40
|
+
$rotation: rotationDegrees,
|
|
41
|
+
$isVisible: isVisible,
|
|
42
|
+
$isRightButton: Boolean(isRightButton),
|
|
43
|
+
$placeButtonsOverCards: placeButtonsOverCards,
|
|
44
|
+
type: "button",
|
|
45
|
+
onClick,
|
|
46
|
+
children: /* @__PURE__ */jsxRuntime.jsx(ScrollButton_styles.Icon, {
|
|
47
|
+
rotation: rotationDegrees,
|
|
48
|
+
arrowOffset,
|
|
49
|
+
children: /* @__PURE__ */jsxRuntime.jsx(StyleableSvgImage.StyleableSvgImage, {
|
|
50
|
+
width: 10,
|
|
51
|
+
height: 16,
|
|
52
|
+
src: icon
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.ScrollButton = ScrollButton;
|
|
58
|
+
//# sourceMappingURL=ScrollButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollButton.js","sources":["../../../../../../src/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useWindowSize } from \"react-use\";\n\nimport arrowRightIcon from \"../../../../../constants/modelCompareData/assets/arrow-right.svg\";\nimport { StyleableSvgImage } from \"../../../../StyleableSvgImage\";\nimport { MOBILE_BREAKPOINT } from \"../../../CompareTable/CompareTable.styles\";\nimport * as S from \"./ScrollButton.styles\";\n\nconst icon =\n typeof arrowRightIcon === \"string\" ? arrowRightIcon : arrowRightIcon.src;\n\nexport const ScrollButton = ({\n color,\n rotationDegrees,\n isVisible,\n isRightButton,\n onClick,\n}: {\n color: string;\n rotationDegrees: number;\n isVisible: boolean;\n isRightButton?: boolean;\n onClick: () => void;\n}) => {\n const { width: screenWidth } = useWindowSize();\n const isSmallScreen = screenWidth < MOBILE_BREAKPOINT;\n const placeButtonsOverCards = screenWidth < 1450;\n\n const arrowOffset = useMemo(() => {\n if (isSmallScreen) {\n return rotationDegrees < 180 ? -5 : 0;\n }\n\n return -15;\n }, [isSmallScreen, rotationDegrees]);\n\n return (\n <S.Button\n $color={color}\n $rotation={rotationDegrees}\n $isVisible={isVisible}\n $isRightButton={Boolean(isRightButton)}\n $placeButtonsOverCards={placeButtonsOverCards}\n type=\"button\"\n onClick={onClick}\n >\n <S.Icon rotation={rotationDegrees} arrowOffset={arrowOffset}>\n <StyleableSvgImage width={10} height={16} src={icon} />\n </S.Icon>\n </S.Button>\n );\n};\n"],"names":["icon","arrowRightIcon","src","ScrollButton","color","rotationDegrees","isVisible","isRightButton","onClick","width","screenWidth","useWindowSize","isSmallScreen","MOBILE_BREAKPOINT","placeButtonsOverCards","arrowOffset","useMemo","jsx","S.Button","Button","$color","$rotation","$isVisible","$isRightButton","Boolean","$placeButtonsOverCards","type","children","S.Icon","rotation","StyleableSvgImage","height"],"mappings":";;;;;;;;;;;;;;;;;;AAQA,MAAMA,IACJ,GAAA,OAAOC,uBAAmB,CAAA,SAAA,CAAA,KAAA,QAAA,GAAWA,qCAAiBA,uBAAe,CAAA,SAAA,CAAA,CAAAC,GAAA;AAEhE,MAAMC,eAAeA,CAAC;EAC3BC,KAAA;EACAC,eAAA;EACAC,SAAA;EACAC,aAAA;EACAC;AACF,CAMM,KAAA;EACJ,MAAM;IAAEC,KAAA,EAAOC;EAAY,CAAA,GAAIC,sBAAc,CAAA,CAAA;EAC7C,MAAMC,gBAAgBF,WAAc,GAAAG,mBAAA,CAAAA,iBAAA;EACpC,MAAMC,wBAAwBJ,WAAc,GAAA,IAAA;EAEtC,MAAAK,WAAA,GAAcC,KAAAA,CAAAA,QAAQ,MAAM;IAChC,IAAIJ,aAAe,EAAA;MACV,OAAAP,eAAA,GAAkB,MAAM,CAAK,CAAA,GAAA,CAAA;IAAA;IAG/B,OAAA,CAAA,EAAA;EAAA,CACN,EAAA,CAACO,aAAe,EAAAP,eAAe,CAAC,CAAA;EAGjC,sBAAAY,UAAA,CAAAA,GAAA,CAACC,mBAAE,CAAAC,MAAA,EAAF;IACCC,MAAQ,EAAAhB,KAAA;IACRiB,SAAW,EAAAhB,eAAA;IACXiB,UAAY,EAAAhB,SAAA;IACZiB,cAAA,EAAgBC,QAAQjB,aAAa,CAAA;IACrCkB,sBAAwB,EAAAX,qBAAA;IACxBY,IAAK,EAAA,QAAA;IACLlB,OAAA;IAEAmB,QAAC,EAAA,eAAAV,UAAA,CAAAA,GAAA,CAAAW,wBAAA,EAAA;MAAOC,UAAUxB,eAAiB;MAAAU,WAAA;MACjCY,QAAC,EAAAV,eAAAA,UAAAA,CAAAA,GAAA,CAAAa,iBAAAA,CAAAA,iBAAA,EAAA;QAAkBrB,OAAO,EAAI;QAAAsB,MAAA,EAAQ,EAAI;QAAA7B,GAAA,EAAKF;OAAM;IACvD,CAAA;EAAA,CACF,CAAA;AAEJ,CAAA;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useWindowSize } from 'react-use';
|
|
4
|
+
import '../../../../../constants/modelCompareData/assets/arrow-right.svg.mjs';
|
|
5
|
+
import '../../../../StyleableSvgImage/index.mjs';
|
|
6
|
+
import { MOBILE_BREAKPOINT } from '../../../CompareTable/CompareTable.styles.mjs';
|
|
7
|
+
import { Button, Icon } from './ScrollButton.styles.mjs';
|
|
8
|
+
import arrowRightIcon__default from "../../../../../assets/arrowRight.svg";
|
|
9
|
+
import { StyleableSvgImage } from '../../../../StyleableSvgImage/StyleableSvgImage.mjs';
|
|
10
|
+
"use strict";
|
|
11
|
+
const icon = typeof arrowRightIcon__default === "string" ? arrowRightIcon__default : arrowRightIcon__default.src;
|
|
12
|
+
const ScrollButton = ({
|
|
13
|
+
color,
|
|
14
|
+
rotationDegrees,
|
|
15
|
+
isVisible,
|
|
16
|
+
isRightButton,
|
|
17
|
+
onClick
|
|
18
|
+
}) => {
|
|
19
|
+
const {
|
|
20
|
+
width: screenWidth
|
|
21
|
+
} = useWindowSize();
|
|
22
|
+
const isSmallScreen = screenWidth < MOBILE_BREAKPOINT;
|
|
23
|
+
const placeButtonsOverCards = screenWidth < 1450;
|
|
24
|
+
const arrowOffset = useMemo(() => {
|
|
25
|
+
if (isSmallScreen) {
|
|
26
|
+
return rotationDegrees < 180 ? -5 : 0;
|
|
27
|
+
}
|
|
28
|
+
return -15;
|
|
29
|
+
}, [isSmallScreen, rotationDegrees]);
|
|
30
|
+
return /* @__PURE__ */jsx(Button, {
|
|
31
|
+
$color: color,
|
|
32
|
+
$rotation: rotationDegrees,
|
|
33
|
+
$isVisible: isVisible,
|
|
34
|
+
$isRightButton: Boolean(isRightButton),
|
|
35
|
+
$placeButtonsOverCards: placeButtonsOverCards,
|
|
36
|
+
type: "button",
|
|
37
|
+
onClick,
|
|
38
|
+
children: /* @__PURE__ */jsx(Icon, {
|
|
39
|
+
rotation: rotationDegrees,
|
|
40
|
+
arrowOffset,
|
|
41
|
+
children: /* @__PURE__ */jsx(StyleableSvgImage, {
|
|
42
|
+
width: 10,
|
|
43
|
+
height: 16,
|
|
44
|
+
src: icon
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export { ScrollButton };
|
|
50
|
+
//# sourceMappingURL=ScrollButton.mjs.map
|
package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollButton.mjs","sources":["../../../../../../src/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useWindowSize } from \"react-use\";\n\nimport arrowRightIcon from \"../../../../../constants/modelCompareData/assets/arrow-right.svg\";\nimport { StyleableSvgImage } from \"../../../../StyleableSvgImage\";\nimport { MOBILE_BREAKPOINT } from \"../../../CompareTable/CompareTable.styles\";\nimport * as S from \"./ScrollButton.styles\";\n\nconst icon =\n typeof arrowRightIcon === \"string\" ? arrowRightIcon : arrowRightIcon.src;\n\nexport const ScrollButton = ({\n color,\n rotationDegrees,\n isVisible,\n isRightButton,\n onClick,\n}: {\n color: string;\n rotationDegrees: number;\n isVisible: boolean;\n isRightButton?: boolean;\n onClick: () => void;\n}) => {\n const { width: screenWidth } = useWindowSize();\n const isSmallScreen = screenWidth < MOBILE_BREAKPOINT;\n const placeButtonsOverCards = screenWidth < 1450;\n\n const arrowOffset = useMemo(() => {\n if (isSmallScreen) {\n return rotationDegrees < 180 ? -5 : 0;\n }\n\n return -15;\n }, [isSmallScreen, rotationDegrees]);\n\n return (\n <S.Button\n $color={color}\n $rotation={rotationDegrees}\n $isVisible={isVisible}\n $isRightButton={Boolean(isRightButton)}\n $placeButtonsOverCards={placeButtonsOverCards}\n type=\"button\"\n onClick={onClick}\n >\n <S.Icon rotation={rotationDegrees} arrowOffset={arrowOffset}>\n <StyleableSvgImage width={10} height={16} src={icon} />\n </S.Icon>\n </S.Button>\n );\n};\n"],"names":["icon","arrowRightIcon","src","ScrollButton","color","rotationDegrees","isVisible","isRightButton","onClick","width","screenWidth","useWindowSize","isSmallScreen","MOBILE_BREAKPOINT","placeButtonsOverCards","arrowOffset","useMemo","jsx","S.Button","$color","$rotation","$isVisible","$isRightButton","Boolean","$placeButtonsOverCards","type","children","S.Icon","rotation","StyleableSvgImage","height"],"mappings":";;;;;;;;;;AAQA,MAAMA,IACJ,GAAA,OAAOC,uBAAmB,KAAA,QAAA,GAAWA,0BAAiBA,uBAAe,CAAAC,GAAA;AAEhE,MAAMC,eAAeA,CAAC;EAC3BC,KAAA;EACAC,eAAA;EACAC,SAAA;EACAC,aAAA;EACAC;AACF,CAMM,KAAA;EACJ,MAAM;IAAEC,KAAA,EAAOC;EAAY,CAAA,GAAIC,aAAc,CAAA,CAAA;EAC7C,MAAMC,gBAAgBF,WAAc,GAAAG,iBAAA;EACpC,MAAMC,wBAAwBJ,WAAc,GAAA,IAAA;EAEtC,MAAAK,WAAA,GAAcC,QAAQ,MAAM;IAChC,IAAIJ,aAAe,EAAA;MACV,OAAAP,eAAA,GAAkB,MAAM,CAAK,CAAA,GAAA,CAAA;IAAA;IAG/B,OAAA,CAAA,EAAA;EAAA,CACN,EAAA,CAACO,aAAe,EAAAP,eAAe,CAAC,CAAA;EAGjC,sBAAAY,GAAA,CAACC,MAAE,EAAF;IACCC,MAAQ,EAAAf,KAAA;IACRgB,SAAW,EAAAf,eAAA;IACXgB,UAAY,EAAAf,SAAA;IACZgB,cAAA,EAAgBC,QAAQhB,aAAa,CAAA;IACrCiB,sBAAwB,EAAAV,qBAAA;IACxBW,IAAK,EAAA,QAAA;IACLjB,OAAA;IAEAkB,QAAC,EAAA,eAAAT,GAAA,CAAAU,IAAA,EAAA;MAAOC,UAAUvB,eAAiB;MAAAU,WAAA;MACjCW,QAAC,EAAA,eAAAT,GAAA,CAAAY,iBAAA,EAAA;QAAkBpB,OAAO,EAAI;QAAAqB,MAAA,EAAQ,EAAI;QAAA5B,GAAA,EAAKF;OAAM;IACvD,CAAA;EAAA,CACF,CAAA;AAEJ,CAAA;"}
|
package/lib/components/ModelCompareV4/ProductList/components/ScrollButton/ScrollButton.styles.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const Button: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
2
|
+
$isVisible: boolean;
|
|
3
|
+
$rotation: number;
|
|
4
|
+
$color: string;
|
|
5
|
+
$isRightButton: boolean;
|
|
6
|
+
$placeButtonsOverCards: boolean;
|
|
7
|
+
}>> & string;
|
|
8
|
+
export declare const Icon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
9
|
+
rotation: number;
|
|
10
|
+
arrowOffset: number;
|
|
11
|
+
}>> & string;
|