@pingux/astro 2.133.0 → 2.134.0-alpha.1

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.
Files changed (61) hide show
  1. package/lib/cjs/components/Box/Box.styles.d.ts +4 -0
  2. package/lib/cjs/components/Box/Box.styles.js +5 -0
  3. package/lib/cjs/components/IconButton/IconButton.styles.d.ts +41 -0
  4. package/lib/cjs/components/IconButton/IconButton.styles.js +14 -1
  5. package/lib/cjs/components/ListBox/Option.js +11 -2
  6. package/lib/cjs/components/SelectField/SelectField.stories.d.ts +1 -0
  7. package/lib/cjs/components/SelectField/SelectField.stories.js +22 -2
  8. package/lib/cjs/components/SelectField/SelectField.test.js +11 -0
  9. package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +48 -27
  10. package/lib/cjs/components/SelectFieldBase/SelectFieldBase.test.js +26 -0
  11. package/lib/cjs/components/TableBase/TableBase.js +36 -6
  12. package/lib/cjs/components/TableBase/TableBase.stories.d.ts +14 -0
  13. package/lib/cjs/components/TableBase/TableBase.stories.js +193 -6
  14. package/lib/cjs/components/TableBase/TableBase.styles.d.ts +17 -1
  15. package/lib/cjs/components/TableBase/TableBase.styles.js +11 -2
  16. package/lib/cjs/components/TableBase/TableBase.test.js +267 -0
  17. package/lib/cjs/components/TableBase/stories/NextGenTableBase.js +2 -4
  18. package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +2 -0
  19. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/icons.d.ts +2 -0
  20. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/index.d.ts +2 -0
  21. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +0 -5
  22. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +0 -5
  23. package/lib/cjs/styles/themes/astro/customProperties/icons.d.ts +2 -0
  24. package/lib/cjs/styles/themes/astro/customProperties/icons.js +1 -1
  25. package/lib/cjs/styles/themes/astro/customProperties/index.d.ts +2 -0
  26. package/lib/cjs/styles/themes/next-gen/customProperties/icons.d.ts +2 -0
  27. package/lib/cjs/styles/themes/next-gen/customProperties/icons.js +1 -1
  28. package/lib/cjs/styles/themes/next-gen/customProperties/index.d.ts +2 -0
  29. package/lib/cjs/styles/themes/next-gen/forms.d.ts +22 -0
  30. package/lib/cjs/styles/themes/next-gen/forms.js +12 -0
  31. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +58 -6
  32. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +38 -2
  33. package/lib/cjs/styles/themes/next-gen/variants/button.js +29 -19
  34. package/lib/cjs/styles/themes/next-gen/variants/cards.d.ts +0 -1
  35. package/lib/cjs/styles/themes/next-gen/variants/cards.js +1 -3
  36. package/lib/cjs/styles/themes/next-gen/variants/tableBase.d.ts +4 -2
  37. package/lib/cjs/styles/themes/next-gen/variants/tableBase.js +4 -2
  38. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +9 -3
  39. package/lib/cjs/styles/themes/next-gen/variants/variants.js +7 -2
  40. package/lib/cjs/types/selectField.d.ts +5 -0
  41. package/lib/components/Box/Box.styles.js +5 -0
  42. package/lib/components/IconButton/IconButton.styles.js +14 -1
  43. package/lib/components/ListBox/Option.js +12 -3
  44. package/lib/components/SelectField/SelectField.stories.js +19 -0
  45. package/lib/components/SelectField/SelectField.test.js +11 -0
  46. package/lib/components/SelectFieldBase/SelectFieldBase.js +41 -20
  47. package/lib/components/SelectFieldBase/SelectFieldBase.test.js +26 -0
  48. package/lib/components/TableBase/TableBase.js +38 -8
  49. package/lib/components/TableBase/TableBase.stories.js +195 -8
  50. package/lib/components/TableBase/TableBase.styles.js +11 -2
  51. package/lib/components/TableBase/TableBase.test.js +267 -1
  52. package/lib/components/TableBase/stories/NextGenTableBase.js +3 -5
  53. package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +0 -5
  54. package/lib/styles/themes/astro/customProperties/icons.js +1 -1
  55. package/lib/styles/themes/next-gen/customProperties/icons.js +1 -1
  56. package/lib/styles/themes/next-gen/forms.js +12 -0
  57. package/lib/styles/themes/next-gen/variants/button.js +29 -19
  58. package/lib/styles/themes/next-gen/variants/cards.js +1 -3
  59. package/lib/styles/themes/next-gen/variants/tableBase.js +4 -2
  60. package/lib/styles/themes/next-gen/variants/variants.js +7 -2
  61. package/package.json +1 -1
@@ -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.email
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)(ExampleTable, null), (0, _react2.jsx)(_.Pagination, {
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
- exports.WithPagination = WithPagination;
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
- // This is the selected state for the row
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), {}, {