@faststore/ui 1.10.28 → 1.10.29

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,17 @@
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.10.29](https://github.com/vtex/faststore/compare/v1.10.28...v1.10.29) (2022-07-29)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add ProductTitle Molecule ([#1418](https://github.com/vtex/faststore/issues/1418)) ([184d0b9](https://github.com/vtex/faststore/commit/184d0b9399648e3cab25cd2348c17269ac549f49))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [1.10.28](https://github.com/vtex/faststore/compare/v1.10.27...v1.10.28) (2022-07-28)
7
18
 
8
19
 
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 ProductTitle } from './molecules/ProductTitle';
38
+ export type { ProductTitleProps } from './molecules/ProductTitle';
37
39
  export { default as AggregateRating } from './molecules/AggregateRating';
38
40
  export type { AggregateRatingProps } from './molecules/AggregateRating';
39
41
  export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './molecules/ProductCard';
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 ProductTitle } from './molecules/ProductTitle';
21
22
  export { default as AggregateRating } from './molecules/AggregateRating';
22
23
  export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './molecules/ProductCard';
23
24
  export { default as Card, CardImage, CardContent, CardActions, } from './molecules/Card';
package/dist/index.js.map CHANGED
@@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AU,GACX,MAAM,oBAAoB,CAAA;AAQ3B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGtE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAG9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAGpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAG9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAG3E,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,aAAa,EACb,eAAe,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,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,26 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import type { ReactNode } from 'react';
3
+ export declare type ProductTitleProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
4
+ /**
5
+ * A react component to be used as the product title, e.g. a `h1`
6
+ */
7
+ title: ReactNode;
8
+ /**
9
+ * A react component to be used as the product label, e.g. a `DiscountBadge`
10
+ */
11
+ label?: ReactNode;
12
+ /**
13
+ * Label for reference.
14
+ */
15
+ refTag?: string;
16
+ /**
17
+ * A text to be used below the title and the label, such as the product's reference number.
18
+ */
19
+ refNumber?: string;
20
+ /**
21
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
22
+ */
23
+ testId?: string;
24
+ };
25
+ declare function ProductTitle({ title, label, refTag, refNumber, testId, ...otherProps }: ProductTitleProps): JSX.Element;
26
+ export default ProductTitle;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ function ProductTitle({ title, label, refTag = "Ref.: ", refNumber, testId = 'store-product-title', ...otherProps }) {
3
+ return (React.createElement("header", Object.assign({ "data-fs-product-title": true, "data-testid": testId }, otherProps),
4
+ React.createElement("div", { "data-fs-product-title-header": true },
5
+ title,
6
+ !!label && label),
7
+ refNumber && (React.createElement("p", { "data-fs-product-title-addendum": true },
8
+ refTag,
9
+ refNumber))));
10
+ }
11
+ export default ProductTitle;
12
+ //# sourceMappingURL=ProductTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductTitle.js","sourceRoot":"","sources":["../../../src/molecules/ProductTitle/ProductTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AA0B7C,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,QAAQ,EAAC,SAAS,EAAE,MAAM,GAAE,qBAAqB,EAAE,GAAG,UAAU,EAAqB;IACjI,OAAO,CACL,4FAA2C,MAAM,IAAM,UAAU;QAC/D;YACG,KAAK;YACL,CAAC,CAAC,KAAK,IAAI,KAAK,CACb;QAEL,SAAS,IAAI,CACZ;YACG,MAAM;YAAE,SAAS,CAChB,CACL,CACM,CACV,CAAA;AACH,CAAC;AAED,eAAe,YAAY,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default } from './ProductTitle';
2
+ export type { ProductTitleProps } from './ProductTitle';
@@ -0,0 +1,2 @@
1
+ export { default } from './ProductTitle';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/ProductTitle/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.28",
3
+ "version": "1.10.29",
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.18",
60
+ "@faststore/styles": "^1.10.29",
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",
@@ -85,5 +85,5 @@
85
85
  "tsdx": "^0.14.1",
86
86
  "typescript": "^4.2.4"
