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.cjs CHANGED
@@ -443,6 +443,48 @@ var Button = function Button(_ref) {
443
443
  }) : null, /*#__PURE__*/React__default["default"].createElement(Text, null, label));
444
444
  };
445
445
 
446
+ /**
447
+ * Action Button
448
+ */
449
+ var ActionButton = function ActionButton(props) {
450
+ var execute = function execute() {
451
+ try {
452
+ var _temp = function () {
453
+ if (states[_state]) {
454
+ return Promise.resolve(states[_state].action()).then(function (newState) {
455
+ if (newState) setState(newState);
456
+ });
457
+ }
458
+ }();
459
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
460
+ } catch (e) {
461
+ return Promise.reject(e);
462
+ }
463
+ };
464
+ var states = props.states,
465
+ state = props.state,
466
+ className = props.className;
467
+ var _useState = React.useState(),
468
+ _state = _useState[0],
469
+ setState = _useState[1];
470
+ React.useEffect(function () {
471
+ setState(state);
472
+ }, [state]);
473
+ React.useEffect(function () {
474
+ if (states[_state] && states[_state].autoexec) execute();
475
+ }, [_state]);
476
+ if (!_state) return null;
477
+ var _states$_state = states[_state],
478
+ icon = _states$_state.icon,
479
+ label = _states$_state.label;
480
+ return /*#__PURE__*/React__default["default"].createElement(Button, _extends({}, props, {
481
+ icon: icon,
482
+ label: label,
483
+ action: execute,
484
+ className: className + " action-btn " + _state
485
+ }));
486
+ };
487
+
446
488
  /**
447
489
  * CheckBox
448
490
  */
@@ -11148,6 +11190,7 @@ var isFunction = function isFunction(value) {
11148
11190
  };
11149
11191
 
11150
11192
  exports.Accordion = Accordion;
11193
+ exports.ActionButton = ActionButton;
11151
11194
  exports.Avatar = Avatar;
11152
11195
  exports.Button = Button;
11153
11196
  exports.Calendar = Calendar;