@elliemae/ds-menu-items-action 3.27.0-next.11

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.
Files changed (33) hide show
  1. package/dist/cjs/DSMenuItemsAction.js +86 -0
  2. package/dist/cjs/DSMenuItemsAction.js.map +7 -0
  3. package/dist/cjs/config/useMenuItemsAction.js +58 -0
  4. package/dist/cjs/config/useMenuItemsAction.js.map +7 -0
  5. package/dist/cjs/config/useValidateProps.js +41 -0
  6. package/dist/cjs/config/useValidateProps.js.map +7 -0
  7. package/dist/cjs/constants/index.js +25 -0
  8. package/dist/cjs/constants/index.js.map +7 -0
  9. package/dist/cjs/index.js +38 -0
  10. package/dist/cjs/index.js.map +7 -0
  11. package/dist/cjs/package.json +7 -0
  12. package/dist/cjs/react-desc-prop-types.js +71 -0
  13. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  14. package/dist/esm/DSMenuItemsAction.js +61 -0
  15. package/dist/esm/DSMenuItemsAction.js.map +7 -0
  16. package/dist/esm/config/useMenuItemsAction.js +28 -0
  17. package/dist/esm/config/useMenuItemsAction.js.map +7 -0
  18. package/dist/esm/config/useValidateProps.js +11 -0
  19. package/dist/esm/config/useValidateProps.js.map +7 -0
  20. package/dist/esm/constants/index.js +2 -0
  21. package/dist/esm/constants/index.js.map +7 -0
  22. package/dist/esm/index.js +8 -0
  23. package/dist/esm/index.js.map +7 -0
  24. package/dist/esm/package.json +7 -0
  25. package/dist/esm/react-desc-prop-types.js +44 -0
  26. package/dist/esm/react-desc-prop-types.js.map +7 -0
  27. package/dist/types/DSMenuItemsAction.d.ts +5 -0
  28. package/dist/types/config/useMenuItemsAction.d.ts +13 -0
  29. package/dist/types/config/useValidateProps.d.ts +3 -0
  30. package/dist/types/constants/index.d.ts +0 -0
  31. package/dist/types/index.d.ts +2 -0
  32. package/dist/types/react-desc-prop-types.d.ts +25 -0
  33. package/package.json +76 -0
