@faststore/ui 1.10.34 → 1.11.18

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 (36) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/molecules/Gift/Gift.d.ts +16 -0
  6. package/dist/molecules/Gift/Gift.js +9 -0
  7. package/dist/molecules/Gift/Gift.js.map +1 -0
  8. package/dist/molecules/Gift/GiftContent.d.ts +10 -0
  9. package/dist/molecules/Gift/GiftContent.js +6 -0
  10. package/dist/molecules/Gift/GiftContent.js.map +1 -0
  11. package/dist/molecules/Gift/GiftImage.d.ts +10 -0
  12. package/dist/molecules/Gift/GiftImage.js +6 -0
  13. package/dist/molecules/Gift/GiftImage.js.map +1 -0
  14. package/dist/molecules/Gift/index.d.ts +6 -0
  15. package/dist/molecules/Gift/index.js +4 -0
  16. package/dist/molecules/Gift/index.js.map +1 -0
  17. package/dist/molecules/OrderSummary/OrderSummary.d.ts +35 -0
  18. package/dist/molecules/OrderSummary/OrderSummary.js +16 -0
  19. package/dist/molecules/OrderSummary/OrderSummary.js.map +1 -0
  20. package/dist/molecules/OrderSummary/index.d.ts +2 -0
  21. package/dist/molecules/OrderSummary/index.js +2 -0
  22. package/dist/molecules/OrderSummary/index.js.map +1 -0
  23. package/package.json +4 -4
  24. package/src/index.ts +10 -0
  25. package/src/molecules/Gift/Gift.test.tsx +53 -0
  26. package/src/molecules/Gift/Gift.tsx +31 -0
  27. package/src/molecules/Gift/GiftContent.tsx +29 -0
  28. package/src/molecules/Gift/GiftImage.tsx +22 -0
  29. package/src/molecules/Gift/index.tsx +8 -0
  30. package/src/molecules/Gift/stories/Gift.mdx +40 -0
  31. package/src/molecules/Gift/stories/Gift.stories.tsx +67 -0
  32. package/src/molecules/OrderSummary/OrderSummary.test.tsx +103 -0
  33. package/src/molecules/OrderSummary/OrderSummary.tsx +109 -0
  34. package/src/molecules/OrderSummary/index.tsx +2 -0
  35. package/src/molecules/OrderSummary/stories/OrderSummary.mdx +29 -0
  36. package/src/molecules/OrderSummary/stories/OrderSummary.stories.tsx +29 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,32 @@
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
+ ## [1.11.18](https://github.com/vtex/faststore/compare/v1.11.17...v1.11.18) (2022-09-12)
7
+
8
+
9
+ ### Features
10
+
11
+ * Adds OrderSummary component to FastStore UI ([#1456](https://github.com/vtex/faststore/issues/1456)) ([f1d983c](https://github.com/vtex/faststore/commit/f1d983cf5684053ad810455d2b6f6ac77bfc7b76))
12
+
13
+
14
+
15
+ ## 1.11.8 (2022-09-01)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Lint issues ([#1450](https://github.com/vtex/faststore/issues/1450)) ([139de34](https://github.com/vtex/faststore/commit/139de346d5d8f094caff4cc58f340f85043e1fb4))
21
+
22
+
23
+
24
+ ## [1.11.2](https://github.com/vtex/faststore/compare/v1.11.1...v1.11.2) (2022-08-10)
25
+
26
+ **Note:** Version bump only for package @faststore/ui
27
+
28
+
29
+
30
+
31
+
6
32
  ## 1.10.34 (2022-08-04)
7
33
 
8
34
 
package/dist/index.d.ts CHANGED
@@ -34,8 +34,12 @@ export { default as Label } from './atoms/Label';
34
34
  export type { LabelProps } from './atoms/Label';
35
35
  export { default as Incentive } from './atoms/Incentive';
36
36
  export type { IncentiveProps } from './atoms/Incentive';
37
+ export { default as Gift, GiftContent, GiftImage } from './molecules/Gift';
38
+ export type { GiftProps, GiftContentProps, GiftImageProps, } from './molecules/Gift';
37
39
  export { default as ProductTitle } from './molecules/ProductTitle';
38
40
  export type { ProductTitleProps } from './molecules/ProductTitle';
41
+ export { default as OrderSummary } from './molecules/OrderSummary';
42
+ export type { OrderSummaryProps } from './molecules/OrderSummary';
39
43
  export { default as AggregateRating } from './molecules/AggregateRating';
40
44
  export type { AggregateRatingProps } from './molecules/AggregateRating';
41
45
  export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './molecules/ProductCard';
package/dist/index.js CHANGED
@@ -18,7 +18,9 @@ export { default as Spinner } from './atoms/Spinner';
18
18
  export { default as Label } from './atoms/Label';
19
19
  export { default as Incentive } from './atoms/Incentive';
20
20
  // Molecules
21
+ export { default as Gift, GiftContent, GiftImage } from './molecules/Gift';
21
22
  export { default as ProductTitle } from './molecules/ProductTitle';
23
+ export { default as OrderSummary } from './molecules/OrderSummary';
22
24
  export { default as AggregateRating } from './molecules/AggregateRating';
23
25
  export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './molecules/ProductCard';
24
26
  export { default as Card, CardImage, CardContent, CardActions, } from './molecules/Card';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAG9C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAG9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAGpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAGpD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,g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EACf,cAAc,GACf,MAAM,uBAAuB,CAAA;AAQ9B,OAAO,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,GACT,MAAM,mBAAmB,CAAA;AAU1B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGpD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAG1E,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,sBAAsB,CAAA;AAQ7B,YAAY;AACZ,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,eAAe,EACf,iBAAiB,GAClB,MAAM,wBAAwB,CAAA;AAO/B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAG/C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAO1E,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { HTMLAttributes } from 'react';
3
+ import type { ReactNode } from 'react';
4
+ export interface GiftProps extends HTMLAttributes<HTMLDivElement> {
5
+ /**
6
+ * ID to find this component in testing tools (e.g.: cypress,
7
+ * testing-library, and jest).
8
+ */
9
+ testId?: string;
10
+ /**
11
+ * A React component that will be rendered as an icon.
12
+ */
13
+ icon?: ReactNode;
14
+ }
15
+ declare const Gift: React.ForwardRefExoticComponent<GiftProps & React.RefAttributes<HTMLDivElement>>;
16
+ export default Gift;
@@ -0,0 +1,9 @@
1
+ import React, { forwardRef } from 'react';
2
+ import Icon from '../../atoms/Icon';
3
+ const Gift = forwardRef(function Gift({ icon, testId = 'store-gift', children, ...otherProps }, ref) {
4
+ return (React.createElement("div", Object.assign({ ref: ref, "data-fs-gift": true, "data-testid": testId }, otherProps),
5
+ icon && React.createElement(Icon, { component: icon, "data-fs-gift-icon": true }),
6
+ React.createElement("div", { "data-fs-gift-wrapper": true }, children)));
7
+ });
8
+ export default Gift;
9
+ //# sourceMappingURL=Gift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Gift.js","sourceRoot":"","sources":["../../../src/molecules/Gift/Gift.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,IAAI,MAAM,kBAAkB,CAAA;AAcnC,MAAM,IAAI,GAAG,UAAU,CAA4B,SAAS,IAAI,CAC9D,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EACxD,GAAG;IAEH,OAAO,CACL,2CAAK,GAAG,EAAE,GAAG,uCAA4B,MAAM,IAAM,UAAU;QAC5D,IAAI,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,8BAAsB;QACpD,6DAA2B,QAAQ,CAAO,CACtC,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,IAAI,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ export interface GiftContentProps extends HTMLAttributes<HTMLElement> {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
+ */
7
+ testId?: string;
8
+ }
9
+ declare const GiftContent: React.ForwardRefExoticComponent<GiftContentProps & React.RefAttributes<HTMLElement>>;
10
+ export default GiftContent;
@@ -0,0 +1,6 @@
1
+ import React, { forwardRef } from 'react';
2
+ const GiftContent = forwardRef(function GiftContent({ testId = 'store-gift-content', children, ...otherProps }, ref) {
3
+ return (React.createElement("section", Object.assign({ ref: ref, "data-fs-gift-content": true, "data-testid": testId }, otherProps), children));
4
+ });
5
+ export default GiftContent;
6
+ //# sourceMappingURL=GiftContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GiftContent.js","sourceRoot":"","sources":["../../../src/molecules/Gift/GiftContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AASzC,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,WAAW,CAClB,EAAE,MAAM,GAAG,oBAAoB,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAC1D,GAAG;IAEH,OAAO,CACL,+CACE,GAAG,EAAE,GAAG,+CAEK,MAAM,IACf,UAAU,GAEb,QAAQ,CACD,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ export interface GiftImageProps extends HTMLAttributes<HTMLDivElement> {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
+ */
7
+ testId?: string;
8
+ }
9
+ declare const GiftImage: React.ForwardRefExoticComponent<GiftImageProps & React.RefAttributes<HTMLDivElement>>;
10
+ export default GiftImage;
@@ -0,0 +1,6 @@
1
+ import React, { forwardRef } from 'react';
2
+ const GiftImage = forwardRef(function GiftImage({ testId = 'store-gift-image', children, ...otherProps }, ref) {
3
+ return (React.createElement("div", Object.assign({ ref: ref, "data-fs-gift-image": true, "data-testid": testId }, otherProps), children));
4
+ });
5
+ export default GiftImage;
6
+ //# sourceMappingURL=GiftImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GiftImage.js","sourceRoot":"","sources":["../../../src/molecules/Gift/GiftImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AASzC,MAAM,SAAS,GAAG,UAAU,CAAiC,SAAS,SAAS,CAC7E,EAAE,MAAM,GAAG,kBAAkB,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EACxD,GAAG;IAEH,OAAO,CACL,2CAAK,GAAG,EAAE,GAAG,6CAAkC,MAAM,IAAM,UAAU,GAClE,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,SAAS,CAAA"}
@@ -0,0 +1,6 @@
1
+ export { default } from './Gift';
2
+ export type { GiftProps } from './Gift';
3
+ export { default as GiftContent } from './GiftContent';
4
+ export type { GiftContentProps } from './GiftContent';
5
+ export { default as GiftImage } from './GiftImage';
6
+ export type { GiftImageProps } from './GiftImage';
@@ -0,0 +1,4 @@
1
+ export { default } from './Gift';
2
+ export { default as GiftContent } from './GiftContent';
3
+ export { default as GiftImage } from './GiftImage';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/Gift/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAGhC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { ListProps } from '../../atoms/List';
3
+ export interface OrderSummaryProps<T = HTMLElement> extends Omit<ListProps<T>, 'variant'> {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress,
6
+ * testing-library, and jest).
7
+ */
8
+ testId?: string;
9
+ /**
10
+ * Label for the subtotal value of the order. Will only show if subtotalValue is provided.
11
+ */
12
+ subtotalLabel?: string;
13
+ /**
14
+ * Subtotal value of the order. If provided, subtotal label and value will be shown.
15
+ */
16
+ subtotalValue?: string;
17
+ /**
18
+ * Label for the discount value for the order. Will only show if discountValue is provided.
19
+ */
20
+ discountLabel?: string;
21
+ /**
22
+ * Discount value for the order. If provided, discount label and value will be shown.
23
+ */
24
+ discountValue?: string;
25
+ /**
26
+ * Label for the total value of the order.
27
+ */
28
+ totalLabel?: string;
29
+ /**
30
+ * Total value of the order.
31
+ */
32
+ totalValue?: string;
33
+ }
34
+ declare const OrderSummary: React.ForwardRefExoticComponent<OrderSummaryProps<HTMLElement> & React.RefAttributes<HTMLUListElement>>;
35
+ export default OrderSummary;
@@ -0,0 +1,16 @@
1
+ import React, { forwardRef } from 'react';
2
+ import List from '../../atoms/List';
3
+ const OrderSummary = forwardRef(function OrderSummary({ testId = 'store-order-summary', children, subtotalLabel, subtotalValue, discountLabel, discountValue, totalLabel, totalValue, ...otherProps }, ref) {
4
+ return (React.createElement(List, Object.assign({ ref: ref, "data-fs-order-summary": true, "data-testid": testId }, otherProps),
5
+ subtotalValue ? (React.createElement("li", { "data-fs-order-summary-subtotal": true },
6
+ React.createElement("span", { "data-fs-order-summary-subtotal-label": true, "data-testid": `${testId}-subtotal-label` }, subtotalLabel),
7
+ React.createElement("span", { "data-fs-order-summary-subtotal-value": true, "data-testid": `${testId}-subtotal-value` }, subtotalValue))) : null,
8
+ discountValue ? (React.createElement("li", { "data-fs-order-summary-discount": true },
9
+ React.createElement("span", { "data-fs-order-summary-discount-label": true, "data-testid": `${testId}-discount-label` }, discountLabel),
10
+ React.createElement("span", { "data-fs-order-summary-discount-value": true, "data-testid": `${testId}-discount-value` }, discountValue))) : null,
11
+ React.createElement("li", { "data-fs-order-summary-total": true },
12
+ React.createElement("span", { "data-fs-order-summary-total-label": true, "data-testid": `${testId}-total-label` }, totalLabel),
13
+ React.createElement("span", { "data-fs-order-summary-total-value": true, "data-testid": `${testId}-total-value` }, totalValue))));
14
+ });
15
+ export default OrderSummary;
16
+ //# sourceMappingURL=OrderSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderSummary.js","sourceRoot":"","sources":["../../../src/molecules/OrderSummary/OrderSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,IAAmB,MAAM,kBAAkB,CAAA;AAkClD,MAAM,YAAY,GAAG,UAAU,CAC7B,SAAS,YAAY,CACnB,EACE,MAAM,GAAG,qBAAqB,EAC9B,QAAQ,EACR,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,oBAAC,IAAI,kBACH,GAAG,EAAE,GAAG,gDAEK,MAAM,IACf,UAAU;QAEb,aAAa,CAAC,CAAC,CAAC,CACf;YACE,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT;YACP,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT,CACJ,CACN,CAAC,CAAC,CAAC,IAAI;QACP,aAAa,CAAC,CAAC,CAAC,CACf;YACE,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT;YACP,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT,CACJ,CACN,CAAC,CAAC,CAAC,IAAI;QACR;YACE,wFAEe,GAAG,MAAM,cAAc,IAEnC,UAAU,CACN;YACP,wFAEe,GAAG,MAAM,cAAc,IAEnC,UAAU,CACN,CACJ,CACA,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default } from './OrderSummary';
2
+ export type { OrderSummaryProps } from './OrderSummary';
@@ -0,0 +1,2 @@
1
+ export { default } from './OrderSummary';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/OrderSummary/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/ui",
3
- "version": "1.10.34",
3
+ "version": "1.11.18",
4
4
  "description": "A lightweight, framework agnostic component library for React",
