@pingux/astro 2.36.0 → 2.37.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.
@@ -123,11 +123,20 @@ declare const _default: {
123
123
  };
124
124
  '&.is-hovered': {
125
125
  bg: string;
126
+ color: string;
126
127
  borderColor: string;
128
+ border: string;
129
+ boxShadow: string;
127
130
  };
128
131
  '&.is-pressed': {
129
132
  bg: string;
130
133
  borderColor: string;
134
+ border: string;
135
+ color: string;
136
+ boxShadow: string;
137
+ path: {
138
+ fill: string;
139
+ };
131
140
  };
132
141
  fontSize: string;
133
142
  fontWeight: number;
@@ -164,6 +173,7 @@ declare const _default: {
164
173
  border: string;
165
174
  borderColor: string;
166
175
  color: string;
176
+ boxShadow: string;
167
177
  path: {
168
178
  fill: string;
169
179
  };
@@ -214,6 +224,7 @@ declare const _default: {
214
224
  border: string;
215
225
  borderColor: string;
216
226
  color: string;
227
+ boxShadow: string;
217
228
  path: {
218
229
  fill: string;
219
230
  };
@@ -258,6 +269,7 @@ declare const _default: {
258
269
  bg: string;
259
270
  borderColor: string;
260
271
  color: string;
272
+ boxShadow: string;
261
273
  path: {
262
274
  fill: string;
263
275
  };
@@ -312,6 +324,7 @@ declare const _default: {
312
324
  border: string;
313
325
  borderColor: string;
314
326
  color: string;
327
+ boxShadow: string;
315
328
  path: {
316
329
  fill: string;
317
330
  };
@@ -352,6 +365,7 @@ declare const _default: {
352
365
  borderColor: string;
353
366
  bg: string;
354
367
  color: string;
368
+ boxShadow: string;
355
369
  path: {
356
370
  fill: string;
357
371
  };
@@ -360,6 +374,7 @@ declare const _default: {
360
374
  border: string;
361
375
  borderColor: string;
362
376
  color: string;
377
+ boxShadow: string;
363
378
  path: {
364
379
  fill: string;
365
380
  };
@@ -449,6 +464,7 @@ declare const _default: {
449
464
  border: string;
450
465
  borderColor: string;
451
466
  color: string;
467
+ boxShadow: string;
452
468
  };
453
469
  '&.is-focused': {
454
470
  outline: string;
@@ -583,6 +599,7 @@ declare const _default: {
583
599
  borderColor: string;
584
600
  bg: string;
585
601
  color: string;
602
+ boxShadow: string;
586
603
  path: {
587
604
  fill: string;
588
605
  };
@@ -591,6 +608,7 @@ declare const _default: {
591
608
  border: string;
592
609
  borderColor: string;
593
610
  color: string;
611
+ boxShadow: string;
594
612
  path: {
595
613
  fill: string;
596
614
  };
@@ -684,6 +702,7 @@ declare const _default: {
684
702
  border: string;
685
703
  borderColor: string;
686
704
  color: string;
705
+ boxShadow: string;
687
706
  path: {
688
707
  fill: string;
689
708
  };
@@ -737,6 +756,7 @@ declare const _default: {
737
756
  border: string;
738
757
  borderColor: string;
739
758
  color: string;
759
+ boxShadow: string;
740
760
  path: {
741
761
  fill: string;
742
762
  };
@@ -777,6 +797,7 @@ declare const _default: {
777
797
  borderColor: string;
778
798
  bg: string;
779
799
  color: string;
800
+ boxShadow: string;
780
801
  path: {
781
802
  fill: string;
782
803
  };
@@ -785,6 +806,7 @@ declare const _default: {
785
806
  border: string;
786
807
  borderColor: string;
787
808
  color: string;
809
+ boxShadow: string;
788
810
  path: {
789
811
  fill: string;
790
812
  };
@@ -36,6 +36,7 @@ var defaultActive = {
36
36
  border: '1px solid',
37
37
  borderColor: 'active',
38
38
  color: 'white',
39
+ boxShadow: 'unset',
39
40
  'path': {
40
41
  fill: 'white'
41
42
  }
@@ -77,7 +78,8 @@ var primary = _objectSpread(_objectSpread({}, base), {}, {
77
78
  bg: 'accent.20',
78
79
  border: '1px solid',
79
80
  borderColor: 'accent.20',
80
- color: 'white'
81
+ color: 'white',
82
+ boxShadow: 'unset'
81
83
  },
82
84
  '&.is-focused': _objectSpread({}, defaultFocus)
83
85
  });
@@ -106,14 +108,15 @@ var critical = _objectSpread(_objectSpread({}, base), {}, {
106
108
  borderColor: 'critical.bright',
107
109
  color: 'white',
108
110
  '&.is-focused': _objectSpread({}, defaultFocus),
109
- '&.is-hovered': {
111
+ '&.is-hovered': _objectSpread(_objectSpread({}, defaultHover), {}, {
110
112
  bg: 'critical.primaryDark',
113
+ color: 'white',
111
114
  borderColor: 'critical.primaryDark'
112
- },
113
- '&.is-pressed': {
115
+ }),
116
+ '&.is-pressed': _objectSpread(_objectSpread({}, defaultActive), {}, {
114
117
  bg: 'critical.secondaryDark',
115
118
  borderColor: 'critical.secondaryDark'
116
- }
119
+ })
117
120
  });
118
121
  var inline = _objectSpread(_objectSpread({}, base), {}, {
119
122
  display: 'inline-flex',
@@ -40,7 +40,8 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
40
40
  var value = props.value,
41
41
  defaultValue = props.defaultValue,
42
42
  minValue = props.minValue,
43
- maxValue = props.maxValue;
43
+ maxValue = props.maxValue,
44
+ hasAutoFocus = props.hasAutoFocus;
44
45
  var _useLocale = (0, _i18n.useLocale)(),
45
46
  locale = _useLocale.locale;
46
47
  var calenderRef = (0, _react.useRef)();
@@ -55,7 +56,9 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
55
56
  maxValue: typeof maxValue === 'string' && (0, _date.parseDate)(maxValue) || maxValue,
56
57
  minValue: typeof minValue === 'string' && (0, _date.parseDate)(minValue) || minValue
57
58
  };
58
- var state = (0, _calendar2.useCalendarState)(_objectSpread(_objectSpread(_objectSpread({}, props), parsedDates), {}, {
59
+ var state = (0, _calendar2.useCalendarState)(_objectSpread(_objectSpread(_objectSpread({
60
+ autoFocus: hasAutoFocus
61
+ }, props), parsedDates), {}, {
59
62
  locale: locale,
60
63
  createCalendar: _date.createCalendar
61
64
  }));
@@ -14,7 +14,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
14
14
  _Object$defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- exports["default"] = exports.UnavailableDates = exports.MinimumDate = exports.MaximumDate = exports.Disabled = exports.DefaultValue = exports.Default = exports.Controlled = exports.Autofocus = void 0;
17
+ exports["default"] = exports.UnavailableDates = exports.MinimumDate = exports.MaximumDate = exports.Disabled = exports.DefaultValue = exports.Default = exports.Controlled = void 0;
18
18
  var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
19
19
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
20
20
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
@@ -210,19 +210,6 @@ MaximumDate.parameters = {
210
210
  url: _figmaLinks.FIGMA_LINKS.calendar.maximumDate
211
211
  }
212
212
  };
213
- var Autofocus = function Autofocus(args) {
214
- return (0, _react2.jsx)(_Calendar["default"], (0, _extends2["default"])({}, args, {
215
- "aria-label": "calendar-component",
216
- hasAutoFocus: true
217
- }));
218
- };
219
- exports.Autofocus = Autofocus;
220
- Autofocus.parameters = {
221
- design: {
222
- type: 'figma',
223
- url: _figmaLinks.FIGMA_LINKS.calendar.autofocus
224
- }
225
- };
226
213
  var Controlled = function Controlled(args) {
227
214
  var _useState = (0, _react.useState)(null),
228
215
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
@@ -294,4 +294,5 @@ test('should autofocus on current day with hasAutoFocus', function () {
294
294
  return cell.getAttribute('aria-disabled') !== 'true';
295
295
  });
296
296
  expect(focusedDay[0]).toHaveTextContent(day);
297
+ expect(focusedDay[0]).toHaveFocus();
297
298
  });
@@ -1,27 +1,15 @@
1
1
  "use strict";
2
2
 
3
- var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
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 _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
13
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
14
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
15
4
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
16
5
  var _react = _interopRequireDefault(require("react"));
17
6
  var _reactStately = require("react-stately");
18
7
  var _list = require("@react-stately/list");
19
8
  var _react2 = require("@testing-library/react");
20
9
  var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
21
- var _jestAxe = require("jest-axe");
10
+ var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
22
11
  var _ = _interopRequireDefault(require("."));
23
12
  var _react3 = require("@emotion/react");
24
- 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 _context2; _forEachInstanceProperty(_context2 = ["next", "throw", "return"]).call(_context2, 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 _context3; 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(_context3 = this.tryEntries).call(_context3, 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; }
25
13
  var testId = 'test-label';
26
14
  var items = [{
27
15
  name: 'a'
@@ -52,17 +40,20 @@ var defaultWithSectionsProps = {
52
40
  'aria-labelledby': 'label',
53
41
  items: itemsWithSections
54
42
  };
55
- var ListBoxWithState = function ListBoxWithState(props) {
56
- var state = (0, _list.useListState)(props);
43
+ var ListBoxWithState = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
44
+ var state = (0, _list.useListState)({
45
+ props: props
46
+ });
57
47
  return (0, _react3.jsx)(_["default"], (0, _extends2["default"])({}, props, {
58
- state: state
48
+ state: state,
49
+ ref: ref
59
50
  }), function (item) {
60
51
  return (0, _react3.jsx)(_reactStately.Item, {
61
52
  key: item.name,
62
- "data-id": item.name
53
+ childItems: item.options
63
54
  }, item.name);
64
55
  });
65
- };
56
+ });
66
57
  var ListBoxWithSections = function ListBoxWithSections(props) {
67
58
  var state = (0, _list.useListState)(props);
68
59
  return (0, _react3.jsx)(_["default"], (0, _extends2["default"])({}, props, {
@@ -123,24 +114,15 @@ test('default listbox', function () {
123
114
  var listbox = _react2.screen.getByRole('listbox');
124
115
  expect(listbox).toBeInTheDocument();
125
116
  });
126
- test('should have no accessibility violations', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
127
- var _getComponent, container, results;
128
- return _regeneratorRuntime().wrap(function _callee$(_context) {
129
- while (1) switch (_context.prev = _context.next) {
130
- case 0:
131
- jest.useRealTimers();
132
- _getComponent = getComponent(), container = _getComponent.container;
133
- _context.next = 4;
134
- return (0, _jestAxe.axe)(container);
135
- case 4:
136
- results = _context.sent;
137
- expect(results).toHaveNoViolations();
138
- case 6:
139
- case "end":
140
- return _context.stop();
141
- }
142
- }, _callee);
143
- })));
117
+
118
+ // Needs to be added to each components test file
119
+ (0, _universalComponentTest.universalComponentTests)({
120
+ renderComponent: function renderComponent(props) {
121
+ return (0, _react3.jsx)(ListBoxWithState, (0, _extends2["default"])({
122
+ "aria-label": "label"
123
+ }, props));
124
+ }
125
+ });
144
126
  test('renders sections and items within section', function () {
145
127
  getSectionsComponent();
146
128
  var listbox = _react2.screen.getByRole('listbox');
@@ -28,6 +28,7 @@ var defaultActive = {
28
28
  border: '1px solid',
29
29
  borderColor: 'active',
30
30
  color: 'white',
31
+ boxShadow: 'unset',
31
32
  'path': {
32
33
  fill: 'white'
33
34
  }
@@ -67,7 +68,8 @@ var primary = _objectSpread(_objectSpread({}, base), {}, {
67
68
  bg: 'accent.20',
68
69
  border: '1px solid',
69
70
  borderColor: 'accent.20',
70
- color: 'white'
71
+ color: 'white',
72
+ boxShadow: 'unset'
71
73
  },
72
74
  '&.is-focused': _objectSpread({}, defaultFocus)
73
75
  });
@@ -96,14 +98,15 @@ var critical = _objectSpread(_objectSpread({}, base), {}, {
96
98
  borderColor: 'critical.bright',
97
99
  color: 'white',
98
100
  '&.is-focused': _objectSpread({}, defaultFocus),
99
- '&.is-hovered': {
101
+ '&.is-hovered': _objectSpread(_objectSpread({}, defaultHover), {}, {
100
102
  bg: 'critical.primaryDark',
103
+ color: 'white',
101
104
  borderColor: 'critical.primaryDark'
102
- },
103
- '&.is-pressed': {
105
+ }),
106
+ '&.is-pressed': _objectSpread(_objectSpread({}, defaultActive), {}, {
104
107
  bg: 'critical.secondaryDark',
105
108
  borderColor: 'critical.secondaryDark'
106
- }
109
+ })
107
110
  });
108
111
  var inline = _objectSpread(_objectSpread({}, base), {}, {
109
112
  display: 'inline-flex',
@@ -29,7 +29,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
29
29
  var value = props.value,
30
30
  defaultValue = props.defaultValue,
31
31
  minValue = props.minValue,
32
- maxValue = props.maxValue;
32
+ maxValue = props.maxValue,
33
+ hasAutoFocus = props.hasAutoFocus;
33
34
  var _useLocale = useLocale(),
34
35
  locale = _useLocale.locale;
35
36
  var calenderRef = useRef();
@@ -44,7 +45,9 @@ var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
44
45
  maxValue: typeof maxValue === 'string' && parseDate(maxValue) || maxValue,
45
46
  minValue: typeof minValue === 'string' && parseDate(minValue) || minValue
46
47
  };
47
- var state = useCalendarState(_objectSpread(_objectSpread(_objectSpread({}, props), parsedDates), {}, {
48
+ var state = useCalendarState(_objectSpread(_objectSpread(_objectSpread({
49
+ autoFocus: hasAutoFocus
50
+ }, props), parsedDates), {}, {
48
51
  locale: locale,
49
52
  createCalendar: createCalendar
50
53
  }));
@@ -192,18 +192,6 @@ MaximumDate.parameters = {
192
192
  url: FIGMA_LINKS.calendar.maximumDate
193
193
  }
194
194
  };
195
- export var Autofocus = function Autofocus(args) {
196
- return ___EmotionJSX(Calendar, _extends({}, args, {
197
- "aria-label": "calendar-component",
198
- hasAutoFocus: true
199
- }));
200
- };
201
- Autofocus.parameters = {
202
- design: {
203
- type: 'figma',
204
- url: FIGMA_LINKS.calendar.autofocus
205
- }
206
- };
207
195
  export var Controlled = function Controlled(args) {
208
196
  var _useState = useState(null),
209
197
  _useState2 = _slicedToArray(_useState, 2),
@@ -291,4 +291,5 @@ test('should autofocus on current day with hasAutoFocus', function () {
291
291
  return cell.getAttribute('aria-disabled') !== 'true';
292
292
  });
293
293
  expect(focusedDay[0]).toHaveTextContent(day);
294
+ expect(focusedDay[0]).toHaveFocus();
294
295
  });
@@ -1,22 +1,10 @@
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 _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
- import _Object$setPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/set-prototype-of";
7
- import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
8
- import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
9
- import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
10
- import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
11
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
12
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
13
- 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 _context2; _forEachInstanceProperty(_context2 = ["next", "throw", "return"]).call(_context2, 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 _context3; 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(_context3 = this.tryEntries).call(_context3, 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; }
14
2
  import React from 'react';
15
3
  import { Item, Section } from 'react-stately';
16
4
  import { useListState } from '@react-stately/list';
17
5
  import { render, screen } from '@testing-library/react';
18
6
  import userEvent from '@testing-library/user-event';
19
- import { axe } from 'jest-axe';
7
+ import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
20
8
  import ListBox from '.';
21
9
  import { jsx as ___EmotionJSX } from "@emotion/react";
22
10
  var testId = 'test-label';
@@ -49,17 +37,20 @@ var defaultWithSectionsProps = {
49
37
  'aria-labelledby': 'label',
50
38
  items: itemsWithSections
51
39
  };
52
- var ListBoxWithState = function ListBoxWithState(props) {
53
- var state = useListState(props);
40
+ var ListBoxWithState = /*#__PURE__*/React.forwardRef(function (props, ref) {
41
+ var state = useListState({
42
+ props: props
43
+ });
54
44
  return ___EmotionJSX(ListBox, _extends({}, props, {
55
- state: state
45
+ state: state,
46
+ ref: ref
56
47
  }), function (item) {
57
48
  return ___EmotionJSX(Item, {
58
49
  key: item.name,
59
- "data-id": item.name
50
+ childItems: item.options
60
51
  }, item.name);
61
52
  });
62
- };
53
+ });
63
54
  var ListBoxWithSections = function ListBoxWithSections(props) {
64
55
  var state = useListState(props);
65
56
  return ___EmotionJSX(ListBox, _extends({}, props, {
@@ -120,24 +111,15 @@ test('default listbox', function () {
120
111
  var listbox = screen.getByRole('listbox');
121
112
  expect(listbox).toBeInTheDocument();
122
113
  });
123
- test('should have no accessibility violations', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
124
- var _getComponent, container, results;
125
- return _regeneratorRuntime().wrap(function _callee$(_context) {
126
- while (1) switch (_context.prev = _context.next) {
127
- case 0:
128
- jest.useRealTimers();
129
- _getComponent = getComponent(), container = _getComponent.container;
130
- _context.next = 4;
131
- return axe(container);
132
- case 4:
133
- results = _context.sent;
134
- expect(results).toHaveNoViolations();
135
- case 6:
136
- case "end":
137
- return _context.stop();
138
- }
139
- }, _callee);
140
- })));
114
+
115
+ // Needs to be added to each components test file
116
+ universalComponentTests({
117
+ renderComponent: function renderComponent(props) {
118
+ return ___EmotionJSX(ListBoxWithState, _extends({
119
+ "aria-label": "label"
120
+ }, props));
121
+ }
122
+ });
141
123
  test('renders sections and items within section', function () {
142
124
  getSectionsComponent();
143
125
  var listbox = screen.getByRole('listbox');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.36.0",
3
+ "version": "2.37.0-alpha.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",