@faststore/components 2.0.39-alpha.0 → 2.0.42-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/ArrowElbowDownRight.d.ts +3 -0
- package/dist/assets/ArrowElbowDownRight.js +8 -0
- package/dist/assets/ArrowElbowDownRight.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/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/molecules/Dropdown/Dropdown.d.ts +9 -0
- package/dist/molecules/Dropdown/Dropdown.js +66 -0
- package/dist/molecules/Dropdown/Dropdown.js.map +1 -0
- package/dist/molecules/Dropdown/DropdownButton.d.ts +10 -0
- package/dist/molecules/Dropdown/DropdownButton.js +12 -0
- package/dist/molecules/Dropdown/DropdownButton.js.map +1 -0
- package/dist/molecules/Dropdown/DropdownItem.d.ts +15 -0
- package/dist/molecules/Dropdown/DropdownItem.js +29 -0
- package/dist/molecules/Dropdown/DropdownItem.js.map +1 -0
- package/dist/molecules/Dropdown/DropdownMenu.d.ts +26 -0
- package/dist/molecules/Dropdown/DropdownMenu.js +66 -0
- package/dist/molecules/Dropdown/DropdownMenu.js.map +1 -0
- package/dist/molecules/Dropdown/contexts/DropdownContext.d.ts +41 -0
- package/dist/molecules/Dropdown/contexts/DropdownContext.js +11 -0
- package/dist/molecules/Dropdown/contexts/DropdownContext.js.map +1 -0
- package/dist/molecules/Dropdown/hooks/useDropdown.d.ts +6 -0
- package/dist/molecules/Dropdown/hooks/useDropdown.js +14 -0
- package/dist/molecules/Dropdown/hooks/useDropdown.js.map +1 -0
- package/dist/molecules/Dropdown/hooks/useDropdownPosition.d.ts +8 -0
- package/dist/molecules/Dropdown/hooks/useDropdownPosition.js +25 -0
- package/dist/molecules/Dropdown/hooks/useDropdownPosition.js.map +1 -0
- package/dist/molecules/Dropdown/index.d.ts +8 -0
- package/dist/molecules/Dropdown/index.js +5 -0
- package/dist/molecules/Dropdown/index.js.map +1 -0
- package/dist/molecules/Table/Table.d.ts +4 -6
- package/dist/molecules/Table/Table.js +1 -1
- package/dist/molecules/Table/Table.js.map +1 -1
- package/dist/molecules/Table/TableBody.d.ts +4 -6
- package/dist/molecules/Table/TableBody.js.map +1 -1
- package/dist/molecules/Table/TableCell.d.ts +4 -2
- package/dist/molecules/Table/TableCell.js +1 -1
- package/dist/molecules/Table/TableCell.js.map +1 -1
- package/dist/molecules/Table/TableFooter.d.ts +4 -6
- package/dist/molecules/Table/TableFooter.js.map +1 -1
- package/dist/molecules/Table/TableHead.d.ts +4 -6
- package/dist/molecules/Table/TableHead.js.map +1 -1
- package/dist/molecules/Table/TableRow.d.ts +4 -6
- package/dist/molecules/Table/TableRow.js +1 -1
- package/dist/molecules/Table/TableRow.js.map +1 -1
- package/package.json +2 -2
- package/src/assets/ArrowElbowDownRight.tsx +34 -0
- package/src/assets/index.ts +1 -0
- package/src/index.ts +12 -0
- package/src/molecules/Dropdown/Dropdown.tsx +101 -0
- package/src/molecules/Dropdown/DropdownButton.tsx +43 -0
- package/src/molecules/Dropdown/DropdownItem.tsx +75 -0
- package/src/molecules/Dropdown/DropdownMenu.tsx +154 -0
- package/src/molecules/Dropdown/contexts/DropdownContext.ts +53 -0
- package/src/molecules/Dropdown/hooks/useDropdown.ts +18 -0
- package/src/molecules/Dropdown/hooks/useDropdownPosition.ts +33 -0
- package/src/molecules/Dropdown/index.ts +11 -0
- package/src/molecules/Table/Table.tsx +21 -23
- package/src/molecules/Table/TableBody.tsx +14 -17
- package/src/molecules/Table/TableCell.tsx +29 -28
- package/src/molecules/Table/TableFooter.tsx +14 -17
- package/src/molecules/Table/TableHead.tsx +14 -17
- package/src/molecules/Table/TableRow.tsx +11 -17
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
import type { TableHTMLAttributes } from 'react'
|
|
2
1
|
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { TableHTMLAttributes, PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
5
5
|
/**
|
|
6
6
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
7
|
*/
|
|
8
8
|
testId?: string
|
|
9
|
-
/**
|
|
10
|
-
* Children for Table components.
|
|
11
|
-
*/
|
|
12
|
-
children: React.ReactNode
|
|
13
9
|
/**
|
|
14
10
|
* Defines what style this component should use.
|
|
15
11
|
*/
|
|
16
12
|
variant?: 'colored' | 'bordered'
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
const Table = forwardRef<HTMLTableElement, TableProps
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<table
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
const Table = forwardRef<HTMLTableElement, PropsWithChildren<TableProps>>(
|
|
16
|
+
function Table(
|
|
17
|
+
{ children, variant = 'colored', testId = 'fs-table', ...otherProps },
|
|
18
|
+
ref
|
|
19
|
+
) {
|
|
20
|
+
return (
|
|
21
|
+
<div data-fs-table>
|
|
22
|
+
<table
|
|
23
|
+
ref={ref}
|
|
24
|
+
data-fs-table-content
|
|
25
|
+
data-fs-table-variant={variant}
|
|
26
|
+
data-testid={testId}
|
|
27
|
+
{...otherProps}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</table>
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
)
|
|
37
35
|
|
|
38
36
|
export default Table
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react'
|
|
2
1
|
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface TableBodyProps
|
|
5
5
|
extends HTMLAttributes<HTMLTableSectionElement> {
|
|
@@ -7,23 +7,20 @@ export interface TableBodyProps
|
|
|
7
7
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
8
8
|
*/
|
|
9
9
|
testId?: string
|
|
10
|
-
/**
|
|
11
|
-
* Children for TableBody components.
|
|
12
|
-
*/
|
|
13
|
-
children: React.ReactNode
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
const TableBody = forwardRef<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
12
|
+
const TableBody = forwardRef<
|
|
13
|
+
HTMLTableSectionElement,
|
|
14
|
+
PropsWithChildren<TableBodyProps>
|
|
15
|
+
>(function TableBody(
|
|
16
|
+
{ children, testId = 'fs-table-body', ...otherProps },
|
|
17
|
+
ref
|
|
18
|
+
) {
|
|
19
|
+
return (
|
|
20
|
+
<tbody ref={ref} data-testid={testId} data-fs-table-body {...otherProps}>
|
|
21
|
+
{children}
|
|
22
|
+
</tbody>
|
|
23
|
+
)
|
|
24
|
+
})
|
|
28
25
|
|
|
29
26
|
export default TableBody
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react'
|
|
2
1
|
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
4
|
type TableCellVariant = 'data' | 'header'
|
|
5
5
|
|
|
@@ -23,33 +23,34 @@ export interface TableCellProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
|
23
23
|
align?: 'left' | 'center' | 'right'
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const TableCell = forwardRef<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
const TableCell = forwardRef<
|
|
27
|
+
HTMLTableCellElement,
|
|
28
|
+
PropsWithChildren<TableCellProps>
|
|
29
|
+
>(function TableCell(
|
|
30
|
+
{
|
|
31
|
+
scope,
|
|
32
|
+
align,
|
|
33
|
+
children,
|
|
34
|
+
variant = 'data',
|
|
35
|
+
testId = 'fs-table-cell',
|
|
36
|
+
...otherProps
|
|
37
|
+
},
|
|
38
|
+
ref
|
|
39
|
+
) {
|
|
40
|
+
const Cell = variant === 'header' ? 'th' : 'td'
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)
|
|
42
|
+
return (
|
|
43
|
+
<Cell
|
|
44
|
+
ref={ref}
|
|
45
|
+
data-fs-table-cell={variant}
|
|
46
|
+
data-fs-table-cell-align={align}
|
|
47
|
+
data-testid={testId}
|
|
48
|
+
scope={scope}
|
|
49
|
+
{...otherProps}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</Cell>
|
|
53
|
+
)
|
|
54
|
+
})
|
|
54
55
|
|
|
55
56
|
export default TableCell
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react'
|
|
2
1
|
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface TableFooterProps
|
|
5
5
|
extends HTMLAttributes<HTMLTableSectionElement> {
|
|
@@ -7,23 +7,20 @@ export interface TableFooterProps
|
|
|
7
7
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
8
8
|
*/
|
|
9
9
|
testId?: string
|
|
10
|
-
/**
|
|
11
|
-
* Children for TableFooter components.
|
|
12
|
-
*/
|
|
13
|
-
children: React.ReactNode
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
const TableFooter = forwardRef<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
12
|
+
const TableFooter = forwardRef<
|
|
13
|
+
HTMLTableSectionElement,
|
|
14
|
+
PropsWithChildren<TableFooterProps>
|
|
15
|
+
>(function TableFooter(
|
|
16
|
+
{ children, testId = 'fs-table-footer', ...otherProps },
|
|
17
|
+
ref
|
|
18
|
+
) {
|
|
19
|
+
return (
|
|
20
|
+
<tfoot ref={ref} data-testid={testId} data-fs-table-footer {...otherProps}>
|
|
21
|
+
{children}
|
|
22
|
+
</tfoot>
|
|
23
|
+
)
|
|
24
|
+
})
|
|
28
25
|
|
|
29
26
|
export default TableFooter
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react'
|
|
2
1
|
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface TableHeadProps
|
|
5
5
|
extends HTMLAttributes<HTMLTableSectionElement> {
|
|
@@ -7,23 +7,20 @@ export interface TableHeadProps
|
|
|
7
7
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
8
8
|
*/
|
|
9
9
|
testId?: string
|
|
10
|
-
/**
|
|
11
|
-
* Children for TableHead components.
|
|
12
|
-
*/
|
|
13
|
-
children: React.ReactNode
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
const TableHead = forwardRef<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
12
|
+
const TableHead = forwardRef<
|
|
13
|
+
HTMLTableSectionElement,
|
|
14
|
+
PropsWithChildren<TableHeadProps>
|
|
15
|
+
>(function TableHead(
|
|
16
|
+
{ children, testId = 'fs-table-head', ...otherProps },
|
|
17
|
+
ref
|
|
18
|
+
) {
|
|
19
|
+
return (
|
|
20
|
+
<thead ref={ref} data-testid={testId} data-fs-table-head {...otherProps}>
|
|
21
|
+
{children}
|
|
22
|
+
</thead>
|
|
23
|
+
)
|
|
24
|
+
})
|
|
28
25
|
|
|
29
26
|
export default TableHead
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react'
|
|
2
1
|
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
5
5
|
/**
|
|
6
6
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
7
|
*/
|
|
8
8
|
testId?: string
|
|
9
|
-
/**
|
|
10
|
-
* Children for TableRow components.
|
|
11
|
-
*/
|
|
12
|
-
children: React.ReactNode
|
|
13
9
|
}
|
|
14
10
|
|
|
15
|
-
const TableRow = forwardRef<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
)
|
|
11
|
+
const TableRow = forwardRef<
|
|
12
|
+
HTMLTableRowElement,
|
|
13
|
+
PropsWithChildren<TableRowProps>
|
|
14
|
+
>(function TableRow({ children, testId = 'fs-table-row', ...otherProps }, ref) {
|
|
15
|
+
return (
|
|
16
|
+
<tr ref={ref} data-fs-table-row data-testid={testId} {...otherProps}>
|
|
17
|
+
{children}
|
|
18
|
+
</tr>
|
|
19
|
+
)
|
|
20
|
+
})
|
|
27
21
|
|
|
28
22
|
export default TableRow
|