@faststore/components 2.0.44-alpha.0 → 2.0.48-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 (50) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/assets/Heart.d.ts +3 -0
  3. package/dist/assets/Heart.js +7 -0
  4. package/dist/assets/Heart.js.map +1 -0
  5. package/dist/assets/Minus.d.ts +3 -0
  6. package/dist/assets/Minus.js +7 -0
  7. package/dist/assets/Minus.js.map +1 -0
  8. package/dist/assets/Plus.d.ts +3 -0
  9. package/dist/assets/Plus.js +8 -0
  10. package/dist/assets/Plus.js.map +1 -0
  11. package/dist/assets/Star.d.ts +3 -0
  12. package/dist/assets/Star.js +7 -0
  13. package/dist/assets/Star.js.map +1 -0
  14. package/dist/assets/index.d.ts +4 -0
  15. package/dist/assets/index.js +4 -0
  16. package/dist/assets/index.js.map +1 -1
  17. package/dist/index.d.ts +6 -0
  18. package/dist/index.js +3 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/molecules/Alert/Alert.d.ts +29 -0
  21. package/dist/molecules/Alert/Alert.js +21 -0
  22. package/dist/molecules/Alert/Alert.js.map +1 -0
  23. package/dist/molecules/Alert/index.d.ts +2 -0
  24. package/dist/molecules/Alert/index.js +2 -0
  25. package/dist/molecules/Alert/index.js.map +1 -0
  26. package/dist/molecules/QuantitySelector/QuantitySelector.d.ts +31 -0
  27. package/dist/molecules/QuantitySelector/QuantitySelector.js +38 -0
  28. package/dist/molecules/QuantitySelector/QuantitySelector.js.map +1 -0
  29. package/dist/molecules/QuantitySelector/index.d.ts +2 -0
  30. package/dist/molecules/QuantitySelector/index.js +2 -0
  31. package/dist/molecules/QuantitySelector/index.js.map +1 -0
  32. package/dist/molecules/Rating/Rating.d.ts +31 -0
  33. package/dist/molecules/Rating/Rating.js +26 -0
  34. package/dist/molecules/Rating/Rating.js.map +1 -0
  35. package/dist/molecules/Rating/index.d.ts +2 -0
  36. package/dist/molecules/Rating/index.js +2 -0
  37. package/dist/molecules/Rating/index.js.map +1 -0
  38. package/package.json +4 -4
  39. package/src/assets/Heart.tsx +19 -0
  40. package/src/assets/Minus.tsx +28 -0
  41. package/src/assets/Plus.tsx +38 -0
  42. package/src/assets/Star.tsx +19 -0
  43. package/src/assets/index.ts +4 -0
  44. package/src/index.ts +6 -0
  45. package/src/molecules/Alert/Alert.tsx +85 -0
  46. package/src/molecules/Alert/index.ts +2 -0
  47. package/src/molecules/QuantitySelector/QuantitySelector.tsx +120 -0
  48. package/src/molecules/QuantitySelector/index.ts +2 -0
  49. package/src/molecules/Rating/Rating.tsx +107 -0
  50. package/src/molecules/Rating/index.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 2.0.48-alpha.0 (2023-01-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * Adds `Alert` Component ([#1590](https://github.com/vtex/faststore/issues/1590)) ([6e1cc00](https://github.com/vtex/faststore/commit/6e1cc004a5f3ae8674798fe6a36fd2a5d1451d7c))
12
+
13
+
14
+
15
+ ## [2.0.47-alpha.0](https://github.com/vtex/faststore/compare/v2.0.46-alpha.0...v2.0.47-alpha.0) (2023-01-13)
16
+
17
+
18
+ ### Features
19
+
20
+ * Adds `QuantitySelector` component ([#1597](https://github.com/vtex/faststore/issues/1597)) ([a587155](https://github.com/vtex/faststore/commit/a5871559a4a28754dd9868b7f85c92a5bde52917))
21
+
22
+
23
+
6
24
  ## [2.0.44-alpha.0](https://github.com/vtex/faststore/compare/v2.0.43-alpha.0...v2.0.44-alpha.0) (2023-01-11)
7
25
 
8
26
  **Note:** Version bump only for package @faststore/components
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ declare const Heart: FC;
3
+ export default Heart;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ // Icon from Phosphor Icons
3
+ const Heart = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 256 256", strokeWidth: "16", width: 24, height: 24 },
4
+ React.createElement("rect", { width: "256", height: "256", fill: "none" }),
5
+ React.createElement("path", { d: "M128,216S28,160,28,92A52,52,0,0,1,128,72h0A52,52,0,0,1,228,92C228,160,128,216,128,216Z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })));
6
+ export default Heart;
7
+ //# sourceMappingURL=Heart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Heart.js","sourceRoot":"","sources":["../../src/assets/Heart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,2BAA2B;AAC3B,MAAM,KAAK,GAAO,GAAG,EAAE,CAAC,CACtB,6BACE,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,aAAa,EACrB,WAAW,EAAC,IAAI,EAChB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE;IAEV,8BAAM,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,GAAQ;IAClD,8BAAM,CAAC,EAAC,wFAAwF,EAAE,MAAM,EAAC,cAAc,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,GAAQ,CACxK,CACP,CAAA;AAED,eAAe,KAAK,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ declare const Minus: FC;
3
+ export default Minus;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ // Icon from Phosphor Icons
3
+ const Minus = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 256 256", strokeWidth: "24", width: 16, height: 16 },
4
+ React.createElement("rect", { width: "256", height: "256", fill: "none" }),
5
+ React.createElement("line", { x1: "40", y1: "128", x2: "216", y2: "128", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })));
6
+ export default Minus;
7
+ //# sourceMappingURL=Minus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Minus.js","sourceRoot":"","sources":["../../src/assets/Minus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,2BAA2B;AAC3B,MAAM,KAAK,GAAO,GAAG,EAAE,CAAC,CACtB,6BACE,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,aAAa,EACrB,WAAW,EAAC,IAAI,EAChB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE;IAEV,8BAAM,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,GAAQ;IAClD,8BACE,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,KAAK,EACR,EAAE,EAAC,KAAK,EACR,EAAE,EAAC,KAAK,EACR,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GAChB,CACJ,CACP,CAAA;AAED,eAAe,KAAK,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ declare const Plus: FC;
3
+ export default Plus;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ // Icon from Phosphor Icons
3
+ const Plus = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 256 256", strokeWidth: "24", width: 16, height: 16 },
4
+ React.createElement("rect", { width: "256", height: "256", fill: "none" }),
5
+ React.createElement("line", { x1: "40", y1: "128", x2: "216", y2: "128", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
6
+ React.createElement("line", { x1: "128", y1: "40", x2: "128", y2: "216", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })));
7
+ export default Plus;
8
+ //# sourceMappingURL=Plus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plus.js","sourceRoot":"","sources":["../../src/assets/Plus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,2BAA2B;AAC3B,MAAM,IAAI,GAAO,GAAG,EAAE,CAAC,CACrB,6BACE,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,aAAa,EACrB,WAAW,EAAC,IAAI,EAChB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE;IAEV,8BAAM,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,GAAQ;IAClD,8BACE,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,KAAK,EACR,EAAE,EAAC,KAAK,EACR,EAAE,EAAC,KAAK,EACR,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GAChB;IACR,8BACE,EAAE,EAAC,KAAK,EACR,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,KAAK,EACR,EAAE,EAAC,KAAK,EACR,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GAChB,CACJ,CACP,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ declare const Star: FC;
3
+ export default Star;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ // Icon from Phosphor Icons
3
+ const Star = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 256 256", strokeWidth: "16", width: 24, height: 24 },
4
+ React.createElement("rect", { width: "256", height: "256", fill: "none" }),
5
+ React.createElement("path", { d: "M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })));
6
+ export default Star;
7
+ //# sourceMappingURL=Star.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Star.js","sourceRoot":"","sources":["../../src/assets/Star.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,2BAA2B;AAC3B,MAAM,IAAI,GAAO,GAAG,EAAE,CAAC,CACrB,6BACE,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,aAAa,EACrB,WAAW,EAAC,IAAI,EAChB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE;IAEV,8BAAM,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,GAAQ;IAClD,8BAAM,CAAC,EAAC,uWAAuW,EAAC,MAAM,EAAC,cAAc,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,GAAQ,CACtb,CACP,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -2,10 +2,14 @@ export { default as ArrowRight } from './ArrowRight';
2
2
  export { default as ArrowElbowDownRight } from './ArrowElbowDownRight';
3
3
  export { default as CaretDown } from './CaretDown';
4
4
  export { default as Checked } from './Checked';
5
+ export { default as Heart } from './Heart';
5
6
  export { default as House } from './House';
7
+ export { default as Minus } from './Minus';
8
+ export { default as Plus } from './Plus';
6
9
  export { default as MinusCircle } from './MinusCircle';
7
10
  export { default as PlusCircle } from './PlusCircle';
8
11
  export { default as Ruler } from './Ruler';
9
12
  export { default as ShoppingCart } from './ShoppingCart';
13
+ export { default as Star } from './Star';
10
14
  export { default as X } from './X';
11
15
  export { default as XCircle } from './XCircle';
@@ -2,11 +2,15 @@ export { default as ArrowRight } from './ArrowRight';
2
2
  export { default as ArrowElbowDownRight } from './ArrowElbowDownRight';
3
3
  export { default as CaretDown } from './CaretDown';
4
4
  export { default as Checked } from './Checked';
5
+ export { default as Heart } from './Heart';
5
6
  export { default as House } from './House';
7
+ export { default as Minus } from './Minus';
8
+ export { default as Plus } from './Plus';
6
9
  export { default as MinusCircle } from './MinusCircle';
7
10
  export { default as PlusCircle } from './PlusCircle';
8
11
  export { default as Ruler } from './Ruler';
9
12
  export { default as ShoppingCart } from './ShoppingCart';
13
+ export { default as Star } from './Star';
10
14
  export { default as X } from './X';
11
15
  export { default as XCircle } from './XCircle';
12
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,KAAK,CAAA;AAClC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,KAAK,CAAA;AAClC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA"}
package/dist/index.d.ts CHANGED
@@ -26,6 +26,8 @@ export type { SelectProps } from './atoms/Select';
26
26
  export { default as SROnly } from './atoms/SROnly';
27
27
  export { default as Accordion, AccordionItem, AccordionButton, AccordionPanel, } from './molecules/Accordion';
28
28
  export type { AccordionProps, AccordionItemProps, AccordionButtonProps, AccordionPanelProps, } from './molecules/Accordion';
29
+ export { default as Alert } from './molecules/Alert';
30
+ export type { AlertProps } from './molecules/Alert';
29
31
  export { default as BuyButton } from './molecules/BuyButton';
30
32
  export { default as CheckboxField } from './molecules/CheckboxField';
31
33
  export type { CheckboxFieldProps } from './molecules/CheckboxField';
@@ -41,6 +43,8 @@ export { default as LinkButton } from './molecules/LinkButton';
41
43
  export type { LinkButtonProps } from './molecules/LinkButton';
42
44
  export { default as RadioField } from './molecules/RadioField';
43
45
  export type { RadioFieldProps } from './molecules/RadioField';
46
+ export { default as Rating } from './molecules/Rating';
47
+ export type { RatingProps } from './molecules/Rating';
44
48
  export { default as SelectField } from './molecules/SelectField';
45
49
  export type { SelectFieldProps } from './molecules/SelectField';
46
50
  export { Table, TableBody, TableCell, TableFooter, TableHead, TableRow, } from './molecules/Table';
@@ -51,5 +55,7 @@ export { default as Toggle } from './molecules/Toggle';
51
55
  export type { ToggleProps } from './molecules/Toggle';
52
56
  export { default as ToggleField } from './molecules/ToggleField';
53
57
  export type { ToggleFieldProps } from './molecules/ToggleField';
58
+ export { default as QuantitySelector } from './molecules/QuantitySelector';
59
+ export type { QuantitySelectorProps } from './molecules/QuantitySelector';
54
60
  export { default as Hero, HeroImage, HeroHeading } from './organisms/Hero';
55
61
  export type { HeroProps, HeroImageProps, HeroHeadingProps, } from './organisms/Hero';
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ export { default as Select } from './atoms/Select';
16
16
  export { default as SROnly } from './atoms/SROnly';
17
17
  // Molecules
18
18
  export { default as Accordion, AccordionItem, AccordionButton, AccordionPanel, } from './molecules/Accordion';
19
+ export { default as Alert } from './molecules/Alert';
19
20
  export { default as BuyButton } from './molecules/BuyButton';
20
21
  export { default as CheckboxField } from './molecules/CheckboxField';
21
22
  export { default as IconButton } from './molecules/IconButton';
@@ -24,11 +25,13 @@ export { default as Dropdown, DropdownButton, DropdownItem, DropdownMenu, } from
24
25
  export { default as InputField } from './molecules/InputField';
25
26
  export { default as LinkButton } from './molecules/LinkButton';
26
27
  export { default as RadioField } from './molecules/RadioField';
28
+ export { default as Rating } from './molecules/Rating';
27
29
  export { default as SelectField } from './molecules/SelectField';
28
30
  export { Table, TableBody, TableCell, TableFooter, TableHead, TableRow, } from './molecules/Table';
29
31
  export { default as Tag } from './molecules/Tag';
30
32
  export { default as Toggle } from './molecules/Toggle';
31
33
  export { default as ToggleField } from './molecules/ToggleField';
34
+ export { default as QuantitySelector } from './molecules/QuantitySelector';
32
35
  // Organisms
33
36
  export { default as Hero, HeroImage, HeroHeading } from './organisms/Hero';
34
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,cAAc,UAAU,CAAA;AAExB,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAA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O,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,sBAAsB,CAAA;AAO7B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEhE,OAAO,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,GACT,MAAM,mBAAmB,CAAA;AAS1B,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEhE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAG1E,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,29 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ import { LinkProps } from '../../index';
4
+ import type { ReactNode, MouseEvent } from 'react';
5
+ export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
6
+ /**
7
+ * ID to find this component in testing tools (e.g.: cypress,
8
+ * testing-library, and jest).
9
+ */
10
+ testId?: string;
11
+ /**
12
+ * Icon component for additional customization.
13
+ */
14
+ icon?: ReactNode;
15
+ /**
16
+ * Enables dismissible feature.
17
+ */
18
+ dismissible?: boolean;
19
+ /**
20
+ * Extends all Link Props.
21
+ */
22
+ link?: LinkProps;
23
+ /**
24
+ * Function called when dismiss button is clicked.
25
+ */
26
+ onClose?: (event: MouseEvent<HTMLElement>) => void;
27
+ }
28
+ declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
29
+ export default Alert;
@@ -0,0 +1,21 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useCallback } from 'react';
3
+ import { Button, Link, Icon } from '../../index';
4
+ import { X } from '../../assets';
5
+ const Alert = forwardRef(function Alert({ testId = 'fs-alert', children, icon, dismissible, link, onClose, ...otherProps }, ref) {
6
+ const handleClose = useCallback((event) => {
7
+ if (event.defaultPrevented) {
8
+ return;
9
+ }
10
+ onClose?.(event);
11
+ }, [onClose]);
12
+ return (React.createElement("div", { ref: ref, role: "alert", "data-fs-alert": true, "data-testid": testId, "data-fs-alert-dismissible": dismissible, ...otherProps },
13
+ icon && React.createElement(Icon, { component: icon }),
14
+ React.createElement("p", { "data-fs-alert-content": true }, children),
15
+ link && (React.createElement(Link, { "data-fs-alert-link": true, variant: "inline", ...link })),
16
+ dismissible && (React.createElement(Button, { "data-fs-alert-button": true, "aria-label": "Close", onClick: handleClose },
17
+ React.createElement("span", null,
18
+ React.createElement(Icon, { component: React.createElement(X, null) }))))));
19
+ });
20
+ export default Alert;
21
+ //# sourceMappingURL=Alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../src/molecules/Alert/Alert.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAa,MAAM,aAAa,CAAA;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AA6BhC,MAAM,KAAK,GAAG,UAAU,CAA6B,SAAS,KAAK,CAAC,EAClE,MAAM,GAAG,UAAU,EACnB,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,OAAO,EACP,GAAG,UAAU,EACd,EACC,GAAG;IACH,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,KAA8B,EAAE,EAAE;QACjC,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC1B,OAAM;SACP;QAED,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAA;IACD,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,OAAO,wCAEC,MAAM,+BACQ,WAAW,KAClC,UAAU;QAGb,IAAI,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,GAAI;QAElC,4DAA0B,QAAQ,CAAK;QAEtC,IAAI,IAAI,CACP,oBAAC,IAAI,gCAAoB,OAAO,EAAC,QAAQ,KAAK,IAAI,GAAI,CACvD;QAEA,WAAW,IAAI,CACd,oBAAC,MAAM,gDAAiC,OAAO,EAAC,OAAO,EAAE,WAAW;YAClE;gBACE,oBAAC,IAAI,IAAC,SAAS,EAAE,oBAAC,CAAC,OAAG,GAAI,CACrB,CACA,CACV,CACG,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,KAAK,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default } from './Alert';
2
+ export type { AlertProps } from './Alert';
@@ -0,0 +1,2 @@
1
+ export { default } from './Alert';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/Alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ export interface QuantitySelectorProps {
3
+ /**
4
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
5
+ *
6
+ * @default 'fs-quantity-selector'
7
+ */
8
+ testId?: string;
9
+ /**
10
+ * The maximum value the quantity selector can receive
11
+ */
12
+ max?: number;
13
+ /**
14
+ * The minimum value the quantity selector can receive
15
+ */
16
+ min?: number;
17
+ /**
18
+ * The initial value for quantity selector
19
+ */
20
+ initial?: number;
21
+ /**
22
+ * Specifies that the whole quantity selector component should be disabled.
23
+ */
24
+ disabled?: boolean;
25
+ /**
26
+ * Event emitted when value is changed
27
+ */
28
+ onChange?: (value: number) => void;
29
+ }
30
+ declare const QuantitySelector: ({ max, min, initial, disabled, onChange, testId, ...otherProps }: QuantitySelectorProps) => JSX.Element;
31
+ export default QuantitySelector;
@@ -0,0 +1,38 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { IconButton, Input } from '../../index';
3
+ import { Minus, Plus } from '../../assets';
4
+ const QuantitySelector = ({ max, min = 1, initial, disabled = false, onChange, testId = 'fs-quantity-selector', ...otherProps }) => {
5
+ const [quantity, setQuantity] = useState(initial ?? min);
6
+ const isLeftDisabled = quantity === min;
7
+ const isRightDisabled = quantity === max;
8
+ const changeQuantity = (increaseValue) => {
9
+ const quantityValue = validateQuantityBounds(quantity + increaseValue);
10
+ onChange?.(quantityValue);
11
+ setQuantity(quantityValue);
12
+ };
13
+ const increase = () => changeQuantity(1);
14
+ const decrease = () => changeQuantity(-1);
15
+ function validateQuantityBounds(n) {
16
+ const maxValue = min ? Math.max(n, min) : n;
17
+ return max ? Math.min(maxValue, max) : maxValue;
18
+ }
19
+ function validateInput(e) {
20
+ const val = e.currentTarget.value;
21
+ if (!Number.isNaN(Number(val))) {
22
+ setQuantity(() => {
23
+ const quantityValue = validateQuantityBounds(Number(val));
24
+ onChange?.(quantityValue);
25
+ return quantityValue;
26
+ });
27
+ }
28
+ }
29
+ useEffect(() => {
30
+ initial && setQuantity(initial);
31
+ }, [initial]);
32
+ return (React.createElement("div", { "data-fs-quantity-selector": disabled ? 'disabled' : 'true', "data-testid": testId, ...otherProps },
33
+ React.createElement(IconButton, { "data-quantity-selector-button": "left", icon: React.createElement(Minus, null), "aria-label": "Decrement Quantity", "aria-controls": "quantity-selector-input", disabled: isLeftDisabled || disabled, onClick: decrease, testId: `${testId}-left-button` }),
34
+ React.createElement(Input, { "data-quantity-selector-input": true, id: "quantity-selector-input", "aria-label": "Quantity", value: quantity, onChange: validateInput, disabled: disabled }),
35
+ React.createElement(IconButton, { "data-quantity-selector-button": "right", "aria-controls": "quantity-selector-input", "aria-label": "Increment Quantity", disabled: isRightDisabled || disabled, icon: React.createElement(Plus, null), onClick: increase, testId: `${testId}-right-button` })));
36
+ };
37
+ export default QuantitySelector;
38
+ //# sourceMappingURL=QuantitySelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuantitySelector.js","sourceRoot":"","sources":["../../../src/molecules/QuantitySelector/QuantitySelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AA+B1C,MAAM,gBAAgB,GAAG,CAAC,EACxB,GAAG,EACH,GAAG,GAAG,CAAC,EACP,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,MAAM,GAAG,sBAAsB,EAC/B,GAAG,UAAU,EACS,EAAE,EAAE;IAC1B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAS,OAAO,IAAI,GAAG,CAAC,CAAA;IAEhE,MAAM,cAAc,GAAG,QAAQ,KAAK,GAAG,CAAA;IACvC,MAAM,eAAe,GAAG,QAAQ,KAAK,GAAG,CAAA;IAExC,MAAM,cAA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,MAAM,iBAC5C,MAAM,KACf,UAAU;QAEd,oBAAC,UAAU,qCACqB,MAAM,EACpC,IAAI,EAAE,oBAAC,KAAK,OAAG,gBACJ,oBAAoB,mBACjB,yBAAyB,EACvC,QAAQ,EAAE,cAAc,IAAI,QAAQ,EACpC,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,GAAG,MAAM,cAAc,GAC/B;QACF,oBAAC,KAAK,0CAEJ,EAAE,EAAC,yBAAyB,gBACjB,UAAU,EACrB,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,QAAQ,GAClB;QACF,oBAAC,UAAU,qCACqB,OAAO,mBACvB,yBAAyB,gBAC5B,oBAAoB,EAC/B,QAAQ,EAAE,eAAe,IAAI,QAAQ,EACrC,IAAI,EAAE,oBAAC,IAAI,OAAG,EACd,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,GAAG,MAAM,eAAe,GAChC,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default } from './QuantitySelector';
2
+ export type { QuantitySelectorProps } from './QuantitySelector';
@@ -0,0 +1,2 @@
1
+ export { default } from './QuantitySelector';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/QuantitySelector/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { HTMLAttributes } from 'react';
4
+ export interface RatingProps extends Omit<HTMLAttributes<HTMLUListElement>, 'onChange'> {
5
+ /**
6
+ * The length of child elements.
7
+ */
8
+ length?: number;
9
+ /**
10
+ * The current value of the rating, based on the quantity of child elements.
11
+ */
12
+ value: number;
13
+ /**
14
+ * A React component that will be rendered as an icon.
15
+ */
16
+ icon: ReactNode;
17
+ /**
18
+ * Function to be triggered when Rating option change. This should only be used if you and an actionable rating list.
19
+ */
20
+ onChange?: (value: number) => void;
21
+ /**
22
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
23
+ */
24
+ testId?: string;
25
+ }
26
+ export interface RatingItemProps {
27
+ 'data-fs-rating-item'?: 'full' | 'partial' | 'empty';
28
+ 'data-testid'?: string;
29
+ }
30
+ declare const Rating: React.ForwardRefExoticComponent<RatingProps & React.RefAttributes<HTMLUListElement>>;
31
+ export default Rating;
@@ -0,0 +1,26 @@
1
+ import React, { forwardRef, useState } from 'react';
2
+ import List from '../../atoms/List';
3
+ import { Icon, IconButton } from '../..';
4
+ const Rating = forwardRef(function Rating({ children, testId = 'fs-rating', length = 5, value = 0, icon, onChange, ...otherProps }, ref) {
5
+ const [hover, setHover] = useState(0);
6
+ return (React.createElement(List, { ref: ref, "data-fs-rating": true, "data-fs-rating-actionable": typeof onChange === 'function', "data-testid": testId, ...otherProps }, Array.from({ length }).map((_, index) => {
7
+ const tempIndex = index + 1;
8
+ const fillCheck = () => {
9
+ if (tempIndex <= (hover || value)) {
10
+ return 'full';
11
+ }
12
+ if (tempIndex - value > 0 && tempIndex - value < 1) {
13
+ return 'partial';
14
+ }
15
+ return 'empty';
16
+ };
17
+ return (React.createElement("li", { key: `rating-${index}`, "data-fs-rating-item": fillCheck(), "data-testid": `${testId}-item` }, onChange ? (React.createElement(IconButton, { "data-fs-rating-button": true, icon: icon, size: "small", "aria-label": "rate", onClick: () => {
18
+ onChange(tempIndex);
19
+ }, onMouseEnter: () => setHover(tempIndex), onMouseLeave: () => setHover(value) })) : (React.createElement(React.Fragment, null,
20
+ React.createElement("div", { "data-fs-rating-icon-wrapper": true },
21
+ React.createElement(Icon, { component: icon })),
22
+ React.createElement(Icon, { "data-fs-rating-icon-outline": true, component: icon })))));
23
+ })));
24
+ });
25
+ export default Rating;
26
+ //# sourceMappingURL=Rating.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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I,EACV,IAAI,EAAC,OAAO,gBACD,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;gBACZ,QAAQ,CAAC,SAAS,CAAC,CAAA;YACrB,CAAC,EACD,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,EACvC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GACnC,CACH,CAAC,CAAC,CAAC,CACF;YACE;gBACE,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,GAAI,CACrB;YACN,oBAAC,IAAI,yCAA6B,SAAS,EAAE,IAAI,GAAI,CACpD,CACJ,CACE,CACN,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,MAAM,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default } from './Rating';
2
+ export type { RatingProps } from './Rating';
@@ -0,0 +1,2 @@
1
+ export { default } from './Rating';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/Rating/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/components",
3
- "version": "2.0.44-alpha.0",
3
+ "version": "2.0.48-alpha.0",
4
4
  "module": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "author": "Emerson Laurentino @emersonlaurentino",
@@ -21,8 +21,8 @@
21
21
  "src"
22
22
  ],
23
23
  "devDependencies": {
24
- "@faststore/eslint-config": "^2.0.37-alpha.0",
25
- "@faststore/shared": "^2.0.44-alpha.0",
24
+ "@faststore/eslint-config": "^2.0.48-alpha.0",
25
+ "@faststore/shared": "^2.0.48-alpha.0",
26
26
  "eslint": "7.32.0",
27
27
  "typescript": "^4.8.4"
28
28
  },
@@ -30,5 +30,5 @@
30
30
  "node": "16.18.0",
31
31
  "yarn": "1.19.1"
32
32
  },
33
- "gitHead": "acf23500bf3f608eaff4debbf42c75e6e5a4c654"
33
+ "gitHead": "13071d1410c4d42df70946ba27631549d2544d85"
34
34
  }
@@ -0,0 +1,19 @@
1
+ import React from 'react'
2
+ import type { FC } from 'react'
3
+
4
+ // Icon from Phosphor Icons
5
+ const Heart: FC = () => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ fill="currentColor"
9
+ viewBox="0 0 256 256"
10
+ strokeWidth="16"
11
+ width={24}
12
+ height={24}
13
+ >
14
+ <rect width="256" height="256" fill="none"></rect>
15
+ <path d="M128,216S28,160,28,92A52,52,0,0,1,128,72h0A52,52,0,0,1,228,92C228,160,128,216,128,216Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"></path>
16
+ </svg>
17
+ )
18
+
19
+ export default Heart
@@ -0,0 +1,28 @@
1
+ import React from 'react'
2
+ import type { FC } from 'react'
3
+
4
+ // Icon from Phosphor Icons
5
+ const Minus: FC = () => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ fill="currentColor"
9
+ viewBox="0 0 256 256"
10
+ strokeWidth="24"
11
+ width={16}
12
+ height={16}
13
+ >
14
+ <rect width="256" height="256" fill="none"></rect>
15
+ <line
16
+ x1="40"
17
+ y1="128"
18
+ x2="216"
19
+ y2="128"
20
+ fill="none"
21
+ stroke="currentColor"
22
+ strokeLinecap="round"
23
+ strokeLinejoin="round"
24
+ ></line>
25
+ </svg>
26
+ )
27
+
28
+ export default Minus
@@ -0,0 +1,38 @@
1
+ import React from 'react'
2
+ import type { FC } from 'react'
3
+
4
+ // Icon from Phosphor Icons
5
+ const Plus: FC = () => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ fill="currentColor"
9
+ viewBox="0 0 256 256"
10
+ strokeWidth="24"
11
+ width={16}
12
+ height={16}
13
+ >
14
+ <rect width="256" height="256" fill="none"></rect>
15
+ <line
16
+ x1="40"
17
+ y1="128"
18
+ x2="216"
19
+ y2="128"
20
+ fill="none"
21
+ stroke="currentColor"
22
+ strokeLinecap="round"
23
+ strokeLinejoin="round"
24
+ ></line>
25
+ <line
26
+ x1="128"
27
+ y1="40"
28
+ x2="128"
29
+ y2="216"
30
+ fill="none"
31
+ stroke="currentColor"
32
+ strokeLinecap="round"
33
+ strokeLinejoin="round"
34
+ ></line>
35
+ </svg>
36
+ )
37
+
38
+ export default Plus
@@ -0,0 +1,19 @@
1
+ import React from 'react'
2
+ import type { FC } from 'react'
3
+
4
+ // Icon from Phosphor Icons
5
+ const Star: FC = () => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ fill="currentColor"
9
+ viewBox="0 0 256 256"
10
+ strokeWidth="16"
11
+ width={24}
12
+ height={24}
13
+ >
14
+ <rect width="256" height="256" fill="none"></rect>
15
+ <path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"></path>
16
+ </svg>
17
+ )
18
+
19
+ export default Star
@@ -2,10 +2,14 @@ export { default as ArrowRight } from './ArrowRight'
2
2
  export { default as ArrowElbowDownRight } from './ArrowElbowDownRight'
