@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.cjs
CHANGED
|
@@ -93,6 +93,9 @@ __export(index_exports, {
|
|
|
93
93
|
createVariants: () => createVariants,
|
|
94
94
|
cx: () => cx,
|
|
95
95
|
darken: () => darken,
|
|
96
|
+
date: () => date,
|
|
97
|
+
dtx: () => dtx,
|
|
98
|
+
findMonth: () => findMonth,
|
|
96
99
|
getContrast: () => getContrast,
|
|
97
100
|
getCountryCodePhone: () => getCountryCodePhone,
|
|
98
101
|
getDialPhone: () => getDialPhone,
|
|
@@ -102,13 +105,12 @@ __export(index_exports, {
|
|
|
102
105
|
hexToRgb: () => hexToRgb,
|
|
103
106
|
initTheme: () => initTheme,
|
|
104
107
|
inputCurrency: () => inputCurrency,
|
|
105
|
-
isEmpty: () => isEmpty,
|
|
106
108
|
lighten: () => lighten,
|
|
107
|
-
mergeDeep: () =>
|
|
109
|
+
mergeDeep: () => mergeDeep2,
|
|
110
|
+
mergeInitialProps: () => mergeInitialProps,
|
|
108
111
|
normalizePhone: () => normalizePhone,
|
|
109
|
-
rgbToHex: () =>
|
|
112
|
+
rgbToHex: () => rgbToHex2,
|
|
110
113
|
text: () => text,
|
|
111
|
-
times: () => times,
|
|
112
114
|
uiStyle: () => uiStyle,
|
|
113
115
|
useBackdrop: () => useBackdrop,
|
|
114
116
|
useBreakpoint: () => useBreakpoint,
|
|
@@ -118,84 +120,1986 @@ __export(index_exports, {
|
|
|
118
120
|
useMediaQuery: () => useMediaQuery,
|
|
119
121
|
useNotistack: () => useNotistack,
|
|
120
122
|
usePlaces: () => usePlaces,
|
|
121
|
-
useTheme: () => useTheme
|
|
123
|
+
useTheme: () => useTheme,
|
|
124
|
+
utils: () => utils
|
|
122
125
|
});
|
|
123
126
|
module.exports = __toCommonJS(index_exports);
|
|
124
127
|
|
|
125
|
-
// src/utils/bem.ts
|
|
126
|
-
var bem = (block) => {
|
|
127
|
-
return (element, modifiers) => {
|
|
128
|
-
const base = element ? `${block}__${element}` : block;
|
|
129
|
-
const classes = [base];
|
|
130
|
-
if (modifiers) {
|
|
131
|
-
Object.entries(modifiers).forEach(([key, value]) => {
|
|
132
|
-
if (!value) return;
|
|
133
|
-
if (typeof value === "boolean") {
|
|
134
|
-
classes.push(`${base}--${key}`);
|
|
135
|
-
} else {
|
|
136
|
-
classes.push(`${base}--${value}`);
|
|
128
|
+
// src/utils/bem.ts
|
|
129
|
+
var bem = (block) => {
|
|
130
|
+
return (element, modifiers) => {
|
|
131
|
+
const base = element ? `${block}__${element}` : block;
|
|
132
|
+
const classes = [base];
|
|
133
|
+
if (modifiers) {
|
|
134
|
+
Object.entries(modifiers).forEach(([key, value]) => {
|
|
135
|
+
if (!value) return;
|
|
136
|
+
if (typeof value === "boolean") {
|
|
137
|
+
classes.push(`${base}--${key}`);
|
|
138
|
+
} else {
|
|
139
|
+
classes.push(`${base}--${value}`);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return classes.join(" ");
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
var bemMerge = (...args) => {
|
|
147
|
+
return args.flatMap((arg) => {
|
|
148
|
+
if (!arg) return [];
|
|
149
|
+
if (typeof arg === "string") return [arg];
|
|
150
|
+
if (typeof arg === "object") {
|
|
151
|
+
return Object.entries(arg).filter(([_, v]) => v).map(([k]) => k);
|
|
152
|
+
}
|
|
153
|
+
return [];
|
|
154
|
+
}).join(" ");
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// src/utils/common.ts
|
|
158
|
+
var common_exports = {};
|
|
159
|
+
__export(common_exports, {
|
|
160
|
+
assign: () => assign,
|
|
161
|
+
blendColors: () => blendColors,
|
|
162
|
+
camelCase: () => camelCase,
|
|
163
|
+
capitalize: () => capitalize,
|
|
164
|
+
capitalizeWords: () => capitalizeWords,
|
|
165
|
+
ceil: () => ceil,
|
|
166
|
+
chunk: () => chunk,
|
|
167
|
+
clamp: () => clamp,
|
|
168
|
+
clampNumber: () => clampNumber,
|
|
169
|
+
compact: () => compact,
|
|
170
|
+
concat: () => concat,
|
|
171
|
+
countBy: () => countBy,
|
|
172
|
+
darkenColor: () => darkenColor,
|
|
173
|
+
debounce: () => debounce,
|
|
174
|
+
decapitalize: () => decapitalize,
|
|
175
|
+
decapitalizeWords: () => decapitalizeWords,
|
|
176
|
+
defaults: () => defaults,
|
|
177
|
+
defaultsDeep: () => defaultsDeep,
|
|
178
|
+
desaturateColor: () => desaturateColor,
|
|
179
|
+
difference: () => difference,
|
|
180
|
+
differenceBy: () => differenceBy,
|
|
181
|
+
emToPx: () => emToPx,
|
|
182
|
+
endsWith: () => endsWith,
|
|
183
|
+
entries: () => entries,
|
|
184
|
+
escape: () => escape,
|
|
185
|
+
first: () => first,
|
|
186
|
+
flatten: () => flatten,
|
|
187
|
+
floor: () => floor,
|
|
188
|
+
fromEntries: () => fromEntries,
|
|
189
|
+
generateAnalogousPalette: () => generateAnalogousPalette,
|
|
190
|
+
generateComplementaryPalette: () => generateComplementaryPalette,
|
|
191
|
+
generateGradientColors: () => generateGradientColors,
|
|
192
|
+
generateMonochromaticPalette: () => generateMonochromaticPalette,
|
|
193
|
+
generateNanoId: () => generateNanoId,
|
|
194
|
+
generateRandomAlphaId: () => generateRandomAlphaId,
|
|
195
|
+
generateRandomAlphanumericId: () => generateRandomAlphanumericId,
|
|
196
|
+
generateRandomApiKey: () => generateRandomApiKey,
|
|
197
|
+
generateRandomBase64Id: () => generateRandomBase64Id,
|
|
198
|
+
generateRandomColor: () => generateRandomColor,
|
|
199
|
+
generateRandomColorPalette: () => generateRandomColorPalette,
|
|
200
|
+
generateRandomColorScheme: () => generateRandomColorScheme,
|
|
201
|
+
generateRandomCoolColor: () => generateRandomCoolColor,
|
|
202
|
+
generateRandomCoolPalette: () => generateRandomCoolPalette,
|
|
203
|
+
generateRandomDarkColor: () => generateRandomDarkColor,
|
|
204
|
+
generateRandomDarkPalette: () => generateRandomDarkPalette,
|
|
205
|
+
generateRandomDomain: () => generateRandomDomain,
|
|
206
|
+
generateRandomEarthToneColor: () => generateRandomEarthToneColor,
|
|
207
|
+
generateRandomEarthTonePalette: () => generateRandomEarthTonePalette,
|
|
208
|
+
generateRandomEmail: () => generateRandomEmail,
|
|
209
|
+
generateRandomGradient: () => generateRandomGradient,
|
|
210
|
+
generateRandomHSLColor: () => generateRandomHSLColor,
|
|
211
|
+
generateRandomHexColor: () => generateRandomHexColor,
|
|
212
|
+
generateRandomHexId: () => generateRandomHexId,
|
|
213
|
+
generateRandomLightColor: () => generateRandomLightColor,
|
|
214
|
+
generateRandomLightPalette: () => generateRandomLightPalette,
|
|
215
|
+
generateRandomMetallicColor: () => generateRandomMetallicColor,
|
|
216
|
+
generateRandomMetallicPalette: () => generateRandomMetallicPalette,
|
|
217
|
+
generateRandomMutedColor: () => generateRandomMutedColor,
|
|
218
|
+
generateRandomMutedPalette: () => generateRandomMutedPalette,
|
|
219
|
+
generateRandomNeonColor: () => generateRandomNeonColor,
|
|
220
|
+
generateRandomNeonPalette: () => generateRandomNeonPalette,
|
|
221
|
+
generateRandomNeutralColor: () => generateRandomNeutralColor,
|
|
222
|
+
generateRandomNeutralPalette: () => generateRandomNeutralPalette,
|
|
223
|
+
generateRandomNumericId: () => generateRandomNumericId,
|
|
224
|
+
generateRandomPassword: () => generateRandomPassword,
|
|
225
|
+
generateRandomPastelColor: () => generateRandomPastelColor,
|
|
226
|
+
generateRandomPastelPalette: () => generateRandomPastelPalette,
|
|
227
|
+
generateRandomRGBColor: () => generateRandomRGBColor,
|
|
228
|
+
generateRandomSessionId: () => generateRandomSessionId,
|
|
229
|
+
generateRandomSlug: () => generateRandomSlug,
|
|
230
|
+
generateRandomString: () => generateRandomString,
|
|
231
|
+
generateRandomToken: () => generateRandomToken,
|
|
232
|
+
generateRandomUrlSafeId: () => generateRandomUrlSafeId,
|
|
233
|
+
generateRandomUsername: () => generateRandomUsername,
|
|
234
|
+
generateRandomVibrantColor: () => generateRandomVibrantColor,
|
|
235
|
+
generateRandomVibrantPalette: () => generateRandomVibrantPalette,
|
|
236
|
+
generateRandomWarmColor: () => generateRandomWarmColor,
|
|
237
|
+
generateRandomWarmPalette: () => generateRandomWarmPalette,
|
|
238
|
+
generateShortId: () => generateShortId,
|
|
239
|
+
generateTetradicPalette: () => generateTetradicPalette,
|
|
240
|
+
generateTriadicPalette: () => generateTriadicPalette,
|
|
241
|
+
generateUUID: () => generateUUID,
|
|
242
|
+
generateUniqueId: () => generateUniqueId,
|
|
243
|
+
get: () => get,
|
|
244
|
+
getContrastColor: () => getContrastColor,
|
|
245
|
+
getDeepValue: () => getDeepValue,
|
|
246
|
+
getNestedValue: () => getNestedValue,
|
|
247
|
+
getValue: () => getValue,
|
|
248
|
+
getValueByPath: () => getValueByPath,
|
|
249
|
+
groupBy: () => groupBy,
|
|
250
|
+
hasDeepKey: () => hasDeepKey,
|
|
251
|
+
hasDeepValue: () => hasDeepValue,
|
|
252
|
+
hasKey: () => hasKey,
|
|
253
|
+
hasKeyByPath: () => hasKeyByPath,
|
|
254
|
+
hasNestedKey: () => hasNestedKey,
|
|
255
|
+
hasNestedValue: () => hasNestedValue,
|
|
256
|
+
hasValue: () => hasValue,
|
|
257
|
+
hasValueByPath: () => hasValueByPath,
|
|
258
|
+
hexToHSL: () => hexToHSL,
|
|
259
|
+
hexToRGB: () => hexToRGB,
|
|
260
|
+
hslToHex: () => hslToHex,
|
|
261
|
+
hslToRGB: () => hslToRGB,
|
|
262
|
+
includes: () => includes,
|
|
263
|
+
intersection: () => intersection,
|
|
264
|
+
intersectionBy: () => intersectionBy,
|
|
265
|
+
invert: () => invert,
|
|
266
|
+
invertColor: () => invertColor,
|
|
267
|
+
isArrayValue: () => isArrayValue,
|
|
268
|
+
isBase64: () => isBase64,
|
|
269
|
+
isBigIntValue: () => isBigIntValue,
|
|
270
|
+
isBooleanValue: () => isBooleanValue,
|
|
271
|
+
isCreditCard: () => isCreditCard,
|
|
272
|
+
isDarkColor: () => isDarkColor,
|
|
273
|
+
isEmail: () => isEmail,
|
|
274
|
+
isEmpty: () => isEmpty,
|
|
275
|
+
isEmptyArray: () => isEmptyArray,
|
|
276
|
+
isEmptyObject: () => isEmptyObject,
|
|
277
|
+
isEmptyString: () => isEmptyString,
|
|
278
|
+
isEmptyValue: () => isEmptyValue,
|
|
279
|
+
isFiniteNumber: () => isFiniteNumber,
|
|
280
|
+
isFunctionValue: () => isFunctionValue,
|
|
281
|
+
isHexColor: () => isHexColor,
|
|
282
|
+
isHexadecimal: () => isHexadecimal,
|
|
283
|
+
isIPv4: () => isIPv4,
|
|
284
|
+
isIPv6: () => isIPv6,
|
|
285
|
+
isISBN: () => isISBN,
|
|
286
|
+
isInteger: () => isInteger,
|
|
287
|
+
isJSON: () => isJSON,
|
|
288
|
+
isLightColor: () => isLightColor,
|
|
289
|
+
isMACAddress: () => isMACAddress,
|
|
290
|
+
isNaNValue: () => isNaNValue,
|
|
291
|
+
isNullValue: () => isNullValue,
|
|
292
|
+
isNumberValue: () => isNumberValue,
|
|
293
|
+
isObjectValue: () => isObjectValue,
|
|
294
|
+
isPhoneNumber: () => isPhoneNumber,
|
|
295
|
+
isPostalCode: () => isPostalCode,
|
|
296
|
+
isRGBColor: () => isRGBColor,
|
|
297
|
+
isSafeInteger: () => isSafeInteger,
|
|
298
|
+
isSlug: () => isSlug,
|
|
299
|
+
isStringValue: () => isStringValue,
|
|
300
|
+
isSymbolValue: () => isSymbolValue,
|
|
301
|
+
isURL: () => isURL,
|
|
302
|
+
isUUID: () => isUUID,
|
|
303
|
+
isUndefinedValue: () => isUndefinedValue,
|
|
304
|
+
isXML: () => isXML,
|
|
305
|
+
kebabCase: () => kebabCase,
|
|
306
|
+
keys: () => keys,
|
|
307
|
+
last: () => last,
|
|
308
|
+
lightenColor: () => lightenColor,
|
|
309
|
+
map: () => map,
|
|
310
|
+
mapKeys: () => mapKeys,
|
|
311
|
+
mapValues: () => mapValues,
|
|
312
|
+
memoize: () => memoize,
|
|
313
|
+
merge: () => merge,
|
|
314
|
+
mergeDeep: () => mergeDeep,
|
|
315
|
+
mixColors: () => mixColors,
|
|
316
|
+
nth: () => nth,
|
|
317
|
+
omit: () => omit,
|
|
318
|
+
omitBy: () => omitBy,
|
|
319
|
+
omitByDeep: () => omitByDeep,
|
|
320
|
+
once: () => once,
|
|
321
|
+
padEnd: () => padEnd,
|
|
322
|
+
padStart: () => padStart,
|
|
323
|
+
parseFloatValue: () => parseFloatValue,
|
|
324
|
+
parseIntValue: () => parseIntValue,
|
|
325
|
+
partition: () => partition,
|
|
326
|
+
percentToPx: () => percentToPx,
|
|
327
|
+
pick: () => pick,
|
|
328
|
+
pickBy: () => pickBy,
|
|
329
|
+
pickByDeep: () => pickByDeep,
|
|
330
|
+
pxToEm: () => pxToEm,
|
|
331
|
+
pxToPercent: () => pxToPercent,
|
|
332
|
+
pxToRem: () => pxToRem,
|
|
333
|
+
random: () => random,
|
|
334
|
+
randomNumber: () => randomNumber,
|
|
335
|
+
range: () => range,
|
|
336
|
+
remToEm: () => remToEm,
|
|
337
|
+
remToPx: () => remToPx,
|
|
338
|
+
repeat: () => repeat,
|
|
339
|
+
rgbToHSL: () => rgbToHSL,
|
|
340
|
+
rgbToHex: () => rgbToHex,
|
|
341
|
+
rotateHue: () => rotateHue,
|
|
342
|
+
round: () => round,
|
|
343
|
+
saturateColor: () => saturateColor,
|
|
344
|
+
setDeepValue: () => setDeepValue,
|
|
345
|
+
setNestedValue: () => setNestedValue,
|
|
346
|
+
setValue: () => setValue,
|
|
347
|
+
setValueByPath: () => setValueByPath,
|
|
348
|
+
shadeColor: () => shadeColor,
|
|
349
|
+
snakeCase: () => snakeCase,
|
|
350
|
+
startsWith: () => startsWith,
|
|
351
|
+
swapCase: () => swapCase,
|
|
352
|
+
throttle: () => throttle,
|
|
353
|
+
times: () => times,
|
|
354
|
+
tintColor: () => tintColor,
|
|
355
|
+
toExponential: () => toExponential,
|
|
356
|
+
toFinite: () => toFinite,
|
|
357
|
+
toFiniteNumber: () => toFiniteNumber,
|
|
358
|
+
toFixed: () => toFixed,
|
|
359
|
+
toInteger: () => toInteger,
|
|
360
|
+
toNumber: () => toNumber,
|
|
361
|
+
toPrecision: () => toPrecision,
|
|
362
|
+
toSafeInteger: () => toSafeInteger,
|
|
363
|
+
trim: () => trim,
|
|
364
|
+
trimEnd: () => trimEnd,
|
|
365
|
+
trimStart: () => trimStart,
|
|
366
|
+
truncate: () => truncate,
|
|
367
|
+
unescape: () => unescape,
|
|
368
|
+
union: () => union,
|
|
369
|
+
unionBy: () => unionBy,
|
|
370
|
+
uniqBy: () => uniqBy,
|
|
371
|
+
unique: () => unique,
|
|
372
|
+
unzip: () => unzip,
|
|
373
|
+
unzipWith: () => unzipWith,
|
|
374
|
+
upperCase: () => upperCase,
|
|
375
|
+
values: () => values,
|
|
376
|
+
without: () => without,
|
|
377
|
+
xor: () => xor,
|
|
378
|
+
zip: () => zip,
|
|
379
|
+
zipObject: () => zipObject,
|
|
380
|
+
zipObjectDeep: () => zipObjectDeep,
|
|
381
|
+
zipWith: () => zipWith,
|
|
382
|
+
zipWithDeep: () => zipWithDeep
|
|
383
|
+
});
|
|
384
|
+
function isEmpty(value) {
|
|
385
|
+
if (value == null) return true;
|
|
386
|
+
if (typeof value === "string") return value.trim().length === 0;
|
|
387
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
388
|
+
if (value instanceof Map || value instanceof Set) {
|
|
389
|
+
return value.size === 0;
|
|
390
|
+
}
|
|
391
|
+
if (typeof value === "object") {
|
|
392
|
+
return Object.keys(value).length === 0;
|
|
393
|
+
}
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
function times(n, iteratee) {
|
|
397
|
+
const result = [];
|
|
398
|
+
for (let i = 0; i < n; i++) {
|
|
399
|
+
result.push(iteratee(i));
|
|
400
|
+
}
|
|
401
|
+
return result;
|
|
402
|
+
}
|
|
403
|
+
function map(array, key, valueKey) {
|
|
404
|
+
const result = {};
|
|
405
|
+
for (const item of array) {
|
|
406
|
+
result[item[key]] = item[valueKey];
|
|
407
|
+
}
|
|
408
|
+
return result;
|
|
409
|
+
}
|
|
410
|
+
function get(obj, key) {
|
|
411
|
+
return obj[key];
|
|
412
|
+
}
|
|
413
|
+
function mergeDeep(target, source) {
|
|
414
|
+
if (typeof target !== "object" || target === null) {
|
|
415
|
+
return source;
|
|
416
|
+
}
|
|
417
|
+
const result = { ...target };
|
|
418
|
+
for (const key in source) {
|
|
419
|
+
if (source.hasOwnProperty(key)) {
|
|
420
|
+
const sourceValue = source[key];
|
|
421
|
+
const targetValue = target[key];
|
|
422
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
423
|
+
result[key] = mergeDeep(targetValue, sourceValue);
|
|
424
|
+
} else {
|
|
425
|
+
result[key] = sourceValue;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return result;
|
|
430
|
+
}
|
|
431
|
+
function omit(obj, keys2) {
|
|
432
|
+
const result = { ...obj };
|
|
433
|
+
for (const key of keys2) {
|
|
434
|
+
delete result[key];
|
|
435
|
+
}
|
|
436
|
+
return result;
|
|
437
|
+
}
|
|
438
|
+
function pick(obj, keys2) {
|
|
439
|
+
const result = {};
|
|
440
|
+
for (const key of keys2) {
|
|
441
|
+
if (key in obj) {
|
|
442
|
+
result[key] = obj[key];
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return result;
|
|
446
|
+
}
|
|
447
|
+
function flatten(array) {
|
|
448
|
+
const result = [];
|
|
449
|
+
for (const subArray of array) {
|
|
450
|
+
result.push(...subArray);
|
|
451
|
+
}
|
|
452
|
+
return result;
|
|
453
|
+
}
|
|
454
|
+
function unique(array) {
|
|
455
|
+
const seen = /* @__PURE__ */ new Set();
|
|
456
|
+
const result = [];
|
|
457
|
+
for (const item of array) {
|
|
458
|
+
if (!seen.has(item)) {
|
|
459
|
+
seen.add(item);
|
|
460
|
+
result.push(item);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return result;
|
|
464
|
+
}
|
|
465
|
+
function debounce(func, wait) {
|
|
466
|
+
let timeout = null;
|
|
467
|
+
return function(...args) {
|
|
468
|
+
if (timeout) {
|
|
469
|
+
clearTimeout(timeout);
|
|
470
|
+
}
|
|
471
|
+
timeout = setTimeout(() => {
|
|
472
|
+
func.apply(this, args);
|
|
473
|
+
}, wait);
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function throttle(func, limit) {
|
|
477
|
+
let inThrottle = false;
|
|
478
|
+
return function(...args) {
|
|
479
|
+
if (!inThrottle) {
|
|
480
|
+
func.apply(this, args);
|
|
481
|
+
inThrottle = true;
|
|
482
|
+
setTimeout(() => {
|
|
483
|
+
inThrottle = false;
|
|
484
|
+
}, limit);
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
function once(func) {
|
|
489
|
+
let called = false;
|
|
490
|
+
return function(...args) {
|
|
491
|
+
if (!called) {
|
|
492
|
+
called = true;
|
|
493
|
+
func.apply(this, args);
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function memoize(func) {
|
|
498
|
+
const cache = /* @__PURE__ */ new Map();
|
|
499
|
+
return function(...args) {
|
|
500
|
+
const key = JSON.stringify(args);
|
|
501
|
+
if (cache.has(key)) {
|
|
502
|
+
return cache.get(key);
|
|
503
|
+
}
|
|
504
|
+
const result = func.apply(this, args);
|
|
505
|
+
cache.set(key, result);
|
|
506
|
+
return result;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function range(start, end, step = 1) {
|
|
510
|
+
const result = [];
|
|
511
|
+
for (let i = start; i < end; i += step) {
|
|
512
|
+
result.push(i);
|
|
513
|
+
}
|
|
514
|
+
return result;
|
|
515
|
+
}
|
|
516
|
+
function random(min, max) {
|
|
517
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
518
|
+
}
|
|
519
|
+
function clamp(value, min, max) {
|
|
520
|
+
return Math.max(min, Math.min(max, value));
|
|
521
|
+
}
|
|
522
|
+
function capitalize(str) {
|
|
523
|
+
if (str.length === 0) return str;
|
|
524
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
525
|
+
}
|
|
526
|
+
function camelCase(str) {
|
|
527
|
+
return str.replace(/[-_]+/g, " ").replace(/[^\w\s]/g, "").replace(/\s+(.)(\w*)/g, (_, p1, p2) => p1.toUpperCase() + p2.toLowerCase()).replace(/\s/g, "");
|
|
528
|
+
}
|
|
529
|
+
function kebabCase(str) {
|
|
530
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
531
|
+
}
|
|
532
|
+
function snakeCase(str) {
|
|
533
|
+
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
|
|
534
|
+
}
|
|
535
|
+
function upperCase(str) {
|
|
536
|
+
return str.toUpperCase();
|
|
537
|
+
}
|
|
538
|
+
function difference(array1, array2) {
|
|
539
|
+
const set2 = new Set(array2);
|
|
540
|
+
return array1.filter((item) => !set2.has(item));
|
|
541
|
+
}
|
|
542
|
+
function intersection(array1, array2) {
|
|
543
|
+
const set2 = new Set(array2);
|
|
544
|
+
return array1.filter((item) => set2.has(item));
|
|
545
|
+
}
|
|
546
|
+
function union(array1, array2) {
|
|
547
|
+
const set = /* @__PURE__ */ new Set([...array1, ...array2]);
|
|
548
|
+
return Array.from(set);
|
|
549
|
+
}
|
|
550
|
+
function zip(array1, array2) {
|
|
551
|
+
const length = Math.min(array1.length, array2.length);
|
|
552
|
+
const result = [];
|
|
553
|
+
for (let i = 0; i < length; i++) {
|
|
554
|
+
result.push([array1[i], array2[i]]);
|
|
555
|
+
}
|
|
556
|
+
return result;
|
|
557
|
+
}
|
|
558
|
+
function unzip(array) {
|
|
559
|
+
const array1 = [];
|
|
560
|
+
const array2 = [];
|
|
561
|
+
for (const [item1, item2] of array) {
|
|
562
|
+
array1.push(item1);
|
|
563
|
+
array2.push(item2);
|
|
564
|
+
}
|
|
565
|
+
return [array1, array2];
|
|
566
|
+
}
|
|
567
|
+
function groupBy(array, key) {
|
|
568
|
+
const result = {};
|
|
569
|
+
for (const item of array) {
|
|
570
|
+
const groupKey = String(item[key]);
|
|
571
|
+
if (!result[groupKey]) {
|
|
572
|
+
result[groupKey] = [];
|
|
573
|
+
}
|
|
574
|
+
result[groupKey].push(item);
|
|
575
|
+
}
|
|
576
|
+
return result;
|
|
577
|
+
}
|
|
578
|
+
function partition(array, predicate) {
|
|
579
|
+
const truthy = [];
|
|
580
|
+
const falsy = [];
|
|
581
|
+
for (const item of array) {
|
|
582
|
+
if (predicate(item)) {
|
|
583
|
+
truthy.push(item);
|
|
584
|
+
} else {
|
|
585
|
+
falsy.push(item);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return [truthy, falsy];
|
|
589
|
+
}
|
|
590
|
+
function countBy(array, key) {
|
|
591
|
+
const result = {};
|
|
592
|
+
for (const item of array) {
|
|
593
|
+
const countKey = String(item[key]);
|
|
594
|
+
result[countKey] = (result[countKey] || 0) + 1;
|
|
595
|
+
}
|
|
596
|
+
return result;
|
|
597
|
+
}
|
|
598
|
+
function chunk(array, size) {
|
|
599
|
+
const result = [];
|
|
600
|
+
for (let i = 0; i < array.length; i += size) {
|
|
601
|
+
result.push(array.slice(i, i + size));
|
|
602
|
+
}
|
|
603
|
+
return result;
|
|
604
|
+
}
|
|
605
|
+
function compact(array) {
|
|
606
|
+
return array.filter(Boolean);
|
|
607
|
+
}
|
|
608
|
+
function concat(...arrays) {
|
|
609
|
+
const result = [];
|
|
610
|
+
for (const array of arrays) {
|
|
611
|
+
result.push(...array);
|
|
612
|
+
}
|
|
613
|
+
return result;
|
|
614
|
+
}
|
|
615
|
+
function differenceBy(array1, array2, iteratee) {
|
|
616
|
+
const set2 = new Set(array2.map(iteratee));
|
|
617
|
+
return array1.filter((item) => !set2.has(iteratee(item)));
|
|
618
|
+
}
|
|
619
|
+
function intersectionBy(array1, array2, iteratee) {
|
|
620
|
+
const set2 = new Set(array2.map(iteratee));
|
|
621
|
+
return array1.filter((item) => set2.has(iteratee(item)));
|
|
622
|
+
}
|
|
623
|
+
function unionBy(array1, array2, iteratee) {
|
|
624
|
+
const seen = /* @__PURE__ */ new Set();
|
|
625
|
+
const result = [];
|
|
626
|
+
for (const item of [...array1, ...array2]) {
|
|
627
|
+
const key = iteratee(item);
|
|
628
|
+
if (!seen.has(key)) {
|
|
629
|
+
seen.add(key);
|
|
630
|
+
result.push(item);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return result;
|
|
634
|
+
}
|
|
635
|
+
function uniqBy(array, iteratee) {
|
|
636
|
+
const seen = /* @__PURE__ */ new Set();
|
|
637
|
+
const result = [];
|
|
638
|
+
for (const item of array) {
|
|
639
|
+
const key = iteratee(item);
|
|
640
|
+
if (!seen.has(key)) {
|
|
641
|
+
seen.add(key);
|
|
642
|
+
result.push(item);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
return result;
|
|
646
|
+
}
|
|
647
|
+
function zipWith(array1, array2, iteratee) {
|
|
648
|
+
const length = Math.min(array1.length, array2.length);
|
|
649
|
+
const result = [];
|
|
650
|
+
for (let i = 0; i < length; i++) {
|
|
651
|
+
result.push(iteratee(array1[i], array2[i]));
|
|
652
|
+
}
|
|
653
|
+
return result;
|
|
654
|
+
}
|
|
655
|
+
function unzipWith(array, iteratee) {
|
|
656
|
+
const result = [];
|
|
657
|
+
for (const [item1, item2] of array) {
|
|
658
|
+
result.push(iteratee(item1, item2));
|
|
659
|
+
}
|
|
660
|
+
return result;
|
|
661
|
+
}
|
|
662
|
+
function without(array, ...values2) {
|
|
663
|
+
const valueSet = new Set(values2);
|
|
664
|
+
return array.filter((item) => !valueSet.has(item));
|
|
665
|
+
}
|
|
666
|
+
function xor(array1, array2) {
|
|
667
|
+
const set1 = new Set(array1);
|
|
668
|
+
const set2 = new Set(array2);
|
|
669
|
+
const result = [];
|
|
670
|
+
for (const item of array1) {
|
|
671
|
+
if (!set2.has(item)) {
|
|
672
|
+
result.push(item);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
for (const item of array2) {
|
|
676
|
+
if (!set1.has(item)) {
|
|
677
|
+
result.push(item);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return result;
|
|
681
|
+
}
|
|
682
|
+
function zipObject(keys2, values2) {
|
|
683
|
+
const result = {};
|
|
684
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
685
|
+
result[keys2[i]] = values2[i];
|
|
686
|
+
}
|
|
687
|
+
return result;
|
|
688
|
+
}
|
|
689
|
+
function zipObjectDeep(keys2, values2) {
|
|
690
|
+
const result = {};
|
|
691
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
692
|
+
const keyParts = String(keys2[i]).split(".");
|
|
693
|
+
let current = result;
|
|
694
|
+
for (let j = 0; j < keyParts.length; j++) {
|
|
695
|
+
const part = keyParts[j];
|
|
696
|
+
if (j === keyParts.length - 1) {
|
|
697
|
+
current[part] = values2[i];
|
|
698
|
+
} else {
|
|
699
|
+
current[part] = current[part] || {};
|
|
700
|
+
current = current[part];
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return result;
|
|
705
|
+
}
|
|
706
|
+
function zipWithDeep(keys2, values2, iteratee) {
|
|
707
|
+
const result = {};
|
|
708
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
709
|
+
const keyParts = String(keys2[i]).split(".");
|
|
710
|
+
let current = result;
|
|
711
|
+
for (let j = 0; j < keyParts.length; j++) {
|
|
712
|
+
const part = keyParts[j];
|
|
713
|
+
if (j === keyParts.length - 1) {
|
|
714
|
+
current[part] = iteratee(values2[i]);
|
|
715
|
+
} else {
|
|
716
|
+
current[part] = current[part] || {};
|
|
717
|
+
current = current[part];
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
return result;
|
|
722
|
+
}
|
|
723
|
+
function first(array) {
|
|
724
|
+
return array[0];
|
|
725
|
+
}
|
|
726
|
+
function last(array) {
|
|
727
|
+
return array[array.length - 1];
|
|
728
|
+
}
|
|
729
|
+
function nth(array, n) {
|
|
730
|
+
if (n < 0) {
|
|
731
|
+
return array[array.length + n];
|
|
732
|
+
}
|
|
733
|
+
return array[n];
|
|
734
|
+
}
|
|
735
|
+
function keys(obj) {
|
|
736
|
+
return Object.keys(obj);
|
|
737
|
+
}
|
|
738
|
+
function values(obj) {
|
|
739
|
+
return Object.values(obj);
|
|
740
|
+
}
|
|
741
|
+
function entries(obj) {
|
|
742
|
+
return Object.entries(obj);
|
|
743
|
+
}
|
|
744
|
+
function fromEntries(entries2) {
|
|
745
|
+
const result = {};
|
|
746
|
+
for (const [key, value] of entries2) {
|
|
747
|
+
result[key] = value;
|
|
748
|
+
}
|
|
749
|
+
return result;
|
|
750
|
+
}
|
|
751
|
+
function invert(obj) {
|
|
752
|
+
const result = {};
|
|
753
|
+
for (const key in obj) {
|
|
754
|
+
if (obj.hasOwnProperty(key)) {
|
|
755
|
+
const value = obj[key];
|
|
756
|
+
result[value] = key;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return result;
|
|
760
|
+
}
|
|
761
|
+
function mapValues(obj, iteratee) {
|
|
762
|
+
const result = {};
|
|
763
|
+
for (const key in obj) {
|
|
764
|
+
if (obj.hasOwnProperty(key)) {
|
|
765
|
+
result[key] = iteratee(obj[key], key);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return result;
|
|
769
|
+
}
|
|
770
|
+
function mapKeys(obj, iteratee) {
|
|
771
|
+
const result = {};
|
|
772
|
+
for (const key in obj) {
|
|
773
|
+
if (obj.hasOwnProperty(key)) {
|
|
774
|
+
const newKey = iteratee(obj[key], key);
|
|
775
|
+
result[newKey] = obj[key];
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return result;
|
|
779
|
+
}
|
|
780
|
+
function merge(target, ...sources) {
|
|
781
|
+
const result = { ...target };
|
|
782
|
+
for (const source of sources) {
|
|
783
|
+
for (const key in source) {
|
|
784
|
+
if (source.hasOwnProperty(key)) {
|
|
785
|
+
const sourceValue = source[key];
|
|
786
|
+
const targetValue = result[key];
|
|
787
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
788
|
+
result[key] = merge(targetValue, sourceValue);
|
|
789
|
+
} else {
|
|
790
|
+
result[key] = sourceValue;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return result;
|
|
796
|
+
}
|
|
797
|
+
function assign(target, ...sources) {
|
|
798
|
+
return Object.assign(target, ...sources);
|
|
799
|
+
}
|
|
800
|
+
function defaults(target, ...sources) {
|
|
801
|
+
const result = { ...target };
|
|
802
|
+
for (const source of sources) {
|
|
803
|
+
for (const key in source) {
|
|
804
|
+
if (source.hasOwnProperty(key) && result[key] === void 0) {
|
|
805
|
+
result[key] = source[key];
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
return result;
|
|
810
|
+
}
|
|
811
|
+
function defaultsDeep(target, ...sources) {
|
|
812
|
+
const result = { ...target };
|
|
813
|
+
for (const source of sources) {
|
|
814
|
+
for (const key in source) {
|
|
815
|
+
if (source.hasOwnProperty(key)) {
|
|
816
|
+
const sourceValue = source[key];
|
|
817
|
+
const targetValue = result[key];
|
|
818
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
819
|
+
result[key] = defaultsDeep(targetValue, sourceValue);
|
|
820
|
+
} else if (result[key] === void 0) {
|
|
821
|
+
result[key] = sourceValue;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
return result;
|
|
827
|
+
}
|
|
828
|
+
function pickBy(obj, predicate) {
|
|
829
|
+
const result = {};
|
|
830
|
+
for (const key in obj) {
|
|
831
|
+
if (obj.hasOwnProperty(key)) {
|
|
832
|
+
const value = obj[key];
|
|
833
|
+
if (predicate(value, key)) {
|
|
834
|
+
result[key] = value;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return result;
|
|
839
|
+
}
|
|
840
|
+
function omitBy(obj, predicate) {
|
|
841
|
+
const result = {};
|
|
842
|
+
for (const key in obj) {
|
|
843
|
+
if (obj.hasOwnProperty(key)) {
|
|
844
|
+
const value = obj[key];
|
|
845
|
+
if (!predicate(value, key)) {
|
|
846
|
+
result[key] = value;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return result;
|
|
851
|
+
}
|
|
852
|
+
function pickByDeep(obj, predicate) {
|
|
853
|
+
const result = {};
|
|
854
|
+
for (const key in obj) {
|
|
855
|
+
if (obj.hasOwnProperty(key)) {
|
|
856
|
+
const value = obj[key];
|
|
857
|
+
if (typeof value === "object" && value !== null) {
|
|
858
|
+
const nestedResult = pickByDeep(value, predicate);
|
|
859
|
+
if (Object.keys(nestedResult).length > 0) {
|
|
860
|
+
result[key] = nestedResult;
|
|
861
|
+
}
|
|
862
|
+
} else if (predicate(value, key)) {
|
|
863
|
+
result[key] = value;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return result;
|
|
868
|
+
}
|
|
869
|
+
function omitByDeep(obj, predicate) {
|
|
870
|
+
const result = {};
|
|
871
|
+
for (const key in obj) {
|
|
872
|
+
if (obj.hasOwnProperty(key)) {
|
|
873
|
+
const value = obj[key];
|
|
874
|
+
if (typeof value === "object" && value !== null) {
|
|
875
|
+
const nestedResult = omitByDeep(value, predicate);
|
|
876
|
+
result[key] = nestedResult;
|
|
877
|
+
} else if (!predicate(value, key)) {
|
|
878
|
+
result[key] = value;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return result;
|
|
883
|
+
}
|
|
884
|
+
function isEmptyObject(obj) {
|
|
885
|
+
return Object.keys(obj).length === 0;
|
|
886
|
+
}
|
|
887
|
+
function isEmptyArray(arr) {
|
|
888
|
+
return arr.length === 0;
|
|
889
|
+
}
|
|
890
|
+
function isEmptyString(str) {
|
|
891
|
+
return str.trim().length === 0;
|
|
892
|
+
}
|
|
893
|
+
function isEmptyValue(value) {
|
|
894
|
+
return value == null || typeof value === "string" && value.trim().length === 0 || Array.isArray(value) && value.length === 0 || typeof value === "object" && Object.keys(value).length === 0;
|
|
895
|
+
}
|
|
896
|
+
function startsWith(str, prefix) {
|
|
897
|
+
return str.startsWith(prefix);
|
|
898
|
+
}
|
|
899
|
+
function endsWith(str, suffix) {
|
|
900
|
+
return str.endsWith(suffix);
|
|
901
|
+
}
|
|
902
|
+
function includes(str, search) {
|
|
903
|
+
return str.includes(search);
|
|
904
|
+
}
|
|
905
|
+
function repeat(str, times2) {
|
|
906
|
+
return str.repeat(times2);
|
|
907
|
+
}
|
|
908
|
+
function padStart(str, targetLength, padString = " ") {
|
|
909
|
+
return str.padStart(targetLength, padString);
|
|
910
|
+
}
|
|
911
|
+
function padEnd(str, targetLength, padString = " ") {
|
|
912
|
+
return str.padEnd(targetLength, padString);
|
|
913
|
+
}
|
|
914
|
+
function trim(str) {
|
|
915
|
+
return str.trim();
|
|
916
|
+
}
|
|
917
|
+
function trimStart(str) {
|
|
918
|
+
return str.trimStart();
|
|
919
|
+
}
|
|
920
|
+
function trimEnd(str) {
|
|
921
|
+
return str.trimEnd();
|
|
922
|
+
}
|
|
923
|
+
function truncate(str, length, omission = "...") {
|
|
924
|
+
if (str.length <= length) return str;
|
|
925
|
+
return str.slice(0, length - omission.length) + omission;
|
|
926
|
+
}
|
|
927
|
+
function escape(str) {
|
|
928
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
929
|
+
}
|
|
930
|
+
function unescape(str) {
|
|
931
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
|
|
932
|
+
}
|
|
933
|
+
function capitalizeWords(str) {
|
|
934
|
+
return str.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
935
|
+
}
|
|
936
|
+
function decapitalize(str) {
|
|
937
|
+
if (str.length === 0) return str;
|
|
938
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
939
|
+
}
|
|
940
|
+
function decapitalizeWords(str) {
|
|
941
|
+
return str.replace(/\b\w/g, (char) => char.toLowerCase());
|
|
942
|
+
}
|
|
943
|
+
function swapCase(str) {
|
|
944
|
+
return str.split("").map((char) => {
|
|
945
|
+
if (char === char.toUpperCase()) {
|
|
946
|
+
return char.toLowerCase();
|
|
947
|
+
} else {
|
|
948
|
+
return char.toUpperCase();
|
|
949
|
+
}
|
|
950
|
+
}).join("");
|
|
951
|
+
}
|
|
952
|
+
function clampNumber(num, min, max) {
|
|
953
|
+
return Math.max(min, Math.min(max, num));
|
|
954
|
+
}
|
|
955
|
+
function randomNumber(min, max) {
|
|
956
|
+
return Math.random() * (max - min) + min;
|
|
957
|
+
}
|
|
958
|
+
function round(num, precision = 0) {
|
|
959
|
+
const factor = Math.pow(10, precision);
|
|
960
|
+
return Math.round(num * factor) / factor;
|
|
961
|
+
}
|
|
962
|
+
function floor(num, precision = 0) {
|
|
963
|
+
const factor = Math.pow(10, precision);
|
|
964
|
+
return Math.floor(num * factor) / factor;
|
|
965
|
+
}
|
|
966
|
+
function ceil(num, precision = 0) {
|
|
967
|
+
const factor = Math.pow(10, precision);
|
|
968
|
+
return Math.ceil(num * factor) / factor;
|
|
969
|
+
}
|
|
970
|
+
function toFixed(num, precision = 0) {
|
|
971
|
+
return num.toFixed(precision);
|
|
972
|
+
}
|
|
973
|
+
function toExponential(num, precision = 0) {
|
|
974
|
+
return num.toExponential(precision);
|
|
975
|
+
}
|
|
976
|
+
function toPrecision(num, precision = 0) {
|
|
977
|
+
return num.toPrecision(precision);
|
|
978
|
+
}
|
|
979
|
+
function isInteger(num) {
|
|
980
|
+
return Number.isInteger(num);
|
|
981
|
+
}
|
|
982
|
+
function isFiniteNumber(num) {
|
|
983
|
+
return Number.isFinite(num);
|
|
984
|
+
}
|
|
985
|
+
function isNaNValue(num) {
|
|
986
|
+
return Number.isNaN(num);
|
|
987
|
+
}
|
|
988
|
+
function isSafeInteger(num) {
|
|
989
|
+
return Number.isSafeInteger(num);
|
|
990
|
+
}
|
|
991
|
+
function parseIntValue(str, radix = 10) {
|
|
992
|
+
return parseInt(str, radix);
|
|
993
|
+
}
|
|
994
|
+
function parseFloatValue(str) {
|
|
995
|
+
return parseFloat(str);
|
|
996
|
+
}
|
|
997
|
+
function toNumber(value) {
|
|
998
|
+
return Number(value);
|
|
999
|
+
}
|
|
1000
|
+
function toInteger(value) {
|
|
1001
|
+
return parseInt(String(value), 10);
|
|
1002
|
+
}
|
|
1003
|
+
function toFinite(value) {
|
|
1004
|
+
const num = toNumber(value);
|
|
1005
|
+
if (num === Infinity) return Number.MAX_VALUE;
|
|
1006
|
+
if (num === -Infinity) return -Number.MAX_VALUE;
|
|
1007
|
+
return isNaN(num) ? 0 : num;
|
|
1008
|
+
}
|
|
1009
|
+
function toSafeInteger(value) {
|
|
1010
|
+
const num = toInteger(value);
|
|
1011
|
+
if (num > Number.MAX_SAFE_INTEGER) return Number.MAX_SAFE_INTEGER;
|
|
1012
|
+
if (num < Number.MIN_SAFE_INTEGER) return Number.MIN_SAFE_INTEGER;
|
|
1013
|
+
return num;
|
|
1014
|
+
}
|
|
1015
|
+
function toFiniteNumber(value) {
|
|
1016
|
+
const num = toNumber(value);
|
|
1017
|
+
if (num === Infinity) return Number.MAX_VALUE;
|
|
1018
|
+
if (num === -Infinity) return -Number.MAX_VALUE;
|
|
1019
|
+
return isNaN(num) ? 0 : num;
|
|
1020
|
+
}
|
|
1021
|
+
function getValue(obj, key) {
|
|
1022
|
+
return obj[key];
|
|
1023
|
+
}
|
|
1024
|
+
function setValue(obj, key, value) {
|
|
1025
|
+
obj[key] = value;
|
|
1026
|
+
}
|
|
1027
|
+
function hasKey(obj, key) {
|
|
1028
|
+
return key in obj;
|
|
1029
|
+
}
|
|
1030
|
+
function hasValue(obj, value) {
|
|
1031
|
+
return Object.values(obj).includes(value);
|
|
1032
|
+
}
|
|
1033
|
+
function getNestedValue(obj, key1, key2) {
|
|
1034
|
+
return obj[key1][key2];
|
|
1035
|
+
}
|
|
1036
|
+
function setNestedValue(obj, key1, key2, value) {
|
|
1037
|
+
obj[key1][key2] = value;
|
|
1038
|
+
}
|
|
1039
|
+
function hasNestedKey(obj, key1, key2) {
|
|
1040
|
+
return key1 in obj && key2 in obj[key1];
|
|
1041
|
+
}
|
|
1042
|
+
function hasNestedValue(obj, key1, key2, value) {
|
|
1043
|
+
return obj[key1][key2] === value;
|
|
1044
|
+
}
|
|
1045
|
+
function getDeepValue(obj, key1, key2, key3) {
|
|
1046
|
+
return obj[key1][key2][key3];
|
|
1047
|
+
}
|
|
1048
|
+
function setDeepValue(obj, key1, key2, key3, value) {
|
|
1049
|
+
obj[key1][key2][key3] = value;
|
|
1050
|
+
}
|
|
1051
|
+
function hasDeepKey(obj, key1, key2, key3) {
|
|
1052
|
+
return key1 in obj && key2 in obj[key1] && key3 in obj[key1][key2];
|
|
1053
|
+
}
|
|
1054
|
+
function hasDeepValue(obj, key1, key2, key3, value) {
|
|
1055
|
+
return obj[key1][key2][key3] === value;
|
|
1056
|
+
}
|
|
1057
|
+
function getValueByPath(obj, path) {
|
|
1058
|
+
const keys2 = path.split(".");
|
|
1059
|
+
let current = obj;
|
|
1060
|
+
for (const key of keys2) {
|
|
1061
|
+
if (current == null) return void 0;
|
|
1062
|
+
current = current[key];
|
|
1063
|
+
}
|
|
1064
|
+
return current;
|
|
1065
|
+
}
|
|
1066
|
+
function setValueByPath(obj, path, value) {
|
|
1067
|
+
const keys2 = path.split(".");
|
|
1068
|
+
let current = obj;
|
|
1069
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
1070
|
+
const key = keys2[i];
|
|
1071
|
+
if (i === keys2.length - 1) {
|
|
1072
|
+
current[key] = value;
|
|
1073
|
+
} else {
|
|
1074
|
+
current[key] = current[key] || {};
|
|
1075
|
+
current = current[key];
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
function hasKeyByPath(obj, path) {
|
|
1080
|
+
const keys2 = path.split(".");
|
|
1081
|
+
let current = obj;
|
|
1082
|
+
for (const key of keys2) {
|
|
1083
|
+
if (current == null || !(key in current)) return false;
|
|
1084
|
+
current = current[key];
|
|
1085
|
+
}
|
|
1086
|
+
return true;
|
|
1087
|
+
}
|
|
1088
|
+
function hasValueByPath(obj, path, value) {
|
|
1089
|
+
const keys2 = path.split(".");
|
|
1090
|
+
let current = obj;
|
|
1091
|
+
for (const key of keys2) {
|
|
1092
|
+
if (current == null || !(key in current)) return false;
|
|
1093
|
+
current = current[key];
|
|
1094
|
+
}
|
|
1095
|
+
return current === value;
|
|
1096
|
+
}
|
|
1097
|
+
function isNumberValue(value) {
|
|
1098
|
+
return typeof value === "number" && !isNaN(value);
|
|
1099
|
+
}
|
|
1100
|
+
function isStringValue(value) {
|
|
1101
|
+
return typeof value === "string";
|
|
1102
|
+
}
|
|
1103
|
+
function isBooleanValue(value) {
|
|
1104
|
+
return typeof value === "boolean";
|
|
1105
|
+
}
|
|
1106
|
+
function isObjectValue(value) {
|
|
1107
|
+
return typeof value === "object" && value !== null;
|
|
1108
|
+
}
|
|
1109
|
+
function isArrayValue(value) {
|
|
1110
|
+
return Array.isArray(value);
|
|
1111
|
+
}
|
|
1112
|
+
function isFunctionValue(value) {
|
|
1113
|
+
return typeof value === "function";
|
|
1114
|
+
}
|
|
1115
|
+
function isNullValue(value) {
|
|
1116
|
+
return value === null;
|
|
1117
|
+
}
|
|
1118
|
+
function isUndefinedValue(value) {
|
|
1119
|
+
return value === void 0;
|
|
1120
|
+
}
|
|
1121
|
+
function isSymbolValue(value) {
|
|
1122
|
+
return typeof value === "symbol";
|
|
1123
|
+
}
|
|
1124
|
+
function isBigIntValue(value) {
|
|
1125
|
+
return typeof value === "bigint";
|
|
1126
|
+
}
|
|
1127
|
+
function isEmail(str) {
|
|
1128
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1129
|
+
return emailRegex.test(str);
|
|
1130
|
+
}
|
|
1131
|
+
function isURL(str) {
|
|
1132
|
+
const urlRegex = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/i;
|
|
1133
|
+
return urlRegex.test(str);
|
|
1134
|
+
}
|
|
1135
|
+
function isPhoneNumber(str) {
|
|
1136
|
+
const phoneRegex = /^\+?[1-9]\d{1,14}$/;
|
|
1137
|
+
return phoneRegex.test(str);
|
|
1138
|
+
}
|
|
1139
|
+
function isPostalCode(str) {
|
|
1140
|
+
const postalCodeRegex = /^\d{5}(-\d{4})?$/;
|
|
1141
|
+
return postalCodeRegex.test(str);
|
|
1142
|
+
}
|
|
1143
|
+
function isCreditCard(str) {
|
|
1144
|
+
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})$/;
|
|
1145
|
+
return creditCardRegex.test(str);
|
|
1146
|
+
}
|
|
1147
|
+
function isISBN(str) {
|
|
1148
|
+
const isbn10Regex = /^(?:\d{9}X|\d{10})$/;
|
|
1149
|
+
const isbn13Regex = /^(?:\d{13})$/;
|
|
1150
|
+
return isbn10Regex.test(str) || isbn13Regex.test(str);
|
|
1151
|
+
}
|
|
1152
|
+
function isJSON(str) {
|
|
1153
|
+
try {
|
|
1154
|
+
JSON.parse(str);
|
|
1155
|
+
return true;
|
|
1156
|
+
} catch {
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
function isXML(str) {
|
|
1161
|
+
const parser = new DOMParser();
|
|
1162
|
+
const doc = parser.parseFromString(str, "application/xml");
|
|
1163
|
+
return !doc.querySelector("parsererror");
|
|
1164
|
+
}
|
|
1165
|
+
function isBase64(str) {
|
|
1166
|
+
const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/;
|
|
1167
|
+
return base64Regex.test(str);
|
|
1168
|
+
}
|
|
1169
|
+
function isHexadecimal(str) {
|
|
1170
|
+
const hexRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1171
|
+
return hexRegex.test(str);
|
|
1172
|
+
}
|
|
1173
|
+
function isUUID(str) {
|
|
1174
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1175
|
+
return uuidRegex.test(str);
|
|
1176
|
+
}
|
|
1177
|
+
function isIPv4(str) {
|
|
1178
|
+
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}$/;
|
|
1179
|
+
return ipv4Regex.test(str);
|
|
1180
|
+
}
|
|
1181
|
+
function isIPv6(str) {
|
|
1182
|
+
const ipv6Regex = /^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/;
|
|
1183
|
+
return ipv6Regex.test(str);
|
|
1184
|
+
}
|
|
1185
|
+
function isMACAddress(str) {
|
|
1186
|
+
const macRegex = /^([0-9A-Fa-f]{2}[:\-]){5}([0-9A-Fa-f]{2})$/;
|
|
1187
|
+
return macRegex.test(str);
|
|
1188
|
+
}
|
|
1189
|
+
function isSlug(str) {
|
|
1190
|
+
const slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
1191
|
+
return slugRegex.test(str);
|
|
1192
|
+
}
|
|
1193
|
+
function isHexColor(str) {
|
|
1194
|
+
const hexColorRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1195
|
+
return hexColorRegex.test(str);
|
|
1196
|
+
}
|
|
1197
|
+
function isRGBColor(str) {
|
|
1198
|
+
const rgbColorRegex = /^rgb\(\s*(\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/;
|
|
1199
|
+
return rgbColorRegex.test(str);
|
|
1200
|
+
}
|
|
1201
|
+
function hexToRGB(hex) {
|
|
1202
|
+
const hexRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1203
|
+
if (!hexRegex.test(hex)) return null;
|
|
1204
|
+
let r, g, b;
|
|
1205
|
+
if (hex.length === 4) {
|
|
1206
|
+
r = parseInt(hex[1] + hex[1], 16);
|
|
1207
|
+
g = parseInt(hex[2] + hex[2], 16);
|
|
1208
|
+
b = parseInt(hex[3] + hex[3], 16);
|
|
1209
|
+
} else {
|
|
1210
|
+
r = parseInt(hex.slice(1, 3), 16);
|
|
1211
|
+
g = parseInt(hex.slice(3, 5), 16);
|
|
1212
|
+
b = parseInt(hex.slice(5, 7), 16);
|
|
1213
|
+
}
|
|
1214
|
+
return { r, g, b };
|
|
1215
|
+
}
|
|
1216
|
+
function rgbToHex(r, g, b) {
|
|
1217
|
+
const toHex = (num) => num.toString(16).padStart(2, "0");
|
|
1218
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
1219
|
+
}
|
|
1220
|
+
function rgbToHSL(r, g, b) {
|
|
1221
|
+
r /= 255;
|
|
1222
|
+
g /= 255;
|
|
1223
|
+
b /= 255;
|
|
1224
|
+
const max = Math.max(r, g, b);
|
|
1225
|
+
const min = Math.min(r, g, b);
|
|
1226
|
+
let h = 0, s = 0, l = (max + min) / 2;
|
|
1227
|
+
if (max !== min) {
|
|
1228
|
+
const d = max - min;
|
|
1229
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
1230
|
+
switch (max) {
|
|
1231
|
+
case r:
|
|
1232
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1233
|
+
break;
|
|
1234
|
+
case g:
|
|
1235
|
+
h = (b - r) / d + 2;
|
|
1236
|
+
break;
|
|
1237
|
+
case b:
|
|
1238
|
+
h = (r - g) / d + 4;
|
|
1239
|
+
break;
|
|
1240
|
+
}
|
|
1241
|
+
h /= 6;
|
|
1242
|
+
}
|
|
1243
|
+
return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) };
|
|
1244
|
+
}
|
|
1245
|
+
function hslToRGB(h, s, l) {
|
|
1246
|
+
h /= 360;
|
|
1247
|
+
s /= 100;
|
|
1248
|
+
l /= 100;
|
|
1249
|
+
let r, g, b;
|
|
1250
|
+
if (s === 0) {
|
|
1251
|
+
r = g = b = l;
|
|
1252
|
+
} else {
|
|
1253
|
+
const hueToRGB = (p2, q2, t) => {
|
|
1254
|
+
if (t < 0) t += 1;
|
|
1255
|
+
if (t > 1) t -= 1;
|
|
1256
|
+
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
1257
|
+
if (t < 1 / 2) return q2;
|
|
1258
|
+
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
1259
|
+
return p2;
|
|
1260
|
+
};
|
|
1261
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
1262
|
+
const p = 2 * l - q;
|
|
1263
|
+
r = hueToRGB(p, q, h + 1 / 3);
|
|
1264
|
+
g = hueToRGB(p, q, h);
|
|
1265
|
+
b = hueToRGB(p, q, h - 1 / 3);
|
|
1266
|
+
}
|
|
1267
|
+
return { r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255) };
|
|
1268
|
+
}
|
|
1269
|
+
function hexToHSL(hex) {
|
|
1270
|
+
const rgb = hexToRGB(hex);
|
|
1271
|
+
if (!rgb) return null;
|
|
1272
|
+
return rgbToHSL(rgb.r, rgb.g, rgb.b);
|
|
1273
|
+
}
|
|
1274
|
+
function hslToHex(h, s, l) {
|
|
1275
|
+
const rgb = hslToRGB(h, s, l);
|
|
1276
|
+
return rgbToHex(rgb.r, rgb.g, rgb.b);
|
|
1277
|
+
}
|
|
1278
|
+
function lightenColor(hex, amount) {
|
|
1279
|
+
const hsl = hexToHSL(hex);
|
|
1280
|
+
if (!hsl) return null;
|
|
1281
|
+
hsl.l = Math.min(100, hsl.l + amount);
|
|
1282
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1283
|
+
}
|
|
1284
|
+
function darkenColor(hex, amount) {
|
|
1285
|
+
const hsl = hexToHSL(hex);
|
|
1286
|
+
if (!hsl) return null;
|
|
1287
|
+
hsl.l = Math.max(0, hsl.l - amount);
|
|
1288
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1289
|
+
}
|
|
1290
|
+
function saturateColor(hex, amount) {
|
|
1291
|
+
const hsl = hexToHSL(hex);
|
|
1292
|
+
if (!hsl) return null;
|
|
1293
|
+
hsl.s = Math.min(100, hsl.s + amount);
|
|
1294
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1295
|
+
}
|
|
1296
|
+
function desaturateColor(hex, amount) {
|
|
1297
|
+
const hsl = hexToHSL(hex);
|
|
1298
|
+
if (!hsl) return null;
|
|
1299
|
+
hsl.s = Math.max(0, hsl.s - amount);
|
|
1300
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1301
|
+
}
|
|
1302
|
+
function rotateHue(hex, degrees) {
|
|
1303
|
+
const hsl = hexToHSL(hex);
|
|
1304
|
+
if (!hsl) return null;
|
|
1305
|
+
hsl.h = (hsl.h + degrees) % 360;
|
|
1306
|
+
if (hsl.h < 0) hsl.h += 360;
|
|
1307
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1308
|
+
}
|
|
1309
|
+
function invertColor(hex) {
|
|
1310
|
+
const rgb = hexToRGB(hex);
|
|
1311
|
+
if (!rgb) return null;
|
|
1312
|
+
const invertedR = 255 - rgb.r;
|
|
1313
|
+
const invertedG = 255 - rgb.g;
|
|
1314
|
+
const invertedB = 255 - rgb.b;
|
|
1315
|
+
return rgbToHex(invertedR, invertedG, invertedB);
|
|
1316
|
+
}
|
|
1317
|
+
function isLightColor(hex) {
|
|
1318
|
+
const rgb = hexToRGB(hex);
|
|
1319
|
+
if (!rgb) return null;
|
|
1320
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1321
|
+
return brightness > 128;
|
|
1322
|
+
}
|
|
1323
|
+
function isDarkColor(hex) {
|
|
1324
|
+
const rgb = hexToRGB(hex);
|
|
1325
|
+
if (!rgb) return null;
|
|
1326
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1327
|
+
return brightness <= 128;
|
|
1328
|
+
}
|
|
1329
|
+
function getContrastColor(hex) {
|
|
1330
|
+
const rgb = hexToRGB(hex);
|
|
1331
|
+
if (!rgb) return null;
|
|
1332
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1333
|
+
return brightness > 128 ? "#000000" : "#FFFFFF";
|
|
1334
|
+
}
|
|
1335
|
+
function blendColors(hex1, hex2, ratio) {
|
|
1336
|
+
const rgb1 = hexToRGB(hex1);
|
|
1337
|
+
const rgb2 = hexToRGB(hex2);
|
|
1338
|
+
if (!rgb1 || !rgb2) return null;
|
|
1339
|
+
const r = Math.round(rgb1.r * (1 - ratio) + rgb2.r * ratio);
|
|
1340
|
+
const g = Math.round(rgb1.g * (1 - ratio) + rgb2.g * ratio);
|
|
1341
|
+
const b = Math.round(rgb1.b * (1 - ratio) + rgb2.b * ratio);
|
|
1342
|
+
return rgbToHex(r, g, b);
|
|
1343
|
+
}
|
|
1344
|
+
function mixColors(hex1, hex2) {
|
|
1345
|
+
return blendColors(hex1, hex2, 0.5);
|
|
1346
|
+
}
|
|
1347
|
+
function shadeColor(hex, percent) {
|
|
1348
|
+
const rgb = hexToRGB(hex);
|
|
1349
|
+
if (!rgb) return null;
|
|
1350
|
+
const r = Math.round(rgb.r * (1 + percent / 100));
|
|
1351
|
+
const g = Math.round(rgb.g * (1 + percent / 100));
|
|
1352
|
+
const b = Math.round(rgb.b * (1 + percent / 100));
|
|
1353
|
+
return rgbToHex(clampNumber(r, 0, 255), clampNumber(g, 0, 255), clampNumber(b, 0, 255));
|
|
1354
|
+
}
|
|
1355
|
+
function tintColor(hex, percent) {
|
|
1356
|
+
const rgb = hexToRGB(hex);
|
|
1357
|
+
if (!rgb) return null;
|
|
1358
|
+
const r = Math.round(rgb.r + (255 - rgb.r) * (percent / 100));
|
|
1359
|
+
const g = Math.round(rgb.g + (255 - rgb.g) * (percent / 100));
|
|
1360
|
+
const b = Math.round(rgb.b + (255 - rgb.b) * (percent / 100));
|
|
1361
|
+
return rgbToHex(clampNumber(r, 0, 255), clampNumber(g, 0, 255), clampNumber(b, 0, 255));
|
|
1362
|
+
}
|
|
1363
|
+
function generateRandomColor() {
|
|
1364
|
+
const r = Math.floor(Math.random() * 256);
|
|
1365
|
+
const g = Math.floor(Math.random() * 256);
|
|
1366
|
+
const b = Math.floor(Math.random() * 256);
|
|
1367
|
+
return rgbToHex(r, g, b);
|
|
1368
|
+
}
|
|
1369
|
+
function generateRandomHexColor() {
|
|
1370
|
+
const hex = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
1371
|
+
return `#${hex}`;
|
|
1372
|
+
}
|
|
1373
|
+
function generateRandomRGBColor() {
|
|
1374
|
+
const r = Math.floor(Math.random() * 256);
|
|
1375
|
+
const g = Math.floor(Math.random() * 256);
|
|
1376
|
+
const b = Math.floor(Math.random() * 256);
|
|
1377
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
1378
|
+
}
|
|
1379
|
+
function generateRandomHSLColor() {
|
|
1380
|
+
const h = Math.floor(Math.random() * 360);
|
|
1381
|
+
const s = Math.floor(Math.random() * 100);
|
|
1382
|
+
const l = Math.floor(Math.random() * 100);
|
|
1383
|
+
return `hsl(${h}, ${s}%, ${l}%)`;
|
|
1384
|
+
}
|
|
1385
|
+
function generateRandomColorScheme(baseHex, schemeType) {
|
|
1386
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1387
|
+
if (!baseHSL) return null;
|
|
1388
|
+
const { h, s, l } = baseHSL;
|
|
1389
|
+
let scheme = [];
|
|
1390
|
+
switch (schemeType) {
|
|
1391
|
+
case "complementary":
|
|
1392
|
+
scheme.push(hslToHex((h + 180) % 360, s, l));
|
|
1393
|
+
break;
|
|
1394
|
+
case "analogous":
|
|
1395
|
+
scheme.push(hslToHex((h + 30) % 360, s, l));
|
|
1396
|
+
scheme.push(hslToHex((h - 30 + 360) % 360, s, l));
|
|
1397
|
+
break;
|
|
1398
|
+
case "triadic":
|
|
1399
|
+
scheme.push(hslToHex((h + 120) % 360, s, l));
|
|
1400
|
+
scheme.push(hslToHex((h + 240) % 360, s, l));
|
|
1401
|
+
break;
|
|
1402
|
+
case "tetradic":
|
|
1403
|
+
scheme.push(hslToHex((h + 90) % 360, s, l));
|
|
1404
|
+
scheme.push(hslToHex((h + 180) % 360, s, l));
|
|
1405
|
+
scheme.push(hslToHex((h + 270) % 360, s, l));
|
|
1406
|
+
break;
|
|
1407
|
+
}
|
|
1408
|
+
return scheme;
|
|
1409
|
+
}
|
|
1410
|
+
function generateGradientColors(startHex, endHex, steps) {
|
|
1411
|
+
const startRGB = hexToRGB(startHex);
|
|
1412
|
+
const endRGB = hexToRGB(endHex);
|
|
1413
|
+
if (!startRGB || !endRGB) return null;
|
|
1414
|
+
const gradientColors = [];
|
|
1415
|
+
for (let i = 0; i < steps; i++) {
|
|
1416
|
+
const ratio = i / (steps - 1);
|
|
1417
|
+
const r = Math.round(startRGB.r * (1 - ratio) + endRGB.r * ratio);
|
|
1418
|
+
const g = Math.round(startRGB.g * (1 - ratio) + endRGB.g * ratio);
|
|
1419
|
+
const b = Math.round(startRGB.b * (1 - ratio) + endRGB.b * ratio);
|
|
1420
|
+
gradientColors.push(rgbToHex(r, g, b));
|
|
1421
|
+
}
|
|
1422
|
+
return gradientColors;
|
|
1423
|
+
}
|
|
1424
|
+
function generateRandomGradient(steps) {
|
|
1425
|
+
const startHex = generateRandomHexColor();
|
|
1426
|
+
const endHex = generateRandomHexColor();
|
|
1427
|
+
return generateGradientColors(startHex, endHex, steps) || [];
|
|
1428
|
+
}
|
|
1429
|
+
function generateRandomColorPalette(count) {
|
|
1430
|
+
const palette = [];
|
|
1431
|
+
for (let i = 0; i < count; i++) {
|
|
1432
|
+
palette.push(generateRandomHexColor());
|
|
1433
|
+
}
|
|
1434
|
+
return palette;
|
|
1435
|
+
}
|
|
1436
|
+
function generateMonochromaticPalette(baseHex, count) {
|
|
1437
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1438
|
+
if (!baseHSL) return null;
|
|
1439
|
+
const { h, s, l } = baseHSL;
|
|
1440
|
+
const palette = [];
|
|
1441
|
+
for (let i = 0; i < count; i++) {
|
|
1442
|
+
const lightness = clampNumber(l + (i - Math.floor(count / 2)) * 10, 0, 100);
|
|
1443
|
+
palette.push(hslToHex(h, s, lightness));
|
|
1444
|
+
}
|
|
1445
|
+
return palette;
|
|
1446
|
+
}
|
|
1447
|
+
function generateAnalogousPalette(baseHex, count) {
|
|
1448
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1449
|
+
if (!baseHSL) return null;
|
|
1450
|
+
const { h, s, l } = baseHSL;
|
|
1451
|
+
const palette = [];
|
|
1452
|
+
for (let i = 0; i < count; i++) {
|
|
1453
|
+
const hue = (h + (i - Math.floor(count / 2)) * 30 + 360) % 360;
|
|
1454
|
+
palette.push(hslToHex(hue, s, l));
|
|
1455
|
+
}
|
|
1456
|
+
return palette;
|
|
1457
|
+
}
|
|
1458
|
+
function generateComplementaryPalette(baseHex) {
|
|
1459
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1460
|
+
if (!baseHSL) return null;
|
|
1461
|
+
const { h, s, l } = baseHSL;
|
|
1462
|
+
const complementaryHue = (h + 180) % 360;
|
|
1463
|
+
return [baseHex, hslToHex(complementaryHue, s, l)];
|
|
1464
|
+
}
|
|
1465
|
+
function generateTriadicPalette(baseHex) {
|
|
1466
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1467
|
+
if (!baseHSL) return null;
|
|
1468
|
+
const { h, s, l } = baseHSL;
|
|
1469
|
+
const hue1 = (h + 120) % 360;
|
|
1470
|
+
const hue2 = (h + 240) % 360;
|
|
1471
|
+
return [baseHex, hslToHex(hue1, s, l), hslToHex(hue2, s, l)];
|
|
1472
|
+
}
|
|
1473
|
+
function generateTetradicPalette(baseHex) {
|
|
1474
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1475
|
+
if (!baseHSL) return null;
|
|
1476
|
+
const { h, s, l } = baseHSL;
|
|
1477
|
+
const hue1 = (h + 90) % 360;
|
|
1478
|
+
const hue2 = (h + 180) % 360;
|
|
1479
|
+
const hue3 = (h + 270) % 360;
|
|
1480
|
+
return [baseHex, hslToHex(hue1, s, l), hslToHex(hue2, s, l), hslToHex(hue3, s, l)];
|
|
1481
|
+
}
|
|
1482
|
+
function generateRandomPastelColor() {
|
|
1483
|
+
const r = Math.floor(Math.random() * 127 + 128);
|
|
1484
|
+
const g = Math.floor(Math.random() * 127 + 128);
|
|
1485
|
+
const b = Math.floor(Math.random() * 127 + 128);
|
|
1486
|
+
return rgbToHex(r, g, b);
|
|
1487
|
+
}
|
|
1488
|
+
function generateRandomVibrantColor() {
|
|
1489
|
+
const r = Math.floor(Math.random() * 256);
|
|
1490
|
+
const g = Math.floor(Math.random() * 256);
|
|
1491
|
+
const b = Math.floor(Math.random() * 256);
|
|
1492
|
+
return rgbToHex(r, g, b);
|
|
1493
|
+
}
|
|
1494
|
+
function generateRandomMutedColor() {
|
|
1495
|
+
const r = Math.floor(Math.random() * 128 + 64);
|
|
1496
|
+
const g = Math.floor(Math.random() * 128 + 64);
|
|
1497
|
+
const b = Math.floor(Math.random() * 128 + 64);
|
|
1498
|
+
return rgbToHex(r, g, b);
|
|
1499
|
+
}
|
|
1500
|
+
function generateRandomDarkColor() {
|
|
1501
|
+
const r = Math.floor(Math.random() * 128);
|
|
1502
|
+
const g = Math.floor(Math.random() * 128);
|
|
1503
|
+
const b = Math.floor(Math.random() * 128);
|
|
1504
|
+
return rgbToHex(r, g, b);
|
|
1505
|
+
}
|
|
1506
|
+
function generateRandomLightColor() {
|
|
1507
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1508
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1509
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1510
|
+
return rgbToHex(r, g, b);
|
|
1511
|
+
}
|
|
1512
|
+
function generateRandomNeutralColor() {
|
|
1513
|
+
const gray = Math.floor(Math.random() * 256);
|
|
1514
|
+
return rgbToHex(gray, gray, gray);
|
|
1515
|
+
}
|
|
1516
|
+
function generateRandomWarmColor() {
|
|
1517
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1518
|
+
const g = Math.floor(Math.random() * 128);
|
|
1519
|
+
const b = Math.floor(Math.random() * 128);
|
|
1520
|
+
return rgbToHex(r, g, b);
|
|
1521
|
+
}
|
|
1522
|
+
function generateRandomCoolColor() {
|
|
1523
|
+
const r = Math.floor(Math.random() * 128);
|
|
1524
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1525
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1526
|
+
return rgbToHex(r, g, b);
|
|
1527
|
+
}
|
|
1528
|
+
function generateRandomEarthToneColor() {
|
|
1529
|
+
const r = Math.floor(Math.random() * 64 + 64);
|
|
1530
|
+
const g = Math.floor(Math.random() * 64 + 64);
|
|
1531
|
+
const b = Math.floor(Math.random() * 64 + 32);
|
|
1532
|
+
return rgbToHex(r, g, b);
|
|
1533
|
+
}
|
|
1534
|
+
function generateRandomMetallicColor() {
|
|
1535
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1536
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1537
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1538
|
+
return rgbToHex(r, g, b);
|
|
1539
|
+
}
|
|
1540
|
+
function generateRandomNeonColor() {
|
|
1541
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1542
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1543
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1544
|
+
return rgbToHex(r, g, b);
|
|
1545
|
+
}
|
|
1546
|
+
function generateRandomPastelPalette(count) {
|
|
1547
|
+
const palette = [];
|
|
1548
|
+
for (let i = 0; i < count; i++) {
|
|
1549
|
+
palette.push(generateRandomPastelColor());
|
|
1550
|
+
}
|
|
1551
|
+
return palette;
|
|
1552
|
+
}
|
|
1553
|
+
function generateRandomVibrantPalette(count) {
|
|
1554
|
+
const palette = [];
|
|
1555
|
+
for (let i = 0; i < count; i++) {
|
|
1556
|
+
palette.push(generateRandomVibrantColor());
|
|
1557
|
+
}
|
|
1558
|
+
return palette;
|
|
1559
|
+
}
|
|
1560
|
+
function generateRandomMutedPalette(count) {
|
|
1561
|
+
const palette = [];
|
|
1562
|
+
for (let i = 0; i < count; i++) {
|
|
1563
|
+
palette.push(generateRandomMutedColor());
|
|
1564
|
+
}
|
|
1565
|
+
return palette;
|
|
1566
|
+
}
|
|
1567
|
+
function generateRandomDarkPalette(count) {
|
|
1568
|
+
const palette = [];
|
|
1569
|
+
for (let i = 0; i < count; i++) {
|
|
1570
|
+
palette.push(generateRandomDarkColor());
|
|
1571
|
+
}
|
|
1572
|
+
return palette;
|
|
1573
|
+
}
|
|
1574
|
+
function generateRandomLightPalette(count) {
|
|
1575
|
+
const palette = [];
|
|
1576
|
+
for (let i = 0; i < count; i++) {
|
|
1577
|
+
palette.push(generateRandomLightColor());
|
|
1578
|
+
}
|
|
1579
|
+
return palette;
|
|
1580
|
+
}
|
|
1581
|
+
function generateRandomNeutralPalette(count) {
|
|
1582
|
+
const palette = [];
|
|
1583
|
+
for (let i = 0; i < count; i++) {
|
|
1584
|
+
palette.push(generateRandomNeutralColor());
|
|
1585
|
+
}
|
|
1586
|
+
return palette;
|
|
1587
|
+
}
|
|
1588
|
+
function generateRandomWarmPalette(count) {
|
|
1589
|
+
const palette = [];
|
|
1590
|
+
for (let i = 0; i < count; i++) {
|
|
1591
|
+
palette.push(generateRandomWarmColor());
|
|
1592
|
+
}
|
|
1593
|
+
return palette;
|
|
1594
|
+
}
|
|
1595
|
+
function generateRandomCoolPalette(count) {
|
|
1596
|
+
const palette = [];
|
|
1597
|
+
for (let i = 0; i < count; i++) {
|
|
1598
|
+
palette.push(generateRandomCoolColor());
|
|
1599
|
+
}
|
|
1600
|
+
return palette;
|
|
1601
|
+
}
|
|
1602
|
+
function generateRandomEarthTonePalette(count) {
|
|
1603
|
+
const palette = [];
|
|
1604
|
+
for (let i = 0; i < count; i++) {
|
|
1605
|
+
palette.push(generateRandomEarthToneColor());
|
|
1606
|
+
}
|
|
1607
|
+
return palette;
|
|
1608
|
+
}
|
|
1609
|
+
function generateRandomMetallicPalette(count) {
|
|
1610
|
+
const palette = [];
|
|
1611
|
+
for (let i = 0; i < count; i++) {
|
|
1612
|
+
palette.push(generateRandomMetallicColor());
|
|
1613
|
+
}
|
|
1614
|
+
return palette;
|
|
1615
|
+
}
|
|
1616
|
+
function generateRandomNeonPalette(count) {
|
|
1617
|
+
const palette = [];
|
|
1618
|
+
for (let i = 0; i < count; i++) {
|
|
1619
|
+
palette.push(generateRandomNeonColor());
|
|
1620
|
+
}
|
|
1621
|
+
return palette;
|
|
1622
|
+
}
|
|
1623
|
+
function pxToRem(px, base = 16) {
|
|
1624
|
+
return `${px / base}rem`;
|
|
1625
|
+
}
|
|
1626
|
+
function remToPx(rem, base = 16) {
|
|
1627
|
+
const remValue = parseFloat(rem);
|
|
1628
|
+
return remValue * base;
|
|
1629
|
+
}
|
|
1630
|
+
function pxToEm(px, base = 16) {
|
|
1631
|
+
return `${px / base}em`;
|
|
1632
|
+
}
|
|
1633
|
+
function emToPx(em, base = 16) {
|
|
1634
|
+
const emValue = parseFloat(em);
|
|
1635
|
+
return emValue * base;
|
|
1636
|
+
}
|
|
1637
|
+
function pxToPercent(px, total) {
|
|
1638
|
+
return `${px / total * 100}%`;
|
|
1639
|
+
}
|
|
1640
|
+
function percentToPx(percent, total) {
|
|
1641
|
+
const percentValue = parseFloat(percent);
|
|
1642
|
+
return percentValue / 100 * total;
|
|
1643
|
+
}
|
|
1644
|
+
function remToEm(rem, base = 16) {
|
|
1645
|
+
const remValue = parseFloat(rem);
|
|
1646
|
+
return `${remValue}em`;
|
|
1647
|
+
}
|
|
1648
|
+
function generateUniqueId(length = 8) {
|
|
1649
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1650
|
+
let id = "";
|
|
1651
|
+
for (let i = 0; i < length; i++) {
|
|
1652
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1653
|
+
}
|
|
1654
|
+
return id;
|
|
1655
|
+
}
|
|
1656
|
+
function generateUUID() {
|
|
1657
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
1658
|
+
const r = Math.random() * 16 | 0;
|
|
1659
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
1660
|
+
return v.toString(16);
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
function generateShortId(length = 6) {
|
|
1664
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1665
|
+
let id = "";
|
|
1666
|
+
for (let i = 0; i < length; i++) {
|
|
1667
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1668
|
+
}
|
|
1669
|
+
return id;
|
|
1670
|
+
}
|
|
1671
|
+
function generateNanoId(length = 21) {
|
|
1672
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
|
|
1673
|
+
let id = "";
|
|
1674
|
+
for (let i = 0; i < length; i++) {
|
|
1675
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1676
|
+
}
|
|
1677
|
+
return id;
|
|
1678
|
+
}
|
|
1679
|
+
function generateRandomString(length = 10) {
|
|
1680
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1681
|
+
let str = "";
|
|
1682
|
+
for (let i = 0; i < length; i++) {
|
|
1683
|
+
str += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1684
|
+
}
|
|
1685
|
+
return str;
|
|
1686
|
+
}
|
|
1687
|
+
function generateRandomHexId(length = 16) {
|
|
1688
|
+
const chars = "abcdef0123456789";
|
|
1689
|
+
let id = "";
|
|
1690
|
+
for (let i = 0; i < length; i++) {
|
|
1691
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1692
|
+
}
|
|
1693
|
+
return id;
|
|
1694
|
+
}
|
|
1695
|
+
function generateRandomNumericId(length = 8) {
|
|
1696
|
+
const chars = "0123456789";
|
|
1697
|
+
let id = "";
|
|
1698
|
+
for (let i = 0; i < length; i++) {
|
|
1699
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1700
|
+
}
|
|
1701
|
+
return id;
|
|
1702
|
+
}
|
|
1703
|
+
function generateRandomAlphaId(length = 8) {
|
|
1704
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
1705
|
+
let id = "";
|
|
1706
|
+
for (let i = 0; i < length; i++) {
|
|
1707
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1708
|
+
}
|
|
1709
|
+
return id;
|
|
1710
|
+
}
|
|
1711
|
+
function generateRandomAlphanumericId(length = 8) {
|
|
1712
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1713
|
+
let id = "";
|
|
1714
|
+
for (let i = 0; i < length; i++) {
|
|
1715
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1716
|
+
}
|
|
1717
|
+
return id;
|
|
1718
|
+
}
|
|
1719
|
+
function generateRandomBase64Id(length = 12) {
|
|
1720
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1721
|
+
let id = "";
|
|
1722
|
+
for (let i = 0; i < length; i++) {
|
|
1723
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1724
|
+
}
|
|
1725
|
+
return id;
|
|
1726
|
+
}
|
|
1727
|
+
function generateRandomUrlSafeId(length = 12) {
|
|
1728
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
1729
|
+
let id = "";
|
|
1730
|
+
for (let i = 0; i < length; i++) {
|
|
1731
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1732
|
+
}
|
|
1733
|
+
return id;
|
|
1734
|
+
}
|
|
1735
|
+
function generateRandomSlug(length = 8) {
|
|
1736
|
+
const chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
1737
|
+
let slug = "";
|
|
1738
|
+
for (let i = 0; i < length; i++) {
|
|
1739
|
+
slug += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1740
|
+
}
|
|
1741
|
+
return slug;
|
|
1742
|
+
}
|
|
1743
|
+
function generateRandomToken(length = 32) {
|
|
1744
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1745
|
+
let token = "";
|
|
1746
|
+
for (let i = 0; i < length; i++) {
|
|
1747
|
+
token += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1748
|
+
}
|
|
1749
|
+
return token;
|
|
1750
|
+
}
|
|
1751
|
+
function generateRandomApiKey(length = 32) {
|
|
1752
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1753
|
+
let apiKey = "";
|
|
1754
|
+
for (let i = 0; i < length; i++) {
|
|
1755
|
+
apiKey += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1756
|
+
}
|
|
1757
|
+
return apiKey;
|
|
1758
|
+
}
|
|
1759
|
+
function generateRandomSessionId(length = 24) {
|
|
1760
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1761
|
+
let sessionId = "";
|
|
1762
|
+
for (let i = 0; i < length; i++) {
|
|
1763
|
+
sessionId += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1764
|
+
}
|
|
1765
|
+
return sessionId;
|
|
1766
|
+
}
|
|
1767
|
+
function generateRandomPassword(length = 12) {
|
|
1768
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=";
|
|
1769
|
+
let password = "";
|
|
1770
|
+
for (let i = 0; i < length; i++) {
|
|
1771
|
+
password += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1772
|
+
}
|
|
1773
|
+
return password;
|
|
1774
|
+
}
|
|
1775
|
+
function generateRandomUsername(length = 8) {
|
|
1776
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1777
|
+
let username = "";
|
|
1778
|
+
for (let i = 0; i < length; i++) {
|
|
1779
|
+
username += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1780
|
+
}
|
|
1781
|
+
return username;
|
|
1782
|
+
}
|
|
1783
|
+
function generateRandomEmail(length = 8) {
|
|
1784
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1785
|
+
let email = "";
|
|
1786
|
+
for (let i = 0; i < length; i++) {
|
|
1787
|
+
email += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1788
|
+
}
|
|
1789
|
+
return `${email.toLowerCase()}@example.com`;
|
|
1790
|
+
}
|
|
1791
|
+
function generateRandomDomain(length = 8) {
|
|
1792
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1793
|
+
let domain = "";
|
|
1794
|
+
for (let i = 0; i < length; i++) {
|
|
1795
|
+
domain += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1796
|
+
}
|
|
1797
|
+
return `${domain.toLowerCase()}.com`;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
// src/utils/date.ts
|
|
1801
|
+
var dtxParse = (value) => {
|
|
1802
|
+
if (!value) return /* @__PURE__ */ new Date();
|
|
1803
|
+
if (value instanceof Date) {
|
|
1804
|
+
return new Date(value);
|
|
1805
|
+
}
|
|
1806
|
+
return new Date(value);
|
|
1807
|
+
};
|
|
1808
|
+
var date = (value, dateFormat) => {
|
|
1809
|
+
const _dtx = dtxParse(value);
|
|
1810
|
+
const { locale, options } = dateFormat || {};
|
|
1811
|
+
const parts = new Intl.DateTimeFormat(locale || "EN", options).formatToParts(_dtx);
|
|
1812
|
+
const month = _dtx.getMonth();
|
|
1813
|
+
return {
|
|
1814
|
+
date: _dtx,
|
|
1815
|
+
month,
|
|
1816
|
+
parts,
|
|
1817
|
+
getDateSplit: (value2) => {
|
|
1818
|
+
if (!value2) return null;
|
|
1819
|
+
const [month2, year] = value2?.split("-").map(Number);
|
|
1820
|
+
return { year, month: month2 };
|
|
1821
|
+
},
|
|
1822
|
+
// MONTH
|
|
1823
|
+
getMonth: () => _dtx.getMonth(),
|
|
1824
|
+
getMonthFormat: (month2) => new Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit" }).format(_dtx.setMonth(month2)),
|
|
1825
|
+
getMonthsFormat: () => times(12, (i) => new Intl.DateTimeFormat(locale, { month: "short" }).format(_dtx.setMonth(i))),
|
|
1826
|
+
setMonth: (month2) => new Date(_dtx.setMonth(month2)),
|
|
1827
|
+
addMonth: (month2) => new Date(_dtx.setMonth(_dtx.getMonth() + month2)),
|
|
1828
|
+
subtractMonth: (month2) => new Date(_dtx.setMonth(_dtx.getMonth() - month2)),
|
|
1829
|
+
diferenceMonths: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24 * 30)),
|
|
1830
|
+
isSameMonth: (date2) => _dtx.getFullYear() === date2.getFullYear() && _dtx.getMonth() === date2.getMonth(),
|
|
1831
|
+
// YEAR
|
|
1832
|
+
setYear: (year) => new Date(_dtx.setFullYear(year)),
|
|
1833
|
+
getUTCYear: () => _dtx.getUTCFullYear(),
|
|
1834
|
+
addYears: (year) => new Date(_dtx.setFullYear(_dtx.getFullYear() + year)),
|
|
1835
|
+
subtractYears: (year) => new Date(_dtx.setFullYear(_dtx.getFullYear() - year)),
|
|
1836
|
+
diferenceYears: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24 * 365)),
|
|
1837
|
+
isSameYear: (date2) => _dtx.getFullYear() === date2.getFullYear(),
|
|
1838
|
+
// DAYS
|
|
1839
|
+
setDay: (day) => new Date(_dtx.setDate(day)),
|
|
1840
|
+
addDays: (days) => new Date(_dtx.setDate(_dtx.getDate() + days)),
|
|
1841
|
+
getDay: () => _dtx.getDate(),
|
|
1842
|
+
subtractDays: (days) => new Date(_dtx.setDate(_dtx.getDate() - days)),
|
|
1843
|
+
diferenceDays: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24)),
|
|
1844
|
+
isSameDay: (date2) => _dtx.getFullYear() === date2.getFullYear(),
|
|
1845
|
+
// HOURS
|
|
1846
|
+
addHours: (hours) => new Date(_dtx.setHours(_dtx.getHours() + hours)),
|
|
1847
|
+
setHours: (hours) => new Date(_dtx.setHours(hours)),
|
|
1848
|
+
getHours: () => _dtx.getHours(),
|
|
1849
|
+
subtractHours: (hours) => new Date(_dtx.setHours(_dtx.getHours() - hours)),
|
|
1850
|
+
diferenceHours: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60)),
|
|
1851
|
+
// MINUTES
|
|
1852
|
+
addMinutes: (minutes) => new Date(_dtx.setMinutes(_dtx.getMinutes() + minutes)),
|
|
1853
|
+
setMinutes: (minutes) => new Date(_dtx.setMinutes(minutes)),
|
|
1854
|
+
getMinutes: () => _dtx.getMinutes(),
|
|
1855
|
+
subtractMinutes: (minutes) => new Date(_dtx.setMinutes(_dtx.getMinutes() - minutes)),
|
|
1856
|
+
diferenceMinutes: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60)),
|
|
1857
|
+
// SECONDS
|
|
1858
|
+
addSeconds: (seconds) => new Date(_dtx.setSeconds(_dtx.getSeconds() + seconds)),
|
|
1859
|
+
setSeconds: (seconds) => new Date(_dtx.setSeconds(seconds)),
|
|
1860
|
+
getSeconds: () => _dtx.getSeconds(),
|
|
1861
|
+
subtractSeconds: (seconds) => new Date(_dtx.setSeconds(_dtx.getSeconds() - seconds)),
|
|
1862
|
+
diferenceSeconds: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / 1e3),
|
|
1863
|
+
// Utils
|
|
1864
|
+
isToday: () => _dtx.getDate() === (/* @__PURE__ */ new Date()).getDate(),
|
|
1865
|
+
isAfter: (date2) => _dtx.getTime() > new Date(date2).getTime(),
|
|
1866
|
+
isBefore: (date2) => _dtx.getTime() < new Date(date2).getTime(),
|
|
1867
|
+
formatLastMonth: () => {
|
|
1868
|
+
const data = _dtx.setMonth(month - 1);
|
|
1869
|
+
const response = Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit", year: options?.year || "numeric" }).formatToParts(data);
|
|
1870
|
+
return response.map((part) => {
|
|
1871
|
+
if (part.type === "literal") {
|
|
1872
|
+
return "-";
|
|
137
1873
|
}
|
|
138
|
-
|
|
1874
|
+
return part.value;
|
|
1875
|
+
}).join("");
|
|
1876
|
+
},
|
|
1877
|
+
formatPrevMonth: () => {
|
|
1878
|
+
const data = _dtx.setMonth(month + 1);
|
|
1879
|
+
const response = Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit", year: options?.year || "numeric" }).formatToParts(data);
|
|
1880
|
+
return response.map((part) => {
|
|
1881
|
+
if (part.type === "literal") {
|
|
1882
|
+
return "-";
|
|
1883
|
+
}
|
|
1884
|
+
return part.value;
|
|
1885
|
+
}).join("");
|
|
1886
|
+
},
|
|
1887
|
+
getDaysInYear: () => new Date(_dtx.getFullYear(), 11, 31).getDate(),
|
|
1888
|
+
getDaysInMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth() + 1, 0).getDate(),
|
|
1889
|
+
getDayOfWeek: () => _dtx.getDay(),
|
|
1890
|
+
getDayOfYear: () => Math.ceil((_dtx.getTime() - new Date(_dtx.getFullYear(), 0, 1).getTime()) / (1e3 * 60 * 60 * 24) + 1),
|
|
1891
|
+
getWeekOfYear: () => Math.ceil(((_dtx.getTime() - new Date(_dtx.getFullYear(), 0, 1).getTime()) / (1e3 * 60 * 60 * 24) + 1) / 7),
|
|
1892
|
+
getStartOfDay: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate()),
|
|
1893
|
+
getEndOfDay: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate(), 23, 59, 59, 999),
|
|
1894
|
+
getStartOfMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), 1),
|
|
1895
|
+
getEndOfMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth() + 1, 0, 23, 59, 59, 999),
|
|
1896
|
+
getStartOfYear: () => new Date(_dtx.getFullYear(), 0, 1),
|
|
1897
|
+
getEndOfYear: () => new Date(_dtx.getFullYear(), 11, 31, 23, 59, 59, 999),
|
|
1898
|
+
isLeapYear: () => _dtx.getFullYear() % 4 === 0 && _dtx.getFullYear() % 100 !== 0 || _dtx.getFullYear() % 400 === 0,
|
|
1899
|
+
isWeekend: () => {
|
|
1900
|
+
const day = _dtx.getDay();
|
|
1901
|
+
return day === 0 || day === 6;
|
|
1902
|
+
},
|
|
1903
|
+
isTomorrow: () => {
|
|
1904
|
+
const tomorrow = /* @__PURE__ */ new Date();
|
|
1905
|
+
tomorrow.setDate((/* @__PURE__ */ new Date()).getDate() + 1);
|
|
1906
|
+
return _dtx.getDate() === tomorrow.getDate() && _dtx.getMonth() === tomorrow.getMonth() && _dtx.getFullYear() === tomorrow.getFullYear();
|
|
1907
|
+
},
|
|
1908
|
+
// FORMATS
|
|
1909
|
+
formatDateWithLocale: (locale2, options2) => _dtx.toLocaleDateString(locale2, options2),
|
|
1910
|
+
formatTimeWithLocale: (locale2, options2) => _dtx.toLocaleTimeString(locale2, options2),
|
|
1911
|
+
formatDateTimeWithLocale: (locale2, options2) => _dtx.toLocaleString(locale2, options2),
|
|
1912
|
+
getDayOfWeekWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { weekday: options?.weekday || "long" }),
|
|
1913
|
+
getMonthNameWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { month: options?.month || "long" }),
|
|
1914
|
+
getYearWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { year: options?.year || "numeric" }),
|
|
1915
|
+
getHourWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { hour: options?.hour || "2-digit" }),
|
|
1916
|
+
getMinuteWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { minute: options?.minute || "2-digit" }),
|
|
1917
|
+
getSecondWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { second: options?.second || "2-digit" }),
|
|
1918
|
+
getDayOfYearWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { day: options?.day || "numeric" }),
|
|
1919
|
+
getTimezoneOffset: () => _dtx.getTimezoneOffset(),
|
|
1920
|
+
convertToTimezone: (timezone) => {
|
|
1921
|
+
const utcDate = new Date(_dtx.getTime() + _dtx.getTimezoneOffset() * 6e4);
|
|
1922
|
+
const tzDate = new Date(utcDate.toLocaleString(locale, { timeZone: timezone }));
|
|
1923
|
+
return tzDate;
|
|
1924
|
+
},
|
|
1925
|
+
toDate() {
|
|
1926
|
+
return dtxParse(_dtx);
|
|
1927
|
+
},
|
|
1928
|
+
Timestamp() {
|
|
1929
|
+
return _dtx.getTime();
|
|
1930
|
+
},
|
|
1931
|
+
ISO: () => {
|
|
1932
|
+
return _dtx.toISOString();
|
|
1933
|
+
},
|
|
1934
|
+
UNIX() {
|
|
1935
|
+
return Math.floor(_dtx.getTime() / 1e3);
|
|
1936
|
+
},
|
|
1937
|
+
UTC() {
|
|
1938
|
+
return new Date(Date.UTC(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate(), _dtx.getHours(), _dtx.getMinutes(), _dtx.getSeconds()));
|
|
1939
|
+
},
|
|
1940
|
+
UTCHours() {
|
|
1941
|
+
return _dtx.getUTCHours();
|
|
1942
|
+
},
|
|
1943
|
+
UTCMinutes() {
|
|
1944
|
+
return _dtx.getUTCMinutes();
|
|
1945
|
+
},
|
|
1946
|
+
UTCSeconds() {
|
|
1947
|
+
return _dtx.getUTCSeconds();
|
|
1948
|
+
},
|
|
1949
|
+
UTCMilliseconds() {
|
|
1950
|
+
return _dtx.getUTCMilliseconds();
|
|
1951
|
+
},
|
|
1952
|
+
UTCWeekendDay() {
|
|
1953
|
+
return _dtx.getUTCDay();
|
|
1954
|
+
},
|
|
1955
|
+
UTCDay() {
|
|
1956
|
+
return _dtx.getUTCDate();
|
|
1957
|
+
},
|
|
1958
|
+
UTCMonth() {
|
|
1959
|
+
return _dtx.getUTCMonth();
|
|
1960
|
+
},
|
|
1961
|
+
UTCFullYear() {
|
|
1962
|
+
return _dtx.getUTCFullYear();
|
|
139
1963
|
}
|
|
140
|
-
return classes.join(" ");
|
|
141
1964
|
};
|
|
142
1965
|
};
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
1966
|
+
var dtx = (value, dateFormat) => {
|
|
1967
|
+
const date2 = dtxParse(value);
|
|
1968
|
+
const { locale, options } = dateFormat || {};
|
|
1969
|
+
return {
|
|
1970
|
+
date: date2,
|
|
1971
|
+
isToday() {
|
|
1972
|
+
const today = /* @__PURE__ */ new Date();
|
|
1973
|
+
return date2.getDate() === today.getDate() && date2.getMonth() === today.getMonth() && date2.getFullYear() === today.getFullYear();
|
|
1974
|
+
},
|
|
1975
|
+
isAfter(other) {
|
|
1976
|
+
return date2.getTime() > dtxParse(other).getTime();
|
|
1977
|
+
},
|
|
1978
|
+
isBefore(other) {
|
|
1979
|
+
return date2.getTime() < dtxParse(other).getTime();
|
|
1980
|
+
},
|
|
1981
|
+
format(locale2 = "it-IT", options2) {
|
|
1982
|
+
return new Intl.DateTimeFormat(
|
|
1983
|
+
locale2,
|
|
1984
|
+
options2
|
|
1985
|
+
).format(date2);
|
|
1986
|
+
},
|
|
1987
|
+
setDate(month, day) {
|
|
1988
|
+
const copy = new Date(date2);
|
|
1989
|
+
copy.setMonth(month);
|
|
1990
|
+
copy.setDate(day);
|
|
1991
|
+
return dtx(copy);
|
|
1992
|
+
},
|
|
1993
|
+
addDate(days) {
|
|
1994
|
+
const copy = new Date(date2);
|
|
1995
|
+
copy.setDate(copy.getDate() + days);
|
|
1996
|
+
return dtx(copy);
|
|
1997
|
+
},
|
|
1998
|
+
addDays(days) {
|
|
1999
|
+
const copy = new Date(date2);
|
|
2000
|
+
copy.setDate(copy.getDate() + days);
|
|
2001
|
+
return dtx(copy);
|
|
2002
|
+
},
|
|
2003
|
+
setDay(days) {
|
|
2004
|
+
const copy = new Date(date2);
|
|
2005
|
+
copy.setDate(days);
|
|
2006
|
+
return dtx(copy);
|
|
2007
|
+
},
|
|
2008
|
+
dayStart: () => {
|
|
2009
|
+
const firstDayOfMonth = new Date(date2.getFullYear(), date2.getMonth(), 1);
|
|
2010
|
+
return firstDayOfMonth.getDay();
|
|
2011
|
+
},
|
|
2012
|
+
days: new Date(date2.getFullYear(), date2.getMonth() + 1, 0).getDate(),
|
|
2013
|
+
getCurrentUTCDay: () => {
|
|
2014
|
+
const utcDate = new Date((/* @__PURE__ */ new Date()).toUTCString());
|
|
2015
|
+
return utcDate.getDay();
|
|
2016
|
+
},
|
|
2017
|
+
CalendarDaysInMonth(year, month) {
|
|
2018
|
+
return new Date(year, month + 1, 0).getDate();
|
|
2019
|
+
},
|
|
2020
|
+
isWeekend: (day) => {
|
|
2021
|
+
const date3 = /* @__PURE__ */ new Date();
|
|
2022
|
+
date3.setDate(day);
|
|
2023
|
+
const dayOfWeek = date3.getDay();
|
|
2024
|
+
return dayOfWeek === 0 || dayOfWeek === 6;
|
|
2025
|
+
},
|
|
2026
|
+
addMonth(months) {
|
|
2027
|
+
const copy = new Date(date2);
|
|
2028
|
+
copy.setMonth(copy.getMonth() + months);
|
|
2029
|
+
return dtx(copy);
|
|
2030
|
+
},
|
|
2031
|
+
setMonth(month) {
|
|
2032
|
+
const copy = new Date(date2);
|
|
2033
|
+
copy.setMonth(month);
|
|
2034
|
+
return dtx(copy);
|
|
2035
|
+
},
|
|
2036
|
+
isMonth: (month) => month === (/* @__PURE__ */ new Date()).getMonth(),
|
|
2037
|
+
startOfMonth() {
|
|
2038
|
+
return dtx(
|
|
2039
|
+
new Date(
|
|
2040
|
+
date2.getFullYear(),
|
|
2041
|
+
date2.getMonth(),
|
|
2042
|
+
1
|
|
2043
|
+
)
|
|
2044
|
+
);
|
|
2045
|
+
},
|
|
2046
|
+
endOfMonth() {
|
|
2047
|
+
return dtx(
|
|
2048
|
+
new Date(
|
|
2049
|
+
date2.getFullYear(),
|
|
2050
|
+
date2.getMonth() + 1,
|
|
2051
|
+
0
|
|
2052
|
+
)
|
|
2053
|
+
);
|
|
2054
|
+
},
|
|
2055
|
+
getMonthsLocale(locale2 = "EN") {
|
|
2056
|
+
return times(12, (i) => new Intl.DateTimeFormat(locale2, { month: options?.month || "short" }).format(new Date(2e3, i, 1)));
|
|
2057
|
+
},
|
|
2058
|
+
toDate() {
|
|
2059
|
+
return new Date(date2);
|
|
2060
|
+
},
|
|
2061
|
+
toISOString() {
|
|
2062
|
+
return date2.toISOString();
|
|
2063
|
+
},
|
|
2064
|
+
CalendarYearFormat(year, format = "YYYY") {
|
|
2065
|
+
return Intl.DateTimeFormat(dateFormat?.locale, { year: format === "YYYY" ? "numeric" : "2-digit" }).format(new Date(year, 0, 1));
|
|
2066
|
+
},
|
|
2067
|
+
calendar: (props) => {
|
|
2068
|
+
const { dtx: dtx2, month, day, data, selected } = props || {};
|
|
2069
|
+
return {
|
|
2070
|
+
day,
|
|
2071
|
+
date: dtx2.toDate(),
|
|
2072
|
+
iso: dtx2.toISOString(),
|
|
2073
|
+
month,
|
|
2074
|
+
key: dtx2.format(locale || "EN", { month: "2-digit", day: "2-digit", year: "numeric" }).replace(/\//g, "-"),
|
|
2075
|
+
monthName: dtx2.format(locale || "EN", { month: options?.month || "short" }),
|
|
2076
|
+
isToday: dtx2.isToday(),
|
|
2077
|
+
isPast: dtx2.isBefore(/* @__PURE__ */ new Date()),
|
|
2078
|
+
isFuture: dtx2.isAfter(/* @__PURE__ */ new Date()),
|
|
2079
|
+
isCurrentMonth: dtx2.isMonth(month),
|
|
2080
|
+
selected: selected?.day === day || false,
|
|
2081
|
+
data: data || null
|
|
2082
|
+
};
|
|
149
2083
|
}
|
|
150
|
-
|
|
151
|
-
}).join(" ");
|
|
2084
|
+
};
|
|
152
2085
|
};
|
|
153
2086
|
|
|
154
2087
|
// src/utils/calendar.ts
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
159
|
-
const today = (0, import_dayjs.default)().startOf("day");
|
|
160
|
-
const startOfMonth = (0, import_dayjs.default)().year(year).month(month).startOf("month");
|
|
161
|
-
const endOfMonth = (0, import_dayjs.default)().year(year).month(month).endOf("month");
|
|
2088
|
+
function getMonthCalendar(dataFormat, year, month, startIndex, selected, props) {
|
|
2089
|
+
const { locale, days } = dataFormat || {};
|
|
2090
|
+
const _date = dtx(new Date(year, month, 1), dataFormat);
|
|
162
2091
|
let dayCurrent = {};
|
|
163
|
-
let startDay =
|
|
2092
|
+
let startDay = _date.dayStart();
|
|
164
2093
|
startDay = startDay === 0 ? 6 : startDay - 1;
|
|
165
|
-
const daysInMonth =
|
|
2094
|
+
const daysInMonth = _date.days;
|
|
166
2095
|
const calendar = [];
|
|
167
2096
|
let week = [];
|
|
168
2097
|
for (let i = 0; i < startDay; i++) {
|
|
169
2098
|
week.push(null);
|
|
170
2099
|
}
|
|
171
2100
|
for (let day = 1; day <= daysInMonth; day++) {
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
const isToday = date.isSame(today, "day");
|
|
175
|
-
const isPast = date.isBefore(today, "day");
|
|
176
|
-
const isFuture = date.isAfter(today, "day");
|
|
177
|
-
if (date.isSame(today, "day")) {
|
|
178
|
-
dayCurrent = {
|
|
179
|
-
day,
|
|
180
|
-
date,
|
|
181
|
-
isToday,
|
|
182
|
-
isPast,
|
|
183
|
-
isFuture,
|
|
184
|
-
isCurrentMonth: true,
|
|
185
|
-
selected: true,
|
|
186
|
-
data: props ? props[key] || null : null
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
week.push({
|
|
190
|
-
day,
|
|
191
|
-
date,
|
|
192
|
-
isToday,
|
|
193
|
-
isPast,
|
|
194
|
-
isFuture,
|
|
195
|
-
isCurrentMonth: true,
|
|
196
|
-
selected: selected ? date.isSame(selected?.date, "day") : false,
|
|
197
|
-
data: props ? props[key] || null : null
|
|
198
|
-
});
|
|
2101
|
+
const key = _date.format(dataFormat.locale || "EN", { day: "2-digit", month: "2-digit", year: "numeric" });
|
|
2102
|
+
week.push(_date.calendar({ dtx: _date.setDate(month, day), month, day, data: [], selected, key }));
|
|
199
2103
|
if (week.length === 7) {
|
|
200
2104
|
calendar.push(week);
|
|
201
2105
|
week = [];
|
|
@@ -217,40 +2121,83 @@ function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
|
217
2121
|
return {
|
|
218
2122
|
calendar,
|
|
219
2123
|
month,
|
|
220
|
-
date:
|
|
221
|
-
daysContainer: getDaysContainer(),
|
|
222
|
-
monthLabel:
|
|
223
|
-
yearLabel:
|
|
224
|
-
days:
|
|
2124
|
+
date: _date.toDate(),
|
|
2125
|
+
daysContainer: getDaysContainer().map((i) => ({ label: isEmpty(days) ? i : days?.[i], value: i })),
|
|
2126
|
+
monthLabel: _date.getMonthsLocale(locale)[month],
|
|
2127
|
+
yearLabel: _date.CalendarYearFormat(year),
|
|
2128
|
+
days: _date.CalendarDaysInMonth(year, month),
|
|
225
2129
|
weeks: calendar.length,
|
|
226
|
-
isWeekend:
|
|
2130
|
+
isWeekend: _date.isWeekend(_date.getCurrentUTCDay()),
|
|
227
2131
|
selected: selected ? Object.assign({}, selected) : null,
|
|
228
|
-
currentDay: dayCurrent
|
|
2132
|
+
currentDay: dayCurrent,
|
|
2133
|
+
props
|
|
229
2134
|
};
|
|
230
2135
|
}
|
|
231
|
-
function
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
2136
|
+
function findMonth(value, years, exclude, direction) {
|
|
2137
|
+
if (!value) return null;
|
|
2138
|
+
let [month, year] = value.split("-").map(Number);
|
|
2139
|
+
month -= 1;
|
|
2140
|
+
const excludedMap = /* @__PURE__ */ new Map();
|
|
2141
|
+
exclude.forEach((item) => {
|
|
2142
|
+
excludedMap.set(
|
|
2143
|
+
item.year,
|
|
2144
|
+
new Set(item.months)
|
|
2145
|
+
);
|
|
235
2146
|
});
|
|
236
|
-
|
|
2147
|
+
const sortedYears = [...years].sort((a, b) => a - b);
|
|
2148
|
+
while (true) {
|
|
2149
|
+
month += direction === "next" ? 1 : -1;
|
|
2150
|
+
if (month > 11) {
|
|
2151
|
+
const yearIndex = sortedYears.indexOf(year);
|
|
2152
|
+
const nextYear = sortedYears[yearIndex + 1];
|
|
2153
|
+
if (nextYear == null) {
|
|
2154
|
+
return null;
|
|
2155
|
+
}
|
|
2156
|
+
year = nextYear;
|
|
2157
|
+
month = 0;
|
|
2158
|
+
}
|
|
2159
|
+
if (month < 0) {
|
|
2160
|
+
const yearIndex = sortedYears.indexOf(year);
|
|
2161
|
+
const prevYear = sortedYears[yearIndex - 1];
|
|
2162
|
+
if (prevYear == null) {
|
|
2163
|
+
return null;
|
|
2164
|
+
}
|
|
2165
|
+
year = prevYear;
|
|
2166
|
+
month = 11;
|
|
2167
|
+
}
|
|
2168
|
+
const excluded = excludedMap.get(year)?.has(month);
|
|
2169
|
+
if (!excluded) {
|
|
2170
|
+
return `${String(month + 1).padStart(2, "0")}-${year}`;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
function getMonthCalendarProps({ year, data, value, format }) {
|
|
2175
|
+
const dtx2 = date(new Date(year, 1.1), format);
|
|
2176
|
+
const s = dtx2.getDateSplit(value);
|
|
2177
|
+
const months = dtx2.getMonthsFormat();
|
|
2178
|
+
const r = dtx2.getDateSplit(value);
|
|
2179
|
+
const smonths = times(
|
|
2180
|
+
months.length,
|
|
2181
|
+
(i) => ({
|
|
2182
|
+
year,
|
|
2183
|
+
label: upperCase(months[i]),
|
|
2184
|
+
value: dtx2.getMonthFormat(i),
|
|
2185
|
+
disabled: dtx2.isAfter(new Date(year, i)) || !!data.exclude.find((e) => e.year === year)?.months.includes(i),
|
|
2186
|
+
selected: !data.selected ? false : r?.month === i + 1 && r?.year === year
|
|
2187
|
+
})
|
|
2188
|
+
);
|
|
2189
|
+
const resolve = {
|
|
237
2190
|
year,
|
|
238
|
-
startIndex,
|
|
2191
|
+
startIndex: dtx2.getMonth(),
|
|
239
2192
|
years: data.years,
|
|
240
2193
|
value,
|
|
241
|
-
|
|
242
|
-
prev: !value ? "" : (0, import_dayjs.default)().year(Number(value?.split("-")[1])).month(Number(value?.split("-")[0])).format("MM-YYYY"),
|
|
243
|
-
months: Array.from({ length: 12 }, (_, i) => ({
|
|
244
|
-
label: (0, import_dayjs.default)().month(i).format(daysFormat?.month || "MMM"),
|
|
245
|
-
value: (0, import_dayjs.default)().month(i).format(daysFormat?.value || "MM"),
|
|
246
|
-
disabled: (0, import_dayjs.default)().year(year).month(i).isAfter((0, import_dayjs.default)(), "month") || data.exclude.find((e) => e.year === year)?.months.includes(i),
|
|
247
|
-
selected: !data.selected ? false : (0, import_dayjs.default)().year(year).month(Number(value?.split("-")[0]) - 1).format("MM") === (0, import_dayjs.default)().month(i).format(daysFormat?.value || "MM")
|
|
248
|
-
}))
|
|
2194
|
+
months: smonths
|
|
249
2195
|
};
|
|
2196
|
+
return resolve;
|
|
250
2197
|
}
|
|
251
2198
|
|
|
252
2199
|
// src/utils/color.ts
|
|
253
|
-
var
|
|
2200
|
+
var rgbToHex2 = (r, g, b) => {
|
|
254
2201
|
return "#" + [r, g, b].map(
|
|
255
2202
|
(v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0")
|
|
256
2203
|
).join("");
|
|
@@ -293,7 +2240,7 @@ var createPaletteColor = (main) => {
|
|
|
293
2240
|
};
|
|
294
2241
|
var lighten = (hex, amount) => {
|
|
295
2242
|
const { r, g, b } = hexToRgb(hex);
|
|
296
|
-
return
|
|
2243
|
+
return rgbToHex2(
|
|
297
2244
|
r + (255 - r) * amount,
|
|
298
2245
|
g + (255 - g) * amount,
|
|
299
2246
|
b + (255 - b) * amount
|
|
@@ -301,7 +2248,7 @@ var lighten = (hex, amount) => {
|
|
|
301
2248
|
};
|
|
302
2249
|
var darken = (hex, amount) => {
|
|
303
2250
|
const { r, g, b } = hexToRgb(hex);
|
|
304
|
-
return
|
|
2251
|
+
return rgbToHex2(
|
|
305
2252
|
r * (1 - amount),
|
|
306
2253
|
g * (1 - amount),
|
|
307
2254
|
b * (1 - amount)
|
|
@@ -312,27 +2259,6 @@ var alpha = (hex, opacity) => {
|
|
|
312
2259
|
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
313
2260
|
};
|
|
314
2261
|
|
|
315
|
-
// src/utils/common.ts
|
|
316
|
-
function isEmpty(value) {
|
|
317
|
-
if (value == null) return true;
|
|
318
|
-
if (typeof value === "string") return value.trim().length === 0;
|
|
319
|
-
if (Array.isArray(value)) return value.length === 0;
|
|
320
|
-
if (value instanceof Map || value instanceof Set) {
|
|
321
|
-
return value.size === 0;
|
|
322
|
-
}
|
|
323
|
-
if (typeof value === "object") {
|
|
324
|
-
return Object.keys(value).length === 0;
|
|
325
|
-
}
|
|
326
|
-
return false;
|
|
327
|
-
}
|
|
328
|
-
function times(n, iteratee) {
|
|
329
|
-
const result = [];
|
|
330
|
-
for (let i = 0; i < n; i++) {
|
|
331
|
-
result.push(iteratee(i));
|
|
332
|
-
}
|
|
333
|
-
return result;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
2262
|
// src/utils/cx.ts
|
|
337
2263
|
var cx = (...args) => {
|
|
338
2264
|
return args.flatMap((arg) => {
|
|
@@ -419,10 +2345,10 @@ var createVariants = (config) => {
|
|
|
419
2345
|
return (props = {}) => {
|
|
420
2346
|
const classes = [config.base];
|
|
421
2347
|
if (config.variants) {
|
|
422
|
-
Object.entries(config.variants).forEach(([key,
|
|
2348
|
+
Object.entries(config.variants).forEach(([key, map2]) => {
|
|
423
2349
|
const value = props[key];
|
|
424
|
-
if (value &&
|
|
425
|
-
classes.push(
|
|
2350
|
+
if (value && map2[value]) {
|
|
2351
|
+
classes.push(map2[value]);
|
|
426
2352
|
}
|
|
427
2353
|
});
|
|
428
2354
|
}
|
|
@@ -473,13 +2399,13 @@ var getNumberPhone = (phone, dial) => {
|
|
|
473
2399
|
};
|
|
474
2400
|
|
|
475
2401
|
// src/utils/merge.ts
|
|
476
|
-
function
|
|
2402
|
+
function mergeDeep2(target, source) {
|
|
477
2403
|
if (!source) return target;
|
|
478
2404
|
const output = { ...target };
|
|
479
|
-
Object.keys(source)
|
|
2405
|
+
Object.keys(source)?.forEach((key) => {
|
|
480
2406
|
const k = key;
|
|
481
2407
|
if (typeof source[k] === "object" && source[k] !== null && !Array.isArray(source[k])) {
|
|
482
|
-
output[k] =
|
|
2408
|
+
output[k] = mergeDeep2(
|
|
483
2409
|
target[k] || {},
|
|
484
2410
|
source[k]
|
|
485
2411
|
);
|
|
@@ -489,6 +2415,10 @@ function mergeDeep(target, source) {
|
|
|
489
2415
|
});
|
|
490
2416
|
return output;
|
|
491
2417
|
}
|
|
2418
|
+
function mergeInitialProps(initial, props) {
|
|
2419
|
+
if (!props) return initial;
|
|
2420
|
+
return mergeDeep2(initial, props);
|
|
2421
|
+
}
|
|
492
2422
|
|
|
493
2423
|
// src/utils/input.ts
|
|
494
2424
|
var inputCurrency = (e, value, alloweds) => {
|
|
@@ -499,6 +2429,11 @@ var inputCurrency = (e, value, alloweds) => {
|
|
|
499
2429
|
e.preventDefault();
|
|
500
2430
|
};
|
|
501
2431
|
|
|
2432
|
+
// src/utils/utils.ts
|
|
2433
|
+
var utils = {
|
|
2434
|
+
...common_exports
|
|
2435
|
+
};
|
|
2436
|
+
|
|
502
2437
|
// src/theme/breakpoint.ts
|
|
503
2438
|
var breakpoints = {
|
|
504
2439
|
xs: 0,
|
|
@@ -838,8 +2773,129 @@ var Box = ({
|
|
|
838
2773
|
"data-testid": "yr3Box",
|
|
839
2774
|
children
|
|
840
2775
|
}
|
|
841
|
-
);
|
|
2776
|
+
);
|
|
2777
|
+
};
|
|
2778
|
+
|
|
2779
|
+
// src/components/Flex/flex.variants.ts
|
|
2780
|
+
var flexVariants = createVariants({
|
|
2781
|
+
base: "yr3Flex",
|
|
2782
|
+
variants: {
|
|
2783
|
+
variant: {
|
|
2784
|
+
row: "yr3Flex--row",
|
|
2785
|
+
column: "yr3Flex--column",
|
|
2786
|
+
wrap: "yr3Flex--wrap"
|
|
2787
|
+
},
|
|
2788
|
+
container: {
|
|
2789
|
+
true: "yr3Flex--container"
|
|
2790
|
+
},
|
|
2791
|
+
center: {
|
|
2792
|
+
true: "yr3Flex--center"
|
|
2793
|
+
},
|
|
2794
|
+
between: {
|
|
2795
|
+
true: "yr3Flex--between"
|
|
2796
|
+
},
|
|
2797
|
+
bordered: {
|
|
2798
|
+
true: "yr3Flex--bordered"
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
});
|
|
2802
|
+
var flex_variants_default = flexVariants;
|
|
2803
|
+
|
|
2804
|
+
// src/components/Flex/Flex.tsx
|
|
2805
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2806
|
+
var Flex = ({
|
|
2807
|
+
container = false,
|
|
2808
|
+
spacing: spacing2 = 1,
|
|
2809
|
+
children,
|
|
2810
|
+
ui,
|
|
2811
|
+
gap,
|
|
2812
|
+
variant = "column",
|
|
2813
|
+
center = false,
|
|
2814
|
+
between = false,
|
|
2815
|
+
style,
|
|
2816
|
+
bordered = false,
|
|
2817
|
+
...props
|
|
2818
|
+
}) => {
|
|
2819
|
+
const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
|
|
2820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2821
|
+
"div",
|
|
2822
|
+
{
|
|
2823
|
+
className: classes,
|
|
2824
|
+
style: composeStyles(ui, style),
|
|
2825
|
+
...props,
|
|
2826
|
+
"data-testid": "yr3Flex",
|
|
2827
|
+
children
|
|
2828
|
+
}
|
|
2829
|
+
);
|
|
2830
|
+
};
|
|
2831
|
+
|
|
2832
|
+
// src/components/Loader/loader.variants.ts
|
|
2833
|
+
var loaderSpinnerVariants = createVariants({
|
|
2834
|
+
base: "yr3Loader--spinner",
|
|
2835
|
+
variants: {
|
|
2836
|
+
color: {
|
|
2837
|
+
primary: "yr3Loader--spinner-color-primary",
|
|
2838
|
+
secondary: "yr3Loader--spinner-color-secondary",
|
|
2839
|
+
success: "yr3Loader--spinner-color-success",
|
|
2840
|
+
error: "yr3Loader--spinner-color-error",
|
|
2841
|
+
warning: "yr3Loader--spinner-color-warning",
|
|
2842
|
+
info: "yr3Loader--spinner-color-info",
|
|
2843
|
+
disabled: "yr3Loader--spinner-color-disabled",
|
|
2844
|
+
text: "yr3Loader--spinner-color-text",
|
|
2845
|
+
background: "yr3Loader--spinner-color-background",
|
|
2846
|
+
common: "yr3Loader--spinner-color-common"
|
|
2847
|
+
},
|
|
2848
|
+
size: {
|
|
2849
|
+
sm: "yr3Loader--spinner-size-sm",
|
|
2850
|
+
md: "yr3Loader--spinner-size-md",
|
|
2851
|
+
lg: "yr3Loader--spinner-size-lg",
|
|
2852
|
+
xs: "yr3Loader--spinner-size-xs"
|
|
2853
|
+
},
|
|
2854
|
+
type: {
|
|
2855
|
+
default: "yr3Loader--spinner-default",
|
|
2856
|
+
dots: "yr3Loader--spinner-dots",
|
|
2857
|
+
fancy: "yr3Loader--spinner-fancy"
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
});
|
|
2861
|
+
|
|
2862
|
+
// src/components/Loader/Loader.tsx
|
|
2863
|
+
var React3 = __toESM(require("react"), 1);
|
|
2864
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2865
|
+
var initialComponents = {
|
|
2866
|
+
loader: {
|
|
2867
|
+
ui: {},
|
|
2868
|
+
style: {}
|
|
2869
|
+
},
|
|
2870
|
+
spinner: {
|
|
2871
|
+
size: "sm",
|
|
2872
|
+
color: "primary",
|
|
2873
|
+
type: "default"
|
|
2874
|
+
},
|
|
2875
|
+
container: {
|
|
2876
|
+
center: true,
|
|
2877
|
+
container: true,
|
|
2878
|
+
ui: {
|
|
2879
|
+
width: "100%",
|
|
2880
|
+
height: "100%"
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2884
|
+
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2885
|
+
const properties = mergeDeep2(initialComponents, propsComponent || {});
|
|
2886
|
+
const classSpinner = loaderSpinnerVariants({
|
|
2887
|
+
color: properties?.spinner?.color,
|
|
2888
|
+
type: properties?.spinner?.type,
|
|
2889
|
+
size: properties?.spinner?.size
|
|
2890
|
+
});
|
|
2891
|
+
if (!loading) return null;
|
|
2892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "yr3Loader", style: composeStyles(properties?.loader?.ui, properties?.loader?.style), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Flex, { ...properties?.container, children: component || /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: classSpinner, children: properties?.spinner?.type === "dots" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React3.Fragment, { children: [
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {}),
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {}),
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {})
|
|
2896
|
+
] }) }) }) });
|
|
842
2897
|
};
|
|
2898
|
+
var Loader_default = Loader;
|
|
843
2899
|
|
|
844
2900
|
// src/components/Text/text.variants.ts
|
|
845
2901
|
var textVariants = createVariants({
|
|
@@ -888,7 +2944,7 @@ var textVariants = createVariants({
|
|
|
888
2944
|
var text_variants_default = textVariants;
|
|
889
2945
|
|
|
890
2946
|
// src/components/Text/Text.tsx
|
|
891
|
-
var
|
|
2947
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
892
2948
|
var Text = ({
|
|
893
2949
|
children,
|
|
894
2950
|
variant = "inherit",
|
|
@@ -902,7 +2958,7 @@ var Text = ({
|
|
|
902
2958
|
}) => {
|
|
903
2959
|
const styleUI = uiStyle({ ...ui, marginTop: gutters[0] || 0, marginBottom: gutters[1] || 0 });
|
|
904
2960
|
const classes = text_variants_default({ variant, color, weight });
|
|
905
|
-
return /* @__PURE__ */ (0,
|
|
2961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
906
2962
|
Component,
|
|
907
2963
|
{
|
|
908
2964
|
className: classes,
|
|
@@ -947,15 +3003,18 @@ var buttonVariant = createVariants({
|
|
|
947
3003
|
},
|
|
948
3004
|
animated: {
|
|
949
3005
|
true: "yr3Button--animated"
|
|
3006
|
+
},
|
|
3007
|
+
loading: {
|
|
3008
|
+
true: "yr3Button--spinner-size-md "
|
|
950
3009
|
}
|
|
951
3010
|
}
|
|
952
3011
|
});
|
|
953
3012
|
|
|
954
3013
|
// src/components/Button/Button.tsx
|
|
955
|
-
var
|
|
3014
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
956
3015
|
var Button = ({ icon, children, color = "text", variant = "text", animated, disabled, gradientBorder = false, size = "auto", ui, style, propsComponent, ...props }) => {
|
|
957
3016
|
const buttonClassname = buttonVariant({ variant, color, animated, disabled, gradientBorder, size });
|
|
958
|
-
return /* @__PURE__ */ (0,
|
|
3017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
959
3018
|
"button",
|
|
960
3019
|
{
|
|
961
3020
|
className: buttonClassname,
|
|
@@ -964,17 +3023,16 @@ var Button = ({ icon, children, color = "text", variant = "text", animated, disa
|
|
|
964
3023
|
...props,
|
|
965
3024
|
style: composeStyles(ui, style),
|
|
966
3025
|
children: [
|
|
967
|
-
|
|
968
|
-
/* @__PURE__ */ (0,
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Loader_default, { ...propsComponent?.loader }),
|
|
3027
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "yr3Button--icon", children: icon }),
|
|
3028
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { variant: propsComponent?.text?.variant || "button", ...propsComponent?.text, children })
|
|
969
3029
|
]
|
|
970
3030
|
}
|
|
971
3031
|
);
|
|
972
3032
|
};
|
|
973
3033
|
|
|
974
3034
|
// src/components/Calendar/Calendar.tsx
|
|
975
|
-
var
|
|
976
|
-
var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
977
|
-
var import_weekday = __toESM(require("dayjs/plugin/weekday"), 1);
|
|
3035
|
+
var React4 = __toESM(require("react"), 1);
|
|
978
3036
|
|
|
979
3037
|
// src/components/Calendar/calendar.variants.ts
|
|
980
3038
|
var calendarVariants = createVariants({
|
|
@@ -1023,14 +3081,22 @@ var calendarDayVariants = createVariants({
|
|
|
1023
3081
|
});
|
|
1024
3082
|
|
|
1025
3083
|
// src/components/Calendar/Calendar.tsx
|
|
1026
|
-
var
|
|
1027
|
-
import_dayjs2.default.extend(import_weekday.default);
|
|
3084
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1028
3085
|
var initalPropsComponent = {
|
|
1029
3086
|
displayButtons: true,
|
|
1030
3087
|
displayCalendar: true,
|
|
3088
|
+
container: {
|
|
3089
|
+
ui: {
|
|
3090
|
+
width: "100%",
|
|
3091
|
+
maxWidth: 400
|
|
3092
|
+
},
|
|
3093
|
+
style: {}
|
|
3094
|
+
},
|
|
1031
3095
|
header: {
|
|
1032
3096
|
color: "primary",
|
|
1033
|
-
ui: {
|
|
3097
|
+
ui: {
|
|
3098
|
+
px: 0.5
|
|
3099
|
+
},
|
|
1034
3100
|
style: {}
|
|
1035
3101
|
},
|
|
1036
3102
|
month: {
|
|
@@ -1040,6 +3106,7 @@ var initalPropsComponent = {
|
|
|
1040
3106
|
},
|
|
1041
3107
|
day: {
|
|
1042
3108
|
color: "primary",
|
|
3109
|
+
selected: "secondary",
|
|
1043
3110
|
bordered: true,
|
|
1044
3111
|
ui: {},
|
|
1045
3112
|
style: {},
|
|
@@ -1047,49 +3114,89 @@ var initalPropsComponent = {
|
|
|
1047
3114
|
},
|
|
1048
3115
|
buttonNext: {
|
|
1049
3116
|
disabled: false,
|
|
1050
|
-
label: "next"
|
|
3117
|
+
label: "next",
|
|
3118
|
+
color: "primary",
|
|
3119
|
+
ui: {
|
|
3120
|
+
justifyContent: "flex-end",
|
|
3121
|
+
p: 0
|
|
3122
|
+
}
|
|
1051
3123
|
},
|
|
1052
3124
|
buttonBack: {
|
|
1053
3125
|
disabled: false,
|
|
1054
|
-
label: "back"
|
|
3126
|
+
label: "back",
|
|
3127
|
+
color: "primary",
|
|
3128
|
+
ui: {
|
|
3129
|
+
justifyContent: "flex-start",
|
|
3130
|
+
p: 0
|
|
3131
|
+
}
|
|
1055
3132
|
}
|
|
1056
3133
|
};
|
|
1057
|
-
var Calendar = ({ onSelect, propsComponent
|
|
1058
|
-
const
|
|
1059
|
-
const
|
|
1060
|
-
const
|
|
1061
|
-
const
|
|
1062
|
-
|
|
3134
|
+
var Calendar = ({ onSelect, propsComponent, mapCalendar, onMonthChange, dataFormat, buttonsComponent }) => {
|
|
3135
|
+
const properties = mergeInitialProps(initalPropsComponent, propsComponent);
|
|
3136
|
+
const _date = /* @__PURE__ */ new Date();
|
|
3137
|
+
const month = date(_date).getMonth();
|
|
3138
|
+
const [currentMonth, setCurrentMonth] = React4.useState(month);
|
|
3139
|
+
const [selected, setSelected] = React4.useState(null);
|
|
3140
|
+
const program = React4.useMemo(() => {
|
|
3141
|
+
return getMonthCalendar(dataFormat, (/* @__PURE__ */ new Date()).getFullYear(), currentMonth, 0, selected, mapCalendar);
|
|
1063
3142
|
}, [selected, currentMonth, mapCalendar]);
|
|
1064
|
-
|
|
3143
|
+
React4.useEffect(() => {
|
|
1065
3144
|
if (selected) {
|
|
1066
3145
|
onSelect && onSelect(selected);
|
|
1067
3146
|
} else {
|
|
1068
|
-
onSelect && onSelect(program
|
|
3147
|
+
onSelect && onSelect(program?.currentDay);
|
|
1069
3148
|
}
|
|
1070
3149
|
}, [selected, program, onSelect]);
|
|
1071
|
-
|
|
3150
|
+
React4.useEffect(() => {
|
|
1072
3151
|
if (currentMonth) {
|
|
1073
3152
|
onMonthChange && onMonthChange(currentMonth);
|
|
1074
3153
|
}
|
|
1075
3154
|
}, [currentMonth]);
|
|
1076
|
-
return /* @__PURE__ */ (0,
|
|
1077
|
-
propsComponent?.displayButtons && /* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1079
|
-
|
|
1080
|
-
|
|
3155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "yr3Calendar", "data-testid": "yr3Calendar", style: composeStyles(properties?.container?.ui, properties?.container?.style), children: [
|
|
3156
|
+
propsComponent?.displayButtons && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "yr3Calendar--header", "data-testid": "yr3CalendarHeader", style: composeStyles(properties?.header?.ui, properties?.header?.style), children: [
|
|
3157
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3158
|
+
Button,
|
|
3159
|
+
{
|
|
3160
|
+
disabled: properties?.buttonBack?.disabled || false,
|
|
3161
|
+
color: properties.buttonBack?.color || "primary",
|
|
3162
|
+
onClick: () => setCurrentMonth(currentMonth - 1),
|
|
3163
|
+
ui: { ...properties.buttonBack.ui },
|
|
3164
|
+
propsComponent: {
|
|
3165
|
+
text: {
|
|
3166
|
+
color: properties?.buttonBack?.color || "primary"
|
|
3167
|
+
}
|
|
3168
|
+
},
|
|
3169
|
+
children: buttonsComponent?.buttonBack ? buttonsComponent?.buttonBack : properties?.buttonBack?.label
|
|
3170
|
+
}
|
|
3171
|
+
),
|
|
3172
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { variant: "h6", color: properties.header?.color || "primary", ui: { textTransform: "uppercase", textAlign: "center" }, children: program?.monthLabel }),
|
|
3173
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3174
|
+
Button,
|
|
3175
|
+
{
|
|
3176
|
+
disabled: properties?.buttonNext?.disabled,
|
|
3177
|
+
color: properties?.buttonNext?.color || "primary",
|
|
3178
|
+
onClick: () => setCurrentMonth(currentMonth + 1),
|
|
3179
|
+
propsComponent: {
|
|
3180
|
+
text: {
|
|
3181
|
+
color: properties?.buttonNext?.color || "primary"
|
|
3182
|
+
}
|
|
3183
|
+
},
|
|
3184
|
+
ui: { ...properties.buttonNext.ui },
|
|
3185
|
+
children: buttonsComponent?.buttonNext ? buttonsComponent?.buttonNext : properties?.buttonNext?.label
|
|
3186
|
+
}
|
|
3187
|
+
)
|
|
1081
3188
|
] }),
|
|
1082
|
-
|
|
1083
|
-
program?.daysContainer
|
|
3189
|
+
properties?.displayCalendar && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "yr3Calendar--container", children: [
|
|
3190
|
+
program?.daysContainer?.map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "yr3Calendar--month", style: composeStyles(properties?.month?.ui, properties?.month?.style), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1084
3191
|
Text,
|
|
1085
3192
|
{
|
|
1086
3193
|
variant: "caption",
|
|
1087
|
-
color:
|
|
1088
|
-
ui: { ...
|
|
1089
|
-
children:
|
|
3194
|
+
color: properties?.month?.color || "primary",
|
|
3195
|
+
ui: { ...properties?.month?.ui, opacity: 0.7, textTransform: "uppercase" },
|
|
3196
|
+
children: i.label
|
|
1090
3197
|
}
|
|
1091
|
-
) }, `month_day_${i}`)),
|
|
1092
|
-
times(program
|
|
3198
|
+
) }, `month_day_${i.label}`)),
|
|
3199
|
+
times(program?.calendar.length, (i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(React4.Fragment, { children: times(program?.calendar[i].length, (j) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1093
3200
|
"div",
|
|
1094
3201
|
{
|
|
1095
3202
|
className: calendarDayVariants({
|
|
@@ -1098,11 +3205,11 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1098
3205
|
isPast: program.calendar[i][j]?.isPast,
|
|
1099
3206
|
isFuture: program.calendar[i][j]?.isFuture,
|
|
1100
3207
|
isCurrentMonth: program.calendar[i][j]?.isCurrentMonth,
|
|
1101
|
-
ui:
|
|
1102
|
-
bordered: !!program.calendar[i][j] &&
|
|
1103
|
-
color:
|
|
3208
|
+
ui: properties?.day?.ui,
|
|
3209
|
+
bordered: !!program.calendar[i][j] && properties?.day?.bordered,
|
|
3210
|
+
color: properties?.day?.color || "primary"
|
|
1104
3211
|
}),
|
|
1105
|
-
style: composeStyles(
|
|
3212
|
+
style: composeStyles(properties?.day?.ui, properties?.day?.style),
|
|
1106
3213
|
"data-testid": "yr3CalendarDay",
|
|
1107
3214
|
onClick: () => {
|
|
1108
3215
|
if (selected === program.calendar[i][j]) {
|
|
@@ -1112,13 +3219,13 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1112
3219
|
}
|
|
1113
3220
|
},
|
|
1114
3221
|
children: [
|
|
1115
|
-
program
|
|
1116
|
-
/* @__PURE__ */ (0,
|
|
3222
|
+
program?.calendar[i][j]?.data && properties?.day?.component ? properties?.day?.component : null,
|
|
3223
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1117
3224
|
Text,
|
|
1118
3225
|
{
|
|
1119
3226
|
variant: "body2",
|
|
1120
|
-
color: program
|
|
1121
|
-
children: program
|
|
3227
|
+
color: program?.calendar[i][j]?.selected ? properties?.day?.selected : "primary",
|
|
3228
|
+
children: program?.calendar[i][j]?.day || ""
|
|
1122
3229
|
}
|
|
1123
3230
|
)
|
|
1124
3231
|
]
|
|
@@ -1130,8 +3237,8 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1130
3237
|
};
|
|
1131
3238
|
|
|
1132
3239
|
// src/components/Checkbox/Checkbox.tsx
|
|
1133
|
-
var
|
|
1134
|
-
var
|
|
3240
|
+
var React5 = __toESM(require("react"), 1);
|
|
3241
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1135
3242
|
var initialPropsComponent = {
|
|
1136
3243
|
checkbox: {
|
|
1137
3244
|
ui: {
|
|
@@ -1156,20 +3263,20 @@ var Checkbox = ({
|
|
|
1156
3263
|
type = "default",
|
|
1157
3264
|
variant = "text"
|
|
1158
3265
|
}) => {
|
|
1159
|
-
const [internal, setInternal] =
|
|
3266
|
+
const [internal, setInternal] = React5.useState(defaultChecked || false);
|
|
1160
3267
|
const isControlled = checked !== void 0;
|
|
1161
3268
|
const value = isControlled ? checked : internal;
|
|
1162
3269
|
const handleChange = (e) => {
|
|
1163
3270
|
if (!isControlled) setInternal(e.target.checked);
|
|
1164
3271
|
onChange?.(e, e.target.checked);
|
|
1165
3272
|
};
|
|
1166
|
-
const properties =
|
|
3273
|
+
const properties = mergeDeep2(initialPropsComponent, propsComponent || {});
|
|
1167
3274
|
const bemClasse = bem("yr3Checkbox");
|
|
1168
3275
|
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}`, type: `type-${type}` });
|
|
1169
3276
|
const boxClasses = bem("yr3Checkbox-box");
|
|
1170
3277
|
const classesBox = boxClasses(void 0, { checked: !!value });
|
|
1171
|
-
return /* @__PURE__ */ (0,
|
|
1172
|
-
/* @__PURE__ */ (0,
|
|
3278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: classes, style: uiStyle(properties?.checkbox?.ui), "data-testid": "yr3Checkbox", children: [
|
|
3279
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1173
3280
|
"input",
|
|
1174
3281
|
{
|
|
1175
3282
|
type: "checkbox",
|
|
@@ -1179,8 +3286,8 @@ var Checkbox = ({
|
|
|
1179
3286
|
"data-testid": "yr3Checkbox-input"
|
|
1180
3287
|
}
|
|
1181
3288
|
),
|
|
1182
|
-
/* @__PURE__ */ (0,
|
|
1183
|
-
label && /* @__PURE__ */ (0,
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: classesBox, "data-testid": "yr3Checkbox-box" }),
|
|
3290
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { variant: "caption", color: !value ? properties?.content?.color : color, ...properties?.content, children: label })
|
|
1184
3291
|
] });
|
|
1185
3292
|
};
|
|
1186
3293
|
|
|
@@ -1217,9 +3324,9 @@ var chipVariants = createVariants({
|
|
|
1217
3324
|
var chip_variants_default = chipVariants;
|
|
1218
3325
|
|
|
1219
3326
|
// src/Icons/IconClose.tsx
|
|
1220
|
-
var
|
|
3327
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1221
3328
|
var IconClose = (props) => {
|
|
1222
|
-
return /* @__PURE__ */ (0,
|
|
3329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsx)(
|
|
1223
3330
|
"path",
|
|
1224
3331
|
{
|
|
1225
3332
|
d: "M16 16L12 12M12 12L8 8M12 12L16 8M12 12L8 16",
|
|
@@ -1232,7 +3339,7 @@ var IconClose = (props) => {
|
|
|
1232
3339
|
};
|
|
1233
3340
|
|
|
1234
3341
|
// src/components/Chip/Chip.tsx
|
|
1235
|
-
var
|
|
3342
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1236
3343
|
var initialChipProps = {
|
|
1237
3344
|
label: {
|
|
1238
3345
|
ui: {},
|
|
@@ -1248,9 +3355,9 @@ var initialChipProps = {
|
|
|
1248
3355
|
}
|
|
1249
3356
|
};
|
|
1250
3357
|
var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "medium", propsComponent, ...props }) => {
|
|
1251
|
-
const properties =
|
|
3358
|
+
const properties = mergeDeep2(initialChipProps, propsComponent);
|
|
1252
3359
|
const className = chip_variants_default({ variant, colors: color, rounded, size });
|
|
1253
|
-
return /* @__PURE__ */ (0,
|
|
3360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1254
3361
|
"div",
|
|
1255
3362
|
{
|
|
1256
3363
|
className,
|
|
@@ -1259,8 +3366,8 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1259
3366
|
style: composeStyles(properties.chip?.ui, properties.chip?.style),
|
|
1260
3367
|
children: [
|
|
1261
3368
|
icon,
|
|
1262
|
-
/* @__PURE__ */ (0,
|
|
1263
|
-
deleted && /* @__PURE__ */ (0,
|
|
3369
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "yr3Chip__label", style: composeStyles(properties?.label?.ui, properties?.label?.style), children: label }),
|
|
3370
|
+
deleted && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1264
3371
|
"span",
|
|
1265
3372
|
{
|
|
1266
3373
|
className: "yr3Chip__delete",
|
|
@@ -1268,7 +3375,7 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1268
3375
|
role: "button",
|
|
1269
3376
|
"aria-label": "delete",
|
|
1270
3377
|
style: composeStyles(properties?.delete?.ui, properties?.delete?.style),
|
|
1271
|
-
children: /* @__PURE__ */ (0,
|
|
3378
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconClose, { ...properties?.icon, stroke: color })
|
|
1272
3379
|
}
|
|
1273
3380
|
)
|
|
1274
3381
|
]
|
|
@@ -1277,12 +3384,12 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1277
3384
|
};
|
|
1278
3385
|
|
|
1279
3386
|
// src/components/Collapse/Collapse.tsx
|
|
1280
|
-
var
|
|
1281
|
-
var
|
|
3387
|
+
var React6 = __toESM(require("react"), 1);
|
|
3388
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1282
3389
|
var Collapse = ({ children, open, anchor }) => {
|
|
1283
|
-
const ref =
|
|
1284
|
-
const [height, setHeight] =
|
|
1285
|
-
|
|
3390
|
+
const ref = React6.useRef(null);
|
|
3391
|
+
const [height, setHeight] = React6.useState(0);
|
|
3392
|
+
React6.useEffect(() => {
|
|
1286
3393
|
if (ref.current) {
|
|
1287
3394
|
if (open) {
|
|
1288
3395
|
setHeight(ref.current.scrollHeight);
|
|
@@ -1291,11 +3398,11 @@ var Collapse = ({ children, open, anchor }) => {
|
|
|
1291
3398
|
}
|
|
1292
3399
|
}
|
|
1293
3400
|
}, [open, children]);
|
|
1294
|
-
return /* @__PURE__ */ (0,
|
|
3401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `yr3Collapse yr3Collapse--${anchor}`, style: { height }, "data-testid": "yr3Collapse", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref, className: "yr3Collapse__inner", children }) });
|
|
1295
3402
|
};
|
|
1296
3403
|
|
|
1297
3404
|
// src/components/Container/Container.tsx
|
|
1298
|
-
var
|
|
3405
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1299
3406
|
var Container = ({
|
|
1300
3407
|
children,
|
|
1301
3408
|
maxWidth = "sm",
|
|
@@ -1305,7 +3412,7 @@ var Container = ({
|
|
|
1305
3412
|
}) => {
|
|
1306
3413
|
const containerClassName = bem("yr3Container");
|
|
1307
3414
|
const classes = containerClassName(void 0, { maxWidth, static: fixed });
|
|
1308
|
-
return /* @__PURE__ */ (0,
|
|
3415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1309
3416
|
"div",
|
|
1310
3417
|
{
|
|
1311
3418
|
className: classes,
|
|
@@ -1317,12 +3424,12 @@ var Container = ({
|
|
|
1317
3424
|
};
|
|
1318
3425
|
|
|
1319
3426
|
// src/theme/controlContext.tsx
|
|
1320
|
-
var
|
|
1321
|
-
var ControlContext =
|
|
1322
|
-
var useControl = () =>
|
|
3427
|
+
var React7 = __toESM(require("react"), 1);
|
|
3428
|
+
var ControlContext = React7.createContext(null);
|
|
3429
|
+
var useControl = () => React7.useContext(ControlContext);
|
|
1323
3430
|
|
|
1324
3431
|
// src/components/Control/Control.tsx
|
|
1325
|
-
var
|
|
3432
|
+
var React8 = __toESM(require("react"), 1);
|
|
1326
3433
|
|
|
1327
3434
|
// src/components/Control/control.variants.ts
|
|
1328
3435
|
var controlVariants = createVariants({
|
|
@@ -1365,7 +3472,7 @@ var controlVariants = createVariants({
|
|
|
1365
3472
|
});
|
|
1366
3473
|
|
|
1367
3474
|
// src/components/Control/Control.tsx
|
|
1368
|
-
var
|
|
3475
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1369
3476
|
var Control = ({
|
|
1370
3477
|
children,
|
|
1371
3478
|
error = false,
|
|
@@ -1377,7 +3484,7 @@ var Control = ({
|
|
|
1377
3484
|
size = "auto",
|
|
1378
3485
|
label = true
|
|
1379
3486
|
}) => {
|
|
1380
|
-
const [focused, setFocused] =
|
|
3487
|
+
const [focused, setFocused] = React8.useState(false);
|
|
1381
3488
|
const value = {
|
|
1382
3489
|
focused,
|
|
1383
3490
|
setFocused,
|
|
@@ -1385,7 +3492,7 @@ var Control = ({
|
|
|
1385
3492
|
disabled
|
|
1386
3493
|
};
|
|
1387
3494
|
const classes = controlVariants({ variant, color, label, size, disabled });
|
|
1388
|
-
return /* @__PURE__ */ (0,
|
|
3495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ControlContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1389
3496
|
"div",
|
|
1390
3497
|
{
|
|
1391
3498
|
className: classes,
|
|
@@ -1428,7 +3535,7 @@ var dividerVariants = createVariants({
|
|
|
1428
3535
|
var dividerVariants_default = dividerVariants;
|
|
1429
3536
|
|
|
1430
3537
|
// src/components/Divider/Divider.tsx
|
|
1431
|
-
var
|
|
3538
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1432
3539
|
var Divider = ({
|
|
1433
3540
|
orientation = "horizontal",
|
|
1434
3541
|
text: text2,
|
|
@@ -1438,14 +3545,14 @@ var Divider = ({
|
|
|
1438
3545
|
color = "primary"
|
|
1439
3546
|
}) => {
|
|
1440
3547
|
const classname = dividerVariants_default({ orientation, align, withText: !!text2, color });
|
|
1441
|
-
return /* @__PURE__ */ (0,
|
|
3548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: classname, style: composeStyles(ui, style), "data-testid": "yr3Divider", children: text2 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "yr3Divider--text", "data-testid": "yr3Divider-text", children: text2 }) });
|
|
1442
3549
|
};
|
|
1443
3550
|
|
|
1444
3551
|
// src/components/Drawer/Drawer.tsx
|
|
1445
|
-
var
|
|
3552
|
+
var React9 = __toESM(require("react"), 1);
|
|
1446
3553
|
|
|
1447
3554
|
// src/components/Drawer/DrawerContainer.tsx
|
|
1448
|
-
var
|
|
3555
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1449
3556
|
var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
1450
3557
|
const { hide } = useBackdrop();
|
|
1451
3558
|
const handleClose = () => {
|
|
@@ -1455,7 +3562,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1455
3562
|
}
|
|
1456
3563
|
return;
|
|
1457
3564
|
};
|
|
1458
|
-
return /* @__PURE__ */ (0,
|
|
3565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "yr3Drawer--container", style: composeStyles(ui, style), onClick: handleClose, "data-testid": "yr3Drawer-container", children });
|
|
1459
3566
|
};
|
|
1460
3567
|
var DrawerContainer_default = DrawerContainer;
|
|
1461
3568
|
|
|
@@ -1475,7 +3582,7 @@ var useClickAway = (ref, callback) => {
|
|
|
1475
3582
|
};
|
|
1476
3583
|
|
|
1477
3584
|
// src/components/Drawer/Drawer.tsx
|
|
1478
|
-
var
|
|
3585
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1479
3586
|
var initialPropsComponent2 = {
|
|
1480
3587
|
drawer: {},
|
|
1481
3588
|
closing: null,
|
|
@@ -1484,9 +3591,9 @@ var initialPropsComponent2 = {
|
|
|
1484
3591
|
};
|
|
1485
3592
|
var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
1486
3593
|
const { show, hide } = useBackdrop();
|
|
1487
|
-
const ref =
|
|
1488
|
-
const properties =
|
|
1489
|
-
|
|
3594
|
+
const ref = React9.useRef(null);
|
|
3595
|
+
const properties = mergeDeep2(initialPropsComponent2, propsComponent);
|
|
3596
|
+
React9.useEffect(() => {
|
|
1490
3597
|
if (open) {
|
|
1491
3598
|
show("drawer");
|
|
1492
3599
|
} else {
|
|
@@ -1501,7 +3608,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1501
3608
|
}
|
|
1502
3609
|
;
|
|
1503
3610
|
});
|
|
1504
|
-
|
|
3611
|
+
React9.useEffect(() => {
|
|
1505
3612
|
if (properties?.onClose) {
|
|
1506
3613
|
hide("drawer");
|
|
1507
3614
|
onClose();
|
|
@@ -1509,7 +3616,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1509
3616
|
}, [properties?.onClose]);
|
|
1510
3617
|
const classesBem = bem("yr3Drawer");
|
|
1511
3618
|
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1512
|
-
return /* @__PURE__ */ (0,
|
|
3619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1513
3620
|
"div",
|
|
1514
3621
|
{
|
|
1515
3622
|
className: drawerClasses,
|
|
@@ -1517,7 +3624,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1517
3624
|
onClick: (e) => e.stopPropagation(),
|
|
1518
3625
|
ref,
|
|
1519
3626
|
"data-testid": "yr3Drawer",
|
|
1520
|
-
children: /* @__PURE__ */ (0,
|
|
3627
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1521
3628
|
DrawerContainer_default,
|
|
1522
3629
|
{
|
|
1523
3630
|
children,
|
|
@@ -1532,15 +3639,15 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1532
3639
|
};
|
|
1533
3640
|
|
|
1534
3641
|
// src/components/Input/Input.tsx
|
|
1535
|
-
var
|
|
3642
|
+
var React10 = __toESM(require("react"), 1);
|
|
1536
3643
|
|
|
1537
3644
|
// src/components/Label/Label.tsx
|
|
1538
|
-
var
|
|
3645
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1539
3646
|
var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
|
|
1540
3647
|
const classes = bem("yr3Label");
|
|
1541
3648
|
const classComponent = classes(void 0, { color: `color-${color}` });
|
|
1542
3649
|
const classnames = bemMerge(classComponent, className);
|
|
1543
|
-
return /* @__PURE__ */ (0,
|
|
3650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1544
3651
|
"span",
|
|
1545
3652
|
{
|
|
1546
3653
|
className: classnames,
|
|
@@ -1593,7 +3700,7 @@ var inputVariants = createVariants({
|
|
|
1593
3700
|
});
|
|
1594
3701
|
|
|
1595
3702
|
// src/components/Input/Input.tsx
|
|
1596
|
-
var
|
|
3703
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1597
3704
|
var initiaPropsComponent = {
|
|
1598
3705
|
label: {
|
|
1599
3706
|
display: true,
|
|
@@ -1602,7 +3709,7 @@ var initiaPropsComponent = {
|
|
|
1602
3709
|
},
|
|
1603
3710
|
control: {}
|
|
1604
3711
|
};
|
|
1605
|
-
var Input =
|
|
3712
|
+
var Input = React10.forwardRef(
|
|
1606
3713
|
({
|
|
1607
3714
|
label,
|
|
1608
3715
|
value,
|
|
@@ -1611,21 +3718,27 @@ var Input = React9.forwardRef(
|
|
|
1611
3718
|
variant = "outlined",
|
|
1612
3719
|
error = "ce un errore",
|
|
1613
3720
|
separatorCurrency = ",",
|
|
3721
|
+
separatorDecimal = ".",
|
|
1614
3722
|
ui,
|
|
1615
3723
|
style,
|
|
1616
3724
|
propsComponent = initiaPropsComponent,
|
|
1617
|
-
pattern = "text",
|
|
1618
3725
|
color = "primary",
|
|
1619
3726
|
size = "auto",
|
|
1620
3727
|
disabled = false,
|
|
3728
|
+
model,
|
|
3729
|
+
pattern,
|
|
1621
3730
|
...props
|
|
1622
3731
|
}, ref) => {
|
|
1623
|
-
const [focused, setFocused] =
|
|
1624
|
-
const [internalValue, setInternalValue] =
|
|
3732
|
+
const [focused, setFocused] = React10.useState(false);
|
|
3733
|
+
const [internalValue, setInternalValue] = React10.useState(defaultValue);
|
|
1625
3734
|
const isControlled = value !== void 0;
|
|
1626
3735
|
const currentValue = isControlled ? value : internalValue;
|
|
1627
3736
|
const isActive = focused || !!currentValue;
|
|
1628
|
-
const
|
|
3737
|
+
const checkMode = (type, value2) => {
|
|
3738
|
+
if (pattern) {
|
|
3739
|
+
const regex = new RegExp(pattern);
|
|
3740
|
+
return regex.test(value2);
|
|
3741
|
+
}
|
|
1629
3742
|
switch (type) {
|
|
1630
3743
|
case "email":
|
|
1631
3744
|
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
@@ -1636,21 +3749,38 @@ var Input = React9.forwardRef(
|
|
|
1636
3749
|
case "currency":
|
|
1637
3750
|
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1638
3751
|
if (separatorCurrency === ".") return /^\d+(\.\d{0,2})?$/.test(value2);
|
|
3752
|
+
case "decimal":
|
|
3753
|
+
if (separatorDecimal === ",") return /^\d+(\,\d*)?$/.test(value2);
|
|
3754
|
+
if (separatorDecimal === ".") return /^\d+(\.\d*)?$/.test(value2);
|
|
1639
3755
|
default:
|
|
1640
3756
|
return true;
|
|
1641
3757
|
}
|
|
1642
3758
|
};
|
|
3759
|
+
const mode = (m) => {
|
|
3760
|
+
switch (m) {
|
|
3761
|
+
case "email":
|
|
3762
|
+
return "email";
|
|
3763
|
+
case "phone":
|
|
3764
|
+
return "tel";
|
|
3765
|
+
case "number":
|
|
3766
|
+
return "numeric";
|
|
3767
|
+
case "currency":
|
|
3768
|
+
return "numeric";
|
|
3769
|
+
default:
|
|
3770
|
+
return "text";
|
|
3771
|
+
}
|
|
3772
|
+
};
|
|
1643
3773
|
const handleChange = (e) => {
|
|
1644
3774
|
const newValue = e.target.value;
|
|
1645
|
-
if (newValue && !
|
|
3775
|
+
if (newValue && !checkMode(model, newValue)) return;
|
|
1646
3776
|
if (!isControlled) {
|
|
1647
3777
|
setInternalValue(newValue);
|
|
1648
3778
|
}
|
|
1649
3779
|
onChange?.(e, newValue);
|
|
1650
3780
|
};
|
|
1651
3781
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1652
|
-
return /* @__PURE__ */ (0,
|
|
1653
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0,
|
|
3782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, disabled, ...propsComponent.control, children: [
|
|
3783
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1654
3784
|
Label,
|
|
1655
3785
|
{
|
|
1656
3786
|
text: label || "",
|
|
@@ -1659,14 +3789,15 @@ var Input = React9.forwardRef(
|
|
|
1659
3789
|
...propsComponent.label
|
|
1660
3790
|
}
|
|
1661
3791
|
),
|
|
1662
|
-
/* @__PURE__ */ (0,
|
|
3792
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1663
3793
|
"input",
|
|
1664
3794
|
{
|
|
1665
3795
|
ref,
|
|
1666
3796
|
value: currentValue,
|
|
1667
|
-
inputMode:
|
|
3797
|
+
inputMode: mode(model),
|
|
1668
3798
|
autoComplete: "off",
|
|
1669
|
-
type:
|
|
3799
|
+
type: props.type,
|
|
3800
|
+
pattern,
|
|
1670
3801
|
disabled,
|
|
1671
3802
|
onChange: handleChange,
|
|
1672
3803
|
onFocus: () => setFocused(true),
|
|
@@ -1682,12 +3813,12 @@ var Input = React9.forwardRef(
|
|
|
1682
3813
|
);
|
|
1683
3814
|
|
|
1684
3815
|
// src/components/Date/MonthSelector.tsx
|
|
1685
|
-
var
|
|
3816
|
+
var React11 = __toESM(require("react"), 1);
|
|
1686
3817
|
|
|
1687
3818
|
// src/Icons/IconSearch.tsx
|
|
1688
|
-
var
|
|
3819
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1689
3820
|
var IconSearch = (props) => {
|
|
1690
|
-
return /* @__PURE__ */ (0,
|
|
3821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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__ */ (0, import_jsx_runtime21.jsx)(
|
|
1691
3822
|
"path",
|
|
1692
3823
|
{
|
|
1693
3824
|
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",
|
|
@@ -1700,21 +3831,21 @@ var IconSearch = (props) => {
|
|
|
1700
3831
|
};
|
|
1701
3832
|
|
|
1702
3833
|
// src/Icons/IconDown.tsx
|
|
1703
|
-
var
|
|
3834
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1704
3835
|
var IconDown = (props) => {
|
|
1705
|
-
return /* @__PURE__ */ (0,
|
|
3836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("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__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1706
3837
|
};
|
|
1707
3838
|
|
|
1708
3839
|
// src/Icons/IconCalendar.tsx
|
|
1709
|
-
var
|
|
3840
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1710
3841
|
var IconCalendar = (props) => {
|
|
1711
|
-
return /* @__PURE__ */ (0,
|
|
3842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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__ */ (0, import_jsx_runtime23.jsx)("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" }) });
|
|
1712
3843
|
};
|
|
1713
3844
|
|
|
1714
3845
|
// src/Icons/IconLeft.tsx
|
|
1715
|
-
var
|
|
3846
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1716
3847
|
var IconLeft = (props) => {
|
|
1717
|
-
return /* @__PURE__ */ (0,
|
|
3848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("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__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M15 7L10 12L15 17", stroke: props.stroke || "currentColor", strokeWidth: props.strokeWidth || "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1718
3849
|
};
|
|
1719
3850
|
|
|
1720
3851
|
// src/components/Date/month.variants.ts
|
|
@@ -1771,9 +3902,9 @@ var monthSelectorContainerVariants = createVariants({
|
|
|
1771
3902
|
});
|
|
1772
3903
|
|
|
1773
3904
|
// src/Icons/IconRight.tsx
|
|
1774
|
-
var
|
|
3905
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1775
3906
|
var IconRight = (props) => {
|
|
1776
|
-
return /* @__PURE__ */ (0,
|
|
3907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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__ */ (0, import_jsx_runtime25.jsx)(
|
|
1777
3908
|
"path",
|
|
1778
3909
|
{
|
|
1779
3910
|
d: "M9 7L14 12L9 17",
|
|
@@ -1786,12 +3917,14 @@ var IconRight = (props) => {
|
|
|
1786
3917
|
};
|
|
1787
3918
|
|
|
1788
3919
|
// src/components/Date/MonthSelector.tsx
|
|
1789
|
-
var
|
|
3920
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1790
3921
|
var initialPropsComponent3 = {
|
|
1791
3922
|
control: {
|
|
1792
3923
|
variant: "outlined",
|
|
1793
3924
|
color: "primary",
|
|
1794
|
-
ui: {
|
|
3925
|
+
ui: {
|
|
3926
|
+
pointerEvents: "none"
|
|
3927
|
+
},
|
|
1795
3928
|
style: {}
|
|
1796
3929
|
},
|
|
1797
3930
|
label: {
|
|
@@ -1826,18 +3959,19 @@ var initialPropsComponent3 = {
|
|
|
1826
3959
|
style: {}
|
|
1827
3960
|
}
|
|
1828
3961
|
};
|
|
1829
|
-
var MonthSelector = ({ label, value, disabled, propsComponent, data,
|
|
1830
|
-
const [open, setOpen] =
|
|
1831
|
-
const [valueState, setValueState] =
|
|
1832
|
-
const [yearSelected, setYearSelected] =
|
|
1833
|
-
const ref =
|
|
3962
|
+
var MonthSelector = ({ label, value, disabled, propsComponent, data, format, onNext, onLast, onChange }) => {
|
|
3963
|
+
const [open, setOpen] = React11.useState(false);
|
|
3964
|
+
const [valueState, setValueState] = React11.useState(value || null);
|
|
3965
|
+
const [yearSelected, setYearSelected] = React11.useState(data?.years.findIndex((y) => y === data.year) || 0);
|
|
3966
|
+
const ref = React11.useRef(null);
|
|
1834
3967
|
useClickAway(ref, () => setOpen(false));
|
|
1835
|
-
const properties =
|
|
3968
|
+
const properties = mergeDeep2(initialPropsComponent3, propsComponent || {});
|
|
1836
3969
|
const iconClasses = monthSelectorIconVariants({ color: properties?.icon?.color });
|
|
1837
3970
|
const containerClasses = monthSelectorContainerVariants({ color: properties?.container?.color });
|
|
1838
|
-
const getData =
|
|
1839
|
-
|
|
1840
|
-
|
|
3971
|
+
const getData = React11.useMemo(() => {
|
|
3972
|
+
const resolve = getMonthCalendarProps({ year: data.years[yearSelected], data, format, value: valueState });
|
|
3973
|
+
return resolve;
|
|
3974
|
+
}, [yearSelected, data, format, valueState]);
|
|
1841
3975
|
const handleYearChange = (newIndex) => {
|
|
1842
3976
|
setYearSelected(newIndex);
|
|
1843
3977
|
};
|
|
@@ -1845,23 +3979,17 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1845
3979
|
const newValue = `${month}-${data.years[yearSelected]}`;
|
|
1846
3980
|
setValueState(newValue);
|
|
1847
3981
|
onChange(newValue);
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
daysFormat,
|
|
1852
|
-
value: newValue
|
|
1853
|
-
});
|
|
1854
|
-
onNext?.(nextData.prev);
|
|
1855
|
-
onLast?.(nextData.last);
|
|
3982
|
+
onNext?.(findMonth(newValue, data.years, data.exclude, "next"));
|
|
3983
|
+
onLast?.(findMonth(newValue, data.years, data.exclude, "prev"));
|
|
3984
|
+
setOpen(false);
|
|
1856
3985
|
};
|
|
1857
3986
|
const classes = monthSelectorVariants({ wrapper: true, disabled });
|
|
1858
|
-
return /* @__PURE__ */ (0,
|
|
1859
|
-
/* @__PURE__ */ (0,
|
|
3987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: classes, ref, children: [
|
|
3988
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1860
3989
|
Input,
|
|
1861
3990
|
{
|
|
1862
3991
|
label,
|
|
1863
3992
|
variant: "base",
|
|
1864
|
-
disabled: true,
|
|
1865
3993
|
value: valueState || "",
|
|
1866
3994
|
propsComponent: {
|
|
1867
3995
|
control: properties?.control,
|
|
@@ -1869,14 +3997,14 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1869
3997
|
}
|
|
1870
3998
|
}
|
|
1871
3999
|
),
|
|
1872
|
-
/* @__PURE__ */ (0,
|
|
4000
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1873
4001
|
"div",
|
|
1874
4002
|
{
|
|
1875
4003
|
className: iconClasses,
|
|
1876
4004
|
style: properties?.icon?.style,
|
|
1877
4005
|
onClick: () => !disabled && setOpen(true),
|
|
1878
4006
|
"data-testid": "yr3MonthSelector--icon",
|
|
1879
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0,
|
|
4007
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1880
4008
|
IconCalendar,
|
|
1881
4009
|
{
|
|
1882
4010
|
width: properties?.icon?.svg?.width,
|
|
@@ -1887,57 +4015,55 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1887
4015
|
)
|
|
1888
4016
|
}
|
|
1889
4017
|
),
|
|
1890
|
-
open && /* @__PURE__ */ (0,
|
|
4018
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1891
4019
|
"div",
|
|
1892
4020
|
{
|
|
1893
4021
|
className: "yr3MonthSelector--wrapper",
|
|
1894
4022
|
style: composeStyles(properties?.wrapper?.ui, properties?.wrapper?.style),
|
|
1895
4023
|
"data-testid": "yr3MonthSelector--wrapper",
|
|
1896
|
-
children: /* @__PURE__ */ (0,
|
|
1897
|
-
/* @__PURE__ */ (0,
|
|
4024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "yr3MonthSelector--component", children: [
|
|
4025
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1898
4026
|
"div",
|
|
1899
4027
|
{
|
|
1900
4028
|
className: containerClasses,
|
|
1901
4029
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1902
4030
|
children: [
|
|
1903
|
-
/* @__PURE__ */ (0,
|
|
4031
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1904
4032
|
"button",
|
|
1905
4033
|
{
|
|
1906
4034
|
disabled: disabled || yearSelected === 0,
|
|
1907
4035
|
type: "button",
|
|
1908
4036
|
className: `yr3MonthSelector--year-button-back ${yearSelected === 0 ? "yr3MonthSelector--year-button-back--disabled" : ""} `,
|
|
1909
4037
|
onClick: () => handleYearChange(yearSelected - 1),
|
|
1910
|
-
children: /* @__PURE__ */ (0,
|
|
4038
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconLeft, { width: 20, height: 20, stroke: "currentColor" })
|
|
1911
4039
|
}
|
|
1912
4040
|
),
|
|
1913
|
-
/* @__PURE__ */ (0,
|
|
4041
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `yr3MonthSelector--year-option`, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Text, { variant: "body1", color: "primary", children: [
|
|
1914
4042
|
data.years[yearSelected],
|
|
1915
4043
|
" "
|
|
1916
4044
|
] }) }),
|
|
1917
|
-
/* @__PURE__ */ (0,
|
|
4045
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1918
4046
|
"button",
|
|
1919
4047
|
{
|
|
1920
4048
|
disabled: disabled || yearSelected === data.years.length - 1,
|
|
1921
4049
|
type: "button",
|
|
1922
4050
|
className: `yr3MonthSelector--year-button-next ${yearSelected === data.years.length - 1 ? "yr3MonthSelector--year-button-next--disabled" : ""}`,
|
|
1923
4051
|
onClick: () => handleYearChange(yearSelected + 1),
|
|
1924
|
-
children: /* @__PURE__ */ (0,
|
|
4052
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconRight, { width: 20, height: 30, stroke: "currentColor" })
|
|
1925
4053
|
}
|
|
1926
4054
|
)
|
|
1927
4055
|
]
|
|
1928
4056
|
}
|
|
1929
4057
|
),
|
|
1930
|
-
/* @__PURE__ */ (0,
|
|
4058
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "yr3MonthSelector--months", children: getData.months.map((m) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1931
4059
|
"button",
|
|
1932
4060
|
{
|
|
1933
4061
|
type: "button",
|
|
1934
4062
|
style: properties?.text?.button,
|
|
1935
4063
|
disabled: m.disabled,
|
|
1936
4064
|
className: `yr3MonthSelector--month ${m.disabled ? "yr3MonthSelector--month--disabled" : ""} ${m.selected ? "yr3MonthSelector--month--selected" : ""}`,
|
|
1937
|
-
onClick: () =>
|
|
1938
|
-
|
|
1939
|
-
},
|
|
1940
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { ...properties?.text, weight: m.disabled ? "thin" : "medium", children: m.label })
|
|
4065
|
+
onClick: () => handleMonthChange(m.value),
|
|
4066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { ...properties?.text, weight: m.disabled ? "thin" : "medium", children: m.label })
|
|
1941
4067
|
},
|
|
1942
4068
|
"month-" + m.value
|
|
1943
4069
|
)) })
|
|
@@ -1948,8 +4074,8 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1948
4074
|
};
|
|
1949
4075
|
|
|
1950
4076
|
// src/components/Fade/Fade.tsx
|
|
1951
|
-
var
|
|
1952
|
-
var
|
|
4077
|
+
var React12 = __toESM(require("react"), 1);
|
|
4078
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1953
4079
|
var Fade = ({
|
|
1954
4080
|
in: inProp,
|
|
1955
4081
|
children,
|
|
@@ -1957,7 +4083,7 @@ var Fade = ({
|
|
|
1957
4083
|
onTransitionEnd,
|
|
1958
4084
|
style
|
|
1959
4085
|
}) => {
|
|
1960
|
-
|
|
4086
|
+
React12.useEffect(() => {
|
|
1961
4087
|
let timeoutId;
|
|
1962
4088
|
if (inProp) {
|
|
1963
4089
|
timeoutId = setTimeout(() => {
|
|
@@ -1966,7 +4092,7 @@ var Fade = ({
|
|
|
1966
4092
|
}
|
|
1967
4093
|
return () => clearTimeout(timeoutId);
|
|
1968
4094
|
}, [inProp, duration, onTransitionEnd]);
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
4095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1970
4096
|
"div",
|
|
1971
4097
|
{
|
|
1972
4098
|
className: `yr3Fade ${inProp ? "yr3Fade--in" : ""}`,
|
|
@@ -1977,61 +4103,8 @@ var Fade = ({
|
|
|
1977
4103
|
);
|
|
1978
4104
|
};
|
|
1979
4105
|
|
|
1980
|
-
// src/components/Flex/flex.variants.ts
|
|
1981
|
-
var flexVariants = createVariants({
|
|
1982
|
-
base: "yr3Flex",
|
|
1983
|
-
variants: {
|
|
1984
|
-
variant: {
|
|
1985
|
-
row: "yr3Flex--row",
|
|
1986
|
-
column: "yr3Flex--column",
|
|
1987
|
-
wrap: "yr3Flex--wrap"
|
|
1988
|
-
},
|
|
1989
|
-
container: {
|
|
1990
|
-
true: "yr3Flex--container"
|
|
1991
|
-
},
|
|
1992
|
-
center: {
|
|
1993
|
-
true: "yr3Flex--center"
|
|
1994
|
-
},
|
|
1995
|
-
between: {
|
|
1996
|
-
true: "yr3Flex--between"
|
|
1997
|
-
},
|
|
1998
|
-
bordered: {
|
|
1999
|
-
true: "yr3Flex--bordered"
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
});
|
|
2003
|
-
var flex_variants_default = flexVariants;
|
|
2004
|
-
|
|
2005
|
-
// src/components/Flex/Flex.tsx
|
|
2006
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2007
|
-
var Flex = ({
|
|
2008
|
-
container = false,
|
|
2009
|
-
spacing: spacing2 = 1,
|
|
2010
|
-
children,
|
|
2011
|
-
ui,
|
|
2012
|
-
gap,
|
|
2013
|
-
variant = "column",
|
|
2014
|
-
center = false,
|
|
2015
|
-
between = false,
|
|
2016
|
-
style,
|
|
2017
|
-
bordered = false,
|
|
2018
|
-
...props
|
|
2019
|
-
}) => {
|
|
2020
|
-
const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
|
|
2021
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2022
|
-
"div",
|
|
2023
|
-
{
|
|
2024
|
-
className: classes,
|
|
2025
|
-
style: composeStyles(ui, style),
|
|
2026
|
-
...props,
|
|
2027
|
-
"data-testid": "yr3Flex",
|
|
2028
|
-
children
|
|
2029
|
-
}
|
|
2030
|
-
);
|
|
2031
|
-
};
|
|
2032
|
-
|
|
2033
4106
|
// src/components/Grid/Grid.tsx
|
|
2034
|
-
var
|
|
4107
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2035
4108
|
var Grid = ({
|
|
2036
4109
|
container = false,
|
|
2037
4110
|
spacing: spacing2 = 0,
|
|
@@ -2064,7 +4137,7 @@ var Grid = ({
|
|
|
2064
4137
|
}
|
|
2065
4138
|
const classes = bem("yr3Grid");
|
|
2066
4139
|
const className = classes(void 0, { container, [`spacing-${spacing2}`]: center, span: item && `Col-${size}` });
|
|
2067
|
-
return /* @__PURE__ */ (0,
|
|
4140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2068
4141
|
"div",
|
|
2069
4142
|
{
|
|
2070
4143
|
className,
|
|
@@ -2077,7 +4150,7 @@ var Grid = ({
|
|
|
2077
4150
|
};
|
|
2078
4151
|
|
|
2079
4152
|
// src/components/Group/Group.tsx
|
|
2080
|
-
var
|
|
4153
|
+
var React13 = __toESM(require("react"), 1);
|
|
2081
4154
|
|
|
2082
4155
|
// src/components/Group/group.variants.ts
|
|
2083
4156
|
var groupVariants = createVariants({
|
|
@@ -2108,8 +4181,8 @@ var groupVariants = createVariants({
|
|
|
2108
4181
|
});
|
|
2109
4182
|
|
|
2110
4183
|
// src/components/Group/Group.tsx
|
|
2111
|
-
var
|
|
2112
|
-
var
|
|
4184
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4185
|
+
var initialComponents2 = (color) => ({
|
|
2113
4186
|
group: {
|
|
2114
4187
|
ui: {},
|
|
2115
4188
|
style: {}
|
|
@@ -2137,13 +4210,13 @@ var Group = ({
|
|
|
2137
4210
|
exclude = false,
|
|
2138
4211
|
propsComponent
|
|
2139
4212
|
}) => {
|
|
2140
|
-
const properties =
|
|
2141
|
-
|
|
4213
|
+
const properties = mergeDeep2(
|
|
4214
|
+
initialComponents2(type === "rounded" ? "text" : color),
|
|
2142
4215
|
propsComponent || {}
|
|
2143
4216
|
);
|
|
2144
|
-
const [internalValue, setInternalValue] =
|
|
4217
|
+
const [internalValue, setInternalValue] = React13.useState(null);
|
|
2145
4218
|
const isControlled = value !== void 0;
|
|
2146
|
-
|
|
4219
|
+
React13.useEffect(() => {
|
|
2147
4220
|
if (isControlled) {
|
|
2148
4221
|
setInternalValue(value);
|
|
2149
4222
|
}
|
|
@@ -2154,7 +4227,7 @@ var Group = ({
|
|
|
2154
4227
|
active: !exclude ? Array.isArray(value) ? value.includes(item?.value) : internalValue === item.value : false,
|
|
2155
4228
|
exclude: exclude && Array.isArray(value) ? !value.includes(item?.value) : ""
|
|
2156
4229
|
});
|
|
2157
|
-
const mappingStyle =
|
|
4230
|
+
const mappingStyle = React13.useMemo(() => {
|
|
2158
4231
|
if (variant !== "filled") return options.map((opt, index) => ({
|
|
2159
4232
|
...opt,
|
|
2160
4233
|
index,
|
|
@@ -2185,13 +4258,13 @@ var Group = ({
|
|
|
2185
4258
|
}
|
|
2186
4259
|
}));
|
|
2187
4260
|
}, [exclude, value, options, type]);
|
|
2188
|
-
return /* @__PURE__ */ (0,
|
|
4261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2189
4262
|
"div",
|
|
2190
4263
|
{
|
|
2191
4264
|
className: groupVariants({ variant, color, type }),
|
|
2192
4265
|
"data-testid": "yr3Group",
|
|
2193
4266
|
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
2194
|
-
children: options.map((opt, index) => /* @__PURE__ */ (0,
|
|
4267
|
+
children: options.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2195
4268
|
"div",
|
|
2196
4269
|
{
|
|
2197
4270
|
"data-testid": "yr3Group-item",
|
|
@@ -2209,7 +4282,7 @@ var Group = ({
|
|
|
2209
4282
|
...mappingStyle?.find((o) => o.value === opt.value)?.style
|
|
2210
4283
|
}
|
|
2211
4284
|
),
|
|
2212
|
-
children: /* @__PURE__ */ (0,
|
|
4285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2213
4286
|
Text,
|
|
2214
4287
|
{
|
|
2215
4288
|
...properties.item?.text,
|
|
@@ -2225,14 +4298,14 @@ var Group = ({
|
|
|
2225
4298
|
};
|
|
2226
4299
|
|
|
2227
4300
|
// src/components/Image/Image.tsx
|
|
2228
|
-
var
|
|
4301
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2229
4302
|
var Image = ({
|
|
2230
4303
|
src,
|
|
2231
4304
|
alt = "",
|
|
2232
4305
|
ui,
|
|
2233
4306
|
style
|
|
2234
4307
|
}) => {
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
4308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2236
4309
|
"img",
|
|
2237
4310
|
{
|
|
2238
4311
|
src,
|
|
@@ -2245,8 +4318,8 @@ var Image = ({
|
|
|
2245
4318
|
};
|
|
2246
4319
|
|
|
2247
4320
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
2248
|
-
var
|
|
2249
|
-
var
|
|
4321
|
+
var React14 = __toESM(require("react"), 1);
|
|
4322
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2250
4323
|
var initialPropsComponent4 = {
|
|
2251
4324
|
box: {},
|
|
2252
4325
|
text: {},
|
|
@@ -2255,10 +4328,10 @@ var initialPropsComponent4 = {
|
|
|
2255
4328
|
content: {}
|
|
2256
4329
|
};
|
|
2257
4330
|
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
2258
|
-
const properties =
|
|
2259
|
-
const [dragging, setDragging] =
|
|
2260
|
-
const [files, setFiles] =
|
|
2261
|
-
const inputRef =
|
|
4331
|
+
const properties = mergeDeep2(initialPropsComponent4, propsComponent || {});
|
|
4332
|
+
const [dragging, setDragging] = React14.useState(false);
|
|
4333
|
+
const [files, setFiles] = React14.useState([]);
|
|
4334
|
+
const inputRef = React14.useRef(null);
|
|
2262
4335
|
const handleFiles = (fileList) => {
|
|
2263
4336
|
if (!fileList) return;
|
|
2264
4337
|
const newFiles = Array.from(fileList);
|
|
@@ -2270,7 +4343,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2270
4343
|
};
|
|
2271
4344
|
const classes = bem("yr3Dropzone");
|
|
2272
4345
|
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
2273
|
-
return /* @__PURE__ */ (0,
|
|
4346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { as: "div", position: "relative", content: "center", ...properties?.box, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2274
4347
|
"div",
|
|
2275
4348
|
{
|
|
2276
4349
|
className: classComponent,
|
|
@@ -2287,7 +4360,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2287
4360
|
onClick: () => inputRef.current?.click(),
|
|
2288
4361
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
2289
4362
|
children: [
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
4363
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2291
4364
|
"input",
|
|
2292
4365
|
{
|
|
2293
4366
|
ref: inputRef,
|
|
@@ -2298,10 +4371,10 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2298
4371
|
onChange: (e) => handleFiles(e.target.files)
|
|
2299
4372
|
}
|
|
2300
4373
|
),
|
|
2301
|
-
isEmpty(files) && /* @__PURE__ */ (0,
|
|
2302
|
-
multiple && /* @__PURE__ */ (0,
|
|
2303
|
-
!multiple && /* @__PURE__ */ (0,
|
|
2304
|
-
!!defaultImage && /* @__PURE__ */ (0,
|
|
4374
|
+
isEmpty(files) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Dropzone--content", style: composeStyles(properties?.content?.ui, properties?.content?.style), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { variant: "helper", color: "disabled", ...propsComponent?.text, children: propsComponent?.text?.primary || "Drag and drop an image here, or click to select one" }) }),
|
|
4375
|
+
multiple && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Dropzone--previews", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
4376
|
+
!multiple && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
4377
|
+
!!defaultImage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: defaultImage }) }),
|
|
2305
4378
|
component
|
|
2306
4379
|
]
|
|
2307
4380
|
}
|
|
@@ -2309,7 +4382,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2309
4382
|
};
|
|
2310
4383
|
|
|
2311
4384
|
// src/components/InputArea/InputArea.tsx
|
|
2312
|
-
var
|
|
4385
|
+
var React15 = __toESM(require("react"), 1);
|
|
2313
4386
|
|
|
2314
4387
|
// src/components/InputArea/inputAreaVariants.ts
|
|
2315
4388
|
var inputAreaVariants = createVariants({
|
|
@@ -2350,7 +4423,7 @@ var inputAreaVariants = createVariants({
|
|
|
2350
4423
|
});
|
|
2351
4424
|
|
|
2352
4425
|
// src/components/InputArea/InputArea.tsx
|
|
2353
|
-
var
|
|
4426
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2354
4427
|
var initiaPropsComponent2 = {
|
|
2355
4428
|
label: {
|
|
2356
4429
|
display: true,
|
|
@@ -2375,8 +4448,8 @@ var InputArea = ({
|
|
|
2375
4448
|
rounded = false,
|
|
2376
4449
|
propsComponent = initiaPropsComponent2
|
|
2377
4450
|
}) => {
|
|
2378
|
-
const ref =
|
|
2379
|
-
const [internalValue, setInternalValue] =
|
|
4451
|
+
const ref = React15.useRef(null);
|
|
4452
|
+
const [internalValue, setInternalValue] = React15.useState(defaultValue);
|
|
2380
4453
|
const isControlled = value !== void 0;
|
|
2381
4454
|
const currentValue = isControlled ? value : internalValue;
|
|
2382
4455
|
const handleChange = (e) => {
|
|
@@ -2393,8 +4466,8 @@ var InputArea = ({
|
|
|
2393
4466
|
el.style.resize = resize;
|
|
2394
4467
|
}
|
|
2395
4468
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
2396
|
-
return /* @__PURE__ */ (0,
|
|
2397
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0,
|
|
4469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { style: { position: "relative" }, children: [
|
|
4470
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2398
4471
|
Label,
|
|
2399
4472
|
{
|
|
2400
4473
|
text: label || "",
|
|
@@ -2402,7 +4475,7 @@ var InputArea = ({
|
|
|
2402
4475
|
...propsComponent.label
|
|
2403
4476
|
}
|
|
2404
4477
|
),
|
|
2405
|
-
/* @__PURE__ */ (0,
|
|
4478
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2406
4479
|
"textarea",
|
|
2407
4480
|
{
|
|
2408
4481
|
className: classes,
|
|
@@ -2414,76 +4487,10 @@ var InputArea = ({
|
|
|
2414
4487
|
"data-testid": "yr3InputArea"
|
|
2415
4488
|
}
|
|
2416
4489
|
),
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { variant: "helper", color: currentValue.length > maxLength ? "error" : "disabled", ui: { textAlign: "right" }, "data-testid": "yr3InputAreaError", children: validate && maxLength ? `${currentValue.length}/${maxLength}` || propsComponent.helperText : "" })
|
|
2418
4491
|
] });
|
|
2419
4492
|
};
|
|
2420
4493
|
|
|
2421
|
-
// src/components/Loader/loader.variants.ts
|
|
2422
|
-
var loaderSpinnerVariants = createVariants({
|
|
2423
|
-
base: "yr3Loader--spinner",
|
|
2424
|
-
variants: {
|
|
2425
|
-
color: {
|
|
2426
|
-
primary: "yr3Loader--spinner-color-primary",
|
|
2427
|
-
secondary: "yr3Loader--spinner-color-secondary",
|
|
2428
|
-
success: "yr3Loader--spinner-color-success",
|
|
2429
|
-
error: "yr3Loader--spinner-color-error",
|
|
2430
|
-
warning: "yr3Loader--spinner-color-warning",
|
|
2431
|
-
info: "yr3Loader--spinner-color-info",
|
|
2432
|
-
disabled: "yr3Loader--spinner-color-disabled",
|
|
2433
|
-
text: "yr3Loader--spinner-color-text",
|
|
2434
|
-
background: "yr3Loader--spinner-color-background",
|
|
2435
|
-
common: "yr3Loader--spinner-color-common"
|
|
2436
|
-
},
|
|
2437
|
-
size: {
|
|
2438
|
-
sm: "yr3Loader--spinner-size-sm",
|
|
2439
|
-
md: "yr3Loader--spinner-size-md",
|
|
2440
|
-
lg: "yr3Loader--spinner-size-lg"
|
|
2441
|
-
},
|
|
2442
|
-
type: {
|
|
2443
|
-
default: "yr3Loader--spinner-default",
|
|
2444
|
-
dots: "yr3Loader--spinner-dots",
|
|
2445
|
-
fancy: "yr3Loader--spinner-fancy"
|
|
2446
|
-
}
|
|
2447
|
-
}
|
|
2448
|
-
});
|
|
2449
|
-
|
|
2450
|
-
// src/components/Loader/Loader.tsx
|
|
2451
|
-
var React15 = __toESM(require("react"), 1);
|
|
2452
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2453
|
-
var initialComponents2 = {
|
|
2454
|
-
loader: {
|
|
2455
|
-
ui: {},
|
|
2456
|
-
style: {}
|
|
2457
|
-
},
|
|
2458
|
-
spinner: {
|
|
2459
|
-
size: "sm",
|
|
2460
|
-
color: "primary",
|
|
2461
|
-
type: "default"
|
|
2462
|
-
},
|
|
2463
|
-
container: {
|
|
2464
|
-
center: true,
|
|
2465
|
-
container: true,
|
|
2466
|
-
ui: {
|
|
2467
|
-
width: "100%",
|
|
2468
|
-
height: "100%"
|
|
2469
|
-
}
|
|
2470
|
-
}
|
|
2471
|
-
};
|
|
2472
|
-
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2473
|
-
const properties = mergeDeep(initialComponents2, propsComponent || {});
|
|
2474
|
-
const classSpinner = loaderSpinnerVariants({
|
|
2475
|
-
color: properties?.spinner?.color,
|
|
2476
|
-
type: properties?.spinner?.type,
|
|
2477
|
-
size: properties?.spinner?.size
|
|
2478
|
-
});
|
|
2479
|
-
if (!loading) return null;
|
|
2480
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "yr3Loader", style: composeStyles(properties?.loader?.ui, properties?.loader?.style), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Flex, { ...properties?.container, children: component || /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: classSpinner, children: properties?.spinner?.type === "dots" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(React15.Fragment, { children: [
|
|
2481
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {}),
|
|
2482
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {}),
|
|
2483
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {})
|
|
2484
|
-
] }) }) }) });
|
|
2485
|
-
};
|
|
2486
|
-
|
|
2487
4494
|
// src/components/Modal/Modal.tsx
|
|
2488
4495
|
var React16 = __toESM(require("react"), 1);
|
|
2489
4496
|
|
|
@@ -2709,7 +4716,7 @@ var Picker = ({ label, variant, color, children, name, value, onChange, propsCom
|
|
|
2709
4716
|
const [valueState, setValueState] = React17.useState(value || null);
|
|
2710
4717
|
const ref = React17.useRef(null);
|
|
2711
4718
|
useClickAway(ref, () => setOpen(false));
|
|
2712
|
-
const properties =
|
|
4719
|
+
const properties = mergeDeep2(initiaPropsComponent3, propsComponent || {});
|
|
2713
4720
|
const classesIcon = PickerIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2714
4721
|
const classes = PickerVariants({ wrapper: true, variant, color });
|
|
2715
4722
|
React17.useEffect(() => {
|
|
@@ -2950,7 +4957,7 @@ var PlacesAutocomplete = ({
|
|
|
2950
4957
|
keyApi,
|
|
2951
4958
|
propsComponent = initPropsComponent
|
|
2952
4959
|
}) => {
|
|
2953
|
-
const [value,
|
|
4960
|
+
const [value, setValue2] = React20.useState(null);
|
|
2954
4961
|
const inputRef = React20.useRef(null);
|
|
2955
4962
|
const [anchorEl, setAnchorEl] = React20.useState(null);
|
|
2956
4963
|
const { suggestions, selectPlace } = (0, import_autocomplete_places.useAutocompletePlaces)({ input: value, apiKey: keyApi, language, provider });
|
|
@@ -2969,12 +4976,12 @@ var PlacesAutocomplete = ({
|
|
|
2969
4976
|
placeId: id
|
|
2970
4977
|
};
|
|
2971
4978
|
onSelect(locationData);
|
|
2972
|
-
|
|
4979
|
+
setValue2(place.address);
|
|
2973
4980
|
setAnchorEl(null);
|
|
2974
4981
|
};
|
|
2975
4982
|
React20.useEffect(() => {
|
|
2976
4983
|
if (defaultLocation) {
|
|
2977
|
-
|
|
4984
|
+
setValue2(defaultLocation);
|
|
2978
4985
|
}
|
|
2979
4986
|
}, [defaultLocation]);
|
|
2980
4987
|
React20.useEffect(() => {
|
|
@@ -2983,7 +4990,7 @@ var PlacesAutocomplete = ({
|
|
|
2983
4990
|
}
|
|
2984
4991
|
}, [value]);
|
|
2985
4992
|
const handleChange = (e) => {
|
|
2986
|
-
|
|
4993
|
+
setValue2(e.target.value);
|
|
2987
4994
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2988
4995
|
};
|
|
2989
4996
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
@@ -3180,12 +5187,12 @@ var initiaPropsComponent4 = {
|
|
|
3180
5187
|
component: void 0
|
|
3181
5188
|
}
|
|
3182
5189
|
};
|
|
3183
|
-
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled }) => {
|
|
5190
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled = false }) => {
|
|
3184
5191
|
const [open, setOpen] = React21.useState(false);
|
|
3185
5192
|
const [valueState, setValueState] = React21.useState(value || defaultValue || null);
|
|
3186
5193
|
const ref = React21.useRef(null);
|
|
3187
5194
|
useClickAway(ref, () => setOpen(false));
|
|
3188
|
-
const properties =
|
|
5195
|
+
const properties = mergeDeep2(initiaPropsComponent4, propsComponent || {});
|
|
3189
5196
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
3190
5197
|
const classes = selectVariants({ wrapper: true, disabled });
|
|
3191
5198
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: classes, ref, children: [
|
|
@@ -3194,10 +5201,15 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
3194
5201
|
{
|
|
3195
5202
|
label,
|
|
3196
5203
|
variant: "base",
|
|
3197
|
-
disabled: true,
|
|
3198
5204
|
value: options.find((opt) => opt.value === valueState)?.label || "",
|
|
3199
5205
|
propsComponent: {
|
|
3200
|
-
control:
|
|
5206
|
+
control: {
|
|
5207
|
+
...properties?.control,
|
|
5208
|
+
ui: {
|
|
5209
|
+
...properties?.control?.ui,
|
|
5210
|
+
pointerEvents: "none"
|
|
5211
|
+
}
|
|
5212
|
+
},
|
|
3201
5213
|
label: properties?.label
|
|
3202
5214
|
}
|
|
3203
5215
|
}
|
|
@@ -3302,7 +5314,7 @@ var Slide = ({
|
|
|
3302
5314
|
onTransitionEnd,
|
|
3303
5315
|
propsComponent
|
|
3304
5316
|
}) => {
|
|
3305
|
-
const properties =
|
|
5317
|
+
const properties = mergeDeep2(initialPropsComponent5, propsComponent || {});
|
|
3306
5318
|
const stateRef = React22.useRef(inProp ? "in" : "out");
|
|
3307
5319
|
React22.useEffect(() => {
|
|
3308
5320
|
stateRef.current = inProp ? "in" : "out";
|
|
@@ -3505,17 +5517,17 @@ function useMediaQuery(query) {
|
|
|
3505
5517
|
}, [computedQuery]);
|
|
3506
5518
|
return matches;
|
|
3507
5519
|
}
|
|
3508
|
-
function useBreakpointValue(
|
|
5520
|
+
function useBreakpointValue(values2) {
|
|
3509
5521
|
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
3510
5522
|
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
3511
5523
|
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
3512
5524
|
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
3513
5525
|
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
3514
|
-
if (xl &&
|
|
3515
|
-
if (lg &&
|
|
3516
|
-
if (md &&
|
|
3517
|
-
if (sm &&
|
|
3518
|
-
if (xs &&
|
|
5526
|
+
if (xl && values2.xl !== void 0) return values2.xl;
|
|
5527
|
+
if (lg && values2.lg !== void 0) return values2.lg;
|
|
5528
|
+
if (md && values2.md !== void 0) return values2.md;
|
|
5529
|
+
if (sm && values2.sm !== void 0) return values2.sm;
|
|
5530
|
+
if (xs && values2.xs !== void 0) return values2.xs;
|
|
3519
5531
|
return void 0;
|
|
3520
5532
|
}
|
|
3521
5533
|
|
|
@@ -3631,6 +5643,9 @@ initTheme();
|
|
|
3631
5643
|
createVariants,
|
|
3632
5644
|
cx,
|
|
3633
5645
|
darken,
|
|
5646
|
+
date,
|
|
5647
|
+
dtx,
|
|
5648
|
+
findMonth,
|
|
3634
5649
|
getContrast,
|
|
3635
5650
|
getCountryCodePhone,
|
|
3636
5651
|
getDialPhone,
|
|
@@ -3640,13 +5655,12 @@ initTheme();
|
|
|
3640
5655
|
hexToRgb,
|
|
3641
5656
|
initTheme,
|
|
3642
5657
|
inputCurrency,
|
|
3643
|
-
isEmpty,
|
|
3644
5658
|
lighten,
|
|
3645
5659
|
mergeDeep,
|
|
5660
|
+
mergeInitialProps,
|
|
3646
5661
|
normalizePhone,
|
|
3647
5662
|
rgbToHex,
|
|
3648
5663
|
text,
|
|
3649
|
-
times,
|
|
3650
5664
|
uiStyle,
|
|
3651
5665
|
useBackdrop,
|
|
3652
5666
|
useBreakpoint,
|
|
@@ -3656,5 +5670,6 @@ initTheme();
|
|
|
3656
5670
|
useMediaQuery,
|
|
3657
5671
|
useNotistack,
|
|
3658
5672
|
usePlaces,
|
|
3659
|
-
useTheme
|
|
5673
|
+
useTheme,
|
|
5674
|
+
utils
|
|
3660
5675
|
});
|