@recursica/mui-adapter 0.6.0 → 0.9.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.
Files changed (164) hide show
  1. package/ARCHITECTURE.md +15 -0
  2. package/CHANGELOG.md +31 -0
  3. package/SETUP.md +78 -0
  4. package/USAGE.md +55 -0
  5. package/dist/mui-adapter.cjs +26 -26
  6. package/dist/mui-adapter.cjs.map +1 -1
  7. package/dist/mui-adapter.css +1 -1
  8. package/dist/mui-adapter.js +3721 -3511
  9. package/dist/mui-adapter.js.map +1 -1
  10. package/dist/src/components/Accordion/Accordion.d.ts +9 -29
  11. package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +2 -5
  12. package/dist/src/components/Autocomplete/Autocomplete.d.ts +4 -8
  13. package/dist/src/components/Avatar/Avatar.d.ts +1 -6
  14. package/dist/src/components/Badge/Badge.d.ts +1 -4
  15. package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +2 -3
  16. package/dist/src/components/Button/Button.d.ts +2 -17
  17. package/dist/src/components/Card/Card.d.ts +2 -4
  18. package/dist/src/components/Checkbox/Checkbox.d.ts +4 -6
  19. package/dist/src/components/Checkbox/CheckboxGroup.d.ts +8 -6
  20. package/dist/src/components/Chip/Chip.d.ts +2 -11
  21. package/dist/src/components/Container/Container.d.ts +1 -5
  22. package/dist/src/components/DatePicker/DatePicker.d.ts +2 -1
  23. package/dist/src/components/Dropdown/Dropdown.d.ts +4 -14
  24. package/dist/src/components/Flex/Flex.d.ts +2 -22
  25. package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +2 -7
  26. package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +3 -18
  27. package/dist/src/components/Group/Group.d.ts +2 -7
  28. package/dist/src/components/HoverCard/HoverCard.d.ts +13 -39
  29. package/dist/src/components/Label/Label.d.ts +2 -9
  30. package/dist/src/components/Link/Link.d.ts +2 -6
  31. package/dist/src/components/Loader/Loader.d.ts +2 -7
  32. package/dist/src/components/Menu/Menu.d.ts +24 -98
  33. package/dist/src/components/Modal/Modal.d.ts +32 -31
  34. package/dist/src/components/NumberInput/NumberInput.d.ts +3 -5
  35. package/dist/src/components/Pagination/Pagination.d.ts +8 -41
  36. package/dist/src/components/Panel/Panel.d.ts +5 -18
  37. package/dist/src/components/Radio/Radio.d.ts +4 -4
  38. package/dist/src/components/Radio/RadioGroup.d.ts +3 -7
  39. package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +2 -5
  40. package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +5 -15
  41. package/dist/src/components/Slider/Slider.d.ts +4 -14
  42. package/dist/src/components/Stack/Stack.d.ts +2 -5
  43. package/dist/src/components/Stepper/Stepper.d.ts +36 -16
  44. package/dist/src/components/Switch/Switch.d.ts +4 -4
  45. package/dist/src/components/Switch/SwitchGroup.d.ts +4 -4
  46. package/dist/src/components/Table/Table.d.ts +2 -1
  47. package/dist/src/components/Tabs/Tabs.d.ts +11 -26
  48. package/dist/src/components/Text/Text.d.ts +2 -16
  49. package/dist/src/components/TextArea/TextArea.d.ts +3 -9
  50. package/dist/src/components/TextField/TextField.d.ts +3 -7
  51. package/dist/src/components/TimePicker/TimePicker.d.ts +2 -1
  52. package/dist/src/components/Timeline/Timeline.d.ts +2 -1
  53. package/dist/src/components/Timeline/TimelineItem.d.ts +2 -13
  54. package/dist/src/components/Title/Title.d.ts +2 -15
  55. package/dist/src/components/Toast/Toast.d.ts +11 -16
  56. package/dist/src/components/Tooltip/Tooltip.d.ts +7 -21
  57. package/dist/src/components/TransferList/TransferList.d.ts +2 -1
  58. package/dist/src/components/Typography/Typography.d.ts +1 -1
  59. package/dist/src/utils/RequireAccessibleLabel.d.ts +1 -18
  60. package/dist/src/utils/filterStylingProps.d.ts +1 -11
  61. package/llms.txt +16 -0
  62. package/package.json +9 -2
  63. package/src/components/Accordion/Accordion.module.css +1 -2
  64. package/src/components/Accordion/Accordion.stories.tsx +0 -18
  65. package/src/components/Accordion/Accordion.tsx +19 -23
  66. package/src/components/AssistiveElement/AssistiveElement.module.css +32 -29
  67. package/src/components/AssistiveElement/AssistiveElement.stories.tsx +10 -27
  68. package/src/components/AssistiveElement/AssistiveElement.tsx +11 -15
  69. package/src/components/Autocomplete/Autocomplete.module.css +17 -18
  70. package/src/components/Autocomplete/Autocomplete.stories.tsx +7 -16
  71. package/src/components/Autocomplete/Autocomplete.tsx +27 -45
  72. package/src/components/Avatar/Avatar.tsx +2 -13
  73. package/src/components/Badge/Badge.tsx +2 -5
  74. package/src/components/Breadcrumb/Breadcrumb.tsx +1 -4
  75. package/src/components/Button/Button.module.css +19 -61
  76. package/src/components/Button/Button.stories.tsx +24 -23
  77. package/src/components/Button/Button.tsx +7 -18
  78. package/src/components/Card/Card.module.css +36 -0
  79. package/src/components/Card/Card.tsx +6 -4
  80. package/src/components/Checkbox/Checkbox.module.css +27 -10
  81. package/src/components/Checkbox/Checkbox.tsx +124 -24
  82. package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
  83. package/src/components/Checkbox/CheckboxGroup.tsx +43 -23
  84. package/src/components/Chip/Chip.module.css +52 -34
  85. package/src/components/Chip/Chip.tsx +45 -47
  86. package/src/components/Container/Container.stories.tsx +103 -20
  87. package/src/components/Container/Container.tsx +1 -13
  88. package/src/components/DatePicker/DatePicker.stories.tsx +125 -19
  89. package/src/components/DatePicker/DatePicker.tsx +3 -1
  90. package/src/components/Dropdown/Dropdown.tsx +7 -9
  91. package/src/components/FileInput/FileInput.stories.tsx +2 -19
  92. package/src/components/FileUpload/FileUpload.stories.tsx +2 -19
  93. package/src/components/Flex/Flex.stories.tsx +113 -20
  94. package/src/components/Flex/Flex.tsx +16 -26
  95. package/src/components/FormControlLayout/FormControlLayout.stories.tsx +0 -8
  96. package/src/components/FormControlLayout/FormControlLayout.tsx +18 -7
  97. package/src/components/FormControlWrapper/FormControlWrapper.module.css +1 -10
  98. package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +12 -21
  99. package/src/components/FormControlWrapper/FormControlWrapper.tsx +11 -30
  100. package/src/components/Group/Group.stories.tsx +6 -30
  101. package/src/components/Group/Group.tsx +14 -9
  102. package/src/components/HoverCard/HoverCard.tsx +72 -75
  103. package/src/components/Label/Label.module.css +4 -0
  104. package/src/components/Label/Label.stories.tsx +18 -12
  105. package/src/components/Label/Label.tsx +3 -9
  106. package/src/components/Link/Link.module.css +4 -3
  107. package/src/components/Link/Link.stories.tsx +2 -8
  108. package/src/components/Link/Link.tsx +1 -5
  109. package/src/components/Loader/Loader.module.css +1 -2
  110. package/src/components/Loader/Loader.tsx +1 -7
  111. package/src/components/Menu/IMPLEMENTATION_NOTES.md +4 -0
  112. package/src/components/Menu/Menu.stories.tsx +106 -188
  113. package/src/components/Menu/Menu.tsx +34 -280
  114. package/src/components/Modal/Modal.tsx +158 -160
  115. package/src/components/NumberInput/NumberInput.tsx +6 -18
  116. package/src/components/Pagination/IMPLEMENTATION_NOTES.md +3 -0
  117. package/src/components/Pagination/Pagination.module.css +12 -24
  118. package/src/components/Pagination/Pagination.stories.tsx +0 -8
  119. package/src/components/Pagination/Pagination.tsx +20 -140
  120. package/src/components/Panel/Panel.tsx +7 -30
  121. package/src/components/Radio/Radio.module.css +25 -10
  122. package/src/components/Radio/Radio.tsx +51 -19
  123. package/src/components/Radio/RadioGroup.stories.tsx +117 -0
  124. package/src/components/Radio/RadioGroup.tsx +26 -12
  125. package/src/components/ReadOnlyField/ReadOnlyField.module.css +6 -6
  126. package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +5 -36
  127. package/src/components/ReadOnlyField/ReadOnlyField.tsx +9 -13
  128. package/src/components/SegmentedControl/SegmentedControl.module.css +23 -47
  129. package/src/components/SegmentedControl/SegmentedControl.tsx +44 -14
  130. package/src/components/Slider/Slider.module.css +1 -4
  131. package/src/components/Slider/Slider.stories.tsx +3 -3
  132. package/src/components/Slider/Slider.tsx +26 -25
  133. package/src/components/Stack/Stack.stories.tsx +4 -25
  134. package/src/components/Stack/Stack.tsx +1 -5
  135. package/src/components/Stepper/IMPLEMENTATION_NOTES.md +4 -0
  136. package/src/components/Stepper/Stepper.stories.tsx +56 -43
  137. package/src/components/Stepper/Stepper.tsx +89 -87
  138. package/src/components/Switch/Switch.module.css +21 -0
  139. package/src/components/Switch/Switch.tsx +63 -16
  140. package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
  141. package/src/components/Switch/SwitchGroup.tsx +27 -18
  142. package/src/components/Table/Table.stories.tsx +1 -19
  143. package/src/components/Table/Table.tsx +3 -1
  144. package/src/components/Tabs/IMPLEMENTATION_NOTES.md +4 -0
  145. package/src/components/Tabs/Tabs.stories.tsx +41 -24
  146. package/src/components/Tabs/Tabs.tsx +49 -66
  147. package/src/components/Text/Text.stories.tsx +5 -17
  148. package/src/components/Text/Text.tsx +1 -15
  149. package/src/components/TextArea/TextArea.tsx +7 -17
  150. package/src/components/TextField/TextField.stories.tsx +1 -27
  151. package/src/components/TextField/TextField.tsx +4 -6
  152. package/src/components/TimePicker/TimePicker.stories.tsx +2 -19
  153. package/src/components/TimePicker/TimePicker.tsx +3 -1
  154. package/src/components/Timeline/Timeline.tsx +4 -1
  155. package/src/components/Timeline/TimelineItem.tsx +1 -12
  156. package/src/components/Title/Title.stories.tsx +0 -18
  157. package/src/components/Title/Title.tsx +1 -7
  158. package/src/components/Toast/Toast.stories.tsx +1 -1
  159. package/src/components/Toast/Toast.tsx +62 -28
  160. package/src/components/Tooltip/Tooltip.tsx +11 -37
  161. package/src/components/TransferList/TransferList.stories.tsx +1 -19
  162. package/src/components/TransferList/TransferList.tsx +3 -1
  163. package/src/utils/RequireAccessibleLabel.ts +1 -12
  164. package/src/utils/filterStylingProps.ts +7 -20
