@pingux/astro 2.133.0 → 2.134.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/Box/Box.styles.d.ts +4 -0
- package/lib/cjs/components/Box/Box.styles.js +5 -0
- package/lib/cjs/components/TableBase/TableBase.js +36 -6
- package/lib/cjs/components/TableBase/TableBase.stories.d.ts +14 -0
- package/lib/cjs/components/TableBase/TableBase.stories.js +193 -6
- package/lib/cjs/components/TableBase/TableBase.styles.d.ts +17 -1
- package/lib/cjs/components/TableBase/TableBase.styles.js +11 -2
- package/lib/cjs/components/TableBase/TableBase.test.js +267 -0
- package/lib/cjs/components/TableBase/stories/NextGenTableBase.js +2 -4
- package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themes/astro/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themes/astro/customProperties/icons.js +1 -1
- package/lib/cjs/styles/themes/astro/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/customProperties/icons.js +1 -1
- package/lib/cjs/styles/themes/next-gen/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +7 -3
- package/lib/cjs/styles/themes/next-gen/variants/cards.d.ts +0 -1
- package/lib/cjs/styles/themes/next-gen/variants/cards.js +1 -3
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.d.ts +4 -2
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.js +4 -2
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +7 -2
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +4 -0
- package/lib/components/Box/Box.styles.js +5 -0
- package/lib/components/TableBase/TableBase.js +38 -8
- package/lib/components/TableBase/TableBase.stories.js +195 -8
- package/lib/components/TableBase/TableBase.styles.js +11 -2
- package/lib/components/TableBase/TableBase.test.js +267 -1
- package/lib/components/TableBase/stories/NextGenTableBase.js +3 -5
- package/lib/styles/themes/astro/customProperties/icons.js +1 -1
- package/lib/styles/themes/next-gen/customProperties/icons.js +1 -1
- package/lib/styles/themes/next-gen/variants/cards.js +1 -3
- package/lib/styles/themes/next-gen/variants/tableBase.js +4 -2
- package/lib/styles/themes/next-gen/variants/variants.js +4 -0
- package/package.json +1 -1
@@ -5,6 +5,7 @@ declare const _default: {
|
|
5
5
|
indeterminateCheckboxIcon: {
|
6
6
|
width: string;
|
7
7
|
height: string;
|
8
|
+
borderRadius: string;
|
8
9
|
'& rect[id="indeterminate-checkbox-icon-wrapper"]': {
|
9
10
|
fill: string;
|
10
11
|
stroke: string;
|
@@ -15,6 +16,9 @@ declare const _default: {
|
|
15
16
|
stroke: string;
|
16
17
|
};
|
17
18
|
};
|
19
|
+
'&.is-focused': {
|
20
|
+
boxShadow: string;
|
21
|
+
};
|
18
22
|
};
|
19
23
|
};
|
20
24
|
export default _default;
|
@@ -5,12 +5,14 @@ _Object$defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports["default"] = void 0;
|
8
|
+
var _colors = require("../../styles/colors");
|
8
9
|
var base = {
|
9
10
|
display: 'flex'
|
10
11
|
};
|
11
12
|
var indeterminateCheckboxIcon = {
|
12
13
|
width: '24px',
|
13
14
|
height: '24px',
|
15
|
+
borderRadius: '4px',
|
14
16
|
'& rect[id="indeterminate-checkbox-icon-wrapper"]': {
|
15
17
|
fill: 'active',
|
16
18
|
stroke: 'active'
|
@@ -20,6 +22,9 @@ var indeterminateCheckboxIcon = {
|
|
20
22
|
fill: 'neutral.80',
|
21
23
|
stroke: 'neutral.80'
|
22
24
|
}
|
25
|
+
},
|
26
|
+
'&.is-focused': {
|
27
|
+
boxShadow: "inset 0px 0px 0px 1px ".concat(_colors.focus)
|
23
28
|
}
|
24
29
|
};
|
25
30
|
var _default = {
|
@@ -63,7 +63,6 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
63
63
|
var bodyRef = (0, _react.useRef)(null);
|
64
64
|
var collection = state.collection;
|
65
65
|
var _useTable = (0, _table.useTable)(_objectSpread(_objectSpread({}, props), {}, {
|
66
|
-
'aria-describedby': props['aria-describedby'] || 'table-caption',
|
67
66
|
scrollRef: bodyRef
|
68
67
|
}), state, tableRef),
|
69
68
|
gridProps = _useTable.gridProps;
|
@@ -105,8 +104,7 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
105
104
|
as: "caption",
|
106
105
|
display: "table-caption",
|
107
106
|
variant: "tableBase.caption",
|
108
|
-
textAlign: "left"
|
109
|
-
id: props['aria-describedby'] || 'table-caption'
|
107
|
+
textAlign: "left"
|
110
108
|
}, caption), (0, _react2.jsx)(TableRowGroup, {
|
111
109
|
type: "thead",
|
112
110
|
hasCaption: !!caption,
|
@@ -133,7 +131,18 @@ var TableBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
133
131
|
})), (0, _react2.jsx)(TableRowGroup, (0, _extends2["default"])({
|
134
132
|
ref: bodyRef,
|
135
133
|
type: "tbody"
|
136
|
-
}, tableBodyProps),
|
134
|
+
}, tableBodyProps), collection.size === 0 && (0, _react2.jsx)(_.Box, {
|
135
|
+
role: "row",
|
136
|
+
key: "loading",
|
137
|
+
"data-testid": "loading",
|
138
|
+
as: "tr",
|
139
|
+
alignItems: "center",
|
140
|
+
justifyContent: "center",
|
141
|
+
px: "lg",
|
142
|
+
py: "md"
|
143
|
+
}, (0, _react2.jsx)(_.Loader, {
|
144
|
+
color: "active"
|
145
|
+
})), (0, _map["default"])(_context3 = (0, _from["default"])(collection)).call(_context3, function (row) {
|
137
146
|
var _context4;
|
138
147
|
return (0, _react2.jsx)(TableRow, {
|
139
148
|
key: row.key,
|
@@ -195,6 +204,7 @@ function TableHeaderRow(props) {
|
|
195
204
|
}), children);
|
196
205
|
}
|
197
206
|
function TableColumnHeader(props) {
|
207
|
+
var _column$props;
|
198
208
|
var column = props.column,
|
199
209
|
state = props.state,
|
200
210
|
className = props.className,
|
@@ -207,19 +217,37 @@ function TableColumnHeader(props) {
|
|
207
217
|
var _useFocusRing = (0, _focus.useFocusRing)(),
|
208
218
|
isFocusVisible = _useFocusRing.isFocusVisible,
|
209
219
|
focusProps = _useFocusRing.focusProps;
|
220
|
+
var allowsSorting = (_column$props = column.props) === null || _column$props === void 0 ? void 0 : _column$props.allowsSorting;
|
221
|
+
var _useGetTheme = (0, _hooks.useGetTheme)(),
|
222
|
+
icons = _useGetTheme.icons;
|
223
|
+
var Ascending = icons.Ascending,
|
224
|
+
Descending = icons.Descending;
|
225
|
+
var sortDescriptor = state.sortDescriptor;
|
226
|
+
var arrowIcon = (sortDescriptor === null || sortDescriptor === void 0 ? void 0 : sortDescriptor.column) === column.key && (sortDescriptor === null || sortDescriptor === void 0 ? void 0 : sortDescriptor.direction) === 'ascending' ? Ascending : Descending;
|
227
|
+
var sortIcon = (0, _react2.jsx)(_.Icon, {
|
228
|
+
icon: arrowIcon,
|
229
|
+
size: "xs",
|
230
|
+
"aria-hidden": "true",
|
231
|
+
title: {
|
232
|
+
name: (sortDescriptor === null || sortDescriptor === void 0 ? void 0 : sortDescriptor.direction) === 'ascending' ? 'Sort ascending' : 'Sort descending'
|
233
|
+
}
|
234
|
+
});
|
210
235
|
var _useStatusClasses2 = (0, _hooks.useStatusClasses)(className, {
|
211
236
|
isFocused: isFocusVisible
|
212
237
|
}),
|
213
238
|
classNames = _useStatusClasses2.classNames;
|
214
239
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
240
|
+
isRow: true,
|
215
241
|
ref: ref,
|
216
242
|
as: "th",
|
217
243
|
variant: "tableBase.head",
|
218
244
|
className: classNames,
|
245
|
+
alignItems: "center",
|
219
246
|
sx: _objectSpread({
|
247
|
+
gap: 'sm',
|
220
248
|
width: layoutState === null || layoutState === void 0 ? void 0 : layoutState.getColumnWidth(column.key)
|
221
249
|
}, column.props.sx)
|
222
|
-
}, (0, _utils.mergeProps)(columnHeaderProps, focusProps, column.props)), column.rendered);
|
250
|
+
}, (0, _utils.mergeProps)(columnHeaderProps, focusProps, column.props)), column.rendered, allowsSorting && sortIcon);
|
223
251
|
}
|
224
252
|
function TableRow(props) {
|
225
253
|
var item = props.item,
|
@@ -232,6 +260,7 @@ function TableRow(props) {
|
|
232
260
|
}, state, ref),
|
233
261
|
rowProps = _useTableRow.rowProps;
|
234
262
|
var isSelected = state.selectionManager.isSelected(item.key);
|
263
|
+
var isDisabled = state.disabledKeys.has(item.key);
|
235
264
|
var _useFocusRing2 = (0, _focus.useFocusRing)(),
|
236
265
|
isFocusVisible = _useFocusRing2.isFocusVisible,
|
237
266
|
focusProps = _useFocusRing2.focusProps;
|
@@ -247,7 +276,8 @@ function TableRow(props) {
|
|
247
276
|
isSelected: isSelected,
|
248
277
|
isHovered: isHovered,
|
249
278
|
isPressed: isPressed,
|
250
|
-
isFocused: isFocusVisible
|
279
|
+
isFocused: isFocusVisible,
|
280
|
+
isDisabled: isDisabled
|
251
281
|
}),
|
252
282
|
classNames = _useStatusClasses3.classNames;
|
253
283
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import { StoryFn } from '@storybook/react';
|
2
3
|
import { TableBaseProps } from '../../types/tableBase';
|
3
4
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
@@ -6,3 +7,16 @@ export declare const Default: StoryFn<TableBaseProps<object>>;
|
|
6
7
|
export declare const MultiSelection: StoryFn<TableBaseProps<object>>;
|
7
8
|
export declare const WithStickyHeader: StoryFn<TableBaseProps<object>>;
|
8
9
|
export declare const WithPagination: StoryFn<TableBaseProps<object>>;
|
10
|
+
export declare const DynamicWithSorting: {
|
11
|
+
(): React.JSX.Element;
|
12
|
+
parameters: {
|
13
|
+
a11y: {
|
14
|
+
config: {
|
15
|
+
rules: {
|
16
|
+
id: string;
|
17
|
+
enabled: boolean;
|
18
|
+
}[];
|
19
|
+
};
|
20
|
+
};
|
21
|
+
};
|
22
|
+
};
|
@@ -1,19 +1,33 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
-
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
5
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
5
|
+
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
6
|
+
var _Object$create = require("@babel/runtime-corejs3/core-js-stable/object/create");
|
7
|
+
var _Object$getPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
|
8
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
9
|
+
var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
|
10
|
+
var _Promise = require("@babel/runtime-corejs3/core-js-stable/promise");
|
11
|
+
var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
|
12
|
+
var _sliceInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
13
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
6
14
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
7
15
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
8
16
|
_Object$defineProperty(exports, "__esModule", {
|
9
17
|
value: true
|
10
18
|
});
|
11
|
-
exports["default"] = exports.WithStickyHeader = exports.WithPagination = exports.MultiSelection = exports.Default = void 0;
|
19
|
+
exports["default"] = exports.WithStickyHeader = exports.WithPagination = exports.MultiSelection = exports.DynamicWithSorting = exports.Default = void 0;
|
12
20
|
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
13
21
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
14
22
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
23
|
+
var _isNan = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/number/is-nan"));
|
24
|
+
var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
|
25
|
+
var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
26
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
15
27
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
16
28
|
var _react = _interopRequireWildcard(require("react"));
|
29
|
+
var _i18n = require("@react-aria/i18n");
|
30
|
+
var _data = require("@react-stately/data");
|
17
31
|
var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
|
18
32
|
var _ = require("../..");
|
19
33
|
var _hooks = require("../../hooks");
|
@@ -22,6 +36,7 @@ var _TableBase = _interopRequireDefault(require("./TableBase.mdx"));
|
|
22
36
|
var _react2 = require("@emotion/react");
|
23
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); }
|
24
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; }
|
39
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context5; _forEachInstanceProperty(_context5 = ["next", "throw", "return"]).call(_context5, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context6; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context6 = this.tryEntries).call(_context6, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty2(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
25
40
|
var _default = {
|
26
41
|
title: 'Experimental/Table',
|
27
42
|
component: _.TableBase,
|
@@ -126,6 +141,9 @@ var WithStickyHeader = function WithStickyHeader() {
|
|
126
141
|
return (0, _react2.jsx)(_.TableBase, {
|
127
142
|
"aria-label": "table",
|
128
143
|
isStickyHeader: true,
|
144
|
+
selectionMode: "single",
|
145
|
+
defaultSelectedKeys: ['2'],
|
146
|
+
disabledKeys: ['3'],
|
129
147
|
tableBodyProps: {
|
130
148
|
style: {
|
131
149
|
height: '300px'
|
@@ -144,8 +162,8 @@ var WithStickyHeader = function WithStickyHeader() {
|
|
144
162
|
}, function (item) {
|
145
163
|
var _context;
|
146
164
|
return (0, _react2.jsx)(_.Row, {
|
147
|
-
key: item.
|
148
|
-
}, (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, {
|
165
|
+
key: item.id
|
166
|
+
}, (0, _react2.jsx)(_.Cell, null, (0, _concat["default"])(_context = "".concat(item.firstName, " ")).call(_context, item.lastName), ' ', item.id), (0, _react2.jsx)(_.Cell, null, item.email), (0, _react2.jsx)(_.Cell, null, (0, _react2.jsx)(_.Badge, {
|
149
167
|
variant: statusVariant[item.status],
|
150
168
|
label: item.status
|
151
169
|
})), (0, _react2.jsx)(_.Cell, null, (0, _react2.jsx)(_.Text, {
|
@@ -154,6 +172,19 @@ var WithStickyHeader = function WithStickyHeader() {
|
|
154
172
|
}));
|
155
173
|
};
|
156
174
|
exports.WithStickyHeader = WithStickyHeader;
|
175
|
+
WithStickyHeader.parameters = {
|
176
|
+
a11y: {
|
177
|
+
config: {
|
178
|
+
rules: [{
|
179
|
+
id: 'color-contrast',
|
180
|
+
enabled: false
|
181
|
+
}, {
|
182
|
+
id: 'scrollable-region-focusable',
|
183
|
+
enabled: false
|
184
|
+
}]
|
185
|
+
}
|
186
|
+
}
|
187
|
+
};
|
157
188
|
var ExampleTable = function ExampleTable() {
|
158
189
|
var _usePaginationState = (0, _hooks.usePaginationState)(),
|
159
190
|
paginationState = _usePaginationState.paginationState;
|
@@ -187,11 +218,167 @@ var WithPagination = function WithPagination() {
|
|
187
218
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
188
219
|
offsetCount = _useState2[0],
|
189
220
|
setOffsetCount = _useState2[1];
|
190
|
-
return (0, _react2.jsx)(_.PaginationProvider, null, (0, _react2.jsx)(
|
221
|
+
return (0, _react2.jsx)(_.PaginationProvider, null, (0, _react2.jsx)(_.Box, {
|
222
|
+
gap: "sm"
|
223
|
+
}, (0, _react2.jsx)(ExampleTable, null), (0, _react2.jsx)(_.Pagination, {
|
191
224
|
totalCount: _items.items.length,
|
192
225
|
offsetCount: offsetCount,
|
193
226
|
onOffsetCountChange: setOffsetCount,
|
194
227
|
offsetOptions: [10, 20, 50, 100]
|
228
|
+
})));
|
229
|
+
};
|
230
|
+
exports.WithPagination = WithPagination;
|
231
|
+
WithPagination.parameters = {
|
232
|
+
a11y: {
|
233
|
+
config: {
|
234
|
+
rules: [{
|
235
|
+
id: 'color-contrast',
|
236
|
+
enabled: false
|
237
|
+
}]
|
238
|
+
}
|
239
|
+
}
|
240
|
+
};
|
241
|
+
var DynamicWithSorting = function DynamicWithSorting() {
|
242
|
+
var columns = [{
|
243
|
+
name: 'Country',
|
244
|
+
key: 'country',
|
245
|
+
isSortable: true
|
246
|
+
}, {
|
247
|
+
name: 'Population',
|
248
|
+
key: 'population',
|
249
|
+
isSortable: true
|
250
|
+
}, {
|
251
|
+
name: 'Continent',
|
252
|
+
key: 'continent',
|
253
|
+
isSortable: true
|
254
|
+
}];
|
255
|
+
var rows = [{
|
256
|
+
id: 1,
|
257
|
+
country: 'Austria',
|
258
|
+
population: '25,000,000',
|
259
|
+
continent: 'Oceania'
|
260
|
+
}, {
|
261
|
+
id: 2,
|
262
|
+
country: 'Canada',
|
263
|
+
population: '37,000,000',
|
264
|
+
continent: 'North America'
|
265
|
+
}, {
|
266
|
+
id: 3,
|
267
|
+
country: 'China',
|
268
|
+
population: '1,398,000,000',
|
269
|
+
continent: 'Asia'
|
270
|
+
}, {
|
271
|
+
id: 4,
|
272
|
+
country: 'Ethiopia',
|
273
|
+
population: '120,000,000',
|
274
|
+
continent: 'Africa'
|
275
|
+
}, {
|
276
|
+
id: 5,
|
277
|
+
country: 'France',
|
278
|
+
population: '67,000,000',
|
279
|
+
continent: 'Europe'
|
280
|
+
}, {
|
281
|
+
id: 6,
|
282
|
+
country: 'Mexico',
|
283
|
+
population: '126,000,000',
|
284
|
+
continent: 'North America'
|
285
|
+
}, {
|
286
|
+
id: 7,
|
287
|
+
country: 'USA',
|
288
|
+
population: '320,000,000',
|
289
|
+
continent: 'North America'
|
290
|
+
}];
|
291
|
+
var collator = (0, _i18n.useCollator)({
|
292
|
+
numeric: true
|
293
|
+
});
|
294
|
+
var list = (0, _data.useAsyncList)({
|
295
|
+
load: function load() {
|
296
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
297
|
+
return _regeneratorRuntime().wrap(function _callee$(_context3) {
|
298
|
+
while (1) switch (_context3.prev = _context3.next) {
|
299
|
+
case 0:
|
300
|
+
return _context3.abrupt("return", {
|
301
|
+
items: rows
|
302
|
+
});
|
303
|
+
case 1:
|
304
|
+
case "end":
|
305
|
+
return _context3.stop();
|
306
|
+
}
|
307
|
+
}, _callee);
|
308
|
+
}))();
|
309
|
+
},
|
310
|
+
sort: function sort(_ref) {
|
311
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
312
|
+
var items, sortDescriptor, getNumericValue;
|
313
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context4) {
|
314
|
+
while (1) switch (_context4.prev = _context4.next) {
|
315
|
+
case 0:
|
316
|
+
items = _ref.items, sortDescriptor = _ref.sortDescriptor;
|
317
|
+
getNumericValue = function getNumericValue(str) {
|
318
|
+
return !(0, _isNan["default"])(str) && (0, _parseFloat2["default"])(str.replace(/,/g, ''));
|
319
|
+
};
|
320
|
+
return _context4.abrupt("return", {
|
321
|
+
items: (0, _sort["default"])(items).call(items, function (a, b) {
|
322
|
+
if (sortDescriptor.column) {
|
323
|
+
var first = a[sortDescriptor.column];
|
324
|
+
var second = b[sortDescriptor.column];
|
325
|
+
var firstNumericValue = getNumericValue(first);
|
326
|
+
var secondNumericValue = getNumericValue(second);
|
327
|
+
var cmp = firstNumericValue && secondNumericValue ? firstNumericValue - secondNumericValue : collator.compare(first, second);
|
328
|
+
return sortDescriptor.direction === 'descending' ? -cmp : cmp;
|
329
|
+
}
|
330
|
+
return 1;
|
331
|
+
})
|
332
|
+
});
|
333
|
+
case 3:
|
334
|
+
case "end":
|
335
|
+
return _context4.stop();
|
336
|
+
}
|
337
|
+
}, _callee2);
|
338
|
+
}))();
|
339
|
+
},
|
340
|
+
initialSortDescriptor: {
|
341
|
+
column: 'country',
|
342
|
+
direction: 'ascending'
|
343
|
+
}
|
344
|
+
});
|
345
|
+
return (0, _react2.jsx)(_.TableBase, {
|
346
|
+
"aria-label": "Dynamic table",
|
347
|
+
onSortChange: function onSortChange(descriptor) {
|
348
|
+
if (descriptor.column) {
|
349
|
+
(0, _sort["default"])(list).call(list, descriptor);
|
350
|
+
}
|
351
|
+
},
|
352
|
+
sortDescriptor: list.sortDescriptor
|
353
|
+
}, (0, _react2.jsx)(_.THead, {
|
354
|
+
columns: columns
|
355
|
+
}, function (column) {
|
356
|
+
return (0, _react2.jsx)(_.Column, {
|
357
|
+
minWidth: 155,
|
358
|
+
allowsSorting: true
|
359
|
+
}, column.name);
|
360
|
+
}), (0, _react2.jsx)(_.TBody, {
|
361
|
+
items: list.items,
|
362
|
+
loadingState: list.loadingState,
|
363
|
+
onLoadMore: list.loadMore
|
364
|
+
}, function (item) {
|
365
|
+
return (0, _react2.jsx)(_.Row, {
|
366
|
+
key: item.name
|
367
|
+
}, function (columnKey) {
|
368
|
+
return (0, _react2.jsx)(_.Cell, null, item[columnKey]);
|
369
|
+
});
|
195
370
|
}));
|
196
371
|
};
|
197
|
-
|
372
|
+
|
373
|
+
// Added to bypass color contrast issue due to virtualizer
|
374
|
+
exports.DynamicWithSorting = DynamicWithSorting;
|
375
|
+
DynamicWithSorting.parameters = {
|
376
|
+
a11y: {
|
377
|
+
config: {
|
378
|
+
rules: [{
|
379
|
+
id: 'color-contrast',
|
380
|
+
enabled: false
|
381
|
+
}]
|
382
|
+
}
|
383
|
+
}
|
384
|
+
};
|
@@ -50,6 +50,9 @@ declare const _default: {
|
|
50
50
|
textAlign: string;
|
51
51
|
p: string;
|
52
52
|
cursor: string;
|
53
|
+
'&:focus-visible': {
|
54
|
+
outline: string;
|
55
|
+
};
|
53
56
|
'&.is-focused': {
|
54
57
|
outline: string;
|
55
58
|
outlineStyle: string;
|
@@ -69,6 +72,9 @@ declare const _default: {
|
|
69
72
|
'&:nth-of-type(odd) ': {
|
70
73
|
bg: string;
|
71
74
|
};
|
75
|
+
'&:focus-visible': {
|
76
|
+
outline: string;
|
77
|
+
};
|
72
78
|
'&.is-focused': {
|
73
79
|
outline: string;
|
74
80
|
outlineStyle: string;
|
@@ -76,7 +82,17 @@ declare const _default: {
|
|
76
82
|
outlineOffset: string;
|
77
83
|
};
|
78
84
|
'&.is-hovered': {};
|
79
|
-
'&.is-selected': {
|
85
|
+
'&.is-selected': {
|
86
|
+
outline: string;
|
87
|
+
outlineStyle: string;
|
88
|
+
outlineColor: string;
|
89
|
+
outlineOffset: string;
|
90
|
+
};
|
91
|
+
'&.is-disabled': {
|
92
|
+
bg: string;
|
93
|
+
opacity: number;
|
94
|
+
cursor: string;
|
95
|
+
};
|
80
96
|
};
|
81
97
|
};
|
82
98
|
export default _default;
|
@@ -51,6 +51,9 @@ var head = _objectSpread(_objectSpread({}, _Text.text.label), {}, {
|
|
51
51
|
textAlign: 'left',
|
52
52
|
p: 'sm',
|
53
53
|
cursor: 'default',
|
54
|
+
'&:focus-visible': {
|
55
|
+
outline: 'none'
|
56
|
+
},
|
54
57
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
55
58
|
});
|
56
59
|
var tbody = {
|
@@ -62,12 +65,18 @@ var row = {
|
|
62
65
|
'&:nth-of-type(odd) ': {
|
63
66
|
bg: 'neutral.95'
|
64
67
|
},
|
68
|
+
'&:focus-visible': {
|
69
|
+
outline: 'none'
|
70
|
+
},
|
65
71
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
66
72
|
'&.is-hovered': {
|
67
73
|
// This is the hover state for the row
|
68
74
|
},
|
69
|
-
'&.is-selected': {
|
70
|
-
|
75
|
+
'&.is-selected': _objectSpread({}, defaultFocus),
|
76
|
+
'&.is-disabled': {
|
77
|
+
bg: 'neutral.90',
|
78
|
+
opacity: 0.5,
|
79
|
+
cursor: 'not-allowed'
|
71
80
|
}
|
72
81
|
};
|
73
82
|
var data = _objectSpread(_objectSpread({}, _Text.text.tableData), {}, {
|