grommet 2.23.0 → 2.24.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 (87) hide show
  1. package/components/Anchor/Anchor.js +2 -3
  2. package/components/CheckBoxGroup/index.d.ts +1 -3
  3. package/components/DataTable/stories/SpaceX.js +6 -4
  4. package/components/DataTable/stories/SpaceXUngrouped.js +4 -2
  5. package/components/Drop/DropContainer.js +6 -2
  6. package/components/FileInput/index.d.ts +6 -1
  7. package/components/Form/stories/HelpAndError.js +1 -1
  8. package/components/Grid/index.d.ts +6 -2
  9. package/components/Layer/Layer.js +1 -1
  10. package/components/Layer/LayerContainer.js +6 -2
  11. package/components/List/List.js +103 -40
  12. package/components/List/index.d.ts +3 -1
  13. package/components/List/propTypes.js +3 -1
  14. package/components/List/stories/Disabled.js +33 -0
  15. package/components/Notification/Notification.js +17 -8
  16. package/components/Notification/index.d.ts +1 -0
  17. package/components/Notification/propTypes.js +1 -0
  18. package/components/PageHeader/PageHeader.js +80 -0
  19. package/components/PageHeader/index.d.ts +26 -0
  20. package/components/PageHeader/index.js +8 -0
  21. package/components/PageHeader/propTypes.js +30 -0
  22. package/components/PageHeader/stories/Custom.js +47 -0
  23. package/components/PageHeader/stories/MultipleActions.js +79 -0
  24. package/components/PageHeader/stories/Responsive.js +37 -0
  25. package/components/PageHeader/stories/Simple.js +36 -0
  26. package/components/RadioButtonGroup/index.d.ts +2 -1
  27. package/components/Select/Select.js +0 -2
  28. package/components/Select/SelectContainer.js +9 -0
  29. package/components/Table/StyledTable.js +1 -1
  30. package/components/TextInput/TextInput.js +32 -3
  31. package/components/TextInput/stories/DefaultSuggestion.js +1 -0
  32. package/components/TextInput/stories/Suggestions.js +1 -0
  33. package/components/Tip/Tip.js +18 -6
  34. package/components/Video/Video.js +100 -46
  35. package/components/Video/index.d.ts +1 -0
  36. package/components/Video/propTypes.js +1 -1
  37. package/components/Video/stories/typescript/ControlsBelow.tsx +6 -2
  38. package/components/index.d.ts +1 -0
  39. package/components/index.js +8 -0
  40. package/es6/components/Anchor/Anchor.js +2 -3
  41. package/es6/components/CheckBoxGroup/index.d.ts +1 -3
  42. package/es6/components/DataTable/stories/SpaceX.js +6 -4
  43. package/es6/components/DataTable/stories/SpaceXUngrouped.js +4 -2
  44. package/es6/components/Drop/DropContainer.js +4 -2
  45. package/es6/components/FileInput/index.d.ts +6 -1
  46. package/es6/components/Form/stories/HelpAndError.js +1 -1
  47. package/es6/components/Grid/index.d.ts +6 -2
  48. package/es6/components/Layer/Layer.js +1 -1
  49. package/es6/components/Layer/LayerContainer.js +4 -2
  50. package/es6/components/List/List.js +104 -41
  51. package/es6/components/List/index.d.ts +3 -1
  52. package/es6/components/List/propTypes.js +3 -1
  53. package/es6/components/List/stories/Disabled.js +20 -0
  54. package/es6/components/Notification/Notification.js +17 -8
  55. package/es6/components/Notification/index.d.ts +1 -0
  56. package/es6/components/Notification/propTypes.js +1 -0
  57. package/es6/components/PageHeader/PageHeader.js +63 -0
  58. package/es6/components/PageHeader/index.d.ts +26 -0
  59. package/es6/components/PageHeader/index.js +1 -0
  60. package/es6/components/PageHeader/propTypes.js +19 -0
  61. package/es6/components/PageHeader/stories/Custom.js +32 -0
  62. package/es6/components/PageHeader/stories/MultipleActions.js +63 -0
  63. package/es6/components/PageHeader/stories/Responsive.js +25 -0
  64. package/es6/components/PageHeader/stories/Simple.js +24 -0
  65. package/es6/components/RadioButtonGroup/index.d.ts +2 -1
  66. package/es6/components/Select/Select.js +0 -2
  67. package/es6/components/Select/SelectContainer.js +9 -0
  68. package/es6/components/Table/StyledTable.js +1 -1
  69. package/es6/components/TextInput/TextInput.js +32 -3
  70. package/es6/components/TextInput/stories/DefaultSuggestion.js +1 -0
  71. package/es6/components/TextInput/stories/Suggestions.js +1 -0
  72. package/es6/components/Tip/Tip.js +18 -6
  73. package/es6/components/Video/Video.js +99 -46
  74. package/es6/components/Video/index.d.ts +1 -0
  75. package/es6/components/Video/propTypes.js +1 -1
  76. package/es6/components/Video/stories/typescript/ControlsBelow.tsx +6 -2
  77. package/es6/components/index.d.ts +1 -0
  78. package/es6/components/index.js +1 -0
  79. package/es6/languages/default.json +4 -1
  80. package/es6/themes/base.d.ts +47 -7
  81. package/es6/themes/base.js +72 -1
  82. package/grommet.min.js +1 -1
  83. package/grommet.min.js.map +1 -1
  84. package/languages/default.json +4 -1
  85. package/package.json +30 -26
  86. package/themes/base.d.ts +47 -7
  87. package/themes/base.js +73 -1
