@faststore/components 2.0.69-alpha.0 → 2.0.70-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 (28) hide show
  1. package/dist/atoms/Price/Price.d.ts +4 -0
  2. package/dist/atoms/Price/Price.js +5 -2
  3. package/dist/atoms/Price/Price.js.map +1 -1
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/molecules/ProductCard/ProductCardContent.js +2 -2
  8. package/dist/molecules/ProductCard/ProductCardContent.js.map +1 -1
  9. package/dist/molecules/SearchProductCard/SearchProductCard.d.ts +20 -0
  10. package/dist/molecules/SearchProductCard/SearchProductCard.js +8 -0
  11. package/dist/molecules/SearchProductCard/SearchProductCard.js.map +1 -0
  12. package/dist/molecules/SearchProductCard/SearchProductCardContent.d.ts +20 -0
  13. package/dist/molecules/SearchProductCard/SearchProductCardContent.js +11 -0
  14. package/dist/molecules/SearchProductCard/SearchProductCardContent.js.map +1 -0
  15. package/dist/molecules/SearchProductCard/SearchProductCardImage.d.ts +10 -0
  16. package/dist/molecules/SearchProductCard/SearchProductCardImage.js +6 -0
  17. package/dist/molecules/SearchProductCard/SearchProductCardImage.js.map +1 -0
  18. package/dist/molecules/SearchProductCard/index.d.ts +6 -0
  19. package/dist/molecules/SearchProductCard/index.js +4 -0
  20. package/dist/molecules/SearchProductCard/index.js.map +1 -0
  21. package/package.json +2 -2
  22. package/src/atoms/Price/Price.tsx +8 -0
  23. package/src/index.ts +10 -0
  24. package/src/molecules/ProductCard/ProductCardContent.tsx +2 -0
  25. package/src/molecules/SearchProductCard/SearchProductCard.tsx +54 -0
  26. package/src/molecules/SearchProductCard/SearchProductCardContent.tsx +51 -0
  27. package/src/molecules/SearchProductCard/SearchProductCardImage.tsx +31 -0
  28. package/src/molecules/SearchProductCard/index.ts +8 -0
@@ -23,6 +23,10 @@ export interface PriceProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'child
23
23
  * The current use case variant for prices.
24
24
  */
25
25
  variant?: PriceVariant;
26
+ /**
27
+ * Text for the screen readers only
28
+ */
29
+ SRText?: string;
26
30
  }
27
31
  declare const Price: React.ForwardRefExoticComponent<PriceProps & React.RefAttributes<Omit<HTMLSpanElement, "children">>>;
28
32
  export default Price;
@@ -1,7 +1,10 @@
1
1
  import React, { forwardRef } from 'react';
