@elliemae/ds-shared 3.2.1-rc.4 → 3.2.1-rc.7
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/cjs/CheckableGroup.js +3 -19
- package/dist/cjs/CheckableGroup.js.map +1 -1
- package/dist/cjs/FocusGroup/FocusGrid.js +5 -18
- package/dist/cjs/FocusGroup/FocusGrid.js.map +1 -1
- package/dist/cjs/FocusGroup/FocusGroup.js +6 -19
- package/dist/cjs/FocusGroup/FocusGroup.js.map +1 -1
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js +14 -42
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js.map +1 -1
- package/dist/cjs/FocusGroup/useFocusGroupItem.js +2 -16
- package/dist/cjs/FocusGroup/useFocusGroupItem.js.map +1 -1
- package/dist/cjs/ScrollSync/ScrollSyncPane.js +3 -19
- package/dist/cjs/ScrollSync/ScrollSyncPane.js.map +1 -1
- package/dist/cjs/createDataInstance/createInstancePlugin.js +1 -15
- package/dist/cjs/createDataInstance/createInstancePlugin.js.map +1 -1
- package/dist/cjs/createDataInstance/createInstanceRef.js +9 -41
- package/dist/cjs/createDataInstance/createInstanceRef.js.map +1 -1
- package/dist/cjs/createDataInstance/utils.js +20 -25
- package/dist/cjs/createDataInstance/utils.js.map +1 -1
- package/dist/cjs/defer-render-hoc/index.js +3 -15
- package/dist/cjs/defer-render-hoc/index.js.map +1 -1
- package/dist/cjs/toolbar/ToolbarProvider.js +9 -24
- package/dist/cjs/toolbar/ToolbarProvider.js.map +1 -1
- package/dist/cjs/useDataGrid/initColumnDefinition.js +27 -33
- package/dist/cjs/useDataGrid/initColumnDefinition.js.map +1 -1
- package/dist/cjs/useDataGrid/useDataGrid.js +31 -53
- package/dist/cjs/useDataGrid/useDataGrid.js.map +1 -1
- package/dist/cjs/useDataList/useDataList.js +14 -47
- package/dist/cjs/useDataList/useDataList.js.map +1 -1
- package/dist/cjs/utils.js +2 -18
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/virtualization/AutoHeightList.js +14 -51
- package/dist/cjs/virtualization/AutoHeightList.js.map +1 -1
- package/dist/cjs/virtualization/FluidHeightList.js +7 -38
- package/dist/cjs/virtualization/FluidHeightList.js.map +1 -1
- package/dist/esm/CheckableGroup.js +3 -21
- package/dist/esm/CheckableGroup.js.map +1 -1
- package/dist/esm/FocusGroup/FocusGrid.js +5 -20
- package/dist/esm/FocusGroup/FocusGrid.js.map +1 -1
- package/dist/esm/FocusGroup/FocusGroup.js +6 -21
- package/dist/esm/FocusGroup/FocusGroup.js.map +1 -1
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js +14 -44
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js.map +1 -1
- package/dist/esm/FocusGroup/useFocusGroupItem.js +2 -17
- package/dist/esm/FocusGroup/useFocusGroupItem.js.map +1 -1
- package/dist/esm/ScrollSync/ScrollSyncPane.js +3 -21
- package/dist/esm/ScrollSync/ScrollSyncPane.js.map +1 -1
- package/dist/esm/createDataInstance/createInstancePlugin.js +1 -17
- package/dist/esm/createDataInstance/createInstancePlugin.js.map +1 -1
- package/dist/esm/createDataInstance/createInstanceRef.js +9 -43
- package/dist/esm/createDataInstance/createInstanceRef.js.map +1 -1
- package/dist/esm/createDataInstance/utils.js +20 -27
- package/dist/esm/createDataInstance/utils.js.map +1 -1
- package/dist/esm/defer-render-hoc/index.js +3 -17
- package/dist/esm/defer-render-hoc/index.js.map +1 -1
- package/dist/esm/toolbar/ToolbarProvider.js +9 -26
- package/dist/esm/toolbar/ToolbarProvider.js.map +1 -1
- package/dist/esm/useDataGrid/initColumnDefinition.js +27 -35
- package/dist/esm/useDataGrid/initColumnDefinition.js.map +1 -1
- package/dist/esm/useDataGrid/useDataGrid.js +31 -55
- package/dist/esm/useDataGrid/useDataGrid.js.map +1 -1
- package/dist/esm/useDataList/useDataList.js +14 -49
- package/dist/esm/useDataList/useDataList.js.map +1 -1
- package/dist/esm/utils.js +2 -20
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/virtualization/AutoHeightList.js +14 -53
- package/dist/esm/virtualization/AutoHeightList.js.map +1 -1
- package/dist/esm/virtualization/FluidHeightList.js +7 -40
- package/dist/esm/virtualization/FluidHeightList.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/useDataList/useDataList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useMemo, useRef } from 'react';\nimport { setRef } from '@elliemae/ds-utilities';\nimport get from 'lodash/get';\nimport {\n composeFormatters,\n reducePropsGetter,\n} from '../createDataInstance/utils';\nimport { recordIterator } from './recordIterator';\nimport { createDataInstanceRef } from '../createDataInstance/createInstanceRef';\n\nexport const getItemLabel = (record, nameKey = 'name') =>\n get(record, ['data', nameKey]);\nexport const getItemChildren = (record, childrenKey = 'children') =>\n get(record, ['data', childrenKey]);\n\nconst listRenderers = {\n list: 'ul',\n item: 'li',\n};\n\n// todo: check if a plugin is a LIST plugin rather than GRID\nexport const useDataList = ({\n data = [],\n plugins = [],\n renderers = listRenderers,\n itemRenderer = [],\n customDecorators,\n ...props\n}) => {\n const listRef = useRef();\n const { instance, decorators } = createDataInstanceRef({\n data,\n renderers,\n plugins,\n customDecorators: {\n ...customDecorators,\n recordIterator,\n getListProps: [],\n getItemProps: [],\n itemRenderer: [...itemRenderer], // components reduce to compose item content\n record: [],\n records: [],\n },\n ...props,\n });\n instance.current.getListRef = () => listRef;\n instance.current.setListRef = (ref) => {\n listRef.current = ref;\n };\n instance.current.getItemLabel = (record) =>\n getItemLabel(record, props.nameKey);\n instance.current.getItemChildren = (record) =>\n getItemChildren(record, props.childrenKey);\n\n instance.current.decorators = decorators;\n instance.current.getListProps = reducePropsGetter(\n decorators.getListProps,\n instance.current,\n );\n instance.current.getItemProps = reducePropsGetter(\n decorators.getItemProps,\n instance.current,\n );\n instance.current.itemRenderer = composeFormatters(\n instance.current.decorators.itemRenderer,\n instance.current,\n );\n\n instance.current.records = useMemo(() => {\n // record iterator TREE / Simple\n let nextRecords = recordIterator(\n data,\n instance.current.decorators.recordIterator,\n decorators.record,\n instance.current,\n );\n\n // compose all records\n nextRecords = decorators.records.reduce(\n (nextRows, getter) => getter(nextRows, instance.current),\n nextRecords,\n );\n\n return nextRecords;\n });\n\n if (props.instanceRef) setRef(props.instanceRef, instance.current);\n\n return instance.current;\n};\n\nexport default useDataList;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAgC;AAChC,0BAAuB;AACvB,iBAAgB;AAChB,mBAGO;AACP,4BAA+B;AAC/B,+BAAsC;AAE/B,MAAM,eAAe,CAAC,QAAQ,UAAU,WAC7C,wBAAI,QAAQ,CAAC,QAAQ,OAAO,CAAC;AACxB,MAAM,kBAAkB,CAAC,QAAQ,cAAc,eACpD,wBAAI,QAAQ,CAAC,QAAQ,WAAW,CAAC;AAEnC,MAAM,gBAAgB;AAAA,EACpB,MAAM;AAAA,EACN,MAAM;AACR;AAGO,MAAM,cAAc,CAAC;AAAA,EAC1B,OAAO,CAAC;AAAA,EACR,UAAU,CAAC;AAAA,EACX,YAAY;AAAA,EACZ,eAAe,CAAC;AAAA,EAChB;AAAA,KACG;AAAA,MACC;AACJ,QAAM,UAAU,yBAAO;AACvB,QAAM,EAAE,UAAU,eAAe,oDAAsB;AAAA,IACrD;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,MAChB,GAAG;AAAA,MACH;AAAA,MACA,cAAc,CAAC;AAAA,MACf,cAAc,CAAC;AAAA,MACf,cAAc,CAAC,GAAG,YAAY;AAAA,MAC9B,QAAQ,CAAC;AAAA,MACT,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACD,WAAS,QAAQ,aAAa,MAAM;AACpC,WAAS,QAAQ,aAAa,CAAC,QAAQ;AACrC,YAAQ,UAAU;AAAA,EACpB;AACA,WAAS,QAAQ,eAAe,CAAC,WAC/B,aAAa,QAAQ,MAAM,OAAO;AACpC,WAAS,QAAQ,kBAAkB,CAAC,WAClC,gBAAgB,QAAQ,MAAM,WAAW;AAE3C,WAAS,QAAQ,aAAa;AAC9B,WAAS,QAAQ,eAAe,oCAC9B,WAAW,cACX,SAAS,OACX;AACA,WAAS,QAAQ,eAAe,oCAC9B,WAAW,cACX,SAAS,OACX;AACA,WAAS,QAAQ,eAAe,oCAC9B,SAAS,QAAQ,WAAW,cAC5B,SAAS,OACX;AAEA,WAAS,QAAQ,UAAU,0BAAQ,MAAM;AAEvC,QAAI,cAAc,0CAChB,MACA,SAAS,QAAQ,WAAW,gBAC5B,WAAW,QACX,SAAS,OACX;AAGA,kBAAc,WAAW,QAAQ,OAC/B,CAAC,UAAU,WAAW,OAAO,UAAU,SAAS,OAAO,GACvD,WACF;AAEA,WAAO;AAAA,EACT,CAAC;AAED,MAAI,MAAM;AAAa,oCAAO,MAAM,aAAa,SAAS,OAAO;AAEjE,SAAO,SAAS;AAClB;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/utils.js
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -95,7 +78,8 @@ const getTotalScroll = (elem) => {
|
|
|
95
78
|
const getTransformProps = (x, y) => ({
|
|
96
79
|
transform: `translate(${x}px, ${y}px)`
|
|
97
80
|
});
|
|
98
|
-
const listWithChildren = (list, childrenProp) => list.map((item) =>
|
|
81
|
+
const listWithChildren = (list, childrenProp) => list.map((item) => ({
|
|
82
|
+
...item,
|
|
99
83
|
[childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
|
|
100
84
|
}));
|
|
101
85
|
const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
package/dist/cjs/utils.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable no-cond-assign */\nexport const objectType = (obj) =>\n Object.prototype.toString.call(obj).slice(8, -1);\nexport const isDefined = (param) => typeof param !== 'undefined';\nexport const isUndefined = (param) => typeof param === 'undefined';\nexport const isFunction = (param) => typeof param === 'function';\nexport const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line\nexport const isString = (str) => objectType(str) === 'String';\nexport const isArray = (arr) => objectType(arr) === 'Array';\n\nexport const closest = (target, selector) => {\n // closest(e.target, '.field')\n while (target) {\n // eslint-disable-line\n if (target.matches && target.matches(selector)) return target;\n if (target.msMatchesSelector && target.msMatchesSelector(selector))\n return target;\n // eslint-disable-next-line no-param-reassign\n target = target.parentNode;\n }\n return null;\n};\n\nexport const getOffsetRect = (elem) => {\n // (1)\n const box = elem.getBoundingClientRect();\n\n const { body, documentElement } = document;\n\n // (2)\n const scrollTop =\n window.pageYOffset || documentElement.scrollTop || body.scrollTop;\n const scrollLeft =\n window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;\n\n // (3)\n const clientTop = documentElement.clientTop || body.clientTop || 0;\n const clientLeft = documentElement.clientLeft || body.clientLeft || 0;\n\n // (4)\n const top = box.top + scrollTop - clientTop;\n const left = box.left + scrollLeft - clientLeft;\n\n return { top: Math.round(top), left: Math.round(left) };\n};\n\nexport const getTotalScroll = (elem) => {\n let top = 0;\n let left = 0;\n\n // eslint-disable-next-line no-param-reassign\n while ((elem = elem.parentNode)) {\n top += elem.scrollTop || 0;\n left += elem.scrollLeft || 0;\n }\n\n return { top, left };\n};\n\nexport const getTransformProps = (x, y) => ({\n transform: `translate(${x}px, ${y}px)`,\n});\n\nexport const listWithChildren = (list, childrenProp) =>\n list.map((item) => ({\n ...item,\n [childrenProp]: item[childrenProp]\n ? listWithChildren(item[childrenProp], childrenProp)\n : [],\n }));\n\nexport const getAllNonEmptyNodesIds = (items, childrenProp) => {\n let childrenIds = [];\n const ids = items\n .filter((item) => item[childrenProp].length)\n .map((item) => {\n childrenIds = childrenIds.concat(\n getAllNonEmptyNodesIds(item[childrenProp], childrenProp),\n );\n return item.id;\n });\n\n return ids.concat(childrenIds);\n};\n\nexport const isInternetExplorer = () => {\n const ua = window.navigator.userAgent;\n const msie = ua.indexOf('MSIE ');\n // If Internet Explorer, return version number\n if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\\./)) {\n return true;\n }\n return false;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADChB,MAAM,aAAa,CAAC,QACzB,OAAO,UAAU,SAAS,KAAK,GAAG,EAAE,MAAM,GAAG,EAAE;AAC1C,MAAM,YAAY,CAAC,UAAU,OAAO,UAAU;AAC9C,MAAM,cAAc,CAAC,UAAU,OAAO,UAAU;AAChD,MAAM,aAAa,CAAC,UAAU,OAAO,UAAU;AAC/C,MAAM,WAAW,WAAS,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK;AACnE,MAAM,WAAW,CAAC,QAAQ,WAAW,GAAG,MAAM;AAC9C,MAAM,UAAU,CAAC,QAAQ,WAAW,GAAG,MAAM;AAE7C,MAAM,UAAU,CAAC,QAAQ,aAAa;AAE3C,SAAO,QAAQ;AAEb,QAAI,OAAO,WAAW,OAAO,QAAQ,QAAQ;AAAG,aAAO;AACvD,QAAI,OAAO,qBAAqB,OAAO,kBAAkB,QAAQ;AAC/D,aAAO;AAET,aAAS,OAAO;AAAA,EAClB;AACA,SAAO;AACT;AAEO,MAAM,gBAAgB,CAAC,SAAS;AAErC,QAAM,MAAM,KAAK,sBAAsB;AAEvC,QAAM,EAAE,MAAM,oBAAoB;AAGlC,QAAM,YACJ,OAAO,eAAe,gBAAgB,aAAa,KAAK;AAC1D,QAAM,aACJ,OAAO,eAAe,gBAAgB,cAAc,KAAK;AAG3D,QAAM,YAAY,gBAAgB,aAAa,KAAK,aAAa;AACjE,QAAM,aAAa,gBAAgB,cAAc,KAA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4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
8
|
var __export = (target, all) => {
|
|
38
9
|
for (var name in all)
|
|
39
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -57,33 +28,25 @@ var React = __toESM(require("react"));
|
|
|
57
28
|
var import_react = __toESM(require("react"));
|
|
58
29
|
var import_react_window = require("react-window");
|
|
59
30
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
60
|
-
const AutoHeightList = (0, import_react.forwardRef)((
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"itemCount",
|
|
72
|
-
"className",
|
|
73
|
-
"innerRef",
|
|
74
|
-
"itemData",
|
|
75
|
-
"itemKey",
|
|
76
|
-
"itemSize",
|
|
77
|
-
"outerRef",
|
|
78
|
-
"component"
|
|
79
|
-
]);
|
|
31
|
+
const AutoHeightList = (0, import_react.forwardRef)(({
|
|
32
|
+
itemCount,
|
|
33
|
+
className,
|
|
34
|
+
innerRef,
|
|
35
|
+
itemData,
|
|
36
|
+
itemKey,
|
|
37
|
+
itemSize,
|
|
38
|
+
outerRef,
|
|
39
|
+
component: ListComponent = import_react_window.FixedSizeList,
|
|
40
|
+
...otherProps
|
|
41
|
+
}, ref) => {
|
|
80
42
|
const listRef = (0, import_react.useRef)();
|
|
81
43
|
const outerListRef = (0, import_react.useRef)();
|
|
82
44
|
(0, import_ds_utilities.useWindowScrollerList)({
|
|
83
45
|
listInstance: listRef,
|
|
84
46
|
outerListRef
|
|
85
47
|
});
|
|
86
|
-
return /* @__PURE__ */ import_react.default.createElement(ListComponent,
|
|
48
|
+
return /* @__PURE__ */ import_react.default.createElement(ListComponent, {
|
|
49
|
+
...otherProps,
|
|
87
50
|
ref: (0, import_ds_utilities.mergeRefs)(ref, listRef),
|
|
88
51
|
className: (0, import_ds_utilities.cx)(className, "window-scroller-override"),
|
|
89
52
|
height: window.innerHeight,
|
|
@@ -95,6 +58,6 @@ const AutoHeightList = (0, import_react.forwardRef)((_a, ref) => {
|
|
|
95
58
|
outerRef: (0, import_ds_utilities.mergeRefs)(outerListRef, outerRef),
|
|
96
59
|
overscanCount: 10,
|
|
97
60
|
useIsScrolling: true
|
|
98
|
-
})
|
|
61
|
+
});
|
|
99
62
|
});
|
|
100
63
|
//# sourceMappingURL=AutoHeightList.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/virtualization/AutoHeightList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { forwardRef, useRef } from 'react';\nimport { FixedSizeList as List } from 'react-window';\nimport { cx, useWindowScrollerList, mergeRefs } from '@elliemae/ds-utilities';\n\nexport const AutoHeightList = forwardRef(\n (\n {\n itemCount,\n className,\n innerRef,\n itemData,\n itemKey,\n itemSize,\n outerRef,\n component: ListComponent = List,\n ...otherProps\n },\n ref,\n ) => {\n const listRef = useRef();\n const outerListRef = useRef();\n\n useWindowScrollerList({\n listInstance: listRef,\n outerListRef,\n });\n\n return (\n <ListComponent\n {...otherProps}\n ref={mergeRefs(ref, listRef)}\n className={cx(className, 'window-scroller-override')}\n height={window.innerHeight}\n innerRef={innerRef}\n itemCount={itemCount}\n itemData={itemData}\n itemKey={itemKey}\n itemSize={itemSize}\n outerRef={mergeRefs(outerListRef, outerRef)}\n overscanCount={10}\n useIsScrolling\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA0C;AAC1C,0BAAsC;AACtC,0BAAqD;AAE9C,MAAM,iBAAiB,6BAC5B,CACE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW,gBAAgB;AAAA,KACxB;AAAA,GAEL,QACG;AACH,QAAM,UAAU,yBAAO;AACvB,QAAM,eAAe,yBAAO;AAE5B,iDAAsB;AAAA,IACpB,cAAc;AAAA,IACd;AAAA,EACF,CAAC;AAED,SACE,mDAAC;AAAA,IACE,GAAG;AAAA,IACJ,KAAK,mCAAU,KAAK,OAAO;AAAA,IAC3B,WAAW,4BAAG,WAAW,0BAA0B;AAAA,IACnD,QAAQ,OAAO;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,mCAAU,cAAc,QAAQ;AAAA,IAC1C,eAAe;AAAA,IACf,gBAAc;AAAA,GAChB;AAEJ,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
8
|
var __export = (target, all) => {
|
|
38
9
|
for (var name in all)
|
|
39
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -56,13 +27,11 @@ module.exports = __toCommonJS(FluidHeightList_exports);
|
|
|
56
27
|
var React = __toESM(require("react"));
|
|
57
28
|
var import_react = __toESM(require("react"));
|
|
58
29
|
var import_react_virtualized_auto_sizer = __toESM(require("react-virtualized-auto-sizer"));
|
|
59
|
-
const FluidHeightList = (0, import_react.forwardRef)((
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})));
|
|
67
|
-
});
|
|
30
|
+
const FluidHeightList = (0, import_react.forwardRef)(({ component: Component, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement(import_react_virtualized_auto_sizer.default, {
|
|
31
|
+
disableWidth: true
|
|
32
|
+
}, ({ height: fluidHeight }) => /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
33
|
+
...props,
|
|
34
|
+
ref,
|
|
35
|
+
height: fluidHeight - 32
|
|
36
|
+
})));
|
|
68
37
|
//# sourceMappingURL=FluidHeightList.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/virtualization/FluidHeightList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { forwardRef } from 'react';\nimport AutoSizer from 'react-virtualized-auto-sizer';\n\nexport const FluidHeightList = forwardRef(\n ({ component: Component, ...props }, ref) => (\n <AutoSizer disableWidth>\n {({ height: fluidHeight }) => (\n <Component\n {...props}\n ref={ref}\n height={fluidHeight - 32} // taking in count the margins of the list\n />\n )}\n </AutoSizer>\n ),\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,0CAAsB;AAEf,MAAM,kBAAkB,6BAC7B,CAAC,EAAE,WAAW,cAAc,SAAS,QACnC,mDAAC;AAAA,EAAU,cAAY;AAAA,GACpB,CAAC,EAAE,QAAQ,kBACV,mDAAC;AAAA,EACE,GAAG;AAAA,EACJ;AAAA,EACA,QAAQ,cAAc;AAAA,CACxB,CAEJ,CAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import React2, { cloneElement } from "react";
|
|
23
4
|
import PropTypes from "prop-types";
|
|
@@ -34,10 +15,11 @@ function useCheckableGroup({ children, active: activeProp, multi, onCheck = () =
|
|
|
34
15
|
return React2.Children.map(children, (child) => {
|
|
35
16
|
const { props } = child;
|
|
36
17
|
const checked = Array.isArray(active) ? active.indexOf(props.name) !== -1 : active === props.name;
|
|
37
|
-
return cloneElement(child,
|
|
18
|
+
return cloneElement(child, {
|
|
19
|
+
...props,
|
|
38
20
|
checked,
|
|
39
21
|
onClick: runAll(handleCheck, props.onClick)
|
|
40
|
-
})
|
|
22
|
+
});
|
|
41
23
|
});
|
|
42
24
|
}
|
|
43
25
|
function CheckableGroup({
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/CheckableGroup.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { cloneElement } from 'react';\nimport PropTypes from 'prop-types';\nimport { addOrRemove, runAll, useDerivedStateFromProps } from '@elliemae/ds-utilities';\n\nexport function useCheckableGroup({ children, active: activeProp, multi, onCheck = () => null }) {\n const [active, setActive] = useDerivedStateFromProps(activeProp);\n\n const handleCheck = ({ target: { value } }, item) => {\n setActive((prevActive) => {\n const nextActive = multi ? addOrRemove(prevActive, value) : value;\n onCheck(nextActive, item);\n return nextActive;\n });\n };\n\n return React.Children.map(children, (child) => {\n const { props } = child;\n const checked = Array.isArray(active) ? active.indexOf(props.name) !== -1 : active === props.name;\n\n return cloneElement(child, {\n ...props,\n checked,\n onClick: runAll(handleCheck, props.onClick),\n });\n });\n}\n\nexport function CheckableGroup({\n active = [],\n multi = false, // checkbox or radio\n children,\n}) {\n return useCheckableGroup({ active, multi, children });\n}\n\nCheckableGroup.propTypes = {\n /* The item (if multi false) or items (if multi true) selected */\n active: PropTypes.arrayOf(PropTypes.string),\n /* Whether is multi select or not */\n multi: PropTypes.bool,\n /* Handler when a user checks an item */\n onCheck: PropTypes.func,\n};\n\nexport default CheckableGroup;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAEO,2BAA2B,EAAE,UAAU,QAAQ,YAAY,OAAO,UAAU,MAAM,QAAQ;AAC/F,QAAM,CAAC,QAAQ,aAAa,yBAAyB,UAAU;AAE/D,QAAM,cAAc,CAAC,EAAE,QAAQ,EAAE,WAAW,SAAS;AACnD,cAAU,CAAC,eAAe;AACxB,YAAM,aAAa,QAAQ,YAAY,YAAY,KAAK,IAAI;AAC5D,cAAQ,YAAY,IAAI;AACxB,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,SAAO,OAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AAC7C,UAAM,EAAE,UAAU;AAClB,UAAM,UAAU,MAAM,QAAQ,MAAM,IAAI,OAAO,QAAQ,MAAM,IAAI,MAAM,KAAK,WAAW,MAAM;AAE7F,WAAO,aAAa,OAAO;AAAA,MACzB,GAAG;AAAA,MACH;AAAA,MACA,SAAS,OAAO,aAAa,MAAM,OAAO;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;AAEO,wBAAwB;AAAA,EAC7B,SAAS,CAAC;AAAA,EACV,QAAQ;AAAA,EACR;AAAA,GACC;AACD,SAAO,kBAAkB,EAAE,QAAQ,OAAO,SAAS,CAAC;AACtD;AAEA,eAAe,YAAY;AAAA,EAEzB,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA,EAE1C,OAAO,UAAU;AAAA,EAEjB,SAAS,UAAU;AACrB;AAEA,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
import React2, { createContext, useEffect, useMemo, useRef } from "react";
|
|
20
4
|
import { isFunction, runAll, get, useHotkeys, mergeRefs } from "@elliemae/ds-utilities";
|
|
@@ -106,7 +90,7 @@ const FocusGridProvider = ({
|
|
|
106
90
|
}
|
|
107
91
|
};
|
|
108
92
|
registerHotKeysHooks(hotKeys, { focusedCell, focusedRow });
|
|
109
|
-
const defaultKeyBindings =
|
|
93
|
+
const defaultKeyBindings = {
|
|
110
94
|
ArrowUp: runAll(preventDefault, () => focusNextCell(-1, 0)),
|
|
111
95
|
ArrowRight: runAll(preventDefault, () => focusNextCell(0, 1)),
|
|
112
96
|
ArrowDown: runAll(preventDefault, () => focusNextCell(1, 0)),
|
|
@@ -124,13 +108,14 @@ const FocusGridProvider = ({
|
|
|
124
108
|
rowIndex = grid.current.length - 1;
|
|
125
109
|
}
|
|
126
110
|
focusNextCell(0, 0, { rowIndex, cellIndex: grid.current[0].length - 1 });
|
|
127
|
-
})
|
|
128
|
-
|
|
111
|
+
}),
|
|
112
|
+
...keyBindings
|
|
113
|
+
};
|
|
129
114
|
const nextKeyBindings = isFunction(keyBindings) ? keyBindings({
|
|
130
115
|
defaultBindings: defaultKeyBindings,
|
|
131
116
|
rowIndex: focusedRow.current,
|
|
132
117
|
cellIndex: focusedCell.current
|
|
133
|
-
}) :
|
|
118
|
+
}) : { ...defaultKeyBindings, ...keyBindings };
|
|
134
119
|
const onKeyDown = (e) => {
|
|
135
120
|
if (e.target.tagName.toLowerCase() === "input")
|
|
136
121
|
return;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/FocusGrid.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { createContext, useEffect, useMemo, useRef } from 'react';\nimport { isFunction, runAll, get, useHotkeys, mergeRefs } from '@elliemae/ds-utilities';\nimport { getNextCellPosition } from './utils/getNextCellPosition';\n\nconst FocusGridContext = createContext();\nconst { Provider } = FocusGridContext;\n\nconst preventDefault = e => e.preventDefault();\n\nfunction registerHotKeysHooks(hotKeys, { focusedRow, focusedCell }) {\n Object.keys(hotKeys).forEach(key => {\n const { handler, options } = hotKeys[key];\n useHotkeys({\n keys: key,\n handler: e => {\n e.preventDefault();\n handler({\n rowIndex: focusedRow.current,\n cellIndex: focusedCell.current,\n });\n },\n options,\n });\n });\n}\n\n// eslint-disable-next-line max-statements\nconst FocusGridProvider = ({\n shouldWrapRows = false,\n shouldWrapCells = false,\n shouldRefocus = true,\n children,\n keyBindings,\n hotKeys,\n}) => {\n const focusedRow = useRef();\n const focusedCell = useRef();\n const grid = useRef([]);\n const containerRef = useRef(document);\n const child = React.Children.only(children);\n const decoratedChild = React.cloneElement(child, {\n innerRef: mergeRefs(child.props.innerRef, containerRef),\n });\n\n const getNode = ({ rowIndex, cellIndex }) =>\n get(grid.current, [rowIndex, cellIndex]);\n\n const register = (node, rowIndex, columnIndex) => {\n if (!node) return;\n if (!Array.isArray(grid.current[rowIndex])) {\n grid.current[rowIndex] = [];\n }\n\n if (rowIndex === 0 && columnIndex === 0) {\n node.setAttribute('tabindex', 0);\n } else {\n node.setAttribute('tabindex', -1);\n }\n\n node.onfocus = () => {\n const prevNode = getNode({\n rowIndex: focusedRow.current,\n cellIndex: focusedCell.current,\n });\n\n if (prevNode) prevNode.setAttribute('tabindex', -1);\n\n node.setAttribute('tabindex', 0);\n focusedRow.current = rowIndex;\n focusedCell.current = columnIndex;\n };\n grid.current[rowIndex][columnIndex] = node;\n };\n\n useEffect(() => {\n if (shouldRefocus) {\n const rowIndex = focusedRow.current;\n const cellIndex = focusedCell.current;\n\n const node = get(grid.current, [rowIndex, cellIndex]);\n if (node) node.focus();\n }\n });\n\n const focusNextCell = (directionY, directionX, position) => {\n const { rowIndex, cellIndex } =\n position ||\n getNextCellPosition({\n grid: grid.current,\n currentCell: focusedCell.current,\n currentRow: focusedRow.current,\n directionX,\n directionY,\n shouldWrapCells,\n shouldWrapRows,\n });\n\n const node = getNode({ rowIndex, cellIndex });\n\n // can focus\n if (node) {\n node.focus();\n focusedRow.current = rowIndex;\n focusedCell.current = cellIndex;\n }\n };\n\n registerHotKeysHooks(hotKeys, { focusedCell, focusedRow });\n\n const defaultKeyBindings = {\n ArrowUp: runAll(preventDefault, () => focusNextCell(-1, 0)),\n ArrowRight: runAll(preventDefault, () => focusNextCell(0, 1)),\n ArrowDown: runAll(preventDefault, () => focusNextCell(1, 0)),\n ArrowLeft: runAll(preventDefault, () => focusNextCell(0, -1)),\n Home: runAll(preventDefault, e => {\n let rowIndex = focusedRow.current;\n if (e.ctrlKey) {\n rowIndex = 0;\n }\n focusNextCell(0, 0, { rowIndex, cellIndex: 0 });\n }),\n End: runAll(preventDefault, e => {\n let rowIndex = focusedRow.current;\n if (e.ctrlKey) {\n rowIndex = grid.current.length - 1;\n }\n focusNextCell(0, 0, { rowIndex, cellIndex: grid.current[0].length - 1 });\n }),\n ...keyBindings,\n };\n const nextKeyBindings = isFunction(keyBindings)\n ? keyBindings({\n defaultBindings: defaultKeyBindings,\n rowIndex: focusedRow.current,\n cellIndex: focusedCell.current,\n })\n : { ...defaultKeyBindings, ...keyBindings };\n\n const onKeyDown = e => {\n if (e.target.tagName.toLowerCase() === 'input') return;\n const action = nextKeyBindings[e.key];\n if (isFunction(action)) action(e);\n };\n\n const activate = container => {\n container.addEventListener('keydown', onKeyDown, true);\n };\n\n const deactivate = container => {\n container.removeEventListener('keydown', onKeyDown, true);\n };\n\n useEffect(() => {\n activate(containerRef.current);\n return () => {\n deactivate(containerRef.current);\n };\n }, []);\n\n const valueProvider = useMemo(\n () => ({\n register,\n }),\n [],\n );\n\n return <Provider value={valueProvider}>{decoratedChild}</Provider>;\n};\n\nexport { FocusGridProvider, FocusGridProvider as FocusGrid, FocusGridContext };\nexport default FocusGridProvider;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAEA,MAAM,mBAAmB,cAAc;AACvC,MAAM,EAAE,aAAa;AAErB,MAAM,iBAAiB,OAAK,EAAE,eAAe;AAE7C,8BAA8B,SAAS,EAAE,YAAY,eAAe;AAClE,SAAO,KAAK,OAAO,EAAE,QAAQ,SAAO;AAClC,UAAM,EAAE,SAAS,YAAY,QAAQ;AACrC,eAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS,OAAK;AACZ,UAAE,eAAe;AACjB,gBAAQ;AAAA,UACN,UAAU,WAAW;AAAA,UACrB,WAAW,YAAY;AAAA,QACzB,CAAC;AAAA,MACH;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AAGA,MAAM,oBAAoB,CAAC;AAAA,EACzB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,gBAAgB;AA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AAG,YAAY;AAE5C,QAAM,YAAY,OAAK;AACrB,QAAI,EAAE,OAAO,QAAQ,YAAY,MAAM;AAAS;AAChD,UAAM,SAAS,gBAAgB,EAAE;AACjC,QAAI,WAAW,MAAM;AAAG,aAAO,CAAC;AAAA,EAClC;AAEA,QAAM,WAAW,eAAa;AAC5B,cAAU,iBAAiB,WAAW,WAAW,IAAI;AAAA,EACvD;AAEA,QAAM,aAAa,eAAa;AAC9B,cAAU,oBAAoB,WAAW,WAAW,IAAI;AAAA,EAC1D;AAEA,YAAU,MAAM;AACd,aAAS,aAAa,OAAO;AAC7B,WAAO,MAAM;AACX,iBAAW,aAAa,OAAO;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,gBAAgB,QACpB,MAAO;AAAA,IACL;AAAA,EACF,IACA,CAAC,CACH;AAEA,SAAO,qCAAC;AAAA,IAAS,OAAO;AAAA,KAAgB,cAAe;AACzD;AAGA,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
import { isFunction, get } from "@elliemae/ds-utilities";
|
|
20
4
|
import hotkeys from "hotkeys-js";
|
|
@@ -37,7 +21,7 @@ const registerHotkeys = (hotKeys = {}, params, getContainer = () => document) =>
|
|
|
37
21
|
e.preventDefault();
|
|
38
22
|
handler(handlerParams);
|
|
39
23
|
};
|
|
40
|
-
hotkeys(hotkey,
|
|
24
|
+
hotkeys(hotkey, { element: getContainer(), ...options }, parameterizedHandler);
|
|
41
25
|
});
|
|
42
26
|
};
|
|
43
27
|
const unregisterHotKeys = (hotKeys = {}) => {
|
|
@@ -49,9 +33,9 @@ const noop = () => null;
|
|
|
49
33
|
class FocusGroup {
|
|
50
34
|
constructor(options = {}) {
|
|
51
35
|
this.items = [];
|
|
52
|
-
this.options =
|
|
36
|
+
this.options = { ...defaultOptions, ...options };
|
|
53
37
|
const { orientation } = this.options;
|
|
54
|
-
this.keyBindings =
|
|
38
|
+
this.keyBindings = {
|
|
55
39
|
ArrowUp: orientation !== "horizontal" && "previous",
|
|
56
40
|
ArrowRight: orientation !== "vertical" && "next",
|
|
57
41
|
ArrowDown: orientation !== "horizontal" && "next",
|
|
@@ -60,8 +44,9 @@ class FocusGroup {
|
|
|
60
44
|
End: "last",
|
|
61
45
|
PageUp: "first",
|
|
62
46
|
PageDown: "last",
|
|
63
|
-
Escape: "exit"
|
|
64
|
-
|
|
47
|
+
Escape: "exit",
|
|
48
|
+
...options.keyBindings
|
|
49
|
+
};
|
|
65
50
|
this.currentFocusedItem = null;
|
|
66
51
|
this.currIndex = null;
|
|
67
52
|
this.mapActions = {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/FocusGroup.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-param-reassign */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { isFunction, get } from '@elliemae/ds-utilities';\nimport hotkeys from 'hotkeys-js';\n\nconst defaultOptions = {\n orientation: 'vertical',\n};\n\nconst safeCallAction = (e, fun, ...args) => {\n if (isFunction(fun)) {\n e.preventDefault();\n fun(...args);\n }\n};\n\nconst registerHotkeys = (hotKeys = {}, params, getContainer = () => document) => {\n Object.keys(hotKeys).forEach((hotkey) => {\n const { options, handler, allowDocumentHandler = false } = hotKeys[hotkey];\n const parameterizedHandler = (e) => {\n const handlerParams = isFunction(params) ? params() : params;\n if (!allowDocumentHandler && handlerParams.item !== document.activeElement) return;\n e.preventDefault();\n handler(handlerParams);\n };\n hotkeys(hotkey, { element: getContainer(), ...options }, parameterizedHandler);\n });\n};\n\nconst unregisterHotKeys = (hotKeys = {}) => {\n Object.keys(hotKeys).forEach((hotkey) => {\n hotkeys.unbind(hotkey);\n });\n};\n\nconst noop = () => null;\n\nclass FocusGroup {\n items = [];\n\n constructor(options = {}) {\n this.options = { ...defaultOptions, ...options };\n\n const { orientation } = this.options;\n\n this.keyBindings = {\n ArrowUp: orientation !== 'horizontal' && 'previous',\n ArrowRight: orientation !== 'vertical' && 'next',\n ArrowDown: orientation !== 'horizontal' && 'next',\n ArrowLeft: orientation !== 'vertical' && 'previous',\n Home: 'first',\n End: 'last',\n PageUp: 'first',\n PageDown: 'last',\n Escape: 'exit',\n ...options.keyBindings,\n };\n\n this.currentFocusedItem = null;\n this.currIndex = null;\n\n this.mapActions = {\n previous: this.focusPrevious.bind(this),\n next: this.focusNext.bind(this),\n first: this.focusFirst.bind(this),\n last: this.focusLast.bind(this),\n exit: this.exit.bind(this),\n enter: () => null,\n };\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.register = this.register.bind(this);\n this.focusFirst = this.focusFirst.bind(this);\n this.focusLast = this.focusLast.bind(this);\n this.isGroupActive = this.isGroupActive.bind(this);\n this.focusNext = this.focusNext.bind(this);\n this.focusPrevious = this.focusPrevious.bind(this);\n this.focusItem = this.focusItem.bind(this);\n this.focusCurrent = this.focusCurrent.bind(this);\n this.getHotKeysParams = this.getHotKeysParams.bind(this);\n this.activate = this.activate.bind(this);\n this.deactivate = this.deactivate.bind(this);\n this.executeActionByEvent = this.executeActionByEvent.bind(this);\n this.unregister = this.unregister.bind(this);\n this.exit = this.exit.bind(this);\n this.focusByNode = this.focusByNode.bind(this);\n this.focusByIndex = this.focusByIndex.bind(this);\n this.focusNextGroup = this.focusNextGroup.bind(this);\n this.focusPreviousGroup = this.focusPreviousGroup.bind(this);\n this.getNextItem = this.getNextItem.bind(this);\n this.getPreviousItem = this.getPreviousItem.bind(this);\n this.checkCanFocusNext = this.checkCanFocusNext.bind(this);\n this.getItemByIndex = this.getItemByIndex.bind(this);\n this.getItemIndexByNode = this.getItemIndexByNode.bind(this);\n this.getFocusedIndex = this.getFocusedIndex.bind(this);\n this.getFocusedItem = this.getFocusedItem.bind(this);\n this.getFirstItem = this.getFirstItem.bind(this);\n this.getLastItem = this.getLastItem.bind(this);\n }\n\n getHotKeysParams() {\n const item = this.currentFocusedItem;\n const { index } = get(item, ['dataset'], {});\n return {\n item,\n index,\n };\n }\n\n activate() {\n const { getContainer } = this.options;\n document.addEventListener('keydown', this.handleKeyDown, true);\n registerHotkeys(this.options.hotKeys, this.getHotKeysParams, getContainer);\n }\n\n deactivate() {\n document.removeEventListener('keydown', this.handleKeyDown, true);\n unregisterHotKeys(this.options.hotKeys);\n }\n\n handleKeyDown(e) {\n if (!this.isGroupActive()) return;\n this.executeActionByEvent(e);\n }\n\n executeActionByEvent(e) {\n const actions = Array.isArray(this.keyBindings[e.key]) ? this.keyBindings[e.key] : [this.keyBindings[e.key]];\n return actions.map((action) =>\n typeof action === 'string' ? safeCallAction(e, this.mapActions[action]) : safeCallAction(e, action),\n );\n }\n\n register(node, props = {}) {\n const afterIndex = this.items.findIndex(\n (item) => item.compareDocumentPosition(node) === Node.DOCUMENT_POSITION_PRECEDING,\n );\n node.specialOnFocus = props.onFocus || noop;\n node.specialOnBlur = props.onBlur || noop;\n node.onclick = () => this.focusItem(node);\n node.onfocus = () => {\n this.focusItem(node);\n };\n if (afterIndex === -1) {\n this.items.push(node);\n } else {\n this.items.splice(afterIndex, 0, node);\n }\n }\n\n unregister(node) {\n const index = this.getItemIndexByNode(node);\n if (index > -1) this.items.splice(index, 1);\n }\n\n exit() {\n const { onExitFocusGroup } = this.options;\n onExitFocusGroup();\n }\n\n focusItem(node) {\n if (this.currentFocusedItem && this.currentFocusedItem !== node) {\n this.currentFocusedItem.specialOnBlur();\n this.currentFocusedItem.setAttribute('tabindex', -1);\n }\n if (!node) return;\n this.currentFocusedItem = node;\n node.setAttribute('tabindex', 0);\n node.focus();\n node.specialOnFocus();\n }\n\n focusNext() {\n const item = this.getNextItem();\n this.focusItem(item);\n }\n\n focusByNode(node) {\n const index = this.getItemIndexByNode(node);\n this.focusByIndex(index);\n }\n\n focusByIndex(index) {\n const item = this.getItemByIndex(index);\n this.focusItem(item);\n }\n\n focusPrevious() {\n const prevItem = this.getPreviousItem();\n this.focusItem(prevItem);\n }\n\n focusFirst() {\n const item = this.getFirstItem();\n this.focusItem(item);\n }\n\n focusLast() {\n const item = this.getLastItem();\n this.focusItem(item);\n }\n\n focusCurrent() {\n this.focusItem(this.currentFocusedItem);\n }\n\n focusNextGroup() {\n const { onFocusNextGroup } = this.options;\n this.exit();\n onFocusNextGroup();\n }\n\n focusPreviousGroup() {\n const { onFocusPreviousGroup } = this.options;\n this.exit();\n onFocusPreviousGroup();\n }\n\n getNextItem() {\n const { loop } = this.options;\n const currentIndex = this.getFocusedIndex();\n const supposedNextIndex = currentIndex + 1;\n if (!this.checkCanFocusNext(supposedNextIndex)) {\n return loop ? this.getFirstItem() : this.focusNextGroup();\n }\n return this.getItemByIndex(supposedNextIndex);\n }\n\n getPreviousItem() {\n const { loop } = this.options;\n const currentIndex = this.getFocusedIndex();\n const supposedPrevIndex = currentIndex - 1;\n if (!this.checkCanFocusPrev(supposedPrevIndex)) {\n return loop ? this.getLastItem() : this.focusPreviousGroup();\n }\n return this.getItemByIndex(supposedPrevIndex);\n }\n\n checkCanFocusNext(index) {\n return this.items.length > index;\n }\n\n checkCanFocusPrev(index) {\n return index >= 0;\n }\n\n getItemByIndex(index) {\n return this.items[index];\n }\n\n getItemIndexByNode(node) {\n return this.items.findIndex((item) => item === node);\n }\n\n getFocusedIndex() {\n return this.getItemIndexByNode(document.activeElement);\n }\n\n getFocusedItem() {\n const index = this.getFocusedIndex();\n return index > -1 && this.items[index];\n }\n\n isGroupActive() {\n return this.getFocusedIndex() !== -1;\n }\n\n getFirstItem() {\n return !!this.items.length && this.items[0];\n }\n\n getLastItem() {\n return !!this.items.length && this.items[this.items.length - 1];\n }\n}\n\nexport { FocusGroup };\nexport default FocusGroup;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACGA;AACA;AAEA,MAAM,iBAAiB;AAAA,EACrB,aAAa;AACf;AAEA,MAAM,iBAAiB,CAAC,GAAG,QAAQ,SAAS;AAC1C,MAAI,WAAW,GAAG,GAAG;AACnB,MAAE,eAAe;AACjB,QAAI,GAAG,IAAI;AAAA,EACb;AACF;AAEA,MAAM,kBAAkB,CAAC,UAAU,CAAC,GAAG,QAAQ,eAAe,MAAM,aAAa;AAC/E,SAAO,KAAK,OAAO,EAAE,QAAQ,CAAC,WAAW;AACvC,UAAM,EAAE,SAAS,SAAS,uBAAuB,UAAU,QAAQ;AACnE,UAAM,uBAAuB,CAAC,MAAM;AAClC,YAAM,gBAAgB,WAAW,MAAM,IAAI,OAAO,IAAI;AACtD,UAAI,CAAC,wBAAwB,cAAc,SAAS,SAAS;AAAe;AAC5E,QAAE,eAAe;AACjB,cAAQ,aAAa;AAAA,IACvB;AACA,YAAQ,QAAQ,EAAE,SAAS,aAAa,GAAG,GAAG,QAAQ,GAAG,oBAAoB;AAAA,EAC/E,CAAC;AACH;AAEA,MAAM,oBAAoB,CAAC,UAAU,CAAC,MAAM;AAC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AE,SAAS,KAAK;AACtB,UAAM,eAAe,KAAK,gBAAgB;AAC1C,UAAM,oBAAoB,eAAe;AACzC,QAAI,CAAC,KAAK,kBAAkB,iBAAiB,GAAG;AAC9C,aAAO,OAAO,KAAK,YAAY,IAAI,KAAK,mBAAmB;AAAA,IAC7D;AACA,WAAO,KAAK,eAAe,iBAAiB;AAAA,EAC9C;AAAA,EAEA,kBAAkB,OAAO;AACvB,WAAO,KAAK,MAAM,SAAS;AAAA,EAC7B;AAAA,EAEA,kBAAkB,OAAO;AACvB,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,eAAe,OAAO;AACpB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAEA,mBAAmB,MAAM;AACvB,WAAO,KAAK,MAAM,UAAU,CAAC,SAAS,SAAS,IAAI;AAAA,EACrD;AAAA,EAEA,kBAAkB;AAChB,WAAO,KAAK,mBAAmB,SAAS,aAAa;AAAA,EACvD;AAAA,EAEA,iBAAiB;AACf,UAAM,QAAQ,KAAK,gBAAgB;AACnC,WAAO,QAAQ,MAAM,KAAK,MAAM;AAAA,EAClC;AAAA,EAEA,gBAAgB;AACd,WAAO,KAAK,gBAAgB,MAAM;AAAA,EACpC;AAAA,EAEA,eAAe;AACb,WAAO,CAAC,CAAC,KAAK,MAAM,UAAU,KAAK,MAAM;AAAA,EAC3C;AAAA,EAEA,cAAc;AACZ,WAAO,CAAC,CAAC,KAAK,MAAM,UAAU,KAAK,MAAM,KAAK,MAAM,SAAS;AAAA,EAC/D;AACF;AAGA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,52 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
var __objRest = (source, exclude) => {
|
|
19
|
-
var target = {};
|
|
20
|
-
for (var prop in source)
|
|
21
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
22
|
-
target[prop] = source[prop];
|
|
23
|
-
if (source != null && __getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
25
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
};
|
|
30
2
|
import * as React from "react";
|
|
31
3
|
import React2 from "react";
|
|
32
4
|
import { FocusGroupProvider } from "./FocusGroupManager";
|
|
33
5
|
function FocusGroupHoc(WrappedComponent, options = {}) {
|
|
34
|
-
return (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, options), /* @__PURE__ */ React2.createElement(WrappedComponent, __spreadValues(__spreadValues({}, props), options)));
|
|
49
|
-
};
|
|
6
|
+
return ({
|
|
7
|
+
onExitFocusGroup,
|
|
8
|
+
onFocusPrevGroup,
|
|
9
|
+
focusKeyBindings,
|
|
10
|
+
...props
|
|
11
|
+
}) => /* @__PURE__ */ React2.createElement(FocusGroupProvider, {
|
|
12
|
+
keyBindings: focusKeyBindings,
|
|
13
|
+
onExitFocusGroup,
|
|
14
|
+
onFocusPrevGroup,
|
|
15
|
+
...options
|
|
16
|
+
}, /* @__PURE__ */ React2.createElement(WrappedComponent, {
|
|
17
|
+
...props,
|
|
18
|
+
...options
|
|
19
|
+
}));
|
|
50
20
|
}
|
|
51
21
|
var focusGroupManagerHoc_default = FocusGroupHoc;
|
|
52
22
|
export {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/focusGroupManagerHoc.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AACA;AAEA,uBAAuB,kBAAkB,UAAU,CAAC,GAAG;AACrD,SAAO,CAAC;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,OACG;AAAA,QAEH,qCAAC;AAAA,IACC,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACC,GAAG;AAAA,KAEJ,qCAAC;AAAA,IAAkB,GAAG;AAAA,IAAQ,GAAG;AAAA,GAAS,CAC5C;AAEJ;AAGA,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __objRest = (source, exclude) => {
|
|
6
|
-
var target = {};
|
|
7
|
-
for (var prop in source)
|
|
8
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
9
|
-
target[prop] = source[prop];
|
|
10
|
-
if (source != null && __getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
12
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
13
|
-
target[prop] = source[prop];
|
|
14
|
-
}
|
|
15
|
-
return target;
|
|
16
|
-
};
|
|
17
2
|
import * as React from "react";
|
|
18
3
|
import { useContext, useEffect } from "react";
|
|
19
4
|
import { FocusGroupContext } from "./FocusGroupContext";
|
|
20
5
|
function useFocusGroupItem(ref = {}, props) {
|
|
21
|
-
const
|
|
6
|
+
const { register, unregister, ...otherActions } = useContext(FocusGroupContext) || {};
|
|
22
7
|
useEffect(() => {
|
|
23
8
|
if (ref.current && register)
|
|
24
9
|
register(ref.current, props);
|
|
@@ -32,7 +17,7 @@ function useFocusGroupItem(ref = {}, props) {
|
|
|
32
17
|
return otherActions;
|
|
33
18
|
}
|
|
34
19
|
const useFocusGroupWithState = (ref = {}, props) => {
|
|
35
|
-
const
|
|
20
|
+
const { register, unregister, ...otherActions } = useContext(FocusGroupContext) || {};
|
|
36
21
|
useEffect(() => {
|
|
37
22
|
if (ref && register)
|
|
38
23
|
register(ref, props);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FocusGroup/useFocusGroupItem.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AAEA,2BAA2B,MAAM,CAAC,GAAG,OAAO;AAC1C,QAAM,EAAE,UAAU,eAAe,iBAC/B,WAAW,iBAAiB,KAAK,CAAC;AAEpC,YAAU,MAAM;AACd,QAAI,IAAI,WAAW;AAAU,eAAS,IAAI,SAAS,KAAK;AACxD,WAAO,MAAM;AACX,UAAI,IAAI,WAAW;AAAY,mBAAW,IAAI,OAAO;AAAA,IACvD;AAAA,EACF,CAAC;AAGD,MAAI,CAAC;AAAU,WAAO,CAAC;AACvB,SAAO;AACT;AAEO,MAAM,yBAAyB,CAAC,MAAM,CAAC,GAAG,UAAU;AACzD,QAAM,EAAE,UAAU,eAAe,iBAC/B,WAAW,iBAAiB,KAAK,CAAC;AAEpC,YAAU,MAAM;AACd,QAAI,OAAO;AAAU,eAAS,KAAK,KAAK;AACxC,WAAO,MAAM;AACX,UAAI,OAAO;AAAY,mBAAW,GAAG;AAAA,IACvC;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAGR,MAAI,CAAC;AAAU,WAAO,CAAC;AACvB,SAAO;AACT;AAGA,IAAO,4BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|