@gustavo-valsechi/client 1.3.63 → 1.4.1

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.
@@ -47,7 +47,7 @@ function Avatar(props) {
47
47
  }, [color, props.name]);
48
48
  const name = () => {
49
49
  const [first, secound] = import_lodash.default.split(props.name, " ") || [];
50
- if (first && secound) return `${first.substring(0, 1)} ${secound.substring(0, 1)}`;
50
+ if (first && secound) return `${first.substring(0, 1)}${secound.substring(0, 1)}`;
51
51
  if (first) return first.substring(0, 1);
52
52
  return "IZ";
53
53
  };
@@ -14,7 +14,7 @@ function Avatar(props) {
14
14
  }, [color, props.name]);
15
15
  const name = () => {
16
16
  const [first, secound] = _.split(props.name, " ") || [];
17
- if (first && secound) return `${first.substring(0, 1)} ${secound.substring(0, 1)}`;
17
+ if (first && secound) return `${first.substring(0, 1)}${secound.substring(0, 1)}`;
18
18
  if (first) return first.substring(0, 1);
19
19
  return "IZ";
20
20
  };
@@ -41,7 +41,7 @@ const Container = import_styled_components.default.div`
41
41
  padding: 1.3rem 1.5rem;
42
42
  border-radius: 5px;
43
43
  background: ${({ theme }) => theme.t05};
44
- flex: 1 1 20rem;
44
+ flex: 1 1;
45
45
 
46
46
  header {
47
47
  display: flex;
@@ -7,7 +7,7 @@ const Container = styled.div`
7
7
  padding: 1.3rem 1.5rem;
8
8
  border-radius: 5px;
9
9
  background: ${({ theme }) => theme.t05};
10
- flex: 1 1 20rem;
10
+ flex: 1 1;
11
11
 
12
12
  header {
13
13
  display: flex;
@@ -60,7 +60,8 @@ function Table(props) {
60
60
  const columnName = !import_lodash.default.isString(column) ? props.options.length - 1 === index ? "actions" : "" : column;
61
61
  content[columnName] = columnName === "actions" ? (_b2 = data.row) == null ? void 0 : _b2.actions : renderRowContainer(props.content[key], data);
62
62
  });
63
- modal.setProps("table", { toggle: true, content });
63
+ modal.toggle("table");
64
+ modal.setProps("table", { content });
64
65
  };
65
66
  const renderRowContainer = (data, option) => {
66
67
  var _a2, _b2, _c2, _d2;
@@ -26,7 +26,8 @@ function Table(props) {
26
26
  const columnName = !_.isString(column) ? props.options.length - 1 === index ? "actions" : "" : column;
27
27
  content[columnName] = columnName === "actions" ? (_b2 = data.row) == null ? void 0 : _b2.actions : renderRowContainer(props.content[key], data);
28
28
  });
29
- modal.setProps("table", { toggle: true, content });
29
+ modal.toggle("table");
30
+ modal.setProps("table", { content });
30
31
  };
31
32
  const renderRowContainer = (data, option) => {
32
33
  var _a2, _b2, _c2, _d2;
@@ -44,7 +44,7 @@ function Modal(props) {
44
44
  const content = import_lodash.default.omit(props.content, ["actions"]);
45
45
  const actions = Object.values(import_lodash.default.pick(props.content, ["actions"]))[0];
46
46
  const onClose = () => {
47
- modal.setProps("table", { toggle: false });
47
+ modal.toggle("table");
48
48
  };
49
49
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
50
  import__.Component,
@@ -11,7 +11,7 @@ function Modal(props) {
11
11
  const content = _.omit(props.content, ["actions"]);
12
12
  const actions = Object.values(_.pick(props.content, ["actions"]))[0];
13
13
  const onClose = () => {
14
- modal.setProps("table", { toggle: false });
14
+ modal.toggle("table");
15
15
  };
16
16
  return /* @__PURE__ */ jsx(
17
17
  Component,
@@ -64,6 +64,12 @@ const ModalProviderContainer = ({ children }) => {
64
64
  settedModals.splice(index, 1, { ...content, props: { ...content.props, ...props } });
65
65
  setModals(settedModals);
66
66
  };
67
+ const toggle = (modalName) => {
68
+ var _a;
69
+ const content = import_lodash.default.find(modals, (modal) => modal.name === modalName);
70
+ if (!content) return;
71
+ setProps(modalName, { toggle: !((_a = content == null ? void 0 : content.props) == null ? void 0 : _a.toggle) });
72
+ };
67
73
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
68
74
  ModalContext.Provider,
69
75
  {
@@ -71,7 +77,8 @@ const ModalProviderContainer = ({ children }) => {
71
77
  value: modals,
72
78
  add,
73
79
  remove,
74
- setProps
80
+ setProps,
81
+ toggle
75
82
  },
76
83
  children: [
77
84
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { children: import_lodash.default.map(modals, (modal, index) => {
@@ -30,6 +30,12 @@ const ModalProviderContainer = ({ children }) => {
30
30
  settedModals.splice(index, 1, { ...content, props: { ...content.props, ...props } });
31
31
  setModals(settedModals);
32
32
  };
33
+ const toggle = (modalName) => {
34
+ var _a;
35
+ const content = _.find(modals, (modal) => modal.name === modalName);
36
+ if (!content) return;
37
+ setProps(modalName, { toggle: !((_a = content == null ? void 0 : content.props) == null ? void 0 : _a.toggle) });
38
+ };
33
39
  return /* @__PURE__ */ jsxs(
34
40
  ModalContext.Provider,
35
41
  {
@@ -37,7 +43,8 @@ const ModalProviderContainer = ({ children }) => {
37
43
  value: modals,
38
44
  add,
39
45
  remove,
40
- setProps
46
+ setProps,
47
+ toggle
41
48
  },
42
49
  children: [
43
50
  /* @__PURE__ */ jsx(Container, { children: _.map(modals, (modal, index) => {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { IButton } from "@interfaces";
3
3
  export interface IModal {
4
- toggle: boolean;
4
+ toggle?: boolean;
5
5
  onClose?: () => void;
6
6
  title?: string;
7
7
  header?: {
@@ -13,4 +13,5 @@ export interface IModalContext {
13
13
  add: (value: IModalConfig) => void;
14
14
  remove: (modalName: string) => void;
15
15
  setProps: (modalName: string, props: IModal) => void;
16
+ toggle: (modalName: string) => void;
16
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.3.63",
3
+ "version": "1.4.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",