2
- const Price = forwardRef(function Price({ value, as: Component = 'span', variant = 'selling', testId = 'fs-price', formatter = (price) => price, ...otherProps }, ref) {
2
+ import { SROnly } from '../../';
3
+ const Price = forwardRef(function Price({ value, as: Component = 'span', variant = 'selling', testId = 'fs-price', formatter = (price) => price, SRText, ...otherProps }, ref) {
3
4
  const formattedPrice = formatter(value, variant);
4
- return (React.createElement(Component, { ref: ref, "data-fs-price": true, "data-fs-price-variant": variant, "data-testid": testId, ...otherProps }, formattedPrice));
5
+ return (React.createElement(Component, { ref: ref, "data-fs-price": true, "data-fs-price-variant": variant, "data-testid": testId, ...otherProps },
6
+ SRText && React.createElement(SROnly, { text: SRText }),
7
+ formattedPrice));
5
8
  });
6
9
  export default Price;
7
10
  //# sourceMappingURL=Price.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Price.js","sourceRoot":"","sources":["../../../src/atoms/Price/Price.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAmCzC,MAAM,KAAK,GAAG,UAAU,CACtB,SAAS,KAAK,CACZ,EACE,KAAK,EACL,EAAE,EAAE,SAAS,GAAG,MAAM,EACtB,OAAO,GAAG,SAAS,EACnB,MAAM,GAAG,UAAU,EACnB,SAAS,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAC5B,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAEhD,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,kDAEe,OAAO,iBACjB,MAAM,KACf,UAAU,IAEb,cAAc,CACL,CACb,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,KAAK,CAAA"}
1
+ {"version":3,"file":"Price.js","sourceRoot":"","sources":["../../../src/atoms/Price/Price.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAuC/B,MAAM,KAAK,GAAG,UAAU,CACtB,SAAS,KAAK,CACZ,EACE,KAAK,EACL,EAAE,EAAE,SAAS,GAAG,MAAM,EACtB,OAAO,GAAG,SAAS,EACnB,MAAM,GAAG,UAAU,EACnB,SAAS,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAC5B,MAAM,EACN,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAEhD,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,kDAEe,OAAO,iBACjB,MAAM,KACf,UAAU;QAEb,MAAM,IAAI,oBAAC,MAAM,IAAC,IAAI,EAAE,MAAM,GAAI;QAClC,cAAc,CACL,CACb,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,KAAK,CAAA"}
package/dist/index.d.ts CHANGED
@@ -66,6 +66,8 @@ export { default as RadioGroup, RadioOption } from './molecules/RadioGroup';
66
66
  export type { RadioGroupProps, RadioOptionProps } from './molecules/RadioGroup';
67
67
  export { default as Rating } from './molecules/Rating';
68
68
  export type { RatingProps } from './molecules/Rating';
69
+ export { default as SearchProductCard, SearchProductCardImage, SearchProductCardContent, } from './molecules/SearchProductCard';
70
+ export type { SearchProductCardProps, SearchProductCardImageProps, SearchProductCardContentProps, } from './molecules/SearchProductCard';
69
71
  export { default as SelectField } from './molecules/SelectField';
70
72
  export type { SelectFieldProps } from './molecules/SelectField';
71
73
  export { Table, TableBody, TableCell, TableFooter, TableHead, TableRow, } from './molecules/Table';
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ export { default as ProductTitle } from './molecules/ProductTitle';
38
38
  export { default as RadioField } from './molecules/RadioField';
39
39
  export { default as RadioGroup, RadioOption } from './molecules/RadioGroup';
40
40
  export { default as Rating } from './molecules/Rating';
41
+ export { default as SearchProductCard, SearchProductCardImage, SearchProductCardContent, } from './molecules/SearchProductCard';
41
42
  export { default as SelectField } from './molecules/SelectField';
42
43
  export { Table, TableBody, TableCell, TableFooter, TableHead, TableRow, } from './molecules/Table';
43
44
  export { default as Tag } from './molecules/Tag';
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,cAAc,SAAS,CAAA;AAEvB,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,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAAE,OAAO,IA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AAI,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;AAO1E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGtE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA"}
@@ -7,8 +7,8 @@ const ProductCardContent = forwardRef(function CardContent({ testId = 'fs-produc
7
7
  React.createElement("h3", { "data-fs-product-card-title": true },
8
8
  React.createElement(Link, { ...linkProps, title: title }, title)),
9
9
  React.createElement("div", { "data-fs-product-card-prices": true },
10
- React.createElement(Price, { value: price?.listPrice ? price.listPrice : 0, formatter: price?.formatter, testId: "list-price", "data-value": price?.listPrice, variant: "listing" }),
11
- React.createElement(Price, { value: price?.value ? price.value : 0, formatter: price?.formatter, testId: "price", "data-value": price?.value, variant: "spot" })),
10
+ React.createElement(Price, { value: price?.listPrice ? price.listPrice : 0, formatter: price?.formatter, testId: "list-price", "data-value": price?.listPrice, variant: "listing", SRText: "Original price:" }),
11
+ React.createElement(Price, { value: price?.value ? price.value : 0, formatter: price?.formatter, testId: "price", "data-value": price?.value, variant: "spot", SRText: "Sale Price:" })),
12
12
  ratingValue && React.createElement(Rating, { value: ratingValue, icon: React.createElement(Star, null) })),
13
13
  showDiscountBadge && !outOfStock && (React.createElement(DiscountBadge, { listPrice: price?.listPrice ? price.listPrice : 0, spotPrice: price?.value ? price.value : 0 })),
14
14
  outOfStock && React.createElement(Badge, null, outOfStockLabel),
@@ -1 +1 @@
1
- {"version":3,"file":"ProductCardContent.js","sourceRoot":"","sources":["../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,aAAa,GAGd,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAmDjD,MAAM,kBAAkB,GAAG,UAAU,CACnC,SAAS,WAAW,CAClB,EACE,MAAM,GAAG,yBAAyB,EAClC,KAAK,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,eAAe,GAAG,cAAc,EAChC,WAAW,EACX,iBAAiB,EACjB,WAAW,GAAG,KAAK,EACnB,aAAa,EACb,QAAQ,EACR,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,iCACE,GAAG,EAAE,GAAG,sEAEoB,iBAAiB,iBAChC,MAAM,KACf,UAAU;QAEd;YACE;gBACE,oBAAC,IAAI,OAAK,SAAS,EAAE,KAAK,EAAE,KAAK,IAC9B,KAAK,CACD,CACJ;YACL;gBACE,oBAAC,KAAK,IACJ,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAC7C,SAAS,EAAE,KAAK,EAAE,SAAS,EAC3B,MAAM,EAAC,YAAY,gBACP,KAAK,EAAE,SAAS,EAC5B,OAAO,EAAC,SAAS,GACjB;gBACF,oBAAC,KAAK,IACJ,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACrC,SAAS,EAAE,KAAK,EAAE,SAAS,EAC3B,MAAM,EAAC,OAAO,gBACF,KAAK,EAAE,KAAK,EACxB,OAAO,EAAC,MAAM,GACd,CACE;YACL,WAAW,IAAI,oBAAC,MAAM,IAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,oBAAC,IAAI,OAAG,GAAI,CAC1D;QACL,iBAAiB,IAAI,CAAC,UAAU,IAAI,CACnC,oBAAC,aAAa,IACZ,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EACjD,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GACzC,CACH;QACA,UAAU,IAAI,oBAAC,KAAK,QAAE,eAAe,CAAS;QAC9C,aAAa,IAAI,CAAC,UAAU,IAAI,CAC/B;YACE,oBAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAE,oBAAC,YAAY,OAAG,EACtB,YAAY,EAAC,MAAM,EACnB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,aAAa,IAErB,WAAW,CACL,CACL,CACP,CACO,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,kBAAkB,CAAA"}
1
+ {"version":3,"file":"ProductCardContent.js","sourceRoot":"","sources":["../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,aAAa,GAGd,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAmDjD,MAAM,kBAAkB,GAAG,UAAU,CACnC,SAAS,WAAW,CAClB,EACE,MAAM,GAAG,yBAAyB,EAClC,K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AAU,IAAI,oBAAC,KAAK,QAAE,eAAe,CAAS;QAC9C,aAAa,IAAI,CAAC,UAAU,IAAI,CAC/B;YACE,oBAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAE,oBAAC,YAAY,OAAG,EACtB,YAAY,EAAC,MAAM,EACnB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,aAAa,IAErB,WAAW,CACL,CACL,CACP,CACO,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import type { HTMLAttributes } from 'react';
3
+ import { LinkProps, LinkElementType } from '../../';
4
+ export interface SearchProductCardProps 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
+ * Props for the link from SearchProduct component.
12
+ */
13
+ linkProps?: Partial<LinkProps<LinkElementType>>;
14
+ /**
15
+ * Callback function when SearchProduct link is clicked.
16
+ */
17
+ onLinkClick?: () => void;
18
+ }
19
+ declare const SearchProductCard: React.ForwardRefExoticComponent<SearchProductCardProps & React.RefAttributes<HTMLDivElement>>;
20
+ export default SearchProductCard;
@@ -0,0 +1,8 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Link } from '../../';
3
+ const SearchProductCard = forwardRef(function ProductCard({ testId = 'fs-search-product-card', linkProps, onLinkClick, children, ...otherProps }, ref) {
4
+ return (React.createElement("article", { ref: ref, "data-fs-search-product-card": true, "data-testid": testId, ...otherProps },
5
+ React.createElement(Link, { ...linkProps, "data-fs-search-product-card-link": true, title: name, variant: "display", onClick: onLinkClick }, children)));
6
+ });
7
+ export default SearchProductCard;
8
+ //# sourceMappingURL=SearchProductCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchProductCard.js","sourceRoot":"","sources":["../../../src/molecules/SearchProductCard/SearchProductCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,IAAI,EAA8B,MAAM,QAAQ,CAAA;AAkBzD,MAAM,iBAAiB,GAAG,UAAU,CAClC,SAAS,WAAW,CAClB,EACE,MAAM,GAAG,wBAAwB,EACjC,SAAS,EACT,WAAW,EACX,QAAQ,EACR,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,iCACE,GAAG,EAAE,GAAG,sDAEK,MAAM,KACf,UAAU;QAEd,oBAAC,IAAI,OACC,SAAS,4CAEb,KAAK,EAAE,IAAI,EACX,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,WAAW,IAEnB,QAAQ,CACJ,CACC,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { Price } from '../../';
3
+ import type { PriceFormatter } from '../../atoms/Price/Price';
4
+ interface Price {
5
+ value: number;
6
+ listPrice: number;
7
+ formatter: PriceFormatter;
8
+ }
9
+ export type SearchProductCardContentProps = {
10
+ /**
11
+ * Specifies the product's title.
12
+ */
13
+ title: string;
14
+ /**
15
+ * Specifies product's prices.
16
+ */
17
+ price: Price;
18
+ };
19
+ declare const SearchProductCardContent: React.ForwardRefExoticComponent<SearchProductCardContentProps & React.RefAttributes<HTMLElement>>;
20
+ export default SearchProductCardContent;
@@ -0,0 +1,11 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Price } from '../../';
3
+ const SearchProductCardContent = forwardRef(function SearchProductCardContent({ price, title, ...otherProps }, ref) {
4
+ return (React.createElement("section", { ref: ref, "data-fs-search-product-card-content": true, ...otherProps },
5
+ React.createElement("p", { "data-fs-search-product-card-title": true }, title),
6
+ React.createElement("span", { "data-fs-search-product-card-prices": true },
7
+ React.createElement(Price, { value: price?.listPrice ? price.listPrice : 0, formatter: price?.formatter, testId: "list-price", "data-value": price?.listPrice, variant: "listing", SRText: "Original price:" }),
8
+ React.createElement(Price, { value: price?.value ? price.value : 0, formatter: price?.formatter, testId: "price", "data-value": price?.value, variant: "spot", SRText: "Price:" }))));
9
+ });
10
+ export default SearchProductCardContent;
11
+ //# sourceMappingURL=SearchProductCardContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchProductCardContent.js","sourceRoot":"","sources":["../../../src/molecules/SearchProductCard/SearchProductCardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAoB9B,MAAM,wBAAwB,GAAG,UAAU,CAGzC,SAAS,wBAAwB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,EAAE,GAAG;IACtE,OAAO,CACL,iCAAS,GAAG,EAAE,GAAG,kDAA0C,UAAU;QACnE,wEAAsC,KAAK,CAAK;QAChD;YACE,oBAAC,KAAK,IACJ,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAC7C,SAAS,EAAE,KAAK,EAAE,SAAS,EAC3B,MAAM,EAAC,YAAY,gBACP,KAAK,EAAE,SAAS,EAC5B,OAAO,EAAC,SAAS,EACjB,MAAM,EAAC,iBAAiB,GACxB;YACF,oBAAC,KAAK,IACJ,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACrC,SAAS,EAAE,KAAK,EAAE,SAAS,EAC3B,MAAM,EAAC,OAAO,gBACF,KAAK,EAAE,KAAK,EACxB,OAAO,EAAC,MAAM,EACd,MAAM,EAAC,QAAQ,GACf,CACG,CACC,CACX,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,wBAAwB,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ export interface SearchProductCardImageProps 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 SearchProductCardImage: React.ForwardRefExoticComponent<SearchProductCardImageProps & React.RefAttributes<HTMLDivElement>>;
10
+ export default SearchProductCardImage;
@@ -0,0 +1,6 @@
1
+ import React, { forwardRef } from 'react';
2
+ const SearchProductCardImage = forwardRef(function SearchProductCardImage({ testId = 'fs-search-product-card-image', children, ...otherProps }, ref) {
3
+ return (React.createElement("div", { ref: ref, "data-fs-search-product-card-image": true, "data-testid": testId, ...otherProps }, children));
4
+ });
5
+ export default SearchProductCardImage;
6
+ //# sourceMappingURL=SearchProductCardImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchProductCardImage.js","sourceRoot":"","sources":["../../../src/molecules/SearchProductCard/SearchProductCardImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAUzC,MAAM,sBAAsB,GAAG,UAAU,CAGvC,SAAS,sBAAsB,CAC/B,EAAE,MAAM,GAAG,8BAA8B,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EACpE,GAAG;IAEH,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,4DAEK,MAAM,KACf,UAAU,IAEb,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,sBAAsB,CAAA"}
@@ -0,0 +1,6 @@
1
+ export { default } from './SearchProductCard';
2
+ export type { SearchProductCardProps } from './SearchProductCard';
3
+ export { default as SearchProductCardImage } from './SearchProductCardImage';
4
+ export type { SearchProductCardImageProps } from './SearchProductCardImage';
5
+ export { default as SearchProductCardContent } from './SearchProductCardContent';
6
+ export type { SearchProductCardContentProps } from './SearchProductCardContent';
@@ -0,0 +1,4 @@
1
+ export { default } from './SearchProductCard';
2
+ export { default as SearchProductCardImage } from './SearchProductCardImage';
3
+ export { default as SearchProductCardContent } from './SearchProductCardContent';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/SearchProductCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG7C,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAG5E,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/components",
3
- "version": "2.0.69-alpha.0",
3
+ "version": "2.0.70-alpha.0",
4
4
  "module": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "author": "Emerson Laurentino @emersonlaurentino",
@@ -30,5 +30,5 @@
30
30
  "node": "16.18.0",
31
31
  "yarn": "1.19.1"
32
32
  },
33
- "gitHead": "9203ce7fd8a8fd0d0ae60afde8743adaec18c53d"
33
+ "gitHead": "5718a199c16ee52a9446cd4090a4f564863c4243"
34
34
  }
@@ -1,6 +1,8 @@
1
1
  import type { HTMLAttributes, ElementType, ReactNode } from 'react'
2
2
  import React, { forwardRef } from 'react'
3
3
 
4
+ import { SROnly } from '../../'
5
+
4
6
  export type PriceVariant =
5
7
  | 'selling'
6
8
  | 'listing'
@@ -32,6 +34,10 @@ export interface PriceProps
32
34
  * The current use case variant for prices.
33
35
  */
34
36
  variant?: PriceVariant
37
+ /**
38
+ * Text for the screen readers only
39
+ */
40
+ SRText?: string
35
41
  }
36
42
 
37
43
  const Price = forwardRef<Omit<HTMLSpanElement, 'children'>, PriceProps>(
@@ -42,6 +48,7 @@ const Price = forwardRef<Omit<HTMLSpanElement, 'children'>, PriceProps>(
42
48
  variant = 'selling',
43
49
  testId = 'fs-price',
44
50
  formatter = (price) => price,
51
+ SRText,
45
52
  ...otherProps
46
53
  },
47
54
  ref
@@ -56,6 +63,7 @@ const Price = forwardRef<Omit<HTMLSpanElement, 'children'>, PriceProps>(
56
63
  data-testid={testId}
57
64
  {...otherProps}
58
65
  >
66
+ {SRText && <SROnly text={SRText} />}
59
67
  {formattedPrice}
60
68
  </Component>
61
69
  )
package/src/index.ts CHANGED
@@ -119,6 +119,16 @@ export { default as RadioGroup, RadioOption } from './molecules/RadioGroup'
119
119
  export type { RadioGroupProps, RadioOptionProps } from './molecules/RadioGroup'
120
120
  export { default as Rating } from './molecules/Rating'
121
121
  export type { RatingProps } from './molecules/Rating'
122
+ export {
123
+ default as SearchProductCard,
124
+ SearchProductCardImage,
125
+ SearchProductCardContent,
126
+ } from './molecules/SearchProductCard'
127
+ export type {
128
+ SearchProductCardProps,
129
+ SearchProductCardImageProps,
130
+ SearchProductCardContentProps,
131
+ } from './molecules/SearchProductCard'
122
132
  export { default as SelectField } from './molecules/SelectField'
123
133
  export type { SelectFieldProps } from './molecules/SelectField'
124
134
  export {
@@ -103,6 +103,7 @@ const ProductCardContent = forwardRef<HTMLElement, ProductCardContentProps>(
103
103
  testId="list-price"
104
104
  data-value={price?.listPrice}
105
105
  variant="listing"
106
+ SRText="Original price:"
106
107
  />
107
108
  <Price
108
109
  value={price?.value ? price.value : 0}
@@ -110,6 +111,7 @@ const ProductCardContent = forwardRef<HTMLElement, ProductCardContentProps>(
110
111
  testId="price"
111
112
  data-value={price?.value}
112
113
  variant="spot"
114
+ SRText="Sale Price:"
113
115
  />
114
116
  </div>
115
117
  {ratingValue && <Rating value={ratingValue} icon={<Star />} />}
@@ -0,0 +1,54 @@
1
+ import React, { forwardRef } from 'react'
2
+ import type { HTMLAttributes } from 'react'
3
+
4
+ import { Link, LinkProps, LinkElementType } from '../../'
5
+
6
+ export interface SearchProductCardProps extends HTMLAttributes<HTMLDivElement> {
7
+ /**
8
+ * ID to find this component in testing tools (e.g.: cypress,
9
+ * testing-library, and jest).
10
+ */
11
+ testId?: string
12
+ /**
13
+ * Props for the link from SearchProduct component.
14
+ */
15
+ linkProps?: Partial<LinkProps<LinkElementType>>
16
+ /**
17
+ * Callback function when SearchProduct link is clicked.
18
+ */
19
+ onLinkClick?: () => void
20
+ }
21
+
22
+ const SearchProductCard = forwardRef<HTMLDivElement, SearchProductCardProps>(
23
+ function ProductCard(
24
+ {
25
+ testId = 'fs-search-product-card',
26
+ linkProps,
27
+ onLinkClick,
28
+ children,
29
+ ...otherProps
30
+ },
31
+ ref
32
+ ) {
33
+ return (
34
+ <article
35
+ ref={ref}
36
+ data-fs-search-product-card
37
+ data-testid={testId}
38
+ {...otherProps}
39
+ >
40
+ <Link
41
+ {...linkProps}
42
+ data-fs-search-product-card-link
43
+ title={name}
44
+ variant="display"
45
+ onClick={onLinkClick}
46
+ >
47
+ {children}
48
+ </Link>
49
+ </article>
50
+ )
51
+ }
52
+ )
53
+
54
+ export default SearchProductCard
@@ -0,0 +1,51 @@
1
+ import React, { forwardRef } from 'react'
2
+ import { Price } from '../../'
3
+ import type { PriceFormatter } from '../../atoms/Price/Price'
4
+
5
+ interface Price {
6
+ value: number
7
+ listPrice: number
8
+ formatter: PriceFormatter
9
+ }
10
+
11
+ export type SearchProductCardContentProps = {
12
+ /**
13
+ * Specifies the product's title.
14
+ */
15
+ title: string
16
+ /**
17
+ * Specifies product's prices.
18
+ */
19
+ price: Price
20
+ }
21
+
22
+ const SearchProductCardContent = forwardRef<
23
+ HTMLElement,
24
+ SearchProductCardContentProps
25
+ >(function SearchProductCardContent({ price, title, ...otherProps }, ref) {
26
+ return (
27
+ <section ref={ref} data-fs-search-product-card-content {...otherProps}>
28
+ <p data-fs-search-product-card-title>{title}</p>
29
+ <span data-fs-search-product-card-prices>
30
+ <Price
31
+ value={price?.listPrice ? price.listPrice : 0}
32
+ formatter={price?.formatter}
33
+ testId="list-price"
34
+ data-value={price?.listPrice}
35
+ variant="listing"
36
+ SRText="Original price:"
37
+ />
38
+ <Price
39
+ value={price?.value ? price.value : 0}
40
+ formatter={price?.formatter}
41
+ testId="price"
42
+ data-value={price?.value}
43
+ variant="spot"
44
+ SRText="Price:"
45
+ />
46
+ </span>
47
+ </section>
48
+ )
49
+ })
50
+
51
+ export default SearchProductCardContent
@@ -0,0 +1,31 @@
1
+ import type { HTMLAttributes } from 'react'
2
+ import React, { forwardRef } from 'react'
3
+
4
+ export interface SearchProductCardImageProps
5
+ extends HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
8
+ */
9
+ testId?: string
10
+ }
11
+
12
+ const SearchProductCardImage = forwardRef<
13
+ HTMLDivElement,
14
+ SearchProductCardImageProps
15
+ >(function SearchProductCardImage(
16
+ { testId = 'fs-search-product-card-image', children, ...otherProps },
17
+ ref
18
+ ) {
19
+ return (
20
+ <div
21
+ ref={ref}
22
+ data-fs-search-product-card-image
23
+ data-testid={testId}
24
+ {...otherProps}
25
+ >
26
+ {children}
27
+ </div>
28
+ )
29
+ })
30
+
31
+ export default SearchProductCardImage
@@ -0,0 +1,8 @@
1
+ export { default } from './SearchProductCard'
2
+ export type { SearchProductCardProps } from './SearchProductCard'
3
+
4
+ export { default as SearchProductCardImage } from './SearchProductCardImage'
5
+ export type { SearchProductCardImageProps } from './SearchProductCardImage'
6
+
7
+ export { default as SearchProductCardContent } from './SearchProductCardContent'
8
+ export type { SearchProductCardContentProps } from './SearchProductCardContent'