@gustavo-valsechi/client 1.3.61 → 1.3.63

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.
@@ -41,14 +41,14 @@ function Avatar(props) {
41
41
  const containerRef = (0, import_react.useRef)({});
42
42
  const [color, setColor] = (0, import_react.useState)("");
43
43
  (0, import_react.useEffect)(() => {
44
- if (color || !props.name) return;
45
- const random = (0, import_randomcolor.default)({ luminosity: "light", seed: props.name });
44
+ if (color) return;
45
+ const random = (0, import_randomcolor.default)({ luminosity: "light", seed: props.name || "Default" });
46
46
  setColor(random);
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} ${secound}`;
51
- if (first) return first;
50
+ if (first && secound) return `${first.substring(0, 1)} ${secound.substring(0, 1)}`;
51
+ if (first) return first.substring(0, 1);
52
52
  return "IZ";
53
53
  };
54
54
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -8,14 +8,14 @@ function Avatar(props) {
8
8
  const containerRef = useRef({});
9
9
  const [color, setColor] = useState("");
10
10
  useEffect(() => {
11
- if (color || !props.name) return;
12
- const random = randomColor({ luminosity: "light", seed: props.name });
11
+ if (color) return;
12
+ const random = randomColor({ luminosity: "light", seed: props.name || "Default" });
13
13
  setColor(random);
14
14
  }, [color, props.name]);
15
15
  const name = () => {
16
16
  const [first, secound] = _.split(props.name, " ") || [];
17
- if (first && secound) return `${first} ${secound}`;
18
- if (first) return first;
17
+ if (first && secound) return `${first.substring(0, 1)} ${secound.substring(0, 1)}`;
18
+ if (first) return first.substring(0, 1);
19
19
  return "IZ";
20
20
  };
21
21
  return /* @__PURE__ */ jsx(
@@ -43,8 +43,8 @@ var import_registry = __toESM(require("../../contexts/theme/registry"));
43
43
  var import_global = __toESM(require("./global.styles"));
44
44
  const ThemeContext = (0, import_react.createContext)({});
45
45
  const ThemeProviderContainer = (props) => {
46
- const [theme, setTheme] = (0, import_react.useState)("light");
47
46
  const [defaultTheme] = (0, import_react.useState)("light");
47
+ const [theme, setTheme] = (0, import_react.useState)(props.theme || defaultTheme);
48
48
  (0, import_react.useEffect)(() => {
49
49
  if (!theme) return;
50
50
  (async () => await (0, import_tools.setStorage)(process.env.NEXT_PUBLIC_STORAGE_THEME, theme))();
@@ -67,12 +67,12 @@ const ThemeProviderContainer = (props) => {
67
67
  ThemeContext.Provider,
68
68
  {
69
69
  value: {
70
- theme: props.theme || defaultTheme,
70
+ theme: theme || defaultTheme,
71
71
  setTheme,
72
- content: import_content.Themes[props.theme || defaultTheme],
72
+ content: import_content.Themes[theme || defaultTheme],
73
73
  Switcher: SwitcherComponent
74
74
  },
75
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_registry.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled_components.ThemeProvider, { theme: import_content.Themes[props.theme || defaultTheme], children: [
75
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_registry.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled_components.ThemeProvider, { theme: import_content.Themes[theme || defaultTheme], children: [
76
76
  props.children,
77
77
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_global.default, {})
78
78
  ] }) })
@@ -9,8 +9,8 @@ import StyledComponentsRegistry from "../../contexts/theme/registry";
9
9
  import GlobalStyles from "./global.styles";
10
10
  const ThemeContext = createContext({});
11
11
  const ThemeProviderContainer = (props) => {
12
- const [theme, setTheme] = useState("light");
13
12
  const [defaultTheme] = useState("light");
13
+ const [theme, setTheme] = useState(props.theme || defaultTheme);
14
14
  useEffect(() => {
15
15
  if (!theme) return;
16
16
  (async () => await setStorage(process.env.NEXT_PUBLIC_STORAGE_THEME, theme))();
@@ -33,12 +33,12 @@ const ThemeProviderContainer = (props) => {
33
33
  ThemeContext.Provider,
34
34
  {
35
35
  value: {
36
- theme: props.theme || defaultTheme,
36
+ theme: theme || defaultTheme,
37
37
  setTheme,
38
- content: Themes[props.theme || defaultTheme],
38
+ content: Themes[theme || defaultTheme],
39
39
  Switcher: SwitcherComponent
40
40
  },
41
- children: /* @__PURE__ */ jsx(StyledComponentsRegistry, { children: /* @__PURE__ */ jsxs(ThemeProvider, { theme: Themes[props.theme || defaultTheme], children: [
41
+ children: /* @__PURE__ */ jsx(StyledComponentsRegistry, { children: /* @__PURE__ */ jsxs(ThemeProvider, { theme: Themes[theme || defaultTheme], children: [
42
42
  props.children,
43
43
  /* @__PURE__ */ jsx(GlobalStyles, {})
44
44
  ] }) })
@@ -1,6 +1,6 @@
1
1
  import { IBaseProvider } from "../..";
2
2
  export interface IThemeProvider extends IBaseProvider {
3
- theme?: string;
3
+ theme?: keyof ITheme;
4
4
  }
5
5
  export interface ICommonTheme {
6
6
  secondary: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.3.61",
3
+ "version": "1.3.63",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",