@rescui/select 0.18.3 → 0.19.0

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.
Files changed (37) hide show
  1. package/lib/_virtual/check-outline.js +294 -63
  2. package/lib/_virtual/close-outline.js +294 -63
  3. package/lib/_virtual/down-outline.js +294 -63
  4. package/lib/_virtual/index.css.js +12 -12
  5. package/lib/_virtual/loading-outline.js +310 -79
  6. package/lib/hooks/use-a11y.d.ts +2 -2
  7. package/lib/hooks/use-a11y.js +124 -36
  8. package/lib/hooks/use-actual-size-from-css.d.ts +3 -4
  9. package/lib/hooks/use-actual-size-from-css.js +47 -18
  10. package/lib/hooks/use-focus.js +54 -10
  11. package/lib/hooks/use-hover.js +54 -10
  12. package/lib/hooks/use-label-focus.js +45 -15
  13. package/lib/hooks/use-multi-handlers.js +113 -38
  14. package/lib/hooks/use-options.d.ts +2 -1
  15. package/lib/hooks/use-options.js +92 -56
  16. package/lib/hooks/use-primary-contrast-css-var-transfer.d.ts +2 -3
  17. package/lib/hooks/use-primary-contrast-css-var-transfer.js +45 -15
  18. package/lib/index.css +195 -196
  19. package/lib/multiselect.js +527 -174
  20. package/lib/native-select.js +416 -118
  21. package/lib/parts/form-trigger-wrapper.js +159 -39
  22. package/lib/parts/hidden-select.js +105 -29
  23. package/lib/parts/icons.js +191 -49
  24. package/lib/parts/list-box.js +277 -74
  25. package/lib/parts/multi-trigger.d.ts +2 -2
  26. package/lib/parts/multi-trigger.js +125 -48
  27. package/lib/parts/native-select-options-with-groups.js +154 -52
  28. package/lib/parts/popup-content.d.ts +3 -3
  29. package/lib/parts/popup-content.js +146 -46
  30. package/lib/select-basic.js +456 -147
  31. package/lib/select-searchable.js +448 -155
  32. package/lib/select.js +228 -56
  33. package/lib/styles/common.p.module.css.js +29 -29
  34. package/lib/styles/form-trigger.p.module.css.js +12 -12
  35. package/lib/styles/list-box.p.module.css.js +13 -13
  36. package/lib/utils/get-text-from-nodes.js +1 -1
  37. package/package.json +12 -11
@@ -1,4 +1,5 @@
1
1
  import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
2
+ import { c } from 'react-compiler-runtime';
2
3
  import React from 'react';
3
4
  import PropTypes from 'prop-types';
4
5
  import cn from 'classnames';
@@ -15,85 +16,315 @@ const Size = {
15
16
  "m": "m",
16
17
  "l": "l"
17
18
  };
18
- const DownOutlineIcon16 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
19
- viewBox: "0 0 16 16"
20
- }, props, {
21
- ref: ref
22
- }), /*#__PURE__*/React.createElement("path", {
23
- d: "M11.354 6.146a.5.5 0 0 0-.708 0L8 8.793 5.354 6.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0 0-.708"
24
- })));
19
+ const DownOutlineIcon16 = /*#__PURE__*/React.forwardRef((props, ref) => {
20
+ const $ = c(4);
21
+ let t0;
22
+
23
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24
+ t0 = /*#__PURE__*/React.createElement("path", {
25
+ d: "M11.354 6.146a.5.5 0 0 0-.708 0L8 8.793 5.354 6.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0 0-.708"
26
+ });
27
+ $[0] = t0;
28
+ } else {
29
+ t0 = $[0];
30
+ }
31
+
32
+ let t1;
33
+
34
+ if ($[1] !== props || $[2] !== ref) {
35
+ t1 = /*#__PURE__*/React.createElement("svg", _extends({
36
+ viewBox: "0 0 16 16"
37
+ }, props, {
38
+ ref: ref
39
+ }), t0);
40
+ $[1] = props;
41
+ $[2] = ref;
42
+ $[3] = t1;
43
+ } else {
44
+ t1 = $[3];
45
+ }
46
+
47
+ return t1;
48
+ });
25
49
  DownOutlineIcon16.displayName = 'DownOutlineIcon16';
