@faststore/ui 2.0.52-alpha.0 → 2.0.54-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.
Files changed (42) hide show
  1. package/dist/index.d.ts +0 -8
  2. package/dist/index.js +0 -4
  3. package/dist/index.js.map +1 -1
  4. package/package.json +2 -2
  5. package/src/components/atoms/Button/styles.scss +16 -0
  6. package/src/components/atoms/Loader/styles.scss +72 -0
  7. package/src/components/atoms/Slider/styles.scss +137 -0
  8. package/src/components/organisms/PriceRange/styles.scss +36 -0
  9. package/src/index.ts +0 -12
  10. package/src/styles/components.scss +4 -1
  11. package/dist/components/atoms/Slider/Slider.d.ts +0 -67
  12. package/dist/components/atoms/Slider/Slider.js +0 -48
  13. package/dist/components/atoms/Slider/Slider.js.map +0 -1
  14. package/dist/components/atoms/Slider/index.d.ts +0 -2
  15. package/dist/components/atoms/Slider/index.js +0 -2
  16. package/dist/components/atoms/Slider/index.js.map +0 -1
  17. package/dist/components/atoms/Spinner/Spinner.d.ts +0 -11
  18. package/dist/components/atoms/Spinner/Spinner.js +0 -6
  19. package/dist/components/atoms/Spinner/Spinner.js.map +0 -1
  20. package/dist/components/atoms/Spinner/index.d.ts +0 -2
  21. package/dist/components/atoms/Spinner/index.js +0 -2
  22. package/dist/components/atoms/Spinner/index.js.map +0 -1
  23. package/dist/components/molecules/LoadingButton/LoadingButton.d.ts +0 -14
  24. package/dist/components/molecules/LoadingButton/LoadingButton.js +0 -8
  25. package/dist/components/molecules/LoadingButton/LoadingButton.js.map +0 -1
  26. package/dist/components/molecules/LoadingButton/index.d.ts +0 -2
  27. package/dist/components/molecules/LoadingButton/index.js +0 -2
  28. package/dist/components/molecules/LoadingButton/index.js.map +0 -1
  29. package/dist/components/molecules/PriceRange/PriceRange.d.ts +0 -47
  30. package/dist/components/molecules/PriceRange/PriceRange.js +0 -28
  31. package/dist/components/molecules/PriceRange/PriceRange.js.map +0 -1
  32. package/dist/components/molecules/PriceRange/index.d.ts +0 -2
  33. package/dist/components/molecules/PriceRange/index.js +0 -2
  34. package/dist/components/molecules/PriceRange/index.js.map +0 -1
  35. package/src/components/atoms/Slider/Slider.tsx +0 -182
  36. package/src/components/atoms/Slider/index.ts +0 -2
  37. package/src/components/atoms/Spinner/Spinner.tsx +0 -19
  38. package/src/components/atoms/Spinner/index.tsx +0 -2
  39. package/src/components/molecules/LoadingButton/LoadingButton.tsx +0 -31
  40. package/src/components/molecules/LoadingButton/index.tsx +0 -2
  41. package/src/components/molecules/PriceRange/PriceRange.tsx +0 -108
  42. package/src/components/molecules/PriceRange/index.ts +0 -2
package/dist/index.d.ts CHANGED
@@ -3,12 +3,8 @@ 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
- export { default as Spinner } from './components/atoms/Spinner';
11
- export type { SpinnerProps } from './components/atoms/Spinner';
12
8
  export { default as Incentive } from './components/atoms/Incentive';
13
9
  export type { IncentiveProps } from './components/atoms/Incentive';
14
10
  export { default as SkuSelector } from './components/molecules/SkuSelector';
@@ -37,10 +33,6 @@ export { default as PaymentMethods } from './components/molecules/PaymentMethods
37
33
  export type { PaymentMethodsProps } from './components/molecules/PaymentMethods';
38
34
  export { default as Breadcrumb } from './components/molecules/Breadcrumb';
39
35
  export type { BreadcrumbProps } from './components/molecules/Breadcrumb';
40
- export { default as LoadingButton } from './components/molecules/LoadingButton';
41
- export type { LoadingButtonProps } from './components/molecules/LoadingButton';
42
- export { default as PriceRange } from './components/molecules/PriceRange';
43
- export type { PriceRangeProps } from './components/molecules/PriceRange';
44
36
  export { default as Form } from './components/molecules/Form';
