@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
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ export { default as Popover } from './components/atoms/Popover';
|
|
|
3
3
|
export type { PopoverProps } from './components/atoms/Popover';
|
|
4
4
|
export { default as TextArea } from './components/atoms/TextArea';
|
|
5
5
|
export type { TextAreaProps } from './components/atoms/TextArea';
|
|
6
|
-
export { default as Slider } from './components/atoms/Slider';
|
|
7
|
-
export type { SliderProps } from './components/atoms/Slider';
|
|
8
6
|
export { default as Skeleton } from './components/atoms/Skeleton';
|
|
9
7
|
export type { SkeletonProps } from './components/atoms/Skeleton';
|
|
10
8
|
export { default as Incentive } from './components/atoms/Incentive';
|
|
@@ -27,16 +25,12 @@ export { default as SearchInput } from './components/molecules/SearchInput';
|
|
|
27
25
|
export type { SearchInputProps, SearchInputRef, } from './components/molecules/SearchInput';
|
|
28
26
|
export { default as Carousel } from './components/molecules/Carousel';
|
|
29
27
|
export type { CarouselProps } from './components/molecules/Carousel';
|
|
30
|
-
export { default as Modal } from './components/molecules/Modal';
|
|
31
|
-
export type { ModalProps } from './components/molecules/Modal';
|
|
32
28
|
export { default as Banner, BannerContent, BannerImage, BannerLink, } from './components/molecules/Banner';
|
|
33
29
|
export type { BannerProps, BannerContentProps, BannerImageProps, BannerLinkProps, } from './components/molecules/Banner';
|
|
34
30
|
export { default as PaymentMethods } from './components/molecules/PaymentMethods';
|
|
35
31
|
export type { PaymentMethodsProps } from './components/molecules/PaymentMethods';
|
|
36
32
|
export { default as Breadcrumb } from './components/molecules/Breadcrumb';
|
|
37
33
|
export type { BreadcrumbProps } from './components/molecules/Breadcrumb';
|
|
38
|
-
export { default as PriceRange } from './components/molecules/PriceRange';
|
|
39
|
-
export type { PriceRangeProps } from './components/molecules/PriceRange';
|
|
40
34
|
export { default as Form } from './components/molecules/Form';
|
|
41
35
|
export type { FormProps } from './components/molecules/Form';
|
|
42
36
|
export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './components/organisms/OutOfStock';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export * from '@faststore/components';
|
|
|
2
2
|
// Atoms
|
|
3
3
|
export { default as Popover } from './components/atoms/Popover';
|
|
4
4
|
export { default as TextArea } from './components/atoms/TextArea';
|
|
5
|
-
export { default as Slider } from './components/atoms/Slider';
|
|
6
5
|
export { default as Skeleton } from './components/atoms/Skeleton';
|
|
7
6
|
export { default as Incentive } from './components/atoms/Incentive';
|
|
8
7
|
// Molecules
|
|
@@ -15,11 +14,9 @@ export { default as CartItem, CartItemActions, CartItemContent, CartItemImage, C
|
|
|
15
14
|
export { default as Bullets } from './components/molecules/Bullets';
|
|
16
15
|
export { default as SearchInput } from './components/molecules/SearchInput';
|
|
17
16
|
export { default as Carousel } from './components/molecules/Carousel';
|
|
18
|
-
export { default as Modal } from './components/molecules/Modal';
|
|
19
17
|
export { default as Banner, BannerContent, BannerImage, BannerLink, } from './components/molecules/Banner';
|
|
20
18
|
export { default as PaymentMethods } from './components/molecules/PaymentMethods';
|
|
21
19
|
export { default as Breadcrumb } from './components/molecules/Breadcrumb';
|
|
22
|
-
export { default as PriceRange } from './components/molecules/PriceRange';
|
|
23
20
|
export { default as Form } from './components/molecules/Form';
|
|
24
21
|
// Organisms
|
|
25
22
|
export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './components/organisms/OutOfStock';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AAErC,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,M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AAI,MAAM,EACjB,aAAa,EACb,WAAW,EACX,UAAU,GACX,MAAM,+BAA+B,CAAA;AAQtC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAGjF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAGzE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAG7D,YAAY;AACZ,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,eAAe,EACf,iBAAiB,GAClB,MAAM,mCAAmC,CAAA;AAO1C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AAG1D,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.56-alpha.0",
|
|
4
4
|
"description": "A lightweight, framework agnostic component library for React",
|
|
5
5
|
"author": "emersonlaurentino",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"node": "16.18.0",
|
|
60
60
|
"yarn": "1.19.1"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6afa204ec28032832e3867f805fbc5bcbbed4aab"
|
|
63
63
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
[data-fs-slider] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Slider
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
--fs-slider-height : var(--fs-spacing-2);
|
|
8
|
+
--fs-slider-border-radius : var(--fs-border-radius-pill);
|
|
9
|
+
--fs-slider-margin-bottom : var(--fs-spacing-3);
|
|
10
|
+
|
|
11
|
+
--fs-slider-bkg-color : var(--fs-color-neutral-bkg);
|
|
12
|
+
--fs-slider-selection-bkg-color : var(--fs-color-primary-bkg-light-active);
|
|
13
|
+
|
|
14
|
+
--fs-slider-transition-function : var(--fs-transition-function);
|
|
15
|
+
--fs-slider-transition-property : var(--fs-transition-property);
|
|
16
|
+
--fs-slider-transition-timing : var(--fs-transition-timing);
|
|
17
|
+
|
|
18
|
+
// Thumb
|
|
19
|
+
--fs-slider-thumb-size : var(--fs-spacing-4);
|
|
20
|
+
--fs-slider-thumb-bkg-color : var(--fs-color-primary-bkg);
|
|
21
|
+
--fs-slider-thumb-bkg-color-hover : var(--fs-color-primary-bkg-hover);
|
|
22
|
+
--fs-slider-thumb-border-width : var(--fs-border-width);
|
|
23
|
+
--fs-slider-thumb-border-radius : var(--fs-border-radius-circle);
|
|
24
|
+
--fs-slider-thumb-border-color : var(--fs-slider-thumb-bkg-color);
|
|
25
|
+
--fs-slider-thumb-border-color-hover : var(--fs-slider-thumb-bkg-color-hover);
|
|
26
|
+
|
|
27
|
+
// Absolute Values
|
|
28
|
+
--fs-slider-absolute-values-text-color : var(--fs-color-disabled-text);
|
|
29
|
+
|
|
30
|
+
// Value Label
|
|
31
|
+
--fs-slider-value-label-bottom : var(--fs-spacing-3);
|
|
32
|
+
--fs-slider-value-label-bkg-color : var(--fs-color-body-bkg);
|
|
33
|
+
|
|
34
|
+
// --------------------------------------------------------
|
|
35
|
+
// Structural Styles
|
|
36
|
+
// --------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
width: 100%;
|
|
39
|
+
|
|
40
|
+
[data-fs-slider-wrapper] {
|
|
41
|
+
position: relative;
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: var(--fs-slider-height);
|
|
44
|
+
margin-bottom: var(--fs-slider-margin-bottom);
|
|
45
|
+
background-color: var(--fs-slider-bkg-color);
|
|
46
|
+
border-radius: var(--fs-slider-border-radius);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[data-fs-slider-range] {
|
|
50
|
+
position: absolute;
|
|
51
|
+
height: var(--fs-slider-height);
|
|
52
|
+
background-color: var(--fs-slider-selection-bkg-color);
|
|
53
|
+
border-radius: var(--fs-slider-border-radius);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Thumb styles for Webkit based browsers (Chrome, Edge)
|
|
57
|
+
[data-fs-slider-thumb],
|
|
58
|
+
[data-fs-slider-thumb]::-webkit-slider-thumb {
|
|
59
|
+
width: var(--fs-slider-thumb-size);
|
|
60
|
+
height: var(--fs-slider-thumb-size);
|
|
61
|
+
pointer-events: auto;
|
|
62
|
+
cursor: col-resize;
|
|
63
|
+
background-color: var(--fs-slider-thumb-bkg-color);
|
|
64
|
+
border: var(--fs-slider-thumb-border-width) solid var(--fs-slider-thumb-border-color);
|
|
65
|
+
border-radius: var(--fs-slider-thumb-border-radius);
|
|
66
|
+
-webkit-tap-highlight-color: transparent;
|
|
67
|
+
appearance: none;
|
|
68
|
+
transition: var(--fs-slider-transition-property) var(--fs-slider-transition-timing) var(--fs-slider-transition-function);
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
background-color: var(--fs-slider-thumb-bkg-color-hover);
|
|
72
|
+
border-color: var(--fs-slider-thumb-border-color-hover);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Thumb styles for Mozilla
|
|
77
|
+
[data-fs-slider-thumb]::-moz-range-thumb {
|
|
78
|
+
width: var(--fs-slider-thumb-size);
|
|
79
|
+
height: var(--fs-slider-thumb-size);
|
|
80
|
+
pointer-events: auto;
|
|
81
|
+
cursor: col-resize;
|
|
82
|
+
background-color: var(--fs-slider-thumb-bkg-color);
|
|
83
|
+
border: var(--fs-slider-thumb-border-width) solid var(--fs-slider-thumb-border-color);
|
|
84
|
+
border-radius: var(--fs-slider-thumb-radius);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[data-fs-slider-thumb] {
|
|
88
|
+
position: absolute;
|
|
89
|
+
width: inherit;
|
|
90
|
+
height: 0;
|
|
91
|
+
margin: calc(var(--fs-slider-height) / 2) 0;
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
border: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[data-fs-slider-thumb="left"] {
|
|
97
|
+
z-index: 1;
|
|
98
|
+
|
|
99
|
+
&:hover + [data-fs-slider-value-label="min"] {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
[data-fs-slider-thumb="right"] {
|
|
105
|
+
z-index: 2;
|
|
106
|
+
|
|
107
|
+
&:hover + [data-fs-slider-value-label="max"] {
|
|
108
|
+
opacity: 1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[data-fs-slider-value-label] {
|
|
113
|
+
position: absolute;
|
|
114
|
+
bottom: var(--fs-slider-value-label-bottom);
|
|
115
|
+
padding: var(--fs-spacing-1);
|
|
116
|
+
background-color: var(--fs-slider-value-label-bkg-color);
|
|
117
|
+
opacity: 0;
|
|
118
|
+
transition: opacity var(--fs-slider-transition-timing) var(--fs-slider-transition-function);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
[data-fs-slider-value-label="min"] {
|
|
122
|
+
text-align: left;
|
|
123
|
+
transform: translateX(-1rem);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[data-fs-slider-value-label="max"] {
|
|
127
|
+
text-align: right;
|
|
128
|
+
transform: translateX(calc(-100% + 1.25rem));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
[data-fs-slider-absolute-values] {
|
|
132
|
+
display: flex;
|
|
133
|
+
justify-content: space-between;
|
|
134
|
+
margin-bottom: var(--fs-spacing-2);
|
|
135
|
+
color: var(--fs-slider-absolute-values-text-color);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[data-fs-modal] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Modal
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
--fs-modal-position-top : 30vh;
|
|
8
|
+
--fs-modal-position-right : var(--fs-spacing-4);
|
|
9
|
+
--fs-modal-position-left : var(--fs-spacing-4);
|
|
10
|
+
--fs-modal-max-width : calc(var(--fs-grid-breakpoint-desktop) / 3);
|
|
11
|
+
--fs-modal-min-height : var(--fs-spacing-5);
|
|
12
|
+
--fs-modal-margin : auto;
|
|
13
|
+
--fs-modal-background-color : var(--fs-color-body-bkg);
|
|
14
|
+
--fs-modal-border-radius : var(--fs-border-radius);
|
|
15
|
+
|
|
16
|
+
--fs-modal-width-tablet : calc(100vw / 3);
|
|
17
|
+
--fs-modal-min-width-tablet : calc(var(--fs-grid-breakpoint-desktop) / 3);
|
|
18
|
+
|
|
19
|
+
--fs-modal-transition-timing : var(--fs-transition-timing);
|
|
20
|
+
--fs-modal-transition-property : transform;
|
|
21
|
+
--fs-modal-transition-in-function : ease-in;
|
|
22
|
+
--fs-modal-transition-out-function : ease-in;
|
|
23
|
+
|
|
24
|
+
// Header
|
|
25
|
+
--fs-modal-header-padding : var(--fs-spacing-4) var(--fs-spacing-7) var(--fs-spacing-4) var(--fs-spacing-4);
|
|
26
|
+
|
|
27
|
+
// Header Title
|
|
28
|
+
--fs-modal-header-title-margin-bottom : .625rem;
|
|
29
|
+
--fs-modal-header-title-size : var(--fs-text-size-lead);
|
|
30
|
+
--fs-modal-header-title-weight : var(--fs-text-weight-bold);
|
|
31
|
+
--fs-modal-header-title-line-height : 1.2;
|
|
32
|
+
|
|
33
|
+
// Header Description
|
|
34
|
+
--fs-modal-header-description-size : var(--fs-text-size-body);
|
|
35
|
+
--fs-modal-header-description-line-height : 1.5;
|
|
36
|
+
--fs-modal-header-description-color : var(--fs-color-text-light);
|
|
37
|
+
|
|
38
|
+
// Header Close Button
|
|
39
|
+
--fs-modal-header-close-button-position-top : 0;
|
|
40
|
+
--fs-modal-header-close-button-position-right : 0;
|
|
41
|
+
|
|
42
|
+
// Body
|
|
43
|
+
--fs-modal-body-padding : var(--fs-spacing-1) var(--fs-spacing-4) var(--fs-spacing-5);
|
|
44
|
+
|
|
45
|
+
position: fixed;
|
|
46
|
+
top: var(--fs-modal-position-top);
|
|
47
|
+
right: var(--fs-modal-position-right);
|
|
48
|
+
left: var(--fs-modal-position-left);
|
|
49
|
+
max-width: var(--fs-modal-max-width);
|
|
50
|
+
min-height: var(--fs-modal-min-height);
|
|
51
|
+
margin: var(--fs-modal-margin);
|
|
52
|
+
background-color: var(--fs-modal-background-color);
|
|
53
|
+
border-radius: var(--fs-modal-border-radius);
|
|
54
|
+
|
|
55
|
+
@include media(">=tablet") {
|
|
56
|
+
width: var(--fs-modal-width-tablet);
|
|
57
|
+
min-width: var(--fs-modal-min-width-tablet);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&[data-fs-modal-state="in"] {
|
|
61
|
+
transition: var(--fs-modal-transition-property) var(--fs-modal-transition-timing) var(--fs-modal-transition-in-function);
|
|
62
|
+
transform: translate3d(0, 0, 0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&[data-fs-modal-state="out"] {
|
|
66
|
+
transition: var(--fs-modal-transition-property) var(--fs-modal-transition-timing) var(--fs-modal-transition-in-function);
|
|
67
|
+
transform: translate3d(0, 50%, 0);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-fs-modal-header] {
|
|
71
|
+
position: relative;
|
|
72
|
+
padding: var(--fs-modal-header-padding);
|
|
73
|
+
|
|
74
|
+
[data-fs-modal-header-title] {
|
|
75
|
+
margin-bottom: var(--fs-modal-header-title-margin-bottom);
|
|
76
|
+
font-size: var(--fs-modal-header-title-size);
|
|
77
|
+
font-weight: var(--fs-modal-header-title-weight);
|
|
78
|
+
line-height: var(--fs-modal-header-title-line-height);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[data-fs-modal-header-description] {
|
|
82
|
+
font-size: var(--fs-modal-header-description-size);
|
|
83
|
+
line-height: var(--fs-modal-header-description-line-height);
|
|
84
|
+
color: var(--fs-modal-header-description-color);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[data-fs-modal-header-close-button] {
|
|
88
|
+
position: absolute;
|
|
89
|
+
top: var(--fs-modal-header-close-button-position-top);
|
|
90
|
+
right: var(--fs-modal-header-close-button-position-right);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[data-fs-modal-body] {
|
|
95
|
+
padding: var(--fs-modal-body-padding);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[data-fs-price-range] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Structural Styles
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
8
|
+
[data-fs-price-range-inputs] {
|
|
9
|
+
display: flex;
|
|
10
|
+
|
|
11
|
+
[data-fs-input-field] {
|
|
12
|
+
width: 50%;
|
|
13
|
+
|
|
14
|
+
input:hover,
|
|
15
|
+
input:focus-visible,
|
|
16
|
+
input:focus {
|
|
17
|
+
z-index: 1;
|
|
18
|
+
+ label { z-index: 1; }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:first-of-type {
|
|
22
|
+
margin-right: -1px;
|
|
23
|
+
|
|
24
|
+
input {
|
|
25
|
+
border-top-right-radius: 0;
|
|
26
|
+
border-bottom-right-radius: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:last-of-type input {
|
|
31
|
+
border-top-left-radius: 0;
|
|
32
|
+
border-bottom-left-radius: 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -7,9 +7,6 @@ export type { PopoverProps } from './components/atoms/Popover'
|
|
|
7
7
|
export { default as TextArea } from './components/atoms/TextArea'
|
|
8
8
|
export type { TextAreaProps } from './components/atoms/TextArea'
|
|
9
9
|
|
|
10
|
-
export { default as Slider } from './components/atoms/Slider'
|
|
11
|
-
export type { SliderProps } from './components/atoms/Slider'
|
|
12
|
-
|
|
13
10
|
export { default as Skeleton } from './components/atoms/Skeleton'
|
|
14
11
|
export type { SkeletonProps } from './components/atoms/Skeleton'
|
|
15
12
|
|
|
@@ -83,9 +80,6 @@ export type {
|
|
|
83
80
|
export { default as Carousel } from './components/molecules/Carousel'
|
|
84
81
|
export type { CarouselProps } from './components/molecules/Carousel'
|
|
85
82
|
|
|
86
|
-
export { default as Modal } from './components/molecules/Modal'
|
|
87
|
-
export type { ModalProps } from './components/molecules/Modal'
|
|
88
|
-
|
|
89
83
|
export {
|
|
90
84
|
default as Banner,
|
|
91
85
|
BannerContent,
|
|
@@ -105,9 +99,6 @@ export type { PaymentMethodsProps } from './components/molecules/PaymentMethods'
|
|
|
105
99
|
export { default as Breadcrumb } from './components/molecules/Breadcrumb'
|
|
106
100
|
export type { BreadcrumbProps } from './components/molecules/Breadcrumb'
|
|
107
101
|
|
|
108
|
-
export { default as PriceRange } from './components/molecules/PriceRange'
|
|
109
|
-
export type { PriceRangeProps } from './components/molecules/PriceRange'
|
|
110
|
-
|
|
111
102
|
export { default as Form } from './components/molecules/Form'
|
|
112
103
|
export type { FormProps } from './components/molecules/Form'
|
|
113
104
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
@import "../components/atoms/Price/styles";
|
|
12
12
|
@import "../components/atoms/Radio/styles";
|
|
13
13
|
@import "../components/atoms/Select/styles";
|
|
14
|
+
@import "../components/atoms/Slider/styles";
|
|
14
15
|
@import "../components/atoms/SROnly/styles";
|
|
15
16
|
|
|
16
17
|
// Molecules
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
@import "../components/molecules/Gift/styles";
|
|
24
25
|
@import "../components/molecules/InputField/styles";
|
|
25
26
|
@import "../components/molecules/LinkButton/styles";
|
|
27
|
+
@import "../components/molecules/Modal/styles";
|
|
26
28
|
@import "../components/molecules/QuantitySelector/styles";
|
|
27
29
|
@import "../components/molecules/RadioField/styles";
|
|
28
30
|
@import "../components/molecules/Rating/styles";
|
|
@@ -34,3 +36,4 @@
|
|
|
34
36
|
|
|
35
37
|
// Organisms
|
|
36
38
|
@import "../components/organisms/Hero/styles";
|
|
39
|
+
@import "../components/organisms/PriceRange/styles";
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code is inspired by the work of [sandra-lewis](https://codesandbox.io/u/sandra-lewis)
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import type { ReactNode } from 'react';
|
|
6
|
-
interface Range {
|
|
7
|
-
absolute: number;
|
|
8
|
-
selected: number;
|
|
9
|
-
}
|
|
10
|
-
export type SliderProps = {
|
|
11
|
-
/**
|
|
12
|
-
* The minimum value of the slider.
|
|
13
|
-
*/
|
|
14
|
-
min: Range;
|
|
15
|
-
/**
|
|
16
|
-
* The maximum value of the slider.
|
|
17
|
-
*/
|
|
18
|
-
max: Range;
|
|
19
|
-
/**
|
|
20
|
-
* Specifies the number interval to be used in the inputs.
|
|
21
|
-
*/
|
|
22
|
-
step?: number;
|
|
23
|
-
/**
|
|
24
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
25
|
-
*
|
|
26
|
-
* @default 'store-slider'
|
|
27
|
-
*/
|
|
28
|
-
testId?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Callback that fires when the slider value changes.
|
|
31
|
-
*/
|
|
32
|
-
onChange?: (value: {
|
|
33
|
-
min: number;
|
|
34
|
-
max: number;
|
|
35
|
-
}) => void;
|
|
36
|
-
/**
|
|
37
|
-
* Callback that fires when the slider value ends changing.
|
|
38
|
-
*/
|
|
39
|
-
onEnd?: (value: {
|
|
40
|
-
min: number;
|
|
41
|
-
max: number;
|
|
42
|
-
}) => void;
|
|
43
|
-
/**
|
|
44
|
-
* A function used to set a human-readable value text based on the slider's current value.
|
|
45
|
-
*/
|
|
46
|
-
getAriaValueText?(value: number, thumb?: 'min' | 'max'): string;
|
|
47
|
-
/**
|
|
48
|
-
* Returns the value of element's class content attribute.
|
|
49
|
-
*/
|
|
50
|
-
className?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Component that renders min value label above the left thumb.
|
|
53
|
-
*/
|
|
54
|
-
minValueLabelComponent?: (minValue: number) => ReactNode;
|
|
55
|
-
/**
|
|
56
|
-
* Component that renders max value label above the right thumb.
|
|
57
|
-
*/
|
|
58
|
-
maxValueLabelComponent?: (maxValue: number) => ReactNode;
|
|
59
|
-
};
|
|
60
|
-
type SliderRefType = {
|
|
61
|
-
setSliderValues: (values: {
|
|
62
|
-
min: number;
|
|
63
|
-
max: number;
|
|
64
|
-
}) => void;
|
|
65
|
-
};
|
|
66
|
-
declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<SliderRefType | undefined>>;
|
|
67
|
-
export default Slider;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code is inspired by the work of [sandra-lewis](https://codesandbox.io/u/sandra-lewis)
|
|
3
|
-
*/
|
|
4
|
-
import React, { useState, useMemo, useImperativeHandle, forwardRef, } from 'react';
|
|
5
|
-
const percent = (value, min, max) => Math.round(((value - min) / (max - min)) * 100);
|
|
6
|
-
const Slider = forwardRef(function Slider({ min, max, onChange, onEnd, testId = 'store-slider', getAriaValueText, className, step, minValueLabelComponent, maxValueLabelComponent, }, ref) {
|
|
7
|
-
const widthPercent = useMemo(() => (max.absolute - min.absolute) / 100, [max.absolute, min.absolute]);
|
|
8
|
-
const [minPercent, setMinPercent] = useState(() => percent(min.selected, min.absolute, max.absolute));
|
|
9
|
-
const [maxPercent, setMaxPercent] = useState(() => percent(max.selected, min.absolute, max.absolute));
|
|
10
|
-
const [minVal, setMinVal] = useState(() => Math.round(min.absolute + minPercent * widthPercent));
|
|
11
|
-
const [maxVal, setMaxVal] = useState(() => Math.round(min.absolute + maxPercent * widthPercent));
|
|
12
|
-
useImperativeHandle(ref, () => ({
|
|
13
|
-
setSliderValues: (values) => {
|
|
14
|
-
const sliderMinValue = Math.min(Number(values.min), maxVal);
|
|
15
|
-
setMinVal(sliderMinValue);
|
|
16
|
-
setMinPercent(percent(sliderMinValue, min.absolute, max.absolute));
|
|
17
|
-
if (values.max > max.absolute) {
|
|
18
|
-
setMaxVal(max.absolute);
|
|
19
|
-
setMaxPercent(percent(max.absolute, min.absolute, max.absolute));
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const sliderMaxValue = Math.max(Number(values.max), minVal);
|
|
23
|
-
setMaxVal(sliderMaxValue);
|
|
24
|
-
setMaxPercent(percent(sliderMaxValue, min.absolute, max.absolute));
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
return (React.createElement("div", { "data-fs-slider": true, "data-testid": testId, className: className },
|
|
28
|
-
React.createElement("div", { "data-slider-range": true, style: {
|
|
29
|
-
left: `${minPercent}%`,
|
|
30
|
-
width: `${maxPercent - minPercent}%`,
|
|
31
|
-
} }),
|
|
32
|
-
React.createElement("input", { type: "range", min: Math.round(min.absolute), max: Math.round(max.absolute), value: minVal, step: step, onMouseUp: () => onEnd?.({ min: minVal, max: maxVal }), onTouchEnd: () => onEnd?.({ min: minVal, max: maxVal }), onChange: (event) => {
|
|
33
|
-
const minValue = Math.min(Number(event.target.value), maxVal);
|
|
34
|
-
setMinVal(minValue);
|
|
35
|
-
setMinPercent(percent(minValue, min.absolute, max.absolute));
|
|
36
|
-
onChange?.({ min: minValue, max: maxVal });
|
|
37
|
-
}, "data-slider-thumb": "left", "aria-valuemin": min.absolute, "aria-valuemax": max.absolute, "aria-valuenow": minVal, "aria-label": String(minVal), "aria-labelledby": getAriaValueText?.(minVal, 'min') }),
|
|
38
|
-
minValueLabelComponent && minValueLabelComponent(minVal),
|
|
39
|
-
React.createElement("input", { type: "range", min: Math.round(min.absolute), max: Math.round(max.absolute), value: maxVal, step: step, onMouseUp: () => onEnd?.({ min: minVal, max: maxVal }), onTouchEnd: () => onEnd?.({ min: minVal, max: maxVal }), onChange: (event) => {
|
|
40
|
-
const maxValue = Math.max(Number(event.target.value), minVal);
|
|
41
|
-
setMaxVal(maxValue);
|
|
42
|
-
setMaxPercent(percent(maxValue, min.absolute, max.absolute));
|
|
43
|
-
onChange?.({ min: minVal, max: maxValue });
|
|
44
|
-
}, "data-slider-thumb": "right", "aria-valuemin": min.absolute, "aria-valuemax": max.absolute, "aria-valuenow": maxVal, "aria-label": String(maxVal), "aria-labelledby": getAriaValueText?.(maxVal, 'max') }),
|
|
45
|
-
maxValueLabelComponent && maxValueLabelComponent(maxVal)));
|
|
46
|
-
});
|
|
47
|
-
export default Slider;
|
|
48
|
-
//# sourceMappingURL=Slider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../../src/components/atoms/Slider/Slider.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,UAAU,GACX,MAAM,OAAO,CAAA;AAyDd,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,EAAE,CAC1D,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;AAEjD,MAAM,MAAM,GAAG,UAAU,CACvB,SAAS,MAAM,CACb,EACE,GAAG,EACH,GAAG,EACH,QAAQ,EACR,KAAK,EACL,MAAM,GAAG,cAAc,EACvB,gBAAgB,EAChB,SAAS,EACT,IAAI,EACJ,sBAAsB,EACtB,sBAAsB,GACvB,EACD,GAAG;IAEH,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,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AE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAA;YAC5C,CAAC,uBACiB,OAAO,mBACV,GAAG,CAAC,QAAQ,mBACZ,GAAG,CAAC,QAAQ,mBACZ,MAAM,gBACT,MAAM,CAAC,MAAM,CAAC,qBACT,gBAAgB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,GAClD;QACD,sBAAsB,IAAI,sBAAsB,CAAC,MAAM,CAAC,CACrD,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/atoms/Slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { AriaAttributes, KeyboardEvent, MouseEvent, PropsWithChildren } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { ModalContentProps } from './ModalContent';
|
|
4
|
-
export interface ModalProps extends ModalContentProps {
|
|
5
|
-
/**
|
|
6
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
-
*/
|
|
8
|
-
testId?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Identifies the element (or elements) that labels the current element.
|
|
11
|
-
* @see aria-labelledby https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby
|
|
12
|
-
*/
|
|
13
|
-
'aria-labelledby'?: AriaAttributes['aria-label'];
|
|
14
|
-
/**
|
|
15
|
-
* This function is called whenever the user hits "Escape" or clicks outside
|
|
16
|
-
* the dialog.
|
|
17
|
-
*/
|
|
18
|
-
onDismiss?: (event: MouseEvent | KeyboardEvent) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Controls whether or not the dialog is open.
|
|
21
|
-
*/
|
|
22
|
-
isOpen: boolean;
|
|
23
|
-
}
|
|
24
|
-
declare const Modal: ({ isOpen, children, onDismiss, testId, ...otherProps }: PropsWithChildren<ModalProps>) => React.ReactPortal | null;
|
|
25
|
-
export default Modal;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
|
-
import { Overlay } from '@faststore/components';
|
|
4
|
-
import ModalContent from './ModalContent';
|
|
5
|
-
/*
|
|
6
|
-
* This component is based on @reach/dialog.
|
|
7
|
-
* https://github.com/reach/reach-ui/blob/main/packages/dialog/src/index.tsx
|
|
8
|
-
* https://reach.tech/dialog
|
|
9
|
-
*/
|
|
10
|
-
const Modal = ({ isOpen, children, onDismiss, testId = 'store-modal', ...otherProps }) => {
|
|
11
|
-
const handleBackdropClick = (event) => {
|
|
12
|
-
if (event.defaultPrevented) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
event.stopPropagation();
|
|
16
|
-
onDismiss?.(event);
|
|
17
|
-
};
|
|
18
|
-
const handleBackdropKeyDown = (event) => {
|
|
19
|
-
if (event.key !== 'Escape' || event.defaultPrevented) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
event.stopPropagation();
|
|
23
|
-
onDismiss?.(event);
|
|
24
|
-
};
|
|
25
|
-
return isOpen
|
|
26
|
-
? createPortal(React.createElement(Overlay, { onClick: handleBackdropClick, onKeyDown: handleBackdropKeyDown },
|
|
27
|
-
React.createElement(ModalContent, { ...otherProps, testId: testId }, children)), document.body)
|
|
28
|
-
: null;
|
|
29
|
-
};
|
|
30
|
-
export default Modal;
|
|
31
|
-
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/Modal.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAwBzC;;;;GAIG;AAEH,MAAM,KAAK,GAAG,CAAC,EACb,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,GAAG,aAAa,EACtB,GAAG,UAAU,EACiB,EAAE,EAAE;IAClC,MAAM,mBAAmB,GAAG,CAAC,KAAiB,EAAE,EAAE;QAChD,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC1B,OAAM;SACP;QAED,KAAK,CAAC,eAAe,EAAE,CAAA;QACvB,SAAS,EAAE,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC,CAAA;IAED,MAAM,qBAAqB,GAAG,CAAC,KAAoB,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,gBAAgB,EAAE;YACpD,OAAM;SACP;QAED,KAAK,CAAC,eAAe,EAAE,CAAA;QACvB,SAAS,EAAE,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC,CAAA;IAED,OAAO,MAAM;QACX,CAAC,CAAC,YAAY,CACV,oBAAC,OAAO,IACN,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,qBAAqB;YAEhC,oBAAC,YAAY,OAAK,UAAU,EAAE,MAAM,EAAE,MAAM,IACzC,QAAQ,CACI,CACP,EACV,QAAQ,CAAC,IAAI,CACd;QACH,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAA;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DetailedHTMLProps, HTMLAttributes, RefObject } from 'react';
|
|
2
|
-
interface ModalContentPureProps extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref'> {
|
|
3
|
-
beforeElementRef: RefObject<HTMLDivElement>;
|
|
4
|
-
trapFocusRef: RefObject<HTMLDivElement>;
|
|
5
|
-
afterElementRef: RefObject<HTMLDivElement>;
|
|
6
|
-
testId?: string;
|
|
7
|
-
}
|
|
8
|
-
export type ModalContentProps = Omit<ModalContentPureProps, 'trapFocusRef' | 'onClick' | 'beforeElementRef' | 'afterElementRef'>;
|
|
9
|
-
declare const ModalContent: ({ children, ...otherProps }: ModalContentProps) => JSX.Element;
|
|
10
|
-
export default ModalContent;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
2
|
-
import useTrapFocus from './useTrapFocus';
|
|
3
|
-
const ModalContentPure = ({ beforeElementRef, trapFocusRef, afterElementRef, testId = 'store-modal-content', children, ...otherProps }) => {
|
|
4
|
-
return (React.createElement(React.Fragment, null,
|
|
5
|
-
React.createElement("div", { ref: beforeElementRef, "data-testid": "beforeElement", tabIndex: 0, "aria-hidden": "true" }),
|
|
6
|
-
React.createElement("div", { "data-fs-modal-content": true, "data-testid": testId, ref: trapFocusRef, "aria-modal": "true", role: "dialog", tabIndex: -1, ...otherProps }, children),
|
|
7
|
-
React.createElement("div", { ref: afterElementRef, "data-testid": "afterElement", tabIndex: 0, "aria-hidden": "true" })));
|
|
8
|
-
};
|
|
9
|
-
const ModalContent = ({ children, ...otherProps }) => {
|
|
10
|
-
const trapFocusRef = useRef(null);
|
|
11
|
-
const beforeElementRef = useRef(null);
|
|
12
|
-
const afterElementRef = useRef(null);
|
|
13
|
-
useTrapFocus({
|
|
14
|
-
beforeElementRef,
|
|
15
|
-
trapFocusRef,
|
|
16
|
-
afterElementRef,
|
|
17
|
-
});
|
|
18
|
-
return (React.createElement(ModalContentPure, { ...otherProps, trapFocusRef: trapFocusRef, beforeElementRef: beforeElementRef, afterElementRef: afterElementRef, onClick: (event) => {
|
|
19
|
-
event.stopPropagation();
|
|
20
|
-
} }, children));
|
|
21
|
-
};
|
|
22
|
-
export default ModalContent;
|
|
23
|
-
//# sourceMappingURL=ModalContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContent.js","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/Mod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CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
|