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.cjs
CHANGED
@@ -9624,6 +9624,79 @@ var TableAPI = function TableAPI(url, host) {
|
|
9624
9624
|
};
|
9625
9625
|
};
|
9626
9626
|
|
9627
|
+
var Wizard = function Wizard(props) {
|
9628
|
+
var _props$init = props.init,
|
9629
|
+
init = _props$init === void 0 ? 0 : _props$init,
|
9630
|
+
onClose = props.onClose,
|
9631
|
+
children = props.children;
|
9632
|
+
|
9633
|
+
var _useState = React.useState(init),
|
9634
|
+
_useState$ = _useState[0],
|
9635
|
+
current = _useState$ === void 0 ? 0 : _useState$,
|
9636
|
+
setCurrent = _useState[1];
|
9637
|
+
|
9638
|
+
var steps = React__default["default"].Children.toArray(children);
|
9639
|
+
var stepRef = React.useRef();
|
9640
|
+
|
9641
|
+
function prev() {
|
9642
|
+
if (current > 0) setCurrent(current - 1);
|
9643
|
+
}
|
9644
|
+
|
9645
|
+
function next() {
|
9646
|
+
stepRef.current.onComplete(function () {
|
9647
|
+
setCurrent(current + 1);
|
9648
|
+
});
|
9649
|
+
}
|
9650
|
+
|
9651
|
+
function finish() {
|
9652
|
+
stepRef.current.onComplete(function () {
|
9653
|
+
if (onClose) onClose();
|
9654
|
+
});
|
9655
|
+
}
|
9656
|
+
|
9657
|
+
var currentStep = React.useMemo(function () {
|
9658
|
+
return React__default["default"].cloneElement(steps[current], {
|
9659
|
+
ref: stepRef
|
9660
|
+
});
|
9661
|
+
}, [current]);
|
9662
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
9663
|
+
className: "wizard"
|
9664
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
9665
|
+
className: "wizard-steps"
|
9666
|
+
}, steps.map(function (step, index) {
|
9667
|
+
var active = index === current;
|
9668
|
+
var done = index < current;
|
9669
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
9670
|
+
key: index,
|
9671
|
+
className: "wizard-step"
|
9672
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
9673
|
+
className: "wizard-step-icon"
|
9674
|
+
}, done && /*#__PURE__*/React__default["default"].createElement(Icon, {
|
9675
|
+
icon: "check"
|
9676
|
+
}), active && /*#__PURE__*/React__default["default"].createElement(Icon, {
|
9677
|
+
icon: "play_arrow"
|
9678
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9679
|
+
className: "wizard-step-label"
|
9680
|
+
}, step.props.label));
|
9681
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9682
|
+
className: "wizard-content"
|
9683
|
+
}, currentStep), /*#__PURE__*/React__default["default"].createElement("div", {
|
9684
|
+
className: "wizard-actions"
|
9685
|
+
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
9686
|
+
label: "Anterior",
|
9687
|
+
disabled: current === 0,
|
9688
|
+
action: prev
|
9689
|
+
}), current < steps.length - 1 ? /*#__PURE__*/React__default["default"].createElement(Button, {
|
9690
|
+
label: "Siguiente",
|
9691
|
+
disabled: current === steps.length - 1,
|
9692
|
+
action: next
|
9693
|
+
}) : /*#__PURE__*/React__default["default"].createElement(Button, {
|
9694
|
+
label: "Finalizar",
|
9695
|
+
action: finish,
|
9696
|
+
raised: true
|
9697
|
+
})));
|
9698
|
+
};
|
9699
|
+
|
9627
9700
|
var isFunction = function isFunction(value) {
|
9628
9701
|
return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
|
9629
9702
|
};
|
@@ -9713,5 +9786,6 @@ exports.Uploader = Uploader;
|
|
9713
9786
|
exports.View = View;
|
9714
9787
|
exports.Viewer = Viewer;
|
9715
9788
|
exports.WaitScreen = WaitScreen;
|
9789
|
+
exports.Wizard = Wizard;
|
9716
9790
|
exports.isFunction = isFunction;
|
9717
9791
|
//# sourceMappingURL=index.cjs.map
|