ywana-core8 0.0.900 → 0.0.901

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.umd.js CHANGED
@@ -435,6 +435,43 @@
435
435
  action: click
436
436
  }) : null, /*#__PURE__*/React__default["default"].createElement(Text, null, label));
437
437
  };
438
+ var ActionButton = function ActionButton(props) {
439
+ var icon = props.icon,
440
+ _props$state = props.state,
441
+ state = _props$state === void 0 ? "normal" : _props$state,
442
+ action = props.action,
443
+ className = props.className;
444
+ var _useState = React.useState("normal"),
445
+ _state = _useState[0],
446
+ setState = _useState[1];
447
+ React.useEffect(function () {
448
+ setState(state);
449
+ }, [state]);
450
+ function activate() {
451
+ setState("running");
452
+ if (action) action();
453
+ }
454
+ var actionIcon = icon;
455
+ switch (_state) {
456
+ case "normal":
457
+ actionIcon = icon;
458
+ break;
459
+ case "running":
460
+ actionIcon = "rotate_right";
461
+ break;
462
+ case "success":
463
+ actionIcon = "task_alt";
464
+ break;
465
+ case "error":
466
+ actionIcon = "error";
467
+ break;
468
+ }
469
+ return /*#__PURE__*/React__default["default"].createElement(Button, _extends({}, props, {
470
+ icon: actionIcon,
471
+ action: activate,
472
+ className: className + " action-btn " + _state
473
+ }));
474
+ };
438
475
 
439
476
  /**
440
477
  * CheckBox
@@ -11141,6 +11178,7 @@
11141
11178
  };
11142
11179
 
11143
11180
  exports.Accordion = Accordion;
11181
+ exports.ActionButton = ActionButton;
11144
11182
  exports.Avatar = Avatar;
11145
11183
  exports.Button = Button;
11146
11184
  exports.Calendar = Calendar;