@pingux/astro 2.16.1-alpha.1 → 2.17.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 (72) hide show
  1. package/lib/cjs/components/ListView/ListView.js +1 -1
  2. package/lib/cjs/components/ListView/ListView.mdx +4 -1
  3. package/lib/cjs/components/ListView/ListView.stories.js +52 -98
  4. package/lib/cjs/components/ListView/ListViewItem.js +126 -0
  5. package/lib/cjs/components/ListViewItem/ListViewItem.js +81 -100
  6. package/lib/cjs/{experimental → components}/ListViewItem/ListViewItem.mdx +4 -4
  7. package/lib/cjs/{experimental → components}/ListViewItem/ListViewItem.stories.js +32 -37
  8. package/lib/cjs/{experimental → components}/ListViewItem/ListViewItem.test.js +3 -3
  9. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.js +5 -5
  10. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.stories.js +5 -5
  11. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.test.js +2 -2
  12. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemMenu.js +8 -8
  13. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemMenu.stories.js +5 -5
  14. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemMenu.test.js +2 -3
  15. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.js +5 -5
  16. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.stories.js +5 -5
  17. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.test.js +2 -2
  18. package/lib/cjs/experimental/PageHeader/PageHeader.js +14 -14
  19. package/lib/cjs/experimental/PageHeader/PageHeader.stories.js +27 -11
  20. package/lib/cjs/experimental/PageHeader/PageHeader.test.js +14 -5
  21. package/lib/cjs/experimental/PanelHeader/PanelHeader.js +1 -1
  22. package/lib/cjs/experimental/PanelHeader/PanelHeader.stories.js +1 -1
  23. package/lib/cjs/index.d.ts +4 -4
  24. package/lib/cjs/index.js +8 -8
  25. package/lib/cjs/recipes/ListAndPanel.stories.js +195 -267
  26. package/lib/cjs/recipes/MaskedValue.stories.js +8 -1
  27. package/lib/cjs/{experimental/recipes → recipes}/ScrollableListView.stories.js +2 -2
  28. package/lib/cjs/utils/designUtils/figmaLinks.js +3 -0
  29. package/lib/components/ListView/ListView.js +1 -1
  30. package/lib/components/ListView/ListView.mdx +4 -1
  31. package/lib/components/ListView/ListView.stories.js +47 -93
  32. package/lib/components/ListView/ListViewItem.js +113 -0
  33. package/lib/components/ListViewItem/ListViewItem.js +78 -99
  34. package/lib/{experimental → components}/ListViewItem/ListViewItem.mdx +4 -4
  35. package/lib/{experimental → components}/ListViewItem/ListViewItem.stories.js +7 -12
  36. package/lib/{experimental → components}/ListViewItem/ListViewItem.test.js +1 -1
  37. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.js +4 -4
  38. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.stories.js +3 -3
  39. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.test.js +1 -1
  40. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemMenu.js +5 -5
  41. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemMenu.stories.js +3 -3
  42. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemMenu.test.js +1 -2
  43. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.js +4 -4
  44. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.stories.js +3 -3
  45. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.test.js +1 -1
  46. package/lib/experimental/PageHeader/PageHeader.js +14 -14
  47. package/lib/experimental/PageHeader/PageHeader.stories.js +25 -10
  48. package/lib/experimental/PageHeader/PageHeader.test.js +14 -5
  49. package/lib/experimental/PanelHeader/PanelHeader.js +1 -1
  50. package/lib/experimental/PanelHeader/PanelHeader.stories.js +1 -1
  51. package/lib/index.js +4 -4
  52. package/lib/recipes/ListAndPanel.stories.js +186 -260
  53. package/lib/recipes/MaskedValue.stories.js +7 -0
  54. package/lib/{experimental/recipes → recipes}/ScrollableListView.stories.js +2 -2
  55. package/lib/utils/designUtils/figmaLinks.js +3 -0
  56. package/package.json +1 -1
  57. package/lib/cjs/components/ListItem/ListItem.stories.js +0 -189
  58. package/lib/cjs/experimental/ListView/ListView.mdx +0 -47
  59. package/lib/cjs/experimental/ListView/ListView.stories.js +0 -742
  60. package/lib/cjs/experimental/ListViewItem/ListViewItem.js +0 -108
  61. package/lib/cjs/experimental/recipes/ListAndPanel.stories.js +0 -359
  62. package/lib/cjs/recipes/ScrollableListView.stories.hidden.js +0 -136
  63. package/lib/components/ListItem/ListItem.stories.js +0 -174
  64. package/lib/experimental/ListView/ListView.mdx +0 -47
  65. package/lib/experimental/ListView/ListView.stories.js +0 -729
  66. package/lib/experimental/ListViewItem/ListViewItem.js +0 -93
  67. package/lib/experimental/recipes/ListAndPanel.stories.js +0 -342
  68. package/lib/recipes/ScrollableListView.stories.hidden.js +0 -121
  69. /package/lib/cjs/{experimental → components}/ListViewItem/listViewItemAttributes.js +0 -0
  70. /package/lib/cjs/{experimental/recipes → recipes}/items.js +0 -0
  71. /package/lib/{experimental → components}/ListViewItem/listViewItemAttributes.js +0 -0
  72. /package/lib/{experimental/recipes → recipes}/items.js +0 -0
