@pingux/astro 2.25.0-alpha.1 → 2.25.0-alpha.2
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/Button/Buttons.styles.js +8 -0
- package/lib/cjs/components/DataTable/DataTable.js +151 -82
- package/lib/cjs/components/DataTable/DataTable.stories.js +262 -113
- package/lib/cjs/components/DataTable/DataTable.styles.js +36 -22
- package/lib/cjs/components/DataTable/DataTable.test.js +21 -14
- package/lib/cjs/components/DataTable/DataTableMenu.js +1 -0
- package/lib/cjs/components/DataTable/DataTableVirtualizer.js +7 -10
- package/lib/cjs/components/DataTable/index.js +1 -1
- package/lib/cjs/components/Text/Text.styles.d.ts +11 -0
- package/lib/cjs/components/Text/Text.styles.js +6 -0
- package/lib/cjs/recipes/DataVisualization.stories.js +416 -0
- package/lib/cjs/utils/devUtils/constants/images.js +3 -1
- package/lib/components/Button/Buttons.styles.js +8 -0
- package/lib/components/DataTable/DataTable.js +145 -76
- package/lib/components/DataTable/DataTable.stories.js +257 -112
- package/lib/components/DataTable/DataTable.styles.js +36 -22
- package/lib/components/DataTable/DataTable.test.js +21 -14
- package/lib/components/DataTable/DataTableMenu.js +1 -0
- package/lib/components/DataTable/DataTableVirtualizer.js +7 -10
- package/lib/components/DataTable/index.js +1 -1
- package/lib/components/Text/Text.styles.js +6 -0
- package/lib/recipes/DataVisualization.stories.js +403 -0
- package/lib/utils/devUtils/constants/images.js +1 -0
- package/package.json +7 -6
@@ -262,6 +262,13 @@ var headerBar = _objectSpread(_objectSpread({}, base), {}, {
|
|
262
262
|
}),
|
263
263
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
264
264
|
});
|
265
|
+
var exampleText = _objectSpread(_objectSpread({}, base), {}, {
|
266
|
+
'&.is-hovered': {
|
267
|
+
textDecoration: 'underline'
|
268
|
+
},
|
269
|
+
background: 'none',
|
270
|
+
'&.is-focused': _objectSpread({}, defaultFocus)
|
271
|
+
});
|
265
272
|
var _default = {
|
266
273
|
critical: critical,
|
267
274
|
"default": _objectSpread(_objectSpread({}, base), {}, {
|
@@ -281,6 +288,7 @@ var _default = {
|
|
281
288
|
quiet: quiet,
|
282
289
|
success: success,
|
283
290
|
colorBlock: colorBlock,
|
291
|
+
exampleText: exampleText,
|
284
292
|
withIcon: withIcon,
|
285
293
|
inlineWithIcon: inlineWithIcon,
|
286
294
|
inlinePrimaryWithIcon: inlinePrimaryWithIcon
|
@@ -15,16 +15,19 @@ _Object$defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
16
16
|
});
|
17
17
|
exports["default"] = void 0;
|
18
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
18
19
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
19
20
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
20
21
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
22
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
21
23
|
var _react = _interopRequireWildcard(require("react"));
|
22
24
|
var _reactAria = require("react-aria");
|
23
25
|
var _MenuDownIcon = _interopRequireDefault(require("@pingux/mdi-react/MenuDownIcon"));
|
24
26
|
var _MenuUpIcon = _interopRequireDefault(require("@pingux/mdi-react/MenuUpIcon"));
|
27
|
+
var _table = require("@react-aria/table");
|
25
28
|
var _virtualizer = require("@react-aria/virtualizer");
|
26
29
|
var _layout = require("@react-stately/layout");
|
27
|
-
var
|
30
|
+
var _table2 = require("@react-stately/table");
|
28
31
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
29
32
|
var _DataTableContext = require("../../context/DataTableContext");
|
30
33
|
var _hooks = require("../../hooks");
|
@@ -40,7 +43,11 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
40
43
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
41
44
|
var DEFAULT_HEADER_HEIGHT = {
|
42
45
|
medium: 34,
|
43
|
-
large:
|
46
|
+
large: 40
|
47
|
+
};
|
48
|
+
var DEFAULT_HIDE_HEADER_CELL_WIDTH = {
|
49
|
+
medium: 38,
|
50
|
+
large: 46
|
44
51
|
};
|
45
52
|
var ROW_HEIGHTS = {
|
46
53
|
compact: {
|
@@ -52,43 +59,70 @@ var ROW_HEIGHTS = {
|
|
52
59
|
large: 50
|
53
60
|
},
|
54
61
|
spacious: {
|
55
|
-
medium: 48
|
56
|
-
large: 75
|
62
|
+
medium: 48
|
57
63
|
}
|
58
64
|
};
|
59
65
|
var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
60
|
-
var
|
61
|
-
|
62
|
-
|
63
|
-
var direction = 'ltr'; // useLocale override
|
64
|
-
var scale = 'large'; // useProvider override
|
65
|
-
|
66
|
+
var scale = 'large';
|
67
|
+
var direction = 'ltr';
|
68
|
+
var onAction = props.onAction;
|
66
69
|
var getDefaultWidth = (0, _react.useCallback)();
|
67
|
-
var
|
68
|
-
|
69
|
-
|
70
|
-
|
70
|
+
var getDefaultMinWidth = (0, _react.useCallback)(function (_ref) {
|
71
|
+
var _ref$props = _ref.props,
|
72
|
+
hideHeader = _ref$props.hideHeader,
|
73
|
+
showDivider = _ref$props.showDivider;
|
74
|
+
if (hideHeader) {
|
75
|
+
var width = DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
|
76
|
+
/* istanbul ignore next */
|
77
|
+
return showDivider ? width + 1 : width;
|
78
|
+
}
|
79
|
+
return 75;
|
80
|
+
}, [scale]);
|
81
|
+
|
82
|
+
// Starts when the user selects resize from the menu, ends when resizing ends
|
83
|
+
// used to control the visibility of the resizer Nubbin
|
84
|
+
var _useState = (0, _react.useState)(false),
|
85
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
86
|
+
isInResizeMode = _useState2[0],
|
87
|
+
setIsInResizeMode = _useState2[1];
|
88
|
+
// entering resizing/exiting resizing doesn't trigger a render
|
89
|
+
// with table layout, so we need to track it here
|
90
|
+
var state = (0, _table2.useTableState)(_objectSpread({}, props));
|
71
91
|
var domRef = (0, _react.useRef)(ref);
|
92
|
+
var headerRef = (0, _react.useRef)();
|
72
93
|
var bodyRef = (0, _react.useRef)();
|
73
94
|
var density = props.density || 'regular';
|
95
|
+
var columnLayout = (0, _react.useMemo)(function () {
|
96
|
+
return new _table2.TableColumnLayout({
|
97
|
+
getDefaultWidth: getDefaultWidth,
|
98
|
+
getDefaultMinWidth: getDefaultMinWidth
|
99
|
+
});
|
100
|
+
}, [getDefaultWidth, getDefaultMinWidth]);
|
74
101
|
var layout = (0, _react.useMemo)(function () {
|
75
102
|
return new _layout.TableLayout({
|
76
|
-
// If props.rowHeight is auto,
|
77
|
-
// otherwise use fixed heights.
|
103
|
+
// If props.rowHeight is auto,
|
104
|
+
// then use estimated heights based on scale, otherwise use fixed heights.
|
78
105
|
rowHeight: props.overflowMode === 'wrap' ? null : ROW_HEIGHTS[density][scale],
|
79
106
|
estimatedRowHeight: props.overflowMode === 'wrap' ? ROW_HEIGHTS[density][scale] : null,
|
80
107
|
headingHeight: props.overflowMode === 'wrap' ? null : DEFAULT_HEADER_HEIGHT[scale],
|
81
|
-
estimatedHeadingHeight: props.overflowMode === 'wrap' ? DEFAULT_HEADER_HEIGHT[scale] : null
|
108
|
+
estimatedHeadingHeight: props.overflowMode === 'wrap' ? DEFAULT_HEADER_HEIGHT[scale] : null,
|
109
|
+
columnLayout: columnLayout,
|
110
|
+
initialCollection: state.collection
|
82
111
|
});
|
83
|
-
},
|
84
|
-
|
85
|
-
|
86
|
-
|
112
|
+
},
|
113
|
+
// don't recompute when state.collection changes, only used for initial value
|
114
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
115
|
+
[props.overflowMode, scale, density, columnLayout]);
|
116
|
+
var _useTable = (0, _table.useTable)(_objectSpread(_objectSpread({}, props), {}, {
|
87
117
|
isVirtualized: true,
|
88
118
|
layout: layout,
|
89
119
|
onRowAction: onAction
|
90
120
|
}), state, domRef),
|
91
121
|
gridProps = _useTable.gridProps;
|
122
|
+
var _useState3 = (0, _react.useState)(false),
|
123
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
124
|
+
headerMenuOpen = _useState4[0],
|
125
|
+
setHeaderMenuOpen = _useState4[1];
|
92
126
|
|
93
127
|
// This overrides collection view's renderWrapper to support DOM hierarchy.
|
94
128
|
var renderWrapper = function renderWrapper(parent, reusableView, children, renderChildren) {
|
@@ -130,7 +164,12 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
130
164
|
parent: parent
|
131
165
|
});
|
132
166
|
};
|
167
|
+
|
168
|
+
// Overrides default renderView
|
133
169
|
var renderView = function renderView(type, item) {
|
170
|
+
var _item$column, _item$column2;
|
171
|
+
var isFirstColumn = (item === null || item === void 0 || (_item$column = item.column) === null || _item$column === void 0 ? void 0 : _item$column.index) === 0;
|
172
|
+
var isLastColumn = (item === null || item === void 0 || (_item$column2 = item.column) === null || _item$column2 === void 0 ? void 0 : _item$column2.index) === state.collection.columnCount - 1;
|
134
173
|
switch (type) {
|
135
174
|
case 'header':
|
136
175
|
case 'rowgroup':
|
@@ -145,7 +184,9 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
145
184
|
}
|
146
185
|
case 'column':
|
147
186
|
return (0, _react2.jsx)(TableColumnHeader, {
|
148
|
-
column: item
|
187
|
+
column: item,
|
188
|
+
isFirst: isFirstColumn,
|
189
|
+
isLast: isLastColumn
|
149
190
|
});
|
150
191
|
case 'loader':
|
151
192
|
return (0, _react2.jsx)(CenteredWrapper, null, (0, _react2.jsx)(_index.Loader, {
|
@@ -168,29 +209,40 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
168
209
|
}
|
169
210
|
viewport.current = e;
|
170
211
|
}, []);
|
212
|
+
var _useFocusRing = (0, _reactAria.useFocusRing)(),
|
213
|
+
isFocusVisible = _useFocusRing.isFocusVisible,
|
214
|
+
focusProps = _useFocusRing.focusProps;
|
215
|
+
var isEmpty = state.collection.size === 0;
|
216
|
+
var onFocusedResizer = function onFocusedResizer() {
|
217
|
+
/* istanbul ignore next */
|
218
|
+
bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
219
|
+
};
|
220
|
+
var mergedProps = (0, _reactAria.mergeProps)(gridProps, focusProps);
|
171
221
|
return (0, _react2.jsx)(_DataTableContext.DataTableContext.Provider, {
|
172
222
|
value: {
|
173
223
|
state: state,
|
174
224
|
layout: layout,
|
175
|
-
|
225
|
+
isInResizeMode: isInResizeMode,
|
226
|
+
setIsInResizeMode: setIsInResizeMode,
|
227
|
+
isEmpty: isEmpty,
|
228
|
+
onFocusedResizer: onFocusedResizer,
|
229
|
+
headerMenuOpen: headerMenuOpen,
|
230
|
+
setHeaderMenuOpen: setHeaderMenuOpen
|
176
231
|
}
|
177
|
-
}, (0, _react2.jsx)(_DataTableVirtualizer["default"], (0, _extends2["default"])({
|
178
|
-
style: {
|
179
|
-
whiteSpace: props.overflowMode === 'wrap' ? 'normal' : 'initial'
|
180
|
-
}
|
181
|
-
}, gridProps, {
|
182
|
-
width: width,
|
183
|
-
height: height,
|
232
|
+
}, (0, _react2.jsx)(_DataTableVirtualizer["default"], (0, _extends2["default"])({}, mergedProps, {
|
184
233
|
layout: layout,
|
185
234
|
collection: state.collection,
|
186
|
-
focusedKey: state.selectionManager.focusedKey,
|
187
235
|
renderView: renderView,
|
188
236
|
renderWrapper: renderWrapper,
|
189
|
-
setTableWidth: columnState.setTableWidth,
|
190
237
|
onVisibleRectChange: onVisibleRectChange,
|
191
238
|
domRef: domRef,
|
239
|
+
headerRef: headerRef,
|
192
240
|
bodyRef: bodyRef,
|
193
|
-
|
241
|
+
isFocusVisible: isFocusVisible,
|
242
|
+
height: props.height,
|
243
|
+
style: {
|
244
|
+
whiteSpace: props.overflowMode === 'wrap' ? 'normal' : 'initial'
|
245
|
+
}
|
194
246
|
})));
|
195
247
|
});
|
196
248
|
DataTable.propTypes = {
|
@@ -223,7 +275,10 @@ DataTable.propTypes = {
|
|
223
275
|
/** Callback function that fires when sortable column header is pressed. */
|
224
276
|
onSortChange: _propTypes["default"].func,
|
225
277
|
/** Defines the current column key to sort by and the sort direction. */
|
226
|
-
sortDescriptor: _propTypes["default"].
|
278
|
+
sortDescriptor: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
279
|
+
column: _propTypes["default"].string,
|
280
|
+
direction: _propTypes["default"].oneOf(['ascending', 'descending'])
|
281
|
+
}), _propTypes["default"].string]),
|
227
282
|
/** Sets the width of table. */
|
228
283
|
width: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
|
229
284
|
};
|
@@ -231,31 +286,35 @@ DataTable.defaultProps = {
|
|
231
286
|
width: '100%',
|
232
287
|
height: 565
|
233
288
|
};
|
234
|
-
function TableHeader(
|
235
|
-
var children =
|
236
|
-
otherProps = (0, _objectWithoutProperties2["default"])(
|
237
|
-
var _useTableRowGroup = (0,
|
289
|
+
var TableHeader = function TableHeader(_ref2) {
|
290
|
+
var children = _ref2.children,
|
291
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
292
|
+
var _useTableRowGroup = (0, _table.useTableRowGroup)(),
|
238
293
|
rowGroupProps = _useTableRowGroup.rowGroupProps;
|
239
294
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, rowGroupProps, otherProps), children);
|
240
|
-
}
|
241
|
-
function TableColumnHeader(props) {
|
242
|
-
var _state$sortDescriptor, _state$sortDescriptor2;
|
243
|
-
var column = props.column
|
295
|
+
};
|
296
|
+
var TableColumnHeader = function TableColumnHeader(props) {
|
297
|
+
var _state$sortDescriptor, _state$sortDescriptor2, _useStatusClasses2, _state$sortDescriptor3;
|
298
|
+
var column = props.column,
|
299
|
+
isFirst = props.isFirst,
|
300
|
+
isLast = props.isLast;
|
244
301
|
var ref = (0, _react.useRef)(null);
|
245
302
|
var _useDataTableContext = (0, _DataTableContext.useDataTableContext)(),
|
246
303
|
state = _useDataTableContext.state;
|
247
|
-
var _useTableColumnHeader = (0,
|
304
|
+
var _useTableColumnHeader = (0, _table.useTableColumnHeader)({
|
248
305
|
node: column,
|
249
306
|
isVirtualized: true
|
250
307
|
}, state, ref),
|
251
308
|
columnHeaderProps = _useTableColumnHeader.columnHeaderProps;
|
252
309
|
var columnProps = column.props;
|
253
310
|
var arrowIcon = ((_state$sortDescriptor = state.sortDescriptor) === null || _state$sortDescriptor === void 0 ? void 0 : _state$sortDescriptor.direction) === 'ascending' && column.key === ((_state$sortDescriptor2 = state.sortDescriptor) === null || _state$sortDescriptor2 === void 0 ? void 0 : _state$sortDescriptor2.column) ? (0, _react2.jsx)(_index.Icon, {
|
311
|
+
size: 24,
|
254
312
|
icon: _MenuUpIcon["default"],
|
255
313
|
title: {
|
256
314
|
name: 'Menu Up Icon'
|
257
315
|
}
|
258
316
|
}) : (0, _react2.jsx)(_index.Icon, {
|
317
|
+
size: 24,
|
259
318
|
icon: _MenuDownIcon["default"],
|
260
319
|
color: "active",
|
261
320
|
title: {
|
@@ -263,47 +322,48 @@ function TableColumnHeader(props) {
|
|
263
322
|
}
|
264
323
|
});
|
265
324
|
var allProps = [columnHeaderProps];
|
266
|
-
var _useStatusClasses = (0, _hooks.useStatusClasses)((
|
325
|
+
var _useStatusClasses = (0, _hooks.useStatusClasses)((_useStatusClasses2 = {
|
267
326
|
'is-column-sortable': columnProps.allowsSorting
|
268
|
-
}, "is-align-".concat(columnProps.align), columnProps.align)),
|
327
|
+
}, (0, _defineProperty2["default"])(_useStatusClasses2, "is-align-".concat(columnProps.align), columnProps.align), (0, _defineProperty2["default"])(_useStatusClasses2, 'is-first-column', isFirst), (0, _defineProperty2["default"])(_useStatusClasses2, 'is-last-column', isLast), _useStatusClasses2)),
|
269
328
|
classNames = _useStatusClasses.classNames;
|
270
329
|
return (0, _react2.jsx)(_reactAria.FocusRing, {
|
271
330
|
focusRingClass: "is-key-focused",
|
272
331
|
focusClass: "is-click-focused"
|
273
|
-
}, (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
332
|
+
}, (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
333
|
+
pl: column.index === 0 ? 0 : 'lg',
|
274
334
|
ref: ref,
|
275
335
|
variant: "dataTable.tableHeadCell",
|
276
336
|
className: classNames
|
277
|
-
}), columnProps.hideHeader ? (0, _react2.jsx)(_reactAria.VisuallyHidden, null, column.rendered) : (0, _react2.jsx)(_index.Box, null, column.rendered), columnProps.allowsSorting && (0, _react2.jsx)(_index.Box, null, arrowIcon)));
|
278
|
-
}
|
279
|
-
function TableRowGroup(
|
280
|
-
var children =
|
281
|
-
otherProps = (0, _objectWithoutProperties2["default"])(
|
282
|
-
var _useTableRowGroup2 = (0,
|
337
|
+
}, _reactAria.mergeProps.apply(void 0, (0, _concat["default"])(allProps).call(allProps, [column.props.cellProps]))), columnProps.hideHeader ? (0, _react2.jsx)(_reactAria.VisuallyHidden, null, column.rendered) : (0, _react2.jsx)(_index.Box, null, column.rendered), columnProps.allowsSorting && ((_state$sortDescriptor3 = state.sortDescriptor) === null || _state$sortDescriptor3 === void 0 ? void 0 : _state$sortDescriptor3.column) === column.key && (0, _react2.jsx)(_index.Box, null, arrowIcon)));
|
338
|
+
};
|
339
|
+
var TableRowGroup = function TableRowGroup(_ref3) {
|
340
|
+
var children = _ref3.children,
|
341
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref3, _excluded2);
|
342
|
+
var _useTableRowGroup2 = (0, _table.useTableRowGroup)(),
|
283
343
|
rowGroupProps = _useTableRowGroup2.rowGroupProps;
|
284
344
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, rowGroupProps, otherProps), children);
|
285
|
-
}
|
286
|
-
function TableRow(
|
287
|
-
var item =
|
288
|
-
children =
|
289
|
-
hasActions =
|
290
|
-
otherProps = (0, _objectWithoutProperties2["default"])(
|
345
|
+
};
|
346
|
+
var TableRow = function TableRow(_ref4) {
|
347
|
+
var item = _ref4.item,
|
348
|
+
children = _ref4.children,
|
349
|
+
hasActions = _ref4.hasActions,
|
350
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded3);
|
291
351
|
var ref = (0, _react.useRef)();
|
292
352
|
var _useDataTableContext2 = (0, _DataTableContext.useDataTableContext)(),
|
293
353
|
state = _useDataTableContext2.state;
|
294
|
-
var _useTableRow = (0,
|
354
|
+
var _useTableRow = (0, _table.useTableRow)({
|
295
355
|
node: item,
|
296
356
|
isVirtualized: true
|
297
357
|
}, state, ref),
|
298
358
|
rowProps = _useTableRow.rowProps;
|
299
|
-
var
|
359
|
+
var _useFocusRing2 = (0, _reactAria.useFocusRing)({
|
300
360
|
within: true
|
301
361
|
}),
|
302
|
-
isFocusVisibleWithin =
|
303
|
-
focusWithinProps =
|
304
|
-
var
|
305
|
-
isFocusVisible =
|
306
|
-
focusProps =
|
362
|
+
isFocusVisibleWithin = _useFocusRing2.isFocusVisible,
|
363
|
+
focusWithinProps = _useFocusRing2.focusProps;
|
364
|
+
var _useFocusRing3 = (0, _reactAria.useFocusRing)(),
|
365
|
+
isFocusVisible = _useFocusRing3.isFocusVisible,
|
366
|
+
focusProps = _useFocusRing3.focusProps;
|
307
367
|
var props = (0, _reactAria.mergeProps)(rowProps, otherProps, focusWithinProps, focusProps);
|
308
368
|
var _useStatusClasses3 = (0, _hooks.useStatusClasses)({
|
309
369
|
'is-row-focus-visible': isFocusVisible || isFocusVisibleWithin
|
@@ -314,15 +374,15 @@ function TableRow(_ref3) {
|
|
314
374
|
variant: "dataTable.tableRow",
|
315
375
|
className: classNames
|
316
376
|
}), children);
|
317
|
-
}
|
318
|
-
function TableHeaderRow(
|
319
|
-
var item =
|
320
|
-
children =
|
321
|
-
style =
|
377
|
+
};
|
378
|
+
var TableHeaderRow = function TableHeaderRow(_ref5) {
|
379
|
+
var item = _ref5.item,
|
380
|
+
children = _ref5.children,
|
381
|
+
style = _ref5.style;
|
322
382
|
var _useDataTableContext3 = (0, _DataTableContext.useDataTableContext)(),
|
323
383
|
state = _useDataTableContext3.state;
|
324
384
|
var ref = (0, _react.useRef)();
|
325
|
-
var _useTableHeaderRow = (0,
|
385
|
+
var _useTableHeaderRow = (0, _table.useTableHeaderRow)({
|
326
386
|
node: item,
|
327
387
|
isVirtualized: true
|
328
388
|
}, state, ref),
|
@@ -331,14 +391,14 @@ function TableHeaderRow(_ref4) {
|
|
331
391
|
ref: ref,
|
332
392
|
style: style
|
333
393
|
}), children);
|
334
|
-
}
|
335
|
-
function TableCell(
|
336
|
-
var cell =
|
394
|
+
};
|
395
|
+
var TableCell = function TableCell(_ref6) {
|
396
|
+
var cell = _ref6.cell;
|
337
397
|
var _useDataTableContext4 = (0, _DataTableContext.useDataTableContext)(),
|
338
398
|
state = _useDataTableContext4.state;
|
339
399
|
var ref = (0, _react.useRef)();
|
340
400
|
var columnProps = cell.column.props;
|
341
|
-
var _useTableCell = (0,
|
401
|
+
var _useTableCell = (0, _table.useTableCell)({
|
342
402
|
node: cell,
|
343
403
|
isVirtualized: true
|
344
404
|
}, state, ref),
|
@@ -347,16 +407,17 @@ function TableCell(_ref5) {
|
|
347
407
|
classNames = _useStatusClasses4.classNames;
|
348
408
|
return (0, _react2.jsx)(_reactAria.FocusRing, {
|
349
409
|
focusRingClass: "is-key-focused"
|
350
|
-
}, (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
410
|
+
}, (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
411
|
+
pl: cell.index === 0 ? 0 : 'lg',
|
351
412
|
ref: ref,
|
352
413
|
variant: "dataTable.tableCell",
|
353
414
|
className: classNames
|
354
|
-
}), (0, _react2.jsx)(_index.Box, {
|
415
|
+
}, (0, _reactAria.mergeProps)(gridCellProps, cell.props.cellProps)), (0, _react2.jsx)(_index.Box, {
|
355
416
|
variant: "dataTable.tableCellContents"
|
356
417
|
}, cell.rendered)));
|
357
|
-
}
|
358
|
-
function CenteredWrapper(
|
359
|
-
var children =
|
418
|
+
};
|
419
|
+
var CenteredWrapper = function CenteredWrapper(_ref7) {
|
420
|
+
var children = _ref7.children;
|
360
421
|
var _useDataTableContext5 = (0, _DataTableContext.useDataTableContext)(),
|
361
422
|
state = _useDataTableContext5.state;
|
362
423
|
return (0, _react2.jsx)(_index.Box, {
|
@@ -367,7 +428,7 @@ function CenteredWrapper(_ref6) {
|
|
367
428
|
role: "rowheader",
|
368
429
|
"aria-colspan": state.collection.columns.length
|
369
430
|
}, children));
|
370
|
-
}
|
431
|
+
};
|
371
432
|
TableCell.propTypes = {
|
372
433
|
cell: _propTypes["default"].shape({
|
373
434
|
column: _propTypes["default"].shape({
|
@@ -375,7 +436,11 @@ TableCell.propTypes = {
|
|
375
436
|
align: _propTypes["default"].string
|
376
437
|
})
|
377
438
|
}),
|
439
|
+
index: _propTypes["default"].number,
|
378
440
|
parentKey: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].string]),
|
441
|
+
props: _propTypes["default"].shape({
|
442
|
+
cellProps: _propTypes["default"].shape({})
|
443
|
+
}),
|
379
444
|
rendered: _propTypes["default"].node
|
380
445
|
})
|
381
446
|
};
|
@@ -391,14 +456,18 @@ TableRow.propTypes = {
|
|
391
456
|
};
|
392
457
|
TableColumnHeader.propTypes = {
|
393
458
|
column: _propTypes["default"].shape({
|
459
|
+
index: _propTypes["default"].number,
|
394
460
|
key: _propTypes["default"].string,
|
395
461
|
props: _propTypes["default"].shape({
|
396
462
|
align: _propTypes["default"].string,
|
397
463
|
allowsSorting: _propTypes["default"].bool,
|
464
|
+
cellProps: _propTypes["default"].shape({}),
|
398
465
|
hideHeader: _propTypes["default"].bool
|
399
466
|
}),
|
400
467
|
rendered: _propTypes["default"].node
|
401
|
-
})
|
468
|
+
}),
|
469
|
+
isFirst: _propTypes["default"].bool,
|
470
|
+
isLast: _propTypes["default"].bool
|
402
471
|
};
|
403
472
|
var _default = DataTable;
|
404
473
|
exports["default"] = _default;
|