45
37
  export type { FormProps } from './components/molecules/Form';
46
38
  export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './components/organisms/OutOfStock';
package/dist/index.js CHANGED
@@ -2,9 +2,7 @@ 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
- export { default as Spinner } from './components/atoms/Spinner';
8
6
  export { default as Incentive } from './components/atoms/Incentive';
9
7
  // Molecules
10
8
  export { default as SkuSelector } from './components/molecules/SkuSelector';
@@ -20,8 +18,6 @@ export { default as Modal } from './components/molecules/Modal';
20
18
  export { default as Banner, BannerContent, BannerImage, BannerLink, } from './components/molecules/Banner';
21
19
  export { default as PaymentMethods } from './components/molecules/PaymentMethods';
22
20
  export { default as Breadcrumb } from './components/molecules/Breadcrumb';
23
- export { default as LoadingButton } from './components/molecules/LoadingButton';
24
- export { default as PriceRange } from './components/molecules/PriceRange';
25
21
  export { default as Form } from './components/molecules/Form';
26
22
  // Organisms
27
23
  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,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAG7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,SAA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W,EAAE,MAAM,oCAAoC,CAAA;AAM3E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAGrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAG/D,OAAO,EACL,OAAO,IAAI,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.52-alpha.0",
3
+ "version": "2.0.54-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": "fe474595d374d91b69063e0b2ed6e56eee0c36d0"
62
+ "gitHead": "7173ea0bec153905a6b800d002401b5c27fd3213"
63
63
  }
@@ -95,6 +95,9 @@
95
95
  --fs-button-disabled-bkg-color : var(--fs-color-disabled-bkg);
96
96
  --fs-button-disabled-text-color : var(--fs-color-disabled-text);
97
97
 
98
+ // Loading
99
+ --fs-button-loading-label-column-gap : var(--fs-spacing-3);
100
+
98
101
  // Small
99
102
  --fs-button-small-padding : var(--fs-spacing-0) var(--fs-spacing-1);
100
103
  --fs-button-small-min-height : var(--fs-spacing-5);
@@ -314,4 +317,17 @@
314
317
  border-width: 0;
315
318
  }
316
319
  }
320
+
321
+ &[data-fs-button-loading="true"] {
322
+ > * {
323
+ opacity: 0;
324
+ pointer-events: none;
325
+ }
326
+ [data-fs-button-loading-label] {
327
+ position: absolute;
328
+ opacity: 1;
329
+ display: flex;
330
+ column-gap: var(--fs-button-loading-label-column-gap);
331
+ }
332
+ }
317
333
  }
@@ -0,0 +1,72 @@
1
+ [data-fs-loader] {
2
+ // --------------------------------------------------------
3
+ // Design Tokens for Loader
4
+ // --------------------------------------------------------
5
+
6
+ --fs-loader-gap : var(--fs-spacing-0);
7
+
8
+ --fs-loader-animation-function : var(--fs-transition-function);
9
+ --fs-loader-animation-timing : var(--fs-transition-timing);
10
+
11
+ // Item
12
+ --fs-loader-item-width : var(--fs-spacing-0);
13
+ --fs-loader-item-height : var(--fs-loader-item-width);
14
+ --fs-loader-item-border-radius : var(--fs-border-radius-circle);
15
+ --fs-loader-item-initial-opacity : .6;
16
+
17
+ // Dark (Default)
18
+ --fs-loader-dark-item-bkg-color : var(--fs-color-primary-bkg-active);
19
+
20
+ // Light
21
+ --fs-loader-light-item-bkg-color : var(--fs-color-tertiary-bkg-light);
22
+
23
+ // --------------------------------------------------------
24
+ // Structural Styles
25
+ // --------------------------------------------------------
26
+
27
+ display: flex;
28
+ align-items: center;
29
+ column-gap: var(--fs-loader-gap);
30
+
31
+ [data-fs-loader-item] {
32
+ width: var(--fs-loader-item-width);
33
+ height: var(--fs-loader-item-height);
34
+ border-radius: var(--fs-loader-item-border-radius);
35
+ opacity: var(--fs-loader-item-initial-opacity);
36
+ top: 0;
37
+ position: relative;
38
+ animation: load 1.2s infinite var(--fs-loader-animation-function) calc(var(--fs-loader-item-delay,0)*var(--fs-loader-animation-timing));
39
+
40
+ &:first-of-type { --fs-loader-item-delay: -1; }
41
+ &:last-of-type { --fs-loader-item-delay: 1; }
42
+ }
43
+
44
+ @keyframes load {
45
+ 20% {
46
+ top: calc(-1 * var(--fs-spacing-0));
47
+ opacity: 1;
48
+ }
49
+ 40% {
50
+ top: 0;
51
+ opacity: .6;
52
+ }
53
+ 60% {
54
+ top: 0;
55
+ opacity: .6;
56
+ }
57
+ }
58
+
59
+ // --------------------------------------------------------
60
+ // Variants Styles
61
+ // --------------------------------------------------------
62
+
63
+ &[data-fs-loader-variant="dark"] [data-fs-loader-item] {
64
+ background-color: var(--fs-loader-dark-item-bkg-color);
65
+ }
66
+
67
+ &[data-fs-loader-variant="light"] [data-fs-loader-item] {
68
+ background-color: var(--fs-loader-light-item-bkg-color);
69
+ }
70
+
71
+ }
72
+
@@ -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,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,15 +7,9 @@ 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
 
