@elliemae/ds-shared 2.2.0-next.4 → 2.3.0-alpha.2
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/cjs/Animations/BaseAnimation.js +55 -35
- package/cjs/Animations/BaseAnimation.js.map +7 -0
- package/cjs/Animations/Grow.js +54 -41
- package/cjs/Animations/Grow.js.map +7 -0
- package/cjs/Animations/GrowRight.js +63 -41
- package/cjs/Animations/GrowRight.js.map +7 -0
- package/cjs/Animations/GrowVertical.js +47 -7
- package/cjs/Animations/GrowVertical.js.map +7 -0
- package/cjs/CheckableGroup.js +67 -65
- package/cjs/CheckableGroup.js.map +7 -0
- package/cjs/DeferRenderAfterComputation.js +48 -24
- package/cjs/DeferRenderAfterComputation.js.map +7 -0
- package/cjs/FocusGroup/FocusGrid.js +108 -143
- package/cjs/FocusGroup/FocusGrid.js.map +7 -0
- package/cjs/FocusGroup/FocusGroup.js +88 -147
- package/cjs/FocusGroup/FocusGroup.js.map +7 -0
- package/cjs/FocusGroup/FocusGroupContext.js +38 -11
- package/cjs/FocusGroup/FocusGroupContext.js.map +7 -0
- package/cjs/FocusGroup/FocusGroupManager.js +56 -47
- package/cjs/FocusGroup/FocusGroupManager.js.map +7 -0
- package/cjs/FocusGroup/focusGroupManagerHoc.js +52 -42
- package/cjs/FocusGroup/focusGroupManagerHoc.js.map +7 -0
- package/cjs/FocusGroup/index.js +47 -21
- package/cjs/FocusGroup/index.js.map +7 -0
- package/cjs/FocusGroup/useFocusGroupItem.js +59 -51
- package/cjs/FocusGroup/useFocusGroupItem.js.map +7 -0
- package/cjs/FocusGroup/utils/getNextCellPosition.js +47 -27
- package/cjs/FocusGroup/utils/getNextCellPosition.js.map +7 -0
- package/cjs/GroupContext/Group.js +64 -73
- package/cjs/GroupContext/Group.js.map +7 -0
- package/cjs/GroupContext/GroupContext.js +36 -13
- package/cjs/GroupContext/GroupContext.js.map +7 -0
- package/cjs/GroupContext/GroupItem.js +39 -21
- package/cjs/GroupContext/GroupItem.js.map +7 -0
- package/cjs/GroupContext/index.js +39 -13
- package/cjs/GroupContext/index.js.map +7 -0
- package/cjs/ScrollSync/ScrollSync.js +60 -75
- package/cjs/ScrollSync/ScrollSync.js.map +7 -0
- package/cjs/ScrollSync/ScrollSyncPane.js +52 -60
- package/cjs/ScrollSync/ScrollSyncPane.js.map +7 -0
- package/cjs/ScrollSync/ScrollSyncProvider.js +103 -50
- package/cjs/ScrollSync/ScrollSyncProvider.js.map +7 -0
- package/cjs/ScrollSync/index.js +37 -11
- package/cjs/ScrollSync/index.js.map +7 -0
- package/cjs/ScrollSync/useScrollSync.js +38 -7
- package/cjs/ScrollSync/useScrollSync.js.map +7 -0
- package/cjs/constants.js +65 -46
- package/cjs/constants.js.map +7 -0
- package/cjs/createDataInstance/createInstancePlugin.js +41 -29
- package/cjs/createDataInstance/createInstancePlugin.js.map +7 -0
- package/cjs/createDataInstance/createInstanceRef.js +66 -71
- package/cjs/createDataInstance/createInstanceRef.js.map +7 -0
- package/cjs/createDataInstance/utils.js +76 -100
- package/cjs/createDataInstance/utils.js.map +7 -0
- package/cjs/defer-render-hoc/index.js +48 -41
- package/cjs/defer-render-hoc/index.js.map +7 -0
- package/cjs/dimsum.config.js +38 -6
- package/cjs/dimsum.config.js.map +7 -0
- package/cjs/index.js +40 -17
- package/cjs/index.js.map +7 -0
- package/cjs/prop-types.js +106 -49
- package/cjs/prop-types.js.map +7 -0
- package/cjs/react-spring/index.js +28 -14
- package/cjs/react-spring/index.js.map +7 -0
- package/cjs/react-spring/renderprops.js +28 -14
- package/cjs/react-spring/renderprops.js.map +7 -0
- package/cjs/toolbar/ToolbarProvider.js +82 -94
- package/cjs/toolbar/ToolbarProvider.js.map +7 -0
- package/cjs/useDataGrid/VolatileRowsListener.js +38 -13
- package/cjs/useDataGrid/VolatileRowsListener.js.map +7 -0
- package/cjs/useDataGrid/index.js +36 -7
- package/cjs/useDataGrid/index.js.map +7 -0
- package/cjs/useDataGrid/initColumnDefinition.js +105 -110
- package/cjs/useDataGrid/initColumnDefinition.js.map +7 -0
- package/cjs/useDataGrid/useDataGrid.js +122 -148
- package/cjs/useDataGrid/useDataGrid.js.map +7 -0
- package/cjs/useDataList/index.js +36 -7
- package/cjs/useDataList/index.js.map +7 -0
- package/cjs/useDataList/recordIterator.js +42 -18
- package/cjs/useDataList/recordIterator.js.map +7 -0
- package/cjs/useDataList/useDataList.js +74 -83
- package/cjs/useDataList/useDataList.js.map +7 -0
- package/cjs/utils.js +71 -80
- package/cjs/utils.js.map +7 -0
- package/cjs/virtualization/AutoHeightList.js +62 -54
- package/cjs/virtualization/AutoHeightList.js.map +7 -0
- package/cjs/virtualization/FluidHeightList.js +42 -48
- package/cjs/virtualization/FluidHeightList.js.map +7 -0
- package/cjs/virtualization/index.js +48 -20
- package/cjs/virtualization/index.js.map +7 -0
- package/esm/Animations/BaseAnimation.js +26 -29
- package/esm/Animations/BaseAnimation.js.map +7 -0
- package/esm/Animations/Grow.js +25 -35
- package/esm/Animations/Grow.js.map +7 -0
- package/esm/Animations/GrowRight.js +34 -35
- package/esm/Animations/GrowRight.js.map +7 -0
- package/esm/Animations/GrowVertical.js +29 -4
- package/esm/Animations/GrowVertical.js.map +7 -0
- package/esm/CheckableGroup.js +35 -52
- package/esm/CheckableGroup.js.map +7 -0
- package/esm/DeferRenderAfterComputation.js +16 -15
- package/esm/DeferRenderAfterComputation.js.map +7 -0
- package/esm/FocusGroup/FocusGrid.js +64 -117
- package/esm/FocusGroup/FocusGrid.js.map +7 -0
- package/esm/FocusGroup/FocusGroup.js +56 -137
- package/esm/FocusGroup/FocusGroup.js.map +7 -0
- package/esm/FocusGroup/FocusGroupContext.js +9 -5
- package/esm/FocusGroup/FocusGroupContext.js.map +7 -0
- package/esm/FocusGroup/FocusGroupManager.js +24 -38
- package/esm/FocusGroup/FocusGroupManager.js.map +7 -0
- package/esm/FocusGroup/focusGroupManagerHoc.js +24 -36
- package/esm/FocusGroup/focusGroupManagerHoc.js.map +7 -0
- package/esm/FocusGroup/index.js +18 -6
- package/esm/FocusGroup/index.js.map +7 -0
- package/esm/FocusGroup/useFocusGroupItem.js +28 -40
- package/esm/FocusGroup/useFocusGroupItem.js.map +7 -0
- package/esm/FocusGroup/utils/getNextCellPosition.js +18 -25
- package/esm/FocusGroup/utils/getNextCellPosition.js.map +7 -0
- package/esm/GroupContext/Group.js +34 -66
- package/esm/GroupContext/Group.js.map +7 -0
- package/esm/GroupContext/GroupContext.js +7 -5
- package/esm/GroupContext/GroupContext.js.map +7 -0
- package/esm/GroupContext/GroupItem.js +10 -15
- package/esm/GroupContext/GroupItem.js.map +7 -0
- package/esm/GroupContext/index.js +10 -3
- package/esm/GroupContext/index.js.map +7 -0
- package/esm/ScrollSync/ScrollSync.js +30 -64
- package/esm/ScrollSync/ScrollSync.js.map +7 -0
- package/esm/ScrollSync/ScrollSyncPane.js +22 -52
- package/esm/ScrollSync/ScrollSyncPane.js.map +7 -0
- package/esm/ScrollSync/ScrollSyncProvider.js +74 -42
- package/esm/ScrollSync/ScrollSyncProvider.js.map +7 -0
- package/esm/ScrollSync/index.js +8 -2
- package/esm/ScrollSync/index.js.map +7 -0
- package/esm/ScrollSync/useScrollSync.js +9 -5
- package/esm/ScrollSync/useScrollSync.js.map +7 -0
- package/esm/constants.js +37 -28
- package/esm/constants.js.map +7 -0
- package/esm/createDataInstance/createInstancePlugin.js +12 -23
- package/esm/createDataInstance/createInstancePlugin.js.map +7 -0
- package/esm/createDataInstance/createInstanceRef.js +36 -59
- package/esm/createDataInstance/createInstanceRef.js.map +7 -0
- package/esm/createDataInstance/utils.js +48 -85
- package/esm/createDataInstance/utils.js.map +7 -0
- package/esm/defer-render-hoc/index.js +17 -31
- package/esm/defer-render-hoc/index.js.map +7 -0
- package/esm/dimsum.config.js +9 -4
- package/esm/dimsum.config.js.map +7 -0
- package/esm/index.js +11 -5
- package/esm/index.js.map +7 -0
- package/esm/prop-types.js +75 -31
- package/esm/prop-types.js.map +7 -0
- package/esm/react-spring/index.js +3 -1
- package/esm/react-spring/index.js.map +7 -0
- package/esm/react-spring/renderprops.js +3 -1
- package/esm/react-spring/renderprops.js.map +7 -0
- package/esm/toolbar/ToolbarProvider.js +45 -74
- package/esm/toolbar/ToolbarProvider.js.map +7 -0
- package/esm/useDataGrid/VolatileRowsListener.js +9 -11
- package/esm/useDataGrid/VolatileRowsListener.js.map +7 -0
- package/esm/useDataGrid/index.js +7 -1
- package/esm/useDataGrid/index.js.map +7 -0
- package/esm/useDataGrid/initColumnDefinition.js +78 -94
- package/esm/useDataGrid/initColumnDefinition.js.map +7 -0
- package/esm/useDataGrid/useDataGrid.js +82 -99
- package/esm/useDataGrid/useDataGrid.js.map +7 -0
- package/esm/useDataList/index.js +7 -1
- package/esm/useDataList/index.js.map +7 -0
- package/esm/useDataList/recordIterator.js +13 -14
- package/esm/useDataList/recordIterator.js.map +7 -0
- package/esm/useDataList/useDataList.js +44 -67
- package/esm/useDataList/useDataList.js.map +7 -0
- package/esm/utils.js +42 -59
- package/esm/utils.js.map +7 -0
- package/esm/virtualization/AutoHeightList.js +28 -40
- package/esm/virtualization/AutoHeightList.js.map +7 -0
- package/esm/virtualization/FluidHeightList.js +14 -38
- package/esm/virtualization/FluidHeightList.js.map +7 -0
- package/esm/virtualization/index.js +19 -16
- package/esm/virtualization/index.js.map +7 -0
- package/package.json +3 -3
- package/types/Animations/BaseAnimation.d.ts +1 -0
- package/types/Animations/Grow.d.ts +1 -0
- package/types/Animations/GrowRight.d.ts +1 -0
- package/types/CheckableGroup.d.ts +1 -0
- package/types/DeferRenderAfterComputation.d.ts +3 -2
- package/types/FocusGroup/FocusGrid.d.ts +5 -3
- package/types/FocusGroup/FocusGroup.d.ts +3 -1
- package/types/FocusGroup/FocusGroupContext.d.ts +3 -2
- package/types/FocusGroup/FocusGroupManager.d.ts +3 -1
- package/types/FocusGroup/focusGroupManagerHoc.d.ts +3 -1
- package/types/FocusGroup/index.d.ts +6 -6
- package/types/FocusGroup/useFocusGroupItem.d.ts +3 -1
- package/types/FocusGroup/utils/getNextCellPosition.d.ts +3 -1
- package/types/GroupContext/Group.d.ts +1 -0
- package/types/GroupContext/GroupItem.d.ts +1 -0
- package/types/GroupContext/index.d.ts +3 -3
- package/types/ScrollSync/ScrollSync.d.ts +4 -2
- package/types/ScrollSync/ScrollSyncPane.d.ts +2 -2
- package/types/ScrollSync/index.d.ts +2 -2
- package/types/ScrollSync/useScrollSync.d.ts +6 -5
- package/types/createDataInstance/createInstancePlugin.d.ts +2 -1
- package/types/createDataInstance/createInstanceRef.d.ts +3 -1
- package/types/dimsum.config.d.ts +3 -2
- package/types/index.d.ts +2 -2
- package/types/toolbar/ToolbarProvider.d.ts +3 -8
- package/types/useDataGrid/VolatileRowsListener.d.ts +3 -1
- package/types/useDataGrid/index.d.ts +1 -1
- package/types/useDataGrid/initColumnDefinition.d.ts +2 -1
- package/types/useDataGrid/useDataGrid.d.ts +3 -2
- package/types/useDataList/index.d.ts +1 -1
- package/types/useDataList/useDataList.d.ts +3 -2
|
@@ -1,44 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return _ref => {
|
|
27
|
-
let {
|
|
28
|
-
onExitFocusGroup,
|
|
29
|
-
onFocusPrevGroup,
|
|
30
|
-
focusKeyBindings
|
|
31
|
-
} = _ref,
|
|
32
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
33
|
-
|
|
34
|
-
return /*#__PURE__*/jsxRuntime.jsx(FocusGroupManager, _objectSpread(_objectSpread({
|
|
35
|
-
keyBindings: focusKeyBindings,
|
|
36
|
-
onExitFocusGroup: onExitFocusGroup,
|
|
37
|
-
onFocusPrevGroup: onFocusPrevGroup
|
|
38
|
-
}, options), {}, {
|
|
39
|
-
children: /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, _objectSpread(_objectSpread({}, props), options))
|
|
40
|
-
}));
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
41
26
|
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var focusGroupManagerHoc_exports = {};
|
|
29
|
+
__export(focusGroupManagerHoc_exports, {
|
|
30
|
+
FocusGroupHoc: () => FocusGroupHoc,
|
|
31
|
+
default: () => focusGroupManagerHoc_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_FocusGroupManager = require("./FocusGroupManager");
|
|
36
|
+
function FocusGroupHoc(WrappedComponent, options = {}) {
|
|
37
|
+
return ({
|
|
38
|
+
onExitFocusGroup,
|
|
39
|
+
onFocusPrevGroup,
|
|
40
|
+
focusKeyBindings,
|
|
41
|
+
...props
|
|
42
|
+
}) => /* @__PURE__ */ import_react.default.createElement(import_FocusGroupManager.FocusGroupProvider, {
|
|
43
|
+
keyBindings: focusKeyBindings,
|
|
44
|
+
onExitFocusGroup,
|
|
45
|
+
onFocusPrevGroup,
|
|
46
|
+
...options
|
|
47
|
+
}, /* @__PURE__ */ import_react.default.createElement(WrappedComponent, {
|
|
48
|
+
...props,
|
|
49
|
+
...options
|
|
50
|
+
}));
|
|
42
51
|
}
|
|
43
|
-
|
|
44
|
-
module.exports =
|
|
52
|
+
var focusGroupManagerHoc_default = FocusGroupHoc;
|
|
53
|
+
module.exports = __toCommonJS(focusGroupManagerHoc_exports);
|
|
54
|
+
//# sourceMappingURL=focusGroupManagerHoc.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/FocusGroup/focusGroupManagerHoc.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/display-name */\nimport React from 'react';\nimport { FocusGroupProvider } from './FocusGroupManager';\n\nfunction FocusGroupHoc(WrappedComponent, options = {}) {\n return ({\n onExitFocusGroup,\n onFocusPrevGroup,\n focusKeyBindings,\n ...props\n }) => (\n <FocusGroupProvider\n keyBindings={focusKeyBindings}\n onExitFocusGroup={onExitFocusGroup}\n onFocusPrevGroup={onFocusPrevGroup}\n {...options}\n >\n <WrappedComponent {...props} {...options} />\n </FocusGroupProvider>\n );\n}\n\nexport { FocusGroupHoc };\nexport default FocusGroupHoc;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,+BAAmC;AAEnC,uBAAuB,kBAAkB,UAAU,IAAI;AACrD,SAAO,CAAC;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,OACG;AAAA,QAEH,mDAAC,6CAAD;AAAA,IACE,aAAa;AAAA,IACb;AAAA,IACA;AAAA,OACI;AAAA,KAEJ,mDAAC,kBAAD;AAAA,OAAsB;AAAA,OAAW;AAAA;AAAA;AAMvC,IAAO,+BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/FocusGroup/index.js
CHANGED
|
@@ -1,21 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var FocusGroup_exports = {};
|
|
29
|
+
__export(FocusGroup_exports, {
|
|
30
|
+
FocusGrid: () => import_FocusGrid.FocusGridProvider,
|
|
31
|
+
FocusGridContext: () => import_FocusGrid.FocusGridContext,
|
|
32
|
+
FocusGroup: () => import_FocusGroup.FocusGroup,
|
|
33
|
+
FocusGroupContext: () => import_FocusGroupContext.FocusGroupContext,
|
|
34
|
+
FocusGroupManager: () => import_FocusGroupManager.FocusGroupManager,
|
|
35
|
+
focusGroupManagerHoc: () => import_focusGroupManagerHoc.FocusGroupHoc,
|
|
36
|
+
useFocusGroupItem: () => import_useFocusGroupItem.useFocusGroupItem,
|
|
37
|
+
useFocusGroupWithState: () => import_useFocusGroupItem.useFocusGroupWithState
|
|
38
|
+
});
|
|
39
|
+
var React = __toESM(require("react"));
|
|
40
|
+
var import_FocusGroup = require("./FocusGroup");
|
|
41
|
+
var import_FocusGroupContext = require("./FocusGroupContext");
|
|
42
|
+
var import_FocusGroupManager = require("./FocusGroupManager");
|
|
43
|
+
var import_useFocusGroupItem = require("./useFocusGroupItem");
|
|
44
|
+
var import_focusGroupManagerHoc = require("./focusGroupManagerHoc");
|
|
45
|
+
var import_FocusGrid = require("./FocusGrid");
|
|
46
|
+
module.exports = __toCommonJS(FocusGroup_exports);
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/FocusGroup/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { FocusGroup } from './FocusGroup';\nexport { FocusGroupContext } from './FocusGroupContext';\nexport { FocusGroupManager } from './FocusGroupManager';\nexport { useFocusGroupItem, useFocusGroupWithState } from './useFocusGroupItem';\nexport { FocusGroupHoc as focusGroupManagerHoc } from './focusGroupManagerHoc';\nexport { FocusGridProvider as FocusGrid, FocusGridContext } from './FocusGrid';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA2B;AAC3B,+BAAkC;AAClC,+BAAkC;AAClC,+BAA0D;AAC1D,kCAAsD;AACtD,uBAAiE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,59 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useFocusGroupItem_exports = {};
|
|
29
|
+
__export(useFocusGroupItem_exports, {
|
|
30
|
+
default: () => useFocusGroupItem_default,
|
|
31
|
+
useFocusGroupItem: () => useFocusGroupItem,
|
|
32
|
+
useFocusGroupWithState: () => useFocusGroupWithState
|
|
33
|
+
});
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_FocusGroupContext = require("./FocusGroupContext");
|
|
37
|
+
function useFocusGroupItem(ref = {}, props) {
|
|
38
|
+
const { register, unregister, ...otherActions } = (0, import_react.useContext)(import_FocusGroupContext.FocusGroupContext) || {};
|
|
39
|
+
(0, import_react.useEffect)(() => {
|
|
40
|
+
if (ref.current && register)
|
|
41
|
+
register(ref.current, props);
|
|
28
42
|
return () => {
|
|
29
|
-
if (ref.current && unregister)
|
|
43
|
+
if (ref.current && unregister)
|
|
44
|
+
unregister(ref.current);
|
|
30
45
|
};
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
});
|
|
47
|
+
if (!register)
|
|
48
|
+
return {};
|
|
34
49
|
return otherActions;
|
|
35
50
|
}
|
|
36
|
-
const useFocusGroupWithState =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
register,
|
|
43
|
-
unregister
|
|
44
|
-
} = _ref2,
|
|
45
|
-
otherActions = _objectWithoutProperties__default["default"](_ref2, _excluded2);
|
|
46
|
-
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
if (ref && register) register(ref, props);
|
|
51
|
+
const useFocusGroupWithState = (ref = {}, props) => {
|
|
52
|
+
const { register, unregister, ...otherActions } = (0, import_react.useContext)(import_FocusGroupContext.FocusGroupContext) || {};
|
|
53
|
+
(0, import_react.useEffect)(() => {
|
|
54
|
+
if (ref && register)
|
|
55
|
+
register(ref, props);
|
|
49
56
|
return () => {
|
|
50
|
-
if (ref && unregister)
|
|
57
|
+
if (ref && unregister)
|
|
58
|
+
unregister(ref);
|
|
51
59
|
};
|
|
52
|
-
}, [ref]);
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
}, [ref]);
|
|
61
|
+
if (!register)
|
|
62
|
+
return {};
|
|
55
63
|
return otherActions;
|
|
56
64
|
};
|
|
57
|
-
|
|
58
|
-
exports
|
|
59
|
-
|
|
65
|
+
var useFocusGroupItem_default = useFocusGroupItem;
|
|
66
|
+
module.exports = __toCommonJS(useFocusGroupItem_exports);
|
|
67
|
+
//# sourceMappingURL=useFocusGroupItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/FocusGroup/useFocusGroupItem.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useContext, useEffect } from 'react';\nimport { FocusGroupContext } from './FocusGroupContext';\n\nfunction useFocusGroupItem(ref = {}, props) {\n const { register, unregister, ...otherActions } =\n useContext(FocusGroupContext) || {};\n\n useEffect(() => {\n if (ref.current && register) register(ref.current, props);\n return () => {\n if (ref.current && unregister) unregister(ref.current);\n };\n });\n\n // if the focus item is not wrapped with the focus provider then return null\n if (!register) return {};\n return otherActions;\n}\n\nexport const useFocusGroupWithState = (ref = {}, props) => {\n const { register, unregister, ...otherActions } =\n useContext(FocusGroupContext) || {};\n\n useEffect(() => {\n if (ref && register) register(ref, props);\n return () => {\n if (ref && unregister) unregister(ref);\n };\n }, [ref]);\n\n // if the focus item is not wrapped with the focus provider then return null\n if (!register) return {};\n return otherActions;\n};\n\nexport { useFocusGroupItem };\nexport default useFocusGroupItem;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsC;AACtC,+BAAkC;AAElC,2BAA2B,MAAM,IAAI,OAAO;AAC1C,QAAM,EAAE,UAAU,eAAe,iBAC/B,6BAAW,+CAAsB;AAEnC,8BAAU,MAAM;AACd,QAAI,IAAI,WAAW;AAAU,eAAS,IAAI,SAAS;AACnD,WAAO,MAAM;AACX,UAAI,IAAI,WAAW;AAAY,mBAAW,IAAI;AAAA;AAAA;AAKlD,MAAI,CAAC;AAAU,WAAO;AACtB,SAAO;AAAA;AAGF,MAAM,yBAAyB,CAAC,MAAM,IAAI,UAAU;AACzD,QAAM,EAAE,UAAU,eAAe,iBAC/B,6BAAW,+CAAsB;AAEnC,8BAAU,MAAM;AACd,QAAI,OAAO;AAAU,eAAS,KAAK;AACnC,WAAO,MAAM;AACX,UAAI,OAAO;AAAY,mBAAW;AAAA;AAAA,KAEnC,CAAC;AAGJ,MAAI,CAAC;AAAU,WAAO;AACtB,SAAO;AAAA;AAIT,IAAO,4BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,47 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var getNextCellPosition_exports = {};
|
|
29
|
+
__export(getNextCellPosition_exports, {
|
|
30
|
+
default: () => getNextCellPosition_default,
|
|
31
|
+
getNextCellPosition: () => getNextCellPosition
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
function getNextCellPosition({
|
|
35
|
+
grid,
|
|
36
|
+
currentRow = 0,
|
|
37
|
+
currentCell = 0,
|
|
38
|
+
directionY,
|
|
39
|
+
directionX,
|
|
40
|
+
shouldWrapCells,
|
|
41
|
+
shouldWrapRows
|
|
42
|
+
}) {
|
|
14
43
|
let nextRow = currentRow + directionY;
|
|
15
44
|
let nextCell = currentCell + directionX;
|
|
16
45
|
const rowCount = grid.length;
|
|
17
46
|
const isLeftRight = directionX !== 0;
|
|
18
|
-
|
|
19
47
|
if (!rowCount) {
|
|
20
48
|
return false;
|
|
21
49
|
}
|
|
22
|
-
|
|
23
|
-
const cellsLength = grid[0].length; // moving horizontally
|
|
24
|
-
|
|
50
|
+
const cellsLength = grid[0].length;
|
|
25
51
|
if (shouldWrapCells && isLeftRight) {
|
|
26
|
-
// to left
|
|
27
52
|
if (nextCell < 0) {
|
|
28
53
|
nextCell = cellsLength - 1;
|
|
29
54
|
nextRow -= 1;
|
|
30
55
|
}
|
|
31
|
-
|
|
32
56
|
if (nextCell >= cellsLength) {
|
|
33
57
|
nextCell = 0;
|
|
34
58
|
nextRow += 1;
|
|
35
59
|
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
60
|
+
}
|
|
39
61
|
if (shouldWrapRows && !isLeftRight) {
|
|
40
|
-
// to top
|
|
41
62
|
if (nextRow < 0) {
|
|
42
63
|
nextCell -= 1;
|
|
43
64
|
nextRow = rowCount - 1;
|
|
44
|
-
|
|
45
65
|
if (grid[nextRow] && nextCell >= 0 && !grid[nextRow][nextCell]) {
|
|
46
66
|
nextRow -= 1;
|
|
47
67
|
}
|
|
@@ -50,11 +70,11 @@ function getNextCellPosition(_ref) {
|
|
|
50
70
|
nextCell += 1;
|
|
51
71
|
}
|
|
52
72
|
}
|
|
53
|
-
|
|
54
73
|
return {
|
|
55
74
|
cellIndex: nextCell,
|
|
56
75
|
rowIndex: nextRow
|
|
57
76
|
};
|
|
58
77
|
}
|
|
59
|
-
|
|
60
|
-
module.exports =
|
|
78
|
+
var getNextCellPosition_default = getNextCellPosition;
|
|
79
|
+
module.exports = __toCommonJS(getNextCellPosition_exports);
|
|
80
|
+
//# sourceMappingURL=getNextCellPosition.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/FocusGroup/utils/getNextCellPosition.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["// eslint-disable-next-line max-statements\nfunction getNextCellPosition({\n grid,\n currentRow = 0,\n currentCell = 0,\n directionY,\n directionX,\n shouldWrapCells,\n shouldWrapRows,\n}) {\n let nextRow = currentRow + directionY;\n let nextCell = currentCell + directionX;\n const rowCount = grid.length;\n const isLeftRight = directionX !== 0;\n\n if (!rowCount) {\n return false;\n }\n\n const cellsLength = grid[0].length;\n\n // moving horizontally\n if (shouldWrapCells && isLeftRight) {\n // to left\n if (nextCell < 0) {\n nextCell = cellsLength - 1;\n nextRow -= 1;\n }\n\n if (nextCell >= cellsLength) {\n nextCell = 0;\n nextRow += 1;\n }\n }\n\n // moving vertically\n if (shouldWrapRows && !isLeftRight) {\n // to top\n if (nextRow < 0) {\n nextCell -= 1;\n nextRow = rowCount - 1;\n if (grid[nextRow] && nextCell >= 0 && !grid[nextRow][nextCell]) {\n nextRow -= 1;\n }\n } else if (nextRow >= rowCount || !grid[nextRow][nextCell]) {\n nextRow = 0;\n nextCell += 1;\n }\n }\n\n return {\n cellIndex: nextCell,\n rowIndex: nextRow,\n };\n}\n\nexport { getNextCellPosition };\nexport default getNextCellPosition;", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,6BAA6B;AAAA,EAC3B;AAAA,EACA,aAAa;AAAA,EACb,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GACC;AACD,MAAI,UAAU,aAAa;AAC3B,MAAI,WAAW,cAAc;AAC7B,QAAM,WAAW,KAAK;AACtB,QAAM,cAAc,eAAe;AAEnC,MAAI,CAAC,UAAU;AACb,WAAO;AAAA;AAGT,QAAM,cAAc,KAAK,GAAG;AAG5B,MAAI,mBAAmB,aAAa;AAElC,QAAI,WAAW,GAAG;AAChB,iBAAW,cAAc;AACzB,iBAAW;AAAA;AAGb,QAAI,YAAY,aAAa;AAC3B,iBAAW;AACX,iBAAW;AAAA;AAAA;AAKf,MAAI,kBAAkB,CAAC,aAAa;AAElC,QAAI,UAAU,GAAG;AACf,kBAAY;AACZ,gBAAU,WAAW;AACrB,UAAI,KAAK,YAAY,YAAY,KAAK,CAAC,KAAK,SAAS,WAAW;AAC9D,mBAAW;AAAA;AAAA,eAEJ,WAAW,YAAY,CAAC,KAAK,SAAS,WAAW;AAC1D,gBAAU;AACV,kBAAY;AAAA;AAAA;AAIhB,SAAO;AAAA,IACL,WAAW;AAAA,IACX,UAAU;AAAA;AAAA;AAKd,IAAO,8BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var Group_exports = {};
|
|
29
|
+
__export(Group_exports, {
|
|
30
|
+
Group: () => Group,
|
|
31
|
+
default: () => Group_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_prop_types = __toESM(require("prop-types"));
|
|
36
|
+
var import_GroupContext = require("./GroupContext");
|
|
37
|
+
const getValueItem = (e) => {
|
|
38
|
+
const { target, currentTarget } = e;
|
|
18
39
|
if (target) {
|
|
19
|
-
const {
|
|
20
|
-
value
|
|
21
|
-
} = target;
|
|
40
|
+
const { value } = target;
|
|
22
41
|
return value;
|
|
23
42
|
}
|
|
24
|
-
|
|
25
43
|
if (currentTarget) {
|
|
26
|
-
const {
|
|
27
|
-
value
|
|
28
|
-
} = currentTarget;
|
|
44
|
+
const { value } = currentTarget;
|
|
29
45
|
return value;
|
|
30
46
|
}
|
|
31
|
-
|
|
32
47
|
return e;
|
|
33
48
|
};
|
|
34
|
-
|
|
35
49
|
const toggleItemValue = (array, e) => {
|
|
36
50
|
const newvalue = getValueItem(e);
|
|
37
51
|
const res = array;
|
|
38
52
|
const index = array.indexOf(newvalue);
|
|
39
|
-
|
|
40
53
|
if (index === -1) {
|
|
41
54
|
res.push(newvalue);
|
|
42
55
|
} else {
|
|
43
56
|
res.splice(index, 1);
|
|
44
57
|
}
|
|
45
|
-
|
|
46
58
|
return res;
|
|
47
59
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Provider
|
|
51
|
-
} = GroupContext.GroupContext;
|
|
52
|
-
/** deprecated use CheckableGroup instead */
|
|
53
|
-
|
|
54
|
-
class Group extends React.Component {
|
|
60
|
+
const { Provider } = import_GroupContext.GroupContext;
|
|
61
|
+
class Group extends import_react.Component {
|
|
55
62
|
constructor(props) {
|
|
56
63
|
super(props);
|
|
57
|
-
const {
|
|
58
|
-
activeValue,
|
|
59
|
-
disabled
|
|
60
|
-
} = props;
|
|
64
|
+
const { activeValue, disabled } = props;
|
|
61
65
|
this.state = {
|
|
62
66
|
activeValue,
|
|
63
67
|
disabled,
|
|
@@ -65,60 +69,47 @@ class Group extends React.Component {
|
|
|
65
69
|
onChange: this.handleChange.bind(this)
|
|
66
70
|
};
|
|
67
71
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
prevValue
|
|
72
|
-
} = _ref;
|
|
73
|
-
if (nextProps.activeValue === prevValue) return null;
|
|
72
|
+
static getDerivedStateFromProps(nextProps, { prevValue }) {
|
|
73
|
+
if (nextProps.activeValue === prevValue)
|
|
74
|
+
return null;
|
|
74
75
|
return {
|
|
75
76
|
activeValue: nextProps.activeValue,
|
|
76
77
|
prevValue: nextProps.activeValue
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const {
|
|
82
|
-
multiple,
|
|
83
|
-
onChange
|
|
84
|
-
} = this.props;
|
|
85
|
-
const {
|
|
86
|
-
activeValue
|
|
87
|
-
} = this.state;
|
|
80
|
+
handleChange(e, ...rest) {
|
|
81
|
+
const { multiple, onChange } = this.props;
|
|
82
|
+
const { activeValue } = this.state;
|
|
88
83
|
const value = getValueItem(e);
|
|
89
84
|
let newValue;
|
|
90
|
-
|
|
91
85
|
if (multiple) {
|
|
92
86
|
newValue = toggleItemValue(activeValue || [], value);
|
|
93
87
|
} else if (activeValue !== value) {
|
|
94
|
-
// default behaviour it will be toggle the active value
|
|
95
88
|
newValue = value;
|
|
96
89
|
}
|
|
97
|
-
|
|
98
90
|
this.setState({
|
|
99
91
|
activeValue: newValue
|
|
100
92
|
});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
rest[_key - 1] = arguments[_key];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (onChange) onChange(newValue, ...rest);
|
|
93
|
+
if (onChange)
|
|
94
|
+
onChange(newValue, ...rest);
|
|
107
95
|
}
|
|
108
|
-
|
|
109
96
|
render() {
|
|
110
|
-
const {
|
|
111
|
-
|
|
112
|
-
} = this.props;
|
|
113
|
-
return /*#__PURE__*/_jsx__default["default"](Provider, {
|
|
97
|
+
const { children } = this.props;
|
|
98
|
+
return /* @__PURE__ */ import_react.default.createElement(Provider, {
|
|
114
99
|
value: this.state
|
|
115
|
-
},
|
|
100
|
+
}, children);
|
|
116
101
|
}
|
|
117
|
-
|
|
118
102
|
}
|
|
119
|
-
|
|
120
103
|
Group.defaultProps = {
|
|
121
104
|
multiple: false
|
|
122
105
|
};
|
|
123
|
-
|
|
124
|
-
|
|
106
|
+
Group.propTypes = {
|
|
107
|
+
children: import_prop_types.default.array,
|
|
108
|
+
multiple: import_prop_types.default.bool,
|
|
109
|
+
onChange: import_prop_types.default.func,
|
|
110
|
+
activeValue: import_prop_types.default.oneOfType([import_prop_types.default.array, import_prop_types.default.number]),
|
|
111
|
+
disabled: import_prop_types.default.bool
|
|
112
|
+
};
|
|
113
|
+
var Group_default = Group;
|
|
114
|
+
module.exports = __toCommonJS(Group_exports);
|
|
115
|
+
//# sourceMappingURL=Group.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/GroupContext/Group.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-unused-state */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { GroupContext } from './GroupContext';\n\nconst getValueItem = (e) => {\n const { target, currentTarget } = e;\n if (target) {\n const { value } = target;\n return value;\n }\n if (currentTarget) {\n const { value } = currentTarget;\n return value;\n }\n return e;\n};\n\nconst toggleItemValue = (array, e) => {\n const newvalue = getValueItem(e);\n const res = array;\n const index = array.indexOf(newvalue);\n\n if (index === -1) {\n res.push(newvalue);\n } else {\n res.splice(index, 1);\n }\n\n return res;\n};\n\nconst { Provider } = GroupContext;\n/** deprecated use CheckableGroup instead */\nclass Group extends Component {\n constructor(props) {\n super(props);\n const { activeValue, disabled } = props;\n this.state = {\n activeValue,\n disabled,\n prevValue: null,\n onChange: this.handleChange.bind(this),\n };\n }\n\n static getDerivedStateFromProps(nextProps, { prevValue }) {\n if (nextProps.activeValue === prevValue) return null;\n return {\n activeValue: nextProps.activeValue,\n prevValue: nextProps.activeValue,\n };\n }\n\n handleChange(e, ...rest) {\n const { multiple, onChange } = this.props;\n const { activeValue } = this.state;\n const value = getValueItem(e);\n let newValue;\n if (multiple) {\n newValue = toggleItemValue(activeValue || [], value);\n } else if (activeValue !== value) {\n // default behaviour it will be toggle the active value\n newValue = value;\n }\n\n this.setState({\n activeValue: newValue,\n });\n\n if (onChange) onChange(newValue, ...rest);\n }\n\n render() {\n const { children } = this.props;\n return <Provider value={this.state}>{children}</Provider>;\n }\n}\n\nGroup.defaultProps = {\n multiple: false,\n};\n\nGroup.propTypes = {\n children: PropTypes.array,\n multiple: PropTypes.bool,\n onChange: PropTypes.func,\n activeValue: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),\n disabled: PropTypes.bool,\n};\n\nexport { Group };\nexport default Group;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAiC;AACjC,wBAAsB;AACtB,0BAA6B;AAE7B,MAAM,eAAe,CAAC,MAAM;AAC1B,QAAM,EAAE,QAAQ,kBAAkB;AAClC,MAAI,QAAQ;AACV,UAAM,EAAE,UAAU;AAClB,WAAO;AAAA;AAET,MAAI,eAAe;AACjB,UAAM,EAAE,UAAU;AAClB,WAAO;AAAA;AAET,SAAO;AAAA;AAGT,MAAM,kBAAkB,CAAC,OAAO,MAAM;AACpC,QAAM,WAAW,aAAa;AAC9B,QAAM,MAAM;AACZ,QAAM,QAAQ,MAAM,QAAQ;AAE5B,MAAI,UAAU,IAAI;AAChB,QAAI,KAAK;AAAA,SACJ;AACL,QAAI,OAAO,OAAO;AAAA;AAGpB,SAAO;AAAA;AAGT,MAAM,EAAE,aAAa;AAErB,oBAAoB,uBAAU;AAAA,EAC5B,YAAY,OAAO;AACjB,UAAM;AACN,UAAM,EAAE,aAAa,aAAa;AAClC,SAAK,QAAQ;AAAA,MACX;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,UAAU,KAAK,aAAa,KAAK;AAAA;AAAA;AAAA,SAI9B,yBAAyB,WAAW,EAAE,aAAa;AACxD,QAAI,UAAU,gBAAgB;AAAW,aAAO;AAChD,WAAO;AAAA,MACL,aAAa,UAAU;AAAA,MACvB,WAAW,UAAU;AAAA;AAAA;AAAA,EAIzB,aAAa,MAAM,MAAM;AACvB,UAAM,EAAE,UAAU,aAAa,KAAK;AACpC,UAAM,EAAE,gBAAgB,KAAK;AAC7B,UAAM,QAAQ,aAAa;AAC3B,QAAI;AACJ,QAAI,UAAU;AACZ,iBAAW,gBAAgB,eAAe,IAAI;AAAA,eACrC,gBAAgB,OAAO;AAEhC,iBAAW;AAAA;AAGb,SAAK,SAAS;AAAA,MACZ,aAAa;AAAA;AAGf,QAAI;AAAU,eAAS,UAAU,GAAG;AAAA;AAAA,EAGtC,SAAS;AACP,UAAM,EAAE,aAAa,KAAK;AAC1B,WAAO,mDAAC,UAAD;AAAA,MAAU,OAAO,KAAK;AAAA,OAAQ;AAAA;AAAA;AAIzC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA;AAGZ,MAAM,YAAY;AAAA,EAChB,UAAU,0BAAU;AAAA,EACpB,UAAU,0BAAU;AAAA,EACpB,UAAU,0BAAU;AAAA,EACpB,aAAa,0BAAU,UAAU,CAAC,0BAAU,OAAO,0BAAU;AAAA,EAC7D,UAAU,0BAAU;AAAA;AAItB,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|