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

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_3sp1p2_4",
3
+ "sizeXS": "_sizeXS_3sp1p2_14",
4
+ "sizeS": "_sizeS_3sp1p2_18",
5
+ "sizeM": "_sizeM_3sp1p2_22",
6
+ "sizeL": "_sizeL_3sp1p2_26",
7
+ "light": "_light_3sp1p2_30",
8
+ "dark": "_dark_3sp1p2_34",
9
+ "allVariants": "_allVariants_3sp1p2_48",
10
+ "variant16": "_variant16_3sp1p2_53",
11
+ "variant20": "_variant20_3sp1p2_54",
12
+ "variant24": "_variant24_3sp1p2_55",
13
+ "variant28": "_variant28_3sp1p2_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 = {