@rescui/select 0.15.1-RUI-280-Update-select-component-downshift-2f40ef205.67 → 0.15.2-RUI-291-Update-next-js-to-the-latest-version-8f54dec0a.66
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/common-prop-types.d.ts +29 -30
- package/lib/constants.d.ts +6 -6
- package/lib/hooks/use-a11y.d.ts +30 -29
- package/lib/hooks/use-a11y.js +10 -7
- package/lib/hooks/use-actual-size-from-css.d.ts +10 -0
- package/lib/hooks/use-actual-size-from-css.js +27 -0
- package/lib/hooks/use-focus.d.ts +10 -10
- package/lib/hooks/use-hover.d.ts +10 -10
- package/lib/hooks/use-label-focus.d.ts +9 -9
- package/lib/hooks/use-multi-handlers.d.ts +11 -11
- package/lib/hooks/use-multi-handlers.js +6 -10
- package/lib/hooks/use-options.d.ts +13 -13
- package/lib/hooks/use-options.js +7 -6
- package/lib/hooks/use-primary-contrast-css-var-transfer.d.ts +11 -0
- package/lib/hooks/use-primary-contrast-css-var-transfer.js +29 -0
- package/lib/hooks/use-safe-id.d.ts +6 -0
- package/lib/hooks/use-safe-id.js +15 -0
- package/lib/index.css +965 -932
- package/lib/index.d.ts +4 -4
- package/lib/multiselect.d.ts +3 -3
- package/lib/multiselect.js +34 -37
- package/lib/native-select.d.ts +4 -4
- package/lib/native-select.js +10 -13
- package/lib/parts/foldable.d.ts +34 -33
- package/lib/parts/form-trigger-wrapper.d.ts +34 -34
- package/lib/parts/hidden-select.d.ts +13 -13
- package/lib/parts/icons.d.ts +17 -17
- package/lib/parts/list-box.d.ts +13 -11
- package/lib/parts/list-box.js +12 -8
- package/lib/parts/multi-trigger.d.ts +12 -12
- package/lib/parts/multi-trigger.js +2 -6
- package/lib/parts/native-select-options-with-groups.d.ts +8 -8
- package/lib/parts/popup-content.d.ts +20 -0
- package/lib/parts/popup-content.js +68 -0
- package/lib/select-basic.d.ts +3 -3
- package/lib/select-basic.js +25 -24
- package/lib/select-searchable.d.ts +3 -3
- package/lib/select-searchable.js +22 -27
- package/lib/select.d.ts +28 -28
- package/lib/styles/common.p.module.css.js +29 -28
- package/lib/styles/form-trigger.p.module.css.js +12 -12
- package/lib/styles/list-box.p.module.css.js +13 -11
- package/lib/types.d.ts +202 -197
- package/lib/utils/calculate-max-height-by-items.d.ts +13 -13
- package/lib/utils/calculate-max-height-by-items.js +11 -11
- package/lib/utils/get-empty-message.d.ts +6 -6
- package/lib/utils/get-option-value.d.ts +2 -2
- package/lib/utils/get-real-items-cnt.d.ts +2 -2
- package/lib/utils/get-text-from-nodes.d.ts +2 -2
- package/lib/utils/get-text-from-nodes.js +1 -3
- package/lib/utils/is-option-a-group.d.ts +2 -2
- package/lib/utils/item-to-string.d.ts +2 -2
- package/lib/utils/merge-props.d.ts +19 -29
- package/lib/utils/merge-props.js +70 -72
- package/lib/utils/throttle.d.ts +1 -1
- package/package.json +8 -8
- package/lib/hooks/use-backward-compatible-id.d.ts +0 -4
- package/lib/hooks/use-backward-compatible-id.js +0 -14
package/lib/utils/merge-props.js
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Assigns a value to a single ref — handles callback refs, object refs, null, and undefined.
|
|
4
|
+
* Returns the cleanup function if the callback ref returned one.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
function assignRef(ref, value) {
|
|
8
|
+
if (ref == null) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
3
11
|
|
|
4
|
-
function setRef(ref, value) {
|
|
5
12
|
if (typeof ref === 'function') {
|
|
6
13
|
return ref(value);
|
|
7
|
-
} else if (ref !== null) {
|
|
8
|
-
ref.current = value;
|
|
9
14
|
}
|
|
15
|
+
|
|
16
|
+
ref.current = value;
|
|
10
17
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Merges multiple refs into
|
|
18
|
+
/**
|
|
19
|
+
* Merges multiple refs into a single callback ref.
|
|
20
|
+
* All provided refs are assigned in left-to-right order.
|
|
21
|
+
* Cleanup functions returned by callback refs are called on detach.
|
|
13
22
|
*/
|
|
14
23
|
|
|
15
24
|
|
|
@@ -18,89 +27,78 @@ function mergeRefs() {
|
|
|
18
27
|
refs[_key] = arguments[_key];
|
|
19
28
|
}
|
|
20
29
|
|
|
21
|
-
if (refs.length === 1 && refs[0]) {
|
|
22
|
-
return refs[0];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
30
|
return value => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
setRef(refs[i], null);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
};
|
|
31
|
+
const cleanups = refs.map(ref => assignRef(ref, value)); // return a combined cleanup only if at least one callback ref provided one.
|
|
32
|
+
// when React uses the cleanup API it will NOT call our merged ref with null on unmount,
|
|
33
|
+
// so we must manually null-out every ref that had no cleanup of its own.
|
|
34
|
+
|
|
35
|
+
if (cleanups.some(Boolean)) {
|
|
36
|
+
return () => cleanups.forEach((cleanup, i) => {
|
|
37
|
+
if (typeof cleanup === 'function') {
|
|
38
|
+
cleanup();
|
|
39
|
+
} else {
|
|
40
|
+
// simulate the ref(null) call that React skips when a cleanup is returned
|
|
41
|
+
assignRef(refs[i], null);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
function pushProp(target, key, value) {
|
|
49
|
+
if (key === 'ref') {
|
|
50
|
+
target.ref = target.ref ? mergeRefs(target.ref, value) : value;
|
|
51
|
+
} else if (key === 'className') {
|
|
52
|
+
target.className = cn(target.className, value);
|
|
53
|
+
} else if (key === 'style') {
|
|
54
|
+
target.style = { ...target.style,
|
|
55
|
+
...value
|
|
56
|
+
};
|
|
57
|
+
} else if (typeof value === 'function') {
|
|
58
|
+
const oldFn = target[key];
|
|
59
|
+
target[key] = oldFn ? function () {
|
|
60
|
+
oldFn(...arguments);
|
|
61
|
+
value(...arguments);
|
|
62
|
+
} : value;
|
|
63
|
+
} else if (!(key in target) || value !== undefined) {
|
|
64
|
+
// for any other duplicate prop, the value from the later object takes precedence;
|
|
65
|
+
// undefined is ignored on duplicated so it cannot erase an existing value
|
|
66
|
+
target[key] = value;
|
|
50
67
|
}
|
|
51
|
-
|
|
52
|
-
return function () {
|
|
53
|
-
for (const callback of callbacks) {
|
|
54
|
-
if (typeof callback === 'function') {
|
|
55
|
-
callback(...arguments);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
68
|
}
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
69
|
+
/**
|
|
70
|
+
* Combines multiple sets of props into a single object:
|
|
71
|
+
* - conflicting `className` values are joined with a space
|
|
72
|
+
* - conflicting `style` objects are shallow-merged (rightmost wins on conflict)
|
|
73
|
+
* - conflicting function props (event handlers) are composed and called left to right
|
|
74
|
+
* - conflicting `ref` props (object refs, callback refs, or null) are merged into a single
|
|
75
|
+
* callback ref that assigns all of them; cleanup functions returned by callback refs are
|
|
76
|
+
* collected and called together on detach
|
|
77
|
+
* - any other conflicting prop is resolved by taking the value from the rightmost props object
|
|
78
|
+
* @param props One or more props objects to merge. Props further to the right take precedence.
|
|
65
79
|
*/
|
|
66
|
-
// eslint-disable-next-line complexity
|
|
67
80
|
|
|
68
81
|
|
|
69
82
|
function mergeProps() {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
83
|
+
for (var _len2 = arguments.length, props = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
84
|
+
props[_key2] = arguments[_key2];
|
|
85
|
+
}
|
|
74
86
|
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
if (props.length === 1) {
|
|
88
|
+
return props[0];
|
|
89
|
+
}
|
|
77
90
|
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
return props.reduce((merged, ps) => {
|
|
92
|
+
for (const key in ps) {
|
|
93
|
+
if (!ps.hasOwnProperty(key)) {
|
|
80
94
|
continue;
|
|
81
95
|
}
|
|
82
96
|
|
|
83
|
-
|
|
84
|
-
const b = props[key]; // Chain events
|
|
85
|
-
|
|
86
|
-
if (typeof a === 'function' && typeof b === 'function' && // This is a lot faster than a regex.
|
|
87
|
-
key[0] === 'o' && key[1] === 'n' && key.charCodeAt(2) >=
|
|
88
|
-
/* 'A' */
|
|
89
|
-
65 && key.charCodeAt(2) <=
|
|
90
|
-
/* 'Z' */
|
|
91
|
-
90) {
|
|
92
|
-
result[key] = chain(a, b); // Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check
|
|
93
|
-
} else if (key === 'className' && typeof a === 'string' && typeof b === 'string') {
|
|
94
|
-
result[key] = cn(a, b);
|
|
95
|
-
} else if (key === 'ref' && a && b) {
|
|
96
|
-
result.ref = mergeRefs(a, b); // Override others
|
|
97
|
-
} else {
|
|
98
|
-
result[key] = b !== undefined ? b : a;
|
|
99
|
-
}
|
|
97
|
+
pushProp(merged, key, ps[key]);
|
|
100
98
|
}
|
|
101
|
-
}
|
|
102
99
|
|
|
103
|
-
|
|
100
|
+
return merged;
|
|
101
|
+
}, {});
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
export {
|
|
104
|
+
export { mergeProps };
|
package/lib/utils/throttle.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function throttle<A extends unknown[], R>(func: (...args: A) => R, wait: number): (...args: A) => R;
|
|
1
|
+
export declare function throttle<A extends unknown[], R>(func: (...args: A) => R, wait: number): (...args: A) => R;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/select",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2-RUI-291-Update-next-js-to-the-latest-version-8f54dec0a.66+8f54dec0a",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime-corejs3": "^7.26.0",
|
|
19
|
-
"@rescui/dropdown": "0.9.
|
|
20
|
-
"@rescui/form-field": "0.1.
|
|
21
|
-
"@rescui/tag": "0.13.
|
|
22
|
-
"@rescui/use-resize-observer": "0.3.1-RUI-
|
|
19
|
+
"@rescui/dropdown": "0.9.6-RUI-291-Update-next-js-to-the-latest-version-8f54dec0a.66+8f54dec0a",
|
|
20
|
+
"@rescui/form-field": "0.1.2-RUI-291-Update-next-js-to-the-latest-version-8f54dec0a.66+8f54dec0a",
|
|
21
|
+
"@rescui/tag": "0.13.6-RUI-291-Update-next-js-to-the-latest-version-8f54dec0a.66+8f54dec0a",
|
|
22
|
+
"@rescui/use-resize-observer": "0.3.1-RUI-291-Update-next-js-to-the-latest-version-8f54dec0a.191+8f54dec0a",
|
|
23
23
|
"classnames": "^2.2.6",
|
|
24
24
|
"downshift": "^9.3.2",
|
|
25
25
|
"scroll-into-view-if-needed": "3.1.0"
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"react": ">=16.8.0 <20"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@rescui/colors": "0.3.1-RUI-
|
|
33
|
+
"@rescui/colors": "0.3.1-RUI-291-Update-next-js-to-the-latest-version-8f54dec0a.79+8f54dec0a",
|
|
34
34
|
"@rescui/scripts": "0.5.1",
|
|
35
|
-
"@rescui/typography": "0.
|
|
35
|
+
"@rescui/typography": "0.25.1-RUI-291-Update-next-js-to-the-latest-version-8f54dec0a.66+8f54dec0a",
|
|
36
36
|
"@rescui/visual-regression": "0.1.4",
|
|
37
37
|
"sniffr": "^1.2.0"
|
|
38
38
|
},
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
|
|
42
42
|
},
|
|
43
43
|
"nx": {},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "8f54dec0a450da30835485cba2edfd0037cccd25"
|
|
45
45
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
2
|
-
|
|
3
|
-
const useBackwardCompatibleId = () => {
|
|
4
|
-
const id = useRef(null);
|
|
5
|
-
|
|
6
|
-
if (id.current === null) {
|
|
7
|
-
id.current = useBackwardCompatibleId.counter++;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return (React.useId ? React.useId : () => id.current)();
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
useBackwardCompatibleId.counter = 0;
|
|
14
|
-
export { useBackwardCompatibleId };
|