react-magma-dom 4.9.0-next.4 → 4.9.0-next.5
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.
- package/dist/esm/index.js +132 -8281
- package/dist/esm/index.js.map +1 -1
- package/dist/react-magma-dom.cjs.development.js +76 -85
- package/dist/react-magma-dom.cjs.development.js.map +1 -1
- package/dist/react-magma-dom.cjs.production.min.js +1 -1
- package/dist/react-magma-dom.cjs.production.min.js.map +1 -1
- package/package.json +3 -3
|
@@ -21,6 +21,46 @@ var ReactDOM = _interopDefault(require('react-dom'));
|
|
|
21
21
|
var downshift = require('downshift');
|
|
22
22
|
var styled = _interopDefault(require('@emotion/styled'));
|
|
23
23
|
|
|
24
|
+
function _arrayLikeToArray(r, a) {
|
|
25
|
+
(null == a || a > r.length) && (a = r.length);
|
|
26
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
27
|
+
return n;
|
|
28
|
+
}
|
|
29
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
30
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
31
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
32
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
33
|
+
t && (r = t);
|
|
34
|
+
var o = 0;
|
|
35
|
+
return function () {
|
|
36
|
+
return o >= r.length ? {
|
|
37
|
+
done: !0
|
|
38
|
+
} : {
|
|
39
|
+
done: !1,
|
|
40
|
+
value: r[o++]
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
45
|
+
}
|
|
46
|
+
function _extends() {
|
|
47
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
48
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
49
|
+
var t = arguments[e];
|
|
50
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
51
|
+
}
|
|
52
|
+
return n;
|
|
53
|
+
}, _extends.apply(null, arguments);
|
|
54
|
+
}
|
|
55
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
56
|
+
if (null == r) return {};
|
|
57
|
+
var t = {};
|
|
58
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
59
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
60
|
+
t[n] = r[n];
|
|
61
|
+
}
|
|
62
|
+
return t;
|
|
63
|
+
}
|
|
24
64
|
function _toPrimitive(t, r) {
|
|
25
65
|
if ("object" != typeof t || !t) return t;
|
|
26
66
|
var e = t[Symbol.toPrimitive];
|
|
@@ -35,61 +75,12 @@ function _toPropertyKey(t) {
|
|
|
35
75
|
var i = _toPrimitive(t, "string");
|
|
36
76
|
return "symbol" == typeof i ? i : i + "";
|
|
37
77
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
44
|
-
target[key] = source[key];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return target;
|
|
49
|
-
};
|
|
50
|
-
return _extends.apply(this, arguments);
|
|
51
|
-
}
|
|
52
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
53
|
-
if (source == null) return {};
|
|
54
|
-
var target = {};
|
|
55
|
-
for (var key in source) {
|
|
56
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
57
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
58
|
-
target[key] = source[key];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return target;
|
|
62
|
-
}
|
|
63
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
64
|
-
if (!o) return;
|
|
65
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
66
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
67
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
68
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
69
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
70
|
-
}
|
|
71
|
-
function _arrayLikeToArray(arr, len) {
|
|
72
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
73
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
74
|
-
return arr2;
|
|
75
|
-
}
|
|
76
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
77
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
78
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
79
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
80
|
-
if (it) o = it;
|
|
81
|
-
var i = 0;
|
|
82
|
-
return function () {
|
|
83
|
-
if (i >= o.length) return {
|
|
84
|
-
done: true
|
|
85
|
-
};
|
|
86
|
-
return {
|
|
87
|
-
done: false,
|
|
88
|
-
value: o[i++]
|
|
89
|
-
};
|
|
90
|
-
};
|
|
78
|
+
function _unsupportedIterableToArray(r, a) {
|
|
79
|
+
if (r) {
|
|
80
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
81
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
82
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
91
83
|
}
|
|
92
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
93
84
|
}
|
|
94
85
|
|
|
95
86
|
var defaultI18n = {
|
|
@@ -1349,7 +1340,7 @@ function animate(property, element, to, options) {
|
|
|
1349
1340
|
var cancel = function cancel() {
|
|
1350
1341
|
cancelled = true;
|
|
1351
1342
|
};
|
|
1352
|
-
var
|
|
1343
|
+
var _step = function step(timestamp) {
|
|
1353
1344
|
if (cancelled) {
|
|
1354
1345
|
return;
|
|
1355
1346
|
}
|
|
@@ -1362,12 +1353,12 @@ function animate(property, element, to, options) {
|
|
|
1362
1353
|
requestAnimationFrame(function () {});
|
|
1363
1354
|
return;
|
|
1364
1355
|
}
|
|
1365
|
-
requestAnimationFrame(
|
|
1356
|
+
requestAnimationFrame(_step);
|
|
1366
1357
|
};
|
|
1367
1358
|
if (from === to) {
|
|
1368
1359
|
return cancel;
|
|
1369
1360
|
}
|
|
1370
|
-
requestAnimationFrame(
|
|
1361
|
+
requestAnimationFrame(_step);
|
|
1371
1362
|
return cancel;
|
|
1372
1363
|
}
|
|
1373
1364
|
function assignRef(ref, value) {
|
|
@@ -1439,7 +1430,7 @@ function resolveProps(defaultProps, props) {
|
|
|
1439
1430
|
* @param {object} defaultProps
|
|
1440
1431
|
* @returns string
|
|
1441
1432
|
*/
|
|
1442
|
-
var
|
|
1433
|
+
var _reactNodeToString = function reactNodeToString(node) {
|
|
1443
1434
|
if (!node) {
|
|
1444
1435
|
return '';
|
|
1445
1436
|
}
|
|
@@ -1451,11 +1442,11 @@ var reactNodeToString = function reactNodeToString(node) {
|
|
|
1451
1442
|
}
|
|
1452
1443
|
if (Array.isArray(node)) {
|
|
1453
1444
|
return node.map(function (subElement) {
|
|
1454
|
-
return
|
|
1445
|
+
return _reactNodeToString(subElement);
|
|
1455
1446
|
}).join('');
|
|
1456
1447
|
}
|
|
1457
1448
|
if (typeof node === 'object' && 'props' in node && node.props && node.props.children) {
|
|
1458
|
-
return
|
|
1449
|
+
return _reactNodeToString(node.props.children);
|
|
1459
1450
|
}
|
|
1460
1451
|
return '';
|
|
1461
1452
|
};
|
|
@@ -4439,7 +4430,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
4439
4430
|
return React.createElement(React.Fragment, null, React.createElement(StyledContainer, {
|
|
4440
4431
|
style: containerStyle
|
|
4441
4432
|
}, React.createElement(HiddenInput, Object.assign({}, other, {
|
|
4442
|
-
"aria-label":
|
|
4433
|
+
"aria-label": _reactNodeToString(labelText),
|
|
4443
4434
|
"aria-describedby": describedBy,
|
|
4444
4435
|
id: id,
|
|
4445
4436
|
"data-testid": testId,
|
|
@@ -15260,7 +15251,7 @@ var getIsDisabled = function getIsDisabled(_ref) {
|
|
|
15260
15251
|
A child is considered valid if it can be counted as an item that would make the parent expandable.
|
|
15261
15252
|
This is used to set `hasOwnTreeItems` which manages visibility of the expandable arrow.
|
|
15262
15253
|
*/
|
|
15263
|
-
var
|
|
15254
|
+
var _areChildrenValid = function areChildrenValid(children) {
|
|
15264
15255
|
if (!children) {
|
|
15265
15256
|
return false;
|
|
15266
15257
|
} else if (!children.length && children.type !== TreeItem) {
|
|
@@ -15278,7 +15269,7 @@ var areChildrenValid = function areChildrenValid(children) {
|
|
|
15278
15269
|
// Recursively check the validity of nested children
|
|
15279
15270
|
if (child.props.children) {
|
|
15280
15271
|
var nestedChildren = Array.isArray(child.props.children) ? child.props.children : [child.props.children];
|
|
15281
|
-
if (
|
|
15272
|
+
if (_areChildrenValid(nestedChildren)) {
|
|
15282
15273
|
hasValidChild = true;
|
|
15283
15274
|
return hasValidChild;
|
|
15284
15275
|
}
|
|
@@ -15286,7 +15277,7 @@ var areChildrenValid = function areChildrenValid(children) {
|
|
|
15286
15277
|
}
|
|
15287
15278
|
return hasValidChild;
|
|
15288
15279
|
};
|
|
15289
|
-
var
|
|
15280
|
+
var _getTreeViewData = function getTreeViewData(_ref2) {
|
|
15290
15281
|
var children = _ref2.children,
|
|
15291
15282
|
selectable = _ref2.selectable,
|
|
15292
15283
|
checkChildren = _ref2.checkChildren,
|
|
@@ -15312,9 +15303,9 @@ var getTreeViewData = function getTreeViewData(_ref2) {
|
|
|
15312
15303
|
itemId: props.itemId,
|
|
15313
15304
|
parentId: parentId,
|
|
15314
15305
|
icon: props.icon,
|
|
15315
|
-
hasOwnTreeItems:
|
|
15306
|
+
hasOwnTreeItems: _areChildrenValid(props.children),
|
|
15316
15307
|
isDisabled: isDisabled
|
|
15317
|
-
}].concat(props.children ?
|
|
15308
|
+
}].concat(props.children ? _getTreeViewData({
|
|
15318
15309
|
children: props.children,
|
|
15319
15310
|
parentId: props.itemId,
|
|
15320
15311
|
selectable: selectable,
|
|
@@ -15342,7 +15333,7 @@ var processItemCheckedStatus = function processItemCheckedStatus(_ref4) {
|
|
|
15342
15333
|
}) : item;
|
|
15343
15334
|
});
|
|
15344
15335
|
};
|
|
15345
|
-
var
|
|
15336
|
+
var _processChildrenSelection = function processChildrenSelection(_ref5) {
|
|
15346
15337
|
var items = _ref5.items,
|
|
15347
15338
|
itemId = _ref5.itemId,
|
|
15348
15339
|
checkedStatus = _ref5.checkedStatus,
|
|
@@ -15363,14 +15354,14 @@ var processChildrenSelection = function processChildrenSelection(_ref5) {
|
|
|
15363
15354
|
return (item == null ? void 0 : item.parentId) === itemId;
|
|
15364
15355
|
});
|
|
15365
15356
|
var itemsWithProcessedChildren = directChildren.reduce(function (result, directChild) {
|
|
15366
|
-
return
|
|
15357
|
+
return _processChildrenSelection({
|
|
15367
15358
|
items: result,
|
|
15368
15359
|
itemId: directChild.itemId,
|
|
15369
15360
|
checkedStatus: checkedStatus,
|
|
15370
15361
|
forceCheckedStatusForDisabled: forceCheckedStatusForDisabled
|
|
15371
15362
|
});
|
|
15372
15363
|
}, itemsWithProcessedItemCheckedStatus);
|
|
15373
|
-
var childrenIds =
|
|
15364
|
+
var childrenIds = _getChildrenIds({
|
|
15374
15365
|
items: itemsWithProcessedChildren,
|
|
15375
15366
|
itemId: itemId
|
|
15376
15367
|
});
|
|
@@ -15389,7 +15380,7 @@ var processChildrenSelection = function processChildrenSelection(_ref5) {
|
|
|
15389
15380
|
forceCheckedStatusForDisabled: forceCheckedStatusForDisabled
|
|
15390
15381
|
});
|
|
15391
15382
|
};
|
|
15392
|
-
var
|
|
15383
|
+
var _getChildrenIds = function getChildrenIds(_ref6) {
|
|
15393
15384
|
var items = _ref6.items,
|
|
15394
15385
|
itemId = _ref6.itemId;
|
|
15395
15386
|
return items.reduce(function (result, item) {
|
|
@@ -15397,7 +15388,7 @@ var getChildrenIds = function getChildrenIds(_ref6) {
|
|
|
15397
15388
|
return result;
|
|
15398
15389
|
}
|
|
15399
15390
|
if (item != null && item.hasOwnTreeItems) {
|
|
15400
|
-
return [].concat(result,
|
|
15391
|
+
return [].concat(result, _getChildrenIds({
|
|
15401
15392
|
items: items,
|
|
15402
15393
|
itemId: item.itemId
|
|
15403
15394
|
}));
|
|
@@ -15408,7 +15399,7 @@ var getChildrenIds = function getChildrenIds(_ref6) {
|
|
|
15408
15399
|
var getChildren = function getChildren(_ref7) {
|
|
15409
15400
|
var items = _ref7.items,
|
|
15410
15401
|
itemId = _ref7.itemId;
|
|
15411
|
-
var childrenIds =
|
|
15402
|
+
var childrenIds = _getChildrenIds({
|
|
15412
15403
|
items: items,
|
|
15413
15404
|
itemId: itemId
|
|
15414
15405
|
});
|
|
@@ -15419,7 +15410,7 @@ var getChildren = function getChildren(_ref7) {
|
|
|
15419
15410
|
var getChildrenUniqueStatuses = function getChildrenUniqueStatuses(_ref8) {
|
|
15420
15411
|
var items = _ref8.items,
|
|
15421
15412
|
itemId = _ref8.itemId;
|
|
15422
|
-
var childrenAndItemIds =
|
|
15413
|
+
var childrenAndItemIds = _getChildrenIds({
|
|
15423
15414
|
items: items,
|
|
15424
15415
|
itemId: itemId
|
|
15425
15416
|
});
|
|
@@ -15442,7 +15433,7 @@ var processInitialParentStatuses = function processInitialParentStatuses(_ref9)
|
|
|
15442
15433
|
if (!(item != null && item.hasOwnTreeItems) || (item == null ? void 0 : item.checkedStatus) !== exports.IndeterminateCheckboxStatus.checked) {
|
|
15443
15434
|
return result;
|
|
15444
15435
|
}
|
|
15445
|
-
return
|
|
15436
|
+
return _processChildrenSelection({
|
|
15446
15437
|
items: result,
|
|
15447
15438
|
itemId: item.itemId,
|
|
15448
15439
|
checkedStatus: exports.IndeterminateCheckboxStatus.checked,
|
|
@@ -15482,7 +15473,7 @@ var getInitialItems = function getInitialItems(_ref10) {
|
|
|
15482
15473
|
selectable = _ref10.selectable,
|
|
15483
15474
|
isTreeViewDisabled = _ref10.isDisabled,
|
|
15484
15475
|
isTopLevelSelectable = _ref10.isTopLevelSelectable;
|
|
15485
|
-
var treeViewData =
|
|
15476
|
+
var treeViewData = _getTreeViewData({
|
|
15486
15477
|
children: children,
|
|
15487
15478
|
checkChildren: checkChildren,
|
|
15488
15479
|
selectable: selectable,
|
|
@@ -15504,7 +15495,7 @@ var getInitialItems = function getInitialItems(_ref10) {
|
|
|
15504
15495
|
}) : treeViewDataItem;
|
|
15505
15496
|
}) : treeViewData;
|
|
15506
15497
|
var itemsWithProcessedChildrenSelection = checkChildren ? enhancedWithPreselectedItems.reduce(function (result, item) {
|
|
15507
|
-
return item.checkedStatus === exports.IndeterminateCheckboxStatus.checked ?
|
|
15498
|
+
return item.checkedStatus === exports.IndeterminateCheckboxStatus.checked ? _processChildrenSelection({
|
|
15508
15499
|
items: result,
|
|
15509
15500
|
itemId: item.itemId,
|
|
15510
15501
|
checkedStatus: item.checkedStatus
|
|
@@ -15533,7 +15524,7 @@ var selectSingle = function selectSingle(_ref12) {
|
|
|
15533
15524
|
});
|
|
15534
15525
|
});
|
|
15535
15526
|
};
|
|
15536
|
-
var
|
|
15527
|
+
var _processParentsSelection = function processParentsSelection(_ref13) {
|
|
15537
15528
|
var items = _ref13.items,
|
|
15538
15529
|
itemId = _ref13.itemId,
|
|
15539
15530
|
checkedStatus = _ref13.checkedStatus,
|
|
@@ -15563,7 +15554,7 @@ var processParentsSelection = function processParentsSelection(_ref13) {
|
|
|
15563
15554
|
checkedStatus: parentStatus
|
|
15564
15555
|
}) : item;
|
|
15565
15556
|
});
|
|
15566
|
-
return
|
|
15557
|
+
return _processParentsSelection({
|
|
15567
15558
|
items: nextItems,
|
|
15568
15559
|
itemId: parent.itemId,
|
|
15569
15560
|
checkedStatus: parentStatus,
|
|
@@ -15610,19 +15601,19 @@ var toggleMulti = function toggleMulti(_ref15) {
|
|
|
15610
15601
|
checkedStatus: checkedStatus
|
|
15611
15602
|
}) : item;
|
|
15612
15603
|
});
|
|
15613
|
-
var itemsWithProcessedChildrenSelection = checkChildren ?
|
|
15604
|
+
var itemsWithProcessedChildrenSelection = checkChildren ? _processChildrenSelection({
|
|
15614
15605
|
items: itemsWithProcessedItemSelection,
|
|
15615
15606
|
itemId: itemId,
|
|
15616
15607
|
checkedStatus: checkedStatus
|
|
15617
15608
|
}) : itemsWithProcessedItemSelection;
|
|
15618
|
-
return checkParents ?
|
|
15609
|
+
return checkParents ? _processParentsSelection({
|
|
15619
15610
|
items: itemsWithProcessedChildrenSelection,
|
|
15620
15611
|
itemId: itemId,
|
|
15621
15612
|
checkedStatus: checkedStatus,
|
|
15622
15613
|
isTopLevelSelectable: isTopLevelSelectable
|
|
15623
15614
|
}) : itemsWithProcessedChildrenSelection;
|
|
15624
15615
|
};
|
|
15625
|
-
var
|
|
15616
|
+
var _getParentIds = function getParentIds(_ref16) {
|
|
15626
15617
|
var items = _ref16.items,
|
|
15627
15618
|
itemId = _ref16.itemId,
|
|
15628
15619
|
_ref16$prevParentIds = _ref16.prevParentIds,
|
|
@@ -15634,7 +15625,7 @@ var getParentIds = function getParentIds(_ref16) {
|
|
|
15634
15625
|
return prevParentIds;
|
|
15635
15626
|
}
|
|
15636
15627
|
var parentId = item.parentId;
|
|
15637
|
-
return parentId ?
|
|
15628
|
+
return parentId ? _getParentIds({
|
|
15638
15629
|
itemId: parentId,
|
|
15639
15630
|
items: items,
|
|
15640
15631
|
prevParentIds: [].concat(prevParentIds, [parentId])
|
|
@@ -15707,7 +15698,7 @@ var getInitialExpandedIds = function getInitialExpandedIds(_ref20) {
|
|
|
15707
15698
|
return initialExpandedItems;
|
|
15708
15699
|
}
|
|
15709
15700
|
return initialExpandedItems.reduce(function (result, itemId) {
|
|
15710
|
-
return [].concat(result, [itemId],
|
|
15701
|
+
return [].concat(result, [itemId], _getParentIds({
|
|
15711
15702
|
itemId: itemId,
|
|
15712
15703
|
items: items
|
|
15713
15704
|
}));
|
|
@@ -16592,7 +16583,7 @@ function useTreeView(props) {
|
|
|
16592
16583
|
var handleExpandedChange = function handleExpandedChange(event, itemId) {
|
|
16593
16584
|
setExpandedSet(function (prevExpandedSet) {
|
|
16594
16585
|
var updatedExpandedSet = new Set(prevExpandedSet);
|
|
16595
|
-
var childItemIds =
|
|
16586
|
+
var childItemIds = _getChildrenIds({
|
|
16596
16587
|
items: items,
|
|
16597
16588
|
itemId: itemId
|
|
16598
16589
|
});
|
|
@@ -17040,7 +17031,7 @@ exports.calculateOffset = calculateOffset;
|
|
|
17040
17031
|
exports.checkedStatusToBoolean = checkedStatusToBoolean;
|
|
17041
17032
|
exports.defaultI18n = defaultI18n;
|
|
17042
17033
|
exports.filterNullEntries = filterNullEntries;
|
|
17043
|
-
exports.getChildrenIds =
|
|
17034
|
+
exports.getChildrenIds = _getChildrenIds;
|
|
17044
17035
|
exports.getChildrenItemIds = getChildrenItemIds;
|
|
17045
17036
|
exports.getChildrenItemIdsFlat = getChildrenItemIdsFlat;
|
|
17046
17037
|
exports.getDateFromString = getDateFromString;
|