@gustavo-valsechi/client 1.3.51 → 1.3.53
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.
|
@@ -35,23 +35,16 @@ module.exports = __toCommonJS(avatar_exports);
|
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_styles = require("./styles");
|
|
38
|
-
var import_tools = require("@gustavo-valsechi/server/tools");
|
|
39
38
|
var import_randomcolor = __toESM(require("randomcolor"));
|
|
40
39
|
var import_lodash = __toESM(require("lodash"));
|
|
41
40
|
function Avatar(props) {
|
|
42
41
|
const containerRef = (0, import_react.useRef)({});
|
|
43
42
|
const [color, setColor] = (0, import_react.useState)("");
|
|
44
43
|
(0, import_react.useEffect)(() => {
|
|
45
|
-
if (color) return;
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (storageColor) return setColor(storageColor);
|
|
50
|
-
const random = (0, import_randomcolor.default)({ luminosity: "light" });
|
|
51
|
-
await (0, import_tools.setStorage)(storageKey, random);
|
|
52
|
-
setColor(random);
|
|
53
|
-
})();
|
|
54
|
-
}, [color]);
|
|
44
|
+
if (color || !props.name) return;
|
|
45
|
+
const random = (0, import_randomcolor.default)({ luminosity: "light", seed: props.name });
|
|
46
|
+
setColor(random);
|
|
47
|
+
}, [color, props.name]);
|
|
55
48
|
const name = () => {
|
|
56
49
|
const [first, secound] = import_lodash.default.split(props.name, " ") || [];
|
|
57
50
|
if (first && secound) return `${first} ${secound}`;
|
|
@@ -2,23 +2,16 @@
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Container } from "./styles";
|
|
5
|
-
import { getStorage, setStorage } from "@gustavo-valsechi/server/tools";
|
|
6
5
|
import randomColor from "randomcolor";
|
|
7
6
|
import _ from "lodash";
|
|
8
7
|
function Avatar(props) {
|
|
9
8
|
const containerRef = useRef({});
|
|
10
9
|
const [color, setColor] = useState("");
|
|
11
10
|
useEffect(() => {
|
|
12
|
-
if (color) return;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (storageColor) return setColor(storageColor);
|
|
17
|
-
const random = randomColor({ luminosity: "light" });
|
|
18
|
-
await setStorage(storageKey, random);
|
|
19
|
-
setColor(random);
|
|
20
|
-
})();
|
|
21
|
-
}, [color]);
|
|
11
|
+
if (color || !props.name) return;
|
|
12
|
+
const random = randomColor({ luminosity: "light", seed: props.name });
|
|
13
|
+
setColor(random);
|
|
14
|
+
}, [color, props.name]);
|
|
22
15
|
const name = () => {
|
|
23
16
|
const [first, secound] = _.split(props.name, " ") || [];
|
|
24
17
|
if (first && secound) return `${first} ${secound}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gustavo-valsechi/client",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.53",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@emotion/is-prop-valid": "1.3.0",
|
|
27
|
-
"@gustavo-valsechi/server": "1.0.
|
|
27
|
+
"@gustavo-valsechi/server": "1.0.8",
|
|
28
28
|
"@hookform/resolvers": "5.2.2",
|
|
29
29
|
"apexcharts": "3.51.0",
|
|
30
30
|
"lodash": "4.17.21",
|
|
@@ -62,20 +62,24 @@
|
|
|
62
62
|
},
|
|
63
63
|
"exports": {
|
|
64
64
|
".": {
|
|
65
|
+
"types": "./dist/index.d.ts",
|
|
65
66
|
"import": "./dist/index.js",
|
|
66
|
-
"
|
|
67
|
+
"require": "./dist/index.cjs"
|
|
67
68
|
},
|
|
68
69
|
"./components": {
|
|
70
|
+
"types": "./dist/components/index.d.ts",
|
|
69
71
|
"import": "./dist/components/index.js",
|
|
70
|
-
"
|
|
72
|
+
"require": "./dist/components/index.cjs"
|
|
71
73
|
},
|
|
72
74
|
"./contexts": {
|
|
75
|
+
"types": "./dist/contexts/index.d.ts",
|
|
73
76
|
"import": "./dist/contexts/index.js",
|
|
74
|
-
"
|
|
77
|
+
"require": "./dist/contexts/index.cjs"
|
|
75
78
|
},
|
|
76
79
|
"./interfaces": {
|
|
80
|
+
"types": "./dist/interfaces/index.d.ts",
|
|
77
81
|
"import": "./dist/interfaces/index.js",
|
|
78
|
-
"
|
|
82
|
+
"require": "./dist/interfaces/index.cjs"
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
}
|