@rescui/collapse 0.8.2 → 0.8.4-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.10

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_18p83uf_4",
3
- "sizeXS": "_sizeXS_18p83uf_14",
4
- "sizeS": "_sizeS_18p83uf_18",
5
- "sizeM": "_sizeM_18p83uf_22",
6
- "sizeL": "_sizeL_18p83uf_26",
7
- "light": "_light_18p83uf_30",
8
- "dark": "_dark_18p83uf_34",
9
- "allVariants": "_allVariants_18p83uf_48",
10
- "variant16": "_variant16_18p83uf_53",
11
- "variant20": "_variant20_18p83uf_54",
12
- "variant24": "_variant24_18p83uf_55",
13
- "variant28": "_variant28_18p83uf_58"
2
+ "icon": "_icon_19upof9_4",
3
+ "sizeXS": "_sizeXS_19upof9_14",
4
+ "sizeS": "_sizeS_19upof9_18",
5
+ "sizeM": "_sizeM_19upof9_22",
6
+ "sizeL": "_sizeL_19upof9_26",
7
+ "light": "_light_19upof9_30",
8
+ "dark": "_dark_19upof9_34",
9
+ "allVariants": "_allVariants_19upof9_48",
10
+ "variant16": "_variant16_19upof9_53",
11
+ "variant20": "_variant20_19upof9_54",
12
+ "variant24": "_variant24_19upof9_55",
13
+ "variant28": "_variant28_19upof9_58"
14
14
  };
15
15
  export { styles as default };
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 = {