5
5
  "author": "emersonlaurentino",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "react-dom": "^17.0.2"
58
58
  },
59
59
  "devDependencies": {
60
- "@faststore/styles": "^1.10.34",
60
+ "@faststore/styles": "^1.11.18",
61
61
  "@size-limit/preset-small-lib": "^7.0.8",
62
62
  "@storybook/addon-actions": "^6.4.4",
63
63
  "@storybook/addon-docs": "^6.4.4",
@@ -79,11 +79,11 @@
79
79
  "react": "^17.0.2",
80
80
  "react-docgen-typescript-loader": "^3.7.2",
81
81
  "react-dom": "^17.0.2",
82
- "shared": "^1.10.34",
82
+ "shared": "^1.11.8",
83
83
  "size-limit": "^7.0.8",
84
84
  "storybook-addon-themes": "^6.1.0",
85
85
  "tsdx": "^0.14.1",
86
86
  "typescript": "^4.2.4"
87
87
  },
88
- "gitHead": "5d59e28c724e389b596e2bb13b1464314eab275f"
88
+ "gitHead": "0d01ff2f997acf54f9066d7245c521ddfdbc5bea"
89
89
  }
package/src/index.ts CHANGED
@@ -54,9 +54,19 @@ export { default as Incentive } from './atoms/Incentive'
54
54
  export type { IncentiveProps } from './atoms/Incentive'