@@ -33,8 +33,7 @@ var Anchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
33
33
  children = _ref.children,
34
34
  color = _ref.color,
35
35
  disabled = _ref.disabled,
36
- _ref$gap = _ref.gap,
37
- gap = _ref$gap === void 0 ? 'small' : _ref$gap,
36
+ gap = _ref.gap,
38
37
  href = _ref.href,
39
38
  icon = _ref.icon,
40
39
  label = _ref.label,
@@ -88,7 +87,7 @@ var Anchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
88
87
  as: "span",
89
88
  direction: "row",
90
89
  align: "center",
91
- gap: gap,
90
+ gap: gap || theme.anchor.gap,
92
91
  responsive: false,
93
92
  style: {
94
93
  display: 'inline-flex'
@@ -10,9 +10,7 @@ interface OnChangeEvent {
10
10
 
11
11
  export interface CheckBoxType
12
12
  extends Omit<CheckBoxProps & JSX.IntrinsicElements['input'], 'checked'> {
13
- [key: CheckBoxGroupProps['labelKey'] | CheckBoxGroupProps['valueKey']]:
14
- | CheckBoxProps['label']
15
- | JSX.IntrinsicElements['input']['value'];
13
+ [key: string]: any;
16
14
  }
17
15
 
18
16
  export interface CheckBoxGroupProps {
@@ -13,6 +13,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
 
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
+ 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) { ["next", "throw", "return"].forEach(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" }], tryLocsList.forEach(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 keys.reverse(), 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) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(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; }
17
+
16
18
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
17
19
 
18
20
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -140,9 +142,9 @@ var SpaceX = function SpaceX() {
140
142
  }, [groups]);
141
143
  (0, _react.useEffect)(function () {
142
144
  var fetchData = /*#__PURE__*/function () {
143
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
145
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
144
146
  var query;
145
- return regeneratorRuntime.wrap(function _callee$(_context) {
147
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
146
148
  while (1) {
147
149
  switch (_context.prev = _context.next) {
148
150
  case 0:
@@ -182,11 +184,11 @@ var SpaceX = function SpaceX() {
182
184
  }, []);
183
185
  (0, _react.useEffect)(function () {
184
186
  var fetchData = /*#__PURE__*/function () {
185
- var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
187
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
186
188
  var _sort;
187
189
 
188
190
  var query;
189
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
191
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
190
192
  while (1) {
191
193
  switch (_context2.prev = _context2.next) {
192
194
  case 0:
@@ -13,6 +13,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
 
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
+ 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) { ["next", "throw", "return"].forEach(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" }], tryLocsList.forEach(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 keys.reverse(), 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) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(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; }
17
+
16
18
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
17
19
 
18
20
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -80,11 +82,11 @@ var SpaceXUngrouped = function SpaceXUngrouped() {
80
82
 
81
83
  (0, _react.useEffect)(function () {
82
84
  var fetchData = /*#__PURE__*/function () {
83
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
85
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
84
86
  var _sort;
85
87
 
86
88
  var query;
87
- return regeneratorRuntime.wrap(function _callee$(_context) {
89
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
88
90
  while (1) {
89
91
  switch (_context.prev = _context.next) {
90
92
  case 0:
@@ -7,6 +7,8 @@ var _react = _interopRequireWildcard(require("react"));
7
7
 
8
8
  var _styledComponents = require("styled-components");
9
9
 
10
+ var _ContainerTargetContext = require("../../contexts/ContainerTargetContext");
11
+
10
12
  var _FocusedContainer = require("../FocusedContainer");
11
13
 
12
14
  var _utils = require("../../utils");
@@ -67,6 +69,8 @@ var DropContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
67
69
  trapFocus = _ref.trapFocus,
68
70
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
69
71
 
72
+ var containerTarget = (0, _react.useContext)(_ContainerTargetContext.ContainerTargetContext);
73
+
70
74
  var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
71
75
 
72
76
  var portalContext = (0, _react.useContext)(_utils.PortalContext) || defaultPortalContext;
@@ -278,7 +282,7 @@ var DropContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
278
282
  var onClickDocument = function onClickDocument(event) {
279
283
  // determine which portal id the target is in, if any
280
284
  var clickedPortalId = null;
281
- var node = event.target;
285
+ var node = containerTarget === document.body ? event.target : event == null ? void 0 : event.path[0];
282
286
 
283
287
  while (clickedPortalId === null && node !== document) {
284
288
  var attr = node.getAttribute('data-g-portal-id');
@@ -313,7 +317,7 @@ var DropContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
313
317
  document.removeEventListener('mousedown', onClickDocument);
314
318
  }
315
319
  };
316
- }, [align, onAlign, dropTarget, onClickOutside, portalContext, portalId, ref, responsive, restrictFocus, stretch, theme.drop]);
320
+ }, [align, containerTarget, onAlign, dropTarget, onClickOutside, portalContext, portalId, ref, responsive, restrictFocus, stretch, theme.drop]);
317
321
  (0, _react.useEffect)(function () {
318
322
  if (restrictFocus) {
319
323
  (ref || dropRef).current.focus();
@@ -22,10 +22,15 @@ export interface FileInputProps {
22
22
  };
23
23
  multiple?: boolean | { aggregateThreshold?: number; max?: number };
24
24
  name?: string;
25
+ onChange?: (
26
+ event?: React.ChangeEvent<HTMLInputElement>,
27
+ { files }?: { files: object },
28
+ { target }?: { target: { files: object } },
29
+ ) => void;
25
30
  renderFile?: (...args: any[]) => void;
26
31
  }
27
32
 
28
- type inputProps = Omit<JSX.IntrinsicElements['input'], 'multiple'>;
33
+ type inputProps = Omit<JSX.IntrinsicElements['input'], 'multiple' | 'onChange'>;
29
34
 
30
35
  export interface FileInputExtendedProps extends FileInputProps, inputProps {}
31
36
 
@@ -29,7 +29,7 @@ var HelpAndError = function HelpAndError() {
29
29
  onChange: function onChange() {}
30
30
  }))), /*#__PURE__*/_react["default"].createElement(_grommet.Form, null, /*#__PURE__*/_react["default"].createElement(_grommet.FormField, {
31
31
  label: "Email",
32
- htmlFor: "text-input",
32
+ htmlFor: "email",
33
33
  help: /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
34
34
  weight: "lighter",
35
35
  size: "small"
@@ -41,17 +41,21 @@ export type GridColumnsType =
41
41
  count?: 'fit' | 'fill' | number;
42
42
  size?: GridSizeType;
43
43
  };
44
+
45
+ export type GridGapType = GapType | { row?: GapType; column?: GapType };
46
+
47
+ export type AreasType = { name?: string; start?: number[]; end?: number[] }[] | string[][];
44
48
  export interface GridProps {
45
49
  a11yTitle?: A11yTitleType;
46
50
  alignSelf?: AlignSelfType;
47
51
  align?: AlignType;
48
52
  alignContent?: AlignContentType;
49
- areas?: { name?: string; start?: number[]; end?: number[] }[] | string[][];
53
+ areas?: AreasType;
50
54
  as?: PolymorphicType;
51
55
  border?: BorderType;
52
56
  columns?: GridColumnsType;
53
57
  fill?: FillType;
54
- gap?: GapType | { row?: GapType; column?: GapType };
58
+ gap?: GridGapType;
55
59
  gridArea?: GridAreaType;
56
60
  height?: HeightType;
57
61
  justify?: 'start' | 'center' | 'end' | 'stretch';
@@ -79,7 +79,7 @@ var Layer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
79
79
 
80
80
  setTimeout(function () {
81
81
  // we add the id and query here so the unit tests work
82
- var clone = document.getElementById('layerClone');
82
+ var clone = containerTarget === document.body ? document.getElementById('layerClone') : containerTarget.getElementById('layerClone');
83
83
 
84
84
  if (clone) {
85
85
  containerTarget.removeChild(clone);
@@ -17,6 +17,8 @@ var _ResponsiveContext = require("../../contexts/ResponsiveContext");
17
17
 
18
18
  var _OptionsContext = require("../../contexts/OptionsContext");
19
19
 
20
+ var _ContainerTargetContext = require("../../contexts/ContainerTargetContext");
21
+
20
22
  var _utils = require("../../utils");
21
23
 
22
24
  var _StyledLayer = require("./StyledLayer");
@@ -57,6 +59,8 @@ var LayerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
57
59
  layerTarget = _ref.target,
58
60
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
59
61
 
62
+ var containerTarget = (0, _react.useContext)(_ContainerTargetContext.ContainerTargetContext);
63
+
60
64
  var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
61
65
 
62
66
  var size = (0, _react.useContext)(_ResponsiveContext.ResponsiveContext); // layerOptions was created to preserve backwards compatibility but
@@ -109,7 +113,7 @@ var LayerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
109
113
  var onClickDocument = function onClickDocument(event) {
110
114
  // determine which portal id the target is in, if any
111
115
  var clickedPortalId = null;
112
- var node = event.target;
116
+ var node = containerTarget === document.body ? event.target : event == null ? void 0 : event.path[0];
113
117
 
114
118
  while (clickedPortalId === null && node !== document && node !== null) {
115
119
  // check if user click occurred within the layer
@@ -176,7 +180,7 @@ var LayerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
176
180
  document.removeEventListener('mousedown', onClickDocument);
177
181
  }
178
182
  };
179
- }, [layerTarget, onClickOutside, portalContext, portalId]);
183
+ }, [containerTarget, layerTarget, onClickOutside, portalContext, portalId]);
180
184
 
181
185
  var content = /*#__PURE__*/_react["default"].createElement(_StyledLayer.StyledContainer, _extends({
182
186
  ref: ref || containerRef,
@@ -23,7 +23,7 @@ var _utils = require("../../utils");
23
23
 
24
24
  var _propTypes = require("./propTypes");
25
25
 
26
- var _excluded = ["a11yTitle", "aria-label", "action", "as", "background", "border", "children", "data", "defaultItemProps", "focus", "itemKey", "itemProps", "onOrder", "pad", "paginate", "primaryKey", "secondaryKey", "show", "step", "onClickItem", "onMore"];
26
+ var _excluded = ["a11yTitle", "aria-label", "action", "as", "background", "border", "children", "data", "defaultItemProps", "disabled", "focus", "itemKey", "itemProps", "onActive", "onClickItem", "onKeyDown", "onMore", "onOrder", "pad", "paginate", "primaryKey", "secondaryKey", "show", "step"];
27
27
 
28
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
29
 
@@ -55,14 +55,32 @@ var StyledList = _styledComponents["default"].ul.withConfig({
55
55
  var StyledItem = (0, _styledComponents["default"])(_Box.Box).withConfig({
56
56
  displayName: "List__StyledItem",
57
57
  componentId: "sc-130gdqg-1"
58
- })(["", " ", " &:focus{", "}", ""], function (props) {
59
- return props.onClick && "cursor: pointer;";
58
+ })(["", " ", " &:focus{", "}", " &:hover{", "}", ""], function (props) {
59
+ return props.onClick && !props.isDisabled && "cursor: pointer;";
60
60
  }, function (props) {
61
- return props.draggable && "cursor: move;";
61
+ return props.draggable && !props.isDisabled && "cursor: move;";
62
62
  }, (0, _utils.unfocusStyle)({
63
63
  forceOutline: true,
64
64
  skipSvgChildren: true
65
65
  }), function (props) {
66
+ var _props$theme$list, _props$theme$list$ite;
67
+
68
+ var disabledStyle;
69
+
70
+ if (props.isDisabled && (_props$theme$list = props.theme.list) != null && (_props$theme$list$ite = _props$theme$list.item) != null && _props$theme$list$ite.disabled) {
71
+ var _props$theme$list$ite2 = props.theme.list.item.disabled,
72
+ color = _props$theme$list$ite2.color,
73
+ cursor = _props$theme$list$ite2.cursor;
74
+ disabledStyle = {
75
+ color: (0, _utils.normalizeColor)(color, props.theme),
76
+ cursor: cursor
77
+ };
78
+ }
79
+
80
+ return disabledStyle;
81
+ }, function (props) {
82
+ return props.isDisabled && "background-color: unset;";
83
+ }, function (props) {
66
84
  return props.theme.list && props.theme.list.item && props.theme.list.item.extend;
67
85
  }); // when paginated, this wraps the data table and pagination component
68
86
 
@@ -136,9 +154,14 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
136
154
  children = _ref.children,
137
155
  data = _ref.data,
138
156
  defaultItemProps = _ref.defaultItemProps,
157
+ disabledItems = _ref.disabled,
139
158
  focus = _ref.focus,
140
159
  itemKey = _ref.itemKey,
141
160
  itemProps = _ref.itemProps,
161
+ onActive = _ref.onActive,
162
+ onClickItem = _ref.onClickItem,
163
+ onKeyDown = _ref.onKeyDown,
164
+ onMore = _ref.onMore,
142
165
  onOrder = _ref.onOrder,
143
166
  pad = _ref.pad,
144
167
  paginate = _ref.paginate,
@@ -147,8 +170,6 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
147
170
  showProp = _ref.show,
148
171
  _ref$step = _ref.step,
149
172
  step = _ref$step === void 0 ? paginate ? 50 : undefined : _ref$step,
150
- onClickItem = _ref.onClickItem,
151
- onMore = _ref.onMore,
152
173
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
153
174
 
154
175
  var listRef = (0, _utils.useForwardedRef)(ref);
@@ -169,6 +190,13 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
169
190
  lastActive = _useState2[0],
170
191
  setLastActive = _useState2[1];
171
192
 
193
+ var updateActive = function updateActive(nextActive) {
194
+ setActive(nextActive); // we occasionally call updateActive with undefined when it already is so,
195
+ // no need to call onActive in that case
196
+
197
+ if (onActive && onClickItem && nextActive !== active) onActive(nextActive);
198
+ };
199
+
172
200
  var _useState3 = (0, _react.useState)(),
173
201
  itemFocus = _useState3[0],
174
202
  setItemFocus = _useState3[1];
@@ -225,12 +253,14 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
225
253
 
226
254
  if (active % 2) {
227
255
  onOrder(reorder(data, index, index + 1));
228
- setActive(Math.min(active + 2, data.length * 2 - 2));
256
+ updateActive(Math.min(active + 2, data.length * 2 - 2));
229
257
  } else {
230
258
  onOrder(reorder(data, index, index - 1));
231
- setActive(Math.max(active - 2, 1));
259
+ updateActive(Math.max(active - 2, 1));
232
260
  }
233
- } else {
261
+ } else if (disabledItems != null && disabledItems.includes(typeof itemKey === 'function' ? itemKey(data[active]) : data[active])) {
262
+ event.preventDefault();
263
+ } else if (onClickItem) {
234
264
  event.persist();
235
265
  var adjustedEvent = event;
236
266
  adjustedEvent.item = data[active];
@@ -240,13 +270,14 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
240
270
  } : undefined,
241
271
  onUp: (onClickItem || onOrder) && active ? function () {
242
272
  var min = onOrder ? 1 : 0;
243
- setActive(Math.max(active - 1, min));
273
+ updateActive(Math.max(active - 1, min));
244
274
  } : undefined,
245
275
  onDown: (onClickItem || onOrder) && data && data.length ? function () {
246
276
  var min = onOrder ? 1 : 0;
247
277
  var max = onOrder ? data.length * 2 - 2 : data.length - 1;
248
- setActive(active >= min ? Math.min(active + 1, max) : min);
249
- } : undefined
278
+ updateActive(active >= min ? Math.min(active + 1, max) : min);
279
+ } : undefined,
280
+ onKeyDown: onKeyDown
250
281
  }, /*#__PURE__*/_react["default"].createElement(StyledList, _extends({
251
282
  "aria-label": ariaLabel || a11yTitle,
252
283
  ref: listRef,
@@ -258,12 +289,12 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
258
289
  // Checks for active variable to stop bug where activeStyle
259
290
  // gets applied to lastActive instead of the item the user
260
291
  // is currently clicking on
261
- !active && active !== 0 ? setActive(lastActive) : setActive(active)
292
+ !active && active !== 0 ? updateActive(lastActive) : updateActive(active)
262
293
  );
263
294
  },
264
295
  onBlur: function onBlur() {
265
296
  setLastActive(active);
266
- setActive(undefined);
297
+ updateActive(undefined);
267
298
  }
268
299
  }, ariaProps, rest), /*#__PURE__*/_react["default"].createElement(_InfiniteScroll.InfiniteScroll, {
269
300
  items: !paginate ? orderingData || data : items,
@@ -328,6 +359,16 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
328
359
  }
329
360
 
330
361
  var key = itemKey ? itemId : getKey(item, index, itemId);
362
+ var isDisabled;
363
+
364
+ if (disabledItems) {
365
+ if (typeof item === 'object' && !itemKey) {
366
+ console.error( // eslint-disable-next-line max-len
367
+ "Warning: Missing prop itemKey. Prop disabled requires itemKey to be specified when data is of type 'object'.");
368
+ }
369
+
370
+ isDisabled = disabledItems == null ? void 0 : disabledItems.includes(key);
371
+ }
331
372
 
332
373
  if (action) {
333
374
  content = [/*#__PURE__*/_react["default"].createElement(_Box.Box, {
@@ -364,28 +405,35 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
364
405
  tabIndex: -1,
365
406
  active: active === index,
366
407
  onClick: function onClick(event) {
367
- // extract from React's synthetic event pool
368
- event.persist();
369
- var adjustedEvent = event;
370
- adjustedEvent.item = item;
371
- adjustedEvent.index = index;
372
- onClickItem(adjustedEvent); // put focus on the List container to meet WCAG
373
- // accessibility guidelines that focus remains on `ul`
374
-
375
- listRef.current.focus();
408
+ // Only prevent event when disabled. We still want screen
409
+ // readers to be aware that an option exists, but is in a
410
+ // disabled state.
411
+ if (isDisabled) {
412
+ event.preventDefault();
413
+ } else {
414
+ // extract from React's synthetic event pool
415
+ event.persist();
416
+ var adjustedEvent = event;
417
+ adjustedEvent.item = item;
418
+ adjustedEvent.index = index;
419
+ onClickItem(adjustedEvent); // put focus on the List container to meet WCAG
420
+ // accessibility guidelines that focus remains on `ul`
421
+
422
+ listRef.current.focus();
423
+ }
376
424
  },
377
425
  onMouseOver: function onMouseOver() {
378
- return setActive(index);
426
+ return updateActive(index);
379
427
  },
380
428
  onMouseOut: function onMouseOut() {
381
- return setActive(undefined);
429
+ return updateActive(undefined);
382
430
  },
383
431
  onFocus: function onFocus() {
384
- setActive(index);
432
+ updateActive(index);
385
433
  setItemFocus(true);
386
434
  },
387
435
  onBlur: function onBlur() {
388
- setActive(undefined);
436
+ updateActive(undefined);
389
437
  setItemFocus(false);
390
438
  }
391
439
  };
@@ -404,7 +452,7 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
404
452
 
405
453
  event.dataTransfer.effectAllowed = 'move';
406
454
  setDragging(index);
407
- setActive(undefined);
455
+ updateActive(undefined);
408
456
  },
409
457
  onDragEnd: function onDragEnd() {
410
458
  setDragging(undefined);
@@ -449,17 +497,17 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
449
497
  },
450
498
  tabIndex: -1,
451
499
  onMouseOver: function onMouseOver() {
452
- return setActive(index * 2);
500
+ return updateActive(index * 2);
453
501
  },
454
502
  onMouseOut: function onMouseOut() {
455
- return setActive(undefined);
503
+ return updateActive(undefined);
456
504
  },
457
505
  onFocus: function onFocus() {
458
- setActive(index * 2);
506
+ updateActive(index * 2);
459
507
  setItemFocus(true);
460
508
  },
461
509
  onBlur: function onBlur() {
462
- setActive(undefined);
510
+ updateActive(undefined);
463
511
  setItemFocus(false);
464
512
  }
465
513
  }), /*#__PURE__*/_react["default"].createElement(_Button.Button, {
@@ -476,17 +524,17 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
476
524
  },
477
525
  tabIndex: -1,
478
526
  onMouseOver: function onMouseOver() {
479
- return setActive(index * 2 + 1);
527
+ return updateActive(index * 2 + 1);
480
528
  },
481
529
  onMouseOut: function onMouseOut() {
482
- return setActive(undefined);
530
+ return updateActive(undefined);
483
531
  },
484
532
  onFocus: function onFocus() {
485
- setActive(index * 2 + 1);
533
+ updateActive(index * 2 + 1);
486
534
  setItemFocus(true);
487
535
  },
488
536
  onBlur: function onBlur() {
489
- setActive(undefined);
537
+ updateActive(undefined);
490
538
  setItemFocus(false);
491
539
  }
492
540
  }));
@@ -500,6 +548,20 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
500
548
  }, content);
501
549
  }
502
550
 
551
+ var itemAriaProps;
552
+
553
+ if (isDisabled) {
554
+ itemAriaProps = {
555
+ 'aria-disabled': true
556
+ };
557
+
558
+ if (onClickItem) {
559
+ itemAriaProps = _extends({}, itemAriaProps, {
560
+ 'aria-selected': false
561
+ });
562
+ }
563
+ }
564
+
503
565
  if (itemProps && itemProps[index]) {
504
566
  boxProps = _extends({}, boxProps, itemProps[index]);
505
567
  }
@@ -507,11 +569,12 @@ var List = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
507
569
  return /*#__PURE__*/_react["default"].createElement(StyledItem, _extends({
508
570
  key: key,
509
571
  tag: "li",
510
- flex: false,
511
- pad: pad || theme.list.item.pad,
512
572
  background: adjustedBackground,
513
- border: adjustedBorder
514
- }, defaultItemProps, boxProps, clickProps, orderProps), onOrder && /*#__PURE__*/_react["default"].createElement(_Text.Text, null, index + 1), content, orderControls);
573
+ border: adjustedBorder,
574
+ isDisabled: isDisabled,
575
+ flex: false,
576
+ pad: pad || theme.list.item.pad
577
+ }, defaultItemProps, boxProps, clickProps, orderProps, itemAriaProps), onOrder && /*#__PURE__*/_react["default"].createElement(_Text.Text, null, index + 1), content, orderControls);
515
578
  }))), paginate && data.length > step && items && items.length ? /*#__PURE__*/_react["default"].createElement(_Pagination.Pagination, _extends({
516
579
  alignSelf: "end"
517
580
  }, paginationProps)) : null);
@@ -45,6 +45,7 @@ export interface ListProps<ListItemType> {
45
45
  border?: BorderType;
46
46
  children?: React.ReactNode;
47
47
  data?: ListItemType[];
48
+ disabled?: string[];
48
49
  gridArea?: GridAreaType;
49
50
  defaultItemProps?: BoxTypes;
50
51
  itemKey?: string | ((item: ListItemType) => string | number);
@@ -52,10 +53,11 @@ export interface ListProps<ListItemType> {
52
53
  [_: string]: { background?: string; border?: BorderType; pad?: PadType };
53
54
  };
54
55
  margin?: MarginType;
55
- onMore?: () => void;
56
+ onActive?: (index: number) => void;
56
57
  onClickItem?:
57
58
  | ((event: React.MouseEvent) => void)
58
59
  | ((event: { item?: ListItemType; index?: number }) => void);
60
+ onMore?: () => void;
59
61
  onOrder?: (orderedData: ListItemType[]) => void;
60
62
  pad?: PadType;
61
63
  paginate?: boolean | PaginationType;
@@ -38,10 +38,12 @@ if (process.env.NODE_ENV !== 'production') {
38
38
  data: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({})])),
39
39
  children: _propTypes["default"].func,
40
40
  defaultItemProps: _propTypes["default"].shape(_propTypes2.BoxPropTypes),
41
+ disabled: _propTypes["default"].arrayOf(_propTypes["default"].string),
41
42
  itemKey: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].func]),
42
43
  itemProps: _propTypes["default"].shape({}),
43
- onMore: _propTypes["default"].func,
44
+ onActive: _propTypes["default"].func,
44
45
  onClickItem: _propTypes["default"].func,
46
+ onMore: _propTypes["default"].func,
45
47
  onOrder: _propTypes["default"].func,
46
48
  pad: _propTypes["default"].oneOfType([_generalPropTypes.padPropType]),
47
49
  paginate: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].object]),
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports["default"] = exports.Disabled = void 0;
5
+
6
+ var _react = _interopRequireDefault(require("react"));
7
+
8
+ var _grommet = require("grommet");
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var locations = ['Boise', 'Fort Collins', 'Los Gatos', 'Palo Alto', 'San Francisco'];
13
+ var disabledLocations = ['Fort Collins', 'Palo Alto'];
14
+
15
+ var Disabled = function Disabled() {
16
+ return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
17
+ align: "center",
18
+ pad: "large"
19
+ }, /*#__PURE__*/_react["default"].createElement(_grommet.List, {
20
+ a11yTitle: "Locations",
21
+ data: locations,
22
+ disabled: disabledLocations,
23
+ onClickItem: function onClickItem(e) {
24
+ console.log(e);
25
+ }
26
+ }));
27
+ };
28
+
29
+ exports.Disabled = Disabled;
30
+ var _default = {
31
+ title: 'Visualizations/List/Disabled'
32
+ };
33
+ exports["default"] = _default;