@gustavo-valsechi/client 1.4.369 → 1.4.371

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.
@@ -70,11 +70,12 @@ const ModalProviderContainer = ({ children }) => {
70
70
  const index = import_lodash.default.findIndex(memory, (modal) => modal.name === modalName);
71
71
  const data = import_lodash.default.find(memory, (modal) => modal.name === modalName);
72
72
  if (!data) return;
73
+ const newProps = import_lodash.default.isFunction(props) ? props(data) : props;
73
74
  memory.splice(index, 1, {
74
75
  ...data,
75
76
  props: {
76
77
  ...data.props,
77
- ...props
78
+ ...newProps
78
79
  }
79
80
  });
80
81
  setModals([...memory]);
@@ -84,14 +85,15 @@ const ModalProviderContainer = ({ children }) => {
84
85
  const index = import_lodash.default.findIndex(memory, (modal) => modal.name === modalName);
85
86
  const data = import_lodash.default.find(memory, (modal) => modal.name === modalName);
86
87
  if (!data) return;
88
+ const newContent = import_lodash.default.isFunction(content) ? content(data) : content;
87
89
  memory.splice(index, 1, {
88
90
  ...data,
89
91
  props: {
90
92
  ...data.props,
91
93
  content: ((_a = data.props) == null ? void 0 : _a.content) ? {
92
94
  ...data.props.content,
93
- ...content
94
- } : content
95
+ ...newContent
96
+ } : newContent
95
97
  }
96
98
  });
97
99
  setModals([...memory]);
@@ -36,11 +36,12 @@ const ModalProviderContainer = ({ children }) => {
36
36
  const index = _.findIndex(memory, (modal) => modal.name === modalName);
37
37
  const data = _.find(memory, (modal) => modal.name === modalName);
38
38
  if (!data) return;
39
+ const newProps = _.isFunction(props) ? props(data) : props;
39
40
  memory.splice(index, 1, {
40
41
  ...data,
41
42
  props: {
42
43
  ...data.props,
43
- ...props
44
+ ...newProps
44
45
  }
45
46
  });
46
47
  setModals([...memory]);
@@ -50,14 +51,15 @@ const ModalProviderContainer = ({ children }) => {
50
51
  const index = _.findIndex(memory, (modal) => modal.name === modalName);
51
52
  const data = _.find(memory, (modal) => modal.name === modalName);
52
53
  if (!data) return;
54
+ const newContent = _.isFunction(content) ? content(data) : content;
53
55
  memory.splice(index, 1, {
54
56
  ...data,
55
57
  props: {
56
58
  ...data.props,
57
59
  content: ((_a = data.props) == null ? void 0 : _a.content) ? {
58
60
  ...data.props.content,
59
- ...content
60
- } : content
61
+ ...newContent
62
+ } : newContent
61
63
  }
62
64
  });
63
65
  setModals([...memory]);
@@ -1,13 +1,10 @@
1
1
  export interface ICreditCard {
2
2
  cvc?: string;
3
3
  cardholder: string;
4
- lastNumber: string;
5
4
  number: string;
6
5
  expiry: string;
7
- validityMonth: string;
8
- validityYear: string;
9
- flag: string;
10
- flagIcon: string;
6
+ flag?: string;
7
+ flagIcon?: string;
11
8
  onSetFlag?: (content: {
12
9
  flag: string;
13
10
  logo: string;
@@ -10,7 +10,11 @@ export interface IModalConfig {
10
10
  export interface IModalContext {
11
11
  add: (config: IModalConfig | IModalConfig[]) => void;
12
12
  remove: (modalName: string | string[]) => void;
13
- setProps: (modalName: string, props: IModal) => void;
14
- setContent: (modalName: string, props: IModal) => void;
13
+ setProps: (modalName: string, props: IModal | ((props: IModal) => object)) => void;
14
+ setContent: (modalName: string, content: {
15
+ [key: string]: any;
16
+ } | ((props: IModal) => {
17
+ [key: string]: any;
18
+ })) => void;
15
19
  toggle: (modalName: string) => void;
16
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.369",
3
+ "version": "1.4.371",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",