@rescui/select 0.18.4 → 0.19.1
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/check-outline.js +294 -63
- package/lib/_virtual/close-outline.js +294 -63
- package/lib/_virtual/down-outline.js +294 -63
- package/lib/_virtual/index.css.js +12 -12
- package/lib/_virtual/loading-outline.js +310 -79
- package/lib/hooks/use-a11y.d.ts +2 -2
- package/lib/hooks/use-a11y.js +124 -36
- package/lib/hooks/use-actual-size-from-css.d.ts +3 -4
- package/lib/hooks/use-actual-size-from-css.js +47 -18
- package/lib/hooks/use-focus.js +54 -10
- package/lib/hooks/use-hover.js +54 -10
- package/lib/hooks/use-label-focus.js +45 -15
- package/lib/hooks/use-multi-handlers.js +113 -38
- package/lib/hooks/use-options.d.ts +2 -1
- package/lib/hooks/use-options.js +92 -56
- package/lib/hooks/use-primary-contrast-css-var-transfer.d.ts +2 -3
- package/lib/hooks/use-primary-contrast-css-var-transfer.js +45 -15
- package/lib/index.css +194 -194
- package/lib/multiselect.js +527 -174
- package/lib/native-select.js +416 -118
- package/lib/parts/form-trigger-wrapper.js +159 -39
- package/lib/parts/hidden-select.js +105 -29
- package/lib/parts/icons.js +191 -49
- package/lib/parts/list-box.js +277 -74
- package/lib/parts/multi-trigger.d.ts +2 -2
- package/lib/parts/multi-trigger.js +125 -48
- package/lib/parts/native-select-options-with-groups.js +154 -52
- package/lib/parts/popup-content.d.ts +3 -3
- package/lib/parts/popup-content.js +146 -46
- package/lib/select-basic.js +456 -147
- package/lib/select-searchable.js +448 -155
- package/lib/select.js +228 -56
- package/lib/styles/common.p.module.css.js +29 -29
- package/lib/styles/form-trigger.p.module.css.js +12 -12
- package/lib/styles/list-box.p.module.css.js +13 -13
- package/lib/utils/get-text-from-nodes.js +1 -1
- package/package.json +13 -12
|
@@ -1,26 +1,56 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import { useState, useEffect, useLayoutEffect } from 'react';
|
|
2
3
|
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
3
4
|
/**
|
|
4
5
|
* Transfer primary contrast css var to the dropdown, but only when the dropdown opens
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
|
-
const usePrimaryContrastCssVarTransfer =
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const usePrimaryContrastCssVarTransfer = t0 => {
|
|
9
|
+
const $ = c(6);
|
|
10
|
+
const {
|
|
11
|
+
triggerEl,
|
|
10
12
|
isOpen
|
|
11
|
-
} =
|
|
13
|
+
} = t0;
|
|
12
14
|
const [isPrimaryContrast, setIsPrimaryContrast] = useState(false);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
let t1;
|
|
16
|
+
let t2;
|
|
17
|
+
|
|
18
|
+
if ($[0] !== isOpen || $[1] !== triggerEl) {
|
|
19
|
+
t1 = () => {
|
|
20
|
+
const ownerWindow = triggerEl?.ownerDocument.defaultView;
|
|
21
|
+
|
|
22
|
+
if (!isOpen || !ownerWindow) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const isPrimaryContrastFromCss = ownerWindow.getComputedStyle(triggerEl).getPropertyValue("--rs-select-contrast-primary");
|
|
27
|
+
setIsPrimaryContrast(isPrimaryContrastFromCss === "1");
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
t2 = [isOpen, triggerEl];
|
|
31
|
+
$[0] = isOpen;
|
|
32
|
+
$[1] = triggerEl;
|
|
33
|
+
$[2] = t1;
|
|
34
|
+
$[3] = t2;
|
|
35
|
+
} else {
|
|
36
|
+
t1 = $[2];
|
|
37
|
+
t2 = $[3];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
useIsomorphicLayoutEffect(t1, t2);
|
|
41
|
+
let t3;
|
|
42
|
+
|
|
43
|
+
if ($[4] !== isPrimaryContrast) {
|
|
44
|
+
t3 = {
|
|
45
|
+
isPrimaryContrast
|
|
46
|
+
};
|
|
47
|
+
$[4] = isPrimaryContrast;
|
|
48
|
+
$[5] = t3;
|
|
49
|
+
} else {
|
|
50
|
+
t3 = $[5];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return t3;
|
|
24
54
|
};
|
|
25
55
|
|
|
26
56
|
export { usePrimaryContrastCssVarTransfer };
|