@workday/canvas-kit-react 11.0.0-alpha.707-next.0 → 11.0.0-alpha.710-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/table/index.d.ts +0 -1
- package/dist/commonjs/table/index.d.ts.map +1 -1
- package/dist/commonjs/table/index.js +0 -1
- package/dist/commonjs/table/lib/Table.d.ts +204 -8
- package/dist/commonjs/table/lib/Table.d.ts.map +1 -1
- package/dist/commonjs/table/lib/Table.js +226 -43
- package/dist/commonjs/table/lib/TableBody.d.ts +2 -0
- package/dist/commonjs/table/lib/TableBody.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableBody.js +19 -0
- package/dist/commonjs/table/lib/TableCaption.d.ts +2 -0
- package/dist/commonjs/table/lib/TableCaption.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableCaption.js +20 -0
- package/dist/commonjs/table/lib/TableCell.d.ts +2 -0
- package/dist/commonjs/table/lib/TableCell.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableCell.js +20 -0
- package/dist/commonjs/table/lib/TableFooter.d.ts +2 -0
- package/dist/commonjs/table/lib/TableFooter.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableFooter.js +19 -0
- package/dist/commonjs/table/lib/TableHead.d.ts +2 -0
- package/dist/commonjs/table/lib/TableHead.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableHead.js +20 -0
- package/dist/commonjs/table/lib/TableHeader.d.ts +2 -0
- package/dist/commonjs/table/lib/TableHeader.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableHeader.js +20 -0
- package/dist/commonjs/table/lib/TableRow.d.ts +1 -33
- package/dist/commonjs/table/lib/TableRow.d.ts.map +1 -1
- package/dist/commonjs/table/lib/TableRow.js +20 -197
- package/dist/es6/table/index.d.ts +0 -1
- package/dist/es6/table/index.d.ts.map +1 -1
- package/dist/es6/table/index.js +0 -1
- package/dist/es6/table/lib/Table.d.ts +204 -8
- package/dist/es6/table/lib/Table.d.ts.map +1 -1
- package/dist/es6/table/lib/Table.js +225 -22
- package/dist/es6/table/lib/TableBody.d.ts +2 -0
- package/dist/es6/table/lib/TableBody.d.ts.map +1 -0
- package/dist/es6/table/lib/TableBody.js +13 -0
- package/dist/es6/table/lib/TableCaption.d.ts +2 -0
- package/dist/es6/table/lib/TableCaption.d.ts.map +1 -0
- package/dist/es6/table/lib/TableCaption.js +14 -0
- package/dist/es6/table/lib/TableCell.d.ts +2 -0
- package/dist/es6/table/lib/TableCell.d.ts.map +1 -0
- package/dist/es6/table/lib/TableCell.js +14 -0
- package/dist/es6/table/lib/TableFooter.d.ts +2 -0
- package/dist/es6/table/lib/TableFooter.d.ts.map +1 -0
- package/dist/es6/table/lib/TableFooter.js +13 -0
- package/dist/es6/table/lib/TableHead.d.ts +2 -0
- package/dist/es6/table/lib/TableHead.d.ts.map +1 -0
- package/dist/es6/table/lib/TableHead.js +14 -0
- package/dist/es6/table/lib/TableHeader.d.ts +2 -0
- package/dist/es6/table/lib/TableHeader.d.ts.map +1 -0
- package/dist/es6/table/lib/TableHeader.js +14 -0
- package/dist/es6/table/lib/TableRow.d.ts +1 -33
- package/dist/es6/table/lib/TableRow.d.ts.map +1 -1
- package/dist/es6/table/lib/TableRow.js +19 -177
- package/package.json +4 -5
- package/table/LICENSE +51 -0
- package/table/index.ts +0 -1
- package/table/lib/Table.tsx +235 -22
- package/table/lib/TableBody.tsx +42 -0
- package/table/lib/TableCaption.tsx +25 -0
- package/table/lib/TableCell.tsx +31 -0
- package/table/lib/TableFooter.tsx +22 -0
- package/table/lib/TableHead.tsx +33 -0
- package/table/lib/TableHeader.tsx +31 -0
- package/table/lib/TableRow.tsx +33 -212
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TableHead = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
9
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
10
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
11
|
+
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
12
|
+
const tableHeadStencil = canvas_kit_styling_1.createStencil({
|
|
13
|
+
base: { name: "sv3y8l", styles: "display:grid;background-color:var(--cnvs-base-palette-soap-100, rgba(246,247,248,1));min-height:3rem;box-sizing:border-box;th {&:first-of-type{border-inline-start:none;}&:last-of-type{border-inline-end:none;}}" }
|
|
14
|
+
}, "table-head");
|
|
15
|
+
exports.TableHead = common_1.createComponent('thead')({
|
|
16
|
+
displayName: 'Table.Head',
|
|
17
|
+
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
18
|
+
return (react_1.default.createElement(Element, Object.assign({ ref: ref }, layout_1.mergeStyles(elemProps, tableHeadStencil())), children));
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../../table/lib/TableHeader.tsx"],"names":[],"mappings":"AAqBA,eAAO,MAAM,WAAW,qMAStB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TableHeader = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
9
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
10
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
11
|
+
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
12
|
+
const tableHeaderStencil = canvas_kit_styling_1.createStencil({
|
|
13
|
+
base: { name: "mt03mc", styles: "display:grid;align-items:center;background-color:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));border-bottom:0.0625rem solid var(--cnvs-base-palette-soap-400, rgba(223,226,230,1));justify-content:start;min-height:3.5rem;padding:var(--cnvs-sys-space-x2, calc(0.25rem * 2)) var(--cnvs-sys-space-x4, calc(0.25rem * 4));word-break:break-word;font-weight:var(--cnvs-sys-font-weight-medium, 500);box-sizing:border-box;" }
|
|
14
|
+
}, "table-header");
|
|
15
|
+
exports.TableHeader = common_1.createComponent('th')({
|
|
16
|
+
displayName: 'Table.Header',
|
|
17
|
+
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
18
|
+
return (react_1.default.createElement(Element, Object.assign({ ref: ref }, layout_1.mergeStyles(elemProps, tableHeaderStencil())), children));
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { StyledType } from '@workday/canvas-kit-react/common';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version. Please use [`Table`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) in Preview instead.
|
|
5
|
-
*/
|
|
6
|
-
export declare enum TableRowState {
|
|
7
|
-
Error = 0,
|
|
8
|
-
Alert = 1,
|
|
9
|
-
InputError = 2,
|
|
10
|
-
InputAlert = 3,
|
|
11
|
-
Hover = 4,
|
|
12
|
-
Selected = 5
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version. Please use [`Table`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) in Preview instead.
|
|
16
|
-
*/
|
|
17
|
-
export interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
18
|
-
/**
|
|
19
|
-
* The state of the TableRow. Accepts `Error`, `Alert`, `InputError`, `InputAlert`, `Hover`, or `Selected`.
|
|
20
|
-
*/
|
|
21
|
-
state?: TableRowState;
|
|
22
|
-
/**
|
|
23
|
-
* If true, render the TableRow with header elements.
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
header?: boolean;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version. Please use [`Table`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) in Preview instead.
|
|
30
|
-
*/
|
|
31
|
-
export declare const TableRow: import("@workday/canvas-kit-react/common").ElementComponent<"tr", TableRowProps & StyledType> & {
|
|
32
|
-
State: typeof TableRowState;
|
|
33
|
-
};
|
|
1
|
+
export declare const TableRow: import("@workday/canvas-kit-react/common").ElementComponent<"tr", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").GridStyleProps>;
|
|
34
2
|
//# sourceMappingURL=TableRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../../../table/lib/TableRow.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../../../table/lib/TableRow.tsx"],"names":[],"mappings":"AAiBA,eAAO,MAAM,QAAQ,qMAuBnB,CAAC"}
|
|
@@ -1,206 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
4
|
};
|
|
24
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.TableRow =
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const polished_1 = require("polished");
|
|
29
|
-
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
6
|
+
exports.TableRow = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
30
9
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
TableRowState[TableRowState["Error"] = 0] = "Error";
|
|
38
|
-
TableRowState[TableRowState["Alert"] = 1] = "Alert";
|
|
39
|
-
TableRowState[TableRowState["InputError"] = 2] = "InputError";
|
|
40
|
-
TableRowState[TableRowState["InputAlert"] = 3] = "InputAlert";
|
|
41
|
-
TableRowState[TableRowState["Hover"] = 4] = "Hover";
|
|
42
|
-
TableRowState[TableRowState["Selected"] = 5] = "Selected";
|
|
43
|
-
})(TableRowState = exports.TableRowState || (exports.TableRowState = {}));
|
|
44
|
-
const errorColor = tokens_1.statusColors.error;
|
|
45
|
-
const errorColorLight = tokens_1.colors.cinnamon200;
|
|
46
|
-
const alertColor = tokens_1.statusColors.warning;
|
|
47
|
-
const alertColorLight = tokens_1.colors.cantaloupe200;
|
|
48
|
-
function makeColoredRow(_bgColor, _borderColor) {
|
|
49
|
-
return {
|
|
50
|
-
backgroundColor: _bgColor,
|
|
51
|
-
position: 'relative',
|
|
52
|
-
// Bottom border
|
|
53
|
-
'&:before, &:after': {
|
|
54
|
-
position: 'absolute',
|
|
55
|
-
left: 0,
|
|
56
|
-
top: -Table_1.borderWidth,
|
|
57
|
-
content: '""',
|
|
58
|
-
width: `calc(100% + ${Table_1.borderWidth}px)`,
|
|
59
|
-
height: Table_1.borderWidth,
|
|
60
|
-
backgroundColor: _borderColor,
|
|
61
|
-
},
|
|
62
|
-
'&:after': {
|
|
63
|
-
top: 'auto',
|
|
64
|
-
bottom: -Table_1.borderWidth,
|
|
65
|
-
},
|
|
66
|
-
'&:first-of-type': {
|
|
67
|
-
boxShadow: `inset ${Table_1.borderWidth}px 0 0 ${_borderColor}`,
|
|
68
|
-
},
|
|
69
|
-
'&:last-child': {
|
|
70
|
-
boxShadow: `inset -${Table_1.borderWidth}px 0 0 ${_borderColor}`,
|
|
71
|
-
'&:before, &:after': {
|
|
72
|
-
width: '100%',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function makeColoredRowStyle(_bgColor, _borderColor) {
|
|
78
|
-
const lightenedBg = polished_1.rgba(_bgColor, 0.2);
|
|
79
|
-
return {
|
|
80
|
-
'th, td': [
|
|
81
|
-
makeColoredRow(lightenedBg, _bgColor),
|
|
82
|
-
{
|
|
83
|
-
borderLeftColor: _borderColor,
|
|
84
|
-
borderRightColor: _borderColor,
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
'&:hover': {
|
|
88
|
-
'th, td': {
|
|
89
|
-
backgroundColor: lightenedBg,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function makeBorderlessStyle(_bgColor) {
|
|
95
|
-
return {
|
|
96
|
-
'th, td': {
|
|
97
|
-
backgroundColor: polished_1.rgba(_bgColor, 0.2),
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
const StyledTableRow = styled_1.default('tr')({
|
|
102
|
-
'th, td': {
|
|
103
|
-
backgroundColor: tokens_1.colors.frenchVanilla100,
|
|
104
|
-
padding: `${tokens_1.space.xs} ${tokens_1.space.xxs}`,
|
|
105
|
-
fontSize: 13,
|
|
106
|
-
borderRight: Table_1.cellBorder,
|
|
107
|
-
borderBottom: Table_1.cellBorder,
|
|
108
|
-
height: `calc(${tokens_1.space.xl} + ${tokens_1.space.xxs})`,
|
|
109
|
-
boxSizing: 'border-box',
|
|
110
|
-
transition: 'background-color 0.2s',
|
|
111
|
-
},
|
|
112
|
-
td: {
|
|
113
|
-
'&:last-child': {
|
|
114
|
-
borderRight: 'none',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
th: {
|
|
118
|
-
height: tokens_1.space.xxl,
|
|
119
|
-
'&:last-child': {
|
|
120
|
-
borderRight: 'none',
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
'&:last-child': {
|
|
124
|
-
'th, td': {
|
|
125
|
-
borderBottom: 'none',
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
}, ({ header }) => header && {
|
|
129
|
-
'&:last-child': {
|
|
130
|
-
'th, td': {
|
|
131
|
-
borderBottom: '1px solid transparent',
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
'th, td': {
|
|
135
|
-
position: 'relative',
|
|
136
|
-
backgroundColor: tokens_1.colors.frenchVanilla100,
|
|
137
|
-
verticalAlign: 'middle',
|
|
138
|
-
'&:after': {
|
|
139
|
-
position: 'absolute',
|
|
140
|
-
left: 0,
|
|
141
|
-
bottom: -Table_1.borderWidth,
|
|
142
|
-
content: '""',
|
|
143
|
-
width: `calc(100% + ${Table_1.borderWidth}px)`,
|
|
144
|
-
height: Table_1.borderWidth,
|
|
145
|
-
backgroundColor: Table_1.borderColor,
|
|
146
|
-
},
|
|
147
|
-
'&:last-child': {
|
|
148
|
-
'&:after': {
|
|
149
|
-
width: '100%',
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
}, ({ state }) => {
|
|
154
|
-
switch (state) {
|
|
155
|
-
case TableRowState.InputError:
|
|
156
|
-
return makeBorderlessStyle(errorColor);
|
|
157
|
-
case TableRowState.Error:
|
|
158
|
-
return makeColoredRowStyle(errorColor, errorColorLight);
|
|
159
|
-
case TableRowState.InputAlert:
|
|
160
|
-
return makeBorderlessStyle(alertColor);
|
|
161
|
-
case TableRowState.Alert:
|
|
162
|
-
return makeColoredRowStyle(alertColor, alertColorLight);
|
|
163
|
-
case TableRowState.Selected:
|
|
164
|
-
return {
|
|
165
|
-
'th, td': [
|
|
166
|
-
makeColoredRow(tokens_1.colors.blueberry100, tokens_1.colors.blueberry500),
|
|
167
|
-
{
|
|
168
|
-
'&:after': {
|
|
169
|
-
zIndex: 2,
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
],
|
|
173
|
-
};
|
|
174
|
-
default:
|
|
175
|
-
return {
|
|
176
|
-
'&:hover': {
|
|
177
|
-
'th, td': {
|
|
178
|
-
backgroundColor: tokens_1.colors.soap300,
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
'&:focus': {
|
|
182
|
-
outline: 'none',
|
|
183
|
-
'th, td': [
|
|
184
|
-
makeColoredRow(tokens_1.colors.blueberry100, tokens_1.colors.blueberry500),
|
|
185
|
-
{
|
|
186
|
-
'&:after': {
|
|
187
|
-
zIndex: 2,
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
/**
|
|
196
|
-
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version. Please use [`Table`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) in Preview instead.
|
|
197
|
-
*/
|
|
10
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
11
|
+
const childrenVars = canvas_kit_styling_1.createVars({ id: "cnvs-children", args: ["cellNumber"] });
|
|
12
|
+
// Styles for rows including dynamic sizing for amount of cells within a row
|
|
13
|
+
const tableRowStencil = canvas_kit_styling_1.createStencil({
|
|
14
|
+
base: { name: "s9e95c", styles: "display:grid;grid-auto-flow:column;grid-template-columns:repeat(var(--cnvs-children-cellNumber), minmax(10rem, 1fr));box-sizing:border-box;" }
|
|
15
|
+
}, "table-row");
|
|
198
16
|
exports.TableRow = common_1.createComponent('tr')({
|
|
199
|
-
displayName: '
|
|
200
|
-
Component: ({
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
17
|
+
displayName: 'Table.Row',
|
|
18
|
+
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
19
|
+
// This calculates the amount of valid React children cells within the row and will update the gridTemplateColumns style property with that amount of cells within the row
|
|
20
|
+
const validChildren = (children) => {
|
|
21
|
+
return react_1.default.Children.toArray(children).filter(child => react_1.default.isValidElement(child));
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* This is the calculated amount of valid React children
|
|
25
|
+
*/
|
|
26
|
+
const childrenArray = validChildren(children).length;
|
|
27
|
+
return (react_1.default.createElement(Element, Object.assign({ ref: ref }, layout_1.mergeStyles(elemProps, [tableRowStencil(), { [childrenVars.cellNumber]: childrenArray }])), children));
|
|
205
28
|
},
|
|
206
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../table/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../table/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/dist/es6/table/index.js
CHANGED
|
@@ -1,11 +1,207 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare const borderWidth = 1;
|
|
3
|
-
export declare const borderColor: string;
|
|
4
|
-
export declare const cellBorder: string;
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
* `Table` is a simple styled compound component that renders a [table](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table) element. It is used to present information in a two-dimensional table comprised of rows and columns of cells containing data.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* ```tsx
|
|
6
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
7
|
+
|
|
8
|
+
export default function App() {
|
|
9
|
+
return (
|
|
10
|
+
<Table>
|
|
11
|
+
<Table.Caption>Table Caption</Table.Caption>
|
|
12
|
+
<Table.Head>
|
|
13
|
+
<Table.Row>
|
|
14
|
+
<Table.Header>Table Header</Table.Header>
|
|
15
|
+
<Table.Header>Table Header</Table.Header>
|
|
16
|
+
</Table.Row>
|
|
17
|
+
</Table.Head>
|
|
18
|
+
<Table.Body>
|
|
19
|
+
<Table.Row>
|
|
20
|
+
<Table.Header>Table Header</Table.Header>
|
|
21
|
+
<Table.Header>Table Header</Table.Header>
|
|
22
|
+
</Table.Row>
|
|
23
|
+
<Table.Row>
|
|
24
|
+
<Table.Header>Table Header</Table.Header>
|
|
25
|
+
<Table.Cell>Table Data Cell</Table.Cell>
|
|
26
|
+
</Table.Row>
|
|
27
|
+
<Table.Row>
|
|
28
|
+
<Table.Header>Table Header</Table.Header>
|
|
29
|
+
<Table.Cell>Table Data Cell</Table.Cell>
|
|
30
|
+
</Table.Row>
|
|
31
|
+
</Table.Body>
|
|
32
|
+
<Table.Footer>
|
|
33
|
+
<Table.Row>
|
|
34
|
+
<Table.Header>Table Header</Table.Header>
|
|
35
|
+
<Table.Cell>Table Data Cell</Table.Cell>
|
|
36
|
+
</Table.Row>
|
|
37
|
+
</Table.Footer>
|
|
38
|
+
</Table>
|
|
39
|
+
);
|
|
10
40
|
}
|
|
41
|
+
```
|
|
42
|
+
*/
|
|
43
|
+
export declare const Table: import("@workday/canvas-kit-react/common").ElementComponent<"table", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").GridStyleProps> & {
|
|
44
|
+
/**
|
|
45
|
+
* `Table.Caption` renders a [caption](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption) element.
|
|
46
|
+
*
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
50
|
+
|
|
51
|
+
export default function App() {
|
|
52
|
+
return (
|
|
53
|
+
<Table>
|
|
54
|
+
<Table.Caption>Table Caption</Table.Caption>
|
|
55
|
+
<Table.Body>
|
|
56
|
+
<Table.Row>
|
|
57
|
+
<Table.Header>Table Header</Table.Header>
|
|
58
|
+
<Table.Cell>Table Cell</Table.Cell>
|
|
59
|
+
</Table.Row>
|
|
60
|
+
</Table.Body>
|
|
61
|
+
</Table>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
*/
|
|
66
|
+
Caption: import("@workday/canvas-kit-react/common").ElementComponent<"caption", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").FlexStyleProps>;
|
|
67
|
+
/**
|
|
68
|
+
* `Table.Head` renders a [thead](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead) element.
|
|
69
|
+
*
|
|
70
|
+
*
|
|
71
|
+
* ```tsx
|
|
72
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
73
|
+
|
|
74
|
+
export default function App() {
|
|
75
|
+
return (
|
|
76
|
+
<Table>
|
|
77
|
+
<Table.Head>
|
|
78
|
+
<Table.Row>
|
|
79
|
+
<Table.Header>Table Header</Table.Header>
|
|
80
|
+
<Table.Cell>Table Cell</Table.Cell>
|
|
81
|
+
</Table.Row>
|
|
82
|
+
</Table.Head>
|
|
83
|
+
</Table>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
*/
|
|
88
|
+
Head: import("@workday/canvas-kit-react/common").ElementComponent<"thead", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").GridStyleProps>;
|
|
89
|
+
/**
|
|
90
|
+
* `Table.Body` renders a [tbody](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody) element.
|
|
91
|
+
*
|
|
92
|
+
*
|
|
93
|
+
* ```tsx
|
|
94
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
95
|
+
|
|
96
|
+
export default function App() {
|
|
97
|
+
return (
|
|
98
|
+
<Table>
|
|
99
|
+
<Table.Body>
|
|
100
|
+
<Table.Row>
|
|
101
|
+
<Table.Header>Table Header</Table.Header>
|
|
102
|
+
<Table.Cell>Table Cell</Table.Cell>
|
|
103
|
+
</Table.Row>
|
|
104
|
+
</Table.Body>
|
|
105
|
+
</Table>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
*/
|
|
110
|
+
Body: import("@workday/canvas-kit-react/common").ElementComponent<"tbody", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").GridStyleProps>;
|
|
111
|
+
/**
|
|
112
|
+
* `Table.Row` renders a [tr](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr) element.
|
|
113
|
+
*
|
|
114
|
+
* **Note**: `Table.Row` is built on [Grid](/docs/components-layout-grid--basic). It will look for
|
|
115
|
+
* how many children are there and if those children are valid React Elements. This will adjust the
|
|
116
|
+
* amount of columns automatically using the `gridTemplateColumns` style prop and the width of the
|
|
117
|
+
* columns is also set using a `minmax` function in the `gridTemplateColumns` style prop. If a user
|
|
118
|
+
* would like to adjust this, it can be overwritten on `Table.Row`. See the example below for how to
|
|
119
|
+
* overwrite `gridTemplateColumns`.
|
|
120
|
+
*
|
|
121
|
+
*
|
|
122
|
+
* ```tsx
|
|
123
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
124
|
+
|
|
125
|
+
export default function App() {
|
|
126
|
+
return (
|
|
127
|
+
<Table>
|
|
128
|
+
<Table.Head>
|
|
129
|
+
<Table.Row gridTemplateColumns="repeat(4, minmax(100px, 1fr))">
|
|
130
|
+
<Table.Header>Table Header</Table.Header>
|
|
131
|
+
<Table.Cell>Table Cell</Table.Cell>
|
|
132
|
+
</Table.Row>
|
|
133
|
+
</Table.Head>
|
|
134
|
+
</Table>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
*/
|
|
139
|
+
Row: import("@workday/canvas-kit-react/common").ElementComponent<"tr", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").GridStyleProps>;
|
|
140
|
+
/**
|
|
141
|
+
* `Table.Header` renders a [th](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th) element.
|
|
142
|
+
*
|
|
143
|
+
*
|
|
144
|
+
* ```tsx
|
|
145
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
146
|
+
|
|
147
|
+
export default function App() {
|
|
148
|
+
return (
|
|
149
|
+
<Table>
|
|
150
|
+
<Table.Head>
|
|
151
|
+
<Table.Row>
|
|
152
|
+
<Table.Header>Table Header</Table.Header>
|
|
153
|
+
<Table.Cell>Table Cell</Table.Cell>
|
|
154
|
+
</Table.Row>
|
|
155
|
+
</Table.Head>
|
|
156
|
+
</Table>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
*/
|
|
161
|
+
Header: import("@workday/canvas-kit-react/common").ElementComponent<"th", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").GridStyleProps>;
|
|
162
|
+
/**
|
|
163
|
+
* `Table.Cell` renders a [td](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td) element.
|
|
164
|
+
*
|
|
165
|
+
*
|
|
166
|
+
* ```tsx
|
|
167
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
168
|
+
|
|
169
|
+
export default function App() {
|
|
170
|
+
return (
|
|
171
|
+
<Table>
|
|
172
|
+
<Table.Body>
|
|
173
|
+
<Table.Row>
|
|
174
|
+
<Table.Header>Table Header</Table.Header>
|
|
175
|
+
<Table.Cell>Table Cell</Table.Cell>
|
|
176
|
+
</Table.Row>
|
|
177
|
+
</Table.Body>
|
|
178
|
+
</Table>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
*/
|
|
183
|
+
Cell: import("@workday/canvas-kit-react/common").ElementComponent<"td", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").GridStyleProps>;
|
|
184
|
+
/**
|
|
185
|
+
* `Table.Footer` renders a [tfoot](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot) element.
|
|
186
|
+
*
|
|
187
|
+
*
|
|
188
|
+
* ```tsx
|
|
189
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
190
|
+
|
|
191
|
+
export default function App() {
|
|
192
|
+
return (
|
|
193
|
+
<Table>
|
|
194
|
+
<Table.Footer>
|
|
195
|
+
<Table.Row>
|
|
196
|
+
<Table.Header>Table Header</Table.Header>
|
|
197
|
+
<Table.Cell>Table Cell</Table.Cell>
|
|
198
|
+
</Table.Row>
|
|
199
|
+
</Table.Footer>
|
|
200
|
+
</Table>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
*/
|
|
205
|
+
Footer: import("@workday/canvas-kit-react/common").ElementComponent<"tfoot", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").GridStyleProps>;
|
|
206
|
+
};
|
|
11
207
|
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../table/lib/Table.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../table/lib/Table.tsx"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,KAAK;IAUd;;;;;;;;;;;;;;;;;;;;;MAqBE;;IAEF;;;;;;;;;;;;;;;;;;;;MAoBE;;IAEF;;;;;;;;;;;;;;;;;;;;MAoBE;;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2BE;;IAEF;;;;;;;;;;;;;;;;;;;;MAoBE;;IAEF;;;;;;;;;;;;;;;;;;;;MAoBE;;IAEF;;;;;;;;;;;;;;;;;;;;MAoBE;;CAGJ,CAAC"}
|