@@ -1,729 +0,0 @@
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 _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
8
- import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
9
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
10
- import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/esm/objectDestructuringEmpty";
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 _context4; _forEachInstanceProperty(_context4 = ["next", "throw", "return"]).call(_context4, 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 _context5; 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(_context5 = this.tryEntries).call(_context5, 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 _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
14
- import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
15
- import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
16
- import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
17
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
18
- import React from 'react';
19
- import { Item, useAsyncList } from 'react-stately';
20
- import FormSelectIcon from '@pingux/mdi-react/FormSelectIcon';
21
- import { action } from '@storybook/addon-actions';
22
- import isChromatic from 'chromatic/isChromatic';
23
- import DocsLayout from '../../../.storybook/storybookDocsLayout';
24
- import { Box, ListView, ListViewItem, ListViewItemMenu, ListViewItemSwitchField } from '../../index';
25
- import loadingStates from '../../utils/devUtils/constants/loadingStates';
26
- import ListViewReadme from './ListView.mdx';
27
- import { jsx as ___EmotionJSX } from "@emotion/react";
28
- export default {
29
- title: 'Experimental/ListView',
30
- component: ListView,
31
- parameters: {
32
- docs: {
33
- page: function page() {
34
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(ListViewReadme, null), ___EmotionJSX(DocsLayout, null));
35
- },
36
- source: {
37
- type: 'code'
38
- }
39
- }
40
- },
41
- argTypes: {
42
- loadingState: {
43
- control: {
44
- type: 'select',
45
- options: loadingStates
46
- }
47
- },
48
- disabledKeys: {},
49
- items: {
50
- control: {
51
- type: 'none'
52
- }
53
- },
54
- onSelectionChange: {
55
- control: 'none'
56
- }
57
- },
58
- args: {
59
- disabledKeys: ['Snake'],
60
- // eslint-disable-next-line no-console
61
- onSelectionChange: console.log
62
- }
63
- };
64
- var items = [{
65
- key: 'Aardvark',
66
- name: 'Aardvark',
67
- id: '1',
68
- hasSeparator: false
69
- }, {
70
- key: 'Kangaroo',
71
- name: 'Kangaroo',
72
- id: '2'
73
- }, {
74
- key: 'Snake',
75
- name: 'Snake',
76
- id: '3'
77
- }];
78
- var animals = [{
79
- name: 'Aardvark'
80
- }, {
81
- name: 'Albatross'
82
- }, {
83
- name: 'Alligator'
84
- }, {
85
- name: 'Alpaca'
86
- }, {
87
- name: 'Ant'
88
- }, {
89
- name: 'Anteater'
90
- }, {
91
- name: 'Antelope'
92
- }, {
93
- name: 'Ape'
94
- }, {
95
- name: 'Armadillo'
96
- }, {
97
- name: 'Donkey'
98
- }, {
99
- name: 'Baboon'
100
- }, {
101
- name: 'Badger'
102
- }, {
103
- name: 'Barracuda'
104
- }, {
105
- name: 'Bat'
106
- }, {
107
- name: 'Bear'
108
- }, {
109
- name: 'Beaver'
110
- }, {
111
- name: 'Bee'
112
- }, {
113
- name: 'Bison'
114
- }, {
115
- name: 'Boar'
116
- }, {
117
- name: 'Buffalo'
118
- }, {
119
- name: 'Butterfly'
120
- }, {
121
- name: 'Camel'
122
- }, {
123
- name: 'Capybara'
124
- }, {
125
- name: 'Caribou'
126
- }, {
127
- name: 'Cassowary'
128
- }, {
129
- name: 'Cat'
130
- }, {
131
- name: 'Caterpillar'
132
- }, {
133
- name: 'Cattle'
134
- }, {
135
- name: 'Chamois'
136
- }, {
137
- name: 'Cheetah'
138
- }, {
139
- name: 'Chicken'
140
- }, {
141
- name: 'Chimpanzee'
142
- }, {
143
- name: 'Chinchilla'
144
- }, {
145
- name: 'Chough'
146
- }, {
147
- name: 'Clam'
148
- }, {
149
- name: 'Cobra'
150
- }, {
151
- name: 'Cockroach'
152
- }, {
153
- name: 'Cod'
154
- }, {
155
- name: 'Cormorant'
156
- }, {
157
- name: 'Coyote'
158
- }, {
159
- name: 'Crab'
160
- }, {
161
- name: 'Crane'
162
- }, {
163
- name: 'Crocodile'
164
- }, {
165
- name: 'Crow'
166
- }, {
167
- name: 'Curlew'
168
- }, {
169
- name: 'Deer'
170
- }, {
171
- name: 'Dinosaur'
172
- }, {
173
- name: 'Dog'
174
- }, {
175
- name: 'Dogfish'
176
- }, {
177
- name: 'Dolphin'
178
- }, {
179
- name: 'Dotterel'
180
- }, {
181
- name: 'Dove'
182
- }, {
183
- name: 'Dragonfly'
184
- }, {
185
- name: 'Duck'
186
- }, {
187
- name: 'Dugong'
188
- }, {
189
- name: 'Dunlin'
190
- }, {
191
- name: 'Eagle'
192
- }, {
193
- name: 'Echidna'
194
- }, {
195
- name: 'Eel'
196
- }, {
197
- name: 'Eland'
198
- }, {
199
- name: 'Elephant'
200
- }, {
201
- name: 'Elk'
202
- }, {
203
- name: 'Emu'
204
- }, {
205
- name: 'Falcon'
206
- }, {
207
- name: 'Ferret'
208
- }, {
209
- name: 'Finch'
210
- }, {
211
- name: 'Fish'
212
- }, {
213
- name: 'Flamingo'
214
- }, {
215
- name: 'Fly'
216
- }, {
217
- name: 'Fox'
218
- }, {
219
- name: 'Frog'
220
- }, {
221
- name: 'Gaur'
222
- }, {
223
- name: 'Gazelle'
224
- }, {
225
- name: 'Gerbil'
226
- }, {
227
- name: 'Giraffe'
228
- }, {
229
- name: 'Gnat'
230
- }, {
231
- name: 'Gnu'
232
- }, {
233
- name: 'Goat'
234
- }, {
235
- name: 'Goldfinch'
236
- }, {
237
- name: 'Goldfish'
238
- }, {
239
- name: 'Goose'
240
- }, {
241
- name: 'Gorilla'
242
- }, {
243
- name: 'Goshawk'
244
- }, {
245
- name: 'Grasshopper'
246
- }, {
247
- name: 'Grouse'
248
- }, {
249
- name: 'Guanaco'
250
- }, {
251
- name: 'Gull'
252
- }, {
253
- name: 'Hamster'
254
- }, {
255
- name: 'Hare'
256
- }, {
257
- name: 'Hawk'
258
- }, {
259
- name: 'Hedgehog'
260
- }, {
261
- name: 'Heron'
262
- }, {
263
- name: 'Herring'
264
- }, {
265
- name: 'Hippopotamus'
266
- }, {
267
- name: 'Hornet'
268
- }, {
269
- name: 'Horse'
270
- }, {
271
- name: 'Human'
272
- }, {
273
- name: 'Hummingbird'
274
- }, {
275
- name: 'Hyena'
276
- }, {
277
- name: 'Ibex'
278
- }, {
279
- name: 'Ibis'
280
- }, {
281
- name: 'Jackal'
282
- }, {
283
- name: 'Jaguar'
284
- }, {
285
- name: 'Jay'
286
- }, {
287
- name: 'Jellyfish'
288
- }, {
289
- name: 'Kangaroo'
290
- }, {
291
- name: 'Kingfisher'
292
- }, {
293
- name: 'Koala'
294
- }, {
295
- name: 'Kookabura'
296
- }, {
297
- name: 'Kouprey'
298
- }, {
299
- name: 'Kudu'
300
- }, {
301
- name: 'Lapwing'
302
- }, {
303
- name: 'Lark'
304
- }, {
305
- name: 'Lemur'
306
- }, {
307
- name: 'Leopard'
308
- }, {
309
- name: 'Lion'
310
- }, {
311
- name: 'Llama'
312
- }, {
313
- name: 'Lobster'
314
- }, {
315
- name: 'Locust'
316
- }, {
317
- name: 'Loris'
318
- }, {
319
- name: 'Louse'
320
- }, {
321
- name: 'Lyrebird'
322
- }, {
323
- name: 'Magpie'
324
- }, {
325
- name: 'Mallard'
326
- }, {
327
- name: 'Manatee'
328
- }, {
329
- name: 'Mandrill'
330
- }, {
331
- name: 'Mantis'
332
- }, {
333
- name: 'Marten'
334
- }, {
335
- name: 'Meerkat'
336
- }, {
337
- name: 'Mink'
338
- }, {
339
- name: 'Mole'
340
- }, {
341
- name: 'Mongoose'
342
- }, {
343
- name: 'Monkey'
344
- }, {
345
- name: 'Moose'
346
- }, {
347
- name: 'Mosquito'
348
- }, {
349
- name: 'Mouse'
350
- }, {
351
- name: 'Mule'
352
- }, {
353
- name: 'Narwhal'
354
- }, {
355
- name: 'Newt'
356
- }, {
357
- name: 'Nightingale'
358
- }, {
359
- name: 'Octopus'
360
- }, {
361
- name: 'Okapi'
362
- }, {
363
- name: 'Opossum'
364
- }, {
365
- name: 'Oryx'
366
- }, {
367
- name: 'Ostrich'
368
- }, {
369
- name: 'Otter'
370
- }, {
371
- name: 'Owl'
372
- }, {
373
- name: 'Oyster'
374
- }, {
375
- name: 'Panther'
376
- }, {
377
- name: 'Parrot'
378
- }, {
379
- name: 'Partridge'
380
- }, {
381
- name: 'Peafowl'
382
- }, {
383
- name: 'Pelican'
384
- }, {
385
- name: 'Penguin'
386
- }, {
387
- name: 'Pheasant'
388
- }, {
389
- name: 'Pig'
390
- }, {
391
- name: 'Pigeon'
392
- }, {
393
- name: 'Pony'
394
- }, {
395
- name: 'Porcupine'
396
- }, {
397
- name: 'Porpoise'
398
- }, {
399
- name: 'Quail'
400
- }, {
401
- name: 'Quelea'
402
- }, {
403
- name: 'Quetzal'
404
- }, {
405
- name: 'Rabbit'
406
- }, {
407
- name: 'Raccoon'
408
- }, {
409
- name: 'Rail'
410
- }, {
411
- name: 'Ram'
412
- }, {
413
- name: 'Rat'
414
- }, {
415
- name: 'Raven'
416
- }, {
417
- name: 'Red deer'
418
- }, {
419
- name: 'Red panda'
420
- }, {
421
- name: 'Reindeer'
422
- }, {
423
- name: 'Rhinoceros'
424
- }, {
425
- name: 'Rook'
426
- }, {
427
- name: 'Salamander'
428
- }, {
429
- name: 'Salmon'
430
- }, {
431
- name: 'Sand Dollar'
432
- }, {
433
- name: 'Sandpiper'
434
- }, {
435
- name: 'Sardine'
436
- }, {
437
- name: 'Scorpion'
438
- }, {
439
- name: 'Seahorse'
440
- }, {
441
- name: 'Seal'
442
- }, {
443
- name: 'Shark'
444
- }, {
445
- name: 'Sheep'
446
- }, {
447
- name: 'Shrew'
448
- }, {
449
- name: 'Skunk'
450
- }, {
451
- name: 'Snail'
452
- }, {
453
- name: 'Snake'
454
- }, {
455
- name: 'Sparrow'
456
- }, {
457
- name: 'Spider'
458
- }, {
459
- name: 'Spoonbill'
460
- }, {
461
- name: 'Squid'
462
- }, {
463
- name: 'Squirrel'
464
- }, {
465
- name: 'Starling'
466
- }, {
467
- name: 'Stingray'
468
- }, {
469
- name: 'Stinkbug'
470
- }, {
471
- name: 'Stork'
472
- }, {
473
- name: 'Swallow'
474
- }, {
475
- name: 'Swan'
476
- }, {
477
- name: 'Tapir'
478
- }, {
479
- name: 'Tarsier'
480
- }, {
481
- name: 'Termite'
482
- }, {
483
- name: 'Tiger'
484
- }, {
485
- name: 'Toad'
486
- }, {
487
- name: 'Trout'
488
- }, {
489
- name: 'Turkey'
490
- }, {
491
- name: 'Turtle'
492
- }, {
493
- name: 'Viper'
494
- }, {
495
- name: 'Vulture'
496
- }, {
497
- name: 'Wallaby'
498
- }, {
499
- name: 'Walrus'
500
- }, {
501
- name: 'Wasp'
502
- }, {
503
- name: 'Weasel'
504
- }, {
505
- name: 'Whale'
506
- }, {
507
- name: 'Wildcat'
508
- }, {
509
- name: 'Wolf'
510
- }, {
511
- name: 'Wolverine'
512
- }, {
513
- name: 'Wombat'
514
- }, {
515
- name: 'Woodcock'
516
- }, {
517
- name: 'Woodpecker'
518
- }, {
519
- name: 'Worm'
520
- }, {
521
- name: 'Wren'
522
- }, {
523
- name: 'Yak'
524
- }, {
525
- name: 'Zebra'
526
- }];
527
- var props = {
528
- disabledKeys: ['Snake']
529
- };
530
- var actions = {
531
- onBlur: action('onBlur'),
532
- onFocus: action('onFocus'),
533
- onLoadMore: action('onLoadMore')
534
- };
535
- var Controls = function Controls() {
536
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(ListViewItemSwitchField, null), ___EmotionJSX(ListViewItemMenu, null, ___EmotionJSX(Item, {
537
- key: "enable"
538
- }, "Enable user"), ___EmotionJSX(Item, {
539
- key: "disable"
540
- }, "Disable user"), ___EmotionJSX(Item, {
541
- key: "delete"
542
- }, "Delete user")));
543
- };
544
- export var Default = function Default(_ref) {
545
- var args = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
546
- return ___EmotionJSX(ListView, _extends({}, props, args, {
547
- items: items
548
- }), function (item) {
549
- return ___EmotionJSX(Item, {
550
- key: item.name
551
- }, ___EmotionJSX(ListViewItem, {
552
- data: {
553
- text: item.name,
554
- icon: FormSelectIcon
555
- }
556
- }, ___EmotionJSX(Controls, null)));
557
- });
558
- };
559
- export var InfiniteLoadingList = function InfiniteLoadingList(args) {
560
- var getMockData = /*#__PURE__*/function () {
561
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(signal, cursor) {
562
- var pageNumber;
563
- return _regeneratorRuntime().wrap(function _callee$(_context) {
564
- while (1) {
565
- switch (_context.prev = _context.next) {
566
- case 0:
567
- pageNumber = 1;
568
- if (cursor) {
569
- pageNumber = Number(cursor.substr(_indexOfInstanceProperty(cursor).call(cursor, '-') + 1));
570
- }
571
- // With this we will emulate load even with mocked API, except for Chromatic runs
572
- if (args.useMockData) {
573
- _context.next = 5;
574
- break;
575
- }
576
- _context.next = 5;
577
- return new _Promise(function (resolve) {
578
- return _setTimeout(resolve, cursor ? 2000 : 3000);
579
- });
580
- case 5:
581
- return _context.abrupt("return", {
582
- items: _sliceInstanceProperty(animals).call(animals, (pageNumber - 1) * 10, pageNumber * 10),
583
- cursor: "mock-".concat(pageNumber + 1)
584
- });
585
- case 6:
586
- case "end":
587
- return _context.stop();
588
- }
589
- }
590
- }, _callee);
591
- }));
592
- return function getMockData(_x, _x2) {
593
- return _ref2.apply(this, arguments);
594
- };
595
- }();
596
- var fetchApiData = /*#__PURE__*/function () {
597
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(signal, cursor, filterText) {
598
- var res, json;
599
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
600
- while (1) {
601
- switch (_context2.prev = _context2.next) {
602
- case 0:
603
- if (!args.useMockData) {
604
- _context2.next = 2;
605
- break;
606
- }
607
- return _context2.abrupt("return", getMockData());
608
- case 2:
609
- _context2.prev = 2;
610
- _context2.next = 5;
611
- return _Promise.race([
612
- // If no cursor is available, then we're loading the first page,
613
- // filtering the results returned via a query string that
614
- // mirrors the ComboBox input text.
615
- // Otherwise, the cursor is the next URL to load,
616
- // as returned from the previous page.
617
- fetch(cursor || "https://swapi.dev/api/people/?search=".concat(filterText), {
618
- signal: signal
619
- }), new _Promise(function (_resolve, reject) {
620
- return _setTimeout(function () {
621
- return reject(new Error('timeout'));
622
- }, 3000);
623
- })]);
624
- case 5:
625
- res = _context2.sent;
626
- _context2.next = 8;
627
- return res.json();
628
- case 8:
629
- json = _context2.sent;
630
- _context2.next = 11;
631
- return new _Promise(function (resolve) {
632
- return _setTimeout(resolve, cursor ? 2000 : 3000);
633
- });
634
- case 11:
635
- return _context2.abrupt("return", {
636
- items: json.results,
637
- cursor: json.next
638
- });
639
- case 14:
640
- _context2.prev = 14;
641
- _context2.t0 = _context2["catch"](2);
642
- return _context2.abrupt("return", getMockData());
643
- case 17:
644
- case "end":
645
- return _context2.stop();
646
- }
647
- }
648
- }, _callee2, null, [[2, 14]]);
649
- }));
650
- return function fetchApiData(_x3, _x4, _x5) {
651
- return _ref3.apply(this, arguments);
652
- };
653
- }();
654
- var list = useAsyncList({
655
- load: function load(_ref4) {
656
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
657
- var signal, cursor, filterText;
658
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
659
- while (1) {
660
- switch (_context3.prev = _context3.next) {
661
- case 0:
662
- signal = _ref4.signal, cursor = _ref4.cursor, filterText = _ref4.filterText;
663
- if (cursor) {
664
- // eslint-disable-next-line
665
- cursor = cursor.replace(/^http:\/\//i, "https://");
666
- }
667
-
668
- // check if we are mocking pages
669
- if (!(cursor && _includesInstanceProperty(cursor).call(cursor, 'mock'))) {
670
- _context3.next = 4;
671
- break;
672
- }
673
- return _context3.abrupt("return", getMockData(signal, cursor, filterText));
674
- case 4:
675
- return _context3.abrupt("return", fetchApiData(signal, cursor, filterText));
676
- case 5:
677
- case "end":
678
- return _context3.stop();
679
- }
680
- }
681
- }, _callee3);
682
- }))();
683
- }
684
- });
685
- return ___EmotionJSX(Box, {
686
- sx: {
687
- maxHeight: '400px'
688
- }
689
- }, ___EmotionJSX(ListView, _extends({}, actions, {
690
- items: list.items,
691
- loadingState: list.loadingState,
692
- onLoadMore: list.loadMore
693
- }), function (item) {
694
- return ___EmotionJSX(Item, {
695
- key: item.name
696
- }, ___EmotionJSX(ListViewItem, {
697
- data: {
698
- text: item.name,
699
- icon: FormSelectIcon
700
- }
701
- }, ___EmotionJSX(Controls, null)));
702
- }));
703
- };
704
- InfiniteLoadingList.args = {
705
- useMockData: isChromatic()
706
- };
707
- InfiniteLoadingList.parameters = {
708
- docs: {
709
- description: {
710
- story: 'Note: Keep in mind the maxHeight may impact when the scroll callback is triggered. If you notice it\'s being called too often, try adjusting that value or loading more objects to prevent this behavior.'
711
- }
712
- }
713
- };
714
- export var MultipleSelection = function MultipleSelection(_ref5) {
715
- var args = _extends({}, (_objectDestructuringEmpty(_ref5), _ref5));
716
- return ___EmotionJSX(ListView, _extends({}, props, args, {
717
- items: items,
718
- selectionMode: "multiple"
719
- }), function (item) {
720
- return ___EmotionJSX(Item, {
721
- key: item.name
722
- }, ___EmotionJSX(ListViewItem, {
723
- data: {
724
- text: item.name,
725
- icon: FormSelectIcon
726
- }
727
- }, ___EmotionJSX(Controls, null)));
728
- });
729
- };