@elliemae/ds-treeview 3.53.0-alpha.1 → 3.53.0-alpha.3
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/parts/CheckboxSelectable.js +2 -2
- package/dist/cjs/parts/CheckboxSelectable.js.map +2 -2
- package/dist/cjs/parts/RadioSelectable.js +6 -6
- package/dist/cjs/parts/RadioSelectable.js.map +3 -3
- package/dist/esm/parts/CheckboxSelectable.js +1 -1
- package/dist/esm/parts/CheckboxSelectable.js.map +1 -1
- package/dist/esm/parts/RadioSelectable.js +5 -5
- package/dist/esm/parts/RadioSelectable.js.map +3 -3
- package/dist/types/TreeViewContext.d.ts +0 -1
- package/dist/types/hoc/DnDTreeContext.d.ts +0 -1
- package/dist/types/hoc/SortableItemContext.d.ts +0 -1
- package/dist/types/parts/CheckboxSelectable.d.ts +0 -1
- package/dist/types/parts/ExpandCaret.d.ts +0 -1
- package/dist/types/parts/Icon.d.ts +0 -1
- package/dist/types/parts/NestingSpace.d.ts +0 -1
- package/dist/types/parts/TreeItem.d.ts +2 -2
- package/dist/types/parts/TreeItemText.d.ts +0 -1
- package/dist/types/parts/TreeList.d.ts +2 -3
- package/dist/types/react-desc-prop-types.d.ts +0 -1
- package/dist/types/utils/group-expands-helpers.d.ts +10 -10
- package/dist/types/utils/keyboard-helpers.d.ts +2 -2
- package/dist/types/utils/refs-helpers.d.ts +0 -1
- package/dist/types/utils/selectable-helper.d.ts +1 -1
- package/dist/types/utils/tree-helpers.d.ts +7 -9
- package/dist/types/utils/useTree.d.ts +0 -1
- package/package.json +17 -15
|
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(CheckboxSelectable_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
|
-
var
|
|
37
|
+
var import_ds_form_checkbox = require("@elliemae/ds-form-checkbox");
|
|
38
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
39
39
|
var import_TreeViewContext = __toESM(require("../TreeViewContext.js"));
|
|
40
40
|
var import_selectable_helper = require("../utils/selectable-helper.js");
|
|
@@ -97,7 +97,7 @@ const CheckboxSelectable = (props) => {
|
|
|
97
97
|
return void 0;
|
|
98
98
|
}, [children, uniqueTreeViewUUID]);
|
|
99
99
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledCheckboxWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
100
|
-
|
|
100
|
+
import_ds_form_checkbox.DSControlledCheckbox,
|
|
101
101
|
{
|
|
102
102
|
checked: isChecked,
|
|
103
103
|
disabled: isDisabled && !applyAriaDisabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/CheckboxSelectable.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useCallback, useMemo } from 'react';\nimport { DSControlledCheckbox } from '@elliemae/ds-
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2EjB;AA3EN,mBAAwD;AACxD,
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useCallback, useMemo } from 'react';\nimport { DSControlledCheckbox } from '@elliemae/ds-form-checkbox';\nimport { styled } from '@elliemae/ds-system';\nimport TreeViewContext from '../TreeViewContext.js';\nimport { toggleCheckboxItem } from '../utils/selectable-helper.js';\nimport { filterObject } from '../utils/object-helpers.js';\nimport type { DSTreeviewT } from '../react-desc-prop-types.js';\nconst StyledCheckboxWrapper = styled.span`\n padding-top: 3px;\n margin-left: 8px;\n`;\ninterface PropsT {\n item: DSTreeviewT.Item;\n itemIndex: number;\n}\nconst CheckboxSelectable = (props: PropsT): JSX.Element | null => {\n const { item, itemIndex } = props;\n const { id, children } = item;\n\n const ctx = useContext(TreeViewContext);\n const {\n props: { onSelectionChange, isItemDisabled, applyAriaDisabled },\n virtualListHelpers: { scrollToIndex },\n triggerTreeRerender,\n selectedCheckboxes,\n setInternallySelectedCheckboxes,\n uniqueTreeViewUUID,\n } = ctx;\n\n const onCheckboxChange = useCallback(() => {\n const newSelections = toggleCheckboxItem(item, selectedCheckboxes);\n const newSelectionHasmap = filterObject<DSTreeviewT.SelectionState>(\n { ...selectedCheckboxes, ...newSelections },\n (value) => value !== false,\n );\n setInternallySelectedCheckboxes(newSelectionHasmap);\n triggerTreeRerender();\n\n const indexAndScrollTo = {\n scrollToItem: () => {\n if (typeof item.virtualIndex === 'number') scrollToIndex(item.virtualIndex);\n },\n itemIndex,\n };\n if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);\n }, [\n item,\n triggerTreeRerender,\n onSelectionChange,\n itemIndex,\n scrollToIndex,\n selectedCheckboxes,\n setInternallySelectedCheckboxes,\n ]);\n const isChecked = useMemo(() => {\n if (selectedCheckboxes[id] === 'mixed') {\n return 'mixed' as const;\n }\n if (selectedCheckboxes[id] === true) {\n return true;\n }\n return false;\n }, [selectedCheckboxes, id]);\n\n const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);\n const ariaControls = useMemo(() => {\n if (children?.length) {\n const childrenIds = children.map((child) => `ds-item-${uniqueTreeViewUUID}-${child.id}`);\n return childrenIds.join(' ');\n }\n return undefined;\n }, [children, uniqueTreeViewUUID]);\n\n return (\n <StyledCheckboxWrapper>\n <DSControlledCheckbox\n checked={isChecked}\n disabled={isDisabled && !applyAriaDisabled}\n applyAriaDisabled={isDisabled && applyAriaDisabled}\n data-testid=\"tree-item-checkbox\"\n aria-controls={ariaControls}\n id={`ds-item-${uniqueTreeViewUUID}-${id}`}\n onChange={onCheckboxChange}\n tabIndex=\"0\"\n />\n </StyledCheckboxWrapper>\n );\n};\n\nexport default CheckboxSelectable;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5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,EACT,GAAG,CAAC,oBAAoB,EAAE,CAAC;AAE3B,QAAM,iBAAa,sBAAQ,MAAM,eAAe,IAAI,GAAG,CAAC,MAAM,cAAc,CAAC;AAC7E,QAAM,mBAAe,sBAAQ,MAAM;AACjC,QAAI,UAAU,QAAQ;AACpB,YAAM,cAAc,SAAS,IAAI,CAAC,UAAU,WAAW,kBAAkB,IAAI,MAAM,EAAE,EAAE;AACvF,aAAO,YAAY,KAAK,GAAG;AAAA,IAC7B;AACA,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,kBAAkB,CAAC;AAEjC,SACE,4CAAC,yBACC;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,UAAU,cAAc,CAAC;AAAA,MACzB,mBAAmB,cAAc;AAAA,MACjC,eAAY;AAAA,MACZ,iBAAe;AAAA,MACf,IAAI,WAAW,kBAAkB,IAAI,EAAE;AAAA,MACvC,UAAU;AAAA,MACV,UAAS;AAAA;AAAA,EACX,GACF;AAEJ;AAEA,IAAO,6BAAQ;",
|
|
6
6
|
"names": ["TreeViewContext"]
|
|
7
7
|
}
|
|
@@ -33,12 +33,12 @@ __export(RadioSelectable_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(RadioSelectable_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var import_ds_form_radio = require("@elliemae/ds-form-radio");
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
38
|
var import_TreeViewContext = __toESM(require("../TreeViewContext.js"));
|
|
39
39
|
const RadioSelectable = (props) => {
|
|
40
40
|
const { item, itemIndex } = props;
|
|
41
|
-
const ctx =
|
|
41
|
+
const ctx = import_react.default.useContext(import_TreeViewContext.default);
|
|
42
42
|
const {
|
|
43
43
|
props: { onSelectionChange, isItemDisabled, applyAriaDisabled },
|
|
44
44
|
virtualListHelpers: { scrollToIndex },
|
|
@@ -46,7 +46,7 @@ const RadioSelectable = (props) => {
|
|
|
46
46
|
setInternallySelectedCheckboxes
|
|
47
47
|
} = ctx;
|
|
48
48
|
const { id } = item;
|
|
49
|
-
const onRadioChange =
|
|
49
|
+
const onRadioChange = import_react.default.useCallback(() => {
|
|
50
50
|
const newSelectionHasmap = { [id]: true };
|
|
51
51
|
setInternallySelectedCheckboxes(newSelectionHasmap);
|
|
52
52
|
const indexAndScrollTo = {
|
|
@@ -57,9 +57,9 @@ const RadioSelectable = (props) => {
|
|
|
57
57
|
};
|
|
58
58
|
if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
|
|
59
59
|
}, [id, setInternallySelectedCheckboxes, itemIndex, onSelectionChange, item, scrollToIndex]);
|
|
60
|
-
const isDisabled =
|
|
60
|
+
const isDisabled = import_react.default.useMemo(() => isItemDisabled(item), [item, isItemDisabled]);
|
|
61
61
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
62
|
-
|
|
62
|
+
import_ds_form_radio.DSControlledRadio,
|
|
63
63
|
{
|
|
64
64
|
checked: selectedCheckboxes[id] === true,
|
|
65
65
|
disabled: isDisabled && !applyAriaDisabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/RadioSelectable.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCnB;AAnCJ,
|
|
6
|
-
"names": ["TreeViewContext"]
|
|
4
|
+
"sourcesContent": ["import { DSControlledRadio } from '@elliemae/ds-form-radio';\nimport React from 'react';\nimport TreeViewContext from '../TreeViewContext.js';\nimport type { DSTreeviewT } from '../react-desc-prop-types.js';\ninterface PropsT {\n item: DSTreeviewT.Item;\n itemIndex: number;\n}\nconst RadioSelectable = (props: PropsT) => {\n const { item, itemIndex } = props;\n\n const ctx = React.useContext(TreeViewContext);\n const {\n props: { onSelectionChange, isItemDisabled, applyAriaDisabled },\n virtualListHelpers: { scrollToIndex },\n selectedCheckboxes,\n setInternallySelectedCheckboxes,\n } = ctx;\n\n const { id } = item;\n\n const onRadioChange = React.useCallback(() => {\n const newSelectionHasmap = { [id]: true };\n setInternallySelectedCheckboxes(newSelectionHasmap);\n const indexAndScrollTo = {\n scrollToItem: () => {\n if (item.virtualIndex) scrollToIndex(item.virtualIndex);\n },\n itemIndex,\n };\n if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);\n }, [id, setInternallySelectedCheckboxes, itemIndex, onSelectionChange, item, scrollToIndex]);\n\n const isDisabled = React.useMemo(() => isItemDisabled(item), [item, isItemDisabled]);\n return (\n <DSControlledRadio\n checked={selectedCheckboxes[id] === true}\n disabled={isDisabled && !applyAriaDisabled}\n applyAriaDisabled={isDisabled && applyAriaDisabled}\n aria-label={item.name}\n className=\"em-ds-tree-item-radio\"\n data-testid=\"tree-item-radio\"\n onChange={onRadioChange}\n tabIndex={0}\n value={id.toString()}\n />\n );\n};\n\nexport default RadioSelectable;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCnB;AAnCJ,2BAAkC;AAClC,mBAAkB;AAClB,6BAA4B;AAM5B,MAAM,kBAAkB,CAAC,UAAkB;AACzC,QAAM,EAAE,MAAM,UAAU,IAAI;AAE5B,QAAM,MAAM,aAAAA,QAAM,WAAW,uBAAAC,OAAe;AAC5C,QAAM;AAAA,IACJ,OAAO,EAAE,mBAAmB,gBAAgB,kBAAkB;AAAA,IAC9D,oBAAoB,EAAE,cAAc;AAAA,IACpC;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,EAAE,GAAG,IAAI;AAEf,QAAM,gBAAgB,aAAAD,QAAM,YAAY,MAAM;AAC5C,UAAM,qBAAqB,EAAE,CAAC,EAAE,GAAG,KAAK;AACxC,oCAAgC,kBAAkB;AAClD,UAAM,mBAAmB;AAAA,MACvB,cAAc,MAAM;AAClB,YAAI,KAAK,aAAc,eAAc,KAAK,YAAY;AAAA,MACxD;AAAA,MACA;AAAA,IACF;AACA,QAAI,kBAAmB,mBAAkB,oBAAoB,MAAM,gBAAgB;AAAA,EACrF,GAAG,CAAC,IAAI,iCAAiC,WAAW,mBAAmB,MAAM,aAAa,CAAC;AAE3F,QAAM,aAAa,aAAAA,QAAM,QAAQ,MAAM,eAAe,IAAI,GAAG,CAAC,MAAM,cAAc,CAAC;AACnF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,mBAAmB,EAAE,MAAM;AAAA,MACpC,UAAU,cAAc,CAAC;AAAA,MACzB,mBAAmB,cAAc;AAAA,MACjC,cAAY,KAAK;AAAA,MACjB,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,UAAU;AAAA,MACV,UAAU;AAAA,MACV,OAAO,GAAG,SAAS;AAAA;AAAA,EACrB;AAEJ;AAEA,IAAO,0BAAQ;",
|
|
6
|
+
"names": ["React", "TreeViewContext"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useCallback, useMemo } from "react";
|
|
4
|
-
import { DSControlledCheckbox } from "@elliemae/ds-
|
|
4
|
+
import { DSControlledCheckbox } from "@elliemae/ds-form-checkbox";
|
|
5
5
|
import { styled } from "@elliemae/ds-system";
|
|
6
6
|
import TreeViewContext from "../TreeViewContext.js";
|
|
7
7
|
import { toggleCheckboxItem } from "../utils/selectable-helper.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/CheckboxSelectable.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useMemo } from 'react';\nimport { DSControlledCheckbox } from '@elliemae/ds-
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useMemo } from 'react';\nimport { DSControlledCheckbox } from '@elliemae/ds-form-checkbox';\nimport { styled } from '@elliemae/ds-system';\nimport TreeViewContext from '../TreeViewContext.js';\nimport { toggleCheckboxItem } from '../utils/selectable-helper.js';\nimport { filterObject } from '../utils/object-helpers.js';\nimport type { DSTreeviewT } from '../react-desc-prop-types.js';\nconst StyledCheckboxWrapper = styled.span`\n padding-top: 3px;\n margin-left: 8px;\n`;\ninterface PropsT {\n item: DSTreeviewT.Item;\n itemIndex: number;\n}\nconst CheckboxSelectable = (props: PropsT): JSX.Element | null => {\n const { item, itemIndex } = props;\n const { id, children } = item;\n\n const ctx = useContext(TreeViewContext);\n const {\n props: { onSelectionChange, isItemDisabled, applyAriaDisabled },\n virtualListHelpers: { scrollToIndex },\n triggerTreeRerender,\n selectedCheckboxes,\n setInternallySelectedCheckboxes,\n uniqueTreeViewUUID,\n } = ctx;\n\n const onCheckboxChange = useCallback(() => {\n const newSelections = toggleCheckboxItem(item, selectedCheckboxes);\n const newSelectionHasmap = filterObject<DSTreeviewT.SelectionState>(\n { ...selectedCheckboxes, ...newSelections },\n (value) => value !== false,\n );\n setInternallySelectedCheckboxes(newSelectionHasmap);\n triggerTreeRerender();\n\n const indexAndScrollTo = {\n scrollToItem: () => {\n if (typeof item.virtualIndex === 'number') scrollToIndex(item.virtualIndex);\n },\n itemIndex,\n };\n if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);\n }, [\n item,\n triggerTreeRerender,\n onSelectionChange,\n itemIndex,\n scrollToIndex,\n selectedCheckboxes,\n setInternallySelectedCheckboxes,\n ]);\n const isChecked = useMemo(() => {\n if (selectedCheckboxes[id] === 'mixed') {\n return 'mixed' as const;\n }\n if (selectedCheckboxes[id] === true) {\n return true;\n }\n return false;\n }, [selectedCheckboxes, id]);\n\n const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);\n const ariaControls = useMemo(() => {\n if (children?.length) {\n const childrenIds = children.map((child) => `ds-item-${uniqueTreeViewUUID}-${child.id}`);\n return childrenIds.join(' ');\n }\n return undefined;\n }, [children, uniqueTreeViewUUID]);\n\n return (\n <StyledCheckboxWrapper>\n <DSControlledCheckbox\n checked={isChecked}\n disabled={isDisabled && !applyAriaDisabled}\n applyAriaDisabled={isDisabled && applyAriaDisabled}\n data-testid=\"tree-item-checkbox\"\n aria-controls={ariaControls}\n id={`ds-item-${uniqueTreeViewUUID}-${id}`}\n onChange={onCheckboxChange}\n tabIndex=\"0\"\n />\n </StyledCheckboxWrapper>\n );\n};\n\nexport default CheckboxSelectable;\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;AC2EjB;AA3EN,SAAgB,YAAY,aAAa,eAAe;AACxD,SAAS,4BAA4B;AACrC,SAAS,cAAc;AACvB,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAE7B,MAAM,wBAAwB,OAAO;AAAA;AAAA;AAAA;AAQrC,MAAM,qBAAqB,CAAC,UAAsC;AAChE,QAAM,EAAE,MAAM,UAAU,IAAI;AAC5B,QAAM,EAAE,IAAI,SAAS,IAAI;AAEzB,QAAM,MAAM,WAAW,eAAe;AACtC,QAAM;AAAA,IACJ,OAAO,EAAE,mBAAmB,gBAAgB,kBAAkB;AAAA,IAC9D,oBAAoB,EAAE,cAAc;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,mBAAmB,YAAY,MAAM;AACzC,UAAM,gBAAgB,mBAAmB,MAAM,kBAAkB;AACjE,UAAM,qBAAqB;AAAA,MACzB,EAAE,GAAG,oBAAoB,GAAG,cAAc;AAAA,MAC1C,CAAC,UAAU,UAAU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|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { DSControlledRadio } from "@elliemae/ds-form-radio";
|
|
4
|
+
import React2 from "react";
|
|
5
5
|
import TreeViewContext from "../TreeViewContext.js";
|
|
6
6
|
const RadioSelectable = (props) => {
|
|
7
7
|
const { item, itemIndex } = props;
|
|
8
|
-
const ctx = useContext(TreeViewContext);
|
|
8
|
+
const ctx = React2.useContext(TreeViewContext);
|
|
9
9
|
const {
|
|
10
10
|
props: { onSelectionChange, isItemDisabled, applyAriaDisabled },
|
|
11
11
|
virtualListHelpers: { scrollToIndex },
|
|
@@ -13,7 +13,7 @@ const RadioSelectable = (props) => {
|
|
|
13
13
|
setInternallySelectedCheckboxes
|
|
14
14
|
} = ctx;
|
|
15
15
|
const { id } = item;
|
|
16
|
-
const onRadioChange = useCallback(() => {
|
|
16
|
+
const onRadioChange = React2.useCallback(() => {
|
|
17
17
|
const newSelectionHasmap = { [id]: true };
|
|
18
18
|
setInternallySelectedCheckboxes(newSelectionHasmap);
|
|
19
19
|
const indexAndScrollTo = {
|
|
@@ -24,7 +24,7 @@ const RadioSelectable = (props) => {
|
|
|
24
24
|
};
|
|
25
25
|
if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
|
|
26
26
|
}, [id, setInternallySelectedCheckboxes, itemIndex, onSelectionChange, item, scrollToIndex]);
|
|
27
|
-
const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);
|
|
27
|
+
const isDisabled = React2.useMemo(() => isItemDisabled(item), [item, isItemDisabled]);
|
|
28
28
|
return /* @__PURE__ */ jsx(
|
|
29
29
|
DSControlledRadio,
|
|
30
30
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/RadioSelectable.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACmCnB;AAnCJ,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSControlledRadio } from '@elliemae/ds-form-radio';\nimport React from 'react';\nimport TreeViewContext from '../TreeViewContext.js';\nimport type { DSTreeviewT } from '../react-desc-prop-types.js';\ninterface PropsT {\n item: DSTreeviewT.Item;\n itemIndex: number;\n}\nconst RadioSelectable = (props: PropsT) => {\n const { item, itemIndex } = props;\n\n const ctx = React.useContext(TreeViewContext);\n const {\n props: { onSelectionChange, isItemDisabled, applyAriaDisabled },\n virtualListHelpers: { scrollToIndex },\n selectedCheckboxes,\n setInternallySelectedCheckboxes,\n } = ctx;\n\n const { id } = item;\n\n const onRadioChange = React.useCallback(() => {\n const newSelectionHasmap = { [id]: true };\n setInternallySelectedCheckboxes(newSelectionHasmap);\n const indexAndScrollTo = {\n scrollToItem: () => {\n if (item.virtualIndex) scrollToIndex(item.virtualIndex);\n },\n itemIndex,\n };\n if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);\n }, [id, setInternallySelectedCheckboxes, itemIndex, onSelectionChange, item, scrollToIndex]);\n\n const isDisabled = React.useMemo(() => isItemDisabled(item), [item, isItemDisabled]);\n return (\n <DSControlledRadio\n checked={selectedCheckboxes[id] === true}\n disabled={isDisabled && !applyAriaDisabled}\n applyAriaDisabled={isDisabled && applyAriaDisabled}\n aria-label={item.name}\n className=\"em-ds-tree-item-radio\"\n data-testid=\"tree-item-radio\"\n onChange={onRadioChange}\n tabIndex={0}\n value={id.toString()}\n />\n );\n};\n\nexport default RadioSelectable;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACmCnB;AAnCJ,SAAS,yBAAyB;AAClC,OAAOA,YAAW;AAClB,OAAO,qBAAqB;AAM5B,MAAM,kBAAkB,CAAC,UAAkB;AACzC,QAAM,EAAE,MAAM,UAAU,IAAI;AAE5B,QAAM,MAAMA,OAAM,WAAW,eAAe;AAC5C,QAAM;AAAA,IACJ,OAAO,EAAE,mBAAmB,gBAAgB,kBAAkB;AAAA,IAC9D,oBAAoB,EAAE,cAAc;AAAA,IACpC;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,EAAE,GAAG,IAAI;AAEf,QAAM,gBAAgBA,OAAM,YAAY,MAAM;AAC5C,UAAM,qBAAqB,EAAE,CAAC,EAAE,GAAG,KAAK;AACxC,oCAAgC,kBAAkB;AAClD,UAAM,mBAAmB;AAAA,MACvB,cAAc,MAAM;AAClB,YAAI,KAAK,aAAc,eAAc,KAAK,YAAY;AAAA,MACxD;AAAA,MACA;AAAA,IACF;AACA,QAAI,kBAAmB,mBAAkB,oBAAoB,MAAM,gBAAgB;AAAA,EACrF,GAAG,CAAC,IAAI,iCAAiC,WAAW,mBAAmB,MAAM,aAAa,CAAC;AAE3F,QAAM,aAAaA,OAAM,QAAQ,MAAM,eAAe,IAAI,GAAG,CAAC,MAAM,cAAc,CAAC;AACnF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,mBAAmB,EAAE,MAAM;AAAA,MACpC,UAAU,cAAc,CAAC;AAAA,MACzB,mBAAmB,cAAc;AAAA,MACjC,cAAY,KAAK;AAAA,MACjB,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,UAAU;AAAA,MACV,UAAU;AAAA,MACV,OAAO,GAAG,SAAS;AAAA;AAAA,EACrB;AAEJ;AAEA,IAAO,0BAAQ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { DSTreeviewT } from '../react-desc-prop-types.js';
|
|
3
|
-
export declare const TreeListItem: React.ComponentType<React.
|
|
4
|
-
export declare const TreeListItemAddonsWrapper: React.ComponentType<React.
|
|
3
|
+
export declare const TreeListItem: React.ComponentType<React.ComponentProps<"li">>;
|
|
4
|
+
export declare const TreeListItemAddonsWrapper: React.ComponentType<React.ComponentProps<"div">>;
|
|
5
5
|
interface PropsT {
|
|
6
6
|
item: DSTreeviewT.Item;
|
|
7
7
|
itemIndex: number;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import type { DSTreeviewT } from '../react-desc-prop-types.js';
|
|
4
3
|
export declare const treeListNoItemsBn = "tree-list-no-items";
|
|
5
|
-
export declare const TreeListNoItems: React.ComponentType<React.
|
|
4
|
+
export declare const TreeListNoItems: React.ComponentType<React.ComponentProps<"div">>;
|
|
6
5
|
export declare const TreeListWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, {
|
|
7
|
-
$removeWidthMaxContent?: boolean
|
|
6
|
+
$removeWidthMaxContent?: boolean;
|
|
8
7
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
|
9
8
|
interface PropsT {
|
|
10
9
|
onMouseDragOverItem?: (opts: {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { DSTreeviewT } from '../react-desc-prop-types.js';
|
|
2
2
|
import type { DSTreeviewInternalsT } from '../sharedTypes.js';
|
|
3
|
-
export declare const updateExpandedState: (treeRoot: DSTreeviewT.Item[
|
|
4
|
-
export declare const toggleItemExpand: (itemToToggle: DSTreeviewT.Item, triggerTreeRerender: () => void, updateUserExpandedState: DSTreeviewInternalsT.CTX[
|
|
5
|
-
export declare const expandItemModel: (modelToExpand: DSTreeviewT.Item[
|
|
6
|
-
export declare const collapseItemModel: (modelToCollapse: DSTreeviewT.Item[
|
|
7
|
-
export declare const expandAll: (treeRoot: DSTreeviewT.Item[
|
|
8
|
-
export declare const collapseAll: (treeRoot: DSTreeviewT.Item[
|
|
9
|
-
export declare const getToggleExpandShouldExpand: (treeRoot: DSTreeviewT.Item[
|
|
10
|
-
export declare const toggleExpandAllHelper: (isExpand: boolean |
|
|
3
|
+
export declare const updateExpandedState: (treeRoot: DSTreeviewT.Item["node"], onExpandChange: DSTreeviewT.Props["onExpandChange"] | null | undefined) => void;
|
|
4
|
+
export declare const toggleItemExpand: (itemToToggle: DSTreeviewT.Item, triggerTreeRerender: () => void, updateUserExpandedState: DSTreeviewInternalsT.CTX["updateUserExpandedState"], scrollTo?: DSTreeviewT.ScrollToFunc) => void;
|
|
5
|
+
export declare const expandItemModel: (modelToExpand: DSTreeviewT.Item["model"]) => void;
|
|
6
|
+
export declare const collapseItemModel: (modelToCollapse: DSTreeviewT.Item["model"]) => void;
|
|
7
|
+
export declare const expandAll: (treeRoot: DSTreeviewT.Item["node"], triggerTreeRerender: () => void) => void;
|
|
8
|
+
export declare const collapseAll: (treeRoot: DSTreeviewT.Item["node"], triggerTreeRerender: () => void) => void;
|
|
9
|
+
export declare const getToggleExpandShouldExpand: (treeRoot: DSTreeviewT.Item["node"]) => boolean;
|
|
10
|
+
export declare const toggleExpandAllHelper: (isExpand: boolean | "toggle", treeRoot: DSTreeviewT.Item["node"], triggerTreeRerender: () => void, setLatestToggledItem: DSTreeviewInternalsT.CTX["setLatestToggledItem"], updateUserExpandedState: DSTreeviewInternalsT.CTX["updateUserExpandedState"]) => void;
|
|
11
11
|
export declare const useNotifyExpandedChange: (propsWithDefaults: DSTreeviewT.Props, { latestToggledItem, expandedGroups, }: {
|
|
12
|
-
latestToggledItem?: DSTreeviewInternalsT.CTX[
|
|
13
|
-
expandedGroups?: DSTreeviewInternalsT.CTX[
|
|
12
|
+
latestToggledItem?: DSTreeviewInternalsT.CTX["latestToggledItem"];
|
|
13
|
+
expandedGroups?: DSTreeviewInternalsT.CTX["expandedGroups"];
|
|
14
14
|
}) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DSTreeviewT } from '../react-desc-prop-types.js';
|
|
2
2
|
import type { DSTreeviewInternalsT } from '../sharedTypes.js';
|
|
3
3
|
import type { SortableItemContextType } from '../hoc/SortableItemContext.js';
|
|
4
|
-
export declare const useOnItemKeyDown: (item: DSTreeviewT.Item, draggableProps: SortableItemContextType[
|
|
4
|
+
export declare const useOnItemKeyDown: (item: DSTreeviewT.Item, draggableProps: SortableItemContextType["draggableProps"]) => (e: React.KeyboardEvent<HTMLLIElement>) => void;
|
|
5
5
|
export declare const useGlobalKeyboardListener: (func: (e: KeyboardEvent) => void) => void;
|
|
6
|
-
export declare const useGlobalToggleAllExpandShortcut: (treeRoot: DSTreeviewT.Item[
|
|
6
|
+
export declare const useGlobalToggleAllExpandShortcut: (treeRoot: DSTreeviewT.Item["node"], triggerTreeRerender: () => void, setLatestToggledItem: DSTreeviewInternalsT.CTX["setLatestToggledItem"], updateUserExpandedState: DSTreeviewInternalsT.CTX["updateUserExpandedState"]) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DSTreeviewT } from '../react-desc-prop-types.js';
|
|
2
|
-
export declare const getGroupCheckState: (node: DSTreeviewT.Item[
|
|
2
|
+
export declare const getGroupCheckState: (node: DSTreeviewT.Item["node"]) => boolean | "mixed";
|
|
3
3
|
export declare const selectCheckboxItemModelParentsTillRoot: (modelToCheck: DSTreeviewT.Item, triggerTreeRerender?: (() => void) | null) => DSTreeviewT.SelectionItems;
|
|
4
4
|
export declare const toggleCheckboxItem: (itemToSelect: DSTreeviewT.Item, currentlySelectedCheckboxes: DSTreeviewT.SelectionItems, triggerTreeRerender?: (() => void) | null) => {
|
|
5
5
|
[x: string]: DSTreeviewT.SelectionState;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import type TreeModel from 'tree-model';
|
|
2
2
|
import type { DSTreeviewT } from '../react-desc-prop-types.js';
|
|
3
|
-
export declare const walkVisibles: (node: DSTreeviewT.Item[
|
|
4
|
-
export declare const walkParents: (nodePath: DSTreeviewT.Item[
|
|
3
|
+
export declare const walkVisibles: (node: DSTreeviewT.Item["node"], callback: (node: DSTreeviewT.Item["node"]) => void, skipRoot?: boolean, highlightOnlyQuery?: boolean) => void;
|
|
4
|
+
export declare const walkParents: (nodePath: DSTreeviewT.Item["nodePath"], callback: (currParent: DSTreeviewT.Item["node"]) => void, skipRoot?: boolean) => void;
|
|
5
5
|
type RecursiveCallbackT = (childNode: DSTreeviewT.Item['node'], cb?: RecursiveCallbackT, isFirst?: boolean) => void;
|
|
6
|
-
export declare const walkAllNodeChildren: (node: DSTreeviewT.Item[
|
|
7
|
-
export declare const getNodeById: (treeRoot: DSTreeviewT.Item[
|
|
6
|
+
export declare const walkAllNodeChildren: (node: DSTreeviewT.Item["node"], callback: RecursiveCallbackT, isFirst?: boolean) => void;
|
|
7
|
+
export declare const getNodeById: (treeRoot: DSTreeviewT.Item["node"], id: DSTreeviewT.StringOrNum) => TreeModel.Node<DSTreeviewT.Item>;
|
|
8
8
|
export declare const cloneNode: (tree: TreeModel, node: DSTreeviewT.Item) => TreeModel.Node<DSTreeviewT.Item>;
|
|
9
9
|
export declare const itemsShareSameParent: (items?: DSTreeviewT.Item[]) => boolean;
|
|
10
|
-
export declare const getItemsParentNode: (items?: DSTreeviewT.Item[], skipSameParentCheck?: boolean) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare const getNodeMatchesSearchQuery: (node: DSTreeviewT.Item['node'], searchQuery?: string) => boolean;
|
|
14
|
-
export declare const getChildrenMatchesSearchQuery: (parentNode: DSTreeviewT.Item['node'], searchQuery?: string) => boolean;
|
|
10
|
+
export declare const getItemsParentNode: (items?: DSTreeviewT.Item[], skipSameParentCheck?: boolean) => DSTreeviewT.Item["node"];
|
|
11
|
+
export declare const getNodeMatchesSearchQuery: (node: DSTreeviewT.Item["node"], searchQuery?: string) => boolean;
|
|
12
|
+
export declare const getChildrenMatchesSearchQuery: (parentNode: DSTreeviewT.Item["node"], searchQuery?: string) => boolean;
|
|
15
13
|
/**
|
|
16
14
|
* Mutate in place a node from tree-model normalizing object properties like "isGroup" even if user didn't specify it explicitly,
|
|
17
15
|
* after execution the node will have "nodePath" "treeDepth" "nodeItemRef" "isGroup" "isExpanded"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-treeview",
|
|
3
|
-
"version": "3.53.0-alpha.
|
|
3
|
+
"version": "3.53.0-alpha.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Tree View",
|
|
6
6
|
"files": [
|
|
@@ -43,24 +43,26 @@
|
|
|
43
43
|
"react-highlight-words": "~0.18.0",
|
|
44
44
|
"react-virtual": "~2.10.4",
|
|
45
45
|
"tree-model": "~1.0.7",
|
|
46
|
-
"uid": "
|
|
47
|
-
"@elliemae/ds-button-v2": "3.53.0-alpha.
|
|
48
|
-
"@elliemae/ds-
|
|
49
|
-
"@elliemae/ds-
|
|
50
|
-
"@elliemae/ds-
|
|
51
|
-
"@elliemae/ds-
|
|
52
|
-
"@elliemae/ds-form": "3.53.0-alpha.
|
|
53
|
-
"@elliemae/ds-
|
|
54
|
-
"@elliemae/ds-
|
|
55
|
-
"@elliemae/ds-
|
|
56
|
-
"@elliemae/ds-
|
|
57
|
-
"@elliemae/ds-
|
|
46
|
+
"uid": "^2.0.2",
|
|
47
|
+
"@elliemae/ds-button-v2": "3.53.0-alpha.3",
|
|
48
|
+
"@elliemae/ds-circular-progress-indicator": "3.53.0-alpha.3",
|
|
49
|
+
"@elliemae/ds-classnames": "3.53.0-alpha.3",
|
|
50
|
+
"@elliemae/ds-drag-and-drop": "3.53.0-alpha.3",
|
|
51
|
+
"@elliemae/ds-form-checkbox": "3.53.0-alpha.3",
|
|
52
|
+
"@elliemae/ds-form": "3.53.0-alpha.3",
|
|
53
|
+
"@elliemae/ds-form-radio": "3.53.0-alpha.3",
|
|
54
|
+
"@elliemae/ds-system": "3.53.0-alpha.3",
|
|
55
|
+
"@elliemae/ds-icons": "3.53.0-alpha.3",
|
|
56
|
+
"@elliemae/ds-props-helpers": "3.53.0-alpha.3",
|
|
57
|
+
"@elliemae/ds-truncated-tooltip-text": "3.53.0-alpha.3",
|
|
58
|
+
"@elliemae/ds-typescript-helpers": "3.53.0-alpha.3"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@elliemae/pui-cli": "9.0.0-next.
|
|
61
|
+
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
61
62
|
"jest": "~29.7.0",
|
|
62
63
|
"styled-components": "~5.3.9",
|
|
63
|
-
"@elliemae/ds-monorepo-devops": "3.53.0-alpha.
|
|
64
|
+
"@elliemae/ds-monorepo-devops": "3.53.0-alpha.3",
|
|
65
|
+
"@elliemae/ds-test-utils": "3.53.0-alpha.3"
|
|
64
66
|
},
|
|
65
67
|
"peerDependencies": {
|
|
66
68
|
"lodash-es": "^4.17.21",
|