@faststore/core 0.3.16 → 2.0.65-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/storybook.css +1 -0
- package/.turbo/turbo-build.log +50 -0
- package/.turbo/turbo-lint.log +2 -0
- package/@generated/graphql/index.ts +27 -3
- package/@generated/graphql/persisted.json +1 -1
- package/CHANGELOG.md +127 -169
- package/README.md +2 -2
- package/cypress/integration/analytics.test.js +4 -4
- package/cypress/integration/cart.test.js +2 -2
- package/cypress/integration/plp.test.js +9 -9
- package/package.json +9 -10
- package/src/Layout.tsx +7 -2
- package/src/components/cart/CartItem/CartItem.tsx +30 -71
- package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +1 -1
- package/src/components/cart/CartSidebar/CartSidebar.tsx +13 -17
- package/src/components/cart/CartSidebar/cart-sidebar.module.scss +2 -0
- package/src/components/common/Alert/Alert.tsx +6 -22
- package/src/components/common/Footer/Footer.stories.mdx +1 -1
- package/src/components/common/Footer/Footer.tsx +5 -38
- package/src/components/common/Footer/FooterFlags.tsx +23 -0
- package/src/components/common/Footer/FooterLinks.tsx +16 -12
- package/src/components/common/Footer/footer.module.scss +2 -28
- package/src/components/common/Footer/index.ts +1 -0
- package/src/components/common/Navbar/NavLinks.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.tsx +1 -1
- package/src/components/common/Navbar/NavbarSlider.stories.mdx +1 -1
- package/src/components/common/Navbar/NavbarSlider.tsx +2 -2
- package/src/components/common/Toast/Toast.tsx +1 -1
- package/src/components/product/ProductCard/ProductCard.tsx +44 -59
- package/src/components/product/ProductGrid/ProductGrid.tsx +7 -1
- package/src/components/regionalization/Regionalization.stories.mdx +24 -6
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.stories.mdx +1 -1
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +1 -1
- package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +1 -1
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.stories.mdx +17 -4
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.tsx +4 -5
- package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +19 -26
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-body.module.scss +25 -0
- package/src/components/search/Filter/Facets.stories.mdx +10 -10
- package/src/components/search/Filter/Facets.tsx +69 -61
- package/src/components/search/Filter/Filter.stories.mdx +1 -1
- package/src/components/search/Filter/Filter.tsx +1 -1
- package/src/components/search/Filter/FilterSlider.stories.mdx +1 -1
- package/src/components/search/Filter/FilterSlider.tsx +2 -2
- package/src/components/search/Filter/facets.module.scss +16 -16
- package/src/components/search/Search.stories.mdx +28 -24
- package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -1
- package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -1
- package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -1
- package/src/components/sections/Newsletter/Newsletter.stories.mdx +1 -1
- package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
- package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +146 -146
- package/src/components/sections/ProductDetails/ProductDetails.tsx +4 -4
- package/src/components/sections/ProductGallery/ProductGallery.tsx +18 -18
- package/src/components/sections/ProductShelf/ProductShelf.tsx +10 -2
- package/src/components/sections/ProductTiles/ProductTiles.tsx +2 -2
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.stories.mdx +1 -1
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.tsx +20 -8
- package/src/components/skeletons/FilterSkeleton/filter-skeleton.module.scss +2 -2
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.stories.mdx +6 -69
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.tsx +36 -9
- package/src/components/skeletons/ProductCardSkeleton/product-card-skeleton.module.scss +16 -55
- package/src/components/skeletons/ProductGridSkeleton/ProductGridSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductShelfSkeleton/ProductShelfSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/ProductTileSkeleton.tsx +18 -17
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/product-tile-skeleton.module.scss +37 -174
- package/src/components/skeletons/ProductTilesSkeleton/ProductTilesSkeleton.tsx +18 -3
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +17 -16
- package/src/components/ui/Gift/Gift.tsx +18 -27
- package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
- package/src/components/ui/SlideOver/SlideOver.stories.mdx +2 -2
- package/src/components/ui/SlideOver/SlideOver.tsx +1 -0
- package/src/components/ui/Tiles/Tiles.stories.mdx +1 -3
- package/src/components/ui/Tiles/tiles.module.scss +11 -13
- package/src/components/ui/Toast/Toast.stories.mdx +1 -1
- package/src/components/ui/Toast/Toast.tsx +1 -1
- package/src/pages/_app.tsx +1 -1
- package/src/sdk/cart/index.ts +5 -0
- package/src/sdk/cart/useBuyButton.ts +1 -1
- package/src/sdk/cart/useCartToggleButton.ts +1 -1
- package/src/styles/vendors/include-media.scss +1 -1
- package/tsconfig.json +4 -6
- package/.eslintrc.json +0 -3
- package/.github/CODEOWNERS +0 -2
- package/.github/workflows/release.yml +0 -42
- package/.release-it.json +0 -32
- package/src/components/cart/CartItem/cart-item.module.scss +0 -68
- package/src/components/product/ProductCard/product-card.module.scss +0 -254
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-content.module.scss +0 -79
- package/src/components/skeletons/Shimmer/Shimmer.tsx +0 -11
- package/src/components/skeletons/Shimmer/index.ts +0 -1
- package/src/components/skeletons/Shimmer/shimmer.module.scss +0 -43
- package/src/components/skeletons/Skeleton/Skeleton.tsx +0 -49
- package/src/components/skeletons/Skeleton/index.ts +0 -1
- package/src/components/skeletons/Skeleton/skeleton.module.scss +0 -77
- package/src/components/skeletons/Skeletons.stories.mdx +0 -177
- package/src/components/ui/Accordion/Accordion.stories.mdx +0 -222
- package/src/components/ui/Accordion/Accordion.tsx +0 -39
- package/src/components/ui/Accordion/AccordionItem.stories.mdx +0 -116
- package/src/components/ui/Accordion/AccordionItem.tsx +0 -82
- package/src/components/ui/Accordion/accordion.module.scss +0 -65
- package/src/components/ui/Accordion/index.ts +0 -2
- package/src/components/ui/Alert/Alert.stories.mdx +0 -164
- package/src/components/ui/Alert/Alert.tsx +0 -81
- package/src/components/ui/Alert/alert.module.scss +0 -93
- package/src/components/ui/Alert/index.ts +0 -1
- package/src/components/ui/Dropdown/Dropdown.stories.mdx +0 -232
- package/src/components/ui/Dropdown/Dropdown.tsx +0 -12
- package/src/components/ui/Dropdown/DropdownButton.tsx +0 -20
- package/src/components/ui/Dropdown/DropdownItem.stories.mdx +0 -139
- package/src/components/ui/Dropdown/DropdownItem.tsx +0 -26
- package/src/components/ui/Dropdown/DropdownMenu.stories.mdx +0 -115
- package/src/components/ui/Dropdown/DropdownMenu.tsx +0 -34
- package/src/components/ui/Dropdown/dropdown.module.scss +0 -101
- package/src/components/ui/Dropdown/index.ts +0 -4
- package/src/components/ui/Gift/Gift.stories.mdx +0 -99
- package/src/components/ui/Gift/gift.module.scss +0 -94
- package/src/components/ui/Modal/Modal.stories.mdx +0 -144
- package/src/components/ui/Modal/Modal.tsx +0 -43
- package/src/components/ui/Modal/index.ts +0 -1
- package/src/components/ui/Modal/modal.module.scss +0 -46
- package/src/components/ui/PriceRange/PriceRange.stories.mdx +0 -192
- package/src/components/ui/PriceRange/PriceRange.tsx +0 -140
- package/src/components/ui/PriceRange/index.ts +0 -1
- package/src/components/ui/PriceRange/price-range.module.scss +0 -176
- package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +0 -105
- package/src/components/ui/ProductTitle/ProductTitle.tsx +0 -11
- package/src/components/ui/ProductTitle/index.ts +0 -1
- package/src/components/ui/ProductTitle/product-title.module.scss +0 -48
- package/src/components/ui/QuantitySelector/QuantitySelector.stories.mdx +0 -246
- package/src/components/ui/QuantitySelector/QuantitySelector.tsx +0 -103
- package/src/components/ui/QuantitySelector/index.ts +0 -1
- package/src/components/ui/QuantitySelector/quantity-selector.module.scss +0 -155
- package/src/sdk/ui/Provider.tsx +0 -151
- package/src/sdk/ui/useFadeEffect.ts +0 -21
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import PriceRange from '.'
|
|
4
|
-
import {
|
|
5
|
-
TokenTable,
|
|
6
|
-
TokenRow,
|
|
7
|
-
TokenDivider,
|
|
8
|
-
BestPractices,
|
|
9
|
-
BestPracticesRule,
|
|
10
|
-
} from 'src/../.storybook/components'
|
|
11
|
-
|
|
12
|
-
<Meta
|
|
13
|
-
title="Molecules/PriceRange"
|
|
14
|
-
argTypes={{
|
|
15
|
-
min: { control: { disable: true } },
|
|
16
|
-
max: { control: { disable: true } },
|
|
17
|
-
testId: {
|
|
18
|
-
table: {
|
|
19
|
-
disable: true,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
className: {
|
|
23
|
-
table: {
|
|
24
|
-
disable: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
onChange: {
|
|
28
|
-
table: {
|
|
29
|
-
disable: true,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
variant: {
|
|
33
|
-
table: {
|
|
34
|
-
disable: true,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
step: {
|
|
38
|
-
control: 'number',
|
|
39
|
-
table: { type: 'number', summary: 10 },
|
|
40
|
-
},
|
|
41
|
-
}}
|
|
42
|
-
component={PriceRange}
|
|
43
|
-
/>
|
|
44
|
-
|
|
45
|
-
export const defaultArgs = {
|
|
46
|
-
min: {
|
|
47
|
-
absolute: 0,
|
|
48
|
-
selected: 0,
|
|
49
|
-
},
|
|
50
|
-
max: {
|
|
51
|
-
absolute: 12400,
|
|
52
|
-
selected: 12400,
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const Template = (args) => {
|
|
57
|
-
return (
|
|
58
|
-
<PriceRange {...defaultArgs} {...args} />
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
<header>
|
|
63
|
-
|
|
64
|
-
# Price Range
|
|
65
|
-
|
|
66
|
-
PriceRange allows you to implement filters on PLP so users have a high control over product prices.
|
|
67
|
-
|
|
68
|
-
</header>
|
|
69
|
-
|
|
70
|
-
## Overview
|
|
71
|
-
|
|
72
|
-
The `PriceRange` component uses [FastStore UI Price Range](https://www.faststore.dev/reference/ui/molecules/PriceRange) as base.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Usage
|
|
77
|
-
|
|
78
|
-
`import PriceRange from '../components/ui/PriceRange'`
|
|
79
|
-
|
|
80
|
-
<Canvas isColumn>
|
|
81
|
-
<Story name="overview-default" args={defaultArgs}>
|
|
82
|
-
{Template.bind({})}
|
|
83
|
-
</Story>
|
|
84
|
-
</Canvas>
|
|
85
|
-
|
|
86
|
-
<ArgsTable story="overview-default" />
|
|
87
|
-
|
|
88
|
-
<TokenTable>
|
|
89
|
-
<TokenRow token="--fs-price-range-height" value="var(--fs-spacing-2)" />
|
|
90
|
-
<TokenRow
|
|
91
|
-
token="--fs-price-range-border-radius"
|
|
92
|
-
value="var(--fs-border-radius-pill)"
|
|
93
|
-
/>
|
|
94
|
-
<TokenRow
|
|
95
|
-
token="--fs-price-range-margin-bottom"
|
|
96
|
-
value="var(--fs-spacing-3)"
|
|
97
|
-
/>
|
|
98
|
-
<TokenDivider />
|
|
99
|
-
<TokenRow
|
|
100
|
-
token="--fs-price-range-transition-function"
|
|
101
|
-
value="var(--fs-transition-function)"
|
|
102
|
-
/>
|
|
103
|
-
<TokenRow
|
|
104
|
-
token="--fs-price-range-transition-property"
|
|
105
|
-
value="varvar(--fs-transition-property)"
|
|
106
|
-
/>
|
|
107
|
-
<TokenRow
|
|
108
|
-
token="--fs-price-range-transition-timing"
|
|
109
|
-
value="var(--fs-transition-timing)"
|
|
110
|
-
/>
|
|
111
|
-
</TokenTable>
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## Nested Elements
|
|
116
|
-
|
|
117
|
-
### Slider
|
|
118
|
-
|
|
119
|
-
<TokenTable>
|
|
120
|
-
<TokenRow
|
|
121
|
-
token="--fs-price-range-slider-bkg-color"
|
|
122
|
-
value="var(--fs-color-neutral-bkg)"
|
|
123
|
-
isColor
|
|
124
|
-
/>
|
|
125
|
-
<TokenRow
|
|
126
|
-
token="--fs-price-range-slider-selection-bkg-color"
|
|
127
|
-
value="var(--fs-color-primary-bkg-light-active)"
|
|
128
|
-
isColor
|
|
129
|
-
/>
|
|
130
|
-
</TokenTable>
|
|
131
|
-
|
|
132
|
-
### Value Label
|
|
133
|
-
|
|
134
|
-
<TokenTable>
|
|
135
|
-
<TokenRow
|
|
136
|
-
token="--fs-price-range-value-label-bottom"
|
|
137
|
-
value="var(--fs-spacing-3)"
|
|
138
|
-
/>
|
|
139
|
-
<TokenRow
|
|
140
|
-
token="--fs-price-range-value-label-bkg-color"
|
|
141
|
-
value="var(--fs-color-body-bkg)"
|
|
142
|
-
isColor
|
|
143
|
-
/>
|
|
144
|
-
</TokenTable>
|
|
145
|
-
|
|
146
|
-
### Absolute Values
|
|
147
|
-
|
|
148
|
-
<TokenTable>
|
|
149
|
-
<TokenRow
|
|
150
|
-
token="--fs-price-range-absolute-values-text-color"
|
|
151
|
-
value="var(--fs-color-disabled-text)"
|
|
152
|
-
isColor
|
|
153
|
-
/>
|
|
154
|
-
</TokenTable>
|
|
155
|
-
|
|
156
|
-
### Thumb
|
|
157
|
-
|
|
158
|
-
<TokenTable>
|
|
159
|
-
<TokenRow token="--fs-price-range-thumb-size" value="var(--fs-spacing-4)" />
|
|
160
|
-
<TokenDivider />
|
|
161
|
-
<TokenRow
|
|
162
|
-
token="--fs-price-range-thumb-bkg-color"
|
|
163
|
-
value="var(--fs-color-primary-bkg)"
|
|
164
|
-
isColor
|
|
165
|
-
/>
|
|
166
|
-
<TokenRow
|
|
167
|
-
token="--fs-price-range-thumb-bkg-color-hover"
|
|
168
|
-
value="var(--fs-color-primary-bkg-hover)"
|
|
169
|
-
isColor
|
|
170
|
-
/>
|
|
171
|
-
<TokenDivider />
|
|
172
|
-
<TokenRow
|
|
173
|
-
token="--fs-price-range-thumb-border-radius"
|
|
174
|
-
value="var(--fs-border-radius-circle)"
|
|
175
|
-
/>
|
|
176
|
-
<TokenRow
|
|
177
|
-
token="--fs-price-range-thumb-border-color"
|
|
178
|
-
value="var(--fs-price-range-thumb-bkg-color)"
|
|
179
|
-
globalValue="var(--fs-color-primary-bkg)"
|
|
180
|
-
isColor
|
|
181
|
-
/>
|
|
182
|
-
<TokenRow
|
|
183
|
-
token="--fs-price-range-thumb-border-color-hover"
|
|
184
|
-
value="var(--fs-price-range-thumb-bkg-color-hover)"
|
|
185
|
-
globalValue="var(--fs-color-primary-bkg-hover)"
|
|
186
|
-
isColor
|
|
187
|
-
/>
|
|
188
|
-
<TokenRow
|
|
189
|
-
token="--fs-price-range-thumb-border-width"
|
|
190
|
-
value="var(--fs-border-width)"
|
|
191
|
-
/>
|
|
192
|
-
</TokenTable>
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { useState, useRef } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
PriceRange as UIPriceRange,
|
|
4
|
-
InputField as UIInputField,
|
|
5
|
-
} from '@faststore/ui'
|
|
6
|
-
import type { PriceRangeProps } from '@faststore/ui'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
usePriceFormatter,
|
|
10
|
-
useFormattedPrice,
|
|
11
|
-
} from 'src/sdk/product/useFormattedPrice'
|
|
12
|
-
|
|
13
|
-
import styles from './price-range.module.scss'
|
|
14
|
-
|
|
15
|
-
type Props = Omit<
|
|
16
|
-
PriceRangeProps,
|
|
17
|
-
'formatter' | 'minValueLabelComponent' | 'maxValueLabelComponent'
|
|
18
|
-
>
|
|
19
|
-
|
|
20
|
-
function PriceRange({ min, max, onEnd, step = 10, ...otherProps }: Props) {
|
|
21
|
-
const formatter = usePriceFormatter({ decimals: false })
|
|
22
|
-
const minAbsoluteFormatted = useFormattedPrice(Math.round(min.absolute))
|
|
23
|
-
const maxAbsoluteFormatted = useFormattedPrice(Math.ceil(max.absolute))
|
|
24
|
-
|
|
25
|
-
const inputMinRef = useRef<HTMLInputElement>(null)
|
|
26
|
-
const inputMaxRef = useRef<HTMLInputElement>(null)
|
|
27
|
-
const priceRangeRef = useRef<{
|
|
28
|
-
setPriceRangeValues: (values: { min: number; max: number }) => void
|
|
29
|
-
}>()
|
|
30
|
-
|
|
31
|
-
const [inputMinError, setInputMinError] = useState<string>()
|
|
32
|
-
const [inputMaxError, setInputMaxError] = useState<string>()
|
|
33
|
-
const [priceRange, setPriceRange] = useState<{ min: number; max: number }>({
|
|
34
|
-
min: Math.round(min.selected),
|
|
35
|
-
max: Math.ceil(max.selected),
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
function onChangePriceRange(value: { min: number; max: number }) {
|
|
39
|
-
setInputMinError(undefined)
|
|
40
|
-
setInputMaxError(undefined)
|
|
41
|
-
setPriceRange({ min: value.min, max: value.max })
|
|
42
|
-
|
|
43
|
-
if (inputMinRef.current?.value) {
|
|
44
|
-
inputMinRef.current.value = String(value.min)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (inputMaxRef.current?.value) {
|
|
48
|
-
inputMaxRef.current.value = String(value.max)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function onChangeInputMin(value: string) {
|
|
53
|
-
setInputMinError(undefined)
|
|
54
|
-
|
|
55
|
-
if (Number(value) < min.absolute) {
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (Number(value) > priceRange.max) {
|
|
60
|
-
setInputMinError(`Min price can't be greater than max`)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
setPriceRange({ ...priceRange, min: Number(value) })
|
|
64
|
-
priceRangeRef.current?.setPriceRangeValues({
|
|
65
|
-
...priceRange,
|
|
66
|
-
min: Number(value),
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function onChangeInputMax(value: string) {
|
|
71
|
-
setInputMaxError(undefined)
|
|
72
|
-
|
|
73
|
-
if (Number(value) > max.absolute) {
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (Number(value) < priceRange.min) {
|
|
78
|
-
setInputMaxError(`Max price can't be smaller than min`)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
setPriceRange({ ...priceRange, max: Number(value) })
|
|
82
|
-
priceRangeRef.current?.setPriceRangeValues({
|
|
83
|
-
...priceRange,
|
|
84
|
-
max: Number(value),
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<div className={styles.fsPriceRange} data-fs-price-range>
|
|
90
|
-
<div data-fs-price-range-absolute-values>
|
|
91
|
-
<span>{minAbsoluteFormatted}</span>
|
|
92
|
-
<span>{maxAbsoluteFormatted}</span>
|
|
93
|
-
</div>
|
|
94
|
-
<UIPriceRange
|
|
95
|
-
ref={priceRangeRef}
|
|
96
|
-
min={min}
|
|
97
|
-
max={max}
|
|
98
|
-
formatter={formatter}
|
|
99
|
-
className={styles.fsPriceRange}
|
|
100
|
-
onEnd={(value) => {
|
|
101
|
-
onEnd?.(value)
|
|
102
|
-
onChangePriceRange(value)
|
|
103
|
-
}}
|
|
104
|
-
{...otherProps}
|
|
105
|
-
/>
|
|
106
|
-
<div data-fs-price-range-inputs>
|
|
107
|
-
<UIInputField
|
|
108
|
-
id="price-range-min"
|
|
109
|
-
step={step}
|
|
110
|
-
label="Min"
|
|
111
|
-
type="number"
|
|
112
|
-
inputMode="numeric"
|
|
113
|
-
error={inputMinError}
|
|
114
|
-
inputRef={inputMinRef}
|
|
115
|
-
min={Math.round(min.absolute)}
|
|
116
|
-
max={Math.ceil(priceRange.max)}
|
|
117
|
-
value={Math.round(priceRange.min)}
|
|
118
|
-
onChange={(e) => onChangeInputMin(e.target.value)}
|
|
119
|
-
onBlur={() => !inputMinError && onEnd?.(priceRange)}
|
|
120
|
-
/>
|
|
121
|
-
<UIInputField
|
|
122
|
-
id="price-range-max"
|
|
123
|
-
label="Max"
|
|
124
|
-
step={step}
|
|
125
|
-
type="number"
|
|
126
|
-
inputMode="numeric"
|
|
127
|
-
error={inputMaxError}
|
|
128
|
-
inputRef={inputMaxRef}
|
|
129
|
-
max={Math.ceil(max.absolute)}
|
|
130
|
-
min={Math.round(priceRange.min)}
|
|
131
|
-
value={Math.ceil(priceRange.max)}
|
|
132
|
-
onChange={(e) => onChangeInputMax(e.target.value)}
|
|
133
|
-
onBlur={() => !inputMaxError && onEnd?.(priceRange)}
|
|
134
|
-
/>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export default PriceRange
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './PriceRange'
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
.fs-price-range {
|
|
2
|
-
// --------------------------------------------------------
|
|
3
|
-
// Design Tokens for Price Range
|
|
4
|
-
// --------------------------------------------------------
|
|
5
|
-
|
|
6
|
-
// Default properties
|
|
7
|
-
--fs-price-range-height : var(--fs-spacing-2);
|
|
8
|
-
--fs-price-range-border-radius : var(--fs-border-radius-pill);
|
|
9
|
-
--fs-price-range-margin-bottom : var(--fs-spacing-3);
|
|
10
|
-
|
|
11
|
-
--fs-price-range-transition-function : var(--fs-transition-function);
|
|
12
|
-
--fs-price-range-transition-property : var(--fs-transition-property);
|
|
13
|
-
--fs-price-range-transition-timing : var(--fs-transition-timing);
|
|
14
|
-
|
|
15
|
-
// Slider
|
|
16
|
-
--fs-price-range-slider-bkg-color : var(--fs-color-neutral-bkg);
|
|
17
|
-
--fs-price-range-slider-selection-bkg-color : var(--fs-color-primary-bkg-light-active);
|
|
18
|
-
|
|
19
|
-
// Value Label
|
|
20
|
-
--fs-price-range-value-label-bottom : var(--fs-spacing-3);
|
|
21
|
-
--fs-price-range-value-label-bkg-color : var(--fs-color-body-bkg);
|
|
22
|
-
|
|
23
|
-
// Absolute Values
|
|
24
|
-
--fs-price-range-absolute-values-text-color : var(--fs-color-disabled-text);
|
|
25
|
-
|
|
26
|
-
// Thumb
|
|
27
|
-
--fs-price-range-thumb-size : var(--fs-spacing-4);
|
|
28
|
-
--fs-price-range-thumb-bkg-color : var(--fs-color-primary-bkg);
|
|
29
|
-
--fs-price-range-thumb-bkg-color-hover : var(--fs-color-primary-bkg-hover);
|
|
30
|
-
--fs-price-range-thumb-border-radius : var(--fs-border-radius-circle);
|
|
31
|
-
--fs-price-range-thumb-border-color : var(--fs-price-range-thumb-bkg-color);
|
|
32
|
-
--fs-price-range-thumb-border-color-hover : var(--fs-price-range-thumb-bkg-color-hover);
|
|
33
|
-
--fs-price-range-thumb-border-width : var(--fs-border-width);
|
|
34
|
-
|
|
35
|
-
// --------------------------------------------------------
|
|
36
|
-
// Structural Styles
|
|
37
|
-
// --------------------------------------------------------
|
|
38
|
-
|
|
39
|
-
[data-fs-slider] {
|
|
40
|
-
position: relative;
|
|
41
|
-
width: 100%;
|
|
42
|
-
height: var(--fs-price-range-height);
|
|
43
|
-
margin-bottom: var(--fs-price-range-margin-bottom);
|
|
44
|
-
background-color: var(--fs-price-range-slider-bkg-color);
|
|
45
|
-
border-radius: var(--fs-price-range-border-radius);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
[data-slider-range] {
|
|
49
|
-
position: absolute;
|
|
50
|
-
height: var(--fs-price-range-height);
|
|
51
|
-
background-color: var(--fs-price-range-slider-selection-bkg-color);
|
|
52
|
-
border-radius: var(--fs-price-range-border-radius);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
[data-price-range-value-label="min"],
|
|
56
|
-
[data-price-range-value-label="max"] {
|
|
57
|
-
bottom: var(--fs-price-range-value-label-bottom);
|
|
58
|
-
padding: var(--fs-spacing-1);
|
|
59
|
-
background-color: var(--fs-price-range-value-label-bkg-color);
|
|
60
|
-
opacity: 0;
|
|
61
|
-
transition: opacity var(--fs-price-range-transition-timing) var(--fs-price-range-transition-function);
|
|
62
|
-
|
|
63
|
-
&:hover {
|
|
64
|
-
opacity: 1;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
[data-price-range-value-label="min"] {
|
|
69
|
-
text-align: left;
|
|
70
|
-
transform: translateX(-1rem);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
[data-price-range-value-label="max"] {
|
|
74
|
-
text-align: right;
|
|
75
|
-
transform: translateX(calc(-100% + 1.25rem));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Thumb styles for Webkit based browsers (Chrome, Edge)
|
|
79
|
-
[data-slider-thumb],
|
|
80
|
-
[data-slider-thumb]::-webkit-slider-thumb {
|
|
81
|
-
width: var(--fs-price-range-thumb-size);
|
|
82
|
-
height: var(--fs-price-range-thumb-size);
|
|
83
|
-
pointer-events: auto;
|
|
84
|
-
cursor: col-resize;
|
|
85
|
-
background-color: var(--fs-price-range-thumb-bkg-color);
|
|
86
|
-
border: var(--fs-price-range-thumb-border-width) solid var(--fs-price-range-thumb-border-color);
|
|
87
|
-
border-radius: var(--fs-price-range-thumb-border-radius);
|
|
88
|
-
-webkit-tap-highlight-color: transparent;
|
|
89
|
-
appearance: none;
|
|
90
|
-
transition: var(--fs-price-range-transition-property) var(--fs-price-range-transition-timing) var(--fs-price-range-transition-function);
|
|
91
|
-
|
|
92
|
-
&:hover {
|
|
93
|
-
background-color: var(--fs-price-range-thumb-bkg-color-hover);
|
|
94
|
-
border-color: var(--fs-price-range-thumb-border-color-hover);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Thumb styles for Mozilla
|
|
99
|
-
[data-slider-thumb]::-moz-range-thumb {
|
|
100
|
-
width: var(--fs-price-range-thumb-size);
|
|
101
|
-
height: var(--fs-price-range-thumb-size);
|
|
102
|
-
pointer-events: auto;
|
|
103
|
-
cursor: col-resize;
|
|
104
|
-
background-color: var(--fs-price-range-thumb-bkg-color);
|
|
105
|
-
border: var(--fs-price-range-thumb-border-width) solid var(--fs-price-range-thumb-border-color);
|
|
106
|
-
border-radius: var(--fs-price-range-thumb-radius);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
[data-slider-thumb] {
|
|
110
|
-
position: absolute;
|
|
111
|
-
width: inherit;
|
|
112
|
-
height: 0;
|
|
113
|
-
margin: calc(var(--fs-price-range-height) / 2) 0;
|
|
114
|
-
pointer-events: none;
|
|
115
|
-
border: none;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
[data-slider-thumb="left"] {
|
|
119
|
-
z-index: 1;
|
|
120
|
-
|
|
121
|
-
&:hover + [data-price-range-value-label="min"] {
|
|
122
|
-
opacity: 1;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
[data-slider-thumb="right"] {
|
|
127
|
-
z-index: 2;
|
|
128
|
-
|
|
129
|
-
&:hover + [data-price-range-value-label="max"] {
|
|
130
|
-
opacity: 1;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
[data-price-range-values] {
|
|
135
|
-
display: flex;
|
|
136
|
-
justify-content: space-between;
|
|
137
|
-
margin-top: var(--fs-spacing-3);
|
|
138
|
-
margin-bottom: var(--fs-spacing-3);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
[data-fs-price-range-inputs] {
|
|
142
|
-
display: flex;
|
|
143
|
-
|
|
144
|
-
[data-fs-input-field] {
|
|
145
|
-
width: 50%;
|
|
146
|
-
|
|
147
|
-
input:hover,
|
|
148
|
-
input:focus-visible,
|
|
149
|
-
input:focus {
|
|
150
|
-
z-index: 1;
|
|
151
|
-
+ label { z-index: 1; }
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
&:first-of-type {
|
|
155
|
-
margin-right: -1px;
|
|
156
|
-
|
|
157
|
-
input {
|
|
158
|
-
border-top-right-radius: 0;
|
|
159
|
-
border-bottom-right-radius: 0;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
&:last-of-type input {
|
|
164
|
-
border-top-left-radius: 0;
|
|
165
|
-
border-bottom-left-radius: 0;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
[data-fs-price-range-absolute-values] {
|
|
171
|
-
display: flex;
|
|
172
|
-
justify-content: space-between;
|
|
173
|
-
margin-bottom: var(--fs-spacing-2);
|
|
174
|
-
color: var(--fs-price-range-absolute-values-text-color);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import { DiscountBadge } from '@faststore/ui'
|
|
4
|
-
import ProductTitle from '.'
|
|
5
|
-
import { TokenTable, TokenRow } from 'src/../.storybook/components'
|
|
6
|
-
|
|
7
|
-
<Meta
|
|
8
|
-
title="Molecules/ProductTitle"
|
|
9
|
-
component={ProductTitle}
|
|
10
|
-
argTypes={{
|
|
11
|
-
title: {
|
|
12
|
-
control: { type: 'radio' },
|
|
13
|
-
options: [
|
|
14
|
-
'<h1>Apple Magic Mouse</h1>',
|
|
15
|
-
'<h2>Apple Magic Mouse</h2>',
|
|
16
|
-
'<h3>Apple Magic Mouse</h3>',
|
|
17
|
-
],
|
|
18
|
-
mapping: {
|
|
19
|
-
'<h1>Apple Magic Mouse</h1>': <h1>Apple Magic Mouse</h1>,
|
|
20
|
-
'<h2>Apple Magic Mouse</h2>': <h2>Apple Magic Mouse</h2>,
|
|
21
|
-
'<h3>Apple Magic Mouse</h3>': <h3>Apple Magic Mouse</h3>,
|
|
22
|
-
},
|
|
23
|
-
defaultValue: '<h1>Apple Magic Mouse</h1>',
|
|
24
|
-
},
|
|
25
|
-
label: {
|
|
26
|
-
control: { type: 'radio' },
|
|
27
|
-
options: [
|
|
28
|
-
'<DiscountBadge listPrice={100} spotPrice={90} size="big" />',
|
|
29
|
-
'<DiscountBadge listPrice={100} spotPrice={70} size="big" />',
|
|
30
|
-
'<DiscountBadge listPrice={100} spotPrice={10} size="big" />',
|
|
31
|
-
],
|
|
32
|
-
mapping: {
|
|
33
|
-
'<DiscountBadge listPrice={100} spotPrice={90} size="big" />': (
|
|
34
|
-
<DiscountBadge listPrice={100} spotPrice={90} size="big" />
|
|
35
|
-
),
|
|
36
|
-
'<DiscountBadge listPrice={100} spotPrice={70} size="big" />': (
|
|
37
|
-
<DiscountBadge listPrice={100} spotPrice={70} size="big" />
|
|
38
|
-
),
|
|
39
|
-
'<DiscountBadge listPrice={100} spotPrice={10} size="big" />': (
|
|
40
|
-
<DiscountBadge listPrice={100} spotPrice={10} size="big" />
|
|
41
|
-
),
|
|
42
|
-
},
|
|
43
|
-
defaultValue:
|
|
44
|
-
'<DiscountBadge listPrice={100} spotPrice={90} size="big" />',
|
|
45
|
-
},
|
|
46
|
-
refNumber: {
|
|
47
|
-
defaultValue: '99995945',
|
|
48
|
-
},
|
|
49
|
-
}}
|
|
50
|
-
/>
|
|
51
|
-
|
|
52
|
-
export const Template = (args) => <ProductTitle {...args} />
|
|
53
|
-
|
|
54
|
-
<header>
|
|
55
|
-
|
|
56
|
-
# Product Title
|
|
57
|
-
|
|
58
|
-
The product title that is commonly used on Product Details Page (PDP).
|
|
59
|
-
|
|
60
|
-
</header>
|
|
61
|
-
|
|
62
|
-
## Usage
|
|
63
|
-
|
|
64
|
-
`import ProductTitle from '../components/ui/ProductTitle'`
|
|
65
|
-
|
|
66
|
-
<Canvas>
|
|
67
|
-
<Story name="Default">{Template.bind({})}</Story>
|
|
68
|
-
</Canvas>
|
|
69
|
-
|
|
70
|
-
<ArgsTable story="Default" />
|
|
71
|
-
|
|
72
|
-
<TokenTable>
|
|
73
|
-
<TokenRow
|
|
74
|
-
token="--fs-product-title-text-size"
|
|
75
|
-
value="var(--fs-text-size-title-product)"
|
|
76
|
-
/>
|
|
77
|
-
<TokenRow
|
|
78
|
-
token="--fs-product-title-text-weight"
|
|
79
|
-
value="var(--fs-text-weight-regular)"
|
|
80
|
-
/>
|
|
81
|
-
<TokenRow token="--fs-product-title-line-height" value="1.12" />
|
|
82
|
-
</TokenTable>
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Nested Elements
|
|
87
|
-
|
|
88
|
-
### Addendum
|
|
89
|
-
|
|
90
|
-
<TokenTable>
|
|
91
|
-
<TokenRow
|
|
92
|
-
token="--fs-product-title-addendum-margin-top"
|
|
93
|
-
value="var(--fs-spacing-3)"
|
|
94
|
-
/>
|
|
95
|
-
<TokenRow
|
|
96
|
-
token="--fs-product-title-addendum-color"
|
|
97
|
-
value="var(--fs-color-text-light)"
|
|
98
|
-
isColor
|
|
99
|
-
/>
|
|
100
|
-
<TokenRow
|
|
101
|
-
token="--fs-product-title-addendum-size"
|
|
102
|
-
value="var(--fs-text-size-1)"
|
|
103
|
-
/>
|
|
104
|
-
<TokenRow token="--fs-product-title-addendum-line-height" value="1.7" />
|
|
105
|
-
</TokenTable>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { memo } from 'react'
|
|
2
|
-
import type { ProductTitleProps } from '@faststore/ui'
|
|
3
|
-
import { ProductTitle as UIProductTitle } from '@faststore/ui'
|
|
4
|
-
|
|
5
|
-
import styles from './product-title.module.scss'
|
|
6
|
-
|
|
7
|
-
function ProductTitle({ ...otherProps }: ProductTitleProps) {
|
|
8
|
-
return <UIProductTitle className={styles.fsProductTitle} {...otherProps} />
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default memo(ProductTitle)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './ProductTitle'
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
@import "src/styles/scaffold";
|
|
2
|
-
|
|
3
|
-
.fs-product-title {
|
|
4
|
-
// --------------------------------------------------------
|
|
5
|
-
// Design Tokens for ProductTitle
|
|
6
|
-
// --------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
// Default properties
|
|
9
|
-
--fs-product-title-text-size : var(--fs-text-size-title-product);
|
|
10
|
-
--fs-product-title-text-weight : var(--fs-text-weight-regular);
|
|
11
|
-
--fs-product-title-line-height : 1.12;
|
|
12
|
-
|
|
13
|
-
--fs-product-title-addendum-margin-top : var(--fs-spacing-3);
|
|
14
|
-
--fs-product-title-addendum-color : var(--fs-color-text-light);
|
|
15
|
-
--fs-product-title-addendum-size : var(--fs-text-size-1);
|
|
16
|
-
--fs-product-title-addendum-line-height : 1.7;
|
|
17
|
-
|
|
18
|
-
// --------------------------------------------------------
|
|
19
|
-
// Structural Styles
|
|
20
|
-
// --------------------------------------------------------
|
|
21
|
-
|
|
22
|
-
[data-fs-product-title-header] {
|
|
23
|
-
display: flex;
|
|
24
|
-
column-gap: var(--fs-spacing-2);
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
|
|
27
|
-
// Title prop
|
|
28
|
-
&:first-child {
|
|
29
|
-
font-size: var(--fs-product-title-text-size);
|
|
30
|
-
font-weight: var(--fs-product-title-text-weight);
|
|
31
|
-
line-height: var(--fs-product-title-line-height);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[data-fs-badge] { white-space: nowrap; }
|
|
35
|
-
|
|
36
|
-
@include media(">=tablet", "<notebook") {
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
row-gap: var(--fs-spacing-3);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[data-fs-product-title-addendum] {
|
|
43
|
-
margin-top: var(--fs-product-title-addendum-margin-top);
|
|
44
|
-
font-size: var(--fs-product-title-addendum-size);
|
|
45
|
-
line-height: var(--fs-product-title-addendum-line-height);
|
|
46
|
-
color: var(--fs-product-title-addendum-color);
|
|
47
|
-
}
|
|
48
|
-
}
|