@bwp-web/components 1.0.5 → 1.0.6
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/README.md +25 -1
- package/dist/UserInitialsIcon/UserInitialsIcon.d.ts +8 -0
- package/dist/UserInitialsIcon/UserInitialsIcon.d.ts.map +1 -0
- package/dist/UserInitialsIcon/index.d.ts +2 -0
- package/dist/UserInitialsIcon/index.d.ts.map +1 -0
- package/dist/index.cjs +428 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +450 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,396 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// ../../node_modules/randomcolor/randomColor.js
|
|
28
|
+
var require_randomColor = __commonJS({
|
|
29
|
+
"../../node_modules/randomcolor/randomColor.js"(exports, module) {
|
|
30
|
+
"use strict";
|
|
31
|
+
(function(root, factory) {
|
|
32
|
+
if (typeof exports === "object") {
|
|
33
|
+
var randomColor2 = factory();
|
|
34
|
+
if (typeof module === "object" && module && module.exports) {
|
|
35
|
+
exports = module.exports = randomColor2;
|
|
36
|
+
}
|
|
37
|
+
exports.randomColor = randomColor2;
|
|
38
|
+
} else if (typeof define === "function" && define.amd) {
|
|
39
|
+
define([], factory);
|
|
40
|
+
} else {
|
|
41
|
+
root.randomColor = factory();
|
|
42
|
+
}
|
|
43
|
+
})(exports, function() {
|
|
44
|
+
var seed = null;
|
|
45
|
+
var colorDictionary = {};
|
|
46
|
+
loadColorBounds();
|
|
47
|
+
var colorRanges = [];
|
|
48
|
+
var randomColor2 = function(options) {
|
|
49
|
+
options = options || {};
|
|
50
|
+
if (options.seed !== void 0 && options.seed !== null && options.seed === parseInt(options.seed, 10)) {
|
|
51
|
+
seed = options.seed;
|
|
52
|
+
} else if (typeof options.seed === "string") {
|
|
53
|
+
seed = stringToInteger(options.seed);
|
|
54
|
+
} else if (options.seed !== void 0 && options.seed !== null) {
|
|
55
|
+
throw new TypeError("The seed value must be an integer or string");
|
|
56
|
+
} else {
|
|
57
|
+
seed = null;
|
|
58
|
+
}
|
|
59
|
+
var H, S, B;
|
|
60
|
+
if (options.count !== null && options.count !== void 0) {
|
|
61
|
+
var totalColors = options.count, colors = [];
|
|
62
|
+
for (var i = 0; i < options.count; i++) {
|
|
63
|
+
colorRanges.push(false);
|
|
64
|
+
}
|
|
65
|
+
options.count = null;
|
|
66
|
+
while (totalColors > colors.length) {
|
|
67
|
+
var color = randomColor2(options);
|
|
68
|
+
if (seed !== null) {
|
|
69
|
+
options.seed = seed;
|
|
70
|
+
}
|
|
71
|
+
colors.push(color);
|
|
72
|
+
}
|
|
73
|
+
options.count = totalColors;
|
|
74
|
+
return colors;
|
|
75
|
+
}
|
|
76
|
+
H = pickHue(options);
|
|
77
|
+
S = pickSaturation(H, options);
|
|
78
|
+
B = pickBrightness(H, S, options);
|
|
79
|
+
return setFormat([H, S, B], options);
|
|
80
|
+
};
|
|
81
|
+
function pickHue(options) {
|
|
82
|
+
if (colorRanges.length > 0) {
|
|
83
|
+
var hueRange = getRealHueRange(options.hue);
|
|
84
|
+
var hue = randomWithin(hueRange);
|
|
85
|
+
var step = (hueRange[1] - hueRange[0]) / colorRanges.length;
|
|
86
|
+
var j = parseInt((hue - hueRange[0]) / step);
|
|
87
|
+
if (colorRanges[j] === true) {
|
|
88
|
+
j = (j + 2) % colorRanges.length;
|
|
89
|
+
} else {
|
|
90
|
+
colorRanges[j] = true;
|
|
91
|
+
}
|
|
92
|
+
var min = (hueRange[0] + j * step) % 359, max = (hueRange[0] + (j + 1) * step) % 359;
|
|
93
|
+
hueRange = [min, max];
|
|
94
|
+
hue = randomWithin(hueRange);
|
|
95
|
+
if (hue < 0) {
|
|
96
|
+
hue = 360 + hue;
|
|
97
|
+
}
|
|
98
|
+
return hue;
|
|
99
|
+
} else {
|
|
100
|
+
var hueRange = getHueRange(options.hue);
|
|
101
|
+
hue = randomWithin(hueRange);
|
|
102
|
+
if (hue < 0) {
|
|
103
|
+
hue = 360 + hue;
|
|
104
|
+
}
|
|
105
|
+
return hue;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function pickSaturation(hue, options) {
|
|
109
|
+
if (options.hue === "monochrome") {
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
if (options.luminosity === "random") {
|
|
113
|
+
return randomWithin([0, 100]);
|
|
114
|
+
}
|
|
115
|
+
var saturationRange = getSaturationRange(hue);
|
|
116
|
+
var sMin = saturationRange[0], sMax = saturationRange[1];
|
|
117
|
+
switch (options.luminosity) {
|
|
118
|
+
case "bright":
|
|
119
|
+
sMin = 55;
|
|
120
|
+
break;
|
|
121
|
+
case "dark":
|
|
122
|
+
sMin = sMax - 10;
|
|
123
|
+
break;
|
|
124
|
+
case "light":
|
|
125
|
+
sMax = 55;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
return randomWithin([sMin, sMax]);
|
|
129
|
+
}
|
|
130
|
+
function pickBrightness(H, S, options) {
|
|
131
|
+
var bMin = getMinimumBrightness(H, S), bMax = 100;
|
|
132
|
+
switch (options.luminosity) {
|
|
133
|
+
case "dark":
|
|
134
|
+
bMax = bMin + 20;
|
|
135
|
+
break;
|
|
136
|
+
case "light":
|
|
137
|
+
bMin = (bMax + bMin) / 2;
|
|
138
|
+
break;
|
|
139
|
+
case "random":
|
|
140
|
+
bMin = 0;
|
|
141
|
+
bMax = 100;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
return randomWithin([bMin, bMax]);
|
|
145
|
+
}
|
|
146
|
+
function setFormat(hsv, options) {
|
|
147
|
+
switch (options.format) {
|
|
148
|
+
case "hsvArray":
|
|
149
|
+
return hsv;
|
|
150
|
+
case "hslArray":
|
|
151
|
+
return HSVtoHSL(hsv);
|
|
152
|
+
case "hsl":
|
|
153
|
+
var hsl = HSVtoHSL(hsv);
|
|
154
|
+
return "hsl(" + hsl[0] + ", " + hsl[1] + "%, " + hsl[2] + "%)";
|
|
155
|
+
case "hsla":
|
|
156
|
+
var hslColor = HSVtoHSL(hsv);
|
|
157
|
+
var alpha4 = options.alpha || Math.random();
|
|
158
|
+
return "hsla(" + hslColor[0] + ", " + hslColor[1] + "%, " + hslColor[2] + "%, " + alpha4 + ")";
|
|
159
|
+
case "rgbArray":
|
|
160
|
+
return HSVtoRGB(hsv);
|
|
161
|
+
case "rgb":
|
|
162
|
+
var rgb = HSVtoRGB(hsv);
|
|
163
|
+
return "rgb(" + rgb.join(", ") + ")";
|
|
164
|
+
case "rgba":
|
|
165
|
+
var rgbColor = HSVtoRGB(hsv);
|
|
166
|
+
var alpha4 = options.alpha || Math.random();
|
|
167
|
+
return "rgba(" + rgbColor.join(", ") + ", " + alpha4 + ")";
|
|
168
|
+
default:
|
|
169
|
+
return HSVtoHex(hsv);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function getMinimumBrightness(H, S) {
|
|
173
|
+
var lowerBounds = getColorInfo(H).lowerBounds;
|
|
174
|
+
for (var i = 0; i < lowerBounds.length - 1; i++) {
|
|
175
|
+
var s1 = lowerBounds[i][0], v1 = lowerBounds[i][1];
|
|
176
|
+
var s2 = lowerBounds[i + 1][0], v2 = lowerBounds[i + 1][1];
|
|
177
|
+
if (S >= s1 && S <= s2) {
|
|
178
|
+
var m = (v2 - v1) / (s2 - s1), b = v1 - m * s1;
|
|
179
|
+
return m * S + b;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return 0;
|
|
183
|
+
}
|
|
184
|
+
function getHueRange(colorInput) {
|
|
185
|
+
if (typeof parseInt(colorInput) === "number") {
|
|
186
|
+
var number = parseInt(colorInput);
|
|
187
|
+
if (number < 360 && number > 0) {
|
|
188
|
+
return [number, number];
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (typeof colorInput === "string") {
|
|
192
|
+
if (colorDictionary[colorInput]) {
|
|
193
|
+
var color = colorDictionary[colorInput];
|
|
194
|
+
if (color.hueRange) {
|
|
195
|
+
return color.hueRange;
|
|
196
|
+
}
|
|
197
|
+
} else if (colorInput.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)) {
|
|
198
|
+
var hue = HexToHSB(colorInput)[0];
|
|
199
|
+
return [hue, hue];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return [0, 360];
|
|
203
|
+
}
|
|
204
|
+
function getSaturationRange(hue) {
|
|
205
|
+
return getColorInfo(hue).saturationRange;
|
|
206
|
+
}
|
|
207
|
+
function getColorInfo(hue) {
|
|
208
|
+
if (hue >= 334 && hue <= 360) {
|
|
209
|
+
hue -= 360;
|
|
210
|
+
}
|
|
211
|
+
for (var colorName in colorDictionary) {
|
|
212
|
+
var color = colorDictionary[colorName];
|
|
213
|
+
if (color.hueRange && hue >= color.hueRange[0] && hue <= color.hueRange[1]) {
|
|
214
|
+
return colorDictionary[colorName];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return "Color not found";
|
|
218
|
+
}
|
|
219
|
+
function randomWithin(range) {
|
|
220
|
+
if (seed === null) {
|
|
221
|
+
var golden_ratio = 0.618033988749895;
|
|
222
|
+
var r = Math.random();
|
|
223
|
+
r += golden_ratio;
|
|
224
|
+
r %= 1;
|
|
225
|
+
return Math.floor(range[0] + r * (range[1] + 1 - range[0]));
|
|
226
|
+
} else {
|
|
227
|
+
var max = range[1] || 1;
|
|
228
|
+
var min = range[0] || 0;
|
|
229
|
+
seed = (seed * 9301 + 49297) % 233280;
|
|
230
|
+
var rnd = seed / 233280;
|
|
231
|
+
return Math.floor(min + rnd * (max - min));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function HSVtoHex(hsv) {
|
|
235
|
+
var rgb = HSVtoRGB(hsv);
|
|
236
|
+
function componentToHex(c) {
|
|
237
|
+
var hex2 = c.toString(16);
|
|
238
|
+
return hex2.length == 1 ? "0" + hex2 : hex2;
|
|
239
|
+
}
|
|
240
|
+
var hex = "#" + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]);
|
|
241
|
+
return hex;
|
|
242
|
+
}
|
|
243
|
+
function defineColor(name, hueRange, lowerBounds) {
|
|
244
|
+
var sMin = lowerBounds[0][0], sMax = lowerBounds[lowerBounds.length - 1][0], bMin = lowerBounds[lowerBounds.length - 1][1], bMax = lowerBounds[0][1];
|
|
245
|
+
colorDictionary[name] = {
|
|
246
|
+
hueRange,
|
|
247
|
+
lowerBounds,
|
|
248
|
+
saturationRange: [sMin, sMax],
|
|
249
|
+
brightnessRange: [bMin, bMax]
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function loadColorBounds() {
|
|
253
|
+
defineColor(
|
|
254
|
+
"monochrome",
|
|
255
|
+
null,
|
|
256
|
+
[[0, 0], [100, 0]]
|
|
257
|
+
);
|
|
258
|
+
defineColor(
|
|
259
|
+
"red",
|
|
260
|
+
[-26, 18],
|
|
261
|
+
[[20, 100], [30, 92], [40, 89], [50, 85], [60, 78], [70, 70], [80, 60], [90, 55], [100, 50]]
|
|
262
|
+
);
|
|
263
|
+
defineColor(
|
|
264
|
+
"orange",
|
|
265
|
+
[18, 46],
|
|
266
|
+
[[20, 100], [30, 93], [40, 88], [50, 86], [60, 85], [70, 70], [100, 70]]
|
|
267
|
+
);
|
|
268
|
+
defineColor(
|
|
269
|
+
"yellow",
|
|
270
|
+
[46, 62],
|
|
271
|
+
[[25, 100], [40, 94], [50, 89], [60, 86], [70, 84], [80, 82], [90, 80], [100, 75]]
|
|
272
|
+
);
|
|
273
|
+
defineColor(
|
|
274
|
+
"green",
|
|
275
|
+
[62, 178],
|
|
276
|
+
[[30, 100], [40, 90], [50, 85], [60, 81], [70, 74], [80, 64], [90, 50], [100, 40]]
|
|
277
|
+
);
|
|
278
|
+
defineColor(
|
|
279
|
+
"blue",
|
|
280
|
+
[178, 257],
|
|
281
|
+
[[20, 100], [30, 86], [40, 80], [50, 74], [60, 60], [70, 52], [80, 44], [90, 39], [100, 35]]
|
|
282
|
+
);
|
|
283
|
+
defineColor(
|
|
284
|
+
"purple",
|
|
285
|
+
[257, 282],
|
|
286
|
+
[[20, 100], [30, 87], [40, 79], [50, 70], [60, 65], [70, 59], [80, 52], [90, 45], [100, 42]]
|
|
287
|
+
);
|
|
288
|
+
defineColor(
|
|
289
|
+
"pink",
|
|
290
|
+
[282, 334],
|
|
291
|
+
[[20, 100], [30, 90], [40, 86], [60, 84], [80, 80], [90, 75], [100, 73]]
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
function HSVtoRGB(hsv) {
|
|
295
|
+
var h = hsv[0];
|
|
296
|
+
if (h === 0) {
|
|
297
|
+
h = 1;
|
|
298
|
+
}
|
|
299
|
+
if (h === 360) {
|
|
300
|
+
h = 359;
|
|
301
|
+
}
|
|
302
|
+
h = h / 360;
|
|
303
|
+
var s = hsv[1] / 100, v = hsv[2] / 100;
|
|
304
|
+
var h_i = Math.floor(h * 6), f = h * 6 - h_i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), r = 256, g = 256, b = 256;
|
|
305
|
+
switch (h_i) {
|
|
306
|
+
case 0:
|
|
307
|
+
r = v;
|
|
308
|
+
g = t;
|
|
309
|
+
b = p;
|
|
310
|
+
break;
|
|
311
|
+
case 1:
|
|
312
|
+
r = q;
|
|
313
|
+
g = v;
|
|
314
|
+
b = p;
|
|
315
|
+
break;
|
|
316
|
+
case 2:
|
|
317
|
+
r = p;
|
|
318
|
+
g = v;
|
|
319
|
+
b = t;
|
|
320
|
+
break;
|
|
321
|
+
case 3:
|
|
322
|
+
r = p;
|
|
323
|
+
g = q;
|
|
324
|
+
b = v;
|
|
325
|
+
break;
|
|
326
|
+
case 4:
|
|
327
|
+
r = t;
|
|
328
|
+
g = p;
|
|
329
|
+
b = v;
|
|
330
|
+
break;
|
|
331
|
+
case 5:
|
|
332
|
+
r = v;
|
|
333
|
+
g = p;
|
|
334
|
+
b = q;
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
var result = [Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)];
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
function HexToHSB(hex) {
|
|
341
|
+
hex = hex.replace(/^#/, "");
|
|
342
|
+
hex = hex.length === 3 ? hex.replace(/(.)/g, "$1$1") : hex;
|
|
343
|
+
var red = parseInt(hex.substr(0, 2), 16) / 255, green = parseInt(hex.substr(2, 2), 16) / 255, blue = parseInt(hex.substr(4, 2), 16) / 255;
|
|
344
|
+
var cMax = Math.max(red, green, blue), delta = cMax - Math.min(red, green, blue), saturation = cMax ? delta / cMax : 0;
|
|
345
|
+
switch (cMax) {
|
|
346
|
+
case red:
|
|
347
|
+
return [60 * ((green - blue) / delta % 6) || 0, saturation, cMax];
|
|
348
|
+
case green:
|
|
349
|
+
return [60 * ((blue - red) / delta + 2) || 0, saturation, cMax];
|
|
350
|
+
case blue:
|
|
351
|
+
return [60 * ((red - green) / delta + 4) || 0, saturation, cMax];
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function HSVtoHSL(hsv) {
|
|
355
|
+
var h = hsv[0], s = hsv[1] / 100, v = hsv[2] / 100, k = (2 - s) * v;
|
|
356
|
+
return [
|
|
357
|
+
h,
|
|
358
|
+
Math.round(s * v / (k < 1 ? k : 2 - k) * 1e4) / 100,
|
|
359
|
+
k / 2 * 100
|
|
360
|
+
];
|
|
361
|
+
}
|
|
362
|
+
function stringToInteger(string) {
|
|
363
|
+
var total = 0;
|
|
364
|
+
for (var i = 0; i !== string.length; i++) {
|
|
365
|
+
if (total >= Number.MAX_SAFE_INTEGER) break;
|
|
366
|
+
total += string.charCodeAt(i);
|
|
367
|
+
}
|
|
368
|
+
return total;
|
|
369
|
+
}
|
|
370
|
+
function getRealHueRange(colorHue) {
|
|
371
|
+
if (!isNaN(colorHue)) {
|
|
372
|
+
var number = parseInt(colorHue);
|
|
373
|
+
if (number < 360 && number > 0) {
|
|
374
|
+
return getColorInfo(colorHue).hueRange;
|
|
375
|
+
}
|
|
376
|
+
} else if (typeof colorHue === "string") {
|
|
377
|
+
if (colorDictionary[colorHue]) {
|
|
378
|
+
var color = colorDictionary[colorHue];
|
|
379
|
+
if (color.hueRange) {
|
|
380
|
+
return color.hueRange;
|
|
381
|
+
}
|
|
382
|
+
} else if (colorHue.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)) {
|
|
383
|
+
var hue = HexToHSB(colorHue)[0];
|
|
384
|
+
return getColorInfo(hue).hueRange;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return [0, 360];
|
|
388
|
+
}
|
|
389
|
+
return randomColor2;
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
|
|
1
394
|
// src/BiampWrapper/BiampWrapper.tsx
|
|
2
395
|
import { Stack } from "@mui/material";
|
|
3
396
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -2313,6 +2706,62 @@ function BiampGlobalSearch({
|
|
|
2313
2706
|
}
|
|
2314
2707
|
);
|
|
2315
2708
|
}
|
|
2709
|
+
|
|
2710
|
+
// src/UserInitialsIcon/UserInitialsIcon.tsx
|
|
2711
|
+
var import_randomcolor = __toESM(require_randomColor(), 1);
|
|
2712
|
+
import { Box as Box12, Typography as Typography7 } from "@mui/material";
|
|
2713
|
+
import { darken } from "@mui/material/styles";
|
|
2714
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2715
|
+
var DEFAULT_SIZE = 40;
|
|
2716
|
+
var TEXT_RATIO = 0.4;
|
|
2717
|
+
function UserInitialsIcon({
|
|
2718
|
+
name,
|
|
2719
|
+
id,
|
|
2720
|
+
width = DEFAULT_SIZE,
|
|
2721
|
+
height = DEFAULT_SIZE,
|
|
2722
|
+
sx,
|
|
2723
|
+
...props
|
|
2724
|
+
}) {
|
|
2725
|
+
const userInitials = getInitials(name);
|
|
2726
|
+
const bgColor = (0, import_randomcolor.default)({ luminosity: "light", seed: id });
|
|
2727
|
+
const textColor = darken((0, import_randomcolor.default)({ luminosity: "dark", seed: id }), 0.3);
|
|
2728
|
+
const size = typeof width === "number" ? width : DEFAULT_SIZE;
|
|
2729
|
+
const fontSize = size * TEXT_RATIO;
|
|
2730
|
+
return /* @__PURE__ */ jsx24(
|
|
2731
|
+
Box12,
|
|
2732
|
+
{
|
|
2733
|
+
minWidth: width,
|
|
2734
|
+
width,
|
|
2735
|
+
minHeight: height,
|
|
2736
|
+
height,
|
|
2737
|
+
borderRadius: 1.5,
|
|
2738
|
+
bgcolor: bgColor,
|
|
2739
|
+
display: "flex",
|
|
2740
|
+
alignItems: "center",
|
|
2741
|
+
justifyContent: "center",
|
|
2742
|
+
sx: { ...sx },
|
|
2743
|
+
...props,
|
|
2744
|
+
children: /* @__PURE__ */ jsx24(
|
|
2745
|
+
Typography7,
|
|
2746
|
+
{
|
|
2747
|
+
variant: "h3",
|
|
2748
|
+
color: textColor,
|
|
2749
|
+
sx: {
|
|
2750
|
+
userSelect: "none",
|
|
2751
|
+
fontSize: size !== DEFAULT_SIZE ? `${fontSize}px` : void 0
|
|
2752
|
+
},
|
|
2753
|
+
children: userInitials
|
|
2754
|
+
}
|
|
2755
|
+
)
|
|
2756
|
+
}
|
|
2757
|
+
);
|
|
2758
|
+
}
|
|
2759
|
+
var getInitials = (name) => {
|
|
2760
|
+
if (!name) return "--";
|
|
2761
|
+
const words = name.trim().split(/\s+/);
|
|
2762
|
+
const initials = words.filter(Boolean).slice(0, 2).map((word) => word[0].toUpperCase()).join("");
|
|
2763
|
+
return initials;
|
|
2764
|
+
};
|
|
2316
2765
|
export {
|
|
2317
2766
|
BIAMP_TABLE_DEBOUNCE_DELAY,
|
|
2318
2767
|
BiampAppDialog,
|
|
@@ -2354,6 +2803,7 @@ export {
|
|
|
2354
2803
|
BiampWrapper,
|
|
2355
2804
|
SegmentedButton,
|
|
2356
2805
|
SegmentedButtonGroup,
|
|
2806
|
+
UserInitialsIcon,
|
|
2357
2807
|
buildCsvString,
|
|
2358
2808
|
exportToCsv,
|
|
2359
2809
|
getColumnVisibilityDirtyCount,
|