26
- const DownOutlineIcon20 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
27
- viewBox: "0 0 20 20"
28
- }, props, {
29
- ref: ref
30
- }), /*#__PURE__*/React.createElement("path", {
31
- d: "M14.53 7.47a.75.75 0 0 0-1.06 0L10 10.94 6.53 7.47a.75.75 0 0 0-1.06 1.06l4 4a.75.75 0 0 0 1.06 0l4-4a.75.75 0 0 0 0-1.06"
32
- })));
50
+ const DownOutlineIcon20 = /*#__PURE__*/React.forwardRef((props, ref) => {
51
+ const $ = c(4);
52
+ let t0;
53
+
54
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
55
+ t0 = /*#__PURE__*/React.createElement("path", {
56
+ d: "M14.53 7.47a.75.75 0 0 0-1.06 0L10 10.94 6.53 7.47a.75.75 0 0 0-1.06 1.06l4 4a.75.75 0 0 0 1.06 0l4-4a.75.75 0 0 0 0-1.06"
57
+ });
58
+ $[0] = t0;
59
+ } else {
60
+ t0 = $[0];
61
+ }
62
+
63
+ let t1;
64
+
65
+ if ($[1] !== props || $[2] !== ref) {
66
+ t1 = /*#__PURE__*/React.createElement("svg", _extends({
67
+ viewBox: "0 0 20 20"
68
+ }, props, {
69
+ ref: ref
70
+ }), t0);
71
+ $[1] = props;
72
+ $[2] = ref;
73
+ $[3] = t1;
74
+ } else {
75
+ t1 = $[3];
76
+ }
77
+
78
+ return t1;
79
+ });
33
80
  DownOutlineIcon20.displayName = 'DownOutlineIcon20';
34
- const DownOutlineIcon24 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
35
- viewBox: "0 0 24 24"
36
- }, props, {
37
- ref: ref
38
- }), /*#__PURE__*/React.createElement("path", {
39
- d: "M18.707 8.293a1 1 0 0 0-1.414 0L12 13.586 6.707 8.293a1 1 0 0 0-1.414 1.414l6 6a1 1 0 0 0 1.414 0l6-6a1 1 0 0 0 0-1.414"
40
- })));
81
+ const DownOutlineIcon24 = /*#__PURE__*/React.forwardRef((props, ref) => {
82
+ const $ = c(4);
83
+ let t0;
84
+
85
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
86
+ t0 = /*#__PURE__*/React.createElement("path", {
87
+ d: "M18.707 8.293a1 1 0 0 0-1.414 0L12 13.586 6.707 8.293a1 1 0 0 0-1.414 1.414l6 6a1 1 0 0 0 1.414 0l6-6a1 1 0 0 0 0-1.414"
88
+ });
89
+ $[0] = t0;
90
+ } else {
91
+ t0 = $[0];
92
+ }
93
+
94
+ let t1;
95
+
96
+ if ($[1] !== props || $[2] !== ref) {
97
+ t1 = /*#__PURE__*/React.createElement("svg", _extends({
98
+ viewBox: "0 0 24 24"
99
+ }, props, {
100
+ ref: ref
101
+ }), t0);
102
+ $[1] = props;
103
+ $[2] = ref;
104
+ $[3] = t1;
105
+ } else {
106
+ t1 = $[3];
107
+ }
108
+
109
+ return t1;
110
+ });
41
111
  DownOutlineIcon24.displayName = 'DownOutlineIcon24';
42
- const DownOutlineIcon28 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
43
- viewBox: "0 0 28 28"
44
- }, props, {
45
- ref: ref
46
- }), /*#__PURE__*/React.createElement("path", {
47
- d: "M21.707 9.793a1 1 0 0 0-1.414 0L14 16.086 7.707 9.793a1 1 0 0 0-1.414 1.414l7 7a1 1 0 0 0 1.414 0l7-7a1 1 0 0 0 0-1.414"
48
- })));
112
+ const DownOutlineIcon28 = /*#__PURE__*/React.forwardRef((props, ref) => {
113
+ const $ = c(4);
114
+ let t0;
115
+
116
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
117
+ t0 = /*#__PURE__*/React.createElement("path", {
118
+ d: "M21.707 9.793a1 1 0 0 0-1.414 0L14 16.086 7.707 9.793a1 1 0 0 0-1.414 1.414l7 7a1 1 0 0 0 1.414 0l7-7a1 1 0 0 0 0-1.414"
119
+ });
120
+ $[0] = t0;
121
+ } else {
122
+ t0 = $[0];
123
+ }
124
+
125
+ let t1;
126
+
127
+ if ($[1] !== props || $[2] !== ref) {
128
+ t1 = /*#__PURE__*/React.createElement("svg", _extends({
129
+ viewBox: "0 0 28 28"
130
+ }, props, {
131
+ ref: ref
132
+ }), t0);
133
+ $[1] = props;
134
+ $[2] = ref;
135
+ $[3] = t1;
136
+ } else {
137
+ t1 = $[3];
138
+ }
139
+
140
+ return t1;
141
+ });
49
142
  DownOutlineIcon28.displayName = 'DownOutlineIcon28';