@@ -0,0 +1,86 @@
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 DSMenuItemsAction_exports = {};
30
+ __export(DSMenuItemsAction_exports, {
31
+ DSMenuItemsAction: () => DSMenuItemsAction,
32
+ DSMenuItemsActionWithSchema: () => DSMenuItemsActionWithSchema
33
+ });
34
+ module.exports = __toCommonJS(DSMenuItemsAction_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_menu_items_commons = require("@elliemae/ds-menu-items-commons");
40
+ var import_react_desc_prop_types = require("./react-desc-prop-types.js");
41
+ var import_useMenuItemsAction = require("./config/useMenuItemsAction.js");
42
+ const DSMenuItemsAction = (props) => {
43
+ const { propsWithDefault, globalProps: globalAttributes, xstyledProps: xStyledProps } = (0, import_useMenuItemsAction.useMenuItemsAction)(props);
44
+ const {
45
+ dsId,
46
+ label,
47
+ secondaryLabel,
48
+ onClick,
49
+ isActive,
50
+ disabled,
51
+ innerRef,
52
+ wrapperStyles,
53
+ optionsShouldHavePadding,
54
+ render: Render
55
+ } = propsWithDefault;
56
+ const gridLayout = import_react.default.useMemo(() => {
57
+ const cols = ["auto"];
58
+ if (secondaryLabel)
59
+ cols.push("min-content");
60
+ return cols;
61
+ }, [secondaryLabel]);
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
63
+ import_ds_menu_items_commons.StyledGlobalMenuItemWrapper,
64
+ {
65
+ id: dsId,
66
+ role: "option",
67
+ isActive,
68
+ disabled,
69
+ onClick: !disabled ? onClick : void 0,
70
+ innerRef,
71
+ pl: optionsShouldHavePadding ? 40 : 16,
72
+ style: wrapperStyles,
73
+ "data-type": "action",
74
+ ...globalAttributes,
75
+ ...xStyledProps,
76
+ children: Render !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Render, { ...propsWithDefault }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyledContentWrapper, { cols: gridLayout, minHeight: "16px", gutter: "xxs", alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyleMenuItemLabel, { children: label }),
78
+ secondaryLabel !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyleMenuItemSecondaryLabel, { children: secondaryLabel })
79
+ ] }) })
80
+ }
81
+ );
82
+ };
83
+ DSMenuItemsAction.displayName = "DSActionMenuItem";
84
+ const DSMenuItemsActionWithSchema = (0, import_ds_props_helpers.describe)(DSMenuItemsAction);
85
+ DSMenuItemsActionWithSchema.propTypes = import_react_desc_prop_types.DSMenuItemsActionPropTypesSchema;
86
+ //# sourceMappingURL=DSMenuItemsAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSMenuItemsAction.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport {\n StyledGlobalMenuItemWrapper,\n StyledContentWrapper,\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n} from '@elliemae/ds-menu-items-commons';\nimport { type DSMenuItemsActionT, DSMenuItemsActionPropTypesSchema } from './react-desc-prop-types.js';\nimport { useMenuItemsAction } from './config/useMenuItemsAction.js';\n\nconst DSMenuItemsAction: React.ComponentType<DSMenuItemsActionT.Props> = (props) => {\n const { propsWithDefault, globalProps: globalAttributes, xstyledProps: xStyledProps } = useMenuItemsAction(props);\n\n const {\n dsId,\n label,\n secondaryLabel,\n onClick,\n isActive,\n disabled,\n innerRef,\n wrapperStyles,\n optionsShouldHavePadding,\n render: Render,\n } = propsWithDefault;\n\n const gridLayout = React.useMemo(() => {\n const cols = ['auto'];\n if (secondaryLabel) cols.push('min-content');\n return cols;\n }, [secondaryLabel]);\n\n return (\n <StyledGlobalMenuItemWrapper\n id={dsId}\n role=\"option\"\n isActive={isActive}\n disabled={disabled}\n onClick={!disabled ? onClick : undefined}\n innerRef={innerRef}\n pl={optionsShouldHavePadding ? 40 : 16}\n style={wrapperStyles}\n data-type=\"action\"\n {...globalAttributes}\n {...xStyledProps}\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <StyledContentWrapper cols={gridLayout} minHeight=\"16px\" gutter=\"xxs\" alignItems=\"center\">\n <>\n <StyleMenuItemLabel>{label}</StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel>{secondaryLabel}</StyleMenuItemSecondaryLabel>\n )}\n </>\n </StyledContentWrapper>\n )}\n </StyledGlobalMenuItemWrapper>\n );\n};\n\n// this is `'DSActionMenuItem'` for legacy reasons, when moving to inheritance pattern this has been kept as it was to avoid complications\nDSMenuItemsAction.displayName = 'DSActionMenuItem';\nconst DSMenuItemsActionWithSchema = describe(DSMenuItemsAction);\nDSMenuItemsActionWithSchema.propTypes = DSMenuItemsActionPropTypesSchema;\n\nexport { DSMenuItemsAction, DSMenuItemsActionWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgDf;AAhDR,mBAAkB;AAClB,8BAAyB;AACzB,mCAKO;AACP,mCAA0E;AAC1E,gCAAmC;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,EAAE,kBAAkB,aAAa,kBAAkB,cAAc,aAAa,QAAI,8CAAmB,KAAK;AAEhH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,IAAI;AAEJ,QAAM,aAAa,aAAAA,QAAM,QAAQ,MAAM;AACrC,UAAM,OAAO,CAAC,MAAM;AACpB,QAAI;AAAgB,WAAK,KAAK,aAAa;AAC3C,WAAO;AAAA,EACT,GAAG,CAAC,cAAc,CAAC;AAEnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI;AAAA,MACJ,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,CAAC,WAAW,UAAU;AAAA,MAC/B;AAAA,MACA,IAAI,2BAA2B,KAAK;AAAA,MACpC,OAAO;AAAA,MACP,aAAU;AAAA,MACT,GAAG;AAAA,MACH,GAAG;AAAA,MAEH,qBAAW,SACV,4CAAC,UAAQ,GAAG,kBAAkB,IAE9B,4CAAC,qDAAqB,MAAM,YAAY,WAAU,QAAO,QAAO,OAAM,YAAW,UAC/E,sFACE;AAAA,oDAAC,mDAAoB,iBAAM;AAAA,QAC1B,mBAAmB,UAClB,4CAAC,4DAA6B,0BAAe;AAAA,SAEjD,GACF;AAAA;AAAA,EAEJ;AAEJ;AAGA,kBAAkB,cAAc;AAChC,MAAM,kCAA8B,kCAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,58 @@
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 useMenuItemsAction_exports = {};
30
+ __export(useMenuItemsAction_exports, {
31
+ useMenuItemsAction: () => useMenuItemsAction
32
+ });
33
+ module.exports = __toCommonJS(useMenuItemsAction_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_react = __toESM(require("react"));
36
+ var import_lodash = require("lodash");
37
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
38
+ var import_react_desc_prop_types = require("../react-desc-prop-types.js");
39
+ var import_useValidateProps = require("./useValidateProps.js");
40
+ const useMenuItemsAction = (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.DSMenuItemsActionPropTypes);
43
+ const globalProps = (0, import_lodash.omit)((0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefault), [
44
+ "cols",
45
+ "rows",
46
+ "wrap"
47
+ ]);
48
+ const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
49
+ return import_react.default.useMemo(
50
+ () => ({
51
+ propsWithDefault,
52
+ globalProps,
53
+ xstyledProps
54
+ }),
55
+ [propsWithDefault, globalProps, xstyledProps]
56
+ );
57
+ };
58
+ //# sourceMappingURL=useMenuItemsAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useMenuItemsAction.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport { omit } from 'lodash';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { type DSMenuItemsActionT, DSMenuItemsActionPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface MenuItemsActionCTX {\n propsWithDefault: DSMenuItemsActionT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n}\n\nexport const useMenuItemsAction = (propsFromUser: DSMenuItemsActionT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSMenuItemsActionT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSMenuItemsActionPropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = omit(useGetGlobalAttributes<DSMenuItemsActionT.InternalProps>(propsWithDefault), [\n 'cols',\n 'rows',\n 'wrap',\n ]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n }),\n [propsWithDefault, globalProps, xstyledProps],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,oBAAqB;AACrB,8BAAyF;AACzF,mCAAkF;AAClF,8BAAiC;AAQ1B,MAAM,qBAAqB,CAAC,kBAA4C;AAI7E,QAAM,uBAAmB,sDAA+D,eAAe,yCAAY;AACnH,gDAAiB,kBAAkB,uDAA0B;AAI7D,QAAM,kBAAc,wBAAK,gDAAyD,gBAAgB,GAAG;AAAA,IACnG;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,mBAAe,4CAAmB,gBAAgB;AAKxD,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,YAAY;AAAA,EAC9C;AACF;",
6
+ "names": ["React"]
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 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_ds_menu_items_commons = require("@elliemae/ds-menu-items-commons");
37
+ const DSMenuItemsActionName = `${import_ds_menu_items_commons.DSMenuItemName}Action`;
38
+ const useValidateProps = (props, propTypes) => {
39
+ (0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, DSMenuItemsActionName);
40
+ };
41
+ //# 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 { DSMenuItemName } from '@elliemae/ds-menu-items-commons';\nimport type { WeakValidationMap } from 'react';\nimport { type DSMenuItemsActionT } from '../react-desc-prop-types.js';\n\n// because this is inherited from the common props, we do not want to put this in the /constants/index.ts file\n// this is strictly defined here because this is meant to strictly influence ONLY the ERROR layer\n// this is 100% decoupled from ds-slots & data-testid\n// this constants only affect the shown error message as of 21/december/2023\nconst DSMenuItemsActionName = `${DSMenuItemName}Action`;\n\nexport const useValidateProps = (\n props: DSMenuItemsActionT.InternalProps,\n propTypes: WeakValidationMap<unknown>,\n): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSMenuItemsActionName);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA+C;AAC/C,mCAA+B;AAQ/B,MAAM,wBAAwB,GAAG;AAE1B,MAAM,mBAAmB,CAC9B,OACA,cACS;AAET,8DAA+B,OAAO,WAAW,qBAAqB;AACxE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,25 @@
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var React = __toESM(require("react"));
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,38 @@
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
+ DSMenuItemsAction: () => import_DSMenuItemsAction.DSMenuItemsAction,
32
+ DSMenuItemsActionWithSchema: () => import_DSMenuItemsAction.DSMenuItemsActionWithSchema
33
+ });
34
+ module.exports = __toCommonJS(src_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_DSMenuItemsAction = require("./DSMenuItemsAction.js");
37
+ var import_react_desc_prop_types = require("./react-desc-prop-types.js");
38
+ //# 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 { DSMenuItemsAction, DSMenuItemsActionWithSchema } from './DSMenuItemsAction.js';\nexport { type DSMenuItemsActionT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,+BAA+D;AAC/D,mCAAwC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "commonjs",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -0,0 +1,71 @@
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
+ DSMenuItemsActionPropTypes: () => DSMenuItemsActionPropTypes,
32
+ DSMenuItemsActionPropTypesSchema: () => DSMenuItemsActionPropTypesSchema,
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
+ var import_ds_menu_items_commons = require("@elliemae/ds-menu-items-commons");
39
+ const defaultProps = {
40
+ ...import_ds_menu_items_commons.DSMenuItemsCommonsDefaultProps,
41
+ label: "",
42
+ value: void 0,
43
+ disabled: false,
44
+ isActive: false,
45
+ onClick: () => {
46
+ },
47
+ optionsShouldHavePadding: false,
48
+ tabIndex: 0
49
+ };
50
+ const { tabIndex, label, value, ...notOvverriddenGlobalPropsTypes } = import_ds_props_helpers.globalAttributesPropTypes;
51
+ const DSMenuItemsActionPropTypes = {
52
+ // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps
53
+ // they are NOT inherited from a common element from ds-menu-items-commons
54
+ ...notOvverriddenGlobalPropsTypes,
55
+ ...import_ds_props_helpers.xstyledPropTypes,
56
+ ...import_ds_menu_items_commons.DSMenuItemsCommonsPropTypes,
57
+ // TODO - add support to PropTypes.oneOf for typeof number
58
+ // currently PropTypes.oneOf([0, -1]) is not supported
59
+ tabIndex: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.number, import_ds_props_helpers.PropTypes.string]).description(
60
+ "The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed."
61
+ ),
62
+ label: import_ds_props_helpers.PropTypes.string.description("The label of the menu item."),
63
+ value: import_ds_props_helpers.PropTypes.any.description("The value of the menu item."),
64
+ isActive: import_ds_props_helpers.PropTypes.bool.description("Whether the menu item is active."),
65
+ optionsShouldHavePadding: import_ds_props_helpers.PropTypes.bool.description(
66
+ "Whether the menu item should have padding. This is used in the context of a menu with options."
67
+ ),
68
+ secondaryLabel: import_ds_props_helpers.PropTypes.string.description("The secondary label of the menu item.")
69
+ };
70
+ const DSMenuItemsActionPropTypesSchema = DSMenuItemsActionPropTypes;
71
+ //# 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-duplicate-type-constituents */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport {\n type DSMenuItemsCommonsT,\n DSMenuItemsCommonsPropTypes,\n DSMenuItemsCommonsDefaultProps,\n} from '@elliemae/ds-menu-items-commons';\nimport type React from 'react';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSMenuItemsActionT {\n // typescript inheritance has no syntax support for \"interfaces\", we have to use union types instead...\n export type RequiredProps = DSMenuItemsCommonsT.RequiredProps;\n\n export type DefaultProps = DSMenuItemsCommonsT.DefaultProps & {\n label: string;\n value: unknown;\n disabled: boolean;\n isActive: boolean;\n onClick: React.MouseEventHandler;\n optionsShouldHavePadding: boolean;\n tabIndex: 0 | -1 | '0' | '-1';\n };\n\n export type OptionalProps = DSMenuItemsCommonsT.OptionalProps<DSMenuItemsActionT.InternalProps> & {\n secondaryLabel?: string;\n };\n\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSMenuItemsActionT.DefaultProps = {\n ...DSMenuItemsCommonsDefaultProps,\n label: '',\n value: undefined,\n disabled: false,\n isActive: false,\n onClick: () => {},\n optionsShouldHavePadding: false,\n tabIndex: 0,\n};\n\n// we are removing some keys from the global attributes because they are overridden by the action props\n// eslint-disable-next-line no-unused-vars\nconst { tabIndex, label, value, ...notOvverriddenGlobalPropsTypes } = globalAttributesPropTypes;\n\nexport const DSMenuItemsActionPropTypes: DSPropTypesSchema<DSMenuItemsActionT.InternalProps> = {\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n ...notOvverriddenGlobalPropsTypes,\n ...xstyledPropTypes,\n ...DSMenuItemsCommonsPropTypes,\n\n // TODO - add support to PropTypes.oneOf for typeof number\n // currently PropTypes.oneOf([0, -1]) is not supported\n tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(\n 'The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed.',\n ),\n label: PropTypes.string.description('The label of the menu item.'),\n value: PropTypes.any.description('The value of the menu item.'),\n isActive: PropTypes.bool.description('Whether the menu item is active.'),\n optionsShouldHavePadding: PropTypes.bool.description(\n 'Whether the menu item should have padding. This is used in the context of a menu with options.',\n ),\n secondaryLabel: PropTypes.string.description('The secondary label of the menu item.'),\n};\n\nexport const DSMenuItemsActionPropTypesSchema =\n DSMenuItemsActionPropTypes as unknown as WeakValidationMap<DSMenuItemsActionT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAAuE;AACvE,mCAIO;AA6CA,MAAM,eAAgD;AAAA,EAC3D,GAAG;AAAA,EACH,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,0BAA0B;AAAA,EAC1B,UAAU;AACZ;AAIA,MAAM,EAAE,UAAU,OAAO,OAAO,GAAG,+BAA+B,IAAI;AAE/D,MAAM,6BAAkF;AAAA;AAAA;AAAA,EAG7F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA;AAAA;AAAA,EAIH,UAAU,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,EAAE;AAAA,IAClE;AAAA,EACF;AAAA,EACA,OAAO,kCAAU,OAAO,YAAY,6BAA6B;AAAA,EACjE,OAAO,kCAAU,IAAI,YAAY,6BAA6B;AAAA,EAC9D,UAAU,kCAAU,KAAK,YAAY,kCAAkC;AAAA,EACvE,0BAA0B,kCAAU,KAAK;AAAA,IACvC;AAAA,EACF;AAAA,EACA,gBAAgB,kCAAU,OAAO,YAAY,uCAAuC;AACtF;AAEO,MAAM,mCACX;",
6
+ "names": []
7
+ }
@@ -0,0 +1,61 @@
1
+ import * as React from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import React2 from "react";
4
+ import { describe } from "@elliemae/ds-props-helpers";
5
+ import {
6
+ StyledGlobalMenuItemWrapper,
7
+ StyledContentWrapper,
8
+ StyleMenuItemLabel,
9
+ StyleMenuItemSecondaryLabel
10
+ } from "@elliemae/ds-menu-items-commons";
11
+ import { DSMenuItemsActionPropTypesSchema } from "./react-desc-prop-types.js";
12
+ import { useMenuItemsAction } from "./config/useMenuItemsAction.js";
13
+ const DSMenuItemsAction = (props) => {
14
+ const { propsWithDefault, globalProps: globalAttributes, xstyledProps: xStyledProps } = useMenuItemsAction(props);
15
+ const {
16
+ dsId,
17
+ label,
18
+ secondaryLabel,
19
+ onClick,
20
+ isActive,
21
+ disabled,
22
+ innerRef,
23
+ wrapperStyles,
24
+ optionsShouldHavePadding,
25
+ render: Render
26
+ } = propsWithDefault;
27
+ const gridLayout = React2.useMemo(() => {
28
+ const cols = ["auto"];
29
+ if (secondaryLabel)
30
+ cols.push("min-content");
31
+ return cols;
32
+ }, [secondaryLabel]);
33
+ return /* @__PURE__ */ jsx(
34
+ StyledGlobalMenuItemWrapper,
35
+ {
36
+ id: dsId,
37
+ role: "option",
38
+ isActive,
39
+ disabled,
40
+ onClick: !disabled ? onClick : void 0,
41
+ innerRef,
42
+ pl: optionsShouldHavePadding ? 40 : 16,
43
+ style: wrapperStyles,
44
+ "data-type": "action",
45
+ ...globalAttributes,
46
+ ...xStyledProps,
47
+ children: Render !== void 0 ? /* @__PURE__ */ jsx(Render, { ...propsWithDefault }) : /* @__PURE__ */ jsx(StyledContentWrapper, { cols: gridLayout, minHeight: "16px", gutter: "xxs", alignItems: "center", children: /* @__PURE__ */ jsxs(Fragment, { children: [
48
+ /* @__PURE__ */ jsx(StyleMenuItemLabel, { children: label }),
49
+ secondaryLabel !== void 0 && /* @__PURE__ */ jsx(StyleMenuItemSecondaryLabel, { children: secondaryLabel })
50
+ ] }) })
51
+ }
52
+ );
53
+ };
54
+ DSMenuItemsAction.displayName = "DSActionMenuItem";
55
+ const DSMenuItemsActionWithSchema = describe(DSMenuItemsAction);
56
+ DSMenuItemsActionWithSchema.propTypes = DSMenuItemsActionPropTypesSchema;
57
+ export {
58
+ DSMenuItemsAction,
59
+ DSMenuItemsActionWithSchema
60
+ };
61
+ //# sourceMappingURL=DSMenuItemsAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSMenuItemsAction.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport {\n StyledGlobalMenuItemWrapper,\n StyledContentWrapper,\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n} from '@elliemae/ds-menu-items-commons';\nimport { type DSMenuItemsActionT, DSMenuItemsActionPropTypesSchema } from './react-desc-prop-types.js';\nimport { useMenuItemsAction } from './config/useMenuItemsAction.js';\n\nconst DSMenuItemsAction: React.ComponentType<DSMenuItemsActionT.Props> = (props) => {\n const { propsWithDefault, globalProps: globalAttributes, xstyledProps: xStyledProps } = useMenuItemsAction(props);\n\n const {\n dsId,\n label,\n secondaryLabel,\n onClick,\n isActive,\n disabled,\n innerRef,\n wrapperStyles,\n optionsShouldHavePadding,\n render: Render,\n } = propsWithDefault;\n\n const gridLayout = React.useMemo(() => {\n const cols = ['auto'];\n if (secondaryLabel) cols.push('min-content');\n return cols;\n }, [secondaryLabel]);\n\n return (\n <StyledGlobalMenuItemWrapper\n id={dsId}\n role=\"option\"\n isActive={isActive}\n disabled={disabled}\n onClick={!disabled ? onClick : undefined}\n innerRef={innerRef}\n pl={optionsShouldHavePadding ? 40 : 16}\n style={wrapperStyles}\n data-type=\"action\"\n {...globalAttributes}\n {...xStyledProps}\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <StyledContentWrapper cols={gridLayout} minHeight=\"16px\" gutter=\"xxs\" alignItems=\"center\">\n <>\n <StyleMenuItemLabel>{label}</StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel>{secondaryLabel}</StyleMenuItemSecondaryLabel>\n )}\n </>\n </StyledContentWrapper>\n )}\n </StyledGlobalMenuItemWrapper>\n );\n};\n\n// this is `'DSActionMenuItem'` for legacy reasons, when moving to inheritance pattern this has been kept as it was to avoid complications\nDSMenuItemsAction.displayName = 'DSActionMenuItem';\nconst DSMenuItemsActionWithSchema = describe(DSMenuItemsAction);\nDSMenuItemsActionWithSchema.propTypes = DSMenuItemsActionPropTypesSchema;\n\nexport { DSMenuItemsAction, DSMenuItemsActionWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACgDf,SAGE,UAHF,KAGE,YAHF;AAhDR,OAAOA,YAAW;AAClB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAkC,wCAAwC;AAC1E,SAAS,0BAA0B;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,EAAE,kBAAkB,aAAa,kBAAkB,cAAc,aAAa,IAAI,mBAAmB,KAAK;AAEhH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,IAAI;AAEJ,QAAM,aAAaA,OAAM,QAAQ,MAAM;AACrC,UAAM,OAAO,CAAC,MAAM;AACpB,QAAI;AAAgB,WAAK,KAAK,aAAa;AAC3C,WAAO;AAAA,EACT,GAAG,CAAC,cAAc,CAAC;AAEnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI;AAAA,MACJ,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,CAAC,WAAW,UAAU;AAAA,MAC/B;AAAA,MACA,IAAI,2BAA2B,KAAK;AAAA,MACpC,OAAO;AAAA,MACP,aAAU;AAAA,MACT,GAAG;AAAA,MACH,GAAG;AAAA,MAEH,qBAAW,SACV,oBAAC,UAAQ,GAAG,kBAAkB,IAE9B,oBAAC,wBAAqB,MAAM,YAAY,WAAU,QAAO,QAAO,OAAM,YAAW,UAC/E,2CACE;AAAA,4BAAC,sBAAoB,iBAAM;AAAA,QAC1B,mBAAmB,UAClB,oBAAC,+BAA6B,0BAAe;AAAA,SAEjD,GACF;AAAA;AAAA,EAEJ;AAEJ;AAGA,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,28 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { omit } from "lodash";
4
+ import { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
5
+ import { DSMenuItemsActionPropTypes, defaultProps } from "../react-desc-prop-types.js";
6
+ import { useValidateProps } from "./useValidateProps.js";
7
+ const useMenuItemsAction = (propsFromUser) => {
8
+ const propsWithDefault = useMemoMergePropsWithDefault(propsFromUser, defaultProps);
9
+ useValidateProps(propsWithDefault, DSMenuItemsActionPropTypes);
10
+ const globalProps = omit(useGetGlobalAttributes(propsWithDefault), [
11
+ "cols",
12
+ "rows",
13
+ "wrap"
14
+ ]);
15
+ const xstyledProps = useGetXstyledProps(propsWithDefault);
16
+ return React2.useMemo(
17
+ () => ({
18
+ propsWithDefault,
19
+ globalProps,
20
+ xstyledProps
21
+ }),
22
+ [propsWithDefault, globalProps, xstyledProps]
23
+ );
24
+ };
25
+ export {
26
+ useMenuItemsAction
27
+ };
28
+ //# sourceMappingURL=useMenuItemsAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useMenuItemsAction.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { omit } from 'lodash';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { type DSMenuItemsActionT, DSMenuItemsActionPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface MenuItemsActionCTX {\n propsWithDefault: DSMenuItemsActionT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n}\n\nexport const useMenuItemsAction = (propsFromUser: DSMenuItemsActionT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSMenuItemsActionT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSMenuItemsActionPropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = omit(useGetGlobalAttributes<DSMenuItemsActionT.InternalProps>(propsWithDefault), [\n 'cols',\n 'rows',\n 'wrap',\n ]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n }),\n [propsWithDefault, globalProps, xstyledProps],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,YAAY;AACrB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAkC,4BAA4B,oBAAoB;AAClF,SAAS,wBAAwB;AAQ1B,MAAM,qBAAqB,CAAC,kBAA4C;AAI7E,QAAM,mBAAmB,6BAA+D,eAAe,YAAY;AACnH,mBAAiB,kBAAkB,0BAA0B;AAI7D,QAAM,cAAc,KAAK,uBAAyD,gBAAgB,GAAG;AAAA,IACnG;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,YAAY;AAAA,EAC9C;AACF;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
3
+ import { DSMenuItemName } from "@elliemae/ds-menu-items-commons";
4
+ const DSMenuItemsActionName = `${DSMenuItemName}Action`;
5
+ const useValidateProps = (props, propTypes) => {
6
+ useValidateTypescriptPropTypes(props, propTypes, DSMenuItemsActionName);
7
+ };
8
+ export {
9
+ useValidateProps
10
+ };
11
+ //# 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 { DSMenuItemName } from '@elliemae/ds-menu-items-commons';\nimport type { WeakValidationMap } from 'react';\nimport { type DSMenuItemsActionT } from '../react-desc-prop-types.js';\n\n// because this is inherited from the common props, we do not want to put this in the /constants/index.ts file\n// this is strictly defined here because this is meant to strictly influence ONLY the ERROR layer\n// this is 100% decoupled from ds-slots & data-testid\n// this constants only affect the shown error message as of 21/december/2023\nconst DSMenuItemsActionName = `${DSMenuItemName}Action`;\n\nexport const useValidateProps = (\n props: DSMenuItemsActionT.InternalProps,\n propTypes: WeakValidationMap<unknown>,\n): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSMenuItemsActionName);\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAC/C,SAAS,sBAAsB;AAQ/B,MAAM,wBAAwB,GAAG;AAE1B,MAAM,mBAAmB,CAC9B,OACA,cACS;AAET,iCAA+B,OAAO,WAAW,qBAAqB;AACxE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import { DSMenuItemsAction, DSMenuItemsActionWithSchema } from "./DSMenuItemsAction.js";
3
+ import {} from "./react-desc-prop-types.js";
4
+ export {
5
+ DSMenuItemsAction,
6
+ DSMenuItemsActionWithSchema
7
+ };
8
+ //# 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 { DSMenuItemsAction, DSMenuItemsActionWithSchema } from './DSMenuItemsAction.js';\nexport { type DSMenuItemsActionT } from './react-desc-prop-types.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,mBAAmB,mCAAmC;AAC/D,eAAwC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -0,0 +1,44 @@
1
+ import * as React from "react";
2
+ import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from "@elliemae/ds-props-helpers";
3
+ import {
4
+ DSMenuItemsCommonsPropTypes,
5
+ DSMenuItemsCommonsDefaultProps
6
+ } from "@elliemae/ds-menu-items-commons";
7
+ const defaultProps = {
8
+ ...DSMenuItemsCommonsDefaultProps,
9
+ label: "",
10
+ value: void 0,
11
+ disabled: false,
12
+ isActive: false,
13
+ onClick: () => {
14
+ },
15
+ optionsShouldHavePadding: false,
16
+ tabIndex: 0
17
+ };
18
+ const { tabIndex, label, value, ...notOvverriddenGlobalPropsTypes } = globalAttributesPropTypes;
19
+ const DSMenuItemsActionPropTypes = {
20
+ // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps
21
+ // they are NOT inherited from a common element from ds-menu-items-commons
22
+ ...notOvverriddenGlobalPropsTypes,
23
+ ...xstyledPropTypes,
24
+ ...DSMenuItemsCommonsPropTypes,
25
+ // TODO - add support to PropTypes.oneOf for typeof number
26
+ // currently PropTypes.oneOf([0, -1]) is not supported
27
+ tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(
28
+ "The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed."
29
+ ),
30
+ label: PropTypes.string.description("The label of the menu item."),
31
+ value: PropTypes.any.description("The value of the menu item."),
32
+ isActive: PropTypes.bool.description("Whether the menu item is active."),
33
+ optionsShouldHavePadding: PropTypes.bool.description(
34
+ "Whether the menu item should have padding. This is used in the context of a menu with options."
35
+ ),
36
+ secondaryLabel: PropTypes.string.description("The secondary label of the menu item.")
37
+ };
38
+ const DSMenuItemsActionPropTypesSchema = DSMenuItemsActionPropTypes;
39
+ export {
40
+ DSMenuItemsActionPropTypes,
41
+ DSMenuItemsActionPropTypesSchema,
42
+ defaultProps
43
+ };
44
+ //# 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-duplicate-type-constituents */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport {\n type DSMenuItemsCommonsT,\n DSMenuItemsCommonsPropTypes,\n DSMenuItemsCommonsDefaultProps,\n} from '@elliemae/ds-menu-items-commons';\nimport type React from 'react';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSMenuItemsActionT {\n // typescript inheritance has no syntax support for \"interfaces\", we have to use union types instead...\n export type RequiredProps = DSMenuItemsCommonsT.RequiredProps;\n\n export type DefaultProps = DSMenuItemsCommonsT.DefaultProps & {\n label: string;\n value: unknown;\n disabled: boolean;\n isActive: boolean;\n onClick: React.MouseEventHandler;\n optionsShouldHavePadding: boolean;\n tabIndex: 0 | -1 | '0' | '-1';\n };\n\n export type OptionalProps = DSMenuItemsCommonsT.OptionalProps<DSMenuItemsActionT.InternalProps> & {\n secondaryLabel?: string;\n };\n\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSMenuItemsActionT.DefaultProps = {\n ...DSMenuItemsCommonsDefaultProps,\n label: '',\n value: undefined,\n disabled: false,\n isActive: false,\n onClick: () => {},\n optionsShouldHavePadding: false,\n tabIndex: 0,\n};\n\n// we are removing some keys from the global attributes because they are overridden by the action props\n// eslint-disable-next-line no-unused-vars\nconst { tabIndex, label, value, ...notOvverriddenGlobalPropsTypes } = globalAttributesPropTypes;\n\nexport const DSMenuItemsActionPropTypes: DSPropTypesSchema<DSMenuItemsActionT.InternalProps> = {\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n ...notOvverriddenGlobalPropsTypes,\n ...xstyledPropTypes,\n ...DSMenuItemsCommonsPropTypes,\n\n // TODO - add support to PropTypes.oneOf for typeof number\n // currently PropTypes.oneOf([0, -1]) is not supported\n tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(\n 'The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed.',\n ),\n label: PropTypes.string.description('The label of the menu item.'),\n value: PropTypes.any.description('The value of the menu item.'),\n isActive: PropTypes.bool.description('Whether the menu item is active.'),\n optionsShouldHavePadding: PropTypes.bool.description(\n 'Whether the menu item should have padding. This is used in the context of a menu with options.',\n ),\n secondaryLabel: PropTypes.string.description('The secondary label of the menu item.'),\n};\n\nexport const DSMenuItemsActionPropTypesSchema =\n DSMenuItemsActionPropTypes as unknown as WeakValidationMap<DSMenuItemsActionT.Props>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,WAAW,2BAA2B,wBAAwB;AACvE;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AA6CA,MAAM,eAAgD;AAAA,EAC3D,GAAG;AAAA,EACH,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,0BAA0B;AAAA,EAC1B,UAAU;AACZ;AAIA,MAAM,EAAE,UAAU,OAAO,OAAO,GAAG,+BAA+B,IAAI;AAE/D,MAAM,6BAAkF;AAAA;AAAA;AAAA,EAG7F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA;AAAA;AAAA,EAIH,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,EAAE;AAAA,IAClE;AAAA,EACF;AAAA,EACA,OAAO,UAAU,OAAO,YAAY,6BAA6B;AAAA,EACjE,OAAO,UAAU,IAAI,YAAY,6BAA6B;AAAA,EAC9D,UAAU,UAAU,KAAK,YAAY,kCAAkC;AAAA,EACvE,0BAA0B,UAAU,KAAK;AAAA,IACvC;AAAA,EACF;AAAA,EACA,gBAAgB,UAAU,OAAO,YAAY,uCAAuC;AACtF;AAEO,MAAM,mCACX;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { type DSMenuItemsActionT } from './react-desc-prop-types.js';
3
+ declare const DSMenuItemsAction: React.ComponentType<DSMenuItemsActionT.Props>;
4
+ declare const DSMenuItemsActionWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSMenuItemsActionT.Props>;
5
+ export { DSMenuItemsAction, DSMenuItemsActionWithSchema };
@@ -0,0 +1,13 @@
1
+ /// <reference types="lodash" />
2
+ import { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';
3
+ import { type DSMenuItemsActionT } from '../react-desc-prop-types.js';
4
+ export interface MenuItemsActionCTX {
5
+ propsWithDefault: DSMenuItemsActionT.InternalProps;
6
+ globalProps: ReturnType<typeof useGetGlobalAttributes>;
7
+ xstyledProps: ReturnType<typeof useGetXstyledProps>;
8
+ }
9
+ export declare const useMenuItemsAction: (propsFromUser: DSMenuItemsActionT.Props) => {
10
+ propsWithDefault: DSMenuItemsActionT.InternalProps;
11
+ globalProps: import("lodash").Omit<import("@elliemae/ds-props-helpers").GlobalAttributesT<Element>, "cols" | "rows" | "wrap">;
12
+ xstyledProps: import("@elliemae/ds-props-helpers").XstyledProps;
13
+ };
@@ -0,0 +1,3 @@
1
+ import type { WeakValidationMap } from 'react';
2
+ import { type DSMenuItemsActionT } from '../react-desc-prop-types.js';
3
+ export declare const useValidateProps: (props: DSMenuItemsActionT.InternalProps, propTypes: WeakValidationMap<unknown>) => void;
File without changes
@@ -0,0 +1,2 @@
1
+ export { DSMenuItemsAction, DSMenuItemsActionWithSchema } from './DSMenuItemsAction.js';
2
+ export { type DSMenuItemsActionT } from './react-desc-prop-types.js';
@@ -0,0 +1,25 @@
1
+ import type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';
2
+ import { type DSMenuItemsCommonsT } from '@elliemae/ds-menu-items-commons';
3
+ import type React from 'react';
4
+ export declare namespace DSMenuItemsActionT {
5
+ type RequiredProps = DSMenuItemsCommonsT.RequiredProps;
6
+ type DefaultProps = DSMenuItemsCommonsT.DefaultProps & {
7
+ label: string;
8
+ value: unknown;
9
+ disabled: boolean;
10
+ isActive: boolean;
11
+ onClick: React.MouseEventHandler;
12
+ optionsShouldHavePadding: boolean;
13
+ tabIndex: 0 | -1 | '0' | '-1';
14
+ };
15
+ type OptionalProps = DSMenuItemsCommonsT.OptionalProps<DSMenuItemsActionT.InternalProps> & {
16
+ secondaryLabel?: string;
17
+ };
18
+ interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps>, XstyledProps, RequiredProps {
19
+ }
20
+ interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps>, XstyledProps, RequiredProps {
21
+ }
22
+ }
23
+ export declare const defaultProps: DSMenuItemsActionT.DefaultProps;
24
+ export declare const DSMenuItemsActionPropTypes: DSPropTypesSchema<DSMenuItemsActionT.InternalProps>;
25
+ export declare const DSMenuItemsActionPropTypesSchema: React.WeakValidationMap<DSMenuItemsActionT.Props>;
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@elliemae/ds-menu-items-action",
3
+ "version": "3.27.0-next.11",
4
+ "license": "MIT",
5
+ "description": "ICE MT - Dimsum - Menu Items Action",
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": "3.27.0-next.11",
40
+ "@elliemae/ds-grid": "3.27.0-next.11",
41
+ "@elliemae/ds-menu-items-commons": "3.27.0-next.11",
42
+ "@elliemae/ds-props-helpers": "3.27.0-next.11",
43
+ "@elliemae/ds-system": "3.27.0-next.11",
44
+ "@elliemae/ds-utilities": "3.27.0-next.11"
45
+ },
46
+ "devDependencies": {
47
+ "lodash": "^4.17.21",
48
+ "styled-components": "~5.3.9",
49
+ "@elliemae/ds-monorepo-devops": "3.27.0-next.11"
50
+ },
51
+ "peerDependencies": {
52
+ "@testing-library/jest-dom": "~5.16.4",
53
+ "@testing-library/react": "~12.1.3",
54
+ "@testing-library/user-event": "~13.5.0",
55
+ "lodash": "^4.17.21",
56
+ "react": "^17.0.2",
57
+ "react-dom": "^17.0.2",
58
+ "styled-components": "~5.3.9"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public",
62
+ "typeSafety": true
63
+ },
64
+ "scripts": {
65
+ "dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
66
+ "test": "pui-cli test --passWithNoTests",
67
+ "lint": "node ../../../scripts/lint.mjs --fix",
68
+ "eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../../.eslintrc.js' src/",
69
+ "dts": "node ../../scripts/dts.mjs",
70
+ "dts:withdeps": "pnpm --filter {.}... dts",
71
+ "build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
72
+ "dev:build": "pnpm --filter {.}... build",
73
+ "dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
74
+ "checkDeps": "npx -yes ../../util/ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
75
+ }
76
+ }