@pingux/astro 2.7.0-alpha.1 → 2.7.0-alpha.3

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 (67) hide show
  1. package/lib/cjs/components/IconButton/IconButton.js +38 -2
  2. package/lib/cjs/components/IconButton/IconButton.stories.js +34 -2
  3. package/lib/cjs/components/ListView/ListView.js +9 -0
  4. package/lib/cjs/components/ListView/ListView.stories.js +80 -34
  5. package/lib/cjs/components/ListViewItem/ListViewItem.styles.js +1 -6
  6. package/lib/cjs/components/Menu/Menu.js +60 -7
  7. package/lib/cjs/components/Menu/Menu.stories.js +56 -2
  8. package/lib/cjs/components/SwitchField/SwitchField.js +54 -12
  9. package/lib/cjs/components/SwitchField/SwitchField.stories.js +34 -2
  10. package/lib/cjs/components/SwitchField/SwitchField.test.js +5 -4
  11. package/lib/cjs/index.js +1 -33
  12. package/lib/cjs/utils/docUtils/ariaAttributes.js +1 -2
  13. package/lib/cjs/utils/docUtils/hoverProps.js +2 -7
  14. package/lib/components/IconButton/IconButton.js +38 -2
  15. package/lib/components/IconButton/IconButton.stories.js +34 -2
  16. package/lib/components/ListView/ListView.js +9 -0
  17. package/lib/components/ListView/ListView.stories.js +82 -35
  18. package/lib/components/ListViewItem/ListViewItem.styles.js +1 -6
  19. package/lib/components/Menu/Menu.js +60 -7
  20. package/lib/components/Menu/Menu.stories.js +57 -2
  21. package/lib/components/SwitchField/SwitchField.js +55 -14
  22. package/lib/components/SwitchField/SwitchField.stories.js +34 -2
  23. package/lib/components/SwitchField/SwitchField.test.js +5 -4
  24. package/lib/index.js +1 -7
  25. package/lib/utils/docUtils/ariaAttributes.js +1 -1
  26. package/lib/utils/docUtils/hoverProps.js +2 -7
  27. package/package.json +1 -1
  28. package/lib/cjs/components/IconButton/iconButtonAttributes.js +0 -100
  29. package/lib/cjs/components/Menu/menuAttributes.js +0 -104
  30. package/lib/cjs/components/SwitchField/switchFieldAttributes.js +0 -191
  31. package/lib/cjs/experimental/StyledListItem/StyledListItem.js +0 -159
  32. package/lib/cjs/experimental/StyledListItem/StyledListItem.stories.js +0 -155
  33. package/lib/cjs/experimental/StyledListItem/StyledListItem.test.js +0 -83
  34. package/lib/cjs/experimental/StyledListItem/controls/ListItemEditButton.js +0 -34
  35. package/lib/cjs/experimental/StyledListItem/controls/ListItemEditButton.stories.js +0 -31
  36. package/lib/cjs/experimental/StyledListItem/controls/ListItemEditButton.test.js +0 -25
  37. package/lib/cjs/experimental/StyledListItem/controls/ListItemMenu.js +0 -37
  38. package/lib/cjs/experimental/StyledListItem/controls/ListItemMenu.stories.js +0 -36
  39. package/lib/cjs/experimental/StyledListItem/controls/ListItemMenu.test.js +0 -59
  40. package/lib/cjs/experimental/StyledListItem/controls/ListItemSwitchField.js +0 -32
  41. package/lib/cjs/experimental/StyledListItem/controls/ListItemSwitchField.stories.js +0 -41
  42. package/lib/cjs/experimental/StyledListItem/controls/ListItemSwitchField.test.js +0 -25
  43. package/lib/cjs/experimental/StyledListItem/styledListItemAttributes.js +0 -81
  44. package/lib/cjs/experimental/recipes/ListAndPanel.stories.js +0 -370
  45. package/lib/cjs/experimental/recipes/ScrollableListView.stories.js +0 -108
  46. package/lib/cjs/experimental/recipes/items.js +0 -126
  47. package/lib/cjs/utils/docUtils/docArgTypes.js +0 -41
  48. package/lib/components/IconButton/iconButtonAttributes.js +0 -91
  49. package/lib/components/Menu/menuAttributes.js +0 -95
  50. package/lib/components/SwitchField/switchFieldAttributes.js +0 -182
  51. package/lib/experimental/StyledListItem/StyledListItem.js +0 -146
  52. package/lib/experimental/StyledListItem/StyledListItem.stories.js +0 -140
  53. package/lib/experimental/StyledListItem/StyledListItem.test.js +0 -74
  54. package/lib/experimental/StyledListItem/controls/ListItemEditButton.js +0 -25
  55. package/lib/experimental/StyledListItem/controls/ListItemEditButton.stories.js +0 -21
  56. package/lib/experimental/StyledListItem/controls/ListItemEditButton.test.js +0 -22
  57. package/lib/experimental/StyledListItem/controls/ListItemMenu.js +0 -28
  58. package/lib/experimental/StyledListItem/controls/ListItemMenu.stories.js +0 -26
  59. package/lib/experimental/StyledListItem/controls/ListItemMenu.test.js +0 -56
  60. package/lib/experimental/StyledListItem/controls/ListItemSwitchField.js +0 -23
  61. package/lib/experimental/StyledListItem/controls/ListItemSwitchField.stories.js +0 -32
  62. package/lib/experimental/StyledListItem/controls/ListItemSwitchField.test.js +0 -22
  63. package/lib/experimental/StyledListItem/styledListItemAttributes.js +0 -72
  64. package/lib/experimental/recipes/ListAndPanel.stories.js +0 -353
  65. package/lib/experimental/recipes/ScrollableListView.stories.js +0 -93
  66. package/lib/experimental/recipes/items.js +0 -117
  67. package/lib/utils/docUtils/docArgTypes.js +0 -29
