@fixefy/fixefy-ui-components 0.2.36 → 0.2.38
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.
|
@@ -415,7 +415,9 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
415
415
|
icon: `${option.logo ? `${logo_folder_name}/${option.logo}` : logo_placeholder ? logo_placeholder : (_option_name = option === null || option === void 0 ? void 0 : option[name]) !== null && _option_name !== void 0 ? _option_name : 'x'}`,
|
|
416
416
|
width: 70,
|
|
417
417
|
height: 16,
|
|
418
|
-
variant: "square"
|
|
418
|
+
variant: "square",
|
|
419
|
+
fontSize: 17,
|
|
420
|
+
background: (0, _helpers.useRandomColor)(theme)
|
|
419
421
|
})
|
|
420
422
|
}),
|
|
421
423
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
@@ -4,3 +4,4 @@ export declare const isObjectValid: (obj: any, isCheckKeys?: boolean) => boolean
|
|
|
4
4
|
export declare const isStringValid: (str: string, minLength?: number | null, maxLength?: number | null, isValidateType?: boolean) => boolean;
|
|
5
5
|
export declare const titleCase: (str?: string) => string;
|
|
6
6
|
export declare const toPascalCase: (string: string, title?: boolean) => string;
|
|
7
|
+
export declare const useRandomColor: (theme: any) => () => unknown;
|
|
@@ -26,8 +26,39 @@ _export(exports, {
|
|
|
26
26
|
},
|
|
27
27
|
toPascalCase: function() {
|
|
28
28
|
return toPascalCase;
|
|
29
|
+
},
|
|
30
|
+
useRandomColor: function() {
|
|
31
|
+
return useRandomColor;
|
|
29
32
|
}
|
|
30
33
|
});
|
|
34
|
+
function _define_property(obj, key, value) {
|
|
35
|
+
if (key in obj) {
|
|
36
|
+
Object.defineProperty(obj, key, {
|
|
37
|
+
value: value,
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
obj[key] = value;
|
|
44
|
+
}
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
47
|
+
function _object_spread(target) {
|
|
48
|
+
for(var i = 1; i < arguments.length; i++){
|
|
49
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
50
|
+
var ownKeys = Object.keys(source);
|
|
51
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
52
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
53
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
ownKeys.forEach(function(key) {
|
|
57
|
+
_define_property(target, key, source[key]);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return target;
|
|
61
|
+
}
|
|
31
62
|
const getJPart = (j, jsonPath, defaultValue, separator = '.', replacer = '^\\.*', joiner = '.')=>{
|
|
32
63
|
// if key is invalid - return error
|
|
33
64
|
if (j == null) return defaultValue;
|
|
@@ -102,3 +133,12 @@ const titleCase = (str = '')=>str && toPascalCase(str.toString(), true);
|
|
|
102
133
|
const toPascalCase = (string, title = false)=>{
|
|
103
134
|
return string && string.replace(/(_[a-z])?(^[a-z])?(_|\s[a-z])?/g, ($1)=>$1.toUpperCase().replace('_', title ? ' ' : ''));
|
|
104
135
|
};
|
|
136
|
+
const useRandomColor = (theme)=>{
|
|
137
|
+
const paletteColors = _object_spread({}, theme.palette.colors);
|
|
138
|
+
const colors = Object.entries(paletteColors).filter(([key])=>!key.includes('light')).map(([_, value])=>value);
|
|
139
|
+
const getRandomColor = ()=>{
|
|
140
|
+
const randomIndex = Math.floor(Math.random() * colors.length);
|
|
141
|
+
return colors[randomIndex];
|
|
142
|
+
};
|
|
143
|
+
return getRandomColor;
|
|
144
|
+
};
|
package/dist/FxIcon/FxIcon.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export declare const FxIcon: ({ icon, width, height, onClick, variant, fontSize, }: {
|
|
1
|
+
export declare const FxIcon: ({ icon, width, height, onClick, variant, fontSize, background, }: {
|
|
2
2
|
icon: string;
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
onClick?: () => void;
|
|
6
6
|
variant?: "circular" | "rounded" | "square";
|
|
7
7
|
fontSize?: number;
|
|
8
|
+
background?: string;
|
|
8
9
|
}) => JSX.Element;
|
package/dist/FxIcon/FxIcon.js
CHANGED
|
@@ -59,12 +59,15 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
}
|
|
60
60
|
return newObj;
|
|
61
61
|
}
|
|
62
|
-
const PublicIcon = ({ icon, width, height, onClick, variant, fontSize })=>{
|
|
62
|
+
const PublicIcon = ({ icon, width, height, onClick, variant, fontSize, background })=>{
|
|
63
63
|
const [isError, setError] = (0, _react.useState)(false);
|
|
64
64
|
const handleError = (isError)=>setError(isError);
|
|
65
65
|
if (isError) {
|
|
66
66
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Avatar, {
|
|
67
67
|
variant: variant || 'circular',
|
|
68
|
+
sx: {
|
|
69
|
+
background: background || '#bdbdbd'
|
|
70
|
+
},
|
|
68
71
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
69
72
|
fontSize: fontSize || 29,
|
|
70
73
|
fontWeight: 600,
|
|
@@ -83,7 +86,7 @@ const PublicIcon = ({ icon, width, height, onClick, variant, fontSize })=>{
|
|
|
83
86
|
onClick: onClick
|
|
84
87
|
});
|
|
85
88
|
};
|
|
86
|
-
const FxIcon = ({ icon, width, height, onClick, variant, fontSize })=>{
|
|
89
|
+
const FxIcon = ({ icon, width, height, onClick, variant, fontSize, background })=>{
|
|
87
90
|
if (!icon) throw Error('Provide a property `icon`');
|
|
88
91
|
return parseIconFromLibrary({
|
|
89
92
|
icon,
|
|
@@ -91,17 +94,19 @@ const FxIcon = ({ icon, width, height, onClick, variant, fontSize })=>{
|
|
|
91
94
|
height,
|
|
92
95
|
onClick,
|
|
93
96
|
variant,
|
|
94
|
-
fontSize
|
|
97
|
+
fontSize,
|
|
98
|
+
background
|
|
95
99
|
});
|
|
96
100
|
};
|
|
97
|
-
const parseIconFromLibrary = ({ icon, width, height, onClick, variant, fontSize })=>{
|
|
101
|
+
const parseIconFromLibrary = ({ icon, width, height, onClick, variant, fontSize, background })=>{
|
|
98
102
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(PublicIcon, {
|
|
99
103
|
icon: icon,
|
|
100
104
|
width: width,
|
|
101
105
|
height: height,
|
|
102
106
|
onClick: onClick,
|
|
103
107
|
variant: variant,
|
|
104
|
-
fontSize: fontSize
|
|
108
|
+
fontSize: fontSize,
|
|
109
|
+
background: background
|
|
105
110
|
});
|
|
106
111
|
};
|
|
107
112
|
const imageLoader = ({ src })=>{
|
package/package.json
CHANGED