@pingux/astro 2.133.0-alpha.3 → 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.
Files changed (37) 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/TableBase/TableBase.js +36 -6
  4. package/lib/cjs/components/TableBase/TableBase.stories.d.ts +14 -0
  5. package/lib/cjs/components/TableBase/TableBase.stories.js +193 -6
  6. package/lib/cjs/components/TableBase/TableBase.styles.d.ts +17 -1
  7. package/lib/cjs/components/TableBase/TableBase.styles.js +11 -2
  8. package/lib/cjs/components/TableBase/TableBase.test.js +267 -0
  9. package/lib/cjs/components/TableBase/stories/NextGenTableBase.js +2 -4
  10. package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +2 -0
  11. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/icons.d.ts +2 -0
  12. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/index.d.ts +2 -0
  13. package/lib/cjs/styles/themes/astro/customProperties/icons.d.ts +2 -0
  14. package/lib/cjs/styles/themes/astro/customProperties/icons.js +1 -1
  15. package/lib/cjs/styles/themes/astro/customProperties/index.d.ts +2 -0
  16. package/lib/cjs/styles/themes/next-gen/customProperties/icons.d.ts +2 -0
  17. package/lib/cjs/styles/themes/next-gen/customProperties/icons.js +1 -1
  18. package/lib/cjs/styles/themes/next-gen/customProperties/index.d.ts +2 -0
  19. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +7 -3
  20. package/lib/cjs/styles/themes/next-gen/variants/cards.d.ts +0 -1
  21. package/lib/cjs/styles/themes/next-gen/variants/cards.js +1 -3
  22. package/lib/cjs/styles/themes/next-gen/variants/tableBase.d.ts +4 -2
  23. package/lib/cjs/styles/themes/next-gen/variants/tableBase.js +4 -2
  24. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +7 -2
  25. package/lib/cjs/styles/themes/next-gen/variants/variants.js +4 -0
  26. package/lib/components/Box/Box.styles.js +5 -0
  27. package/lib/components/TableBase/TableBase.js +38 -8
  28. package/lib/components/TableBase/TableBase.stories.js +195 -8
  29. package/lib/components/TableBase/TableBase.styles.js +11 -2
  30. package/lib/components/TableBase/TableBase.test.js +267 -1
  31. package/lib/components/TableBase/stories/NextGenTableBase.js +3 -5
  32. package/lib/styles/themes/astro/customProperties/icons.js +1 -1
  33. package/lib/styles/themes/next-gen/customProperties/icons.js +1 -1
  34. package/lib/styles/themes/next-gen/variants/cards.js +1 -3
  35. package/lib/styles/themes/next-gen/variants/tableBase.js +4 -2
  36. package/lib/styles/themes/next-gen/variants/variants.js +4 -0
  37. package/package.json +1 -1
@@ -1,7 +1,21 @@
1
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
2
+ import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
3
+ import _Object$create from "@babel/runtime-corejs3/core-js-stable/object/create";
4
+ import _Object$getPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/get-prototype-of";
5
+ import _Object$setPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/set-prototype-of";
6
+ import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
7
+ import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
8
+ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
9
+ import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
10
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
1
11
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
12
+ 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 _context14; _forEachInstanceProperty(_context14 = ["next", "throw", "return"]).call(_context14, 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 _context15; 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(_context15 = this.tryEntries).call(_context15, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(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; }
2
13
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
14
+ import _sortInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/sort";
15
+ import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
3
16
  import React from 'react';
4
- import { fireEvent, render, screen } from '@testing-library/react';
17
+ import { useAsyncList } from 'react-stately';
18
+ import { act as actHooks, fireEvent, render, renderHook, screen, within } from '@testing-library/react';
5
19
  import userEvent from '@testing-library/user-event';
6
20
  import { Cell, Column, Row, TBody, THead } from '../../index';
7
21
  import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
@@ -111,6 +125,13 @@ test('renders table rows', function () {
111
125
  expect(screen.getByText(object.continent)).toBeInTheDocument();
112
126
  });
113
127
  });
