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.
@@ -9617,40 +9617,40 @@ var TableAPI = function TableAPI(url, host) {
9617
9617
  };
9618
9618
 
9619
9619
  var Wizard = function Wizard(props) {
9620
- var _props$steps = props.steps,
9621
- steps = _props$steps === void 0 ? [] : _props$steps,
9622
- _props$init = props.init,
9620
+ var _props$init = props.init,
9623
9621
  init = _props$init === void 0 ? 0 : _props$init,
9624
- onClose = props.onClose;
9622
+ onClose = props.onClose,
9623
+ children = props.children;
9625
9624
 
9626
9625
  var _useState = useState(init),
9627
9626
  _useState$ = _useState[0],
9628
9627
  current = _useState$ === void 0 ? 0 : _useState$,
9629
9628
  setCurrent = _useState[1];
9630
9629
 
9630
+ var steps = React.Children.toArray(children);
9631
+ var stepRef = useRef();
9632
+
9631
9633
  function prev() {
9632
9634
  if (current > 0) setCurrent(current - 1);
9633
9635
  }
9634
9636
 
9635
9637
  function next() {
9636
- var step = steps[current];
9637
-
9638
- if (step.onComplete) {
9639
- step.onComplete(function () {
9640
- setCurrent(current + 1);
9641
- });
9642
- } else {
9638
+ stepRef.current.onComplete(function () {
9643
9639
  setCurrent(current + 1);
9644
- }
9640
+ });
9645
9641
  }
9646
9642
 
9647
9643
  function finish() {
9648
- var step = steps[current];
9649
- if (step.onComplete) step.onComplete(function () {
9644
+ stepRef.current.onComplete(function () {
9650
9645
  if (onClose) onClose();
9651
9646
  });
9652
9647
  }
9653
9648
 
9649
+ var currentStep = useMemo(function () {
9650
+ return React.cloneElement(steps[current], {
9651
+ ref: stepRef
9652
+ });
9653
+ }, [current]);
9654
9654
  return /*#__PURE__*/React.createElement("div", {
9655
9655
  className: "wizard"
9656
9656
  }, /*#__PURE__*/React.createElement("div", {
@@ -9669,10 +9669,10 @@ var Wizard = function Wizard(props) {
9669
9669
  icon: "play_arrow"
9670
9670
  })), /*#__PURE__*/React.createElement("div", {
9671
9671
  className: "wizard-step-label"
9672
- }, step.label));
9672
+ }, step.props.label));
9673
9673
  })), /*#__PURE__*/React.createElement("div", {
9674
9674
  className: "wizard-content"
9675
- }, steps[current].content), /*#__PURE__*/React.createElement("div", {
9675
+ }, currentStep), /*#__PURE__*/React.createElement("div", {
9676
9676
  className: "wizard-actions"
9677
9677
  }, /*#__PURE__*/React.createElement(Button, {
9678
9678
  label: "Anterior",