@faststore/components 2.0.28-alpha.0 → 2.0.30-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.
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.30-alpha.0 (2023-01-02)
7
+
8
+
9
+ ### Documentation
10
+
11
+ * cms ([#1573](https://github.com/vtex/faststore/issues/1573)) ([f540edd](https://github.com/vtex/faststore/commit/f540edd5e8c7ea10e8cd26b1c6f65b10ecce67c4))
12
+
13
+
14
+
15
+ ## [2.0.29-alpha.0](https://github.com/vtex/faststore/compare/v2.0.28-alpha.0...v2.0.29-alpha.0) (2022-12-23)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Adds Badge props to `DiscountBadge` + Fixes SelectField testId ([#1570](https://github.com/vtex/faststore/issues/1570)) ([b1513a5](https://github.com/vtex/faststore/commit/b1513a569235cb60bd3a1c6f16e24fd61d810017))
21
+
22
+
23
+
6
24
  ## [2.0.28-alpha.0](https://github.com/vtex/faststore/compare/v2.0.27-alpha.0...v2.0.28-alpha.0) (2022-12-23)
7
25
 
8
26
 
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare type DiscountBadgeProps = {
2
+ import { BadgeProps } from '../..';
3
+ export interface DiscountBadgeProps extends Omit<BadgeProps, 'variant' | 'counter' | 'aria-label'> {
3
4
  /**
4
5
  * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
5
6
  */
@@ -20,6 +21,6 @@ export declare type DiscountBadgeProps = {
20
21
  * Sets the limit percentage value to consider a high discount.
21
22
  */
22
23
  thresholdHigh?: number;
23
- };
24
- declare const DiscountBadge: ({ listPrice, spotPrice, thresholdLow, thresholdHigh, testId, }: DiscountBadgeProps) => JSX.Element;
24
+ }
25
+ declare const DiscountBadge: ({ listPrice, spotPrice, thresholdLow, thresholdHigh, size, testId, }: DiscountBadgeProps) => JSX.Element;
25
26
  export default DiscountBadge;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Badge } from '../..';
3
3
  import { useDiscountPercent } from '../DiscountBadge/useDiscountPercent';
4
- const DiscountBadge = ({ listPrice, spotPrice, thresholdLow = 15, thresholdHigh = 40, testId = 'fs-discount-badge', }) => {
4
+ const DiscountBadge = ({ listPrice, spotPrice, thresholdLow = 15, thresholdHigh = 40, size, testId = 'fs-discount-badge', }) => {
5
5
  const discountPercent = useDiscountPercent(listPrice, spotPrice);
6
6
  if (discountPercent === 0) {
7
7
  return React.createElement(React.Fragment, null);
@@ -11,7 +11,7 @@ const DiscountBadge = ({ listPrice, spotPrice, thresholdLow = 15, thresholdHigh
11
11
  : discountPercent <= thresholdHigh
12
12
  ? 'medium'
13
13
  : 'high';
14
- return (React.createElement(Badge, { "data-fs-discount-badge": true, "data-fs-discount-badge-variant": discountVariant, "data-testid": testId },
14
+ return (React.createElement(Badge, { "data-fs-discount-badge": true, "data-fs-discount-badge-variant": discountVariant, size: size, "data-testid": testId },
15
15
  discountPercent,
16
16
  "% off"));
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DiscountBadge.js","sourceRoot":"","sources":["../../../src/molecules/DiscountBadge/DiscountBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAyBxE,MAAM,aAAa,GAAG,CAAC,EACrB,SAAS,EACT,SAAS,EACT,YAAY,GAAG,EAAE,EACjB,aAAa,GAAG,EAAE,EAClB,MAAM,GAAG,mBAAmB,GACT,EAAE,EAAE;IACvB,MAAM,eAAe,GAAG,kBAAkB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IAEhE,IAAI,eAAe,KAAK,CAAC,EAAE;QACzB,OAAO,yCAAK,CAAA;KACb;IAED,MAAM,eAAe,GACnB,eAAe,IAAI,YAAY;QAC7B,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,eAAe,IAAI,aAAa;YAClC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAA;IAEZ,OAAO,CACL,oBAAC,KAAK,sEAE4B,eAAe,iBAClC,MAAM;QAElB,eAAe;gBACV,CACT,CAAA;AACH,CAAC,CAAA;AAED,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"DiscountBadge.js","sourceRoot":"","sources":["../../../src/molecules/DiscountBadge/DiscountBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,EAAc,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AA0BxE,MAAM,aAAa,GAAG,CAAC,EACrB,SAAS,EACT,SAAS,EACT,YAAY,GAAG,EAAE,EACjB,aAAa,GAAG,EAAE,EAClB,IAAI,EACJ,MAAM,GAAG,mBAAmB,GACT,EAAE,EAAE;IACvB,MAAM,eAAe,GAAG,kBAAkB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IAEhE,IAAI,eAAe,KAAK,CAAC,EAAE;QACzB,OAAO,yCAAK,CAAA;KACb;IAED,MAAM,eAAe,GACnB,eAAe,IAAI,YAAY;QAC7B,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,eAAe,IAAI,aAAa;YAClC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAA;IAEZ,OAAO,CACL,oBAAC,KAAK,sEAE4B,eAAe,EAC/C,IAAI,EAAE,IAAI,iBACG,MAAM;QAElB,eAAe;gBACV,CACT,CAAA;AACH,CAAC,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import { Label, Select } from '../..';
3
3
  const SelectField = forwardRef(function SelectField({ id, label, options, testId = 'fs-select-field', ...otherProps }, ref) {
4
- return (React.createElement("div", { ref: ref, "data-fs-select-field": true, "data-testid": testId },
4
+ return (React.createElement("div", { ref: ref, "data-fs-select-field": true },
5
5
  React.createElement(Label, { "data-fs-select-field-label": true, htmlFor: id }, label),
6
- React.createElement(Select, { id: id, options: options, ...otherProps })));
6
+ React.createElement(Select, { id: id, options: options, "data-testid": testId, ...otherProps })));
7
7
  });
8
8
  export default SelectField;
9
9
  //# sourceMappingURL=SelectField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../src/molecules/SelectField/SelectField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAUrC,MAAM,WAAW,GAAG,UAAU,CAG5B,SAAS,WAAW,CACpB,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,EAAE,GAAG,UAAU,EAAE,EACjE,GAAG;IAEH,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,+CAAoC,MAAM;QACrD,oBAAC,KAAK,wCAA4B,OAAO,EAAE,EAAE,IAC1C,KAAK,CACA;QACR,oBAAC,MAAM,IAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,KAAM,UAAU,GAAI,CAChD,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../src/molecules/SelectField/SelectField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAUrC,MAAM,WAAW,GAAG,UAAU,CAG5B,SAAS,WAAW,CACpB,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,EAAE,GAAG,UAAU,EAAE,EACjE,GAAG;IAEH,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG;QACX,oBAAC,KAAK,wCAA4B,OAAO,EAAE,EAAE,IAC1C,KAAK,CACA;QACR,oBAAC,MAAM,IAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,iBAAe,MAAM,KAAM,UAAU,GAAI,CACrE,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,WAAW,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/components",
3
- "version": "2.0.28-alpha.0",
3
+ "version": "2.0.30-alpha.0",
4
4
  "module": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "author": "Emerson Laurentino @emersonlaurentino",
@@ -21,12 +21,12 @@
21
21
  "src"
22
22
  ],
23
23
  "devDependencies": {
24
- "@faststore/shared": "^2.0.3-alpha.0",
24
+ "@faststore/shared": "^2.0.30-alpha.0",
25
25
  "typescript": "^4.8.4"
26
26
  },
27
27
  "volta": {
28
28
  "node": "16.18.0",
29
29
  "yarn": "1.19.1"
30
30
  },
31
- "gitHead": "3fd249f7fa1d6224af74c6a53e429528f82c96fe"
31
+ "gitHead": "e36e4ccd7986e227a41ce72f753b3c03fb152c08"
32
32
  }
@@ -1,9 +1,10 @@
1
1
  import React from 'react'
2
- import { Badge } from '../..'
2
+ import { Badge, BadgeProps } from '../..'
3
3
 
4
4
  import { useDiscountPercent } from '../DiscountBadge/useDiscountPercent'
5
5
 
6
- export type DiscountBadgeProps = {
6
+ export interface DiscountBadgeProps
7
+ extends Omit<BadgeProps, 'variant' | 'counter' | 'aria-label'> {
7
8
  /**
8
9
  * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
9
10
  */
@@ -31,6 +32,7 @@ const DiscountBadge = ({
31
32
  spotPrice,
32
33
  thresholdLow = 15,
33
34
  thresholdHigh = 40,
35
+ size,
34
36
  testId = 'fs-discount-badge',
35
37
  }: DiscountBadgeProps) => {
36
38
  const discountPercent = useDiscountPercent(listPrice, spotPrice)
@@ -50,6 +52,7 @@ const DiscountBadge = ({
50
52
  <Badge
51
53
  data-fs-discount-badge
52
54
  data-fs-discount-badge-variant={discountVariant}
55
+ size={size}
53
56
  data-testid={testId}
54
57
  >
55
58
  {discountPercent}% off
@@ -19,11 +19,11 @@ const SelectField = forwardRef<
19
19
  ref
20
20
  ) {
21
21
  return (
22
- <div ref={ref} data-fs-select-field data-testid={testId}>
22
+ <div ref={ref} data-fs-select-field>
23
23
  <Label data-fs-select-field-label htmlFor={id}>
24
24
  {label}
25
25
  </Label>
26
- <Select id={id} options={options} {...otherProps} />
26
+ <Select id={id} options={options} data-testid={testId} {...otherProps} />
27
27
  </div>
28
28
  )
29
29
  })