@sproutsocial/seeds-react-table 1.0.50 → 1.0.51
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 +32 -32
- package/CHANGELOG.md +8 -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 +5 -4
- 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/dist/v2/index.d.ts
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>;
|
package/dist/v2/index.js
CHANGED
|
@@ -46,18 +46,21 @@ __export(v2_exports, {
|
|
|
46
46
|
TableHeaderCell: () => TableHeaderCell,
|
|
47
47
|
TableRoot: () => TableRoot,
|
|
48
48
|
TableRow: () => TableRow,
|
|
49
|
-
TableV2: () =>
|
|
49
|
+
TableV2: () => TableV2Hybrid_default,
|
|
50
50
|
TableWrapper: () => TableWrapper,
|
|
51
51
|
useTableContainerId: () => useTableContainerId
|
|
52
52
|
});
|
|
53
53
|
module.exports = __toCommonJS(v2_exports);
|
|
54
54
|
|
|
55
|
-
// src/v2/
|
|
56
|
-
var
|
|
55
|
+
// src/v2/TableV2Hybrid.tsx
|
|
56
|
+
var import_react2 = __toESM(require("react"));
|
|
57
57
|
|
|
58
58
|
// src/v2/TableV2Types.ts
|
|
59
59
|
var React = require("react");
|
|
60
60
|
|
|
61
|
+
// src/v2/TableV2Hybrid.tsx
|
|
62
|
+
var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
|
|
63
|
+
|
|
61
64
|
// src/v2/styles.ts
|
|
62
65
|
var import_styled_components = __toESM(require("styled-components"));
|
|
63
66
|
var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
|
|
@@ -122,27 +125,218 @@ var StyledTableCell = import_styled_components.default.td`
|
|
|
122
125
|
`;
|
|
123
126
|
StyledTableCell.displayName = "TableV2.TableCell";
|
|
124
127
|
|
|
125
|
-
// src/v2/
|
|
128
|
+
// src/v2/TableV2Tailwind.tsx
|
|
129
|
+
var import_react = __toESM(require("react"));
|
|
126
130
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
function cn(...inputs) {
|
|
132
|
+
const classes = [];
|
|
133
|
+
for (const input of inputs) {
|
|
134
|
+
if (!input) continue;
|
|
135
|
+
if (typeof input === "string") {
|
|
136
|
+
classes.push(input);
|
|
137
|
+
} else if (typeof input === "object") {
|
|
138
|
+
for (const [key, value] of Object.entries(input)) {
|
|
139
|
+
if (value) {
|
|
140
|
+
classes.push(key);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return classes.join(" ");
|
|
146
|
+
}
|
|
147
|
+
var TableV2ContainerTailwind = import_react.default.forwardRef(({ className, children, as: Component = "div", ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
148
|
+
Component,
|
|
149
|
+
{
|
|
150
|
+
ref,
|
|
151
|
+
className: cn("seeds-table-v2-container", className),
|
|
152
|
+
...rest,
|
|
153
|
+
children
|
|
154
|
+
}
|
|
155
|
+
));
|
|
156
|
+
TableV2ContainerTailwind.displayName = "TableV2.ContainerTailwind";
|
|
157
|
+
var TableRootTailwind = import_react.default.forwardRef(({ className, children, as: Component = "table", ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref, className: cn("seeds-table-v2", className), ...rest, children }));
|
|
158
|
+
TableRootTailwind.displayName = "TableV2.TableTailwind";
|
|
159
|
+
var CaptionTailwind = import_react.default.forwardRef(
|
|
160
|
+
({
|
|
161
|
+
className,
|
|
162
|
+
children,
|
|
163
|
+
isVisible = true,
|
|
164
|
+
as: Component = "caption",
|
|
165
|
+
...rest
|
|
166
|
+
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
167
|
+
Component,
|
|
168
|
+
{
|
|
169
|
+
ref,
|
|
170
|
+
className: cn(
|
|
171
|
+
"seeds-table-v2-caption",
|
|
172
|
+
{ "seeds-table-v2-caption-hidden": !isVisible },
|
|
173
|
+
className
|
|
174
|
+
),
|
|
175
|
+
...rest,
|
|
176
|
+
children
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
);
|
|
180
|
+
CaptionTailwind.displayName = "TableV2.CaptionTailwind";
|
|
181
|
+
var TableHeaderTailwind = import_react.default.forwardRef(({ className, children, as: Component = "thead", ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
182
|
+
Component,
|
|
183
|
+
{
|
|
184
|
+
ref,
|
|
185
|
+
className: cn("seeds-table-v2-header", className),
|
|
186
|
+
...rest,
|
|
187
|
+
children
|
|
188
|
+
}
|
|
189
|
+
));
|
|
190
|
+
TableHeaderTailwind.displayName = "TableV2.TableHeaderTailwind";
|
|
191
|
+
var TableBodyTailwind = import_react.default.forwardRef(({ className, children, as: Component = "tbody", ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
192
|
+
Component,
|
|
193
|
+
{
|
|
194
|
+
ref,
|
|
195
|
+
className: cn("seeds-table-v2-body", className),
|
|
196
|
+
...rest,
|
|
197
|
+
children
|
|
198
|
+
}
|
|
199
|
+
));
|
|
200
|
+
TableBodyTailwind.displayName = "TableV2.TableBodyTailwind";
|
|
201
|
+
var TableRowTailwind = import_react.default.forwardRef(({ className, children, as: Component = "tr", ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
202
|
+
Component,
|
|
203
|
+
{
|
|
204
|
+
ref,
|
|
205
|
+
className: cn("seeds-table-v2-row", className),
|
|
206
|
+
...rest,
|
|
207
|
+
children
|
|
208
|
+
}
|
|
209
|
+
));
|
|
210
|
+
TableRowTailwind.displayName = "TableV2.TableRowTailwind";
|
|
211
|
+
var TableHeaderCellTailwind = import_react.default.forwardRef(({ className, children, as: Component = "th", ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
212
|
+
Component,
|
|
213
|
+
{
|
|
214
|
+
ref,
|
|
215
|
+
className: cn("seeds-table-v2-header-cell", className),
|
|
216
|
+
...rest,
|
|
217
|
+
children
|
|
218
|
+
}
|
|
219
|
+
));
|
|
220
|
+
TableHeaderCellTailwind.displayName = "TableV2.TableHeaderCellTailwind";
|
|
221
|
+
var TableCellTailwind = import_react.default.forwardRef(({ className, children, as: Component = "td", ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
222
|
+
Component,
|
|
223
|
+
{
|
|
224
|
+
ref,
|
|
225
|
+
className: cn("seeds-table-v2-cell", className),
|
|
226
|
+
...rest,
|
|
227
|
+
children
|
|
228
|
+
}
|
|
229
|
+
));
|
|
230
|
+
TableCellTailwind.displayName = "TableV2.TableCellTailwind";
|
|
231
|
+
|
|
232
|
+
// src/v2/TableV2Hybrid.tsx
|
|
233
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
234
|
+
var TableContainerContext = import_react2.default.createContext(null);
|
|
235
|
+
var useTableContainerId = () => import_react2.default.useContext(TableContainerContext);
|
|
236
|
+
var TableWrapper = import_react2.default.forwardRef(({ children, className, ...rest }, ref) => {
|
|
237
|
+
const containerId = (0, import_react2.useId)();
|
|
238
|
+
const containerProps = {
|
|
239
|
+
role: "region",
|
|
240
|
+
tabIndex: 0,
|
|
241
|
+
id: containerId,
|
|
242
|
+
"aria-labelledby": containerId
|
|
243
|
+
};
|
|
244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableContainerContext.Provider, { value: containerId, children: (0, import_seeds_react_system_props2.needsStyledComponents)({ ...rest, className }) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
135
245
|
StyledTableV2Container,
|
|
136
246
|
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
247
|
+
className,
|
|
248
|
+
ref,
|
|
249
|
+
...containerProps,
|
|
250
|
+
...rest,
|
|
251
|
+
children
|
|
252
|
+
}
|
|
253
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
254
|
+
TableV2ContainerTailwind,
|
|
255
|
+
{
|
|
256
|
+
className,
|
|
257
|
+
ref,
|
|
258
|
+
...containerProps,
|
|
141
259
|
...rest,
|
|
142
260
|
children
|
|
143
261
|
}
|
|
144
262
|
) });
|
|
145
|
-
};
|
|
263
|
+
});
|
|
264
|
+
TableWrapper.displayName = "TableV2.TableWrapper";
|
|
265
|
+
var TableRoot = import_react2.default.forwardRef(
|
|
266
|
+
({ className, children, ...rest }, ref) => {
|
|
267
|
+
if ((0, import_seeds_react_system_props2.needsStyledComponents)({ ...rest, className })) {
|
|
268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StyledTableV2, { className, ref, ...rest, children });
|
|
269
|
+
}
|
|
270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableRootTailwind, { className, ref, ...rest, children });
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
TableRoot.displayName = "TableV2.Table";
|
|
274
|
+
var TableCaption = import_react2.default.forwardRef(({ className, children, isVisible = true, ...rest }, ref) => {
|
|
275
|
+
if ((0, import_seeds_react_system_props2.needsStyledComponents)({ ...rest, className })) {
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
277
|
+
StyledCaption,
|
|
278
|
+
{
|
|
279
|
+
className,
|
|
280
|
+
isVisible,
|
|
281
|
+
ref,
|
|
282
|
+
...rest,
|
|
283
|
+
children
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
288
|
+
CaptionTailwind,
|
|
289
|
+
{
|
|
290
|
+
className,
|
|
291
|
+
isVisible,
|
|
292
|
+
ref,
|
|
293
|
+
...rest,
|
|
294
|
+
children
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
});
|
|
298
|
+
TableCaption.displayName = "TableV2.Caption";
|
|
299
|
+
var TableHeader = import_react2.default.forwardRef(({ className, children, ...rest }, ref) => {
|
|
300
|
+
if ((0, import_seeds_react_system_props2.needsStyledComponents)({ ...rest, className })) {
|
|
301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StyledTableHeader, { className, ref, ...rest, children });
|
|
302
|
+
}
|
|
303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableHeaderTailwind, { className, ref, ...rest, children });
|
|
304
|
+
});
|
|
305
|
+
TableHeader.displayName = "TableV2.TableHeader";
|
|
306
|
+
var TableBody = import_react2.default.forwardRef(
|
|
307
|
+
({ className, children, ...rest }, ref) => {
|
|
308
|
+
if ((0, import_seeds_react_system_props2.needsStyledComponents)({ ...rest, className })) {
|
|
309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StyledTableBody, { className, ref, ...rest, children });
|
|
310
|
+
}
|
|
311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableBodyTailwind, { className, ref, ...rest, children });
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
TableBody.displayName = "TableV2.TableBody";
|
|
315
|
+
var TableRow = import_react2.default.forwardRef(
|
|
316
|
+
({ className, children, ...rest }, ref) => {
|
|
317
|
+
if ((0, import_seeds_react_system_props2.needsStyledComponents)({ ...rest, className })) {
|
|
318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StyledTableRow, { className, ref, ...rest, children });
|
|
319
|
+
}
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableRowTailwind, { className, ref, ...rest, children });
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
TableRow.displayName = "TableV2.TableRow";
|
|
324
|
+
var TableHeaderCell = import_react2.default.forwardRef(({ className, children, ...rest }, ref) => {
|
|
325
|
+
if ((0, import_seeds_react_system_props2.needsStyledComponents)({ ...rest, className })) {
|
|
326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StyledTableHeaderCell, { className, ref, ...rest, children });
|
|
327
|
+
}
|
|
328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableHeaderCellTailwind, { className, ref, ...rest, children });
|
|
329
|
+
});
|
|
330
|
+
TableHeaderCell.displayName = "TableV2.TableHeaderCell";
|
|
331
|
+
var TableCell = import_react2.default.forwardRef(
|
|
332
|
+
({ className, children, ...rest }, ref) => {
|
|
333
|
+
if ((0, import_seeds_react_system_props2.needsStyledComponents)({ ...rest, className })) {
|
|
334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StyledTableCell, { className, ref, ...rest, children });
|
|
335
|
+
}
|
|
336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableCellTailwind, { className, ref, ...rest, children });
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
TableCell.displayName = "TableV2.TableCell";
|
|
146
340
|
var TableV2 = ({
|
|
147
341
|
caption,
|
|
148
342
|
displayCaption = true,
|
|
@@ -150,21 +344,14 @@ var TableV2 = ({
|
|
|
150
344
|
data
|
|
151
345
|
}) => {
|
|
152
346
|
const containerId = useTableContainerId();
|
|
153
|
-
return /* @__PURE__ */ (0,
|
|
154
|
-
/* @__PURE__ */ (0,
|
|
155
|
-
/* @__PURE__ */ (0,
|
|
156
|
-
/* @__PURE__ */ (0,
|
|
347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(TableRoot, { children: [
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableCaption, { id: containerId ?? void 0, isVisible: displayCaption, children: caption }),
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableRow, { children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableHeaderCell, { scope: "col", children: column }, index)) }) }),
|
|
350
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableBody, { children: data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableRow, { children: row.map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableCell, { children: cell }, cellIndex)) }, rowIndex)) })
|
|
157
351
|
] }) });
|
|
158
352
|
};
|
|
159
353
|
var Table = TableV2;
|
|
160
|
-
var
|
|
161
|
-
var TableCaption = StyledCaption;
|
|
162
|
-
var TableHeader = StyledTableHeader;
|
|
163
|
-
var TableBody = StyledTableBody;
|
|
164
|
-
var TableRow = StyledTableRow;
|
|
165
|
-
var TableHeaderCell = StyledTableHeaderCell;
|
|
166
|
-
var TableCell = StyledTableCell;
|
|
167
|
-
var TableV2_default = TableV2;
|
|
354
|
+
var TableV2Hybrid_default = TableV2;
|
|
168
355
|
// Annotate the CommonJS export names for ESM import in node:
|
|
169
356
|
0 && (module.exports = {
|
|
170
357
|
StyledCaption,
|
package/dist/v2/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/v2/index.ts","../../src/v2/TableV2.tsx","../../src/v2/TableV2Types.ts","../../src/v2/styles.ts"],"sourcesContent":["// V2 Table - Explicit flat exports for optimal tree shaking\nexport {\n Table,\n TableRoot,\n TableWrapper,\n TableCaption,\n TableHeader,\n TableBody,\n TableRow,\n TableHeaderCell,\n TableCell,\n useTableContainerId,\n default as TableV2,\n} from \"./TableV2\";\n\n// Explicit type exports\nexport type { TableV2Props, ColumnHeader, RowData } from \"./TableV2Types\";\n\n// Explicit style exports\nexport * from \"./styles\";\n","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: left;\n`;\n\nStyledTableCell.displayName = \"TableV2.TableCell\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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;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":["styled","React"]}
|
|
1
|
+
{"version":3,"sources":["../../src/v2/index.ts","../../src/v2/TableV2Hybrid.tsx","../../src/v2/TableV2Types.ts","../../src/v2/styles.ts","../../src/v2/TableV2Tailwind.tsx"],"sourcesContent":["// V2 Table - Explicit flat exports for optimal tree shaking\nexport {\n Table,\n TableRoot,\n TableWrapper,\n TableCaption,\n TableHeader,\n TableBody,\n TableRow,\n TableHeaderCell,\n TableCell,\n useTableContainerId,\n default as TableV2,\n} from \"./TableV2\";\n\n// Explicit type exports\nexport type { TableV2Props, ColumnHeader, RowData } from \"./TableV2Types\";\n\n// Explicit style exports\nexport * from \"./styles\";\n","/**\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,IAAAA,gBAA6B;;;ACb7B,YAAuB;;;ADevB,IAAAC,mCAAsC;;;AEftC,+BAA4B;AAC5B,sCAIO;AAEA,IAAM,yBAAyB,yBAAAC,QAAO;AAAA,IACzC,sCAAM;AAAA,IACN,sCAAM;AAAA;AAAA;AAAA;AAKH,IAAM,gBAAgB,yBA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KAAK,GAAG,QAAQ;AAC3C,UAAI,wDAAsB,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG;AACjD,WACE,6CAAC,yBAAsB,WAAsB,KAAW,GAAG,MACxD,UACH;AAAA,EAEJ;AACA,SACE,6CAAC,2BAAwB,WAAsB,KAAW,GAAG,MAC1D,UACH;AAEJ,CAAC;AAED,gBAAgB,cAAc;AAEvB,IAAM,YAAY,cAAAA,QAAM;AAAA,EAC7B,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AACzC,YAAI,wDAAsB,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG;AACjD,aACE,6CAAC,mBAAgB,WAAsB,KAAW,GAAG,MAClD,UACH;AAAA,IAEJ;AACA,WACE,6CAAC,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,6CAAC,gBACC,wDAAC,aACC;AAAA,iDAAC,gBAAa,IAAI,eAAe,QAAW,WAAW,gBACpD,mBACH;AAAA,IACA,6CAAC,eACC,uDAAC,YACE,kBAAQ,IAAI,CAAC,QAAQ,UACpB,6CAAC,mBAA4B,OAAM,OAChC,oBADmB,KAEtB,CACD,GACH,GACF;AAAA,IACA,6CAAC,aACE,eAAK,IAAI,CAAC,KAAK,aACd,6CAAC,YACE,cAAI,IAAI,CAAC,MAAM,cACd,6CAAC,aAA2B,kBAAZ,SAAiB,CAClC,KAHY,QAIf,CACD,GACH;AAAA,KACF,GACF;AAEJ;AAGO,IAAM,QAAQ;AAGrB,IAAO,wBAAQ;","names":["import_react","import_seeds_react_system_props","styled","React","import_jsx_runtime","React"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-table",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.51",
|
|
4
4
|
"description": "Seeds React Table",
|
|
5
5
|
"author": "Sprout Social, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,11 +37,12 @@
|
|
|
37
37
|
"types": "./dist/v1/TableRowAccordion/index.d.ts",
|
|
38
38
|
"import": "./dist/esm/v1/TableRowAccordion/index.js",
|
|
39
39
|
"require": "./dist/v1/TableRowAccordion/index.js"
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
|
+
"./dist/table-v2.css": "./dist/table-v2.css"
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
43
|
-
"build": "tsup --dts",
|
|
44
|
-
"build:debug": "tsup --dts --metafile",
|
|
44
|
+
"build": "tsup --dts && cp src/table-v2.css dist/table-v2.css",
|
|
45
|
+
"build:debug": "tsup --dts --metafile && cp src/table-v2.css dist/table-v2.css",
|
|
45
46
|
"dev": "tsup --watch --dts",
|
|
46
47
|
"clean": "rm -rf .turbo dist",
|
|
47
48
|
"clean:modules": "rm -rf node_modules",
|
package/src/table-v2.css
ADDED
|
@@ -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/src/v2/TableV2.tsx
CHANGED
|
@@ -1,91 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export const TableWrapper = ({
|
|
20
|
-
children,
|
|
21
|
-
...rest
|
|
22
|
-
}: {
|
|
23
|
-
children: React.ReactElement;
|
|
24
|
-
}) => {
|
|
25
|
-
const containerId = useId();
|
|
26
|
-
return (
|
|
27
|
-
<TableContainerContext.Provider value={containerId}>
|
|
28
|
-
<StyledTableV2Container
|
|
29
|
-
role="region"
|
|
30
|
-
tabIndex={0}
|
|
31
|
-
id={containerId}
|
|
32
|
-
aria-labelledby={containerId}
|
|
33
|
-
{...rest}
|
|
34
|
-
>
|
|
35
|
-
{children}
|
|
36
|
-
</StyledTableV2Container>
|
|
37
|
-
</TableContainerContext.Provider>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const TableV2 = ({
|
|
42
|
-
caption,
|
|
43
|
-
displayCaption = true,
|
|
44
|
-
columns,
|
|
45
|
-
data,
|
|
46
|
-
}: TableV2Props) => {
|
|
47
|
-
const containerId = useTableContainerId();
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<TableWrapper>
|
|
51
|
-
<StyledTableV2>
|
|
52
|
-
<StyledCaption id={containerId ?? undefined} isVisible={displayCaption}>
|
|
53
|
-
{caption}
|
|
54
|
-
</StyledCaption>
|
|
55
|
-
<StyledTableHeader>
|
|
56
|
-
<StyledTableRow>
|
|
57
|
-
{columns.map((column, index) => (
|
|
58
|
-
<StyledTableHeaderCell key={index} scope="col">
|
|
59
|
-
{column}
|
|
60
|
-
</StyledTableHeaderCell>
|
|
61
|
-
))}
|
|
62
|
-
</StyledTableRow>
|
|
63
|
-
</StyledTableHeader>
|
|
64
|
-
<StyledTableBody>
|
|
65
|
-
{data.map((row, rowIndex) => (
|
|
66
|
-
<StyledTableRow key={rowIndex}>
|
|
67
|
-
{row.map((cell, cellIndex) => (
|
|
68
|
-
<StyledTableCell key={cellIndex}>{cell}</StyledTableCell>
|
|
69
|
-
))}
|
|
70
|
-
</StyledTableRow>
|
|
71
|
-
))}
|
|
72
|
-
</StyledTableBody>
|
|
73
|
-
</StyledTableV2>
|
|
74
|
-
</TableWrapper>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// Export the full Table component as Table (main export)
|
|
79
|
-
export const Table = TableV2;
|
|
80
|
-
|
|
81
|
-
// Export styled components for compound component usage
|
|
82
|
-
export const TableRoot = StyledTableV2;
|
|
83
|
-
export const TableCaption = StyledCaption;
|
|
84
|
-
export const TableHeader = StyledTableHeader;
|
|
85
|
-
export const TableBody = StyledTableBody;
|
|
86
|
-
export const TableRow = StyledTableRow;
|
|
87
|
-
export const TableHeaderCell = StyledTableHeaderCell;
|
|
88
|
-
export const TableCell = StyledTableCell;
|
|
89
|
-
|
|
90
|
-
// Default export
|
|
91
|
-
export default TableV2;
|
|
1
|
+
// Public v2 Table surface. Every exported name keeps its identity but now points
|
|
2
|
+
// at a hybrid wrapper that renders the Tailwind (CSS-class) path by default and
|
|
3
|
+
// falls back to styled-components when styled-system props are present.
|
|
4
|
+
// The styled-components entities remain available via `export * from "./styles"`.
|
|
5
|
+
export {
|
|
6
|
+
Table,
|
|
7
|
+
TableWrapper,
|
|
8
|
+
TableRoot,
|
|
9
|
+
TableCaption,
|
|
10
|
+
TableHeader,
|
|
11
|
+
TableBody,
|
|
12
|
+
TableRow,
|
|
13
|
+
TableHeaderCell,
|
|
14
|
+
TableCell,
|
|
15
|
+
useTableContainerId,
|
|
16
|
+
default,
|
|
17
|
+
} from "./TableV2Hybrid";
|