@sproutsocial/seeds-react-table 1.0.50 → 1.0.53
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/.turbo/turbo-build.log +34 -34
- package/CHANGELOG.md +26 -0
- package/dist/esm/v2/index.js +216 -29
- package/dist/esm/v2/index.js.map +1 -1
- package/dist/table-v2.css +87 -0
- package/dist/v2/index.d.mts +17 -12
- package/dist/v2/index.d.ts +17 -12
- package/dist/v2/index.js +216 -29
- package/dist/v2/index.js.map +1 -1
- package/package.json +9 -8
- package/src/table-v2.css +87 -0
- package/src/v2/TableV2.tsx +17 -91
- package/src/v2/TableV2Hybrid.tsx +277 -0
- package/src/v2/TableV2Tailwind.tsx +177 -0
- package/src/v2/__tests__/table-v2.test.tsx +233 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
yarn run v1.22.22
|
|
2
|
-
$ tsup --dts
|
|
3
|
-
[34mCLI[39m Building entry: src/index.ts, src/v1/index.ts, src/v2/index.ts, src/v1/
|
|
2
|
+
$ tsup --dts && cp src/table-v2.css dist/table-v2.css
|
|
3
|
+
[34mCLI[39m Building entry: src/index.ts, src/v1/index.ts, src/v2/index.ts, src/v1/TableCell/index.ts, src/v1/TableHeaderCell/index.ts, src/v1/TableRowAccordion/index.ts
|
|
4
4
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
5
5
|
[34mCLI[39m tsup v8.5.0
|
|
6
6
|
[34mCLI[39m Using tsup config: /home/runner/_work/seeds/seeds/seeds-react/seeds-react-table/tsup.config.ts
|
|
@@ -8,62 +8,62 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m10.39 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/v1/index.js [22m[32m10.32 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/v1/TableRowAccordion/index.js [22m[32m6.38 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/v2/index.js [22m[32m14.12 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/v1/TableCell/index.js [22m[32m3.12 KB[39m
|
|
16
|
+
[32mCJS[39m [1mdist/v1/TableHeaderCell/index.js [22m[32m5.97 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m19.00 KB[39m
|
|
18
|
+
[32mCJS[39m [1mdist/v1/index.js.map [22m[32m17.51 KB[39m
|
|
19
|
+
[32mCJS[39m [1mdist/v1/TableRowAccordion/index.js.map [22m[32m9.33 KB[39m
|
|
20
|
+
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m21.74 KB[39m
|
|
21
|
+
[32mCJS[39m [1mdist/v1/TableCell/index.js.map [22m[32m3.92 KB[39m
|
|
22
|
+
[32mCJS[39m [1mdist/v1/TableHeaderCell/index.js.map [22m[32m8.15 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 207ms
|
|
12
24
|
[32mESM[39m [1mdist/esm/index.js [22m[32m306.00 B[39m
|
|
25
|
+
[32mESM[39m [1mdist/esm/v2/index.js [22m[32m10.11 KB[39m
|
|
26
|
+
[32mESM[39m [1mdist/esm/chunk-F73BV5I2.js [22m[32m2.82 KB[39m
|
|
27
|
+
[32mESM[39m [1mdist/esm/chunk-T7WTUUPA.js [22m[32m3.91 KB[39m
|
|
13
28
|
[32mESM[39m [1mdist/esm/chunk-WGM7UCXV.js [22m[32m1.36 KB[39m
|
|
29
|
+
[32mESM[39m [1mdist/esm/v1/TableCell/index.js [22m[32m196.00 B[39m
|
|
14
30
|
[32mESM[39m [1mdist/esm/v1/TableHeaderCell/index.js [22m[32m264.00 B[39m
|
|
15
|
-
[32mESM[39m [1mdist/esm/chunk-T7WTUUPA.js [22m[32m3.91 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/esm/v2/index.js [22m[32m4.17 KB[39m
|
|
17
31
|
[32mESM[39m [1mdist/esm/v1/TableRowAccordion/index.js [22m[32m2.94 KB[39m
|
|
18
32
|
[32mESM[39m [1mdist/esm/v1/index.js [22m[32m265.00 B[39m
|
|
19
|
-
[32mESM[39m [1mdist/esm/v1/TableCell/index.js [22m[32m196.00 B[39m
|
|
20
|
-
[32mESM[39m [1mdist/esm/chunk-F73BV5I2.js.map [22m[32m4.98 KB[39m
|
|
21
33
|
[32mESM[39m [1mdist/esm/index.js.map [22m[32m1.91 KB[39m
|
|
22
|
-
[32mESM[39m [1mdist/esm/
|
|
23
|
-
[32mESM[39m [1mdist/esm/chunk-
|
|
34
|
+
[32mESM[39m [1mdist/esm/v2/index.js.map [22m[32m21.15 KB[39m
|
|
35
|
+
[32mESM[39m [1mdist/esm/chunk-F73BV5I2.js.map [22m[32m4.98 KB[39m
|
|
24
36
|
[32mESM[39m [1mdist/esm/chunk-T7WTUUPA.js.map [22m[32m8.01 KB[39m
|
|
25
|
-
[32mESM[39m [1mdist/esm/
|
|
26
|
-
[32mESM[39m [1mdist/esm/v1/index.js.map [22m[32m406.00 B[39m
|
|
27
|
-
[32mESM[39m [1mdist/esm/v1/TableRowAccordion/index.js.map [22m[32m5.28 KB[39m
|
|
37
|
+
[32mESM[39m [1mdist/esm/chunk-WGM7UCXV.js.map [22m[32m3.80 KB[39m
|
|
28
38
|
[32mESM[39m [1mdist/esm/v1/TableCell/index.js.map [22m[32m71.00 B[39m
|
|
29
|
-
[32mESM[39m
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[32mCJS[39m [1mdist/v1/TableCell/index.js [22m[32m3.12 KB[39m
|
|
34
|
-
[32mCJS[39m [1mdist/index.js [22m[32m10.39 KB[39m
|
|
35
|
-
[32mCJS[39m [1mdist/v1/TableRowAccordion/index.js [22m[32m6.38 KB[39m
|
|
36
|
-
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m7.88 KB[39m
|
|
37
|
-
[32mCJS[39m [1mdist/v1/index.js.map [22m[32m17.51 KB[39m
|
|
38
|
-
[32mCJS[39m [1mdist/v1/TableHeaderCell/index.js.map [22m[32m8.15 KB[39m
|
|
39
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m19.00 KB[39m
|
|
40
|
-
[32mCJS[39m [1mdist/v1/TableRowAccordion/index.js.map [22m[32m9.33 KB[39m
|
|
41
|
-
[32mCJS[39m [1mdist/v1/TableCell/index.js.map [22m[32m3.92 KB[39m
|
|
42
|
-
[32mCJS[39m ⚡️ Build success in 100ms
|
|
39
|
+
[32mESM[39m [1mdist/esm/v1/TableHeaderCell/index.js.map [22m[32m71.00 B[39m
|
|
40
|
+
[32mESM[39m [1mdist/esm/v1/TableRowAccordion/index.js.map [22m[32m5.28 KB[39m
|
|
41
|
+
[32mESM[39m [1mdist/esm/v1/index.js.map [22m[32m406.00 B[39m
|
|
42
|
+
[32mESM[39m ⚡️ Build success in 208ms
|
|
43
43
|
[34mDTS[39m Build start
|
|
44
|
-
[32mDTS[39m ⚡️ Build success in
|
|
44
|
+
[32mDTS[39m ⚡️ Build success in 19539ms
|
|
45
45
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m474.00 B[39m
|
|
46
46
|
[32mDTS[39m [1mdist/v1/index.d.ts [22m[32m480.00 B[39m
|
|
47
|
-
[32mDTS[39m [1mdist/v2/index.d.ts [22m[
|
|
48
|
-
[32mDTS[39m [1mdist/v1/TableHeaderCell/index.d.ts [22m[32m408.00 B[39m
|
|
47
|
+
[32mDTS[39m [1mdist/v2/index.d.ts [22m[32m3.09 KB[39m
|
|
49
48
|
[32mDTS[39m [1mdist/v1/TableCell/index.d.ts [22m[32m278.00 B[39m
|
|
49
|
+
[32mDTS[39m [1mdist/v1/TableHeaderCell/index.d.ts [22m[32m408.00 B[39m
|
|
50
50
|
[32mDTS[39m [1mdist/v1/TableRowAccordion/index.d.ts [22m[32m1.28 KB[39m
|
|
51
51
|
[32mDTS[39m [1mdist/Table-Dl102bgy.d.ts [22m[32m1015.00 B[39m
|
|
52
|
-
[32mDTS[39m [1mdist/TableHeaderCell-DnwlruQg.d.ts [22m[32m588.00 B[39m
|
|
53
52
|
[32mDTS[39m [1mdist/TableCell-CN71R1B5.d.ts [22m[32m453.00 B[39m
|
|
53
|
+
[32mDTS[39m [1mdist/TableHeaderCell-DnwlruQg.d.ts [22m[32m588.00 B[39m
|
|
54
54
|
[32mDTS[39m [1mdist/TableTypes-DlNqrZVT.d.ts [22m[32m1.55 KB[39m
|
|
55
55
|
[32mDTS[39m [1mdist/TableHeaderCellTypes-CH_zzW6X.d.ts [22m[32m1.06 KB[39m
|
|
56
56
|
[32mDTS[39m [1mdist/TableCellTypes-Cp-8r7l1.d.ts [22m[32m1013.00 B[39m
|
|
57
57
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m480.00 B[39m
|
|
58
58
|
[32mDTS[39m [1mdist/v1/index.d.mts [22m[32m486.00 B[39m
|
|
59
|
-
[32mDTS[39m [1mdist/v2/index.d.mts [22m[
|
|
60
|
-
[32mDTS[39m [1mdist/v1/TableHeaderCell/index.d.mts [22m[32m411.00 B[39m
|
|
59
|
+
[32mDTS[39m [1mdist/v2/index.d.mts [22m[32m3.09 KB[39m
|
|
61
60
|
[32mDTS[39m [1mdist/v1/TableCell/index.d.mts [22m[32m280.00 B[39m
|
|
61
|
+
[32mDTS[39m [1mdist/v1/TableHeaderCell/index.d.mts [22m[32m411.00 B[39m
|
|
62
62
|
[32mDTS[39m [1mdist/v1/TableRowAccordion/index.d.mts [22m[32m1.28 KB[39m
|
|
63
63
|
[32mDTS[39m [1mdist/Table-CX-3nEyi.d.mts [22m[32m1018.00 B[39m
|
|
64
|
-
[32mDTS[39m [1mdist/TableHeaderCell-DsJpGb2j.d.mts [22m[32m589.00 B[39m
|
|
65
64
|
[32mDTS[39m [1mdist/TableCell-B8GMRlv7.d.mts [22m[32m454.00 B[39m
|
|
65
|
+
[32mDTS[39m [1mdist/TableHeaderCell-DsJpGb2j.d.mts [22m[32m589.00 B[39m
|
|
66
66
|
[32mDTS[39m [1mdist/TableTypes--W7X6tmk.d.mts [22m[32m1.55 KB[39m
|
|
67
67
|
[32mDTS[39m [1mdist/TableHeaderCellTypes-CsJQBwu2.d.mts [22m[32m1.06 KB[39m
|
|
68
68
|
[32mDTS[39m [1mdist/TableCellTypes-Cp-8r7l1.d.mts [22m[32m1013.00 B[39m
|
|
69
|
-
Done in
|
|
69
|
+
Done in 21.26s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-table
|
|
2
2
|
|
|
3
|
+
## 1.0.53
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [3371484]
|
|
8
|
+
- @sproutsocial/seeds-react-icon@2.5.0
|
|
9
|
+
- @sproutsocial/seeds-react-theme@4.4.0
|
|
10
|
+
|
|
11
|
+
## 1.0.52
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [56661b6]
|
|
16
|
+
- @sproutsocial/seeds-react-system-props@3.2.0
|
|
17
|
+
- @sproutsocial/seeds-react-theme@4.3.2
|
|
18
|
+
- @sproutsocial/seeds-react-icon@2.4.9
|
|
19
|
+
- @sproutsocial/seeds-react-text@1.5.4
|
|
20
|
+
|
|
21
|
+
## 1.0.51
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 50982e3: Honor the polymorphic `as` prop in every v2 Table Tailwind leaf. `TableWrapper`, `TableRoot`, `TableCaption`, `TableHeader`, `TableBody`, `TableRow`, `TableHeaderCell`, and `TableCell` now render a dynamic element from `as` (defaulting to `<div>` / `<table>` / `<caption>` / `<thead>` / `<tbody>` / `<tr>` / `<th>` / `<td>`) instead of a hard-coded tag. A string `as` renders the requested element with the Tailwind class intact, and a component-valued `as` (e.g. the documented `tableRowProps={{ as: styled(TableRow) }}` / `tableBodyProps={{ as: styled(TableBody) }}` DataTable pattern) re-enters the hybrid and falls back to the styled-components path. Because `as` is destructured out, it no longer leaks onto the DOM as an invalid attribute. This restores the polymorphic behavior the styled-components path provided and fixes the downstream `@sproutsocial/seeds-react-data-table` row-header and row/body customization rendering.
|
|
26
|
+
|
|
27
|
+
The v2 Table hybrid now routes on the documented `needsStyledComponents` single gate, so genuine `styled()` extensions (detected via an injected `theme` prop or `sc-XXXX` className) fall back to the styled-components path instead of leaking `theme` onto the DOM.
|
|
28
|
+
|
|
3
29
|
## 1.0.50
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/esm/v2/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
// src/v2/
|
|
2
|
-
import
|
|
1
|
+
// src/v2/TableV2Hybrid.tsx
|
|
2
|
+
import React3, { useId } from "react";
|
|
3
3
|
|
|
4
4
|
// src/v2/TableV2Types.ts
|
|
5
5
|
import "react";
|
|
6
6
|
|
|
7
|
+
// src/v2/TableV2Hybrid.tsx
|
|
8
|
+
import { needsStyledComponents } from "@sproutsocial/seeds-react-system-props";
|
|
9
|
+
|
|
7
10
|
// src/v2/styles.ts
|
|
8
11
|
import styled, { css } from "styled-components";
|
|
9
12
|
import {
|
|
@@ -72,27 +75,218 @@ var StyledTableCell = styled.td`
|
|
|
72
75
|
`;
|
|
73
76
|
StyledTableCell.displayName = "TableV2.TableCell";
|
|
74
77
|
|
|
75
|
-
// src/v2/
|
|
76
|
-
import
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
// src/v2/TableV2Tailwind.tsx
|
|
79
|
+
import React2 from "react";
|
|
80
|
+
import { jsx } from "react/jsx-runtime";
|
|
81
|
+
function cn(...inputs) {
|
|
82
|
+
const classes = [];
|
|
83
|
+
for (const input of inputs) {
|
|
84
|
+
if (!input) continue;
|
|
85
|
+
if (typeof input === "string") {
|
|
86
|
+
classes.push(input);
|
|
87
|
+
} else if (typeof input === "object") {
|
|
88
|
+
for (const [key, value] of Object.entries(input)) {
|
|
89
|
+
if (value) {
|
|
90
|
+
classes.push(key);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return classes.join(" ");
|
|
96
|
+
}
|
|
97
|
+
var TableV2ContainerTailwind = React2.forwardRef(({ className, children, as: Component = "div", ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
98
|
+
Component,
|
|
99
|
+
{
|
|
100
|
+
ref,
|
|
101
|
+
className: cn("seeds-table-v2-container", className),
|
|
102
|
+
...rest,
|
|
103
|
+
children
|
|
104
|
+
}
|
|
105
|
+
));
|
|
106
|
+
TableV2ContainerTailwind.displayName = "TableV2.ContainerTailwind";
|
|
107
|
+
var TableRootTailwind = React2.forwardRef(({ className, children, as: Component = "table", ...rest }, ref) => /* @__PURE__ */ jsx(Component, { ref, className: cn("seeds-table-v2", className), ...rest, children }));
|
|
108
|
+
TableRootTailwind.displayName = "TableV2.TableTailwind";
|
|
109
|
+
var CaptionTailwind = React2.forwardRef(
|
|
110
|
+
({
|
|
111
|
+
className,
|
|
112
|
+
children,
|
|
113
|
+
isVisible = true,
|
|
114
|
+
as: Component = "caption",
|
|
115
|
+
...rest
|
|
116
|
+
}, ref) => /* @__PURE__ */ jsx(
|
|
117
|
+
Component,
|
|
118
|
+
{
|
|
119
|
+
ref,
|
|
120
|
+
className: cn(
|
|
121
|
+
"seeds-table-v2-caption",
|
|
122
|
+
{ "seeds-table-v2-caption-hidden": !isVisible },
|
|
123
|
+
className
|
|
124
|
+
),
|
|
125
|
+
...rest,
|
|
126
|
+
children
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
CaptionTailwind.displayName = "TableV2.CaptionTailwind";
|
|
131
|
+
var TableHeaderTailwind = React2.forwardRef(({ className, children, as: Component = "thead", ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
132
|
+
Component,
|
|
133
|
+
{
|
|
134
|
+
ref,
|
|
135
|
+
className: cn("seeds-table-v2-header", className),
|
|
136
|
+
...rest,
|
|
137
|
+
children
|
|
138
|
+
}
|
|
139
|
+
));
|
|
140
|
+
TableHeaderTailwind.displayName = "TableV2.TableHeaderTailwind";
|
|
141
|
+
var TableBodyTailwind = React2.forwardRef(({ className, children, as: Component = "tbody", ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
142
|
+
Component,
|
|
143
|
+
{
|
|
144
|
+
ref,
|
|
145
|
+
className: cn("seeds-table-v2-body", className),
|
|
146
|
+
...rest,
|
|
147
|
+
children
|
|
148
|
+
}
|
|
149
|
+
));
|
|
150
|
+
TableBodyTailwind.displayName = "TableV2.TableBodyTailwind";
|
|
151
|
+
var TableRowTailwind = React2.forwardRef(({ className, children, as: Component = "tr", ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
152
|
+
Component,
|
|
153
|
+
{
|
|
154
|
+
ref,
|
|
155
|
+
className: cn("seeds-table-v2-row", className),
|
|
156
|
+
...rest,
|
|
157
|
+
children
|
|
158
|
+
}
|
|
159
|
+
));
|
|
160
|
+
TableRowTailwind.displayName = "TableV2.TableRowTailwind";
|
|
161
|
+
var TableHeaderCellTailwind = React2.forwardRef(({ className, children, as: Component = "th", ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
162
|
+
Component,
|
|
163
|
+
{
|
|
164
|
+
ref,
|
|
165
|
+
className: cn("seeds-table-v2-header-cell", className),
|
|
166
|
+
...rest,
|
|
167
|
+
children
|
|
168
|
+
}
|
|
169
|
+
));
|
|
170
|
+
TableHeaderCellTailwind.displayName = "TableV2.TableHeaderCellTailwind";
|
|
171
|
+
var TableCellTailwind = React2.forwardRef(({ className, children, as: Component = "td", ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
172
|
+
Component,
|
|
173
|
+
{
|
|
174
|
+
ref,
|
|
175
|
+
className: cn("seeds-table-v2-cell", className),
|
|
176
|
+
...rest,
|
|
177
|
+
children
|
|
178
|
+
}
|
|
179
|
+
));
|
|
180
|
+
TableCellTailwind.displayName = "TableV2.TableCellTailwind";
|
|
181
|
+
|
|
182
|
+
// src/v2/TableV2Hybrid.tsx
|
|
183
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
184
|
+
var TableContainerContext = React3.createContext(null);
|
|
185
|
+
var useTableContainerId = () => React3.useContext(TableContainerContext);
|
|
186
|
+
var TableWrapper = React3.forwardRef(({ children, className, ...rest }, ref) => {
|
|
83
187
|
const containerId = useId();
|
|
84
|
-
|
|
188
|
+
const containerProps = {
|
|
189
|
+
role: "region",
|
|
190
|
+
tabIndex: 0,
|
|
191
|
+
id: containerId,
|
|
192
|
+
"aria-labelledby": containerId
|
|
193
|
+
};
|
|
194
|
+
return /* @__PURE__ */ jsx2(TableContainerContext.Provider, { value: containerId, children: needsStyledComponents({ ...rest, className }) ? /* @__PURE__ */ jsx2(
|
|
85
195
|
StyledTableV2Container,
|
|
86
196
|
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
197
|
+
className,
|
|
198
|
+
ref,
|
|
199
|
+
...containerProps,
|
|
200
|
+
...rest,
|
|
201
|
+
children
|
|
202
|
+
}
|
|
203
|
+
) : /* @__PURE__ */ jsx2(
|
|
204
|
+
TableV2ContainerTailwind,
|
|
205
|
+
{
|
|
206
|
+
className,
|
|
207
|
+
ref,
|
|
208
|
+
...containerProps,
|
|
91
209
|
...rest,
|
|
92
210
|
children
|
|
93
211
|
}
|
|
94
212
|
) });
|
|
95
|
-
};
|
|
213
|
+
});
|
|
214
|
+
TableWrapper.displayName = "TableV2.TableWrapper";
|
|
215
|
+
var TableRoot = React3.forwardRef(
|
|
216
|
+
({ className, children, ...rest }, ref) => {
|
|
217
|
+
if (needsStyledComponents({ ...rest, className })) {
|
|
218
|
+
return /* @__PURE__ */ jsx2(StyledTableV2, { className, ref, ...rest, children });
|
|
219
|
+
}
|
|
220
|
+
return /* @__PURE__ */ jsx2(TableRootTailwind, { className, ref, ...rest, children });
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
TableRoot.displayName = "TableV2.Table";
|
|
224
|
+
var TableCaption = React3.forwardRef(({ className, children, isVisible = true, ...rest }, ref) => {
|
|
225
|
+
if (needsStyledComponents({ ...rest, className })) {
|
|
226
|
+
return /* @__PURE__ */ jsx2(
|
|
227
|
+
StyledCaption,
|
|
228
|
+
{
|
|
229
|
+
className,
|
|
230
|
+
isVisible,
|
|
231
|
+
ref,
|
|
232
|
+
...rest,
|
|
233
|
+
children
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
return /* @__PURE__ */ jsx2(
|
|
238
|
+
CaptionTailwind,
|
|
239
|
+
{
|
|
240
|
+
className,
|
|
241
|
+
isVisible,
|
|
242
|
+
ref,
|
|
243
|
+
...rest,
|
|
244
|
+
children
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
});
|
|
248
|
+
TableCaption.displayName = "TableV2.Caption";
|
|
249
|
+
var TableHeader = React3.forwardRef(({ className, children, ...rest }, ref) => {
|
|
250
|
+
if (needsStyledComponents({ ...rest, className })) {
|
|
251
|
+
return /* @__PURE__ */ jsx2(StyledTableHeader, { className, ref, ...rest, children });
|
|
252
|
+
}
|
|
253
|
+
return /* @__PURE__ */ jsx2(TableHeaderTailwind, { className, ref, ...rest, children });
|
|
254
|
+
});
|
|
255
|
+
TableHeader.displayName = "TableV2.TableHeader";
|
|
256
|
+
var TableBody = React3.forwardRef(
|
|
257
|
+
({ className, children, ...rest }, ref) => {
|
|
258
|
+
if (needsStyledComponents({ ...rest, className })) {
|
|
259
|
+
return /* @__PURE__ */ jsx2(StyledTableBody, { className, ref, ...rest, children });
|
|
260
|
+
}
|
|
261
|
+
return /* @__PURE__ */ jsx2(TableBodyTailwind, { className, ref, ...rest, children });
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
TableBody.displayName = "TableV2.TableBody";
|
|
265
|
+
var TableRow = React3.forwardRef(
|
|
266
|
+
({ className, children, ...rest }, ref) => {
|
|
267
|
+
if (needsStyledComponents({ ...rest, className })) {
|
|
268
|
+
return /* @__PURE__ */ jsx2(StyledTableRow, { className, ref, ...rest, children });
|
|
269
|
+
}
|
|
270
|
+
return /* @__PURE__ */ jsx2(TableRowTailwind, { className, ref, ...rest, children });
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
TableRow.displayName = "TableV2.TableRow";
|
|
274
|
+
var TableHeaderCell = React3.forwardRef(({ className, children, ...rest }, ref) => {
|
|
275
|
+
if (needsStyledComponents({ ...rest, className })) {
|
|
276
|
+
return /* @__PURE__ */ jsx2(StyledTableHeaderCell, { className, ref, ...rest, children });
|
|
277
|
+
}
|
|
278
|
+
return /* @__PURE__ */ jsx2(TableHeaderCellTailwind, { className, ref, ...rest, children });
|
|
279
|
+
});
|
|
280
|
+
TableHeaderCell.displayName = "TableV2.TableHeaderCell";
|
|
281
|
+
var TableCell = React3.forwardRef(
|
|
282
|
+
({ className, children, ...rest }, ref) => {
|
|
283
|
+
if (needsStyledComponents({ ...rest, className })) {
|
|
284
|
+
return /* @__PURE__ */ jsx2(StyledTableCell, { className, ref, ...rest, children });
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ jsx2(TableCellTailwind, { className, ref, ...rest, children });
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
TableCell.displayName = "TableV2.TableCell";
|
|
96
290
|
var TableV2 = ({
|
|
97
291
|
caption,
|
|
98
292
|
displayCaption = true,
|
|
@@ -100,21 +294,14 @@ var TableV2 = ({
|
|
|
100
294
|
data
|
|
101
295
|
}) => {
|
|
102
296
|
const containerId = useTableContainerId();
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */
|
|
297
|
+
return /* @__PURE__ */ jsx2(TableWrapper, { children: /* @__PURE__ */ jsxs(TableRoot, { children: [
|
|
298
|
+
/* @__PURE__ */ jsx2(TableCaption, { id: containerId ?? void 0, isVisible: displayCaption, children: caption }),
|
|
299
|
+
/* @__PURE__ */ jsx2(TableHeader, { children: /* @__PURE__ */ jsx2(TableRow, { children: columns.map((column, index) => /* @__PURE__ */ jsx2(TableHeaderCell, { scope: "col", children: column }, index)) }) }),
|
|
300
|
+
/* @__PURE__ */ jsx2(TableBody, { children: data.map((row, rowIndex) => /* @__PURE__ */ jsx2(TableRow, { children: row.map((cell, cellIndex) => /* @__PURE__ */ jsx2(TableCell, { children: cell }, cellIndex)) }, rowIndex)) })
|
|
107
301
|
] }) });
|
|
108
302
|
};
|
|
109
303
|
var Table = TableV2;
|
|
110
|
-
var
|
|
111
|
-
var TableCaption = StyledCaption;
|
|
112
|
-
var TableHeader = StyledTableHeader;
|
|
113
|
-
var TableBody = StyledTableBody;
|
|
114
|
-
var TableRow = StyledTableRow;
|
|
115
|
-
var TableHeaderCell = StyledTableHeaderCell;
|
|
116
|
-
var TableCell = StyledTableCell;
|
|
117
|
-
var TableV2_default = TableV2;
|
|
304
|
+
var TableV2Hybrid_default = TableV2;
|
|
118
305
|
export {
|
|
119
306
|
StyledCaption,
|
|
120
307
|
StyledTableBody,
|
|
@@ -132,7 +319,7 @@ export {
|
|
|
132
319
|
TableHeaderCell,
|
|
133
320
|
TableRoot,
|
|
134
321
|
TableRow,
|
|
135
|
-
|
|
322
|
+
TableV2Hybrid_default as TableV2,
|
|
136
323
|
TableWrapper,
|
|
137
324
|
useTableContainerId
|
|
138
325
|
};
|
package/dist/esm/v2/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/v2/TableV2.tsx","../../../src/v2/TableV2Types.ts","../../../src/v2/styles.ts"],"sourcesContent":["import React, { useId } from \"react\";\nimport { type TableV2Props } from \"./TableV2Types\";\nimport {\n StyledTableV2Container,\n StyledTableV2,\n StyledCaption,\n StyledTableHeader,\n StyledTableBody,\n StyledTableRow,\n StyledTableHeaderCell,\n StyledTableCell,\n} from \"./styles\";\n\nconst TableContainerContext = React.createContext<string | null>(null);\n\nexport const useTableContainerId = () =>\n React.useContext(TableContainerContext);\n\nexport const TableWrapper = ({\n children,\n ...rest\n}: {\n children: React.ReactElement;\n}) => {\n const containerId = useId();\n return (\n <TableContainerContext.Provider value={containerId}>\n <StyledTableV2Container\n role=\"region\"\n tabIndex={0}\n id={containerId}\n aria-labelledby={containerId}\n {...rest}\n >\n {children}\n </StyledTableV2Container>\n </TableContainerContext.Provider>\n );\n};\n\nconst TableV2 = ({\n caption,\n displayCaption = true,\n columns,\n data,\n}: TableV2Props) => {\n const containerId = useTableContainerId();\n\n return (\n <TableWrapper>\n <StyledTableV2>\n <StyledCaption id={containerId ?? undefined} isVisible={displayCaption}>\n {caption}\n </StyledCaption>\n <StyledTableHeader>\n <StyledTableRow>\n {columns.map((column, index) => (\n <StyledTableHeaderCell key={index} scope=\"col\">\n {column}\n </StyledTableHeaderCell>\n ))}\n </StyledTableRow>\n </StyledTableHeader>\n <StyledTableBody>\n {data.map((row, rowIndex) => (\n <StyledTableRow key={rowIndex}>\n {row.map((cell, cellIndex) => (\n <StyledTableCell key={cellIndex}>{cell}</StyledTableCell>\n ))}\n </StyledTableRow>\n ))}\n </StyledTableBody>\n </StyledTableV2>\n </TableWrapper>\n );\n};\n\n// Export the full Table component as Table (main export)\nexport const Table = TableV2;\n\n// Export styled components for compound component usage\nexport const TableRoot = StyledTableV2;\nexport const TableCaption = StyledCaption;\nexport const TableHeader = StyledTableHeader;\nexport const TableBody = StyledTableBody;\nexport const TableRow = StyledTableRow;\nexport const TableHeaderCell = StyledTableHeaderCell;\nexport const TableCell = StyledTableCell;\n\n// Default export\nexport default TableV2;\n","import * as React from \"react\";\n\nexport type ColumnHeader = string | React.ReactNode;\n\nexport type RowData = Array<string | React.ReactNode>;\n\nexport interface TableV2Props {\n caption: string;\n displayCaption?: boolean;\n columns: ColumnHeader[];\n data: RowData[];\n}\n","import styled, { css } from \"styled-components\";\nimport {\n COMMON,\n LAYOUT,\n TYPOGRAPHY,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport const StyledTableV2Container = styled.div`\n ${COMMON}\n ${LAYOUT}\n overflow-x: auto;\n max-width: 100%;\n`;\n\nexport const StyledTableV2 = styled.table`\n width: 100%;\n border-collapse: collapse;\n color: ${(props) => props.theme.colors.text.body};\n font-family: ${(props) => props.theme.fontFamily};\n`;\n\nStyledTableV2.displayName = \"TableV2.Table\";\n\nexport const StyledCaption = styled.caption<{ isVisible: boolean }>`\n ${TYPOGRAPHY}\n text-align: left;\n ${(props) => props.theme.typography[400]}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding: ${(props) => props.theme.space[300]};\n margin-top: ${(props) => props.theme.space[200]};\n ${({ isVisible }) =>\n !isVisible &&\n css`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n `}\n`;\n\nStyledCaption.displayName = \"TableV2.Caption\";\n\nexport const StyledTableHeader = styled.thead`\n vertical-align: bottom;\n border-bottom: 1px solid\n ${(props) => props.theme.colors.container.border.base};\n`;\n\nStyledTableHeader.displayName = \"TableV2.TableHeader\";\n\nexport const StyledTableBody = styled.tbody``;\n\nStyledTableBody.displayName = \"TableV2.TableBody\";\n\nexport const StyledTableRow = styled.tr`\n border-bottom: 1px solid\n ${(props) => props.theme.colors.container.border.base};\n`;\n\nStyledTableRow.displayName = \"TableV2.TableRow\";\n\nexport const StyledTableHeaderCell = styled.th`\n ${(props) => props.theme.typography[100]}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding: ${(props) => props.theme.space[300]};\n text-align: left;\n min-width: 0;\n`;\n\nStyledTableHeaderCell.displayName = \"TableV2.TableHeaderCell\";\n\nexport const StyledTableCell = styled.td`\n ${(props) => props.theme.typography[200]}\n font-weight: ${(props) => props.theme.fontWeights.normal};\n padding: ${(props) => props.theme.space[300]};\n text-align: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A,KACF,GACF;AAEJ;AAGO,IAAM,QAAQ;AAGd,IAAM,YAAY;AAClB,IAAM,eAAe;AACrB,IAAM,cAAc;AACpB,IAAM,YAAY;AAClB,IAAM,WAAW;AACjB,IAAM,kBAAkB;AACxB,IAAM,YAAY;AAGzB,IAAO,kBAAQ;","names":["React","React"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/v2/TableV2Hybrid.tsx","../../../src/v2/TableV2Types.ts","../../../src/v2/styles.ts","../../../src/v2/TableV2Tailwind.tsx"],"sourcesContent":["/**\n * Hybrid v2 Table components.\n *\n * Each exported sub-component renders the fast pure-CSS-class (Tailwind) path by\n * default and transparently falls back to the styled-components path via the\n * documented `needsStyledComponents` single gate — i.e. when a consumer passes\n * styled-system props (px, color, width, …) or extends the component with\n * `styled()` (detected through an injected `theme` prop or the generated\n * `sc-XXXX` className). This mirrors the established Button/Badge hybrid pattern\n * and preserves 100% backward compatibility with the existing styled-components\n * API.\n */\n\nimport React, { useId } from \"react\";\nimport { type TableV2Props } from \"./TableV2Types\";\nimport { needsStyledComponents } from \"@sproutsocial/seeds-react-system-props\";\nimport {\n StyledTableV2Container,\n StyledTableV2,\n StyledCaption,\n StyledTableHeader,\n StyledTableBody,\n StyledTableRow,\n StyledTableHeaderCell,\n StyledTableCell,\n} from \"./styles\";\nimport {\n TableV2ContainerTailwind,\n TableRootTailwind,\n CaptionTailwind,\n TableHeaderTailwind,\n TableBodyTailwind,\n TableRowTailwind,\n TableHeaderCellTailwind,\n TableCellTailwind,\n} from \"./TableV2Tailwind\";\n\ntype HybridProps = {\n className?: string;\n children?: React.ReactNode;\n [key: string]: any;\n};\n\nconst TableContainerContext = React.createContext<string | null>(null);\n\nexport const useTableContainerId = () =>\n React.useContext(TableContainerContext);\n\nexport const TableWrapper = React.forwardRef<\n HTMLDivElement,\n { children: React.ReactElement } & HybridProps\n>(({ children, className, ...rest }, ref) => {\n const containerId = useId();\n\n // Region semantics stay identical on both paths.\n const containerProps = {\n role: \"region\",\n tabIndex: 0,\n id: containerId,\n \"aria-labelledby\": containerId,\n };\n\n return (\n <TableContainerContext.Provider value={containerId}>\n {needsStyledComponents({ ...rest, className }) ? (\n <StyledTableV2Container\n className={className}\n ref={ref}\n {...containerProps}\n {...rest}\n >\n {children}\n </StyledTableV2Container>\n ) : (\n <TableV2ContainerTailwind\n className={className}\n ref={ref}\n {...containerProps}\n {...rest}\n >\n {children}\n </TableV2ContainerTailwind>\n )}\n </TableContainerContext.Provider>\n );\n});\n\nTableWrapper.displayName = \"TableV2.TableWrapper\";\n\nexport const TableRoot = React.forwardRef<HTMLTableElement, HybridProps>(\n ({ className, children, ...rest }, ref) => {\n if (needsStyledComponents({ ...rest, className })) {\n return (\n <StyledTableV2 className={className} ref={ref} {...rest}>\n {children}\n </StyledTableV2>\n );\n }\n return (\n <TableRootTailwind className={className} ref={ref} {...rest}>\n {children}\n </TableRootTailwind>\n );\n }\n);\n\nTableRoot.displayName = \"TableV2.Table\";\n\nexport const TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n HybridProps & { isVisible?: boolean }\n>(({ className, children, isVisible = true, ...rest }, ref) => {\n if (needsStyledComponents({ ...rest, className })) {\n return (\n <StyledCaption\n className={className}\n isVisible={isVisible}\n ref={ref}\n {...rest}\n >\n {children}\n </StyledCaption>\n );\n }\n return (\n <CaptionTailwind\n className={className}\n isVisible={isVisible}\n ref={ref}\n {...rest}\n >\n {children}\n </CaptionTailwind>\n );\n});\n\nTableCaption.displayName = \"TableV2.Caption\";\n\nexport const TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n HybridProps\n>(({ className, children, ...rest }, ref) => {\n if (needsStyledComponents({ ...rest, className })) {\n return (\n <StyledTableHeader className={className} ref={ref} {...rest}>\n {children}\n </StyledTableHeader>\n );\n }\n return (\n <TableHeaderTailwind className={className} ref={ref} {...rest}>\n {children}\n </TableHeaderTailwind>\n );\n});\n\nTableHeader.displayName = \"TableV2.TableHeader\";\n\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, HybridProps>(\n ({ className, children, ...rest }, ref) => {\n if (needsStyledComponents({ ...rest, className })) {\n return (\n <StyledTableBody className={className} ref={ref} {...rest}>\n {children}\n </StyledTableBody>\n );\n }\n return (\n <TableBodyTailwind className={className} ref={ref} {...rest}>\n {children}\n </TableBodyTailwind>\n );\n }\n);\n\nTableBody.displayName = \"TableV2.TableBody\";\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, HybridProps>(\n ({ className, children, ...rest }, ref) => {\n if (needsStyledComponents({ ...rest, className })) {\n return (\n <StyledTableRow className={className} ref={ref} {...rest}>\n {children}\n </StyledTableRow>\n );\n }\n return (\n <TableRowTailwind className={className} ref={ref} {...rest}>\n {children}\n </TableRowTailwind>\n );\n }\n);\n\nTableRow.displayName = \"TableV2.TableRow\";\n\nexport const TableHeaderCell = React.forwardRef<\n HTMLTableCellElement,\n HybridProps\n>(({ className, children, ...rest }, ref) => {\n if (needsStyledComponents({ ...rest, className })) {\n return (\n <StyledTableHeaderCell className={className} ref={ref} {...rest}>\n {children}\n </StyledTableHeaderCell>\n );\n }\n return (\n <TableHeaderCellTailwind className={className} ref={ref} {...rest}>\n {children}\n </TableHeaderCellTailwind>\n );\n});\n\nTableHeaderCell.displayName = \"TableV2.TableHeaderCell\";\n\nexport const TableCell = React.forwardRef<HTMLTableCellElement, HybridProps>(\n ({ className, children, ...rest }, ref) => {\n if (needsStyledComponents({ ...rest, className })) {\n return (\n <StyledTableCell className={className} ref={ref} {...rest}>\n {children}\n </StyledTableCell>\n );\n }\n return (\n <TableCellTailwind className={className} ref={ref} {...rest}>\n {children}\n </TableCellTailwind>\n );\n }\n);\n\nTableCell.displayName = \"TableV2.TableCell\";\n\nconst TableV2 = ({\n caption,\n displayCaption = true,\n columns,\n data,\n}: TableV2Props) => {\n const containerId = useTableContainerId();\n\n return (\n <TableWrapper>\n <TableRoot>\n <TableCaption id={containerId ?? undefined} isVisible={displayCaption}>\n {caption}\n </TableCaption>\n <TableHeader>\n <TableRow>\n {columns.map((column, index) => (\n <TableHeaderCell key={index} scope=\"col\">\n {column}\n </TableHeaderCell>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.map((row, rowIndex) => (\n <TableRow key={rowIndex}>\n {row.map((cell, cellIndex) => (\n <TableCell key={cellIndex}>{cell}</TableCell>\n ))}\n </TableRow>\n ))}\n </TableBody>\n </TableRoot>\n </TableWrapper>\n );\n};\n\n// Export the full Table component as Table (main export)\nexport const Table = TableV2;\n\n// Default export\nexport default TableV2;\n","import * as React from \"react\";\n\nexport type ColumnHeader = string | React.ReactNode;\n\nexport type RowData = Array<string | React.ReactNode>;\n\nexport interface TableV2Props {\n caption: string;\n displayCaption?: boolean;\n columns: ColumnHeader[];\n data: RowData[];\n}\n","import styled, { css } from \"styled-components\";\nimport {\n COMMON,\n LAYOUT,\n TYPOGRAPHY,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport const StyledTableV2Container = styled.div`\n ${COMMON}\n ${LAYOUT}\n overflow-x: auto;\n max-width: 100%;\n`;\n\nexport const StyledTableV2 = styled.table`\n width: 100%;\n border-collapse: collapse;\n color: ${(props) => props.theme.colors.text.body};\n font-family: ${(props) => props.theme.fontFamily};\n`;\n\nStyledTableV2.displayName = \"TableV2.Table\";\n\nexport const StyledCaption = styled.caption<{ isVisible: boolean }>`\n ${TYPOGRAPHY}\n text-align: left;\n ${(props) => props.theme.typography[400]}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding: ${(props) => props.theme.space[300]};\n margin-top: ${(props) => props.theme.space[200]};\n ${({ isVisible }) =>\n !isVisible &&\n css`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n `}\n`;\n\nStyledCaption.displayName = \"TableV2.Caption\";\n\nexport const StyledTableHeader = styled.thead`\n vertical-align: bottom;\n border-bottom: 1px solid\n ${(props) => props.theme.colors.container.border.base};\n`;\n\nStyledTableHeader.displayName = \"TableV2.TableHeader\";\n\nexport const StyledTableBody = styled.tbody``;\n\nStyledTableBody.displayName = \"TableV2.TableBody\";\n\nexport const StyledTableRow = styled.tr`\n border-bottom: 1px solid\n ${(props) => props.theme.colors.container.border.base};\n`;\n\nStyledTableRow.displayName = \"TableV2.TableRow\";\n\nexport const StyledTableHeaderCell = styled.th`\n ${(props) => props.theme.typography[100]}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding: ${(props) => props.theme.space[300]};\n text-align: left;\n min-width: 0;\n`;\n\nStyledTableHeaderCell.displayName = \"TableV2.TableHeaderCell\";\n\nexport const StyledTableCell = styled.td`\n ${(props) => props.theme.typography[200]}\n font-weight: ${(props) => props.theme.fontWeights.normal};\n padding: ${(props) => props.theme.space[300]};\n text-align: left;\n`;\n\nStyledTableCell.displayName = \"TableV2.TableCell\";\n","/**\n * Tailwind CSS implementation of the v2 Table sub-components.\n * Uses Seeds table CSS classes from table-v2.css.\n *\n * These are the pure semantic-HTML + CSS-class leaves the hybrid wrappers render\n * on the fast path. They forward `className` and `ref` so `styled(Component)`\n * extensions keep working, and pass standard HTML attributes (scope, id, role,\n * tabIndex, …) straight through to the DOM. Every leaf honors the polymorphic\n * `as` prop (rendering a dynamic element instead of a hard-coded tag) so\n * `<TableCell as=\"th\" scope=\"row\">` produces a real `<th scope=\"row\">` with the\n * `rowheader` role and `<TableRow as=\"div\">` renders a `<div>`, matching the\n * styled-components path. Because `as` is destructured out, it never leaks onto\n * the DOM node; a component-valued `as` (e.g. `styled(TableRow)`) re-enters the\n * hybrid, which then detects the styled signal and routes to styled-components.\n */\n\nimport React from \"react\";\n\n// Utility for merging class names properly\nfunction cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n\ntype TailwindProps = {\n className?: string;\n children?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const TableV2ContainerTailwind = React.forwardRef<\n HTMLDivElement,\n TailwindProps\n>(({ className, children, as: Component = \"div\", ...rest }, ref) => (\n <Component\n ref={ref}\n className={cn(\"seeds-table-v2-container\", className)}\n {...rest}\n >\n {children}\n </Component>\n));\n\nTableV2ContainerTailwind.displayName = \"TableV2.ContainerTailwind\";\n\nexport const TableRootTailwind = React.forwardRef<\n HTMLTableElement,\n TailwindProps\n>(({ className, children, as: Component = \"table\", ...rest }, ref) => (\n <Component ref={ref} className={cn(\"seeds-table-v2\", className)} {...rest}>\n {children}\n </Component>\n));\n\nTableRootTailwind.displayName = \"TableV2.TableTailwind\";\n\nexport const CaptionTailwind = React.forwardRef<\n HTMLTableCaptionElement,\n TailwindProps & { isVisible?: boolean }\n>(\n (\n {\n className,\n children,\n isVisible = true,\n as: Component = \"caption\",\n ...rest\n },\n ref\n ) => (\n <Component\n ref={ref}\n className={cn(\n \"seeds-table-v2-caption\",\n { \"seeds-table-v2-caption-hidden\": !isVisible },\n className\n )}\n {...rest}\n >\n {children}\n </Component>\n )\n);\n\nCaptionTailwind.displayName = \"TableV2.CaptionTailwind\";\n\nexport const TableHeaderTailwind = React.forwardRef<\n HTMLTableSectionElement,\n TailwindProps\n>(({ className, children, as: Component = \"thead\", ...rest }, ref) => (\n <Component\n ref={ref}\n className={cn(\"seeds-table-v2-header\", className)}\n {...rest}\n >\n {children}\n </Component>\n));\n\nTableHeaderTailwind.displayName = \"TableV2.TableHeaderTailwind\";\n\nexport const TableBodyTailwind = React.forwardRef<\n HTMLTableSectionElement,\n TailwindProps\n>(({ className, children, as: Component = \"tbody\", ...rest }, ref) => (\n <Component\n ref={ref}\n className={cn(\"seeds-table-v2-body\", className)}\n {...rest}\n >\n {children}\n </Component>\n));\n\nTableBodyTailwind.displayName = \"TableV2.TableBodyTailwind\";\n\nexport const TableRowTailwind = React.forwardRef<\n HTMLTableRowElement,\n TailwindProps\n>(({ className, children, as: Component = \"tr\", ...rest }, ref) => (\n <Component\n ref={ref}\n className={cn(\"seeds-table-v2-row\", className)}\n {...rest}\n >\n {children}\n </Component>\n));\n\nTableRowTailwind.displayName = \"TableV2.TableRowTailwind\";\n\nexport const TableHeaderCellTailwind = React.forwardRef<\n HTMLTableCellElement,\n TailwindProps\n>(({ className, children, as: Component = \"th\", ...rest }, ref) => (\n <Component\n ref={ref}\n className={cn(\"seeds-table-v2-header-cell\", className)}\n {...rest}\n >\n {children}\n </Component>\n));\n\nTableHeaderCellTailwind.displayName = \"TableV2.TableHeaderCellTailwind\";\n\nexport const TableCellTailwind = React.forwardRef<\n HTMLTableCellElement,\n TailwindProps\n>(({ className, children, as: Component = \"td\", ...rest }, ref) => (\n <Component\n ref={ref}\n className={cn(\"seeds-table-v2-cell\", className)}\n {...rest}\n >\n {children}\n </Component>\n));\n\nTableCellTailwind.displayName = \"TableV2.TableCellTailwind\";\n"],"mappings":";AAaA,OAAOA,UAAS,aAAa;;;ACb7B,OAAuB;;;ADevB,SAAS,6BAA6B;;;AEftC,OAAO,UAAU,WAAW;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,IAAM,yBAAyB,OAAO;AAAA,IACzC,MAAM;AAAA,IACN,MAAM;AAAA;AAAA;AAAA;AAKH,IAAM,gBAAgB,OAAO;AAAA;AAAA;AAAA,WAGzB,CAAC,UAAU,MAAM,MAAM,OAAO,KAAK,IAAI;AAAA,iBACjC,CAAC,UAAU,MAAM,MAAM,UAAU;AAAA;AAGlD,cAAc,cAAc;AAErB,IAAM,gBAAgB,OAAO;AAAA,IAChC,UAAU;AAAA;AAAA,IAEV,CAAC,UAAU,MAAM,MAAM,WAAW,GAAG,CAAC;AAAA,iBACzB,CAAC,UAAU,MAAM,MAAM,YAAY,QAAQ;AAAA,aAC/C,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,gBAC9B,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AC,mBAAgB,WAAsB,KAAW,GAAG,MAClD,UACH;AAAA,IAEJ;AACA,WACE,gBAAAA,KAAC,qBAAkB,WAAsB,KAAW,GAAG,MACpD,UACH;AAAA,EAEJ;AACF;AAEA,UAAU,cAAc;AAExB,IAAM,UAAU,CAAC;AAAA,EACf;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA;AACF,MAAoB;AAClB,QAAM,cAAc,oBAAoB;AAExC,SACE,gBAAAA,KAAC,gBACC,+BAAC,aACC;AAAA,oBAAAA,KAAC,gBAAa,IAAI,eAAe,QAAW,WAAW,gBACpD,mBACH;AAAA,IACA,gBAAAA,KAAC,eACC,0BAAAA,KAAC,YACE,kBAAQ,IAAI,CAAC,QAAQ,UACpB,gBAAAA,KAAC,mBAA4B,OAAM,OAChC,oBADmB,KAEtB,CACD,GACH,GACF;AAAA,IACA,gBAAAA,KAAC,aACE,eAAK,IAAI,CAAC,KAAK,aACd,gBAAAA,KAAC,YACE,cAAI,IAAI,CAAC,MAAM,cACd,gBAAAA,KAAC,aAA2B,kBAAZ,SAAiB,CAClC,KAHY,QAIf,CACD,GACH;AAAA,KACF,GACF;AAEJ;AAGO,IAAM,QAAQ;AAGrB,IAAO,wBAAQ;","names":["React","React","jsx","React"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds v2 Table component classes
|
|
3
|
+
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
|
+
*
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
|
|
6
|
+
* CSS variable definitions and dark mode support.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* <div class="seeds-table-v2-container" role="region" tabindex="0">
|
|
10
|
+
* <table class="seeds-table-v2">
|
|
11
|
+
* <caption class="seeds-table-v2-caption">Caption</caption>
|
|
12
|
+
* <thead class="seeds-table-v2-header">
|
|
13
|
+
* <tr class="seeds-table-v2-row">
|
|
14
|
+
* <th class="seeds-table-v2-header-cell" scope="col">Header</th>
|
|
15
|
+
* </tr>
|
|
16
|
+
* </thead>
|
|
17
|
+
* <tbody class="seeds-table-v2-body">
|
|
18
|
+
* <tr class="seeds-table-v2-row">
|
|
19
|
+
* <td class="seeds-table-v2-cell">Data</td>
|
|
20
|
+
* </tr>
|
|
21
|
+
* </tbody>
|
|
22
|
+
* </table>
|
|
23
|
+
* </div>
|
|
24
|
+
*
|
|
25
|
+
* All rules are wrapped in `@layer components` so that consumer Tailwind
|
|
26
|
+
* utilities (unlayered) win the cascade over these styles.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
@layer components {
|
|
30
|
+
.seeds-table-v2-container {
|
|
31
|
+
overflow-x: auto;
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.seeds-table-v2 {
|
|
36
|
+
width: 100%;
|
|
37
|
+
border-collapse: collapse;
|
|
38
|
+
color: var(--color-text-body);
|
|
39
|
+
font-family: var(--font-family);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.seeds-table-v2-caption {
|
|
43
|
+
text-align: left;
|
|
44
|
+
font-size: var(--font-size-400);
|
|
45
|
+
line-height: var(--line-height-400);
|
|
46
|
+
font-weight: var(--font-weight-semibold);
|
|
47
|
+
padding: var(--space-300);
|
|
48
|
+
margin-top: var(--space-200);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.seeds-table-v2-caption-hidden {
|
|
52
|
+
position: absolute;
|
|
53
|
+
width: 1px;
|
|
54
|
+
height: 1px;
|
|
55
|
+
padding: 0;
|
|
56
|
+
margin: -1px;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
clip: rect(0, 0, 0, 0);
|
|
59
|
+
border: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.seeds-table-v2-header {
|
|
63
|
+
vertical-align: bottom;
|
|
64
|
+
border-bottom: 1px solid var(--color-container-border-base);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.seeds-table-v2-row {
|
|
68
|
+
border-bottom: 1px solid var(--color-container-border-base);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.seeds-table-v2-header-cell {
|
|
72
|
+
font-size: var(--font-size-100);
|
|
73
|
+
line-height: var(--line-height-100);
|
|
74
|
+
font-weight: var(--font-weight-semibold);
|
|
75
|
+
padding: var(--space-300);
|
|
76
|
+
text-align: left;
|
|
77
|
+
min-width: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.seeds-table-v2-cell {
|
|
81
|
+
font-size: var(--font-size-200);
|
|
82
|
+
line-height: var(--line-height-200);
|
|
83
|
+
font-weight: var(--font-weight-normal);
|
|
84
|
+
padding: var(--space-300);
|
|
85
|
+
text-align: left;
|
|
86
|
+
}
|
|
87
|
+
}
|
package/dist/v2/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as styled_components from 'styled-components';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import React__default from 'react';
|
|
4
|
+
import * as styled_components from 'styled-components';
|
|
5
5
|
|
|
6
6
|
type ColumnHeader = string | React.ReactNode;
|
|
7
7
|
type RowData = Array<string | React.ReactNode>;
|
|
@@ -12,21 +12,26 @@ interface TableV2Props {
|
|
|
12
12
|
data: RowData[];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
type HybridProps = {
|
|
16
|
+
className?: string;
|
|
17
|
+
children?: React__default.ReactNode;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
15
20
|
declare const useTableContainerId: () => string | null;
|
|
16
|
-
declare const TableWrapper:
|
|
21
|
+
declare const TableWrapper: React__default.ForwardRefExoticComponent<Omit<{
|
|
17
22
|
children: React__default.ReactElement;
|
|
18
|
-
}
|
|
23
|
+
} & HybridProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const TableRoot: React__default.ForwardRefExoticComponent<Omit<HybridProps, "ref"> & React__default.RefAttributes<HTMLTableElement>>;
|
|
25
|
+
declare const TableCaption: React__default.ForwardRefExoticComponent<Omit<HybridProps & {
|
|
26
|
+
isVisible?: boolean;
|
|
27
|
+
}, "ref"> & React__default.RefAttributes<HTMLTableCaptionElement>>;
|
|
28
|
+
declare const TableHeader: React__default.ForwardRefExoticComponent<Omit<HybridProps, "ref"> & React__default.RefAttributes<HTMLTableSectionElement>>;
|
|
29
|
+
declare const TableBody: React__default.ForwardRefExoticComponent<Omit<HybridProps, "ref"> & React__default.RefAttributes<HTMLTableSectionElement>>;
|
|
30
|
+
declare const TableRow: React__default.ForwardRefExoticComponent<Omit<HybridProps, "ref"> & React__default.RefAttributes<HTMLTableRowElement>>;
|
|
31
|
+
declare const TableHeaderCell: React__default.ForwardRefExoticComponent<Omit<HybridProps, "ref"> & React__default.RefAttributes<HTMLTableCellElement>>;
|
|
32
|
+
declare const TableCell: React__default.ForwardRefExoticComponent<Omit<HybridProps, "ref"> & React__default.RefAttributes<HTMLTableCellElement>>;
|
|
19
33
|
declare const TableV2: ({ caption, displayCaption, columns, data, }: TableV2Props) => react_jsx_runtime.JSX.Element;
|
|
20
34
|
declare const Table: ({ caption, displayCaption, columns, data, }: TableV2Props) => react_jsx_runtime.JSX.Element;
|
|
21
|
-
declare const TableRoot: styled_components.StyledComponent<"table", any, {}, never>;
|
|
22
|
-
declare const TableCaption: styled_components.StyledComponent<"caption", any, {
|
|
23
|
-
isVisible: boolean;
|
|
24
|
-
}, never>;
|
|
25
|
-
declare const TableHeader: styled_components.StyledComponent<"thead", any, {}, never>;
|
|
26
|
-
declare const TableBody: styled_components.StyledComponent<"tbody", any, {}, never>;
|
|
27
|
-
declare const TableRow: styled_components.StyledComponent<"tr", any, {}, never>;
|
|
28
|
-
declare const TableHeaderCell: styled_components.StyledComponent<"th", any, {}, never>;
|
|
29
|
-
declare const TableCell: styled_components.StyledComponent<"td", any, {}, never>;
|
|
30
35
|
|
|
31
36
|
declare const StyledTableV2Container: styled_components.StyledComponent<"div", any, {}, never>;
|
|
32
37
|
declare const StyledTableV2: styled_components.StyledComponent<"table", any, {}, never>;
|