3
3
  export { default as CaretDown } from './CaretDown'
4
4
  export { default as Checked } from './Checked'
5
+ export { default as Heart } from './Heart'
5
6
  export { default as House } from './House'
7
+ export { default as Minus } from './Minus'
8
+ export { default as Plus } from './Plus'
6
9
  export { default as MinusCircle } from './MinusCircle'
7
10
  export { default as PlusCircle } from './PlusCircle'
8
11
  export { default as Ruler } from './Ruler'
9
12
  export { default as ShoppingCart } from './ShoppingCart'
13
+ export { default as Star } from './Star'
10
14
  export { default as X } from './X'
11
15
  export { default as XCircle } from './XCircle'
package/src/index.ts CHANGED
@@ -41,6 +41,8 @@ export type {
41
41
  AccordionButtonProps,
42
42
  AccordionPanelProps,
43
43
  } from './molecules/Accordion'
44
+ export { default as Alert } from './molecules/Alert'
45
+ export type { AlertProps } from './molecules/Alert'
44
46
  export { default as BuyButton } from './molecules/BuyButton'
45
47
  export { default as CheckboxField } from './molecules/CheckboxField'
46
48
  export type { CheckboxFieldProps } from './molecules/CheckboxField'
@@ -66,6 +68,8 @@ export { default as LinkButton } from './molecules/LinkButton'
66
68
  export type { LinkButtonProps } from './molecules/LinkButton'