128
+ test('renders sticky header', function () {
129
+ getComponent({
130
+ isStickyHeader: true
131
+ });
132
+ var stickyHeader = screen.getAllByRole('rowgroup');
133
+ expect(stickyHeader[0]).toHaveClass('is-sticky');
134
+ });
114
135
  test('renders checkbox in case of multi selection', function () {
115
136
  getComponent({
116
137
  selectionMode: 'multiple'
@@ -265,4 +286,249 @@ test('Arrow Left move the focus to next cell', function () {
265
286
  key: 'ArrowLeft'
266
287
  });
267
288
  expect(rows[1]).toHaveFocus();
289
+ });
290
+ describe('Sortable Table with useAsyncList', function () {
291
+ var dataTestId = 'sortableTable';
292
+ var defaultTableProps = {
293
+ 'aria-label': 'Custom table with sortable content',
294
+ width: '100%',
295
+ height: '100%',
296
+ 'data-testid': dataTestId
297
+ };
298
+ function load() {
299
+ return _load.apply(this, arguments);
300
+ }
301
+ function _load() {
302
+ _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
303
+ return _regeneratorRuntime().wrap(function _callee9$(_context11) {
304
+ while (1) switch (_context11.prev = _context11.next) {
305
+ case 0:
306
+ return _context11.abrupt("return", {
307
+ items: objects
308
+ });
309
+ case 1:
310
+ case "end":
311
+ return _context11.stop();
312
+ }
313
+ }, _callee9);
314
+ }));
315
+ return _load.apply(this, arguments);
316
+ }
317
+ function sort(_x) {
318
+ return _sort.apply(this, arguments);
319
+ }
320
+ function _sort() {
321
+ _sort = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(list) {
322
+ var _context12;
323
+ return _regeneratorRuntime().wrap(function _callee10$(_context13) {
324
+ while (1) switch (_context13.prev = _context13.next) {
325
+ case 0:
326
+ // eslint-disable-next-line no-param-reassign
327
+ list.items = _sortInstanceProperty(_context12 = list.items).call(_context12, function (a, b) {
328
+ var first = a[list.sortDescriptor.column];
329
+ var second = b[list.sortDescriptor.column];
330
+ var cmp = (_parseInt(first) || first) < (_parseInt(second) || second) // eslint-disable-line
331
+ ? -1 : 1;
332
+ if (list.sortDescriptor.direction === 'descending') {
333
+ cmp *= -1;
334
+ }
335
+ return cmp;
336
+ });
337
+ return _context13.abrupt("return", list);
338
+ case 2:
339
+ case "end":
340
+ return _context13.stop();
341
+ }
342
+ }, _callee10);
343
+ }));
344
+ return _sort.apply(this, arguments);
345
+ }
346
+ var sortableDataTable = function sortableDataTable(_ref) {
347
+ var result = _ref.result;
348
+ return render(___EmotionJSX(TableBase, _extends({}, defaultTableProps, {
349
+ sortDescriptor: result.current.sortDescriptor
350
+ }), ___EmotionJSX(THead, {
351
+ columns: headers
352
+ }, function (column) {
353
+ return ___EmotionJSX(Column, {
354
+ allowsSorting: true
355
+ }, column.name);
356
+ }), ___EmotionJSX(TBody, {
357
+ items: result.current.items
358
+ }, function (item) {
359
+ return ___EmotionJSX(Row, null, function (columnKey) {
360
+ return ___EmotionJSX(Cell, null, item[columnKey]);
361
+ });
362
+ })));
363
+ };
364
+ test('sort by country column A => Z', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
365
+ var _renderHook, result, sortableTable, rowgroups, thead, headerCells, tRows;
366
+ return _regeneratorRuntime().wrap(function _callee4$(_context5) {
367
+ while (1) switch (_context5.prev = _context5.next) {
368
+ case 0:
369
+ _renderHook = renderHook(function () {
370
+ return useAsyncList({
371
+ load: load,
372
+ sort: sort,
373
+ initialSortDescriptor: {
374
+ column: 'country',
375
+ direction: 'ascending'
376
+ }
377
+ });
378
+ }), result = _renderHook.result;
379
+ _context5.next = 3;
380
+ return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
381
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
382
+ while (1) switch (_context.prev = _context.next) {
383
+ case 0:
384
+ jest.runOnlyPendingTimers();
385
+ case 1:
386
+ case "end":
387
+ return _context.stop();
388
+ }
389
+ }, _callee);
390
+ })));
391
+ case 3:
392
+ _context5.next = 5;
393
+ return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
394
+ var _context2;
395
+ return _regeneratorRuntime().wrap(function _callee2$(_context3) {
396
+ while (1) switch (_context3.prev = _context3.next) {
397
+ case 0:
398
+ _sortInstanceProperty(_context2 = result.current).call(_context2, {
399
+ column: 'country',
400
+ direction: 'ascending'
401
+ });
402
+ case 1:
403
+ case "end":
404
+ return _context3.stop();
405
+ }
406
+ }, _callee2);
407
+ })));
408
+ case 5:
409
+ _context5.next = 7;
410
+ return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
411
+ return _regeneratorRuntime().wrap(function _callee3$(_context4) {
412
+ while (1) switch (_context4.prev = _context4.next) {
413
+ case 0:
414
+ jest.runOnlyPendingTimers();
415
+ case 1:
416
+ case "end":
417
+ return _context4.stop();
418
+ }
419
+ }, _callee3);
420
+ })));
421
+ case 7:
422
+ sortableDataTable({
423
+ result: result
424
+ });
425
+ sortableTable = screen.getByTestId(dataTestId);
426
+ expect(sortableTable).toBeInTheDocument();
427
+ expect(sortableTable).toBeVisible();
428
+ expect(sortableTable).toHaveAttribute('aria-label', 'Custom table with sortable content');
429
+ expect(sortableTable).toHaveAttribute('data-testid', dataTestId);
430
+ rowgroups = within(sortableTable).getAllByRole('rowgroup'); // verify first header column is sorted a -> z
431
+ thead = within(rowgroups[0]).getByRole('row');
432
+ headerCells = within(thead).getAllByRole('columnheader');
433
+ expect(headerCells[0]).toHaveTextContent('Country');
434
+ expect(headerCells[0]).toHaveAttribute('aria-sort', 'ascending');
435
+ tRows = within(rowgroups[1]).getAllByRole('row'); // verify country column is sorted a -> z
436
+ expect(tRows).toHaveLength(4);
437
+ expect(tRows[0]).toHaveAttribute('data-key', '2');
438
+ expect(tRows[0]).toHaveTextContent('Canada');
439
+ expect(tRows[1]).toHaveAttribute('data-key', '3');
440
+ expect(tRows[1]).toHaveTextContent('China');
441
+ expect(tRows[2]).toHaveAttribute('data-key', '4');
442
+ expect(tRows[2]).toHaveTextContent('France');
443
+ expect(tRows[3]).toHaveAttribute('data-key', '1');
444
+ expect(tRows[3]).toHaveTextContent('USA');
445
+ case 28:
446
+ case "end":
447
+ return _context5.stop();
448
+ }
449
+ }, _callee4);
450
+ })));
451
+ test('sort by country column Z => A', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
452
+ var _renderHook2, result, sortableTable, rowgroups, tRows;
453
+ return _regeneratorRuntime().wrap(function _callee8$(_context10) {
454
+ while (1) switch (_context10.prev = _context10.next) {
455
+ case 0:
456
+ _renderHook2 = renderHook(function () {
457
+ return useAsyncList({
458
+ load: load,
459
+ sort: sort,
460
+ initialSortDescriptor: {
461
+ column: 'country',
462
+ direction: 'descending'
463
+ }
464
+ });
465
+ }), result = _renderHook2.result;
466
+ _context10.next = 3;
467
+ return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
468
+ return _regeneratorRuntime().wrap(function _callee5$(_context6) {
469
+ while (1) switch (_context6.prev = _context6.next) {
470
+ case 0:
471
+ jest.runOnlyPendingTimers();
472
+ case 1:
473
+ case "end":
474
+ return _context6.stop();
475
+ }
476
+ }, _callee5);
477
+ })));
478
+ case 3:
479
+ _context10.next = 5;
480
+ return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
481
+ var _context7;
482
+ return _regeneratorRuntime().wrap(function _callee6$(_context8) {
483
+ while (1) switch (_context8.prev = _context8.next) {
484
+ case 0:
485
+ _sortInstanceProperty(_context7 = result.current).call(_context7, {
486
+ column: 'country',
487
+ direction: 'descending'
488
+ });
489
+ case 1:
490
+ case "end":
491
+ return _context8.stop();
492
+ }
493
+ }, _callee6);
494
+ })));
495
+ case 5:
496
+ _context10.next = 7;
497
+ return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
498
+ return _regeneratorRuntime().wrap(function _callee7$(_context9) {
499
+ while (1) switch (_context9.prev = _context9.next) {
500
+ case 0:
501
+ jest.runOnlyPendingTimers();
502
+ case 1:
503
+ case "end":
504
+ return _context9.stop();
505
+ }
506
+ }, _callee7);
507
+ })));
508
+ case 7:
509
+ sortableDataTable({
510
+ result: result
511
+ });
512
+ sortableTable = screen.getByTestId(dataTestId);
513
+ expect(sortableTable).toBeInTheDocument();
514
+ expect(sortableTable).toBeVisible();
515
+ expect(sortableTable).toHaveAttribute('aria-label', 'Custom table with sortable content');
516
+ expect(sortableTable).toHaveAttribute('data-testid', dataTestId);
517
+ rowgroups = within(sortableTable).getAllByRole('rowgroup');
518
+ tRows = within(rowgroups[1]).getAllByRole('row'); // verify country column is sorted z -> a
519
+ expect(tRows).toHaveLength(4);
520
+ expect(tRows[0]).toHaveAttribute('data-key', '1');
521
+ expect(tRows[0]).toHaveTextContent('USA');
522
+ expect(tRows[1]).toHaveAttribute('data-key', '4');
523
+ expect(tRows[1]).toHaveTextContent('France');
524
+ expect(tRows[2]).toHaveAttribute('data-key', '3');
525
+ expect(tRows[2]).toHaveTextContent('China');
526
+ expect(tRows[3]).toHaveAttribute('data-key', '2');
527
+ expect(tRows[3]).toHaveTextContent('Canada');
528
+ case 24:
529
+ case "end":
530
+ return _context10.stop();
531
+ }
532
+ }, _callee8);
533
+ })));
268
534
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Card, Cell, Column, Row, TableBase, TBody, THead } from '../../..';
2
+ import { Cell, Column, Row, TableBase, TBody, THead } from '../../..';
3
3
  import { jsx as ___EmotionJSX } from "@emotion/react";