@@ -1,74 +0,0 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
3
- import React from 'react';
4
- import AccountIcon from '@pingux/mdi-react/AccountIcon';
5
- import { ListItemSwitchField } from '../../index';
6
- import axeTest from '../../utils/testUtils/testAxe';
7
- import { render, screen } from '../../utils/testUtils/testWrapper';
8
- import StyledListItem, { LIST_ITEM_ICON } from './StyledListItem';
9
- import { jsx as ___EmotionJSX } from "@emotion/react";
10
- var defaultProps = {
11
- details: {
12
- text: 'testText',
13
- subtext: 'testSubtext',
14
- icon: AccountIcon
15
- }
16
- };
17
- var getComponent = function getComponent() {
18
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19
- return render(___EmotionJSX(StyledListItem, _extends({}, defaultProps, props)));
20
- };
21
-
22
- // Need to be added to each test file to test accessibility using axe.
23
- axeTest(getComponent);
24
- var TEST_TEXT = 'test text';
25
- describe('StyledListItem', function () {
26
- test('renders details', function () {
27
- var _context;
28
- getComponent();
29
- var _defaultProps$details = defaultProps.details,
30
- text = _defaultProps$details.text,
31
- subtext = _defaultProps$details.subtext;
32
- screen.getByText(text);
33
- screen.getByText(subtext);
34
- screen.getByRole('img', {
35
- name: _concatInstanceProperty(_context = "".concat(text)).call(_context, LIST_ITEM_ICON)
36
- });
37
- });
38
- test('renders children', function () {
39
- getComponent({
40
- children: ___EmotionJSX(ListItemSwitchField, null)
41
- });
42
- screen.getByRole('switch');
43
- });
44
- test('renders rightOfDetails slot', function () {
45
- getComponent({
46
- slots: {
47
- rightOfDetails: ___EmotionJSX("div", null, TEST_TEXT)
48
- }
49
- });
50
- screen.getByText(TEST_TEXT);
51
- });
52
- describe('when there is a leftOfDetails slot', function () {
53
- test('renders leftOfDetails slot', function () {
54
- getComponent({
55
- slots: {
56
- leftOfDetails: ___EmotionJSX("div", null, TEST_TEXT)
57
- }
58
- });
59
- screen.getByText(TEST_TEXT);
60
- });
61
- test('it dose not render an icon', function () {
62
- getComponent({
63
- slots: {
64
- leftOfDetails: ___EmotionJSX("div", null, TEST_TEXT)
65
- }
66
- });
67
- var text = defaultProps.details.text;
68
- expect(screen.queryByTitle({
69
- id: "".concat(text, "-list-item-icon"),
70
- name: text
71
- })).not.toBeInTheDocument();
72
- });
73
- });
74
- });
@@ -1,25 +0,0 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import React from 'react';
3
- import CreateIcon from '@pingux/mdi-react/CreateIcon';
4
- import { iconButtonPropTypes } from '../../../components/IconButton/iconButtonAttributes';
5
- import { Box, Icon, IconButton } from '../../../index';
6
-
7
- /**
8
- * ListItemEditButton is one of several styled control components that can be used as a child
9
- * nested inside of the [StyledListItem](./?path=/story/experimental-styledlistitem--default).
10
- * Its a wrapper component around the [IconButton](./?path=/story/components-iconbutton--default),
11
- * intended to make matching specs easy. Most props available to the IconButton are also available
12
- * to ListItemEditButton.
13
- */
14
- import { jsx as ___EmotionJSX } from "@emotion/react";
15
- var ListItemEditButton = function ListItemEditButton(props) {
16
- return ___EmotionJSX(Box, null, ___EmotionJSX(IconButton, _extends({
17
- "aria-label": "edit-icon"
18
- }, props), ___EmotionJSX(Icon, {
19
- icon: CreateIcon,
20
- size: "sm"
21
- })));
22
- };
23
- ListItemEditButton.propTypes = iconButtonPropTypes;
24
- ListItemEditButton.displayName = 'ListItemEditButton';
25
- export default ListItemEditButton;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { iconButtonArgTypes } from '../../../components/IconButton/iconButtonAttributes';
3
- import { ListItemEditButton } from '../../../index';
4
- import { jsx as ___EmotionJSX } from "@emotion/react";
5
- delete iconButtonArgTypes.size;
6
- delete iconButtonArgTypes.icon;
7
- export default {
8
- title: 'Experimental/StyledListItem/Controls/ListItemEditButton',
9
- component: ListItemEditButton,
10
- parameters: {
11
- docs: {
12
- source: {
13
- type: 'code'
14
- }
15
- }
16
- },
17
- argTypes: iconButtonArgTypes
18
- };
19
- export var Default = function Default(args) {
20
- return ___EmotionJSX(ListItemEditButton, args);
21
- };
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import userEvent from '@testing-library/user-event';
3
- import axeTest from '../../../utils/testUtils/testAxe';
4
- import { render, screen } from '../../../utils/testUtils/testWrapper';
5
- import ListItemEditButton from './ListItemEditButton';
6
- import { jsx as ___EmotionJSX } from "@emotion/react";
7
- var getComponent = function getComponent() {
8
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
- return render(___EmotionJSX(ListItemEditButton, props));
10
- };
11
-
12
- // Need to be added to each test file to test accessibility using axe.
13
- axeTest(getComponent);
14
- test('ListItemEditButton responds to IconButton props', function () {
15
- var onPress = jest.fn();
16
- getComponent({
17
- onPress: onPress
18
- });
19
- var button = screen.getByRole('button');
20
- userEvent.click(button);
21
- expect(onPress).toBeCalled();
22
- });
@@ -1,28 +0,0 @@
1
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
2
- var _excluded = ["children"];
3
- import React from 'react';
4
- import MoreVertIcon from '@pingux/mdi-react/MoreVertIcon';
5
- import { menuPropTypes } from '../../../components/Menu/menuAttributes';
6
- import { Icon, IconButton, Menu, PopoverMenu } from '../../../index';
7
-
8
- /**
9
- * ListItemMenu is one of several styled control components that can be used as a child
10
- * nested inside of the [StyledListItem](./?path=/story/experimental-styledlistitem--default).
11
- * Its a wrapper component around the [PopoverMenu](./?path=/story/components-popovermenu--default)
12
- * and [Menu](./?path=/docs/components-menu--default) component, intended to make matching
13
- * specs easy. Most props available to the Menu component are available to ListItemMenu.
14
- */
15
- import { jsx as ___EmotionJSX } from "@emotion/react";
16
- var ListItemMenu = function ListItemMenu(_ref) {
17
- var children = _ref.children,
18
- others = _objectWithoutProperties(_ref, _excluded);
19
- return ___EmotionJSX(PopoverMenu, null, ___EmotionJSX(IconButton, {
20
- "aria-label": "more"
21
- }, ___EmotionJSX(Icon, {
22
- icon: MoreVertIcon,
23
- size: "md"
24
- })), ___EmotionJSX(Menu, others, children));
25
- };
26
- ListItemMenu.propTypes = menuPropTypes;
27
- ListItemMenu.displayName = 'ListItemMenu';
28
- export default ListItemMenu;
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { Item } from 'react-stately';
3
- import { menuArgTypes } from '../../../components/Menu/menuAttributes';
4
- import { ListItemMenu } from '../../../index';
5
- import { jsx as ___EmotionJSX } from "@emotion/react";
6
- export default {
7
- title: 'Experimental/StyledListItem/Controls/ListItemMenu',
8
- component: ListItemMenu,
9
- parameters: {
10
- docs: {
11
- source: {
12
- type: 'code'
13
- }
14
- }
15
- },
16
- argTypes: menuArgTypes
17
- };
18
- export var Default = function Default() {
19
- return ___EmotionJSX(ListItemMenu, null, ___EmotionJSX(Item, {
20
- key: "enable"
21
- }, "Enable user"), ___EmotionJSX(Item, {
22
- key: "disable"
23
- }, "Disable user"), ___EmotionJSX(Item, {
24
- key: "delete"
25
- }, "Delete user"));
26
- };
@@ -1,56 +0,0 @@
1
- import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
2
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
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
- 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, $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 generator._invoke = function (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); } }; }(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; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return 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, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), 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 (object) { var 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; }
13
- import React from 'react';
14
- import userEvent from '@testing-library/user-event';
15
- import { Item } from '../../../index';
16
- import axeTest from '../../../utils/testUtils/testAxe';
17
- import { render, screen } from '../../../utils/testUtils/testWrapper';
18
- import ListItemMenu from './ListItemMenu';
19
- import { jsx as ___EmotionJSX } from "@emotion/react";
20
- var getComponent = function getComponent() {
21
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
- return render(___EmotionJSX(ListItemMenu, props, ___EmotionJSX(Item, null, "testItem")));
23
- };
24
-
25
- // Need to be added to each test file to test accessibility using axe.
26
- axeTest(getComponent);
27
- test('ListItemMenu responds to Menu props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
28
- var onAction, menuTrigger, menuItem;
29
- return _regeneratorRuntime().wrap(function _callee$(_context) {
30
- while (1) {
31
- switch (_context.prev = _context.next) {
32
- case 0:
33
- onAction = jest.fn();
34
- getComponent({
35
- onAction: onAction
36
- });
37
- menuTrigger = screen.getByRole('button', {
38
- name: 'more'
39
- });
40
- _context.next = 5;
41
- return userEvent.click(menuTrigger);
42
- case 5:
43
- menuItem = screen.getByRole('menuitem', {
44
- name: 'testItem'
45
- });
46
- _context.next = 8;
47
- return userEvent.click(menuItem);
48
- case 8:
49
- expect(onAction).toBeCalled();
50
- case 9:
51
- case "end":
52
- return _context.stop();
53
- }
54
- }
55
- }, _callee);
56
- })));
@@ -1,23 +0,0 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import React from 'react';
3
- import { switchFieldPropTypes } from '../../../components/SwitchField/switchFieldAttributes';
4
- import { SwitchField } from '../../../index';
5
-
6
- /**
7
- * ListItemSwitchField is one of several styled control components that can be used as a child
8
- * nested inside of the [StyledListItem](./?path=/story/experimental-styledlistitem--default).
9
- * Its a wrapper component around the [SwitchField](./?path=/story/form-switchfield--default),
10
- * intended to make matching specs easy. Most props available to the SwitchField are also
11
- * available to ListItemEditButton.
12
- */
13
- import { jsx as ___EmotionJSX } from "@emotion/react";
14
- var ListItemSwitchField = function ListItemSwitchField(props) {
15
- return ___EmotionJSX(SwitchField, _extends({
16
- "aria-label": "active user",
17
- isDefaultSelected: true,
18
- mr: 0
19
- }, props));
20
- };
21
- ListItemSwitchField.displayName = 'ListItemSwitchField';
22
- ListItemSwitchField.propTypes = switchFieldPropTypes;
23
- export default ListItemSwitchField;
@@ -1,32 +0,0 @@
1
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
2
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
3
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
4
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
5
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
- import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
12
- import React from 'react';
13
- import { switchFieldArgTypes } from '../../../components/SwitchField/switchFieldAttributes';
14
- import { ListItemSwitchField } from '../../../index';
15
- import { onHoverArgTypes } from '../../../utils/docUtils/hoverProps';
16
- import { jsx as ___EmotionJSX } from "@emotion/react";
17
- delete switchFieldArgTypes.label;
18
- export default {
19
- title: 'Experimental/StyledListItem/Controls/ListItemSwitchField',
20
- component: ListItemSwitchField,
21
- parameters: {
22
- docs: {
23
- source: {
24
- type: 'code'
25
- }
26
- }
27
- },
28
- argTypes: _objectSpread(_objectSpread({}, switchFieldArgTypes), onHoverArgTypes)
29
- };
30
- export var Default = function Default(args) {
31
- return ___EmotionJSX(ListItemSwitchField, args);
32
- };
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import userEvent from '@testing-library/user-event';
3
- import axeTest from '../../../utils/testUtils/testAxe';
4
- import { render, screen } from '../../../utils/testUtils/testWrapper';
5
- import ListItemSwitchField from './ListItemSwitchField';
6
- import { jsx as ___EmotionJSX } from "@emotion/react";
7
- var getComponent = function getComponent() {
8
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
- return render(___EmotionJSX(ListItemSwitchField, props));
10
- };
11
-
12
- // Need to be added to each test file to test accessibility using axe.
13
- axeTest(getComponent);
14
- test('ListItemSwitchField responds to SwitchFiled props', function () {
15
- var onChange = jest.fn();
16
- getComponent({
17
- onChange: onChange
18
- });
19
- var switchField = screen.getByRole('switch');
20
- userEvent.click(switchField);
21
- expect(onChange).toBeCalled();
22
- });
@@ -1,72 +0,0 @@
1
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
2
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
3
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
4
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
5
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
- import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
12
- import PropTypes from 'prop-types';
13
- import { booleanArg, stringOrStringArray } from '../../utils/docUtils/docArgTypes';
14
- import { onHoverArgTypes, onHoverPropTypes } from '../../utils/docUtils/hoverProps';
15
- var descriptions = {
16
- details: 'Object with User/Group details.',
17
- className: 'A list of class names to apply to the element',
18
- isSelected: 'Sets the selected state of the ListItem',
19
- isPanelHeader: 'A boolean that will adapt the styling of ListIteme to be used as the PanelHeader',
20
- slots: 'Provides a way to insert markup in specified places.',
21
- linkProps: 'When present, provides meta click functionality'
22
- };
23
- export var styledListItemArgTypes = _objectSpread({
24
- className: {
25
- description: descriptions.className,
26
- type: {
27
- summary: stringOrStringArray
28
- }
29
- },
30
- details: {
31
- description: descriptions.details,
32
- type: {
33
- summary: '{ icon, text, subtext }'
34
- }
35
- },
36
- isSelected: _objectSpread(_objectSpread({}, booleanArg), {}, {
37
- description: descriptions.isSelected,
38
- control: {
39
- type: 'none'
40
- },
41
- linkProps: {
42
- description: descriptions.linkProps,
43
- type: {
44
- summary: '{ href, target }'
45
- }
46
- }
47
- }),
48
- onMetaClick: {
49
- description: ''
50
- },
51
- slots: {
52
- description: descriptions.slots,
53
- type: {
54
- summary: '{ leftOfDetails, rightOfDetails }'
55
- }
56
- }
57
- }, onHoverArgTypes);
58
- export var styledListItemPropTypes = _objectSpread({
59
- className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
60
- details: PropTypes.shape({
61
- icon: PropTypes.elementType,
62
- subtext: PropTypes.string,
63
- text: PropTypes.string
64
- }),
65
- isSelected: PropTypes.bool,
66
- linkProps: PropTypes.object,
67
- onMetaClick: PropTypes.func,
68
- slots: PropTypes.shape({
69
- leftOfDetails: PropTypes.node,
70
- rightOfDetails: PropTypes.node
71
- })
72
- }, onHoverPropTypes);