ywana-core8 0.0.662 → 0.0.664
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 +27 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +27 -20
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +27 -20
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/incubator/wizard.js +13 -7
- package/src/incubator/wizard.test.js +85 -8
package/dist/index.modern.js
CHANGED
@@ -9670,23 +9670,43 @@ var Wizard = function Wizard(props) {
|
|
9670
9670
|
current = _useState2$ === void 0 ? 0 : _useState2$,
|
9671
9671
|
setCurrent = _useState2[1];
|
9672
9672
|
|
9673
|
+
var _useState3 = useState(true),
|
9674
|
+
valid = _useState3[0],
|
9675
|
+
setValid = _useState3[1];
|
9676
|
+
|
9673
9677
|
var steps = React.Children.toArray(children);
|
9674
9678
|
var stepRef = useRef();
|
9675
9679
|
|
9680
|
+
function validate(form, isValid) {
|
9681
|
+
setValid(isValid);
|
9682
|
+
}
|
9683
|
+
|
9676
9684
|
function prev() {
|
9677
9685
|
if (current > 0) setCurrent(current - 1);
|
9678
9686
|
}
|
9679
9687
|
|
9680
|
-
var currentStep =
|
9681
|
-
|
9682
|
-
|
9683
|
-
|
9684
|
-
|
9688
|
+
var currentStep = React.cloneElement(steps[current], {
|
9689
|
+
ref: stepRef,
|
9690
|
+
onChange: validate
|
9691
|
+
});
|
9692
|
+
var nextButton = current < steps.length - 1 ? /*#__PURE__*/React.createElement(Button, {
|
9693
|
+
label: "Siguiented",
|
9694
|
+
action: next,
|
9695
|
+
raised: true,
|
9696
|
+
disabled: !valid
|
9697
|
+
}) : /*#__PURE__*/React.createElement(Button, {
|
9698
|
+
label: "Finish",
|
9699
|
+
action: finish
|
9700
|
+
});
|
9701
|
+
var prevButton = current > 0 ? /*#__PURE__*/React.createElement(Button, {
|
9702
|
+
label: "Atr\xE1s",
|
9703
|
+
action: prev
|
9704
|
+
}) : null;
|
9685
9705
|
return /*#__PURE__*/React.createElement(WizardProvider, {
|
9686
9706
|
form: form
|
9687
9707
|
}, /*#__PURE__*/React.createElement("div", {
|
9688
9708
|
className: "wizard"
|
9689
|
-
}, /*#__PURE__*/React.createElement("div", {
|
9709
|
+
}, current, /*#__PURE__*/React.createElement("div", {
|
9690
9710
|
className: "wizard-steps"
|
9691
9711
|
}, steps.map(function (step, index) {
|
9692
9712
|
var active = index === current;
|
@@ -9707,20 +9727,7 @@ var Wizard = function Wizard(props) {
|
|
9707
9727
|
className: "wizard-content"
|
9708
9728
|
}, currentStep), /*#__PURE__*/React.createElement("div", {
|
9709
9729
|
className: "wizard-actions"
|
9710
|
-
}, /*#__PURE__*/React.createElement(
|
9711
|
-
label: "Anterior",
|
9712
|
-
disabled: current === 0,
|
9713
|
-
action: prev
|
9714
|
-
}), current < steps.length - 1 ? /*#__PURE__*/React.createElement(Button, {
|
9715
|
-
label: "Siguiente",
|
9716
|
-
disabled: stepRef.current && stepRef.current.isValid(),
|
9717
|
-
action: next
|
9718
|
-
}) : /*#__PURE__*/React.createElement(Button, {
|
9719
|
-
label: "Finalizar",
|
9720
|
-
disabled: stepRef.current && stepRef.current.isValid(),
|
9721
|
-
action: finish,
|
9722
|
-
raised: true
|
9723
|
-
}))));
|
9730
|
+
}, prevButton, /*#__PURE__*/React.createElement("div", null), nextButton)));
|
9724
9731
|
};
|
9725
9732
|
|
9726
9733
|
var isFunction = function isFunction(value) {
|