@rescui/dropdown-menu 0.11.17 → 0.11.19-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.10

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,4 +1,4 @@
1
- # Dropdown Menu
1
+ # DropdownMenu
2
2
 
3
3
  ## LLM
4
4
 
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React, { useRef, useState } from 'react';
2
+ import React, { useState } from 'react';
3
3
  import { useThemeWithUndefined } from '@rescui/ui-contexts';
4
4
  import { Dropdown } from '@rescui/dropdown';
5
5
  import { Menu } from '@rescui/menu';
@@ -33,18 +33,18 @@ const DropdownMenu = _ref => {
33
33
  className,
34
34
  ...restProps
35
35
  } = _ref;
36
- const menuWrapperRef = useRef(null);
36
+ const [menuWrapperEl, setMenuWrapperEl] = useState(null);
37
37
  const [height, setHeight] = useState(0);
38
38
  let itemHeightFromCss = null;
39
39
 
40
- if (menuWrapperRef.current) {
40
+ if (menuWrapperEl) {
41
41
  // In theory this part of the code might cause issues with SSR.
42
- // But in this specific context, because of checking ref "menuWrapperRef",
42
+ // But in this specific context, because of checking state ref "menuWrapperEl",
43
43
  // we are sure that the value will still be "null" on the first render.
44
44
  // Therefore, the first render on the client will be the same as on the server.
45
45
  // Also, there will be no layout shifts on the following renders because
46
46
  // it's a dropdown-content and in most cases it opens only on-demand
47
- const menuWrapperStyles = getComputedStyle(menuWrapperRef.current);
47
+ const menuWrapperStyles = getComputedStyle(menuWrapperEl);
48
48
  itemHeightFromCss = parseInt(menuWrapperStyles.getPropertyValue('--_rs-dropdown-menu-item-height'), 10) || null;
49
49
  }
50
50
 
@@ -69,7 +69,8 @@ const DropdownMenu = _ref => {
69
69
  maxHeight: maxHeight,
70
70
  className: cn(SIZE_TO_CLASS[size], styles.dropdownMenu, className)
71
71
  }, /*#__PURE__*/React.createElement(MenuWrapper, {
72
- ref: menuWrapperRef,
72
+ el: menuWrapperEl,
73
+ setEl: setMenuWrapperEl,
73
74
  onHeightUpdate: setHeight
74
75
  }, /*#__PURE__*/React.createElement(Menu, {
75
76
  size: size,
@@ -1,8 +1,8 @@
1
1
  var styles = {
2
- "sizeS": "_sizeS_8gpi6g_8",
3
- "sizeM": "_sizeM_8gpi6g_11",
4
- "sizeL": "_sizeL_8gpi6g_14",
5
- "dropdownMenu": "_dropdownMenu_8gpi6g_18",
6
- "menu": "_menu_8gpi6g_23"
2
+ "sizeS": "_sizeS_1t494nu_8",
3
+ "sizeM": "_sizeM_1t494nu_11",
4
+ "sizeL": "_sizeL_1t494nu_14",
5
+ "dropdownMenu": "_dropdownMenu_1t494nu_18",
6
+ "menu": "_menu_1t494nu_23"
7
7
  };
8
8
  export { styles as default };
package/lib/index.css CHANGED
@@ -1,29 +1,29 @@
1
- ._sizeS_8gpi6g_8{
1
+ ._sizeS_1t494nu_8{
2
2
  --_rs-dropdown-menu-min-width:316px;
3
3
  --_rs-dropdown-menu-max-width:389px;
4
4
  }
5
- ._sizeS_8gpi6g_8 [data-rs-internal='dropdown-menu__menu-wrapper']{
5
+ ._sizeS_1t494nu_8 [data-rs-internal='dropdown-menu__menu-wrapper']{
6
6
  --_rs-dropdown-menu-item-height:32px;
7
7
  }
8
- ._sizeM_8gpi6g_11{
8
+ ._sizeM_1t494nu_11{
9
9
  --_rs-dropdown-menu-min-width:316px;
10
10
  --_rs-dropdown-menu-max-width:494px;
11
11
  }
12
- ._sizeM_8gpi6g_11 [data-rs-internal='dropdown-menu__menu-wrapper']{
12
+ ._sizeM_1t494nu_11 [data-rs-internal='dropdown-menu__menu-wrapper']{
13
13
  --_rs-dropdown-menu-item-height:40px;
14
14
  }
15
- ._sizeL_8gpi6g_14{
15
+ ._sizeL_1t494nu_14{
16
16
  --_rs-dropdown-menu-min-width:316px;
17
17
  --_rs-dropdown-menu-max-width:494px;
18
18
  }
19
- ._sizeL_8gpi6g_14 [data-rs-internal='dropdown-menu__menu-wrapper']{
19
+ ._sizeL_1t494nu_14 [data-rs-internal='dropdown-menu__menu-wrapper']{
20
20
  --_rs-dropdown-menu-item-height:52px;
21
21
  }
22
- ._dropdownMenu_8gpi6g_18{
22
+ ._dropdownMenu_1t494nu_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_8gpi6g_23{
26
+ ._menu_1t494nu_23{
27
27
  margin:0;
28
28
  padding:0;
29
29
 
@@ -2,5 +2,10 @@ import React from 'react';
2
2
  export type MenuWrapperProps = {
3
3
  children?: React.ReactNode;
4
4
  onHeightUpdate?: (newHeight: number) => void;
5
+ el: HTMLDivElement | null;
6
+ setEl: (el: HTMLDivElement | null) => void;
7
+ };
8
+ export declare const MenuWrapper: {
9
+ ({ children, onHeightUpdate, setEl, el }: MenuWrapperProps): React.JSX.Element;
10
+ displayName: string;
5
11
  };
6
- export declare const MenuWrapper: React.ForwardRefExoticComponent<MenuWrapperProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,15 +1,19 @@
1
1
  import React from 'react';
2
2
  import { useResizeObserver } from '@rescui/use-resize-observer';
3
- const MenuWrapper = /*#__PURE__*/React.forwardRef((_ref, ref) => {
3
+
4
+ const MenuWrapper = _ref => {
4
5
  let {
5
6
  children,
6
- onHeightUpdate
7
+ onHeightUpdate,
8
+ setEl,
9
+ el
7
10
  } = _ref;
8
- useResizeObserver(ref, entry => onHeightUpdate(entry.target.offsetHeight));
11
+ useResizeObserver(el, entry => onHeightUpdate(entry.target.offsetHeight));
9
12
  return /*#__PURE__*/React.createElement("div", {
10
- ref: ref,
13
+ ref: setEl,
11
14
  "data-rs-internal": 'dropdown-menu__menu-wrapper'
12
15
  }, children);
13
- });
16
+ };
17
+
14
18
  MenuWrapper.displayName = 'MenuWrapper';
15
19
  export { MenuWrapper };
@@ -295,24 +295,24 @@ render(<Demo />);
295
295
 
296
296
  ##### Demo
297
297
 
298
- Instead of separate classes, it may be a single class with `@media` queries inside:
298
+ Use the controls to see the effect at different viewport widths.
299
299
 
300
300
  ```tsx
301
301
  import { useState } from 'react';
302
302
  import { DropdownMenu, MenuItem } from '@rescui/dropdown-menu';
303
303
  import { Button } from '@rescui/button';
304
304
 
305
- const MyDropdownMenu = ({ className }) => {
305
+ const MyDropdownMenu = () => {
306
306
  const [isOpen, setIsOpen] = useState(false);
307
307
 
308
308
  const toggleIsOpen = () => setIsOpen(s => !s);
309
309
  return (
310
- <div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)' }}>
310
+ <div style={{ height: 350 }}>
311
311
  <DropdownMenu
312
312
  isOpen={isOpen}
313
313
  onRequestClose={() => setIsOpen(false)}
314
314
  trigger={<Button onClick={toggleIsOpen}>Open Menu</Button>}
315
- className={className}
315
+ className="my-dropdown-menu"
316
316
  >
317
317
  <MenuItem>Some text 1</MenuItem>
318
318
  <MenuItem>Some text 2</MenuItem>
@@ -327,33 +327,18 @@ const MyDropdownMenu = ({ className }) => {
327
327
  );
328
328
  };
329
329
 
330
- render(
331
- <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
332
- <div>
333
- <p>Default:</p>
334
- <MyDropdownMenu />
335
- </div>
336
- <div>
337
- <p>Var1:</p>
338
- <MyDropdownMenu className={`my-dropdown-menu-var-1`} />
339
- </div>
340
- <div>
341
- <p>Var1 & Var2 combined:</p>
342
- <MyDropdownMenu
343
- className={`my-dropdown-menu-var-1 my-dropdown-menu-var-2`}
344
- />
345
- </div>
346
- </div>
347
- );
330
+ render(<MyDropdownMenu />);
348
331
  ```
349
332
 
350
333
  ```postcss
351
334
  @import '@rescui/dropdown-menu/lib/public-api.p.css';
352
335
 
353
- .my-dropdown-menu-var-1 {
354
- @mixin rs-dropdown-menu-size-l;
355
- }
356
- .my-dropdown-menu-var-2 {
357
- @mixin rs-dropdown-menu-size-s;
336
+ .my-dropdown-menu {
337
+ @media (max-width: 640px) {
338
+ @mixin rs-dropdown-menu-size-l;
339
+ }
340
+ @media (max-width: 500px) {
341
+ @mixin rs-dropdown-menu-size-s;
342
+ }
358
343
  }
359
344
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescui/dropdown-menu",
3
- "version": "0.11.17",
3
+ "version": "0.11.19-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.10+dbbefd7b8",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
@@ -17,27 +17,27 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/runtime-corejs3": "^7.26.0",
20
- "@rescui/dropdown": "^0.10.3",
21
- "@rescui/menu": "^0.13.7",
22
- "@rescui/use-resize-observer": "^0.3.2",
20
+ "@rescui/dropdown": "0.11.1-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.10+dbbefd7b8",
21
+ "@rescui/menu": "0.13.8-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.14+dbbefd7b8",
22
+ "@rescui/use-resize-observer": "0.3.4-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.10+dbbefd7b8",
23
23
  "classnames": "^2.2.6"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@rescui/ui-contexts": "^0.6.0",
27
27
  "prop-types": "^15",
28
- "react": ">=16.8.0 <20"
28
+ "react": ">=17.0.0 <20"
29
29
  },
30
30
  "devDependencies": {
31
- "@rescui/colors": "^0.3.2",
32
- "@rescui/icons": "^1.8.2",
33
- "@rescui/scripts": "^0.5.2",
34
- "@rescui/typography": "^0.27.2",
35
- "@rescui/visual-regression": "^0.1.4"
31
+ "@rescui/colors": "0.3.3-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.14+dbbefd7b8",
32
+ "@rescui/icons": "1.8.3-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.14+dbbefd7b8",
33
+ "@rescui/scripts": "0.5.2",
34
+ "@rescui/typography": "0.27.3-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.14+dbbefd7b8",
35
+ "@rescui/visual-regression": "0.1.4"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "rescui-scripts build && yarn run build-pcss-api",
39
39
  "build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
40
40
  },
41
41
  "nx": {},
42
- "gitHead": "d60e4f3491c7cdb9ef684d08940869914492a61b"
42
+ "gitHead": "dbbefd7b8e24da18262edf3baffa35039ae01af3"
43
43
  }