@rescui/dropdown-menu 0.11.13 → 0.11.15-RUI-293-Update-menu-component-7a032357e.20

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/README.md CHANGED
@@ -1,3 +1,5 @@
1
- # Dropdown Menu
1
+ # DropdownMenu
2
2
 
3
- * [Usage examples](./docs/demo.md)
3
+ ## LLM
4
+
5
+ To get the docs for the LLM, check out [this index](./llm/index.md).
@@ -1,40 +1,41 @@
1
- import React from 'react';
2
- import { DropdownProps } from '@rescui/dropdown';
3
- import { MenuItemIconPlacement } from '@rescui/menu';
4
- declare type DropdownMenuSize = 's' | 'm' | 'l';
5
- export interface DropdownMenuProps extends Omit<DropdownProps, 'maxWidth' | 'minWidth' | 'maxHeight' | 'leastMaxHeight' | 'className'> {
6
- /**
7
- * Maximum number of visible items in the dropdown list.
8
- * For large lists, n + 0.5 items will be visible at a time.
9
- * If the maximum number of items in a list is exactly n + 1, all
10
- * items will be shown still (to avoid creating a scroll for half an item only).
11
- */
12
- maxVisibleItems?: number;
13
- iconPlacement?: MenuItemIconPlacement;
14
- itemTag?: React.ElementType;
15
- tag?: React.ElementType;
16
- size?: DropdownMenuSize;
17
- wrapItemsWithLi?: boolean;
18
- activateFirstItemOnOpen?: boolean;
19
- /**
20
- * See [MDN spec](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width).
21
- * `trigger` is a special value that substitutes with trigger's width calculated on every dropdown position update
22
- * @type 'trigger' | MinWidthProperty<string | number>;
23
- * @default 316px
24
- * */
25
- minWidth?: DropdownProps['minWidth'];
26
- /**
27
- * See [MDN spec](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width).
28
- * `trigger` is a special value that substitutes with trigger's width calculated on every dropdown position update
29
- * @type 'trigger' | MaxWidthProperty<string | number>;
30
- * @default "389px"(s); "494px"(m,l)
31
- * */
32
- maxWidth?: DropdownProps['maxWidth'];
33
- /**
34
- * Automatically resize icons according to the size of the menu item.
35
- * */
36
- resizeIcons?: boolean;
37
- className?: string;
38
- }
39
- export declare const DropdownMenu: React.FC<DropdownMenuProps>;
40
- export default DropdownMenu;
1
+ import React from 'react';
2
+ import { DropdownProps } from '@rescui/dropdown';
3
+ import { MenuItemIconPlacement } from '@rescui/menu';
4
+ type DropdownMenuSize = 's' | 'm' | 'l';
5
+ export interface DropdownMenuProps extends Omit<DropdownProps, 'maxWidth' | 'minWidth' | 'maxHeight' | 'leastMaxHeight' | 'className'> {
6
+ /**
7
+ * Maximum number of visible items in the dropdown list.
8
+ * For large lists, n + 0.5 items will be visible at a time.
9
+ * If the maximum number of items in a list is exactly n + 1, all
10
+ * items will be shown still (to avoid creating a scroll for half an item only).
11
+ */
12
+ maxVisibleItems?: number;
13
+ iconPlacement?: MenuItemIconPlacement;
14
+ itemTag?: React.ElementType;
15
+ tag?: React.ElementType;
16
+ size?: DropdownMenuSize;
17
+ wrapItemsWithLi?: boolean;
18
+ activateFirstItemOnOpen?: boolean;
19
+ /**
20
+ * See [MDN spec](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width).
21
+ * `trigger` is a special value that substitutes with trigger's width calculated on every dropdown position update
22
+ * @type 'trigger' | MinWidthProperty<string | number>;
23
+ * @default 316px
24
+ * */
25
+ minWidth?: DropdownProps['minWidth'];
26
+ /**
27
+ * See [MDN spec](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width).
28
+ * `trigger` is a special value that substitutes with trigger's width calculated on every dropdown position update
29
+ * @type 'trigger' | MaxWidthProperty<string | number>;
30
+ * @default "389px"(s); "494px"(m,l)
31
+ * @rawDefaultValue
32
+ * */
33
+ maxWidth?: DropdownProps['maxWidth'];
34
+ /**
35
+ * Automatically resize icons according to the size of the menu item.
36
+ * */
37
+ resizeIcons?: boolean;
38
+ className?: string;
39
+ }
40
+ export declare const DropdownMenu: React.FC<DropdownMenuProps>;
41
+ export default DropdownMenu;
@@ -36,6 +36,7 @@ const DropdownMenu = _ref => {
36
36
  const menuWrapperRef = useRef(null);
37
37
  const [height, setHeight] = useState(0);
38
38
  let itemHeightFromCss = null;
39
+ let contrastPrimaryFromCss = null;
39
40
 
40
41
  if (menuWrapperRef.current) {
41
42
  // In theory this part of the code might cause issues with SSR.
@@ -46,6 +47,7 @@ const DropdownMenu = _ref => {
46
47
  // it's a dropdown-content and in most cases it opens only on-demand
47
48
  const menuWrapperStyles = getComputedStyle(menuWrapperRef.current);
48
49
  itemHeightFromCss = parseInt(menuWrapperStyles.getPropertyValue('--_rs-dropdown-menu-item-height'), 10) || null;
50
+ contrastPrimaryFromCss = parseInt(menuWrapperStyles.getPropertyValue('--rs-dropdown-menu-contrast-primary'), 10) || null;
49
51
  }
50
52
 
51
53
  const itemHeight = itemHeightFromCss || ITEM_HEIGHT_BY_SIZE[size]; // a little buffer of 10% here
@@ -80,8 +82,10 @@ const DropdownMenu = _ref => {
80
82
  "data-test": "dropdown-menu",
81
83
  "data-rs-internal": 'dropdown-menu__menu',
82
84
  className: styles.menu,
85
+ style: {
86
+ '--rs-menu-contrast-primary': contrastPrimaryFromCss
87
+ },
83
88
  enableKeyboardNavigation: true,
84
- returnFocusOnUnmount: true,
85
89
  activateFirstItem: activateFirstItemOnOpen,
86
90
  wrapItemsWithLi: wrapItemsWithLi,
87
91
  resizeIcons: resizeIcons
@@ -1,8 +1,8 @@
1
1
  var styles = {
2
- "sizeS": "_sizeS_1ndkkjy_8",
3
- "sizeM": "_sizeM_1ndkkjy_11",
4
- "sizeL": "_sizeL_1ndkkjy_14",
5
- "dropdownMenu": "_dropdownMenu_1ndkkjy_18",
6
- "menu": "_menu_1ndkkjy_23"
2
+ "sizeS": "_sizeS_sr3m6n_8",
3
+ "sizeM": "_sizeM_sr3m6n_11",
4
+ "sizeL": "_sizeL_sr3m6n_14",
5
+ "dropdownMenu": "_dropdownMenu_sr3m6n_18",
6
+ "menu": "_menu_sr3m6n_23"
7
7
  };
8
8
  export { styles as default };
package/lib/index.css CHANGED
@@ -1,29 +1,29 @@
1
- ._sizeS_1ndkkjy_8{
1
+ ._sizeS_sr3m6n_8{
2
2
  --_rs-dropdown-menu-min-width:316px;
3
3
  --_rs-dropdown-menu-max-width:389px;
4
4
  }
5
- ._sizeS_1ndkkjy_8 [data-rs-internal='dropdown-menu__menu-wrapper']{
5
+ ._sizeS_sr3m6n_8 [data-rs-internal='dropdown-menu__menu-wrapper']{
6
6
  --_rs-dropdown-menu-item-height:32px;
7
7
  }
8
- ._sizeM_1ndkkjy_11{
8
+ ._sizeM_sr3m6n_11{
9
9
  --_rs-dropdown-menu-min-width:316px;
10
10
  --_rs-dropdown-menu-max-width:494px;
11
11
  }
12
- ._sizeM_1ndkkjy_11 [data-rs-internal='dropdown-menu__menu-wrapper']{
12
+ ._sizeM_sr3m6n_11 [data-rs-internal='dropdown-menu__menu-wrapper']{
13
13
  --_rs-dropdown-menu-item-height:40px;
14
14
  }
15
- ._sizeL_1ndkkjy_14{
15
+ ._sizeL_sr3m6n_14{
16
16
  --_rs-dropdown-menu-min-width:316px;
17
17
  --_rs-dropdown-menu-max-width:494px;
18
18
  }
19
- ._sizeL_1ndkkjy_14 [data-rs-internal='dropdown-menu__menu-wrapper']{
19
+ ._sizeL_sr3m6n_14 [data-rs-internal='dropdown-menu__menu-wrapper']{
20
20
  --_rs-dropdown-menu-item-height:52px;
21
21
  }
22
- ._dropdownMenu_1ndkkjy_18{
22
+ ._dropdownMenu_sr3m6n_18{
23
23
  min-width:var(--_rs-dropdown-menu-min-width);
24
24
  max-width:var(--_rs-dropdown-menu-max-width);
25
25
  }
26
- ._menu_1ndkkjy_23{
26
+ ._menu_sr3m6n_23{
27
27
  margin:0;
28
28
  padding:0;
29
29
 
package/lib/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { default as DropdownMenu } from './dropdown-menu';
2
- export type { DropdownMenuProps } from './dropdown-menu';
3
- export { MenuItem } from '@rescui/menu';
1
+ export { default as DropdownMenu } from './dropdown-menu';
2
+ export type { DropdownMenuProps } from './dropdown-menu';
3
+ export { MenuItem } from '@rescui/menu';
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- export declare type MenuWrapperProps = {
3
- children?: React.ReactNode;
4
- onHeightUpdate?: (newHeight: number) => void;
5
- };
6
- export declare const MenuWrapper: React.ForwardRefExoticComponent<MenuWrapperProps & React.RefAttributes<HTMLDivElement>>;
1
+ import React from 'react';
2
+ export type MenuWrapperProps = {
3
+ children?: React.ReactNode;
4
+ onHeightUpdate?: (newHeight: number) => void;
5
+ };
6
+ export declare const MenuWrapper: React.ForwardRefExoticComponent<MenuWrapperProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,424 @@
1
+ # DropdownMenu
2
+
3
+ DropdownMenu is a special type of Dropdown component with predefined dimensions for correctly displaying overflowing menus. Compared to the standard Dropdown option, it also offers keyboard navigation and a simpler API for making menus.
4
+
5
+ ## Usage
6
+
7
+ ### Features showcase
8
+
9
+ #### Basic example
10
+
11
+ ```tsx
12
+ import { useState } from 'react';
13
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
14
+ import { Button } from '@rescui/button';
15
+
16
+ const Demo = () => {
17
+ const [isOpen, setIsOpen] = useState(false);
18
+
19
+ const toggleIsOpen = () => setIsOpen(s => !s);
20
+
21
+ return (
22
+ <DropdownMenu
23
+ isOpen={isOpen}
24
+ onRequestClose={() => setIsOpen(false)}
25
+ trigger={<Button onClick={toggleIsOpen}>Open Menu</Button>}
26
+ >
27
+ <MenuItem>Some text 1</MenuItem>
28
+ <MenuItem>Some text 2</MenuItem>
29
+ <MenuItem>Some text 3</MenuItem>
30
+ <MenuItem>Some text 4</MenuItem>
31
+ <MenuItem>Some text 5</MenuItem>
32
+ <MenuItem>Some text 6</MenuItem>
33
+ <MenuItem>Some text 7</MenuItem>
34
+ <MenuItem>Some text 8</MenuItem>
35
+ </DropdownMenu>
36
+ );
37
+ };
38
+
39
+ render(<Demo />);
40
+ ```
41
+
42
+ #### Links, buttons, divider
43
+
44
+ ```tsx
45
+ import { useState } from 'react';
46
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
47
+ import { Divider } from '@rescui/menu';
48
+ import { Button } from '@rescui/button';
49
+ import { ArrowTopRightOutlineIcon } from '@rescui/icons';
50
+
51
+ const Demo = () => {
52
+ const [isOpen, setIsOpen] = useState(false);
53
+
54
+ const toggleIsOpen = () => setIsOpen(s => !s);
55
+
56
+ return (
57
+ <DropdownMenu
58
+ isOpen={isOpen}
59
+ onRequestClose={() => setIsOpen(false)}
60
+ trigger={<Button onClick={toggleIsOpen}>Open Menu</Button>}
61
+ >
62
+ <MenuItem href="#somewhere1">Some link 1</MenuItem>
63
+ <MenuItem href="#somewhere2">Some link 2</MenuItem>
64
+ <MenuItem onClick={() => alert(3)}>Some button 3</MenuItem>
65
+ <MenuItem href="#somewhere4" onClick={() => alert(4)}>
66
+ Some link 4
67
+ </MenuItem>
68
+ <Divider />
69
+ <MenuItem
70
+ href="#somewhere5"
71
+ icon={<ArrowTopRightOutlineIcon />}
72
+ iconPlacement="right"
73
+ >
74
+ External link 5
75
+ </MenuItem>
76
+ <MenuItem onClick={() => alert(6)}>Some button 6</MenuItem>
77
+ </DropdownMenu>
78
+ );
79
+ };
80
+
81
+ render(<Demo />);
82
+ ```
83
+
84
+ #### Select first item on open by keyboard
85
+
86
+ ```tsx
87
+ import { useState } from 'react';
88
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
89
+ import { Button } from '@rescui/button';
90
+
91
+ const Demo = () => {
92
+ const [isOpenBy, setIsOpenBy] = useState(null);
93
+
94
+ const handleClick = () => setIsOpenBy(s => !s && 'mouse');
95
+
96
+ const handleKeyDown = e => {
97
+ if (e.code === 'ArrowDown' || e.code === 'Enter' || e.code === 'Space') {
98
+ e.preventDefault();
99
+ setIsOpenBy('keyboard');
100
+ }
101
+ };
102
+
103
+ return (
104
+ <DropdownMenu
105
+ isOpen={Boolean(isOpenBy)}
106
+ onRequestClose={() => setIsOpenBy(null)}
107
+ activateFirstItemOnOpen={isOpenBy === 'keyboard'}
108
+ trigger={
109
+ <Button onClick={handleClick} onKeyDown={handleKeyDown}>
110
+ Open Menu
111
+ </Button>
112
+ }
113
+ >
114
+ <MenuItem>Some text 1</MenuItem>
115
+ <MenuItem>Some text 2</MenuItem>
116
+ <MenuItem>Some text 3</MenuItem>
117
+ <MenuItem>Some text 4</MenuItem>
118
+ <MenuItem>Some text 5</MenuItem>
119
+ <MenuItem>Some text 6</MenuItem>
120
+ <MenuItem>Some text 7</MenuItem>
121
+ <MenuItem>Some text 8</MenuItem>
122
+ </DropdownMenu>
123
+ );
124
+ };
125
+
126
+ render(<Demo />);
127
+ ```
128
+
129
+ #### Rock with glow effect
130
+
131
+ ```tsx
132
+ import { useState } from 'react';
133
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
134
+ import { Button } from '@rescui/button';
135
+ import { useGlowHover } from '@rescui/use-glow-hover';
136
+
137
+ const GlowMenuItem = ({ theme, ...restProps }) => {
138
+ const ref = useGlowHover({
139
+ lightSizeEnterAnimationTime: 0,
140
+ lightSizeLeaveAnimationTime: 0,
141
+ preset: 'bright-pink',
142
+ enableBurst: true,
143
+ forceTheme: 'light'
144
+ });
145
+ return <MenuItem {...restProps} ref={ref} />;
146
+ };
147
+
148
+ const Demo = () => {
149
+ const [isOpen, setIsOpen] = useState(false);
150
+
151
+ const toggleIsOpen = () => setIsOpen(s => !s);
152
+
153
+ return (
154
+ <DropdownMenu
155
+ mode="rock"
156
+ isOpen={isOpen}
157
+ onRequestClose={() => setIsOpen(false)}
158
+ trigger={<Button onClick={toggleIsOpen}>Open Menu</Button>}
159
+ >
160
+ <GlowMenuItem>Some text 1</GlowMenuItem>
161
+ <GlowMenuItem>Some text 2</GlowMenuItem>
162
+ <GlowMenuItem>Some text 3</GlowMenuItem>
163
+ <GlowMenuItem>Some text 4</GlowMenuItem>
164
+ <GlowMenuItem>Some text 5</GlowMenuItem>
165
+ <GlowMenuItem>Some text 6</GlowMenuItem>
166
+ <GlowMenuItem>Some text 7</GlowMenuItem>
167
+ <GlowMenuItem>Some text 8</GlowMenuItem>
168
+ </DropdownMenu>
169
+ );
170
+ };
171
+
172
+ render(<Demo />);
173
+ ```
174
+
175
+ #### With selected support
176
+
177
+ ```tsx
178
+ import { useState } from 'react';
179
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
180
+ import { Button } from '@rescui/button';
181
+
182
+ const OPTIONS = [
183
+ 'Some text 1',
184
+ 'Some text 2',
185
+ 'Some text 3',
186
+ 'Some text 4',
187
+ 'Some text 5',
188
+ 'Some text 6',
189
+ 'Some text 7',
190
+ 'Some text 8'
191
+ ];
192
+
193
+ const Demo = () => {
194
+ const [isOpen, setIsOpen] = useState(false);
195
+ const [selected, setSelected] = useState(OPTIONS[2]);
196
+
197
+ const toggleIsOpen = () => setIsOpen(s => !s);
198
+
199
+ return (
200
+ <DropdownMenu
201
+ isOpen={isOpen}
202
+ onRequestClose={() => setIsOpen(false)}
203
+ trigger={<Button onClick={toggleIsOpen}>Open Menu</Button>}
204
+ >
205
+ {OPTIONS.map(option => (
206
+ <MenuItem
207
+ key={option}
208
+ selected={selected === option}
209
+ onClick={() => setSelected(option)}
210
+ >
211
+ {option}
212
+ </MenuItem>
213
+ ))}
214
+ </DropdownMenu>
215
+ );
216
+ };
217
+
218
+ render(<Demo />);
219
+ ```
220
+
221
+ #### With `minWidth`
222
+
223
+ ```tsx
224
+ import { useState } from 'react';
225
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
226
+ import { Button } from '@rescui/button';
227
+
228
+ const Demo = () => {
229
+ const [isOpen, setIsOpen] = useState(false);
230
+
231
+ const toggleIsOpen = () => setIsOpen(s => !s);
232
+
233
+ return (
234
+ <DropdownMenu
235
+ isOpen={isOpen}
236
+ onRequestClose={() => setIsOpen(false)}
237
+ trigger={<Button onClick={toggleIsOpen}>Open Menu</Button>}
238
+ minWidth="trigger"
239
+ >
240
+ <MenuItem>Some text 1</MenuItem>
241
+ <MenuItem>Some text 2</MenuItem>
242
+ <MenuItem>Some text 3</MenuItem>
243
+ <MenuItem>Some text 4</MenuItem>
244
+ <MenuItem>Some text 5</MenuItem>
245
+ <MenuItem>Some text 6</MenuItem>
246
+ <MenuItem>Some text 7</MenuItem>
247
+ <MenuItem>Some text 8</MenuItem>
248
+ </DropdownMenu>
249
+ );
250
+ };
251
+
252
+ render(<Demo />);
253
+ ```
254
+
255
+ #### With icons
256
+
257
+ ```tsx
258
+ import { useState } from 'react';
259
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
260
+ import { Button } from '@rescui/button';
261
+ import { PrintOutlineIcon } from '@rescui/icons';
262
+
263
+ const Demo = () => {
264
+ const [isOpen, setIsOpen] = useState(false);
265
+
266
+ const toggleIsOpen = () => setIsOpen(s => !s);
267
+
268
+ return (
269
+ <DropdownMenu
270
+ isOpen={isOpen}
271
+ onRequestClose={() => setIsOpen(false)}
272
+ trigger={<Button onClick={toggleIsOpen}>Open Menu</Button>}
273
+ size="l"
274
+ >
275
+ <MenuItem icon={<PrintOutlineIcon />}>Some text 1</MenuItem>
276
+ <MenuItem icon={<PrintOutlineIcon />}>Some text 2</MenuItem>
277
+ <MenuItem icon={<PrintOutlineIcon />}>Some text 3</MenuItem>
278
+ <MenuItem icon={<PrintOutlineIcon />}>Some text 4</MenuItem>
279
+ <MenuItem icon={<PrintOutlineIcon />}>Some text 5</MenuItem>
280
+ </DropdownMenu>
281
+ );
282
+ };
283
+
284
+ render(<Demo />);
285
+ ```
286
+
287
+ #### Contrast primary color
288
+
289
+ If your primary color background requires dark text color, use `--rs-dropdown-menu-contrast-primary` CSS variable.
290
+
291
+ ```tsx
292
+ import { useState } from 'react';
293
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
294
+ import { Button } from '@rescui/button';
295
+
296
+ const Demo = () => {
297
+ const [isOpen, setIsOpen] = useState(false);
298
+
299
+ const toggleIsOpen = () => setIsOpen(s => !s);
300
+
301
+ return (
302
+ <div className="light-green-primary">
303
+ <DropdownMenu
304
+ isOpen={isOpen}
305
+ onRequestClose={() => setIsOpen(false)}
306
+ trigger={
307
+ <Button onClick={toggleIsOpen} mode="rock">
308
+ Open Menu
309
+ </Button>
310
+ }
311
+ size="l"
312
+ className="dropdown-menu-with-contrast-primary"
313
+ >
314
+ <MenuItem>Some text 1</MenuItem>
315
+ <MenuItem>Some text 2</MenuItem>
316
+ <MenuItem>Some text 3</MenuItem>
317
+ <MenuItem>Some text 4</MenuItem>
318
+ <MenuItem>Some text 5</MenuItem>
319
+ </DropdownMenu>
320
+ </div>
321
+ );
322
+ };
323
+
324
+ render(<Demo />);
325
+ ```
326
+
327
+ ```postcss
328
+ .dropdown-menu-with-contrast-primary {
329
+ --rs-dropdown-menu-contrast-primary: 1;
330
+ }
331
+
332
+ .light-green-primary {
333
+ --rs-color-primary-light-theme: rgb(71, 224, 84);
334
+ --rs-color-primary-t-dim-light-theme: rgba(71, 224, 84, 0.8);
335
+ --rs-color-primary-t-fog-light-theme: rgba(71, 224, 84, 0.2);
336
+
337
+ --rs-color-primary-dark-theme: rgb(71, 224, 84);
338
+ --rs-color-primary-t-dim-dark-theme: rgba(71, 224, 84, 0.8);
339
+ --rs-color-primary-t-fog-dark-theme: rgba(71, 224, 84, 0.2);
340
+ }
341
+ ```
342
+
343
+ ## CSS Mixins API
344
+
345
+ #### `DropdownMenu` mixins
346
+
347
+ | Mixin name | Details |
348
+ | --- | --- |
349
+ | `rs-dropdown-menu-size-s` | prop: `size`<br><br>value: `"s"` |
350
+ | `rs-dropdown-menu-size-m` | prop: `size`<br><br>value: `"m"` |
351
+ | `rs-dropdown-menu-size-l` | prop: `size`<br><br>value: `"l"` |
352
+
353
+ ##### Demo
354
+
355
+ Instead of separate classes, it may be a single class with `@media` queries inside:
356
+
357
+ ```tsx
358
+ import { useState } from 'react';
359
+ import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
360
+ import { Button } from '@rescui/button';
361
+
362
+ const MyDropdownMenu = ({ className }) => {
363
+ const [isOpen, setIsOpen] = useState(false);
364
+
365
+ const toggleIsOpen = () => setIsOpen(s => !s);
366
+ return (
367
+ <div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)' }}>
368
+ <DropdownMenu
369
+ isOpen={isOpen}
370
+ onRequestClose={() => setIsOpen(false)}
371
+ trigger={<Button onClick={toggleIsOpen}>Open Menu</Button>}
372
+ className={className}
373
+ >
374
+ <MenuItem>Some text 1</MenuItem>
375
+ <MenuItem>Some text 2</MenuItem>
376
+ <MenuItem>Some text 3</MenuItem>
377
+ <MenuItem>Some text 4</MenuItem>
378
+ <MenuItem>Some text 5</MenuItem>
379
+ <MenuItem>Some text 6</MenuItem>
380
+ <MenuItem>Some text 7</MenuItem>
381
+ <MenuItem>Some text 8</MenuItem>
382
+ </DropdownMenu>
383
+ </div>
384
+ );
385
+ };
386
+
387
+ render(
388
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
389
+ <div>
390
+ <p>Default:</p>
391
+ <MyDropdownMenu />
392
+ </div>
393
+ <div>
394
+ <p>Var1:</p>
395
+ <MyDropdownMenu className={`my-dropdown-menu-var-1`} />
396
+ </div>
397
+ <div>
398
+ <p>Var1 & Var2 combined:</p>
399
+ <MyDropdownMenu
400
+ className={`my-dropdown-menu-var-1 my-dropdown-menu-var-2`}
401
+ />
402
+ </div>
403
+ </div>
404
+ );
405
+ ```
406
+
407
+ ```postcss
408
+ @import '@rescui/dropdown-menu/lib/public-api.p.css';
409
+
410
+ .my-dropdown-menu-var-1 {
411
+ @mixin rs-dropdown-menu-size-l;
412
+ }
413
+ .my-dropdown-menu-var-2 {
414
+ @mixin rs-dropdown-menu-size-s;
415
+ }
416
+ ```
417
+
418
+ #### `Menu` CSS Vars
419
+
420
+ | Variable | Syntax | Description |
421
+ | --- | --- | --- |
422
+ | `--rs-dropdown-menu-contrast-primary` | `0 \| 1` | The flag whenever the current primary is contrast enough and highlighted text color should be inverted |
423
+
424
+ Check out [this example](/components/dropdown-menu/#contrast-primary-color) for contrast primary.
package/llm/index.md ADDED
@@ -0,0 +1,2 @@
1
+ - Components and Hooks
2
+ - [DropdownMenu](./components/dropdown-menu.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescui/dropdown-menu",
3
- "version": "0.11.13",
3
+ "version": "0.11.15-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
@@ -9,6 +9,7 @@
9
9
  "src:main": "src/index.ts",
10
10
  "files": [
11
11
  "lib",
12
+ "llm",
12
13
  "LICENSE.txt"
13
14
  ],
14
15
  "publishConfig": {
@@ -16,9 +17,9 @@
16
17
  },
17
18
  "dependencies": {
18
19
  "@babel/runtime-corejs3": "^7.26.0",
19
- "@rescui/dropdown": "^0.9.7",
20
- "@rescui/menu": "^0.13.4",
21
- "@rescui/use-resize-observer": "^0.3.0",
20
+ "@rescui/dropdown": "0.10.1-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
21
+ "@rescui/menu": "0.13.6-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
22
+ "@rescui/use-resize-observer": "0.3.1-RUI-293-Update-menu-component-7a032357e.167+7a032357e",
22
23
  "classnames": "^2.2.6"
23
24
  },
24
25
  "peerDependencies": {
@@ -27,16 +28,16 @@
27
28
  "react": ">=16.8.0 <20"
28
29
  },
29
30
  "devDependencies": {
30
- "@rescui/colors": "^0.3.0",
31
- "@rescui/icons": "^1.7.5",
32
- "@rescui/scripts": "^0.5.1",
33
- "@rescui/typography": "^0.26.0",
34
- "@rescui/visual-regression": "^0.1.4"
31
+ "@rescui/colors": "0.3.1-RUI-293-Update-menu-component-7a032357e.55+7a032357e",
32
+ "@rescui/icons": "1.7.7-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
33
+ "@rescui/scripts": "0.5.2",
34
+ "@rescui/typography": "0.27.1-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
35
+ "@rescui/visual-regression": "0.1.4"
35
36
  },
36
37
  "scripts": {
37
38
  "build": "rescui-scripts build && yarn run build-pcss-api",
38
39
  "build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
39
40
  },
40
41
  "nx": {},
41
- "gitHead": "fcf55336342c842c02c07a178e9bacb9a033ef83"
42
+ "gitHead": "7a032357e8f31abbf69e18aa6b7ef2d75e40f42e"
42
43
  }