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.cjs CHANGED
@@ -442,6 +442,43 @@ var Button = function Button(_ref) {
442
442
  action: click
443
443
  }) : null, /*#__PURE__*/React__default["default"].createElement(Text, null, label));
444
444
  };
445
+ var ActionButton = function ActionButton(props) {
446
+ var icon = props.icon,
447
+ _props$state = props.state,
448
+ state = _props$state === void 0 ? "normal" : _props$state,
449
+ action = props.action,
450
+ className = props.className;
451
+ var _useState = React.useState("normal"),
452
+ _state = _useState[0],
453
+ setState = _useState[1];
454
+ React.useEffect(function () {
455
+ setState(state);
456
+ }, [state]);
457
+ function activate() {
458
+ setState("running");
459
+ if (action) action();
460
+ }
461
+ var actionIcon = icon;
462
+ switch (_state) {
463
+ case "normal":
464
+ actionIcon = icon;
465
+ break;
466
+ case "running":
467
+ actionIcon = "rotate_right";
468
+ break;
469
+ case "success":
470
+ actionIcon = "task_alt";
471
+ break;
472
+ case "error":
473
+ actionIcon = "error";
474
+ break;
475
+ }
476
+ return /*#__PURE__*/React__default["default"].createElement(Button, _extends({}, props, {
477
+ icon: actionIcon,
478
+ action: activate,
479
+ className: className + " action-btn " + _state
480
+ }));
481
+ };
445
482
 
446
483
  /**
447
484
  * CheckBox
@@ -11148,6 +11185,7 @@ var isFunction = function isFunction(value) {
11148
11185
  };
11149
11186
 
11150
11187
  exports.Accordion = Accordion;
11188
+ exports.ActionButton = ActionButton;
11151
11189
  exports.Avatar = Avatar;
11152
11190
  exports.Button = Button;
11153
11191
  exports.Calendar = Calendar;