@rescui/collapse 0.8.6-RUI-308-Fix-select-issues-405b9fa40.12 → 0.9.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.
@@ -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 RightIcon16 = /*#__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: "M5.97 4.47a.75.75 0 0 0 0 1.06L8.44 8l-2.47 2.47a.75.75 0 1 0 1.06 1.06l3-3a.75.75 0 0 0 0-1.06l-3-3a.75.75 0 0 0-1.06 0"
24
- })));
19
+ const RightIcon16 = /*#__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: "M5.97 4.47a.75.75 0 0 0 0 1.06L8.44 8l-2.47 2.47a.75.75 0 1 0 1.06 1.06l3-3a.75.75 0 0 0 0-1.06l-3-3a.75.75 0 0 0-1.06 0"
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
  RightIcon16.displayName = 'RightIcon16';
26
- const RightIcon20 = /*#__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: "M7.293 5.293a1 1 0 0 0 0 1.414L10.586 10l-3.293 3.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414l-4-4a1 1 0 0 0-1.414 0"
32
- })));
50
+ const RightIcon20 = /*#__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: "M7.293 5.293a1 1 0 0 0 0 1.414L10.586 10l-3.293 3.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414l-4-4a1 1 0 0 0-1.414 0"
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
  RightIcon20.displayName = 'RightIcon20';
34
- const RightIcon24 = /*#__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: "M7.94 4.94a1.5 1.5 0 0 0 0 2.12L12.878 12l-4.94 4.94a1.5 1.5 0 0 0 2.122 2.12l6-6a1.5 1.5 0 0 0 0-2.12l-6-6a1.5 1.5 0 0 0-2.122 0"
40
- })));
81
+ const RightIcon24 = /*#__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: "M7.94 4.94a1.5 1.5 0 0 0 0 2.12L12.878 12l-4.94 4.94a1.5 1.5 0 0 0 2.122 2.12l6-6a1.5 1.5 0 0 0 0-2.12l-6-6a1.5 1.5 0 0 0-2.122 0"
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
  RightIcon24.displayName = 'RightIcon24';
42
- const RightIcon28 = /*#__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: "M9.44 5.94a1.5 1.5 0 0 0 0 2.12L15.378 14l-5.94 5.94a1.5 1.5 0 0 0 2.122 2.12l7-7a1.5 1.5 0 0 0 0-2.12l-7-7a1.5 1.5 0 0 0-2.122 0"
48
- })));
112
+ const RightIcon28 = /*#__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: "M9.44 5.94a1.5 1.5 0 0 0 0 2.12L15.378 14l-5.94 5.94a1.5 1.5 0 0 0 2.122 2.12l7-7a1.5 1.5 0 0 0 0-2.12l-7-7a1.5 1.5 0 0 0-2.122 0"
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
  RightIcon28.displayName = 'RightIcon28';
50
- const RightIcon = /*#__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 RightIcon = /*#__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(RightIcon16, {
74
- className: styles.variant16
75
- }), /*#__PURE__*/React.createElement(RightIcon20, {
76
- className: styles.variant20
77
- }), /*#__PURE__*/React.createElement(RightIcon24, {
78
- className: styles.variant24
79
- }), /*#__PURE__*/React.createElement(RightIcon28, {
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(RightIcon16, {
238
+ className: styles.variant16
239
+ });
240
+ t10 = /*#__PURE__*/React.createElement(RightIcon20, {
241
+ className: styles.variant20
242
+ });
243
+ t11 = /*#__PURE__*/React.createElement(RightIcon24, {
244
+ className: styles.variant24
245
+ });
246
+ t12 = /*#__PURE__*/React.createElement(RightIcon28, {
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(RightIcon16, mainProps);
275
+ if (size === Size.xs) {
276
+ let t9;
277
+
278
+ if ($[26] !== mainProps) {
279
+ t9 = /*#__PURE__*/React.createElement(RightIcon16, 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(RightIcon20, mainProps);
289
+ if (size === Size.s) {
290
+ let t9;
291
+
292
+ if ($[28] !== mainProps) {
293
+ t9 = /*#__PURE__*/React.createElement(RightIcon20, 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(RightIcon24, 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(RightIcon24, mainProps);
317
+ let t9;
318
+
319
+ if ($[32] !== mainProps) {
320
+ t9 = /*#__PURE__*/React.createElement(RightIcon28, mainProps);
321
+ $[32] = mainProps;
322
+ $[33] = t9;
323
+ } else {
324
+ t9 = $[33];
94
325
  }
95
326
 
96
- return /*#__PURE__*/React.createElement(RightIcon28, mainProps);
327
+ return t9;
97
328
  });
98
329
  RightIcon.displayName = 'RightIcon';
99
330
  RightIcon.propTypes = {
package/lib/accordion.js CHANGED
@@ -1,4 +1,6 @@
1
1
  "use client";
2
+ import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
3
+ import { c } from 'react-compiler-runtime';
2
4
  import React, { useState } from 'react';
3
5
  import cn from 'classnames';
4
6
  import PropTypes from 'prop-types';
@@ -18,39 +20,104 @@ const THEME_STYLES = {
18
20
  dark: styles.themeDark
19
21
  };
20
22
  const Accordion = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
21
- (_ref, ref) => {
22
- let {
23
- children,
24
- className,
25
- openedClassName,
26
- size = 'm',
27
- mode = 'classic',
28
- icon = 'left-plus',
29
- borderBottom = false,
30
- disableLeftPadding = false,
31
- gap = 0,
32
- theme: themeFromProps,
33
- value,
34
- onChange,
35
- ...restProps
36
- } = _ref;
37
- const isControlled = typeof value !== 'undefined';
23
+ (t0, ref) => {
24
+ const $ = c(39);
25
+ let children;
26
+ let className;
27
+ let onChange;
28
+ let openedClassName;
29
+ let restProps;
30
+ let t1;
31
+ let t2;
32
+ let t3;
33
+ let t4;
34
+ let t5;
35
+ let t6;
36
+ let themeFromProps;
37
+ let value;
38
+
39
+ if ($[0] !== t0) {
40
+ ({
41
+ children,
42
+ className,
43
+ openedClassName,
44
+ size: t1,
45
+ mode: t2,
46
+ icon: t3,
47
+ borderBottom: t4,
48
+ disableLeftPadding: t5,
49
+ gap: t6,
50
+ theme: themeFromProps,
51
+ value,
52
+ onChange,
53
+ ...restProps
54
+ } = t0);
55
+ $[0] = t0;
56
+ $[1] = children;
57
+ $[2] = className;
58
+ $[3] = onChange;
59
+ $[4] = openedClassName;
60
+ $[5] = restProps;
61
+ $[6] = t1;
62
+ $[7] = t2;
63
+ $[8] = t3;
64
+ $[9] = t4;
65
+ $[10] = t5;
66
+ $[11] = t6;
67
+ $[12] = themeFromProps;
68
+ $[13] = value;
69
+ } else {
70
+ children = $[1];
71
+ className = $[2];
72
+ onChange = $[3];
73
+ openedClassName = $[4];
74
+ restProps = $[5];
75
+ t1 = $[6];
76
+ t2 = $[7];
77
+ t3 = $[8];
78
+ t4 = $[9];
79
+ t5 = $[10];
80
+ t6 = $[11];
81
+ themeFromProps = $[12];
82
+ value = $[13];
83
+ }
84
+
85
+ const size = t1 === undefined ? "m" : t1;
86
+ const mode = t2 === undefined ? "classic" : t2;
87
+ const icon = t3 === undefined ? "left-plus" : t3;
88
+ const borderBottom = t4 === undefined ? false : t4;
89
+ const disableLeftPadding = t5 === undefined ? false : t5;
90
+ const gap = t6 === undefined ? 0 : t6;
91
+ const isControlled = typeof value !== "undefined";
38
92
  const theme = useThemeWithUndefined(themeFromProps);
39
93
  const [openKey, setActiveKey] = useState(isControlled ? value : null);
94
+ let t7;
95
+
96
+ if ($[14] !== onChange || $[15] !== openKey) {
97
+ t7 = key => {
98
+ const activatingKey = key !== openKey ? key : null;
40
99
 
41
- const toggleActiveKey = key => {
42
- const activatingKey = key !== openKey ? key : null;
100
+ if (onChange) {
101
+ onChange(activatingKey);
102
+ }
43
103
 
44
- if (onChange) {
45
- onChange(activatingKey);
46
- }
104
+ setActiveKey(activatingKey);
105
+ };
47
106
 
48
- setActiveKey(activatingKey);
49
- };
107
+ $[14] = onChange;
108
+ $[15] = openKey;
109
+ $[16] = t7;
110
+ } else {
111
+ t7 = $[16];
112
+ }
50
113
 
51
- return /*#__PURE__*/React.createElement(collapseContext.Provider, {
52
- value: {
53
- openedKey: isControlled ? value : openKey,
114
+ const toggleActiveKey = t7;
115
+ const t8 = isControlled ? value : openKey;
116
+ let t9;
117
+
118
+ if ($[17] !== borderBottom || $[18] !== disableLeftPadding || $[19] !== icon || $[20] !== isControlled || $[21] !== mode || $[22] !== openedClassName || $[23] !== size || $[24] !== t8 || $[25] !== toggleActiveKey) {
119
+ t9 = {
120
+ openedKey: t8,
54
121
  isInAccordion: true,
55
122
  isInControlledAccordion: isControlled,
56
123
  toggleActiveKey,
@@ -61,13 +128,67 @@ const Accordion = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line com
61
128
  borderBottom,
62
129
  disableLeftPadding,
63
130
  openedClassName
64
- }
65
- }, /*#__PURE__*/React.createElement("div", {
66
- "data-test": 'accordion',
67
- ...restProps,
68
- className: cn(styles.accordion, GAP_STYLES[gap], THEME_STYLES[theme], className),
69
- ref: ref
70
- }, children));
131
+ };
132
+ $[17] = borderBottom;
133
+ $[18] = disableLeftPadding;
134
+ $[19] = icon;
135
+ $[20] = isControlled;
136
+ $[21] = mode;
137
+ $[22] = openedClassName;
138
+ $[23] = size;
139
+ $[24] = t8;
140
+ $[25] = toggleActiveKey;
141
+ $[26] = t9;
142
+ } else {
143
+ t9 = $[26];
144
+ }
145
+
146
+ const t10 = GAP_STYLES[gap];
147
+ const t11 = THEME_STYLES[theme];
148
+ let t12;
149
+
150
+ if ($[27] !== className || $[28] !== t10 || $[29] !== t11) {
151
+ t12 = cn(styles.accordion, t10, t11, className);
152
+ $[27] = className;
153
+ $[28] = t10;
154
+ $[29] = t11;
155
+ $[30] = t12;
156
+ } else {
157
+ t12 = $[30];
158
+ }
159
+
160
+ let t13;
161
+
162
+ if ($[31] !== children || $[32] !== ref || $[33] !== restProps || $[34] !== t12) {
163
+ t13 = /*#__PURE__*/React.createElement("div", _extends({
164
+ "data-test": "accordion"
165
+ }, restProps, {
166
+ className: t12,
167
+ ref: ref
168
+ }), children);
169
+ $[31] = children;
170
+ $[32] = ref;
171
+ $[33] = restProps;
172
+ $[34] = t12;
173
+ $[35] = t13;
174
+ } else {
175
+ t13 = $[35];
176
+ }
177
+
178
+ let t14;
179
+
180
+ if ($[36] !== t13 || $[37] !== t9) {
181
+ t14 = /*#__PURE__*/React.createElement(collapseContext.Provider, {
182
+ value: t9
183
+ }, t13);
184
+ $[36] = t13;
185
+ $[37] = t9;
186
+ $[38] = t14;
187
+ } else {
188
+ t14 = $[38];
189
+ }
190
+
191
+ return t14;
71
192
  });
72
193
  Accordion.displayName = 'Accordion';
73
194
  Accordion.propTypes = {