16
- export { default as Spinner } from './components/atoms/Spinner'
17
- export type { SpinnerProps } from './components/atoms/Spinner'
18
-
19
13
  export { default as Incentive } from './components/atoms/Incentive'
20
14
  export type { IncentiveProps } from './components/atoms/Incentive'
21
15
 
@@ -108,12 +102,6 @@ export type { PaymentMethodsProps } from './components/molecules/PaymentMethods'
108
102
  export { default as Breadcrumb } from './components/molecules/Breadcrumb'
109
103
  export type { BreadcrumbProps } from './components/molecules/Breadcrumb'
110
104
 
111
- export { default as LoadingButton } from './components/molecules/LoadingButton'
112
- export type { LoadingButtonProps } from './components/molecules/LoadingButton'
113
-
114
- export { default as PriceRange } from './components/molecules/PriceRange'
115
- export type { PriceRangeProps } from './components/molecules/PriceRange'
116
-
117
105
  export { default as Form } from './components/molecules/Form'
118
106
  export type { FormProps } from './components/molecules/Form'
119
107
 
@@ -3,13 +3,15 @@
3
3
  @import "../components/atoms/Button/styles";
4
4
  @import "../components/atoms/Checkbox/styles";
5
5
  @import "../components/atoms/Icon/styles";
6
- @import "../components/atoms/Link/styles";
7
6
  @import "../components/atoms/Input/styles";
7
+ @import "../components/atoms/Link/styles";
8
8
  @import "../components/atoms/List/styles";
9
+ @import "../components/atoms/Loader/styles";
9
10
  @import "../components/atoms/Overlay/styles";
10
11
  @import "../components/atoms/Price/styles";
11
12
  @import "../components/atoms/Radio/styles";
12
13
  @import "../components/atoms/Select/styles";
14
+ @import "../components/atoms/Slider/styles";
13
15
  @import "../components/atoms/SROnly/styles";
14
16
 
15
17
  // Molecules
@@ -33,3 +35,4 @@
33
35
 
34
36
  // Organisms
35
37
  @import "../components/organisms/Hero/styles";
