@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.
Files changed (67) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/assets/ArrowElbowDownRight.d.ts +3 -0
  3. package/dist/assets/ArrowElbowDownRight.js +8 -0
  4. package/dist/assets/ArrowElbowDownRight.js.map +1 -0
  5. package/dist/assets/index.d.ts +1 -0
  6. package/dist/assets/index.js +1 -0
  7. package/dist/assets/index.js.map +1 -1
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.js +1 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/molecules/Dropdown/Dropdown.d.ts +9 -0
  12. package/dist/molecules/Dropdown/Dropdown.js +66 -0
  13. package/dist/molecules/Dropdown/Dropdown.js.map +1 -0
  14. package/dist/molecules/Dropdown/DropdownButton.d.ts +10 -0
  15. package/dist/molecules/Dropdown/DropdownButton.js +12 -0
  16. package/dist/molecules/Dropdown/DropdownButton.js.map +1 -0
  17. package/dist/molecules/Dropdown/DropdownItem.d.ts +15 -0
  18. package/dist/molecules/Dropdown/DropdownItem.js +29 -0
  19. package/dist/molecules/Dropdown/DropdownItem.js.map +1 -0
  20. package/dist/molecules/Dropdown/DropdownMenu.d.ts +26 -0
  21. package/dist/molecules/Dropdown/DropdownMenu.js +66 -0
  22. package/dist/molecules/Dropdown/DropdownMenu.js.map +1 -0
  23. package/dist/molecules/Dropdown/contexts/DropdownContext.d.ts +41 -0
  24. package/dist/molecules/Dropdown/contexts/DropdownContext.js +11 -0
  25. package/dist/molecules/Dropdown/contexts/DropdownContext.js.map +1 -0
  26. package/dist/molecules/Dropdown/hooks/useDropdown.d.ts +6 -0
  27. package/dist/molecules/Dropdown/hooks/useDropdown.js +14 -0
  28. package/dist/molecules/Dropdown/hooks/useDropdown.js.map +1 -0
  29. package/dist/molecules/Dropdown/hooks/useDropdownPosition.d.ts +8 -0
  30. package/dist/molecules/Dropdown/hooks/useDropdownPosition.js +25 -0
  31. package/dist/molecules/Dropdown/hooks/useDropdownPosition.js.map +1 -0
  32. package/dist/molecules/Dropdown/index.d.ts +8 -0
  33. package/dist/molecules/Dropdown/index.js +5 -0
  34. package/dist/molecules/Dropdown/index.js.map +1 -0
  35. package/dist/molecules/Table/Table.d.ts +4 -6
  36. package/dist/molecules/Table/Table.js +1 -1
  37. package/dist/molecules/Table/Table.js.map +1 -1
  38. package/dist/molecules/Table/TableBody.d.ts +4 -6
  39. package/dist/molecules/Table/TableBody.js.map +1 -1
  40. package/dist/molecules/Table/TableCell.d.ts +4 -2
  41. package/dist/molecules/Table/TableCell.js +1 -1
  42. package/dist/molecules/Table/TableCell.js.map +1 -1
  43. package/dist/molecules/Table/TableFooter.d.ts +4 -6
  44. package/dist/molecules/Table/TableFooter.js.map +1 -1
  45. package/dist/molecules/Table/TableHead.d.ts +4 -6
  46. package/dist/molecules/Table/TableHead.js.map +1 -1
  47. package/dist/molecules/Table/TableRow.d.ts +4 -6
  48. package/dist/molecules/Table/TableRow.js +1 -1
  49. package/dist/molecules/Table/TableRow.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/assets/ArrowElbowDownRight.tsx +34 -0
  52. package/src/assets/index.ts +1 -0
  53. package/src/index.ts +12 -0
  54. package/src/molecules/Dropdown/Dropdown.tsx +101 -0
  55. package/src/molecules/Dropdown/DropdownButton.tsx +43 -0
  56. package/src/molecules/Dropdown/DropdownItem.tsx +75 -0
  57. package/src/molecules/Dropdown/DropdownMenu.tsx +154 -0
  58. package/src/molecules/Dropdown/contexts/DropdownContext.ts +53 -0
  59. package/src/molecules/Dropdown/hooks/useDropdown.ts +18 -0
  60. package/src/molecules/Dropdown/hooks/useDropdownPosition.ts +33 -0
  61. package/src/molecules/Dropdown/index.ts +11 -0
  62. package/src/molecules/Table/Table.tsx +21 -23
  63. package/src/molecules/Table/TableBody.tsx +14 -17
  64. package/src/molecules/Table/TableCell.tsx +29 -28
  65. package/src/molecules/Table/TableFooter.tsx +14 -17
  66. package/src/molecules/Table/TableHead.tsx +14 -17
  67. 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>(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
- })
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<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
- )
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<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'
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
- 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
- )
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<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
- )
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<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
- )
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<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
- )
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