@rescui/select 0.18.1-RUI-297-Add-react-compiler-to-the-packages-build-8aaaed4be.39 → 0.18.1-RUI-297-Add-react-compiler-to-the-packages-build-ccd086200.40

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,7 +1,7 @@
1
1
  "use client";
2
2
  import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
3
3
  import { c } from 'react-compiler-runtime';
4
- import React from 'react';
4
+ import React, { useState } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import cn from 'classnames';
7
7
  import { useThemeWithUndefined } from '@rescui/ui-contexts';
@@ -49,7 +49,7 @@ const THEME_STYLES = {
49
49
  }; // eslint-disable-next-line complexity
50
50
 
51
51
  const NativeSelect = t0 => {
52
- const $ = c(102);
52
+ const $ = c(104);
53
53
  let error;
54
54
  let id;
55
55
  let label;
@@ -160,25 +160,26 @@ const NativeSelect = t0 => {
160
160
  const isClearable = t6 === undefined ? false : t6;
161
161
  const reserveErrorLine = t7 === undefined ? false : t7;
162
162
  const boldLabel = t8 === undefined ? true : t8;
163
- const triggerRef = React.useRef(null);
163
+ const [triggerEl, setTriggerEl] = useState(null);
164
164
  let t10;
165
165
 
166
- if ($[24] !== error || $[25] !== isDisabled || $[26] !== label || $[27] !== note) {
166
+ if ($[24] !== error || $[25] !== isDisabled || $[26] !== label || $[27] !== note || $[28] !== triggerEl) {
167
167
  t10 = {
168
168
  prefix: "native-select",
169
169
  error,
170
170
  description: note,
171
171
  label,
172
- fieldRef: triggerRef,
172
+ fieldEl: triggerEl,
173
173
  isDisabled
174
174
  };
175
175
  $[24] = error;
176
176
  $[25] = isDisabled;
177
177
  $[26] = label;
178
178
  $[27] = note;
179
- $[28] = t10;
179
+ $[28] = triggerEl;
180
+ $[29] = t10;
180
181
  } else {
181
- t10 = $[28];
182
+ t10 = $[29];
182
183
  }
183
184
 
184
185
  const {
@@ -189,20 +190,20 @@ const NativeSelect = t0 => {
189
190
  } = useA11y(t10);
190
191
  let t11;
191
192
 
192
- if ($[29] !== onChange) {
193
+ if ($[30] !== onChange) {
193
194
  t11 = () => onChange(null);
194
195
 
195
- $[29] = onChange;
196
- $[30] = t11;
196
+ $[30] = onChange;
197
+ $[31] = t11;
197
198
  } else {
198
- t11 = $[30];
199
+ t11 = $[31];
199
200
  }
200
201
 
201
202
  const reset = t11;
202
203
  const theme = useThemeWithUndefined(themeFromProps);
203
204
  let t12;
204
205
 
205
- if ($[31] !== onChange || $[32] !== options) {
206
+ if ($[32] !== onChange || $[33] !== options) {
206
207
  t12 = event => {
207
208
  const newValue = event.target.value;
208
209
  const selectedOption = findSelectedOption(options, newValue);
@@ -212,24 +213,24 @@ const NativeSelect = t0 => {
212
213
  }
213
214
  };
214
215
 
215
- $[31] = onChange;
216
- $[32] = options;
217
- $[33] = t12;
216
+ $[32] = onChange;
217
+ $[33] = options;
218
+ $[34] = t12;
218
219
  } else {
219
- t12 = $[33];
220
+ t12 = $[34];
220
221
  }
221
222
 
222
223
  const handleChange = t12;
223
224
  let t13;
224
225
 
225
- if ($[34] !== isDisabled) {
226
+ if ($[35] !== isDisabled) {
226
227
  t13 = {
227
228
  isDisabled
228
229
  };
229
- $[34] = isDisabled;
230
- $[35] = t13;
230
+ $[35] = isDisabled;
231
+ $[36] = t13;
231
232
  } else {
232
- t13 = $[35];
233
+ t13 = $[36];
233
234
  }
234
235
 
235
236
  const {
@@ -238,14 +239,14 @@ const NativeSelect = t0 => {
238
239
  } = useFocus(t13);
239
240
  let t14;
240
241
 
241
- if ($[36] !== isDisabled) {
242
+ if ($[37] !== isDisabled) {
242
243
  t14 = {
243
244
  isDisabled
244
245
  };
245
- $[36] = isDisabled;
246
- $[37] = t14;
246
+ $[37] = isDisabled;
247
+ $[38] = t14;
247
248
  } else {
248
- t14 = $[37];
249
+ t14 = $[38];
249
250
  }
250
251
 
251
252
  const {
@@ -254,17 +255,17 @@ const NativeSelect = t0 => {
254
255
  } = useHover(t14);
255
256
  let t15;
256
257
 
257
- if ($[38] !== isLoading || $[39] !== noOptionsMessage) {
258
+ if ($[39] !== isLoading || $[40] !== noOptionsMessage) {
258
259
  t15 = getEmptyMessage({
259
260
  isLoading,
260
261
  isNothingFound: false,
261
262
  noOptionsMessage
262
263
  });
263
- $[38] = isLoading;
264
- $[39] = noOptionsMessage;
265
- $[40] = t15;
264
+ $[39] = isLoading;
265
+ $[40] = noOptionsMessage;
266
+ $[41] = t15;
266
267
  } else {
267
- t15 = $[40];
268
+ t15 = $[41];
268
269
  }
269
270
 
270
271
  const emptyListMessage = t15;
@@ -274,82 +275,82 @@ const NativeSelect = t0 => {
274
275
  const t19 = Boolean(error) && styles.error;
275
276
  let t20;
276
277
 
277
- if ($[41] !== className || $[42] !== t16 || $[43] !== t17 || $[44] !== t18 || $[45] !== t19) {
278
+ if ($[42] !== className || $[43] !== t16 || $[44] !== t17 || $[45] !== t18 || $[46] !== t19) {
278
279
  t20 = cn(className, styles.root, t16, t17, styles.classic, t18, t19);
279
- $[41] = className;
280
- $[42] = t16;
281
- $[43] = t17;
282
- $[44] = t18;
283
- $[45] = t19;
284
- $[46] = t20;
280
+ $[42] = className;
281
+ $[43] = t16;
282
+ $[44] = t17;
283
+ $[45] = t18;
284
+ $[46] = t19;
285
+ $[47] = t20;
285
286
  } else {
286
- t20 = $[46];
287
+ t20 = $[47];
287
288
  }
288
289
 
289
290
  let t21;
290
291
 
291
- if ($[47] !== labelProps) {
292
+ if ($[48] !== labelProps) {
292
293
  t21 = mergeProps(labelProps);
293
- $[47] = labelProps;
294
- $[48] = t21;
294
+ $[48] = labelProps;
295
+ $[49] = t21;
295
296
  } else {
296
- t21 = $[48];
297
+ t21 = $[49];
297
298
  }
298
299
 
299
300
  let t22;
300
301
 
301
- if ($[49] !== isClearable || $[50] !== reset) {
302
+ if ($[50] !== isClearable || $[51] !== reset) {
302
303
  t22 = event_0 => {
303
304
  if (isClearable && (event_0.key === "Backspace" || event_0.key === "Delete")) {
304
305
  reset();
305
306
  }
306
307
  };
307
308
 
308
- $[49] = isClearable;
309
- $[50] = reset;
310
- $[51] = t22;
309
+ $[50] = isClearable;
310
+ $[51] = reset;
311
+ $[52] = t22;
311
312
  } else {
312
- t22 = $[51];
313
+ t22 = $[52];
313
314
  }
314
315
 
315
316
  let t23;
316
317
 
317
- if ($[52] !== fieldProps || $[53] !== focusProps || $[54] !== hoverProps || $[55] !== t22) {
318
+ if ($[53] !== fieldProps || $[54] !== focusProps || $[55] !== hoverProps || $[56] !== t22) {
318
319
  t23 = mergeProps(fieldProps, focusProps, hoverProps, {
319
320
  onKeyDown: t22
320
321
  });
321
- $[52] = fieldProps;
322
- $[53] = focusProps;
323
- $[54] = hoverProps;
324
- $[55] = t22;
325
- $[56] = t23;
322
+ $[53] = fieldProps;
323
+ $[54] = focusProps;
324
+ $[55] = hoverProps;
325
+ $[56] = t22;
326
+ $[57] = t23;
326
327
  } else {
327
- t23 = $[56];
328
+ t23 = $[57];
328
329
  }
329
330
 
330
331
  const t24 = isDisabled ? true : undefined;
331
332
  const t25 = value?.value ?? "";
332
333
  let t26;
333
334
 
334
- if ($[57] !== emptyListMessage || $[58] !== options || $[59] !== placeholder) {
335
+ if ($[58] !== emptyListMessage || $[59] !== options || $[60] !== placeholder) {
335
336
  t26 = /*#__PURE__*/React.createElement(NativeSelectOptionsWithGroups, {
336
337
  optionsWithGroups: options,
337
338
  placeholder: placeholder,
338
339
  emptyListMessage: emptyListMessage
339
340
  });
340
- $[57] = emptyListMessage;
341
- $[58] = options;
342
- $[59] = placeholder;
343
- $[60] = t26;
341
+ $[58] = emptyListMessage;
342
+ $[59] = options;
343
+ $[60] = placeholder;
344
+ $[61] = t26;
344
345
  } else {
345
- t26 = $[60];
346
+ t26 = $[61];
346
347
  }
347
348
 
348
349
  let t27;
349
350
 
350
- if ($[61] !== handleChange || $[62] !== name || $[63] !== rest || $[64] !== t23 || $[65] !== t24 || $[66] !== t25 || $[67] !== t26) {
351
+ if ($[62] !== handleChange || $[63] !== name || $[64] !== rest || $[65] !== t23 || $[66] !== t24 || $[67] !== t25 || $[68] !== t26) {
351
352
  t27 = /*#__PURE__*/React.createElement("select", _extends({}, rest, t23, {
352
- ref: triggerRef,
353
+ ref: setTriggerEl,
353
354
  "data-test": "native-select_select",
354
355
  "data-rs-internal": "select-native__select",
355
356
  className: styles.select,
@@ -358,21 +359,21 @@ const NativeSelect = t0 => {
358
359
  name: name,
359
360
  value: t25
360
361
  }), t26);
361
- $[61] = handleChange;
362
- $[62] = name;
363
- $[63] = rest;
364
- $[64] = t23;
365
- $[65] = t24;
366
- $[66] = t25;
367
- $[67] = t26;
368
- $[68] = t27;
362
+ $[62] = handleChange;
363
+ $[63] = name;
364
+ $[64] = rest;
365
+ $[65] = t23;
366
+ $[66] = t24;
367
+ $[67] = t25;
368
+ $[68] = t26;
369
+ $[69] = t27;
369
370
  } else {
370
- t27 = $[68];
371
+ t27 = $[69];
371
372
  }
372
373
 
373
374
  let t28;
374
375
 
375
- if ($[69] !== fieldProps || $[70] !== isClearable || $[71] !== isDisabled || $[72] !== isFocused || $[73] !== isHovered || $[74] !== isLoading || $[75] !== placeholder || $[76] !== reset || $[77] !== trigger || $[78] !== value?.label || $[79] !== value?.value) {
376
+ if ($[70] !== fieldProps || $[71] !== isClearable || $[72] !== isDisabled || $[73] !== isFocused || $[74] !== isHovered || $[75] !== isLoading || $[76] !== placeholder || $[77] !== reset || $[78] !== trigger || $[79] !== triggerEl || $[80] !== value?.label || $[81] !== value?.value) {
376
377
  t28 = trigger ? trigger({
377
378
  focused: isFocused,
378
379
  hovered: isHovered,
@@ -392,44 +393,45 @@ const NativeSelect = t0 => {
392
393
  triggerId: fieldProps.id,
393
394
  onClear: () => {
394
395
  reset();
395
- triggerRef.current?.focus({
396
+ triggerEl?.focus({
396
397
  focusVisible: false
397
398
  });
398
399
  },
399
400
  canHaveClearIcon: isClearable && !isDisabled && Boolean(value?.value)
400
401
  }));
401
- $[69] = fieldProps;
402
- $[70] = isClearable;
403
- $[71] = isDisabled;
404
- $[72] = isFocused;
405
- $[73] = isHovered;
406
- $[74] = isLoading;
407
- $[75] = placeholder;
408
- $[76] = reset;
409
- $[77] = trigger;
410
- $[78] = value?.label;
411
- $[79] = value?.value;
412
- $[80] = t28;
402
+ $[70] = fieldProps;
403
+ $[71] = isClearable;
404
+ $[72] = isDisabled;
405
+ $[73] = isFocused;
406
+ $[74] = isHovered;
407
+ $[75] = isLoading;
408
+ $[76] = placeholder;
409
+ $[77] = reset;
410
+ $[78] = trigger;
411
+ $[79] = triggerEl;
412
+ $[80] = value?.label;
413
+ $[81] = value?.value;
414
+ $[82] = t28;
413
415
  } else {
414
- t28 = $[80];
416
+ t28 = $[82];
415
417
  }
416
418
 
417
419
  let t29;
418
420
 
419
- if ($[81] !== t27 || $[82] !== t28) {
421
+ if ($[83] !== t27 || $[84] !== t28) {
420
422
  t29 = /*#__PURE__*/React.createElement("div", {
421
423
  className: styles.triggerContainer
422
424
  }, t27, t28);
423
- $[81] = t27;
424
- $[82] = t28;
425
- $[83] = t29;
425
+ $[83] = t27;
426
+ $[84] = t28;
427
+ $[85] = t29;
426
428
  } else {
427
- t29 = $[83];
429
+ t29 = $[85];
428
430
  }
429
431
 
430
432
  let t30;
431
433
 
432
- if ($[84] !== boldLabel || $[85] !== descriptionProps || $[86] !== error || $[87] !== errorMessageProps || $[88] !== isDisabled || $[89] !== label || $[90] !== note || $[91] !== reserveErrorLine || $[92] !== size || $[93] !== t21 || $[94] !== t29 || $[95] !== theme) {
434
+ if ($[86] !== boldLabel || $[87] !== descriptionProps || $[88] !== error || $[89] !== errorMessageProps || $[90] !== isDisabled || $[91] !== label || $[92] !== note || $[93] !== reserveErrorLine || $[94] !== size || $[95] !== t21 || $[96] !== t29 || $[97] !== theme) {
433
435
  t30 = /*#__PURE__*/React.createElement(FormTriggerWrapper, {
434
436
  theme: theme,
435
437
  size: size,
@@ -443,39 +445,39 @@ const NativeSelect = t0 => {
443
445
  note: note,
444
446
  descriptionProps: descriptionProps
445
447
  }, t29);
446
- $[84] = boldLabel;
447
- $[85] = descriptionProps;
448
- $[86] = error;
449
- $[87] = errorMessageProps;
450
- $[88] = isDisabled;
451
- $[89] = label;
452
- $[90] = note;
453
- $[91] = reserveErrorLine;
454
- $[92] = size;
455
- $[93] = t21;
456
- $[94] = t29;
457
- $[95] = theme;
458
- $[96] = t30;
448
+ $[86] = boldLabel;
449
+ $[87] = descriptionProps;
450
+ $[88] = error;
451
+ $[89] = errorMessageProps;
452
+ $[90] = isDisabled;
453
+ $[91] = label;
454
+ $[92] = note;
455
+ $[93] = reserveErrorLine;
456
+ $[94] = size;
457
+ $[95] = t21;
458
+ $[96] = t29;
459
+ $[97] = theme;
460
+ $[98] = t30;
459
461
  } else {
460
- t30 = $[96];
462
+ t30 = $[98];
461
463
  }
462
464
 
463
465
  let t31;
464
466
 
465
- if ($[97] !== id || $[98] !== style || $[99] !== t20 || $[100] !== t30) {
467
+ if ($[99] !== id || $[100] !== style || $[101] !== t20 || $[102] !== t30) {
466
468
  t31 = /*#__PURE__*/React.createElement("div", {
467
469
  className: t20,
468
470
  id: id,
469
471
  style: style,
470
472
  "data-test": "native-select"
471
473
  }, t30);
472
- $[97] = id;
473
- $[98] = style;
474
- $[99] = t20;
475
- $[100] = t30;
476
- $[101] = t31;
474
+ $[99] = id;
475
+ $[100] = style;
476
+ $[101] = t20;
477
+ $[102] = t30;
478
+ $[103] = t31;
477
479
  } else {
478
- t31 = $[101];
480
+ t31 = $[103];
479
481
  }
480
482
 
481
483
  return t31;
@@ -3,7 +3,6 @@ import { c } from 'react-compiler-runtime';
3
3
  import React from 'react';
4
4
  import cn from 'classnames';
5
5
  import styles from '../styles/list-box.p.module.css.js';
6
- import { useNoMemoGetter } from '../hooks/use-no-memo-getter.js';
7
6
  import { calculateMaxHeightByItems } from '../utils/calculate-max-height-by-items.js';
8
7
  import { getRealItemsCnt } from '../utils/get-real-items-cnt.js';
9
8
  import { getTextFromNodes } from '../utils/get-text-from-nodes.js';
@@ -19,7 +18,7 @@ const MODE_STYLES = {
19
18
  };
20
19
 
21
20
  function Option(t0) {
22
- const $ = c(12);
21
+ const $ = c(28);
23
22
  const {
24
23
  item,
25
24
  state
@@ -30,66 +29,105 @@ function Option(t0) {
30
29
  highlightedIndex
31
30
  } = state;
32
31
  const index = item.index;
33
- const isSelected = selectedMap.has(item.key);
34
- const isHighlighted = highlightedIndex === item.index;
35
- const isDisabled = item.disabled;
36
- const itemProps = useNoMemoGetter(getItemProps, {
37
- item,
38
- index,
39
- "aria-selected": isSelected,
40
- "tab-index": isHighlighted ? 0 : -1
41
- });
42
- const t1 = cn(styles.item, isSelected && styles.selected, isDisabled && styles.disabled);
43
- const t2 = "select-list-box__item";
44
- const t3 = `select-options-list__item_${item.key}`;
32
+ let T0;
33
+ let t1;
34
+ let t2;
35
+ let t3;
45
36
  let t4;
37
+ let t5;
38
+ let t6;
39
+ let t7;
40
+ let t8;
41
+
42
+ if ($[0] !== getItemProps || $[1] !== highlightedIndex || $[2] !== index || $[3] !== item || $[4] !== selectedMap) {
43
+ const isSelected = selectedMap.has(item.key);
44
+ const isHighlighted = highlightedIndex === item.index;
45
+ const isDisabled = item.disabled;
46
+ t3 = getItemProps({
47
+ item,
48
+ index,
49
+ "aria-selected": isSelected,
50
+ "tab-index": isHighlighted ? 0 : -1
51
+ });
52
+ t4 = cn(styles.item, isSelected && styles.selected, isDisabled && styles.disabled);
53
+ t5 = "select-list-box__item";
54
+ t6 = isHighlighted;
55
+ t7 = `select-options-list__item_${item.key}`;
56
+
57
+ if ($[14] !== item.label) {
58
+ t8 = /*#__PURE__*/React.createElement("span", null, item.label);
59
+ $[14] = item.label;
60
+ $[15] = t8;
61
+ } else {
62
+ t8 = $[15];
63
+ }
46
64
 
47
- if ($[0] !== item.label) {
48
- t4 = /*#__PURE__*/React.createElement("span", null, item.label);
49
- $[0] = item.label;
50
- $[1] = t4;
65
+ T0 = CheckOutlineIcon;
66
+ t1 = "select-list-box__check-icon";
67
+ t2 = cn(styles.checkIcon, isSelected && styles.visible);
68
+ $[0] = getItemProps;
69
+ $[1] = highlightedIndex;
70
+ $[2] = index;
71
+ $[3] = item;
72
+ $[4] = selectedMap;
73
+ $[5] = T0;
74
+ $[6] = t1;
75
+ $[7] = t2;
76
+ $[8] = t3;
77
+ $[9] = t4;
78
+ $[10] = t5;
79
+ $[11] = t6;
80
+ $[12] = t7;
81
+ $[13] = t8;
51
82
  } else {
52
- t4 = $[1];
83
+ T0 = $[5];
84
+ t1 = $[6];
85
+ t2 = $[7];
86
+ t3 = $[8];
87
+ t4 = $[9];
88
+ t5 = $[10];
89
+ t6 = $[11];
90
+ t7 = $[12];
91
+ t8 = $[13];
53
92
  }
54
93
 
55
- const T0 = CheckOutlineIcon;
56
- const t5 = "select-list-box__check-icon";
57
- const t6 = cn(styles.checkIcon, isSelected && styles.visible);
58
- let t7;
94
+ let t9;
59
95
 
60
- if ($[2] !== T0 || $[3] !== t6) {
61
- t7 = /*#__PURE__*/React.createElement(T0, {
62
- "data-rs-internal": t5,
63
- className: t6
96
+ if ($[16] !== T0 || $[17] !== t1 || $[18] !== t2) {
97
+ t9 = /*#__PURE__*/React.createElement(T0, {
98
+ "data-rs-internal": t1,
99
+ className: t2
64
100
  });
65
- $[2] = T0;
66
- $[3] = t6;
67
- $[4] = t7;
101
+ $[16] = T0;
102
+ $[17] = t1;
103
+ $[18] = t2;
104
+ $[19] = t9;
68
105
  } else {
69
- t7 = $[4];
106
+ t9 = $[19];
70
107
  }
71
108
 
72
- let t8;
109
+ let t10;
73
110
 
74
- if ($[5] !== isHighlighted || $[6] !== itemProps || $[7] !== t1 || $[8] !== t3 || $[9] !== t4 || $[10] !== t7) {
75
- t8 = /*#__PURE__*/React.createElement("li", _extends({}, itemProps, {
76
- className: t1,
77
- "data-rs-internal": t2,
78
- "data-focused": isHighlighted,
79
- "data-test": t3
80
- }), t4, t7);
81
- $[5] = isHighlighted;
82
- $[6] = itemProps;
83
- $[7] = t1;
84
- $[8] = t3;
85
- $[9] = t4;
86
- $[10] = t7;
87
- $[11] = t8;
111
+ if ($[20] !== t3 || $[21] !== t4 || $[22] !== t5 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9) {
112
+ t10 = /*#__PURE__*/React.createElement("li", _extends({}, t3, {
113
+ className: t4,
114
+ "data-rs-internal": t5,
115
+ "data-focused": t6,
116
+ "data-test": t7
117
+ }), t8, t9);
118
+ $[20] = t3;
119
+ $[21] = t4;
120
+ $[22] = t5;
121
+ $[23] = t6;
122
+ $[24] = t7;
123
+ $[25] = t8;
124
+ $[26] = t9;
125
+ $[27] = t10;
88
126
  } else {
89
- t8 = $[11];
127
+ t10 = $[27];
90
128
  }
91
129
 
92
- return t8;
130
+ return t10;
93
131
  }
94
132
 
95
133
  function ListBoxGroup(t0) {
@@ -7,6 +7,6 @@ export interface MultiTriggerProps {
7
7
  isSingleLine: boolean;
8
8
  isDisabled: boolean;
9
9
  placeholder?: string;
10
- triggerRef?: React.RefObject<HTMLDivElement>;
10
+ triggerEl?: HTMLDivElement | null;
11
11
  }
12
- export declare function MultiTrigger({ selectedItems, valueProps, isSingleLine, isDisabled, placeholder, triggerRef, removeSelectedItem }: MultiTriggerProps): React.JSX.Element;
12
+ export declare function MultiTrigger({ selectedItems, valueProps, isSingleLine, isDisabled, placeholder, triggerEl, removeSelectedItem }: MultiTriggerProps): React.JSX.Element;