jvetrau-ds 0.2.33 → 0.2.35
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/components/index.cjs +6 -0
- package/components/index.d.ts +2 -0
- package/components/index.js +1 -0
- package/components/surface/surface.css +21 -5
- package/components/table/index.cjs +22 -0
- package/components/table/index.cjs.map +1 -0
- package/components/table/index.d.ts +3 -0
- package/components/table/index.js +3 -0
- package/components/table/index.js.map +1 -0
- package/components/table/table.cjs +139 -0
- package/components/table/table.cjs.map +1 -0
- package/components/table/table.css +168 -0
- package/components/table/table.d.ts +39 -0
- package/components/table/table.js +137 -0
- package/components/table/table.js.map +1 -0
- package/components/table/table.meta.d.ts +2 -0
- package/index.cjs +6 -0
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/styles.css +191 -5
package/components/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var courseOutline = require('./course-outline/course-outline');
|
|
|
31
31
|
var calendarMonth = require('./calendar-month');
|
|
32
32
|
var flipList = require('./flip-list/flip-list');
|
|
33
33
|
var avatarUpload = require('./avatar-upload/avatar-upload');
|
|
34
|
+
var table = require('./table');
|
|
34
35
|
|
|
35
36
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
37
|
|
|
@@ -64,6 +65,7 @@ var discussion__default = /*#__PURE__*/_interopDefault(discussion);
|
|
|
64
65
|
var courseOutline__default = /*#__PURE__*/_interopDefault(courseOutline);
|
|
65
66
|
var flipList__default = /*#__PURE__*/_interopDefault(flipList);
|
|
66
67
|
var avatarUpload__default = /*#__PURE__*/_interopDefault(avatarUpload);
|
|
68
|
+
var table__default = /*#__PURE__*/_interopDefault(table);
|
|
67
69
|
|
|
68
70
|
|
|
69
71
|
|
|
@@ -195,6 +197,10 @@ Object.defineProperty(exports, "AvatarUpload", {
|
|
|
195
197
|
enumerable: true,
|
|
196
198
|
get: function () { return avatarUpload__default.default; }
|
|
197
199
|
});
|
|
200
|
+
Object.defineProperty(exports, "Table", {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
get: function () { return table__default.default; }
|
|
203
|
+
});
|
|
198
204
|
Object.keys(calendarMonth).forEach(function (k) {
|
|
199
205
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
200
206
|
enumerable: true,
|
package/components/index.d.ts
CHANGED
|
@@ -60,3 +60,5 @@ export { default as FlipList } from './flip-list/flip-list';
|
|
|
60
60
|
export type { FlipListItem, FlipListProps, } from './flip-list/flip-list';
|
|
61
61
|
export { default as AvatarUpload } from './avatar-upload/avatar-upload';
|
|
62
62
|
export type { AvatarUploadProps, } from './avatar-upload/avatar-upload';
|
|
63
|
+
export { default as Table } from './table';
|
|
64
|
+
export type { TableBodyProps, TableCellProps, TableColumn, TableColumnWidth, TableProps, TableRowProps } from './table';
|
package/components/index.js
CHANGED
|
@@ -29,5 +29,6 @@ export { default as CourseOutline } from './course-outline/course-outline';
|
|
|
29
29
|
export * from './calendar-month';
|
|
30
30
|
export { default as FlipList } from './flip-list/flip-list';
|
|
31
31
|
export { default as AvatarUpload } from './avatar-upload/avatar-upload';
|
|
32
|
+
export { default as Table } from './table';
|
|
32
33
|
//# sourceMappingURL=index.js.map
|
|
33
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -147,6 +147,24 @@
|
|
|
147
147
|
/* motion */
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
.surface--secondary .progressbar {
|
|
151
|
+
/* color */
|
|
152
|
+
--progressbar-track-bg: color-mix(in srgb, var(--color-primary-1) 30%, transparent);
|
|
153
|
+
--progressbar-buffered-bg: color-mix(in srgb, var(--color-primary-1) 40%, transparent);
|
|
154
|
+
--progressbar-value-bg: var(--color-primary-1);
|
|
155
|
+
--progressbar-label-color: var(--color-text-primary-1);
|
|
156
|
+
|
|
157
|
+
/* typography */
|
|
158
|
+
|
|
159
|
+
/* size */
|
|
160
|
+
|
|
161
|
+
/* border */
|
|
162
|
+
|
|
163
|
+
/* depth */
|
|
164
|
+
|
|
165
|
+
/* motion */
|
|
166
|
+
}
|
|
167
|
+
|
|
150
168
|
.surface--tertiary {
|
|
151
169
|
/* color */
|
|
152
170
|
--surface-bg: var(--color-bg-container-tertiary);
|
|
@@ -181,12 +199,10 @@
|
|
|
181
199
|
/* motion */
|
|
182
200
|
}
|
|
183
201
|
|
|
184
|
-
.surface--
|
|
202
|
+
.surface--tertiary .calendar-month {
|
|
185
203
|
/* color */
|
|
186
|
-
--
|
|
187
|
-
--
|
|
188
|
-
--progressbar-value-bg: var(--color-primary-1);
|
|
189
|
-
--progressbar-label-color: var(--color-text-primary-1);
|
|
204
|
+
--calendar-month-marked-bg: var(--color-primary-1);
|
|
205
|
+
--calendar-month-marked-color: var(--color-text-primary-1);
|
|
190
206
|
|
|
191
207
|
/* typography */
|
|
192
208
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var table = require('./table');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var table__default = /*#__PURE__*/_interopDefault(table);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "Table", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return table__default.default; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "default", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return table__default.default; }
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=index.cjs.map
|
|
22
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
require('./table.css');
|
|
5
|
+
var classnames = require('../helpers/classnames');
|
|
6
|
+
|
|
7
|
+
const getFractionTotal = (columns) => columns.reduce((total, column) => {
|
|
8
|
+
if (column.width?.type !== "fraction" || column.width.value <= 0) {
|
|
9
|
+
return total;
|
|
10
|
+
}
|
|
11
|
+
return total + column.width.value;
|
|
12
|
+
}, 0);
|
|
13
|
+
const getFractionPercentage = (value, total) => Number(
|
|
14
|
+
(value / total * 100).toFixed(6)
|
|
15
|
+
);
|
|
16
|
+
const getColumnWidth = (width, fractionTotal) => {
|
|
17
|
+
if (!width || width.type === "auto") {
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
if (width.type === "min") {
|
|
21
|
+
return "1%";
|
|
22
|
+
}
|
|
23
|
+
if (width.type === "max") {
|
|
24
|
+
return "100%";
|
|
25
|
+
}
|
|
26
|
+
if (width.type === "fixed") {
|
|
27
|
+
return width.value;
|
|
28
|
+
}
|
|
29
|
+
if (width.value <= 0 || fractionTotal <= 0) {
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
return `${getFractionPercentage(
|
|
33
|
+
width.value,
|
|
34
|
+
fractionTotal
|
|
35
|
+
)}%`;
|
|
36
|
+
};
|
|
37
|
+
const TableBody = ({
|
|
38
|
+
className = "",
|
|
39
|
+
...props
|
|
40
|
+
}) => {
|
|
41
|
+
const classes = classnames.classnames(
|
|
42
|
+
"table__body",
|
|
43
|
+
className,
|
|
44
|
+
{}
|
|
45
|
+
);
|
|
46
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
"tbody",
|
|
48
|
+
{
|
|
49
|
+
className: classes,
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
const TableRow = ({
|
|
55
|
+
className = "",
|
|
56
|
+
...props
|
|
57
|
+
}) => {
|
|
58
|
+
const classes = classnames.classnames(
|
|
59
|
+
"table__row",
|
|
60
|
+
className,
|
|
61
|
+
{}
|
|
62
|
+
);
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
"tr",
|
|
65
|
+
{
|
|
66
|
+
className: classes,
|
|
67
|
+
...props
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
const TableCell = ({
|
|
72
|
+
className = "",
|
|
73
|
+
...props
|
|
74
|
+
}) => {
|
|
75
|
+
const classes = classnames.classnames(
|
|
76
|
+
"table__cell",
|
|
77
|
+
className,
|
|
78
|
+
{}
|
|
79
|
+
);
|
|
80
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
+
"td",
|
|
82
|
+
{
|
|
83
|
+
className: classes,
|
|
84
|
+
...props
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
const Table = ({
|
|
89
|
+
columns,
|
|
90
|
+
className = "",
|
|
91
|
+
children,
|
|
92
|
+
...props
|
|
93
|
+
}) => {
|
|
94
|
+
const classes = classnames.classnames(
|
|
95
|
+
"table",
|
|
96
|
+
className,
|
|
97
|
+
{}
|
|
98
|
+
);
|
|
99
|
+
const fractionTotal = getFractionTotal(columns);
|
|
100
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
101
|
+
"table",
|
|
102
|
+
{
|
|
103
|
+
className: classes,
|
|
104
|
+
...props,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsxRuntime.jsx("colgroup", { children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
107
|
+
"col",
|
|
108
|
+
{
|
|
109
|
+
style: {
|
|
110
|
+
width: getColumnWidth(
|
|
111
|
+
column.width,
|
|
112
|
+
fractionTotal
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
column.id
|
|
117
|
+
)) }),
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "table__head", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "table__row", children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
"th",
|
|
120
|
+
{
|
|
121
|
+
className: "table__header",
|
|
122
|
+
scope: "col",
|
|
123
|
+
children: column.header
|
|
124
|
+
},
|
|
125
|
+
column.id
|
|
126
|
+
)) }) }),
|
|
127
|
+
children
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
Table.Body = TableBody;
|
|
133
|
+
Table.Row = TableRow;
|
|
134
|
+
Table.Cell = TableCell;
|
|
135
|
+
var table_default = Table;
|
|
136
|
+
|
|
137
|
+
module.exports = table_default;
|
|
138
|
+
//# sourceMappingURL=table.cjs.map
|
|
139
|
+
//# sourceMappingURL=table.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table.tsx"],"names":["classnames","jsx","jsxs"],"mappings":";;;;;;AA4CA,MAAM,mBAAmB,CACvB,OAAA,KAEA,QAAQ,MAAA,CAAO,CAAC,OAAO,MAAA,KAAW;AAChC,EAAA,IACE,OAAO,KAAA,EAAO,IAAA,KAAS,cACvB,MAAA,CAAO,KAAA,CAAM,SAAS,CAAA,EACtB;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA,GAAQ,OAAO,KAAA,CAAM,KAAA;AAC9B,CAAA,EAAG,CAAC,CAAA;AAEN,MAAM,qBAAA,GAAwB,CAC5B,KAAA,EACA,KAAA,KAEA,MAAA;AAAA,EAAA,CACI,KAAA,GAAQ,KAAA,GAAS,GAAA,EAAK,OAAA,CAAQ,CAAC;AACnC,CAAA;AAEF,MAAM,cAAA,GAAiB,CACrB,KAAA,EACA,aAAA,KACiC;AACjC,EAAA,IAAI,CAAC,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EAAU,eAAA;AAAA,YACV,KAAA,EAAM,KAAA;AAAA,YAEL,QAAA,EAAA,MAAA,CAAO;AAAA,WAAA;AAAA,UAJH,MAAA,CAAO;AAAA,SAMf,GACH,CAAA,EACF,CAAA;AAAA,QAEC;AAAA;AAAA;AAAA,GACH;AAEJ,CAAA;AAEA,KAAA,CAAM,IAAA,GAAO,SAAA;AACb,KAAA,CAAM,GAAA,GAAM,QAAA;AACZ,KAAA,CAAM,IAAA,GAAO,SAAA;AAEb,IAAO,aAAA,GAAQ","file":"table.cjs","sourcesContent":["import React from 'react';\n\nimport './table.css';\nimport { classnames } from '../helpers/classnames';\n\nexport type TableColumnWidth =\n | {\n type: 'auto';\n }\n | {\n type: 'max';\n }\n | {\n type: 'fraction';\n value: number;\n }\n | {\n type: 'min';\n }\n | {\n type: 'fixed';\n value: string;\n };\n\nexport interface TableColumn {\n id: React.Key;\n header: React.ReactNode;\n width?: TableColumnWidth;\n}\n\nexport interface TableProps\n extends React.TableHTMLAttributes<HTMLTableElement> {\n columns: TableColumn[];\n}\n\nexport interface TableBodyProps\n extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport interface TableRowProps\n extends React.HTMLAttributes<HTMLTableRowElement> {}\n\nexport interface TableCellProps\n extends React.TdHTMLAttributes<HTMLTableCellElement> {}\n\nconst getFractionTotal = (\n columns: TableColumn[],\n) =>\n columns.reduce((total, column) => {\n if (\n column.width?.type !== 'fraction' ||\n column.width.value <= 0\n ) {\n return total;\n }\n\n return total + column.width.value;\n }, 0);\n\nconst getFractionPercentage = (\n value: number,\n total: number,\n) =>\n Number(\n ((value / total) * 100).toFixed(6),\n );\n\nconst getColumnWidth = (\n width: TableColumnWidth | undefined,\n fractionTotal: number,\n): React.CSSProperties['width'] => {\n if (!width || width.type === 'auto') {\n return undefined;\n }\n\n if (width.type === 'min') {\n return '1%';\n }\n\n if (width.type === 'max') {\n return '100%';\n }\n\n if (width.type === 'fixed') {\n return width.value;\n }\n\n if (\n width.value <= 0 ||\n fractionTotal <= 0\n ) {\n return undefined;\n }\n\n return `${getFractionPercentage(\n width.value,\n fractionTotal,\n )}%`;\n};\n\nconst TableBody: React.FC<\n TableBodyProps\n> = ({\n className = '',\n ...props\n}) => {\n const classes = classnames(\n 'table__body',\n className,\n {},\n );\n\n return (\n <tbody\n className={classes}\n {...props}\n />\n );\n};\n\nconst TableRow: React.FC<\n TableRowProps\n> = ({\n className = '',\n ...props\n}) => {\n const classes = classnames(\n 'table__row',\n className,\n {},\n );\n\n return (\n <tr\n className={classes}\n {...props}\n />\n );\n};\n\nconst TableCell: React.FC<\n TableCellProps\n> = ({\n className = '',\n ...props\n}) => {\n const classes = classnames(\n 'table__cell',\n className,\n {},\n );\n\n return (\n <td\n className={classes}\n {...props}\n />\n );\n};\n\ninterface TableComponent\n extends React.FC<TableProps> {\n Body: typeof TableBody;\n Row: typeof TableRow;\n Cell: typeof TableCell;\n}\n\nconst Table: TableComponent = ({\n columns,\n className = '',\n children,\n ...props\n}) => {\n const classes = classnames(\n 'table',\n className,\n {},\n );\n\n const fractionTotal =\n getFractionTotal(columns);\n\n return (\n <table\n className={classes}\n {...props}\n >\n <colgroup>\n {columns.map((column) => (\n <col\n key={column.id}\n style={{\n width: getColumnWidth(\n column.width,\n fractionTotal,\n ),\n }}\n />\n ))}\n </colgroup>\n\n <thead className=\"table__head\">\n <tr className=\"table__row\">\n {columns.map((column) => (\n <th\n key={column.id}\n className=\"table__header\"\n scope=\"col\"\n >\n {column.header}\n </th>\n ))}\n </tr>\n </thead>\n\n {children}\n </table>\n );\n};\n\nTable.Body = TableBody;\nTable.Row = TableRow;\nTable.Cell = TableCell;\n\nexport default Table;\n"]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
.table {
|
|
2
|
+
/* color */
|
|
3
|
+
--table-color: var(--color-text);
|
|
4
|
+
--table-border-color: var(--color-line-grid);
|
|
5
|
+
|
|
6
|
+
/* typography */
|
|
7
|
+
--table-font-family: var(--font-h4-family);
|
|
8
|
+
--table-font-size: var(--font-h4);
|
|
9
|
+
--table-line-height: var(--font-h4-line);
|
|
10
|
+
--table-letter-spacing: var(--font-h4-letter-spacing);
|
|
11
|
+
--table-font-weight: var(--font-body-weight);
|
|
12
|
+
--table-header-font-weight: var(--font-h4-weight);
|
|
13
|
+
|
|
14
|
+
/* size */
|
|
15
|
+
--table-column-gap: var(--margin-item);
|
|
16
|
+
--table-row-gap: var(--font-h4-margin);
|
|
17
|
+
width: 100%;
|
|
18
|
+
border-collapse: collapse;
|
|
19
|
+
|
|
20
|
+
/* border */
|
|
21
|
+
|
|
22
|
+
/* depth */
|
|
23
|
+
|
|
24
|
+
/* motion */
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.table__head {
|
|
28
|
+
/* color */
|
|
29
|
+
|
|
30
|
+
/* typography */
|
|
31
|
+
|
|
32
|
+
/* size */
|
|
33
|
+
|
|
34
|
+
/* border */
|
|
35
|
+
|
|
36
|
+
/* depth */
|
|
37
|
+
|
|
38
|
+
/* motion */
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.table__row {
|
|
42
|
+
/* color */
|
|
43
|
+
|
|
44
|
+
/* typography */
|
|
45
|
+
|
|
46
|
+
/* size */
|
|
47
|
+
|
|
48
|
+
/* border */
|
|
49
|
+
|
|
50
|
+
/* depth */
|
|
51
|
+
|
|
52
|
+
/* motion */
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.table__header,
|
|
56
|
+
.table__cell {
|
|
57
|
+
/* color */
|
|
58
|
+
color: var(--table-color);
|
|
59
|
+
|
|
60
|
+
/* typography */
|
|
61
|
+
font-family: var(--table-font-family);
|
|
62
|
+
font-size: var(--table-font-size);
|
|
63
|
+
font-weight: var(--table-font-weight);
|
|
64
|
+
line-height: var(--table-line-height);
|
|
65
|
+
letter-spacing: var(--table-letter-spacing);
|
|
66
|
+
text-align: left;
|
|
67
|
+
vertical-align: top;
|
|
68
|
+
|
|
69
|
+
/* size */
|
|
70
|
+
padding-block: var(--table-row-gap);
|
|
71
|
+
padding-inline: calc(
|
|
72
|
+
var(--table-column-gap) / 2
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
/* border */
|
|
76
|
+
|
|
77
|
+
/* depth */
|
|
78
|
+
|
|
79
|
+
/* motion */
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.table__header:first-child,
|
|
83
|
+
.table__cell:first-child {
|
|
84
|
+
/* color */
|
|
85
|
+
|
|
86
|
+
/* typography */
|
|
87
|
+
|
|
88
|
+
/* size */
|
|
89
|
+
padding-left: var(--padding-table-horz);
|
|
90
|
+
|
|
91
|
+
/* border */
|
|
92
|
+
|
|
93
|
+
/* depth */
|
|
94
|
+
|
|
95
|
+
/* motion */
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.table__header:last-child,
|
|
99
|
+
.table__cell:last-child {
|
|
100
|
+
/* color */
|
|
101
|
+
|
|
102
|
+
/* typography */
|
|
103
|
+
|
|
104
|
+
/* size */
|
|
105
|
+
padding-right: var(--padding-table-horz);
|
|
106
|
+
|
|
107
|
+
/* border */
|
|
108
|
+
|
|
109
|
+
/* depth */
|
|
110
|
+
|
|
111
|
+
/* motion */
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.table__header {
|
|
115
|
+
/* color */
|
|
116
|
+
|
|
117
|
+
/* typography */
|
|
118
|
+
font-weight: var(--table-header-font-weight);
|
|
119
|
+
|
|
120
|
+
/* size */
|
|
121
|
+
padding-top: var(--padding-table-vert);
|
|
122
|
+
|
|
123
|
+
/* border */
|
|
124
|
+
border-bottom:
|
|
125
|
+
var(--size-border-width-icon)
|
|
126
|
+
solid
|
|
127
|
+
var(--table-border-color);
|
|
128
|
+
|
|
129
|
+
/* depth */
|
|
130
|
+
|
|
131
|
+
/* motion */
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.table__cell {
|
|
135
|
+
/* color */
|
|
136
|
+
|
|
137
|
+
/* typography */
|
|
138
|
+
|
|
139
|
+
/* size */
|
|
140
|
+
|
|
141
|
+
/* border */
|
|
142
|
+
border-bottom:
|
|
143
|
+
var(--size-border-width-min)
|
|
144
|
+
solid
|
|
145
|
+
var(--table-border-color);
|
|
146
|
+
|
|
147
|
+
/* depth */
|
|
148
|
+
|
|
149
|
+
/* motion */
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.table__body
|
|
153
|
+
.table__row:last-child
|
|
154
|
+
.table__cell {
|
|
155
|
+
/* color */
|
|
156
|
+
|
|
157
|
+
/* typography */
|
|
158
|
+
|
|
159
|
+
/* size */
|
|
160
|
+
padding-bottom: var(--padding-table-vert);
|
|
161
|
+
|
|
162
|
+
/* border */
|
|
163
|
+
border-bottom: 0;
|
|
164
|
+
|
|
165
|
+
/* depth */
|
|
166
|
+
|
|
167
|
+
/* motion */
|
|
168
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './table.css';
|
|
3
|
+
export type TableColumnWidth = {
|
|
4
|
+
type: 'auto';
|
|
5
|
+
} | {
|
|
6
|
+
type: 'max';
|
|
7
|
+
} | {
|
|
8
|
+
type: 'fraction';
|
|
9
|
+
value: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'min';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'fixed';
|
|
14
|
+
value: string;
|
|
15
|
+
};
|
|
16
|
+
export interface TableColumn {
|
|
17
|
+
id: React.Key;
|
|
18
|
+
header: React.ReactNode;
|
|
19
|
+
width?: TableColumnWidth;
|
|
20
|
+
}
|
|
21
|
+
export interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {
|
|
22
|
+
columns: TableColumn[];
|
|
23
|
+
}
|
|
24
|
+
export interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {
|
|
25
|
+
}
|
|
26
|
+
export interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
27
|
+
}
|
|
28
|
+
export interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
29
|
+
}
|
|
30
|
+
declare const TableBody: React.FC<TableBodyProps>;
|
|
31
|
+
declare const TableRow: React.FC<TableRowProps>;
|
|
32
|
+
declare const TableCell: React.FC<TableCellProps>;
|
|
33
|
+
interface TableComponent extends React.FC<TableProps> {
|
|
34
|
+
Body: typeof TableBody;
|
|
35
|
+
Row: typeof TableRow;
|
|
36
|
+
Cell: typeof TableCell;
|
|
37
|
+
}
|
|
38
|
+
declare const Table: TableComponent;
|
|
39
|
+
export default Table;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import './table.css';
|
|
3
|
+
import { classnames } from '../helpers/classnames';
|
|
4
|
+
|
|
5
|
+
const getFractionTotal = (columns) => columns.reduce((total, column) => {
|
|
6
|
+
if (column.width?.type !== "fraction" || column.width.value <= 0) {
|
|
7
|
+
return total;
|
|
8
|
+
}
|
|
9
|
+
return total + column.width.value;
|
|
10
|
+
}, 0);
|
|
11
|
+
const getFractionPercentage = (value, total) => Number(
|
|
12
|
+
(value / total * 100).toFixed(6)
|
|
13
|
+
);
|
|
14
|
+
const getColumnWidth = (width, fractionTotal) => {
|
|
15
|
+
if (!width || width.type === "auto") {
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
if (width.type === "min") {
|
|
19
|
+
return "1%";
|
|
20
|
+
}
|
|
21
|
+
if (width.type === "max") {
|
|
22
|
+
return "100%";
|
|
23
|
+
}
|
|
24
|
+
if (width.type === "fixed") {
|
|
25
|
+
return width.value;
|
|
26
|
+
}
|
|
27
|
+
if (width.value <= 0 || fractionTotal <= 0) {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
return `${getFractionPercentage(
|
|
31
|
+
width.value,
|
|
32
|
+
fractionTotal
|
|
33
|
+
)}%`;
|
|
34
|
+
};
|
|
35
|
+
const TableBody = ({
|
|
36
|
+
className = "",
|
|
37
|
+
...props
|
|
38
|
+
}) => {
|
|
39
|
+
const classes = classnames(
|
|
40
|
+
"table__body",
|
|
41
|
+
className,
|
|
42
|
+
{}
|
|
43
|
+
);
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
"tbody",
|
|
46
|
+
{
|
|
47
|
+
className: classes,
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
const TableRow = ({
|
|
53
|
+
className = "",
|
|
54
|
+
...props
|
|
55
|
+
}) => {
|
|
56
|
+
const classes = classnames(
|
|
57
|
+
"table__row",
|
|
58
|
+
className,
|
|
59
|
+
{}
|
|
60
|
+
);
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"tr",
|
|
63
|
+
{
|
|
64
|
+
className: classes,
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
const TableCell = ({
|
|
70
|
+
className = "",
|
|
71
|
+
...props
|
|
72
|
+
}) => {
|
|
73
|
+
const classes = classnames(
|
|
74
|
+
"table__cell",
|
|
75
|
+
className,
|
|
76
|
+
{}
|
|
77
|
+
);
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
"td",
|
|
80
|
+
{
|
|
81
|
+
className: classes,
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
const Table = ({
|
|
87
|
+
columns,
|
|
88
|
+
className = "",
|
|
89
|
+
children,
|
|
90
|
+
...props
|
|
91
|
+
}) => {
|
|
92
|
+
const classes = classnames(
|
|
93
|
+
"table",
|
|
94
|
+
className,
|
|
95
|
+
{}
|
|
96
|
+
);
|
|
97
|
+
const fractionTotal = getFractionTotal(columns);
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
"table",
|
|
100
|
+
{
|
|
101
|
+
className: classes,
|
|
102
|
+
...props,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx("colgroup", { children: columns.map((column) => /* @__PURE__ */ jsx(
|
|
105
|
+
"col",
|
|
106
|
+
{
|
|
107
|
+
style: {
|
|
108
|
+
width: getColumnWidth(
|
|
109
|
+
column.width,
|
|
110
|
+
fractionTotal
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
column.id
|
|
115
|
+
)) }),
|
|
116
|
+
/* @__PURE__ */ jsx("thead", { className: "table__head", children: /* @__PURE__ */ jsx("tr", { className: "table__row", children: columns.map((column) => /* @__PURE__ */ jsx(
|
|
117
|
+
"th",
|
|
118
|
+
{
|
|
119
|
+
className: "table__header",
|
|
120
|
+
scope: "col",
|
|
121
|
+
children: column.header
|
|
122
|
+
},
|
|
123
|
+
column.id
|
|
124
|
+
)) }) }),
|
|
125
|
+
children
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
Table.Body = TableBody;
|
|
131
|
+
Table.Row = TableRow;
|
|
132
|
+
Table.Cell = TableCell;
|
|
133
|
+
var table_default = Table;
|
|
134
|
+
|
|
135
|
+
export { table_default as default };
|
|
136
|
+
//# sourceMappingURL=table.js.map
|
|
137
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":";;;;AA4CA,MAAM,mBAAmB,CACvB,OAAA,KAEA,QAAQ,MAAA,CAAO,CAAC,OAAO,MAAA,KAAW;AAChC,EAAA,IACE,OAAO,KAAA,EAAO,IAAA,KAAS,cACvB,MAAA,CAAO,KAAA,CAAM,SAAS,CAAA,EACtB;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA,GAAQ,OAAO,KAAA,CAAM,KAAA;AAC9B,CAAA,EAAG,CAAC,CAAA;AAEN,MAAM,qBAAA,GAAwB,CAC5B,KAAA,EACA,KAAA,KAEA,MAAA;AAAA,EAAA,CACI,KAAA,GAAQ,KAAA,GAAS,GAAA,E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AA,CAAQ,GAAA,CAAI,CAAC,MAAA,qBACZ,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YAEC,SAAA,EAAU,eAAA;AAAA,YACV,KAAA,EAAM,KAAA;AAAA,YAEL,QAAA,EAAA,MAAA,CAAO;AAAA,WAAA;AAAA,UAJH,MAAA,CAAO;AAAA,SAMf,GACH,CAAA,EACF,CAAA;AAAA,QAEC;AAAA;AAAA;AAAA,GACH;AAEJ,CAAA;AAEA,KAAA,CAAM,IAAA,GAAO,SAAA;AACb,KAAA,CAAM,GAAA,GAAM,QAAA;AACZ,KAAA,CAAM,IAAA,GAAO,SAAA;AAEb,IAAO,aAAA,GAAQ","file":"table.js","sourcesContent":["import React from 'react';\n\nimport './table.css';\nimport { classnames } from '../helpers/classnames';\n\nexport type TableColumnWidth =\n | {\n type: 'auto';\n }\n | {\n type: 'max';\n }\n | {\n type: 'fraction';\n value: number;\n }\n | {\n type: 'min';\n }\n | {\n type: 'fixed';\n value: string;\n };\n\nexport interface TableColumn {\n id: React.Key;\n header: React.ReactNode;\n width?: TableColumnWidth;\n}\n\nexport interface TableProps\n extends React.TableHTMLAttributes<HTMLTableElement> {\n columns: TableColumn[];\n}\n\nexport interface TableBodyProps\n extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport interface TableRowProps\n extends React.HTMLAttributes<HTMLTableRowElement> {}\n\nexport interface TableCellProps\n extends React.TdHTMLAttributes<HTMLTableCellElement> {}\n\nconst getFractionTotal = (\n columns: TableColumn[],\n) =>\n columns.reduce((total, column) => {\n if (\n column.width?.type !== 'fraction' ||\n column.width.value <= 0\n ) {\n return total;\n }\n\n return total + column.width.value;\n }, 0);\n\nconst getFractionPercentage = (\n value: number,\n total: number,\n) =>\n Number(\n ((value / total) * 100).toFixed(6),\n );\n\nconst getColumnWidth = (\n width: TableColumnWidth | undefined,\n fractionTotal: number,\n): React.CSSProperties['width'] => {\n if (!width || width.type === 'auto') {\n return undefined;\n }\n\n if (width.type === 'min') {\n return '1%';\n }\n\n if (width.type === 'max') {\n return '100%';\n }\n\n if (width.type === 'fixed') {\n return width.value;\n }\n\n if (\n width.value <= 0 ||\n fractionTotal <= 0\n ) {\n return undefined;\n }\n\n return `${getFractionPercentage(\n width.value,\n fractionTotal,\n )}%`;\n};\n\nconst TableBody: React.FC<\n TableBodyProps\n> = ({\n className = '',\n ...props\n}) => {\n const classes = classnames(\n 'table__body',\n className,\n {},\n );\n\n return (\n <tbody\n className={classes}\n {...props}\n />\n );\n};\n\nconst TableRow: React.FC<\n TableRowProps\n> = ({\n className = '',\n ...props\n}) => {\n const classes = classnames(\n 'table__row',\n className,\n {},\n );\n\n return (\n <tr\n className={classes}\n {...props}\n />\n );\n};\n\nconst TableCell: React.FC<\n TableCellProps\n> = ({\n className = '',\n ...props\n}) => {\n const classes = classnames(\n 'table__cell',\n className,\n {},\n );\n\n return (\n <td\n className={classes}\n {...props}\n />\n );\n};\n\ninterface TableComponent\n extends React.FC<TableProps> {\n Body: typeof TableBody;\n Row: typeof TableRow;\n Cell: typeof TableCell;\n}\n\nconst Table: TableComponent = ({\n columns,\n className = '',\n children,\n ...props\n}) => {\n const classes = classnames(\n 'table',\n className,\n {},\n );\n\n const fractionTotal =\n getFractionTotal(columns);\n\n return (\n <table\n className={classes}\n {...props}\n >\n <colgroup>\n {columns.map((column) => (\n <col\n key={column.id}\n style={{\n width: getColumnWidth(\n column.width,\n fractionTotal,\n ),\n }}\n />\n ))}\n </colgroup>\n\n <thead className=\"table__head\">\n <tr className=\"table__row\">\n {columns.map((column) => (\n <th\n key={column.id}\n className=\"table__header\"\n scope=\"col\"\n >\n {column.header}\n </th>\n ))}\n </tr>\n </thead>\n\n {children}\n </table>\n );\n};\n\nTable.Body = TableBody;\nTable.Row = TableRow;\nTable.Cell = TableCell;\n\nexport default Table;\n"]}
|
package/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ var courseOutline = require('./components/course-outline');
|
|
|
33
33
|
var calendarMonth = require('./components/calendar-month');
|
|
34
34
|
var flipList = require('./components/flip-list');
|
|
35
35
|
var avatarUpload = require('./components/avatar-upload');
|
|
36
|
+
var table = require('./components/table');
|
|
36
37
|
var header = require('./patterns/header');
|
|
37
38
|
var footer = require('./patterns/footer');
|
|
38
39
|
var screenHeader = require('./patterns/screen-header');
|
|
@@ -79,6 +80,7 @@ var discussion__default = /*#__PURE__*/_interopDefault(discussion);
|
|
|
79
80
|
var courseOutline__default = /*#__PURE__*/_interopDefault(courseOutline);
|
|
80
81
|
var flipList__default = /*#__PURE__*/_interopDefault(flipList);
|
|
81
82
|
var avatarUpload__default = /*#__PURE__*/_interopDefault(avatarUpload);
|
|
83
|
+
var table__default = /*#__PURE__*/_interopDefault(table);
|
|
82
84
|
var header__default = /*#__PURE__*/_interopDefault(header);
|
|
83
85
|
var footer__default = /*#__PURE__*/_interopDefault(footer);
|
|
84
86
|
var screenHeader__default = /*#__PURE__*/_interopDefault(screenHeader);
|
|
@@ -229,6 +231,10 @@ Object.defineProperty(exports, "AvatarUpload", {
|
|
|
229
231
|
enumerable: true,
|
|
230
232
|
get: function () { return avatarUpload__default.default; }
|
|
231
233
|
});
|
|
234
|
+
Object.defineProperty(exports, "Table", {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
get: function () { return table__default.default; }
|
|
237
|
+
});
|
|
232
238
|
Object.defineProperty(exports, "Header", {
|
|
233
239
|
enumerable: true,
|
|
234
240
|
get: function () { return header__default.default; }
|
package/index.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ export { default as FlipList } from './components/flip-list';
|
|
|
68
68
|
export type { FlipListItem, FlipListProps, } from './components/flip-list';
|
|
69
69
|
export { default as AvatarUpload } from './components/avatar-upload';
|
|
70
70
|
export type { AvatarUploadProps, } from './components/avatar-upload';
|
|
71
|
+
export { default as Table } from './components/table';
|
|
72
|
+
export type { TableBodyProps, TableCellProps, TableColumn, TableColumnWidth, TableProps, TableRowProps } from './components/table';
|
|
71
73
|
export { default as Header } from './patterns/header';
|
|
72
74
|
export type { HeaderProps } from './patterns/header';
|
|
73
75
|
export { default as Footer } from './patterns/footer';
|
package/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export { default as CourseOutline } from './components/course-outline';
|
|
|
31
31
|
export * from './components/calendar-month';
|
|
32
32
|
export { default as FlipList } from './components/flip-list';
|
|
33
33
|
export { default as AvatarUpload } from './components/avatar-upload';
|
|
34
|
+
export { default as Table } from './components/table';
|
|
34
35
|
export { default as Header } from './patterns/header';
|
|
35
36
|
export { default as Footer } from './patterns/footer';
|
|
36
37
|
export { default as ScreenHeader } from './patterns/screen-header';
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -4893,6 +4893,24 @@
|
|
|
4893
4893
|
/* motion */
|
|
4894
4894
|
}
|
|
4895
4895
|
|
|
4896
|
+
.surface--secondary .progressbar {
|
|
4897
|
+
/* color */
|
|
4898
|
+
--progressbar-track-bg: color-mix(in srgb, var(--color-primary-1) 30%, transparent);
|
|
4899
|
+
--progressbar-buffered-bg: color-mix(in srgb, var(--color-primary-1) 40%, transparent);
|
|
4900
|
+
--progressbar-value-bg: var(--color-primary-1);
|
|
4901
|
+
--progressbar-label-color: var(--color-text-primary-1);
|
|
4902
|
+
|
|
4903
|
+
/* typography */
|
|
4904
|
+
|
|
4905
|
+
/* size */
|
|
4906
|
+
|
|
4907
|
+
/* border */
|
|
4908
|
+
|
|
4909
|
+
/* depth */
|
|
4910
|
+
|
|
4911
|
+
/* motion */
|
|
4912
|
+
}
|
|
4913
|
+
|
|
4896
4914
|
.surface--tertiary {
|
|
4897
4915
|
/* color */
|
|
4898
4916
|
--surface-bg: var(--color-bg-container-tertiary);
|
|
@@ -4927,12 +4945,10 @@
|
|
|
4927
4945
|
/* motion */
|
|
4928
4946
|
}
|
|
4929
4947
|
|
|
4930
|
-
.surface--
|
|
4948
|
+
.surface--tertiary .calendar-month {
|
|
4931
4949
|
/* color */
|
|
4932
|
-
--
|
|
4933
|
-
--
|
|
4934
|
-
--progressbar-value-bg: var(--color-primary-1);
|
|
4935
|
-
--progressbar-label-color: var(--color-text-primary-1);
|
|
4950
|
+
--calendar-month-marked-bg: var(--color-primary-1);
|
|
4951
|
+
--calendar-month-marked-color: var(--color-text-primary-1);
|
|
4936
4952
|
|
|
4937
4953
|
/* typography */
|
|
4938
4954
|
|
|
@@ -4964,6 +4980,176 @@
|
|
|
4964
4980
|
/* motion */
|
|
4965
4981
|
}
|
|
4966
4982
|
|
|
4983
|
+
/* src/components/table/table.css */
|
|
4984
|
+
.table {
|
|
4985
|
+
/* color */
|
|
4986
|
+
--table-color: var(--color-text);
|
|
4987
|
+
--table-border-color: var(--color-line-grid);
|
|
4988
|
+
|
|
4989
|
+
/* typography */
|
|
4990
|
+
--table-font-family: var(--font-h4-family);
|
|
4991
|
+
--table-font-size: var(--font-h4);
|
|
4992
|
+
--table-line-height: var(--font-h4-line);
|
|
4993
|
+
--table-letter-spacing: var(--font-h4-letter-spacing);
|
|
4994
|
+
--table-font-weight: var(--font-body-weight);
|
|
4995
|
+
--table-header-font-weight: var(--font-h4-weight);
|
|
4996
|
+
|
|
4997
|
+
/* size */
|
|
4998
|
+
--table-column-gap: var(--margin-item);
|
|
4999
|
+
--table-row-gap: var(--font-h4-margin);
|
|
5000
|
+
width: 100%;
|
|
5001
|
+
border-collapse: collapse;
|
|
5002
|
+
|
|
5003
|
+
/* border */
|
|
5004
|
+
|
|
5005
|
+
/* depth */
|
|
5006
|
+
|
|
5007
|
+
/* motion */
|
|
5008
|
+
}
|
|
5009
|
+
|
|
5010
|
+
.table__head {
|
|
5011
|
+
/* color */
|
|
5012
|
+
|
|
5013
|
+
/* typography */
|
|
5014
|
+
|
|
5015
|
+
/* size */
|
|
5016
|
+
|
|
5017
|
+
/* border */
|
|
5018
|
+
|
|
5019
|
+
/* depth */
|
|
5020
|
+
|
|
5021
|
+
/* motion */
|
|
5022
|
+
}
|
|
5023
|
+
|
|
5024
|
+
.table__row {
|
|
5025
|
+
/* color */
|
|
5026
|
+
|
|
5027
|
+
/* typography */
|
|
5028
|
+
|
|
5029
|
+
/* size */
|
|
5030
|
+
|
|
5031
|
+
/* border */
|
|
5032
|
+
|
|
5033
|
+
/* depth */
|
|
5034
|
+
|
|
5035
|
+
/* motion */
|
|
5036
|
+
}
|
|
5037
|
+
|
|
5038
|
+
.table__header,
|
|
5039
|
+
.table__cell {
|
|
5040
|
+
/* color */
|
|
5041
|
+
color: var(--table-color);
|
|
5042
|
+
|
|
5043
|
+
/* typography */
|
|
5044
|
+
font-family: var(--table-font-family);
|
|
5045
|
+
font-size: var(--table-font-size);
|
|
5046
|
+
font-weight: var(--table-font-weight);
|
|
5047
|
+
line-height: var(--table-line-height);
|
|
5048
|
+
letter-spacing: var(--table-letter-spacing);
|
|
5049
|
+
text-align: left;
|
|
5050
|
+
vertical-align: top;
|
|
5051
|
+
|
|
5052
|
+
/* size */
|
|
5053
|
+
padding-block: var(--table-row-gap);
|
|
5054
|
+
padding-inline: calc(
|
|
5055
|
+
var(--table-column-gap) / 2
|
|
5056
|
+
);
|
|
5057
|
+
|
|
5058
|
+
/* border */
|
|
5059
|
+
|
|
5060
|
+
/* depth */
|
|
5061
|
+
|
|
5062
|
+
/* motion */
|
|
5063
|
+
}
|
|
5064
|
+
|
|
5065
|
+
.table__header:first-child,
|
|
5066
|
+
.table__cell:first-child {
|
|
5067
|
+
/* color */
|
|
5068
|
+
|
|
5069
|
+
/* typography */
|
|
5070
|
+
|
|
5071
|
+
/* size */
|
|
5072
|
+
padding-left: var(--padding-table-horz);
|
|
5073
|
+
|
|
5074
|
+
/* border */
|
|
5075
|
+
|
|
5076
|
+
/* depth */
|
|
5077
|
+
|
|
5078
|
+
/* motion */
|
|
5079
|
+
}
|
|
5080
|
+
|
|
5081
|
+
.table__header:last-child,
|
|
5082
|
+
.table__cell:last-child {
|
|
5083
|
+
/* color */
|
|
5084
|
+
|
|
5085
|
+
/* typography */
|
|
5086
|
+
|
|
5087
|
+
/* size */
|
|
5088
|
+
padding-right: var(--padding-table-horz);
|
|
5089
|
+
|
|
5090
|
+
/* border */
|
|
5091
|
+
|
|
5092
|
+
/* depth */
|
|
5093
|
+
|
|
5094
|
+
/* motion */
|
|
5095
|
+
}
|
|
5096
|
+
|
|
5097
|
+
.table__header {
|
|
5098
|
+
/* color */
|
|
5099
|
+
|
|
5100
|
+
/* typography */
|
|
5101
|
+
font-weight: var(--table-header-font-weight);
|
|
5102
|
+
|
|
5103
|
+
/* size */
|
|
5104
|
+
padding-top: var(--padding-table-vert);
|
|
5105
|
+
|
|
5106
|
+
/* border */
|
|
5107
|
+
border-bottom:
|
|
5108
|
+
var(--size-border-width-icon)
|
|
5109
|
+
solid
|
|
5110
|
+
var(--table-border-color);
|
|
5111
|
+
|
|
5112
|
+
/* depth */
|
|
5113
|
+
|
|
5114
|
+
/* motion */
|
|
5115
|
+
}
|
|
5116
|
+
|
|
5117
|
+
.table__cell {
|
|
5118
|
+
/* color */
|
|
5119
|
+
|
|
5120
|
+
/* typography */
|
|
5121
|
+
|
|
5122
|
+
/* size */
|
|
5123
|
+
|
|
5124
|
+
/* border */
|
|
5125
|
+
border-bottom:
|
|
5126
|
+
var(--size-border-width-min)
|
|
5127
|
+
solid
|
|
5128
|
+
var(--table-border-color);
|
|
5129
|
+
|
|
5130
|
+
/* depth */
|
|
5131
|
+
|
|
5132
|
+
/* motion */
|
|
5133
|
+
}
|
|
5134
|
+
|
|
5135
|
+
.table__body
|
|
5136
|
+
.table__row:last-child
|
|
5137
|
+
.table__cell {
|
|
5138
|
+
/* color */
|
|
5139
|
+
|
|
5140
|
+
/* typography */
|
|
5141
|
+
|
|
5142
|
+
/* size */
|
|
5143
|
+
padding-bottom: var(--padding-table-vert);
|
|
5144
|
+
|
|
5145
|
+
/* border */
|
|
5146
|
+
border-bottom: 0;
|
|
5147
|
+
|
|
5148
|
+
/* depth */
|
|
5149
|
+
|
|
5150
|
+
/* motion */
|
|
5151
|
+
}
|
|
5152
|
+
|
|
4967
5153
|
/* src/components/tabs/tabs.css */
|
|
4968
5154
|
.tabs {
|
|
4969
5155
|
/* color */
|