@pingux/astro 2.142.1-alpha.1 → 2.143.0-alpha.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/lib/cjs/components/Card/Card.styles.d.ts +3 -0
- package/lib/cjs/components/Card/Card.styles.js +4 -1
- package/lib/cjs/components/TableBase/TableBase.d.ts +1 -7
- package/lib/cjs/components/TableBase/TableBase.js +96 -74
- package/lib/cjs/components/TableBase/TableBase.stories.js +45 -36
- package/lib/cjs/components/TableBase/TableBase.styles.d.ts +5 -7
- package/lib/cjs/components/TableBase/TableBase.styles.js +8 -3
- package/lib/cjs/components/TableBase/stories/NextGenTableBase.js +5 -2
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +5 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +6 -0
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +32 -22
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.d.ts +32 -22
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.js +35 -23
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +32 -22
- package/lib/cjs/types/tableBase.d.ts +4 -3
- package/lib/components/Card/Card.styles.js +4 -1
- package/lib/components/TableBase/TableBase.js +100 -72
- package/lib/components/TableBase/TableBase.stories.js +46 -37
- package/lib/components/TableBase/TableBase.styles.js +8 -3
- package/lib/components/TableBase/stories/NextGenTableBase.js +6 -3
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +6 -0
- package/lib/styles/themes/next-gen/variants/tableBase.js +35 -23
- package/package.json +1 -1
@@ -95,7 +95,10 @@ var activeCard = _objectSpread(_objectSpread({}, interactive), {}, {
|
|
95
95
|
});
|
96
96
|
var tableWrapper = _objectSpread(_objectSpread({}, container), {}, {
|
97
97
|
padding: 0,
|
98
|
-
boxShadow: 'none'
|
98
|
+
boxShadow: 'none',
|
99
|
+
overflow: 'auto',
|
100
|
+
scrollPaddingTop: '50px',
|
101
|
+
scrollPaddingBottom: '20px'
|
99
102
|
});
|
100
103
|
var _default = {
|
101
104
|
container: container,
|
@@ -1,10 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type { TableBaseProps
|
2
|
+
import type { TableBaseProps } from '../../types/tableBase';
|
3
3
|
declare const TableBase: React.ForwardRefExoticComponent<TableBaseProps<object> & React.RefAttributes<HTMLTableElement>>;
|
4
4
|
export default TableBase;
|
5
|
-
export declare const TableRowGroup: React.ForwardRefExoticComponent<TableRowGroupProps & React.RefAttributes<HTMLTableSectionElement>>;
|
6
|
-
export declare function TableHeaderRow<T>(props: TableHeaderRowProps<T>): React.JSX.Element;
|
7
|
-
export declare function TableColumnHeader<T>(props: TableColumnHeaderProps<T>): React.JSX.Element;
|
8
|
-
export declare function TableRow<T>(props: TableRowProps<T>): React.JSX.Element;
|
9
|
-
export declare function TableCell<T>(props: TableCellProps<T>): React.JSX.Element;
|
10
|
-
export declare function TableCheckboxCell<T>(props: TableCheckboxCellProps<T>): React.JSX.Element;
|
@@ -14,12 +14,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
14
14
|
_Object$defineProperty(exports, "__esModule", {
|
15
15
|
value: true
|
16
16
|
});
|
17
|
-
exports
|
18
|
-
exports.TableCheckboxCell = TableCheckboxCell;
|
19
|
-
exports.TableColumnHeader = TableColumnHeader;
|
20
|
-
exports.TableHeaderRow = TableHeaderRow;
|
21
|
-
exports.TableRow = TableRow;
|
22
|
-
exports["default"] = exports.TableRowGroup = void 0;
|
17
|
+
exports["default"] = void 0;
|
23
18
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
24
19
|
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
25
20
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
@@ -36,8 +31,9 @@ var _table2 = require("@react-stately/table");
|
|
36
31
|
var _ = require("../..");
|
37
32
|
var _hooks = require("../../hooks");
|
38
33
|
var _react2 = require("@emotion/react");
|
39
|
-
var _excluded = ["caption", "selectionMode", "selectionBehavior", "
|
40
|
-
_excluded2 = ["
|
34
|
+
var _excluded = ["caption", "selectionMode", "selectionBehavior", "hasSelectionCheckboxes", "isStickyHeader", "className"],
|
35
|
+
_excluded2 = ["caption"],
|
36
|
+
_excluded3 = ["type", "children", "className", "isSticky"];
|
41
37
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
42
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
43
39
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -47,11 +43,15 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
47
43
|
var caption = props.caption,
|
48
44
|
selectionMode = props.selectionMode,
|
49
45
|
selectionBehavior = props.selectionBehavior,
|
50
|
-
tableBodyProps = props.tableBodyProps,
|
51
46
|
hasSelectionCheckboxes = props.hasSelectionCheckboxes,
|
52
47
|
_props$isStickyHeader = props.isStickyHeader,
|
53
48
|
isStickyHeader = _props$isStickyHeader === void 0 ? false : _props$isStickyHeader,
|
49
|
+
className = props.className,
|
54
50
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
51
|
+
var tableRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
52
|
+
var headerRef = (0, _react.useRef)(null);
|
53
|
+
var scrollRef = (0, _react.useRef)(null);
|
54
|
+
var bodyRef = (0, _react.useRef)(null);
|
55
55
|
var _useState = (0, _react.useState)(0),
|
56
56
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
57
57
|
tableWidth = _useState2[0],
|
@@ -59,11 +59,9 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
59
59
|
var state = (0, _table2.useTableState)(_objectSpread(_objectSpread({}, props), {}, {
|
60
60
|
showSelectionCheckboxes: hasSelectionCheckboxes || selectionMode === 'multiple' && selectionBehavior !== 'replace'
|
61
61
|
}));
|
62
|
-
var tableRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
63
|
-
var bodyRef = (0, _react.useRef)(null);
|
64
62
|
var collection = state.collection;
|
65
63
|
var _useTable = (0, _table.useTable)(_objectSpread(_objectSpread({}, props), {}, {
|
66
|
-
scrollRef:
|
64
|
+
scrollRef: scrollRef
|
67
65
|
}), state, tableRef),
|
68
66
|
gridProps = _useTable.gridProps;
|
69
67
|
var getDefaultWidth = (0, _react.useCallback)(function (node) {
|
@@ -74,9 +72,9 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
74
72
|
}, []);
|
75
73
|
var getDefaultMinWidth = (0, _react.useCallback)(function (node) {
|
76
74
|
if (node.props.isSelectionCell) {
|
77
|
-
return
|
75
|
+
return 70;
|
78
76
|
}
|
79
|
-
return
|
77
|
+
return 100;
|
80
78
|
}, []);
|
81
79
|
var layoutState = (0, _table2.useTableColumnResizeState)({
|
82
80
|
getDefaultWidth: getDefaultWidth,
|
@@ -94,28 +92,31 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
94
92
|
return setTableWidth(tableRef.current.clientWidth);
|
95
93
|
}
|
96
94
|
});
|
97
|
-
|
98
|
-
|
95
|
+
var _useStatusClasses = (0, _hooks.useStatusClasses)(className, {
|
96
|
+
'has-caption': !!caption
|
97
|
+
}),
|
98
|
+
classNames = _useStatusClasses.classNames;
|
99
|
+
return (0, _react2.jsx)(_.Box, {
|
100
|
+
ref: scrollRef
|
99
101
|
}, (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
100
102
|
as: "table",
|
103
|
+
display: "table",
|
101
104
|
variant: "tableBase.container",
|
105
|
+
className: classNames,
|
102
106
|
ref: tableRef
|
103
|
-
}, gridProps, others), caption && (0, _react2.jsx)(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
textAlign: "left"
|
108
|
-
}, caption), (0, _react2.jsx)(TableRowGroup, {
|
107
|
+
}, gridProps, others), caption && (0, _react2.jsx)(TableCaption, {
|
108
|
+
caption: caption
|
109
|
+
}), (0, _react2.jsx)(TableRowGroup, {
|
110
|
+
ref: headerRef,
|
109
111
|
type: "thead",
|
110
|
-
hasCaption: !!caption,
|
111
112
|
isSticky: isStickyHeader
|
112
113
|
}, (0, _map["default"])(_context = collection.headerRows).call(_context, function (headerRow) {
|
113
|
-
var _context2
|
114
|
+
var _context2;
|
114
115
|
return (0, _react2.jsx)(TableHeaderRow, {
|
115
116
|
key: headerRow.key,
|
116
117
|
item: headerRow,
|
117
118
|
state: state
|
118
|
-
}, (0, _map["default"])(_context2 = (0, _from["default"])(
|
119
|
+
}, (0, _map["default"])(_context2 = (0, _from["default"])(headerRow.childNodes)).call(_context2, function (column) {
|
119
120
|
return column.props.isSelectionCell ? (0, _react2.jsx)(TableSelectAllCell, {
|
120
121
|
key: column.key,
|
121
122
|
column: column,
|
@@ -131,24 +132,24 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
131
132
|
})), (0, _react2.jsx)(TableRowGroup, (0, _extends2["default"])({
|
132
133
|
ref: bodyRef,
|
133
134
|
type: "tbody"
|
134
|
-
},
|
135
|
+
}, collection.body.props), collection.size === 0 && (0, _react2.jsx)(_.Box, {
|
136
|
+
as: "tr",
|
135
137
|
role: "row",
|
136
138
|
key: "loading",
|
137
139
|
"data-testid": "loading",
|
138
|
-
as: "tr",
|
139
140
|
alignItems: "center",
|
140
141
|
justifyContent: "center",
|
141
142
|
px: "lg",
|
142
143
|
py: "md"
|
143
144
|
}, (0, _react2.jsx)(_.Loader, {
|
144
145
|
color: "active"
|
145
|
-
})), (0, _map["default"])(_context3 = (0, _from["default"])(collection)).call(_context3, function (row) {
|
146
|
+
})), (0, _map["default"])(_context3 = (0, _from["default"])(collection.body.childNodes)).call(_context3, function (row) {
|
146
147
|
var _context4;
|
147
148
|
return (0, _react2.jsx)(TableRow, {
|
148
149
|
key: row.key,
|
149
150
|
item: row,
|
150
151
|
state: state
|
151
|
-
}, (0, _map["default"])(_context4 = (0, _from["default"])(
|
152
|
+
}, (0, _map["default"])(_context4 = (0, _from["default"])(collection.getChildren(row.key))).call(_context4, function (cell) {
|
152
153
|
return cell.props.isSelectionCell ? (0, _react2.jsx)(TableCheckboxCell, {
|
153
154
|
key: cell.key,
|
154
155
|
cell: cell,
|
@@ -163,30 +164,40 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
163
164
|
}));
|
164
165
|
}))));
|
165
166
|
});
|
166
|
-
var
|
167
|
-
|
167
|
+
var TableCaption = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
168
|
+
var caption = props.caption,
|
169
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded2);
|
170
|
+
if (!caption) {
|
171
|
+
return null;
|
172
|
+
}
|
173
|
+
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
174
|
+
as: "caption",
|
175
|
+
display: "table-caption",
|
176
|
+
ref: ref,
|
177
|
+
variant: "tableBase.caption",
|
178
|
+
textAlign: "left"
|
179
|
+
}, others), caption);
|
180
|
+
});
|
168
181
|
var TableRowGroup = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
169
182
|
var type = props.type,
|
170
183
|
children = props.children,
|
171
|
-
hasCaption = props.hasCaption,
|
172
184
|
className = props.className,
|
173
185
|
isSticky = props.isSticky,
|
174
|
-
others = (0, _objectWithoutProperties2["default"])(props,
|
186
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded3);
|
175
187
|
var _useTableRowGroup = (0, _table.useTableRowGroup)(),
|
176
188
|
rowGroupProps = _useTableRowGroup.rowGroupProps;
|
177
|
-
var
|
178
|
-
hasCaption: hasCaption,
|
189
|
+
var _useStatusClasses2 = (0, _hooks.useStatusClasses)(className, {
|
179
190
|
isSticky: isSticky && type === 'thead'
|
180
191
|
}),
|
181
|
-
classNames =
|
192
|
+
classNames = _useStatusClasses2.classNames;
|
182
193
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
183
|
-
ref: ref,
|
184
194
|
as: type,
|
195
|
+
display: type === 'thead' ? 'table-header-group' : 'table-row-group',
|
196
|
+
ref: ref,
|
185
197
|
className: classNames,
|
186
198
|
variant: "tableBase.".concat(type)
|
187
199
|
}, rowGroupProps, others), children);
|
188
200
|
});
|
189
|
-
exports.TableRowGroup = TableRowGroup;
|
190
201
|
function TableHeaderRow(props) {
|
191
202
|
var item = props.item,
|
192
203
|
state = props.state,
|
@@ -198,7 +209,7 @@ function TableHeaderRow(props) {
|
|
198
209
|
rowProps = _useTableHeaderRow.rowProps;
|
199
210
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
200
211
|
as: "tr",
|
201
|
-
|
212
|
+
display: "table-row"
|
202
213
|
}, rowProps, {
|
203
214
|
ref: ref
|
204
215
|
}), children);
|
@@ -232,22 +243,24 @@ function TableColumnHeader(props) {
|
|
232
243
|
name: (sortDescriptor === null || sortDescriptor === void 0 ? void 0 : sortDescriptor.direction) === 'ascending' ? 'Sort ascending' : 'Sort descending'
|
233
244
|
}
|
234
245
|
});
|
235
|
-
var
|
246
|
+
var _useStatusClasses3 = (0, _hooks.useStatusClasses)(className, {
|
236
247
|
isFocused: isFocusVisible
|
237
248
|
}),
|
238
|
-
classNames =
|
249
|
+
classNames = _useStatusClasses3.classNames;
|
239
250
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
240
|
-
isRow: true,
|
241
|
-
ref: ref,
|
242
251
|
as: "th",
|
252
|
+
display: "table-cell",
|
253
|
+
ref: ref,
|
243
254
|
variant: "tableBase.head",
|
244
255
|
className: classNames,
|
245
|
-
alignItems: "center",
|
246
256
|
sx: _objectSpread({
|
247
|
-
gap: 'sm',
|
248
257
|
width: layoutState === null || layoutState === void 0 ? void 0 : layoutState.getColumnWidth(column.key)
|
249
258
|
}, column.props.sx)
|
250
|
-
}, (0, _utils.mergeProps)(columnHeaderProps, focusProps, column.props)),
|
259
|
+
}, (0, _utils.mergeProps)(columnHeaderProps, focusProps, column.props)), (0, _react2.jsx)(_.Box, {
|
260
|
+
isRow: true,
|
261
|
+
gap: "sm",
|
262
|
+
alignItems: "center"
|
263
|
+
}, (0, _react2.jsx)(_.Text, null, column.rendered), allowsSorting && sortIcon));
|
251
264
|
}
|
252
265
|
function TableRow(props) {
|
253
266
|
var item = props.item,
|
@@ -272,17 +285,17 @@ function TableRow(props) {
|
|
272
285
|
}),
|
273
286
|
pressProps = _usePress.pressProps,
|
274
287
|
isPressed = _usePress.isPressed;
|
275
|
-
var
|
288
|
+
var _useStatusClasses4 = (0, _hooks.useStatusClasses)(className, {
|
276
289
|
isSelected: isSelected,
|
277
290
|
isHovered: isHovered,
|
278
291
|
isPressed: isPressed,
|
279
292
|
isFocused: isFocusVisible,
|
280
293
|
isDisabled: isDisabled
|
281
294
|
}),
|
282
|
-
classNames =
|
295
|
+
classNames = _useStatusClasses4.classNames;
|
283
296
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
284
297
|
as: "tr",
|
285
|
-
|
298
|
+
display: "table-row",
|
286
299
|
className: classNames,
|
287
300
|
variant: "tableBase.row"
|
288
301
|
}, (0, _utils.mergeProps)(rowProps, focusProps, hoverProps, pressProps), {
|
@@ -302,12 +315,13 @@ function TableCell(props) {
|
|
302
315
|
var _useFocusRing3 = (0, _focus.useFocusRing)(),
|
303
316
|
isFocusVisible = _useFocusRing3.isFocusVisible,
|
304
317
|
focusProps = _useFocusRing3.focusProps;
|
305
|
-
var
|
318
|
+
var _useStatusClasses5 = (0, _hooks.useStatusClasses)(className, {
|
306
319
|
isFocused: isFocusVisible
|
307
320
|
}),
|
308
|
-
classNames =
|
321
|
+
classNames = _useStatusClasses5.classNames;
|
309
322
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
310
323
|
as: "td",
|
324
|
+
display: "table-cell",
|
311
325
|
variant: "tableBase.data",
|
312
326
|
ref: ref,
|
313
327
|
className: classNames,
|
@@ -316,27 +330,6 @@ function TableCell(props) {
|
|
316
330
|
}, cell.props.sx)
|
317
331
|
}, (0, _utils.mergeProps)(gridCellProps, focusProps, cell.props)), cell.rendered);
|
318
332
|
}
|
319
|
-
function TableCheckboxCell(props) {
|
320
|
-
var cell = props.cell,
|
321
|
-
state = props.state,
|
322
|
-
layoutState = props.layoutState;
|
323
|
-
var ref = (0, _react.useRef)(null);
|
324
|
-
var _useTableCell2 = (0, _table.useTableCell)({
|
325
|
-
node: cell
|
326
|
-
}, state, ref),
|
327
|
-
gridCellProps = _useTableCell2.gridCellProps;
|
328
|
-
var _useTableSelectionChe = (0, _table.useTableSelectionCheckbox)({
|
329
|
-
key: cell.parentKey
|
330
|
-
}, state),
|
331
|
-
checkboxProps = _useTableSelectionChe.checkboxProps;
|
332
|
-
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
333
|
-
as: "td",
|
334
|
-
variant: "tableBase.data",
|
335
|
-
width: layoutState === null || layoutState === void 0 ? void 0 : layoutState.getColumnWidth(cell.column.key)
|
336
|
-
}, gridCellProps, {
|
337
|
-
ref: ref
|
338
|
-
}), (0, _react2.jsx)(_.CheckboxField, checkboxProps));
|
339
|
-
}
|
340
333
|
function TableSelectAllCell(props) {
|
341
334
|
var column = props.column,
|
342
335
|
state = props.state,
|
@@ -350,8 +343,11 @@ function TableSelectAllCell(props) {
|
|
350
343
|
checkboxProps = _useTableSelectAllChe.checkboxProps;
|
351
344
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
352
345
|
as: "th",
|
346
|
+
display: "table-cell",
|
353
347
|
variant: "tableBase.head",
|
354
|
-
|
348
|
+
sx: {
|
349
|
+
width: layoutState === null || layoutState === void 0 ? void 0 : layoutState.getColumnWidth(column.key)
|
350
|
+
}
|
355
351
|
}, columnHeaderProps, {
|
356
352
|
ref: ref
|
357
353
|
}), state.selectionManager.selectionMode === 'single' ? (0, _react2.jsx)(_visuallyHidden.VisuallyHidden, null, checkboxProps['aria-label']) : (0, _react2.jsx)(_.CheckboxField, (0, _extends2["default"])({
|
@@ -359,4 +355,30 @@ function TableSelectAllCell(props) {
|
|
359
355
|
'data-testid': 'select-all-checkbox'
|
360
356
|
}
|
361
357
|
}, checkboxProps)));
|
362
|
-
}
|
358
|
+
}
|
359
|
+
function TableCheckboxCell(props) {
|
360
|
+
var cell = props.cell,
|
361
|
+
state = props.state,
|
362
|
+
layoutState = props.layoutState;
|
363
|
+
var ref = (0, _react.useRef)(null);
|
364
|
+
var _useTableCell2 = (0, _table.useTableCell)({
|
365
|
+
node: cell
|
366
|
+
}, state, ref),
|
367
|
+
gridCellProps = _useTableCell2.gridCellProps;
|
368
|
+
var _useTableSelectionChe = (0, _table.useTableSelectionCheckbox)({
|
369
|
+
key: cell.parentKey
|
370
|
+
}, state),
|
371
|
+
checkboxProps = _useTableSelectionChe.checkboxProps;
|
372
|
+
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
373
|
+
as: "td",
|
374
|
+
display: "table-cell",
|
375
|
+
variant: "tableBase.data",
|
376
|
+
sx: _objectSpread({
|
377
|
+
width: layoutState === null || layoutState === void 0 ? void 0 : layoutState.getColumnWidth(cell.column.key)
|
378
|
+
}, cell.props.sx)
|
379
|
+
}, gridCellProps, {
|
380
|
+
ref: ref
|
381
|
+
}), (0, _react2.jsx)(_.CheckboxField, checkboxProps));
|
382
|
+
}
|
383
|
+
var _default = TableBase;
|
384
|
+
exports["default"] = _default;
|
@@ -89,14 +89,17 @@ var statusVariant = {
|
|
89
89
|
Inactive: 'secondaryStatusBadge'
|
90
90
|
};
|
91
91
|
var Default = function Default() {
|
92
|
-
return (0, _react2.jsx)(_.
|
92
|
+
return (0, _react2.jsx)(_.Card, {
|
93
|
+
variant: "cards.tableWrapper"
|
94
|
+
}, (0, _react2.jsx)(_.TableBase, {
|
93
95
|
caption: "Lorem ipsum",
|
94
96
|
"aria-label": "table"
|
95
97
|
}, (0, _react2.jsx)(_.THead, {
|
96
98
|
columns: headers
|
97
99
|
}, function (column) {
|
98
100
|
return (0, _react2.jsx)(_.Column, {
|
99
|
-
key: column.key
|
101
|
+
key: column.key,
|
102
|
+
minWidth: 200
|
100
103
|
}, column.name);
|
101
104
|
}), (0, _react2.jsx)(_.TBody, {
|
102
105
|
items: objects
|
@@ -106,7 +109,7 @@ var Default = function Default() {
|
|
106
109
|
}, function (columnKey) {
|
107
110
|
return (0, _react2.jsx)(_.Cell, null, item[columnKey]);
|
108
111
|
});
|
109
|
-
}));
|
112
|
+
})));
|
110
113
|
};
|
111
114
|
exports.Default = Default;
|
112
115
|
var MultiSelection = function MultiSelection() {
|
@@ -114,7 +117,9 @@ var MultiSelection = function MultiSelection() {
|
|
114
117
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
115
118
|
selectedKeys = _React$useState2[0],
|
116
119
|
setSelectedKeys = _React$useState2[1];
|
117
|
-
return (0, _react2.jsx)(_.
|
120
|
+
return (0, _react2.jsx)(_.Card, {
|
121
|
+
variant: "cards.tableWrapper"
|
122
|
+
}, (0, _react2.jsx)(_.TableBase, {
|
118
123
|
caption: "Lorem ipsum",
|
119
124
|
"aria-label": "table",
|
120
125
|
selectionMode: "multiple",
|
@@ -124,7 +129,8 @@ var MultiSelection = function MultiSelection() {
|
|
124
129
|
columns: headers
|
125
130
|
}, function (column) {
|
126
131
|
return (0, _react2.jsx)(_.Column, {
|
127
|
-
key: column.key
|
132
|
+
key: column.key,
|
133
|
+
minWidth: 200
|
128
134
|
}, column.name);
|
129
135
|
}), (0, _react2.jsx)(_.TBody, {
|
130
136
|
items: objects
|
@@ -134,42 +140,38 @@ var MultiSelection = function MultiSelection() {
|
|
134
140
|
}, function (columnKey) {
|
135
141
|
return (0, _react2.jsx)(_.Cell, null, item[columnKey]);
|
136
142
|
});
|
137
|
-
}));
|
143
|
+
})));
|
138
144
|
};
|
139
145
|
exports.MultiSelection = MultiSelection;
|
140
146
|
var WithStickyHeader = function WithStickyHeader() {
|
141
|
-
return (0, _react2.jsx)(_.
|
147
|
+
return (0, _react2.jsx)(_.Card, {
|
148
|
+
variant: "cards.tableWrapper",
|
149
|
+
height: "400px"
|
150
|
+
}, (0, _react2.jsx)(_.TableBase, {
|
142
151
|
"aria-label": "table",
|
143
152
|
isStickyHeader: true,
|
144
153
|
selectionMode: "single",
|
145
154
|
defaultSelectedKeys: ['2'],
|
146
|
-
disabledKeys: ['3']
|
147
|
-
tableBodyProps: {
|
148
|
-
style: {
|
149
|
-
height: '300px'
|
150
|
-
}
|
151
|
-
}
|
155
|
+
disabledKeys: ['3']
|
152
156
|
}, (0, _react2.jsx)(_.THead, null, (0, _react2.jsx)(_.Column, {
|
153
|
-
|
157
|
+
minWidth: 200
|
154
158
|
}, "Name"), (0, _react2.jsx)(_.Column, {
|
155
|
-
|
159
|
+
minWidth: 300
|
156
160
|
}, "Email"), (0, _react2.jsx)(_.Column, {
|
157
|
-
|
158
|
-
}, "Status"), (0, _react2.jsx)(_.Column, {
|
159
|
-
width: "1fr"
|
160
|
-
}, "Bio")), (0, _react2.jsx)(_.TBody, {
|
161
|
+
minWidth: 150
|
162
|
+
}, "Status"), (0, _react2.jsx)(_.Column, null, "Bio")), (0, _react2.jsx)(_.TBody, {
|
161
163
|
items: _items.items
|
162
164
|
}, function (item) {
|
163
165
|
var _context;
|
164
166
|
return (0, _react2.jsx)(_.Row, {
|
165
167
|
key: item.id
|
166
|
-
}, (0, _react2.jsx)(_.Cell, null, (0, _concat["default"])(_context = "".concat(item.firstName, " ")).call(_context, item.lastName)
|
168
|
+
}, (0, _react2.jsx)(_.Cell, null, (0, _concat["default"])(_context = "".concat(item.firstName, " ")).call(_context, item.lastName)), (0, _react2.jsx)(_.Cell, null, item.email), (0, _react2.jsx)(_.Cell, null, (0, _react2.jsx)(_.Badge, {
|
167
169
|
variant: statusVariant[item.status],
|
168
170
|
label: item.status
|
169
171
|
})), (0, _react2.jsx)(_.Cell, null, (0, _react2.jsx)(_.Text, {
|
170
172
|
variant: "textEllipsis"
|
171
|
-
}, "Lorem ipsum dolor sit amet
|
172
|
-
}));
|
173
|
+
}, "Lorem ipsum dolor sit amet.")));
|
174
|
+
})));
|
173
175
|
};
|
174
176
|
exports.WithStickyHeader = WithStickyHeader;
|
175
177
|
WithStickyHeader.parameters = {
|
@@ -190,16 +192,15 @@ var ExampleTable = function ExampleTable() {
|
|
190
192
|
paginationState = _usePaginationState.paginationState;
|
191
193
|
var renderItems = (0, _slice["default"])(_items.items).call(_items.items, paginationState.firstRenderedIndex, paginationState.lastRenderedIndex + 1);
|
192
194
|
return (0, _react2.jsx)(_.TableBase, {
|
193
|
-
"aria-label": "table"
|
195
|
+
"aria-label": "table",
|
196
|
+
className: "has-pagination"
|
194
197
|
}, (0, _react2.jsx)(_.THead, null, (0, _react2.jsx)(_.Column, {
|
195
|
-
|
198
|
+
minWidth: 200
|
196
199
|
}, "Name"), (0, _react2.jsx)(_.Column, {
|
197
|
-
|
200
|
+
minWidth: 300
|
198
201
|
}, "Email"), (0, _react2.jsx)(_.Column, {
|
199
|
-
|
200
|
-
}, "Status"), (0, _react2.jsx)(_.Column, {
|
201
|
-
width: "1fr"
|
202
|
-
}, "Bio")), (0, _react2.jsx)(_.TBody, {
|
202
|
+
minWidth: 150
|
203
|
+
}, "Status"), (0, _react2.jsx)(_.Column, null, "Bio")), (0, _react2.jsx)(_.TBody, {
|
203
204
|
items: renderItems
|
204
205
|
}, function (item) {
|
205
206
|
var _context2;
|
@@ -210,7 +211,7 @@ var ExampleTable = function ExampleTable() {
|
|
210
211
|
label: item.status
|
211
212
|
})), (0, _react2.jsx)(_.Cell, null, (0, _react2.jsx)(_.Text, {
|
212
213
|
variant: "textEllipsis"
|
213
|
-
}, "Lorem ipsum dolor sit amet
|
214
|
+
}, "Lorem ipsum dolor sit amet.")));
|
214
215
|
}));
|
215
216
|
};
|
216
217
|
var WithPagination = function WithPagination() {
|
@@ -218,14 +219,20 @@ var WithPagination = function WithPagination() {
|
|
218
219
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
219
220
|
offsetCount = _useState2[0],
|
220
221
|
setOffsetCount = _useState2[1];
|
221
|
-
return (0, _react2.jsx)(_.
|
222
|
-
|
223
|
-
}, (0, _react2.jsx)(
|
222
|
+
return (0, _react2.jsx)(_.Card, {
|
223
|
+
variant: "cards.tableWrapper"
|
224
|
+
}, (0, _react2.jsx)(_.PaginationProvider, null, (0, _react2.jsx)(_.Box, {
|
225
|
+
variant: "cards.body",
|
226
|
+
overflow: "auto",
|
227
|
+
p: "0"
|
228
|
+
}, (0, _react2.jsx)(ExampleTable, null)), (0, _react2.jsx)(_.Box, {
|
229
|
+
variant: "cards.footer"
|
230
|
+
}, (0, _react2.jsx)(_.Pagination, {
|
224
231
|
totalCount: _items.items.length,
|
225
232
|
offsetCount: offsetCount,
|
226
233
|
onOffsetCountChange: setOffsetCount,
|
227
234
|
offsetOptions: [10, 20, 50, 100]
|
228
|
-
})));
|
235
|
+
}))));
|
229
236
|
};
|
230
237
|
exports.WithPagination = WithPagination;
|
231
238
|
WithPagination.parameters = {
|
@@ -342,7 +349,9 @@ var DynamicWithSorting = function DynamicWithSorting() {
|
|
342
349
|
direction: 'ascending'
|
343
350
|
}
|
344
351
|
});
|
345
|
-
return (0, _react2.jsx)(_.
|
352
|
+
return (0, _react2.jsx)(_.Card, {
|
353
|
+
variant: "cards.tableWrapper"
|
354
|
+
}, (0, _react2.jsx)(_.TableBase, {
|
346
355
|
"aria-label": "Dynamic table",
|
347
356
|
onSortChange: function onSortChange(descriptor) {
|
348
357
|
if (descriptor.column) {
|
@@ -367,7 +376,7 @@ var DynamicWithSorting = function DynamicWithSorting() {
|
|
367
376
|
}, function (columnKey) {
|
368
377
|
return (0, _react2.jsx)(_.Cell, null, item[columnKey]);
|
369
378
|
});
|
370
|
-
}));
|
379
|
+
})));
|
371
380
|
};
|
372
381
|
|
373
382
|
// Added to bypass color contrast issue due to virtualizer
|
@@ -7,12 +7,14 @@ declare const _default: {
|
|
7
7
|
position: string;
|
8
8
|
top: number;
|
9
9
|
zIndex: number;
|
10
|
+
boxShadow: string;
|
10
11
|
};
|
11
12
|
};
|
12
13
|
tbody: {
|
13
14
|
borderBottom: string;
|
14
15
|
borderBottomColor: string;
|
15
|
-
|
16
|
+
overflowX: string;
|
17
|
+
scrollPaddingBottom: string;
|
16
18
|
};
|
17
19
|
caption: {
|
18
20
|
fontFamily: string;
|
@@ -23,6 +25,7 @@ declare const _default: {
|
|
23
25
|
};
|
24
26
|
container: {
|
25
27
|
width: string;
|
28
|
+
height: string;
|
26
29
|
borderSpacing: string;
|
27
30
|
borderCollapse: string;
|
28
31
|
position: string;
|
@@ -82,12 +85,7 @@ declare const _default: {
|
|
82
85
|
outlineOffset: string;
|
83
86
|
};
|
84
87
|
'&.is-hovered': {};
|
85
|
-
'&.is-selected': {
|
86
|
-
outline: string;
|
87
|
-
outlineStyle: string;
|
88
|
-
outlineColor: string;
|
89
|
-
outlineOffset: string;
|
90
|
-
};
|
88
|
+
'&.is-selected': {};
|
91
89
|
'&.is-disabled': {
|
92
90
|
bg: string;
|
93
91
|
opacity: number;
|
@@ -25,6 +25,7 @@ var defaultFocus = {
|
|
25
25
|
};
|
26
26
|
var container = {
|
27
27
|
width: '100%',
|
28
|
+
height: '100%',
|
28
29
|
borderSpacing: '0',
|
29
30
|
borderCollapse: 'collapse',
|
30
31
|
position: 'relative'
|
@@ -43,7 +44,8 @@ var thead = {
|
|
43
44
|
'&.is-sticky': {
|
44
45
|
position: 'sticky',
|
45
46
|
top: 0,
|
46
|
-
zIndex: 1
|
47
|
+
zIndex: 1,
|
48
|
+
boxShadow: '0 1px 0 #68747f'
|
47
49
|
}
|
48
50
|
};
|
49
51
|
var head = _objectSpread(_objectSpread({}, _Text.text.label), {}, {
|
@@ -59,7 +61,8 @@ var head = _objectSpread(_objectSpread({}, _Text.text.label), {}, {
|
|
59
61
|
var tbody = {
|
60
62
|
borderBottom: '1px solid',
|
61
63
|
borderBottomColor: 'neutral.80',
|
62
|
-
|
64
|
+
overflowX: 'auto',
|
65
|
+
scrollPaddingBottom: '20px'
|
63
66
|
};
|
64
67
|
var row = {
|
65
68
|
'&:nth-of-type(odd) ': {
|
@@ -72,7 +75,9 @@ var row = {
|
|
72
75
|
'&.is-hovered': {
|
73
76
|
// This is the hover state for the row
|
74
77
|
},
|
75
|
-
'&.is-selected':
|
78
|
+
'&.is-selected': {
|
79
|
+
// This is the selected state for the row
|
80
|
+
},
|
76
81
|
'&.is-disabled': {
|
77
82
|
bg: 'neutral.90',
|
78
83
|
opacity: 0.5,
|
@@ -42,7 +42,10 @@ var NextGenTableBase = function NextGenTableBase() {
|
|
42
42
|
additional_grant: '+25,000',
|
43
43
|
total_grant: '75,000'
|
44
44
|
}];
|
45
|
-
return (0, _react2.jsx)(_.
|
45
|
+
return (0, _react2.jsx)(_.Card, {
|
46
|
+
variant: "cards.tableWrapper",
|
47
|
+
overflow: "unset"
|
48
|
+
}, (0, _react2.jsx)(_.TableBase, {
|
46
49
|
caption: "Lorem ipsum",
|
47
50
|
"aria-label": "table"
|
48
51
|
}, (0, _react2.jsx)(_.THead, {
|
@@ -59,7 +62,7 @@ var NextGenTableBase = function NextGenTableBase() {
|
|
59
62
|
}, function (columnKey) {
|
60
63
|
return (0, _react2.jsx)(_.Cell, null, item[columnKey]);
|
61
64
|
});
|
62
|
-
}));
|
65
|
+
})));
|
63
66
|
};
|
64
67
|
var _default = NextGenTableBase;
|
65
68
|
exports["default"] = _default;
|