@recursica/mui-adapter 0.6.0 → 0.7.0
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/ARCHITECTURE.md +15 -0
- package/CHANGELOG.md +6 -0
- package/SETUP.md +77 -0
- package/USAGE.md +55 -0
- package/dist/mui-adapter.cjs +26 -26
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +3721 -3511
- package/dist/mui-adapter.js.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts +9 -29
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +2 -5
- package/dist/src/components/Autocomplete/Autocomplete.d.ts +4 -8
- package/dist/src/components/Avatar/Avatar.d.ts +1 -6
- package/dist/src/components/Badge/Badge.d.ts +1 -4
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/dist/src/components/Button/Button.d.ts +2 -17
- package/dist/src/components/Card/Card.d.ts +2 -4
- package/dist/src/components/Checkbox/Checkbox.d.ts +4 -6
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +8 -6
- package/dist/src/components/Chip/Chip.d.ts +2 -11
- package/dist/src/components/Container/Container.d.ts +1 -5
- package/dist/src/components/DatePicker/DatePicker.d.ts +2 -1
- package/dist/src/components/Dropdown/Dropdown.d.ts +4 -14
- package/dist/src/components/Flex/Flex.d.ts +2 -22
- package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +2 -7
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +3 -18
- package/dist/src/components/Group/Group.d.ts +2 -7
- package/dist/src/components/HoverCard/HoverCard.d.ts +13 -39
- package/dist/src/components/Label/Label.d.ts +2 -9
- package/dist/src/components/Link/Link.d.ts +2 -6
- package/dist/src/components/Loader/Loader.d.ts +2 -7
- package/dist/src/components/Menu/Menu.d.ts +24 -98
- package/dist/src/components/Modal/Modal.d.ts +32 -31
- package/dist/src/components/NumberInput/NumberInput.d.ts +3 -5
- package/dist/src/components/Pagination/Pagination.d.ts +8 -41
- package/dist/src/components/Panel/Panel.d.ts +5 -18
- package/dist/src/components/Radio/Radio.d.ts +4 -4
- package/dist/src/components/Radio/RadioGroup.d.ts +3 -7
- package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +2 -5
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +5 -15
- package/dist/src/components/Slider/Slider.d.ts +4 -14
- package/dist/src/components/Stack/Stack.d.ts +2 -5
- package/dist/src/components/Stepper/Stepper.d.ts +36 -16
- package/dist/src/components/Switch/Switch.d.ts +4 -4
- package/dist/src/components/Switch/SwitchGroup.d.ts +4 -4
- package/dist/src/components/Table/Table.d.ts +2 -1
- package/dist/src/components/Tabs/Tabs.d.ts +11 -26
- package/dist/src/components/Text/Text.d.ts +2 -16
- package/dist/src/components/TextArea/TextArea.d.ts +3 -9
- package/dist/src/components/TextField/TextField.d.ts +3 -7
- package/dist/src/components/TimePicker/TimePicker.d.ts +2 -1
- package/dist/src/components/Timeline/Timeline.d.ts +2 -1
- package/dist/src/components/Timeline/TimelineItem.d.ts +2 -13
- package/dist/src/components/Title/Title.d.ts +2 -15
- package/dist/src/components/Toast/Toast.d.ts +11 -16
- package/dist/src/components/Tooltip/Tooltip.d.ts +7 -21
- package/dist/src/components/TransferList/TransferList.d.ts +2 -1
- package/dist/src/components/Typography/Typography.d.ts +1 -1
- package/dist/src/utils/RequireAccessibleLabel.d.ts +1 -18
- package/dist/src/utils/filterStylingProps.d.ts +1 -11
- package/llms.txt +16 -0
- package/package.json +6 -2
- package/src/components/Accordion/Accordion.module.css +1 -2
- package/src/components/Accordion/Accordion.stories.tsx +0 -18
- package/src/components/Accordion/Accordion.tsx +19 -23
- package/src/components/AssistiveElement/AssistiveElement.module.css +32 -29
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +10 -27
- package/src/components/AssistiveElement/AssistiveElement.tsx +11 -15
- package/src/components/Autocomplete/Autocomplete.module.css +17 -18
- package/src/components/Autocomplete/Autocomplete.stories.tsx +7 -16
- package/src/components/Autocomplete/Autocomplete.tsx +27 -45
- package/src/components/Avatar/Avatar.tsx +2 -13
- package/src/components/Badge/Badge.tsx +2 -5
- package/src/components/Breadcrumb/Breadcrumb.tsx +1 -4
- package/src/components/Button/Button.module.css +19 -61
- package/src/components/Button/Button.stories.tsx +24 -23
- package/src/components/Button/Button.tsx +7 -18
- package/src/components/Card/Card.module.css +36 -0
- package/src/components/Card/Card.tsx +6 -4
- package/src/components/Checkbox/Checkbox.module.css +27 -10
- package/src/components/Checkbox/Checkbox.tsx +124 -24
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +43 -23
- package/src/components/Chip/Chip.module.css +52 -34
- package/src/components/Chip/Chip.tsx +45 -47
- package/src/components/Container/Container.stories.tsx +103 -20
- package/src/components/Container/Container.tsx +1 -13
- package/src/components/DatePicker/DatePicker.stories.tsx +125 -19
- package/src/components/DatePicker/DatePicker.tsx +3 -1
- package/src/components/Dropdown/Dropdown.tsx +7 -9
- package/src/components/FileInput/FileInput.stories.tsx +2 -19
- package/src/components/FileUpload/FileUpload.stories.tsx +2 -19
- package/src/components/Flex/Flex.stories.tsx +113 -20
- package/src/components/Flex/Flex.tsx +16 -26
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +0 -8
- package/src/components/FormControlLayout/FormControlLayout.tsx +18 -7
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +1 -10
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +12 -21
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +11 -30
- package/src/components/Group/Group.stories.tsx +6 -30
- package/src/components/Group/Group.tsx +14 -9
- package/src/components/HoverCard/HoverCard.tsx +72 -75
- package/src/components/Label/Label.module.css +4 -0
- package/src/components/Label/Label.stories.tsx +18 -12
- package/src/components/Label/Label.tsx +3 -9
- package/src/components/Link/Link.module.css +4 -3
- package/src/components/Link/Link.stories.tsx +2 -8
- package/src/components/Link/Link.tsx +1 -5
- package/src/components/Loader/Loader.module.css +1 -2
- package/src/components/Loader/Loader.tsx +1 -7
- package/src/components/Menu/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Menu/Menu.stories.tsx +106 -188
- package/src/components/Menu/Menu.tsx +34 -280
- package/src/components/Modal/Modal.tsx +158 -160
- package/src/components/NumberInput/NumberInput.tsx +6 -18
- package/src/components/Pagination/IMPLEMENTATION_NOTES.md +3 -0
- package/src/components/Pagination/Pagination.module.css +12 -24
- package/src/components/Pagination/Pagination.stories.tsx +0 -8
- package/src/components/Pagination/Pagination.tsx +20 -140
- package/src/components/Panel/Panel.tsx +7 -30
- package/src/components/Radio/Radio.module.css +25 -10
- package/src/components/Radio/Radio.tsx +51 -19
- package/src/components/Radio/RadioGroup.stories.tsx +117 -0
- package/src/components/Radio/RadioGroup.tsx +26 -12
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +6 -6
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +5 -36
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +9 -13
- package/src/components/SegmentedControl/SegmentedControl.module.css +23 -47
- package/src/components/SegmentedControl/SegmentedControl.tsx +44 -14
- package/src/components/Slider/Slider.module.css +1 -4
- package/src/components/Slider/Slider.stories.tsx +3 -3
- package/src/components/Slider/Slider.tsx +26 -25
- package/src/components/Stack/Stack.stories.tsx +4 -25
- package/src/components/Stack/Stack.tsx +1 -5
- package/src/components/Stepper/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Stepper/Stepper.stories.tsx +56 -43
- package/src/components/Stepper/Stepper.tsx +89 -87
- package/src/components/Switch/Switch.module.css +21 -0
- package/src/components/Switch/Switch.tsx +63 -16
- package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
- package/src/components/Switch/SwitchGroup.tsx +27 -18
- package/src/components/Table/Table.stories.tsx +1 -19
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/Tabs/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Tabs/Tabs.stories.tsx +41 -24
- package/src/components/Tabs/Tabs.tsx +49 -66
- package/src/components/Text/Text.stories.tsx +5 -17
- package/src/components/Text/Text.tsx +1 -15
- package/src/components/TextArea/TextArea.tsx +7 -17
- package/src/components/TextField/TextField.stories.tsx +1 -27
- package/src/components/TextField/TextField.tsx +4 -6
- package/src/components/TimePicker/TimePicker.stories.tsx +2 -19
- package/src/components/TimePicker/TimePicker.tsx +3 -1
- package/src/components/Timeline/Timeline.tsx +4 -1
- package/src/components/Timeline/TimelineItem.tsx +1 -12
- package/src/components/Title/Title.stories.tsx +0 -18
- package/src/components/Title/Title.tsx +1 -7
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.tsx +62 -28
- package/src/components/Tooltip/Tooltip.tsx +11 -37
- package/src/components/TransferList/TransferList.stories.tsx +1 -19
- package/src/components/TransferList/TransferList.tsx +3 -1
- package/src/utils/RequireAccessibleLabel.ts +1 -12
- package/src/utils/filterStylingProps.ts +7 -20
|
@@ -1,321 +1,75 @@
|
|
|
1
1
|
import { forwardRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Menu as MuiMenu,
|
|
4
|
+
type MenuProps as MuiMenuProps,
|
|
5
|
+
MenuItem as MuiMenuItem,
|
|
6
|
+
type MenuItemProps as MuiMenuItemProps,
|
|
7
|
+
Divider as MuiDivider,
|
|
8
|
+
type DividerProps as MuiDividerProps,
|
|
9
|
+
} from "@mui/material";
|
|
3
10
|
import {
|
|
4
11
|
filterStylingProps,
|
|
5
12
|
type RecursicaOverStyled,
|
|
6
13
|
} from "../../utils/filterStylingProps";
|
|
7
14
|
import styles from "./Menu.module.css";
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
// MENU ROOT
|
|
11
|
-
// ============================================================
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Recursica Menu component wrapping Mui's composable Menu.
|
|
15
|
-
*
|
|
16
|
-
* Usage follows the composable dot-notation pattern:
|
|
17
|
-
* ```tsx
|
|
18
|
-
* <Menu>
|
|
19
|
-
* <Menu.Target><Button>Open</Button></Menu.Target>
|
|
20
|
-
* <Menu.Dropdown>
|
|
21
|
-
* <Menu.Label>Section</Menu.Label>
|
|
22
|
-
* <Menu.Item>Action</Menu.Item>
|
|
23
|
-
* <Menu.Divider />
|
|
24
|
-
* <Menu.Item>Another action</Menu.Item>
|
|
25
|
-
* </Menu.Dropdown>
|
|
26
|
-
* </Menu>
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export type MenuProps = RecursicaOverStyled<MuiMenuProps>;
|
|
30
|
-
|
|
31
|
-
const MenuBase = function Menu({ overStyled = false, ...rest }: MenuProps) {
|
|
32
|
-
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
33
|
-
|
|
34
|
-
// Bind CSS module classes to Mui's internal classNames API
|
|
35
|
-
const mergedClassNames: Partial<Record<string, string>> = {
|
|
36
|
-
dropdown: styles.dropdown,
|
|
37
|
-
item: styles.item,
|
|
38
|
-
itemLabel: styles.itemLabel,
|
|
39
|
-
itemSection: styles.itemSection,
|
|
40
|
-
divider: styles.divider,
|
|
41
|
-
label: styles.label,
|
|
42
|
-
chevron: styles.chevron,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const classNamesProp = (sanitizedProps as Record<string, unknown>).classNames;
|
|
46
|
-
if (
|
|
47
|
-
classNamesProp &&
|
|
48
|
-
typeof classNamesProp === "object" &&
|
|
49
|
-
!Array.isArray(classNamesProp)
|
|
50
|
-
) {
|
|
51
|
-
const o = classNamesProp as Record<string, string>;
|
|
52
|
-
Object.keys(o).forEach((key) => {
|
|
53
|
-
if (mergedClassNames[key]) {
|
|
54
|
-
mergedClassNames[key] = `${mergedClassNames[key]} ${o[key]}`;
|
|
55
|
-
} else {
|
|
56
|
-
mergedClassNames[key] = o[key];
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<MuiMenu
|
|
63
|
-
classes={mergedClassNames}
|
|
64
|
-
{...(sanitizedProps as unknown as MuiMenuProps)}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
MenuBase.displayName = "Menu";
|
|
69
|
-
|
|
70
|
-
// ============================================================
|
|
71
|
-
// MENU TARGET
|
|
72
|
-
// ============================================================
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Wrapper for the element that triggers the menu.
|
|
76
|
-
* Requires a single child element that supports ref forwarding.
|
|
77
|
-
*/
|
|
78
|
-
export type MenuTargetProps = any;
|
|
79
|
-
|
|
80
|
-
const MenuTarget = function MenuTarget(props: MenuTargetProps) {
|
|
81
|
-
return <div {...props} />;
|
|
82
|
-
};
|
|
83
|
-
MenuTarget.displayName = "MenuTarget";
|
|
84
|
-
|
|
85
|
-
// ============================================================
|
|
86
|
-
// MENU DROPDOWN
|
|
87
|
-
// ============================================================
|
|
88
|
-
|
|
89
|
-
/** The dropdown panel containing menu items, dividers, and labels. */
|
|
90
|
-
export type MenuDropdownProps = RecursicaOverStyled<any>;
|
|
91
|
-
|
|
92
|
-
const MenuDropdown = forwardRef<HTMLDivElement, MenuDropdownProps>(
|
|
93
|
-
function MenuDropdown({ overStyled = false, ...rest }, ref) {
|
|
94
|
-
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
95
|
-
const classNameProp = (sanitizedProps as Record<string, unknown>)
|
|
96
|
-
.className as string | undefined;
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<div
|
|
100
|
-
ref={ref}
|
|
101
|
-
className={classNameProp}
|
|
102
|
-
{...(sanitizedProps as unknown as any)}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
},
|
|
106
|
-
);
|
|
107
|
-
MenuDropdown.displayName = "MenuDropdown";
|
|
108
|
-
|
|
109
|
-
// ============================================================
|
|
110
|
-
// MENU ITEM
|
|
111
|
-
// ============================================================
|
|
16
|
+
import { type RecursicaMenuProps } from "@recursica/adapter-common";
|
|
112
17
|
|
|
113
|
-
|
|
114
|
-
* An individual actionable item within the menu dropdown.
|
|
115
|
-
*
|
|
116
|
-
* **Note:** Mui's `color` prop is stripped in strict mode to enforce
|
|
117
|
-
* design token adherence. Use `overStyled={true}` if you need to bypass.
|
|
118
|
-
*/
|
|
119
|
-
export type MenuItemProps = RecursicaOverStyled<Omit<any, "color">>;
|
|
18
|
+
export type MenuProps = RecursicaOverStyled<MuiMenuProps & RecursicaMenuProps>;
|
|
120
19
|
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
124
|
-
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
125
|
-
|
|
126
|
-
// Strip Mui's `color` prop to enforce token-driven styling
|
|
127
|
-
if (!overStyled) {
|
|
128
|
-
delete restRecord["color"];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const classNameProp = restRecord.className as string | undefined;
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<div
|
|
135
|
-
ref={ref}
|
|
136
|
-
className={classNameProp}
|
|
137
|
-
{...(sanitizedProps as unknown as any)}
|
|
138
|
-
/>
|
|
139
|
-
);
|
|
140
|
-
},
|
|
141
|
-
);
|
|
142
|
-
_MenuItem.displayName = "MenuItem";
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* An individual actionable item within the menu dropdown.
|
|
146
|
-
*
|
|
147
|
-
* Supports polymorphism via the `component` prop for link-style items.
|
|
148
|
-
* @example
|
|
149
|
-
* ```tsx
|
|
150
|
-
* <Menu.Item component="a" href="/settings">Settings</Menu.Item>
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
const MenuItem = _MenuItem as any;
|
|
154
|
-
|
|
155
|
-
// ============================================================
|
|
156
|
-
// MENU DIVIDER
|
|
157
|
-
// ============================================================
|
|
158
|
-
|
|
159
|
-
/** A visual separator between groups of menu items. */
|
|
160
|
-
export type MenuDividerProps = RecursicaOverStyled<any>;
|
|
161
|
-
|
|
162
|
-
const MenuDivider = forwardRef<HTMLHRElement, MenuDividerProps>(
|
|
163
|
-
function MenuDivider({ overStyled = false, ...rest }, ref) {
|
|
164
|
-
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
165
|
-
const classNameProp = (sanitizedProps as Record<string, unknown>)
|
|
166
|
-
.className as string | undefined;
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
<hr
|
|
170
|
-
ref={ref}
|
|
171
|
-
className={classNameProp}
|
|
172
|
-
{...(sanitizedProps as unknown as any)}
|
|
173
|
-
/>
|
|
174
|
-
);
|
|
175
|
-
},
|
|
176
|
-
);
|
|
177
|
-
MenuDivider.displayName = "MenuDivider";
|
|
178
|
-
|
|
179
|
-
// ============================================================
|
|
180
|
-
// MENU LABEL
|
|
181
|
-
// ============================================================
|
|
182
|
-
|
|
183
|
-
/** A non-interactive section label used to categorize groups of menu items. */
|
|
184
|
-
export type MenuLabelProps = RecursicaOverStyled<any>;
|
|
185
|
-
|
|
186
|
-
const MenuLabel = forwardRef<HTMLDivElement, MenuLabelProps>(function MenuLabel(
|
|
187
|
-
{ overStyled = false, ...rest },
|
|
20
|
+
export const Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu(
|
|
21
|
+
{ overStyled = false, className, ...rest },
|
|
188
22
|
ref,
|
|
189
23
|
) {
|
|
190
24
|
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
191
|
-
const classNameProp = (sanitizedProps as Record<string, unknown>)
|
|
192
|
-
.className as string | undefined;
|
|
193
25
|
|
|
194
26
|
return (
|
|
195
|
-
<
|
|
27
|
+
<MuiMenu
|
|
196
28
|
ref={ref}
|
|
197
|
-
className={
|
|
198
|
-
{
|
|
29
|
+
className={`${styles.dropdown} ${className || ""}`}
|
|
30
|
+
classes={{
|
|
31
|
+
paper: styles.dropdown,
|
|
32
|
+
list: styles.dropdown,
|
|
33
|
+
}}
|
|
34
|
+
{...(sanitizedProps as MuiMenuProps)}
|
|
199
35
|
/>
|
|
200
36
|
);
|
|
201
37
|
});
|
|
202
|
-
MenuLabel.displayName = "MenuLabel";
|
|
203
|
-
|
|
204
|
-
// ============================================================
|
|
205
|
-
// MENU SUB (SUBMENU CONTAINER)
|
|
206
|
-
// ============================================================
|
|
207
|
-
|
|
208
|
-
/** Container for a submenu, wrapping Menu.Sub.Target and Menu.Sub.Dropdown. */
|
|
209
|
-
export type MenuSubProps = any;
|
|
210
|
-
|
|
211
|
-
const MenuSubBase = function MenuSub(props: MenuSubProps) {
|
|
212
|
-
return <div {...props} />;
|
|
213
|
-
};
|
|
214
|
-
MenuSubBase.displayName = "MenuSub";
|
|
215
|
-
|
|
216
|
-
// ============================================================
|
|
217
|
-
// MENU SUB TARGET
|
|
218
|
-
// ============================================================
|
|
219
|
-
|
|
220
|
-
/** Wrapper for the element that triggers the submenu. */
|
|
221
|
-
export type MenuSubTargetProps = any;
|
|
222
|
-
|
|
223
|
-
const MenuSubTarget = function MenuSubTarget(props: MenuSubTargetProps) {
|
|
224
|
-
return <div {...props} />;
|
|
225
|
-
};
|
|
226
|
-
MenuSubTarget.displayName = "MenuSubTarget";
|
|
227
38
|
|
|
228
|
-
|
|
229
|
-
// MENU SUB ITEM (triggers submenu)
|
|
230
|
-
// ============================================================
|
|
39
|
+
Menu.displayName = "Menu";
|
|
231
40
|
|
|
232
|
-
|
|
233
|
-
* A menu item that acts as a submenu trigger.
|
|
234
|
-
* Renders within Menu.Sub.Target and displays a chevron indicator.
|
|
235
|
-
*/
|
|
236
|
-
export type MenuSubItemProps = RecursicaOverStyled<Omit<any, "color">>;
|
|
41
|
+
export type MenuItemProps = RecursicaOverStyled<MuiMenuItemProps>;
|
|
237
42
|
|
|
238
|
-
const
|
|
239
|
-
function
|
|
43
|
+
export const MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(
|
|
44
|
+
function MenuItem({ overStyled = false, className, ...rest }, ref) {
|
|
240
45
|
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
241
|
-
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
242
|
-
|
|
243
|
-
if (!overStyled) {
|
|
244
|
-
delete restRecord["color"];
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const classNameProp = restRecord.className as string | undefined;
|
|
248
46
|
|
|
249
47
|
return (
|
|
250
|
-
<
|
|
48
|
+
<MuiMenuItem
|
|
251
49
|
ref={ref}
|
|
252
|
-
className={
|
|
253
|
-
{...(sanitizedProps as
|
|
50
|
+
className={`${styles.item} ${className || ""}`}
|
|
51
|
+
{...(sanitizedProps as MuiMenuItemProps)}
|
|
254
52
|
/>
|
|
255
53
|
);
|
|
256
54
|
},
|
|
257
55
|
);
|
|
258
|
-
_MenuSubItem.displayName = "MenuSubItem";
|
|
259
56
|
|
|
260
|
-
|
|
261
|
-
* A menu item that acts as a submenu trigger.
|
|
262
|
-
*
|
|
263
|
-
* Supports polymorphism via the `component` prop.
|
|
264
|
-
*/
|
|
265
|
-
const MenuSubItem = _MenuSubItem as any;
|
|
57
|
+
MenuItem.displayName = "MenuItem";
|
|
266
58
|
|
|
267
|
-
|
|
268
|
-
// MENU SUB DROPDOWN
|
|
269
|
-
// ============================================================
|
|
59
|
+
export type MenuDividerProps = RecursicaOverStyled<MuiDividerProps>;
|
|
270
60
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const MenuSubDropdown = forwardRef<HTMLDivElement, MenuSubDropdownProps>(
|
|
275
|
-
function MenuSubDropdown({ overStyled = false, ...rest }, ref) {
|
|
61
|
+
export const MenuDivider = forwardRef<HTMLHRElement, MenuDividerProps>(
|
|
62
|
+
function MenuDivider({ overStyled = false, className, ...rest }, ref) {
|
|
276
63
|
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
277
|
-
const classNameProp = (sanitizedProps as Record<string, unknown>)
|
|
278
|
-
.className as string | undefined;
|
|
279
64
|
|
|
280
65
|
return (
|
|
281
|
-
<
|
|
66
|
+
<MuiDivider
|
|
282
67
|
ref={ref}
|
|
283
|
-
className={
|
|
284
|
-
{...(sanitizedProps as
|
|
68
|
+
className={`${styles.divider} ${className || ""}`}
|
|
69
|
+
{...(sanitizedProps as MuiDividerProps)}
|
|
285
70
|
/>
|
|
286
71
|
);
|
|
287
72
|
},
|
|
288
73
|
);
|
|
289
|
-
MenuSubDropdown.displayName = "MenuSubDropdown";
|
|
290
|
-
|
|
291
|
-
// ============================================================
|
|
292
|
-
// DOT NOTATION EXPORT
|
|
293
|
-
// ============================================================
|
|
294
74
|
|
|
295
|
-
|
|
296
|
-
Target: typeof MenuSubTarget;
|
|
297
|
-
Item: typeof MenuSubItem;
|
|
298
|
-
Dropdown: typeof MenuSubDropdown;
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
const MenuSub = MenuSubBase as MenuSubComponent;
|
|
302
|
-
MenuSub.Target = MenuSubTarget;
|
|
303
|
-
MenuSub.Item = MenuSubItem;
|
|
304
|
-
MenuSub.Dropdown = MenuSubDropdown;
|
|
305
|
-
|
|
306
|
-
type MenuComponent = typeof MenuBase & {
|
|
307
|
-
Target: typeof MenuTarget;
|
|
308
|
-
Dropdown: typeof MenuDropdown;
|
|
309
|
-
Item: typeof MenuItem;
|
|
310
|
-
Divider: typeof MenuDivider;
|
|
311
|
-
Label: typeof MenuLabel;
|
|
312
|
-
Sub: MenuSubComponent;
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
export const Menu = MenuBase as MenuComponent;
|
|
316
|
-
Menu.Target = MenuTarget;
|
|
317
|
-
Menu.Dropdown = MenuDropdown;
|
|
318
|
-
Menu.Item = MenuItem;
|
|
319
|
-
Menu.Divider = MenuDivider;
|
|
320
|
-
Menu.Label = MenuLabel;
|
|
321
|
-
Menu.Sub = MenuSub;
|
|
75
|
+
MenuDivider.displayName = "MenuDivider";
|