4
4
  var NextGenTableBase = function NextGenTableBase() {
5
5
  var headers = [{
@@ -34,9 +34,7 @@ var NextGenTableBase = function NextGenTableBase() {
34
34
  additional_grant: '+25,000',
35
35
  total_grant: '75,000'
36
36
  }];
37
- return ___EmotionJSX(Card, {
38
- variant: "cards.tableWrapper"
39
- }, ___EmotionJSX(TableBase, {
37
+ return ___EmotionJSX(TableBase, {
40
38
  caption: "Lorem ipsum",
41
39
  "aria-label": "table"
42
40
  }, ___EmotionJSX(THead, {
@@ -53,6 +51,6 @@ var NextGenTableBase = function NextGenTableBase() {
53
51
  }, function (columnKey) {
54
52
  return ___EmotionJSX(Cell, null, item[columnKey]);
55
53
  });
56
- })));
54
+ }));
57
55
  };
58
56
  export default NextGenTableBase;
@@ -18,4 +18,4 @@ import statuses, { statusIcon } from '../../../../utils/devUtils/constants/statu
18
18
  export default (_MenuDown$MenuUp$stat = {
19
19
  MenuDown: MenuDown,
20
20
  MenuUp: MenuUp
21
- }, _defineProperty(_MenuDown$MenuUp$stat, statuses.DEFAULT, InformationIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.ERROR, AlertCircleIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.SUCCESS, CheckCircleIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.WARNING, AlertIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.INFO, InformationOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.CRITICAL, AlertCircleOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.MAJOR, ArrowUpIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.MINOR, ArrowDownIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.WARNING_NEUTRAL, AlertOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.FATAL, CloseOctagonOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, "pingLogoHorizontalSmall", pingLogoHorizontalSmallWhite), _defineProperty(_MenuDown$MenuUp$stat, "listViewMenu", MoreVertIcon), _MenuDown$MenuUp$stat);
21
+ }, _defineProperty(_MenuDown$MenuUp$stat, statuses.DEFAULT, InformationIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.ERROR, AlertCircleIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.SUCCESS, CheckCircleIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.WARNING, AlertIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.INFO, InformationOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.CRITICAL, AlertCircleOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.MAJOR, ArrowUpIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.MINOR, ArrowDownIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.WARNING_NEUTRAL, AlertOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.FATAL, CloseOctagonOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, "pingLogoHorizontalSmall", pingLogoHorizontalSmallWhite), _defineProperty(_MenuDown$MenuUp$stat, "listViewMenu", MoreVertIcon), _defineProperty(_MenuDown$MenuUp$stat, "Ascending", ArrowUpIcon), _defineProperty(_MenuDown$MenuUp$stat, "Descending", ArrowDownIcon), _MenuDown$MenuUp$stat);
@@ -15,4 +15,4 @@ import statuses, { statusIcon } from '../../../../utils/devUtils/constants/statu
15
15
  export default (_MenuDown$MenuUp$stat = {
16
16
  MenuDown: ChevronDownIcon,
17
17
  MenuUp: ChevronUpIcon
18
- }, _defineProperty(_MenuDown$MenuUp$stat, statuses.DEFAULT, InformationOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.ERROR, AlertCircleOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.SUCCESS, CheckCircleOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.WARNING, AlertOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.INFO, InformationOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.CRITICAL, AlertCircleOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.MAJOR, ArrowUpIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.MINOR, ArrowDownIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.WARNING_NEUTRAL, AlertOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.FATAL, CloseOctagonOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, "pingLogoHorizontalSmall", pingLogoHorizontalSmall), _defineProperty(_MenuDown$MenuUp$stat, "listViewMenu", DotsHorizontalIcon), _MenuDown$MenuUp$stat);
18
+ }, _defineProperty(_MenuDown$MenuUp$stat, statuses.DEFAULT, InformationOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.ERROR, AlertCircleOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.SUCCESS, CheckCircleOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statuses.WARNING, AlertOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.INFO, InformationOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.CRITICAL, AlertCircleOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.MAJOR, ArrowUpIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.MINOR, ArrowDownIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.WARNING_NEUTRAL, AlertOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, statusIcon.FATAL, CloseOctagonOutlineIcon), _defineProperty(_MenuDown$MenuUp$stat, "pingLogoHorizontalSmall", pingLogoHorizontalSmall), _defineProperty(_MenuDown$MenuUp$stat, "listViewMenu", DotsHorizontalIcon), _defineProperty(_MenuDown$MenuUp$stat, "Ascending", ArrowUpIcon), _defineProperty(_MenuDown$MenuUp$stat, "Descending", ArrowDownIcon), _MenuDown$MenuUp$stat);
@@ -74,9 +74,7 @@ var suggestionRow = _objectSpread(_objectSpread({}, baseSuggestion), {}, {
74
74
  var suggestionColumn = _objectSpread(_objectSpread({}, baseSuggestion), {}, {
75
75
  display: 'flex'
76
76
  });
77
- var tableWrapper = _objectSpread(_objectSpread({}, container), {}, {
78
- overflowY: 'hidden'
79
- });
77
+ var tableWrapper = _objectSpread({}, container);
80
78
  export default {
81
79
  interactive: interactive,
82
80
  dark: dark,
@@ -41,9 +41,9 @@ var thead = {
41
41
  borderBottomColor: 'border.base',
42
42
  backgroundColor: 'background.base',
43
43
  '&:not(.has-caption)': {
44
+ borderTopLeftRadius: borderRadius,
45
+ borderTopRightRadius: borderRadius,
44
46
  '& > tr:first-child': {
45
- borderTopLeftRadius: borderRadius,
46
- borderTopRightRadius: borderRadius,
47
47
  '& > th:first-of-type': {
48
48
  borderTopLeftRadius: borderRadius
49
49
  },
@@ -66,6 +66,8 @@ var tbody = {
66
66
  borderTopColor: 'border.base',
67
67
  borderBottom: 'unset',
68
68
  backgroundColor: 'background.base',
69
+ borderBottomLeftRadius: borderRadius,
70
+ borderBottomRightRadius: borderRadius,
69
71
  '& > tr:last-child': {
70
72
  borderBottom: 'unset',
71
73
  borderBottomLeftRadius: borderRadius,
@@ -12,6 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  import attachment from '../../../../components/AIComponents/Attachment/Attachment.styles';
13
13
  import skeleton from '../../../../components/Skeleton/Skeleton.styles';
14
14
  import codeView from '../codeView/codeView';
15
+ import colors from '../colors/colors';
15
16
  import { avatar } from './avatar';
16
17
  import button, { defaultFocus } from './button';
17
18
  import callout from './callout';
@@ -456,6 +457,9 @@ export default {
456
457
  fill: 'gray-500',
457
458
  stroke: 'gray-500'
458
459
  }
460
+ },
461
+ '&.is-focused': {
462
+ boxShadow: "inset 0px 0px 0px 1px ".concat(colors.focus)
459
463
  }
460
464
  }
461
465
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.133.0-alpha.3",
3
+ "version": "2.134.0-alpha.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",