@cloudtower/eagle 0.28.0-alpha.1 → 0.28.0-alpha.2

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.
@@ -5,6 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var index = require('../../store/index.js');
6
6
  var React = require('react');
7
7
  var reactRedux = require('react-redux');
8
+ var redux = require('redux');
9
+ var modal = require('../../store/modal.js');
8
10
 
9
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
12
 
@@ -16,12 +18,51 @@ const ctx = React.createContext({
16
18
  });
17
19
  const KitStoreProvider = (props) => {
18
20
  const { children } = props;
19
- return /* @__PURE__ */ React__default.default.createElement(reactRedux.Provider, { context: ctx, store: index.UIKitStore }, children);
21
+ const [store] = React.useState(redux.createStore(index.rootReducer));
22
+ return /* @__PURE__ */ React__default.default.createElement(reactRedux.Provider, { context: ctx, store }, children);
20
23
  };
21
24
  var KitStoreProvider$1 = KitStoreProvider;
22
25
  const useKitDispatch = reactRedux.createDispatchHook(ctx);
23
26
  const useKitSelector = reactRedux.createSelectorHook(ctx);
27
+ const usePushModal = () => {
28
+ const dispatch = useKitDispatch();
29
+ const pushModal = React.useCallback(
30
+ (modal$1) => {
31
+ dispatch({
32
+ type: modal.ModalActions.PUSH_MODAL,
33
+ payload: modal$1
34
+ });
35
+ },
36
+ [dispatch]
37
+ );
38
+ return pushModal;
39
+ };
40
+ const useCloseModal = () => {
41
+ const dispatch = useKitDispatch();
42
+ const closeModal = React.useCallback(
43
+ (id) => {
44
+ dispatch({
45
+ type: modal.ModalActions.CLOSE_MODAL,
46
+ id
47
+ });
48
+ },
49
+ [dispatch]
50
+ );
51
+ return closeModal;
52
+ };
53
+ const usePopModal = () => {
54
+ const dispatch = useKitDispatch();
55
+ const popModal = React.useCallback(() => {
56
+ dispatch({
57
+ type: modal.ModalActions.POP_MODAL
58
+ });
59
+ }, [dispatch]);
60
+ return popModal;
61
+ };
24
62
 
25
63
  exports.default = KitStoreProvider$1;
64
+ exports.useCloseModal = useCloseModal;
26
65
  exports.useKitDispatch = useKitDispatch;
27
66
  exports.useKitSelector = useKitSelector;
67
+ exports.usePopModal = usePopModal;
68
+ exports.usePushModal = usePushModal;
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('../KitStoreProvider/index.js');
4
- var index$1 = require('../../store/index.js');
5
4
  var React = require('react');
6
5
 
7
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -31,6 +30,7 @@ const ModalStack = () => {
31
30
  const stack = index.useKitSelector(
32
31
  (state) => state.modal.stack
33
32
  );
33
+ const closeModal = index.useCloseModal();
34
34
  return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, stack.map((modal) => /* @__PURE__ */ React__default.default.createElement(
35
35
  modal.component,
36
36
  __spreadProps(__spreadValues({}, modal.props), {
@@ -40,7 +40,7 @@ const ModalStack = () => {
40
40
  if ((_a = modal.props) == null ? void 0 : _a.onClose) {
41
41
  modal.props.onClose();
42
42
  }
43
- index$1.closeModal(modal.id);
43
+ closeModal(modal.id);
44
44
  },
45
45
  key: modal.id
46
46
  })
package/dist/cjs/index.js CHANGED
@@ -204,8 +204,11 @@ exports.AntdPasswordInputStyled = index$A.AntdPasswordInputStyled;
204
204
  exports.InputPassword = index$A.default;
205
205
  exports.InputTagItem = index$B;
206
206
  exports.KitStoreProvider = index$C.default;
207
+ exports.useCloseModal = index$C.useCloseModal;
207
208
  exports.useKitDispatch = index$C.useKitDispatch;
208
209
  exports.useKitSelector = index$C.useKitSelector;
210
+ exports.usePopModal = index$C.usePopModal;
211
+ exports.usePushModal = index$C.usePushModal;
209
212
  exports.Link = index$D;
210
213
  exports.Loading = index$E;
211
214
  exports.attachTypeApi = index$F.attachTypeApi;