38
+ @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,cAA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M,CAAC,CAAA;gBAE7D,SAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;gBAC5D,QAAQ,EAAE,CAAC,EAAE,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,2 +0,0 @@
1
- export { default } from './Slider';
2
- export type { SliderProps } from './Slider';
@@ -1,2 +0,0 @@
1
- export { default } from './Slider';
2
- //# sourceMappingURL=index.js.map
@@ -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,11 +0,0 @@
1
- import React from 'react';
2
- export type SpinnerProps = {
3
- /**
4
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
5
- */
6
- testId?: string;
7
- };
8
- declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & {
9
- children?: React.ReactNode;
10
- } & React.RefAttributes<HTMLDivElement>>;
11
- export default Spinner;
@@ -1,6 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- const Spinner = forwardRef(function Spinner({ children, testId = 'store-spinner', ...otherProps }, ref) {
3
- return (React.createElement("span", { ref: ref, "data-fs-spinner": true, "data-testid": testId, ...otherProps }));
4
- });
5
- export default Spinner;
6
- //# sourceMappingURL=Spinner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../../../src/components/atoms/Spinner/Spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AASzC,MAAM,OAAO,GAAG,UAAU,CACxB,SAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,GAAG,UAAU,EAAE,EAAE,GAAG;IACzE,OAAO,CACL,8BAAM,GAAG,EAAE,GAAG,0CAA+B,MAAM,KAAM,UAAU,GAAI,CACxE,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './Spinner';
2
- export type { SpinnerProps } from './Spinner';
@@ -1,2 +0,0 @@
1
- export { default } from './Spinner';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/atoms/Spinner/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import type { ButtonProps } from '@faststore/components';
3
- export interface LoadingButtonProps extends ButtonProps {
4
- /**
5
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
- */
7
- testId?: string;
8
- /**
9
- * The current loading state of the button.
10
- */
11
- loading: boolean;
12
- }
13
- declare const LoadingButton: React.ForwardRefExoticComponent<LoadingButtonProps & React.RefAttributes<HTMLButtonElement>>;
14
- export default LoadingButton;
@@ -1,8 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import { Button } from '@faststore/components';
3
- import Spinner from '../../atoms/Spinner';
4
- const LoadingButton = forwardRef(function LoadingButton({ children, loading, testId = 'store-loading-button', ...otherProps }, ref) {
5
- return (React.createElement(Button, { ref: ref, "data-fs-loading-button": true, testId: testId, ...otherProps }, loading ? React.createElement(Spinner, null) : children));
6
- });
7
- export default LoadingButton;
8
- //# sourceMappingURL=LoadingButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoadingButton.js","sourceRoot":"","sources":["../../../../src/components/molecules/LoadingButton/LoadingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,OAAO,OAAO,MAAM,qBAAqB,CAAA;AAazC,MAAM,aAAa,GAAG,UAAU,CAC9B,SAAS,aAAa,CACpB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,sBAAsB,EAAE,GAAG,UAAU,EAAE,EACrE,GAAG;IAEH,OAAO,CACL,oBAAC,MAAM,IAAC,GAAG,EAAE,GAAG,kCAAyB,MAAM,EAAE,MAAM,KAAM,UAAU,IACpE,OAAO,CAAC,CAAC,CAAC,oBAAC,OAAO,OAAG,CAAC,CAAC,CAAC,QAAQ,CAC1B,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './LoadingButton';
2
- export type { LoadingButtonProps } from './LoadingButton';
@@ -1,2 +0,0 @@
1
- export { default } from './LoadingButton';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/LoadingButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,47 +0,0 @@
1
- import React from 'react';
2
- import type { AriaAttributes } from 'react';
3
- import type { PriceProps } from '@faststore/components';
4
- import type { SliderProps } from '../../atoms/Slider';
5
- export type PriceRangeProps = SliderProps & {
6
- /**
7
- * The current use case variant for prices.
8
- */
9
- variant?: PriceProps['variant'];
10
- /**
11
- * Formatter function that transforms the raw price value and render the result.
12
- */
13
- formatter: PriceProps['formatter'];
14
- /**
15
- * Returns the value of element's class content attribute.
16
- */
17
- className?: string;
18
- /**
19
- * Defines a string value that labels the current element.
20
- */
21
- 'aria-label'?: AriaAttributes['aria-label'];
22
- };
23
- type PriceRangeRefType = {
24
- setPriceRangeValues: (values: {
25
- min: number;
26
- max: number;
27
- }) => void;
28
- };
29
- declare const PriceRange: React.ForwardRefExoticComponent<SliderProps & {
30
- /**
31
- * The current use case variant for prices.
32
- */
33
- variant?: PriceProps['variant'];
34
- /**
35
- * Formatter function that transforms the raw price value and render the result.
36
- */
37
- formatter: PriceProps['formatter'];
38
- /**
39
- * Returns the value of element's class content attribute.
40
- */
41
- className?: string | undefined;
42
- /**
43
- * Defines a string value that labels the current element.
44
- */
45
- 'aria-label'?: AriaAttributes['aria-label'];
46
- } & React.RefAttributes<PriceRangeRefType | undefined>>;
47
- export default PriceRange;
@@ -1,28 +0,0 @@
1
- import React, { useRef, useImperativeHandle, forwardRef } from 'react';
2
- import { Price } from '@faststore/components';
3
- import Slider from '../../atoms/Slider';
4
- const PriceRange = forwardRef(function PriceRange({ className, formatter, max, min, step, onChange, onEnd, testId = 'store-price-range', variant, 'aria-label': ariaLabel, }, ref) {
5
- const sliderRef = useRef();
6
- useImperativeHandle(ref, () => ({
7
- setPriceRangeValues: (values) => {
8
- onChange?.(values);
9
- sliderRef.current?.setSliderValues(values);
10
- },
11
- }));
12
- return (React.createElement("div", { "data-fs-price-range": true, "data-testid": testId, className: className },
13
- React.createElement(Slider, { ref: sliderRef, min: min, max: max, step: step, onEnd: onEnd, "aria-label": ariaLabel, onChange: (value) => onChange?.(value), minValueLabelComponent: (minValue) => {
14
- const minPercent = (minValue / max.absolute) * 100;
15
- return (React.createElement(Price, { value: minValue, variant: variant, formatter: formatter, "data-price-range-value-label": "min", style: {
16
- position: 'absolute',
17
- left: `calc(${minPercent}% + (${8 - minPercent * 0.2}px))`,
18
- } }));
19
- }, maxValueLabelComponent: (maxValue) => {
20
- const maxPercent = (maxValue / max.absolute) * 100;
21
- return (React.createElement(Price, { formatter: formatter, variant: variant, value: maxValue, "data-price-range-value-label": "max", style: {
22
- position: 'absolute',
23
- left: `calc(${maxPercent}% + (${8 - maxPercent * 0.2}px))`,
24
- } }));
25
- } })));
26
- });
27
- export default PriceRange;
28
- //# sourceMappingURL=PriceRange.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PriceRange.js","sourceRoot":"","sources":["../../../../src/components/molecules/PriceRange/PriceRange.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGtE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAG7C,OAAO,MAAM,MAAM,oBAAoB,CAAA;AA0BvC,MAAM,UAAU,GAAG,UAAU,CAC3B,SAAS,UAAU,CACjB,EACE,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,MAAM,GAAG,mBAAmB,EAC5B,OAAO,EACP,YAAY,EAAE,SAAS,GACxB,EACD,GAAG;IAEH,MAAM,SAAS,GAAG,MAAM,EAEpB,CAAA;IAEJ,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,mBAAmB,EAAE,CAAC,MAAoC,EAAE,EAAE;YAC5D,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAA;YAClB,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;QAC5C,CAAC;KACF,CAAC,CAAC,CAAA;IAEH,OAAO,CACL,yEAAsC,MAAM,EAAE,SAAS,EAAE,SAAS;QAChE,oBAAC,MAAM,IACL,GAAG,EAAE,SAAS,EACd,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,gBACA,SAAS,EACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EACtC,sBAAsB,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACnC,MAAM,UAAU,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAA;gBAElD,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,kCACS,KAAK,EAClC,KAAK,EAAE;wBACL,QAAQ,EAAE,UAAU;wBACpB,IAAI,EAAE,QAAQ,UAAU,QAAQ,CAAC,GAAG,UAAU,GAAG,GAAG,MAAM;qBAC3D,GACD,CACH,CAAA;YACH,CAAC,EACD,sBAAsB,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACnC,MAAM,UAAU,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAA;gBAElD,OAAO,CACL,oBAAC,KAAK,IACJ,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,QAAQ,kCACc,KAAK,EAClC,KAAK,EAAE;wBACL,QAAQ,EAAE,UAAU;wBACpB,IAAI,EAAE,QAAQ,UAAU,QAAQ,CAAC,GAAG,UAAU,GAAG,GAAG,MAAM;qBAC3D,GACD,CACH,CAAA;YACH,CAAC,GACD,CACE,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './PriceRange';
2
- export type { PriceRangeProps } from './PriceRange';
@@ -1,2 +0,0 @@
1
- export { default } from './PriceRange';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/PriceRange/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -1,182 +0,0 @@
1
- /**
2
- * This code is inspired by the work of [sandra-lewis](https://codesandbox.io/u/sandra-lewis)
3
- */
4
- import React, {
5
- useState,
6
- useMemo,
7
- useImperativeHandle,
8
- forwardRef,
9
- } from 'react'
10
- import type { ReactNode } from 'react'
11
-
12
- interface Range {
13
- absolute: number
14
- selected: number
15
- }
16
-
17
- export type SliderProps = {
18
- /**
19
- * The minimum value of the slider.
20
- */
21
- min: Range
22
- /**
23
- * The maximum value of the slider.
24
- */
25
- max: Range
26
- /**
27
- * Specifies the number interval to be used in the inputs.
28
- */
29
- step?: number
30
- /**
31
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
32
- *
33
- * @default 'store-slider'
34
- */
35
- testId?: string
36
- /**
37
- * Callback that fires when the slider value changes.
38
- */
39
- onChange?: (value: { min: number; max: number }) => void
40
- /**
41
- * Callback that fires when the slider value ends changing.
42
- */
43
- onEnd?: (value: { min: number; max: number }) => void
44
- /**
45
- * A function used to set a human-readable value text based on the slider's current value.
46
- */
47
- getAriaValueText?(value: number, thumb?: 'min' | 'max'): string
48
- /**
49
- * Returns the value of element's class content attribute.
50
- */
51
- className?: string
52
- /**
53
- * Component that renders min value label above the left thumb.
54
- */
55
- minValueLabelComponent?: (minValue: number) => ReactNode
56
- /**
57
- * Component that renders max value label above the right thumb.
58
- */
59
- maxValueLabelComponent?: (maxValue: number) => ReactNode
60
- }
61
-
62
- type SliderRefType = {
63
- setSliderValues: (values: { min: number; max: number }) => void
64
- }
65
-
66
- const percent = (value: number, min: number, max: number) =>
67
- Math.round(((value - min) / (max - min)) * 100)
68
-
69
- const Slider = forwardRef<SliderRefType | undefined, SliderProps>(
70
- function Slider(
71
- {
72
- min,
73
- max,
74
- onChange,
75
- onEnd,
76
- testId = 'store-slider',
77
- getAriaValueText,
78
- className,
79
- step,
80
- minValueLabelComponent,
81
- maxValueLabelComponent,
82
- },
83
- ref
84
- ) {
85
- const widthPercent = useMemo(
86
- () => (max.absolute - min.absolute) / 100,
87
- [max.absolute, min.absolute]
88
- )
89
- const [minPercent, setMinPercent] = useState(() =>
90
- percent(min.selected, min.absolute, max.absolute)
91
- )
92
-
93
- const [maxPercent, setMaxPercent] = useState(() =>
94
- percent(max.selected, min.absolute, max.absolute)
95
- )
96
-
97
- const [minVal, setMinVal] = useState(() =>
98
- Math.round(min.absolute + minPercent * widthPercent)
99
- )
100
- const [maxVal, setMaxVal] = useState(() =>
101
- Math.round(min.absolute + maxPercent * widthPercent)
102
- )
103
-
104
- useImperativeHandle(ref, () => ({
105
- setSliderValues: (values: { min: number; max: number }) => {
106
- const sliderMinValue = Math.min(Number(values.min), maxVal)
107
- setMinVal(sliderMinValue)
108
- setMinPercent(percent(sliderMinValue, min.absolute, max.absolute))
109
-
110
- if (values.max > max.absolute) {
111
- setMaxVal(max.absolute)
112
- setMaxPercent(percent(max.absolute, min.absolute, max.absolute))
113
- return
114
- }
115
-
116
- const sliderMaxValue = Math.max(Number(values.max), minVal)
117
- setMaxVal(sliderMaxValue)
118
- setMaxPercent(percent(sliderMaxValue, min.absolute, max.absolute))
119
- },
120
- }))
121
-
122
- return (
123
- <div data-fs-slider data-testid={testId} className={className}>
124
- <div
125
- data-slider-range
126
- style={{
127
- left: `${minPercent}%`,
128
- width: `${maxPercent - minPercent}%`,
129
- }}
130
- />
131
- <input
132
- type="range"
133
- min={Math.round(min.absolute)}
134
- max={Math.round(max.absolute)}
135
- value={minVal}
136
- step={step}
137
- onMouseUp={() => onEnd?.({ min: minVal, max: maxVal })}
138
- onTouchEnd={() => onEnd?.({ min: minVal, max: maxVal })}
139
- onChange={(event) => {
140
- const minValue = Math.min(Number(event.target.value), maxVal)
141
-
142
- setMinVal(minValue)
143
- setMinPercent(percent(minValue, min.absolute, max.absolute))
144
- onChange?.({ min: minValue, max: maxVal })
145
- }}
146
- data-slider-thumb="left"
147
- aria-valuemin={min.absolute}
148
- aria-valuemax={max.absolute}
149
- aria-valuenow={minVal}
150
- aria-label={String(minVal)}
151
- aria-labelledby={getAriaValueText?.(minVal, 'min')}
152
- />
153
- {minValueLabelComponent && minValueLabelComponent(minVal)}
154
- <input
155
- type="range"
156
- min={Math.round(min.absolute)}
157
- max={Math.round(max.absolute)}
158
- value={maxVal}
159
- step={step}
160
- onMouseUp={() => onEnd?.({ min: minVal, max: maxVal })}
161
- onTouchEnd={() => onEnd?.({ min: minVal, max: maxVal })}
162
- onChange={(event) => {
163
- const maxValue = Math.max(Number(event.target.value), minVal)
164
-
165
- setMaxVal(maxValue)
166
- setMaxPercent(percent(maxValue, min.absolute, max.absolute))
167
- onChange?.({ min: minVal, max: maxValue })
168
- }}
169
- data-slider-thumb="right"
170
- aria-valuemin={min.absolute}
171
- aria-valuemax={max.absolute}
172
- aria-valuenow={maxVal}
173
- aria-label={String(maxVal)}
174
- aria-labelledby={getAriaValueText?.(maxVal, 'max')}
175
- />
176
- {maxValueLabelComponent && maxValueLabelComponent(maxVal)}
177
- </div>
178
- )
179
- }
180
- )
181
-
182
- export default Slider
@@ -1,2 +0,0 @@
1
- export { default } from './Slider'
2
- export type { SliderProps } from './Slider'
@@ -1,19 +0,0 @@
1
- import type { PropsWithChildren } from 'react'
2
- import React, { forwardRef } from 'react'
3
-
4
- export type SpinnerProps = {
5
- /**
6
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
7
- */
8
- testId?: string
9
- }
10
-
11
- const Spinner = forwardRef<HTMLDivElement, PropsWithChildren<SpinnerProps>>(
12
- function Spinner({ children, testId = 'store-spinner', ...otherProps }, ref) {
13
- return (
14
- <span ref={ref} data-fs-spinner data-testid={testId} {...otherProps} />
15
- )
16
- }
17
- )
18
-
19
- export default Spinner
@@ -1,2 +0,0 @@
1
- export { default } from './Spinner'
2
- export type { SpinnerProps } from './Spinner'
@@ -1,31 +0,0 @@
1
- import React, { forwardRef } from 'react'
2
-
3
- import { Button } from '@faststore/components'
4
- import type { ButtonProps } from '@faststore/components'
5
- import Spinner from '../../atoms/Spinner'
6
-
7
- export interface LoadingButtonProps extends ButtonProps {
8
- /**
9
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
10
- */
11
- testId?: string
12
- /**
13
- * The current loading state of the button.
14
- */
15
- loading: boolean
16
- }
17
-
18
- const LoadingButton = forwardRef<HTMLButtonElement, LoadingButtonProps>(
19
- function LoadingButton(
20
- { children, loading, testId = 'store-loading-button', ...otherProps },
21
- ref
22
- ) {
23
- return (
24
- <Button ref={ref} data-fs-loading-button testId={testId} {...otherProps}>
25
- {loading ? <Spinner /> : children}
26
- </Button>
27
- )
28
- }
29
- )
30
-
31
- export default LoadingButton
@@ -1,2 +0,0 @@
1
- export { default } from './LoadingButton'
2
- export type { LoadingButtonProps } from './LoadingButton'
@@ -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
@@ -1,2 +0,0 @@
1
- export { default } from './PriceRange'
2
- export type { PriceRangeProps } from './PriceRange'