@yr3/ui 1.0.24 → 1.1.2
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 +21 -12
- 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 +2456 -441
- package/dist/index.d.cts +781 -89
- package/dist/index.d.ts +781 -89
- package/dist/index.js +2468 -450
- package/dist/styles/index.css +30 -14
- package/dist/styles/index.css.map +1 -1
- package/package.json +3 -5
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 } = 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,83 @@ 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
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
2015
|
+
function findMonth(value, years, exclude, direction) {
|
|
2016
|
+
if (!value) return null;
|
|
2017
|
+
let [month, year] = value.split("-").map(Number);
|
|
2018
|
+
month -= 1;
|
|
2019
|
+
const excludedMap = /* @__PURE__ */ new Map();
|
|
2020
|
+
exclude.forEach((item) => {
|
|
2021
|
+
excludedMap.set(
|
|
2022
|
+
item.year,
|
|
2023
|
+
new Set(item.months)
|
|
2024
|
+
);
|
|
111
2025
|
});
|
|
112
|
-
|
|
2026
|
+
const sortedYears = [...years].sort((a, b) => a - b);
|
|
2027
|
+
while (true) {
|
|
2028
|
+
month += direction === "next" ? 1 : -1;
|
|
2029
|
+
if (month > 11) {
|
|
2030
|
+
const yearIndex = sortedYears.indexOf(year);
|
|
2031
|
+
const nextYear = sortedYears[yearIndex + 1];
|
|
2032
|
+
if (nextYear == null) {
|
|
2033
|
+
return null;
|
|
2034
|
+
}
|
|
2035
|
+
year = nextYear;
|
|
2036
|
+
month = 0;
|
|
2037
|
+
}
|
|
2038
|
+
if (month < 0) {
|
|
2039
|
+
const yearIndex = sortedYears.indexOf(year);
|
|
2040
|
+
const prevYear = sortedYears[yearIndex - 1];
|
|
2041
|
+
if (prevYear == null) {
|
|
2042
|
+
return null;
|
|
2043
|
+
}
|
|
2044
|
+
year = prevYear;
|
|
2045
|
+
month = 11;
|
|
2046
|
+
}
|
|
2047
|
+
const excluded = excludedMap.get(year)?.has(month);
|
|
2048
|
+
if (!excluded) {
|
|
2049
|
+
return `${String(month + 1).padStart(2, "0")}-${year}`;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
function getMonthCalendarProps({ year, data, value, format }) {
|
|
2054
|
+
const dtx2 = date(new Date(year, 1.1), format);
|
|
2055
|
+
const s = dtx2.getDateSplit(value);
|
|
2056
|
+
const months = dtx2.getMonthsFormat();
|
|
2057
|
+
const r = dtx2.getDateSplit(value);
|
|
2058
|
+
const smonths = times(
|
|
2059
|
+
months.length,
|
|
2060
|
+
(i) => ({
|
|
2061
|
+
year,
|
|
2062
|
+
label: upperCase(months[i]),
|
|
2063
|
+
value: dtx2.getMonthFormat(i),
|
|
2064
|
+
disabled: dtx2.isAfter(new Date(year, i)) || !!data.exclude.find((e) => e.year === year)?.months.includes(i),
|
|
2065
|
+
selected: !data.selected ? false : r?.month === i + 1 && r?.year === year
|
|
2066
|
+
})
|
|
2067
|
+
);
|
|
2068
|
+
const resolve = {
|
|
113
2069
|
year,
|
|
114
|
-
startIndex,
|
|
2070
|
+
startIndex: dtx2.getMonth(),
|
|
115
2071
|
years: data.years,
|
|
116
2072
|
value,
|
|
117
|
-
|
|
118
|
-
prev: !value ? "" : dayjs().year(Number(value?.split("-")[1])).month(Number(value?.split("-")[0])).format("MM-YYYY"),
|
|
119
|
-
months: Array.from({ length: 12 }, (_, i) => ({
|
|
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
|
-
}))
|
|
2073
|
+
months: smonths
|
|
125
2074
|
};
|
|
2075
|
+
return resolve;
|
|
126
2076
|
}
|
|
127
2077
|
|
|
128
2078
|
// src/utils/color.ts
|
|
129
|
-
var
|
|
2079
|
+
var rgbToHex2 = (r, g, b) => {
|
|
130
2080
|
return "#" + [r, g, b].map(
|
|
131
2081
|
(v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0")
|
|
132
2082
|
).join("");
|
|
@@ -169,7 +2119,7 @@ var createPaletteColor = (main) => {
|
|
|
169
2119
|
};
|
|
170
2120
|
var lighten = (hex, amount) => {
|
|
171
2121
|
const { r, g, b } = hexToRgb(hex);
|
|
172
|
-
return
|
|
2122
|
+
return rgbToHex2(
|
|
173
2123
|
r + (255 - r) * amount,
|
|
174
2124
|
g + (255 - g) * amount,
|
|
175
2125
|
b + (255 - b) * amount
|
|
@@ -177,7 +2127,7 @@ var lighten = (hex, amount) => {
|
|
|
177
2127
|
};
|
|
178
2128
|
var darken = (hex, amount) => {
|
|
179
2129
|
const { r, g, b } = hexToRgb(hex);
|
|
180
|
-
return
|
|
2130
|
+
return rgbToHex2(
|
|
181
2131
|
r * (1 - amount),
|
|
182
2132
|
g * (1 - amount),
|
|
183
2133
|
b * (1 - amount)
|
|
@@ -188,27 +2138,6 @@ var alpha = (hex, opacity) => {
|
|
|
188
2138
|
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
189
2139
|
};
|
|
190
2140
|
|
|
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
2141
|
// src/utils/cx.ts
|
|
213
2142
|
var cx = (...args) => {
|
|
214
2143
|
return args.flatMap((arg) => {
|
|
@@ -295,10 +2224,10 @@ var createVariants = (config) => {
|
|
|
295
2224
|
return (props = {}) => {
|
|
296
2225
|
const classes = [config.base];
|
|
297
2226
|
if (config.variants) {
|
|
298
|
-
Object.entries(config.variants).forEach(([key,
|
|
2227
|
+
Object.entries(config.variants).forEach(([key, map2]) => {
|
|
299
2228
|
const value = props[key];
|
|
300
|
-
if (value &&
|
|
301
|
-
classes.push(
|
|
2229
|
+
if (value && map2[value]) {
|
|
2230
|
+
classes.push(map2[value]);
|
|
302
2231
|
}
|
|
303
2232
|
});
|
|
304
2233
|
}
|
|
@@ -349,13 +2278,13 @@ var getNumberPhone = (phone, dial) => {
|
|
|
349
2278
|
};
|
|
350
2279
|
|
|
351
2280
|
// src/utils/merge.ts
|
|
352
|
-
function
|
|
2281
|
+
function mergeDeep2(target, source) {
|
|
353
2282
|
if (!source) return target;
|
|
354
2283
|
const output = { ...target };
|
|
355
|
-
Object.keys(source)
|
|
2284
|
+
Object.keys(source)?.forEach((key) => {
|
|
356
2285
|
const k = key;
|
|
357
2286
|
if (typeof source[k] === "object" && source[k] !== null && !Array.isArray(source[k])) {
|
|
358
|
-
output[k] =
|
|
2287
|
+
output[k] = mergeDeep2(
|
|
359
2288
|
target[k] || {},
|
|
360
2289
|
source[k]
|
|
361
2290
|
);
|
|
@@ -365,6 +2294,10 @@ function mergeDeep(target, source) {
|
|
|
365
2294
|
});
|
|
366
2295
|
return output;
|
|
367
2296
|
}
|
|
2297
|
+
function mergeInitialProps(initial, props) {
|
|
2298
|
+
if (!props) return initial;
|
|
2299
|
+
return mergeDeep2(initial, props);
|
|
2300
|
+
}
|
|
368
2301
|
|
|
369
2302
|
// src/utils/input.ts
|
|
370
2303
|
var inputCurrency = (e, value, alloweds) => {
|
|
@@ -375,6 +2308,11 @@ var inputCurrency = (e, value, alloweds) => {
|
|
|
375
2308
|
e.preventDefault();
|
|
376
2309
|
};
|
|
377
2310
|
|
|
2311
|
+
// src/utils/utils.ts
|
|
2312
|
+
var utils = {
|
|
2313
|
+
...common_exports
|
|
2314
|
+
};
|
|
2315
|
+
|
|
378
2316
|
// src/theme/breakpoint.ts
|
|
379
2317
|
var breakpoints = {
|
|
380
2318
|
xs: 0,
|
|
@@ -690,32 +2628,153 @@ var boxVariants = createVariants({
|
|
|
690
2628
|
sticky: "yr3Box--position-sticky"
|
|
691
2629
|
}
|
|
692
2630
|
}
|
|
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
|
-
);
|
|
2631
|
+
});
|
|
2632
|
+
|
|
2633
|
+
// src/components/Box/Box.tsx
|
|
2634
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2635
|
+
var Box = ({
|
|
2636
|
+
content = "start",
|
|
2637
|
+
children,
|
|
2638
|
+
drawer = false,
|
|
2639
|
+
ui,
|
|
2640
|
+
style,
|
|
2641
|
+
as: Component = "div",
|
|
2642
|
+
position = "relative",
|
|
2643
|
+
...props
|
|
2644
|
+
}) => {
|
|
2645
|
+
const classes = boxVariants({ content, drawer, position });
|
|
2646
|
+
return /* @__PURE__ */ jsx4(
|
|
2647
|
+
Component,
|
|
2648
|
+
{
|
|
2649
|
+
className: classes,
|
|
2650
|
+
style: composeStyles(ui, style),
|
|
2651
|
+
...props,
|
|
2652
|
+
"data-testid": "yr3Box",
|
|
2653
|
+
children
|
|
2654
|
+
}
|
|
2655
|
+
);
|
|
2656
|
+
};
|
|
2657
|
+
|
|
2658
|
+
// src/components/Flex/flex.variants.ts
|
|
2659
|
+
var flexVariants = createVariants({
|
|
2660
|
+
base: "yr3Flex",
|
|
2661
|
+
variants: {
|
|
2662
|
+
variant: {
|
|
2663
|
+
row: "yr3Flex--row",
|
|
2664
|
+
column: "yr3Flex--column",
|
|
2665
|
+
wrap: "yr3Flex--wrap"
|
|
2666
|
+
},
|
|
2667
|
+
container: {
|
|
2668
|
+
true: "yr3Flex--container"
|
|
2669
|
+
},
|
|
2670
|
+
center: {
|
|
2671
|
+
true: "yr3Flex--center"
|
|
2672
|
+
},
|
|
2673
|
+
between: {
|
|
2674
|
+
true: "yr3Flex--between"
|
|
2675
|
+
},
|
|
2676
|
+
bordered: {
|
|
2677
|
+
true: "yr3Flex--bordered"
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
});
|
|
2681
|
+
var flex_variants_default = flexVariants;
|
|
2682
|
+
|
|
2683
|
+
// src/components/Flex/Flex.tsx
|
|
2684
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2685
|
+
var Flex = ({
|
|
2686
|
+
container = false,
|
|
2687
|
+
spacing: spacing2 = 1,
|
|
2688
|
+
children,
|
|
2689
|
+
ui,
|
|
2690
|
+
gap,
|
|
2691
|
+
variant = "column",
|
|
2692
|
+
center = false,
|
|
2693
|
+
between = false,
|
|
2694
|
+
style,
|
|
2695
|
+
bordered = false,
|
|
2696
|
+
...props
|
|
2697
|
+
}) => {
|
|
2698
|
+
const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
|
|
2699
|
+
return /* @__PURE__ */ jsx5(
|
|
2700
|
+
"div",
|
|
2701
|
+
{
|
|
2702
|
+
className: classes,
|
|
2703
|
+
style: composeStyles(ui, style),
|
|
2704
|
+
...props,
|
|
2705
|
+
"data-testid": "yr3Flex",
|
|
2706
|
+
children
|
|
2707
|
+
}
|
|
2708
|
+
);
|
|
2709
|
+
};
|
|
2710
|
+
|
|
2711
|
+
// src/components/Loader/loader.variants.ts
|
|
2712
|
+
var loaderSpinnerVariants = createVariants({
|
|
2713
|
+
base: "yr3Loader--spinner",
|
|
2714
|
+
variants: {
|
|
2715
|
+
color: {
|
|
2716
|
+
primary: "yr3Loader--spinner-color-primary",
|
|
2717
|
+
secondary: "yr3Loader--spinner-color-secondary",
|
|
2718
|
+
success: "yr3Loader--spinner-color-success",
|
|
2719
|
+
error: "yr3Loader--spinner-color-error",
|
|
2720
|
+
warning: "yr3Loader--spinner-color-warning",
|
|
2721
|
+
info: "yr3Loader--spinner-color-info",
|
|
2722
|
+
disabled: "yr3Loader--spinner-color-disabled",
|
|
2723
|
+
text: "yr3Loader--spinner-color-text",
|
|
2724
|
+
background: "yr3Loader--spinner-color-background",
|
|
2725
|
+
common: "yr3Loader--spinner-color-common"
|
|
2726
|
+
},
|
|
2727
|
+
size: {
|
|
2728
|
+
sm: "yr3Loader--spinner-size-sm",
|
|
2729
|
+
md: "yr3Loader--spinner-size-md",
|
|
2730
|
+
lg: "yr3Loader--spinner-size-lg",
|
|
2731
|
+
xs: "yr3Loader--spinner-size-xs"
|
|
2732
|
+
},
|
|
2733
|
+
type: {
|
|
2734
|
+
default: "yr3Loader--spinner-default",
|
|
2735
|
+
dots: "yr3Loader--spinner-dots",
|
|
2736
|
+
fancy: "yr3Loader--spinner-fancy"
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
});
|
|
2740
|
+
|
|
2741
|
+
// src/components/Loader/Loader.tsx
|
|
2742
|
+
import * as React3 from "react";
|
|
2743
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2744
|
+
var initialComponents = {
|
|
2745
|
+
loader: {
|
|
2746
|
+
ui: {},
|
|
2747
|
+
style: {}
|
|
2748
|
+
},
|
|
2749
|
+
spinner: {
|
|
2750
|
+
size: "sm",
|
|
2751
|
+
color: "primary",
|
|
2752
|
+
type: "default"
|
|
2753
|
+
},
|
|
2754
|
+
container: {
|
|
2755
|
+
center: true,
|
|
2756
|
+
container: true,
|
|
2757
|
+
ui: {
|
|
2758
|
+
width: "100%",
|
|
2759
|
+
height: "100%"
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
};
|
|
2763
|
+
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2764
|
+
const properties = mergeDeep2(initialComponents, propsComponent || {});
|
|
2765
|
+
const classSpinner = loaderSpinnerVariants({
|
|
2766
|
+
color: properties?.spinner?.color,
|
|
2767
|
+
type: properties?.spinner?.type,
|
|
2768
|
+
size: properties?.spinner?.size
|
|
2769
|
+
});
|
|
2770
|
+
if (!loading) return null;
|
|
2771
|
+
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: [
|
|
2772
|
+
/* @__PURE__ */ jsx6("span", {}),
|
|
2773
|
+
/* @__PURE__ */ jsx6("span", {}),
|
|
2774
|
+
/* @__PURE__ */ jsx6("span", {})
|
|
2775
|
+
] }) }) }) });
|
|
718
2776
|
};
|
|
2777
|
+
var Loader_default = Loader;
|
|
719
2778
|
|
|
720
2779
|
// src/components/Text/text.variants.ts
|
|
721
2780
|
var textVariants = createVariants({
|
|
@@ -764,7 +2823,7 @@ var textVariants = createVariants({
|
|
|
764
2823
|
var text_variants_default = textVariants;
|
|
765
2824
|
|
|
766
2825
|
// src/components/Text/Text.tsx
|
|
767
|
-
import { jsx as
|
|
2826
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
768
2827
|
var Text = ({
|
|
769
2828
|
children,
|
|
770
2829
|
variant = "inherit",
|
|
@@ -778,7 +2837,7 @@ var Text = ({
|
|
|
778
2837
|
}) => {
|
|
779
2838
|
const styleUI = uiStyle({ ...ui, marginTop: gutters[0] || 0, marginBottom: gutters[1] || 0 });
|
|
780
2839
|
const classes = text_variants_default({ variant, color, weight });
|
|
781
|
-
return /* @__PURE__ */
|
|
2840
|
+
return /* @__PURE__ */ jsx7(
|
|
782
2841
|
Component,
|
|
783
2842
|
{
|
|
784
2843
|
className: classes,
|
|
@@ -823,15 +2882,18 @@ var buttonVariant = createVariants({
|
|
|
823
2882
|
},
|
|
824
2883
|
animated: {
|
|
825
2884
|
true: "yr3Button--animated"
|
|
2885
|
+
},
|
|
2886
|
+
loading: {
|
|
2887
|
+
true: "yr3Button--spinner-size-md "
|
|
826
2888
|
}
|
|
827
2889
|
}
|
|
828
2890
|
});
|
|
829
2891
|
|
|
830
2892
|
// src/components/Button/Button.tsx
|
|
831
|
-
import { jsx as
|
|
2893
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
832
2894
|
var Button = ({ icon, children, color = "text", variant = "text", animated, disabled, gradientBorder = false, size = "auto", ui, style, propsComponent, ...props }) => {
|
|
833
2895
|
const buttonClassname = buttonVariant({ variant, color, animated, disabled, gradientBorder, size });
|
|
834
|
-
return /* @__PURE__ */
|
|
2896
|
+
return /* @__PURE__ */ jsxs3(
|
|
835
2897
|
"button",
|
|
836
2898
|
{
|
|
837
2899
|
className: buttonClassname,
|
|
@@ -840,17 +2902,16 @@ var Button = ({ icon, children, color = "text", variant = "text", animated, disa
|
|
|
840
2902
|
...props,
|
|
841
2903
|
style: composeStyles(ui, style),
|
|
842
2904
|
children: [
|
|
843
|
-
|
|
844
|
-
/* @__PURE__ */
|
|
2905
|
+
/* @__PURE__ */ jsx8(Loader_default, { ...propsComponent?.loader }),
|
|
2906
|
+
icon && /* @__PURE__ */ jsx8("span", { className: "yr3Button--icon", children: icon }),
|
|
2907
|
+
/* @__PURE__ */ jsx8(Text, { variant: propsComponent?.text?.variant || "button", ...propsComponent?.text, children })
|
|
845
2908
|
]
|
|
846
2909
|
}
|
|
847
2910
|
);
|
|
848
2911
|
};
|
|
849
2912
|
|
|
850
2913
|
// src/components/Calendar/Calendar.tsx
|
|
851
|
-
import * as
|
|
852
|
-
import dayjs2 from "dayjs";
|
|
853
|
-
import weekday from "dayjs/plugin/weekday";
|
|
2914
|
+
import * as React4 from "react";
|
|
854
2915
|
|
|
855
2916
|
// src/components/Calendar/calendar.variants.ts
|
|
856
2917
|
var calendarVariants = createVariants({
|
|
@@ -899,14 +2960,22 @@ var calendarDayVariants = createVariants({
|
|
|
899
2960
|
});
|
|
900
2961
|
|
|
901
2962
|
// src/components/Calendar/Calendar.tsx
|
|
902
|
-
import { jsx as
|
|
903
|
-
dayjs2.extend(weekday);
|
|
2963
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
904
2964
|
var initalPropsComponent = {
|
|
905
2965
|
displayButtons: true,
|
|
906
2966
|
displayCalendar: true,
|
|
2967
|
+
container: {
|
|
2968
|
+
ui: {
|
|
2969
|
+
width: "100%",
|
|
2970
|
+
maxWidth: 400
|
|
2971
|
+
},
|
|
2972
|
+
style: {}
|
|
2973
|
+
},
|
|
907
2974
|
header: {
|
|
908
2975
|
color: "primary",
|
|
909
|
-
ui: {
|
|
2976
|
+
ui: {
|
|
2977
|
+
px: 0.5
|
|
2978
|
+
},
|
|
910
2979
|
style: {}
|
|
911
2980
|
},
|
|
912
2981
|
month: {
|
|
@@ -916,6 +2985,7 @@ var initalPropsComponent = {
|
|
|
916
2985
|
},
|
|
917
2986
|
day: {
|
|
918
2987
|
color: "primary",
|
|
2988
|
+
selected: "secondary",
|
|
919
2989
|
bordered: true,
|
|
920
2990
|
ui: {},
|
|
921
2991
|
style: {},
|
|
@@ -923,49 +2993,89 @@ var initalPropsComponent = {
|
|
|
923
2993
|
},
|
|
924
2994
|
buttonNext: {
|
|
925
2995
|
disabled: false,
|
|
926
|
-
label: "next"
|
|
2996
|
+
label: "next",
|
|
2997
|
+
color: "primary",
|
|
2998
|
+
ui: {
|
|
2999
|
+
justifyContent: "flex-end",
|
|
3000
|
+
p: 0
|
|
3001
|
+
}
|
|
927
3002
|
},
|
|
928
3003
|
buttonBack: {
|
|
929
3004
|
disabled: false,
|
|
930
|
-
label: "back"
|
|
3005
|
+
label: "back",
|
|
3006
|
+
color: "primary",
|
|
3007
|
+
ui: {
|
|
3008
|
+
justifyContent: "flex-start",
|
|
3009
|
+
p: 0
|
|
3010
|
+
}
|
|
931
3011
|
}
|
|
932
3012
|
};
|
|
933
|
-
var Calendar = ({ onSelect, propsComponent
|
|
934
|
-
const
|
|
935
|
-
const
|
|
936
|
-
const
|
|
937
|
-
const
|
|
938
|
-
|
|
3013
|
+
var Calendar = ({ onSelect, propsComponent, mapCalendar, onMonthChange, dataFormat, buttonsComponent }) => {
|
|
3014
|
+
const properties = mergeInitialProps(initalPropsComponent, propsComponent);
|
|
3015
|
+
const _date = /* @__PURE__ */ new Date();
|
|
3016
|
+
const month = date(_date).getMonth();
|
|
3017
|
+
const [currentMonth, setCurrentMonth] = React4.useState(month);
|
|
3018
|
+
const [selected, setSelected] = React4.useState(null);
|
|
3019
|
+
const program = React4.useMemo(() => {
|
|
3020
|
+
return getMonthCalendar(dataFormat, (/* @__PURE__ */ new Date()).getFullYear(), currentMonth, 0, selected, mapCalendar);
|
|
939
3021
|
}, [selected, currentMonth, mapCalendar]);
|
|
940
|
-
|
|
3022
|
+
React4.useEffect(() => {
|
|
941
3023
|
if (selected) {
|
|
942
3024
|
onSelect && onSelect(selected);
|
|
943
3025
|
} else {
|
|
944
|
-
onSelect && onSelect(program
|
|
3026
|
+
onSelect && onSelect(program?.currentDay);
|
|
945
3027
|
}
|
|
946
3028
|
}, [selected, program, onSelect]);
|
|
947
|
-
|
|
3029
|
+
React4.useEffect(() => {
|
|
948
3030
|
if (currentMonth) {
|
|
949
3031
|
onMonthChange && onMonthChange(currentMonth);
|
|
950
3032
|
}
|
|
951
3033
|
}, [currentMonth]);
|
|
952
|
-
return /* @__PURE__ */
|
|
953
|
-
propsComponent?.displayButtons && /* @__PURE__ */
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
|
|
956
|
-
|
|
3034
|
+
return /* @__PURE__ */ jsxs4("div", { className: "yr3Calendar", "data-testid": "yr3Calendar", style: composeStyles(properties?.container?.ui, properties?.container?.style), children: [
|
|
3035
|
+
propsComponent?.displayButtons && /* @__PURE__ */ jsxs4("div", { className: "yr3Calendar--header", "data-testid": "yr3CalendarHeader", style: composeStyles(properties?.header?.ui, properties?.header?.style), children: [
|
|
3036
|
+
/* @__PURE__ */ jsx9(
|
|
3037
|
+
Button,
|
|
3038
|
+
{
|
|
3039
|
+
disabled: properties?.buttonBack?.disabled || false,
|
|
3040
|
+
color: properties.buttonBack?.color || "primary",
|
|
3041
|
+
onClick: () => setCurrentMonth(currentMonth - 1),
|
|
3042
|
+
ui: { ...properties.buttonBack.ui },
|
|
3043
|
+
propsComponent: {
|
|
3044
|
+
text: {
|
|
3045
|
+
color: properties?.buttonBack?.color || "primary"
|
|
3046
|
+
}
|
|
3047
|
+
},
|
|
3048
|
+
children: buttonsComponent?.buttonBack ? buttonsComponent?.buttonBack : properties?.buttonBack?.label
|
|
3049
|
+
}
|
|
3050
|
+
),
|
|
3051
|
+
/* @__PURE__ */ jsx9(Text, { variant: "h6", color: properties.header?.color || "primary", ui: { textTransform: "uppercase", textAlign: "center" }, children: program?.monthLabel }),
|
|
3052
|
+
/* @__PURE__ */ jsx9(
|
|
3053
|
+
Button,
|
|
3054
|
+
{
|
|
3055
|
+
disabled: properties?.buttonNext?.disabled,
|
|
3056
|
+
color: properties?.buttonNext?.color || "primary",
|
|
3057
|
+
onClick: () => setCurrentMonth(currentMonth + 1),
|
|
3058
|
+
propsComponent: {
|
|
3059
|
+
text: {
|
|
3060
|
+
color: properties?.buttonNext?.color || "primary"
|
|
3061
|
+
}
|
|
3062
|
+
},
|
|
3063
|
+
ui: { ...properties.buttonNext.ui },
|
|
3064
|
+
children: buttonsComponent?.buttonNext ? buttonsComponent?.buttonNext : properties?.buttonNext?.label
|
|
3065
|
+
}
|
|
3066
|
+
)
|
|
957
3067
|
] }),
|
|
958
|
-
|
|
959
|
-
program?.daysContainer
|
|
3068
|
+
properties?.displayCalendar && /* @__PURE__ */ jsxs4("div", { className: "yr3Calendar--container", children: [
|
|
3069
|
+
program?.daysContainer?.map((i) => /* @__PURE__ */ jsx9("div", { className: "yr3Calendar--month", style: composeStyles(properties?.month?.ui, properties?.month?.style), children: /* @__PURE__ */ jsx9(
|
|
960
3070
|
Text,
|
|
961
3071
|
{
|
|
962
3072
|
variant: "caption",
|
|
963
|
-
color:
|
|
964
|
-
ui: { ...
|
|
965
|
-
children:
|
|
3073
|
+
color: properties?.month?.color || "primary",
|
|
3074
|
+
ui: { ...properties?.month?.ui, opacity: 0.7, textTransform: "uppercase" },
|
|
3075
|
+
children: i.label
|
|
966
3076
|
}
|
|
967
|
-
) }, `month_day_${i}`)),
|
|
968
|
-
times(program
|
|
3077
|
+
) }, `month_day_${i.label}`)),
|
|
3078
|
+
times(program?.calendar.length, (i) => /* @__PURE__ */ jsx9(React4.Fragment, { children: times(program?.calendar[i].length, (j) => /* @__PURE__ */ jsxs4(
|
|
969
3079
|
"div",
|
|
970
3080
|
{
|
|
971
3081
|
className: calendarDayVariants({
|
|
@@ -974,11 +3084,11 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
974
3084
|
isPast: program.calendar[i][j]?.isPast,
|
|
975
3085
|
isFuture: program.calendar[i][j]?.isFuture,
|
|
976
3086
|
isCurrentMonth: program.calendar[i][j]?.isCurrentMonth,
|
|
977
|
-
ui:
|
|
978
|
-
bordered: !!program.calendar[i][j] &&
|
|
979
|
-
color:
|
|
3087
|
+
ui: properties?.day?.ui,
|
|
3088
|
+
bordered: !!program.calendar[i][j] && properties?.day?.bordered,
|
|
3089
|
+
color: properties?.day?.color || "primary"
|
|
980
3090
|
}),
|
|
981
|
-
style: composeStyles(
|
|
3091
|
+
style: composeStyles(properties?.day?.ui, properties?.day?.style),
|
|
982
3092
|
"data-testid": "yr3CalendarDay",
|
|
983
3093
|
onClick: () => {
|
|
984
3094
|
if (selected === program.calendar[i][j]) {
|
|
@@ -988,13 +3098,13 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
988
3098
|
}
|
|
989
3099
|
},
|
|
990
3100
|
children: [
|
|
991
|
-
program
|
|
992
|
-
/* @__PURE__ */
|
|
3101
|
+
program?.calendar[i][j]?.data && properties?.day?.component ? properties?.day?.component : null,
|
|
3102
|
+
/* @__PURE__ */ jsx9(
|
|
993
3103
|
Text,
|
|
994
3104
|
{
|
|
995
3105
|
variant: "body2",
|
|
996
|
-
color: program
|
|
997
|
-
children: program
|
|
3106
|
+
color: program?.calendar[i][j]?.selected ? properties?.day?.selected : "primary",
|
|
3107
|
+
children: program?.calendar[i][j]?.day || ""
|
|
998
3108
|
}
|
|
999
3109
|
)
|
|
1000
3110
|
]
|
|
@@ -1006,8 +3116,8 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1006
3116
|
};
|
|
1007
3117
|
|
|
1008
3118
|
// src/components/Checkbox/Checkbox.tsx
|
|
1009
|
-
import * as
|
|
1010
|
-
import { jsx as
|
|
3119
|
+
import * as React5 from "react";
|
|
3120
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1011
3121
|
var initialPropsComponent = {
|
|
1012
3122
|
checkbox: {
|
|
1013
3123
|
ui: {
|
|
@@ -1032,20 +3142,20 @@ var Checkbox = ({
|
|
|
1032
3142
|
type = "default",
|
|
1033
3143
|
variant = "text"
|
|
1034
3144
|
}) => {
|
|
1035
|
-
const [internal, setInternal] =
|
|
3145
|
+
const [internal, setInternal] = React5.useState(defaultChecked || false);
|
|
1036
3146
|
const isControlled = checked !== void 0;
|
|
1037
3147
|
const value = isControlled ? checked : internal;
|
|
1038
3148
|
const handleChange = (e) => {
|
|
1039
3149
|
if (!isControlled) setInternal(e.target.checked);
|
|
1040
3150
|
onChange?.(e, e.target.checked);
|
|
1041
3151
|
};
|
|
1042
|
-
const properties =
|
|
3152
|
+
const properties = mergeDeep2(initialPropsComponent, propsComponent || {});
|
|
1043
3153
|
const bemClasse = bem("yr3Checkbox");
|
|
1044
3154
|
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}`, type: `type-${type}` });
|
|
1045
3155
|
const boxClasses = bem("yr3Checkbox-box");
|
|
1046
3156
|
const classesBox = boxClasses(void 0, { checked: !!value });
|
|
1047
|
-
return /* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
3157
|
+
return /* @__PURE__ */ jsxs5("label", { className: classes, style: uiStyle(properties?.checkbox?.ui), "data-testid": "yr3Checkbox", children: [
|
|
3158
|
+
/* @__PURE__ */ jsx10(
|
|
1049
3159
|
"input",
|
|
1050
3160
|
{
|
|
1051
3161
|
type: "checkbox",
|
|
@@ -1055,8 +3165,8 @@ var Checkbox = ({
|
|
|
1055
3165
|
"data-testid": "yr3Checkbox-input"
|
|
1056
3166
|
}
|
|
1057
3167
|
),
|
|
1058
|
-
/* @__PURE__ */
|
|
1059
|
-
label && /* @__PURE__ */
|
|
3168
|
+
/* @__PURE__ */ jsx10("span", { className: classesBox, "data-testid": "yr3Checkbox-box" }),
|
|
3169
|
+
label && /* @__PURE__ */ jsx10(Text, { variant: "caption", color: !value ? properties?.content?.color : color, ...properties?.content, children: label })
|
|
1060
3170
|
] });
|
|
1061
3171
|
};
|
|
1062
3172
|
|
|
@@ -1093,9 +3203,9 @@ var chipVariants = createVariants({
|
|
|
1093
3203
|
var chip_variants_default = chipVariants;
|
|
1094
3204
|
|
|
1095
3205
|
// src/Icons/IconClose.tsx
|
|
1096
|
-
import { jsx as
|
|
3206
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1097
3207
|
var IconClose = (props) => {
|
|
1098
|
-
return /* @__PURE__ */
|
|
3208
|
+
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
3209
|
"path",
|
|
1100
3210
|
{
|
|
1101
3211
|
d: "M16 16L12 12M12 12L8 8M12 12L16 8M12 12L8 16",
|
|
@@ -1108,7 +3218,7 @@ var IconClose = (props) => {
|
|
|
1108
3218
|
};
|
|
1109
3219
|
|
|
1110
3220
|
// src/components/Chip/Chip.tsx
|
|
1111
|
-
import { jsx as
|
|
3221
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1112
3222
|
var initialChipProps = {
|
|
1113
3223
|
label: {
|
|
1114
3224
|
ui: {},
|
|
@@ -1124,9 +3234,9 @@ var initialChipProps = {
|
|
|
1124
3234
|
}
|
|
1125
3235
|
};
|
|
1126
3236
|
var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "medium", propsComponent, ...props }) => {
|
|
1127
|
-
const properties =
|
|
3237
|
+
const properties = mergeDeep2(initialChipProps, propsComponent);
|
|
1128
3238
|
const className = chip_variants_default({ variant, colors: color, rounded, size });
|
|
1129
|
-
return /* @__PURE__ */
|
|
3239
|
+
return /* @__PURE__ */ jsxs6(
|
|
1130
3240
|
"div",
|
|
1131
3241
|
{
|
|
1132
3242
|
className,
|
|
@@ -1135,8 +3245,8 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1135
3245
|
style: composeStyles(properties.chip?.ui, properties.chip?.style),
|
|
1136
3246
|
children: [
|
|
1137
3247
|
icon,
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
deleted && /* @__PURE__ */
|
|
3248
|
+
/* @__PURE__ */ jsx12("span", { className: "yr3Chip__label", style: composeStyles(properties?.label?.ui, properties?.label?.style), children: label }),
|
|
3249
|
+
deleted && /* @__PURE__ */ jsx12(
|
|
1140
3250
|
"span",
|
|
1141
3251
|
{
|
|
1142
3252
|
className: "yr3Chip__delete",
|
|
@@ -1144,7 +3254,7 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1144
3254
|
role: "button",
|
|
1145
3255
|
"aria-label": "delete",
|
|
1146
3256
|
style: composeStyles(properties?.delete?.ui, properties?.delete?.style),
|
|
1147
|
-
children: /* @__PURE__ */
|
|
3257
|
+
children: /* @__PURE__ */ jsx12(IconClose, { ...properties?.icon, stroke: color })
|
|
1148
3258
|
}
|
|
1149
3259
|
)
|
|
1150
3260
|
]
|
|
@@ -1153,12 +3263,12 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1153
3263
|
};
|
|
1154
3264
|
|
|
1155
3265
|
// src/components/Collapse/Collapse.tsx
|
|
1156
|
-
import * as
|
|
1157
|
-
import { jsx as
|
|
3266
|
+
import * as React6 from "react";
|
|
3267
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1158
3268
|
var Collapse = ({ children, open, anchor }) => {
|
|
1159
|
-
const ref =
|
|
1160
|
-
const [height, setHeight] =
|
|
1161
|
-
|
|
3269
|
+
const ref = React6.useRef(null);
|
|
3270
|
+
const [height, setHeight] = React6.useState(0);
|
|
3271
|
+
React6.useEffect(() => {
|
|
1162
3272
|
if (ref.current) {
|
|
1163
3273
|
if (open) {
|
|
1164
3274
|
setHeight(ref.current.scrollHeight);
|
|
@@ -1167,11 +3277,11 @@ var Collapse = ({ children, open, anchor }) => {
|
|
|
1167
3277
|
}
|
|
1168
3278
|
}
|
|
1169
3279
|
}, [open, children]);
|
|
1170
|
-
return /* @__PURE__ */
|
|
3280
|
+
return /* @__PURE__ */ jsx13("div", { className: `yr3Collapse yr3Collapse--${anchor}`, style: { height }, "data-testid": "yr3Collapse", children: /* @__PURE__ */ jsx13("div", { ref, className: "yr3Collapse__inner", children }) });
|
|
1171
3281
|
};
|
|
1172
3282
|
|
|
1173
3283
|
// src/components/Container/Container.tsx
|
|
1174
|
-
import { jsx as
|
|
3284
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1175
3285
|
var Container = ({
|
|
1176
3286
|
children,
|
|
1177
3287
|
maxWidth = "sm",
|
|
@@ -1181,7 +3291,7 @@ var Container = ({
|
|
|
1181
3291
|
}) => {
|
|
1182
3292
|
const containerClassName = bem("yr3Container");
|
|
1183
3293
|
const classes = containerClassName(void 0, { maxWidth, static: fixed });
|
|
1184
|
-
return /* @__PURE__ */
|
|
3294
|
+
return /* @__PURE__ */ jsx14(
|
|
1185
3295
|
"div",
|
|
1186
3296
|
{
|
|
1187
3297
|
className: classes,
|
|
@@ -1193,12 +3303,12 @@ var Container = ({
|
|
|
1193
3303
|
};
|
|
1194
3304
|
|
|
1195
3305
|
// src/theme/controlContext.tsx
|
|
1196
|
-
import * as
|
|
1197
|
-
var ControlContext =
|
|
1198
|
-
var useControl = () =>
|
|
3306
|
+
import * as React7 from "react";
|
|
3307
|
+
var ControlContext = React7.createContext(null);
|
|
3308
|
+
var useControl = () => React7.useContext(ControlContext);
|
|
1199
3309
|
|
|
1200
3310
|
// src/components/Control/Control.tsx
|
|
1201
|
-
import * as
|
|
3311
|
+
import * as React8 from "react";
|
|
1202
3312
|
|
|
1203
3313
|
// src/components/Control/control.variants.ts
|
|
1204
3314
|
var controlVariants = createVariants({
|
|
@@ -1241,7 +3351,7 @@ var controlVariants = createVariants({
|
|
|
1241
3351
|
});
|
|
1242
3352
|
|
|
1243
3353
|
// src/components/Control/Control.tsx
|
|
1244
|
-
import { jsx as
|
|
3354
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1245
3355
|
var Control = ({
|
|
1246
3356
|
children,
|
|
1247
3357
|
error = false,
|
|
@@ -1253,7 +3363,7 @@ var Control = ({
|
|
|
1253
3363
|
size = "auto",
|
|
1254
3364
|
label = true
|
|
1255
3365
|
}) => {
|
|
1256
|
-
const [focused, setFocused] =
|
|
3366
|
+
const [focused, setFocused] = React8.useState(false);
|
|
1257
3367
|
const value = {
|
|
1258
3368
|
focused,
|
|
1259
3369
|
setFocused,
|
|
@@ -1261,7 +3371,7 @@ var Control = ({
|
|
|
1261
3371
|
disabled
|
|
1262
3372
|
};
|
|
1263
3373
|
const classes = controlVariants({ variant, color, label, size, disabled });
|
|
1264
|
-
return /* @__PURE__ */
|
|
3374
|
+
return /* @__PURE__ */ jsx15(ControlContext.Provider, { value, children: /* @__PURE__ */ jsx15(
|
|
1265
3375
|
"div",
|
|
1266
3376
|
{
|
|
1267
3377
|
className: classes,
|
|
@@ -1304,7 +3414,7 @@ var dividerVariants = createVariants({
|
|
|
1304
3414
|
var dividerVariants_default = dividerVariants;
|
|
1305
3415
|
|
|
1306
3416
|
// src/components/Divider/Divider.tsx
|
|
1307
|
-
import { jsx as
|
|
3417
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1308
3418
|
var Divider = ({
|
|
1309
3419
|
orientation = "horizontal",
|
|
1310
3420
|
text: text2,
|
|
@@ -1314,14 +3424,14 @@ var Divider = ({
|
|
|
1314
3424
|
color = "primary"
|
|
1315
3425
|
}) => {
|
|
1316
3426
|
const classname = dividerVariants_default({ orientation, align, withText: !!text2, color });
|
|
1317
|
-
return /* @__PURE__ */
|
|
3427
|
+
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
3428
|
};
|
|
1319
3429
|
|
|
1320
3430
|
// src/components/Drawer/Drawer.tsx
|
|
1321
|
-
import * as
|
|
3431
|
+
import * as React9 from "react";
|
|
1322
3432
|
|
|
1323
3433
|
// src/components/Drawer/DrawerContainer.tsx
|
|
1324
|
-
import { jsx as
|
|
3434
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1325
3435
|
var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
1326
3436
|
const { hide } = useBackdrop();
|
|
1327
3437
|
const handleClose = () => {
|
|
@@ -1331,7 +3441,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1331
3441
|
}
|
|
1332
3442
|
return;
|
|
1333
3443
|
};
|
|
1334
|
-
return /* @__PURE__ */
|
|
3444
|
+
return /* @__PURE__ */ jsx17("div", { className: "yr3Drawer--container", style: composeStyles(ui, style), onClick: handleClose, "data-testid": "yr3Drawer-container", children });
|
|
1335
3445
|
};
|
|
1336
3446
|
var DrawerContainer_default = DrawerContainer;
|
|
1337
3447
|
|
|
@@ -1351,7 +3461,7 @@ var useClickAway = (ref, callback) => {
|
|
|
1351
3461
|
};
|
|
1352
3462
|
|
|
1353
3463
|
// src/components/Drawer/Drawer.tsx
|
|
1354
|
-
import { jsx as
|
|
3464
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1355
3465
|
var initialPropsComponent2 = {
|
|
1356
3466
|
drawer: {},
|
|
1357
3467
|
closing: null,
|
|
@@ -1360,9 +3470,9 @@ var initialPropsComponent2 = {
|
|
|
1360
3470
|
};
|
|
1361
3471
|
var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
1362
3472
|
const { show, hide } = useBackdrop();
|
|
1363
|
-
const ref =
|
|
1364
|
-
const properties =
|
|
1365
|
-
|
|
3473
|
+
const ref = React9.useRef(null);
|
|
3474
|
+
const properties = mergeDeep2(initialPropsComponent2, propsComponent);
|
|
3475
|
+
React9.useEffect(() => {
|
|
1366
3476
|
if (open) {
|
|
1367
3477
|
show("drawer");
|
|
1368
3478
|
} else {
|
|
@@ -1377,7 +3487,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1377
3487
|
}
|
|
1378
3488
|
;
|
|
1379
3489
|
});
|
|
1380
|
-
|
|
3490
|
+
React9.useEffect(() => {
|
|
1381
3491
|
if (properties?.onClose) {
|
|
1382
3492
|
hide("drawer");
|
|
1383
3493
|
onClose();
|
|
@@ -1385,7 +3495,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1385
3495
|
}, [properties?.onClose]);
|
|
1386
3496
|
const classesBem = bem("yr3Drawer");
|
|
1387
3497
|
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1388
|
-
return /* @__PURE__ */
|
|
3498
|
+
return /* @__PURE__ */ jsx18(
|
|
1389
3499
|
"div",
|
|
1390
3500
|
{
|
|
1391
3501
|
className: drawerClasses,
|
|
@@ -1393,7 +3503,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1393
3503
|
onClick: (e) => e.stopPropagation(),
|
|
1394
3504
|
ref,
|
|
1395
3505
|
"data-testid": "yr3Drawer",
|
|
1396
|
-
children: /* @__PURE__ */
|
|
3506
|
+
children: /* @__PURE__ */ jsx18(
|
|
1397
3507
|
DrawerContainer_default,
|
|
1398
3508
|
{
|
|
1399
3509
|
children,
|
|
@@ -1408,15 +3518,15 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1408
3518
|
};
|
|
1409
3519
|
|
|
1410
3520
|
// src/components/Input/Input.tsx
|
|
1411
|
-
import * as
|
|
3521
|
+
import * as React10 from "react";
|
|
1412
3522
|
|
|
1413
3523
|
// src/components/Label/Label.tsx
|
|
1414
|
-
import { jsx as
|
|
3524
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1415
3525
|
var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
|
|
1416
3526
|
const classes = bem("yr3Label");
|
|
1417
3527
|
const classComponent = classes(void 0, { color: `color-${color}` });
|
|
1418
3528
|
const classnames = bemMerge(classComponent, className);
|
|
1419
|
-
return /* @__PURE__ */
|
|
3529
|
+
return /* @__PURE__ */ jsx19(
|
|
1420
3530
|
"span",
|
|
1421
3531
|
{
|
|
1422
3532
|
className: classnames,
|
|
@@ -1469,7 +3579,7 @@ var inputVariants = createVariants({
|
|
|
1469
3579
|
});
|
|
1470
3580
|
|
|
1471
3581
|
// src/components/Input/Input.tsx
|
|
1472
|
-
import { jsx as
|
|
3582
|
+
import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1473
3583
|
var initiaPropsComponent = {
|
|
1474
3584
|
label: {
|
|
1475
3585
|
display: true,
|
|
@@ -1478,7 +3588,7 @@ var initiaPropsComponent = {
|
|
|
1478
3588
|
},
|
|
1479
3589
|
control: {}
|
|
1480
3590
|
};
|
|
1481
|
-
var Input =
|
|
3591
|
+
var Input = React10.forwardRef(
|
|
1482
3592
|
({
|
|
1483
3593
|
label,
|
|
1484
3594
|
value,
|
|
@@ -1487,21 +3597,27 @@ var Input = React9.forwardRef(
|
|
|
1487
3597
|
variant = "outlined",
|
|
1488
3598
|
error = "ce un errore",
|
|
1489
3599
|
separatorCurrency = ",",
|
|
3600
|
+
separatorDecimal = ".",
|
|
1490
3601
|
ui,
|
|
1491
3602
|
style,
|
|
1492
3603
|
propsComponent = initiaPropsComponent,
|
|
1493
|
-
pattern = "text",
|
|
1494
3604
|
color = "primary",
|
|
1495
3605
|
size = "auto",
|
|
1496
3606
|
disabled = false,
|
|
3607
|
+
model,
|
|
3608
|
+
pattern,
|
|
1497
3609
|
...props
|
|
1498
3610
|
}, ref) => {
|
|
1499
|
-
const [focused, setFocused] =
|
|
1500
|
-
const [internalValue, setInternalValue] =
|
|
3611
|
+
const [focused, setFocused] = React10.useState(false);
|
|
3612
|
+
const [internalValue, setInternalValue] = React10.useState(defaultValue);
|
|
1501
3613
|
const isControlled = value !== void 0;
|
|
1502
3614
|
const currentValue = isControlled ? value : internalValue;
|
|
1503
3615
|
const isActive = focused || !!currentValue;
|
|
1504
|
-
const
|
|
3616
|
+
const checkMode = (type, value2) => {
|
|
3617
|
+
if (pattern) {
|
|
3618
|
+
const regex = new RegExp(pattern);
|
|
3619
|
+
return regex.test(value2);
|
|
3620
|
+
}
|
|
1505
3621
|
switch (type) {
|
|
1506
3622
|
case "email":
|
|
1507
3623
|
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
@@ -1512,21 +3628,38 @@ var Input = React9.forwardRef(
|
|
|
1512
3628
|
case "currency":
|
|
1513
3629
|
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1514
3630
|
if (separatorCurrency === ".") return /^\d+(\.\d{0,2})?$/.test(value2);
|
|
3631
|
+
case "decimal":
|
|
3632
|
+
if (separatorDecimal === ",") return /^\d+(\,\d*)?$/.test(value2);
|
|
3633
|
+
if (separatorDecimal === ".") return /^\d+(\.\d*)?$/.test(value2);
|
|
1515
3634
|
default:
|
|
1516
3635
|
return true;
|
|
1517
3636
|
}
|
|
1518
3637
|
};
|
|
3638
|
+
const mode = (m) => {
|
|
3639
|
+
switch (m) {
|
|
3640
|
+
case "email":
|
|
3641
|
+
return "email";
|
|
3642
|
+
case "phone":
|
|
3643
|
+
return "tel";
|
|
3644
|
+
case "number":
|
|
3645
|
+
return "numeric";
|
|
3646
|
+
case "currency":
|
|
3647
|
+
return "numeric";
|
|
3648
|
+
default:
|
|
3649
|
+
return "text";
|
|
3650
|
+
}
|
|
3651
|
+
};
|
|
1519
3652
|
const handleChange = (e) => {
|
|
1520
3653
|
const newValue = e.target.value;
|
|
1521
|
-
if (newValue && !
|
|
3654
|
+
if (newValue && !checkMode(model, newValue)) return;
|
|
1522
3655
|
if (!isControlled) {
|
|
1523
3656
|
setInternalValue(newValue);
|
|
1524
3657
|
}
|
|
1525
3658
|
onChange?.(e, newValue);
|
|
1526
3659
|
};
|
|
1527
3660
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1528
|
-
return /* @__PURE__ */
|
|
1529
|
-
propsComponent?.label?.display && /* @__PURE__ */
|
|
3661
|
+
return /* @__PURE__ */ jsxs7(Control, { variant, color, label: propsComponent?.label?.display, disabled, ...propsComponent.control, children: [
|
|
3662
|
+
propsComponent?.label?.display && /* @__PURE__ */ jsx20(
|
|
1530
3663
|
Label,
|
|
1531
3664
|
{
|
|
1532
3665
|
text: label || "",
|
|
@@ -1535,14 +3668,15 @@ var Input = React9.forwardRef(
|
|
|
1535
3668
|
...propsComponent.label
|
|
1536
3669
|
}
|
|
1537
3670
|
),
|
|
1538
|
-
/* @__PURE__ */
|
|
3671
|
+
/* @__PURE__ */ jsx20(
|
|
1539
3672
|
"input",
|
|
1540
3673
|
{
|
|
1541
3674
|
ref,
|
|
1542
3675
|
value: currentValue,
|
|
1543
|
-
inputMode:
|
|
3676
|
+
inputMode: mode(model),
|
|
1544
3677
|
autoComplete: "off",
|
|
1545
|
-
type:
|
|
3678
|
+
type: props.type,
|
|
3679
|
+
pattern,
|
|
1546
3680
|
disabled,
|
|
1547
3681
|
onChange: handleChange,
|
|
1548
3682
|
onFocus: () => setFocused(true),
|
|
@@ -1558,12 +3692,12 @@ var Input = React9.forwardRef(
|
|
|
1558
3692
|
);
|
|
1559
3693
|
|
|
1560
3694
|
// src/components/Date/MonthSelector.tsx
|
|
1561
|
-
import * as
|
|
3695
|
+
import * as React11 from "react";
|
|
1562
3696
|
|
|
1563
3697
|
// src/Icons/IconSearch.tsx
|
|
1564
|
-
import { jsx as
|
|
3698
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1565
3699
|
var IconSearch = (props) => {
|
|
1566
|
-
return /* @__PURE__ */
|
|
3700
|
+
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
3701
|
"path",
|
|
1568
3702
|
{
|
|
1569
3703
|
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 +3710,21 @@ var IconSearch = (props) => {
|
|
|
1576
3710
|
};
|
|
1577
3711
|
|
|
1578
3712
|
// src/Icons/IconDown.tsx
|
|
1579
|
-
import { jsx as
|
|
3713
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1580
3714
|
var IconDown = (props) => {
|
|
1581
|
-
return /* @__PURE__ */
|
|
3715
|
+
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
3716
|
};
|
|
1583
3717
|
|
|
1584
3718
|
// src/Icons/IconCalendar.tsx
|
|
1585
|
-
import { jsx as
|
|
3719
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1586
3720
|
var IconCalendar = (props) => {
|
|
1587
|
-
return /* @__PURE__ */
|
|
3721
|
+
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
3722
|
};
|
|
1589
3723
|
|
|
1590
3724
|
// src/Icons/IconLeft.tsx
|
|
1591
|
-
import { jsx as
|
|
3725
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1592
3726
|
var IconLeft = (props) => {
|
|
1593
|
-
return /* @__PURE__ */
|
|
3727
|
+
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
3728
|
};
|
|
1595
3729
|
|
|
1596
3730
|
// src/components/Date/month.variants.ts
|
|
@@ -1647,9 +3781,9 @@ var monthSelectorContainerVariants = createVariants({
|
|
|
1647
3781
|
});
|
|
1648
3782
|
|
|
1649
3783
|
// src/Icons/IconRight.tsx
|
|
1650
|
-
import { jsx as
|
|
3784
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1651
3785
|
var IconRight = (props) => {
|
|
1652
|
-
return /* @__PURE__ */
|
|
3786
|
+
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
3787
|
"path",
|
|
1654
3788
|
{
|
|
1655
3789
|
d: "M9 7L14 12L9 17",
|
|
@@ -1662,12 +3796,14 @@ var IconRight = (props) => {
|
|
|
1662
3796
|
};
|
|
1663
3797
|
|
|
1664
3798
|
// src/components/Date/MonthSelector.tsx
|
|
1665
|
-
import { jsx as
|
|
3799
|
+
import { jsx as jsx26, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1666
3800
|
var initialPropsComponent3 = {
|
|
1667
3801
|
control: {
|
|
1668
3802
|
variant: "outlined",
|
|
1669
3803
|
color: "primary",
|
|
1670
|
-
ui: {
|
|
3804
|
+
ui: {
|
|
3805
|
+
pointerEvents: "none"
|
|
3806
|
+
},
|
|
1671
3807
|
style: {}
|
|
1672
3808
|
},
|
|
1673
3809
|
label: {
|
|
@@ -1702,18 +3838,19 @@ var initialPropsComponent3 = {
|
|
|
1702
3838
|
style: {}
|
|
1703
3839
|
}
|
|
1704
3840
|
};
|
|
1705
|
-
var MonthSelector = ({ label, value, disabled, propsComponent, data,
|
|
1706
|
-
const [open, setOpen] =
|
|
1707
|
-
const [valueState, setValueState] =
|
|
1708
|
-
const [yearSelected, setYearSelected] =
|
|
1709
|
-
const ref =
|
|
3841
|
+
var MonthSelector = ({ label, value, disabled, propsComponent, data, format, onNext, onLast, onChange }) => {
|
|
3842
|
+
const [open, setOpen] = React11.useState(false);
|
|
3843
|
+
const [valueState, setValueState] = React11.useState(value || null);
|
|
3844
|
+
const [yearSelected, setYearSelected] = React11.useState(data?.years.findIndex((y) => y === data.year) || 0);
|
|
3845
|
+
const ref = React11.useRef(null);
|
|
1710
3846
|
useClickAway(ref, () => setOpen(false));
|
|
1711
|
-
const properties =
|
|
3847
|
+
const properties = mergeDeep2(initialPropsComponent3, propsComponent || {});
|
|
1712
3848
|
const iconClasses = monthSelectorIconVariants({ color: properties?.icon?.color });
|
|
1713
3849
|
const containerClasses = monthSelectorContainerVariants({ color: properties?.container?.color });
|
|
1714
|
-
const getData =
|
|
1715
|
-
|
|
1716
|
-
|
|
3850
|
+
const getData = React11.useMemo(() => {
|
|
3851
|
+
const resolve = getMonthCalendarProps({ year: data.years[yearSelected], data, format, value: valueState });
|
|
3852
|
+
return resolve;
|
|
3853
|
+
}, [yearSelected, data, format, valueState]);
|
|
1717
3854
|
const handleYearChange = (newIndex) => {
|
|
1718
3855
|
setYearSelected(newIndex);
|
|
1719
3856
|
};
|
|
@@ -1721,23 +3858,17 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1721
3858
|
const newValue = `${month}-${data.years[yearSelected]}`;
|
|
1722
3859
|
setValueState(newValue);
|
|
1723
3860
|
onChange(newValue);
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
daysFormat,
|
|
1728
|
-
value: newValue
|
|
1729
|
-
});
|
|
1730
|
-
onNext?.(nextData.prev);
|
|
1731
|
-
onLast?.(nextData.last);
|
|
3861
|
+
onNext?.(findMonth(newValue, data.years, data.exclude, "next"));
|
|
3862
|
+
onLast?.(findMonth(newValue, data.years, data.exclude, "prev"));
|
|
3863
|
+
setOpen(false);
|
|
1732
3864
|
};
|
|
1733
3865
|
const classes = monthSelectorVariants({ wrapper: true, disabled });
|
|
1734
|
-
return /* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
3866
|
+
return /* @__PURE__ */ jsxs8("div", { className: classes, ref, children: [
|
|
3867
|
+
/* @__PURE__ */ jsx26(
|
|
1736
3868
|
Input,
|
|
1737
3869
|
{
|
|
1738
3870
|
label,
|
|
1739
3871
|
variant: "base",
|
|
1740
|
-
disabled: true,
|
|
1741
3872
|
value: valueState || "",
|
|
1742
3873
|
propsComponent: {
|
|
1743
3874
|
control: properties?.control,
|
|
@@ -1745,14 +3876,14 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1745
3876
|
}
|
|
1746
3877
|
}
|
|
1747
3878
|
),
|
|
1748
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ jsx26(
|
|
1749
3880
|
"div",
|
|
1750
3881
|
{
|
|
1751
3882
|
className: iconClasses,
|
|
1752
3883
|
style: properties?.icon?.style,
|
|
1753
3884
|
onClick: () => !disabled && setOpen(true),
|
|
1754
3885
|
"data-testid": "yr3MonthSelector--icon",
|
|
1755
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */
|
|
3886
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ jsx26(
|
|
1756
3887
|
IconCalendar,
|
|
1757
3888
|
{
|
|
1758
3889
|
width: properties?.icon?.svg?.width,
|
|
@@ -1763,57 +3894,55 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1763
3894
|
)
|
|
1764
3895
|
}
|
|
1765
3896
|
),
|
|
1766
|
-
open && /* @__PURE__ */
|
|
3897
|
+
open && /* @__PURE__ */ jsx26(
|
|
1767
3898
|
"div",
|
|
1768
3899
|
{
|
|
1769
3900
|
className: "yr3MonthSelector--wrapper",
|
|
1770
3901
|
style: composeStyles(properties?.wrapper?.ui, properties?.wrapper?.style),
|
|
1771
3902
|
"data-testid": "yr3MonthSelector--wrapper",
|
|
1772
|
-
children: /* @__PURE__ */
|
|
1773
|
-
/* @__PURE__ */
|
|
3903
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "yr3MonthSelector--component", children: [
|
|
3904
|
+
/* @__PURE__ */ jsxs8(
|
|
1774
3905
|
"div",
|
|
1775
3906
|
{
|
|
1776
3907
|
className: containerClasses,
|
|
1777
3908
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1778
3909
|
children: [
|
|
1779
|
-
/* @__PURE__ */
|
|
3910
|
+
/* @__PURE__ */ jsx26(
|
|
1780
3911
|
"button",
|
|
1781
3912
|
{
|
|
1782
3913
|
disabled: disabled || yearSelected === 0,
|
|
1783
3914
|
type: "button",
|
|
1784
3915
|
className: `yr3MonthSelector--year-button-back ${yearSelected === 0 ? "yr3MonthSelector--year-button-back--disabled" : ""} `,
|
|
1785
3916
|
onClick: () => handleYearChange(yearSelected - 1),
|
|
1786
|
-
children: /* @__PURE__ */
|
|
3917
|
+
children: /* @__PURE__ */ jsx26(IconLeft, { width: 20, height: 20, stroke: "currentColor" })
|
|
1787
3918
|
}
|
|
1788
3919
|
),
|
|
1789
|
-
/* @__PURE__ */
|
|
3920
|
+
/* @__PURE__ */ jsx26("div", { className: `yr3MonthSelector--year-option`, children: /* @__PURE__ */ jsxs8(Text, { variant: "body1", color: "primary", children: [
|
|
1790
3921
|
data.years[yearSelected],
|
|
1791
3922
|
" "
|
|
1792
3923
|
] }) }),
|
|
1793
|
-
/* @__PURE__ */
|
|
3924
|
+
/* @__PURE__ */ jsx26(
|
|
1794
3925
|
"button",
|
|
1795
3926
|
{
|
|
1796
3927
|
disabled: disabled || yearSelected === data.years.length - 1,
|
|
1797
3928
|
type: "button",
|
|
1798
3929
|
className: `yr3MonthSelector--year-button-next ${yearSelected === data.years.length - 1 ? "yr3MonthSelector--year-button-next--disabled" : ""}`,
|
|
1799
3930
|
onClick: () => handleYearChange(yearSelected + 1),
|
|
1800
|
-
children: /* @__PURE__ */
|
|
3931
|
+
children: /* @__PURE__ */ jsx26(IconRight, { width: 20, height: 30, stroke: "currentColor" })
|
|
1801
3932
|
}
|
|
1802
3933
|
)
|
|
1803
3934
|
]
|
|
1804
3935
|
}
|
|
1805
3936
|
),
|
|
1806
|
-
/* @__PURE__ */
|
|
3937
|
+
/* @__PURE__ */ jsx26("div", { className: "yr3MonthSelector--months", children: getData.months.map((m) => /* @__PURE__ */ jsx26(
|
|
1807
3938
|
"button",
|
|
1808
3939
|
{
|
|
1809
3940
|
type: "button",
|
|
1810
3941
|
style: properties?.text?.button,
|
|
1811
3942
|
disabled: m.disabled,
|
|
1812
3943
|
className: `yr3MonthSelector--month ${m.disabled ? "yr3MonthSelector--month--disabled" : ""} ${m.selected ? "yr3MonthSelector--month--selected" : ""}`,
|
|
1813
|
-
onClick: () =>
|
|
1814
|
-
|
|
1815
|
-
},
|
|
1816
|
-
children: /* @__PURE__ */ jsx24(Text, { ...properties?.text, weight: m.disabled ? "thin" : "medium", children: m.label })
|
|
3944
|
+
onClick: () => handleMonthChange(m.value),
|
|
3945
|
+
children: /* @__PURE__ */ jsx26(Text, { ...properties?.text, weight: m.disabled ? "thin" : "medium", children: m.label })
|
|
1817
3946
|
},
|
|
1818
3947
|
"month-" + m.value
|
|
1819
3948
|
)) })
|
|
@@ -1824,8 +3953,8 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1824
3953
|
};
|
|
1825
3954
|
|
|
1826
3955
|
// src/components/Fade/Fade.tsx
|
|
1827
|
-
import * as
|
|
1828
|
-
import { jsx as
|
|
3956
|
+
import * as React12 from "react";
|
|
3957
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1829
3958
|
var Fade = ({
|
|
1830
3959
|
in: inProp,
|
|
1831
3960
|
children,
|
|
@@ -1833,7 +3962,7 @@ var Fade = ({
|
|
|
1833
3962
|
onTransitionEnd,
|
|
1834
3963
|
style
|
|
1835
3964
|
}) => {
|
|
1836
|
-
|
|
3965
|
+
React12.useEffect(() => {
|
|
1837
3966
|
let timeoutId;
|
|
1838
3967
|
if (inProp) {
|
|
1839
3968
|
timeoutId = setTimeout(() => {
|
|
@@ -1842,7 +3971,7 @@ var Fade = ({
|
|
|
1842
3971
|
}
|
|
1843
3972
|
return () => clearTimeout(timeoutId);
|
|
1844
3973
|
}, [inProp, duration, onTransitionEnd]);
|
|
1845
|
-
return /* @__PURE__ */
|
|
3974
|
+
return /* @__PURE__ */ jsx27(
|
|
1846
3975
|
"div",
|
|
1847
3976
|
{
|
|
1848
3977
|
className: `yr3Fade ${inProp ? "yr3Fade--in" : ""}`,
|
|
@@ -1853,61 +3982,8 @@ var Fade = ({
|
|
|
1853
3982
|
);
|
|
1854
3983
|
};
|
|
1855
3984
|
|
|
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
3985
|
// src/components/Grid/Grid.tsx
|
|
1910
|
-
import { jsx as
|
|
3986
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1911
3987
|
var Grid = ({
|
|
1912
3988
|
container = false,
|
|
1913
3989
|
spacing: spacing2 = 0,
|
|
@@ -1940,7 +4016,7 @@ var Grid = ({
|
|
|
1940
4016
|
}
|
|
1941
4017
|
const classes = bem("yr3Grid");
|
|
1942
4018
|
const className = classes(void 0, { container, [`spacing-${spacing2}`]: center, span: item && `Col-${size}` });
|
|
1943
|
-
return /* @__PURE__ */
|
|
4019
|
+
return /* @__PURE__ */ jsx28(
|
|
1944
4020
|
"div",
|
|
1945
4021
|
{
|
|
1946
4022
|
className,
|
|
@@ -1953,7 +4029,7 @@ var Grid = ({
|
|
|
1953
4029
|
};
|
|
1954
4030
|
|
|
1955
4031
|
// src/components/Group/Group.tsx
|
|
1956
|
-
import * as
|
|
4032
|
+
import * as React13 from "react";
|
|
1957
4033
|
|
|
1958
4034
|
// src/components/Group/group.variants.ts
|
|
1959
4035
|
var groupVariants = createVariants({
|
|
@@ -1984,8 +4060,8 @@ var groupVariants = createVariants({
|
|
|
1984
4060
|
});
|
|
1985
4061
|
|
|
1986
4062
|
// src/components/Group/Group.tsx
|
|
1987
|
-
import { jsx as
|
|
1988
|
-
var
|
|
4063
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4064
|
+
var initialComponents2 = (color) => ({
|
|
1989
4065
|
group: {
|
|
1990
4066
|
ui: {},
|
|
1991
4067
|
style: {}
|
|
@@ -2013,13 +4089,13 @@ var Group = ({
|
|
|
2013
4089
|
exclude = false,
|
|
2014
4090
|
propsComponent
|
|
2015
4091
|
}) => {
|
|
2016
|
-
const properties =
|
|
2017
|
-
|
|
4092
|
+
const properties = mergeDeep2(
|
|
4093
|
+
initialComponents2(type === "rounded" ? "text" : color),
|
|
2018
4094
|
propsComponent || {}
|
|
2019
4095
|
);
|
|
2020
|
-
const [internalValue, setInternalValue] =
|
|
4096
|
+
const [internalValue, setInternalValue] = React13.useState(null);
|
|
2021
4097
|
const isControlled = value !== void 0;
|
|
2022
|
-
|
|
4098
|
+
React13.useEffect(() => {
|
|
2023
4099
|
if (isControlled) {
|
|
2024
4100
|
setInternalValue(value);
|
|
2025
4101
|
}
|
|
@@ -2030,7 +4106,7 @@ var Group = ({
|
|
|
2030
4106
|
active: !exclude ? Array.isArray(value) ? value.includes(item?.value) : internalValue === item.value : false,
|
|
2031
4107
|
exclude: exclude && Array.isArray(value) ? !value.includes(item?.value) : ""
|
|
2032
4108
|
});
|
|
2033
|
-
const mappingStyle =
|
|
4109
|
+
const mappingStyle = React13.useMemo(() => {
|
|
2034
4110
|
if (variant !== "filled") return options.map((opt, index) => ({
|
|
2035
4111
|
...opt,
|
|
2036
4112
|
index,
|
|
@@ -2061,13 +4137,13 @@ var Group = ({
|
|
|
2061
4137
|
}
|
|
2062
4138
|
}));
|
|
2063
4139
|
}, [exclude, value, options, type]);
|
|
2064
|
-
return /* @__PURE__ */
|
|
4140
|
+
return /* @__PURE__ */ jsx29(
|
|
2065
4141
|
"div",
|
|
2066
4142
|
{
|
|
2067
4143
|
className: groupVariants({ variant, color, type }),
|
|
2068
4144
|
"data-testid": "yr3Group",
|
|
2069
4145
|
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
2070
|
-
children: options.map((opt, index) => /* @__PURE__ */
|
|
4146
|
+
children: options.map((opt, index) => /* @__PURE__ */ jsx29(
|
|
2071
4147
|
"div",
|
|
2072
4148
|
{
|
|
2073
4149
|
"data-testid": "yr3Group-item",
|
|
@@ -2085,7 +4161,7 @@ var Group = ({
|
|
|
2085
4161
|
...mappingStyle?.find((o) => o.value === opt.value)?.style
|
|
2086
4162
|
}
|
|
2087
4163
|
),
|
|
2088
|
-
children: /* @__PURE__ */
|
|
4164
|
+
children: /* @__PURE__ */ jsx29(
|
|
2089
4165
|
Text,
|
|
2090
4166
|
{
|
|
2091
4167
|
...properties.item?.text,
|
|
@@ -2101,14 +4177,14 @@ var Group = ({
|
|
|
2101
4177
|
};
|
|
2102
4178
|
|
|
2103
4179
|
// src/components/Image/Image.tsx
|
|
2104
|
-
import { jsx as
|
|
4180
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2105
4181
|
var Image = ({
|
|
2106
4182
|
src,
|
|
2107
4183
|
alt = "",
|
|
2108
4184
|
ui,
|
|
2109
4185
|
style
|
|
2110
4186
|
}) => {
|
|
2111
|
-
return /* @__PURE__ */
|
|
4187
|
+
return /* @__PURE__ */ jsx30(
|
|
2112
4188
|
"img",
|
|
2113
4189
|
{
|
|
2114
4190
|
src,
|
|
@@ -2121,8 +4197,8 @@ var Image = ({
|
|
|
2121
4197
|
};
|
|
2122
4198
|
|
|
2123
4199
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
2124
|
-
import * as
|
|
2125
|
-
import { jsx as
|
|
4200
|
+
import * as React14 from "react";
|
|
4201
|
+
import { jsx as jsx31, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2126
4202
|
var initialPropsComponent4 = {
|
|
2127
4203
|
box: {},
|
|
2128
4204
|
text: {},
|
|
@@ -2131,10 +4207,10 @@ var initialPropsComponent4 = {
|
|
|
2131
4207
|
content: {}
|
|
2132
4208
|
};
|
|
2133
4209
|
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
2134
|
-
const properties =
|
|
2135
|
-
const [dragging, setDragging] =
|
|
2136
|
-
const [files, setFiles] =
|
|
2137
|
-
const inputRef =
|
|
4210
|
+
const properties = mergeDeep2(initialPropsComponent4, propsComponent || {});
|
|
4211
|
+
const [dragging, setDragging] = React14.useState(false);
|
|
4212
|
+
const [files, setFiles] = React14.useState([]);
|
|
4213
|
+
const inputRef = React14.useRef(null);
|
|
2138
4214
|
const handleFiles = (fileList) => {
|
|
2139
4215
|
if (!fileList) return;
|
|
2140
4216
|
const newFiles = Array.from(fileList);
|
|
@@ -2146,7 +4222,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2146
4222
|
};
|
|
2147
4223
|
const classes = bem("yr3Dropzone");
|
|
2148
4224
|
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
2149
|
-
return /* @__PURE__ */
|
|
4225
|
+
return /* @__PURE__ */ jsx31(Box, { as: "div", position: "relative", content: "center", ...properties?.box, children: /* @__PURE__ */ jsxs9(
|
|
2150
4226
|
"div",
|
|
2151
4227
|
{
|
|
2152
4228
|
className: classComponent,
|
|
@@ -2163,7 +4239,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2163
4239
|
onClick: () => inputRef.current?.click(),
|
|
2164
4240
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
2165
4241
|
children: [
|
|
2166
|
-
/* @__PURE__ */
|
|
4242
|
+
/* @__PURE__ */ jsx31(
|
|
2167
4243
|
"input",
|
|
2168
4244
|
{
|
|
2169
4245
|
ref: inputRef,
|
|
@@ -2174,10 +4250,10 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2174
4250
|
onChange: (e) => handleFiles(e.target.files)
|
|
2175
4251
|
}
|
|
2176
4252
|
),
|
|
2177
|
-
isEmpty(files) && /* @__PURE__ */
|
|
2178
|
-
multiple && /* @__PURE__ */
|
|
2179
|
-
!multiple && /* @__PURE__ */
|
|
2180
|
-
!!defaultImage && /* @__PURE__ */
|
|
4253
|
+
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" }) }),
|
|
4254
|
+
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)) }),
|
|
4255
|
+
!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)) }),
|
|
4256
|
+
!!defaultImage && /* @__PURE__ */ jsx31("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: /* @__PURE__ */ jsx31("img", { src: defaultImage }) }),
|
|
2181
4257
|
component
|
|
2182
4258
|
]
|
|
2183
4259
|
}
|
|
@@ -2185,7 +4261,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2185
4261
|
};
|
|
2186
4262
|
|
|
2187
4263
|
// src/components/InputArea/InputArea.tsx
|
|
2188
|
-
import * as
|
|
4264
|
+
import * as React15 from "react";
|
|
2189
4265
|
|
|
2190
4266
|
// src/components/InputArea/inputAreaVariants.ts
|
|
2191
4267
|
var inputAreaVariants = createVariants({
|
|
@@ -2226,7 +4302,7 @@ var inputAreaVariants = createVariants({
|
|
|
2226
4302
|
});
|
|
2227
4303
|
|
|
2228
4304
|
// src/components/InputArea/InputArea.tsx
|
|
2229
|
-
import { jsx as
|
|
4305
|
+
import { jsx as jsx32, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2230
4306
|
var initiaPropsComponent2 = {
|
|
2231
4307
|
label: {
|
|
2232
4308
|
display: true,
|
|
@@ -2251,8 +4327,8 @@ var InputArea = ({
|
|
|
2251
4327
|
rounded = false,
|
|
2252
4328
|
propsComponent = initiaPropsComponent2
|
|
2253
4329
|
}) => {
|
|
2254
|
-
const ref =
|
|
2255
|
-
const [internalValue, setInternalValue] =
|
|
4330
|
+
const ref = React15.useRef(null);
|
|
4331
|
+
const [internalValue, setInternalValue] = React15.useState(defaultValue);
|
|
2256
4332
|
const isControlled = value !== void 0;
|
|
2257
4333
|
const currentValue = isControlled ? value : internalValue;
|
|
2258
4334
|
const handleChange = (e) => {
|
|
@@ -2269,8 +4345,8 @@ var InputArea = ({
|
|
|
2269
4345
|
el.style.resize = resize;
|
|
2270
4346
|
}
|
|
2271
4347
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
2272
|
-
return /* @__PURE__ */
|
|
2273
|
-
propsComponent?.label?.display && /* @__PURE__ */
|
|
4348
|
+
return /* @__PURE__ */ jsxs10("div", { style: { position: "relative" }, children: [
|
|
4349
|
+
propsComponent?.label?.display && /* @__PURE__ */ jsx32(
|
|
2274
4350
|
Label,
|
|
2275
4351
|
{
|
|
2276
4352
|
text: label || "",
|
|
@@ -2278,7 +4354,7 @@ var InputArea = ({
|
|
|
2278
4354
|
...propsComponent.label
|
|
2279
4355
|
}
|
|
2280
4356
|
),
|
|
2281
|
-
/* @__PURE__ */
|
|
4357
|
+
/* @__PURE__ */ jsx32(
|
|
2282
4358
|
"textarea",
|
|
2283
4359
|
{
|
|
2284
4360
|
className: classes,
|
|
@@ -2290,76 +4366,10 @@ var InputArea = ({
|
|
|
2290
4366
|
"data-testid": "yr3InputArea"
|
|
2291
4367
|
}
|
|
2292
4368
|
),
|
|
2293
|
-
/* @__PURE__ */
|
|
4369
|
+
/* @__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
4370
|
] });
|
|
2295
4371
|
};
|
|
2296
4372
|
|
|
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
4373
|
// src/components/Modal/Modal.tsx
|
|
2364
4374
|
import * as React16 from "react";
|
|
2365
4375
|
|
|
@@ -2585,7 +4595,7 @@ var Picker = ({ label, variant, color, children, name, value, onChange, propsCom
|
|
|
2585
4595
|
const [valueState, setValueState] = React17.useState(value || null);
|
|
2586
4596
|
const ref = React17.useRef(null);
|
|
2587
4597
|
useClickAway(ref, () => setOpen(false));
|
|
2588
|
-
const properties =
|
|
4598
|
+
const properties = mergeDeep2(initiaPropsComponent3, propsComponent || {});
|
|
2589
4599
|
const classesIcon = PickerIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2590
4600
|
const classes = PickerVariants({ wrapper: true, variant, color });
|
|
2591
4601
|
React17.useEffect(() => {
|
|
@@ -2826,7 +4836,7 @@ var PlacesAutocomplete = ({
|
|
|
2826
4836
|
keyApi,
|
|
2827
4837
|
propsComponent = initPropsComponent
|
|
2828
4838
|
}) => {
|
|
2829
|
-
const [value,
|
|
4839
|
+
const [value, setValue2] = React20.useState(null);
|
|
2830
4840
|
const inputRef = React20.useRef(null);
|
|
2831
4841
|
const [anchorEl, setAnchorEl] = React20.useState(null);
|
|
2832
4842
|
const { suggestions, selectPlace } = useAutocompletePlaces({ input: value, apiKey: keyApi, language, provider });
|
|
@@ -2845,12 +4855,12 @@ var PlacesAutocomplete = ({
|
|
|
2845
4855
|
placeId: id
|
|
2846
4856
|
};
|
|
2847
4857
|
onSelect(locationData);
|
|
2848
|
-
|
|
4858
|
+
setValue2(place.address);
|
|
2849
4859
|
setAnchorEl(null);
|
|
2850
4860
|
};
|
|
2851
4861
|
React20.useEffect(() => {
|
|
2852
4862
|
if (defaultLocation) {
|
|
2853
|
-
|
|
4863
|
+
setValue2(defaultLocation);
|
|
2854
4864
|
}
|
|
2855
4865
|
}, [defaultLocation]);
|
|
2856
4866
|
React20.useEffect(() => {
|
|
@@ -2859,7 +4869,7 @@ var PlacesAutocomplete = ({
|
|
|
2859
4869
|
}
|
|
2860
4870
|
}, [value]);
|
|
2861
4871
|
const handleChange = (e) => {
|
|
2862
|
-
|
|
4872
|
+
setValue2(e.target.value);
|
|
2863
4873
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2864
4874
|
};
|
|
2865
4875
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
@@ -3056,12 +5066,12 @@ var initiaPropsComponent4 = {
|
|
|
3056
5066
|
component: void 0
|
|
3057
5067
|
}
|
|
3058
5068
|
};
|
|
3059
|
-
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled }) => {
|
|
5069
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled = false }) => {
|
|
3060
5070
|
const [open, setOpen] = React21.useState(false);
|
|
3061
5071
|
const [valueState, setValueState] = React21.useState(value || defaultValue || null);
|
|
3062
5072
|
const ref = React21.useRef(null);
|
|
3063
5073
|
useClickAway(ref, () => setOpen(false));
|
|
3064
|
-
const properties =
|
|
5074
|
+
const properties = mergeDeep2(initiaPropsComponent4, propsComponent || {});
|
|
3065
5075
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
3066
5076
|
const classes = selectVariants({ wrapper: true, disabled });
|
|
3067
5077
|
return /* @__PURE__ */ jsxs18("div", { className: classes, ref, children: [
|
|
@@ -3070,10 +5080,15 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
3070
5080
|
{
|
|
3071
5081
|
label,
|
|
3072
5082
|
variant: "base",
|
|
3073
|
-
disabled: true,
|
|
3074
5083
|
value: options.find((opt) => opt.value === valueState)?.label || "",
|
|
3075
5084
|
propsComponent: {
|
|
3076
|
-
control:
|
|
5085
|
+
control: {
|
|
5086
|
+
...properties?.control,
|
|
5087
|
+
ui: {
|
|
5088
|
+
...properties?.control?.ui,
|
|
5089
|
+
pointerEvents: "none"
|
|
5090
|
+
}
|
|
5091
|
+
},
|
|
3077
5092
|
label: properties?.label
|
|
3078
5093
|
}
|
|
3079
5094
|
}
|
|
@@ -3178,7 +5193,7 @@ var Slide = ({
|
|
|
3178
5193
|
onTransitionEnd,
|
|
3179
5194
|
propsComponent
|
|
3180
5195
|
}) => {
|
|
3181
|
-
const properties =
|
|
5196
|
+
const properties = mergeDeep2(initialPropsComponent5, propsComponent || {});
|
|
3182
5197
|
const stateRef = React22.useRef(inProp ? "in" : "out");
|
|
3183
5198
|
React22.useEffect(() => {
|
|
3184
5199
|
stateRef.current = inProp ? "in" : "out";
|
|
@@ -3381,17 +5396,17 @@ function useMediaQuery(query) {
|
|
|
3381
5396
|
}, [computedQuery]);
|
|
3382
5397
|
return matches;
|
|
3383
5398
|
}
|
|
3384
|
-
function useBreakpointValue(
|
|
5399
|
+
function useBreakpointValue(values2) {
|
|
3385
5400
|
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
3386
5401
|
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
3387
5402
|
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
3388
5403
|
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
3389
5404
|
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
3390
|
-
if (xl &&
|
|
3391
|
-
if (lg &&
|
|
3392
|
-
if (md &&
|
|
3393
|
-
if (sm &&
|
|
3394
|
-
if (xs &&
|
|
5405
|
+
if (xl && values2.xl !== void 0) return values2.xl;
|
|
5406
|
+
if (lg && values2.lg !== void 0) return values2.lg;
|
|
5407
|
+
if (md && values2.md !== void 0) return values2.md;
|
|
5408
|
+
if (sm && values2.sm !== void 0) return values2.sm;
|
|
5409
|
+
if (xs && values2.xs !== void 0) return values2.xs;
|
|
3395
5410
|
return void 0;
|
|
3396
5411
|
}
|
|
3397
5412
|
|
|
@@ -3506,6 +5521,9 @@ export {
|
|
|
3506
5521
|
createVariants,
|
|
3507
5522
|
cx,
|
|
3508
5523
|
darken,
|
|
5524
|
+
date,
|
|
5525
|
+
dtx,
|
|
5526
|
+
findMonth,
|
|
3509
5527
|
getContrast,
|
|
3510
5528
|
getCountryCodePhone,
|
|
3511
5529
|
getDialPhone,
|
|
@@ -3515,13 +5533,12 @@ export {
|
|
|
3515
5533
|
hexToRgb,
|
|
3516
5534
|
initTheme,
|
|
3517
5535
|
inputCurrency,
|
|
3518
|
-
isEmpty,
|
|
3519
5536
|
lighten,
|
|
3520
|
-
mergeDeep,
|
|
5537
|
+
mergeDeep2 as mergeDeep,
|
|
5538
|
+
mergeInitialProps,
|
|
3521
5539
|
normalizePhone,
|
|
3522
|
-
rgbToHex,
|
|
5540
|
+
rgbToHex2 as rgbToHex,
|
|
3523
5541
|
text,
|
|
3524
|
-
times,
|
|
3525
5542
|
uiStyle,
|
|
3526
5543
|
useBackdrop,
|
|
3527
5544
|
useBreakpoint,
|
|
@@ -3531,5 +5548,6 @@ export {
|
|
|
3531
5548
|
useMediaQuery,
|
|
3532
5549
|
useNotistack,
|
|
3533
5550
|
usePlaces,
|
|
3534
|
-
useTheme
|
|
5551
|
+
useTheme,
|
|
5552
|
+
utils
|
|
3535
5553
|
};
|