@elliemae/ds-menu-items 3.9.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/ActionMenuItem/index.js +70 -0
- package/dist/cjs/components/ActionMenuItem/index.js.map +7 -0
- package/dist/cjs/components/MultiMenuItem/index.js +92 -0
- package/dist/cjs/components/MultiMenuItem/index.js.map +7 -0
- package/dist/cjs/components/Section/index.js +58 -0
- package/dist/cjs/components/Section/index.js.map +7 -0
- package/dist/cjs/components/Separator/index.js +53 -0
- package/dist/cjs/components/Separator/index.js.map +7 -0
- package/dist/cjs/components/SingleMenuItem/index.js +95 -0
- package/dist/cjs/components/SingleMenuItem/index.js.map +7 -0
- package/dist/cjs/components/SingleWithSubmenuItem/index.js +158 -0
- package/dist/cjs/components/SingleWithSubmenuItem/index.js.map +7 -0
- package/dist/cjs/components/SingleWithSubmenuItem/useGetSubmenuHandlers.js +83 -0
- package/dist/cjs/components/SingleWithSubmenuItem/useGetSubmenuHandlers.js.map +7 -0
- package/dist/cjs/components/SubmenuItem/index.js +147 -0
- package/dist/cjs/components/SubmenuItem/index.js.map +7 -0
- package/dist/cjs/components/SubmenuItem/useGetSubmenuHandlers.js +83 -0
- package/dist/cjs/components/SubmenuItem/useGetSubmenuHandlers.js.map +7 -0
- package/dist/cjs/components/index.js +32 -0
- package/dist/cjs/components/index.js.map +7 -0
- package/dist/cjs/components/styled.js +159 -0
- package/dist/cjs/components/styled.js.map +7 -0
- package/dist/cjs/index.js +26 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +118 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/esm/components/ActionMenuItem/index.js +44 -0
- package/dist/esm/components/ActionMenuItem/index.js.map +7 -0
- package/dist/esm/components/MultiMenuItem/index.js +66 -0
- package/dist/esm/components/MultiMenuItem/index.js.map +7 -0
- package/dist/esm/components/Section/index.js +32 -0
- package/dist/esm/components/Section/index.js.map +7 -0
- package/dist/esm/components/Separator/index.js +27 -0
- package/dist/esm/components/Separator/index.js.map +7 -0
- package/dist/esm/components/SingleMenuItem/index.js +69 -0
- package/dist/esm/components/SingleMenuItem/index.js.map +7 -0
- package/dist/esm/components/SingleWithSubmenuItem/index.js +138 -0
- package/dist/esm/components/SingleWithSubmenuItem/index.js.map +7 -0
- package/dist/esm/components/SingleWithSubmenuItem/useGetSubmenuHandlers.js +57 -0
- package/dist/esm/components/SingleWithSubmenuItem/useGetSubmenuHandlers.js.map +7 -0
- package/dist/esm/components/SubmenuItem/index.js +127 -0
- package/dist/esm/components/SubmenuItem/index.js.map +7 -0
- package/dist/esm/components/SubmenuItem/useGetSubmenuHandlers.js +57 -0
- package/dist/esm/components/SubmenuItem/useGetSubmenuHandlers.js.map +7 -0
- package/dist/esm/components/index.js +9 -0
- package/dist/esm/components/index.js.map +7 -0
- package/dist/esm/components/styled.js +140 -0
- package/dist/esm/components/styled.js.map +7 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +92 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/package.json +62 -0
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var react_desc_prop_types_exports = {};
|
|
26
|
+
__export(react_desc_prop_types_exports, {
|
|
27
|
+
defaultActionProps: () => defaultActionProps,
|
|
28
|
+
defaultCommonProps: () => defaultCommonProps,
|
|
29
|
+
defaultMultiProps: () => defaultMultiProps,
|
|
30
|
+
defaultSectionProps: () => defaultSectionProps,
|
|
31
|
+
defaultSeparatorProps: () => defaultSeparatorProps,
|
|
32
|
+
defaultSingleProps: () => defaultSingleProps,
|
|
33
|
+
defaultSingleWithSubmenuProps: () => defaultSingleWithSubmenuProps,
|
|
34
|
+
defaultSubmenuProps: () => defaultSubmenuProps,
|
|
35
|
+
itemProps: () => itemProps
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
38
|
+
var React = __toESM(require("react"));
|
|
39
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
40
|
+
const noop = () => null;
|
|
41
|
+
const defaultCommonProps = {
|
|
42
|
+
innerRef: noop,
|
|
43
|
+
wrapperStyles: {}
|
|
44
|
+
};
|
|
45
|
+
const defaultActionProps = {
|
|
46
|
+
...defaultCommonProps,
|
|
47
|
+
label: "",
|
|
48
|
+
value: void 0,
|
|
49
|
+
disabled: false,
|
|
50
|
+
isActive: false,
|
|
51
|
+
onClick: noop,
|
|
52
|
+
optionsShouldHavePadding: false
|
|
53
|
+
};
|
|
54
|
+
const defaultMultiProps = {
|
|
55
|
+
...defaultCommonProps,
|
|
56
|
+
label: "",
|
|
57
|
+
isActive: false,
|
|
58
|
+
disabled: false,
|
|
59
|
+
isSelected: false,
|
|
60
|
+
onClick: noop,
|
|
61
|
+
onMouseDown: noop,
|
|
62
|
+
onMouseEnter: noop,
|
|
63
|
+
onMouseLeave: noop,
|
|
64
|
+
tabIndex: 0
|
|
65
|
+
};
|
|
66
|
+
const defaultSingleProps = {
|
|
67
|
+
...defaultCommonProps,
|
|
68
|
+
label: "",
|
|
69
|
+
isActive: false,
|
|
70
|
+
disabled: false,
|
|
71
|
+
isSelected: false,
|
|
72
|
+
onClick: noop,
|
|
73
|
+
onMouseDown: noop,
|
|
74
|
+
onMouseEnter: noop,
|
|
75
|
+
onMouseLeave: noop,
|
|
76
|
+
dataTestid: "",
|
|
77
|
+
tabIndex: 0
|
|
78
|
+
};
|
|
79
|
+
const defaultSubmenuProps = {
|
|
80
|
+
...defaultCommonProps,
|
|
81
|
+
label: "",
|
|
82
|
+
isActive: false,
|
|
83
|
+
disabled: false,
|
|
84
|
+
isSubmenuOpened: false,
|
|
85
|
+
onSubmenuOpen: noop,
|
|
86
|
+
rightAddon: "chevron",
|
|
87
|
+
optionsShouldHavePadding: false,
|
|
88
|
+
Dropdown: noop,
|
|
89
|
+
dropdownProps: {
|
|
90
|
+
options: [],
|
|
91
|
+
onSubmenuToggle: noop,
|
|
92
|
+
openedSubmenus: {},
|
|
93
|
+
selectedOptions: {},
|
|
94
|
+
onKeyDown: noop,
|
|
95
|
+
onOptionClick: noop,
|
|
96
|
+
onClickOutside: noop,
|
|
97
|
+
minWidth: "auto",
|
|
98
|
+
maxHeight: "auto"
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const defaultSectionProps = {
|
|
102
|
+
...defaultCommonProps,
|
|
103
|
+
label: ""
|
|
104
|
+
};
|
|
105
|
+
const defaultSeparatorProps = {
|
|
106
|
+
...defaultCommonProps
|
|
107
|
+
};
|
|
108
|
+
const defaultSingleWithSubmenuProps = {
|
|
109
|
+
...defaultSingleProps,
|
|
110
|
+
...defaultSubmenuProps
|
|
111
|
+
};
|
|
112
|
+
const itemProps = {
|
|
113
|
+
dsId: import_ds_utilities.PropTypes.string,
|
|
114
|
+
innerRef: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.func, import_ds_utilities.PropTypes.shape({ current: import_ds_utilities.PropTypes.any })]),
|
|
115
|
+
wrapperStyles: import_ds_utilities.PropTypes.object,
|
|
116
|
+
render: import_ds_utilities.PropTypes.func
|
|
117
|
+
};
|
|
118
|
+
//# 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-explicit-any */\nimport React, { PropsWithChildren, WeakValidationMap } from 'react';\nimport { SizingProps } from '@elliemae/ds-system';\nimport { PropTypes } from '@elliemae/ds-utilities';\n\nexport namespace DSMenuItemT {\n export interface CommonProps<T = Record<string, unknown>> {\n dsId: string;\n innerRef?: React.RefObject<HTMLLIElement> | ((_ref: HTMLLIElement) => void);\n wrapperStyles?: Record<string, unknown>;\n render?: React.ComponentType<T>;\n }\n\n export interface ActionProps extends CommonProps<ActionProps> {\n label?: string;\n value?: unknown;\n disabled?: boolean;\n isActive?: boolean;\n onClick?: React.MouseEventHandler;\n optionsShouldHavePadding?: boolean;\n }\n\n export interface MultiProps extends CommonProps<MultiProps> {\n label?: string;\n isActive?: boolean;\n disabled?: boolean;\n isSelected?: boolean;\n onClick?: React.MouseEventHandler;\n onMouseDown?: React.MouseEventHandler;\n onMouseEnter?: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n tabIndex?: number;\n }\n\n export interface SingleProps extends CommonProps<SingleProps> {\n label?: string;\n isActive?: boolean;\n disabled?: boolean;\n isSelected?: boolean;\n onClick?: React.MouseEventHandler;\n onMouseDown?: React.MouseEventHandler;\n onMouseEnter?: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n dataTestid?: string;\n tabIndex?: number;\n }\n\n export interface SubmenuProps extends CommonProps<SubmenuProps> {\n label?: string;\n isActive?: boolean;\n disabled?: boolean;\n isSubmenuOpened?: boolean;\n onSubmenuOpen?: React.MouseEventHandler;\n onSubmenuClose?: React.MouseEventHandler;\n rightAddon?: 'ellipsis' | 'chevron';\n optionsShouldHavePadding?: boolean;\n onMouseEnter?: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n Dropdown: React.ComponentType<PropsWithChildren<SubmenuProps['dropdownProps']>>;\n dropdownProps?: {\n options: any[];\n onSubmenuToggle?: (\n nextOpenedSubmenus: Record<string, boolean>,\n submenu: any,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n openedSubmenus?: Record<string, boolean>;\n selectedOptions?: Record<string, boolean>;\n onKeyDown?: React.KeyboardEventHandler;\n onOptionClick?: (\n nextSelectedOptions: Record<string, boolean>,\n clickedOption: any,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n onClickOutside?: (e: React.MouseEvent | React.KeyboardEvent | React.TouchEvent) => void;\n minWidth?: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n [key: string]: unknown;\n };\n }\n\n export interface SectionProps extends CommonProps<SectionProps> {\n label?: string;\n }\n\n export type SeparatorProps = CommonProps<SeparatorProps>;\n\n export interface SingleWithSubmenuProps extends Omit<SingleProps, 'render'>, Omit<SubmenuProps, 'render'> {\n render?: React.ComponentType<SingleWithSubmenuProps>;\n }\n}\n\nconst noop = () => null;\n\nexport const defaultCommonProps: Partial<Omit<DSMenuItemT.CommonProps, 'render'>> = {\n innerRef: noop,\n wrapperStyles: {},\n};\n\nexport const defaultActionProps: Partial<DSMenuItemT.ActionProps> = {\n ...defaultCommonProps,\n label: '',\n value: undefined,\n disabled: false,\n isActive: false,\n onClick: noop,\n optionsShouldHavePadding: false,\n};\n\nexport const defaultMultiProps: Partial<DSMenuItemT.MultiProps> = {\n ...defaultCommonProps,\n label: '',\n isActive: false,\n disabled: false,\n isSelected: false,\n onClick: noop,\n onMouseDown: noop,\n onMouseEnter: noop,\n onMouseLeave: noop,\n tabIndex: 0,\n};\n\nexport const defaultSingleProps: Partial<DSMenuItemT.SingleProps> = {\n ...defaultCommonProps,\n label: '',\n isActive: false,\n disabled: false,\n isSelected: false,\n onClick: noop,\n onMouseDown: noop,\n onMouseEnter: noop,\n onMouseLeave: noop,\n dataTestid: '',\n tabIndex: 0,\n};\n\nexport const defaultSubmenuProps: Partial<DSMenuItemT.SubmenuProps> = {\n ...defaultCommonProps,\n label: '',\n isActive: false,\n disabled: false,\n isSubmenuOpened: false,\n onSubmenuOpen: noop,\n rightAddon: 'chevron',\n optionsShouldHavePadding: false,\n Dropdown: noop,\n dropdownProps: {\n options: [],\n onSubmenuToggle: noop,\n openedSubmenus: {},\n selectedOptions: {},\n onKeyDown: noop,\n onOptionClick: noop,\n onClickOutside: noop,\n minWidth: 'auto',\n maxHeight: 'auto',\n },\n};\n\nexport const defaultSectionProps: Partial<DSMenuItemT.SectionProps> = {\n ...defaultCommonProps,\n label: '',\n};\n\nexport const defaultSeparatorProps: Partial<DSMenuItemT.SeparatorProps> = {\n ...defaultCommonProps,\n};\n\nexport const defaultSingleWithSubmenuProps: Partial<Omit<DSMenuItemT.SingleWithSubmenuProps, 'render'>> = {\n ...defaultSingleProps,\n ...defaultSubmenuProps,\n};\n\nexport const itemProps = {\n dsId: PropTypes.string,\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),\n wrapperStyles: PropTypes.object,\n render: PropTypes.func,\n} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,0BAA0B;AAyF1B,MAAM,OAAO,MAAM;AAEZ,MAAM,qBAAuE;AAAA,EAClF,UAAU;AAAA,EACV,eAAe,CAAC;AAClB;AAEO,MAAM,qBAAuD;AAAA,EAClE,GAAG;AAAA,EACH,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA,EACT,0BAA0B;AAC5B;AAEO,MAAM,oBAAqD;AAAA,EAChE,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,cAAc;AAAA,EACd,cAAc;AAAA,EACd,UAAU;AACZ;AAEO,MAAM,qBAAuD;AAAA,EAClE,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,cAAc;AAAA,EACd,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,UAAU;AACZ;AAEO,MAAM,sBAAyD;AAAA,EACpE,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,eAAe;AAAA,IACb,SAAS,CAAC;AAAA,IACV,iBAAiB;AAAA,IACjB,gBAAgB,CAAC;AAAA,IACjB,iBAAiB,CAAC;AAAA,IAClB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,WAAW;AAAA,EACb;AACF;AAEO,MAAM,sBAAyD;AAAA,EACpE,GAAG;AAAA,EACH,OAAO;AACT;AAEO,MAAM,wBAA6D;AAAA,EACxE,GAAG;AACL;AAEO,MAAM,gCAA6F;AAAA,EACxG,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,YAAY;AAAA,EACvB,MAAM,8BAAU;AAAA,EAChB,UAAU,8BAAU,UAAU,CAAC,8BAAU,MAAM,8BAAU,MAAM,EAAE,SAAS,8BAAU,IAAI,CAAC,CAAC,CAAC;AAAA,EAC3F,eAAe,8BAAU;AAAA,EACzB,QAAQ,8BAAU;AACpB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
4
|
+
import { defaultActionProps, itemProps } from "../../react-desc-prop-types";
|
|
5
|
+
import { StyledGlobalMenuItemWrapper, StyledItemLabel } from "../styled";
|
|
6
|
+
const ActionMenuItem = (props) => {
|
|
7
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultActionProps);
|
|
8
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
9
|
+
const {
|
|
10
|
+
dsId,
|
|
11
|
+
label,
|
|
12
|
+
onClick,
|
|
13
|
+
isActive,
|
|
14
|
+
disabled,
|
|
15
|
+
innerRef,
|
|
16
|
+
wrapperStyles,
|
|
17
|
+
optionsShouldHavePadding,
|
|
18
|
+
render: Render
|
|
19
|
+
} = propsWithDefault;
|
|
20
|
+
return /* @__PURE__ */ jsx(StyledGlobalMenuItemWrapper, {
|
|
21
|
+
id: dsId,
|
|
22
|
+
role: "option",
|
|
23
|
+
isActive,
|
|
24
|
+
disabled,
|
|
25
|
+
onClick: !disabled ? onClick : void 0,
|
|
26
|
+
ref: innerRef,
|
|
27
|
+
pl: optionsShouldHavePadding ? 40 : 16,
|
|
28
|
+
style: wrapperStyles,
|
|
29
|
+
children: Render !== void 0 ? /* @__PURE__ */ jsx(Render, {
|
|
30
|
+
...propsWithDefault
|
|
31
|
+
}) : /* @__PURE__ */ jsx(StyledItemLabel, {
|
|
32
|
+
children: label
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
ActionMenuItem.propTypes = itemProps;
|
|
37
|
+
ActionMenuItem.displayName = "ActionMenuItem";
|
|
38
|
+
const ActionMenuItemWithSchema = describe(ActionMenuItem);
|
|
39
|
+
ActionMenuItemWithSchema.propTypes = itemProps;
|
|
40
|
+
export {
|
|
41
|
+
ActionMenuItem,
|
|
42
|
+
ActionMenuItemWithSchema
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/ActionMenuItem/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { DSMenuItemT, defaultActionProps, itemProps } from '../../react-desc-prop-types';\nimport { StyledGlobalMenuItemWrapper, StyledItemLabel } from '../styled';\n\nconst ActionMenuItem = (props: DSMenuItemT.ActionProps): JSX.Element => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultActionProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, itemProps);\n\n const {\n dsId,\n label,\n onClick,\n isActive,\n disabled,\n innerRef,\n wrapperStyles,\n optionsShouldHavePadding,\n render: Render,\n } = propsWithDefault;\n\n return (\n <StyledGlobalMenuItemWrapper\n id={dsId}\n role=\"option\"\n isActive={isActive}\n disabled={disabled}\n onClick={!disabled ? onClick : undefined}\n ref={innerRef}\n pl={optionsShouldHavePadding ? 40 : 16}\n style={wrapperStyles}\n >\n {Render !== undefined ? <Render {...propsWithDefault} /> : <StyledItemLabel>{label}</StyledItemLabel>}\n </StyledGlobalMenuItemWrapper>\n );\n};\n\nActionMenuItem.propTypes = itemProps;\nActionMenuItem.displayName = 'ActionMenuItem';\nconst ActionMenuItemWithSchema = describe(ActionMenuItem);\nActionMenuItemWithSchema.propTypes = itemProps;\n\nexport { ActionMenuItem, ActionMenuItemWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,UAAU,8BAA8B,sCAAsC;AACvF,SAAsB,oBAAoB,iBAAiB;AAC3D,SAAS,6BAA6B,uBAAuB;AAE7D,MAAM,iBAAiB,CAAC,UAAgD;AACtE,QAAM,mBAAmB,6BAA6B,OAAO,kBAAkB;AAE/E,iCAA+B,kBAAkB,SAAS;AAE1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,IAAI;AAEJ,SACE,oBAAC;AAAA,IACC,IAAI;AAAA,IACJ,MAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA,SAAS,CAAC,WAAW,UAAU;AAAA,IAC/B,KAAK;AAAA,IACL,IAAI,2BAA2B,KAAK;AAAA,IACpC,OAAO;AAAA,IAEN,qBAAW,SAAY,oBAAC;AAAA,MAAQ,GAAG;AAAA,KAAkB,IAAK,oBAAC;AAAA,MAAiB;AAAA,KAAM;AAAA,GACrF;AAEJ;AAEA,eAAe,YAAY;AAC3B,eAAe,cAAc;AAC7B,MAAM,2BAA2B,SAAS,cAAc;AACxD,yBAAyB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
4
|
+
import { DSControlledCheckbox } from "@elliemae/ds-form-checkbox";
|
|
5
|
+
import { defaultMultiProps, itemProps } from "../../react-desc-prop-types";
|
|
6
|
+
import { StyledGlobalMenuItemWrapper, StyledItemContent } from "../styled";
|
|
7
|
+
const noop = () => null;
|
|
8
|
+
const MultiMenuItem = (props) => {
|
|
9
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultMultiProps);
|
|
10
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
11
|
+
const {
|
|
12
|
+
dsId,
|
|
13
|
+
label,
|
|
14
|
+
disabled,
|
|
15
|
+
isSelected,
|
|
16
|
+
isActive,
|
|
17
|
+
onClick,
|
|
18
|
+
innerRef,
|
|
19
|
+
onMouseEnter,
|
|
20
|
+
onMouseLeave,
|
|
21
|
+
onMouseDown,
|
|
22
|
+
wrapperStyles,
|
|
23
|
+
tabIndex,
|
|
24
|
+
render: Render
|
|
25
|
+
} = propsWithDefault;
|
|
26
|
+
return /* @__PURE__ */ jsx(StyledGlobalMenuItemWrapper, {
|
|
27
|
+
id: dsId,
|
|
28
|
+
disabled,
|
|
29
|
+
isActive,
|
|
30
|
+
isSelected,
|
|
31
|
+
ref: innerRef,
|
|
32
|
+
onMouseDown,
|
|
33
|
+
onMouseEnter,
|
|
34
|
+
onMouseLeave,
|
|
35
|
+
role: "option",
|
|
36
|
+
className: isActive ? "ds-list-item-active" : "",
|
|
37
|
+
"aria-selected": isSelected,
|
|
38
|
+
style: wrapperStyles,
|
|
39
|
+
onClick,
|
|
40
|
+
"data-testid": "combobox-option",
|
|
41
|
+
children: /* @__PURE__ */ jsx(StyledItemContent, {
|
|
42
|
+
children: Render !== void 0 ? /* @__PURE__ */ jsx(Render, {
|
|
43
|
+
...props
|
|
44
|
+
}) : /* @__PURE__ */ jsx(DSControlledCheckbox, {
|
|
45
|
+
disabled,
|
|
46
|
+
checked: isSelected,
|
|
47
|
+
onMouseDown,
|
|
48
|
+
name: label,
|
|
49
|
+
label,
|
|
50
|
+
onChange: noop,
|
|
51
|
+
tabIndex,
|
|
52
|
+
wrapLabel: true,
|
|
53
|
+
device: "desktop"
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
MultiMenuItem.propTypes = itemProps;
|
|
59
|
+
MultiMenuItem.displayName = "MultiMenuItem";
|
|
60
|
+
const MultiMenuItemWithSchema = describe(MultiMenuItem);
|
|
61
|
+
MultiMenuItemWithSchema.propTypes = itemProps;
|
|
62
|
+
export {
|
|
63
|
+
MultiMenuItem,
|
|
64
|
+
MultiMenuItemWithSchema
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/MultiMenuItem/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { DSControlledCheckbox } from '@elliemae/ds-form-checkbox';\nimport { DSMenuItemT, defaultMultiProps, itemProps } from '../../react-desc-prop-types';\nimport { StyledGlobalMenuItemWrapper, StyledItemContent } from '../styled';\n\nconst noop = () => null;\n\nconst MultiMenuItem: React.ComponentType<DSMenuItemT.MultiProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultMultiProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, itemProps);\n\n const {\n dsId,\n label,\n disabled,\n isSelected,\n isActive,\n onClick,\n innerRef,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n wrapperStyles,\n tabIndex,\n render: Render,\n } = propsWithDefault;\n\n return (\n <StyledGlobalMenuItemWrapper\n id={dsId}\n disabled={disabled}\n isActive={isActive}\n isSelected={isSelected}\n ref={innerRef}\n onMouseDown={onMouseDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n role=\"option\"\n className={isActive ? 'ds-list-item-active' : ''}\n aria-selected={isSelected}\n style={wrapperStyles}\n onClick={onClick}\n data-testid=\"combobox-option\"\n >\n <StyledItemContent>\n {Render !== undefined ? (\n <Render {...props} />\n ) : (\n <DSControlledCheckbox\n disabled={disabled}\n checked={isSelected}\n onMouseDown={onMouseDown}\n name={label}\n label={label}\n onChange={noop}\n tabIndex={tabIndex}\n wrapLabel\n device=\"desktop\"\n />\n )}\n </StyledItemContent>\n </StyledGlobalMenuItemWrapper>\n );\n};\n\nMultiMenuItem.propTypes = itemProps;\nMultiMenuItem.displayName = 'MultiMenuItem';\nconst MultiMenuItemWithSchema = describe(MultiMenuItem);\nMultiMenuItemWithSchema.propTypes = itemProps;\n\nexport { MultiMenuItem, MultiMenuItemWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,UAAU,8BAA8B,sCAAsC;AACvF,SAAS,4BAA4B;AACrC,SAAsB,mBAAmB,iBAAiB;AAC1D,SAAS,6BAA6B,yBAAyB;AAE/D,MAAM,OAAO,MAAM;AAEnB,MAAM,gBAA6D,CAAC,UAAU;AAC5E,QAAM,mBAAmB,6BAA6B,OAAO,iBAAiB;AAE9E,iCAA+B,kBAAkB,SAAS;AAE1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,IAAI;AAEJ,SACE,oBAAC;AAAA,IACC,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAK;AAAA,IACL,WAAW,WAAW,wBAAwB;AAAA,IAC9C,iBAAe;AAAA,IACf,OAAO;AAAA,IACP;AAAA,IACA,eAAY;AAAA,IAEZ,8BAAC;AAAA,MACE,qBAAW,SACV,oBAAC;AAAA,QAAQ,GAAG;AAAA,OAAO,IAEnB,oBAAC;AAAA,QACC;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA,MAAM;AAAA,QACN;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA,WAAS;AAAA,QACT,QAAO;AAAA,OACT;AAAA,KAEJ;AAAA,GACF;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,0BAA0B,SAAS,aAAa;AACtD,wBAAwB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Grid } from "@elliemae/ds-grid";
|
|
4
|
+
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
5
|
+
import { defaultSectionProps, itemProps } from "../../react-desc-prop-types";
|
|
6
|
+
import { StyledSectionWrapper, StyledGroupLabel } from "../styled";
|
|
7
|
+
const Section = (props) => {
|
|
8
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultSectionProps);
|
|
9
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
10
|
+
const { label, wrapperStyles, innerRef, render: Render } = props;
|
|
11
|
+
return /* @__PURE__ */ jsx(StyledSectionWrapper, {
|
|
12
|
+
style: wrapperStyles,
|
|
13
|
+
ref: innerRef,
|
|
14
|
+
role: "presentation",
|
|
15
|
+
children: Render !== void 0 ? /* @__PURE__ */ jsx(Render, {
|
|
16
|
+
...props
|
|
17
|
+
}) : /* @__PURE__ */ jsx(Grid, {
|
|
18
|
+
children: /* @__PURE__ */ jsx(StyledGroupLabel, {
|
|
19
|
+
children: label
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
Section.propTypes = itemProps;
|
|
25
|
+
Section.displayName = "Section";
|
|
26
|
+
const SectionWithSchema = describe(Section);
|
|
27
|
+
SectionWithSchema.propTypes = itemProps;
|
|
28
|
+
export {
|
|
29
|
+
Section,
|
|
30
|
+
SectionWithSchema
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/Section/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { DSMenuItemT, defaultSectionProps, itemProps } from '../../react-desc-prop-types';\nimport { StyledSectionWrapper, StyledGroupLabel } from '../styled';\n\nconst Section: React.ComponentType<DSMenuItemT.SectionProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultSectionProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, itemProps);\n\n const { label, wrapperStyles, innerRef, render: Render } = props;\n\n return (\n <StyledSectionWrapper style={wrapperStyles} ref={innerRef} role=\"presentation\">\n {Render !== undefined ? (\n <Render {...props} />\n ) : (\n <Grid>\n <StyledGroupLabel>{label}</StyledGroupLabel>\n </Grid>\n )}\n </StyledSectionWrapper>\n );\n};\n\nSection.propTypes = itemProps;\nSection.displayName = 'Section';\nconst SectionWithSchema = describe(Section);\nSectionWithSchema.propTypes = itemProps;\n\nexport { Section, SectionWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,YAAY;AACrB,SAAS,UAAU,8BAA8B,sCAAsC;AACvF,SAAsB,qBAAqB,iBAAiB;AAC5D,SAAS,sBAAsB,wBAAwB;AAEvD,MAAM,UAAyD,CAAC,UAAU;AACxE,QAAM,mBAAmB,6BAA6B,OAAO,mBAAmB;AAEhF,iCAA+B,kBAAkB,SAAS;AAE1D,QAAM,EAAE,OAAO,eAAe,UAAU,QAAQ,OAAO,IAAI;AAE3D,SACE,oBAAC;AAAA,IAAqB,OAAO;AAAA,IAAe,KAAK;AAAA,IAAU,MAAK;AAAA,IAC7D,qBAAW,SACV,oBAAC;AAAA,MAAQ,GAAG;AAAA,KAAO,IAEnB,oBAAC;AAAA,MACC,8BAAC;AAAA,QAAkB;AAAA,OAAM;AAAA,KAC3B;AAAA,GAEJ;AAEJ;AAEA,QAAQ,YAAY;AACpB,QAAQ,cAAc;AACtB,MAAM,oBAAoB,SAAS,OAAO;AAC1C,kBAAkB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
4
|
+
import { itemProps, defaultSeparatorProps } from "../../react-desc-prop-types";
|
|
5
|
+
import { StyledSeparatorWrapper, StyledSeparator } from "../styled";
|
|
6
|
+
const Separator = (props) => {
|
|
7
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultSeparatorProps);
|
|
8
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
9
|
+
const { wrapperStyles, innerRef, render: Render } = propsWithDefault;
|
|
10
|
+
return /* @__PURE__ */ jsx(StyledSeparatorWrapper, {
|
|
11
|
+
style: wrapperStyles,
|
|
12
|
+
ref: innerRef,
|
|
13
|
+
role: "separator",
|
|
14
|
+
children: Render ? /* @__PURE__ */ jsx(Render, {
|
|
15
|
+
...props
|
|
16
|
+
}) : /* @__PURE__ */ jsx(StyledSeparator, {})
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
Separator.propTypes = itemProps;
|
|
20
|
+
Separator.displayName = "Separator";
|
|
21
|
+
const SeparatorWithSchema = describe(Separator);
|
|
22
|
+
SeparatorWithSchema.propTypes = itemProps;
|
|
23
|
+
export {
|
|
24
|
+
Separator,
|
|
25
|
+
SeparatorWithSchema
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/Separator/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { DSMenuItemT, itemProps, defaultSeparatorProps } from '../../react-desc-prop-types';\nimport { StyledSeparatorWrapper, StyledSeparator } from '../styled';\n\nconst Separator: React.ComponentType<DSMenuItemT.SeparatorProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultSeparatorProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, itemProps);\n const { wrapperStyles, innerRef, render: Render } = propsWithDefault;\n return (\n <StyledSeparatorWrapper style={wrapperStyles} ref={innerRef} role=\"separator\">\n {Render ? <Render {...props} /> : <StyledSeparator />}\n </StyledSeparatorWrapper>\n );\n};\n\nSeparator.propTypes = itemProps;\nSeparator.displayName = 'Separator';\nconst SeparatorWithSchema = describe(Separator);\nSeparatorWithSchema.propTypes = itemProps;\n\nexport { Separator, SeparatorWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,UAAU,8BAA8B,sCAAsC;AACvF,SAAsB,WAAW,6BAA6B;AAC9D,SAAS,wBAAwB,uBAAuB;AAExD,MAAM,YAA6D,CAAC,UAAU;AAC5E,QAAM,mBAAmB,6BAA6B,OAAO,qBAAqB;AAElF,iCAA+B,kBAAkB,SAAS;AAC1D,QAAM,EAAE,eAAe,UAAU,QAAQ,OAAO,IAAI;AACpD,SACE,oBAAC;AAAA,IAAuB,OAAO;AAAA,IAAe,KAAK;AAAA,IAAU,MAAK;AAAA,IAC/D,mBAAS,oBAAC;AAAA,MAAQ,GAAG;AAAA,KAAO,IAAK,oBAAC,mBAAgB;AAAA,GACrD;AAEJ;AAEA,UAAU,YAAY;AACtB,UAAU,cAAc;AACxB,MAAM,sBAAsB,SAAS,SAAS;AAC9C,oBAAoB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
4
|
+
import { Checkmark } from "@elliemae/ds-icons";
|
|
5
|
+
import Grid from "@elliemae/ds-grid";
|
|
6
|
+
import { defaultSingleProps, itemProps } from "../../react-desc-prop-types";
|
|
7
|
+
import { StyledGlobalMenuItemWrapper, StyleMenuItemLabel } from "../styled";
|
|
8
|
+
const SingleMenuItem = (props) => {
|
|
9
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultSingleProps);
|
|
10
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
11
|
+
const {
|
|
12
|
+
dsId,
|
|
13
|
+
label,
|
|
14
|
+
isSelected,
|
|
15
|
+
onClick,
|
|
16
|
+
isActive,
|
|
17
|
+
innerRef,
|
|
18
|
+
onMouseDown,
|
|
19
|
+
onMouseEnter,
|
|
20
|
+
onMouseLeave,
|
|
21
|
+
wrapperStyles,
|
|
22
|
+
render: Render,
|
|
23
|
+
dataTestid,
|
|
24
|
+
disabled
|
|
25
|
+
} = propsWithDefault;
|
|
26
|
+
return /* @__PURE__ */ jsx(StyledGlobalMenuItemWrapper, {
|
|
27
|
+
"aria-selected": isSelected,
|
|
28
|
+
id: dsId,
|
|
29
|
+
role: "option",
|
|
30
|
+
isActive,
|
|
31
|
+
isSelected,
|
|
32
|
+
onClick,
|
|
33
|
+
ref: innerRef,
|
|
34
|
+
onMouseDown,
|
|
35
|
+
onMouseEnter,
|
|
36
|
+
onMouseLeave,
|
|
37
|
+
className: isActive ? "ds-list-item-active" : "",
|
|
38
|
+
style: wrapperStyles,
|
|
39
|
+
"data-testid": dataTestid,
|
|
40
|
+
disabled,
|
|
41
|
+
children: Render !== void 0 ? /* @__PURE__ */ jsx(Render, {
|
|
42
|
+
...props
|
|
43
|
+
}) : /* @__PURE__ */ jsxs(Grid, {
|
|
44
|
+
cols: ["16px", "auto"],
|
|
45
|
+
minHeight: "16px",
|
|
46
|
+
gutter: "xxs",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsx("div", {
|
|
50
|
+
children: isSelected && /* @__PURE__ */ jsx(Checkmark, {
|
|
51
|
+
size: "s",
|
|
52
|
+
color: ["brand-primary", "600"]
|
|
53
|
+
})
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ jsx(StyleMenuItemLabel, {
|
|
56
|
+
children: label
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
SingleMenuItem.propTypes = itemProps;
|
|
63
|
+
SingleMenuItem.displayName = "SingleMenuItem";
|
|
64
|
+
const SingleMenuItemWithSchema = describe(SingleMenuItem);
|
|
65
|
+
SingleMenuItemWithSchema.propTypes = itemProps;
|
|
66
|
+
export {
|
|
67
|
+
SingleMenuItem
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/SingleMenuItem/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport Grid from '@elliemae/ds-grid';\nimport { DSMenuItemT, defaultSingleProps, itemProps } from '../../react-desc-prop-types';\nimport { StyledGlobalMenuItemWrapper, StyleMenuItemLabel } from '../styled';\n\nconst SingleMenuItem: React.ComponentType<DSMenuItemT.SingleProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultSingleProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, itemProps);\n const {\n dsId,\n label,\n isSelected,\n onClick,\n isActive,\n innerRef,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n wrapperStyles,\n render: Render,\n dataTestid,\n disabled,\n } = propsWithDefault;\n\n return (\n <StyledGlobalMenuItemWrapper\n aria-selected={isSelected}\n id={dsId}\n role=\"option\"\n isActive={isActive}\n isSelected={isSelected}\n onClick={onClick}\n ref={innerRef}\n onMouseDown={onMouseDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n className={isActive ? 'ds-list-item-active' : ''}\n style={wrapperStyles}\n data-testid={dataTestid}\n disabled={disabled}\n >\n {Render !== undefined ? (\n <Render {...props} />\n ) : (\n <Grid cols={['16px', 'auto']} minHeight=\"16px\" gutter=\"xxs\" alignItems=\"center\">\n <div>{isSelected && <Checkmark size=\"s\" color={['brand-primary', '600']} />}</div>\n <StyleMenuItemLabel>{label}</StyleMenuItemLabel>\n </Grid>\n )}\n </StyledGlobalMenuItemWrapper>\n );\n};\n\nSingleMenuItem.propTypes = itemProps;\nSingleMenuItem.displayName = 'SingleMenuItem';\nconst SingleMenuItemWithSchema = describe(SingleMenuItem);\nSingleMenuItemWithSchema.propTypes = itemProps;\n\nexport { SingleMenuItem };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,UAAU,8BAA8B,sCAAsC;AACvF,SAAS,iBAAiB;AAC1B,OAAO,UAAU;AACjB,SAAsB,oBAAoB,iBAAiB;AAC3D,SAAS,6BAA6B,0BAA0B;AAEhE,MAAM,iBAA+D,CAAC,UAAU;AAC9E,QAAM,mBAAmB,6BAA6B,OAAO,kBAAkB;AAE/E,iCAA+B,kBAAkB,SAAS;AAC1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,SACE,oBAAC;AAAA,IACC,iBAAe;AAAA,IACf,IAAI;AAAA,IACJ,MAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW,wBAAwB;AAAA,IAC9C,OAAO;AAAA,IACP,eAAa;AAAA,IACb;AAAA,IAEC,qBAAW,SACV,oBAAC;AAAA,MAAQ,GAAG;AAAA,KAAO,IAEnB,qBAAC;AAAA,MAAK,MAAM,CAAC,QAAQ,MAAM;AAAA,MAAG,WAAU;AAAA,MAAO,QAAO;AAAA,MAAM,YAAW;AAAA,MACrE;AAAA,4BAAC;AAAA,UAAK,wBAAc,oBAAC;AAAA,YAAU,MAAK;AAAA,YAAI,OAAO,CAAC,iBAAiB,KAAK;AAAA,WAAG;AAAA,SAAG;AAAA,QAC5E,oBAAC;AAAA,UAAoB;AAAA,SAAM;AAAA;AAAA,KAC7B;AAAA,GAEJ;AAEJ;AAEA,eAAe,YAAY;AAC3B,eAAe,cAAc;AAC7B,MAAM,2BAA2B,SAAS,cAAc;AACxD,yBAAyB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { Grid } from "@elliemae/ds-grid";
|
|
5
|
+
import { MoreOptionsVert, ChevronRight, Checkmark } from "@elliemae/ds-icons";
|
|
6
|
+
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
7
|
+
import { defaultSingleWithSubmenuProps, itemProps } from "../../react-desc-prop-types";
|
|
8
|
+
import {
|
|
9
|
+
StyledItemLabel,
|
|
10
|
+
StyledIconContainer,
|
|
11
|
+
StyledEllipsisButton,
|
|
12
|
+
StyledGlobalMenuItemWrapper,
|
|
13
|
+
StyledVerticalSeparator
|
|
14
|
+
} from "../styled";
|
|
15
|
+
import { useGetSubmenuHandlers } from "./useGetSubmenuHandlers";
|
|
16
|
+
const SingleWithSubmenuItem = (props) => {
|
|
17
|
+
const propsWithDefault = useMemoMergePropsWithDefault(
|
|
18
|
+
props,
|
|
19
|
+
defaultSingleWithSubmenuProps
|
|
20
|
+
);
|
|
21
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
22
|
+
const {
|
|
23
|
+
dsId,
|
|
24
|
+
label,
|
|
25
|
+
isActive,
|
|
26
|
+
disabled,
|
|
27
|
+
onClick,
|
|
28
|
+
isSelected,
|
|
29
|
+
isSubmenuOpened,
|
|
30
|
+
rightAddon,
|
|
31
|
+
innerRef,
|
|
32
|
+
wrapperStyles,
|
|
33
|
+
render: Render,
|
|
34
|
+
Dropdown,
|
|
35
|
+
dropdownProps: {
|
|
36
|
+
options,
|
|
37
|
+
openedSubmenus,
|
|
38
|
+
onSubmenuToggle,
|
|
39
|
+
selectedOptions,
|
|
40
|
+
onKeyDown,
|
|
41
|
+
onOptionClick,
|
|
42
|
+
onClickOutside,
|
|
43
|
+
minWidth,
|
|
44
|
+
maxHeight
|
|
45
|
+
}
|
|
46
|
+
} = propsWithDefault;
|
|
47
|
+
const [delayedIsOpened, setDelayedIsOpened] = useState(false);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setTimeout(() => setDelayedIsOpened(isSubmenuOpened));
|
|
50
|
+
}, [isSubmenuOpened]);
|
|
51
|
+
const { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick } = useGetSubmenuHandlers(propsWithDefault);
|
|
52
|
+
return /* @__PURE__ */ jsx(Dropdown, {
|
|
53
|
+
isOpened: delayedIsOpened,
|
|
54
|
+
options: options ?? [],
|
|
55
|
+
onOptionClick,
|
|
56
|
+
startPlacementPreference: "right-start",
|
|
57
|
+
placementOrderPreference: ["right-start", "right-end", "left-start", "left-end"],
|
|
58
|
+
selectedOptions,
|
|
59
|
+
openedSubmenus,
|
|
60
|
+
onSubmenuToggle,
|
|
61
|
+
onKeyDown,
|
|
62
|
+
onClickOutside,
|
|
63
|
+
customOffset: [-4, 1],
|
|
64
|
+
onMouseEnter: onMouseEnterHandler,
|
|
65
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
66
|
+
wrapperStyles: { ...wrapperStyles, w: "100%" },
|
|
67
|
+
minWidth,
|
|
68
|
+
maxHeight,
|
|
69
|
+
as: "li",
|
|
70
|
+
role: "option",
|
|
71
|
+
"aria-selected": isSubmenuOpened,
|
|
72
|
+
"aria-describedby": `dropdownmenu-submenu-${dsId}`,
|
|
73
|
+
id: dsId,
|
|
74
|
+
children: /* @__PURE__ */ jsxs(StyledGlobalMenuItemWrapper, {
|
|
75
|
+
pr: 0,
|
|
76
|
+
onClick: !disabled ? onClick : void 0,
|
|
77
|
+
isSelected: isSubmenuOpened,
|
|
78
|
+
disabled,
|
|
79
|
+
isActive,
|
|
80
|
+
onMouseEnter: onMouseEnterHandler,
|
|
81
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
82
|
+
ref: innerRef,
|
|
83
|
+
as: "div",
|
|
84
|
+
children: [
|
|
85
|
+
Render !== void 0 ? /* @__PURE__ */ jsx(Render, {
|
|
86
|
+
...propsWithDefault
|
|
87
|
+
}) : /* @__PURE__ */ jsxs(Grid, {
|
|
88
|
+
cols: ["16px", "auto", "min-content"],
|
|
89
|
+
gutter: "xxs",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx("div", {
|
|
93
|
+
children: isSelected && /* @__PURE__ */ jsx(Checkmark, {
|
|
94
|
+
size: "s",
|
|
95
|
+
color: disabled ? ["neutral", "500"] : ["brand-primary", "600"]
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ jsx(StyledItemLabel, {
|
|
99
|
+
children: label
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsxs(StyledIconContainer, {
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ jsx(StyledVerticalSeparator, {}),
|
|
104
|
+
rightAddon === "ellipsis" ? /* @__PURE__ */ jsx(StyledEllipsisButton, {
|
|
105
|
+
tabIndex: -1,
|
|
106
|
+
onClick: onEllipsisClick,
|
|
107
|
+
disabled,
|
|
108
|
+
children: /* @__PURE__ */ jsx(MoreOptionsVert, {
|
|
109
|
+
className: "ds-dropdown-menu-v2-more-options",
|
|
110
|
+
color: disabled ? ["neutral", "500"] : ["brand-primary", "600"],
|
|
111
|
+
size: "s"
|
|
112
|
+
})
|
|
113
|
+
}) : /* @__PURE__ */ jsx(ChevronRight, {
|
|
114
|
+
color: disabled ? ["neutral", "500"] : ["brand-primary", "600"],
|
|
115
|
+
size: "s"
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ jsx("span", {
|
|
122
|
+
id: `dropdownmenu-submenu-${dsId}`,
|
|
123
|
+
style: { display: "none" },
|
|
124
|
+
children: "submenu, to open this submenu press the Right Arrow key"
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
SingleWithSubmenuItem.propTypes = itemProps;
|
|
131
|
+
SingleWithSubmenuItem.displayName = "SingleWithSubmenuItem";
|
|
132
|
+
const SingleWithSubmenuItemWithSchema = describe(SingleWithSubmenuItem);
|
|
133
|
+
SingleWithSubmenuItemWithSchema.propTypes = itemProps;
|
|
134
|
+
export {
|
|
135
|
+
SingleWithSubmenuItem,
|
|
136
|
+
SingleWithSubmenuItemWithSchema
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/SingleWithSubmenuItem/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useEffect, useState } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { MoreOptionsVert, ChevronRight, Checkmark } from '@elliemae/ds-icons';\nimport { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { DSMenuItemT, defaultSingleWithSubmenuProps, itemProps } from '../../react-desc-prop-types';\nimport {\n StyledItemLabel,\n StyledIconContainer,\n StyledEllipsisButton,\n StyledGlobalMenuItemWrapper,\n StyledVerticalSeparator,\n} from '../styled';\nimport { useGetSubmenuHandlers } from './useGetSubmenuHandlers';\n\nconst SingleWithSubmenuItem: React.ComponentType<DSMenuItemT.SingleWithSubmenuProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<Required<DSMenuItemT.SingleWithSubmenuProps>>(\n props,\n defaultSingleWithSubmenuProps,\n );\n\n useValidateTypescriptPropTypes(propsWithDefault, itemProps);\n\n const {\n dsId,\n label,\n isActive,\n disabled,\n onClick,\n isSelected,\n isSubmenuOpened,\n rightAddon,\n innerRef,\n wrapperStyles,\n render: Render,\n Dropdown,\n dropdownProps: {\n options,\n openedSubmenus,\n onSubmenuToggle,\n selectedOptions,\n onKeyDown,\n onOptionClick,\n onClickOutside,\n minWidth,\n maxHeight,\n },\n } = propsWithDefault;\n\n // If we don't delay the opening of the poppers, the position will not be placed correctly\n // That why we delay it for the next render using the useEffect hook\n // TODO -- @carusox move this to utilities as a hook\n const [delayedIsOpened, setDelayedIsOpened] = useState(false);\n\n useEffect(() => {\n setTimeout(() => setDelayedIsOpened(isSubmenuOpened));\n }, [isSubmenuOpened]);\n\n const { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick } = useGetSubmenuHandlers(propsWithDefault);\n\n return (\n <Dropdown\n isOpened={delayedIsOpened}\n options={options ?? []}\n onOptionClick={onOptionClick}\n startPlacementPreference=\"right-start\"\n placementOrderPreference={['right-start', 'right-end', 'left-start', 'left-end']}\n selectedOptions={selectedOptions}\n openedSubmenus={openedSubmenus}\n onSubmenuToggle={onSubmenuToggle}\n onKeyDown={onKeyDown}\n onClickOutside={onClickOutside}\n customOffset={[-4, 1]}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n wrapperStyles={{ ...wrapperStyles, w: '100%' }}\n minWidth={minWidth}\n maxHeight={maxHeight}\n as=\"li\"\n role=\"option\"\n aria-selected={isSubmenuOpened}\n aria-describedby={`dropdownmenu-submenu-${dsId}`}\n id={dsId}\n >\n <StyledGlobalMenuItemWrapper\n pr={0}\n onClick={!disabled ? onClick : undefined}\n isSelected={isSubmenuOpened}\n disabled={disabled}\n isActive={isActive}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n ref={innerRef}\n as=\"div\"\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <Grid cols={['16px', 'auto', 'min-content']} gutter=\"xxs\" alignItems=\"center\">\n <div>\n {isSelected && <Checkmark size=\"s\" color={disabled ? ['neutral', '500'] : ['brand-primary', '600']} />}\n </div>\n <StyledItemLabel>{label}</StyledItemLabel>\n <StyledIconContainer>\n <StyledVerticalSeparator />\n {rightAddon === 'ellipsis' ? (\n <StyledEllipsisButton tabIndex={-1} onClick={onEllipsisClick} disabled={disabled}>\n <MoreOptionsVert\n className=\"ds-dropdown-menu-v2-more-options\"\n color={disabled ? ['neutral', '500'] : ['brand-primary', '600']}\n size=\"s\"\n />\n </StyledEllipsisButton>\n ) : (\n <ChevronRight color={disabled ? ['neutral', '500'] : ['brand-primary', '600']} size=\"s\" />\n )}\n </StyledIconContainer>\n </Grid>\n )}\n <span id={`dropdownmenu-submenu-${dsId}`} style={{ display: 'none' }}>\n submenu, to open this submenu press the Right Arrow key\n </span>\n </StyledGlobalMenuItemWrapper>\n </Dropdown>\n );\n};\n\nSingleWithSubmenuItem.propTypes = itemProps;\nSingleWithSubmenuItem.displayName = 'SingleWithSubmenuItem';\nconst SingleWithSubmenuItemWithSchema = describe(SingleWithSubmenuItem);\nSingleWithSubmenuItemWithSchema.propTypes = itemProps;\n\nexport { SingleWithSubmenuItem, SingleWithSubmenuItemWithSchema };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|