55
55
 
56
56
  // Molecules
57
+ export { default as Gift, GiftContent, GiftImage } from './molecules/Gift'
58
+ export type {
59
+ GiftProps,
60
+ GiftContentProps,
61
+ GiftImageProps,
62
+ } from './molecules/Gift'
63
+
57
64
  export { default as ProductTitle } from './molecules/ProductTitle'
58
65
  export type { ProductTitleProps } from './molecules/ProductTitle'
59
66
 
67
+ export { default as OrderSummary } from './molecules/OrderSummary'
68
+ export type { OrderSummaryProps } from './molecules/OrderSummary'
69
+
60
70
  export { default as AggregateRating } from './molecules/AggregateRating'
61
71
  export type { AggregateRatingProps } from './molecules/AggregateRating'
62
72
 
@@ -0,0 +1,53 @@
1
+ import { render } from '@testing-library/react'
2
+ import { axe } from 'jest-axe'
3
+ import React from 'react'
4
+
5
+ import Gift from './Gift'
6
+ import GiftImage from './GiftImage'
7
+ import GiftContent from './GiftContent'
8
+
9
+ const GiftTest = () => {
10
+ return (
11
+ <Gift>
12
+ <GiftImage>
13
+ <div>An image</div>
14
+ </GiftImage>
15
+ <GiftContent>
16
+ <h3>Product Name</h3>
17
+ <p>89.90</p>
18
+ <span>Free</span>
19
+ </GiftContent>
20
+ </Gift>
21
+ )
22
+ }
23
+
24
+ describe('Gift', () => {
25
+ describe('Data attributes', () => {
26
+ const { getByTestId } = render(<GiftTest />)
27
+
28
+ const gift = getByTestId('store-gift')
29
+ const giftImage = getByTestId('store-gift-image')
30
+ const giftContent = getByTestId('store-gift-content')
31
+
32
+ it('`Gift` component should have `data-fs-gift` attribute', () => {
33
+ expect(gift).toHaveAttribute('data-fs-gift')
34
+ })
35
+
36
+ it('`GiftImage` component should have `data-fs-gift-image` attribute', () => {
37
+ expect(giftImage).toHaveAttribute('data-fs-gift-image')
38
+ })
39
+
40
+ it('`GiftContent` component should have `data-fs-gift-content` attribute', () => {
41
+ expect(giftContent).toHaveAttribute('data-fs-gift-content')
42
+ })
43
+ })
44
+
45
+ describe('Accessibility', () => {
46
+ it('should have no violations', async () => {
47
+ const { getByTestId } = render(<GiftTest />)
48
+
49
+ expect(await axe(getByTestId('store-gift'))).toHaveNoViolations()
50
+ expect(await axe(getByTestId('store-gift'))).toHaveNoIncompletes()
51
+ })
52
+ })
53
+ })
@@ -0,0 +1,31 @@
1
+ import React, { forwardRef } from 'react'
2
+ import type { HTMLAttributes } from 'react'
3
+ import type { ReactNode } from 'react'
4
+
5
+ import Icon from '../../atoms/Icon'
6
+
7
+ export interface GiftProps extends HTMLAttributes<HTMLDivElement> {
8
+ /**
9
+ * ID to find this component in testing tools (e.g.: cypress,
10
+ * testing-library, and jest).
11
+ */
12
+ testId?: string
13
+ /**
14
+ * A React component that will be rendered as an icon.
15
+ */
16
+ icon?: ReactNode
17
+ }
18
+
19
+ const Gift = forwardRef<HTMLDivElement, GiftProps>(function Gift(
20
+ { icon, testId = 'store-gift', children, ...otherProps },
21
+ ref
22
+ ) {
23
+ return (
24
+ <div ref={ref} data-fs-gift data-testid={testId} {...otherProps}>
25
+ {icon && <Icon component={icon} data-fs-gift-icon />}
26
+ <div data-fs-gift-wrapper>{children}</div>
27
+ </div>
28
+ )
29
+ })
30
+
31
+ export default Gift
@@ -0,0 +1,29 @@
1
+ import type { HTMLAttributes } from 'react'
2
+ import React, { forwardRef } from 'react'
3
+
4
+ export interface GiftContentProps extends HTMLAttributes<HTMLElement> {
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 GiftContent = forwardRef<HTMLElement, GiftContentProps>(
12
+ function GiftContent(
13
+ { testId = 'store-gift-content', children, ...otherProps },
14
+ ref
15
+ ) {
16
+ return (
17
+ <section
18
+ ref={ref}
19
+ data-fs-gift-content
20
+ data-testid={testId}
21
+ {...otherProps}
22
+ >
23
+ {children}
24
+ </section>
25
+ )
26
+ }
27
+ )
28
+
29
+ export default GiftContent
@@ -0,0 +1,22 @@
1
+ import type { HTMLAttributes } from 'react'
2
+ import React, { forwardRef } from 'react'
3
+
4
+ export interface GiftImageProps extends HTMLAttributes<HTMLDivElement> {
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 GiftImage = forwardRef<HTMLDivElement, GiftImageProps>(function GiftImage(
12
+ { testId = 'store-gift-image', children, ...otherProps },
13
+ ref
14
+ ) {
15
+ return (
16
+ <div ref={ref} data-fs-gift-image data-testid={testId} {...otherProps}>
17
+ {children}
18
+ </div>
19
+ )
20
+ })
21
+
22
+ export default GiftImage
@@ -0,0 +1,8 @@
1
+ export { default } from './Gift'
2
+ export type { GiftProps } from './Gift'
3
+
4
+ export { default as GiftContent } from './GiftContent'
5
+ export type { GiftContentProps } from './GiftContent'
6
+
7
+ export { default as GiftImage } from './GiftImage'
8
+ export type { GiftImageProps } from './GiftImage'
@@ -0,0 +1,40 @@
1
+ import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
2
+
3
+ import Gift from '../Gift'
4
+
5
+ # Gift
6
+
7
+ <Canvas>
8
+ <Story id="molecules-gift--gift" />
9
+ </Canvas>
10
+
11
+ ## Components
12
+
13
+ The `Gift` uses the [Compound Component](https://kentcdodds.com/blog/compound-components-with-react-hooks) pattern, its components are:
14
+
15
+ - `Gift`: the wrapper component, it can receive a `Icon` prop.
16
+ - `GiftImage`: the component's that display the product image.
17
+ - `GiftContent`: the component that can display the product's title, price, and a badge.
18
+
19
+ ## Props
20
+
21
+ <ArgsTable of={Gift} />
22
+
23
+ ## CSS Selectors
24
+
25
+ ```css
26
+ [data-fs-gift] {
27
+ }
28
+
29
+ [data-fs-gift-wrapper] {
30
+ }
31
+
32
+ [data-fs-gift-icon] {
33
+ }
34
+
35
+ [data-fs-gift-content] {
36
+ }
37
+
38
+ [data-fs-gift-image] {
39
+ }
40
+ ```
@@ -0,0 +1,67 @@
1
+ import type { Story, Meta } from '@storybook/react'
2
+ import React, { useMemo } from 'react'
3
+
4
+ import Badge from '../../../atoms/Badge/Badge'
5
+ import Price from '../../../atoms/Price/Price'
6
+ // Gift components
7
+ import GiftComponent from '../Gift'
8
+ import GiftContent from '../GiftContent'
9
+ import GiftImage from '../GiftImage'
10
+ import type { GiftProps } from '../Gift'
11
+ import mdx from './Gift.mdx'
12
+
13
+ const Tag = () => (
14
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
15
+ <path fill="none" d="M0 0h256v256H0z" />
16
+ <path
17
+ d="M122.7 25.9 42 42l-16.1 80.7a8 8 0 0 0 2.2 7.2l104.4 104.4a7.9 7.9 0 0 0 11.3 0l90.5-90.5a7.9 7.9 0 0 0 0-11.3L129.9 28.1a8 8 0 0 0-7.2-2.2Z"
18
+ fill="none"
19
+ stroke="#000"
20
+ strokeLinecap="round"
21
+ strokeLinejoin="round"
22
+ strokeWidth="16"
23
+ />
24
+ <circle cx="84" cy="84" r="12" />
25
+ </svg>
26
+ )
27
+
28
+ function useIntlFormatter(price: number) {
29
+ return useMemo(() => {
30
+ const formattedPrice = new Intl.NumberFormat('en-GB', {
31
+ style: 'currency',
32
+ currency: 'USD',
33
+ }).format(price)
34
+
35
+ return formattedPrice
36
+ }, [price])
37
+ }
38
+
39
+ const GiftTemplate: Story<GiftProps> = ({ testId }) => (
40
+ <GiftComponent testId={testId} icon={<Tag />}>
41
+ <GiftImage>
42
+ <img
43
+ alt="Aedle VK-1 L Headphone"
44
+ src="https://assets.vtex.app/unsafe/1608x1206/center/middle/https%3A%2F%2Fstoreframework.vtexassets.com%2Farquivos%2Fids%2F190901%2Funsplash-headphone.jpg%3Fv%3D637800115948430000"
45
+ />
46
+ </GiftImage>
47
+ <GiftContent>
48
+ <h3>Get a pair of Aedle VK-1 L Headphone</h3>
49
+ <div>
50
+ <Price value={145} formatter={useIntlFormatter} />
51
+ <Badge>Free</Badge>
52
+ </div>
53
+ </GiftContent>
54
+ </GiftComponent>
55
+ )
56
+
57
+ export const Gift = GiftTemplate.bind({})
58
+ Gift.storyName = 'Gift'
59
+
60
+ export default {
61
+ title: 'Molecules/Gift',
62
+ parameters: {
63
+ docs: {
64
+ page: mdx,
65
+ },
66
+ },
67
+ } as Meta
@@ -0,0 +1,103 @@
1
+ import { render } from '@testing-library/react'
2
+ import { axe } from 'jest-axe'
3
+ import React from 'react'
4
+
5
+ import OrderSummary from './OrderSummary'
6
+
7
+ const ELEMENT_NOT_FOUND_MESSAGE = 'Unable to find an element by:'
8
+
9
+ describe('OrderSummary', () => {
10
+ it('should have `data-fs-order-summary` attribute', () => {
11
+ const { getByTestId } = render(<OrderSummary />)
12
+
13
+ expect(getByTestId('store-order-summary')).toHaveAttribute(
14
+ 'data-fs-order-summary'
15
+ )
16
+ })
17
+
18
+ it('should always render total labels and values elements', async () => {
19
+ const { getByTestId } = render(<OrderSummary />)
20
+
21
+ expect(getByTestId('store-order-summary-total-label')).toBeInTheDocument()
22
+ expect(getByTestId('store-order-summary-total-value')).toBeInTheDocument()
23
+ })
24
+
25
+ it('should not render subtotal or discount labels and values if subtotalValue or discountValue are not provided', async () => {
26
+ const { getByTestId } = render(
27
+ <OrderSummary totalLabel="Total" totalValue="250$" />
28
+ )
29
+
30
+ expect(() =>
31
+ getByTestId('store-order-summary-subtotal-label')
32
+ ).toThrowError(ELEMENT_NOT_FOUND_MESSAGE)
33
+ expect(() => getByTestId('store-order-summary-subtotal-value')).toThrow(
34
+ ELEMENT_NOT_FOUND_MESSAGE
35
+ )
36
+
37
+ expect(() => getByTestId('store-order-summary-discount-label')).toThrow(
38
+ ELEMENT_NOT_FOUND_MESSAGE
39
+ )
40
+ expect(() => getByTestId('store-order-summary-discount-value')).toThrow(
41
+ ELEMENT_NOT_FOUND_MESSAGE
42
+ )
43
+ })
44
+
45
+ it('should render subtotal label and value if subtotalValue is provided', async () => {
46
+ const { getByTestId } = render(
47
+ <OrderSummary
48
+ subtotalLabel="Subtotal"
49
+ totalLabel="Total"
50
+ subtotalValue="300$"
51
+ totalValue="250$"
52
+ />
53
+ )
54
+
55
+ expect(
56
+ getByTestId('store-order-summary-subtotal-label')
57
+ ).toBeInTheDocument()
58
+ expect(getByTestId('store-order-summary-subtotal-label')).toHaveTextContent(
59
+ 'Subtotal'
60
+ )
61
+
62
+ expect(
63
+ getByTestId('store-order-summary-subtotal-value')
64
+ ).toBeInTheDocument()
65
+ expect(getByTestId('store-order-summary-subtotal-value')).toHaveTextContent(
66
+ '300$'
67
+ )
68
+ })
69
+
70
+ it('should render discount label and value if discountValue is provided', async () => {
71
+ const { getByTestId } = render(
72
+ <OrderSummary
73
+ subtotalLabel="Subtotal"
74
+ totalLabel="Total"
75
+ subtotalValue="300$"
76
+ totalValue="250$"
77
+ discountLabel="Discount"
78
+ discountValue="-50$"
79
+ />
80
+ )
81
+
82
+ expect(
83
+ getByTestId('store-order-summary-discount-label')
84
+ ).toBeInTheDocument()
85
+ expect(getByTestId('store-order-summary-discount-label')).toHaveTextContent(
86
+ 'Discount'
87
+ )
88
+ expect(
89
+ getByTestId('store-order-summary-discount-value')
90
+ ).toBeInTheDocument()
91
+ expect(getByTestId('store-order-summary-discount-value')).toHaveTextContent(
92
+ '-50$'
93
+ )
94
+ })
95
+
96
+ describe('Accessibility', () => {
97
+ it('should have no violations', async () => {
98
+ const { getByTestId } = render(<OrderSummary />)
99
+
100
+ expect(await axe(getByTestId('store-order-summary'))).toHaveNoViolations()
101
+ })
102
+ })
103
+ })
@@ -0,0 +1,109 @@
1
+ import React, { forwardRef } from 'react'
2
+ import List, { ListProps } from '../../atoms/List'
3
+
4
+ export interface OrderSummaryProps<T = HTMLElement> extends Omit<ListProps<T>, 'variant'> {
5
+ /**
6
+ * ID to find this component in testing tools (e.g.: cypress,
7
+ * testing-library, and jest).
8
+ */
9
+ testId?: string
10
+ /**
11
+ * Label for the subtotal value of the order. Will only show if subtotalValue is provided.
12
+ */
13
+ subtotalLabel?: string
14
+ /**
15
+ * Subtotal value of the order. If provided, subtotal label and value will be shown.
16
+ */
17
+ subtotalValue?: string
18
+ /**
19
+ * Label for the discount value for the order. Will only show if discountValue is provided.
20
+ */
21
+ discountLabel?: string
22
+ /**
23
+ * Discount value for the order. If provided, discount label and value will be shown.
24
+ */
25
+ discountValue?: string
26
+ /**
27
+ * Label for the total value of the order.
28
+ */
29
+ totalLabel?: string
30
+ /**
31
+ * Total value of the order.
32
+ */
33
+ totalValue?: string
34
+ }
35
+
36
+ const OrderSummary = forwardRef<HTMLUListElement, OrderSummaryProps>(
37
+ function OrderSummary(
38
+ {
39
+ testId = 'store-order-summary',
40
+ children,
41
+ subtotalLabel,
42
+ subtotalValue,
43
+ discountLabel,
44
+ discountValue,
45
+ totalLabel,
46
+ totalValue,
47
+ ...otherProps
48
+ },
49
+ ref
50
+ ) {
51
+ return (
52
+ <List
53
+ ref={ref}
54
+ data-fs-order-summary
55
+ data-testid={testId}
56
+ {...otherProps}
57
+ >
58
+ {subtotalValue ? (
59
+ <li data-fs-order-summary-subtotal>
60
+ <span
61
+ data-fs-order-summary-subtotal-label
62
+ data-testid={`${testId}-subtotal-label`}
63
+ >
64
+ {subtotalLabel}
65
+ </span>
66
+ <span
67
+ data-fs-order-summary-subtotal-value
68
+ data-testid={`${testId}-subtotal-value`}
69
+ >
70
+ {subtotalValue}
71
+ </span>
72
+ </li>
73
+ ) : null}
74
+ {discountValue ? (
75
+ <li data-fs-order-summary-discount>
76
+ <span
77
+ data-fs-order-summary-discount-label
78
+ data-testid={`${testId}-discount-label`}
79
+ >
80
+ {discountLabel}
81
+ </span>
82
+ <span
83
+ data-fs-order-summary-discount-value
84
+ data-testid={`${testId}-discount-value`}
85
+ >
86
+ {discountValue}
87
+ </span>
88
+ </li>
89
+ ) : null}
90
+ <li data-fs-order-summary-total>
91
+ <span
92
+ data-fs-order-summary-total-label
93
+ data-testid={`${testId}-total-label`}
94
+ >
95
+ {totalLabel}
96
+ </span>
97
+ <span
98
+ data-fs-order-summary-total-value
99
+ data-testid={`${testId}-total-value`}
100
+ >
101
+ {totalValue}
102
+ </span>
103
+ </li>
104
+ </List>
105
+ )
106
+ }
107
+ )
108
+
109
+ export default OrderSummary
@@ -0,0 +1,2 @@
1
+ export { default } from './OrderSummary'
2
+ export type { OrderSummaryProps } from './OrderSummary'
@@ -0,0 +1,29 @@
1
+ import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
2
+
3
+ import OrderSummary from '../OrderSummary'
4
+
5
+ # OrderSummary
6
+
7
+ <Canvas>
8
+ <Story id="molecules-ordersummary--order-summary" />
9
+ </Canvas>
10
+
11
+ ## Props
12
+
13
+ <ArgsTable of={ OrderSummary } />
14
+
15
+ ## CSS Selectors
16
+
17
+ ```css
18
+ [data-fs-order-summary] {}
19
+ [data-fs-order-summary-subtotal] {}
20
+ [data-fs-order-summary-subtotal-label] {}
21
+ [data-fs-order-summary-subtotal-value] {}
22
+ [data-fs-order-summary-discount] {}
23
+ [data-fs-order-summary-discount-label] {}
24
+ [data-fs-order-summary-discount-value] {}
25
+ [data-fs-order-summary-total] {}
26
+ [data-fs-order-summary-total-label] {}
27
+ [data-fs-order-summary-total-value] {}
28
+
29
+ ```
@@ -0,0 +1,29 @@
1
+ import type { Story, Meta } from '@storybook/react'
2
+ import React from 'react'
3
+
4
+ import type { OrderSummaryProps } from '../OrderSummary'
5
+ import Component from '../OrderSummary'
6
+ import mdx from './OrderSummary.mdx'
7
+
8
+ const OrderSummaryTemplate: Story<OrderSummaryProps> = () => (
9
+ <Component
10
+ subtotalLabel='Subtotal (3 products)'
11
+ subtotalValue='$300'
12
+ discountLabel='Discount'
13
+ discountValue='-$50'
14
+ totalLabel='Total'
15
+ totalValue='250$'
16
+ />
17
+ )
18
+
19
+ export const OrderSummary = OrderSummaryTemplate.bind({})
20
+ OrderSummary.storyName = 'OrderSummary'
21
+
22
+ export default {
23
+ title: 'Molecules/OrderSummary',
24
+ parameters: {
25
+ docs: {
26
+ page: mdx,
27
+ },
28
+ },
29
+ } as Meta