@rescui/collapse 0.8.4-RUI-297-Add-react-compiler-to-the-packages-build-f15074a13.11 → 0.8.5

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,15 +1,15 @@
1
1
  var styles = {
2
- "icon": "_icon_ydxoyp_4",
3
- "sizeXS": "_sizeXS_ydxoyp_14",
4
- "sizeS": "_sizeS_ydxoyp_18",
5
- "sizeM": "_sizeM_ydxoyp_22",
6
- "sizeL": "_sizeL_ydxoyp_26",
7
- "light": "_light_ydxoyp_30",
8
- "dark": "_dark_ydxoyp_34",
9
- "allVariants": "_allVariants_ydxoyp_48",
10
- "variant16": "_variant16_ydxoyp_53",
11
- "variant20": "_variant20_ydxoyp_54",
12
- "variant24": "_variant24_ydxoyp_55",
13
- "variant28": "_variant28_ydxoyp_58"
2
+ "icon": "_icon_1npbgia_4",
3
+ "sizeXS": "_sizeXS_1npbgia_14",
4
+ "sizeS": "_sizeS_1npbgia_18",
5
+ "sizeM": "_sizeM_1npbgia_22",
6
+ "sizeL": "_sizeL_1npbgia_26",
7
+ "light": "_light_1npbgia_30",
8
+ "dark": "_dark_1npbgia_34",
9
+ "allVariants": "_allVariants_1npbgia_48",
10
+ "variant16": "_variant16_1npbgia_53",
11
+ "variant20": "_variant20_1npbgia_54",
12
+ "variant24": "_variant24_1npbgia_55",
13
+ "variant28": "_variant28_1npbgia_58"
14
14
  };
15
15
  export { styles as default };
package/lib/accordion.js CHANGED
@@ -1,6 +1,4 @@
1
1
  "use client";
2
- import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
3
- import { c } from 'react-compiler-runtime';
4
2
  import React, { useState } from 'react';
5
3
  import cn from 'classnames';
6
4
  import PropTypes from 'prop-types';
@@ -20,104 +18,39 @@ const THEME_STYLES = {
20
18
  dark: styles.themeDark
21
19
  };
22
20
  const Accordion = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
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";
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';
92
38
  const theme = useThemeWithUndefined(themeFromProps);
93
39
  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;
99
40
 
100
- if (onChange) {
101
- onChange(activatingKey);
102
- }
41
+ const toggleActiveKey = key => {
42
+ const activatingKey = key !== openKey ? key : null;
103
43
 
104
- setActiveKey(activatingKey);
105
- };
44
+ if (onChange) {
45
+ onChange(activatingKey);
46
+ }
106
47
 
107
- $[14] = onChange;
108
- $[15] = openKey;
109
- $[16] = t7;
110
- } else {
111
- t7 = $[16];
112
- }
48
+ setActiveKey(activatingKey);
49
+ };
113
50
 
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,
51
+ return /*#__PURE__*/React.createElement(collapseContext.Provider, {
52
+ value: {
53
+ openedKey: isControlled ? value : openKey,
121
54
  isInAccordion: true,
122
55
  isInControlledAccordion: isControlled,
123
56
  toggleActiveKey,
@@ -128,67 +61,13 @@ const Accordion = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line com
128
61
  borderBottom,
129
62
  disableLeftPadding,
130
63
  openedClassName
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;
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));
192
71
  });
193
72
  Accordion.displayName = 'Accordion';
