@faststore/components 2.0.19-alpha.0 → 2.0.27-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 +18 -0
- package/dist/assets/Ruler.d.ts +3 -0
- package/dist/assets/Ruler.js +10 -0
- package/dist/assets/Ruler.js.map +1 -0
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.js +1 -0
- package/dist/assets/index.js.map +1 -1
- 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/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.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/Table/Table.d.ts +18 -0
- package/dist/molecules/Table/Table.js +7 -0
- package/dist/molecules/Table/Table.js.map +1 -0
- package/dist/molecules/Table/TableBody.d.ts +14 -0
- package/dist/molecules/Table/TableBody.js +6 -0
- package/dist/molecules/Table/TableBody.js.map +1 -0
- package/dist/molecules/Table/TableCell.d.ts +24 -0
- package/dist/molecules/Table/TableCell.js +7 -0
- package/dist/molecules/Table/TableCell.js.map +1 -0
- package/dist/molecules/Table/TableFooter.d.ts +14 -0
- package/dist/molecules/Table/TableFooter.js +6 -0
- package/dist/molecules/Table/TableFooter.js.map +1 -0
- package/dist/molecules/Table/TableHead.d.ts +14 -0
- package/dist/molecules/Table/TableHead.js +6 -0
- package/dist/molecules/Table/TableHead.js.map +1 -0
- package/dist/molecules/Table/TableRow.d.ts +14 -0
- package/dist/molecules/Table/TableRow.js +6 -0
- package/dist/molecules/Table/TableRow.js.map +1 -0
- package/dist/molecules/Table/index.d.ts +12 -0
- package/dist/molecules/Table/index.js +7 -0
- package/dist/molecules/Table/index.js.map +1 -0
- 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/assets/Ruler.tsx +23 -0
- package/src/assets/index.ts +1 -0
- 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/index.ts +16 -0
- 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/Table/Table.tsx +38 -0
- package/src/molecules/Table/TableBody.tsx +29 -0
- package/src/molecules/Table/TableCell.tsx +55 -0
- package/src/molecules/Table/TableFooter.tsx +29 -0
- package/src/molecules/Table/TableHead.tsx +29 -0
- package/src/molecules/Table/TableRow.tsx +28 -0
- package/src/molecules/Table/index.ts +17 -0
- package/src/molecules/Tag/Tag.tsx +1 -1
- package/src/molecules/Toggle/Toggle.tsx +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableBody.js","sourceRoot":"","sources":["../../../src/molecules/Table/TableBody.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAczC,MAAM,SAAS,GAAG,UAAU,CAC1B,SAAS,SAAS,CAChB,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,GAAG,UAAU,EAAE,EACrD,GAAG;IAEH,OAAO,CACL,+BAAO,GAAG,EAAE,GAAG,iBAAe,MAAM,iCAAyB,UAAU,IACpE,QAAQ,CACH,CACT,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare type TableCellVariant = 'data' | 'header';
|
|
4
|
+
export interface TableCellProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
+
*/
|
|
8
|
+
testId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Specify if this component should be rendered as a header (`<th>`) or as a data cell (`<td>`).
|
|
11
|
+
*/
|
|
12
|
+
variant?: TableCellVariant;
|
|
13
|
+
/**
|
|
14
|
+
* Defines the cells that the header element (`<th>`) relates to.
|
|
15
|
+
* @see scope https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
|
|
16
|
+
*/
|
|
17
|
+
scope?: 'col' | 'row' | 'rowgroup' | 'colgroup';
|
|
18
|
+
/**
|
|
19
|
+
* Defines how this component should be aligned.
|
|
20
|
+
*/
|
|
21
|
+
align?: 'left' | 'center' | 'right';
|
|
22
|
+
}
|
|
23
|
+
declare const TableCell: React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
24
|
+
export default TableCell;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
const TableCell = forwardRef(function TableCell({ testId = 'fs-table-cell', children, variant = 'data', scope, align, ...otherProps }, ref) {
|
|
3
|
+
const Cell = variant === 'header' ? 'th' : 'td';
|
|
4
|
+
return (React.createElement(Cell, { ref: ref, "data-fs-table-cell": variant, "data-fs-table-cell-align": align, "data-testid": testId, scope: scope, ...otherProps }, children));
|
|
5
|
+
});
|
|
6
|
+
export default TableCell;
|
|
7
|
+
//# sourceMappingURL=TableCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCell.js","sourceRoot":"","sources":["../../../src/molecules/Table/TableCell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAwBzC,MAAM,SAAS,GAAG,UAAU,CAC1B,SAAS,SAAS,CAChB,EACE,MAAM,GAAG,eAAe,EACxB,QAAQ,EACR,OAAO,GAAG,MAAM,EAChB,KAAK,EACL,KAAK,EACL,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,IAAI,GAAG,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;IAE/C,OAAO,CACL,oBAAC,IAAI,IACH,GAAG,EAAE,GAAG,wBACY,OAAO,8BACD,KAAK,iBAClB,MAAM,EACnB,KAAK,EAAE,KAAK,KACR,UAAU,IAEb,QAAQ,CACJ,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface TableFooterProps extends HTMLAttributes<HTMLTableSectionElement> {
|
|
4
|
+
/**
|
|
5
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
6
|
+
*/
|
|
7
|
+
testId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Children for TableFooter components.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const TableFooter: React.ForwardRefExoticComponent<TableFooterProps & React.RefAttributes<HTMLTableSectionElement>>;
|
|
14
|
+
export default TableFooter;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
const TableFooter = forwardRef(function TableFooter({ children, testId = 'fs-table-footer', ...otherProps }, ref) {
|
|
3
|
+
return (React.createElement("tfoot", { ref: ref, "data-testid": testId, "data-fs-table-footer": true, ...otherProps }, children));
|
|
4
|
+
});
|
|
5
|
+
export default TableFooter;
|
|
6
|
+
//# sourceMappingURL=TableFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableFooter.js","sourceRoot":"","sources":["../../../src/molecules/Table/TableFooter.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAczC,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,WAAW,CAClB,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,EAAE,GAAG,UAAU,EAAE,EACvD,GAAG;IAEH,OAAO,CACL,+BAAO,GAAG,EAAE,GAAG,iBAAe,MAAM,mCAA2B,UAAU,IACtE,QAAQ,CACH,CACT,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface TableHeadProps extends HTMLAttributes<HTMLTableSectionElement> {
|
|
4
|
+
/**
|
|
5
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
6
|
+
*/
|
|
7
|
+
testId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Children for TableHead components.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const TableHead: React.ForwardRefExoticComponent<TableHeadProps & React.RefAttributes<HTMLTableSectionElement>>;
|
|
14
|
+
export default TableHead;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
const TableHead = forwardRef(function TableHead({ children, testId = 'fs-table-head', ...otherProps }, ref) {
|
|
3
|
+
return (React.createElement("thead", { ref: ref, "data-testid": testId, "data-fs-table-head": true, ...otherProps }, children));
|
|
4
|
+
});
|
|
5
|
+
export default TableHead;
|
|
6
|
+
//# sourceMappingURL=TableHead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHead.js","sourceRoot":"","sources":["../../../src/molecules/Table/TableHead.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAczC,MAAM,SAAS,GAAG,UAAU,CAC1B,SAAS,SAAS,CAChB,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,GAAG,UAAU,EAAE,EACrD,GAAG;IAEH,OAAO,CACL,+BAAO,GAAG,EAAE,GAAG,iBAAe,MAAM,iCAAyB,UAAU,IACpE,QAAQ,CACH,CACT,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
4
|
+
/**
|
|
5
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
6
|
+
*/
|
|
7
|
+
testId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Children for TableRow components.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const TableRow: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLTableRowElement>>;
|
|
14
|
+
export default TableRow;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
const TableRow = forwardRef(function TableRow({ testId = 'fs-table-row', children, ...otherProps }, ref) {
|
|
3
|
+
return (React.createElement("tr", { ref: ref, "data-fs-table-row": true, "data-testid": testId, ...otherProps }, children));
|
|
4
|
+
});
|
|
5
|
+
export default TableRow;
|
|
6
|
+
//# sourceMappingURL=TableRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableRow.js","sourceRoot":"","sources":["../../../src/molecules/Table/TableRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAazC,MAAM,QAAQ,GAAG,UAAU,CACzB,SAAS,QAAQ,CACf,EAAE,MAAM,GAAG,cAAc,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EACpD,GAAG;IAEH,OAAO,CACL,4BAAI,GAAG,EAAE,GAAG,4CAAiC,MAAM,KAAM,UAAU,IAChE,QAAQ,CACN,CACN,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Table } from './Table';
|
|
2
|
+
export type { TableProps } from './Table';
|
|
3
|
+
export { default as TableRow } from './TableRow';
|
|
4
|
+
export type { TableRowProps } from './TableRow';
|
|
5
|
+
export { default as TableCell } from './TableCell';
|
|
6
|
+
export type { TableCellProps } from './TableCell';
|
|
7
|
+
export { default as TableBody } from './TableBody';
|
|
8
|
+
export type { TableBodyProps } from './TableBody';
|
|
9
|
+
export { default as TableHead } from './TableHead';
|
|
10
|
+
export type { TableHeadProps } from './TableHead';
|
|
11
|
+
export { default as TableFooter } from './TableFooter';
|
|
12
|
+
export type { TableFooterProps } from './TableFooter';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Table } from './Table';
|
|
2
|
+
export { default as TableRow } from './TableRow';
|
|
3
|
+
export { default as TableCell } from './TableCell';
|
|
4
|
+
export { default as TableBody } from './TableBody';
|
|
5
|
+
export { default as TableHead } from './TableHead';
|
|
6
|
+
export { default as TableFooter } from './TableFooter';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/Table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAG1C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,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.27-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": "04930d63aa9a06a5481abe53e40f89bc7d03b999"
|
|
32
32
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { FC } from 'react'
|
|
3
|
+
|
|
4
|
+
// Icon from Phosphor Icons
|
|
5
|
+
const Ruler: FC = () => (
|
|
6
|
+
<svg
|
|
7
|
+
id="Ruler"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
fill="currentColor"
|
|
10
|
+
viewBox="0 0 256 256"
|
|
11
|
+
strokeWidth="16"
|
|
12
|
+
width={24}
|
|
13
|
+
height={24}
|
|
14
|
+
>
|
|
15
|
+
<rect width="256" height="256" fill="none"></rect>
|
|
16
|
+
<rect x="26.2" y="82.7" width="203.6" height="90.51" rx="8" transform="translate(-53 128) rotate(-45)" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"></rect>
|
|
17
|
+
<line x1="132" y1="60" x2="164" y2="92" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"></line>
|
|
18
|
+
<line x1="96" y1="96" x2="128" y2="128" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"></line>
|
|
19
|
+
<line x1="60" y1="132" x2="92" y2="164" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"></line>
|
|
20
|
+
</svg>
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
export default Ruler
|
package/src/assets/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as ArrowRight } from './ArrowRight'
|
|
|
2
2
|
export { default as CaretDown } from './CaretDown'
|
|
3
3
|
export { default as Checked } from './Checked'
|
|
4
4
|
export { default as House } from './House'
|
|
5
|
+
export { default as Ruler } from './Ruler'
|
|
5
6
|
export { default as ShoppingCart } from './ShoppingCart'
|
|
6
7
|
export { default as X } from './X'
|
|
7
8
|
export { default as XCircle } from './XCircle'
|
|
@@ -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
|
})
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,22 @@ export { default as RadioField } from './molecules/RadioField'
|
|
|
44
44
|
export type { RadioFieldProps } from './molecules/RadioField'
|
|
45
45
|
export { default as SelectField } from './molecules/SelectField'
|
|
46
46
|
export type { SelectFieldProps } from './molecules/SelectField'
|
|
47
|
+
export {
|
|
48
|
+
Table,
|
|
49
|
+
TableBody,
|
|
50
|
+
TableCell,
|
|
51
|
+
TableFooter,
|
|
52
|
+
TableHead,
|
|
53
|
+
TableRow,
|
|
54
|
+
} from './molecules/Table'
|
|
55
|
+
export type {
|
|
56
|
+
TableProps,
|
|
57
|
+
TableBodyProps,
|
|
58
|
+
TableCellProps,
|
|
59
|
+
TableFooterProps,
|
|
60
|
+
TableHeadProps,
|
|
61
|
+
TableRowProps,
|
|
62
|
+
} from './molecules/Table'
|
|
47
63
|
export { default as Tag } from './molecules/Tag'
|
|
48
64
|
export type { TagProps } from './molecules/Tag'
|
|
49
65
|
export { default as Toggle } from './molecules/Toggle'
|
|
@@ -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
|
})
|