@rescui/collapse 0.8.3 → 0.8.4-RUI-297-Add-react-compiler-to-the-packages-build-f15074a13.11
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.
- package/lib/_virtual/index.css.js +12 -12
- package/lib/accordion.js +155 -34
- package/lib/collapse.js +324 -101
- package/lib/collapse.p.module.css.js +32 -32
- package/lib/index.css +73 -73
- package/lib/use-collapse-state.d.ts +7 -6
- package/lib/use-collapse-state.js +160 -43
- package/lib/use-safe-id.d.ts +3 -0
- package/lib/use-safe-id.js +10 -0
- package/package.json +11 -10
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"icon": "
|
|
3
|
-
"sizeXS": "
|
|
4
|
-
"sizeS": "
|
|
5
|
-
"sizeM": "
|
|
6
|
-
"sizeL": "
|
|
7
|
-
"light": "
|
|
8
|
-
"dark": "
|
|
9
|
-
"allVariants": "
|
|
10
|
-
"variant16": "
|
|
11
|
-
"variant20": "
|
|
12
|
-
"variant24": "
|
|
13
|
-
"variant28": "
|
|
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"
|
|
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
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
42
|
-
|
|
100
|
+
if (onChange) {
|
|
101
|
+
onChange(activatingKey);
|
|
102
|
+
}
|
|
43
103
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
104
|
+
setActiveKey(activatingKey);
|
|
105
|
+
};
|
|
47
106
|
|
|
48
|
-
|
|
49
|
-
|
|
107
|
+
$[14] = onChange;
|
|
108
|
+
$[15] = openKey;
|
|
109
|
+
$[16] = t7;
|
|
110
|
+
} else {
|
|
111
|
+
t7 = $[16];
|
|
112
|
+
}
|
|
50
113
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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 = {
|