@faststore/ui 2.0.53-alpha.0 → 2.0.56-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/dist/index.d.ts +0 -6
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/Slider/styles.scss +137 -0
- package/src/components/molecules/Modal/styles.scss +97 -0
- package/src/components/organisms/PriceRange/styles.scss +36 -0
- package/src/index.ts +0 -9
- package/src/styles/components.scss +3 -0
- package/dist/components/atoms/Slider/Slider.d.ts +0 -67
- package/dist/components/atoms/Slider/Slider.js +0 -48
- package/dist/components/atoms/Slider/Slider.js.map +0 -1
- package/dist/components/atoms/Slider/index.d.ts +0 -2
- package/dist/components/atoms/Slider/index.js +0 -2
- package/dist/components/atoms/Slider/index.js.map +0 -1
- package/dist/components/molecules/Modal/Modal.d.ts +0 -25
- package/dist/components/molecules/Modal/Modal.js +0 -31
- package/dist/components/molecules/Modal/Modal.js.map +0 -1
- package/dist/components/molecules/Modal/ModalContent.d.ts +0 -10
- package/dist/components/molecules/Modal/ModalContent.js +0 -23
- package/dist/components/molecules/Modal/ModalContent.js.map +0 -1
- package/dist/components/molecules/Modal/index.d.ts +0 -2
- package/dist/components/molecules/Modal/index.js +0 -2
- package/dist/components/molecules/Modal/index.js.map +0 -1
- package/dist/components/molecules/Modal/useTrapFocus.d.ts +0 -8
- package/dist/components/molecules/Modal/useTrapFocus.js +0 -76
- package/dist/components/molecules/Modal/useTrapFocus.js.map +0 -1
- package/dist/components/molecules/PriceRange/PriceRange.d.ts +0 -47
- package/dist/components/molecules/PriceRange/PriceRange.js +0 -28
- package/dist/components/molecules/PriceRange/PriceRange.js.map +0 -1
- package/dist/components/molecules/PriceRange/index.d.ts +0 -2
- package/dist/components/molecules/PriceRange/index.js +0 -2
- package/dist/components/molecules/PriceRange/index.js.map +0 -1
- package/src/components/atoms/Slider/Slider.tsx +0 -182
- package/src/components/atoms/Slider/index.ts +0 -2
- package/src/components/molecules/Modal/Modal.tsx +0 -82
- package/src/components/molecules/Modal/ModalContent.tsx +0 -90
- package/src/components/molecules/Modal/index.tsx +0 -2
- package/src/components/molecules/Modal/useTrapFocus.ts +0 -110
- package/src/components/molecules/PriceRange/PriceRange.tsx +0 -108
- package/src/components/molecules/PriceRange/index.ts +0 -2
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useImperativeHandle, forwardRef } from 'react'
|
|
2
|
-
import type { AriaAttributes } from 'react'
|
|
3
|
-
|
|
4
|
-
import { Price } from '@faststore/components'
|
|
5
|
-
import type { PriceProps } from '@faststore/components'
|
|
6
|
-
|
|
7
|
-
import Slider from '../../atoms/Slider'
|
|
8
|
-
import type { SliderProps } from '../../atoms/Slider'
|
|
9
|
-
|
|
10
|
-
export type PriceRangeProps = SliderProps & {
|
|
11
|
-
/**
|
|
12
|
-
* The current use case variant for prices.
|
|
13
|
-
*/
|
|
14
|
-
variant?: PriceProps['variant']
|
|
15
|
-
/**
|
|
16
|
-
* Formatter function that transforms the raw price value and render the result.
|
|
17
|
-
*/
|
|
18
|
-
formatter: PriceProps['formatter']
|
|
19
|
-
/**
|
|
20
|
-
* Returns the value of element's class content attribute.
|
|
21
|
-
*/
|
|
22
|
-
className?: string
|
|
23
|
-
/**
|
|
24
|
-
* Defines a string value that labels the current element.
|
|
25
|
-
*/
|
|
26
|
-
'aria-label'?: AriaAttributes['aria-label']
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type PriceRangeRefType = {
|
|
30
|
-
setPriceRangeValues: (values: { min: number; max: number }) => void
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const PriceRange = forwardRef<PriceRangeRefType | undefined, PriceRangeProps>(
|
|
34
|
-
function PriceRange(
|
|
35
|
-
{
|
|
36
|
-
className,
|
|
37
|
-
formatter,
|
|
38
|
-
max,
|
|
39
|
-
min,
|
|
40
|
-
step,
|
|
41
|
-
onChange,
|
|
42
|
-
onEnd,
|
|
43
|
-
testId = 'store-price-range',
|
|
44
|
-
variant,
|
|
45
|
-
'aria-label': ariaLabel,
|
|
46
|
-
},
|
|
47
|
-
ref
|
|
48
|
-
) {
|
|
49
|
-
const sliderRef = useRef<{
|
|
50
|
-
setSliderValues: (values: { min: number; max: number }) => void
|
|
51
|
-
}>()
|
|
52
|
-
|
|
53
|
-
useImperativeHandle(ref, () => ({
|
|
54
|
-
setPriceRangeValues: (values: { min: number; max: number }) => {
|
|
55
|
-
onChange?.(values)
|
|
56
|
-
sliderRef.current?.setSliderValues(values)
|
|
57
|
-
},
|
|
58
|
-
}))
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div data-fs-price-range data-testid={testId} className={className}>
|
|
62
|
-
<Slider
|
|
63
|
-
ref={sliderRef}
|
|
64
|
-
min={min}
|
|
65
|
-
max={max}
|
|
66
|
-
step={step}
|
|
67
|
-
onEnd={onEnd}
|
|
68
|
-
aria-label={ariaLabel}
|
|
69
|
-
onChange={(value) => onChange?.(value)}
|
|
70
|
-
minValueLabelComponent={(minValue) => {
|
|
71
|
-
const minPercent = (minValue / max.absolute) * 100
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Price
|
|
75
|
-
value={minValue}
|
|
76
|
-
variant={variant}
|
|
77
|
-
formatter={formatter}
|
|
78
|
-
data-price-range-value-label="min"
|
|
79
|
-
style={{
|
|
80
|
-
position: 'absolute',
|
|
81
|
-
left: `calc(${minPercent}% + (${8 - minPercent * 0.2}px))`,
|
|
82
|
-
}}
|
|
83
|
-
/>
|
|
84
|
-
)
|
|
85
|
-
}}
|
|
86
|
-
maxValueLabelComponent={(maxValue) => {
|
|
87
|
-
const maxPercent = (maxValue / max.absolute) * 100
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<Price
|
|
91
|
-
formatter={formatter}
|
|
92
|
-
variant={variant}
|
|
93
|
-
value={maxValue}
|
|
94
|
-
data-price-range-value-label="max"
|
|
95
|
-
style={{
|
|
96
|
-
position: 'absolute',
|
|
97
|
-
left: `calc(${maxPercent}% + (${8 - maxPercent * 0.2}px))`,
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
100
|
-
)
|
|
101
|
-
}}
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
export default PriceRange
|