@pingux/astro 2.130.4 → 2.131.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 (64) hide show
  1. package/lib/cjs/components/GridList/GridList.d.ts +3 -0
  2. package/lib/cjs/components/GridList/GridList.js +56 -0
  3. package/lib/cjs/components/GridList/GridList.mdx +68 -0
  4. package/lib/cjs/components/GridList/GridList.stories.d.ts +185 -0
  5. package/lib/cjs/components/GridList/GridList.stories.js +137 -0
  6. package/lib/cjs/components/GridList/GridList.styles.d.ts +18 -0
  7. package/lib/cjs/components/GridList/GridList.styles.js +27 -0
  8. package/lib/cjs/components/GridList/GridList.test.d.ts +1 -0
  9. package/lib/cjs/components/GridList/GridList.test.js +153 -0
  10. package/lib/cjs/components/GridList/GridListRow.d.ts +4 -0
  11. package/lib/cjs/components/GridList/GridListRow.js +88 -0
  12. package/lib/cjs/components/GridList/gridListAttributes.d.ts +170 -0
  13. package/lib/cjs/components/GridList/gridListAttributes.js +178 -0
  14. package/lib/cjs/components/GridList/index.d.ts +2 -0
  15. package/lib/cjs/components/GridList/index.js +21 -0
  16. package/lib/cjs/components/TreeView/InsertionIndicator.js +19 -14
  17. package/lib/cjs/components/TreeView/TreeView.styles.js +2 -1
  18. package/lib/cjs/components/TreeView/index.js +7 -0
  19. package/lib/cjs/hooks/index.d.ts +2 -0
  20. package/lib/cjs/hooks/index.js +14 -0
  21. package/lib/cjs/hooks/useGridList/index.d.ts +1 -0
  22. package/lib/cjs/hooks/useGridList/index.js +14 -0
  23. package/lib/cjs/hooks/useGridList/useGridList.d.ts +18 -0
  24. package/lib/cjs/hooks/useGridList/useGridList.js +175 -0
  25. package/lib/cjs/hooks/useGridListItem/index.d.ts +1 -0
  26. package/lib/cjs/hooks/useGridListItem/index.js +14 -0
  27. package/lib/cjs/hooks/useGridListItem/useGridListItem.d.ts +308 -0
  28. package/lib/cjs/hooks/useGridListItem/useGridListItem.js +67 -0
  29. package/lib/cjs/hooks/useReorderableCollection/index.d.ts +1 -0
  30. package/lib/cjs/hooks/useReorderableCollection/index.js +14 -0
  31. package/lib/cjs/hooks/useReorderableCollection/useReorderableCollection.d.ts +9 -0
  32. package/lib/cjs/hooks/useReorderableCollection/useReorderableCollection.js +99 -0
  33. package/lib/cjs/index.d.ts +1 -0
  34. package/lib/cjs/index.js +15 -0
  35. package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
  36. package/lib/cjs/styles/variants/variants.js +2 -0
  37. package/lib/cjs/types/dnd.d.ts +66 -0
  38. package/lib/cjs/types/dnd.js +6 -0
  39. package/lib/cjs/types/gridList.d.ts +59 -0
  40. package/lib/cjs/types/gridList.js +6 -0
  41. package/lib/components/GridList/GridList.js +44 -0
  42. package/lib/components/GridList/GridList.mdx +68 -0
  43. package/lib/components/GridList/GridList.stories.js +124 -0
  44. package/lib/components/GridList/GridList.styles.js +19 -0
  45. package/lib/components/GridList/GridList.test.js +149 -0
  46. package/lib/components/GridList/GridListRow.js +74 -0
  47. package/lib/components/GridList/gridListAttributes.js +170 -0
  48. package/lib/components/GridList/index.js +2 -0
  49. package/lib/components/TreeView/InsertionIndicator.js +19 -14
  50. package/lib/components/TreeView/TreeView.styles.js +2 -1
  51. package/lib/components/TreeView/index.js +1 -0
  52. package/lib/hooks/index.js +2 -0
  53. package/lib/hooks/useGridList/index.js +1 -0
  54. package/lib/hooks/useGridList/useGridList.js +166 -0
  55. package/lib/hooks/useGridListItem/index.js +1 -0
  56. package/lib/hooks/useGridListItem/useGridListItem.js +59 -0
  57. package/lib/hooks/useReorderableCollection/index.js +1 -0
  58. package/lib/hooks/useReorderableCollection/useReorderableCollection.js +91 -0
  59. package/lib/index.js +1 -0
  60. package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
  61. package/lib/styles/variants/variants.js +2 -0
  62. package/lib/types/dnd.js +1 -0
  63. package/lib/types/gridList.js +1 -0
  64. package/package.json +3 -2
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
+ var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
6
+ var _Object$create = require("@babel/runtime-corejs3/core-js-stable/object/create");
7
+ var _Object$getPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
8
+ var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
9
+ var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
10
+ var _Promise = require("@babel/runtime-corejs3/core-js-stable/promise");
11
+ var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
12
+ var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
13
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
14
+ var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
15
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
16
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
17
+ var _react = _interopRequireDefault(require("react"));
18
+ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
19
+ var _ = require("../..");
20
+ var _testWrapper = require("../../utils/testUtils/testWrapper");
21
+ var _GridList = _interopRequireDefault(require("./GridList"));
22
+ var _react2 = require("@emotion/react");
23
+ 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 _context3; _forEachInstanceProperty2(_context3 = ["next", "throw", "return"]).call(_context3, 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" }], _forEachInstanceProperty2(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 _context4; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context4 = this.tryEntries).call(_context4, 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; }
24
+ var items = [{
25
+ name: 'Item 1',
26
+ key: 'item1'
27
+ }, {
28
+ name: 'Item 2',
29
+ key: 'item2'
30
+ }, {
31
+ name: 'Item 3',
32
+ key: 'item3'
33
+ }];
34
+ var getDefaultComponent = function getDefaultComponent(props) {
35
+ return (0, _testWrapper.render)((0, _react2.jsx)(_GridList["default"], (0, _extends2["default"])({
36
+ items: items
37
+ }, props), function (item) {
38
+ return (0, _react2.jsx)(_.Item, {
39
+ key: item.key,
40
+ textValue: item.name
41
+ }, item.name);
42
+ }));
43
+ };
44
+ describe('GridList Component', function () {
45
+ test('renders GridList with items', function () {
46
+ getDefaultComponent({});
47
+ var list = _testWrapper.screen.getByRole('grid');
48
+ expect(list).toBeInTheDocument();
49
+ var listItems = _testWrapper.screen.getAllByRole('row');
50
+ expect(listItems).toHaveLength(items.length);
51
+ (0, _forEach["default"])(items).call(items, function (item) {
52
+ expect(_testWrapper.screen.getByText(item.name)).toBeInTheDocument();
53
+ });
54
+ });
55
+ test('renders GridListRow for each item', function () {
56
+ getDefaultComponent();
57
+ var rows = _testWrapper.screen.getAllByRole('row');
58
+ expect(rows).toHaveLength(items.length);
59
+ });
60
+ test('handles keyboard navigation', function () {
61
+ getDefaultComponent();
62
+ var rows = _testWrapper.screen.getAllByRole('row');
63
+ _userEvent["default"].tab();
64
+ expect(rows[0]).toHaveClass('is-focused');
65
+ _testWrapper.fireEvent.keyDown(rows[0], {
66
+ key: 'ArrowDown'
67
+ });
68
+ expect(rows[1]).toHaveClass('is-focused');
69
+ _testWrapper.fireEvent.keyDown(rows[1], {
70
+ key: 'ArrowUp'
71
+ });
72
+ expect(rows[0]).toHaveClass('is-focused');
73
+ });
74
+ test('handles drag and drop functionality', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
75
+ var onReorder, rows, list, buttons, insertionIndicator;
76
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
77
+ while (1) switch (_context.prev = _context.next) {
78
+ case 0:
79
+ onReorder = jest.fn();
80
+ getDefaultComponent({
81
+ isReorderable: true,
82
+ onReorder: onReorder
83
+ });
84
+ rows = _testWrapper.screen.getAllByRole('row');
85
+ list = _testWrapper.screen.getByRole('grid');
86
+ buttons = _testWrapper.screen.getAllByRole('button');
87
+ _userEvent["default"].tab();
88
+ _testWrapper.fireEvent.keyDown(rows[0], {
89
+ key: 'ArrowRight'
90
+ });
91
+ _testWrapper.fireEvent.keyUp(rows[0], {
92
+ key: 'ArrowRight'
93
+ });
94
+ _testWrapper.fireEvent.keyDown(buttons[0], {
95
+ key: 'Enter'
96
+ });
97
+ _testWrapper.fireEvent.keyUp(buttons[0], {
98
+ key: 'Enter'
99
+ });
100
+ _context.next = 12;
101
+ return _testWrapper.screen.findByTestId('insertion-indicator');
102
+ case 12:
103
+ insertionIndicator = _context.sent;
104
+ _userEvent["default"].type(list, '{arrowdown}');
105
+ _userEvent["default"].type(insertionIndicator, '{enter}');
106
+ expect(onReorder).toHaveBeenCalled();
107
+ case 16:
108
+ case "end":
109
+ return _context.stop();
110
+ }
111
+ }, _callee);
112
+ })));
113
+ test('able to drop at bottom', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
114
+ var onReorder, rows, list, buttons, insertionIndicator;
115
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
116
+ while (1) switch (_context2.prev = _context2.next) {
117
+ case 0:
118
+ onReorder = jest.fn();
119
+ getDefaultComponent({
120
+ isReorderable: true,
121
+ onReorder: onReorder
122
+ });
123
+ rows = _testWrapper.screen.getAllByRole('row');
124
+ list = _testWrapper.screen.getByRole('grid');
125
+ buttons = _testWrapper.screen.getAllByRole('button');
126
+ _userEvent["default"].tab();
127
+ _testWrapper.fireEvent.keyDown(rows[0], {
128
+ key: 'ArrowRight'
129
+ });
130
+ _testWrapper.fireEvent.keyUp(rows[0], {
131
+ key: 'ArrowRight'
132
+ });
133
+ _testWrapper.fireEvent.keyDown(buttons[0], {
134
+ key: 'Enter'
135
+ });
136
+ _testWrapper.fireEvent.keyUp(buttons[0], {
137
+ key: 'Enter'
138
+ });
139
+ _context2.next = 12;
140
+ return _testWrapper.screen.findByTestId('insertion-indicator');
141
+ case 12:
142
+ insertionIndicator = _context2.sent;
143
+ _userEvent["default"].type(list, '{arrowdown}');
144
+ _userEvent["default"].type(list, '{arrowdown}');
145
+ _userEvent["default"].type(insertionIndicator, '{enter}');
146
+ expect(onReorder).toHaveBeenCalled();
147
+ case 17:
148
+ case "end":
149
+ return _context2.stop();
150
+ }
151
+ }, _callee2);
152
+ })));
153
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { GridListRowProps } from '../../types/dnd';
3
+ declare const GridListRow: React.ForwardRefExoticComponent<GridListRowProps & React.RefAttributes<HTMLElement>>;
4
+ export default GridListRow;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
+ var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
5
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
7
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
8
+ _Object$defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ exports["default"] = void 0;
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
13
+ var _react = _interopRequireWildcard(require("react"));
14
+ var _DragVerticalIcon = _interopRequireDefault(require("@pingux/mdi-react/DragVerticalIcon"));
15
+ var _hooks = require("../../hooks");
16
+ var _useGridListItem2 = _interopRequireDefault(require("../../hooks/useGridListItem/useGridListItem"));
17
+ var _index = require("../../index");
18
+ var _TreeView = require("../TreeView");
19
+ var _react2 = require("@emotion/react");
20
+ 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); }
21
+ 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; }
22
+ var GridListRow = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
23
+ var colRef = _react["default"].useRef(null);
24
+ var rowRef = (0, _hooks.useLocalOrForwardRef)(ref);
25
+ var buttonRef = _react["default"].useRef(null);
26
+ var cellRef = _react["default"].useRef(null);
27
+ var dragState = props.dragState,
28
+ dropState = props.dropState,
29
+ isReorderable = props.isReorderable,
30
+ item = props.item,
31
+ state = props.state;
32
+ var _useGridListItem = (0, _useGridListItem2["default"])({
33
+ state: state,
34
+ item: item,
35
+ dragState: dragState,
36
+ dropState: dropState,
37
+ ref: rowRef,
38
+ cellRef: cellRef,
39
+ isReorderable: isReorderable
40
+ }),
41
+ rowProps = _useGridListItem.rowProps,
42
+ gridCellProps = _useGridListItem.gridCellProps,
43
+ buttonProps = _useGridListItem.buttonProps;
44
+ return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_TreeView.InsertionIndicator, {
45
+ key: "".concat(item.key, "-before"),
46
+ target: {
47
+ type: 'item',
48
+ key: item.key,
49
+ dropPosition: 'before'
50
+ },
51
+ dropState: dropState,
52
+ collectionRef: colRef
53
+ }), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, rowProps, {
54
+ variant: "gridList.rowContainer",
55
+ isRow: true,
56
+ ref: rowRef
57
+ }), isReorderable && (0, _react2.jsx)(_index.Box, {
58
+ isRow: true,
59
+ sx: {
60
+ alignItems: 'center',
61
+ mr: 'xs'
62
+ }
63
+ }, (0, _react2.jsx)(_index.IconButton, (0, _extends2["default"])({
64
+ ref: buttonRef
65
+ }, buttonProps, {
66
+ sx: {
67
+ pointerEvents: 'none'
68
+ }
69
+ }), (0, _react2.jsx)(_index.Icon, {
70
+ icon: _DragVerticalIcon["default"]
71
+ }))), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, gridCellProps, {
72
+ isRow: true,
73
+ sx: {
74
+ alignItems: 'center'
75
+ }
76
+ }), item.rendered)), state.collection.getKeyAfter(item.key) == null && (0, _react2.jsx)(_TreeView.InsertionIndicator, {
77
+ key: "".concat(item.key, "-after"),
78
+ target: {
79
+ type: 'item',
80
+ key: item.key,
81
+ dropPosition: 'after'
82
+ },
83
+ dropState: dropState,
84
+ collectionRef: colRef
85
+ }));
86
+ });
87
+ var _default = GridListRow;
88
+ exports["default"] = _default;
@@ -0,0 +1,170 @@
1
+ export declare const gridListArgTypes: {
2
+ isReorderable: {
3
+ description: string;
4
+ control: {
5
+ type: string;
6
+ };
7
+ };
8
+ selectedKeys: {
9
+ description: string;
10
+ control: {
11
+ disable: boolean;
12
+ };
13
+ };
14
+ disabledKeys: {
15
+ description: string;
16
+ control: {
17
+ type: string;
18
+ };
19
+ };
20
+ defaultSelectedKeys: {
21
+ description: string;
22
+ control: {
23
+ disable: boolean;
24
+ };
25
+ };
26
+ onSelectionChange: {
27
+ description: string;
28
+ control: {
29
+ disable: boolean;
30
+ };
31
+ };
32
+ allowDuplicateSelectionEvents: {
33
+ description: string;
34
+ control: {
35
+ type: string;
36
+ };
37
+ };
38
+ autoFocus: {
39
+ description: string;
40
+ control: {
41
+ type: string;
42
+ };
43
+ };
44
+ children: {
45
+ description: string;
46
+ control: {
47
+ disable: boolean;
48
+ };
49
+ };
50
+ collection: {
51
+ description: string;
52
+ control: {
53
+ disable: boolean;
54
+ };
55
+ };
56
+ disabledBehavior: {
57
+ description: string;
58
+ control: {
59
+ type: string;
60
+ options: string[];
61
+ };
62
+ };
63
+ disallowEmptySelection: {
64
+ description: string;
65
+ control: {
66
+ type: string;
67
+ };
68
+ };
69
+ disallowTypeAhead: {
70
+ description: string;
71
+ control: {
72
+ type: string;
73
+ };
74
+ };
75
+ escapeKeyBehavior: {
76
+ description: string;
77
+ control: {
78
+ type: string;
79
+ options: string[];
80
+ };
81
+ };
82
+ filter: {
83
+ description: string;
84
+ control: {
85
+ disable: boolean;
86
+ };
87
+ };
88
+ getKey: {
89
+ description: string;
90
+ control: {
91
+ disable: boolean;
92
+ };
93
+ };
94
+ initialFilterText: {
95
+ description: string;
96
+ control: {
97
+ type: string;
98
+ };
99
+ };
100
+ initialSelectedKeys: {
101
+ description: string;
102
+ control: {
103
+ disable: boolean;
104
+ };
105
+ };
106
+ items: {
107
+ description: string;
108
+ control: {
109
+ disable: boolean;
110
+ };
111
+ };
112
+ keyboardDelegate: {
113
+ description: string;
114
+ control: {
115
+ disable: boolean;
116
+ };
117
+ };
118
+ keyboardNavigationBehavior: {
119
+ description: string;
120
+ control: {
121
+ type: string;
122
+ options: string[];
123
+ };
124
+ };
125
+ linkBehavior: {
126
+ description: string;
127
+ control: {
128
+ type: string;
129
+ options: string[];
130
+ };
131
+ };
132
+ onAction: {
133
+ description: string;
134
+ control: {
135
+ disable: boolean;
136
+ };
137
+ };
138
+ ref: {
139
+ description: string;
140
+ control: {
141
+ disable: boolean;
142
+ };
143
+ };
144
+ selectionBehavior: {
145
+ description: string;
146
+ control: {
147
+ type: string;
148
+ options: string[];
149
+ };
150
+ };
151
+ selectionMode: {
152
+ description: string;
153
+ control: {
154
+ type: string;
155
+ options: string[];
156
+ };
157
+ };
158
+ shouldFocusWrap: {
159
+ description: string;
160
+ control: {
161
+ type: string;
162
+ };
163
+ };
164
+ shouldSelectOnPressUp: {
165
+ description: string;
166
+ control: {
167
+ type: string;
168
+ };
169
+ };
170
+ };
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.gridListArgTypes = void 0;
8
+ var gridListArgTypes = {
9
+ isReorderable: {
10
+ description: 'Whether or not the list has drag and drop reorder enabled.',
11
+ control: {
12
+ type: 'boolean'
13
+ }
14
+ },
15
+ selectedKeys: {
16
+ description: 'The array of keys that is currently selected. (Controlled version).',
17
+ control: {
18
+ disable: true
19
+ }
20
+ },
21
+ disabledKeys: {
22
+ description: 'The array of keys that are unable to be selected.',
23
+ control: {
24
+ type: 'text'
25
+ }
26
+ },
27
+ defaultSelectedKeys: {
28
+ description: 'The array of keys that is selected by default. (Uncontrolled version).',
29
+ control: {
30
+ disable: true
31
+ }
32
+ },
33
+ onSelectionChange: {
34
+ description: 'A callback function that fires when the selection changes.',
35
+ control: {
36
+ disable: true
37
+ }
38
+ },
39
+ allowDuplicateSelectionEvents: {
40
+ description: 'Whether duplicate selection events are allowed.',
41
+ control: {
42
+ type: 'boolean'
43
+ }
44
+ },
45
+ autoFocus: {
46
+ description: 'Whether the grid should automatically focus on mount.',
47
+ control: {
48
+ type: 'boolean'
49
+ }
50
+ },
51
+ children: {
52
+ description: 'The child nodes to render inside the grid.',
53
+ control: {
54
+ disable: true
55
+ }
56
+ },
57
+ collection: {
58
+ description: 'The collection of items to display in the grid.',
59
+ control: {
60
+ disable: true
61
+ }
62
+ },
63
+ disabledBehavior: {
64
+ description: 'Defines how disabled items are handled.',
65
+ control: {
66
+ type: 'select',
67
+ options: ['all', 'selection']
68
+ }
69
+ },
70
+ disallowEmptySelection: {
71
+ description: 'Whether empty selection is disallowed.',
72
+ control: {
73
+ type: 'boolean'
74
+ }
75
+ },
76
+ disallowTypeAhead: {
77
+ description: 'Whether type-ahead functionality is disabled.',
78
+ control: {
79
+ type: 'boolean'
80
+ }
81
+ },
82
+ escapeKeyBehavior: {
83
+ description: 'Defines the behavior when the Escape key is pressed.',
84
+ control: {
85
+ type: 'select',
86
+ options: ['clearSelection', 'none']
87
+ }
88
+ },
89
+ filter: {
90
+ description: 'A function to filter items based on the input text.',
91
+ control: {
92
+ disable: true
93
+ }
94
+ },
95
+ getKey: {
96
+ description: 'A function to get the key for an item.',
97
+ control: {
98
+ disable: true
99
+ }
100
+ },
101
+ initialFilterText: {
102
+ description: 'The initial filter text for the grid.',
103
+ control: {
104
+ type: 'text'
105
+ }
106
+ },
107
+ initialSelectedKeys: {
108
+ description: 'The keys that are initially selected.',
109
+ control: {
110
+ disable: true
111
+ }
112
+ },
113
+ items: {
114
+ description: 'The list of items to display in the grid.',
115
+ control: {
116
+ disable: true
117
+ }
118
+ },
119
+ keyboardDelegate: {
120
+ description: 'A custom keyboard delegate for handling keyboard navigation.',
121
+ control: {
122
+ disable: true
123
+ }
124
+ },
125
+ keyboardNavigationBehavior: {
126
+ description: 'Defines the keyboard navigation behavior for the grid.',
127
+ control: {
128
+ type: 'select',
129
+ options: ['arrow', 'tab']
130
+ }
131
+ },
132
+ linkBehavior: {
133
+ description: 'Defines the behavior of links in the grid.',
134
+ control: {
135
+ type: 'select',
136
+ options: ['action', 'selection', 'override']
137
+ }
138
+ },
139
+ onAction: {
140
+ description: 'A callback function that fires when an action is performed on an item.',
141
+ control: {
142
+ disable: true
143
+ }
144
+ },
145
+ ref: {
146
+ description: 'A ref object for the grid.',
147
+ control: {
148
+ disable: true
149
+ }
150
+ },
151
+ selectionBehavior: {
152
+ description: 'Defines the selection behavior for the grid.',
153
+ control: {
154
+ type: 'select',
155
+ options: ['toggle', 'replace']
156
+ }
157
+ },
158
+ selectionMode: {
159
+ description: 'Defines the selection mode for the grid.',
160
+ control: {
161
+ type: 'select',
162
+ options: ['none', 'single', 'multiple']
163
+ }
164
+ },
165
+ shouldFocusWrap: {
166
+ description: 'Whether focus should wrap around when navigating with the keyboard.',
167
+ control: {
168
+ type: 'boolean'
169
+ }
170
+ },
171
+ shouldSelectOnPressUp: {
172
+ description: 'Whether selection should occur on key press up.',
173
+ control: {
174
+ type: 'boolean'
175
+ }
176
+ }
177
+ };
178
+ exports.gridListArgTypes = gridListArgTypes;
@@ -0,0 +1,2 @@
1
+ export { default } from './GridList';
2
+ export { default as GridListRow } from './GridListRow';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ _Object$defineProperty(exports, "GridListRow", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _GridListRow["default"];
12
+ }
13
+ });
14
+ _Object$defineProperty(exports, "default", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _GridList["default"];
18
+ }
19
+ });
20
+ var _GridList = _interopRequireDefault(require("./GridList"));
21
+ var _GridListRow = _interopRequireDefault(require("./GridListRow"));