ywana-core8 0.0.900 → 0.0.902

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
@@ -436,6 +436,48 @@
436
436
  }) : null, /*#__PURE__*/React__default["default"].createElement(Text, null, label));
437
437
  };
438
438
 
439
+ /**
440
+ * Action Button
441
+ */
442
+ var ActionButton = function ActionButton(props) {
443
+ var execute = function execute() {
444
+ try {
445
+ var _temp = function () {
446
+ if (states[_state]) {
447
+ return Promise.resolve(states[_state].action()).then(function (newState) {
448
+ if (newState) setState(newState);
449
+ });
450
+ }
451
+ }();
452
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
453
+ } catch (e) {
454
+ return Promise.reject(e);
455
+ }
456
+ };
457
+ var states = props.states,
458
+ state = props.state,
459
+ className = props.className;
460
+ var _useState = React.useState(),
461
+ _state = _useState[0],
462
+ setState = _useState[1];
463
+ React.useEffect(function () {
464
+ setState(state);
465
+ }, [state]);
466
+ React.useEffect(function () {
467
+ if (states[_state] && states[_state].autoexec) execute();
468
+ }, [_state]);
469
+ if (!_state) return null;
470
+ var _states$_state = states[_state],
471
+ icon = _states$_state.icon,
472
+ label = _states$_state.label;
473
+ return /*#__PURE__*/React__default["default"].createElement(Button, _extends({}, props, {
474
+ icon: icon,
475
+ label: label,
476
+ action: execute,
477
+ className: className + " action-btn " + _state
478
+ }));
479
+ };
480
+
439
481
  /**
440
482
  * CheckBox
441
483
  */
@@ -11141,6 +11183,7 @@
11141
11183
  };
11142
11184
 
11143
11185
  exports.Accordion = Accordion;
11186
+ exports.ActionButton = ActionButton;
11144
11187
  exports.Avatar = Avatar;
11145
11188
  exports.Button = Button;
11146
11189
  exports.Calendar = Calendar;