ywana-core8 0.0.653 → 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 +74 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +30 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +74 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +74 -0
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/incubator/index.js +1 -0
- package/src/incubator/wizard.css +30 -0
- package/src/incubator/wizard.js +61 -0
- package/src/incubator/wizard.test.js +32 -0
- package/src/index.js +3 -0
package/dist/index.umd.js
CHANGED
@@ -9618,6 +9618,79 @@
|
|
9618
9618
|
};
|
9619
9619
|
};
|
9620
9620
|
|
9621
|
+
var Wizard = function Wizard(props) {
|
9622
|
+
var _props$init = props.init,
|
9623
|
+
init = _props$init === void 0 ? 0 : _props$init,
|
9624
|
+
onClose = props.onClose,
|
9625
|
+
children = props.children;
|
9626
|
+
|
9627
|
+
var _useState = React.useState(init),
|
9628
|
+
_useState$ = _useState[0],
|
9629
|
+
current = _useState$ === void 0 ? 0 : _useState$,
|
9630
|
+
setCurrent = _useState[1];
|
9631
|
+
|
9632
|
+
var steps = React__default["default"].Children.toArray(children);
|
9633
|
+
var stepRef = React.useRef();
|
9634
|
+
|
9635
|
+
function prev() {
|
9636
|
+
if (current > 0) setCurrent(current - 1);
|
9637
|
+
}
|
9638
|
+
|
9639
|
+
function next() {
|
9640
|
+
stepRef.current.onComplete(function () {
|
9641
|
+
setCurrent(current + 1);
|
9642
|
+
});
|
9643
|
+
}
|
9644
|
+
|
9645
|
+
function finish() {
|
9646
|
+
stepRef.current.onComplete(function () {
|
9647
|
+
if (onClose) onClose();
|
9648
|
+
});
|
9649
|
+
}
|
9650
|
+
|
9651
|
+
var currentStep = React.useMemo(function () {
|
9652
|
+
return React__default["default"].cloneElement(steps[current], {
|
9653
|
+
ref: stepRef
|
9654
|
+
});
|
9655
|
+
}, [current]);
|
9656
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
9657
|
+
className: "wizard"
|
9658
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
9659
|
+
className: "wizard-steps"
|
9660
|
+
}, steps.map(function (step, index) {
|
9661
|
+
var active = index === current;
|
9662
|
+
var done = index < current;
|
9663
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
9664
|
+
key: index,
|
9665
|
+
className: "wizard-step"
|
9666
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
9667
|
+
className: "wizard-step-icon"
|
9668
|
+
}, done && /*#__PURE__*/React__default["default"].createElement(Icon, {
|
9669
|
+
icon: "check"
|
9670
|
+
}), active && /*#__PURE__*/React__default["default"].createElement(Icon, {
|
9671
|
+
icon: "play_arrow"
|
9672
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9673
|
+
className: "wizard-step-label"
|
9674
|
+
}, step.props.label));
|
9675
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9676
|
+
className: "wizard-content"
|
9677
|
+
}, currentStep), /*#__PURE__*/React__default["default"].createElement("div", {
|
9678
|
+
className: "wizard-actions"
|
9679
|
+
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
9680
|
+
label: "Anterior",
|
9681
|
+
disabled: current === 0,
|
9682
|
+
action: prev
|
9683
|
+
}), current < steps.length - 1 ? /*#__PURE__*/React__default["default"].createElement(Button, {
|
9684
|
+
label: "Siguiente",
|
9685
|
+
disabled: current === steps.length - 1,
|
9686
|
+
action: next
|
9687
|
+
}) : /*#__PURE__*/React__default["default"].createElement(Button, {
|
9688
|
+
label: "Finalizar",
|
9689
|
+
action: finish,
|
9690
|
+
raised: true
|
9691
|
+
})));
|
9692
|
+
};
|
9693
|
+
|
9621
9694
|
var isFunction = function isFunction(value) {
|
9622
9695
|
return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
|
9623
9696
|
};
|
@@ -9707,6 +9780,7 @@
|
|
9707
9780
|
exports.View = View;
|
9708
9781
|
exports.Viewer = Viewer;
|
9709
9782
|
exports.WaitScreen = WaitScreen;
|
9783
|
+
exports.Wizard = Wizard;
|
9710
9784
|
exports.isFunction = isFunction;
|
9711
9785
|
|
9712
9786
|
}));
|