@syscore/ui-library 2.0.0-beta-publish-workflow-beta.2 → 2.0.0-beta-publish-workflow-beta.4
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/client/components/ui/table.tsx +197 -50
- package/client/global.css +39 -106
- package/client/ui/Table/{TableV01.stories.tsx → Table.stories.tsx} +76 -78
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +22 -37
- package/dist/index.es.js +64 -127
- package/package.json +1 -1
- package/client/components/ui/table-v01.tsx +0 -230
package/dist/index.d.ts
CHANGED
|
@@ -463,26 +463,21 @@ import { SystemBarIcon } from '../client/components/ui/system-bar';
|
|
|
463
463
|
import { SystemBarSpacer } from '../client/components/ui/system-bar';
|
|
464
464
|
import { Tab } from '../client/hooks/use-tabs';
|
|
465
465
|
import { Table } from '../client/components/ui/table';
|
|
466
|
+
import { TableAction } from '../client/components/ui/table';
|
|
467
|
+
import { TableAlign } from '../client/components/ui/table';
|
|
466
468
|
import { TableBody } from '../client/components/ui/table';
|
|
469
|
+
import { TableBodyCellProps } from '../client/components/ui/table';
|
|
467
470
|
import { TableCaption } from '../client/components/ui/table';
|
|
468
471
|
import { TableCell } from '../client/components/ui/table';
|
|
472
|
+
import { TableCellProps } from '../client/components/ui/table';
|
|
473
|
+
import { TableDensity } from '../client/components/ui/table';
|
|
469
474
|
import { TableFooter } from '../client/components/ui/table';
|
|
470
475
|
import { TableHead } from '../client/components/ui/table';
|
|
471
476
|
import { TableHeader } from '../client/components/ui/table';
|
|
477
|
+
import { TableHeaderCell } from '../client/components/ui/table';
|
|
478
|
+
import { TableProps } from '../client/components/ui/table';
|
|
472
479
|
import { TableRow } from '../client/components/ui/table';
|
|
473
|
-
import {
|
|
474
|
-
import { TableV01Action } from '../client/components/ui/table-v01';
|
|
475
|
-
import { TableV01Align } from '../client/components/ui/table-v01';
|
|
476
|
-
import { TableV01Body } from '../client/components/ui/table-v01';
|
|
477
|
-
import { TableV01Cell } from '../client/components/ui/table-v01';
|
|
478
|
-
import { TableV01CellProps } from '../client/components/ui/table-v01';
|
|
479
|
-
import { TableV01Density } from '../client/components/ui/table-v01';
|
|
480
|
-
import { TableV01Footer } from '../client/components/ui/table-v01';
|
|
481
|
-
import { TableV01Header } from '../client/components/ui/table-v01';
|
|
482
|
-
import { TableV01HeaderCell } from '../client/components/ui/table-v01';
|
|
483
|
-
import { TableV01Props } from '../client/components/ui/table-v01';
|
|
484
|
-
import { TableV01Row } from '../client/components/ui/table-v01';
|
|
485
|
-
import { TableV01Tag } from '../client/components/ui/table-v01';
|
|
480
|
+
import { TableTag } from '../client/components/ui/table';
|
|
486
481
|
import { Tabs } from '../client/components/ui/tabs';
|
|
487
482
|
import { TabsContent } from '../client/components/ui/tabs';
|
|
488
483
|
import { TabsList } from '../client/components/ui/tabs';
|
|
@@ -1511,45 +1506,35 @@ export { Tab }
|
|
|
1511
1506
|
|
|
1512
1507
|
export { Table }
|
|
1513
1508
|
|
|
1509
|
+
export { TableAction }
|
|
1510
|
+
|
|
1511
|
+
export { TableAlign }
|
|
1512
|
+
|
|
1514
1513
|
export { TableBody }
|
|
1515
1514
|
|
|
1515
|
+
export { TableBodyCellProps }
|
|
1516
|
+
|
|
1516
1517
|
export { TableCaption }
|
|
1517
1518
|
|
|
1518
1519
|
export { TableCell }
|
|
1519
1520
|
|
|
1521
|
+
export { TableCellProps }
|
|
1522
|
+
|
|
1523
|
+
export { TableDensity }
|
|
1524
|
+
|
|
1520
1525
|
export { TableFooter }
|
|
1521
1526
|
|
|
1522
1527
|
export { TableHead }
|
|
1523
1528
|
|
|
1524
1529
|
export { TableHeader }
|
|
1525
1530
|
|
|
1526
|
-
export {
|
|
1527
|
-
|
|
1528
|
-
export { TableV01 }
|
|
1529
|
-
|
|
1530
|
-
export { TableV01Action }
|
|
1531
|
-
|
|
1532
|
-
export { TableV01Align }
|
|
1531
|
+
export { TableHeaderCell }
|
|
1533
1532
|
|
|
1534
|
-
export {
|
|
1533
|
+
export { TableProps }
|
|
1535
1534
|
|
|
1536
|
-
export {
|
|
1537
|
-
|
|
1538
|
-
export { TableV01CellProps }
|
|
1539
|
-
|
|
1540
|
-
export { TableV01Density }
|
|
1541
|
-
|
|
1542
|
-
export { TableV01Footer }
|
|
1543
|
-
|
|
1544
|
-
export { TableV01Header }
|
|
1545
|
-
|
|
1546
|
-
export { TableV01HeaderCell }
|
|
1547
|
-
|
|
1548
|
-
export { TableV01Props }
|
|
1549
|
-
|
|
1550
|
-
export { TableV01Row }
|
|
1535
|
+
export { TableRow }
|
|
1551
1536
|
|
|
1552
|
-
export {
|
|
1537
|
+
export { TableTag }
|
|
1553
1538
|
|
|
1554
1539
|
export { Tabs }
|
|
1555
1540
|
|
package/dist/index.es.js
CHANGED
|
@@ -1342,70 +1342,80 @@ const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...pr
|
|
|
1342
1342
|
}
|
|
1343
1343
|
));
|
|
1344
1344
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
1345
|
-
const Table = React.forwardRef(
|
|
1346
|
-
"table",
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1345
|
+
const Table = React.forwardRef(
|
|
1346
|
+
({ className, containerClassName, density = "compact", ...props }, ref) => /* @__PURE__ */ jsx("div", { className: cn("table-wrapper", containerClassName), children: /* @__PURE__ */ jsx(
|
|
1347
|
+
"table",
|
|
1348
|
+
{
|
|
1349
|
+
ref,
|
|
1350
|
+
"data-density": density,
|
|
1351
|
+
className: cn("table", className),
|
|
1352
|
+
...props
|
|
1353
|
+
}
|
|
1354
|
+
) })
|
|
1355
|
+
);
|
|
1353
1356
|
Table.displayName = "Table";
|
|
1354
1357
|
const TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("table-header", className), ...props }));
|
|
1355
1358
|
TableHeader.displayName = "TableHeader";
|
|
1356
|
-
const TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1357
|
-
"tbody",
|
|
1358
|
-
{
|
|
1359
|
-
ref,
|
|
1360
|
-
className: cn("table-body", className),
|
|
1361
|
-
...props
|
|
1362
|
-
}
|
|
1363
|
-
));
|
|
1359
|
+
const TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: cn("table-body", className), ...props }));
|
|
1364
1360
|
TableBody.displayName = "TableBody";
|
|
1365
|
-
const TableFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1366
|
-
"tfoot",
|
|
1367
|
-
{
|
|
1368
|
-
ref,
|
|
1369
|
-
className: cn("table-footer", className),
|
|
1370
|
-
...props
|
|
1371
|
-
}
|
|
1372
|
-
));
|
|
1361
|
+
const TableFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tfoot", { ref, className: cn("table-footer", className), ...props }));
|
|
1373
1362
|
TableFooter.displayName = "TableFooter";
|
|
1374
|
-
const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1375
|
-
"tr",
|
|
1376
|
-
{
|
|
1377
|
-
ref,
|
|
1378
|
-
className: cn("table-row", className),
|
|
1379
|
-
...props
|
|
1380
|
-
}
|
|
1381
|
-
));
|
|
1363
|
+
const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", { ref, className: cn("table-row", className), ...props }));
|
|
1382
1364
|
TableRow.displayName = "TableRow";
|
|
1383
|
-
const
|
|
1384
|
-
"
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1365
|
+
const TableTag = React.forwardRef(
|
|
1366
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("span", { ref, className: cn("table-tag", className), ...props })
|
|
1367
|
+
);
|
|
1368
|
+
TableTag.displayName = "TableTag";
|
|
1369
|
+
const TableHeaderCell = React.forwardRef(
|
|
1370
|
+
({ className, align = "left", label, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1371
|
+
"th",
|
|
1372
|
+
{
|
|
1373
|
+
ref,
|
|
1374
|
+
scope: "col",
|
|
1375
|
+
"data-align": align,
|
|
1376
|
+
className: cn("table-header-cell", className),
|
|
1377
|
+
...props,
|
|
1378
|
+
children: /* @__PURE__ */ jsxs("span", { className: "table-cell-inner overline-medium", children: [
|
|
1379
|
+
label,
|
|
1380
|
+
children
|
|
1381
|
+
] })
|
|
1382
|
+
}
|
|
1383
|
+
)
|
|
1384
|
+
);
|
|
1385
|
+
TableHeaderCell.displayName = "TableHeaderCell";
|
|
1386
|
+
const TableHead = React.forwardRef(
|
|
1387
|
+
(props, ref) => /* @__PURE__ */ jsx(TableHeaderCell, { ref, ...props })
|
|
1388
|
+
);
|
|
1391
1389
|
TableHead.displayName = "TableHead";
|
|
1392
|
-
const TableCell = React.forwardRef(
|
|
1393
|
-
"
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1390
|
+
const TableCell = React.forwardRef(
|
|
1391
|
+
({ className, align = "left", text, tag, action, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1392
|
+
"td",
|
|
1393
|
+
{
|
|
1394
|
+
ref,
|
|
1395
|
+
"data-align": align,
|
|
1396
|
+
className: cn("table-cell", className),
|
|
1397
|
+
...props,
|
|
1398
|
+
children: /* @__PURE__ */ jsxs("span", { className: "table-cell-inner", children: [
|
|
1399
|
+
text,
|
|
1400
|
+
tag != null ? /* @__PURE__ */ jsx(TableTag, { children: tag }) : null,
|
|
1401
|
+
action,
|
|
1402
|
+
children
|
|
1403
|
+
] })
|
|
1404
|
+
}
|
|
1405
|
+
)
|
|
1406
|
+
);
|
|
1400
1407
|
TableCell.displayName = "TableCell";
|
|
1401
|
-
const
|
|
1402
|
-
"
|
|
1408
|
+
const TableAction = React.forwardRef(({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1409
|
+
"button",
|
|
1403
1410
|
{
|
|
1404
1411
|
ref,
|
|
1405
|
-
|
|
1412
|
+
type,
|
|
1413
|
+
className: cn("table-action", className),
|
|
1406
1414
|
...props
|
|
1407
1415
|
}
|
|
1408
1416
|
));
|
|
1417
|
+
TableAction.displayName = "TableAction";
|
|
1418
|
+
const TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("caption", { ref, className: cn("table-caption", className), ...props }));
|
|
1409
1419
|
TableCaption.displayName = "TableCaption";
|
|
1410
1420
|
const CodeBadge = React.forwardRef(
|
|
1411
1421
|
({
|
|
@@ -6095,73 +6105,6 @@ const PaginationEllipsis = ({
|
|
|
6095
6105
|
}
|
|
6096
6106
|
);
|
|
6097
6107
|
PaginationEllipsis.displayName = "PaginationEllipsis";
|
|
6098
|
-
const TableV01 = React.forwardRef(
|
|
6099
|
-
({ className, containerClassName, density = "compact", ...props }, ref) => /* @__PURE__ */ jsx("div", { className: cn("table-v01-wrapper", containerClassName), children: /* @__PURE__ */ jsx(
|
|
6100
|
-
"table",
|
|
6101
|
-
{
|
|
6102
|
-
ref,
|
|
6103
|
-
"data-density": density,
|
|
6104
|
-
className: cn("table-v01", className),
|
|
6105
|
-
...props
|
|
6106
|
-
}
|
|
6107
|
-
) })
|
|
6108
|
-
);
|
|
6109
|
-
TableV01.displayName = "TableV01";
|
|
6110
|
-
const TableV01Header = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("table-v01-header", className), ...props }));
|
|
6111
|
-
TableV01Header.displayName = "TableV01Header";
|
|
6112
|
-
const TableV01Body = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: cn("table-v01-body", className), ...props }));
|
|
6113
|
-
TableV01Body.displayName = "TableV01Body";
|
|
6114
|
-
const TableV01Footer = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tfoot", { ref, className: cn("table-v01-footer", className), ...props }));
|
|
6115
|
-
TableV01Footer.displayName = "TableV01Footer";
|
|
6116
|
-
const TableV01Row = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", { ref, className: cn("table-v01-row", className), ...props }));
|
|
6117
|
-
TableV01Row.displayName = "TableV01Row";
|
|
6118
|
-
const TableV01Tag = React.forwardRef(
|
|
6119
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx("span", { ref, className: cn("table-v01-tag", className), ...props })
|
|
6120
|
-
);
|
|
6121
|
-
TableV01Tag.displayName = "TableV01Tag";
|
|
6122
|
-
const TableV01HeaderCell = React.forwardRef(({ className, align = "left", label, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6123
|
-
"th",
|
|
6124
|
-
{
|
|
6125
|
-
ref,
|
|
6126
|
-
scope: "col",
|
|
6127
|
-
"data-align": align,
|
|
6128
|
-
className: cn("table-v01-header-cell", className),
|
|
6129
|
-
...props,
|
|
6130
|
-
children: /* @__PURE__ */ jsxs("span", { className: "table-v01-cell-inner overline-medium", children: [
|
|
6131
|
-
label,
|
|
6132
|
-
children
|
|
6133
|
-
] })
|
|
6134
|
-
}
|
|
6135
|
-
));
|
|
6136
|
-
TableV01HeaderCell.displayName = "TableV01HeaderCell";
|
|
6137
|
-
const TableV01Cell = React.forwardRef(
|
|
6138
|
-
({ className, align = "left", text, tag, action, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6139
|
-
"td",
|
|
6140
|
-
{
|
|
6141
|
-
ref,
|
|
6142
|
-
"data-align": align,
|
|
6143
|
-
className: cn("table-v01-cell", className),
|
|
6144
|
-
...props,
|
|
6145
|
-
children: /* @__PURE__ */ jsxs("span", { className: "table-v01-cell-inner", children: [
|
|
6146
|
-
text,
|
|
6147
|
-
tag != null ? /* @__PURE__ */ jsx(TableV01Tag, { children: tag }) : null,
|
|
6148
|
-
action,
|
|
6149
|
-
children
|
|
6150
|
-
] })
|
|
6151
|
-
}
|
|
6152
|
-
)
|
|
6153
|
-
);
|
|
6154
|
-
TableV01Cell.displayName = "TableV01Cell";
|
|
6155
|
-
const TableV01Action = React.forwardRef(({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6156
|
-
"button",
|
|
6157
|
-
{
|
|
6158
|
-
ref,
|
|
6159
|
-
type,
|
|
6160
|
-
className: cn("table-v01-action", className),
|
|
6161
|
-
...props
|
|
6162
|
-
}
|
|
6163
|
-
));
|
|
6164
|
-
TableV01Action.displayName = "TableV01Action";
|
|
6165
6108
|
const iconProps = {
|
|
6166
6109
|
fill: "none",
|
|
6167
6110
|
strokeWidth: 1.5,
|
|
@@ -17502,22 +17445,16 @@ export {
|
|
|
17502
17445
|
SystemBarIcon,
|
|
17503
17446
|
SystemBarSpacer,
|
|
17504
17447
|
Table,
|
|
17448
|
+
TableAction,
|
|
17505
17449
|
TableBody,
|
|
17506
17450
|
TableCaption,
|
|
17507
17451
|
TableCell,
|
|
17508
17452
|
TableFooter,
|
|
17509
17453
|
TableHead,
|
|
17510
17454
|
TableHeader,
|
|
17455
|
+
TableHeaderCell,
|
|
17511
17456
|
TableRow,
|
|
17512
|
-
|
|
17513
|
-
TableV01Action,
|
|
17514
|
-
TableV01Body,
|
|
17515
|
-
TableV01Cell,
|
|
17516
|
-
TableV01Footer,
|
|
17517
|
-
TableV01Header,
|
|
17518
|
-
TableV01HeaderCell,
|
|
17519
|
-
TableV01Row,
|
|
17520
|
-
TableV01Tag,
|
|
17457
|
+
TableTag,
|
|
17521
17458
|
Tabs,
|
|
17522
17459
|
TabsContent,
|
|
17523
17460
|
TabsList,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syscore/ui-library",
|
|
3
|
-
"version": "2.0.0-beta-publish-workflow-beta.
|
|
3
|
+
"version": "2.0.0-beta-publish-workflow-beta.4",
|
|
4
4
|
"description": "A comprehensive React component library built with Radix UI, Tailwind CSS, and TypeScript",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "@/lib/utils";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Table — built from the Figma component set `Table component` (node 12176:414).
|
|
7
|
-
*
|
|
8
|
-
* Figma models a single *cell* with four properties and ~135 variants. Two of
|
|
9
|
-
* them are structural rather than authored:
|
|
10
|
-
*
|
|
11
|
-
* - `Alignment` (Left / Center / Right) is really the cell's **column
|
|
12
|
-
* position**: it selects which borders and which corner radius the cell
|
|
13
|
-
* carries, not how the text sits. `Center` carries all four, so every column
|
|
14
|
-
* is divided; that grid is derived here from the cell order.
|
|
15
|
-
* - `Placement` (Header / Intermediate / Bottom) is the **row position**.
|
|
16
|
-
* Header is its own element; Intermediate vs Bottom is derived from
|
|
17
|
-
* `tr:last-child`.
|
|
18
|
-
*
|
|
19
|
-
* `Content type` (Text / Text + Tag / Text + Action / Tag / Action) collapses
|
|
20
|
-
* into composition — a cell renders whatever children it is given, with the
|
|
21
|
-
* 10px gap Figma specifies.
|
|
22
|
-
*
|
|
23
|
-
* That leaves `density` as the one real variant, and it is the cell's *vertical*
|
|
24
|
-
* padding only — 16 / 20 / 24, all on the `--space-*` scale. Horizontal padding
|
|
25
|
-
* stays 16 at every density. Cell heights then follow from the content, matching
|
|
26
|
-
* Figma's 40/48/56 for headers, 43/51/59 for text rows and 64/72/80 for tag and
|
|
27
|
-
* action rows.
|
|
28
|
-
*/
|
|
29
|
-
type TableV01Density = "compact" | "balanced" | "spacious";
|
|
30
|
-
type TableV01Align = "left" | "center" | "right";
|
|
31
|
-
|
|
32
|
-
// ---------------------------------------------------------------------------
|
|
33
|
-
// Root
|
|
34
|
-
// ---------------------------------------------------------------------------
|
|
35
|
-
|
|
36
|
-
interface TableV01Props extends React.TableHTMLAttributes<HTMLTableElement> {
|
|
37
|
-
/** Figma `Density`. Sets the cell's vertical padding; heights follow. Default `compact`. */
|
|
38
|
-
density?: TableV01Density;
|
|
39
|
-
/** Wrapper class, for width or overflow handling. */
|
|
40
|
-
containerClassName?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const TableV01 = React.forwardRef<HTMLTableElement, TableV01Props>(
|
|
44
|
-
({ className, containerClassName, density = "compact", ...props }, ref) => (
|
|
45
|
-
<div className={cn("table-v01-wrapper", containerClassName)}>
|
|
46
|
-
<table
|
|
47
|
-
ref={ref}
|
|
48
|
-
data-density={density}
|
|
49
|
-
className={cn("table-v01", className)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
),
|
|
54
|
-
);
|
|
55
|
-
TableV01.displayName = "TableV01";
|
|
56
|
-
|
|
57
|
-
// ---------------------------------------------------------------------------
|
|
58
|
-
// Sections and rows
|
|
59
|
-
// ---------------------------------------------------------------------------
|
|
60
|
-
|
|
61
|
-
const TableV01Header = React.forwardRef<
|
|
62
|
-
HTMLTableSectionElement,
|
|
63
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
64
|
-
>(({ className, ...props }, ref) => (
|
|
65
|
-
<thead ref={ref} className={cn("table-v01-header", className)} {...props} />
|
|
66
|
-
));
|
|
67
|
-
TableV01Header.displayName = "TableV01Header";
|
|
68
|
-
|
|
69
|
-
const TableV01Body = React.forwardRef<
|
|
70
|
-
HTMLTableSectionElement,
|
|
71
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
72
|
-
>(({ className, ...props }, ref) => (
|
|
73
|
-
<tbody ref={ref} className={cn("table-v01-body", className)} {...props} />
|
|
74
|
-
));
|
|
75
|
-
TableV01Body.displayName = "TableV01Body";
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Figma's `Placement=Bottom` is the last row of the table. As a section it also
|
|
79
|
-
* takes over the bottom corner radii from the body.
|
|
80
|
-
*/
|
|
81
|
-
const TableV01Footer = React.forwardRef<
|
|
82
|
-
HTMLTableSectionElement,
|
|
83
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
84
|
-
>(({ className, ...props }, ref) => (
|
|
85
|
-
<tfoot ref={ref} className={cn("table-v01-footer", className)} {...props} />
|
|
86
|
-
));
|
|
87
|
-
TableV01Footer.displayName = "TableV01Footer";
|
|
88
|
-
|
|
89
|
-
const TableV01Row = React.forwardRef<
|
|
90
|
-
HTMLTableRowElement,
|
|
91
|
-
React.HTMLAttributes<HTMLTableRowElement>
|
|
92
|
-
>(({ className, ...props }, ref) => (
|
|
93
|
-
<tr ref={ref} className={cn("table-v01-row", className)} {...props} />
|
|
94
|
-
));
|
|
95
|
-
TableV01Row.displayName = "TableV01Row";
|
|
96
|
-
|
|
97
|
-
// ---------------------------------------------------------------------------
|
|
98
|
-
// Cells
|
|
99
|
-
// ---------------------------------------------------------------------------
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Figma's code/strategy tag (instance `code_strategy_*`): emerald tint with a
|
|
103
|
-
* 1.5px tinted border and tabular figures.
|
|
104
|
-
*/
|
|
105
|
-
interface TableV01TagProps extends React.HTMLAttributes<HTMLSpanElement> {}
|
|
106
|
-
|
|
107
|
-
const TableV01Tag = React.forwardRef<HTMLSpanElement, TableV01TagProps>(
|
|
108
|
-
({ className, ...props }, ref) => (
|
|
109
|
-
<span ref={ref} className={cn("table-v01-tag", className)} {...props} />
|
|
110
|
-
),
|
|
111
|
-
);
|
|
112
|
-
TableV01Tag.displayName = "TableV01Tag";
|
|
113
|
-
|
|
114
|
-
interface TableV01CellProps
|
|
115
|
-
extends React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
116
|
-
/**
|
|
117
|
-
* Text alignment within the cell. Figma's `Alignment` property is column
|
|
118
|
-
* position, not text alignment, so this is additive — tables need it for
|
|
119
|
-
* numeric columns.
|
|
120
|
-
*/
|
|
121
|
-
align?: TableV01Align;
|
|
122
|
-
/** The column label. Figma sets it uppercase in the overline ramp. */
|
|
123
|
-
label?: React.ReactNode;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** Figma `Placement=Header`: cyan/50 fill, uppercase overline label in cyan/800. */
|
|
127
|
-
const TableV01HeaderCell = React.forwardRef<
|
|
128
|
-
HTMLTableCellElement,
|
|
129
|
-
TableV01CellProps
|
|
130
|
-
>(({ className, align = "left", label, children, ...props }, ref) => (
|
|
131
|
-
<th
|
|
132
|
-
ref={ref}
|
|
133
|
-
scope="col"
|
|
134
|
-
data-align={align}
|
|
135
|
-
className={cn("table-v01-header-cell", className)}
|
|
136
|
-
{...props}
|
|
137
|
-
>
|
|
138
|
-
<span className="table-v01-cell-inner overline-medium">
|
|
139
|
-
{label}
|
|
140
|
-
{children}
|
|
141
|
-
</span>
|
|
142
|
-
</th>
|
|
143
|
-
));
|
|
144
|
-
TableV01HeaderCell.displayName = "TableV01HeaderCell";
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Figma `Placement=Intermediates | Bottom`: white fill, Mazzard Medium 16/21.
|
|
148
|
-
*
|
|
149
|
-
* Figma's `Content type` axis is expressed as content props rather than an
|
|
150
|
-
* enum: pass any of `text`, `tag` and `action` and the cell renders them in
|
|
151
|
-
* Figma's order with the 10px gap. `children` still works for anything the
|
|
152
|
-
* props cannot express (a link, two lines, a custom control).
|
|
153
|
-
*/
|
|
154
|
-
interface TableV01BodyCellProps
|
|
155
|
-
extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
156
|
-
/** Text alignment within the cell. Additive to Figma. */
|
|
157
|
-
align?: TableV01Align;
|
|
158
|
-
/** Figma `Content type=Text …`: Mazzard Medium 16/21 in gray/800. */
|
|
159
|
-
text?: React.ReactNode;
|
|
160
|
-
/** Figma `Content type=… + Tag`: wrapped in the code/strategy tag. */
|
|
161
|
-
tag?: React.ReactNode;
|
|
162
|
-
/** Figma `Content type=… + Action`: pass one or more `TableV01Action`. */
|
|
163
|
-
action?: React.ReactNode;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const TableV01Cell = React.forwardRef<
|
|
167
|
-
HTMLTableCellElement,
|
|
168
|
-
TableV01BodyCellProps
|
|
169
|
-
>(
|
|
170
|
-
(
|
|
171
|
-
{ className, align = "left", text, tag, action, children, ...props },
|
|
172
|
-
ref,
|
|
173
|
-
) => (
|
|
174
|
-
<td
|
|
175
|
-
ref={ref}
|
|
176
|
-
data-align={align}
|
|
177
|
-
className={cn("table-v01-cell", className)}
|
|
178
|
-
{...props}
|
|
179
|
-
>
|
|
180
|
-
<span className="table-v01-cell-inner">
|
|
181
|
-
{text}
|
|
182
|
-
{tag != null ? <TableV01Tag>{tag}</TableV01Tag> : null}
|
|
183
|
-
{action}
|
|
184
|
-
{children}
|
|
185
|
-
</span>
|
|
186
|
-
</td>
|
|
187
|
-
),
|
|
188
|
-
);
|
|
189
|
-
TableV01Cell.displayName = "TableV01Cell";
|
|
190
|
-
|
|
191
|
-
// ---------------------------------------------------------------------------
|
|
192
|
-
// Cell content — the pieces Figma's `Content type` composes
|
|
193
|
-
// ---------------------------------------------------------------------------
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Figma's `button_icon_*`: a 32px white circle with a gray/100 border holding a
|
|
197
|
-
* 14px icon. Pass the icon as children.
|
|
198
|
-
*/
|
|
199
|
-
const TableV01Action = React.forwardRef<
|
|
200
|
-
HTMLButtonElement,
|
|
201
|
-
React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
202
|
-
>(({ className, type = "button", ...props }, ref) => (
|
|
203
|
-
<button
|
|
204
|
-
ref={ref}
|
|
205
|
-
type={type}
|
|
206
|
-
className={cn("table-v01-action", className)}
|
|
207
|
-
{...props}
|
|
208
|
-
/>
|
|
209
|
-
));
|
|
210
|
-
TableV01Action.displayName = "TableV01Action";
|
|
211
|
-
|
|
212
|
-
export {
|
|
213
|
-
TableV01,
|
|
214
|
-
TableV01Header,
|
|
215
|
-
TableV01Body,
|
|
216
|
-
TableV01Footer,
|
|
217
|
-
TableV01Row,
|
|
218
|
-
TableV01HeaderCell,
|
|
219
|
-
TableV01Cell,
|
|
220
|
-
TableV01Tag,
|
|
221
|
-
TableV01Action,
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
export type {
|
|
225
|
-
TableV01Props,
|
|
226
|
-
TableV01CellProps,
|
|
227
|
-
TableV01BodyCellProps,
|
|
228
|
-
TableV01Density,
|
|
229
|
-
TableV01Align,
|
|
230
|
-
};
|