@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,38 @@
|
|
|
1
|
+
import type { DetailedHTMLProps, TableHTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface TableProps extends DetailedHTMLProps<TableHTMLAttributes<HTMLTableElement>, HTMLTableElement> {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
+
*/
|
|
8
|
+
testId?: string
|
|
9
|
+
/**
|
|
10
|
+
* Children for Table components.
|
|
11
|
+
*/
|
|
12
|
+
children: React.ReactNode
|
|
13
|
+
/**
|
|
14
|
+
* Defines what style this component should use.
|
|
15
|
+
*/
|
|
16
|
+
variant?: 'colored' | 'bordered'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Table = forwardRef<HTMLTableElement, TableProps>(function Table(
|
|
20
|
+
{ variant = 'colored', testId = 'fs-table', children, ...otherProps },
|
|
21
|
+
ref
|
|
22
|
+
) {
|
|
23
|
+
return (
|
|
24
|
+
<div data-fs-table>
|
|
25
|
+
<table
|
|
26
|
+
ref={ref}
|
|
27
|
+
data-fs-table-content
|
|
28
|
+
data-fs-table-variant={variant}
|
|
29
|
+
data-testid={testId}
|
|
30
|
+
{...otherProps}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</table>
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export default Table
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface TableBodyProps
|
|
5
|
+
extends HTMLAttributes<HTMLTableSectionElement> {
|
|
6
|
+
/**
|
|
7
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
8
|
+
*/
|
|
9
|
+
testId?: string
|
|
10
|
+
/**
|
|
11
|
+
* Children for TableBody components.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(
|
|
17
|
+
function TableBody(
|
|
18
|
+
{ children, testId = 'fs-table-body', ...otherProps },
|
|
19
|
+
ref
|
|
20
|
+
) {
|
|
21
|
+
return (
|
|
22
|
+
<tbody ref={ref} data-testid={testId} data-fs-table-body {...otherProps}>
|
|
23
|
+
{children}
|
|
24
|
+
</tbody>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
export default TableBody
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
type TableCellVariant = 'data' | 'header'
|
|
5
|
+
|
|
6
|
+
export interface TableCellProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
7
|
+
/**
|
|
8
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
9
|
+
*/
|
|
10
|
+
testId?: string
|
|
11
|
+
/**
|
|
12
|
+
* Specify if this component should be rendered as a header (`<th>`) or as a data cell (`<td>`).
|
|
13
|
+
*/
|
|
14
|
+
variant?: TableCellVariant
|
|
15
|
+
/**
|
|
16
|
+
* Defines the cells that the header element (`<th>`) relates to.
|
|
17
|
+
* @see scope https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
|
|
18
|
+
*/
|
|
19
|
+
scope?: 'col' | 'row' | 'rowgroup' | 'colgroup'
|
|
20
|
+
/**
|
|
21
|
+
* Defines how this component should be aligned.
|
|
22
|
+
*/
|
|
23
|
+
align?: 'left' | 'center' | 'right'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
|
|
27
|
+
function TableCell(
|
|
28
|
+
{
|
|
29
|
+
testId = 'fs-table-cell',
|
|
30
|
+
children,
|
|
31
|
+
variant = 'data',
|
|
32
|
+
scope,
|
|
33
|
+
align,
|
|
34
|
+
...otherProps
|
|
35
|
+
},
|
|
36
|
+
ref
|
|
37
|
+
) {
|
|
38
|
+
const Cell = variant === 'header' ? 'th' : 'td'
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Cell
|
|
42
|
+
ref={ref}
|
|
43
|
+
data-fs-table-cell={variant}
|
|
44
|
+
data-fs-table-cell-align={align}
|
|
45
|
+
data-testid={testId}
|
|
46
|
+
scope={scope}
|
|
47
|
+
{...otherProps}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
</Cell>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
export default TableCell
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface TableFooterProps
|
|
5
|
+
extends HTMLAttributes<HTMLTableSectionElement> {
|
|
6
|
+
/**
|
|
7
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
8
|
+
*/
|
|
9
|
+
testId?: string
|
|
10
|
+
/**
|
|
11
|
+
* Children for TableFooter components.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TableFooter = forwardRef<HTMLTableSectionElement, TableFooterProps>(
|
|
17
|
+
function TableFooter(
|
|
18
|
+
{ children, testId = 'fs-table-footer', ...otherProps },
|
|
19
|
+
ref
|
|
20
|
+
) {
|
|
21
|
+
return (
|
|
22
|
+
<tfoot ref={ref} data-testid={testId} data-fs-table-footer {...otherProps}>
|
|
23
|
+
{children}
|
|
24
|
+
</tfoot>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
export default TableFooter
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface TableHeadProps
|
|
5
|
+
extends HTMLAttributes<HTMLTableSectionElement> {
|
|
6
|
+
/**
|
|
7
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
8
|
+
*/
|
|
9
|
+
testId?: string
|
|
10
|
+
/**
|
|
11
|
+
* Children for TableHead components.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TableHead = forwardRef<HTMLTableSectionElement, TableHeadProps>(
|
|
17
|
+
function TableHead(
|
|
18
|
+
{ children, testId = 'fs-table-head', ...otherProps },
|
|
19
|
+
ref
|
|
20
|
+
) {
|
|
21
|
+
return (
|
|
22
|
+
<thead ref={ref} data-testid={testId} data-fs-table-head {...otherProps}>
|
|
23
|
+
{children}
|
|
24
|
+
</thead>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
export default TableHead
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
+
*/
|
|
8
|
+
testId?: string
|
|
9
|
+
/**
|
|
10
|
+
* Children for TableRow components.
|
|
11
|
+
*/
|
|
12
|
+
children: React.ReactNode
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(
|
|
16
|
+
function TableRow(
|
|
17
|
+
{ testId = 'fs-table-row', children, ...otherProps },
|
|
18
|
+
ref
|
|
19
|
+
) {
|
|
20
|
+
return (
|
|
21
|
+
<tr ref={ref} data-fs-table-row data-testid={testId} {...otherProps}>
|
|
22
|
+
{children}
|
|
23
|
+
</tr>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
export default TableRow
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { default as Table } from './Table'
|
|
2
|
+
export type { TableProps } from './Table'
|
|
3
|
+
|
|
4
|
+
export { default as TableRow } from './TableRow'
|
|
5
|
+
export type { TableRowProps } from './TableRow'
|
|
6
|
+
|
|
7
|
+
export { default as TableCell } from './TableCell'
|
|
8
|
+
export type { TableCellProps } from './TableCell'
|
|
9
|
+
|
|
10
|
+
export { default as TableBody } from './TableBody'
|
|
11
|
+
export type { TableBodyProps } from './TableBody'
|
|
12
|
+
|
|
13
|
+
export { default as TableHead } from './TableHead'
|
|
14
|
+
export type { TableHeadProps } from './TableHead'
|
|
15
|
+
|
|
16
|
+
export { default as TableFooter } from './TableFooter'
|
|
17
|
+
export type { TableFooterProps } from './TableFooter'
|
|
@@ -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}
|