87
87
  },
88
- "gitHead": "9fb36482671c60c4e4035e4677a7d4308e65488b"
88
+ "gitHead": "505d423909498d321c657b8ce05ab2a15f015fce"
89
89
  }
package/src/index.ts CHANGED
@@ -54,6 +54,9 @@ export { default as Incentive } from './atoms/Incentive'
54
54
  export type { IncentiveProps } from './atoms/Incentive'
55
55
 
56
56
  // Molecules
57
+ export { default as ProductTitle } from './molecules/ProductTitle'
58
+ export type { ProductTitleProps } from './molecules/ProductTitle'
59
+
57
60
  export { default as AggregateRating } from './molecules/AggregateRating'
58
61
  export type { AggregateRatingProps } from './molecules/AggregateRating'
59
62
 
@@ -0,0 +1,44 @@
1
+ import React, { HTMLAttributes } from 'react'
2
+ import type { ReactNode } from 'react'
3
+
4
+ export type ProductTitleProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
5
+ /**
6
+ * A react component to be used as the product title, e.g. a `h1`
7
+ */
8
+ title: ReactNode
9
+ /**
10
+ * A react component to be used as the product label, e.g. a `DiscountBadge`
11
+ */
12
+ label?: ReactNode
13
+ /**
14
+ * Label for reference.
15
+ */
16
+ refTag?: string
17
+ /**
18
+ * A text to be used below the title and the label, such as the product's reference number.
19
+ */
20
+ refNumber?: string
21
+ /**
22
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
23
+ */
24
+ testId?: string
25
+ }
26
+
27
+ function ProductTitle({ title, label, refTag= "Ref.: ",refNumber, testId= 'store-product-title', ...otherProps }: ProductTitleProps) {
28
+ return (
29
+ <header data-fs-product-title data-testid={testId} {...otherProps}>
30
+ <div data-fs-product-title-header>
31
+ {title}
32
+ {!!label && label}
33
+ </div>
34
+
35
+ {refNumber && (
36
+ <p data-fs-product-title-addendum>
37
+ {refTag}{refNumber}
38
+ </p>
39
+ )}
40
+ </header>
41
+ )
42
+ }
43
+
44
+ export default ProductTitle
@@ -0,0 +1,2 @@
1
+ export { default } from './ProductTitle'
2
+ export type { ProductTitleProps } from './ProductTitle'
@@ -0,0 +1,26 @@
1
+ import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
2
+
3
+ import ProductTitle from '../ProductTitle'
4
+
5
+ # ProductTitle
6
+
7
+ <Canvas>
8
+ <Story id="molecules-producttitle--product-title" />
9
+ </Canvas>
10
+
11
+ ## Props
12
+
13
+ <ArgsTable of={ ProductTitle } />
14
+
15
+ ## CSS Selectors
16
+
17
+ ```css
18
+ [data-fs-product-title] {
19
+ }
20
+
21
+ [data-fs-product-title-header] {
22
+ }
23
+
24
+ [data-fs-product-title-addendum] {
25
+ }
26
+ ```
@@ -0,0 +1,27 @@
1
+ import type { Story, Meta } from '@storybook/react'
2
+ import React from 'react'
3
+
4
+ import type { ProductTitleProps } from '../ProductTitle'
5
+ import Component from '../ProductTitle'
6
+ import mdx from './ProductTitle.mdx'
7
+ import Badge from '../../../atoms/Badge'
8
+
9
+ const ProductTitleTemplate: Story<ProductTitleProps> = () => (
10
+ <Component
11
+ title={<h1>Apple Magic Mouse</h1>}
12
+ refNumber='99995945'
13
+ label={<Badge>90%</Badge>}
14
+ />
15
+ )
16
+
17
+ export const ProductTitle = ProductTitleTemplate.bind({})
18
+ ProductTitle.storyName = 'ProductTitle'
19
+
20
+ export default {
21
+ title: 'Molecules/ProductTitle',
22
+ parameters: {
23
+ docs: {
24
+ page: mdx,
25
+ },
26
+ },
27
+ } as Meta