@faststore/components 2.0.28-alpha.0 → 2.0.29-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 +9 -0
- package/dist/molecules/DiscountBadge/DiscountBadge.d.ts +4 -3
- package/dist/molecules/DiscountBadge/DiscountBadge.js +2 -2
- package/dist/molecules/DiscountBadge/DiscountBadge.js.map +1 -1
- package/dist/molecules/SelectField/SelectField.js +2 -2
- package/dist/molecules/SelectField/SelectField.js.map +1 -1
- package/package.json +2 -2
- package/src/molecules/DiscountBadge/DiscountBadge.tsx +5 -2
- package/src/molecules/SelectField/SelectField.tsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
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.29-alpha.0](https://github.com/vtex/faststore/compare/v2.0.28-alpha.0...v2.0.29-alpha.0) (2022-12-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Adds Badge props to `DiscountBadge` + Fixes SelectField testId ([#1570](https://github.com/vtex/faststore/issues/1570)) ([b1513a5](https://github.com/vtex/faststore/commit/b1513a569235cb60bd3a1c6f16e24fd61d810017))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [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
16
|
|
|
8
17
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
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,
|
|
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
|
|
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
|
|
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.
|
|
3
|
+
"version": "2.0.29-alpha.0",
|
|
4
4
|
"module": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"author": "Emerson Laurentino @emersonlaurentino",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"node": "16.18.0",
|
|
29
29
|
"yarn": "1.19.1"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "bbb814ece0e5ba067669003801e0741fe47e9e5e"
|
|
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
|
|
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
|
|
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
|
})
|