@eclass/ui-kit 1.59.6 → 1.59.7
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.
- package/dist/eclass-ui-kit.es.js +10 -10
- package/dist/eclass-ui-kit.es.js.map +1 -1
- package/dist/eclass-ui-kit.umd.js +30 -30
- package/dist/eclass-ui-kit.umd.js.map +1 -1
- package/dist/molecules/Avatar/Avatar.d.ts +2 -2
- package/dist/molecules/Avatar/Avatar.d.ts.map +1 -1
- package/dist/molecules/Avatar/Avatar.types.d.ts +2 -2
- package/dist/molecules/Avatar/Avatar.types.d.ts.map +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/eclass-ui-kit.es.js
CHANGED
|
@@ -6759,18 +6759,18 @@ function skipAttributesToProps(node2) {
|
|
|
6759
6759
|
var HTMLReactParser = /* @__PURE__ */ getDefaultExportFromCjs(lib$3);
|
|
6760
6760
|
var ReactParser = HTMLReactParser.default || HTMLReactParser;
|
|
6761
6761
|
const AVATAR_COLORS = ["#0076ba", "#229f9c", "#2cb26b", "#30baed", "#95569e", "#9bc03a", "#d84315", "#f5a623", "#f6712f", "#ff6363"];
|
|
6762
|
-
const
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6762
|
+
const getColorIndex = (fullName) => {
|
|
6763
|
+
var _a;
|
|
6764
|
+
const trimmedNameLength = (_a = fullName == null ? void 0 : fullName.trim().length) != null ? _a : 0;
|
|
6765
|
+
return trimmedNameLength % 10;
|
|
6766
|
+
};
|
|
6767
|
+
const getAvatarColor = (fullName) => {
|
|
6768
|
+
const position = getColorIndex(fullName);
|
|
6769
|
+
return AVATAR_COLORS[position];
|
|
6769
6770
|
};
|
|
6770
6771
|
const getInitials = (fullName) => fullName.split(" ").map((word) => word[0]).slice(0, 2).join("").toUpperCase();
|
|
6771
6772
|
const Avatar = ({
|
|
6772
6773
|
fullName,
|
|
6773
|
-
userId,
|
|
6774
6774
|
picture,
|
|
6775
6775
|
size = 50,
|
|
6776
6776
|
fontSize = 14,
|
|
@@ -6781,8 +6781,8 @@ const Avatar = ({
|
|
|
6781
6781
|
const [bgColor, setBgColor] = useState("");
|
|
6782
6782
|
const [imageValid, setImageValid] = useState(false);
|
|
6783
6783
|
useEffect(() => {
|
|
6784
|
-
setBgColor(
|
|
6785
|
-
}, [
|
|
6784
|
+
setBgColor(getAvatarColor(fullName));
|
|
6785
|
+
}, [fullName]);
|
|
6786
6786
|
const wrapperStyle = {
|
|
6787
6787
|
alignItems: "center",
|
|
6788
6788
|
backgroundColor: (fullName == null ? void 0 : fullName.length) === 0 ? "#fff" : bgColor,
|