ywana-core8 0.0.654 → 0.0.655
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 +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +16 -16
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +16 -16
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/incubator/wizard.js +16 -12
- package/src/incubator/wizard.test.js +25 -9
package/dist/index.umd.js
CHANGED
@@ -9619,40 +9619,40 @@
|
|
9619
9619
|
};
|
9620
9620
|
|
9621
9621
|
var Wizard = function Wizard(props) {
|
9622
|
-
var _props$
|
9623
|
-
steps = _props$steps === void 0 ? [] : _props$steps,
|
9624
|
-
_props$init = props.init,
|
9622
|
+
var _props$init = props.init,
|
9625
9623
|
init = _props$init === void 0 ? 0 : _props$init,
|
9626
|
-
onClose = props.onClose
|
9624
|
+
onClose = props.onClose,
|
9625
|
+
children = props.children;
|
9627
9626
|
|
9628
9627
|
var _useState = React.useState(init),
|
9629
9628
|
_useState$ = _useState[0],
|
9630
9629
|
current = _useState$ === void 0 ? 0 : _useState$,
|
9631
9630
|
setCurrent = _useState[1];
|
9632
9631
|
|
9632
|
+
var steps = React__default["default"].Children.toArray(children);
|
9633
|
+
var stepRef = React.useRef();
|
9634
|
+
|
9633
9635
|
function prev() {
|
9634
9636
|
if (current > 0) setCurrent(current - 1);
|
9635
9637
|
}
|
9636
9638
|
|
9637
9639
|
function next() {
|
9638
|
-
|
9639
|
-
|
9640
|
-
if (step.onComplete) {
|
9641
|
-
step.onComplete(function () {
|
9642
|
-
setCurrent(current + 1);
|
9643
|
-
});
|
9644
|
-
} else {
|
9640
|
+
stepRef.current.onComplete(function () {
|
9645
9641
|
setCurrent(current + 1);
|
9646
|
-
}
|
9642
|
+
});
|
9647
9643
|
}
|
9648
9644
|
|
9649
9645
|
function finish() {
|
9650
|
-
|
9651
|
-
if (step.onComplete) step.onComplete(function () {
|
9646
|
+
stepRef.current.onComplete(function () {
|
9652
9647
|
if (onClose) onClose();
|
9653
9648
|
});
|
9654
9649
|
}
|
9655
9650
|
|
9651
|
+
var currentStep = React.useMemo(function () {
|
9652
|
+
return React__default["default"].cloneElement(steps[current], {
|
9653
|
+
ref: stepRef
|
9654
|
+
});
|
9655
|
+
}, [current]);
|
9656
9656
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
9657
9657
|
className: "wizard"
|
9658
9658
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -9671,10 +9671,10 @@
|
|
9671
9671
|
icon: "play_arrow"
|
9672
9672
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9673
9673
|
className: "wizard-step-label"
|
9674
|
-
}, step.label));
|
9674
|
+
}, step.props.label));
|
9675
9675
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9676
9676
|
className: "wizard-content"
|
9677
|
-
},
|
9677
|
+
}, currentStep), /*#__PURE__*/React__default["default"].createElement("div", {
|
9678
9678
|
className: "wizard-actions"
|
9679
9679
|
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
9680
9680
|
label: "Anterior",
|