@yr3/ui 1.0.24 → 1.1.1
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 -2
- package/dist/components/Button/buttons.css +2 -0
- package/dist/components/Button/buttons.css.map +1 -1
- package/dist/components/Calendar/calendar.css +0 -2
- package/dist/components/Calendar/calendar.css.map +1 -1
- package/dist/components/Control/control.css +2 -0
- package/dist/components/Control/control.css.map +1 -1
- package/dist/components/Date/month.css +20 -10
- package/dist/components/Date/month.css.map +1 -1
- package/dist/components/Loader/loader.css +5 -0
- package/dist/components/Loader/loader.css.map +1 -1
- package/dist/index.cjs +2415 -432
- package/dist/index.d.cts +775 -89
- package/dist/index.d.ts +775 -89
- package/dist/index.js +2428 -441
- package/dist/styles/index.css +29 -12
- package/dist/styles/index.css.map +1 -1
- package/package.json +2 -4
package/dist/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/utils/bem.ts
|
|
2
8
|
var bem = (block) => {
|
|
3
9
|
return (element, modifiers) => {
|
|
@@ -11,67 +17,1968 @@ var bem = (block) => {
|
|
|
11
17
|
} else {
|
|
12
18
|
classes.push(`${base}--${value}`);
|
|
13
19
|
}
|
|
14
|
-
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return classes.join(" ");
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
var bemMerge = (...args) => {
|
|
26
|
+
return args.flatMap((arg) => {
|
|
27
|
+
if (!arg) return [];
|
|
28
|
+
if (typeof arg === "string") return [arg];
|
|
29
|
+
if (typeof arg === "object") {
|
|
30
|
+
return Object.entries(arg).filter(([_, v]) => v).map(([k]) => k);
|
|
31
|
+
}
|
|
32
|
+
return [];
|
|
33
|
+
}).join(" ");
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/utils/common.ts
|
|
37
|
+
var common_exports = {};
|
|
38
|
+
__export(common_exports, {
|
|
39
|
+
assign: () => assign,
|
|
40
|
+
blendColors: () => blendColors,
|
|
41
|
+
camelCase: () => camelCase,
|
|
42
|
+
capitalize: () => capitalize,
|
|
43
|
+
capitalizeWords: () => capitalizeWords,
|
|
44
|
+
ceil: () => ceil,
|
|
45
|
+
chunk: () => chunk,
|
|
46
|
+
clamp: () => clamp,
|
|
47
|
+
clampNumber: () => clampNumber,
|
|
48
|
+
compact: () => compact,
|
|
49
|
+
concat: () => concat,
|
|
50
|
+
countBy: () => countBy,
|
|
51
|
+
darkenColor: () => darkenColor,
|
|
52
|
+
debounce: () => debounce,
|
|
53
|
+
decapitalize: () => decapitalize,
|
|
54
|
+
decapitalizeWords: () => decapitalizeWords,
|
|
55
|
+
defaults: () => defaults,
|
|
56
|
+
defaultsDeep: () => defaultsDeep,
|
|
57
|
+
desaturateColor: () => desaturateColor,
|
|
58
|
+
difference: () => difference,
|
|
59
|
+
differenceBy: () => differenceBy,
|
|
60
|
+
emToPx: () => emToPx,
|
|
61
|
+
endsWith: () => endsWith,
|
|
62
|
+
entries: () => entries,
|
|
63
|
+
escape: () => escape,
|
|
64
|
+
first: () => first,
|
|
65
|
+
flatten: () => flatten,
|
|
66
|
+
floor: () => floor,
|
|
67
|
+
fromEntries: () => fromEntries,
|
|
68
|
+
generateAnalogousPalette: () => generateAnalogousPalette,
|
|
69
|
+
generateComplementaryPalette: () => generateComplementaryPalette,
|
|
70
|
+
generateGradientColors: () => generateGradientColors,
|
|
71
|
+
generateMonochromaticPalette: () => generateMonochromaticPalette,
|
|
72
|
+
generateNanoId: () => generateNanoId,
|
|
73
|
+
generateRandomAlphaId: () => generateRandomAlphaId,
|
|
74
|
+
generateRandomAlphanumericId: () => generateRandomAlphanumericId,
|
|
75
|
+
generateRandomApiKey: () => generateRandomApiKey,
|
|
76
|
+
generateRandomBase64Id: () => generateRandomBase64Id,
|
|
77
|
+
generateRandomColor: () => generateRandomColor,
|
|
78
|
+
generateRandomColorPalette: () => generateRandomColorPalette,
|
|
79
|
+
generateRandomColorScheme: () => generateRandomColorScheme,
|
|
80
|
+
generateRandomCoolColor: () => generateRandomCoolColor,
|
|
81
|
+
generateRandomCoolPalette: () => generateRandomCoolPalette,
|
|
82
|
+
generateRandomDarkColor: () => generateRandomDarkColor,
|
|
83
|
+
generateRandomDarkPalette: () => generateRandomDarkPalette,
|
|
84
|
+
generateRandomDomain: () => generateRandomDomain,
|
|
85
|
+
generateRandomEarthToneColor: () => generateRandomEarthToneColor,
|
|
86
|
+
generateRandomEarthTonePalette: () => generateRandomEarthTonePalette,
|
|
87
|
+
generateRandomEmail: () => generateRandomEmail,
|
|
88
|
+
generateRandomGradient: () => generateRandomGradient,
|
|
89
|
+
generateRandomHSLColor: () => generateRandomHSLColor,
|
|
90
|
+
generateRandomHexColor: () => generateRandomHexColor,
|
|
91
|
+
generateRandomHexId: () => generateRandomHexId,
|
|
92
|
+
generateRandomLightColor: () => generateRandomLightColor,
|
|
93
|
+
generateRandomLightPalette: () => generateRandomLightPalette,
|
|
94
|
+
generateRandomMetallicColor: () => generateRandomMetallicColor,
|
|
95
|
+
generateRandomMetallicPalette: () => generateRandomMetallicPalette,
|
|
96
|
+
generateRandomMutedColor: () => generateRandomMutedColor,
|
|
97
|
+
generateRandomMutedPalette: () => generateRandomMutedPalette,
|
|
98
|
+
generateRandomNeonColor: () => generateRandomNeonColor,
|
|
99
|
+
generateRandomNeonPalette: () => generateRandomNeonPalette,
|
|
100
|
+
generateRandomNeutralColor: () => generateRandomNeutralColor,
|
|
101
|
+
generateRandomNeutralPalette: () => generateRandomNeutralPalette,
|
|
102
|
+
generateRandomNumericId: () => generateRandomNumericId,
|
|
103
|
+
generateRandomPassword: () => generateRandomPassword,
|
|
104
|
+
generateRandomPastelColor: () => generateRandomPastelColor,
|
|
105
|
+
generateRandomPastelPalette: () => generateRandomPastelPalette,
|
|
106
|
+
generateRandomRGBColor: () => generateRandomRGBColor,
|
|
107
|
+
generateRandomSessionId: () => generateRandomSessionId,
|
|
108
|
+
generateRandomSlug: () => generateRandomSlug,
|
|
109
|
+
generateRandomString: () => generateRandomString,
|
|
110
|
+
generateRandomToken: () => generateRandomToken,
|
|
111
|
+
generateRandomUrlSafeId: () => generateRandomUrlSafeId,
|
|
112
|
+
generateRandomUsername: () => generateRandomUsername,
|
|
113
|
+
generateRandomVibrantColor: () => generateRandomVibrantColor,
|
|
114
|
+
generateRandomVibrantPalette: () => generateRandomVibrantPalette,
|
|
115
|
+
generateRandomWarmColor: () => generateRandomWarmColor,
|
|
116
|
+
generateRandomWarmPalette: () => generateRandomWarmPalette,
|
|
117
|
+
generateShortId: () => generateShortId,
|
|
118
|
+
generateTetradicPalette: () => generateTetradicPalette,
|
|
119
|
+
generateTriadicPalette: () => generateTriadicPalette,
|
|
120
|
+
generateUUID: () => generateUUID,
|
|
121
|
+
generateUniqueId: () => generateUniqueId,
|
|
122
|
+
get: () => get,
|
|
123
|
+
getContrastColor: () => getContrastColor,
|
|
124
|
+
getDeepValue: () => getDeepValue,
|
|
125
|
+
getNestedValue: () => getNestedValue,
|
|
126
|
+
getValue: () => getValue,
|
|
127
|
+
getValueByPath: () => getValueByPath,
|
|
128
|
+
groupBy: () => groupBy,
|
|
129
|
+
hasDeepKey: () => hasDeepKey,
|
|
130
|
+
hasDeepValue: () => hasDeepValue,
|
|
131
|
+
hasKey: () => hasKey,
|
|
132
|
+
hasKeyByPath: () => hasKeyByPath,
|
|
133
|
+
hasNestedKey: () => hasNestedKey,
|
|
134
|
+
hasNestedValue: () => hasNestedValue,
|
|
135
|
+
hasValue: () => hasValue,
|
|
136
|
+
hasValueByPath: () => hasValueByPath,
|
|
137
|
+
hexToHSL: () => hexToHSL,
|
|
138
|
+
hexToRGB: () => hexToRGB,
|
|
139
|
+
hslToHex: () => hslToHex,
|
|
140
|
+
hslToRGB: () => hslToRGB,
|
|
141
|
+
includes: () => includes,
|
|
142
|
+
intersection: () => intersection,
|
|
143
|
+
intersectionBy: () => intersectionBy,
|
|
144
|
+
invert: () => invert,
|
|
145
|
+
invertColor: () => invertColor,
|
|
146
|
+
isArrayValue: () => isArrayValue,
|
|
147
|
+
isBase64: () => isBase64,
|
|
148
|
+
isBigIntValue: () => isBigIntValue,
|
|
149
|
+
isBooleanValue: () => isBooleanValue,
|
|
150
|
+
isCreditCard: () => isCreditCard,
|
|
151
|
+
isDarkColor: () => isDarkColor,
|
|
152
|
+
isEmail: () => isEmail,
|
|
153
|
+
isEmpty: () => isEmpty,
|
|
154
|
+
isEmptyArray: () => isEmptyArray,
|
|
155
|
+
isEmptyObject: () => isEmptyObject,
|
|
156
|
+
isEmptyString: () => isEmptyString,
|
|
157
|
+
isEmptyValue: () => isEmptyValue,
|
|
158
|
+
isFiniteNumber: () => isFiniteNumber,
|
|
159
|
+
isFunctionValue: () => isFunctionValue,
|
|
160
|
+
isHexColor: () => isHexColor,
|
|
161
|
+
isHexadecimal: () => isHexadecimal,
|
|
162
|
+
isIPv4: () => isIPv4,
|
|
163
|
+
isIPv6: () => isIPv6,
|
|
164
|
+
isISBN: () => isISBN,
|
|
165
|
+
isInteger: () => isInteger,
|
|
166
|
+
isJSON: () => isJSON,
|
|
167
|
+
isLightColor: () => isLightColor,
|
|
168
|
+
isMACAddress: () => isMACAddress,
|
|
169
|
+
isNaNValue: () => isNaNValue,
|
|
170
|
+
isNullValue: () => isNullValue,
|
|
171
|
+
isNumberValue: () => isNumberValue,
|
|
172
|
+
isObjectValue: () => isObjectValue,
|
|
173
|
+
isPhoneNumber: () => isPhoneNumber,
|
|
174
|
+
isPostalCode: () => isPostalCode,
|
|
175
|
+
isRGBColor: () => isRGBColor,
|
|
176
|
+
isSafeInteger: () => isSafeInteger,
|
|
177
|
+
isSlug: () => isSlug,
|
|
178
|
+
isStringValue: () => isStringValue,
|
|
179
|
+
isSymbolValue: () => isSymbolValue,
|
|
180
|
+
isURL: () => isURL,
|
|
181
|
+
isUUID: () => isUUID,
|
|
182
|
+
isUndefinedValue: () => isUndefinedValue,
|
|
183
|
+
isXML: () => isXML,
|
|
184
|
+
kebabCase: () => kebabCase,
|
|
185
|
+
keys: () => keys,
|
|
186
|
+
last: () => last,
|
|
187
|
+
lightenColor: () => lightenColor,
|
|
188
|
+
map: () => map,
|
|
189
|
+
mapKeys: () => mapKeys,
|
|
190
|
+
mapValues: () => mapValues,
|
|
191
|
+
memoize: () => memoize,
|
|
192
|
+
merge: () => merge,
|
|
193
|
+
mergeDeep: () => mergeDeep,
|
|
194
|
+
mixColors: () => mixColors,
|
|
195
|
+
nth: () => nth,
|
|
196
|
+
omit: () => omit,
|
|
197
|
+
omitBy: () => omitBy,
|
|
198
|
+
omitByDeep: () => omitByDeep,
|
|
199
|
+
once: () => once,
|
|
200
|
+
padEnd: () => padEnd,
|
|
201
|
+
padStart: () => padStart,
|
|
202
|
+
parseFloatValue: () => parseFloatValue,
|
|
203
|
+
parseIntValue: () => parseIntValue,
|
|
204
|
+
partition: () => partition,
|
|
205
|
+
percentToPx: () => percentToPx,
|
|
206
|
+
pick: () => pick,
|
|
207
|
+
pickBy: () => pickBy,
|
|
208
|
+
pickByDeep: () => pickByDeep,
|
|
209
|
+
pxToEm: () => pxToEm,
|
|
210
|
+
pxToPercent: () => pxToPercent,
|
|
211
|
+
pxToRem: () => pxToRem,
|
|
212
|
+
random: () => random,
|
|
213
|
+
randomNumber: () => randomNumber,
|
|
214
|
+
range: () => range,
|
|
215
|
+
remToEm: () => remToEm,
|
|
216
|
+
remToPx: () => remToPx,
|
|
217
|
+
repeat: () => repeat,
|
|
218
|
+
rgbToHSL: () => rgbToHSL,
|
|
219
|
+
rgbToHex: () => rgbToHex,
|
|
220
|
+
rotateHue: () => rotateHue,
|
|
221
|
+
round: () => round,
|
|
222
|
+
saturateColor: () => saturateColor,
|
|
223
|
+
setDeepValue: () => setDeepValue,
|
|
224
|
+
setNestedValue: () => setNestedValue,
|
|
225
|
+
setValue: () => setValue,
|
|
226
|
+
setValueByPath: () => setValueByPath,
|
|
227
|
+
shadeColor: () => shadeColor,
|
|
228
|
+
snakeCase: () => snakeCase,
|
|
229
|
+
startsWith: () => startsWith,
|
|
230
|
+
swapCase: () => swapCase,
|
|
231
|
+
throttle: () => throttle,
|
|
232
|
+
times: () => times,
|
|
233
|
+
tintColor: () => tintColor,
|
|
234
|
+
toExponential: () => toExponential,
|
|
235
|
+
toFinite: () => toFinite,
|
|
236
|
+
toFiniteNumber: () => toFiniteNumber,
|
|
237
|
+
toFixed: () => toFixed,
|
|
238
|
+
toInteger: () => toInteger,
|
|
239
|
+
toNumber: () => toNumber,
|
|
240
|
+
toPrecision: () => toPrecision,
|
|
241
|
+
toSafeInteger: () => toSafeInteger,
|
|
242
|
+
trim: () => trim,
|
|
243
|
+
trimEnd: () => trimEnd,
|
|
244
|
+
trimStart: () => trimStart,
|
|
245
|
+
truncate: () => truncate,
|
|
246
|
+
unescape: () => unescape,
|
|
247
|
+
union: () => union,
|
|
248
|
+
unionBy: () => unionBy,
|
|
249
|
+
uniqBy: () => uniqBy,
|
|
250
|
+
unique: () => unique,
|
|
251
|
+
unzip: () => unzip,
|
|
252
|
+
unzipWith: () => unzipWith,
|
|
253
|
+
upperCase: () => upperCase,
|
|
254
|
+
values: () => values,
|
|
255
|
+
without: () => without,
|
|
256
|
+
xor: () => xor,
|
|
257
|
+
zip: () => zip,
|
|
258
|
+
zipObject: () => zipObject,
|
|
259
|
+
zipObjectDeep: () => zipObjectDeep,
|
|
260
|
+
zipWith: () => zipWith,
|
|
261
|
+
zipWithDeep: () => zipWithDeep
|
|
262
|
+
});
|
|
263
|
+
function isEmpty(value) {
|
|
264
|
+
if (value == null) return true;
|
|
265
|
+
if (typeof value === "string") return value.trim().length === 0;
|
|
266
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
267
|
+
if (value instanceof Map || value instanceof Set) {
|
|
268
|
+
return value.size === 0;
|
|
269
|
+
}
|
|
270
|
+
if (typeof value === "object") {
|
|
271
|
+
return Object.keys(value).length === 0;
|
|
272
|
+
}
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
function times(n, iteratee) {
|
|
276
|
+
const result = [];
|
|
277
|
+
for (let i = 0; i < n; i++) {
|
|
278
|
+
result.push(iteratee(i));
|
|
279
|
+
}
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
function map(array, key, valueKey) {
|
|
283
|
+
const result = {};
|
|
284
|
+
for (const item of array) {
|
|
285
|
+
result[item[key]] = item[valueKey];
|
|
286
|
+
}
|
|
287
|
+
return result;
|
|
288
|
+
}
|
|
289
|
+
function get(obj, key) {
|
|
290
|
+
return obj[key];
|
|
291
|
+
}
|
|
292
|
+
function mergeDeep(target, source) {
|
|
293
|
+
if (typeof target !== "object" || target === null) {
|
|
294
|
+
return source;
|
|
295
|
+
}
|
|
296
|
+
const result = { ...target };
|
|
297
|
+
for (const key in source) {
|
|
298
|
+
if (source.hasOwnProperty(key)) {
|
|
299
|
+
const sourceValue = source[key];
|
|
300
|
+
const targetValue = target[key];
|
|
301
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
302
|
+
result[key] = mergeDeep(targetValue, sourceValue);
|
|
303
|
+
} else {
|
|
304
|
+
result[key] = sourceValue;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return result;
|
|
309
|
+
}
|
|
310
|
+
function omit(obj, keys2) {
|
|
311
|
+
const result = { ...obj };
|
|
312
|
+
for (const key of keys2) {
|
|
313
|
+
delete result[key];
|
|
314
|
+
}
|
|
315
|
+
return result;
|
|
316
|
+
}
|
|
317
|
+
function pick(obj, keys2) {
|
|
318
|
+
const result = {};
|
|
319
|
+
for (const key of keys2) {
|
|
320
|
+
if (key in obj) {
|
|
321
|
+
result[key] = obj[key];
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return result;
|
|
325
|
+
}
|
|
326
|
+
function flatten(array) {
|
|
327
|
+
const result = [];
|
|
328
|
+
for (const subArray of array) {
|
|
329
|
+
result.push(...subArray);
|
|
330
|
+
}
|
|
331
|
+
return result;
|
|
332
|
+
}
|
|
333
|
+
function unique(array) {
|
|
334
|
+
const seen = /* @__PURE__ */ new Set();
|
|
335
|
+
const result = [];
|
|
336
|
+
for (const item of array) {
|
|
337
|
+
if (!seen.has(item)) {
|
|
338
|
+
seen.add(item);
|
|
339
|
+
result.push(item);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
function debounce(func, wait) {
|
|
345
|
+
let timeout = null;
|
|
346
|
+
return function(...args) {
|
|
347
|
+
if (timeout) {
|
|
348
|
+
clearTimeout(timeout);
|
|
349
|
+
}
|
|
350
|
+
timeout = setTimeout(() => {
|
|
351
|
+
func.apply(this, args);
|
|
352
|
+
}, wait);
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
function throttle(func, limit) {
|
|
356
|
+
let inThrottle = false;
|
|
357
|
+
return function(...args) {
|
|
358
|
+
if (!inThrottle) {
|
|
359
|
+
func.apply(this, args);
|
|
360
|
+
inThrottle = true;
|
|
361
|
+
setTimeout(() => {
|
|
362
|
+
inThrottle = false;
|
|
363
|
+
}, limit);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function once(func) {
|
|
368
|
+
let called = false;
|
|
369
|
+
return function(...args) {
|
|
370
|
+
if (!called) {
|
|
371
|
+
called = true;
|
|
372
|
+
func.apply(this, args);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function memoize(func) {
|
|
377
|
+
const cache = /* @__PURE__ */ new Map();
|
|
378
|
+
return function(...args) {
|
|
379
|
+
const key = JSON.stringify(args);
|
|
380
|
+
if (cache.has(key)) {
|
|
381
|
+
return cache.get(key);
|
|
382
|
+
}
|
|
383
|
+
const result = func.apply(this, args);
|
|
384
|
+
cache.set(key, result);
|
|
385
|
+
return result;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function range(start, end, step = 1) {
|
|
389
|
+
const result = [];
|
|
390
|
+
for (let i = start; i < end; i += step) {
|
|
391
|
+
result.push(i);
|
|
392
|
+
}
|
|
393
|
+
return result;
|
|
394
|
+
}
|
|
395
|
+
function random(min, max) {
|
|
396
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
397
|
+
}
|
|
398
|
+
function clamp(value, min, max) {
|
|
399
|
+
return Math.max(min, Math.min(max, value));
|
|
400
|
+
}
|
|
401
|
+
function capitalize(str) {
|
|
402
|
+
if (str.length === 0) return str;
|
|
403
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
404
|
+
}
|
|
405
|
+
function camelCase(str) {
|
|
406
|
+
return str.replace(/[-_]+/g, " ").replace(/[^\w\s]/g, "").replace(/\s+(.)(\w*)/g, (_, p1, p2) => p1.toUpperCase() + p2.toLowerCase()).replace(/\s/g, "");
|
|
407
|
+
}
|
|
408
|
+
function kebabCase(str) {
|
|
409
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
410
|
+
}
|
|
411
|
+
function snakeCase(str) {
|
|
412
|
+
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
|
|
413
|
+
}
|
|
414
|
+
function upperCase(str) {
|
|
415
|
+
return str.toUpperCase();
|
|
416
|
+
}
|
|
417
|
+
function difference(array1, array2) {
|
|
418
|
+
const set2 = new Set(array2);
|
|
419
|
+
return array1.filter((item) => !set2.has(item));
|
|
420
|
+
}
|
|
421
|
+
function intersection(array1, array2) {
|
|
422
|
+
const set2 = new Set(array2);
|
|
423
|
+
return array1.filter((item) => set2.has(item));
|
|
424
|
+
}
|
|
425
|
+
function union(array1, array2) {
|
|
426
|
+
const set = /* @__PURE__ */ new Set([...array1, ...array2]);
|
|
427
|
+
return Array.from(set);
|
|
428
|
+
}
|
|
429
|
+
function zip(array1, array2) {
|
|
430
|
+
const length = Math.min(array1.length, array2.length);
|
|
431
|
+
const result = [];
|
|
432
|
+
for (let i = 0; i < length; i++) {
|
|
433
|
+
result.push([array1[i], array2[i]]);
|
|
434
|
+
}
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
function unzip(array) {
|
|
438
|
+
const array1 = [];
|
|
439
|
+
const array2 = [];
|
|
440
|
+
for (const [item1, item2] of array) {
|
|
441
|
+
array1.push(item1);
|
|
442
|
+
array2.push(item2);
|
|
443
|
+
}
|
|
444
|
+
return [array1, array2];
|
|
445
|
+
}
|
|
446
|
+
function groupBy(array, key) {
|
|
447
|
+
const result = {};
|
|
448
|
+
for (const item of array) {
|
|
449
|
+
const groupKey = String(item[key]);
|
|
450
|
+
if (!result[groupKey]) {
|
|
451
|
+
result[groupKey] = [];
|
|
452
|
+
}
|
|
453
|
+
result[groupKey].push(item);
|
|
454
|
+
}
|
|
455
|
+
return result;
|
|
456
|
+
}
|
|
457
|
+
function partition(array, predicate) {
|
|
458
|
+
const truthy = [];
|
|
459
|
+
const falsy = [];
|
|
460
|
+
for (const item of array) {
|
|
461
|
+
if (predicate(item)) {
|
|
462
|
+
truthy.push(item);
|
|
463
|
+
} else {
|
|
464
|
+
falsy.push(item);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return [truthy, falsy];
|
|
468
|
+
}
|
|
469
|
+
function countBy(array, key) {
|
|
470
|
+
const result = {};
|
|
471
|
+
for (const item of array) {
|
|
472
|
+
const countKey = String(item[key]);
|
|
473
|
+
result[countKey] = (result[countKey] || 0) + 1;
|
|
474
|
+
}
|
|
475
|
+
return result;
|
|
476
|
+
}
|
|
477
|
+
function chunk(array, size) {
|
|
478
|
+
const result = [];
|
|
479
|
+
for (let i = 0; i < array.length; i += size) {
|
|
480
|
+
result.push(array.slice(i, i + size));
|
|
481
|
+
}
|
|
482
|
+
return result;
|
|
483
|
+
}
|
|
484
|
+
function compact(array) {
|
|
485
|
+
return array.filter(Boolean);
|
|
486
|
+
}
|
|
487
|
+
function concat(...arrays) {
|
|
488
|
+
const result = [];
|
|
489
|
+
for (const array of arrays) {
|
|
490
|
+
result.push(...array);
|
|
491
|
+
}
|
|
492
|
+
return result;
|
|
493
|
+
}
|
|
494
|
+
function differenceBy(array1, array2, iteratee) {
|
|
495
|
+
const set2 = new Set(array2.map(iteratee));
|
|
496
|
+
return array1.filter((item) => !set2.has(iteratee(item)));
|
|
497
|
+
}
|
|
498
|
+
function intersectionBy(array1, array2, iteratee) {
|
|
499
|
+
const set2 = new Set(array2.map(iteratee));
|
|
500
|
+
return array1.filter((item) => set2.has(iteratee(item)));
|
|
501
|
+
}
|
|
502
|
+
function unionBy(array1, array2, iteratee) {
|
|
503
|
+
const seen = /* @__PURE__ */ new Set();
|
|
504
|
+
const result = [];
|
|
505
|
+
for (const item of [...array1, ...array2]) {
|
|
506
|
+
const key = iteratee(item);
|
|
507
|
+
if (!seen.has(key)) {
|
|
508
|
+
seen.add(key);
|
|
509
|
+
result.push(item);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return result;
|
|
513
|
+
}
|
|
514
|
+
function uniqBy(array, iteratee) {
|
|
515
|
+
const seen = /* @__PURE__ */ new Set();
|
|
516
|
+
const result = [];
|
|
517
|
+
for (const item of array) {
|
|
518
|
+
const key = iteratee(item);
|
|
519
|
+
if (!seen.has(key)) {
|
|
520
|
+
seen.add(key);
|
|
521
|
+
result.push(item);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return result;
|
|
525
|
+
}
|
|
526
|
+
function zipWith(array1, array2, iteratee) {
|
|
527
|
+
const length = Math.min(array1.length, array2.length);
|
|
528
|
+
const result = [];
|
|
529
|
+
for (let i = 0; i < length; i++) {
|
|
530
|
+
result.push(iteratee(array1[i], array2[i]));
|
|
531
|
+
}
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
function unzipWith(array, iteratee) {
|
|
535
|
+
const result = [];
|
|
536
|
+
for (const [item1, item2] of array) {
|
|
537
|
+
result.push(iteratee(item1, item2));
|
|
538
|
+
}
|
|
539
|
+
return result;
|
|
540
|
+
}
|
|
541
|
+
function without(array, ...values2) {
|
|
542
|
+
const valueSet = new Set(values2);
|
|
543
|
+
return array.filter((item) => !valueSet.has(item));
|
|
544
|
+
}
|
|
545
|
+
function xor(array1, array2) {
|
|
546
|
+
const set1 = new Set(array1);
|
|
547
|
+
const set2 = new Set(array2);
|
|
548
|
+
const result = [];
|
|
549
|
+
for (const item of array1) {
|
|
550
|
+
if (!set2.has(item)) {
|
|
551
|
+
result.push(item);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
for (const item of array2) {
|
|
555
|
+
if (!set1.has(item)) {
|
|
556
|
+
result.push(item);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return result;
|
|
560
|
+
}
|
|
561
|
+
function zipObject(keys2, values2) {
|
|
562
|
+
const result = {};
|
|
563
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
564
|
+
result[keys2[i]] = values2[i];
|
|
565
|
+
}
|
|
566
|
+
return result;
|
|
567
|
+
}
|
|
568
|
+
function zipObjectDeep(keys2, values2) {
|
|
569
|
+
const result = {};
|
|
570
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
571
|
+
const keyParts = String(keys2[i]).split(".");
|
|
572
|
+
let current = result;
|
|
573
|
+
for (let j = 0; j < keyParts.length; j++) {
|
|
574
|
+
const part = keyParts[j];
|
|
575
|
+
if (j === keyParts.length - 1) {
|
|
576
|
+
current[part] = values2[i];
|
|
577
|
+
} else {
|
|
578
|
+
current[part] = current[part] || {};
|
|
579
|
+
current = current[part];
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return result;
|
|
584
|
+
}
|
|
585
|
+
function zipWithDeep(keys2, values2, iteratee) {
|
|
586
|
+
const result = {};
|
|
587
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
588
|
+
const keyParts = String(keys2[i]).split(".");
|
|
589
|
+
let current = result;
|
|
590
|
+
for (let j = 0; j < keyParts.length; j++) {
|
|
591
|
+
const part = keyParts[j];
|
|
592
|
+
if (j === keyParts.length - 1) {
|
|
593
|
+
current[part] = iteratee(values2[i]);
|
|
594
|
+
} else {
|
|
595
|
+
current[part] = current[part] || {};
|
|
596
|
+
current = current[part];
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return result;
|
|
601
|
+
}
|
|
602
|
+
function first(array) {
|
|
603
|
+
return array[0];
|
|
604
|
+
}
|
|
605
|
+
function last(array) {
|
|
606
|
+
return array[array.length - 1];
|
|
607
|
+
}
|
|
608
|
+
function nth(array, n) {
|
|
609
|
+
if (n < 0) {
|
|
610
|
+
return array[array.length + n];
|
|
611
|
+
}
|
|
612
|
+
return array[n];
|
|
613
|
+
}
|
|
614
|
+
function keys(obj) {
|
|
615
|
+
return Object.keys(obj);
|
|
616
|
+
}
|
|
617
|
+
function values(obj) {
|
|
618
|
+
return Object.values(obj);
|
|
619
|
+
}
|
|
620
|
+
function entries(obj) {
|
|
621
|
+
return Object.entries(obj);
|
|
622
|
+
}
|
|
623
|
+
function fromEntries(entries2) {
|
|
624
|
+
const result = {};
|
|
625
|
+
for (const [key, value] of entries2) {
|
|
626
|
+
result[key] = value;
|
|
627
|
+
}
|
|
628
|
+
return result;
|
|
629
|
+
}
|
|
630
|
+
function invert(obj) {
|
|
631
|
+
const result = {};
|
|
632
|
+
for (const key in obj) {
|
|
633
|
+
if (obj.hasOwnProperty(key)) {
|
|
634
|
+
const value = obj[key];
|
|
635
|
+
result[value] = key;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return result;
|
|
639
|
+
}
|
|
640
|
+
function mapValues(obj, iteratee) {
|
|
641
|
+
const result = {};
|
|
642
|
+
for (const key in obj) {
|
|
643
|
+
if (obj.hasOwnProperty(key)) {
|
|
644
|
+
result[key] = iteratee(obj[key], key);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
return result;
|
|
648
|
+
}
|
|
649
|
+
function mapKeys(obj, iteratee) {
|
|
650
|
+
const result = {};
|
|
651
|
+
for (const key in obj) {
|
|
652
|
+
if (obj.hasOwnProperty(key)) {
|
|
653
|
+
const newKey = iteratee(obj[key], key);
|
|
654
|
+
result[newKey] = obj[key];
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return result;
|
|
658
|
+
}
|
|
659
|
+
function merge(target, ...sources) {
|
|
660
|
+
const result = { ...target };
|
|
661
|
+
for (const source of sources) {
|
|
662
|
+
for (const key in source) {
|
|
663
|
+
if (source.hasOwnProperty(key)) {
|
|
664
|
+
const sourceValue = source[key];
|
|
665
|
+
const targetValue = result[key];
|
|
666
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
667
|
+
result[key] = merge(targetValue, sourceValue);
|
|
668
|
+
} else {
|
|
669
|
+
result[key] = sourceValue;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return result;
|
|
675
|
+
}
|
|
676
|
+
function assign(target, ...sources) {
|
|
677
|
+
return Object.assign(target, ...sources);
|
|
678
|
+
}
|
|
679
|
+
function defaults(target, ...sources) {
|
|
680
|
+
const result = { ...target };
|
|
681
|
+
for (const source of sources) {
|
|
682
|
+
for (const key in source) {
|
|
683
|
+
if (source.hasOwnProperty(key) && result[key] === void 0) {
|
|
684
|
+
result[key] = source[key];
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
return result;
|
|
689
|
+
}
|
|
690
|
+
function defaultsDeep(target, ...sources) {
|
|
691
|
+
const result = { ...target };
|
|
692
|
+
for (const source of sources) {
|
|
693
|
+
for (const key in source) {
|
|
694
|
+
if (source.hasOwnProperty(key)) {
|
|
695
|
+
const sourceValue = source[key];
|
|
696
|
+
const targetValue = result[key];
|
|
697
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
698
|
+
result[key] = defaultsDeep(targetValue, sourceValue);
|
|
699
|
+
} else if (result[key] === void 0) {
|
|
700
|
+
result[key] = sourceValue;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return result;
|
|
706
|
+
}
|
|
707
|
+
function pickBy(obj, predicate) {
|
|
708
|
+
const result = {};
|
|
709
|
+
for (const key in obj) {
|
|
710
|
+
if (obj.hasOwnProperty(key)) {
|
|
711
|
+
const value = obj[key];
|
|
712
|
+
if (predicate(value, key)) {
|
|
713
|
+
result[key] = value;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return result;
|
|
718
|
+
}
|
|
719
|
+
function omitBy(obj, predicate) {
|
|
720
|
+
const result = {};
|
|
721
|
+
for (const key in obj) {
|
|
722
|
+
if (obj.hasOwnProperty(key)) {
|
|
723
|
+
const value = obj[key];
|
|
724
|
+
if (!predicate(value, key)) {
|
|
725
|
+
result[key] = value;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return result;
|
|
730
|
+
}
|
|
731
|
+
function pickByDeep(obj, predicate) {
|
|
732
|
+
const result = {};
|
|
733
|
+
for (const key in obj) {
|
|
734
|
+
if (obj.hasOwnProperty(key)) {
|
|
735
|
+
const value = obj[key];
|
|
736
|
+
if (typeof value === "object" && value !== null) {
|
|
737
|
+
const nestedResult = pickByDeep(value, predicate);
|
|
738
|
+
if (Object.keys(nestedResult).length > 0) {
|
|
739
|
+
result[key] = nestedResult;
|
|
740
|
+
}
|
|
741
|
+
} else if (predicate(value, key)) {
|
|
742
|
+
result[key] = value;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
return result;
|
|
747
|
+
}
|
|
748
|
+
function omitByDeep(obj, predicate) {
|
|
749
|
+
const result = {};
|
|
750
|
+
for (const key in obj) {
|
|
751
|
+
if (obj.hasOwnProperty(key)) {
|
|
752
|
+
const value = obj[key];
|
|
753
|
+
if (typeof value === "object" && value !== null) {
|
|
754
|
+
const nestedResult = omitByDeep(value, predicate);
|
|
755
|
+
result[key] = nestedResult;
|
|
756
|
+
} else if (!predicate(value, key)) {
|
|
757
|
+
result[key] = value;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
return result;
|
|
762
|
+
}
|
|
763
|
+
function isEmptyObject(obj) {
|
|
764
|
+
return Object.keys(obj).length === 0;
|
|
765
|
+
}
|
|
766
|
+
function isEmptyArray(arr) {
|
|
767
|
+
return arr.length === 0;
|
|
768
|
+
}
|
|
769
|
+
function isEmptyString(str) {
|
|
770
|
+
return str.trim().length === 0;
|
|
771
|
+
}
|
|
772
|
+
function isEmptyValue(value) {
|
|
773
|
+
return value == null || typeof value === "string" && value.trim().length === 0 || Array.isArray(value) && value.length === 0 || typeof value === "object" && Object.keys(value).length === 0;
|
|
774
|
+
}
|
|
775
|
+
function startsWith(str, prefix) {
|
|
776
|
+
return str.startsWith(prefix);
|
|
777
|
+
}
|
|
778
|
+
function endsWith(str, suffix) {
|
|
779
|
+
return str.endsWith(suffix);
|
|
780
|
+
}
|
|
781
|
+
function includes(str, search) {
|
|
782
|
+
return str.includes(search);
|
|
783
|
+
}
|
|
784
|
+
function repeat(str, times2) {
|
|
785
|
+
return str.repeat(times2);
|
|
786
|
+
}
|
|
787
|
+
function padStart(str, targetLength, padString = " ") {
|
|
788
|
+
return str.padStart(targetLength, padString);
|
|
789
|
+
}
|
|
790
|
+
function padEnd(str, targetLength, padString = " ") {
|
|
791
|
+
return str.padEnd(targetLength, padString);
|
|
792
|
+
}
|
|
793
|
+
function trim(str) {
|
|
794
|
+
return str.trim();
|
|
795
|
+
}
|
|
796
|
+
function trimStart(str) {
|
|
797
|
+
return str.trimStart();
|
|
798
|
+
}
|
|
799
|
+
function trimEnd(str) {
|
|
800
|
+
return str.trimEnd();
|
|
801
|
+
}
|
|
802
|
+
function truncate(str, length, omission = "...") {
|
|
803
|
+
if (str.length <= length) return str;
|
|
804
|
+
return str.slice(0, length - omission.length) + omission;
|
|
805
|
+
}
|
|
806
|
+
function escape(str) {
|
|
807
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
808
|
+
}
|
|
809
|
+
function unescape(str) {
|
|
810
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
|
|
811
|
+
}
|
|
812
|
+
function capitalizeWords(str) {
|
|
813
|
+
return str.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
814
|
+
}
|
|
815
|
+
function decapitalize(str) {
|
|
816
|
+
if (str.length === 0) return str;
|
|
817
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
818
|
+
}
|
|
819
|
+
function decapitalizeWords(str) {
|
|
820
|
+
return str.replace(/\b\w/g, (char) => char.toLowerCase());
|
|
821
|
+
}
|
|
822
|
+
function swapCase(str) {
|
|
823
|
+
return str.split("").map((char) => {
|
|
824
|
+
if (char === char.toUpperCase()) {
|
|
825
|
+
return char.toLowerCase();
|
|
826
|
+
} else {
|
|
827
|
+
return char.toUpperCase();
|
|
828
|
+
}
|
|
829
|
+
}).join("");
|
|
830
|
+
}
|
|
831
|
+
function clampNumber(num, min, max) {
|
|
832
|
+
return Math.max(min, Math.min(max, num));
|
|
833
|
+
}
|
|
834
|
+
function randomNumber(min, max) {
|
|
835
|
+
return Math.random() * (max - min) + min;
|
|
836
|
+
}
|
|
837
|
+
function round(num, precision = 0) {
|
|
838
|
+
const factor = Math.pow(10, precision);
|
|
839
|
+
return Math.round(num * factor) / factor;
|
|
840
|
+
}
|
|
841
|
+
function floor(num, precision = 0) {
|
|
842
|
+
const factor = Math.pow(10, precision);
|
|
843
|
+
return Math.floor(num * factor) / factor;
|
|
844
|
+
}
|
|
845
|
+
function ceil(num, precision = 0) {
|
|
846
|
+
const factor = Math.pow(10, precision);
|
|
847
|
+
return Math.ceil(num * factor) / factor;
|
|
848
|
+
}
|
|
849
|
+
function toFixed(num, precision = 0) {
|
|
850
|
+
return num.toFixed(precision);
|
|
851
|
+
}
|
|
852
|
+
function toExponential(num, precision = 0) {
|
|
853
|
+
return num.toExponential(precision);
|
|
854
|
+
}
|
|
855
|
+
function toPrecision(num, precision = 0) {
|
|
856
|
+
return num.toPrecision(precision);
|
|
857
|
+
}
|
|
858
|
+
function isInteger(num) {
|
|
859
|
+
return Number.isInteger(num);
|
|
860
|
+
}
|
|
861
|
+
function isFiniteNumber(num) {
|
|
862
|
+
return Number.isFinite(num);
|
|
863
|
+
}
|
|
864
|
+
function isNaNValue(num) {
|
|
865
|
+
return Number.isNaN(num);
|
|
866
|
+
}
|
|
867
|
+
function isSafeInteger(num) {
|
|
868
|
+
return Number.isSafeInteger(num);
|
|
869
|
+
}
|
|
870
|
+
function parseIntValue(str, radix = 10) {
|
|
871
|
+
return parseInt(str, radix);
|
|
872
|
+
}
|
|
873
|
+
function parseFloatValue(str) {
|
|
874
|
+
return parseFloat(str);
|
|
875
|
+
}
|
|
876
|
+
function toNumber(value) {
|
|
877
|
+
return Number(value);
|
|
878
|
+
}
|
|
879
|
+
function toInteger(value) {
|
|
880
|
+
return parseInt(String(value), 10);
|
|
881
|
+
}
|
|
882
|
+
function toFinite(value) {
|
|
883
|
+
const num = toNumber(value);
|
|
884
|
+
if (num === Infinity) return Number.MAX_VALUE;
|
|
885
|
+
if (num === -Infinity) return -Number.MAX_VALUE;
|
|
886
|
+
return isNaN(num) ? 0 : num;
|
|
887
|
+
}
|
|
888
|
+
function toSafeInteger(value) {
|
|
889
|
+
const num = toInteger(value);
|
|
890
|
+
if (num > Number.MAX_SAFE_INTEGER) return Number.MAX_SAFE_INTEGER;
|
|
891
|
+
if (num < Number.MIN_SAFE_INTEGER) return Number.MIN_SAFE_INTEGER;
|
|
892
|
+
return num;
|
|
893
|
+
}
|
|
894
|
+
function toFiniteNumber(value) {
|
|
895
|
+
const num = toNumber(value);
|
|
896
|
+
if (num === Infinity) return Number.MAX_VALUE;
|
|
897
|
+
if (num === -Infinity) return -Number.MAX_VALUE;
|
|
898
|
+
return isNaN(num) ? 0 : num;
|
|
899
|
+
}
|
|
900
|
+
function getValue(obj, key) {
|
|
901
|
+
return obj[key];
|
|
902
|
+
}
|
|
903
|
+
function setValue(obj, key, value) {
|
|
904
|
+
obj[key] = value;
|
|
905
|
+
}
|
|
906
|
+
function hasKey(obj, key) {
|
|
907
|
+
return key in obj;
|
|
908
|
+
}
|
|
909
|
+
function hasValue(obj, value) {
|
|
910
|
+
return Object.values(obj).includes(value);
|
|
911
|
+
}
|
|
912
|
+
function getNestedValue(obj, key1, key2) {
|
|
913
|
+
return obj[key1][key2];
|
|
914
|
+
}
|
|
915
|
+
function setNestedValue(obj, key1, key2, value) {
|
|
916
|
+
obj[key1][key2] = value;
|
|
917
|
+
}
|
|
918
|
+
function hasNestedKey(obj, key1, key2) {
|
|
919
|
+
return key1 in obj && key2 in obj[key1];
|
|
920
|
+
}
|
|
921
|
+
function hasNestedValue(obj, key1, key2, value) {
|
|
922
|
+
return obj[key1][key2] === value;
|
|
923
|
+
}
|
|
924
|
+
function getDeepValue(obj, key1, key2, key3) {
|
|
925
|
+
return obj[key1][key2][key3];
|
|
926
|
+
}
|
|
927
|
+
function setDeepValue(obj, key1, key2, key3, value) {
|
|
928
|
+
obj[key1][key2][key3] = value;
|
|
929
|
+
}
|
|
930
|
+
function hasDeepKey(obj, key1, key2, key3) {
|
|
931
|
+
return key1 in obj && key2 in obj[key1] && key3 in obj[key1][key2];
|
|
932
|
+
}
|
|
933
|
+
function hasDeepValue(obj, key1, key2, key3, value) {
|
|
934
|
+
return obj[key1][key2][key3] === value;
|
|
935
|
+
}
|
|
936
|
+
function getValueByPath(obj, path) {
|
|
937
|
+
const keys2 = path.split(".");
|
|
938
|
+
let current = obj;
|
|
939
|
+
for (const key of keys2) {
|
|
940
|
+
if (current == null) return void 0;
|
|
941
|
+
current = current[key];
|
|
942
|
+
}
|
|
943
|
+
return current;
|
|
944
|
+
}
|
|
945
|
+
function setValueByPath(obj, path, value) {
|
|
946
|
+
const keys2 = path.split(".");
|
|
947
|
+
let current = obj;
|
|
948
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
949
|
+
const key = keys2[i];
|
|
950
|
+
if (i === keys2.length - 1) {
|
|
951
|
+
current[key] = value;
|
|
952
|
+
} else {
|
|
953
|
+
current[key] = current[key] || {};
|
|
954
|
+
current = current[key];
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
function hasKeyByPath(obj, path) {
|
|
959
|
+
const keys2 = path.split(".");
|
|
960
|
+
let current = obj;
|
|
961
|
+
for (const key of keys2) {
|
|
962
|
+
if (current == null || !(key in current)) return false;
|
|
963
|
+
current = current[key];
|
|
964
|
+
}
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
function hasValueByPath(obj, path, value) {
|
|
968
|
+
const keys2 = path.split(".");
|
|
969
|
+
let current = obj;
|
|
970
|
+
for (const key of keys2) {
|
|
971
|
+
if (current == null || !(key in current)) return false;
|
|
972
|
+
current = current[key];
|
|
973
|
+
}
|
|
974
|
+
return current === value;
|
|
975
|
+
}
|
|
976
|
+
function isNumberValue(value) {
|
|
977
|
+
return typeof value === "number" && !isNaN(value);
|
|
978
|
+
}
|
|
979
|
+
function isStringValue(value) {
|
|
980
|
+
return typeof value === "string";
|
|
981
|
+
}
|
|
982
|
+
function isBooleanValue(value) {
|
|
983
|
+
return typeof value === "boolean";
|
|
984
|
+
}
|
|
985
|
+
function isObjectValue(value) {
|
|
986
|
+
return typeof value === "object" && value !== null;
|
|
987
|
+
}
|
|
988
|
+
function isArrayValue(value) {
|
|
989
|
+
return Array.isArray(value);
|
|
990
|
+
}
|
|
991
|
+
function isFunctionValue(value) {
|
|
992
|
+
return typeof value === "function";
|
|
993
|
+
}
|
|
994
|
+
function isNullValue(value) {
|
|
995
|
+
return value === null;
|
|
996
|
+
}
|
|
997
|
+
function isUndefinedValue(value) {
|
|
998
|
+
return value === void 0;
|
|
999
|
+
}
|
|
1000
|
+
function isSymbolValue(value) {
|
|
1001
|
+
return typeof value === "symbol";
|
|
1002
|
+
}
|
|
1003
|
+
function isBigIntValue(value) {
|
|
1004
|
+
return typeof value === "bigint";
|
|
1005
|
+
}
|
|
1006
|
+
function isEmail(str) {
|
|
1007
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1008
|
+
return emailRegex.test(str);
|
|
1009
|
+
}
|
|
1010
|
+
function isURL(str) {
|
|
1011
|
+
const urlRegex = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/i;
|
|
1012
|
+
return urlRegex.test(str);
|
|
1013
|
+
}
|
|
1014
|
+
function isPhoneNumber(str) {
|
|
1015
|
+
const phoneRegex = /^\+?[1-9]\d{1,14}$/;
|
|
1016
|
+
return phoneRegex.test(str);
|
|
1017
|
+
}
|
|
1018
|
+
function isPostalCode(str) {
|
|
1019
|
+
const postalCodeRegex = /^\d{5}(-\d{4})?$/;
|
|
1020
|
+
return postalCodeRegex.test(str);
|
|
1021
|
+
}
|
|
1022
|
+
function isCreditCard(str) {
|
|
1023
|
+
const creditCardRegex = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})$/;
|
|
1024
|
+
return creditCardRegex.test(str);
|
|
1025
|
+
}
|
|
1026
|
+
function isISBN(str) {
|
|
1027
|
+
const isbn10Regex = /^(?:\d{9}X|\d{10})$/;
|
|
1028
|
+
const isbn13Regex = /^(?:\d{13})$/;
|
|
1029
|
+
return isbn10Regex.test(str) || isbn13Regex.test(str);
|
|
1030
|
+
}
|
|
1031
|
+
function isJSON(str) {
|
|
1032
|
+
try {
|
|
1033
|
+
JSON.parse(str);
|
|
1034
|
+
return true;
|
|
1035
|
+
} catch {
|
|
1036
|
+
return false;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
function isXML(str) {
|
|
1040
|
+
const parser = new DOMParser();
|
|
1041
|
+
const doc = parser.parseFromString(str, "application/xml");
|
|
1042
|
+
return !doc.querySelector("parsererror");
|
|
1043
|
+
}
|
|
1044
|
+
function isBase64(str) {
|
|
1045
|
+
const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/;
|
|
1046
|
+
return base64Regex.test(str);
|
|
1047
|
+
}
|
|
1048
|
+
function isHexadecimal(str) {
|
|
1049
|
+
const hexRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1050
|
+
return hexRegex.test(str);
|
|
1051
|
+
}
|
|
1052
|
+
function isUUID(str) {
|
|
1053
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1054
|
+
return uuidRegex.test(str);
|
|
1055
|
+
}
|
|
1056
|
+
function isIPv4(str) {
|
|
1057
|
+
const ipv4Regex = /^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/;
|
|
1058
|
+
return ipv4Regex.test(str);
|
|
1059
|
+
}
|
|
1060
|
+
function isIPv6(str) {
|
|
1061
|
+
const ipv6Regex = /^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/;
|
|
1062
|
+
return ipv6Regex.test(str);
|
|
1063
|
+
}
|
|
1064
|
+
function isMACAddress(str) {
|
|
1065
|
+
const macRegex = /^([0-9A-Fa-f]{2}[:\-]){5}([0-9A-Fa-f]{2})$/;
|
|
1066
|
+
return macRegex.test(str);
|
|
1067
|
+
}
|
|
1068
|
+
function isSlug(str) {
|
|
1069
|
+
const slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
1070
|
+
return slugRegex.test(str);
|
|
1071
|
+
}
|
|
1072
|
+
function isHexColor(str) {
|
|
1073
|
+
const hexColorRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1074
|
+
return hexColorRegex.test(str);
|
|
1075
|
+
}
|
|
1076
|
+
function isRGBColor(str) {
|
|
1077
|
+
const rgbColorRegex = /^rgb\(\s*(\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/;
|
|
1078
|
+
return rgbColorRegex.test(str);
|
|
1079
|
+
}
|
|
1080
|
+
function hexToRGB(hex) {
|
|
1081
|
+
const hexRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1082
|
+
if (!hexRegex.test(hex)) return null;
|
|
1083
|
+
let r, g, b;
|
|
1084
|
+
if (hex.length === 4) {
|
|
1085
|
+
r = parseInt(hex[1] + hex[1], 16);
|
|
1086
|
+
g = parseInt(hex[2] + hex[2], 16);
|
|
1087
|
+
b = parseInt(hex[3] + hex[3], 16);
|
|
1088
|
+
} else {
|
|
1089
|
+
r = parseInt(hex.slice(1, 3), 16);
|
|
1090
|
+
g = parseInt(hex.slice(3, 5), 16);
|
|
1091
|
+
b = parseInt(hex.slice(5, 7), 16);
|
|
1092
|
+
}
|
|
1093
|
+
return { r, g, b };
|
|
1094
|
+
}
|
|
1095
|
+
function rgbToHex(r, g, b) {
|
|
1096
|
+
const toHex = (num) => num.toString(16).padStart(2, "0");
|
|
1097
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
1098
|
+
}
|
|
1099
|
+
function rgbToHSL(r, g, b) {
|
|
1100
|
+
r /= 255;
|
|
1101
|
+
g /= 255;
|
|
1102
|
+
b /= 255;
|
|
1103
|
+
const max = Math.max(r, g, b);
|
|
1104
|
+
const min = Math.min(r, g, b);
|
|
1105
|
+
let h = 0, s = 0, l = (max + min) / 2;
|
|
1106
|
+
if (max !== min) {
|
|
1107
|
+
const d = max - min;
|
|
1108
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
1109
|
+
switch (max) {
|
|
1110
|
+
case r:
|
|
1111
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1112
|
+
break;
|
|
1113
|
+
case g:
|
|
1114
|
+
h = (b - r) / d + 2;
|
|
1115
|
+
break;
|
|
1116
|
+
case b:
|
|
1117
|
+
h = (r - g) / d + 4;
|
|
1118
|
+
break;
|
|
1119
|
+
}
|
|
1120
|
+
h /= 6;
|
|
1121
|
+
}
|
|
1122
|
+
return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) };
|
|
1123
|
+
}
|
|
1124
|
+
function hslToRGB(h, s, l) {
|
|
1125
|
+
h /= 360;
|
|
1126
|
+
s /= 100;
|
|
1127
|
+
l /= 100;
|
|
1128
|
+
let r, g, b;
|
|
1129
|
+
if (s === 0) {
|
|
1130
|
+
r = g = b = l;
|
|
1131
|
+
} else {
|
|
1132
|
+
const hueToRGB = (p2, q2, t) => {
|
|
1133
|
+
if (t < 0) t += 1;
|
|
1134
|
+
if (t > 1) t -= 1;
|
|
1135
|
+
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
1136
|
+
if (t < 1 / 2) return q2;
|
|
1137
|
+
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
1138
|
+
return p2;
|
|
1139
|
+
};
|
|
1140
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
1141
|
+
const p = 2 * l - q;
|
|
1142
|
+
r = hueToRGB(p, q, h + 1 / 3);
|
|
1143
|
+
g = hueToRGB(p, q, h);
|
|
1144
|
+
b = hueToRGB(p, q, h - 1 / 3);
|
|
1145
|
+
}
|
|
1146
|
+
return { r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255) };
|
|
1147
|
+
}
|
|
1148
|
+
function hexToHSL(hex) {
|
|
1149
|
+
const rgb = hexToRGB(hex);
|
|
1150
|
+
if (!rgb) return null;
|
|
1151
|
+
return rgbToHSL(rgb.r, rgb.g, rgb.b);
|
|
1152
|
+
}
|
|
1153
|
+
function hslToHex(h, s, l) {
|
|
1154
|
+
const rgb = hslToRGB(h, s, l);
|
|
1155
|
+
return rgbToHex(rgb.r, rgb.g, rgb.b);
|
|
1156
|
+
}
|
|
1157
|
+
function lightenColor(hex, amount) {
|
|
1158
|
+
const hsl = hexToHSL(hex);
|
|
1159
|
+
if (!hsl) return null;
|
|
1160
|
+
hsl.l = Math.min(100, hsl.l + amount);
|
|
1161
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1162
|
+
}
|
|
1163
|
+
function darkenColor(hex, amount) {
|
|
1164
|
+
const hsl = hexToHSL(hex);
|
|
1165
|
+
if (!hsl) return null;
|
|
1166
|
+
hsl.l = Math.max(0, hsl.l - amount);
|
|
1167
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1168
|
+
}
|
|
1169
|
+
function saturateColor(hex, amount) {
|
|
1170
|
+
const hsl = hexToHSL(hex);
|
|
1171
|
+
if (!hsl) return null;
|
|
1172
|
+
hsl.s = Math.min(100, hsl.s + amount);
|
|
1173
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1174
|
+
}
|
|
1175
|
+
function desaturateColor(hex, amount) {
|
|
1176
|
+
const hsl = hexToHSL(hex);
|
|
1177
|
+
if (!hsl) return null;
|
|
1178
|
+
hsl.s = Math.max(0, hsl.s - amount);
|
|
1179
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1180
|
+
}
|
|
1181
|
+
function rotateHue(hex, degrees) {
|
|
1182
|
+
const hsl = hexToHSL(hex);
|
|
1183
|
+
if (!hsl) return null;
|
|
1184
|
+
hsl.h = (hsl.h + degrees) % 360;
|
|
1185
|
+
if (hsl.h < 0) hsl.h += 360;
|
|
1186
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1187
|
+
}
|
|
1188
|
+
function invertColor(hex) {
|
|
1189
|
+
const rgb = hexToRGB(hex);
|
|
1190
|
+
if (!rgb) return null;
|
|
1191
|
+
const invertedR = 255 - rgb.r;
|
|
1192
|
+
const invertedG = 255 - rgb.g;
|
|
1193
|
+
const invertedB = 255 - rgb.b;
|
|
1194
|
+
return rgbToHex(invertedR, invertedG, invertedB);
|
|
1195
|
+
}
|
|
1196
|
+
function isLightColor(hex) {
|
|
1197
|
+
const rgb = hexToRGB(hex);
|
|
1198
|
+
if (!rgb) return null;
|
|
1199
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1200
|
+
return brightness > 128;
|
|
1201
|
+
}
|
|
1202
|
+
function isDarkColor(hex) {
|
|
1203
|
+
const rgb = hexToRGB(hex);
|
|
1204
|
+
if (!rgb) return null;
|
|
1205
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1206
|
+
return brightness <= 128;
|
|
1207
|
+
}
|
|
1208
|
+
function getContrastColor(hex) {
|
|
1209
|
+
const rgb = hexToRGB(hex);
|
|
1210
|
+
if (!rgb) return null;
|
|
1211
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1212
|
+
return brightness > 128 ? "#000000" : "#FFFFFF";
|
|
1213
|
+
}
|
|
1214
|
+
function blendColors(hex1, hex2, ratio) {
|
|
1215
|
+
const rgb1 = hexToRGB(hex1);
|
|
1216
|
+
const rgb2 = hexToRGB(hex2);
|
|
1217
|
+
if (!rgb1 || !rgb2) return null;
|
|
1218
|
+
const r = Math.round(rgb1.r * (1 - ratio) + rgb2.r * ratio);
|
|
1219
|
+
const g = Math.round(rgb1.g * (1 - ratio) + rgb2.g * ratio);
|
|
1220
|
+
const b = Math.round(rgb1.b * (1 - ratio) + rgb2.b * ratio);
|
|
1221
|
+
return rgbToHex(r, g, b);
|
|
1222
|
+
}
|
|
1223
|
+
function mixColors(hex1, hex2) {
|
|
1224
|
+
return blendColors(hex1, hex2, 0.5);
|
|
1225
|
+
}
|
|
1226
|
+
function shadeColor(hex, percent) {
|
|
1227
|
+
const rgb = hexToRGB(hex);
|
|
1228
|
+
if (!rgb) return null;
|
|
1229
|
+
const r = Math.round(rgb.r * (1 + percent / 100));
|
|
1230
|
+
const g = Math.round(rgb.g * (1 + percent / 100));
|
|
1231
|
+
const b = Math.round(rgb.b * (1 + percent / 100));
|
|
1232
|
+
return rgbToHex(clampNumber(r, 0, 255), clampNumber(g, 0, 255), clampNumber(b, 0, 255));
|
|
1233
|
+
}
|
|
1234
|
+
function tintColor(hex, percent) {
|
|
1235
|
+
const rgb = hexToRGB(hex);
|
|
1236
|
+
if (!rgb) return null;
|
|
1237
|
+
const r = Math.round(rgb.r + (255 - rgb.r) * (percent / 100));
|
|
1238
|
+
const g = Math.round(rgb.g + (255 - rgb.g) * (percent / 100));
|
|
1239
|
+
const b = Math.round(rgb.b + (255 - rgb.b) * (percent / 100));
|
|
1240
|
+
return rgbToHex(clampNumber(r, 0, 255), clampNumber(g, 0, 255), clampNumber(b, 0, 255));
|
|
1241
|
+
}
|
|
1242
|
+
function generateRandomColor() {
|
|
1243
|
+
const r = Math.floor(Math.random() * 256);
|
|
1244
|
+
const g = Math.floor(Math.random() * 256);
|
|
1245
|
+
const b = Math.floor(Math.random() * 256);
|
|
1246
|
+
return rgbToHex(r, g, b);
|
|
1247
|
+
}
|
|
1248
|
+
function generateRandomHexColor() {
|
|
1249
|
+
const hex = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
1250
|
+
return `#${hex}`;
|
|
1251
|
+
}
|
|
1252
|
+
function generateRandomRGBColor() {
|
|
1253
|
+
const r = Math.floor(Math.random() * 256);
|
|
1254
|
+
const g = Math.floor(Math.random() * 256);
|
|
1255
|
+
const b = Math.floor(Math.random() * 256);
|
|
1256
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
1257
|
+
}
|
|
1258
|
+
function generateRandomHSLColor() {
|
|
1259
|
+
const h = Math.floor(Math.random() * 360);
|
|
1260
|
+
const s = Math.floor(Math.random() * 100);
|
|
1261
|
+
const l = Math.floor(Math.random() * 100);
|
|
1262
|
+
return `hsl(${h}, ${s}%, ${l}%)`;
|
|
1263
|
+
}
|
|
1264
|
+
function generateRandomColorScheme(baseHex, schemeType) {
|
|
1265
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1266
|
+
if (!baseHSL) return null;
|
|
1267
|
+
const { h, s, l } = baseHSL;
|
|
1268
|
+
let scheme = [];
|
|
1269
|
+
switch (schemeType) {
|
|
1270
|
+
case "complementary":
|
|
1271
|
+
scheme.push(hslToHex((h + 180) % 360, s, l));
|
|
1272
|
+
break;
|
|
1273
|
+
case "analogous":
|
|
1274
|
+
scheme.push(hslToHex((h + 30) % 360, s, l));
|
|
1275
|
+
scheme.push(hslToHex((h - 30 + 360) % 360, s, l));
|
|
1276
|
+
break;
|
|
1277
|
+
case "triadic":
|
|
1278
|
+
scheme.push(hslToHex((h + 120) % 360, s, l));
|
|
1279
|
+
scheme.push(hslToHex((h + 240) % 360, s, l));
|
|
1280
|
+
break;
|
|
1281
|
+
case "tetradic":
|
|
1282
|
+
scheme.push(hslToHex((h + 90) % 360, s, l));
|
|
1283
|
+
scheme.push(hslToHex((h + 180) % 360, s, l));
|
|
1284
|
+
scheme.push(hslToHex((h + 270) % 360, s, l));
|
|
1285
|
+
break;
|
|
1286
|
+
}
|
|
1287
|
+
return scheme;
|
|
1288
|
+
}
|
|
1289
|
+
function generateGradientColors(startHex, endHex, steps) {
|
|
1290
|
+
const startRGB = hexToRGB(startHex);
|
|
1291
|
+
const endRGB = hexToRGB(endHex);
|
|
1292
|
+
if (!startRGB || !endRGB) return null;
|
|
1293
|
+
const gradientColors = [];
|
|
1294
|
+
for (let i = 0; i < steps; i++) {
|
|
1295
|
+
const ratio = i / (steps - 1);
|
|
1296
|
+
const r = Math.round(startRGB.r * (1 - ratio) + endRGB.r * ratio);
|
|
1297
|
+
const g = Math.round(startRGB.g * (1 - ratio) + endRGB.g * ratio);
|
|
1298
|
+
const b = Math.round(startRGB.b * (1 - ratio) + endRGB.b * ratio);
|
|
1299
|
+
gradientColors.push(rgbToHex(r, g, b));
|
|
1300
|
+
}
|
|
1301
|
+
return gradientColors;
|
|
1302
|
+
}
|
|
1303
|
+
function generateRandomGradient(steps) {
|
|
1304
|
+
const startHex = generateRandomHexColor();
|
|
1305
|
+
const endHex = generateRandomHexColor();
|
|
1306
|
+
return generateGradientColors(startHex, endHex, steps) || [];
|
|
1307
|
+
}
|
|
1308
|
+
function generateRandomColorPalette(count) {
|
|
1309
|
+
const palette = [];
|
|
1310
|
+
for (let i = 0; i < count; i++) {
|
|
1311
|
+
palette.push(generateRandomHexColor());
|
|
1312
|
+
}
|
|
1313
|
+
return palette;
|
|
1314
|
+
}
|
|
1315
|
+
function generateMonochromaticPalette(baseHex, count) {
|
|
1316
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1317
|
+
if (!baseHSL) return null;
|
|
1318
|
+
const { h, s, l } = baseHSL;
|
|
1319
|
+
const palette = [];
|
|
1320
|
+
for (let i = 0; i < count; i++) {
|
|
1321
|
+
const lightness = clampNumber(l + (i - Math.floor(count / 2)) * 10, 0, 100);
|
|
1322
|
+
palette.push(hslToHex(h, s, lightness));
|
|
1323
|
+
}
|
|
1324
|
+
return palette;
|
|
1325
|
+
}
|
|
1326
|
+
function generateAnalogousPalette(baseHex, count) {
|
|
1327
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1328
|
+
if (!baseHSL) return null;
|
|
1329
|
+
const { h, s, l } = baseHSL;
|
|
1330
|
+
const palette = [];
|
|
1331
|
+
for (let i = 0; i < count; i++) {
|
|
1332
|
+
const hue = (h + (i - Math.floor(count / 2)) * 30 + 360) % 360;
|
|
1333
|
+
palette.push(hslToHex(hue, s, l));
|
|
1334
|
+
}
|
|
1335
|
+
return palette;
|
|
1336
|
+
}
|
|
1337
|
+
function generateComplementaryPalette(baseHex) {
|
|
1338
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1339
|
+
if (!baseHSL) return null;
|
|
1340
|
+
const { h, s, l } = baseHSL;
|
|
1341
|
+
const complementaryHue = (h + 180) % 360;
|
|
1342
|
+
return [baseHex, hslToHex(complementaryHue, s, l)];
|
|
1343
|
+
}
|
|
1344
|
+
function generateTriadicPalette(baseHex) {
|
|
1345
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1346
|
+
if (!baseHSL) return null;
|
|
1347
|
+
const { h, s, l } = baseHSL;
|
|
1348
|
+
const hue1 = (h + 120) % 360;
|
|
1349
|
+
const hue2 = (h + 240) % 360;
|
|
1350
|
+
return [baseHex, hslToHex(hue1, s, l), hslToHex(hue2, s, l)];
|
|
1351
|
+
}
|
|
1352
|
+
function generateTetradicPalette(baseHex) {
|
|
1353
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1354
|
+
if (!baseHSL) return null;
|
|
1355
|
+
const { h, s, l } = baseHSL;
|
|
1356
|
+
const hue1 = (h + 90) % 360;
|
|
1357
|
+
const hue2 = (h + 180) % 360;
|
|
1358
|
+
const hue3 = (h + 270) % 360;
|
|
1359
|
+
return [baseHex, hslToHex(hue1, s, l), hslToHex(hue2, s, l), hslToHex(hue3, s, l)];
|
|
1360
|
+
}
|
|
1361
|
+
function generateRandomPastelColor() {
|
|
1362
|
+
const r = Math.floor(Math.random() * 127 + 128);
|
|
1363
|
+
const g = Math.floor(Math.random() * 127 + 128);
|
|
1364
|
+
const b = Math.floor(Math.random() * 127 + 128);
|
|
1365
|
+
return rgbToHex(r, g, b);
|
|
1366
|
+
}
|
|
1367
|
+
function generateRandomVibrantColor() {
|
|
1368
|
+
const r = Math.floor(Math.random() * 256);
|
|
1369
|
+
const g = Math.floor(Math.random() * 256);
|
|
1370
|
+
const b = Math.floor(Math.random() * 256);
|
|
1371
|
+
return rgbToHex(r, g, b);
|
|
1372
|
+
}
|
|
1373
|
+
function generateRandomMutedColor() {
|
|
1374
|
+
const r = Math.floor(Math.random() * 128 + 64);
|
|
1375
|
+
const g = Math.floor(Math.random() * 128 + 64);
|
|
1376
|
+
const b = Math.floor(Math.random() * 128 + 64);
|
|
1377
|
+
return rgbToHex(r, g, b);
|
|
1378
|
+
}
|
|
1379
|
+
function generateRandomDarkColor() {
|
|
1380
|
+
const r = Math.floor(Math.random() * 128);
|
|
1381
|
+
const g = Math.floor(Math.random() * 128);
|
|
1382
|
+
const b = Math.floor(Math.random() * 128);
|
|
1383
|
+
return rgbToHex(r, g, b);
|
|
1384
|
+
}
|
|
1385
|
+
function generateRandomLightColor() {
|
|
1386
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1387
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1388
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1389
|
+
return rgbToHex(r, g, b);
|
|
1390
|
+
}
|
|
1391
|
+
function generateRandomNeutralColor() {
|
|
1392
|
+
const gray = Math.floor(Math.random() * 256);
|
|
1393
|
+
return rgbToHex(gray, gray, gray);
|
|
1394
|
+
}
|
|
1395
|
+
function generateRandomWarmColor() {
|
|
1396
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1397
|
+
const g = Math.floor(Math.random() * 128);
|
|
1398
|
+
const b = Math.floor(Math.random() * 128);
|
|
1399
|
+
return rgbToHex(r, g, b);
|
|
1400
|
+
}
|
|
1401
|
+
function generateRandomCoolColor() {
|
|
1402
|
+
const r = Math.floor(Math.random() * 128);
|
|
1403
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1404
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1405
|
+
return rgbToHex(r, g, b);
|
|
1406
|
+
}
|
|
1407
|
+
function generateRandomEarthToneColor() {
|
|
1408
|
+
const r = Math.floor(Math.random() * 64 + 64);
|
|
1409
|
+
const g = Math.floor(Math.random() * 64 + 64);
|
|
1410
|
+
const b = Math.floor(Math.random() * 64 + 32);
|
|
1411
|
+
return rgbToHex(r, g, b);
|
|
1412
|
+
}
|
|
1413
|
+
function generateRandomMetallicColor() {
|
|
1414
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1415
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1416
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1417
|
+
return rgbToHex(r, g, b);
|
|
1418
|
+
}
|
|
1419
|
+
function generateRandomNeonColor() {
|
|
1420
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1421
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1422
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1423
|
+
return rgbToHex(r, g, b);
|
|
1424
|
+
}
|
|
1425
|
+
function generateRandomPastelPalette(count) {
|
|
1426
|
+
const palette = [];
|
|
1427
|
+
for (let i = 0; i < count; i++) {
|
|
1428
|
+
palette.push(generateRandomPastelColor());
|
|
1429
|
+
}
|
|
1430
|
+
return palette;
|
|
1431
|
+
}
|
|
1432
|
+
function generateRandomVibrantPalette(count) {
|
|
1433
|
+
const palette = [];
|
|
1434
|
+
for (let i = 0; i < count; i++) {
|
|
1435
|
+
palette.push(generateRandomVibrantColor());
|
|
1436
|
+
}
|
|
1437
|
+
return palette;
|
|
1438
|
+
}
|
|
1439
|
+
function generateRandomMutedPalette(count) {
|
|
1440
|
+
const palette = [];
|
|
1441
|
+
for (let i = 0; i < count; i++) {
|
|
1442
|
+
palette.push(generateRandomMutedColor());
|
|
1443
|
+
}
|
|
1444
|
+
return palette;
|
|
1445
|
+
}
|
|
1446
|
+
function generateRandomDarkPalette(count) {
|
|
1447
|
+
const palette = [];
|
|
1448
|
+
for (let i = 0; i < count; i++) {
|
|
1449
|
+
palette.push(generateRandomDarkColor());
|
|
1450
|
+
}
|
|
1451
|
+
return palette;
|
|
1452
|
+
}
|
|
1453
|
+
function generateRandomLightPalette(count) {
|
|
1454
|
+
const palette = [];
|
|
1455
|
+
for (let i = 0; i < count; i++) {
|
|
1456
|
+
palette.push(generateRandomLightColor());
|
|
1457
|
+
}
|
|
1458
|
+
return palette;
|
|
1459
|
+
}
|
|
1460
|
+
function generateRandomNeutralPalette(count) {
|
|
1461
|
+
const palette = [];
|
|
1462
|
+
for (let i = 0; i < count; i++) {
|
|
1463
|
+
palette.push(generateRandomNeutralColor());
|
|
1464
|
+
}
|
|
1465
|
+
return palette;
|
|
1466
|
+
}
|
|
1467
|
+
function generateRandomWarmPalette(count) {
|
|
1468
|
+
const palette = [];
|
|
1469
|
+
for (let i = 0; i < count; i++) {
|
|
1470
|
+
palette.push(generateRandomWarmColor());
|
|
1471
|
+
}
|
|
1472
|
+
return palette;
|
|
1473
|
+
}
|
|
1474
|
+
function generateRandomCoolPalette(count) {
|
|
1475
|
+
const palette = [];
|
|
1476
|
+
for (let i = 0; i < count; i++) {
|
|
1477
|
+
palette.push(generateRandomCoolColor());
|
|
1478
|
+
}
|
|
1479
|
+
return palette;
|
|
1480
|
+
}
|
|
1481
|
+
function generateRandomEarthTonePalette(count) {
|
|
1482
|
+
const palette = [];
|
|
1483
|
+
for (let i = 0; i < count; i++) {
|
|
1484
|
+
palette.push(generateRandomEarthToneColor());
|
|
1485
|
+
}
|
|
1486
|
+
return palette;
|
|
1487
|
+
}
|
|
1488
|
+
function generateRandomMetallicPalette(count) {
|
|
1489
|
+
const palette = [];
|
|
1490
|
+
for (let i = 0; i < count; i++) {
|
|
1491
|
+
palette.push(generateRandomMetallicColor());
|
|
1492
|
+
}
|
|
1493
|
+
return palette;
|
|
1494
|
+
}
|
|
1495
|
+
function generateRandomNeonPalette(count) {
|
|
1496
|
+
const palette = [];
|
|
1497
|
+
for (let i = 0; i < count; i++) {
|
|
1498
|
+
palette.push(generateRandomNeonColor());
|
|
1499
|
+
}
|
|
1500
|
+
return palette;
|
|
1501
|
+
}
|
|
1502
|
+
function pxToRem(px, base = 16) {
|
|
1503
|
+
return `${px / base}rem`;
|
|
1504
|
+
}
|
|
1505
|
+
function remToPx(rem, base = 16) {
|
|
1506
|
+
const remValue = parseFloat(rem);
|
|
1507
|
+
return remValue * base;
|
|
1508
|
+
}
|
|
1509
|
+
function pxToEm(px, base = 16) {
|
|
1510
|
+
return `${px / base}em`;
|
|
1511
|
+
}
|
|
1512
|
+
function emToPx(em, base = 16) {
|
|
1513
|
+
const emValue = parseFloat(em);
|
|
1514
|
+
return emValue * base;
|
|
1515
|
+
}
|
|
1516
|
+
function pxToPercent(px, total) {
|
|
1517
|
+
return `${px / total * 100}%`;
|
|
1518
|
+
}
|
|
1519
|
+
function percentToPx(percent, total) {
|
|
1520
|
+
const percentValue = parseFloat(percent);
|
|
1521
|
+
return percentValue / 100 * total;
|
|
1522
|
+
}
|
|
1523
|
+
function remToEm(rem, base = 16) {
|
|
1524
|
+
const remValue = parseFloat(rem);
|
|
1525
|
+
return `${remValue}em`;
|
|
1526
|
+
}
|
|
1527
|
+
function generateUniqueId(length = 8) {
|
|
1528
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1529
|
+
let id = "";
|
|
1530
|
+
for (let i = 0; i < length; i++) {
|
|
1531
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1532
|
+
}
|
|
1533
|
+
return id;
|
|
1534
|
+
}
|
|
1535
|
+
function generateUUID() {
|
|
1536
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
1537
|
+
const r = Math.random() * 16 | 0;
|
|
1538
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
1539
|
+
return v.toString(16);
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
function generateShortId(length = 6) {
|
|
1543
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1544
|
+
let id = "";
|
|
1545
|
+
for (let i = 0; i < length; i++) {
|
|
1546
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1547
|
+
}
|
|
1548
|
+
return id;
|
|
1549
|
+
}
|
|
1550
|
+
function generateNanoId(length = 21) {
|
|
1551
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
|
|
1552
|
+
let id = "";
|
|
1553
|
+
for (let i = 0; i < length; i++) {
|
|
1554
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1555
|
+
}
|
|
1556
|
+
return id;
|
|
1557
|
+
}
|
|
1558
|
+
function generateRandomString(length = 10) {
|
|
1559
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1560
|
+
let str = "";
|
|
1561
|
+
for (let i = 0; i < length; i++) {
|
|
1562
|
+
str += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1563
|
+
}
|
|
1564
|
+
return str;
|
|
1565
|
+
}
|
|
1566
|
+
function generateRandomHexId(length = 16) {
|
|
1567
|
+
const chars = "abcdef0123456789";
|
|
1568
|
+
let id = "";
|
|
1569
|
+
for (let i = 0; i < length; i++) {
|
|
1570
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1571
|
+
}
|
|
1572
|
+
return id;
|
|
1573
|
+
}
|
|
1574
|
+
function generateRandomNumericId(length = 8) {
|
|
1575
|
+
const chars = "0123456789";
|
|
1576
|
+
let id = "";
|
|
1577
|
+
for (let i = 0; i < length; i++) {
|
|
1578
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1579
|
+
}
|
|
1580
|
+
return id;
|
|
1581
|
+
}
|
|
1582
|
+
function generateRandomAlphaId(length = 8) {
|
|
1583
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
1584
|
+
let id = "";
|
|
1585
|
+
for (let i = 0; i < length; i++) {
|
|
1586
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1587
|
+
}
|
|
1588
|
+
return id;
|
|
1589
|
+
}
|
|
1590
|
+
function generateRandomAlphanumericId(length = 8) {
|
|
1591
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1592
|
+
let id = "";
|
|
1593
|
+
for (let i = 0; i < length; i++) {
|
|
1594
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1595
|
+
}
|
|
1596
|
+
return id;
|
|
1597
|
+
}
|
|
1598
|
+
function generateRandomBase64Id(length = 12) {
|
|
1599
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1600
|
+
let id = "";
|
|
1601
|
+
for (let i = 0; i < length; i++) {
|
|
1602
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1603
|
+
}
|
|
1604
|
+
return id;
|
|
1605
|
+
}
|
|
1606
|
+
function generateRandomUrlSafeId(length = 12) {
|
|
1607
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
1608
|
+
let id = "";
|
|
1609
|
+
for (let i = 0; i < length; i++) {
|
|
1610
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1611
|
+
}
|
|
1612
|
+
return id;
|
|
1613
|
+
}
|
|
1614
|
+
function generateRandomSlug(length = 8) {
|
|
1615
|
+
const chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
1616
|
+
let slug = "";
|
|
1617
|
+
for (let i = 0; i < length; i++) {
|
|
1618
|
+
slug += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1619
|
+
}
|
|
1620
|
+
return slug;
|
|
1621
|
+
}
|
|
1622
|
+
function generateRandomToken(length = 32) {
|
|
1623
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1624
|
+
let token = "";
|
|
1625
|
+
for (let i = 0; i < length; i++) {
|
|
1626
|
+
token += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1627
|
+
}
|
|
1628
|
+
return token;
|
|
1629
|
+
}
|
|
1630
|
+
function generateRandomApiKey(length = 32) {
|
|
1631
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1632
|
+
let apiKey = "";
|
|
1633
|
+
for (let i = 0; i < length; i++) {
|
|
1634
|
+
apiKey += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1635
|
+
}
|
|
1636
|
+
return apiKey;
|
|
1637
|
+
}
|
|
1638
|
+
function generateRandomSessionId(length = 24) {
|
|
1639
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1640
|
+
let sessionId = "";
|
|
1641
|
+
for (let i = 0; i < length; i++) {
|
|
1642
|
+
sessionId += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1643
|
+
}
|
|
1644
|
+
return sessionId;
|
|
1645
|
+
}
|
|
1646
|
+
function generateRandomPassword(length = 12) {
|
|
1647
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=";
|
|
1648
|
+
let password = "";
|
|
1649
|
+
for (let i = 0; i < length; i++) {
|
|
1650
|
+
password += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1651
|
+
}
|
|
1652
|
+
return password;
|
|
1653
|
+
}
|
|
1654
|
+
function generateRandomUsername(length = 8) {
|
|
1655
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1656
|
+
let username = "";
|
|
1657
|
+
for (let i = 0; i < length; i++) {
|
|
1658
|
+
username += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1659
|
+
}
|
|
1660
|
+
return username;
|
|
1661
|
+
}
|
|
1662
|
+
function generateRandomEmail(length = 8) {
|
|
1663
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1664
|
+
let email = "";
|
|
1665
|
+
for (let i = 0; i < length; i++) {
|
|
1666
|
+
email += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1667
|
+
}
|
|
1668
|
+
return `${email.toLowerCase()}@example.com`;
|
|
1669
|
+
}
|
|
1670
|
+
function generateRandomDomain(length = 8) {
|
|
1671
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1672
|
+
let domain = "";
|
|
1673
|
+
for (let i = 0; i < length; i++) {
|
|
1674
|
+
domain += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1675
|
+
}
|
|
1676
|
+
return `${domain.toLowerCase()}.com`;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
// src/utils/date.ts
|
|
1680
|
+
var dtxParse = (value) => {
|
|
1681
|
+
if (!value) return /* @__PURE__ */ new Date();
|
|
1682
|
+
if (value instanceof Date) {
|
|
1683
|
+
return new Date(value);
|
|
1684
|
+
}
|
|
1685
|
+
return new Date(value);
|
|
1686
|
+
};
|
|
1687
|
+
var date = (value, dateFormat) => {
|
|
1688
|
+
const _dtx = dtxParse(value);
|
|
1689
|
+
const { locale, options } = dateFormat || {};
|
|
1690
|
+
const parts = new Intl.DateTimeFormat(locale || "EN", options).formatToParts(_dtx);
|
|
1691
|
+
const month = _dtx.getMonth();
|
|
1692
|
+
return {
|
|
1693
|
+
date: _dtx,
|
|
1694
|
+
month,
|
|
1695
|
+
parts,
|
|
1696
|
+
getDateSplit: (value2) => {
|
|
1697
|
+
if (!value2) return null;
|
|
1698
|
+
const [month2, year] = value2?.split("-").map(Number);
|
|
1699
|
+
return { year, month: month2 };
|
|
1700
|
+
},
|
|
1701
|
+
// MONTH
|
|
1702
|
+
getMonth: () => _dtx.getMonth(),
|
|
1703
|
+
getMonthFormat: (month2) => new Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit" }).format(_dtx.setMonth(month2)),
|
|
1704
|
+
getMonthsFormat: () => times(12, (i) => new Intl.DateTimeFormat(locale, { month: "short" }).format(_dtx.setMonth(i))),
|
|
1705
|
+
setMonth: (month2) => new Date(_dtx.setMonth(month2)),
|
|
1706
|
+
addMonth: (month2) => new Date(_dtx.setMonth(_dtx.getMonth() + month2)),
|
|
1707
|
+
subtractMonth: (month2) => new Date(_dtx.setMonth(_dtx.getMonth() - month2)),
|
|
1708
|
+
diferenceMonths: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24 * 30)),
|
|
1709
|
+
isSameMonth: (date2) => _dtx.getFullYear() === date2.getFullYear() && _dtx.getMonth() === date2.getMonth(),
|
|
1710
|
+
// YEAR
|
|
1711
|
+
setYear: (year) => new Date(_dtx.setFullYear(year)),
|
|
1712
|
+
getUTCYear: () => _dtx.getUTCFullYear(),
|
|
1713
|
+
addYears: (year) => new Date(_dtx.setFullYear(_dtx.getFullYear() + year)),
|
|
1714
|
+
subtractYears: (year) => new Date(_dtx.setFullYear(_dtx.getFullYear() - year)),
|
|
1715
|
+
diferenceYears: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24 * 365)),
|
|
1716
|
+
isSameYear: (date2) => _dtx.getFullYear() === date2.getFullYear(),
|
|
1717
|
+
// DAYS
|
|
1718
|
+
setDay: (day) => new Date(_dtx.setDate(day)),
|
|
1719
|
+
addDays: (days) => new Date(_dtx.setDate(_dtx.getDate() + days)),
|
|
1720
|
+
getDay: () => _dtx.getDate(),
|
|
1721
|
+
subtractDays: (days) => new Date(_dtx.setDate(_dtx.getDate() - days)),
|
|
1722
|
+
diferenceDays: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24)),
|
|
1723
|
+
isSameDay: (date2) => _dtx.getFullYear() === date2.getFullYear(),
|
|
1724
|
+
// HOURS
|
|
1725
|
+
addHours: (hours) => new Date(_dtx.setHours(_dtx.getHours() + hours)),
|
|
1726
|
+
setHours: (hours) => new Date(_dtx.setHours(hours)),
|
|
1727
|
+
getHours: () => _dtx.getHours(),
|
|
1728
|
+
subtractHours: (hours) => new Date(_dtx.setHours(_dtx.getHours() - hours)),
|
|
1729
|
+
diferenceHours: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60)),
|
|
1730
|
+
// MINUTES
|
|
1731
|
+
addMinutes: (minutes) => new Date(_dtx.setMinutes(_dtx.getMinutes() + minutes)),
|
|
1732
|
+
setMinutes: (minutes) => new Date(_dtx.setMinutes(minutes)),
|
|
1733
|
+
getMinutes: () => _dtx.getMinutes(),
|
|
1734
|
+
subtractMinutes: (minutes) => new Date(_dtx.setMinutes(_dtx.getMinutes() - minutes)),
|
|
1735
|
+
diferenceMinutes: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60)),
|
|
1736
|
+
// SECONDS
|
|
1737
|
+
addSeconds: (seconds) => new Date(_dtx.setSeconds(_dtx.getSeconds() + seconds)),
|
|
1738
|
+
setSeconds: (seconds) => new Date(_dtx.setSeconds(seconds)),
|
|
1739
|
+
getSeconds: () => _dtx.getSeconds(),
|
|
1740
|
+
subtractSeconds: (seconds) => new Date(_dtx.setSeconds(_dtx.getSeconds() - seconds)),
|
|
1741
|
+
diferenceSeconds: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / 1e3),
|
|
1742
|
+
// Utils
|
|
1743
|
+
isToday: () => _dtx.getDate() === (/* @__PURE__ */ new Date()).getDate(),
|
|
1744
|
+
isAfter: (date2) => _dtx.getTime() > new Date(date2).getTime(),
|
|
1745
|
+
isBefore: (date2) => _dtx.getTime() < new Date(date2).getTime(),
|
|
1746
|
+
formatLastMonth: () => {
|
|
1747
|
+
const data = _dtx.setMonth(month - 1);
|
|
1748
|
+
const response = Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit", year: options?.year || "numeric" }).formatToParts(data);
|
|
1749
|
+
return response.map((part) => {
|
|
1750
|
+
if (part.type === "literal") {
|
|
1751
|
+
return "-";
|
|
1752
|
+
}
|
|
1753
|
+
return part.value;
|
|
1754
|
+
}).join("");
|
|
1755
|
+
},
|
|
1756
|
+
formatPrevMonth: () => {
|
|
1757
|
+
const data = _dtx.setMonth(month + 1);
|
|
1758
|
+
const response = Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit", year: options?.year || "numeric" }).formatToParts(data);
|
|
1759
|
+
return response.map((part) => {
|
|
1760
|
+
if (part.type === "literal") {
|
|
1761
|
+
return "-";
|
|
1762
|
+
}
|
|
1763
|
+
return part.value;
|
|
1764
|
+
}).join("");
|
|
1765
|
+
},
|
|
1766
|
+
getDaysInYear: () => new Date(_dtx.getFullYear(), 11, 31).getDate(),
|
|
1767
|
+
getDaysInMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth() + 1, 0).getDate(),
|
|
1768
|
+
getDayOfWeek: () => _dtx.getDay(),
|
|
1769
|
+
getDayOfYear: () => Math.ceil((_dtx.getTime() - new Date(_dtx.getFullYear(), 0, 1).getTime()) / (1e3 * 60 * 60 * 24) + 1),
|
|
1770
|
+
getWeekOfYear: () => Math.ceil(((_dtx.getTime() - new Date(_dtx.getFullYear(), 0, 1).getTime()) / (1e3 * 60 * 60 * 24) + 1) / 7),
|
|
1771
|
+
getStartOfDay: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate()),
|
|
1772
|
+
getEndOfDay: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate(), 23, 59, 59, 999),
|
|
1773
|
+
getStartOfMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), 1),
|
|
1774
|
+
getEndOfMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth() + 1, 0, 23, 59, 59, 999),
|
|
1775
|
+
getStartOfYear: () => new Date(_dtx.getFullYear(), 0, 1),
|
|
1776
|
+
getEndOfYear: () => new Date(_dtx.getFullYear(), 11, 31, 23, 59, 59, 999),
|
|
1777
|
+
isLeapYear: () => _dtx.getFullYear() % 4 === 0 && _dtx.getFullYear() % 100 !== 0 || _dtx.getFullYear() % 400 === 0,
|
|
1778
|
+
isWeekend: () => {
|
|
1779
|
+
const day = _dtx.getDay();
|
|
1780
|
+
return day === 0 || day === 6;
|
|
1781
|
+
},
|
|
1782
|
+
isTomorrow: () => {
|
|
1783
|
+
const tomorrow = /* @__PURE__ */ new Date();
|
|
1784
|
+
tomorrow.setDate((/* @__PURE__ */ new Date()).getDate() + 1);
|
|
1785
|
+
return _dtx.getDate() === tomorrow.getDate() && _dtx.getMonth() === tomorrow.getMonth() && _dtx.getFullYear() === tomorrow.getFullYear();
|
|
1786
|
+
},
|
|
1787
|
+
// FORMATS
|
|
1788
|
+
formatDateWithLocale: (locale2, options2) => _dtx.toLocaleDateString(locale2, options2),
|
|
1789
|
+
formatTimeWithLocale: (locale2, options2) => _dtx.toLocaleTimeString(locale2, options2),
|
|
1790
|
+
formatDateTimeWithLocale: (locale2, options2) => _dtx.toLocaleString(locale2, options2),
|
|
1791
|
+
getDayOfWeekWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { weekday: options?.weekday || "long" }),
|
|
1792
|
+
getMonthNameWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { month: options?.month || "long" }),
|
|
1793
|
+
getYearWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { year: options?.year || "numeric" }),
|
|
1794
|
+
getHourWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { hour: options?.hour || "2-digit" }),
|
|
1795
|
+
getMinuteWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { minute: options?.minute || "2-digit" }),
|
|
1796
|
+
getSecondWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { second: options?.second || "2-digit" }),
|
|
1797
|
+
getDayOfYearWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { day: options?.day || "numeric" }),
|
|
1798
|
+
getTimezoneOffset: () => _dtx.getTimezoneOffset(),
|
|
1799
|
+
convertToTimezone: (timezone) => {
|
|
1800
|
+
const utcDate = new Date(_dtx.getTime() + _dtx.getTimezoneOffset() * 6e4);
|
|
1801
|
+
const tzDate = new Date(utcDate.toLocaleString(locale, { timeZone: timezone }));
|
|
1802
|
+
return tzDate;
|
|
1803
|
+
},
|
|
1804
|
+
toDate() {
|
|
1805
|
+
return dtxParse(_dtx);
|
|
1806
|
+
},
|
|
1807
|
+
Timestamp() {
|
|
1808
|
+
return _dtx.getTime();
|
|
1809
|
+
},
|
|
1810
|
+
ISO: () => {
|
|
1811
|
+
return _dtx.toISOString();
|
|
1812
|
+
},
|
|
1813
|
+
UNIX() {
|
|
1814
|
+
return Math.floor(_dtx.getTime() / 1e3);
|
|
1815
|
+
},
|
|
1816
|
+
UTC() {
|
|
1817
|
+
return new Date(Date.UTC(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate(), _dtx.getHours(), _dtx.getMinutes(), _dtx.getSeconds()));
|
|
1818
|
+
},
|
|
1819
|
+
UTCHours() {
|
|
1820
|
+
return _dtx.getUTCHours();
|
|
1821
|
+
},
|
|
1822
|
+
UTCMinutes() {
|
|
1823
|
+
return _dtx.getUTCMinutes();
|
|
1824
|
+
},
|
|
1825
|
+
UTCSeconds() {
|
|
1826
|
+
return _dtx.getUTCSeconds();
|
|
1827
|
+
},
|
|
1828
|
+
UTCMilliseconds() {
|
|
1829
|
+
return _dtx.getUTCMilliseconds();
|
|
1830
|
+
},
|
|
1831
|
+
UTCWeekendDay() {
|
|
1832
|
+
return _dtx.getUTCDay();
|
|
1833
|
+
},
|
|
1834
|
+
UTCDay() {
|
|
1835
|
+
return _dtx.getUTCDate();
|
|
1836
|
+
},
|
|
1837
|
+
UTCMonth() {
|
|
1838
|
+
return _dtx.getUTCMonth();
|
|
1839
|
+
},
|
|
1840
|
+
UTCFullYear() {
|
|
1841
|
+
return _dtx.getUTCFullYear();
|
|
15
1842
|
}
|
|
16
|
-
return classes.join(" ");
|
|
17
1843
|
};
|
|
18
1844
|
};
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1845
|
+
var dtx = (value, dateFormat) => {
|
|
1846
|
+
const date2 = dtxParse(value);
|
|
1847
|
+
const { locale, options } = dateFormat || {};
|
|
1848
|
+
return {
|
|
1849
|
+
date: date2,
|
|
1850
|
+
isToday() {
|
|
1851
|
+
const today = /* @__PURE__ */ new Date();
|
|
1852
|
+
return date2.getDate() === today.getDate() && date2.getMonth() === today.getMonth() && date2.getFullYear() === today.getFullYear();
|
|
1853
|
+
},
|
|
1854
|
+
isAfter(other) {
|
|
1855
|
+
return date2.getTime() > dtxParse(other).getTime();
|
|
1856
|
+
},
|
|
1857
|
+
isBefore(other) {
|
|
1858
|
+
return date2.getTime() < dtxParse(other).getTime();
|
|
1859
|
+
},
|
|
1860
|
+
format(locale2 = "it-IT", options2) {
|
|
1861
|
+
return new Intl.DateTimeFormat(
|
|
1862
|
+
locale2,
|
|
1863
|
+
options2
|
|
1864
|
+
).format(date2);
|
|
1865
|
+
},
|
|
1866
|
+
setDate(month, day) {
|
|
1867
|
+
const copy = new Date(date2);
|
|
1868
|
+
copy.setMonth(month);
|
|
1869
|
+
copy.setDate(day);
|
|
1870
|
+
return dtx(copy);
|
|
1871
|
+
},
|
|
1872
|
+
addDate(days) {
|
|
1873
|
+
const copy = new Date(date2);
|
|
1874
|
+
copy.setDate(copy.getDate() + days);
|
|
1875
|
+
return dtx(copy);
|
|
1876
|
+
},
|
|
1877
|
+
addDays(days) {
|
|
1878
|
+
const copy = new Date(date2);
|
|
1879
|
+
copy.setDate(copy.getDate() + days);
|
|
1880
|
+
return dtx(copy);
|
|
1881
|
+
},
|
|
1882
|
+
setDay(days) {
|
|
1883
|
+
const copy = new Date(date2);
|
|
1884
|
+
copy.setDate(days);
|
|
1885
|
+
return dtx(copy);
|
|
1886
|
+
},
|
|
1887
|
+
dayStart: () => {
|
|
1888
|
+
const firstDayOfMonth = new Date(date2.getFullYear(), date2.getMonth(), 1);
|
|
1889
|
+
return firstDayOfMonth.getDay();
|
|
1890
|
+
},
|
|
1891
|
+
days: new Date(date2.getFullYear(), date2.getMonth() + 1, 0).getDate(),
|
|
1892
|
+
getCurrentUTCDay: () => {
|
|
1893
|
+
const utcDate = new Date((/* @__PURE__ */ new Date()).toUTCString());
|
|
1894
|
+
return utcDate.getDay();
|
|
1895
|
+
},
|
|
1896
|
+
CalendarDaysInMonth(year, month) {
|
|
1897
|
+
return new Date(year, month + 1, 0).getDate();
|
|
1898
|
+
},
|
|
1899
|
+
isWeekend: (day) => {
|
|
1900
|
+
const date3 = /* @__PURE__ */ new Date();
|
|
1901
|
+
date3.setDate(day);
|
|
1902
|
+
const dayOfWeek = date3.getDay();
|
|
1903
|
+
return dayOfWeek === 0 || dayOfWeek === 6;
|
|
1904
|
+
},
|
|
1905
|
+
addMonth(months) {
|
|
1906
|
+
const copy = new Date(date2);
|
|
1907
|
+
copy.setMonth(copy.getMonth() + months);
|
|
1908
|
+
return dtx(copy);
|
|
1909
|
+
},
|
|
1910
|
+
setMonth(month) {
|
|
1911
|
+
const copy = new Date(date2);
|
|
1912
|
+
copy.setMonth(month);
|
|
1913
|
+
return dtx(copy);
|
|
1914
|
+
},
|
|
1915
|
+
isMonth: (month) => month === (/* @__PURE__ */ new Date()).getMonth(),
|
|
1916
|
+
startOfMonth() {
|
|
1917
|
+
return dtx(
|
|
1918
|
+
new Date(
|
|
1919
|
+
date2.getFullYear(),
|
|
1920
|
+
date2.getMonth(),
|
|
1921
|
+
1
|
|
1922
|
+
)
|
|
1923
|
+
);
|
|
1924
|
+
},
|
|
1925
|
+
endOfMonth() {
|
|
1926
|
+
return dtx(
|
|
1927
|
+
new Date(
|
|
1928
|
+
date2.getFullYear(),
|
|
1929
|
+
date2.getMonth() + 1,
|
|
1930
|
+
0
|
|
1931
|
+
)
|
|
1932
|
+
);
|
|
1933
|
+
},
|
|
1934
|
+
getMonthsLocale(locale2 = "EN") {
|
|
1935
|
+
return times(12, (i) => new Intl.DateTimeFormat(locale2, { month: options?.month || "short" }).format(new Date(2e3, i, 1)));
|
|
1936
|
+
},
|
|
1937
|
+
toDate() {
|
|
1938
|
+
return new Date(date2);
|
|
1939
|
+
},
|
|
1940
|
+
toISOString() {
|
|
1941
|
+
return date2.toISOString();
|
|
1942
|
+
},
|
|
1943
|
+
CalendarYearFormat(year, format = "YYYY") {
|
|
1944
|
+
return Intl.DateTimeFormat(dateFormat?.locale, { year: format === "YYYY" ? "numeric" : "2-digit" }).format(new Date(year, 0, 1));
|
|
1945
|
+
},
|
|
1946
|
+
calendar: (props) => {
|
|
1947
|
+
const { dtx: dtx2, month, day, data, selected } = props || {};
|
|
1948
|
+
return {
|
|
1949
|
+
day,
|
|
1950
|
+
date: dtx2.toDate(),
|
|
1951
|
+
iso: dtx2.toISOString(),
|
|
1952
|
+
month,
|
|
1953
|
+
key: dtx2.format(locale || "EN", { month: "2-digit", day: "2-digit", year: "numeric" }).replace(/\//g, "-"),
|
|
1954
|
+
monthName: dtx2.format(locale || "EN", { month: options?.month || "short" }),
|
|
1955
|
+
isToday: dtx2.isToday(),
|
|
1956
|
+
isPast: dtx2.isBefore(/* @__PURE__ */ new Date()),
|
|
1957
|
+
isFuture: dtx2.isAfter(/* @__PURE__ */ new Date()),
|
|
1958
|
+
isCurrentMonth: dtx2.isMonth(month),
|
|
1959
|
+
selected: selected?.day === day || false,
|
|
1960
|
+
data: data || null
|
|
1961
|
+
};
|
|
25
1962
|
}
|
|
26
|
-
|
|
27
|
-
}).join(" ");
|
|
1963
|
+
};
|
|
28
1964
|
};
|
|
29
1965
|
|
|
30
1966
|
// src/utils/calendar.ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
35
|
-
const today = dayjs().startOf("day");
|
|
36
|
-
const startOfMonth = dayjs().year(year).month(month).startOf("month");
|
|
37
|
-
const endOfMonth = dayjs().year(year).month(month).endOf("month");
|
|
1967
|
+
function getMonthCalendar(dataFormat, year, month, startIndex, selected, props) {
|
|
1968
|
+
const { locale, days, options } = dataFormat || {};
|
|
1969
|
+
const _date = dtx(new Date(year, month, 1), dataFormat);
|
|
38
1970
|
let dayCurrent = {};
|
|
39
|
-
let startDay =
|
|
1971
|
+
let startDay = _date.dayStart();
|
|
40
1972
|
startDay = startDay === 0 ? 6 : startDay - 1;
|
|
41
|
-
const daysInMonth =
|
|
1973
|
+
const daysInMonth = _date.days;
|
|
42
1974
|
const calendar = [];
|
|
43
1975
|
let week = [];
|
|
44
1976
|
for (let i = 0; i < startDay; i++) {
|
|
45
1977
|
week.push(null);
|
|
46
1978
|
}
|
|
47
1979
|
for (let day = 1; day <= daysInMonth; day++) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const isToday = date.isSame(today, "day");
|
|
51
|
-
const isPast = date.isBefore(today, "day");
|
|
52
|
-
const isFuture = date.isAfter(today, "day");
|
|
53
|
-
if (date.isSame(today, "day")) {
|
|
54
|
-
dayCurrent = {
|
|
55
|
-
day,
|
|
56
|
-
date,
|
|
57
|
-
isToday,
|
|
58
|
-
isPast,
|
|
59
|
-
isFuture,
|
|
60
|
-
isCurrentMonth: true,
|
|
61
|
-
selected: true,
|
|
62
|
-
data: props ? props[key] || null : null
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
week.push({
|
|
66
|
-
day,
|
|
67
|
-
date,
|
|
68
|
-
isToday,
|
|
69
|
-
isPast,
|
|
70
|
-
isFuture,
|
|
71
|
-
isCurrentMonth: true,
|
|
72
|
-
selected: selected ? date.isSame(selected?.date, "day") : false,
|
|
73
|
-
data: props ? props[key] || null : null
|
|
74
|
-
});
|
|
1980
|
+
const key = _date.format(dataFormat.locale || "EN", { day: "2-digit", month: "2-digit", year: "numeric" });
|
|
1981
|
+
week.push(_date.calendar({ dtx: _date.setDate(month, day), month, day, data: [], selected, key }));
|
|
75
1982
|
if (week.length === 7) {
|
|
76
1983
|
calendar.push(week);
|
|
77
1984
|
week = [];
|
|
@@ -93,40 +2000,46 @@ function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
|
93
2000
|
return {
|
|
94
2001
|
calendar,
|
|
95
2002
|
month,
|
|
96
|
-
date:
|
|
97
|
-
daysContainer: getDaysContainer(),
|
|
98
|
-
monthLabel:
|
|
99
|
-
yearLabel:
|
|
100
|
-
days:
|
|
2003
|
+
date: _date.toDate(),
|
|
2004
|
+
daysContainer: getDaysContainer().map((i) => ({ label: isEmpty(days) ? i : days?.[i], value: i })),
|
|
2005
|
+
monthLabel: _date.getMonthsLocale(locale)[month],
|
|
2006
|
+
yearLabel: _date.CalendarYearFormat(year),
|
|
2007
|
+
days: _date.CalendarDaysInMonth(year, month),
|
|
101
2008
|
weeks: calendar.length,
|
|
102
|
-
isWeekend:
|
|
2009
|
+
isWeekend: _date.isWeekend(_date.getCurrentUTCDay()),
|
|
103
2010
|
selected: selected ? Object.assign({}, selected) : null,
|
|
104
|
-
currentDay: dayCurrent
|
|
2011
|
+
currentDay: dayCurrent,
|
|
2012
|
+
props
|
|
105
2013
|
};
|
|
106
2014
|
}
|
|
107
|
-
function getMonthCalendarProps({ year, data, value,
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
2015
|
+
function getMonthCalendarProps({ year, data, value, format }) {
|
|
2016
|
+
const dtx2 = date(new Date(year, 0, 1), format);
|
|
2017
|
+
const months = dtx2.getMonthsFormat();
|
|
2018
|
+
const r = dtx2.getDateSplit(value);
|
|
2019
|
+
const smonths = times(
|
|
2020
|
+
months.length,
|
|
2021
|
+
(i) => ({
|
|
2022
|
+
year,
|
|
2023
|
+
label: upperCase(months[i]),
|
|
2024
|
+
value: dtx2.getMonthFormat(i),
|
|
2025
|
+
disabled: dtx2.isAfter(new Date(year, i)) || !!data.exclude.find((e) => e.year === year)?.months.includes(i),
|
|
2026
|
+
selected: !data.selected ? false : r?.month === i + 1 && r?.year === year
|
|
2027
|
+
})
|
|
2028
|
+
);
|
|
2029
|
+
const resolve = {
|
|
113
2030
|
year,
|
|
114
|
-
startIndex,
|
|
2031
|
+
startIndex: dtx2.getMonth(),
|
|
115
2032
|
years: data.years,
|
|
116
2033
|
value,
|
|
117
|
-
last:
|
|
118
|
-
prev:
|
|
119
|
-
months:
|
|
120
|
-
label: dayjs().month(i).format(daysFormat?.month || "MMM"),
|
|
121
|
-
value: dayjs().month(i).format(daysFormat?.value || "MM"),
|
|
122
|
-
disabled: dayjs().year(year).month(i).isAfter(dayjs(), "month") || data.exclude.find((e) => e.year === year)?.months.includes(i),
|
|
123
|
-
selected: !data.selected ? false : dayjs().year(year).month(Number(value?.split("-")[0]) - 1).format("MM") === dayjs().month(i).format(daysFormat?.value || "MM")
|
|
124
|
-
}))
|
|
2034
|
+
last: dtx2.formatLastMonth(),
|
|
2035
|
+
prev: dtx2.formatPrevMonth(),
|
|
2036
|
+
months: smonths
|
|
125
2037
|
};
|
|
2038
|
+
return resolve;
|
|
126
2039
|
}
|
|
127
2040
|
|
|
128
2041
|
// src/utils/color.ts
|
|
129
|
-
var
|
|
2042
|
+
var rgbToHex2 = (r, g, b) => {
|
|
130
2043
|
return "#" + [r, g, b].map(
|
|
131
2044
|
(v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0")
|
|
132
2045
|
).join("");
|
|
@@ -169,7 +2082,7 @@ var createPaletteColor = (main) => {
|
|
|
169
2082
|
};
|
|
170
2083
|
var lighten = (hex, amount) => {
|
|
171
2084
|
const { r, g, b } = hexToRgb(hex);
|
|
172
|
-
return
|
|
2085
|
+
return rgbToHex2(
|
|
173
2086
|
r + (255 - r) * amount,
|
|
174
2087
|
g + (255 - g) * amount,
|
|
175
2088
|
b + (255 - b) * amount
|
|
@@ -177,7 +2090,7 @@ var lighten = (hex, amount) => {
|
|
|
177
2090
|
};
|
|
178
2091
|
var darken = (hex, amount) => {
|
|
179
2092
|
const { r, g, b } = hexToRgb(hex);
|
|
180
|
-
return
|
|
2093
|
+
return rgbToHex2(
|
|
181
2094
|
r * (1 - amount),
|
|
182
2095
|
g * (1 - amount),
|
|
183
2096
|
b * (1 - amount)
|
|
@@ -188,27 +2101,6 @@ var alpha = (hex, opacity) => {
|
|
|
188
2101
|
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
189
2102
|
};
|
|
190
2103
|
|
|
191
|
-
// src/utils/common.ts
|
|
192
|
-
function isEmpty(value) {
|
|
193
|
-
if (value == null) return true;
|
|
194
|
-
if (typeof value === "string") return value.trim().length === 0;
|
|
195
|
-
if (Array.isArray(value)) return value.length === 0;
|
|
196
|
-
if (value instanceof Map || value instanceof Set) {
|
|
197
|
-
return value.size === 0;
|
|
198
|
-
}
|
|
199
|
-
if (typeof value === "object") {
|
|
200
|
-
return Object.keys(value).length === 0;
|
|
201
|
-
}
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
function times(n, iteratee) {
|
|
205
|
-
const result = [];
|
|
206
|
-
for (let i = 0; i < n; i++) {
|
|
207
|
-
result.push(iteratee(i));
|
|
208
|
-
}
|
|
209
|
-
return result;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
2104
|
// src/utils/cx.ts
|
|
213
2105
|
var cx = (...args) => {
|
|
214
2106
|
return args.flatMap((arg) => {
|
|
@@ -295,10 +2187,10 @@ var createVariants = (config) => {
|
|
|
295
2187
|
return (props = {}) => {
|
|
296
2188
|
const classes = [config.base];
|
|
297
2189
|
if (config.variants) {
|
|
298
|
-
Object.entries(config.variants).forEach(([key,
|
|
2190
|
+
Object.entries(config.variants).forEach(([key, map2]) => {
|
|
299
2191
|
const value = props[key];
|
|
300
|
-
if (value &&
|
|
301
|
-
classes.push(
|
|
2192
|
+
if (value && map2[value]) {
|
|
2193
|
+
classes.push(map2[value]);
|
|
302
2194
|
}
|
|
303
2195
|
});
|
|
304
2196
|
}
|
|
@@ -349,13 +2241,13 @@ var getNumberPhone = (phone, dial) => {
|
|
|
349
2241
|
};
|
|
350
2242
|
|
|
351
2243
|
// src/utils/merge.ts
|
|
352
|
-
function
|
|
2244
|
+
function mergeDeep2(target, source) {
|
|
353
2245
|
if (!source) return target;
|
|
354
2246
|
const output = { ...target };
|
|
355
|
-
Object.keys(source)
|
|
2247
|
+
Object.keys(source)?.forEach((key) => {
|
|
356
2248
|
const k = key;
|
|
357
2249
|
if (typeof source[k] === "object" && source[k] !== null && !Array.isArray(source[k])) {
|
|
358
|
-
output[k] =
|
|
2250
|
+
output[k] = mergeDeep2(
|
|
359
2251
|
target[k] || {},
|
|
360
2252
|
source[k]
|
|
361
2253
|
);
|
|
@@ -365,6 +2257,10 @@ function mergeDeep(target, source) {
|
|
|
365
2257
|
});
|
|
366
2258
|
return output;
|
|
367
2259
|
}
|
|
2260
|
+
function mergeInitialProps(initial, props) {
|
|
2261
|
+
if (!props) return initial;
|
|
2262
|
+
return mergeDeep2(initial, props);
|
|
2263
|
+
}
|
|
368
2264
|
|
|
369
2265
|
// src/utils/input.ts
|
|
370
2266
|
var inputCurrency = (e, value, alloweds) => {
|
|
@@ -375,6 +2271,11 @@ var inputCurrency = (e, value, alloweds) => {
|
|
|
375
2271
|
e.preventDefault();
|
|
376
2272
|
};
|
|
377
2273
|
|
|
2274
|
+
// src/utils/utils.ts
|
|
2275
|
+
var utils = {
|
|
2276
|
+
...common_exports
|
|
2277
|
+
};
|
|
2278
|
+
|
|
378
2279
|
// src/theme/breakpoint.ts
|
|
379
2280
|
var breakpoints = {
|
|
380
2281
|
xs: 0,
|
|
@@ -690,32 +2591,153 @@ var boxVariants = createVariants({
|
|
|
690
2591
|
sticky: "yr3Box--position-sticky"
|
|
691
2592
|
}
|
|
692
2593
|
}
|
|
693
|
-
});
|
|
694
|
-
|
|
695
|
-
// src/components/Box/Box.tsx
|
|
696
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
697
|
-
var Box = ({
|
|
698
|
-
content = "start",
|
|
699
|
-
children,
|
|
700
|
-
drawer = false,
|
|
701
|
-
ui,
|
|
702
|
-
style,
|
|
703
|
-
as: Component = "div",
|
|
704
|
-
position = "relative",
|
|
705
|
-
...props
|
|
706
|
-
}) => {
|
|
707
|
-
const classes = boxVariants({ content, drawer, position });
|
|
708
|
-
return /* @__PURE__ */ jsx4(
|
|
709
|
-
Component,
|
|
710
|
-
{
|
|
711
|
-
className: classes,
|
|
712
|
-
style: composeStyles(ui, style),
|
|
713
|
-
...props,
|
|
714
|
-
"data-testid": "yr3Box",
|
|
715
|
-
children
|
|
716
|
-
}
|
|
717
|
-
);
|
|
2594
|
+
});
|
|
2595
|
+
|
|
2596
|
+
// src/components/Box/Box.tsx
|
|
2597
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2598
|
+
var Box = ({
|
|
2599
|
+
content = "start",
|
|
2600
|
+
children,
|
|
2601
|
+
drawer = false,
|
|
2602
|
+
ui,
|
|
2603
|
+
style,
|
|
2604
|
+
as: Component = "div",
|
|
2605
|
+
position = "relative",
|
|
2606
|
+
...props
|
|
2607
|
+
}) => {
|
|
2608
|
+
const classes = boxVariants({ content, drawer, position });
|
|
2609
|
+
return /* @__PURE__ */ jsx4(
|
|
2610
|
+
Component,
|
|
2611
|
+
{
|
|
2612
|
+
className: classes,
|
|
2613
|
+
style: composeStyles(ui, style),
|
|
2614
|
+
...props,
|
|
2615
|
+
"data-testid": "yr3Box",
|
|
2616
|
+
children
|
|
2617
|
+
}
|
|
2618
|
+
);
|
|
2619
|
+
};
|
|
2620
|
+
|
|
2621
|
+
// src/components/Flex/flex.variants.ts
|
|
2622
|
+
var flexVariants = createVariants({
|
|
2623
|
+
base: "yr3Flex",
|
|
2624
|
+
variants: {
|
|
2625
|
+
variant: {
|
|
2626
|
+
row: "yr3Flex--row",
|
|
2627
|
+
column: "yr3Flex--column",
|
|
2628
|
+
wrap: "yr3Flex--wrap"
|
|
2629
|
+
},
|
|
2630
|
+
container: {
|
|
2631
|
+
true: "yr3Flex--container"
|
|
2632
|
+
},
|
|
2633
|
+
center: {
|
|
2634
|
+
true: "yr3Flex--center"
|
|
2635
|
+
},
|
|
2636
|
+
between: {
|
|
2637
|
+
true: "yr3Flex--between"
|
|
2638
|
+
},
|
|
2639
|
+
bordered: {
|
|
2640
|
+
true: "yr3Flex--bordered"
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
});
|
|
2644
|
+
var flex_variants_default = flexVariants;
|
|
2645
|
+
|
|
2646
|
+
// src/components/Flex/Flex.tsx
|
|
2647
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2648
|
+
var Flex = ({
|
|
2649
|
+
container = false,
|
|
2650
|
+
spacing: spacing2 = 1,
|
|
2651
|
+
children,
|
|
2652
|
+
ui,
|
|
2653
|
+
gap,
|
|
2654
|
+
variant = "column",
|
|
2655
|
+
center = false,
|
|
2656
|
+
between = false,
|
|
2657
|
+
style,
|
|
2658
|
+
bordered = false,
|
|
2659
|
+
...props
|
|
2660
|
+
}) => {
|
|
2661
|
+
const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
|
|
2662
|
+
return /* @__PURE__ */ jsx5(
|
|
2663
|
+
"div",
|
|
2664
|
+
{
|
|
2665
|
+
className: classes,
|
|
2666
|
+
style: composeStyles(ui, style),
|
|
2667
|
+
...props,
|
|
2668
|
+
"data-testid": "yr3Flex",
|
|
2669
|
+
children
|
|
2670
|
+
}
|
|
2671
|
+
);
|
|
2672
|
+
};
|
|
2673
|
+
|
|
2674
|
+
// src/components/Loader/loader.variants.ts
|
|
2675
|
+
var loaderSpinnerVariants = createVariants({
|
|
2676
|
+
base: "yr3Loader--spinner",
|
|
2677
|
+
variants: {
|
|
2678
|
+
color: {
|
|
2679
|
+
primary: "yr3Loader--spinner-color-primary",
|
|
2680
|
+
secondary: "yr3Loader--spinner-color-secondary",
|
|
2681
|
+
success: "yr3Loader--spinner-color-success",
|
|
2682
|
+
error: "yr3Loader--spinner-color-error",
|
|
2683
|
+
warning: "yr3Loader--spinner-color-warning",
|
|
2684
|
+
info: "yr3Loader--spinner-color-info",
|
|
2685
|
+
disabled: "yr3Loader--spinner-color-disabled",
|
|
2686
|
+
text: "yr3Loader--spinner-color-text",
|
|
2687
|
+
background: "yr3Loader--spinner-color-background",
|
|
2688
|
+
common: "yr3Loader--spinner-color-common"
|
|
2689
|
+
},
|
|
2690
|
+
size: {
|
|
2691
|
+
sm: "yr3Loader--spinner-size-sm",
|
|
2692
|
+
md: "yr3Loader--spinner-size-md",
|
|
2693
|
+
lg: "yr3Loader--spinner-size-lg",
|
|
2694
|
+
xs: "yr3Loader--spinner-size-xs"
|
|
2695
|
+
},
|
|
2696
|
+
type: {
|
|
2697
|
+
default: "yr3Loader--spinner-default",
|
|
2698
|
+
dots: "yr3Loader--spinner-dots",
|
|
2699
|
+
fancy: "yr3Loader--spinner-fancy"
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
});
|
|
2703
|
+
|
|
2704
|
+
// src/components/Loader/Loader.tsx
|
|
2705
|
+
import * as React3 from "react";
|
|
2706
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2707
|
+
var initialComponents = {
|
|
2708
|
+
loader: {
|
|
2709
|
+
ui: {},
|
|
2710
|
+
style: {}
|
|
2711
|
+
},
|
|
2712
|
+
spinner: {
|
|
2713
|
+
size: "sm",
|
|
2714
|
+
color: "primary",
|
|
2715
|
+
type: "default"
|
|
2716
|
+
},
|
|
2717
|
+
container: {
|
|
2718
|
+
center: true,
|
|
2719
|
+
container: true,
|
|
2720
|
+
ui: {
|
|
2721
|
+
width: "100%",
|
|
2722
|
+
height: "100%"
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
};
|
|
2726
|
+
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2727
|
+
const properties = mergeDeep2(initialComponents, propsComponent || {});
|
|
2728
|
+
const classSpinner = loaderSpinnerVariants({
|
|
2729
|
+
color: properties?.spinner?.color,
|
|
2730
|
+
type: properties?.spinner?.type,
|
|
2731
|
+
size: properties?.spinner?.size
|
|
2732
|
+
});
|
|
2733
|
+
if (!loading) return null;
|
|
2734
|
+
return /* @__PURE__ */ jsx6("div", { className: "yr3Loader", style: composeStyles(properties?.loader?.ui, properties?.loader?.style), children: /* @__PURE__ */ jsx6(Flex, { ...properties?.container, children: component || /* @__PURE__ */ jsx6("div", { className: classSpinner, children: properties?.spinner?.type === "dots" && /* @__PURE__ */ jsxs2(React3.Fragment, { children: [
|
|
2735
|
+
/* @__PURE__ */ jsx6("span", {}),
|
|
2736
|
+
/* @__PURE__ */ jsx6("span", {}),
|
|
2737
|
+
/* @__PURE__ */ jsx6("span", {})
|
|
2738
|
+
] }) }) }) });
|
|
718
2739
|
};
|
|
2740
|
+
var Loader_default = Loader;
|
|
719
2741
|
|
|
720
2742
|
// src/components/Text/text.variants.ts
|
|
721
2743
|
var textVariants = createVariants({
|
|
@@ -764,7 +2786,7 @@ var textVariants = createVariants({
|
|
|
764
2786
|
var text_variants_default = textVariants;
|
|
765
2787
|
|
|
766
2788
|
// src/components/Text/Text.tsx
|
|
767
|
-
import { jsx as
|
|
2789
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
768
2790
|
var Text = ({
|
|
769
2791
|
children,
|
|
770
2792
|
variant = "inherit",
|
|
@@ -778,7 +2800,7 @@ var Text = ({
|
|
|
778
2800
|
}) => {
|
|
779
2801
|
const styleUI = uiStyle({ ...ui, marginTop: gutters[0] || 0, marginBottom: gutters[1] || 0 });
|
|
780
2802
|
const classes = text_variants_default({ variant, color, weight });
|
|
781
|
-
return /* @__PURE__ */
|
|
2803
|
+
return /* @__PURE__ */ jsx7(
|
|
782
2804
|
Component,
|
|
783
2805
|
{
|
|
784
2806
|
className: classes,
|
|
@@ -823,15 +2845,18 @@ var buttonVariant = createVariants({
|
|
|
823
2845
|
},
|
|
824
2846
|
animated: {
|
|
825
2847
|
true: "yr3Button--animated"
|
|
2848
|
+
},
|
|
2849
|
+
loading: {
|
|
2850
|
+
true: "yr3Button--spinner-size-md "
|
|
826
2851
|
}
|
|
827
2852
|
}
|
|
828
2853
|
});
|
|
829
2854
|
|
|
830
2855
|
// src/components/Button/Button.tsx
|
|
831
|
-
import { jsx as
|
|
2856
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
832
2857
|
var Button = ({ icon, children, color = "text", variant = "text", animated, disabled, gradientBorder = false, size = "auto", ui, style, propsComponent, ...props }) => {
|
|
833
2858
|
const buttonClassname = buttonVariant({ variant, color, animated, disabled, gradientBorder, size });
|
|
834
|
-
return /* @__PURE__ */
|
|
2859
|
+
return /* @__PURE__ */ jsxs3(
|
|
835
2860
|
"button",
|
|
836
2861
|
{
|
|
837
2862
|
className: buttonClassname,
|
|
@@ -840,17 +2865,16 @@ var Button = ({ icon, children, color = "text", variant = "text", animated, disa
|
|
|
840
2865
|
...props,
|
|
841
2866
|
style: composeStyles(ui, style),
|
|
842
2867
|
children: [
|
|
843
|
-
|
|
844
|
-
/* @__PURE__ */
|
|
2868
|
+
/* @__PURE__ */ jsx8(Loader_default, { ...propsComponent?.loader }),
|
|
2869
|
+
icon && /* @__PURE__ */ jsx8("span", { className: "yr3Button--icon", children: icon }),
|
|
2870
|
+
/* @__PURE__ */ jsx8(Text, { variant: propsComponent?.text?.variant || "button", ...propsComponent?.text, children })
|
|
845
2871
|
]
|
|
846
2872
|
}
|
|
847
2873
|
);
|
|
848
2874
|
};
|
|
849
2875
|
|
|
850
2876
|
// src/components/Calendar/Calendar.tsx
|
|
851
|
-
import * as
|
|
852
|
-
import dayjs2 from "dayjs";
|
|
853
|
-
import weekday from "dayjs/plugin/weekday";
|
|
2877
|
+
import * as React4 from "react";
|
|
854
2878
|
|
|
855
2879
|
// src/components/Calendar/calendar.variants.ts
|
|
856
2880
|
var calendarVariants = createVariants({
|
|
@@ -899,14 +2923,22 @@ var calendarDayVariants = createVariants({
|
|
|
899
2923
|
});
|
|
900
2924
|
|
|
901
2925
|
// src/components/Calendar/Calendar.tsx
|
|
902
|
-
import { jsx as
|
|
903
|
-
dayjs2.extend(weekday);
|
|
2926
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
904
2927
|
var initalPropsComponent = {
|
|
905
2928
|
displayButtons: true,
|
|
906
2929
|
displayCalendar: true,
|
|
2930
|
+
container: {
|
|
2931
|
+
ui: {
|
|
2932
|
+
width: "100%",
|
|
2933
|
+
maxWidth: 400
|
|
2934
|
+
},
|
|
2935
|
+
style: {}
|
|
2936
|
+
},
|
|
907
2937
|
header: {
|
|
908
2938
|
color: "primary",
|
|
909
|
-
ui: {
|
|
2939
|
+
ui: {
|
|
2940
|
+
px: 0.5
|
|
2941
|
+
},
|
|
910
2942
|
style: {}
|
|
911
2943
|
},
|
|
912
2944
|
month: {
|
|
@@ -916,6 +2948,7 @@ var initalPropsComponent = {
|
|
|
916
2948
|
},
|
|
917
2949
|
day: {
|
|
918
2950
|
color: "primary",
|
|
2951
|
+
selected: "secondary",
|
|
919
2952
|
bordered: true,
|
|
920
2953
|
ui: {},
|
|
921
2954
|
style: {},
|
|
@@ -923,49 +2956,89 @@ var initalPropsComponent = {
|
|
|
923
2956
|
},
|
|
924
2957
|
buttonNext: {
|
|
925
2958
|
disabled: false,
|
|
926
|
-
label: "next"
|
|
2959
|
+
label: "next",
|
|
2960
|
+
color: "primary",
|
|
2961
|
+
ui: {
|
|
2962
|
+
justifyContent: "flex-end",
|
|
2963
|
+
p: 0
|
|
2964
|
+
}
|
|
927
2965
|
},
|
|
928
2966
|
buttonBack: {
|
|
929
2967
|
disabled: false,
|
|
930
|
-
label: "back"
|
|
2968
|
+
label: "back",
|
|
2969
|
+
color: "primary",
|
|
2970
|
+
ui: {
|
|
2971
|
+
justifyContent: "flex-start",
|
|
2972
|
+
p: 0
|
|
2973
|
+
}
|
|
931
2974
|
}
|
|
932
2975
|
};
|
|
933
|
-
var Calendar = ({ onSelect, propsComponent
|
|
934
|
-
const
|
|
935
|
-
const
|
|
936
|
-
const
|
|
937
|
-
const
|
|
938
|
-
|
|
2976
|
+
var Calendar = ({ onSelect, propsComponent, mapCalendar, onMonthChange, dataFormat, buttonsComponent }) => {
|
|
2977
|
+
const properties = mergeInitialProps(initalPropsComponent, propsComponent);
|
|
2978
|
+
const _date = /* @__PURE__ */ new Date();
|
|
2979
|
+
const month = date(_date).getMonth();
|
|
2980
|
+
const [currentMonth, setCurrentMonth] = React4.useState(month);
|
|
2981
|
+
const [selected, setSelected] = React4.useState(null);
|
|
2982
|
+
const program = React4.useMemo(() => {
|
|
2983
|
+
return getMonthCalendar(dataFormat, (/* @__PURE__ */ new Date()).getFullYear(), currentMonth, 0, selected, mapCalendar);
|
|
939
2984
|
}, [selected, currentMonth, mapCalendar]);
|
|
940
|
-
|
|
2985
|
+
React4.useEffect(() => {
|
|
941
2986
|
if (selected) {
|
|
942
2987
|
onSelect && onSelect(selected);
|
|
943
2988
|
} else {
|
|
944
|
-
onSelect && onSelect(program
|
|
2989
|
+
onSelect && onSelect(program?.currentDay);
|
|
945
2990
|
}
|
|
946
2991
|
}, [selected, program, onSelect]);
|
|
947
|
-
|
|
2992
|
+
React4.useEffect(() => {
|
|
948
2993
|
if (currentMonth) {
|
|
949
2994
|
onMonthChange && onMonthChange(currentMonth);
|
|
950
2995
|
}
|
|
951
2996
|
}, [currentMonth]);
|
|
952
|
-
return /* @__PURE__ */
|
|
953
|
-
propsComponent?.displayButtons && /* @__PURE__ */
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
|
|
956
|
-
|
|
2997
|
+
return /* @__PURE__ */ jsxs4("div", { className: "yr3Calendar", "data-testid": "yr3Calendar", style: composeStyles(properties?.container?.ui, properties?.container?.style), children: [
|
|
2998
|
+
propsComponent?.displayButtons && /* @__PURE__ */ jsxs4("div", { className: "yr3Calendar--header", "data-testid": "yr3CalendarHeader", style: composeStyles(properties?.header?.ui, properties?.header?.style), children: [
|
|
2999
|
+
/* @__PURE__ */ jsx9(
|
|
3000
|
+
Button,
|
|
3001
|
+
{
|
|
3002
|
+
disabled: properties?.buttonBack?.disabled || false,
|
|
3003
|
+
color: properties.buttonBack?.color || "primary",
|
|
3004
|
+
onClick: () => setCurrentMonth(currentMonth - 1),
|
|
3005
|
+
ui: { ...properties.buttonBack.ui },
|
|
3006
|
+
propsComponent: {
|
|
3007
|
+
text: {
|
|
3008
|
+
color: properties?.buttonBack?.color || "primary"
|
|
3009
|
+
}
|
|
3010
|
+
},
|
|
3011
|
+
children: buttonsComponent?.buttonBack ? buttonsComponent?.buttonBack : properties?.buttonBack?.label
|
|
3012
|
+
}
|
|
3013
|
+
),
|
|
3014
|
+
/* @__PURE__ */ jsx9(Text, { variant: "h6", color: properties.header?.color || "primary", ui: { textTransform: "uppercase", textAlign: "center" }, children: program?.monthLabel }),
|
|
3015
|
+
/* @__PURE__ */ jsx9(
|
|
3016
|
+
Button,
|
|
3017
|
+
{
|
|
3018
|
+
disabled: properties?.buttonNext?.disabled,
|
|
3019
|
+
color: properties?.buttonNext?.color || "primary",
|
|
3020
|
+
onClick: () => setCurrentMonth(currentMonth + 1),
|
|
3021
|
+
propsComponent: {
|
|
3022
|
+
text: {
|
|
3023
|
+
color: properties?.buttonNext?.color || "primary"
|
|
3024
|
+
}
|
|
3025
|
+
},
|
|
3026
|
+
ui: { ...properties.buttonNext.ui },
|
|
3027
|
+
children: buttonsComponent?.buttonNext ? buttonsComponent?.buttonNext : properties?.buttonNext?.label
|
|
3028
|
+
}
|
|
3029
|
+
)
|
|
957
3030
|
] }),
|
|
958
|
-
|
|
959
|
-
program?.daysContainer
|
|
3031
|
+
properties?.displayCalendar && /* @__PURE__ */ jsxs4("div", { className: "yr3Calendar--container", children: [
|
|
3032
|
+
program?.daysContainer?.map((i) => /* @__PURE__ */ jsx9("div", { className: "yr3Calendar--month", style: composeStyles(properties?.month?.ui, properties?.month?.style), children: /* @__PURE__ */ jsx9(
|
|
960
3033
|
Text,
|
|
961
3034
|
{
|
|
962
3035
|
variant: "caption",
|
|
963
|
-
color:
|
|
964
|
-
ui: { ...
|
|
965
|
-
children:
|
|
3036
|
+
color: properties?.month?.color || "primary",
|
|
3037
|
+
ui: { ...properties?.month?.ui, opacity: 0.7, textTransform: "uppercase" },
|
|
3038
|
+
children: i.label
|
|
966
3039
|
}
|
|
967
|
-
) }, `month_day_${i}`)),
|
|
968
|
-
times(program
|
|
3040
|
+
) }, `month_day_${i.label}`)),
|
|
3041
|
+
times(program?.calendar.length, (i) => /* @__PURE__ */ jsx9(React4.Fragment, { children: times(program?.calendar[i].length, (j) => /* @__PURE__ */ jsxs4(
|
|
969
3042
|
"div",
|
|
970
3043
|
{
|
|
971
3044
|
className: calendarDayVariants({
|
|
@@ -974,11 +3047,11 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
974
3047
|
isPast: program.calendar[i][j]?.isPast,
|
|
975
3048
|
isFuture: program.calendar[i][j]?.isFuture,
|
|
976
3049
|
isCurrentMonth: program.calendar[i][j]?.isCurrentMonth,
|
|
977
|
-
ui:
|
|
978
|
-
bordered: !!program.calendar[i][j] &&
|
|
979
|
-
color:
|
|
3050
|
+
ui: properties?.day?.ui,
|
|
3051
|
+
bordered: !!program.calendar[i][j] && properties?.day?.bordered,
|
|
3052
|
+
color: properties?.day?.color || "primary"
|
|
980
3053
|
}),
|
|
981
|
-
style: composeStyles(
|
|
3054
|
+
style: composeStyles(properties?.day?.ui, properties?.day?.style),
|
|
982
3055
|
"data-testid": "yr3CalendarDay",
|
|
983
3056
|
onClick: () => {
|
|
984
3057
|
if (selected === program.calendar[i][j]) {
|
|
@@ -988,13 +3061,13 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
988
3061
|
}
|
|
989
3062
|
},
|
|
990
3063
|
children: [
|
|
991
|
-
program
|
|
992
|
-
/* @__PURE__ */
|
|
3064
|
+
program?.calendar[i][j]?.data && properties?.day?.component ? properties?.day?.component : null,
|
|
3065
|
+
/* @__PURE__ */ jsx9(
|
|
993
3066
|
Text,
|
|
994
3067
|
{
|
|
995
3068
|
variant: "body2",
|
|
996
|
-
color: program
|
|
997
|
-
children: program
|
|
3069
|
+
color: program?.calendar[i][j]?.selected ? properties?.day?.selected : "primary",
|
|
3070
|
+
children: program?.calendar[i][j]?.day || ""
|
|
998
3071
|
}
|
|
999
3072
|
)
|
|
1000
3073
|
]
|
|
@@ -1006,8 +3079,8 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1006
3079
|
};
|
|
1007
3080
|
|
|
1008
3081
|
// src/components/Checkbox/Checkbox.tsx
|
|
1009
|
-
import * as
|
|
1010
|
-
import { jsx as
|
|
3082
|
+
import * as React5 from "react";
|
|
3083
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1011
3084
|
var initialPropsComponent = {
|
|
1012
3085
|
checkbox: {
|
|
1013
3086
|
ui: {
|
|
@@ -1032,20 +3105,20 @@ var Checkbox = ({
|
|
|
1032
3105
|
type = "default",
|
|
1033
3106
|
variant = "text"
|
|
1034
3107
|
}) => {
|
|
1035
|
-
const [internal, setInternal] =
|
|
3108
|
+
const [internal, setInternal] = React5.useState(defaultChecked || false);
|
|
1036
3109
|
const isControlled = checked !== void 0;
|
|
1037
3110
|
const value = isControlled ? checked : internal;
|
|
1038
3111
|
const handleChange = (e) => {
|
|
1039
3112
|
if (!isControlled) setInternal(e.target.checked);
|
|
1040
3113
|
onChange?.(e, e.target.checked);
|
|
1041
3114
|
};
|
|
1042
|
-
const properties =
|
|
3115
|
+
const properties = mergeDeep2(initialPropsComponent, propsComponent || {});
|
|
1043
3116
|
const bemClasse = bem("yr3Checkbox");
|
|
1044
3117
|
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}`, type: `type-${type}` });
|
|
1045
3118
|
const boxClasses = bem("yr3Checkbox-box");
|
|
1046
3119
|
const classesBox = boxClasses(void 0, { checked: !!value });
|
|
1047
|
-
return /* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
3120
|
+
return /* @__PURE__ */ jsxs5("label", { className: classes, style: uiStyle(properties?.checkbox?.ui), "data-testid": "yr3Checkbox", children: [
|
|
3121
|
+
/* @__PURE__ */ jsx10(
|
|
1049
3122
|
"input",
|
|
1050
3123
|
{
|
|
1051
3124
|
type: "checkbox",
|
|
@@ -1055,8 +3128,8 @@ var Checkbox = ({
|
|
|
1055
3128
|
"data-testid": "yr3Checkbox-input"
|
|
1056
3129
|
}
|
|
1057
3130
|
),
|
|
1058
|
-
/* @__PURE__ */
|
|
1059
|
-
label && /* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsx10("span", { className: classesBox, "data-testid": "yr3Checkbox-box" }),
|
|
3132
|
+
label && /* @__PURE__ */ jsx10(Text, { variant: "caption", color: !value ? properties?.content?.color : color, ...properties?.content, children: label })
|
|
1060
3133
|
] });
|
|
1061
3134
|
};
|
|
1062
3135
|
|
|
@@ -1093,9 +3166,9 @@ var chipVariants = createVariants({
|
|
|
1093
3166
|
var chip_variants_default = chipVariants;
|
|
1094
3167
|
|
|
1095
3168
|
// src/Icons/IconClose.tsx
|
|
1096
|
-
import { jsx as
|
|
3169
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1097
3170
|
var IconClose = (props) => {
|
|
1098
|
-
return /* @__PURE__ */
|
|
3171
|
+
return /* @__PURE__ */ jsx11("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx11(
|
|
1099
3172
|
"path",
|
|
1100
3173
|
{
|
|
1101
3174
|
d: "M16 16L12 12M12 12L8 8M12 12L16 8M12 12L8 16",
|
|
@@ -1108,7 +3181,7 @@ var IconClose = (props) => {
|
|
|
1108
3181
|
};
|
|
1109
3182
|
|
|
1110
3183
|
// src/components/Chip/Chip.tsx
|
|
1111
|
-
import { jsx as
|
|
3184
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1112
3185
|
var initialChipProps = {
|
|
1113
3186
|
label: {
|
|
1114
3187
|
ui: {},
|
|
@@ -1124,9 +3197,9 @@ var initialChipProps = {
|
|
|
1124
3197
|
}
|
|
1125
3198
|
};
|
|
1126
3199
|
var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "medium", propsComponent, ...props }) => {
|
|
1127
|
-
const properties =
|
|
3200
|
+
const properties = mergeDeep2(initialChipProps, propsComponent);
|
|
1128
3201
|
const className = chip_variants_default({ variant, colors: color, rounded, size });
|
|
1129
|
-
return /* @__PURE__ */
|
|
3202
|
+
return /* @__PURE__ */ jsxs6(
|
|
1130
3203
|
"div",
|
|
1131
3204
|
{
|
|
1132
3205
|
className,
|
|
@@ -1135,8 +3208,8 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1135
3208
|
style: composeStyles(properties.chip?.ui, properties.chip?.style),
|
|
1136
3209
|
children: [
|
|
1137
3210
|
icon,
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
deleted && /* @__PURE__ */
|
|
3211
|
+
/* @__PURE__ */ jsx12("span", { className: "yr3Chip__label", style: composeStyles(properties?.label?.ui, properties?.label?.style), children: label }),
|
|
3212
|
+
deleted && /* @__PURE__ */ jsx12(
|
|
1140
3213
|
"span",
|
|
1141
3214
|
{
|
|
1142
3215
|
className: "yr3Chip__delete",
|
|
@@ -1144,7 +3217,7 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1144
3217
|
role: "button",
|
|
1145
3218
|
"aria-label": "delete",
|
|
1146
3219
|
style: composeStyles(properties?.delete?.ui, properties?.delete?.style),
|
|
1147
|
-
children: /* @__PURE__ */
|
|
3220
|
+
children: /* @__PURE__ */ jsx12(IconClose, { ...properties?.icon, stroke: color })
|
|
1148
3221
|
}
|
|
1149
3222
|
)
|
|
1150
3223
|
]
|
|
@@ -1153,12 +3226,12 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1153
3226
|
};
|
|
1154
3227
|
|
|
1155
3228
|
// src/components/Collapse/Collapse.tsx
|
|
1156
|
-
import * as
|
|
1157
|
-
import { jsx as
|
|
3229
|
+
import * as React6 from "react";
|
|
3230
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1158
3231
|
var Collapse = ({ children, open, anchor }) => {
|
|
1159
|
-
const ref =
|
|
1160
|
-
const [height, setHeight] =
|
|
1161
|
-
|
|
3232
|
+
const ref = React6.useRef(null);
|
|
3233
|
+
const [height, setHeight] = React6.useState(0);
|
|
3234
|
+
React6.useEffect(() => {
|
|
1162
3235
|
if (ref.current) {
|
|
1163
3236
|
if (open) {
|
|
1164
3237
|
setHeight(ref.current.scrollHeight);
|
|
@@ -1167,11 +3240,11 @@ var Collapse = ({ children, open, anchor }) => {
|
|
|
1167
3240
|
}
|
|
1168
3241
|
}
|
|
1169
3242
|
}, [open, children]);
|
|
1170
|
-
return /* @__PURE__ */
|
|
3243
|
+
return /* @__PURE__ */ jsx13("div", { className: `yr3Collapse yr3Collapse--${anchor}`, style: { height }, "data-testid": "yr3Collapse", children: /* @__PURE__ */ jsx13("div", { ref, className: "yr3Collapse__inner", children }) });
|
|
1171
3244
|
};
|
|
1172
3245
|
|
|
1173
3246
|
// src/components/Container/Container.tsx
|
|
1174
|
-
import { jsx as
|
|
3247
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1175
3248
|
var Container = ({
|
|
1176
3249
|
children,
|
|
1177
3250
|
maxWidth = "sm",
|
|
@@ -1181,7 +3254,7 @@ var Container = ({
|
|
|
1181
3254
|
}) => {
|
|
1182
3255
|
const containerClassName = bem("yr3Container");
|
|
1183
3256
|
const classes = containerClassName(void 0, { maxWidth, static: fixed });
|
|
1184
|
-
return /* @__PURE__ */
|
|
3257
|
+
return /* @__PURE__ */ jsx14(
|
|
1185
3258
|
"div",
|
|
1186
3259
|
{
|
|
1187
3260
|
className: classes,
|
|
@@ -1193,12 +3266,12 @@ var Container = ({
|
|
|
1193
3266
|
};
|
|
1194
3267
|
|
|
1195
3268
|
// src/theme/controlContext.tsx
|
|
1196
|
-
import * as
|
|
1197
|
-
var ControlContext =
|
|
1198
|
-
var useControl = () =>
|
|
3269
|
+
import * as React7 from "react";
|
|
3270
|
+
var ControlContext = React7.createContext(null);
|
|
3271
|
+
var useControl = () => React7.useContext(ControlContext);
|
|
1199
3272
|
|
|
1200
3273
|
// src/components/Control/Control.tsx
|
|
1201
|
-
import * as
|
|
3274
|
+
import * as React8 from "react";
|
|
1202
3275
|
|
|
1203
3276
|
// src/components/Control/control.variants.ts
|
|
1204
3277
|
var controlVariants = createVariants({
|
|
@@ -1241,7 +3314,7 @@ var controlVariants = createVariants({
|
|
|
1241
3314
|
});
|
|
1242
3315
|
|
|
1243
3316
|
// src/components/Control/Control.tsx
|
|
1244
|
-
import { jsx as
|
|
3317
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1245
3318
|
var Control = ({
|
|
1246
3319
|
children,
|
|
1247
3320
|
error = false,
|
|
@@ -1253,7 +3326,7 @@ var Control = ({
|
|
|
1253
3326
|
size = "auto",
|
|
1254
3327
|
label = true
|
|
1255
3328
|
}) => {
|
|
1256
|
-
const [focused, setFocused] =
|
|
3329
|
+
const [focused, setFocused] = React8.useState(false);
|
|
1257
3330
|
const value = {
|
|
1258
3331
|
focused,
|
|
1259
3332
|
setFocused,
|
|
@@ -1261,7 +3334,7 @@ var Control = ({
|
|
|
1261
3334
|
disabled
|
|
1262
3335
|
};
|
|
1263
3336
|
const classes = controlVariants({ variant, color, label, size, disabled });
|
|
1264
|
-
return /* @__PURE__ */
|
|
3337
|
+
return /* @__PURE__ */ jsx15(ControlContext.Provider, { value, children: /* @__PURE__ */ jsx15(
|
|
1265
3338
|
"div",
|
|
1266
3339
|
{
|
|
1267
3340
|
className: classes,
|
|
@@ -1304,7 +3377,7 @@ var dividerVariants = createVariants({
|
|
|
1304
3377
|
var dividerVariants_default = dividerVariants;
|
|
1305
3378
|
|
|
1306
3379
|
// src/components/Divider/Divider.tsx
|
|
1307
|
-
import { jsx as
|
|
3380
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1308
3381
|
var Divider = ({
|
|
1309
3382
|
orientation = "horizontal",
|
|
1310
3383
|
text: text2,
|
|
@@ -1314,14 +3387,14 @@ var Divider = ({
|
|
|
1314
3387
|
color = "primary"
|
|
1315
3388
|
}) => {
|
|
1316
3389
|
const classname = dividerVariants_default({ orientation, align, withText: !!text2, color });
|
|
1317
|
-
return /* @__PURE__ */
|
|
3390
|
+
return /* @__PURE__ */ jsx16("div", { className: classname, style: composeStyles(ui, style), "data-testid": "yr3Divider", children: text2 && /* @__PURE__ */ jsx16("span", { className: "yr3Divider--text", "data-testid": "yr3Divider-text", children: text2 }) });
|
|
1318
3391
|
};
|
|
1319
3392
|
|
|
1320
3393
|
// src/components/Drawer/Drawer.tsx
|
|
1321
|
-
import * as
|
|
3394
|
+
import * as React9 from "react";
|
|
1322
3395
|
|
|
1323
3396
|
// src/components/Drawer/DrawerContainer.tsx
|
|
1324
|
-
import { jsx as
|
|
3397
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1325
3398
|
var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
1326
3399
|
const { hide } = useBackdrop();
|
|
1327
3400
|
const handleClose = () => {
|
|
@@ -1331,7 +3404,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1331
3404
|
}
|
|
1332
3405
|
return;
|
|
1333
3406
|
};
|
|
1334
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ jsx17("div", { className: "yr3Drawer--container", style: composeStyles(ui, style), onClick: handleClose, "data-testid": "yr3Drawer-container", children });
|
|
1335
3408
|
};
|
|
1336
3409
|
var DrawerContainer_default = DrawerContainer;
|
|
1337
3410
|
|
|
@@ -1351,7 +3424,7 @@ var useClickAway = (ref, callback) => {
|
|
|
1351
3424
|
};
|
|
1352
3425
|
|
|
1353
3426
|
// src/components/Drawer/Drawer.tsx
|
|
1354
|
-
import { jsx as
|
|
3427
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1355
3428
|
var initialPropsComponent2 = {
|
|
1356
3429
|
drawer: {},
|
|
1357
3430
|
closing: null,
|
|
@@ -1360,9 +3433,9 @@ var initialPropsComponent2 = {
|
|
|
1360
3433
|
};
|
|
1361
3434
|
var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
1362
3435
|
const { show, hide } = useBackdrop();
|
|
1363
|
-
const ref =
|
|
1364
|
-
const properties =
|
|
1365
|
-
|
|
3436
|
+
const ref = React9.useRef(null);
|
|
3437
|
+
const properties = mergeDeep2(initialPropsComponent2, propsComponent);
|
|
3438
|
+
React9.useEffect(() => {
|
|
1366
3439
|
if (open) {
|
|
1367
3440
|
show("drawer");
|
|
1368
3441
|
} else {
|
|
@@ -1377,7 +3450,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1377
3450
|
}
|
|
1378
3451
|
;
|
|
1379
3452
|
});
|
|
1380
|
-
|
|
3453
|
+
React9.useEffect(() => {
|
|
1381
3454
|
if (properties?.onClose) {
|
|
1382
3455
|
hide("drawer");
|
|
1383
3456
|
onClose();
|
|
@@ -1385,7 +3458,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1385
3458
|
}, [properties?.onClose]);
|
|
1386
3459
|
const classesBem = bem("yr3Drawer");
|
|
1387
3460
|
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1388
|
-
return /* @__PURE__ */
|
|
3461
|
+
return /* @__PURE__ */ jsx18(
|
|
1389
3462
|
"div",
|
|
1390
3463
|
{
|
|
1391
3464
|
className: drawerClasses,
|
|
@@ -1393,7 +3466,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1393
3466
|
onClick: (e) => e.stopPropagation(),
|
|
1394
3467
|
ref,
|
|
1395
3468
|
"data-testid": "yr3Drawer",
|
|
1396
|
-
children: /* @__PURE__ */
|
|
3469
|
+
children: /* @__PURE__ */ jsx18(
|
|
1397
3470
|
DrawerContainer_default,
|
|
1398
3471
|
{
|
|
1399
3472
|
children,
|
|
@@ -1408,15 +3481,15 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1408
3481
|
};
|
|
1409
3482
|
|
|
1410
3483
|
// src/components/Input/Input.tsx
|
|
1411
|
-
import * as
|
|
3484
|
+
import * as React10 from "react";
|
|
1412
3485
|
|
|
1413
3486
|
// src/components/Label/Label.tsx
|
|
1414
|
-
import { jsx as
|
|
3487
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1415
3488
|
var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
|
|
1416
3489
|
const classes = bem("yr3Label");
|
|
1417
3490
|
const classComponent = classes(void 0, { color: `color-${color}` });
|
|
1418
3491
|
const classnames = bemMerge(classComponent, className);
|
|
1419
|
-
return /* @__PURE__ */
|
|
3492
|
+
return /* @__PURE__ */ jsx19(
|
|
1420
3493
|
"span",
|
|
1421
3494
|
{
|
|
1422
3495
|
className: classnames,
|
|
@@ -1469,7 +3542,7 @@ var inputVariants = createVariants({
|
|
|
1469
3542
|
});
|
|
1470
3543
|
|
|
1471
3544
|
// src/components/Input/Input.tsx
|
|
1472
|
-
import { jsx as
|
|
3545
|
+
import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1473
3546
|
var initiaPropsComponent = {
|
|
1474
3547
|
label: {
|
|
1475
3548
|
display: true,
|
|
@@ -1478,7 +3551,7 @@ var initiaPropsComponent = {
|
|
|
1478
3551
|
},
|
|
1479
3552
|
control: {}
|
|
1480
3553
|
};
|
|
1481
|
-
var Input =
|
|
3554
|
+
var Input = React10.forwardRef(
|
|
1482
3555
|
({
|
|
1483
3556
|
label,
|
|
1484
3557
|
value,
|
|
@@ -1487,21 +3560,27 @@ var Input = React9.forwardRef(
|
|
|
1487
3560
|
variant = "outlined",
|
|
1488
3561
|
error = "ce un errore",
|
|
1489
3562
|
separatorCurrency = ",",
|
|
3563
|
+
separatorDecimal = ".",
|
|
1490
3564
|
ui,
|
|
1491
3565
|
style,
|
|
1492
3566
|
propsComponent = initiaPropsComponent,
|
|
1493
|
-
pattern = "text",
|
|
1494
3567
|
color = "primary",
|
|
1495
3568
|
size = "auto",
|
|
1496
3569
|
disabled = false,
|
|
3570
|
+
model,
|
|
3571
|
+
pattern,
|
|
1497
3572
|
...props
|
|
1498
3573
|
}, ref) => {
|
|
1499
|
-
const [focused, setFocused] =
|
|
1500
|
-
const [internalValue, setInternalValue] =
|
|
3574
|
+
const [focused, setFocused] = React10.useState(false);
|
|
3575
|
+
const [internalValue, setInternalValue] = React10.useState(defaultValue);
|
|
1501
3576
|
const isControlled = value !== void 0;
|
|
1502
3577
|
const currentValue = isControlled ? value : internalValue;
|
|
1503
3578
|
const isActive = focused || !!currentValue;
|
|
1504
|
-
const
|
|
3579
|
+
const checkMode = (type, value2) => {
|
|
3580
|
+
if (pattern) {
|
|
3581
|
+
const regex = new RegExp(pattern);
|
|
3582
|
+
return regex.test(value2);
|
|
3583
|
+
}
|
|
1505
3584
|
switch (type) {
|
|
1506
3585
|
case "email":
|
|
1507
3586
|
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
@@ -1512,21 +3591,38 @@ var Input = React9.forwardRef(
|
|
|
1512
3591
|
case "currency":
|
|
1513
3592
|
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1514
3593
|
if (separatorCurrency === ".") return /^\d+(\.\d{0,2})?$/.test(value2);
|
|
3594
|
+
case "decimal":
|
|
3595
|
+
if (separatorDecimal === ",") return /^\d+(\,\d*)?$/.test(value2);
|
|
3596
|
+
if (separatorDecimal === ".") return /^\d+(\.\d*)?$/.test(value2);
|
|
1515
3597
|
default:
|
|
1516
3598
|
return true;
|
|
1517
3599
|
}
|
|
1518
3600
|
};
|
|
3601
|
+
const mode = (m) => {
|
|
3602
|
+
switch (m) {
|
|
3603
|
+
case "email":
|
|
3604
|
+
return "email";
|
|
3605
|
+
case "phone":
|
|
3606
|
+
return "tel";
|
|
3607
|
+
case "number":
|
|
3608
|
+
return "numeric";
|
|
3609
|
+
case "currency":
|
|
3610
|
+
return "numeric";
|
|
3611
|
+
default:
|
|
3612
|
+
return "text";
|
|
3613
|
+
}
|
|
3614
|
+
};
|
|
1519
3615
|
const handleChange = (e) => {
|
|
1520
3616
|
const newValue = e.target.value;
|
|
1521
|
-
if (newValue && !
|
|
3617
|
+
if (newValue && !checkMode(model, newValue)) return;
|
|
1522
3618
|
if (!isControlled) {
|
|
1523
3619
|
setInternalValue(newValue);
|
|
1524
3620
|
}
|
|
1525
3621
|
onChange?.(e, newValue);
|
|
1526
3622
|
};
|
|
1527
3623
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1528
|
-
return /* @__PURE__ */
|
|
1529
|
-
propsComponent?.label?.display && /* @__PURE__ */
|
|
3624
|
+
return /* @__PURE__ */ jsxs7(Control, { variant, color, label: propsComponent?.label?.display, disabled, ...propsComponent.control, children: [
|
|
3625
|
+
propsComponent?.label?.display && /* @__PURE__ */ jsx20(
|
|
1530
3626
|
Label,
|
|
1531
3627
|
{
|
|
1532
3628
|
text: label || "",
|
|
@@ -1535,14 +3631,15 @@ var Input = React9.forwardRef(
|
|
|
1535
3631
|
...propsComponent.label
|
|
1536
3632
|
}
|
|
1537
3633
|
),
|
|
1538
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsx20(
|
|
1539
3635
|
"input",
|
|
1540
3636
|
{
|
|
1541
3637
|
ref,
|
|
1542
3638
|
value: currentValue,
|
|
1543
|
-
inputMode:
|
|
3639
|
+
inputMode: mode(model),
|
|
1544
3640
|
autoComplete: "off",
|
|
1545
|
-
type:
|
|
3641
|
+
type: props.type,
|
|
3642
|
+
pattern,
|
|
1546
3643
|
disabled,
|
|
1547
3644
|
onChange: handleChange,
|
|
1548
3645
|
onFocus: () => setFocused(true),
|
|
@@ -1558,12 +3655,12 @@ var Input = React9.forwardRef(
|
|
|
1558
3655
|
);
|
|
1559
3656
|
|
|
1560
3657
|
// src/components/Date/MonthSelector.tsx
|
|
1561
|
-
import * as
|
|
3658
|
+
import * as React11 from "react";
|
|
1562
3659
|
|
|
1563
3660
|
// src/Icons/IconSearch.tsx
|
|
1564
|
-
import { jsx as
|
|
3661
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1565
3662
|
var IconSearch = (props) => {
|
|
1566
|
-
return /* @__PURE__ */
|
|
3663
|
+
return /* @__PURE__ */ jsx21("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21(
|
|
1567
3664
|
"path",
|
|
1568
3665
|
{
|
|
1569
3666
|
d: "M15.7955 15.8111L21 21M18 10.5C18 14.6421 14.6421 18 10.5 18C6.35786 18 3 14.6421 3 10.5C3 6.35786 6.35786 3 10.5 3C14.6421 3 18 6.35786 18 10.5Z",
|
|
@@ -1576,21 +3673,21 @@ var IconSearch = (props) => {
|
|
|
1576
3673
|
};
|
|
1577
3674
|
|
|
1578
3675
|
// src/Icons/IconDown.tsx
|
|
1579
|
-
import { jsx as
|
|
3676
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1580
3677
|
var IconDown = (props) => {
|
|
1581
|
-
return /* @__PURE__ */
|
|
3678
|
+
return /* @__PURE__ */ jsx22("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "data-testid": "yr3Icons", children: /* @__PURE__ */ jsx22("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1582
3679
|
};
|
|
1583
3680
|
|
|
1584
3681
|
// src/Icons/IconCalendar.tsx
|
|
1585
|
-
import { jsx as
|
|
3682
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1586
3683
|
var IconCalendar = (props) => {
|
|
1587
|
-
return /* @__PURE__ */
|
|
3684
|
+
return /* @__PURE__ */ jsx23("svg", { width: props.width || "24px", height: props.height || "24px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx23("path", { stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5" }) });
|
|
1588
3685
|
};
|
|
1589
3686
|
|
|
1590
3687
|
// src/Icons/IconLeft.tsx
|
|
1591
|
-
import { jsx as
|
|
3688
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1592
3689
|
var IconLeft = (props) => {
|
|
1593
|
-
return /* @__PURE__ */
|
|
3690
|
+
return /* @__PURE__ */ jsx24("svg", { width: props.width || "24px", height: props.height || "24px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M15 7L10 12L15 17", stroke: props.stroke || "currentColor", strokeWidth: props.strokeWidth || "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1594
3691
|
};
|
|
1595
3692
|
|
|
1596
3693
|
// src/components/Date/month.variants.ts
|
|
@@ -1647,9 +3744,9 @@ var monthSelectorContainerVariants = createVariants({
|
|
|
1647
3744
|
});
|
|
1648
3745
|
|
|
1649
3746
|
// src/Icons/IconRight.tsx
|
|
1650
|
-
import { jsx as
|
|
3747
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1651
3748
|
var IconRight = (props) => {
|
|
1652
|
-
return /* @__PURE__ */
|
|
3749
|
+
return /* @__PURE__ */ jsx25("svg", { width: props.width || "24px", height: props.height || "24px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx25(
|
|
1653
3750
|
"path",
|
|
1654
3751
|
{
|
|
1655
3752
|
d: "M9 7L14 12L9 17",
|
|
@@ -1662,12 +3759,14 @@ var IconRight = (props) => {
|
|
|
1662
3759
|
};
|
|
1663
3760
|
|
|
1664
3761
|
// src/components/Date/MonthSelector.tsx
|
|
1665
|
-
import { jsx as
|
|
3762
|
+
import { jsx as jsx26, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1666
3763
|
var initialPropsComponent3 = {
|
|
1667
3764
|
control: {
|
|
1668
3765
|
variant: "outlined",
|
|
1669
3766
|
color: "primary",
|
|
1670
|
-
ui: {
|
|
3767
|
+
ui: {
|
|
3768
|
+
pointerEvents: "none"
|
|
3769
|
+
},
|
|
1671
3770
|
style: {}
|
|
1672
3771
|
},
|
|
1673
3772
|
label: {
|
|
@@ -1702,18 +3801,18 @@ var initialPropsComponent3 = {
|
|
|
1702
3801
|
style: {}
|
|
1703
3802
|
}
|
|
1704
3803
|
};
|
|
1705
|
-
var MonthSelector = ({ label, value, disabled, propsComponent, data,
|
|
1706
|
-
const [open, setOpen] =
|
|
1707
|
-
const [valueState, setValueState] =
|
|
1708
|
-
const [yearSelected, setYearSelected] =
|
|
1709
|
-
const ref =
|
|
3804
|
+
var MonthSelector = ({ label, value, disabled, propsComponent, data, format, onNext, onLast, onChange }) => {
|
|
3805
|
+
const [open, setOpen] = React11.useState(false);
|
|
3806
|
+
const [valueState, setValueState] = React11.useState(value || null);
|
|
3807
|
+
const [yearSelected, setYearSelected] = React11.useState(data?.years.findIndex((y) => y === data.year) || 0);
|
|
3808
|
+
const ref = React11.useRef(null);
|
|
1710
3809
|
useClickAway(ref, () => setOpen(false));
|
|
1711
|
-
const properties =
|
|
3810
|
+
const properties = mergeDeep2(initialPropsComponent3, propsComponent || {});
|
|
1712
3811
|
const iconClasses = monthSelectorIconVariants({ color: properties?.icon?.color });
|
|
1713
3812
|
const containerClasses = monthSelectorContainerVariants({ color: properties?.container?.color });
|
|
1714
|
-
const getData =
|
|
1715
|
-
return getMonthCalendarProps({ year: data.years[yearSelected], data,
|
|
1716
|
-
}, [yearSelected, data,
|
|
3813
|
+
const getData = React11.useMemo(() => {
|
|
3814
|
+
return getMonthCalendarProps({ year: data.years[yearSelected], data, format, value: valueState });
|
|
3815
|
+
}, [yearSelected, data, format, valueState]);
|
|
1717
3816
|
const handleYearChange = (newIndex) => {
|
|
1718
3817
|
setYearSelected(newIndex);
|
|
1719
3818
|
};
|
|
@@ -1724,20 +3823,19 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1724
3823
|
const nextData = getMonthCalendarProps({
|
|
1725
3824
|
year: data.years[yearSelected],
|
|
1726
3825
|
data,
|
|
1727
|
-
|
|
3826
|
+
format,
|
|
1728
3827
|
value: newValue
|
|
1729
3828
|
});
|
|
1730
3829
|
onNext?.(nextData.prev);
|
|
1731
3830
|
onLast?.(nextData.last);
|
|
1732
3831
|
};
|
|
1733
3832
|
const classes = monthSelectorVariants({ wrapper: true, disabled });
|
|
1734
|
-
return /* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
3833
|
+
return /* @__PURE__ */ jsxs8("div", { className: classes, ref, children: [
|
|
3834
|
+
/* @__PURE__ */ jsx26(
|
|
1736
3835
|
Input,
|
|
1737
3836
|
{
|
|
1738
3837
|
label,
|
|
1739
3838
|
variant: "base",
|
|
1740
|
-
disabled: true,
|
|
1741
3839
|
value: valueState || "",
|
|
1742
3840
|
propsComponent: {
|
|
1743
3841
|
control: properties?.control,
|
|
@@ -1745,14 +3843,14 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1745
3843
|
}
|
|
1746
3844
|
}
|
|
1747
3845
|
),
|
|
1748
|
-
/* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ jsx26(
|
|
1749
3847
|
"div",
|
|
1750
3848
|
{
|
|
1751
3849
|
className: iconClasses,
|
|
1752
3850
|
style: properties?.icon?.style,
|
|
1753
3851
|
onClick: () => !disabled && setOpen(true),
|
|
1754
3852
|
"data-testid": "yr3MonthSelector--icon",
|
|
1755
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */
|
|
3853
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ jsx26(
|
|
1756
3854
|
IconCalendar,
|
|
1757
3855
|
{
|
|
1758
3856
|
width: properties?.icon?.svg?.width,
|
|
@@ -1763,47 +3861,47 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1763
3861
|
)
|
|
1764
3862
|
}
|
|
1765
3863
|
),
|
|
1766
|
-
open && /* @__PURE__ */
|
|
3864
|
+
open && /* @__PURE__ */ jsx26(
|
|
1767
3865
|
"div",
|
|
1768
3866
|
{
|
|
1769
3867
|
className: "yr3MonthSelector--wrapper",
|
|
1770
3868
|
style: composeStyles(properties?.wrapper?.ui, properties?.wrapper?.style),
|
|
1771
3869
|
"data-testid": "yr3MonthSelector--wrapper",
|
|
1772
|
-
children: /* @__PURE__ */
|
|
1773
|
-
/* @__PURE__ */
|
|
3870
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "yr3MonthSelector--component", children: [
|
|
3871
|
+
/* @__PURE__ */ jsxs8(
|
|
1774
3872
|
"div",
|
|
1775
3873
|
{
|
|
1776
3874
|
className: containerClasses,
|
|
1777
3875
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1778
3876
|
children: [
|
|
1779
|
-
/* @__PURE__ */
|
|
3877
|
+
/* @__PURE__ */ jsx26(
|
|
1780
3878
|
"button",
|
|
1781
3879
|
{
|
|
1782
3880
|
disabled: disabled || yearSelected === 0,
|
|
1783
3881
|
type: "button",
|
|
1784
3882
|
className: `yr3MonthSelector--year-button-back ${yearSelected === 0 ? "yr3MonthSelector--year-button-back--disabled" : ""} `,
|
|
1785
3883
|
onClick: () => handleYearChange(yearSelected - 1),
|
|
1786
|
-
children: /* @__PURE__ */
|
|
3884
|
+
children: /* @__PURE__ */ jsx26(IconLeft, { width: 20, height: 20, stroke: "currentColor" })
|
|
1787
3885
|
}
|
|
1788
3886
|
),
|
|
1789
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ jsx26("div", { className: `yr3MonthSelector--year-option`, children: /* @__PURE__ */ jsxs8(Text, { variant: "body1", color: "primary", children: [
|
|
1790
3888
|
data.years[yearSelected],
|
|
1791
3889
|
" "
|
|
1792
3890
|
] }) }),
|
|
1793
|
-
/* @__PURE__ */
|
|
3891
|
+
/* @__PURE__ */ jsx26(
|
|
1794
3892
|
"button",
|
|
1795
3893
|
{
|
|
1796
3894
|
disabled: disabled || yearSelected === data.years.length - 1,
|
|
1797
3895
|
type: "button",
|
|
1798
3896
|
className: `yr3MonthSelector--year-button-next ${yearSelected === data.years.length - 1 ? "yr3MonthSelector--year-button-next--disabled" : ""}`,
|
|
1799
3897
|
onClick: () => handleYearChange(yearSelected + 1),
|
|
1800
|
-
children: /* @__PURE__ */
|
|
3898
|
+
children: /* @__PURE__ */ jsx26(IconRight, { width: 20, height: 30, stroke: "currentColor" })
|
|
1801
3899
|
}
|
|
1802
3900
|
)
|
|
1803
3901
|
]
|
|
1804
3902
|
}
|
|
1805
3903
|
),
|
|
1806
|
-
/* @__PURE__ */
|
|
3904
|
+
/* @__PURE__ */ jsx26("div", { className: "yr3MonthSelector--months", children: getData.months.map((m) => /* @__PURE__ */ jsx26(
|
|
1807
3905
|
"button",
|
|
1808
3906
|
{
|
|
1809
3907
|
type: "button",
|
|
@@ -1812,8 +3910,9 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1812
3910
|
className: `yr3MonthSelector--month ${m.disabled ? "yr3MonthSelector--month--disabled" : ""} ${m.selected ? "yr3MonthSelector--month--selected" : ""}`,
|
|
1813
3911
|
onClick: () => {
|
|
1814
3912
|
handleMonthChange(m.value);
|
|
3913
|
+
setOpen(false);
|
|
1815
3914
|
},
|
|
1816
|
-
children: /* @__PURE__ */
|
|
3915
|
+
children: /* @__PURE__ */ jsx26(Text, { ...properties?.text, weight: m.disabled ? "thin" : "medium", children: m.label })
|
|
1817
3916
|
},
|
|
1818
3917
|
"month-" + m.value
|
|
1819
3918
|
)) })
|
|
@@ -1824,8 +3923,8 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1824
3923
|
};
|
|
1825
3924
|
|
|
1826
3925
|
// src/components/Fade/Fade.tsx
|
|
1827
|
-
import * as
|
|
1828
|
-
import { jsx as
|
|
3926
|
+
import * as React12 from "react";
|
|
3927
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1829
3928
|
var Fade = ({
|
|
1830
3929
|
in: inProp,
|
|
1831
3930
|
children,
|
|
@@ -1833,7 +3932,7 @@ var Fade = ({
|
|
|
1833
3932
|
onTransitionEnd,
|
|
1834
3933
|
style
|
|
1835
3934
|
}) => {
|
|
1836
|
-
|
|
3935
|
+
React12.useEffect(() => {
|
|
1837
3936
|
let timeoutId;
|
|
1838
3937
|
if (inProp) {
|
|
1839
3938
|
timeoutId = setTimeout(() => {
|
|
@@ -1842,7 +3941,7 @@ var Fade = ({
|
|
|
1842
3941
|
}
|
|
1843
3942
|
return () => clearTimeout(timeoutId);
|
|
1844
3943
|
}, [inProp, duration, onTransitionEnd]);
|
|
1845
|
-
return /* @__PURE__ */
|
|
3944
|
+
return /* @__PURE__ */ jsx27(
|
|
1846
3945
|
"div",
|
|
1847
3946
|
{
|
|
1848
3947
|
className: `yr3Fade ${inProp ? "yr3Fade--in" : ""}`,
|
|
@@ -1853,61 +3952,8 @@ var Fade = ({
|
|
|
1853
3952
|
);
|
|
1854
3953
|
};
|
|
1855
3954
|
|
|
1856
|
-
// src/components/Flex/flex.variants.ts
|
|
1857
|
-
var flexVariants = createVariants({
|
|
1858
|
-
base: "yr3Flex",
|
|
1859
|
-
variants: {
|
|
1860
|
-
variant: {
|
|
1861
|
-
row: "yr3Flex--row",
|
|
1862
|
-
column: "yr3Flex--column",
|
|
1863
|
-
wrap: "yr3Flex--wrap"
|
|
1864
|
-
},
|
|
1865
|
-
container: {
|
|
1866
|
-
true: "yr3Flex--container"
|
|
1867
|
-
},
|
|
1868
|
-
center: {
|
|
1869
|
-
true: "yr3Flex--center"
|
|
1870
|
-
},
|
|
1871
|
-
between: {
|
|
1872
|
-
true: "yr3Flex--between"
|
|
1873
|
-
},
|
|
1874
|
-
bordered: {
|
|
1875
|
-
true: "yr3Flex--bordered"
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
});
|
|
1879
|
-
var flex_variants_default = flexVariants;
|
|
1880
|
-
|
|
1881
|
-
// src/components/Flex/Flex.tsx
|
|
1882
|
-
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1883
|
-
var Flex = ({
|
|
1884
|
-
container = false,
|
|
1885
|
-
spacing: spacing2 = 1,
|
|
1886
|
-
children,
|
|
1887
|
-
ui,
|
|
1888
|
-
gap,
|
|
1889
|
-
variant = "column",
|
|
1890
|
-
center = false,
|
|
1891
|
-
between = false,
|
|
1892
|
-
style,
|
|
1893
|
-
bordered = false,
|
|
1894
|
-
...props
|
|
1895
|
-
}) => {
|
|
1896
|
-
const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
|
|
1897
|
-
return /* @__PURE__ */ jsx26(
|
|
1898
|
-
"div",
|
|
1899
|
-
{
|
|
1900
|
-
className: classes,
|
|
1901
|
-
style: composeStyles(ui, style),
|
|
1902
|
-
...props,
|
|
1903
|
-
"data-testid": "yr3Flex",
|
|
1904
|
-
children
|
|
1905
|
-
}
|
|
1906
|
-
);
|
|
1907
|
-
};
|
|
1908
|
-
|
|
1909
3955
|
// src/components/Grid/Grid.tsx
|
|
1910
|
-
import { jsx as
|
|
3956
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1911
3957
|
var Grid = ({
|
|
1912
3958
|
container = false,
|
|
1913
3959
|
spacing: spacing2 = 0,
|
|
@@ -1940,7 +3986,7 @@ var Grid = ({
|
|
|
1940
3986
|
}
|
|
1941
3987
|
const classes = bem("yr3Grid");
|
|
1942
3988
|
const className = classes(void 0, { container, [`spacing-${spacing2}`]: center, span: item && `Col-${size}` });
|
|
1943
|
-
return /* @__PURE__ */
|
|
3989
|
+
return /* @__PURE__ */ jsx28(
|
|
1944
3990
|
"div",
|
|
1945
3991
|
{
|
|
1946
3992
|
className,
|
|
@@ -1953,7 +3999,7 @@ var Grid = ({
|
|
|
1953
3999
|
};
|
|
1954
4000
|
|
|
1955
4001
|
// src/components/Group/Group.tsx
|
|
1956
|
-
import * as
|
|
4002
|
+
import * as React13 from "react";
|
|
1957
4003
|
|
|
1958
4004
|
// src/components/Group/group.variants.ts
|
|
1959
4005
|
var groupVariants = createVariants({
|
|
@@ -1984,8 +4030,8 @@ var groupVariants = createVariants({
|
|
|
1984
4030
|
});
|
|
1985
4031
|
|
|
1986
4032
|
// src/components/Group/Group.tsx
|
|
1987
|
-
import { jsx as
|
|
1988
|
-
var
|
|
4033
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4034
|
+
var initialComponents2 = (color) => ({
|
|
1989
4035
|
group: {
|
|
1990
4036
|
ui: {},
|
|
1991
4037
|
style: {}
|
|
@@ -2013,13 +4059,13 @@ var Group = ({
|
|
|
2013
4059
|
exclude = false,
|
|
2014
4060
|
propsComponent
|
|
2015
4061
|
}) => {
|
|
2016
|
-
const properties =
|
|
2017
|
-
|
|
4062
|
+
const properties = mergeDeep2(
|
|
4063
|
+
initialComponents2(type === "rounded" ? "text" : color),
|
|
2018
4064
|
propsComponent || {}
|
|
2019
4065
|
);
|
|
2020
|
-
const [internalValue, setInternalValue] =
|
|
4066
|
+
const [internalValue, setInternalValue] = React13.useState(null);
|
|
2021
4067
|
const isControlled = value !== void 0;
|
|
2022
|
-
|
|
4068
|
+
React13.useEffect(() => {
|
|
2023
4069
|
if (isControlled) {
|
|
2024
4070
|
setInternalValue(value);
|
|
2025
4071
|
}
|
|
@@ -2030,7 +4076,7 @@ var Group = ({
|
|
|
2030
4076
|
active: !exclude ? Array.isArray(value) ? value.includes(item?.value) : internalValue === item.value : false,
|
|
2031
4077
|
exclude: exclude && Array.isArray(value) ? !value.includes(item?.value) : ""
|
|
2032
4078
|
});
|
|
2033
|
-
const mappingStyle =
|
|
4079
|
+
const mappingStyle = React13.useMemo(() => {
|
|
2034
4080
|
if (variant !== "filled") return options.map((opt, index) => ({
|
|
2035
4081
|
...opt,
|
|
2036
4082
|
index,
|
|
@@ -2061,13 +4107,13 @@ var Group = ({
|
|
|
2061
4107
|
}
|
|
2062
4108
|
}));
|
|
2063
4109
|
}, [exclude, value, options, type]);
|
|
2064
|
-
return /* @__PURE__ */
|
|
4110
|
+
return /* @__PURE__ */ jsx29(
|
|
2065
4111
|
"div",
|
|
2066
4112
|
{
|
|
2067
4113
|
className: groupVariants({ variant, color, type }),
|
|
2068
4114
|
"data-testid": "yr3Group",
|
|
2069
4115
|
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
2070
|
-
children: options.map((opt, index) => /* @__PURE__ */
|
|
4116
|
+
children: options.map((opt, index) => /* @__PURE__ */ jsx29(
|
|
2071
4117
|
"div",
|
|
2072
4118
|
{
|
|
2073
4119
|
"data-testid": "yr3Group-item",
|
|
@@ -2085,7 +4131,7 @@ var Group = ({
|
|
|
2085
4131
|
...mappingStyle?.find((o) => o.value === opt.value)?.style
|
|
2086
4132
|
}
|
|
2087
4133
|
),
|
|
2088
|
-
children: /* @__PURE__ */
|
|
4134
|
+
children: /* @__PURE__ */ jsx29(
|
|
2089
4135
|
Text,
|
|
2090
4136
|
{
|
|
2091
4137
|
...properties.item?.text,
|
|
@@ -2101,14 +4147,14 @@ var Group = ({
|
|
|
2101
4147
|
};
|
|
2102
4148
|
|
|
2103
4149
|
// src/components/Image/Image.tsx
|
|
2104
|
-
import { jsx as
|
|
4150
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2105
4151
|
var Image = ({
|
|
2106
4152
|
src,
|
|
2107
4153
|
alt = "",
|
|
2108
4154
|
ui,
|
|
2109
4155
|
style
|
|
2110
4156
|
}) => {
|
|
2111
|
-
return /* @__PURE__ */
|
|
4157
|
+
return /* @__PURE__ */ jsx30(
|
|
2112
4158
|
"img",
|
|
2113
4159
|
{
|
|
2114
4160
|
src,
|
|
@@ -2121,8 +4167,8 @@ var Image = ({
|
|
|
2121
4167
|
};
|
|
2122
4168
|
|
|
2123
4169
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
2124
|
-
import * as
|
|
2125
|
-
import { jsx as
|
|
4170
|
+
import * as React14 from "react";
|
|
4171
|
+
import { jsx as jsx31, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2126
4172
|
var initialPropsComponent4 = {
|
|
2127
4173
|
box: {},
|
|
2128
4174
|
text: {},
|
|
@@ -2131,10 +4177,10 @@ var initialPropsComponent4 = {
|
|
|
2131
4177
|
content: {}
|
|
2132
4178
|
};
|
|
2133
4179
|
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
2134
|
-
const properties =
|
|
2135
|
-
const [dragging, setDragging] =
|
|
2136
|
-
const [files, setFiles] =
|
|
2137
|
-
const inputRef =
|
|
4180
|
+
const properties = mergeDeep2(initialPropsComponent4, propsComponent || {});
|
|
4181
|
+
const [dragging, setDragging] = React14.useState(false);
|
|
4182
|
+
const [files, setFiles] = React14.useState([]);
|
|
4183
|
+
const inputRef = React14.useRef(null);
|
|
2138
4184
|
const handleFiles = (fileList) => {
|
|
2139
4185
|
if (!fileList) return;
|
|
2140
4186
|
const newFiles = Array.from(fileList);
|
|
@@ -2146,7 +4192,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2146
4192
|
};
|
|
2147
4193
|
const classes = bem("yr3Dropzone");
|
|
2148
4194
|
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
2149
|
-
return /* @__PURE__ */
|
|
4195
|
+
return /* @__PURE__ */ jsx31(Box, { as: "div", position: "relative", content: "center", ...properties?.box, children: /* @__PURE__ */ jsxs9(
|
|
2150
4196
|
"div",
|
|
2151
4197
|
{
|
|
2152
4198
|
className: classComponent,
|
|
@@ -2163,7 +4209,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2163
4209
|
onClick: () => inputRef.current?.click(),
|
|
2164
4210
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
2165
4211
|
children: [
|
|
2166
|
-
/* @__PURE__ */
|
|
4212
|
+
/* @__PURE__ */ jsx31(
|
|
2167
4213
|
"input",
|
|
2168
4214
|
{
|
|
2169
4215
|
ref: inputRef,
|
|
@@ -2174,10 +4220,10 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2174
4220
|
onChange: (e) => handleFiles(e.target.files)
|
|
2175
4221
|
}
|
|
2176
4222
|
),
|
|
2177
|
-
isEmpty(files) && /* @__PURE__ */
|
|
2178
|
-
multiple && /* @__PURE__ */
|
|
2179
|
-
!multiple && /* @__PURE__ */
|
|
2180
|
-
!!defaultImage && /* @__PURE__ */
|
|
4223
|
+
isEmpty(files) && /* @__PURE__ */ jsx31("div", { className: "yr3Dropzone--content", style: composeStyles(properties?.content?.ui, properties?.content?.style), children: /* @__PURE__ */ jsx31(Text, { variant: "helper", color: "disabled", ...propsComponent?.text, children: propsComponent?.text?.primary || "Drag and drop an image here, or click to select one" }) }),
|
|
4224
|
+
multiple && /* @__PURE__ */ jsx31("div", { className: "yr3Dropzone--previews", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ jsx31("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
4225
|
+
!multiple && /* @__PURE__ */ jsx31("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ jsx31("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
4226
|
+
!!defaultImage && /* @__PURE__ */ jsx31("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: /* @__PURE__ */ jsx31("img", { src: defaultImage }) }),
|
|
2181
4227
|
component
|
|
2182
4228
|
]
|
|
2183
4229
|
}
|
|
@@ -2185,7 +4231,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2185
4231
|
};
|
|
2186
4232
|
|
|
2187
4233
|
// src/components/InputArea/InputArea.tsx
|
|
2188
|
-
import * as
|
|
4234
|
+
import * as React15 from "react";
|
|
2189
4235
|
|
|
2190
4236
|
// src/components/InputArea/inputAreaVariants.ts
|
|
2191
4237
|
var inputAreaVariants = createVariants({
|
|
@@ -2226,7 +4272,7 @@ var inputAreaVariants = createVariants({
|
|
|
2226
4272
|
});
|
|
2227
4273
|
|
|
2228
4274
|
// src/components/InputArea/InputArea.tsx
|
|
2229
|
-
import { jsx as
|
|
4275
|
+
import { jsx as jsx32, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2230
4276
|
var initiaPropsComponent2 = {
|
|
2231
4277
|
label: {
|
|
2232
4278
|
display: true,
|
|
@@ -2251,8 +4297,8 @@ var InputArea = ({
|
|
|
2251
4297
|
rounded = false,
|
|
2252
4298
|
propsComponent = initiaPropsComponent2
|
|
2253
4299
|
}) => {
|
|
2254
|
-
const ref =
|
|
2255
|
-
const [internalValue, setInternalValue] =
|
|
4300
|
+
const ref = React15.useRef(null);
|
|
4301
|
+
const [internalValue, setInternalValue] = React15.useState(defaultValue);
|
|
2256
4302
|
const isControlled = value !== void 0;
|
|
2257
4303
|
const currentValue = isControlled ? value : internalValue;
|
|
2258
4304
|
const handleChange = (e) => {
|
|
@@ -2269,8 +4315,8 @@ var InputArea = ({
|
|
|
2269
4315
|
el.style.resize = resize;
|
|
2270
4316
|
}
|
|
2271
4317
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
2272
|
-
return /* @__PURE__ */
|
|
2273
|
-
propsComponent?.label?.display && /* @__PURE__ */
|
|
4318
|
+
return /* @__PURE__ */ jsxs10("div", { style: { position: "relative" }, children: [
|
|
4319
|
+
propsComponent?.label?.display && /* @__PURE__ */ jsx32(
|
|
2274
4320
|
Label,
|
|
2275
4321
|
{
|
|
2276
4322
|
text: label || "",
|
|
@@ -2278,7 +4324,7 @@ var InputArea = ({
|
|
|
2278
4324
|
...propsComponent.label
|
|
2279
4325
|
}
|
|
2280
4326
|
),
|
|
2281
|
-
/* @__PURE__ */
|
|
4327
|
+
/* @__PURE__ */ jsx32(
|
|
2282
4328
|
"textarea",
|
|
2283
4329
|
{
|
|
2284
4330
|
className: classes,
|
|
@@ -2290,76 +4336,10 @@ var InputArea = ({
|
|
|
2290
4336
|
"data-testid": "yr3InputArea"
|
|
2291
4337
|
}
|
|
2292
4338
|
),
|
|
2293
|
-
/* @__PURE__ */
|
|
4339
|
+
/* @__PURE__ */ jsx32(Text, { variant: "helper", color: currentValue.length > maxLength ? "error" : "disabled", ui: { textAlign: "right" }, "data-testid": "yr3InputAreaError", children: validate && maxLength ? `${currentValue.length}/${maxLength}` || propsComponent.helperText : "" })
|
|
2294
4340
|
] });
|
|
2295
4341
|
};
|
|
2296
4342
|
|
|
2297
|
-
// src/components/Loader/loader.variants.ts
|
|
2298
|
-
var loaderSpinnerVariants = createVariants({
|
|
2299
|
-
base: "yr3Loader--spinner",
|
|
2300
|
-
variants: {
|
|
2301
|
-
color: {
|
|
2302
|
-
primary: "yr3Loader--spinner-color-primary",
|
|
2303
|
-
secondary: "yr3Loader--spinner-color-secondary",
|
|
2304
|
-
success: "yr3Loader--spinner-color-success",
|
|
2305
|
-
error: "yr3Loader--spinner-color-error",
|
|
2306
|
-
warning: "yr3Loader--spinner-color-warning",
|
|
2307
|
-
info: "yr3Loader--spinner-color-info",
|
|
2308
|
-
disabled: "yr3Loader--spinner-color-disabled",
|
|
2309
|
-
text: "yr3Loader--spinner-color-text",
|
|
2310
|
-
background: "yr3Loader--spinner-color-background",
|
|
2311
|
-
common: "yr3Loader--spinner-color-common"
|
|
2312
|
-
},
|
|
2313
|
-
size: {
|
|
2314
|
-
sm: "yr3Loader--spinner-size-sm",
|
|
2315
|
-
md: "yr3Loader--spinner-size-md",
|
|
2316
|
-
lg: "yr3Loader--spinner-size-lg"
|
|
2317
|
-
},
|
|
2318
|
-
type: {
|
|
2319
|
-
default: "yr3Loader--spinner-default",
|
|
2320
|
-
dots: "yr3Loader--spinner-dots",
|
|
2321
|
-
fancy: "yr3Loader--spinner-fancy"
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
});
|
|
2325
|
-
|
|
2326
|
-
// src/components/Loader/Loader.tsx
|
|
2327
|
-
import * as React15 from "react";
|
|
2328
|
-
import { jsx as jsx32, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2329
|
-
var initialComponents2 = {
|
|
2330
|
-
loader: {
|
|
2331
|
-
ui: {},
|
|
2332
|
-
style: {}
|
|
2333
|
-
},
|
|
2334
|
-
spinner: {
|
|
2335
|
-
size: "sm",
|
|
2336
|
-
color: "primary",
|
|
2337
|
-
type: "default"
|
|
2338
|
-
},
|
|
2339
|
-
container: {
|
|
2340
|
-
center: true,
|
|
2341
|
-
container: true,
|
|
2342
|
-
ui: {
|
|
2343
|
-
width: "100%",
|
|
2344
|
-
height: "100%"
|
|
2345
|
-
}
|
|
2346
|
-
}
|
|
2347
|
-
};
|
|
2348
|
-
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2349
|
-
const properties = mergeDeep(initialComponents2, propsComponent || {});
|
|
2350
|
-
const classSpinner = loaderSpinnerVariants({
|
|
2351
|
-
color: properties?.spinner?.color,
|
|
2352
|
-
type: properties?.spinner?.type,
|
|
2353
|
-
size: properties?.spinner?.size
|
|
2354
|
-
});
|
|
2355
|
-
if (!loading) return null;
|
|
2356
|
-
return /* @__PURE__ */ jsx32("div", { className: "yr3Loader", style: composeStyles(properties?.loader?.ui, properties?.loader?.style), children: /* @__PURE__ */ jsx32(Flex, { ...properties?.container, children: component || /* @__PURE__ */ jsx32("div", { className: classSpinner, children: properties?.spinner?.type === "dots" && /* @__PURE__ */ jsxs10(React15.Fragment, { children: [
|
|
2357
|
-
/* @__PURE__ */ jsx32("span", {}),
|
|
2358
|
-
/* @__PURE__ */ jsx32("span", {}),
|
|
2359
|
-
/* @__PURE__ */ jsx32("span", {})
|
|
2360
|
-
] }) }) }) });
|
|
2361
|
-
};
|
|
2362
|
-
|
|
2363
4343
|
// src/components/Modal/Modal.tsx
|
|
2364
4344
|
import * as React16 from "react";
|
|
2365
4345
|
|
|
@@ -2585,7 +4565,7 @@ var Picker = ({ label, variant, color, children, name, value, onChange, propsCom
|
|
|
2585
4565
|
const [valueState, setValueState] = React17.useState(value || null);
|
|
2586
4566
|
const ref = React17.useRef(null);
|
|
2587
4567
|
useClickAway(ref, () => setOpen(false));
|
|
2588
|
-
const properties =
|
|
4568
|
+
const properties = mergeDeep2(initiaPropsComponent3, propsComponent || {});
|
|
2589
4569
|
const classesIcon = PickerIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2590
4570
|
const classes = PickerVariants({ wrapper: true, variant, color });
|
|
2591
4571
|
React17.useEffect(() => {
|
|
@@ -2826,7 +4806,7 @@ var PlacesAutocomplete = ({
|
|
|
2826
4806
|
keyApi,
|
|
2827
4807
|
propsComponent = initPropsComponent
|
|
2828
4808
|
}) => {
|
|
2829
|
-
const [value,
|
|
4809
|
+
const [value, setValue2] = React20.useState(null);
|
|
2830
4810
|
const inputRef = React20.useRef(null);
|
|
2831
4811
|
const [anchorEl, setAnchorEl] = React20.useState(null);
|
|
2832
4812
|
const { suggestions, selectPlace } = useAutocompletePlaces({ input: value, apiKey: keyApi, language, provider });
|
|
@@ -2845,12 +4825,12 @@ var PlacesAutocomplete = ({
|
|
|
2845
4825
|
placeId: id
|
|
2846
4826
|
};
|
|
2847
4827
|
onSelect(locationData);
|
|
2848
|
-
|
|
4828
|
+
setValue2(place.address);
|
|
2849
4829
|
setAnchorEl(null);
|
|
2850
4830
|
};
|
|
2851
4831
|
React20.useEffect(() => {
|
|
2852
4832
|
if (defaultLocation) {
|
|
2853
|
-
|
|
4833
|
+
setValue2(defaultLocation);
|
|
2854
4834
|
}
|
|
2855
4835
|
}, [defaultLocation]);
|
|
2856
4836
|
React20.useEffect(() => {
|
|
@@ -2859,7 +4839,7 @@ var PlacesAutocomplete = ({
|
|
|
2859
4839
|
}
|
|
2860
4840
|
}, [value]);
|
|
2861
4841
|
const handleChange = (e) => {
|
|
2862
|
-
|
|
4842
|
+
setValue2(e.target.value);
|
|
2863
4843
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2864
4844
|
};
|
|
2865
4845
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
@@ -3056,12 +5036,12 @@ var initiaPropsComponent4 = {
|
|
|
3056
5036
|
component: void 0
|
|
3057
5037
|
}
|
|
3058
5038
|
};
|
|
3059
|
-
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled }) => {
|
|
5039
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled = false }) => {
|
|
3060
5040
|
const [open, setOpen] = React21.useState(false);
|
|
3061
5041
|
const [valueState, setValueState] = React21.useState(value || defaultValue || null);
|
|
3062
5042
|
const ref = React21.useRef(null);
|
|
3063
5043
|
useClickAway(ref, () => setOpen(false));
|
|
3064
|
-
const properties =
|
|
5044
|
+
const properties = mergeDeep2(initiaPropsComponent4, propsComponent || {});
|
|
3065
5045
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
3066
5046
|
const classes = selectVariants({ wrapper: true, disabled });
|
|
3067
5047
|
return /* @__PURE__ */ jsxs18("div", { className: classes, ref, children: [
|
|
@@ -3070,10 +5050,15 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
3070
5050
|
{
|
|
3071
5051
|
label,
|
|
3072
5052
|
variant: "base",
|
|
3073
|
-
disabled: true,
|
|
3074
5053
|
value: options.find((opt) => opt.value === valueState)?.label || "",
|
|
3075
5054
|
propsComponent: {
|
|
3076
|
-
control:
|
|
5055
|
+
control: {
|
|
5056
|
+
...properties?.control,
|
|
5057
|
+
ui: {
|
|
5058
|
+
...properties?.control?.ui,
|
|
5059
|
+
pointerEvents: "none"
|
|
5060
|
+
}
|
|
5061
|
+
},
|
|
3077
5062
|
label: properties?.label
|
|
3078
5063
|
}
|
|
3079
5064
|
}
|
|
@@ -3178,7 +5163,7 @@ var Slide = ({
|
|
|
3178
5163
|
onTransitionEnd,
|
|
3179
5164
|
propsComponent
|
|
3180
5165
|
}) => {
|
|
3181
|
-
const properties =
|
|
5166
|
+
const properties = mergeDeep2(initialPropsComponent5, propsComponent || {});
|
|
3182
5167
|
const stateRef = React22.useRef(inProp ? "in" : "out");
|
|
3183
5168
|
React22.useEffect(() => {
|
|
3184
5169
|
stateRef.current = inProp ? "in" : "out";
|
|
@@ -3381,17 +5366,17 @@ function useMediaQuery(query) {
|
|
|
3381
5366
|
}, [computedQuery]);
|
|
3382
5367
|
return matches;
|
|
3383
5368
|
}
|
|
3384
|
-
function useBreakpointValue(
|
|
5369
|
+
function useBreakpointValue(values2) {
|
|
3385
5370
|
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
3386
5371
|
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
3387
5372
|
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
3388
5373
|
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
3389
5374
|
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
3390
|
-
if (xl &&
|
|
3391
|
-
if (lg &&
|
|
3392
|
-
if (md &&
|
|
3393
|
-
if (sm &&
|
|
3394
|
-
if (xs &&
|
|
5375
|
+
if (xl && values2.xl !== void 0) return values2.xl;
|
|
5376
|
+
if (lg && values2.lg !== void 0) return values2.lg;
|
|
5377
|
+
if (md && values2.md !== void 0) return values2.md;
|
|
5378
|
+
if (sm && values2.sm !== void 0) return values2.sm;
|
|
5379
|
+
if (xs && values2.xs !== void 0) return values2.xs;
|
|
3395
5380
|
return void 0;
|
|
3396
5381
|
}
|
|
3397
5382
|
|
|
@@ -3506,6 +5491,8 @@ export {
|
|
|
3506
5491
|
createVariants,
|
|
3507
5492
|
cx,
|
|
3508
5493
|
darken,
|
|
5494
|
+
date,
|
|
5495
|
+
dtx,
|
|
3509
5496
|
getContrast,
|
|
3510
5497
|
getCountryCodePhone,
|
|
3511
5498
|
getDialPhone,
|
|
@@ -3515,13 +5502,12 @@ export {
|
|
|
3515
5502
|
hexToRgb,
|
|
3516
5503
|
initTheme,
|
|
3517
5504
|
inputCurrency,
|
|
3518
|
-
isEmpty,
|
|
3519
5505
|
lighten,
|
|
3520
|
-
mergeDeep,
|
|
5506
|
+
mergeDeep2 as mergeDeep,
|
|
5507
|
+
mergeInitialProps,
|
|
3521
5508
|
normalizePhone,
|
|
3522
|
-
rgbToHex,
|
|
5509
|
+
rgbToHex2 as rgbToHex,
|
|
3523
5510
|
text,
|
|
3524
|
-
times,
|
|
3525
5511
|
uiStyle,
|
|
3526
5512
|
useBackdrop,
|
|
3527
5513
|
useBreakpoint,
|
|
@@ -3531,5 +5517,6 @@ export {
|
|
|
3531
5517
|
useMediaQuery,
|
|
3532
5518
|
useNotistack,
|
|
3533
5519
|
usePlaces,
|
|
3534
|
-
useTheme
|
|
5520
|
+
useTheme,
|
|
5521
|
+
utils
|
|
3535
5522
|
};
|