@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.
- package/lib/_virtual/index.css.js +12 -12
- package/lib/hooks/use-actual-size-from-css.js +37 -17
- package/lib/index.css +192 -192
- package/lib/multiselect.js +32 -36
- package/lib/parts/popup-content.d.ts +2 -4
- package/lib/parts/popup-content.js +41 -68
- package/lib/select-basic.js +0 -2
- package/lib/select-searchable.js +0 -2
- package/lib/styles/common.p.module.css.js +1 -1
- package/lib/styles/form-trigger.p.module.css.js +1 -1
- package/lib/styles/list-box.p.module.css.js +1 -1
- package/llm/components/multiselect.md +5 -5
- package/llm/components/select.md +11 -11
- package/package.json +10 -10
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"icon": "
|
|
3
|
-
"sizeXS": "
|
|
4
|
-
"sizeS": "
|
|
5
|
-
"sizeM": "
|
|
6
|
-
"sizeL": "
|
|
7
|
-
"light": "
|
|
8
|
-
"dark": "
|
|
9
|
-
"allVariants": "
|
|
10
|
-
"variant16": "
|
|
11
|
-
"variant20": "
|
|
12
|
-
"variant24": "
|
|
13
|
-
"variant28": "
|
|
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(
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
40
|
+
cancelAnimationFrame(frameRef.current);
|
|
41
|
+
frameRef.current = requestAnimationFrame(() => {
|
|
42
|
+
setSize(sizeFromCss || sizeFromProps);
|
|
43
|
+
});
|
|
24
44
|
};
|
|
25
|
-
$[
|
|
26
|
-
$[
|
|
27
|
-
$[
|
|
45
|
+
$[2] = sizeFromProps;
|
|
46
|
+
$[3] = triggerEl;
|
|
47
|
+
$[4] = t3;
|
|
28
48
|
} else {
|
|
29
|
-
|
|
49
|
+
t3 = $[4];
|
|
30
50
|
}
|
|
31
|
-
useResizeObserver(observableRef,
|
|
32
|
-
let
|
|
33
|
-
if ($[
|
|
34
|
-
|
|
51
|
+
useResizeObserver(observableRef, t3);
|
|
52
|
+
let t4;
|
|
53
|
+
if ($[5] !== size) {
|
|
54
|
+
t4 = {
|
|
35
55
|
observableRef,
|
|
36
56
|
size
|
|
37
57
|
};
|
|
38
|
-
$[
|
|
39
|
-
$[
|
|
58
|
+
$[5] = size;
|
|
59
|
+
$[6] = t4;
|
|
40
60
|
} else {
|
|
41
|
-
|
|
61
|
+
t4 = $[6];
|
|
42
62
|
}
|
|
43
|
-
return
|
|
63
|
+
return t4;
|
|
44
64
|
};
|
|
45
65
|
|
|
46
66
|
export { useActualSizeFromCss };
|