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.modern.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import 'material-design-icons-iconfont/dist/material-design-icons.css';
|
2
|
-
import React, { useState,
|
2
|
+
import React, { useState, useEffect, useContext, Fragment, useRef, useMemo, Children } from 'react';
|
3
3
|
import RSwitch from 'react-switch';
|
4
4
|
import moment$1 from 'moment';
|
5
5
|
import { extendMoment } from 'moment-range';
|
@@ -198,18 +198,25 @@ var Accordion = function Accordion(props) {
|
|
198
198
|
sections = _props$sections === void 0 ? [] : _props$sections,
|
199
199
|
onCheck = props.onCheck;
|
200
200
|
|
201
|
-
var _useState = useState(
|
202
|
-
return section.open;
|
203
|
-
})),
|
201
|
+
var _useState = useState([]),
|
204
202
|
openSections = _useState[0],
|
205
203
|
setOpenSections = _useState[1];
|
206
204
|
|
207
|
-
var _useState2 = useState(
|
208
|
-
return section.checked;
|
209
|
-
})),
|
205
|
+
var _useState2 = useState([]),
|
210
206
|
checkedSections = _useState2[0],
|
211
207
|
setCheckedSections = _useState2[1];
|
212
208
|
|
209
|
+
useEffect(function () {
|
210
|
+
var openSections = sections.map(function (section) {
|
211
|
+
return section.open;
|
212
|
+
});
|
213
|
+
var checkedSections = sections.map(function (section) {
|
214
|
+
return section.checked;
|
215
|
+
});
|
216
|
+
setOpenSections(openSections);
|
217
|
+
setCheckedSections(checkedSections);
|
218
|
+
}, [sections]);
|
219
|
+
|
213
220
|
function toggle(index) {
|
214
221
|
var next = openSections.map(function (open, i) {
|
215
222
|
return i === index ? !open : open;
|