194
73
  Accordion.propTypes = {
package/lib/collapse.js CHANGED
@@ -1,11 +1,8 @@
1
1
  "use client";
2
- import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
3
- import { c } from 'react-compiler-runtime';
4
2
  import React, { useState, useContext, useRef, useEffect } from 'react';
5
3
  import cn from 'classnames';
6
4
  import PropTypes from 'prop-types';
7
5
  import { useThemeWithUndefined } from '@rescui/ui-contexts';
8
- import { useResizeObserver } from '@rescui/use-resize-observer';
9
6
  import RightIcon from './_virtual/right.js';
10
7
  import PlusIcon from './_virtual/plus.js';
11
8
  import { collapseContext } from './context.js';
@@ -32,83 +29,25 @@ const ICON_STYLES = {
32
29
  arrow: styles.iconArrow
33
30
  };
34
31
  const Collapse = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
35
- (t0, ref) => {
36
- const $ = c(71);
37
- let borderBottomFromProps;
38
- let children;
39
- let className;
40
- let disableLeftPaddingFromProps;
41
- let iconFromProps;
42
- let itemKey;
43
- let modeFromProps;
44
- let openedClassnameFromProps;
45
- let restProps;
46
- let sizeFromProps;
47
- let t1;
48
- let themeFromProps;
49
- let title;
50
-
51
- if ($[0] !== t0) {
52
- ({
53
- children,
54
- className,
55
- openedClassName: openedClassnameFromProps,
56
- size: sizeFromProps,
57
- mode: modeFromProps,
58
- icon: iconFromProps,
59
- borderBottom: borderBottomFromProps,
60
- disableLeftPadding: disableLeftPaddingFromProps,
61
- title,
62
- isDefaultOpened: t1,
63
- theme: themeFromProps,
64
- itemKey,
65
- ...restProps
66
- } = t0);
67
- $[0] = t0;
68
- $[1] = borderBottomFromProps;
69
- $[2] = children;
70
- $[3] = className;
71
- $[4] = disableLeftPaddingFromProps;
72
- $[5] = iconFromProps;
73
- $[6] = itemKey;
74
- $[7] = modeFromProps;
75
- $[8] = openedClassnameFromProps;
76
- $[9] = restProps;
77
- $[10] = sizeFromProps;
78
- $[11] = t1;
79
- $[12] = themeFromProps;
80
- $[13] = title;
81
- } else {
82
- borderBottomFromProps = $[1];
83
- children = $[2];
84
- className = $[3];
85
- disableLeftPaddingFromProps = $[4];
86
- iconFromProps = $[5];
87
- itemKey = $[6];
88
- modeFromProps = $[7];
89
- openedClassnameFromProps = $[8];
90
- restProps = $[9];
91
- sizeFromProps = $[10];
92
- t1 = $[11];
93
- themeFromProps = $[12];
94
- title = $[13];
95
- }
96
-
97
- const isDefaultOpened = t1 === undefined ? false : t1;
32
+ (_ref, ref) => {
33
+ let {
34
+ children,
35
+ className,
36
+ openedClassName: openedClassnameFromProps,
37
+ size: sizeFromProps,
38
+ mode: modeFromProps,
39
+ icon: iconFromProps,
40
+ borderBottom: borderBottomFromProps,
41
+ disableLeftPadding: disableLeftPaddingFromProps,
42
+ title,
43
+ isDefaultOpened = false,
44
+ theme: themeFromProps,
45
+ itemKey,
46
+ ...restProps
47
+ } = _ref;
98
48
  const uniqueId = useSafeId();
99
- let t2;
100
-
101
- if ($[14] !== itemKey || $[15] !== uniqueId) {
102
- t2 = () => itemKey ?? uniqueId;
103
-
104
- $[14] = itemKey;
105
- $[15] = uniqueId;
106
- $[16] = t2;
107
- } else {
108
- t2 = $[16];
109
- }
110
-
111
- const [key] = useState(t2);
49
+ const [key] = useState(() => itemKey ?? uniqueId);
50
+ const [isAccordionConnected, setIsAccordionConnected] = useState(false);
112
51
  const theme = useThemeWithUndefined(themeFromProps);
113
52
  const {
114
53
  openedKey,
@@ -123,260 +62,88 @@ const Collapse = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line comp
123
62
  disableLeftPadding: disableLeftPaddingFromContext,
124
63
  openedClassName: openedClassNameFromContext
125
64
  } = useContext(collapseContext);
126
- const size = sizeFromProps ?? sizeFromContext ?? "m";
127
- const mode = modeFromProps ?? modeFromContext ?? "classic";
128
- const icon = iconFromProps ?? iconFromContext ?? "left-plus";
65
+ const size = sizeFromProps ?? sizeFromContext ?? 'm';
66
+ const mode = modeFromProps ?? modeFromContext ?? 'classic';
67
+ const icon = iconFromProps ?? iconFromContext ?? 'left-plus';
129
68
  const borderBottom = borderBottomFromProps ?? borderBottomFromContext ?? false;
130
69
  const disableLeftPadding = disableLeftPaddingFromProps ?? disableLeftPaddingFromContext ?? false;
131
70
  const openedClassName = openedClassnameFromProps ?? openedClassNameFromContext;
132
- const resizeRef = useRef(null);
133
- const [height, setHeight] = useState("initial");
134
- let t3;
71
+ const contentRef = useRef(null);
72
+ const [isAnimationEnabled, setIsAnimationEnabled] = useState(!isInAccordion); // this state is ignored in accordion
73
+
74
+ const [shouldBeOpenedLocal, setShouldBeOpenedLocal] = useState(isDefaultOpened); // boolean state. ignores CLOSING and OPENING states
75
+
76
+ const shouldBeOpened = isAccordionConnected ? openedKey === key : shouldBeOpenedLocal;
77
+ useEffect(() => {
78
+ if (!isInAccordion) {
79
+ return;
80
+ }
81
+
82
+ if (!isAccordionConnected) {
83
+ // For an uncontrolled accordion, register the initially opened item.
84
+ // Keep using the local state until this update and the connection update
85
+ // have rendered together.
86
+ if (!isInControlledAccordion && isDefaultOpened && setActiveKey) {
87
+ setActiveKey(key);
88
+ } // eslint-disable-next-line react-hooks/set-state-in-effect
135
89
 
136
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
137
- t3 = entry => setHeight(entry.target.offsetHeight);
138
90
 
139
- $[17] = t3;
140
- } else {
141
- t3 = $[17];
142
- }
91
+ setIsAccordionConnected(true);
92
+ return;
93
+ } // The first accordion state has already been committed. Enabling
94
+ // transitions separately makes its initial reconciliation instantaneous.
95
+ // eslint-disable-next-line react-hooks/set-state-in-effect
143
96
 
144
- useResizeObserver(resizeRef, t3);
145
- const isHeightCalculated = height !== "initial";
146
- const [shouldBeOpenedLocal, setShouldBeOpenedLocal] = useState(isDefaultOpened);
147
- const shouldBeOpened = isInAccordion ? openedKey === key : shouldBeOpenedLocal;
148
- const t4 = !isHeightCalculated;
149
- let t5;
150
97
 
151
- if ($[18] !== shouldBeOpened || $[19] !== t4) {
152
- t5 = {
153
- shouldBeOpened,
154
- cancelAnimation: t4
155
- };
156
- $[18] = shouldBeOpened;
157
- $[19] = t4;
158
- $[20] = t5;
159
- } else {
160
- t5 = $[20];
161
- }
98
+ setIsAnimationEnabled(true);
99
+ }, [isAccordionConnected, isInAccordion, isInControlledAccordion, isDefaultOpened, setActiveKey, key]); // add CLOSING and OPENING states
162
100
 
163
- const {
164
- contentRef,
165
- isStartedClosing,
166
- onAnimationEnd: handleTransitionEnd,
167
- state: collapseState
168
- } = useCollapseState(t5);
101
+ const collapseState = useCollapseState({
102
+ shouldBeOpened,
103
+ contentRef
104
+ });
169
105
  const isOpening = collapseState === COLLAPSE_STATES.OPENING;
170
106
  const isOpened = collapseState === COLLAPSE_STATES.OPEN;
171
- const isClosing = collapseState === COLLAPSE_STATES.CLOSING_PREPARE || collapseState === COLLAPSE_STATES.CLOSING;
107
+ const isClosing = collapseState === COLLAPSE_STATES.CLOSING;
172
108
  const isClosed = collapseState === COLLAPSE_STATES.CLOSE;
173
- const isRightIcon = icon === "right-plus";
174
- const Icon = icon === "arrow" ? RightIcon : PlusIcon;
175
- let t6;
176
-
177
- if ($[21] !== key || $[22] !== shouldBeOpened || $[23] !== toggleActiveKey) {
178
- t6 = () => {
179
- if (toggleActiveKey) {
180
- toggleActiveKey(key);
181
- }
182
-
183
- setShouldBeOpenedLocal(!shouldBeOpened);
184
- };
185
-
186
- $[21] = key;
187
- $[22] = shouldBeOpened;
188
- $[23] = toggleActiveKey;
189
- $[24] = t6;
190
- } else {
191
- t6 = $[24];
192
- }
193
-
194
- const toggleOpened = t6;
195
- let t7;
196
-
197
- if ($[25] !== isDefaultOpened || $[26] !== isInAccordion || $[27] !== isInControlledAccordion || $[28] !== key || $[29] !== setActiveKey) {
198
- t7 = () => {
199
- if (isInAccordion && !isInControlledAccordion && isDefaultOpened && setActiveKey) {
200
- setActiveKey(key);
201
- }
202
- };
203
-
204
- $[25] = isDefaultOpened;
205
- $[26] = isInAccordion;
206
- $[27] = isInControlledAccordion;
207
- $[28] = key;
208
- $[29] = setActiveKey;
209
- $[30] = t7;
210
- } else {
211
- t7 = $[30];
212
- }
213
-
214
- let t8;
215
-
216
- if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
217
- t8 = [];
218
- $[31] = t8;
219
- } else {
220
- t8 = $[31];
221
- }
222
-
223
- useEffect(t7, t8);
224
- const t9 = isOpening && styles.opening;
225
- const t10 = isOpened && styles.opened;
226
- const t11 = isClosing && !isStartedClosing && styles.closingTransition;
227
- const t12 = isClosing && styles.closing;
228
- const t13 = isClosed && styles.closed;
229
- const t14 = !isClosed && openedClassName;
230
- const t15 = SIZE_STYLES[size];
231
- const t16 = MODE_STYLES[mode];
232
- const t17 = ICON_STYLES[icon];
233
- const t18 = borderBottom && styles.hasBorderBottom;
234
- const t19 = disableLeftPadding && styles.disableLeftPadding;
235
- const t20 = isRightIcon ? styles.rightIcon : styles.leftIcon;
236
- const t21 = THEME_STYLES[theme];
237
- let t22;
238
-
239
- if ($[32] !== className || $[33] !== t10 || $[34] !== t11 || $[35] !== t12 || $[36] !== t13 || $[37] !== t14 || $[38] !== t15 || $[39] !== t16 || $[40] !== t17 || $[41] !== t18 || $[42] !== t19 || $[43] !== t20 || $[44] !== t21 || $[45] !== t9) {
240
- t22 = cn(className, styles.main, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21);
241
- $[32] = className;
242
- $[33] = t10;
243
- $[34] = t11;
244
- $[35] = t12;
245
- $[36] = t13;
246
- $[37] = t14;
247
- $[38] = t15;
248
- $[39] = t16;
249
- $[40] = t17;
250
- $[41] = t18;
251
- $[42] = t19;
252
- $[43] = t20;
253
- $[44] = t21;
254
- $[45] = t9;
255
- $[46] = t22;
256
- } else {
257
- t22 = $[46];
258
- }
259
-
260
- let t23;
261
-
262
- if ($[47] !== Icon) {
263
- t23 = /*#__PURE__*/React.createElement(Icon, {
264
- className: styles.icon,
265
- "data-render-all-sizes": true
266
- });
267
- $[47] = Icon;
268
- $[48] = t23;
269
- } else {
270
- t23 = $[48];
271
- }
272
-
273
- let t24;
274
-
275
- if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
276
- t24 = cn(styles.title);
277
- $[49] = t24;
278
- } else {
279
- t24 = $[49];
280
- }
281
-
282
- let t25;
283
-
284
- if ($[50] !== title) {
285
- t25 = /*#__PURE__*/React.createElement("span", {
286
- className: t24,
287
- "data-rs-internal": "collapse__title"
288
- }, title);
289
- $[50] = title;
290
- $[51] = t25;
291
- } else {
292
- t25 = $[51];
293
- }
294
-
295
- let t26;
296
-
297
- if ($[52] !== t23 || $[53] !== t25 || $[54] !== toggleOpened) {
298
- t26 = /*#__PURE__*/React.createElement("button", {
299
- type: "button",
300
- "data-test": "collapse__button",
301
- "data-rs-internal": "collapse__button",
302
- className: styles.button,
303
- onClick: toggleOpened
304
- }, t23, t25);
305
- $[52] = t23;
306
- $[53] = t25;
307
- $[54] = toggleOpened;
308
- $[55] = t26;
309
- } else {
310
- t26 = $[55];
311
- }
312
-
313
- const t27 = isOpening || isStartedClosing ? height : null;
314
- let t28;
315
-
316
- if ($[56] !== t27) {
317
- t28 = {
318
- height: t27
319
- };
320
- $[56] = t27;
321
- $[57] = t28;
322
- } else {
323
- t28 = $[57];
324
- }
325
-
326
- let t29;
327
-
328
- if ($[58] !== children) {
329
- t29 = /*#__PURE__*/React.createElement("div", {
330
- ref: resizeRef,
331
- className: styles.innerWrapper
332
- }, children);
333
- $[58] = children;
334
- $[59] = t29;
335
- } else {
336
- t29 = $[59];
337
- }
338
-
339
- let t30;
340
-
341
- if ($[60] !== contentRef || $[61] !== handleTransitionEnd || $[62] !== t28 || $[63] !== t29) {
342
- t30 = /*#__PURE__*/React.createElement("div", {
343
- className: styles.content,
344
- "data-rs-internal": "collapse__content",
345
- style: t28,
346
- ref: contentRef,
347
- onTransitionEnd: handleTransitionEnd,
348
- tabIndex: -1
349
- }, t29);
350
- $[60] = contentRef;
351
- $[61] = handleTransitionEnd;
352
- $[62] = t28;
353
- $[63] = t29;
354
- $[64] = t30;
355
- } else {
356
- t30 = $[64];
357
- }
358
-
359
- let t31;
360
-
361
- if ($[65] !== ref || $[66] !== restProps || $[67] !== t22 || $[68] !== t26 || $[69] !== t30) {
362
- t31 = /*#__PURE__*/React.createElement("div", _extends({
363
- "data-test": "collapse"
364
- }, restProps, {
365
- className: t22,
366
- "data-rs-internal": "collapse__collapse",
367
- ref: ref
368
- }), t26, t30);
369
- $[65] = ref;
370
- $[66] = restProps;
371
- $[67] = t22;
372
- $[68] = t26;
373
- $[69] = t30;
374
- $[70] = t31;
375
- } else {
376
- t31 = $[70];
377
- }
378
-
379
- return t31;
109
+ const isRightIcon = icon === 'right-plus';
110
+ const Icon = icon === 'arrow' ? RightIcon : PlusIcon;
111
+
112
+ const toggleOpened = () => {
113
+ if (toggleActiveKey) {
114
+ toggleActiveKey(key);
115
+ } // this state update does nothing in accordion
116
+
117
+
118
+ setShouldBeOpenedLocal(!shouldBeOpened);
119
+ };
120
+
121
+ return /*#__PURE__*/React.createElement("div", {
122
+ "data-test": 'collapse',
123
+ ...restProps,
124
+ className: cn(className, styles.main, isAnimationEnabled && styles.animationEnabled, isOpening && styles.opening, isOpened && styles.opened, isClosing && styles.closing, isClosed && styles.closed, !isClosed && openedClassName, SIZE_STYLES[size], MODE_STYLES[mode], ICON_STYLES[icon], borderBottom && styles.hasBorderBottom, disableLeftPadding && styles.disableLeftPadding, isRightIcon ? styles.rightIcon : styles.leftIcon, THEME_STYLES[theme]),
125
+ "data-rs-internal": "collapse__collapse",
126
+ ref: ref
127
+ }, /*#__PURE__*/React.createElement("button", {
128
+ type: "button",
129
+ "data-test": 'collapse__button',
130
+ "data-rs-internal": "collapse__button",
131
+ className: styles.button,
132
+ onClick: toggleOpened
133
+ }, /*#__PURE__*/React.createElement(Icon, {
134
+ className: styles.icon,
135
+ "data-render-all-sizes": true
136
+ }), /*#__PURE__*/React.createElement("span", {
137
+ className: cn(styles.title),
138
+ "data-rs-internal": "collapse__title"
139
+ }, title)), /*#__PURE__*/React.createElement("div", {
140
+ className: styles.content,
141
+ "data-rs-internal": "collapse__content",
142
+ ref: contentRef,
143
+ tabIndex: -1
144
+ }, /*#__PURE__*/React.createElement("div", {
145
+ className: styles.innerWrapper
146
+ }, children)));
380
147
  });
381
148
  Collapse.displayName = 'Collapse';
382
149
  Collapse.propTypes = {