@rescui/select 0.22.0 → 0.22.1-floating-ui-migration-ee8cf10db.7.sha-ee8cf10db

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.
@@ -1,16 +1,16 @@
1
1
  var styles = {
2
- "icon": "_icon_16z0qk4_4",
3
- "sizeXS": "_sizeXS_16z0qk4_14",
4
- "sizeS": "_sizeS_16z0qk4_18",
5
- "sizeM": "_sizeM_16z0qk4_22",
6
- "sizeL": "_sizeL_16z0qk4_26",
7
- "light": "_light_16z0qk4_30",
8
- "dark": "_dark_16z0qk4_34",
9
- "allVariants": "_allVariants_16z0qk4_48",
10
- "variant16": "_variant16_16z0qk4_53",
11
- "variant20": "_variant20_16z0qk4_54",
12
- "variant24": "_variant24_16z0qk4_55",
13
- "variant28": "_variant28_16z0qk4_58"
2
+ "icon": "_icon_1jn1uwd_4",
3
+ "sizeXS": "_sizeXS_1jn1uwd_14",
4
+ "sizeS": "_sizeS_1jn1uwd_18",
5
+ "sizeM": "_sizeM_1jn1uwd_22",
6
+ "sizeL": "_sizeL_1jn1uwd_26",
7
+ "light": "_light_1jn1uwd_30",
8
+ "dark": "_dark_1jn1uwd_34",
9
+ "allVariants": "_allVariants_1jn1uwd_48",
10
+ "variant16": "_variant16_1jn1uwd_53",
11
+ "variant20": "_variant20_1jn1uwd_54",
12
+ "variant24": "_variant24_1jn1uwd_55",
13
+ "variant28": "_variant28_1jn1uwd_58"
14
14
  };
15
15
 
16
16
  export { styles as default };
@@ -1,18 +1,35 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import { useRef, useState } from 'react';
2
+ import { useRef, useState, useEffect } from 'react';
3
3
  import { useResizeObserver } from '@rescui/use-resize-observer';
4
4
 
5
5
  const useActualSizeFromCss = t0 => {
6
- const $ = c(5);
6
+ const $ = c(7);
7
7
  const {
8
8
  sizeFromProps,
9
9
  triggerEl
10
10
  } = t0;
11
11
  const observableRef = useRef(null);
12
12
  const [size, setSize] = useState(sizeFromProps);
13
+ const frameRef = useRef(null);
13
14
  let t1;
14
- if ($[0] !== sizeFromProps || $[1] !== triggerEl) {
15
- t1 = () => {
15
+ let t2;
16
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
17
+ t1 = () => () => {
18
+ if (frameRef.current !== null) {
19
+ cancelAnimationFrame(frameRef.current);
20
+ }
21
+ };
22
+ t2 = [];
23
+ $[0] = t1;
24
+ $[1] = t2;
25
+ } else {
26
+ t1 = $[0];
27
+ t2 = $[1];
28
+ }
29
+ useEffect(t1, t2);
30
+ let t3;
31
+ if ($[2] !== sizeFromProps || $[3] !== triggerEl) {
32
+ t3 = () => {
16
33
  const ownerWindow = triggerEl?.ownerDocument.defaultView;
17
34
  if (!ownerWindow) {
18
35
  return;
@@ -20,27 +37,30 @@ const useActualSizeFromCss = t0 => {
20
37
  const triggerFormWrapperStyles = ownerWindow.getComputedStyle(triggerEl);
21
38
  const rawSizeFromCss = triggerFormWrapperStyles.getPropertyValue("--_rs-select-size");
22
39
  const sizeFromCss = ["s", "m", "l"].includes(rawSizeFromCss) ? rawSizeFromCss : null;
23
- setSize(sizeFromCss || sizeFromProps);
40
+ cancelAnimationFrame(frameRef.current);
41
+ frameRef.current = requestAnimationFrame(() => {
42
+ setSize(sizeFromCss || sizeFromProps);
43
+ });
24
44
  };
25
- $[0] = sizeFromProps;
26
- $[1] = triggerEl;
27
- $[2] = t1;
45
+ $[2] = sizeFromProps;
46
+ $[3] = triggerEl;
47
+ $[4] = t3;
28
48
  } else {
29
- t1 = $[2];
49
+ t3 = $[4];
30
50
  }
31
- useResizeObserver(observableRef, t1);
32
- let t2;
33
- if ($[3] !== size) {
34
- t2 = {
51
+ useResizeObserver(observableRef, t3);
52
+ let t4;
53
+ if ($[5] !== size) {
54
+ t4 = {
35
55
  observableRef,
36
56
  size
37
57
  };
38
- $[3] = size;
39
- $[4] = t2;
58
+ $[5] = size;
59
+ $[6] = t4;
40
60
  } else {
41
- t2 = $[4];
61
+ t4 = $[6];
42
62
  }
43
- return t2;
63
+ return t4;
44
64
  };
45
65
 
46
66
  export { useActualSizeFromCss };