@faststore/components 2.0.19-alpha.0 → 2.0.24-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/atoms/Badge/Badge.js +1 -1
- package/dist/atoms/Badge/Badge.js.map +1 -1
- package/dist/atoms/Button/Button.js +1 -1
- package/dist/atoms/Button/Button.js.map +1 -1
- package/dist/atoms/Icon/Icon.d.ts +4 -4
- package/dist/atoms/Link/Link.d.ts +4 -4
- package/dist/atoms/Link/Link.js +1 -1
- package/dist/atoms/Link/Link.js.map +1 -1
- package/dist/atoms/List/List.js +1 -1
- package/dist/atoms/List/List.js.map +1 -1
- package/dist/atoms/Overlay/Overlay.js +1 -1
- package/dist/atoms/Overlay/Overlay.js.map +1 -1
- package/dist/atoms/Price/Price.d.ts +4 -4
- package/dist/atoms/Price/Price.js +1 -1
- package/dist/atoms/Price/Price.js.map +1 -1
- package/dist/atoms/Radio/Radio.js +1 -1
- package/dist/atoms/Radio/Radio.js.map +1 -1
- package/dist/atoms/SROnly/SROnly.d.ts +2 -2
- package/dist/atoms/SROnly/SROnly.js.map +1 -1
- package/dist/atoms/Select/Select.d.ts +4 -4
- package/dist/atoms/Select/Select.js +1 -1
- package/dist/atoms/Select/Select.js.map +1 -1
- package/dist/molecules/BuyButton/BuyButton.d.ts +2 -2
- package/dist/molecules/BuyButton/BuyButton.js +2 -2
- package/dist/molecules/BuyButton/BuyButton.js.map +1 -1
- package/dist/molecules/DiscountBadge/DiscountBadge.d.ts +5 -5
- package/dist/molecules/DiscountBadge/DiscountBadge.js +2 -2
- package/dist/molecules/DiscountBadge/DiscountBadge.js.map +1 -1
- package/dist/molecules/IconButton/IconButton.js +1 -1
- package/dist/molecules/IconButton/IconButton.js.map +1 -1
- package/dist/molecules/InputField/InputField.d.ts +5 -1
- package/dist/molecules/InputField/InputField.js +2 -2
- package/dist/molecules/InputField/InputField.js.map +1 -1
- package/dist/molecules/LinkButton/LinkButton.js +1 -1
- package/dist/molecules/LinkButton/LinkButton.js.map +1 -1
- package/dist/molecules/SelectField/SelectField.js +2 -2
- package/dist/molecules/SelectField/SelectField.js.map +1 -1
- package/dist/molecules/Tag/Tag.js +1 -1
- package/dist/molecules/Tag/Tag.js.map +1 -1
- package/dist/molecules/Toggle/Toggle.js +1 -1
- package/dist/molecules/Toggle/Toggle.js.map +1 -1
- package/package.json +2 -2
- package/src/atoms/Badge/Badge.tsx +1 -1
- package/src/atoms/Button/Button.tsx +1 -1
- package/src/atoms/Icon/Icon.tsx +4 -4
- package/src/atoms/Link/Link.tsx +19 -14
- package/src/atoms/List/List.tsx +1 -1
- package/src/atoms/Overlay/Overlay.tsx +2 -2
- package/src/atoms/Price/Price.tsx +5 -5
- package/src/atoms/Radio/Radio.tsx +1 -1
- package/src/atoms/SROnly/SROnly.tsx +2 -2
- package/src/atoms/Select/Select.tsx +6 -6
- package/src/molecules/BuyButton/BuyButton.tsx +8 -3
- package/src/molecules/DiscountBadge/DiscountBadge.tsx +6 -6
- package/src/molecules/IconButton/IconButton.tsx +1 -1
- package/src/molecules/InputField/InputField.tsx +6 -0
- package/src/molecules/LinkButton/LinkButton.tsx +2 -2
- package/src/molecules/SelectField/SelectField.tsx +2 -2
- package/src/molecules/Tag/Tag.tsx +1 -1
- package/src/molecules/Toggle/Toggle.tsx +1 -1
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.24-alpha.0](https://github.com/vtex/faststore/compare/v2.0.23-alpha.0...v2.0.24-alpha.0) (2022-12-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Chores
|
|
10
|
+
|
|
11
|
+
* Review components docs ([#1557](https://github.com/vtex/faststore/issues/1557)) ([2da23a0](https://github.com/vtex/faststore/commit/2da23a0ffe2f201f7e6163ea3db8dea4de07afa8))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [2.0.19-alpha.0](https://github.com/vtex/faststore/compare/v2.0.18-alpha.0...v2.0.19-alpha.0) (2022-12-16)
|
|
7
16
|
|
|
8
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
const Badge = forwardRef(function Badge({ testId = 'fs-badge', size = 'small', variant = 'neutral', counter = false, 'aria-label': ariaLabel, children, ...otherProps }, ref) {
|
|
3
|
-
return (React.createElement("div", { ref: ref, "data-fs-badge": true, "
|
|
3
|
+
return (React.createElement("div", { ref: ref, "data-fs-badge": true, "aria-label": ariaLabel, "data-fs-badge-variant": counter ? null : variant, "data-fs-badge-size": size, "data-fs-badge-counter": counter, "data-testid": testId, ...otherProps },
|
|
4
4
|
React.createElement("div", { "data-fs-badge-wrapper": true }, children)));
|
|
5
5
|
});
|
|
6
6
|
export default Badge;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/atoms/Badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAkCzC,MAAM,KAAK,GAAG,UAAU,CAA6B,SAAS,KAAK,CACjE,EACE,MAAM,GAAG,UAAU,EACnB,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,KAAK,EACf,YAAY,EAAE,SAAS,EACvB,QAAQ,EACR,GAAG,UAAU,EACF,EACb,GAAG;IAEH,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/atoms/Badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAkCzC,MAAM,KAAK,GAAG,UAAU,CAA6B,SAAS,KAAK,CACjE,EACE,MAAM,GAAG,UAAU,EACnB,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,KAAK,EACf,YAAY,EAAE,SAAS,EACvB,QAAQ,EACR,GAAG,UAAU,EACF,EACb,GAAG;IAEH,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,uCAEI,SAAS,2BACE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,wBAC3B,IAAI,2BACD,OAAO,iBACjB,MAAM,KACf,UAAU;QAEd,8DAA4B,QAAQ,CAAO,CACvC,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,KAAK,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Icon } from '../../index';
|
|
3
3
|
const Button = forwardRef(function Button({ children, variant, inverse, size = 'regular', testId = 'fs-button', icon, iconPosition = 'left', disabled, ...otherProps }, ref) {
|
|
4
|
-
return (React.createElement("button", { ref: ref, "data-
|
|
4
|
+
return (React.createElement("button", { ref: ref, "data-fs-button": true, "data-fs-button-inverse": inverse, "data-fs-button-size": size, "data-fs-button-variant": variant, disabled: disabled, "data-testid": testId, ...otherProps },
|
|
5
5
|
icon && iconPosition === 'left' && React.createElement(Icon, { component: icon }),
|
|
6
6
|
children,
|
|
7
7
|
icon && iconPosition === 'right' && React.createElement(Icon, { component: icon })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/atoms/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAqClC,MAAM,MAAM,GAAG,UAAU,CAAiC,SAAS,MAAM,CACvE,EACE,QAAQ,EACR,OAAO,EACP,OAAO,EACP,IAAI,GAAG,SAAS,EAChB,MAAM,GAAG,WAAW,EACpB,IAAI,EACJ,YAAY,GAAG,MAAM,EACrB,QAAQ,EACR,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,gCACE,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/atoms/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAqClC,MAAM,MAAM,GAAG,UAAU,CAAiC,SAAS,MAAM,CACvE,EACE,QAAQ,EACR,OAAO,EACP,OAAO,EACP,IAAI,GAAG,SAAS,EAChB,MAAM,GAAG,WAAW,EACpB,IAAI,EACJ,YAAY,GAAG,MAAM,EACrB,QAAQ,EACR,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,gCACE,GAAG,EAAE,GAAG,oDAEgB,OAAO,yBACV,IAAI,4BACD,OAAO,EAC/B,QAAQ,EAAE,QAAQ,iBACL,MAAM,KACf,UAAU;QAEb,IAAI,IAAI,YAAY,KAAK,MAAM,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,GAAI;QAC5D,QAAQ;QACR,IAAI,IAAI,YAAY,KAAK,OAAO,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,GAAI,CACvD,CACV,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,MAAM,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
-
/**
|
|
5
|
-
* A React component that will be rendered as an icon.
|
|
6
|
-
*/
|
|
7
|
-
component: ReactNode;
|
|
8
4
|
/**
|
|
9
5
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
10
6
|
*/
|
|
11
7
|
testId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* A React component that will be rendered as an icon.
|
|
10
|
+
*/
|
|
11
|
+
component: ReactNode;
|
|
12
12
|
}
|
|
13
13
|
declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
14
14
|
export default Icon;
|
|
@@ -6,12 +6,12 @@ declare type LinkBaseProps = {
|
|
|
6
6
|
*/
|
|
7
7
|
testId?: string;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* Specifies the component variant.
|
|
10
|
+
*/
|
|
11
11
|
variant?: 'default' | 'display' | 'inline';
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* Defines use of inverted color.
|
|
14
|
+
*/
|
|
15
15
|
inverse?: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Defines size os element
|
package/dist/atoms/Link/Link.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
const Link = forwardRef(function Link({ as, children, variant = 'default', size =
|
|
2
|
+
const Link = forwardRef(function Link({ as, children, variant = 'default', size = 'regular', inverse, testId = 'fs-link', ...otherProps }, ref) {
|
|
3
3
|
const Component = as ?? 'a';
|
|
4
4
|
return (React.createElement(Component, { ref: ref, "data-fs-link": true, "data-fs-link-variant": variant, "data-fs-link-inverse": inverse, "data-fs-link-size": size, "data-testid": testId, ...otherProps }, children));
|
|
5
5
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/atoms/Link/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/atoms/Link/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAgCzC,MAAM,IAAI,GAAkB,UAAU,CAAC,SAAS,IAAI,CAGlD,EACE,EAAE,EACF,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,SAAS,EAChB,OAAO,EACP,MAAM,GAAG,SAAS,EAClB,GAAG,UAAU,EACA,EACf,GAAuB;IAEvB,MAAM,SAAS,GAAG,EAAE,IAAI,GAAG,CAAA;IAE3B,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,gDAEc,OAAO,0BACP,OAAO,uBACV,IAAI,iBACV,MAAM,KACf,UAAU,IAEb,QAAQ,CACC,CACb,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,IAAI,CAAA"}
|
package/dist/atoms/List/List.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
const List = forwardRef(function List({ as, marker, testId = 'fs-list', ...otherProps }, ref) {
|
|
3
3
|
const Component = as ?? 'ul';
|
|
4
|
-
return (React.createElement(Component, { ref: ref, "data-fs-list": true, "data-
|
|
4
|
+
return (React.createElement(Component, { ref: ref, "data-fs-list": true, "data-fs-list-marker": marker, "data-testid": testId, ...otherProps }));
|
|
5
5
|
});
|
|
6
6
|
export default List;
|
|
7
7
|
//# sourceMappingURL=List.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/atoms/List/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AA0BzC,MAAM,IAAI,GAAkB,UAAU,CAAC,SAAS,IAAI,CAGlD,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,UAAU,EAAgB,EAC/D,GAAsB;IAEtB,MAAM,SAAS,GAAG,EAAE,IAAI,IAAI,CAAA;IAE5B,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/atoms/List/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AA0BzC,MAAM,IAAI,GAAkB,UAAU,CAAC,SAAS,IAAI,CAGlD,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,UAAU,EAAgB,EAC/D,GAAsB;IAEtB,MAAM,SAAS,GAAG,EAAE,IAAI,IAAI,CAAA;IAE5B,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,+CAEa,MAAM,iBACd,MAAM,KACf,UAAU,GACd,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,IAAI,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
const Overlay = forwardRef(function Overlay({ testId = 'fs-overlay', ...otherProps }, ref) {
|
|
3
|
-
return (React.createElement("div", {
|
|
3
|
+
return (React.createElement("div", { ref: ref, "data-fs-overlay": true, role: "presentation", "data-testid": testId, ...otherProps }));
|
|
4
4
|
});
|
|
5
5
|
export default Overlay;
|
|
6
6
|
//# sourceMappingURL=Overlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overlay.js","sourceRoot":"","sources":["../../../src/atoms/Overlay/Overlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AASzC,MAAM,OAAO,GAAG,UAAU,CAAwB,SAAS,OAAO,CAChE,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,UAAU,EAAE,EACxC,GAAG;IAEH,OAAO,CACL,6BACE,IAAI,EAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"Overlay.js","sourceRoot":"","sources":["../../../src/atoms/Overlay/Overlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AASzC,MAAM,OAAO,GAAG,UAAU,CAAwB,SAAS,OAAO,CAChE,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,UAAU,EAAE,EACxC,GAAG;IAEH,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,2BAER,IAAI,EAAC,cAAc,iBACN,MAAM,KACf,UAAU,GACd,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,OAAO,CAAA"}
|
|
@@ -3,14 +3,14 @@ import React from 'react';
|
|
|
3
3
|
export declare type PriceVariant = 'selling' | 'listing' | 'spot' | 'savings' | 'installment';
|
|
4
4
|
export declare type PriceFormatter = (price: number, variant: PriceVariant) => ReactNode;
|
|
5
5
|
export interface PriceProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
6
|
-
/**
|
|
7
|
-
* Set the HTML element tag of this component.
|
|
8
|
-
*/
|
|
9
|
-
as?: ElementType;
|
|
10
6
|
/**
|
|
11
7
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
12
8
|
*/
|
|
13
9
|
testId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Set the HTML element tag of this component.
|
|
12
|
+
*/
|
|
13
|
+
as?: ElementType;
|
|
14
14
|
/**
|
|
15
15
|
* The raw price value.
|
|
16
16
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
const Price = forwardRef(function Price({ value, as: Component = 'span', variant = 'selling', testId = 'fs-price', formatter = (price) => price, ...otherProps }, ref) {
|
|
3
3
|
const formattedPrice = formatter(value, variant);
|
|
4
|
-
return (React.createElement(Component, { ref: ref, "data-fs-price": true, "data-
|
|
4
|
+
return (React.createElement(Component, { ref: ref, "data-fs-price": true, "data-fs-price-variant": variant, "data-testid": testId, ...otherProps }, formattedPrice));
|
|
5
5
|
});
|
|
6
6
|
export default Price;
|
|
7
7
|
//# 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,
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
const Radio = forwardRef(function Radio({ testId = 'fs-radio', ...otherProps }, ref) {
|
|
3
|
-
return (React.createElement("input", { ref: ref, "data-fs-radio": true, "data-testid": testId,
|
|
3
|
+
return (React.createElement("input", { ref: ref, "data-fs-radio": true, type: "radio", "data-testid": testId, ...otherProps }));
|
|
4
4
|
});
|
|
5
5
|
export default Radio;
|
|
6
6
|
//# sourceMappingURL=Radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/atoms/Radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAWzC,MAAM,KAAK,GAAG,UAAU,CAA+B,SAAS,KAAK,CACnE,EAAE,MAAM,GAAG,UAAU,EAAE,GAAG,UAAU,EAAc,EAClD,GAAG;IAEH,OAAO,CACL,+BACE,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/atoms/Radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAWzC,MAAM,KAAK,GAAG,UAAU,CAA+B,SAAS,KAAK,CACnE,EAAE,MAAM,GAAG,UAAU,EAAE,GAAG,UAAU,EAAc,EAClD,GAAG;IAEH,OAAO,CACL,+BACE,GAAG,EAAE,GAAG,yBAER,IAAI,EAAC,OAAO,iBACC,MAAM,KACf,UAAU,GACd,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,KAAK,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ElementType } from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface SROnlyProps {
|
|
3
3
|
text: string;
|
|
4
4
|
as?: ElementType;
|
|
5
5
|
}
|
|
6
|
-
declare function SROnly({ text, as }:
|
|
6
|
+
declare function SROnly({ text, as }: SROnlyProps): JSX.Element;
|
|
7
7
|
export default SROnly;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SROnly.js","sourceRoot":"","sources":["../../../src/atoms/SROnly/SROnly.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,SAAS,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"SROnly.js","sourceRoot":"","sources":["../../../src/atoms/SROnly/SROnly.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,SAAS,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAe;IACvC,MAAM,SAAS,GAAG,EAAE,IAAI,MAAM,CAAA;IAE9B,OAAO,oBAAC,SAAS,+BAAkB,IAAI,CAAa,CAAA;AACtD,CAAC;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SelectHTMLAttributes } from 'react';
|
|
3
3
|
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
4
|
+
/**
|
|
5
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
6
|
+
*/
|
|
7
|
+
testId?: string;
|
|
4
8
|
/**
|
|
5
9
|
* Assigns an identifier to link the UISelect component and its label.
|
|
6
10
|
*/
|
|
@@ -11,10 +15,6 @@ export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
|
11
15
|
* will be displayed in the UI.
|
|
12
16
|
*/
|
|
13
17
|
options: Record<string, string>;
|
|
14
|
-
/**
|
|
15
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
16
|
-
*/
|
|
17
|
-
testId?: string;
|
|
18
18
|
}
|
|
19
19
|
declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
20
20
|
export default Select;
|
|
@@ -3,7 +3,7 @@ import { Icon } from '../..';
|
|
|
3
3
|
import { CaretDown } from '../../assets';
|
|
4
4
|
const Select = forwardRef(function Select({ options, id, testId = 'fs-select', ...otherProps }, ref) {
|
|
5
5
|
return (React.createElement("div", { "data-fs-select": true },
|
|
6
|
-
React.createElement("select", {
|
|
6
|
+
React.createElement("select", { ref: ref, id: id, "data-testid": testId, ...otherProps }, Object.keys(options).map((key) => (React.createElement("option", { key: key, value: key }, options[key])))),
|
|
7
7
|
React.createElement(Icon, { "data-fs-select-icon": true, component: React.createElement(CaretDown, null) })));
|
|
8
8
|
});
|
|
9
9
|
export default Select;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/atoms/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAmBxC,MAAM,MAAM,GAAG,UAAU,CAAiC,SAAS,MAAM,CACvE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,UAAU,EAAe,EACjE,GAAG;IAEH,OAAO,CACL;QACE,gCAAQ,EAAE,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/atoms/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAmBxC,MAAM,MAAM,GAAG,UAAU,CAAiC,SAAS,MAAM,CACvE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,UAAU,EAAe,EACjE,GAAG;IAEH,OAAO,CACL;QACE,gCAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,iBAAe,MAAM,KAAM,UAAU,IAC1D,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACjC,gCAAQ,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IACzB,OAAO,CAAC,GAAG,CAAC,CACN,CACV,CAAC,CACK;QACT,oBAAC,IAAI,iCAAqB,SAAS,EAAE,oBAAC,SAAS,OAAG,GAAI,CAClD,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,MAAM,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ButtonProps } from '../../index';
|
|
3
|
-
declare type
|
|
4
|
-
declare function BuyButton({ icon, children, ...otherProps }:
|
|
3
|
+
declare type BuyButtonProps = ButtonProps;
|
|
4
|
+
declare function BuyButton({ testId, icon, children, ...otherProps }: BuyButtonProps): JSX.Element;
|
|
5
5
|
export default BuyButton;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Button, Icon } from '../../index';
|
|
3
3
|
import { ShoppingCart } from '../../assets';
|
|
4
|
-
function BuyButton({ icon, children, ...otherProps }) {
|
|
5
|
-
return (React.createElement(Button, { "data-fs-buy-button": true, ...otherProps },
|
|
4
|
+
function BuyButton({ testId = 'fs-buy-button', icon, children, ...otherProps }) {
|
|
5
|
+
return (React.createElement(Button, { "data-fs-buy-button": true, "data-testid": testId, ...otherProps },
|
|
6
6
|
React.createElement(Icon, { component: React.createElement(ShoppingCart, null) }),
|
|
7
7
|
children));
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyButton.js","sourceRoot":"","sources":["../../../src/molecules/BuyButton/BuyButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAI3C,SAAS,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"BuyButton.js","sourceRoot":"","sources":["../../../src/molecules/BuyButton/BuyButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAI3C,SAAS,SAAS,CAAC,EACjB,MAAM,GAAG,eAAe,EACxB,IAAI,EACJ,QAAQ,EACR,GAAG,UAAU,EACE;IACf,OAAO,CACL,oBAAC,MAAM,+CAAiC,MAAM,KAAM,UAAU;QAC5D,oBAAC,IAAI,IAAC,SAAS,EAAE,oBAAC,YAAY,OAAG,GAAI;QACpC,QAAQ,CACF,CACV,CAAA;AACH,CAAC;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare type DiscountBadgeProps = {
|
|
3
|
+
/**
|
|
4
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
5
|
+
*/
|
|
6
|
+
testId?: string;
|
|
3
7
|
/**
|
|
4
8
|
* Specifies price without discount applied.
|
|
5
9
|
*/
|
|
@@ -8,10 +12,6 @@ export declare type DiscountBadgeProps = {
|
|
|
8
12
|
* Specifies current price with discount applied.
|
|
9
13
|
*/
|
|
10
14
|
spotPrice: number;
|
|
11
|
-
/**
|
|
12
|
-
* Sets the component's size.
|
|
13
|
-
*/
|
|
14
|
-
size?: 'small' | 'big';
|
|
15
15
|
/**
|
|
16
16
|
* Sets the limit percentage value to consider a low discount.
|
|
17
17
|
*/
|
|
@@ -21,5 +21,5 @@ export declare type DiscountBadgeProps = {
|
|
|
21
21
|
*/
|
|
22
22
|
thresholdHigh?: number;
|
|
23
23
|
};
|
|
24
|
-
declare const DiscountBadge: ({ listPrice, spotPrice,
|
|
24
|
+
declare const DiscountBadge: ({ listPrice, spotPrice, thresholdLow, thresholdHigh, testId, }: DiscountBadgeProps) => JSX.Element;
|
|
25
25
|
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,
|
|
4
|
+
const DiscountBadge = ({ listPrice, spotPrice, thresholdLow = 15, thresholdHigh = 40, 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, size = 'small', thresholdLow = 15
|
|
|
11
11
|
: discountPercent <= thresholdHigh
|
|
12
12
|
? 'medium'
|
|
13
13
|
: 'high';
|
|
14
|
-
return (React.createElement(Badge, {
|
|
14
|
+
return (React.createElement(Badge, { "data-fs-discount-badge": true, "data-fs-discount-badge-variant": discountVariant, "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,
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Icon, Button } from '../../index';
|
|
3
3
|
const IconButton = forwardRef(function IconButton({ icon, children, testId = 'fs-icon-button', 'aria-label': ariaLabel, variant, ...otherProps }, ref) {
|
|
4
|
-
return (React.createElement(Button, { ref: ref, "data-fs-button": true, "data-fs-icon-button": true,
|
|
4
|
+
return (React.createElement(Button, { ref: ref, "data-fs-button": true, "data-fs-icon-button": true, variant: variant ?? 'tertiary', "aria-label": ariaLabel, testId: testId, ...otherProps },
|
|
5
5
|
children,
|
|
6
6
|
React.createElement(Icon, { component: icon })));
|
|
7
7
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../src/molecules/IconButton/IconButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAkB1C,MAAM,UAAU,GAAG,UAAU,CAC3B,SAAS,UAAU,CACjB,EACE,IAAI,EACJ,QAAQ,EACR,MAAM,GAAG,gBAAgB,EACzB,YAAY,EAAE,SAAS,EACvB,OAAO,EACP,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,oBAAC,MAAM,IACL,GAAG,EAAE,GAAG,uDAGR,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../src/molecules/IconButton/IconButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAkB1C,MAAM,UAAU,GAAG,UAAU,CAC3B,SAAS,UAAU,CACjB,EACE,IAAI,EACJ,QAAQ,EACR,MAAM,GAAG,gBAAgB,EACzB,YAAY,EAAE,SAAS,EACvB,OAAO,EACP,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,oBAAC,MAAM,IACL,GAAG,EAAE,GAAG,uDAGR,OAAO,EAAE,OAAO,IAAI,UAAU,gBAClB,SAAS,EACrB,MAAM,EAAE,MAAM,KACV,UAAU;QAEb,QAAQ;QACT,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,GAAI,CAClB,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { MutableRefObject } from 'react';
|
|
2
2
|
import type { InputProps } from '../../index';
|
|
3
3
|
declare type DefaultProps = {
|
|
4
|
+
/**
|
|
5
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
6
|
+
*/
|
|
7
|
+
testId?: string;
|
|
4
8
|
/**
|
|
5
9
|
* ID to identify input and corresponding label.
|
|
6
10
|
*/
|
|
@@ -51,5 +55,5 @@ declare type ActionableInputField = {
|
|
|
51
55
|
displayClearButton?: boolean;
|
|
52
56
|
};
|
|
53
57
|
export declare type InputFieldProps = DefaultProps & Omit<InputProps, 'disabled' | 'onSubmit'> & ActionableInputField;
|
|
54
|
-
declare const InputField: ({ id, label, type, error, displayClearButton, actionable, buttonActionText, onSubmit, onClear, placeholder, inputRef, disabled, value, ...otherProps }: InputFieldProps) => JSX.Element;
|
|
58
|
+
declare const InputField: ({ id, label, type, error, displayClearButton, actionable, buttonActionText, onSubmit, onClear, placeholder, inputRef, disabled, value, testId, ...otherProps }: InputFieldProps) => JSX.Element;
|
|
55
59
|
export default InputField;
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { Input, Label, IconButton, Button } from '../../index';
|
|
3
3
|
import { XCircle } from '../../assets';
|
|
4
4
|
const InputField = ({ id, label, type = 'text', error, displayClearButton, actionable, buttonActionText = 'Apply', onSubmit, onClear, placeholder = ' ', // initializes with an empty space to style float label using `placeholder-shown`
|
|
5
|
-
inputRef, disabled, value, ...otherProps }) => {
|
|
5
|
+
inputRef, disabled, value, testId = 'fs-input-field', ...otherProps }) => {
|
|
6
6
|
const shouldDisplayError = !disabled && error && error !== '';
|
|
7
7
|
const shouldDisplayButton = actionable && !disabled && value !== '';
|
|
8
|
-
return (React.createElement("div", { "data-fs-input-field": true, "data-fs-input-field-actionable": actionable, "data-fs-input-field-error": error && error !== '' },
|
|
8
|
+
return (React.createElement("div", { "data-fs-input-field": true, "data-fs-input-field-actionable": actionable, "data-fs-input-field-error": error && error !== '', "data-testid": testId },
|
|
9
9
|
React.createElement(Input, { id: id, type: type, value: value, ref: inputRef, disabled: disabled, placeholder: placeholder, ...otherProps }),
|
|
10
10
|
React.createElement(Label, { htmlFor: id }, label),
|
|
11
11
|
shouldDisplayButton &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputField.js","sourceRoot":"","sources":["../../../src/molecules/InputField/InputField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"InputField.js","sourceRoot":"","sources":["../../../src/molecules/InputField/InputField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAgEtC,MAAM,UAAU,GAAG,CAAC,EAClB,EAAE,EACF,KAAK,EACL,IAAI,GAAG,MAAM,EACb,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,gBAAgB,GAAG,OAAO,EAC1B,QAAQ,EACR,OAAO,EACP,WAAW,GAAG,GAAG,EAAE,iFAAiF;AACpG,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,GAAG,gBAAgB,EACzB,GAAG,UAAU,EACG,EAAE,EAAE;IACpB,MAAM,kBAAkB,GAAG,CAAC,QAAQ,IAAI,KAAK,IAAI,KAAK,KAAK,EAAE,CAAA;IAC7D,MAAM,mBAAmB,GAAG,UAAU,IAAI,CAAC,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAA;IAEnE,OAAO,CACL,4FAEkC,UAAU,+BACf,KAAK,IAAI,KAAK,KAAK,EAAE,iBACnC,MAAM;QAEnB,oBAAC,KAAK,IACJ,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,KACpB,UAAU,GACd;QACF,oBAAC,KAAK,IAAC,OAAO,EAAE,EAAE,IAAG,KAAK,CAAS;QAElC,mBAAmB;YAClB,CAAC,kBAAkB,IAAI,KAAK,CAAC,CAAC,CAAC,CAC7B,oBAAC,UAAU,2BACW,OAAO,gBAChB,aAAa,EACxB,IAAI,EAAE,oBAAC,OAAO,OAAG,EACjB,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,EAAE,EAAE,CAAA;oBACX,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;gBAC5B,CAAC,GACD,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,MAAM,IAAC,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,QAAQ,IACtD,gBAAgB,CACV,CACV,CAAC;QACH,kBAAkB,IAAI,CACrB,2EAAyC,KAAK,CAAQ,CACvD,CACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -8,7 +8,7 @@ function LinkButton({ icon, inverse, children, disabled, iconPosition, size = 'r
|
|
|
8
8
|
linkRef.current?.blur();
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
return (React.createElement("a", { ref: linkRef,
|
|
11
|
+
return (React.createElement("a", { ref: linkRef, "data-fs-button": true, "data-fs-link-button": true, "data-fs-button-size": size, "data-fs-button-variant": variant, "data-fs-button-inverse": inverse, "data-fs-button-disabled": disabled, onFocus: onFocus, "data-testid": testId, ...otherProps },
|
|
12
12
|
iconPosition === 'left' && React.createElement(Icon, { component: icon }),
|
|
13
13
|
children,
|
|
14
14
|
iconPosition === 'right' && React.createElement(Icon, { component: icon })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkButton.js","sourceRoot":"","sources":["../../../src/molecules/LinkButton/LinkButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAGrC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAM5B,SAAS,UAAU,CAAC,EAClB,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,IAAI,GAAG,SAAS,EAChB,OAAO,GAAG,SAAS,EACnB,MAAM,GAAG,gBAAgB,EACzB,GAAG,UAAU,EACG;IAChB,MAAM,OAAO,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAA;IAEtD,SAAS,OAAO,CAAC,CAAa;QAC5B,CAAC,CAAC,cAAc,EAAE,CAAA;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,CAAA;SACxB;IACH,CAAC;IAED,OAAO,CACL,2BACE,GAAG,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"LinkButton.js","sourceRoot":"","sources":["../../../src/molecules/LinkButton/LinkButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAGrC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAM5B,SAAS,UAAU,CAAC,EAClB,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,IAAI,GAAG,SAAS,EAChB,OAAO,GAAG,SAAS,EACnB,MAAM,GAAG,gBAAgB,EACzB,GAAG,UAAU,EACG;IAChB,MAAM,OAAO,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAA;IAEtD,SAAS,OAAO,CAAC,CAAa;QAC5B,CAAC,CAAC,cAAc,EAAE,CAAA;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,CAAA;SACxB;IACH,CAAC;IAED,OAAO,CACL,2BACE,GAAG,EAAE,OAAO,8EAGS,IAAI,4BACD,OAAO,4BACP,OAAO,6BACN,QAAQ,EACjC,OAAO,EAAE,OAAO,iBACH,MAAM,KACf,UAAU;QAEb,YAAY,KAAK,MAAM,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,GAAI;QACpD,QAAQ;QACR,YAAY,KAAK,OAAO,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,GAAI,CACpD,CACL,CAAA;AACH,CAAC;AAED,eAAe,UAAU,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, "data-testid": testId },
|
|
5
5
|
React.createElement(Label, { "data-fs-select-field-label": true, htmlFor: id }, label),
|
|
6
|
-
React.createElement(Select, { id: id, options: options,
|
|
6
|
+
React.createElement(Select, { id: id, options: options, ...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,+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"}
|
|
@@ -3,7 +3,7 @@ import { Icon } from '../..';
|
|
|
3
3
|
import { Badge } from '../..';
|
|
4
4
|
import { X } from '../../assets';
|
|
5
5
|
const Tag = forwardRef(function Tag({ testId = 'fs-tag', label, icon, iconButtonLabel, onClose, ...otherProps }, ref) {
|
|
6
|
-
return (React.createElement(Badge, { ref: ref, "data-fs-tag": true, "data-testid": testId,
|
|
6
|
+
return (React.createElement(Badge, { ref: ref, "data-fs-tag": true, size: "big", "data-testid": testId, ...otherProps },
|
|
7
7
|
React.createElement("span", { "data-fs-tag-label": true }, label),
|
|
8
8
|
React.createElement("button", { "data-fs-tag-icon-button": true, "aria-label": iconButtonLabel ? iconButtonLabel : 'remove', onClick: onClose },
|
|
9
9
|
React.createElement(Icon, { component: icon ? icon : React.createElement(X, null) }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../../src/molecules/Tag/Tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAc,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAyBhC,MAAM,GAAG,GAAG,UAAU,CAA2B,SAAS,GAAG,CAC3D,EAAE,MAAM,GAAG,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,EAC3E,GAAG;IAEH,OAAO,CACL,oBAAC,KAAK,IACJ,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../../src/molecules/Tag/Tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAc,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAyBhC,MAAM,GAAG,GAAG,UAAU,CAA2B,SAAS,GAAG,CAC3D,EAAE,MAAM,GAAG,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,EAC3E,GAAG;IAEH,OAAO,CACL,oBAAC,KAAK,IACJ,GAAG,EAAE,GAAG,uBAER,IAAI,EAAC,KAAK,iBACG,MAAM,KACf,UAAU;QAEd,2DAAyB,KAAK,CAAQ;QACtC,+EAEc,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,QAAQ,EACxD,OAAO,EAAE,OAAO;YAEhB,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,CAAC,OAAG,GAAI,CACjC,CACH,CACT,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,GAAG,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { Input, Icon } from './../../';
|
|
|
3
3
|
import { Checked } from '../../assets';
|
|
4
4
|
const Toggle = forwardRef(function Toggle({ testId = 'fs-toggle', id, disabled, variant = 'horizontal', ...otherProps }, ref) {
|
|
5
5
|
return (React.createElement("div", { "data-fs-toggle": true, "data-fs-toggle-variant": variant, "data-testid": testId },
|
|
6
|
-
React.createElement(Input, {
|
|
6
|
+
React.createElement(Input, { ref: ref, id: id, role: "switch", type: "checkbox", disabled: disabled, ...otherProps }),
|
|
7
7
|
React.createElement("span", { "data-fs-toggle-knob": true },
|
|
8
8
|
React.createElement(Icon, { component: React.createElement(Checked, null) }))));
|
|
9
9
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../../src/molecules/Toggle/Toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAsBtC,MAAM,MAAM,GAAG,UAAU,CAAgC,SAAS,MAAM,CACtE,EACE,MAAM,GAAG,WAAW,EACpB,EAAE,EACF,QAAQ,EACR,OAAO,GAAG,YAAY,EACtB,GAAG,UAAU,EACD,EACd,GAAG;IAEH,OAAO,CACL,+EAA4C,OAAO,iBAAe,MAAM;QACtE,oBAAC,KAAK,IACJ,
|
|
1
|
+
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../../src/molecules/Toggle/Toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAsBtC,MAAM,MAAM,GAAG,UAAU,CAAgC,SAAS,MAAM,CACtE,EACE,MAAM,GAAG,WAAW,EACpB,EAAE,EACF,QAAQ,EACR,OAAO,GAAG,YAAY,EACtB,GAAG,UAAU,EACD,EACd,GAAG;IAEH,OAAO,CACL,+EAA4C,OAAO,iBAAe,MAAM;QACtE,oBAAC,KAAK,IACJ,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,QAAQ,KACd,UAAU,GACd;QACF;YACE,oBAAC,IAAI,IAAC,SAAS,EAAE,oBAAC,OAAO,OAAG,GAAI,CAC3B,CACH,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.24-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": "b59392c361cae99ef9b261125b561860b59ee6cd"
|
|
32
32
|
}
|
|
@@ -49,11 +49,11 @@ const Badge = forwardRef<HTMLDivElement, BadgeProps>(function Badge(
|
|
|
49
49
|
<div
|
|
50
50
|
ref={ref}
|
|
51
51
|
data-fs-badge
|
|
52
|
-
data-testid={testId}
|
|
53
52
|
aria-label={ariaLabel}
|
|
54
53
|
data-fs-badge-variant={counter ? null : variant}
|
|
55
54
|
data-fs-badge-size={size}
|
|
56
55
|
data-fs-badge-counter={counter}
|
|
56
|
+
data-testid={testId}
|
|
57
57
|
{...otherProps}
|
|
58
58
|
>
|
|
59
59
|
<div data-fs-badge-wrapper>{children}</div>
|
|
@@ -54,12 +54,12 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
|
54
54
|
return (
|
|
55
55
|
<button
|
|
56
56
|
ref={ref}
|
|
57
|
-
data-testid={testId}
|
|
58
57
|
data-fs-button
|
|
59
58
|
data-fs-button-inverse={inverse}
|
|
60
59
|
data-fs-button-size={size}
|
|
61
60
|
data-fs-button-variant={variant}
|
|
62
61
|
disabled={disabled}
|
|
62
|
+
data-testid={testId}
|
|
63
63
|
{...otherProps}
|
|
64
64
|
>
|
|
65
65
|
{icon && iconPosition === 'left' && <Icon component={icon} />}
|
package/src/atoms/Icon/Icon.tsx
CHANGED
|
@@ -2,14 +2,14 @@ import type { HTMLAttributes, ReactNode } from 'react'
|
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
|
-
/**
|
|
6
|
-
* A React component that will be rendered as an icon.
|
|
7
|
-
*/
|
|
8
|
-
component: ReactNode
|
|
9
5
|
/**
|
|
10
6
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
11
7
|
*/
|
|
12
8
|
testId?: string
|
|
9
|
+
/**
|
|
10
|
+
* A React component that will be rendered as an icon.
|
|
11
|
+
*/
|
|
12
|
+
component: ReactNode
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const Icon = forwardRef<HTMLSpanElement, IconProps>(function Button(
|
package/src/atoms/Link/Link.tsx
CHANGED
|
@@ -8,12 +8,12 @@ type LinkBaseProps = {
|
|
|
8
8
|
*/
|
|
9
9
|
testId?: string
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
* Specifies the component variant.
|
|
12
|
+
*/
|
|
13
13
|
variant?: 'default' | 'display' | 'inline'
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
* Defines use of inverted color.
|
|
16
|
+
*/
|
|
17
17
|
inverse?: boolean
|
|
18
18
|
/**
|
|
19
19
|
* Defines size os element
|
|
@@ -23,10 +23,8 @@ type LinkBaseProps = {
|
|
|
23
23
|
|
|
24
24
|
export type LinkElementType = ElementType
|
|
25
25
|
|
|
26
|
-
export type LinkProps<C extends LinkElementType = 'a'> =
|
|
27
|
-
C,
|
|
28
|
-
LinkBaseProps
|
|
29
|
-
>
|
|
26
|
+
export type LinkProps<C extends LinkElementType = 'a'> =
|
|
27
|
+
PolymorphicComponentPropsWithRef<C, LinkBaseProps>
|
|
30
28
|
|
|
31
29
|
type LinkComponent = <C extends LinkElementType = 'a'>(
|
|
32
30
|
props: LinkProps<C>
|
|
@@ -35,20 +33,27 @@ type LinkComponent = <C extends LinkElementType = 'a'>(
|
|
|
35
33
|
const Link: LinkComponent = forwardRef(function Link<
|
|
36
34
|
C extends LinkElementType = 'a'
|
|
37
35
|
>(
|
|
38
|
-
{
|
|
36
|
+
{
|
|
37
|
+
as,
|
|
38
|
+
children,
|
|
39
|
+
variant = 'default',
|
|
40
|
+
size = 'regular',
|
|
41
|
+
inverse,
|
|
42
|
+
testId = 'fs-link',
|
|
43
|
+
...otherProps
|
|
44
|
+
}: LinkProps<C>,
|
|
39
45
|
ref?: PolymorphicRef<C>
|
|
40
46
|
) {
|
|
41
|
-
|
|
42
47
|
const Component = as ?? 'a'
|
|
43
48
|
|
|
44
49
|
return (
|
|
45
|
-
<Component
|
|
46
|
-
ref={ref}
|
|
47
|
-
data-fs-link
|
|
50
|
+
<Component
|
|
51
|
+
ref={ref}
|
|
52
|
+
data-fs-link
|
|
48
53
|
data-fs-link-variant={variant}
|
|
49
54
|
data-fs-link-inverse={inverse}
|
|
50
55
|
data-fs-link-size={size}
|
|
51
|
-
data-testid={testId}
|
|
56
|
+
data-testid={testId}
|
|
52
57
|
{...otherProps}
|
|
53
58
|
>
|
|
54
59
|
{children}
|
package/src/atoms/List/List.tsx
CHANGED
|
@@ -12,14 +12,14 @@ export type PriceFormatter = (price: number, variant: PriceVariant) => ReactNode
|
|
|
12
12
|
|
|
13
13
|
export interface PriceProps
|
|
14
14
|
extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
15
|
-
/**
|
|
16
|
-
* Set the HTML element tag of this component.
|
|
17
|
-
*/
|
|
18
|
-
as?: ElementType
|
|
19
15
|
/**
|
|
20
16
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
21
17
|
*/
|
|
22
18
|
testId?: string
|
|
19
|
+
/**
|
|
20
|
+
* Set the HTML element tag of this component.
|
|
21
|
+
*/
|
|
22
|
+
as?: ElementType
|
|
23
23
|
/**
|
|
24
24
|
* The raw price value.
|
|
25
25
|
*/
|
|
@@ -52,8 +52,8 @@ const Price = forwardRef<Omit<HTMLSpanElement, 'children'>, PriceProps>(
|
|
|
52
52
|
<Component
|
|
53
53
|
ref={ref}
|
|
54
54
|
data-fs-price
|
|
55
|
-
data-testid={testId}
|
|
56
55
|
data-fs-price-variant={variant}
|
|
56
|
+
data-testid={testId}
|
|
57
57
|
{...otherProps}
|
|
58
58
|
>
|
|
59
59
|
{formattedPrice}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ElementType } from 'react'
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
interface SROnlyProps {
|
|
5
5
|
text: string
|
|
6
6
|
as?: ElementType
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function SROnly({ text, as }:
|
|
9
|
+
function SROnly({ text, as }: SROnlyProps) {
|
|
10
10
|
const Component = as ?? 'span'
|
|
11
11
|
|
|
12
12
|
return <Component data-fs-sr-only>{text}</Component>
|
|
@@ -4,6 +4,10 @@ import { Icon } from '../..'
|
|
|
4
4
|
import { CaretDown } from '../../assets'
|
|
5
5
|
|
|
6
6
|
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
7
|
+
/**
|
|
8
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
9
|
+
*/
|
|
10
|
+
testId?: string
|
|
7
11
|
/**
|
|
8
12
|
* Assigns an identifier to link the UISelect component and its label.
|
|
9
13
|
*/
|
|
@@ -14,10 +18,6 @@ export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
|
14
18
|
* will be displayed in the UI.
|
|
15
19
|
*/
|
|
16
20
|
options: Record<string, string>
|
|
17
|
-
/**
|
|
18
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
19
|
-
*/
|
|
20
|
-
testId?: string
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(
|
|
@@ -26,14 +26,14 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(
|
|
|
26
26
|
) {
|
|
27
27
|
return (
|
|
28
28
|
<div data-fs-select>
|
|
29
|
-
<select
|
|
29
|
+
<select ref={ref} id={id} data-testid={testId} {...otherProps}>
|
|
30
30
|
{Object.keys(options).map((key) => (
|
|
31
31
|
<option key={key} value={key}>
|
|
32
32
|
{options[key]}
|
|
33
33
|
</option>
|
|
34
34
|
))}
|
|
35
35
|
</select>
|
|
36
|
-
<Icon data-fs-select-icon component={<CaretDown />}/>
|
|
36
|
+
<Icon data-fs-select-icon component={<CaretDown />} />
|
|
37
37
|
</div>
|
|
38
38
|
)
|
|
39
39
|
})
|
|
@@ -4,11 +4,16 @@ import { Button, Icon } from '../../index'
|
|
|
4
4
|
import type { ButtonProps } from '../../index'
|
|
5
5
|
import { ShoppingCart } from '../../assets'
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type BuyButtonProps = ButtonProps
|
|
8
8
|
|
|
9
|
-
function BuyButton({
|
|
9
|
+
function BuyButton({
|
|
10
|
+
testId = 'fs-buy-button',
|
|
11
|
+
icon,
|
|
12
|
+
children,
|
|
13
|
+
...otherProps
|
|
14
|
+
}: BuyButtonProps) {
|
|
10
15
|
return (
|
|
11
|
-
<Button data-fs-buy-button {...otherProps}>
|
|
16
|
+
<Button data-fs-buy-button data-testid={testId} {...otherProps}>
|
|
12
17
|
<Icon component={<ShoppingCart />} />
|
|
13
18
|
{children}
|
|
14
19
|
</Button>
|
|
@@ -4,6 +4,10 @@ import { Badge } from '../..'
|
|
|
4
4
|
import { useDiscountPercent } from '../DiscountBadge/useDiscountPercent'
|
|
5
5
|
|
|
6
6
|
export type DiscountBadgeProps = {
|
|
7
|
+
/**
|
|
8
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
9
|
+
*/
|
|
10
|
+
testId?: string
|
|
7
11
|
/**
|
|
8
12
|
* Specifies price without discount applied.
|
|
9
13
|
*/
|
|
@@ -12,10 +16,6 @@ export type DiscountBadgeProps = {
|
|
|
12
16
|
* Specifies current price with discount applied.
|
|
13
17
|
*/
|
|
14
18
|
spotPrice: number
|
|
15
|
-
/**
|
|
16
|
-
* Sets the component's size.
|
|
17
|
-
*/
|
|
18
|
-
size?: 'small' | 'big'
|
|
19
19
|
/**
|
|
20
20
|
* Sets the limit percentage value to consider a low discount.
|
|
21
21
|
*/
|
|
@@ -29,9 +29,9 @@ export type DiscountBadgeProps = {
|
|
|
29
29
|
const DiscountBadge = ({
|
|
30
30
|
listPrice,
|
|
31
31
|
spotPrice,
|
|
32
|
-
size = 'small',
|
|
33
32
|
thresholdLow = 15,
|
|
34
33
|
thresholdHigh = 40,
|
|
34
|
+
testId = 'fs-discount-badge',
|
|
35
35
|
}: DiscountBadgeProps) => {
|
|
36
36
|
const discountPercent = useDiscountPercent(listPrice, spotPrice)
|
|
37
37
|
|
|
@@ -48,9 +48,9 @@ const DiscountBadge = ({
|
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
50
|
<Badge
|
|
51
|
-
size={size}
|
|
52
51
|
data-fs-discount-badge
|
|
53
52
|
data-fs-discount-badge-variant={discountVariant}
|
|
53
|
+
data-testid={testId}
|
|
54
54
|
>
|
|
55
55
|
{discountPercent}% off
|
|
56
56
|
</Badge>
|
|
@@ -36,9 +36,9 @@ const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
|
36
36
|
ref={ref}
|
|
37
37
|
data-fs-button
|
|
38
38
|
data-fs-icon-button
|
|
39
|
-
testId={testId}
|
|
40
39
|
variant={variant ?? 'tertiary'}
|
|
41
40
|
aria-label={ariaLabel}
|
|
41
|
+
testId={testId}
|
|
42
42
|
{...otherProps}
|
|
43
43
|
>
|
|
44
44
|
{children}
|
|
@@ -6,6 +6,10 @@ import type { InputProps } from '../../index'
|
|
|
6
6
|
import { XCircle } from '../../assets'
|
|
7
7
|
|
|
8
8
|
type DefaultProps = {
|
|
9
|
+
/**
|
|
10
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
11
|
+
*/
|
|
12
|
+
testId?: string
|
|
9
13
|
/**
|
|
10
14
|
* ID to identify input and corresponding label.
|
|
11
15
|
*/
|
|
@@ -77,6 +81,7 @@ const InputField = ({
|
|
|
77
81
|
inputRef,
|
|
78
82
|
disabled,
|
|
79
83
|
value,
|
|
84
|
+
testId = 'fs-input-field',
|
|
80
85
|
...otherProps
|
|
81
86
|
}: InputFieldProps) => {
|
|
82
87
|
const shouldDisplayError = !disabled && error && error !== ''
|
|
@@ -87,6 +92,7 @@ const InputField = ({
|
|
|
87
92
|
data-fs-input-field
|
|
88
93
|
data-fs-input-field-actionable={actionable}
|
|
89
94
|
data-fs-input-field-error={error && error !== ''}
|
|
95
|
+
data-testid={testId}
|
|
90
96
|
>
|
|
91
97
|
<Input
|
|
92
98
|
id={id}
|
|
@@ -31,14 +31,14 @@ function LinkButton({
|
|
|
31
31
|
return (
|
|
32
32
|
<a
|
|
33
33
|
ref={linkRef}
|
|
34
|
-
onFocus={onFocus}
|
|
35
34
|
data-fs-button
|
|
36
35
|
data-fs-link-button
|
|
37
|
-
data-testid={testId}
|
|
38
36
|
data-fs-button-size={size}
|
|
39
37
|
data-fs-button-variant={variant}
|
|
40
38
|
data-fs-button-inverse={inverse}
|
|
41
39
|
data-fs-button-disabled={disabled}
|
|
40
|
+
onFocus={onFocus}
|
|
41
|
+
data-testid={testId}
|
|
42
42
|
{...otherProps}
|
|
43
43
|
>
|
|
44
44
|
{iconPosition === 'left' && <Icon component={icon} />}
|
|
@@ -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 data-testid={testId}>
|
|
23
23
|
<Label data-fs-select-field-label htmlFor={id}>
|
|
24
24
|
{label}
|
|
25
25
|
</Label>
|
|
26
|
-
<Select id={id} options={options}
|
|
26
|
+
<Select id={id} options={options} {...otherProps} />
|
|
27
27
|
</div>
|
|
28
28
|
)
|
|
29
29
|
})
|
|
@@ -36,8 +36,8 @@ const Toggle = forwardRef<HTMLInputElement, ToggleProps>(function Toggle(
|
|
|
36
36
|
return (
|
|
37
37
|
<div data-fs-toggle data-fs-toggle-variant={variant} data-testid={testId}>
|
|
38
38
|
<Input
|
|
39
|
-
id={id}
|
|
40
39
|
ref={ref}
|
|
40
|
+
id={id}
|
|
41
41
|
role="switch"
|
|
42
42
|
type="checkbox"
|
|
43
43
|
disabled={disabled}
|