ywana-core8 0.0.580 → 0.0.581
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/dist/index.cjs +13 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +14 -7
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +13 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/accordion.js +10 -3
package/dist/index.cjs
CHANGED
@@ -206,18 +206,25 @@ var Accordion = function Accordion(props) {
|
|
206
206
|
sections = _props$sections === void 0 ? [] : _props$sections,
|
207
207
|
onCheck = props.onCheck;
|
208
208
|
|
209
|
-
var _useState = React.useState(
|
210
|
-
return section.open;
|
211
|
-
})),
|
209
|
+
var _useState = React.useState([]),
|
212
210
|
openSections = _useState[0],
|
213
211
|
setOpenSections = _useState[1];
|
214
212
|
|
215
|
-
var _useState2 = React.useState(
|
216
|
-
return section.checked;
|
217
|
-
})),
|
213
|
+
var _useState2 = React.useState([]),
|
218
214
|
checkedSections = _useState2[0],
|
219
215
|
setCheckedSections = _useState2[1];
|
220
216
|
|
217
|
+
React.useEffect(function () {
|
218
|
+
var openSections = sections.map(function (section) {
|
219
|
+
return section.open;
|
220
|
+
});
|
221
|
+
var checkedSections = sections.map(function (section) {
|
222
|
+
return section.checked;
|
223
|
+
});
|
224
|
+
setOpenSections(openSections);
|
225
|
+
setCheckedSections(checkedSections);
|
226
|
+
}, [sections]);
|
227
|
+
|
221
228
|
function toggle(index) {
|
222
229
|
var next = openSections.map(function (open, i) {
|
223
230
|
return i === index ? !open : open;
|