50
- const DownOutlineIcon = /*#__PURE__*/React.forwardRef((_ref, ref) => {
51
- let {
52
- theme,
53
- size: sizeFromProps = "m",
54
- className,
55
- style,
56
- ['data-render-all-sizes']: renderAllSizes = false,
57
- ...props
58
- } = _ref;
143
+ const DownOutlineIcon = /*#__PURE__*/React.forwardRef((t0, ref) => {
144
+ const $ = c(34);
145
+ let className;
146
+ let props;
147
+ let style;
148
+ let t1;
149
+ let t2;
150
+ let theme;
151
+
152
+ if ($[0] !== t0) {
153
+ ({
154
+ theme,
155
+ size: t1,
156
+ className,
157
+ style,
158
+ "data-render-all-sizes": t2,
159
+ ...props
160
+ } = t0);
161
+ $[0] = t0;
162
+ $[1] = className;
163
+ $[2] = props;
164
+ $[3] = style;
165
+ $[4] = t1;
166
+ $[5] = t2;
167
+ $[6] = theme;
168
+ } else {
169
+ className = $[1];
170
+ props = $[2];
171
+ style = $[3];
172
+ t1 = $[4];
173
+ t2 = $[5];
174
+ theme = $[6];
175
+ }
176
+
177
+ const sizeFromProps = t1 === undefined ? "m" : t1;
178
+ const renderAllSizes = t2 === undefined ? false : t2;
59
179
  const size = sizeFromProps in Size ? sizeFromProps : "m";
60
- const mainProps = { ...props,
61
- className: cn(styles.icon, styles[theme], sizeStyles[size], renderAllSizes && styles.allVariants, className),
62
- style: renderAllSizes ? {
63
- '--rs-icon-ar-width': 28,
64
- '--rs-icon-ar-height': 28,
180
+ const t3 = styles[theme];
181
+ const t4 = sizeStyles[size];
182
+ const t5 = renderAllSizes && styles.allVariants;
183
+ let t6;
184
+
185
+ if ($[7] !== className || $[8] !== t3 || $[9] !== t4 || $[10] !== t5) {
186
+ t6 = cn(styles.icon, t3, t4, t5, className);
187
+ $[7] = className;
188
+ $[8] = t3;
189
+ $[9] = t4;
190
+ $[10] = t5;
191
+ $[11] = t6;
192
+ } else {
193
+ t6 = $[11];
194
+ }
195
+
196
+ let t7;
197
+
198
+ if ($[12] !== renderAllSizes || $[13] !== style) {
199
+ t7 = renderAllSizes ? {
200
+ "--rs-icon-ar-width": 28,
201
+ "--rs-icon-ar-height": 28,
65
202
  ...style
66
- } : style,
67
- ref
68
- };
203
+ } : style;
204
+ $[12] = renderAllSizes;
205
+ $[13] = style;
206
+ $[14] = t7;
207
+ } else {
208
+ t7 = $[14];
209
+ }
210
+
211
+ let t8;
212
+
213
+ if ($[15] !== props || $[16] !== ref || $[17] !== t6 || $[18] !== t7) {
214
+ t8 = { ...props,
215
+ className: t6,
216
+ style: t7,
217
+ ref
218
+ };
219
+ $[15] = props;
220
+ $[16] = ref;
221
+ $[17] = t6;
222
+ $[18] = t7;
223
+ $[19] = t8;
224
+ } else {
225
+ t8 = $[19];
226
+ }
227
+
228
+ const mainProps = t8;
69
229
 
70
230
  if (renderAllSizes) {
71
- return /*#__PURE__*/React.createElement("svg", _extends({
72
- viewBox: "0 0 28 28"
73
- }, mainProps), /*#__PURE__*/React.createElement(DownOutlineIcon16, {
74
- className: styles.variant16
75
- }), /*#__PURE__*/React.createElement(DownOutlineIcon20, {
76
- className: styles.variant20
77
- }), /*#__PURE__*/React.createElement(DownOutlineIcon24, {
78
- className: styles.variant24
79
- }), /*#__PURE__*/React.createElement(DownOutlineIcon28, {
80
- className: styles.variant28
81
- }));
231
+ let t10;
232
+ let t11;
233
+ let t12;
234
+ let t9;
235
+
236
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
237
+ t9 = /*#__PURE__*/React.createElement(DownOutlineIcon16, {
238
+ className: styles.variant16
239
+ });
240
+ t10 = /*#__PURE__*/React.createElement(DownOutlineIcon20, {
241
+ className: styles.variant20
242
+ });
243
+ t11 = /*#__PURE__*/React.createElement(DownOutlineIcon24, {
244
+ className: styles.variant24
245
+ });
246
+ t12 = /*#__PURE__*/React.createElement(DownOutlineIcon28, {
247
+ className: styles.variant28
248
+ });
249
+ $[20] = t10;
250
+ $[21] = t11;
251
+ $[22] = t12;
252
+ $[23] = t9;
253
+ } else {
254
+ t10 = $[20];
255
+ t11 = $[21];
256
+ t12 = $[22];
257
+ t9 = $[23];
258
+ }
259
+
260
+ let t13;
261
+
262
+ if ($[24] !== mainProps) {
263
+ t13 = /*#__PURE__*/React.createElement("svg", _extends({
264
+ viewBox: "0 0 28 28"
265
+ }, mainProps), t9, t10, t11, t12);
266
+ $[24] = mainProps;
267
+ $[25] = t13;
268
+ } else {
269
+ t13 = $[25];
270
+ }
271
+
272
+ return t13;
82
273
  }
83
274
 
84
- if (size === Size['xs']) {
85
- return /*#__PURE__*/React.createElement(DownOutlineIcon16, mainProps);
275
+ if (size === Size.xs) {
276
+ let t9;
277
+
278
+ if ($[26] !== mainProps) {
279
+ t9 = /*#__PURE__*/React.createElement(DownOutlineIcon16, mainProps);
280
+ $[26] = mainProps;
281
+ $[27] = t9;
282
+ } else {
283
+ t9 = $[27];
284
+ }
285
+
286
+ return t9;
86
287
  }
87
288
 
88
- if (size === Size['s']) {
89
- return /*#__PURE__*/React.createElement(DownOutlineIcon20, mainProps);
289
+ if (size === Size.s) {
290
+ let t9;
291
+
292
+ if ($[28] !== mainProps) {
293
+ t9 = /*#__PURE__*/React.createElement(DownOutlineIcon20, mainProps);
294
+ $[28] = mainProps;
295
+ $[29] = t9;
296
+ } else {
297
+ t9 = $[29];
298
+ }
299
+
300
+ return t9;
301
+ }
302
+
303
+ if (size === Size.m) {
304
+ let t9;
305
+
306
+ if ($[30] !== mainProps) {
307
+ t9 = /*#__PURE__*/React.createElement(DownOutlineIcon24, mainProps);
308
+ $[30] = mainProps;
309
+ $[31] = t9;
310
+ } else {
311
+ t9 = $[31];
312
+ }
313
+
314
+ return t9;
90
315
  }
91
316
 
92
- if (size === Size['m']) {
93
- return /*#__PURE__*/React.createElement(DownOutlineIcon24, mainProps);
317
+ let t9;
318
+
319
+ if ($[32] !== mainProps) {
320
+ t9 = /*#__PURE__*/React.createElement(DownOutlineIcon28, mainProps);
321
+ $[32] = mainProps;
322
+ $[33] = t9;
323
+ } else {
324
+ t9 = $[33];
94
325
  }
95
326
 
96
- return /*#__PURE__*/React.createElement(DownOutlineIcon28, mainProps);
327
+ return t9;
97
328
  });
98
329
  DownOutlineIcon.displayName = 'DownOutlineIcon';
99
330
  DownOutlineIcon.propTypes = {
@@ -1,15 +1,15 @@
1
1
  var styles = {
2
- "icon": "_icon_kgy1zm_4",
3
- "sizeXS": "_sizeXS_kgy1zm_14",
4
- "sizeS": "_sizeS_kgy1zm_18",
5
- "sizeM": "_sizeM_kgy1zm_22",
6
- "sizeL": "_sizeL_kgy1zm_26",
7
- "light": "_light_kgy1zm_30",
8
- "dark": "_dark_kgy1zm_34",
9
- "allVariants": "_allVariants_kgy1zm_48",
10
- "variant16": "_variant16_kgy1zm_53",
11
- "variant20": "_variant20_kgy1zm_54",
12
- "variant24": "_variant24_kgy1zm_55",
13
- "variant28": "_variant28_kgy1zm_58"
2
+ "icon": "_icon_1ohuzr2_4",
3
+ "sizeXS": "_sizeXS_1ohuzr2_14",
4
+ "sizeS": "_sizeS_1ohuzr2_18",
5
+ "sizeM": "_sizeM_1ohuzr2_22",
6
+ "sizeL": "_sizeL_1ohuzr2_26",
7
+ "light": "_light_1ohuzr2_30",
8
+ "dark": "_dark_1ohuzr2_34",
9
+ "allVariants": "_allVariants_1ohuzr2_48",
10
+ "variant16": "_variant16_1ohuzr2_53",
11
+ "variant20": "_variant20_1ohuzr2_54",
12
+ "variant24": "_variant24_1ohuzr2_55",
13
+ "variant28": "_variant28_1ohuzr2_58"
14
14
  };
15
15
  export { styles as default };