@@ -1,7 +1,3 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { Menu } from "./Menu";
3
- import { Button } from "../Button";
4
-
5
1
  /**
6
2
  * Menu story axes:
7
3
  * - trigger: click (default) vs hover behavior
@@ -11,7 +7,13 @@ import { Button } from "../Button";
11
7
  * - layer: tested via the global Layer decorator (withLayer/layer args)
12
8
  */
13
9
 
14
- const SettingsIcon = () => (
10
+ import React, { useState, useRef, useEffect } from "react";
11
+ import type { Meta, StoryObj } from "@storybook/react";
12
+ import { Menu, MenuItem, MenuDivider } from "./Menu";
13
+ import { Button } from "../Button";
14
+ import { ListSubheader } from "@mui/material";
15
+
16
+ const SettingsIcon = (props: any) => (
15
17
  <svg
16
18
  xmlns="http://www.w3.org/2000/svg"
17
19
  width="14"
@@ -22,13 +24,14 @@ const SettingsIcon = () => (
22
24
  strokeWidth="2"
23
25
  strokeLinecap="round"
24
26
  strokeLinejoin="round"
27
+ {...props}
25
28
  >
26
29
  <circle cx="12" cy="12" r="3" />
27
- <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
30
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" />
28
31
  </svg>
29
32
  );
30
33
 
31
- const SearchIcon = () => (
34
+ const SearchIcon = (props: any) => (
32
35
  <svg
33
36
  xmlns="http://www.w3.org/2000/svg"
34
37
  width="14"
@@ -39,13 +42,14 @@ const SearchIcon = () => (
39
42
  strokeWidth="2"
40
43
  strokeLinecap="round"
41
44
  strokeLinejoin="round"
45
+ {...props}
42
46
  >
43
47
  <circle cx="11" cy="11" r="8" />
44
48
  <line x1="21" y1="21" x2="16.65" y2="16.65" />
45
49
  </svg>
46
50
  );
47
51
 
48
- const MessageIcon = () => (
52
+ const MessageIcon = (props: any) => (
49
53
  <svg
50
54
  xmlns="http://www.w3.org/2000/svg"
51
55
  width="14"
@@ -56,12 +60,13 @@ const MessageIcon = () => (
56
60
  strokeWidth="2"
57
61
  strokeLinecap="round"
58
62
  strokeLinejoin="round"
63
+ {...props}
59
64
  >
60
65
  <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
61
66
  </svg>
62
67
  );
63
68
 
64
- const ImageIcon = () => (
69
+ const ImageIcon = (props: any) => (
65
70
  <svg
66
71
  xmlns="http://www.w3.org/2000/svg"
67
72
  width="14"
@@ -72,6 +77,7 @@ const ImageIcon = () => (
72
77
  strokeWidth="2"
73
78
  strokeLinecap="round"
74
79
  strokeLinejoin="round"
80
+ {...props}
75
81
  >
76
82
  <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
77
83
  <circle cx="8.5" cy="8.5" r="1.5" />
@@ -79,7 +85,7 @@ const ImageIcon = () => (
79
85
  </svg>
80
86
  );
81
87
 
82
- const TrashIcon = () => (
88
+ const TrashIcon = (props: any) => (
83
89
  <svg
84
90
  xmlns="http://www.w3.org/2000/svg"
85
91
  width="14"
@@ -90,13 +96,14 @@ const TrashIcon = () => (
90
96
  strokeWidth="2"
91
97
  strokeLinecap="round"
92
98
  strokeLinejoin="round"
99
+ {...props}
93
100
  >
94
101
  <polyline points="3 6 5 6 21 6" />
95
102
  <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
96
103
  </svg>
97
104
  );
98
105
 
99
- const ArrowsIcon = () => (
106
+ const ArrowsIcon = (props: any) => (
100
107
  <svg
101
108
  xmlns="http://www.w3.org/2000/svg"
102
109
  width="14"
@@ -107,6 +114,7 @@ const ArrowsIcon = () => (
107
114
  strokeWidth="2"
108
115
  strokeLinecap="round"
109
116
  strokeLinejoin="round"
117
+ {...props}
110
118
  >
111
119
  <polyline points="17 1 21 5 17 9" />
112
120
  <path d="M3 11V9a4 4 0 0 1 4-4h14" />
@@ -115,207 +123,117 @@ const ArrowsIcon = () => (
115
123
  </svg>
116
124
  );
117
125
 
118
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
119
126
  type MenuStoryArgs = Record<string, any>;
120
127
 
121
128
  const meta: Meta = {
122
129
  title: "UI-Kit/Menu",
123
130
  component: Menu,
124
131
  tags: ["autodocs"],
125
- argTypes: {
126
- trigger: {
127
- control: "select",
128
- options: ["click", "hover", "click-hover"],
129
- description:
130
- "Determines how the menu is triggered: click (default), hover, or both.",
131
- },
132
- position: {
133
- control: "select",
134
- options: [
135
- "bottom",
136
- "bottom-start",
137
- "bottom-end",
138
- "top",
139
- "top-start",
140
- "top-end",
141
- "left",
142
- "left-start",
143
- "left-end",
144
- "right",
145
- "right-start",
146
- "right-end",
147
- ],
148
- description: "The position of the dropdown relative to the target.",
149
- },
150
- withArrow: {
151
- control: "boolean",
152
- description: "Whether to display an arrow pointing to the target.",
153
- },
154
- offset: {
155
- control: "number",
156
- description:
157
- "Distance in px between the dropdown and the target element.",
158
- },
159
- opened: {
160
- control: "boolean",
161
- description:
162
- "Controlled open state. Leave undefined for uncontrolled behavior.",
163
- },
164
- },
165
- parameters: {
166
- docs: {
167
- description: {
168
- component: `
169
- The \`Menu\` component combines a list of secondary actions into a single interactive overlay area, wrapping Mantine's composable \`Menu\` while enforcing strict Recursica design token styling.
170
-
171
- ### Composable API
172
-
173
- Menu uses a dot-notation composition pattern:
174
- - \`<Menu>\` — Root container managing open/close state
175
- - \`<Menu.Target>\` — Wrapper for the trigger element (must be a single element supporting ref)
176
- - \`<Menu.Dropdown>\` — The popup panel
177
- - \`<Menu.Item>\` — An actionable item with optional \`leftSection\` / \`rightSection\`
178
- - \`<Menu.Divider>\` — A visual separator
179
- - \`<Menu.Label>\` — A non-interactive section header
180
-
181
- ### Sub-menus
182
- Nested menus are supported via \`<Menu.Sub>\`, \`<Menu.Sub.Target>\`, \`<Menu.Sub.Item>\`, and \`<Menu.Sub.Dropdown>\`.
183
-
184
- ### Design Token Limitations
185
- Mantine's \`color\` prop on \`Menu.Item\` is stripped in strict mode to enforce design token adherence. Use \`overStyled={true}\` to bypass this restriction.
186
- `,
187
- },
188
- },
189
- },
190
132
  };
191
133
 
192
134
  export default meta;
193
135
 
194
136
  type Story = StoryObj<MenuStoryArgs>;
195
137
 
196
- export const Default: Story = {
197
- args: {
198
- trigger: "click",
199
- position: "bottom-start",
200
- withArrow: false,
201
- offset: 5,
202
- opened: undefined,
203
- },
204
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
205
- render: ({ withLayer, layer, ...args }: MenuStoryArgs) => {
206
- return (
207
- <Menu {...args}>
208
- <Menu.Target>
209
- <Button variant="solid">Toggle Menu</Button>
210
- </Menu.Target>
211
-
212
- <Menu.Dropdown>
213
- <Menu.Label>Application</Menu.Label>
214
- <Menu.Item leftSection={<SettingsIcon />}>Settings</Menu.Item>
215
- <Menu.Item leftSection={<MessageIcon />}>Messages</Menu.Item>
216
- <Menu.Item leftSection={<ImageIcon />}>Gallery</Menu.Item>
217
- <Menu.Item leftSection={<SearchIcon />}>Search</Menu.Item>
218
-
219
- <Menu.Divider />
220
-
221
- <Menu.Label>Danger zone</Menu.Label>
222
- <Menu.Item leftSection={<ArrowsIcon />}>Transfer my data</Menu.Item>
223
- <Menu.Item leftSection={<TrashIcon />}>Delete my account</Menu.Item>
224
- </Menu.Dropdown>
138
+ const InteractiveMenu = ({ children, openDelay, ...args }: any) => {
139
+ const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
140
+ const buttonRef = useRef<HTMLButtonElement>(null);
141
+
142
+ const open = Boolean(anchorEl) || args.opened;
143
+
144
+ useEffect(() => {
145
+ if (args.opened && buttonRef.current) {
146
+ setAnchorEl(buttonRef.current);
147
+ }
148
+ }, [args.opened]);
149
+
150
+ const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
151
+ setAnchorEl(event.currentTarget);
152
+ };
153
+ const handleClose = () => {
154
+ setAnchorEl(null);
155
+ };
156
+
157
+ return (
158
+ <div>
159
+ <Button ref={buttonRef} variant="solid" onClick={handleClick}>
160
+ Toggle Menu
161
+ </Button>
162
+ <Menu anchorEl={anchorEl} open={open} onClose={handleClose} {...args}>
163
+ {children}
225
164
  </Menu>
226
- );
227
- },
165
+ </div>
166
+ );
228
167
  };
229
168
 
230
- export const WithDisabledItems: Story = {
169
+ export const Default: Story = {
170
+ render: (args) => (
171
+ <InteractiveMenu {...args}>
172
+ <ListSubheader>Application</ListSubheader>
173
+ <MenuItem>
174
+ <SettingsIcon style={{ marginRight: 8 }} /> Settings
175
+ </MenuItem>
176
+ <MenuItem>
177
+ <MessageIcon style={{ marginRight: 8 }} /> Messages
178
+ </MenuItem>
179
+ <MenuItem>
180
+ <ImageIcon style={{ marginRight: 8 }} /> Gallery
181
+ </MenuItem>
182
+ <MenuItem>
183
+ <SearchIcon style={{ marginRight: 8 }} /> Search
184
+ </MenuItem>
185
+ <MenuDivider />
186
+ <ListSubheader>Danger zone</ListSubheader>
187
+ <MenuItem>
188
+ <ArrowsIcon style={{ marginRight: 8 }} /> Transfer my data
189
+ </MenuItem>
190
+ <MenuItem>
191
+ <TrashIcon style={{ marginRight: 8 }} /> Delete my account
192
+ </MenuItem>
193
+ </InteractiveMenu>
194
+ ),
231
195
  args: {
232
- position: "bottom-start",
233
- },
234
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
235
- render: ({ withLayer, layer, ...args }: MenuStoryArgs) => {
236
- return (
237
- <Menu {...args}>
238
- <Menu.Target>
239
- <Button variant="solid">Menu with Disabled</Button>
240
- </Menu.Target>
241
-
242
- <Menu.Dropdown>
243
- <Menu.Item leftSection={<SettingsIcon />}>Settings</Menu.Item>
244
- <Menu.Item leftSection={<SearchIcon />} disabled>
245
- Search (disabled)
246
- </Menu.Item>
247
- <Menu.Item leftSection={<MessageIcon />}>Messages</Menu.Item>
248
- <Menu.Item leftSection={<TrashIcon />} disabled>
249
- Delete (disabled)
250
- </Menu.Item>
251
- </Menu.Dropdown>
252
- </Menu>
253
- );
196
+ opened: true,
254
197
  },
255
198
  };
256
199
 
257
- export const WithSubmenus: Story = {
200
+ export const WithDisabledItems: Story = {
201
+ render: (args) => (
202
+ <InteractiveMenu {...args}>
203
+ <MenuItem>
204
+ <SettingsIcon style={{ marginRight: 8 }} /> Settings
205
+ </MenuItem>
206
+ <MenuItem disabled>
207
+ <SearchIcon style={{ marginRight: 8 }} /> Search (disabled)
208
+ </MenuItem>
209
+ <MenuItem>
210
+ <MessageIcon style={{ marginRight: 8 }} /> Messages
211
+ </MenuItem>
212
+ <MenuItem disabled>
213
+ <TrashIcon style={{ marginRight: 8 }} /> Delete (disabled)
214
+ </MenuItem>
215
+ </InteractiveMenu>
216
+ ),
258
217
  args: {
259
- position: "bottom-start",
260
- width: 200,
261
- },
262
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
263
- render: ({ withLayer, layer, ...args }: MenuStoryArgs) => {
264
- return (
265
- <Menu {...args}>
266
- <Menu.Target>
267
- <Button variant="solid">Menu with Submenus</Button>
268
- </Menu.Target>
269
-
270
- <Menu.Dropdown>
271
- <Menu.Item>Dashboard</Menu.Item>
272
- <Menu.Sub>
273
- <Menu.Sub.Target>
274
- <Menu.Sub.Item>Products</Menu.Sub.Item>
275
- </Menu.Sub.Target>
276
- <Menu.Sub.Dropdown>
277
- <Menu.Item>All products</Menu.Item>
278
- <Menu.Item>Categories</Menu.Item>
279
- <Menu.Item>Tags</Menu.Item>
280
- </Menu.Sub.Dropdown>
281
- </Menu.Sub>
282
- <Menu.Sub>
283
- <Menu.Sub.Target>
284
- <Menu.Sub.Item>Orders</Menu.Sub.Item>
285
- </Menu.Sub.Target>
286
- <Menu.Sub.Dropdown>
287
- <Menu.Item>Open</Menu.Item>
288
- <Menu.Item>Completed</Menu.Item>
289
- <Menu.Item>Cancelled</Menu.Item>
290
- </Menu.Sub.Dropdown>
291
- </Menu.Sub>
292
- </Menu.Dropdown>
293
- </Menu>
294
- );
218
+ opened: true,
295
219
  },
296
220
  };
297
221
 
298
222
  export const HoverTrigger: Story = {
223
+ render: (args) => (
224
+ <InteractiveMenu {...args}>
225
+ <MenuItem>
226
+ <SettingsIcon style={{ marginRight: 8 }} /> Settings
227
+ </MenuItem>
228
+ <MenuItem>
229
+ <MessageIcon style={{ marginRight: 8 }} /> Messages
230
+ </MenuItem>
231
+ <MenuItem>
232
+ <ImageIcon style={{ marginRight: 8 }} /> Gallery
233
+ </MenuItem>
234
+ </InteractiveMenu>
235
+ ),
299
236
  args: {
300
- trigger: "click-hover",
301
- position: "bottom-start",
302
- openDelay: 100,
303
- closeDelay: 400,
304
- },
305
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
306
- render: ({ withLayer, layer, ...args }: MenuStoryArgs) => {
307
- return (
308
- <Menu {...args}>
309
- <Menu.Target>
310
- <Button variant="solid">Hover or Click</Button>
311
- </Menu.Target>
312
-
313
- <Menu.Dropdown>
314
- <Menu.Item leftSection={<SettingsIcon />}>Settings</Menu.Item>
315
- <Menu.Item leftSection={<MessageIcon />}>Messages</Menu.Item>
316
- <Menu.Item leftSection={<ImageIcon />}>Gallery</Menu.Item>
317
- </Menu.Dropdown>
318
- </Menu>
319
- );
237
+ opened: true,
320
238
  },
321
239
  };