@elliemae/ds-menu-tree-item 3.27.0-next.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/DSMenuTreeItem.js +134 -0
- package/dist/cjs/DSMenuTreeItem.js.map +7 -0
- package/dist/cjs/config/useMenuTreeItem.js +60 -0
- package/dist/cjs/config/useMenuTreeItem.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js +40 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants/index.js +48 -0
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +41 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/react-desc-prop-types.js +60 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styled.js +57 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/esm/DSMenuTreeItem.js +104 -0
- package/dist/esm/DSMenuTreeItem.js.map +7 -0
- package/dist/esm/config/useMenuTreeItem.js +30 -0
- package/dist/esm/config/useMenuTreeItem.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +10 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants/index.js +18 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +7 -0
- package/dist/esm/react-desc-prop-types.js +30 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styled.js +27 -0
- package/dist/esm/styled.js.map +7 -0
- package/dist/types/DSMenuTreeItem.d.ts +5 -0
- package/dist/types/config/useMenuTreeItem.d.ts +12 -0
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants/index.d.ts +9 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/react-desc-prop-types.d.ts +40 -0
- package/dist/types/styled.d.ts +3 -0
- package/dist/types/tests/DSMenuTreeItem.test.d.ts +1 -0
- package/package.json +79 -0
@@ -0,0 +1,134 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var DSMenuTreeItem_exports = {};
|
30
|
+
__export(DSMenuTreeItem_exports, {
|
31
|
+
DSMenuTreeItem: () => DSMenuTreeItem,
|
32
|
+
DSMenuTreeItemWithSchema: () => DSMenuTreeItemWithSchema
|
33
|
+
});
|
34
|
+
module.exports = __toCommonJS(DSMenuTreeItem_exports);
|
35
|
+
var React = __toESM(require("react"));
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
37
|
+
var import_react = __toESM(require("react"));
|
38
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
39
|
+
var import_ds_form_checkbox = require("@elliemae/ds-form-checkbox");
|
40
|
+
var import_ds_form_radio = require("@elliemae/ds-form-radio");
|
41
|
+
var import_ds_grid = __toESM(require("@elliemae/ds-grid"));
|
42
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
43
|
+
var import_ds_separator = require("@elliemae/ds-separator");
|
44
|
+
var import_ds_typography = require("@elliemae/ds-typography");
|
45
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
46
|
+
var import_useMenuTreeItem = require("./config/useMenuTreeItem.js");
|
47
|
+
var import_constants = require("./constants/index.js");
|
48
|
+
var import_styled = require("./styled.js");
|
49
|
+
const mainContentCols = ["1fr"];
|
50
|
+
const DSMenuTreeItem = (props) => {
|
51
|
+
const { propsWithDefault, xstyledProps } = (0, import_useMenuTreeItem.useMenuTreeItem)(props);
|
52
|
+
const { onCollapse, item, onSelect = () => {
|
53
|
+
}, isSelected, multiple } = propsWithDefault;
|
54
|
+
const cols = (0, import_react.useMemo)(() => {
|
55
|
+
if (isSelected !== void 0) {
|
56
|
+
return ["auto", "auto", "auto", "1fr"];
|
57
|
+
}
|
58
|
+
return ["auto", "auto", "1fr"];
|
59
|
+
}, [isSelected]);
|
60
|
+
const subItemsLength = (0, import_react.useMemo)(() => {
|
61
|
+
if (item.subitems && item.subitems?.length > 0) {
|
62
|
+
return item.subitems.length;
|
63
|
+
}
|
64
|
+
return 0;
|
65
|
+
}, [item.subitems]);
|
66
|
+
const expandableButton = (0, import_react.useMemo)(() => {
|
67
|
+
if (subItemsLength > 0) {
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.default, { cols: ["auto", "auto"], alignItems: "center", children: [
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
70
|
+
import_styled.StyledButton,
|
71
|
+
{
|
72
|
+
"aria-label": "Expand",
|
73
|
+
buttonType: "icon",
|
74
|
+
size: "s",
|
75
|
+
onClick: () => {
|
76
|
+
onCollapse(item.dsId);
|
77
|
+
},
|
78
|
+
children: item.collapsed === false ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ArrowheadDown, { size: "s", color: ["brand-primary", "800"] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ArrowheadRight, { size: "s", color: ["brand-primary", "800"] })
|
79
|
+
}
|
80
|
+
),
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.Folder, { color: ["brand-primary", "700"] })
|
82
|
+
] });
|
83
|
+
}
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.default, { alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.FilePdf, { color: ["brand-primary", "700"] }) });
|
85
|
+
}, [item.collapsed, item.dsId, onCollapse, subItemsLength]);
|
86
|
+
const SelectComponent = import_react.default.useMemo(() => {
|
87
|
+
if (multiple) {
|
88
|
+
return import_ds_form_checkbox.DSControlledCheckbox;
|
89
|
+
}
|
90
|
+
return import_ds_form_radio.DSControlledRadio;
|
91
|
+
}, [multiple]);
|
92
|
+
const handleOnSelect = (0, import_react.useCallback)(() => {
|
93
|
+
onSelect(item.dsId);
|
94
|
+
}, [item.dsId, onSelect]);
|
95
|
+
const [, setIsFocused] = import_react.default.useState(false);
|
96
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
97
|
+
import_styled.MenuItemWrapper,
|
98
|
+
{
|
99
|
+
cols: mainContentCols,
|
100
|
+
getOwnerProps: () => propsWithDefault,
|
101
|
+
getOwnerPropsArguments: () => ({}),
|
102
|
+
...xstyledProps,
|
103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.default, { cols, marginLeft: item.depth * 24, gutter: "xxs2", alignItems: "center", children: [
|
104
|
+
isSelected !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
105
|
+
SelectComponent,
|
106
|
+
{
|
107
|
+
onFocus: () => setIsFocused(true),
|
108
|
+
onBlur: () => setIsFocused(false),
|
109
|
+
checked: isSelected,
|
110
|
+
onChange: handleOnSelect,
|
111
|
+
"aria-label": "Select",
|
112
|
+
value: String(item.dsId)
|
113
|
+
}
|
114
|
+
),
|
115
|
+
expandableButton,
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.default, { alignItems: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_typography.DSTypography, { variant: "b1", id: `${item.dsId}-text`, children: [
|
117
|
+
"Test ",
|
118
|
+
item.dsId
|
119
|
+
] }) }),
|
120
|
+
subItemsLength > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.default, { cols: ["min-content", "auto"], gutter: "xxs", children: [
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.default, { alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_separator.DSSeparatorV2, { isVertical: true, height: "80%" }) }),
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.default, { alignItems: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_typography.DSTypography, { variant: "b1", color: "neutral-500", children: [
|
123
|
+
subItemsLength,
|
124
|
+
" Items"
|
125
|
+
] }) })
|
126
|
+
] })
|
127
|
+
] })
|
128
|
+
}
|
129
|
+
);
|
130
|
+
};
|
131
|
+
DSMenuTreeItem.displayName = import_constants.DSMenuTreeItemName;
|
132
|
+
const DSMenuTreeItemWithSchema = (0, import_ds_props_helpers.describe)(DSMenuTreeItem);
|
133
|
+
DSMenuTreeItemWithSchema.propTypes = import_react_desc_prop_types.DSMenuTreeItemPropTypesSchema;
|
134
|
+
//# sourceMappingURL=DSMenuTreeItem.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/DSMenuTreeItem.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport React, { useCallback, useMemo } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DSControlledCheckbox } from '@elliemae/ds-form-checkbox';\nimport { DSControlledRadio } from '@elliemae/ds-form-radio';\nimport Grid from '@elliemae/ds-grid';\nimport { ArrowheadDown, ArrowheadRight, Folder, FilePdf } from '@elliemae/ds-icons';\nimport { DSSeparatorV2 } from '@elliemae/ds-separator';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { type DSMenuTreeItemT, DSMenuTreeItemPropTypesSchema } from './react-desc-prop-types.js';\nimport { useMenuTreeItem } from './config/useMenuTreeItem.js';\nimport { DSMenuTreeItemName } from './constants/index.js';\nimport { MenuItemWrapper, StyledButton } from './styled.js';\n\nconst mainContentCols = ['1fr'];\n\nconst DSMenuTreeItem: React.ComponentType<DSMenuTreeItemT.Props> = (props) => {\n const { propsWithDefault, xstyledProps } = useMenuTreeItem(props);\n\n const { onCollapse, item, onSelect = () => {}, isSelected, multiple } = propsWithDefault;\n const cols = useMemo(() => {\n if (isSelected !== undefined) {\n return ['auto', 'auto', 'auto', '1fr'];\n }\n return ['auto', 'auto', '1fr'];\n }, [isSelected]);\n\n const subItemsLength = useMemo(() => {\n if (item.subitems && item.subitems?.length > 0) {\n return item.subitems.length;\n }\n return 0;\n }, [item.subitems]);\n const expandableButton = useMemo(() => {\n if (subItemsLength > 0) {\n return (\n <Grid cols={['auto', 'auto']} alignItems=\"center\">\n <StyledButton\n aria-label=\"Expand\"\n buttonType=\"icon\"\n size=\"s\"\n onClick={() => {\n onCollapse(item.dsId);\n }}\n >\n {item.collapsed === false ? (\n <ArrowheadDown size=\"s\" color={['brand-primary', '800']} />\n ) : (\n <ArrowheadRight size=\"s\" color={['brand-primary', '800']} />\n )}\n </StyledButton>\n <Folder color={['brand-primary', '700']} />\n </Grid>\n );\n }\n return (\n <Grid alignItems=\"center\">\n <FilePdf color={['brand-primary', '700']} />\n </Grid>\n );\n }, [item.collapsed, item.dsId, onCollapse, subItemsLength]);\n\n const SelectComponent = React.useMemo(() => {\n if (multiple) {\n return DSControlledCheckbox;\n }\n return DSControlledRadio;\n }, [multiple]);\n\n const handleOnSelect = useCallback(() => {\n onSelect(item.dsId);\n }, [item.dsId, onSelect]);\n\n const [, setIsFocused] = React.useState(false);\n\n return (\n <MenuItemWrapper\n cols={mainContentCols}\n getOwnerProps={() => propsWithDefault}\n getOwnerPropsArguments={() => ({})}\n {...xstyledProps}\n >\n <Grid cols={cols} marginLeft={item.depth * 24} gutter=\"xxs2\" alignItems=\"center\">\n {isSelected !== undefined && (\n <SelectComponent\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n checked={isSelected}\n onChange={handleOnSelect}\n aria-label=\"Select\"\n value={String(item.dsId)}\n />\n )}\n {expandableButton}\n <Grid alignItems=\"flex-end\">\n <DSTypography variant=\"b1\" id={`${item.dsId}-text`}>\n Test {item.dsId}\n </DSTypography>\n </Grid>\n {subItemsLength > 0 && (\n <Grid cols={['min-content', 'auto']} gutter=\"xxs\">\n <Grid alignItems=\"center\">\n <DSSeparatorV2 isVertical height=\"80%\" />\n </Grid>\n <Grid alignItems=\"flex-end\">\n <DSTypography variant=\"b1\" color=\"neutral-500\">\n {subItemsLength} Items\n </DSTypography>\n </Grid>\n </Grid>\n )}\n </Grid>\n </MenuItemWrapper>\n );\n};\n\nDSMenuTreeItem.displayName = DSMenuTreeItemName;\nconst DSMenuTreeItemWithSchema = describe(DSMenuTreeItem);\nDSMenuTreeItemWithSchema.propTypes = DSMenuTreeItemPropTypesSchema;\n\nexport { DSMenuTreeItem, DSMenuTreeItemWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": "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",
|
6
|
+
"names": ["Grid", "React"]
|
7
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var useMenuTreeItem_exports = {};
|
30
|
+
__export(useMenuTreeItem_exports, {
|
31
|
+
useMenuTreeItem: () => useMenuTreeItem
|
32
|
+
});
|
33
|
+
module.exports = __toCommonJS(useMenuTreeItem_exports);
|
34
|
+
var React = __toESM(require("react"));
|
35
|
+
var import_react = __toESM(require("react"));
|
36
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
37
|
+
var import_uid = require("uid");
|
38
|
+
var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
39
|
+
var import_useValidateProps = require("./useValidateProps.js");
|
40
|
+
const useMenuTreeItem = (propsFromUser) => {
|
41
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(propsFromUser, import_react_desc_prop_types.defaultProps);
|
42
|
+
(0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSMenuTreeItemPropTypes);
|
43
|
+
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
|
44
|
+
const instanceUid = import_react.default.useMemo(() => (0, import_uid.uid)(5), []);
|
45
|
+
return import_react.default.useMemo(
|
46
|
+
() => ({
|
47
|
+
propsWithDefault,
|
48
|
+
xstyledProps,
|
49
|
+
instanceUid
|
50
|
+
// ...eventHandlers,
|
51
|
+
}),
|
52
|
+
[
|
53
|
+
propsWithDefault,
|
54
|
+
xstyledProps,
|
55
|
+
instanceUid
|
56
|
+
// eventHandlers,
|
57
|
+
]
|
58
|
+
);
|
59
|
+
};
|
60
|
+
//# sourceMappingURL=useMenuTreeItem.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/config/useMenuTreeItem.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { type DSMenuTreeItemT, DSMenuTreeItemPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface MenuTreeItemCTX {\n propsWithDefault: DSMenuTreeItemT.InternalProps;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useMenuTreeItem = (propsFromUser: DSMenuTreeItemT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSMenuTreeItemT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSMenuTreeItemPropTypes);\n // =============================================================================\n // XSTYLED PROPS\n // =============================================================================\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const instanceUid = React.useMemo(() => uid(5), []);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n // const eventHandlers = useEventHandlers({ propsWithDefault, instanceUid }); // <-- complex logic should be made atomics this way\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n xstyledProps,\n instanceUid,\n // ...eventHandlers,\n }),\n [\n propsWithDefault,\n xstyledProps,\n instanceUid,\n // eventHandlers,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAAiE;AACjE,iBAAoB;AACpB,mCAA4E;AAC5E,8BAAiC;AAQ1B,MAAM,kBAAkB,CAAC,kBAAyC;AAIvE,QAAM,uBAAmB,sDAA4D,eAAe,yCAAY;AAChH,gDAAiB,kBAAkB,oDAAuB;AAI1D,QAAM,mBAAe,4CAAmB,gBAAgB;AAKxD,QAAM,cAAc,aAAAA,QAAM,QAAQ,UAAM,gBAAI,CAAC,GAAG,CAAC,CAAC;AAMlD,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,EACF;AACF;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var useValidateProps_exports = {};
|
30
|
+
__export(useValidateProps_exports, {
|
31
|
+
useValidateProps: () => useValidateProps
|
32
|
+
});
|
33
|
+
module.exports = __toCommonJS(useValidateProps_exports);
|
34
|
+
var React = __toESM(require("react"));
|
35
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
36
|
+
var import_constants = require("../constants");
|
37
|
+
const useValidateProps = (props, propTypes) => {
|
38
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, import_constants.DSMenuTreeItemName);
|
39
|
+
};
|
40
|
+
//# sourceMappingURL=useValidateProps.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/config/useValidateProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { WeakValidationMap } from 'react';\nimport { type DSMenuTreeItemT } from '../react-desc-prop-types';\nimport { DSMenuTreeItemName } from '../constants';\n\nexport const useValidateProps = (props: DSMenuTreeItemT.InternalProps, propTypes: WeakValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSMenuTreeItemName);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA+C;AAG/C,uBAAmC;AAE5B,MAAM,mBAAmB,CAAC,OAAsC,cAAgD;AAErH,8DAA+B,OAAO,WAAW,mCAAkB;AACrE;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var constants_exports = {};
|
30
|
+
__export(constants_exports, {
|
31
|
+
DSMenuTreeItemName: () => DSMenuTreeItemName,
|
32
|
+
EXAMPLE_CONSTANTS: () => EXAMPLE_CONSTANTS,
|
33
|
+
MENU_TREE_ITEM_DATA_TESTID: () => MENU_TREE_ITEM_DATA_TESTID,
|
34
|
+
MENU_TREE_ITEM_SLOTS: () => MENU_TREE_ITEM_SLOTS
|
35
|
+
});
|
36
|
+
module.exports = __toCommonJS(constants_exports);
|
37
|
+
var React = __toESM(require("react"));
|
38
|
+
var import_ds_system = require("@elliemae/ds-system");
|
39
|
+
const DSMenuTreeItemName = "DSMenuTreeItem";
|
40
|
+
const EXAMPLE_CONSTANTS = {
|
41
|
+
HELLO: "WORLD",
|
42
|
+
FOO: "BAR"
|
43
|
+
};
|
44
|
+
const MENU_TREE_ITEM_SLOTS = {
|
45
|
+
ROOT: "root"
|
46
|
+
};
|
47
|
+
const MENU_TREE_ITEM_DATA_TESTID = (0, import_ds_system.slotObjectToDataTestIds)(DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS);
|
48
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSMenuTreeItemName = 'DSMenuTreeItem';\n\nexport const EXAMPLE_CONSTANTS = {\n HELLO: 'WORLD',\n FOO: 'BAR',\n} as const;\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators \nexport const MENU_TREE_ITEM_SLOTS = {\n ROOT: 'root',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const MENU_TREE_ITEM_DATA_TESTID = slotObjectToDataTestIds(DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS)\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,qBAAqB;AAE3B,MAAM,oBAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,KAAK;AACP;AAGO,MAAM,uBAAuB;AAAA,EAClC,MAAM;AACR;AAGO,MAAM,iCAA6B,0CAAwB,oBAAoB,oBAAoB;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var src_exports = {};
|
30
|
+
__export(src_exports, {
|
31
|
+
DSMenuTreeItem: () => import_DSMenuTreeItem.DSMenuTreeItem,
|
32
|
+
DSMenuTreeItemWithSchema: () => import_DSMenuTreeItem.DSMenuTreeItemWithSchema,
|
33
|
+
MENU_TREE_ITEM_DATA_TESTID: () => import_constants.MENU_TREE_ITEM_DATA_TESTID,
|
34
|
+
MENU_TREE_ITEM_SLOTS: () => import_constants.MENU_TREE_ITEM_SLOTS
|
35
|
+
});
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
37
|
+
var React = __toESM(require("react"));
|
38
|
+
var import_DSMenuTreeItem = require("./DSMenuTreeItem");
|
39
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types");
|
40
|
+
var import_constants = require("./constants");
|
41
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { \n DSMenuTreeItem,\n DSMenuTreeItemWithSchema\n} from './DSMenuTreeItem';\nexport { type DSMenuTreeItemT } from './react-desc-prop-types';\nexport {\n MENU_TREE_ITEM_SLOTS,\n MENU_TREE_ITEM_DATA_TESTID,\n} from './constants';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,4BAGO;AACP,mCAAqC;AACrC,uBAGO;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var react_desc_prop_types_exports = {};
|
30
|
+
__export(react_desc_prop_types_exports, {
|
31
|
+
DSMenuTreeItemPropTypes: () => DSMenuTreeItemPropTypes,
|
32
|
+
DSMenuTreeItemPropTypesSchema: () => DSMenuTreeItemPropTypesSchema,
|
33
|
+
defaultProps: () => defaultProps
|
34
|
+
});
|
35
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
36
|
+
var React = __toESM(require("react"));
|
37
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
38
|
+
const defaultProps = {
|
39
|
+
isSelected: false,
|
40
|
+
multiple: false
|
41
|
+
};
|
42
|
+
const itemPropsSchema = import_ds_props_helpers.PropTypes.shape({
|
43
|
+
dsId: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.string, import_ds_props_helpers.PropTypes.number]).isRequired,
|
44
|
+
collapsed: import_ds_props_helpers.PropTypes.bool,
|
45
|
+
depth: import_ds_props_helpers.PropTypes.number,
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
47
|
+
subitems: import_ds_props_helpers.PropTypes.any
|
48
|
+
});
|
49
|
+
const DSMenuTreeItemPropTypes = {
|
50
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
51
|
+
item: itemPropsSchema.description("some example of proptypes"),
|
52
|
+
onCollapse: import_ds_props_helpers.PropTypes.func,
|
53
|
+
subitems: import_ds_props_helpers.PropTypes.object,
|
54
|
+
onSelect: import_ds_props_helpers.PropTypes.func,
|
55
|
+
isSelected: import_ds_props_helpers.PropTypes.bool,
|
56
|
+
multiple: import_ds_props_helpers.PropTypes.bool,
|
57
|
+
depth: import_ds_props_helpers.PropTypes.number
|
58
|
+
};
|
59
|
+
const DSMenuTreeItemPropTypesSchema = DSMenuTreeItemPropTypes;
|
60
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type { DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS } from './constants/index.js';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSMenuTreeItemT {\n export interface ItemT {\n dsId: string;\n collapsed?: boolean;\n depth: number;\n subitems: ItemT[] | null;\n }\n\n export interface TreeviewItemProps {\n onCollapse: (dsId: string) => void;\n item: ItemT;\n onSelect?: (dsId: string) => void;\n isSelected?: boolean;\n multiple?: boolean;\n }\n\n export interface RequiredProps {\n item: ItemT;\n dsId: string;\n depth: number;\n }\n\n export interface DefaultProps {\n isSelected?: boolean;\n multiple?: boolean;\n }\n\n export interface OptionalProps extends PropsForGlobalOnSlots<typeof DSMenuTreeItemName, typeof MENU_TREE_ITEM_SLOTS> {\n onCollapse: (dsId: string) => void;\n subitems: ItemT[] | null;\n onSelect?: (dsId: string) => void;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, XstyledProps, RequiredProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, XstyledProps, RequiredProps {}\n\n export type ExampleState = '0' | '1';\n}\n\nexport const defaultProps: DSMenuTreeItemT.DefaultProps = {\n isSelected: false,\n multiple: false,\n};\n\nconst itemPropsSchema = PropTypes.shape({\n dsId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n collapsed: PropTypes.bool,\n depth: PropTypes.number,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n subitems: PropTypes.any,\n});\n\nexport const DSMenuTreeItemPropTypes: DSPropTypesSchema<DSMenuTreeItemT.Props> = {\n ...xstyledPropTypes,\n item: itemPropsSchema.description('some example of proptypes'),\n onCollapse: PropTypes.func,\n subitems: PropTypes.object,\n onSelect: PropTypes.func,\n isSelected: PropTypes.bool,\n multiple: PropTypes.bool,\n depth: PropTypes.number,\n};\n\nexport const DSMenuTreeItemPropTypesSchema =\n DSMenuTreeItemPropTypes as unknown as WeakValidationMap<DSMenuTreeItemT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAA4C;AA4CrC,MAAM,eAA6C;AAAA,EACxD,YAAY;AAAA,EACZ,UAAU;AACZ;AAEA,MAAM,kBAAkB,kCAAU,MAAM;AAAA,EACtC,MAAM,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,EAAE;AAAA,EAChE,WAAW,kCAAU;AAAA,EACrB,OAAO,kCAAU;AAAA;AAAA,EAEjB,UAAU,kCAAU;AACtB,CAAC;AAEM,MAAM,0BAAoE;AAAA,EAC/E,GAAG;AAAA,EACH,MAAM,gBAAgB,YAAY,2BAA2B;AAAA,EAC7D,YAAY,kCAAU;AAAA,EACtB,UAAU,kCAAU;AAAA,EACpB,UAAU,kCAAU;AAAA,EACpB,YAAY,kCAAU;AAAA,EACtB,UAAU,kCAAU;AAAA,EACpB,OAAO,kCAAU;AACnB;AAEO,MAAM,gCACX;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var styled_exports = {};
|
30
|
+
__export(styled_exports, {
|
31
|
+
MenuItemWrapper: () => MenuItemWrapper,
|
32
|
+
StyledButton: () => StyledButton
|
33
|
+
});
|
34
|
+
module.exports = __toCommonJS(styled_exports);
|
35
|
+
var React = __toESM(require("react"));
|
36
|
+
var import_ds_system = require("@elliemae/ds-system");
|
37
|
+
var import_ds_button_v2 = require("@elliemae/ds-button-v2");
|
38
|
+
var import_ds_grid = require("@elliemae/ds-grid");
|
39
|
+
var import_constants = require("./constants/index.js");
|
40
|
+
const borderStyle = import_ds_system.css`
|
41
|
+
outline: 2px solid ${({ theme }) => theme.colors.brand["700"]};
|
42
|
+
outline-offset: -2px;
|
43
|
+
`;
|
44
|
+
const MenuItemWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSMenuTreeItemName, slot: import_constants.MENU_TREE_ITEM_SLOTS.ROOT })`
|
45
|
+
height: 36px;
|
46
|
+
|
47
|
+
${({ isFocused }) => isFocused && borderStyle};
|
48
|
+
&:hover {
|
49
|
+
background-color: ${({ theme }) => theme.colors.brand["200"]};
|
50
|
+
}
|
51
|
+
`;
|
52
|
+
const StyledButton = (0, import_ds_system.styled)(import_ds_button_v2.DSButtonV3)`
|
53
|
+
&:hover:not(:disabled) {
|
54
|
+
background-color: transparent;
|
55
|
+
}
|
56
|
+
`;
|
57
|
+
//# sourceMappingURL=styled.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/styled.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["import { styled, css } from '@elliemae/ds-system';\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS } from './constants/index.js';\n\nconst borderStyle = css`\n outline: 2px solid ${({ theme }) => theme.colors.brand['700']};\n outline-offset: -2px;\n`;\n\nexport const MenuItemWrapper = styled(Grid, { name: DSMenuTreeItemName, slot: MENU_TREE_ITEM_SLOTS.ROOT })`\n height: 36px;\n\n ${({ isFocused }: any) => isFocused && borderStyle};\n &:hover {\n background-color: ${({ theme }) => theme.colors.brand['200']};\n }\n`;\n\nexport const StyledButton = styled(DSButtonV3)`\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAC5B,0BAA2B;AAC3B,qBAAqB;AACrB,uBAAyD;AAEzD,MAAM,cAAc;AAAA,uBACG,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,KAAK;AAAA;AAAA;AAIvD,MAAM,sBAAkB,yBAAO,qBAAM,EAAE,MAAM,qCAAoB,MAAM,sCAAqB,KAAK,CAAC;AAAA;AAAA;AAAA,IAGrG,CAAC,EAAE,UAAU,MAAW,aAAa;AAAA;AAAA,wBAEjB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,KAAK;AAAA;AAAA;AAIxD,MAAM,mBAAe,yBAAO,8BAAU;AAAA;AAAA;AAAA;AAAA;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,104 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
3
|
+
import React2, { useCallback, useMemo } from "react";
|
4
|
+
import { describe } from "@elliemae/ds-props-helpers";
|
5
|
+
import { DSControlledCheckbox } from "@elliemae/ds-form-checkbox";
|
6
|
+
import { DSControlledRadio } from "@elliemae/ds-form-radio";
|
7
|
+
import Grid from "@elliemae/ds-grid";
|
8
|
+
import { ArrowheadDown, ArrowheadRight, Folder, FilePdf } from "@elliemae/ds-icons";
|
9
|
+
import { DSSeparatorV2 } from "@elliemae/ds-separator";
|
10
|
+
import { DSTypography } from "@elliemae/ds-typography";
|
11
|
+
import { DSMenuTreeItemPropTypesSchema } from "./react-desc-prop-types.js";
|
12
|
+
import { useMenuTreeItem } from "./config/useMenuTreeItem.js";
|
13
|
+
import { DSMenuTreeItemName } from "./constants/index.js";
|
14
|
+
import { MenuItemWrapper, StyledButton } from "./styled.js";
|
15
|
+
const mainContentCols = ["1fr"];
|
16
|
+
const DSMenuTreeItem = (props) => {
|
17
|
+
const { propsWithDefault, xstyledProps } = useMenuTreeItem(props);
|
18
|
+
const { onCollapse, item, onSelect = () => {
|
19
|
+
}, isSelected, multiple } = propsWithDefault;
|
20
|
+
const cols = useMemo(() => {
|
21
|
+
if (isSelected !== void 0) {
|
22
|
+
return ["auto", "auto", "auto", "1fr"];
|
23
|
+
}
|
24
|
+
return ["auto", "auto", "1fr"];
|
25
|
+
}, [isSelected]);
|
26
|
+
const subItemsLength = useMemo(() => {
|
27
|
+
if (item.subitems && item.subitems?.length > 0) {
|
28
|
+
return item.subitems.length;
|
29
|
+
}
|
30
|
+
return 0;
|
31
|
+
}, [item.subitems]);
|
32
|
+
const expandableButton = useMemo(() => {
|
33
|
+
if (subItemsLength > 0) {
|
34
|
+
return /* @__PURE__ */ jsxs(Grid, { cols: ["auto", "auto"], alignItems: "center", children: [
|
35
|
+
/* @__PURE__ */ jsx(
|
36
|
+
StyledButton,
|
37
|
+
{
|
38
|
+
"aria-label": "Expand",
|
39
|
+
buttonType: "icon",
|
40
|
+
size: "s",
|
41
|
+
onClick: () => {
|
42
|
+
onCollapse(item.dsId);
|
43
|
+
},
|
44
|
+
children: item.collapsed === false ? /* @__PURE__ */ jsx(ArrowheadDown, { size: "s", color: ["brand-primary", "800"] }) : /* @__PURE__ */ jsx(ArrowheadRight, { size: "s", color: ["brand-primary", "800"] })
|
45
|
+
}
|
46
|
+
),
|
47
|
+
/* @__PURE__ */ jsx(Folder, { color: ["brand-primary", "700"] })
|
48
|
+
] });
|
49
|
+
}
|
50
|
+
return /* @__PURE__ */ jsx(Grid, { alignItems: "center", children: /* @__PURE__ */ jsx(FilePdf, { color: ["brand-primary", "700"] }) });
|
51
|
+
}, [item.collapsed, item.dsId, onCollapse, subItemsLength]);
|
52
|
+
const SelectComponent = React2.useMemo(() => {
|
53
|
+
if (multiple) {
|
54
|
+
return DSControlledCheckbox;
|
55
|
+
}
|
56
|
+
return DSControlledRadio;
|
57
|
+
}, [multiple]);
|
58
|
+
const handleOnSelect = useCallback(() => {
|
59
|
+
onSelect(item.dsId);
|
60
|
+
}, [item.dsId, onSelect]);
|
61
|
+
const [, setIsFocused] = React2.useState(false);
|
62
|
+
return /* @__PURE__ */ jsx(
|
63
|
+
MenuItemWrapper,
|
64
|
+
{
|
65
|
+
cols: mainContentCols,
|
66
|
+
getOwnerProps: () => propsWithDefault,
|
67
|
+
getOwnerPropsArguments: () => ({}),
|
68
|
+
...xstyledProps,
|
69
|
+
children: /* @__PURE__ */ jsxs(Grid, { cols, marginLeft: item.depth * 24, gutter: "xxs2", alignItems: "center", children: [
|
70
|
+
isSelected !== void 0 && /* @__PURE__ */ jsx(
|
71
|
+
SelectComponent,
|
72
|
+
{
|
73
|
+
onFocus: () => setIsFocused(true),
|
74
|
+
onBlur: () => setIsFocused(false),
|
75
|
+
checked: isSelected,
|
76
|
+
onChange: handleOnSelect,
|
77
|
+
"aria-label": "Select",
|
78
|
+
value: String(item.dsId)
|
79
|
+
}
|
80
|
+
),
|
81
|
+
expandableButton,
|
82
|
+
/* @__PURE__ */ jsx(Grid, { alignItems: "flex-end", children: /* @__PURE__ */ jsxs(DSTypography, { variant: "b1", id: `${item.dsId}-text`, children: [
|
83
|
+
"Test ",
|
84
|
+
item.dsId
|
85
|
+
] }) }),
|
86
|
+
subItemsLength > 0 && /* @__PURE__ */ jsxs(Grid, { cols: ["min-content", "auto"], gutter: "xxs", children: [
|
87
|
+
/* @__PURE__ */ jsx(Grid, { alignItems: "center", children: /* @__PURE__ */ jsx(DSSeparatorV2, { isVertical: true, height: "80%" }) }),
|
88
|
+
/* @__PURE__ */ jsx(Grid, { alignItems: "flex-end", children: /* @__PURE__ */ jsxs(DSTypography, { variant: "b1", color: "neutral-500", children: [
|
89
|
+
subItemsLength,
|
90
|
+
" Items"
|
91
|
+
] }) })
|
92
|
+
] })
|
93
|
+
] })
|
94
|
+
}
|
95
|
+
);
|
96
|
+
};
|
97
|
+
DSMenuTreeItem.displayName = DSMenuTreeItemName;
|
98
|
+
const DSMenuTreeItemWithSchema = describe(DSMenuTreeItem);
|
99
|
+
DSMenuTreeItemWithSchema.propTypes = DSMenuTreeItemPropTypesSchema;
|
100
|
+
export {
|
101
|
+
DSMenuTreeItem,
|
102
|
+
DSMenuTreeItemWithSchema
|
103
|
+
};
|
104
|
+
//# sourceMappingURL=DSMenuTreeItem.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSMenuTreeItem.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport React, { useCallback, useMemo } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DSControlledCheckbox } from '@elliemae/ds-form-checkbox';\nimport { DSControlledRadio } from '@elliemae/ds-form-radio';\nimport Grid from '@elliemae/ds-grid';\nimport { ArrowheadDown, ArrowheadRight, Folder, FilePdf } from '@elliemae/ds-icons';\nimport { DSSeparatorV2 } from '@elliemae/ds-separator';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { type DSMenuTreeItemT, DSMenuTreeItemPropTypesSchema } from './react-desc-prop-types.js';\nimport { useMenuTreeItem } from './config/useMenuTreeItem.js';\nimport { DSMenuTreeItemName } from './constants/index.js';\nimport { MenuItemWrapper, StyledButton } from './styled.js';\n\nconst mainContentCols = ['1fr'];\n\nconst DSMenuTreeItem: React.ComponentType<DSMenuTreeItemT.Props> = (props) => {\n const { propsWithDefault, xstyledProps } = useMenuTreeItem(props);\n\n const { onCollapse, item, onSelect = () => {}, isSelected, multiple } = propsWithDefault;\n const cols = useMemo(() => {\n if (isSelected !== undefined) {\n return ['auto', 'auto', 'auto', '1fr'];\n }\n return ['auto', 'auto', '1fr'];\n }, [isSelected]);\n\n const subItemsLength = useMemo(() => {\n if (item.subitems && item.subitems?.length > 0) {\n return item.subitems.length;\n }\n return 0;\n }, [item.subitems]);\n const expandableButton = useMemo(() => {\n if (subItemsLength > 0) {\n return (\n <Grid cols={['auto', 'auto']} alignItems=\"center\">\n <StyledButton\n aria-label=\"Expand\"\n buttonType=\"icon\"\n size=\"s\"\n onClick={() => {\n onCollapse(item.dsId);\n }}\n >\n {item.collapsed === false ? (\n <ArrowheadDown size=\"s\" color={['brand-primary', '800']} />\n ) : (\n <ArrowheadRight size=\"s\" color={['brand-primary', '800']} />\n )}\n </StyledButton>\n <Folder color={['brand-primary', '700']} />\n </Grid>\n );\n }\n return (\n <Grid alignItems=\"center\">\n <FilePdf color={['brand-primary', '700']} />\n </Grid>\n );\n }, [item.collapsed, item.dsId, onCollapse, subItemsLength]);\n\n const SelectComponent = React.useMemo(() => {\n if (multiple) {\n return DSControlledCheckbox;\n }\n return DSControlledRadio;\n }, [multiple]);\n\n const handleOnSelect = useCallback(() => {\n onSelect(item.dsId);\n }, [item.dsId, onSelect]);\n\n const [, setIsFocused] = React.useState(false);\n\n return (\n <MenuItemWrapper\n cols={mainContentCols}\n getOwnerProps={() => propsWithDefault}\n getOwnerPropsArguments={() => ({})}\n {...xstyledProps}\n >\n <Grid cols={cols} marginLeft={item.depth * 24} gutter=\"xxs2\" alignItems=\"center\">\n {isSelected !== undefined && (\n <SelectComponent\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n checked={isSelected}\n onChange={handleOnSelect}\n aria-label=\"Select\"\n value={String(item.dsId)}\n />\n )}\n {expandableButton}\n <Grid alignItems=\"flex-end\">\n <DSTypography variant=\"b1\" id={`${item.dsId}-text`}>\n Test {item.dsId}\n </DSTypography>\n </Grid>\n {subItemsLength > 0 && (\n <Grid cols={['min-content', 'auto']} gutter=\"xxs\">\n <Grid alignItems=\"center\">\n <DSSeparatorV2 isVertical height=\"80%\" />\n </Grid>\n <Grid alignItems=\"flex-end\">\n <DSTypography variant=\"b1\" color=\"neutral-500\">\n {subItemsLength} Items\n </DSTypography>\n </Grid>\n </Grid>\n )}\n </Grid>\n </MenuItemWrapper>\n );\n};\n\nDSMenuTreeItem.displayName = DSMenuTreeItemName;\nconst DSMenuTreeItemWithSchema = describe(DSMenuTreeItem);\nDSMenuTreeItemWithSchema.propTypes = DSMenuTreeItemPropTypesSchema;\n\nexport { DSMenuTreeItem, DSMenuTreeItemWithSchema };\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoCf,SAUM,KAVN;AAnCR,OAAOA,UAAS,aAAa,eAAe;AAC5C,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAClC,OAAO,UAAU;AACjB,SAAS,eAAe,gBAAgB,QAAQ,eAAe;AAC/D,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAA+B,qCAAqC;AACpE,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,oBAAoB;AAE9C,MAAM,kBAAkB,CAAC,KAAK;AAE9B,MAAM,iBAA6D,CAAC,UAAU;AAC5E,QAAM,EAAE,kBAAkB,aAAa,IAAI,gBAAgB,KAAK;AAEhE,QAAM,EAAE,YAAY,MAAM,WAAW,MAAM;AAAA,EAAC,GAAG,YAAY,SAAS,IAAI;AACxE,QAAM,OAAO,QAAQ,MAAM;AACzB,QAAI,eAAe,QAAW;AAC5B,aAAO,CAAC,QAAQ,QAAQ,QAAQ,KAAK;AAAA,IACvC;AACA,WAAO,CAAC,QAAQ,QAAQ,KAAK;AAAA,EAC/B,GAAG,CAAC,UAAU,CAAC;AAEf,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,KAAK,YAAY,KAAK,UAAU,SAAS,GAAG;AAC9C,aAAO,KAAK,SAAS;AAAA,IACvB;AACA,WAAO;AAAA,EACT,GAAG,CAAC,KAAK,QAAQ,CAAC;AAClB,QAAM,mBAAmB,QAAQ,MAAM;AACrC,QAAI,iBAAiB,GAAG;AACtB,aACE,qBAAC,QAAK,MAAM,CAAC,QAAQ,MAAM,GAAG,YAAW,UACvC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,YAAW;AAAA,YACX,MAAK;AAAA,YACL,SAAS,MAAM;AACb,yBAAW,KAAK,IAAI;AAAA,YACtB;AAAA,YAEC,eAAK,cAAc,QAClB,oBAAC,iBAAc,MAAK,KAAI,OAAO,CAAC,iBAAiB,KAAK,GAAG,IAEzD,oBAAC,kBAAe,MAAK,KAAI,OAAO,CAAC,iBAAiB,KAAK,GAAG;AAAA;AAAA,QAE9D;AAAA,QACA,oBAAC,UAAO,OAAO,CAAC,iBAAiB,KAAK,GAAG;AAAA,SAC3C;AAAA,IAEJ;AACA,WACE,oBAAC,QAAK,YAAW,UACf,8BAAC,WAAQ,OAAO,CAAC,iBAAiB,KAAK,GAAG,GAC5C;AAAA,EAEJ,GAAG,CAAC,KAAK,WAAW,KAAK,MAAM,YAAY,cAAc,CAAC;AAE1D,QAAM,kBAAkBA,OAAM,QAAQ,MAAM;AAC1C,QAAI,UAAU;AACZ,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,iBAAiB,YAAY,MAAM;AACvC,aAAS,KAAK,IAAI;AAAA,EACpB,GAAG,CAAC,KAAK,MAAM,QAAQ,CAAC;AAExB,QAAM,CAAC,EAAE,YAAY,IAAIA,OAAM,SAAS,KAAK;AAE7C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,eAAe,MAAM;AAAA,MACrB,wBAAwB,OAAO,CAAC;AAAA,MAC/B,GAAG;AAAA,MAEJ,+BAAC,QAAK,MAAY,YAAY,KAAK,QAAQ,IAAI,QAAO,QAAO,YAAW,UACrE;AAAA,uBAAe,UACd;AAAA,UAAC;AAAA;AAAA,YACC,SAAS,MAAM,aAAa,IAAI;AAAA,YAChC,QAAQ,MAAM,aAAa,KAAK;AAAA,YAChC,SAAS;AAAA,YACT,UAAU;AAAA,YACV,cAAW;AAAA,YACX,OAAO,OAAO,KAAK,IAAI;AAAA;AAAA,QACzB;AAAA,QAED;AAAA,QACD,oBAAC,QAAK,YAAW,YACf,+BAAC,gBAAa,SAAQ,MAAK,IAAI,GAAG,KAAK,aAAa;AAAA;AAAA,UAC5C,KAAK;AAAA,WACb,GACF;AAAA,QACC,iBAAiB,KAChB,qBAAC,QAAK,MAAM,CAAC,eAAe,MAAM,GAAG,QAAO,OAC1C;AAAA,8BAAC,QAAK,YAAW,UACf,8BAAC,iBAAc,YAAU,MAAC,QAAO,OAAM,GACzC;AAAA,UACA,oBAAC,QAAK,YAAW,YACf,+BAAC,gBAAa,SAAQ,MAAK,OAAM,eAC9B;AAAA;AAAA,YAAe;AAAA,aAClB,GACF;AAAA,WACF;AAAA,SAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,eAAe,cAAc;AAC7B,MAAM,2BAA2B,SAAS,cAAc;AACxD,yBAAyB,YAAY;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import React2 from "react";
|
3
|
+
import { useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
|
4
|
+
import { uid } from "uid";
|
5
|
+
import { DSMenuTreeItemPropTypes, defaultProps } from "../react-desc-prop-types.js";
|
6
|
+
import { useValidateProps } from "./useValidateProps.js";
|
7
|
+
const useMenuTreeItem = (propsFromUser) => {
|
8
|
+
const propsWithDefault = useMemoMergePropsWithDefault(propsFromUser, defaultProps);
|
9
|
+
useValidateProps(propsWithDefault, DSMenuTreeItemPropTypes);
|
10
|
+
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
11
|
+
const instanceUid = React2.useMemo(() => uid(5), []);
|
12
|
+
return React2.useMemo(
|
13
|
+
() => ({
|
14
|
+
propsWithDefault,
|
15
|
+
xstyledProps,
|
16
|
+
instanceUid
|
17
|
+
// ...eventHandlers,
|
18
|
+
}),
|
19
|
+
[
|
20
|
+
propsWithDefault,
|
21
|
+
xstyledProps,
|
22
|
+
instanceUid
|
23
|
+
// eventHandlers,
|
24
|
+
]
|
25
|
+
);
|
26
|
+
};
|
27
|
+
export {
|
28
|
+
useMenuTreeItem
|
29
|
+
};
|
30
|
+
//# sourceMappingURL=useMenuTreeItem.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useMenuTreeItem.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { type DSMenuTreeItemT, DSMenuTreeItemPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface MenuTreeItemCTX {\n propsWithDefault: DSMenuTreeItemT.InternalProps;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useMenuTreeItem = (propsFromUser: DSMenuTreeItemT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSMenuTreeItemT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSMenuTreeItemPropTypes);\n // =============================================================================\n // XSTYLED PROPS\n // =============================================================================\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const instanceUid = React.useMemo(() => uid(5), []);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n // const eventHandlers = useEventHandlers({ propsWithDefault, instanceUid }); // <-- complex logic should be made atomics this way\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n xstyledProps,\n instanceUid,\n // ...eventHandlers,\n }),\n [\n propsWithDefault,\n xstyledProps,\n instanceUid,\n // eventHandlers,\n ],\n );\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,oBAAoB,oCAAoC;AACjE,SAAS,WAAW;AACpB,SAA+B,yBAAyB,oBAAoB;AAC5E,SAAS,wBAAwB;AAQ1B,MAAM,kBAAkB,CAAC,kBAAyC;AAIvE,QAAM,mBAAmB,6BAA4D,eAAe,YAAY;AAChH,mBAAiB,kBAAkB,uBAAuB;AAI1D,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,cAAcA,OAAM,QAAQ,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;AAMlD,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,EACF;AACF;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
|
3
|
+
import { DSMenuTreeItemName } from "../constants";
|
4
|
+
const useValidateProps = (props, propTypes) => {
|
5
|
+
useValidateTypescriptPropTypes(props, propTypes, DSMenuTreeItemName);
|
6
|
+
};
|
7
|
+
export {
|
8
|
+
useValidateProps
|
9
|
+
};
|
10
|
+
//# sourceMappingURL=useValidateProps.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { WeakValidationMap } from 'react';\nimport { type DSMenuTreeItemT } from '../react-desc-prop-types';\nimport { DSMenuTreeItemName } from '../constants';\n\nexport const useValidateProps = (props: DSMenuTreeItemT.InternalProps, propTypes: WeakValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSMenuTreeItemName);\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAG/C,SAAS,0BAA0B;AAE5B,MAAM,mBAAmB,CAAC,OAAsC,cAAgD;AAErH,iCAA+B,OAAO,WAAW,kBAAkB;AACrE;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { slotObjectToDataTestIds } from "@elliemae/ds-system";
|
3
|
+
const DSMenuTreeItemName = "DSMenuTreeItem";
|
4
|
+
const EXAMPLE_CONSTANTS = {
|
5
|
+
HELLO: "WORLD",
|
6
|
+
FOO: "BAR"
|
7
|
+
};
|
8
|
+
const MENU_TREE_ITEM_SLOTS = {
|
9
|
+
ROOT: "root"
|
10
|
+
};
|
11
|
+
const MENU_TREE_ITEM_DATA_TESTID = slotObjectToDataTestIds(DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS);
|
12
|
+
export {
|
13
|
+
DSMenuTreeItemName,
|
14
|
+
EXAMPLE_CONSTANTS,
|
15
|
+
MENU_TREE_ITEM_DATA_TESTID,
|
16
|
+
MENU_TREE_ITEM_SLOTS
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSMenuTreeItemName = 'DSMenuTreeItem';\n\nexport const EXAMPLE_CONSTANTS = {\n HELLO: 'WORLD',\n FOO: 'BAR',\n} as const;\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators \nexport const MENU_TREE_ITEM_SLOTS = {\n ROOT: 'root',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const MENU_TREE_ITEM_DATA_TESTID = slotObjectToDataTestIds(DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS)\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,qBAAqB;AAE3B,MAAM,oBAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,KAAK;AACP;AAGO,MAAM,uBAAuB;AAAA,EAClC,MAAM;AACR;AAGO,MAAM,6BAA6B,wBAAwB,oBAAoB,oBAAoB;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import {
|
3
|
+
DSMenuTreeItem,
|
4
|
+
DSMenuTreeItemWithSchema
|
5
|
+
} from "./DSMenuTreeItem";
|
6
|
+
import {} from "./react-desc-prop-types";
|
7
|
+
import {
|
8
|
+
MENU_TREE_ITEM_SLOTS,
|
9
|
+
MENU_TREE_ITEM_DATA_TESTID
|
10
|
+
} from "./constants";
|
11
|
+
export {
|
12
|
+
DSMenuTreeItem,
|
13
|
+
DSMenuTreeItemWithSchema,
|
14
|
+
MENU_TREE_ITEM_DATA_TESTID,
|
15
|
+
MENU_TREE_ITEM_SLOTS
|
16
|
+
};
|
17
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { \n DSMenuTreeItem,\n DSMenuTreeItemWithSchema\n} from './DSMenuTreeItem';\nexport { type DSMenuTreeItemT } from './react-desc-prop-types';\nexport {\n MENU_TREE_ITEM_SLOTS,\n MENU_TREE_ITEM_DATA_TESTID,\n} from './constants';\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,eAAqC;AACrC;AAAA,EACI;AAAA,EACA;AAAA,OACG;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { PropTypes, xstyledPropTypes } from "@elliemae/ds-props-helpers";
|
3
|
+
const defaultProps = {
|
4
|
+
isSelected: false,
|
5
|
+
multiple: false
|
6
|
+
};
|
7
|
+
const itemPropsSchema = PropTypes.shape({
|
8
|
+
dsId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
9
|
+
collapsed: PropTypes.bool,
|
10
|
+
depth: PropTypes.number,
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
12
|
+
subitems: PropTypes.any
|
13
|
+
});
|
14
|
+
const DSMenuTreeItemPropTypes = {
|
15
|
+
...xstyledPropTypes,
|
16
|
+
item: itemPropsSchema.description("some example of proptypes"),
|
17
|
+
onCollapse: PropTypes.func,
|
18
|
+
subitems: PropTypes.object,
|
19
|
+
onSelect: PropTypes.func,
|
20
|
+
isSelected: PropTypes.bool,
|
21
|
+
multiple: PropTypes.bool,
|
22
|
+
depth: PropTypes.number
|
23
|
+
};
|
24
|
+
const DSMenuTreeItemPropTypesSchema = DSMenuTreeItemPropTypes;
|
25
|
+
export {
|
26
|
+
DSMenuTreeItemPropTypes,
|
27
|
+
DSMenuTreeItemPropTypesSchema,
|
28
|
+
defaultProps
|
29
|
+
};
|
30
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type { DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS } from './constants/index.js';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSMenuTreeItemT {\n export interface ItemT {\n dsId: string;\n collapsed?: boolean;\n depth: number;\n subitems: ItemT[] | null;\n }\n\n export interface TreeviewItemProps {\n onCollapse: (dsId: string) => void;\n item: ItemT;\n onSelect?: (dsId: string) => void;\n isSelected?: boolean;\n multiple?: boolean;\n }\n\n export interface RequiredProps {\n item: ItemT;\n dsId: string;\n depth: number;\n }\n\n export interface DefaultProps {\n isSelected?: boolean;\n multiple?: boolean;\n }\n\n export interface OptionalProps extends PropsForGlobalOnSlots<typeof DSMenuTreeItemName, typeof MENU_TREE_ITEM_SLOTS> {\n onCollapse: (dsId: string) => void;\n subitems: ItemT[] | null;\n onSelect?: (dsId: string) => void;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, XstyledProps, RequiredProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, XstyledProps, RequiredProps {}\n\n export type ExampleState = '0' | '1';\n}\n\nexport const defaultProps: DSMenuTreeItemT.DefaultProps = {\n isSelected: false,\n multiple: false,\n};\n\nconst itemPropsSchema = PropTypes.shape({\n dsId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n collapsed: PropTypes.bool,\n depth: PropTypes.number,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n subitems: PropTypes.any,\n});\n\nexport const DSMenuTreeItemPropTypes: DSPropTypesSchema<DSMenuTreeItemT.Props> = {\n ...xstyledPropTypes,\n item: itemPropsSchema.description('some example of proptypes'),\n onCollapse: PropTypes.func,\n subitems: PropTypes.object,\n onSelect: PropTypes.func,\n isSelected: PropTypes.bool,\n multiple: PropTypes.bool,\n depth: PropTypes.number,\n};\n\nexport const DSMenuTreeItemPropTypesSchema =\n DSMenuTreeItemPropTypes as unknown as WeakValidationMap<DSMenuTreeItemT.Props>;\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,WAAW,wBAAwB;AA4CrC,MAAM,eAA6C;AAAA,EACxD,YAAY;AAAA,EACZ,UAAU;AACZ;AAEA,MAAM,kBAAkB,UAAU,MAAM;AAAA,EACtC,MAAM,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,EAAE;AAAA,EAChE,WAAW,UAAU;AAAA,EACrB,OAAO,UAAU;AAAA;AAAA,EAEjB,UAAU,UAAU;AACtB,CAAC;AAEM,MAAM,0BAAoE;AAAA,EAC/E,GAAG;AAAA,EACH,MAAM,gBAAgB,YAAY,2BAA2B;AAAA,EAC7D,YAAY,UAAU;AAAA,EACtB,UAAU,UAAU;AAAA,EACpB,UAAU,UAAU;AAAA,EACpB,YAAY,UAAU;AAAA,EACtB,UAAU,UAAU;AAAA,EACpB,OAAO,UAAU;AACnB;AAEO,MAAM,gCACX;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { styled, css } from "@elliemae/ds-system";
|
3
|
+
import { DSButtonV3 } from "@elliemae/ds-button-v2";
|
4
|
+
import { Grid } from "@elliemae/ds-grid";
|
5
|
+
import { DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS } from "./constants/index.js";
|
6
|
+
const borderStyle = css`
|
7
|
+
outline: 2px solid ${({ theme }) => theme.colors.brand["700"]};
|
8
|
+
outline-offset: -2px;
|
9
|
+
`;
|
10
|
+
const MenuItemWrapper = styled(Grid, { name: DSMenuTreeItemName, slot: MENU_TREE_ITEM_SLOTS.ROOT })`
|
11
|
+
height: 36px;
|
12
|
+
|
13
|
+
${({ isFocused }) => isFocused && borderStyle};
|
14
|
+
&:hover {
|
15
|
+
background-color: ${({ theme }) => theme.colors.brand["200"]};
|
16
|
+
}
|
17
|
+
`;
|
18
|
+
const StyledButton = styled(DSButtonV3)`
|
19
|
+
&:hover:not(:disabled) {
|
20
|
+
background-color: transparent;
|
21
|
+
}
|
22
|
+
`;
|
23
|
+
export {
|
24
|
+
MenuItemWrapper,
|
25
|
+
StyledButton
|
26
|
+
};
|
27
|
+
//# sourceMappingURL=styled.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styled.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css } from '@elliemae/ds-system';\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS } from './constants/index.js';\n\nconst borderStyle = css`\n outline: 2px solid ${({ theme }) => theme.colors.brand['700']};\n outline-offset: -2px;\n`;\n\nexport const MenuItemWrapper = styled(Grid, { name: DSMenuTreeItemName, slot: MENU_TREE_ITEM_SLOTS.ROOT })`\n height: 36px;\n\n ${({ isFocused }: any) => isFocused && borderStyle};\n &:hover {\n background-color: ${({ theme }) => theme.colors.brand['200']};\n }\n`;\n\nexport const StyledButton = styled(DSButtonV3)`\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n`;\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,WAAW;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,oBAAoB,4BAA4B;AAEzD,MAAM,cAAc;AAAA,uBACG,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,KAAK;AAAA;AAAA;AAIvD,MAAM,kBAAkB,OAAO,MAAM,EAAE,MAAM,oBAAoB,MAAM,qBAAqB,KAAK,CAAC;AAAA;AAAA;AAAA,IAGrG,CAAC,EAAE,UAAU,MAAW,aAAa;AAAA;AAAA,wBAEjB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,KAAK;AAAA;AAAA;AAIxD,MAAM,eAAe,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { type DSMenuTreeItemT } from './react-desc-prop-types.js';
|
3
|
+
declare const DSMenuTreeItem: React.ComponentType<DSMenuTreeItemT.Props>;
|
4
|
+
declare const DSMenuTreeItemWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSMenuTreeItemT.Props>;
|
5
|
+
export { DSMenuTreeItem, DSMenuTreeItemWithSchema };
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { useGetXstyledProps } from '@elliemae/ds-props-helpers';
|
2
|
+
import { type DSMenuTreeItemT } from '../react-desc-prop-types.js';
|
3
|
+
export interface MenuTreeItemCTX {
|
4
|
+
propsWithDefault: DSMenuTreeItemT.InternalProps;
|
5
|
+
xstyledProps: ReturnType<typeof useGetXstyledProps>;
|
6
|
+
instanceUid: string;
|
7
|
+
}
|
8
|
+
export declare const useMenuTreeItem: (propsFromUser: DSMenuTreeItemT.Props) => {
|
9
|
+
propsWithDefault: DSMenuTreeItemT.InternalProps;
|
10
|
+
xstyledProps: import("@elliemae/ds-props-helpers").XstyledProps;
|
11
|
+
instanceUid: string;
|
12
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare const DSMenuTreeItemName = "DSMenuTreeItem";
|
2
|
+
export declare const EXAMPLE_CONSTANTS: {
|
3
|
+
readonly HELLO: "WORLD";
|
4
|
+
readonly FOO: "BAR";
|
5
|
+
};
|
6
|
+
export declare const MENU_TREE_ITEM_SLOTS: {
|
7
|
+
readonly ROOT: "root";
|
8
|
+
};
|
9
|
+
export declare const MENU_TREE_ITEM_DATA_TESTID: Record<string, string>;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import type { XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';
|
2
|
+
import type { DSMenuTreeItemName, MENU_TREE_ITEM_SLOTS } from './constants/index.js';
|
3
|
+
import type { WeakValidationMap } from 'react';
|
4
|
+
export declare namespace DSMenuTreeItemT {
|
5
|
+
interface ItemT {
|
6
|
+
dsId: string;
|
7
|
+
collapsed?: boolean;
|
8
|
+
depth: number;
|
9
|
+
subitems: ItemT[] | null;
|
10
|
+
}
|
11
|
+
interface TreeviewItemProps {
|
12
|
+
onCollapse: (dsId: string) => void;
|
13
|
+
item: ItemT;
|
14
|
+
onSelect?: (dsId: string) => void;
|
15
|
+
isSelected?: boolean;
|
16
|
+
multiple?: boolean;
|
17
|
+
}
|
18
|
+
interface RequiredProps {
|
19
|
+
item: ItemT;
|
20
|
+
dsId: string;
|
21
|
+
depth: number;
|
22
|
+
}
|
23
|
+
interface DefaultProps {
|
24
|
+
isSelected?: boolean;
|
25
|
+
multiple?: boolean;
|
26
|
+
}
|
27
|
+
interface OptionalProps extends PropsForGlobalOnSlots<typeof DSMenuTreeItemName, typeof MENU_TREE_ITEM_SLOTS> {
|
28
|
+
onCollapse: (dsId: string) => void;
|
29
|
+
subitems: ItemT[] | null;
|
30
|
+
onSelect?: (dsId: string) => void;
|
31
|
+
}
|
32
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, XstyledProps, RequiredProps {
|
33
|
+
}
|
34
|
+
interface InternalProps extends DefaultProps, OptionalProps, XstyledProps, RequiredProps {
|
35
|
+
}
|
36
|
+
type ExampleState = '0' | '1';
|
37
|
+
}
|
38
|
+
export declare const defaultProps: DSMenuTreeItemT.DefaultProps;
|
39
|
+
export declare const DSMenuTreeItemPropTypes: DSPropTypesSchema<DSMenuTreeItemT.Props>;
|
40
|
+
export declare const DSMenuTreeItemPropTypesSchema: WeakValidationMap<DSMenuTreeItemT.Props>;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare const MenuItemWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, any, never>;
|
3
|
+
export declare const StyledButton: import("styled-components").StyledComponent<import("react").ComponentType<import("@elliemae/ds-button-v2").DSButtonV3T.Props>, import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ComponentType<import("@elliemae/ds-button-v2").DSButtonV3T.Props>>, never>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/package.json
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
{
|
2
|
+
"name": "@elliemae/ds-menu-tree-item",
|
3
|
+
"version": "3.27.0-next.11",
|
4
|
+
"license": "MIT",
|
5
|
+
"description": "ICE MT - Dimsum - Menu Tree Item",
|
6
|
+
"files": [
|
7
|
+
"dist"
|
8
|
+
],
|
9
|
+
"module": "./dist/esm/index.js",
|
10
|
+
"main": "./dist/cjs/index.js",
|
11
|
+
"types": "./dist/types/index.d.ts",
|
12
|
+
"exports": {
|
13
|
+
".": {
|
14
|
+
"import": "./dist/esm/index.js",
|
15
|
+
"require": "./dist/cjs/index.js"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"sideEffects": [
|
19
|
+
"*.css",
|
20
|
+
"*.scss"
|
21
|
+
],
|
22
|
+
"repository": {
|
23
|
+
"type": "git",
|
24
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
25
|
+
},
|
26
|
+
"engines": {
|
27
|
+
"pnpm": ">=6",
|
28
|
+
"node": ">=16"
|
29
|
+
},
|
30
|
+
"author": "ICE MT",
|
31
|
+
"jestSonar": {
|
32
|
+
"sonar56x": true,
|
33
|
+
"reportPath": "reports",
|
34
|
+
"reportFile": "tests.xml",
|
35
|
+
"indent": 4
|
36
|
+
},
|
37
|
+
"dependencies": {
|
38
|
+
"@xstyled/styled-components": "~3.6.0",
|
39
|
+
"@elliemae/ds-button-v2": "3.27.0-next.11",
|
40
|
+
"@elliemae/ds-form-checkbox": "3.27.0-next.11",
|
41
|
+
"@elliemae/ds-grid": "3.27.0-next.11",
|
42
|
+
"@elliemae/ds-form-radio": "3.27.0-next.11",
|
43
|
+
"@elliemae/ds-icons": "3.27.0-next.11",
|
44
|
+
"@elliemae/ds-props-helpers": "3.27.0-next.11",
|
45
|
+
"@elliemae/ds-separator": "3.27.0-next.11",
|
46
|
+
"@elliemae/ds-system": "3.27.0-next.11",
|
47
|
+
"@elliemae/ds-typography": "3.27.0-next.11",
|
48
|
+
"@elliemae/ds-utilities": "3.27.0-next.11"
|
49
|
+
},
|
50
|
+
"devDependencies": {
|
51
|
+
"@elliemae/pui-cli": "~9.0.0-next.31",
|
52
|
+
"styled-components": "~5.3.9",
|
53
|
+
"@elliemae/ds-monorepo-devops": "3.27.0-next.11"
|
54
|
+
},
|
55
|
+
"peerDependencies": {
|
56
|
+
"@testing-library/jest-dom": "~5.16.4",
|
57
|
+
"@testing-library/react": "~12.1.3",
|
58
|
+
"@testing-library/user-event": "~13.5.0",
|
59
|
+
"react": "^17.0.2",
|
60
|
+
"react-dom": "^17.0.2",
|
61
|
+
"styled-components": "~5.3.9"
|
62
|
+
},
|
63
|
+
"publishConfig": {
|
64
|
+
"access": "public",
|
65
|
+
"typeSafety": false
|
66
|
+
},
|
67
|
+
"scripts": {
|
68
|
+
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
69
|
+
"test": "pui-cli test --passWithNoTests",
|
70
|
+
"lint": "node ../../../scripts/lint.mjs --fix",
|
71
|
+
"eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../../.eslintrc.js' src/",
|
72
|
+
"dts": "node ../../scripts/dts.mjs",
|
73
|
+
"dts:withdeps": "pnpm --filter {.}... dts",
|
74
|
+
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
75
|
+
"dev:build": "pnpm --filter {.}... build",
|
76
|
+
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
77
|
+
"checkDeps": "npx -yes ../../util/ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
78
|
+
}
|
79
|
+
}
|