67
69
  export { default as RadioField } from './molecules/RadioField'
68
70
  export type { RadioFieldProps } from './molecules/RadioField'
71
+ export { default as Rating } from './molecules/Rating'
72
+ export type { RatingProps } from './molecules/Rating'
69
73
  export { default as SelectField } from './molecules/SelectField'
70
74
  export type { SelectFieldProps } from './molecules/SelectField'
71
75
  export {
@@ -90,6 +94,8 @@ export { default as Toggle } from './molecules/Toggle'
90
94
  export type { ToggleProps } from './molecules/Toggle'
91
95
  export { default as ToggleField } from './molecules/ToggleField'
92
96
  export type { ToggleFieldProps } from './molecules/ToggleField'
97
+ export { default as QuantitySelector } from './molecules/QuantitySelector'
98
+ export type { QuantitySelectorProps } from './molecules/QuantitySelector'
93
99
 
94
100
  // Organisms
95
101
  export { default as Hero, HeroImage, HeroHeading } from './organisms/Hero'
@@ -0,0 +1,85 @@
1
+ import type { HTMLAttributes } from 'react'
2
+ import React, { forwardRef } from 'react'
3
+ import { useCallback } from 'react'
4
+
5
+ import { Button, Link, Icon, LinkProps } from '../../index'
6
+
7
+ import { X } from '../../assets'
8
+
9
+ import type { ReactNode, MouseEvent } from 'react'
10
+
11
+ export interface AlertProps
12
+ extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
13
+ /**
14
+ * ID to find this component in testing tools (e.g.: cypress,
15
+ * testing-library, and jest).
16
+ */
17
+ testId?: string
18
+ /**
19
+ * Icon component for additional customization.
20
+ */
21
+ icon?: ReactNode
22
+ /**
23
+ * Enables dismissible feature.
24
+ */
25
+ dismissible?: boolean
26
+ /**
27
+ * Extends all Link Props.
28
+ */
29
+ link?: LinkProps
30
+ /**
31
+ * Function called when dismiss button is clicked.
32
+ */
33
+ onClose?: (event: MouseEvent<HTMLElement>) => void
34
+ }
35
+
36
+ const Alert = forwardRef<HTMLDivElement, AlertProps>(function Alert({
37
+ testId = 'fs-alert',
38
+ children,
39
+ icon,
40
+ dismissible,
41
+ link,
42
+ onClose,
43
+ ...otherProps
44
+ },
45
+ ref) {
46
+ const handleClose = useCallback(
47
+ (event: MouseEvent<HTMLElement>) => {
48
+ if (event.defaultPrevented) {
49
+ return
50
+ }
51
+
52
+ onClose?.(event)
53
+ },
54
+ [onClose]
55
+ )
56
+ return (
57
+ <div
58
+ ref={ref}
59
+ role="alert"
60
+ data-fs-alert
61
+ data-testid={testId}
62
+ data-fs-alert-dismissible={dismissible}
63
+ {...otherProps}
64
+ >
65
+
66
+ {icon && <Icon component={icon} />}
67
+
68
+ <p data-fs-alert-content>{children}</p>
69
+
70
+ {link && (
71
+ <Link data-fs-alert-link variant="inline" {...link} />
72
+ )}
73
+
74
+ {dismissible && (
75
+ <Button data-fs-alert-button aria-label="Close" onClick={handleClose}>
76
+ <span>
77
+ <Icon component={<X />} />
78
+ </span>
79
+ </Button>
80
+ )}
81
+ </div>
82
+ )
83
+ })
84
+
85
+ export default Alert
@@ -0,0 +1,2 @@
1
+ export { default } from './Alert'
2
+ export type { AlertProps } from './Alert'
@@ -0,0 +1,120 @@
1
+ import React, { useState, useEffect } from 'react'
2
+
3
+ import { IconButton, Input } from '../../index'
4
+ import { Minus, Plus } from '../../assets'
5
+
6
+ export interface QuantitySelectorProps {
7
+ /**
8
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
9
+ *
10
+ * @default 'fs-quantity-selector'
11
+ */
12
+ testId?: string
13
+ /**
14
+ * The maximum value the quantity selector can receive
15
+ */
16
+ max?: number
17
+ /**
18
+ * The minimum value the quantity selector can receive
19
+ */
20
+ min?: number
21
+ /**
22
+ * The initial value for quantity selector
23
+ */
24
+ initial?: number
25
+ /**
26
+ * Specifies that the whole quantity selector component should be disabled.
27
+ */
28
+ disabled?: boolean
29
+ /**
30
+ * Event emitted when value is changed
31
+ */
32
+ onChange?: (value: number) => void
33
+ }
34
+
35
+ const QuantitySelector = ({
36
+ max,
37
+ min = 1,
38
+ initial,
39
+ disabled = false,
40
+ onChange,
41
+ testId = 'fs-quantity-selector',
42
+ ...otherProps
43
+ }: QuantitySelectorProps) => {
44
+ const [quantity, setQuantity] = useState<number>(initial ?? min)
45
+
46
+ const isLeftDisabled = quantity === min
47
+ const isRightDisabled = quantity === max
48
+
49
+ const changeQuantity = (increaseValue: number) => {
50
+ const quantityValue = validateQuantityBounds(quantity + increaseValue)
51
+
52
+ onChange?.(quantityValue)
53
+ setQuantity(quantityValue)
54
+ }
55
+
56
+ const increase = () => changeQuantity(1)
57
+
58
+ const decrease = () => changeQuantity(-1)
59
+
60
+ function validateQuantityBounds(n: number): number {
61
+ const maxValue = min ? Math.max(n, min) : n
62
+
63
+ return max ? Math.min(maxValue, max) : maxValue
64
+ }
65
+
66
+ function validateInput(e: React.FormEvent<HTMLInputElement>) {
67
+ const val = e.currentTarget.value
68
+
69
+ if (!Number.isNaN(Number(val))) {
70
+ setQuantity(() => {
71
+ const quantityValue = validateQuantityBounds(Number(val))
72
+
73
+ onChange?.(quantityValue)
74
+
75
+ return quantityValue
76
+ })
77
+ }
78
+ }
79
+
80
+ useEffect(() => {
81
+ initial && setQuantity(initial)
82
+ }, [initial])
83
+
84
+ return (
85
+ <div
86
+ data-fs-quantity-selector={disabled ? 'disabled' : 'true'}
87
+ data-testid={testId}
88
+ {...otherProps}
89
+ >
90
+ <IconButton
91
+ data-quantity-selector-button="left"
92
+ icon={<Minus />}
93
+ aria-label="Decrement Quantity"
94
+ aria-controls="quantity-selector-input"
95
+ disabled={isLeftDisabled || disabled}
96
+ onClick={decrease}
97
+ testId={`${testId}-left-button`}
98
+ />
99
+ <Input
100
+ data-quantity-selector-input
101
+ id="quantity-selector-input"
102
+ aria-label="Quantity"
103
+ value={quantity}
104
+ onChange={validateInput}
105
+ disabled={disabled}
106
+ />
107
+ <IconButton
108
+ data-quantity-selector-button="right"
109
+ aria-controls="quantity-selector-input"
110
+ aria-label="Increment Quantity"
111
+ disabled={isRightDisabled || disabled}
112
+ icon={<Plus />}
113
+ onClick={increase}
114
+ testId={`${testId}-right-button`}
115
+ />
116
+ </div>
117
+ )
118
+ }
119
+
120
+ export default QuantitySelector
@@ -0,0 +1,2 @@
1
+ export { default } from './QuantitySelector'
2
+ export type { QuantitySelectorProps } from './QuantitySelector'
@@ -0,0 +1,107 @@
1
+ import React, { forwardRef, useState } from 'react'
2
+ import { ReactNode } from 'react'
3
+ import { HTMLAttributes } from 'react'
4
+
5
+ import List from '../../atoms/List'
6
+ import { Icon, IconButton } from '../..'
7
+
8
+ export interface RatingProps
9
+ extends Omit<HTMLAttributes<HTMLUListElement>, 'onChange'> {
10
+ /**
11
+ * The length of child elements.
12
+ */
13
+ length?: number
14
+ /**
15
+ * The current value of the rating, based on the quantity of child elements.
16
+ */
17
+ value: number
18
+ /**
19
+ * A React component that will be rendered as an icon.
20
+ */
21
+ icon: ReactNode
22
+ /**
23
+ * Function to be triggered when Rating option change. This should only be used if you and an actionable rating list.
24
+ */
25
+ onChange?: (value: number) => void
26
+ /**
27
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
28
+ */
29
+ testId?: string
30
+ }
31
+
32
+ export interface RatingItemProps {
33
+ 'data-fs-rating-item'?: 'full' | 'partial' | 'empty'
34
+ 'data-testid'?: string
35
+ }
36
+
37
+ const Rating = forwardRef<HTMLUListElement, RatingProps>(function Rating(
38
+ {
39
+ children,
40
+ testId = 'fs-rating',
41
+ length = 5,
42
+ value = 0,
43
+ icon,
44
+ onChange,
45
+ ...otherProps
46
+ },
47
+ ref
48
+ ) {
49
+ const [hover, setHover] = useState(0)
50
+
51
+ return (
52
+ <List
53
+ ref={ref}
54
+ data-fs-rating
55
+ data-fs-rating-actionable={typeof onChange === 'function'}
56
+ data-testid={testId}
57
+ {...otherProps}
58
+ >
59
+ {Array.from({ length }).map((_, index: number) => {
60
+ const tempIndex = index + 1
61
+
62
+ const fillCheck = () => {
63
+ if (tempIndex <= (hover || value)) {
64
+ return 'full'
65
+ }
66
+
67
+ if (tempIndex - value > 0 && tempIndex - value < 1) {
68
+ return 'partial'
69
+ }
70
+
71
+ return 'empty'
72
+ }
73
+
74
+ return (
75
+ <li
76
+ key={`rating-${index}`}
77
+ data-fs-rating-item={fillCheck()}
78
+ data-testid={`${testId}-item`}
79
+ >
80
+ {onChange ? (
81
+ <IconButton
82
+ data-fs-rating-button
83
+ icon={icon}
84
+ size="small"
85
+ aria-label="rate"
86
+ onClick={() => {
87
+ onChange(tempIndex)
88
+ }}
89
+ onMouseEnter={() => setHover(tempIndex)}
90
+ onMouseLeave={() => setHover(value)}
91
+ />
92
+ ) : (
93
+ <>
94
+ <div data-fs-rating-icon-wrapper>
95
+ <Icon component={icon} />
96
+ </div>
97
+ <Icon data-fs-rating-icon-outline component={icon} />
98
+ </>
99
+ )}
100
+ </li>
101
+ )
102
+ })}
103
+ </List>
104
+ )
105
+ })
106
+
107
+ export default Rating
@@ -0,0 +1,2 @@
1
+ export { default } from './Rating'
2
+ export type { RatingProps } from './Rating'