@faststore/ui 1.10.31 → 1.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.8 (2022-09-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Lint issues ([#1450](https://github.com/vtex/faststore/issues/1450)) ([139de34](https://github.com/vtex/faststore/commit/139de346d5d8f094caff4cc58f340f85043e1fb4))
12
+
13
+
14
+
15
+ ## [1.11.2](https://github.com/vtex/faststore/compare/v1.11.1...v1.11.2) (2022-08-10)
16
+
17
+ **Note:** Version bump only for package @faststore/ui
18
+
19
+
20
+
21
+
22
+
23
+ ## 1.10.34 (2022-08-04)
24
+
25
+
26
+ ### Features
27
+
28
+ * Add skuSelector-related properties to ProductGroup type ([#1407](https://github.com/vtex/faststore/issues/1407)) ([3f9f33f](https://github.com/vtex/faststore/commit/3f9f33f05b47d266465f349edb7645ad06ff7b27))
29
+
30
+
31
+
6
32
  ## [1.10.31](https://github.com/vtex/faststore/compare/v1.10.30...v1.10.31) (2022-08-02)
7
33
 
8
34
 
package/dist/index.d.ts CHANGED
@@ -34,6 +34,8 @@ 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';
39
41
  export { default as AggregateRating } from './molecules/AggregateRating';
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ 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';
22
23
  export { default as AggregateRating } from './molecules/AggregateRating';
23
24
  export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './molecules/ProductCard';
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,gBAAgB,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAG9C,OAAO,EAAE,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AAO,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/ui",
3
- "version": "1.10.31",
3
+ "version": "1.11.8",
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.30",
60
+ "@faststore/styles": "^1.11.8",
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.30",
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": "cd75cbdac4910c60b9ff42ab7bc830d2dc35ba49"
88
+ "gitHead": "3775ec32d866149eb6519e68b7b2b977ffc0dace"
89
89
  }
package/src/index.ts CHANGED
@@ -54,6 +54,13 @@ 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
 
@@ -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