@yr3/ui 1.0.24 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2
- package/dist/components/Button/buttons.css +2 -0
- package/dist/components/Button/buttons.css.map +1 -1
- package/dist/components/Calendar/calendar.css +0 -2
- package/dist/components/Calendar/calendar.css.map +1 -1
- package/dist/components/Control/control.css +2 -0
- package/dist/components/Control/control.css.map +1 -1
- package/dist/components/Date/month.css +20 -10
- package/dist/components/Date/month.css.map +1 -1
- package/dist/components/Loader/loader.css +5 -0
- package/dist/components/Loader/loader.css.map +1 -1
- package/dist/index.cjs +2415 -432
- package/dist/index.d.cts +775 -89
- package/dist/index.d.ts +775 -89
- package/dist/index.js +2428 -441
- package/dist/styles/index.css +29 -12
- package/dist/styles/index.css.map +1 -1
- package/package.json +2 -4
package/dist/index.cjs
CHANGED
|
@@ -93,6 +93,8 @@ __export(index_exports, {
|
|
|
93
93
|
createVariants: () => createVariants,
|
|
94
94
|
cx: () => cx,
|
|
95
95
|
darken: () => darken,
|
|
96
|
+
date: () => date,
|
|
97
|
+
dtx: () => dtx,
|
|
96
98
|
getContrast: () => getContrast,
|
|
97
99
|
getCountryCodePhone: () => getCountryCodePhone,
|
|
98
100
|
getDialPhone: () => getDialPhone,
|
|
@@ -102,13 +104,12 @@ __export(index_exports, {
|
|
|
102
104
|
hexToRgb: () => hexToRgb,
|
|
103
105
|
initTheme: () => initTheme,
|
|
104
106
|
inputCurrency: () => inputCurrency,
|
|
105
|
-
isEmpty: () => isEmpty,
|
|
106
107
|
lighten: () => lighten,
|
|
107
|
-
mergeDeep: () =>
|
|
108
|
+
mergeDeep: () => mergeDeep2,
|
|
109
|
+
mergeInitialProps: () => mergeInitialProps,
|
|
108
110
|
normalizePhone: () => normalizePhone,
|
|
109
|
-
rgbToHex: () =>
|
|
111
|
+
rgbToHex: () => rgbToHex2,
|
|
110
112
|
text: () => text,
|
|
111
|
-
times: () => times,
|
|
112
113
|
uiStyle: () => uiStyle,
|
|
113
114
|
useBackdrop: () => useBackdrop,
|
|
114
115
|
useBreakpoint: () => useBreakpoint,
|
|
@@ -118,84 +119,1986 @@ __export(index_exports, {
|
|
|
118
119
|
useMediaQuery: () => useMediaQuery,
|
|
119
120
|
useNotistack: () => useNotistack,
|
|
120
121
|
usePlaces: () => usePlaces,
|
|
121
|
-
useTheme: () => useTheme
|
|
122
|
+
useTheme: () => useTheme,
|
|
123
|
+
utils: () => utils
|
|
122
124
|
});
|
|
123
125
|
module.exports = __toCommonJS(index_exports);
|
|
124
126
|
|
|
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}`);
|
|
127
|
+
// src/utils/bem.ts
|
|
128
|
+
var bem = (block) => {
|
|
129
|
+
return (element, modifiers) => {
|
|
130
|
+
const base = element ? `${block}__${element}` : block;
|
|
131
|
+
const classes = [base];
|
|
132
|
+
if (modifiers) {
|
|
133
|
+
Object.entries(modifiers).forEach(([key, value]) => {
|
|
134
|
+
if (!value) return;
|
|
135
|
+
if (typeof value === "boolean") {
|
|
136
|
+
classes.push(`${base}--${key}`);
|
|
137
|
+
} else {
|
|
138
|
+
classes.push(`${base}--${value}`);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return classes.join(" ");
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
var bemMerge = (...args) => {
|
|
146
|
+
return args.flatMap((arg) => {
|
|
147
|
+
if (!arg) return [];
|
|
148
|
+
if (typeof arg === "string") return [arg];
|
|
149
|
+
if (typeof arg === "object") {
|
|
150
|
+
return Object.entries(arg).filter(([_, v]) => v).map(([k]) => k);
|
|
151
|
+
}
|
|
152
|
+
return [];
|
|
153
|
+
}).join(" ");
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// src/utils/common.ts
|
|
157
|
+
var common_exports = {};
|
|
158
|
+
__export(common_exports, {
|
|
159
|
+
assign: () => assign,
|
|
160
|
+
blendColors: () => blendColors,
|
|
161
|
+
camelCase: () => camelCase,
|
|
162
|
+
capitalize: () => capitalize,
|
|
163
|
+
capitalizeWords: () => capitalizeWords,
|
|
164
|
+
ceil: () => ceil,
|
|
165
|
+
chunk: () => chunk,
|
|
166
|
+
clamp: () => clamp,
|
|
167
|
+
clampNumber: () => clampNumber,
|
|
168
|
+
compact: () => compact,
|
|
169
|
+
concat: () => concat,
|
|
170
|
+
countBy: () => countBy,
|
|
171
|
+
darkenColor: () => darkenColor,
|
|
172
|
+
debounce: () => debounce,
|
|
173
|
+
decapitalize: () => decapitalize,
|
|
174
|
+
decapitalizeWords: () => decapitalizeWords,
|
|
175
|
+
defaults: () => defaults,
|
|
176
|
+
defaultsDeep: () => defaultsDeep,
|
|
177
|
+
desaturateColor: () => desaturateColor,
|
|
178
|
+
difference: () => difference,
|
|
179
|
+
differenceBy: () => differenceBy,
|
|
180
|
+
emToPx: () => emToPx,
|
|
181
|
+
endsWith: () => endsWith,
|
|
182
|
+
entries: () => entries,
|
|
183
|
+
escape: () => escape,
|
|
184
|
+
first: () => first,
|
|
185
|
+
flatten: () => flatten,
|
|
186
|
+
floor: () => floor,
|
|
187
|
+
fromEntries: () => fromEntries,
|
|
188
|
+
generateAnalogousPalette: () => generateAnalogousPalette,
|
|
189
|
+
generateComplementaryPalette: () => generateComplementaryPalette,
|
|
190
|
+
generateGradientColors: () => generateGradientColors,
|
|
191
|
+
generateMonochromaticPalette: () => generateMonochromaticPalette,
|
|
192
|
+
generateNanoId: () => generateNanoId,
|
|
193
|
+
generateRandomAlphaId: () => generateRandomAlphaId,
|
|
194
|
+
generateRandomAlphanumericId: () => generateRandomAlphanumericId,
|
|
195
|
+
generateRandomApiKey: () => generateRandomApiKey,
|
|
196
|
+
generateRandomBase64Id: () => generateRandomBase64Id,
|
|
197
|
+
generateRandomColor: () => generateRandomColor,
|
|
198
|
+
generateRandomColorPalette: () => generateRandomColorPalette,
|
|
199
|
+
generateRandomColorScheme: () => generateRandomColorScheme,
|
|
200
|
+
generateRandomCoolColor: () => generateRandomCoolColor,
|
|
201
|
+
generateRandomCoolPalette: () => generateRandomCoolPalette,
|
|
202
|
+
generateRandomDarkColor: () => generateRandomDarkColor,
|
|
203
|
+
generateRandomDarkPalette: () => generateRandomDarkPalette,
|
|
204
|
+
generateRandomDomain: () => generateRandomDomain,
|
|
205
|
+
generateRandomEarthToneColor: () => generateRandomEarthToneColor,
|
|
206
|
+
generateRandomEarthTonePalette: () => generateRandomEarthTonePalette,
|
|
207
|
+
generateRandomEmail: () => generateRandomEmail,
|
|
208
|
+
generateRandomGradient: () => generateRandomGradient,
|
|
209
|
+
generateRandomHSLColor: () => generateRandomHSLColor,
|
|
210
|
+
generateRandomHexColor: () => generateRandomHexColor,
|
|
211
|
+
generateRandomHexId: () => generateRandomHexId,
|
|
212
|
+
generateRandomLightColor: () => generateRandomLightColor,
|
|
213
|
+
generateRandomLightPalette: () => generateRandomLightPalette,
|
|
214
|
+
generateRandomMetallicColor: () => generateRandomMetallicColor,
|
|
215
|
+
generateRandomMetallicPalette: () => generateRandomMetallicPalette,
|
|
216
|
+
generateRandomMutedColor: () => generateRandomMutedColor,
|
|
217
|
+
generateRandomMutedPalette: () => generateRandomMutedPalette,
|
|
218
|
+
generateRandomNeonColor: () => generateRandomNeonColor,
|
|
219
|
+
generateRandomNeonPalette: () => generateRandomNeonPalette,
|
|
220
|
+
generateRandomNeutralColor: () => generateRandomNeutralColor,
|
|
221
|
+
generateRandomNeutralPalette: () => generateRandomNeutralPalette,
|
|
222
|
+
generateRandomNumericId: () => generateRandomNumericId,
|
|
223
|
+
generateRandomPassword: () => generateRandomPassword,
|
|
224
|
+
generateRandomPastelColor: () => generateRandomPastelColor,
|
|
225
|
+
generateRandomPastelPalette: () => generateRandomPastelPalette,
|
|
226
|
+
generateRandomRGBColor: () => generateRandomRGBColor,
|
|
227
|
+
generateRandomSessionId: () => generateRandomSessionId,
|
|
228
|
+
generateRandomSlug: () => generateRandomSlug,
|
|
229
|
+
generateRandomString: () => generateRandomString,
|
|
230
|
+
generateRandomToken: () => generateRandomToken,
|
|
231
|
+
generateRandomUrlSafeId: () => generateRandomUrlSafeId,
|
|
232
|
+
generateRandomUsername: () => generateRandomUsername,
|
|
233
|
+
generateRandomVibrantColor: () => generateRandomVibrantColor,
|
|
234
|
+
generateRandomVibrantPalette: () => generateRandomVibrantPalette,
|
|
235
|
+
generateRandomWarmColor: () => generateRandomWarmColor,
|
|
236
|
+
generateRandomWarmPalette: () => generateRandomWarmPalette,
|
|
237
|
+
generateShortId: () => generateShortId,
|
|
238
|
+
generateTetradicPalette: () => generateTetradicPalette,
|
|
239
|
+
generateTriadicPalette: () => generateTriadicPalette,
|
|
240
|
+
generateUUID: () => generateUUID,
|
|
241
|
+
generateUniqueId: () => generateUniqueId,
|
|
242
|
+
get: () => get,
|
|
243
|
+
getContrastColor: () => getContrastColor,
|
|
244
|
+
getDeepValue: () => getDeepValue,
|
|
245
|
+
getNestedValue: () => getNestedValue,
|
|
246
|
+
getValue: () => getValue,
|
|
247
|
+
getValueByPath: () => getValueByPath,
|
|
248
|
+
groupBy: () => groupBy,
|
|
249
|
+
hasDeepKey: () => hasDeepKey,
|
|
250
|
+
hasDeepValue: () => hasDeepValue,
|
|
251
|
+
hasKey: () => hasKey,
|
|
252
|
+
hasKeyByPath: () => hasKeyByPath,
|
|
253
|
+
hasNestedKey: () => hasNestedKey,
|
|
254
|
+
hasNestedValue: () => hasNestedValue,
|
|
255
|
+
hasValue: () => hasValue,
|
|
256
|
+
hasValueByPath: () => hasValueByPath,
|
|
257
|
+
hexToHSL: () => hexToHSL,
|
|
258
|
+
hexToRGB: () => hexToRGB,
|
|
259
|
+
hslToHex: () => hslToHex,
|
|
260
|
+
hslToRGB: () => hslToRGB,
|
|
261
|
+
includes: () => includes,
|
|
262
|
+
intersection: () => intersection,
|
|
263
|
+
intersectionBy: () => intersectionBy,
|
|
264
|
+
invert: () => invert,
|
|
265
|
+
invertColor: () => invertColor,
|
|
266
|
+
isArrayValue: () => isArrayValue,
|
|
267
|
+
isBase64: () => isBase64,
|
|
268
|
+
isBigIntValue: () => isBigIntValue,
|
|
269
|
+
isBooleanValue: () => isBooleanValue,
|
|
270
|
+
isCreditCard: () => isCreditCard,
|
|
271
|
+
isDarkColor: () => isDarkColor,
|
|
272
|
+
isEmail: () => isEmail,
|
|
273
|
+
isEmpty: () => isEmpty,
|
|
274
|
+
isEmptyArray: () => isEmptyArray,
|
|
275
|
+
isEmptyObject: () => isEmptyObject,
|
|
276
|
+
isEmptyString: () => isEmptyString,
|
|
277
|
+
isEmptyValue: () => isEmptyValue,
|
|
278
|
+
isFiniteNumber: () => isFiniteNumber,
|
|
279
|
+
isFunctionValue: () => isFunctionValue,
|
|
280
|
+
isHexColor: () => isHexColor,
|
|
281
|
+
isHexadecimal: () => isHexadecimal,
|
|
282
|
+
isIPv4: () => isIPv4,
|
|
283
|
+
isIPv6: () => isIPv6,
|
|
284
|
+
isISBN: () => isISBN,
|
|
285
|
+
isInteger: () => isInteger,
|
|
286
|
+
isJSON: () => isJSON,
|
|
287
|
+
isLightColor: () => isLightColor,
|
|
288
|
+
isMACAddress: () => isMACAddress,
|
|
289
|
+
isNaNValue: () => isNaNValue,
|
|
290
|
+
isNullValue: () => isNullValue,
|
|
291
|
+
isNumberValue: () => isNumberValue,
|
|
292
|
+
isObjectValue: () => isObjectValue,
|
|
293
|
+
isPhoneNumber: () => isPhoneNumber,
|
|
294
|
+
isPostalCode: () => isPostalCode,
|
|
295
|
+
isRGBColor: () => isRGBColor,
|
|
296
|
+
isSafeInteger: () => isSafeInteger,
|
|
297
|
+
isSlug: () => isSlug,
|
|
298
|
+
isStringValue: () => isStringValue,
|
|
299
|
+
isSymbolValue: () => isSymbolValue,
|
|
300
|
+
isURL: () => isURL,
|
|
301
|
+
isUUID: () => isUUID,
|
|
302
|
+
isUndefinedValue: () => isUndefinedValue,
|
|
303
|
+
isXML: () => isXML,
|
|
304
|
+
kebabCase: () => kebabCase,
|
|
305
|
+
keys: () => keys,
|
|
306
|
+
last: () => last,
|
|
307
|
+
lightenColor: () => lightenColor,
|
|
308
|
+
map: () => map,
|
|
309
|
+
mapKeys: () => mapKeys,
|
|
310
|
+
mapValues: () => mapValues,
|
|
311
|
+
memoize: () => memoize,
|
|
312
|
+
merge: () => merge,
|
|
313
|
+
mergeDeep: () => mergeDeep,
|
|
314
|
+
mixColors: () => mixColors,
|
|
315
|
+
nth: () => nth,
|
|
316
|
+
omit: () => omit,
|
|
317
|
+
omitBy: () => omitBy,
|
|
318
|
+
omitByDeep: () => omitByDeep,
|
|
319
|
+
once: () => once,
|
|
320
|
+
padEnd: () => padEnd,
|
|
321
|
+
padStart: () => padStart,
|
|
322
|
+
parseFloatValue: () => parseFloatValue,
|
|
323
|
+
parseIntValue: () => parseIntValue,
|
|
324
|
+
partition: () => partition,
|
|
325
|
+
percentToPx: () => percentToPx,
|
|
326
|
+
pick: () => pick,
|
|
327
|
+
pickBy: () => pickBy,
|
|
328
|
+
pickByDeep: () => pickByDeep,
|
|
329
|
+
pxToEm: () => pxToEm,
|
|
330
|
+
pxToPercent: () => pxToPercent,
|
|
331
|
+
pxToRem: () => pxToRem,
|
|
332
|
+
random: () => random,
|
|
333
|
+
randomNumber: () => randomNumber,
|
|
334
|
+
range: () => range,
|
|
335
|
+
remToEm: () => remToEm,
|
|
336
|
+
remToPx: () => remToPx,
|
|
337
|
+
repeat: () => repeat,
|
|
338
|
+
rgbToHSL: () => rgbToHSL,
|
|
339
|
+
rgbToHex: () => rgbToHex,
|
|
340
|
+
rotateHue: () => rotateHue,
|
|
341
|
+
round: () => round,
|
|
342
|
+
saturateColor: () => saturateColor,
|
|
343
|
+
setDeepValue: () => setDeepValue,
|
|
344
|
+
setNestedValue: () => setNestedValue,
|
|
345
|
+
setValue: () => setValue,
|
|
346
|
+
setValueByPath: () => setValueByPath,
|
|
347
|
+
shadeColor: () => shadeColor,
|
|
348
|
+
snakeCase: () => snakeCase,
|
|
349
|
+
startsWith: () => startsWith,
|
|
350
|
+
swapCase: () => swapCase,
|
|
351
|
+
throttle: () => throttle,
|
|
352
|
+
times: () => times,
|
|
353
|
+
tintColor: () => tintColor,
|
|
354
|
+
toExponential: () => toExponential,
|
|
355
|
+
toFinite: () => toFinite,
|
|
356
|
+
toFiniteNumber: () => toFiniteNumber,
|
|
357
|
+
toFixed: () => toFixed,
|
|
358
|
+
toInteger: () => toInteger,
|
|
359
|
+
toNumber: () => toNumber,
|
|
360
|
+
toPrecision: () => toPrecision,
|
|
361
|
+
toSafeInteger: () => toSafeInteger,
|
|
362
|
+
trim: () => trim,
|
|
363
|
+
trimEnd: () => trimEnd,
|
|
364
|
+
trimStart: () => trimStart,
|
|
365
|
+
truncate: () => truncate,
|
|
366
|
+
unescape: () => unescape,
|
|
367
|
+
union: () => union,
|
|
368
|
+
unionBy: () => unionBy,
|
|
369
|
+
uniqBy: () => uniqBy,
|
|
370
|
+
unique: () => unique,
|
|
371
|
+
unzip: () => unzip,
|
|
372
|
+
unzipWith: () => unzipWith,
|
|
373
|
+
upperCase: () => upperCase,
|
|
374
|
+
values: () => values,
|
|
375
|
+
without: () => without,
|
|
376
|
+
xor: () => xor,
|
|
377
|
+
zip: () => zip,
|
|
378
|
+
zipObject: () => zipObject,
|
|
379
|
+
zipObjectDeep: () => zipObjectDeep,
|
|
380
|
+
zipWith: () => zipWith,
|
|
381
|
+
zipWithDeep: () => zipWithDeep
|
|
382
|
+
});
|
|
383
|
+
function isEmpty(value) {
|
|
384
|
+
if (value == null) return true;
|
|
385
|
+
if (typeof value === "string") return value.trim().length === 0;
|
|
386
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
387
|
+
if (value instanceof Map || value instanceof Set) {
|
|
388
|
+
return value.size === 0;
|
|
389
|
+
}
|
|
390
|
+
if (typeof value === "object") {
|
|
391
|
+
return Object.keys(value).length === 0;
|
|
392
|
+
}
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
function times(n, iteratee) {
|
|
396
|
+
const result = [];
|
|
397
|
+
for (let i = 0; i < n; i++) {
|
|
398
|
+
result.push(iteratee(i));
|
|
399
|
+
}
|
|
400
|
+
return result;
|
|
401
|
+
}
|
|
402
|
+
function map(array, key, valueKey) {
|
|
403
|
+
const result = {};
|
|
404
|
+
for (const item of array) {
|
|
405
|
+
result[item[key]] = item[valueKey];
|
|
406
|
+
}
|
|
407
|
+
return result;
|
|
408
|
+
}
|
|
409
|
+
function get(obj, key) {
|
|
410
|
+
return obj[key];
|
|
411
|
+
}
|
|
412
|
+
function mergeDeep(target, source) {
|
|
413
|
+
if (typeof target !== "object" || target === null) {
|
|
414
|
+
return source;
|
|
415
|
+
}
|
|
416
|
+
const result = { ...target };
|
|
417
|
+
for (const key in source) {
|
|
418
|
+
if (source.hasOwnProperty(key)) {
|
|
419
|
+
const sourceValue = source[key];
|
|
420
|
+
const targetValue = target[key];
|
|
421
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
422
|
+
result[key] = mergeDeep(targetValue, sourceValue);
|
|
423
|
+
} else {
|
|
424
|
+
result[key] = sourceValue;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return result;
|
|
429
|
+
}
|
|
430
|
+
function omit(obj, keys2) {
|
|
431
|
+
const result = { ...obj };
|
|
432
|
+
for (const key of keys2) {
|
|
433
|
+
delete result[key];
|
|
434
|
+
}
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
function pick(obj, keys2) {
|
|
438
|
+
const result = {};
|
|
439
|
+
for (const key of keys2) {
|
|
440
|
+
if (key in obj) {
|
|
441
|
+
result[key] = obj[key];
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return result;
|
|
445
|
+
}
|
|
446
|
+
function flatten(array) {
|
|
447
|
+
const result = [];
|
|
448
|
+
for (const subArray of array) {
|
|
449
|
+
result.push(...subArray);
|
|
450
|
+
}
|
|
451
|
+
return result;
|
|
452
|
+
}
|
|
453
|
+
function unique(array) {
|
|
454
|
+
const seen = /* @__PURE__ */ new Set();
|
|
455
|
+
const result = [];
|
|
456
|
+
for (const item of array) {
|
|
457
|
+
if (!seen.has(item)) {
|
|
458
|
+
seen.add(item);
|
|
459
|
+
result.push(item);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return result;
|
|
463
|
+
}
|
|
464
|
+
function debounce(func, wait) {
|
|
465
|
+
let timeout = null;
|
|
466
|
+
return function(...args) {
|
|
467
|
+
if (timeout) {
|
|
468
|
+
clearTimeout(timeout);
|
|
469
|
+
}
|
|
470
|
+
timeout = setTimeout(() => {
|
|
471
|
+
func.apply(this, args);
|
|
472
|
+
}, wait);
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function throttle(func, limit) {
|
|
476
|
+
let inThrottle = false;
|
|
477
|
+
return function(...args) {
|
|
478
|
+
if (!inThrottle) {
|
|
479
|
+
func.apply(this, args);
|
|
480
|
+
inThrottle = true;
|
|
481
|
+
setTimeout(() => {
|
|
482
|
+
inThrottle = false;
|
|
483
|
+
}, limit);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
function once(func) {
|
|
488
|
+
let called = false;
|
|
489
|
+
return function(...args) {
|
|
490
|
+
if (!called) {
|
|
491
|
+
called = true;
|
|
492
|
+
func.apply(this, args);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
function memoize(func) {
|
|
497
|
+
const cache = /* @__PURE__ */ new Map();
|
|
498
|
+
return function(...args) {
|
|
499
|
+
const key = JSON.stringify(args);
|
|
500
|
+
if (cache.has(key)) {
|
|
501
|
+
return cache.get(key);
|
|
502
|
+
}
|
|
503
|
+
const result = func.apply(this, args);
|
|
504
|
+
cache.set(key, result);
|
|
505
|
+
return result;
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function range(start, end, step = 1) {
|
|
509
|
+
const result = [];
|
|
510
|
+
for (let i = start; i < end; i += step) {
|
|
511
|
+
result.push(i);
|
|
512
|
+
}
|
|
513
|
+
return result;
|
|
514
|
+
}
|
|
515
|
+
function random(min, max) {
|
|
516
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
517
|
+
}
|
|
518
|
+
function clamp(value, min, max) {
|
|
519
|
+
return Math.max(min, Math.min(max, value));
|
|
520
|
+
}
|
|
521
|
+
function capitalize(str) {
|
|
522
|
+
if (str.length === 0) return str;
|
|
523
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
524
|
+
}
|
|
525
|
+
function camelCase(str) {
|
|
526
|
+
return str.replace(/[-_]+/g, " ").replace(/[^\w\s]/g, "").replace(/\s+(.)(\w*)/g, (_, p1, p2) => p1.toUpperCase() + p2.toLowerCase()).replace(/\s/g, "");
|
|
527
|
+
}
|
|
528
|
+
function kebabCase(str) {
|
|
529
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
530
|
+
}
|
|
531
|
+
function snakeCase(str) {
|
|
532
|
+
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
|
|
533
|
+
}
|
|
534
|
+
function upperCase(str) {
|
|
535
|
+
return str.toUpperCase();
|
|
536
|
+
}
|
|
537
|
+
function difference(array1, array2) {
|
|
538
|
+
const set2 = new Set(array2);
|
|
539
|
+
return array1.filter((item) => !set2.has(item));
|
|
540
|
+
}
|
|
541
|
+
function intersection(array1, array2) {
|
|
542
|
+
const set2 = new Set(array2);
|
|
543
|
+
return array1.filter((item) => set2.has(item));
|
|
544
|
+
}
|
|
545
|
+
function union(array1, array2) {
|
|
546
|
+
const set = /* @__PURE__ */ new Set([...array1, ...array2]);
|
|
547
|
+
return Array.from(set);
|
|
548
|
+
}
|
|
549
|
+
function zip(array1, array2) {
|
|
550
|
+
const length = Math.min(array1.length, array2.length);
|
|
551
|
+
const result = [];
|
|
552
|
+
for (let i = 0; i < length; i++) {
|
|
553
|
+
result.push([array1[i], array2[i]]);
|
|
554
|
+
}
|
|
555
|
+
return result;
|
|
556
|
+
}
|
|
557
|
+
function unzip(array) {
|
|
558
|
+
const array1 = [];
|
|
559
|
+
const array2 = [];
|
|
560
|
+
for (const [item1, item2] of array) {
|
|
561
|
+
array1.push(item1);
|
|
562
|
+
array2.push(item2);
|
|
563
|
+
}
|
|
564
|
+
return [array1, array2];
|
|
565
|
+
}
|
|
566
|
+
function groupBy(array, key) {
|
|
567
|
+
const result = {};
|
|
568
|
+
for (const item of array) {
|
|
569
|
+
const groupKey = String(item[key]);
|
|
570
|
+
if (!result[groupKey]) {
|
|
571
|
+
result[groupKey] = [];
|
|
572
|
+
}
|
|
573
|
+
result[groupKey].push(item);
|
|
574
|
+
}
|
|
575
|
+
return result;
|
|
576
|
+
}
|
|
577
|
+
function partition(array, predicate) {
|
|
578
|
+
const truthy = [];
|
|
579
|
+
const falsy = [];
|
|
580
|
+
for (const item of array) {
|
|
581
|
+
if (predicate(item)) {
|
|
582
|
+
truthy.push(item);
|
|
583
|
+
} else {
|
|
584
|
+
falsy.push(item);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return [truthy, falsy];
|
|
588
|
+
}
|
|
589
|
+
function countBy(array, key) {
|
|
590
|
+
const result = {};
|
|
591
|
+
for (const item of array) {
|
|
592
|
+
const countKey = String(item[key]);
|
|
593
|
+
result[countKey] = (result[countKey] || 0) + 1;
|
|
594
|
+
}
|
|
595
|
+
return result;
|
|
596
|
+
}
|
|
597
|
+
function chunk(array, size) {
|
|
598
|
+
const result = [];
|
|
599
|
+
for (let i = 0; i < array.length; i += size) {
|
|
600
|
+
result.push(array.slice(i, i + size));
|
|
601
|
+
}
|
|
602
|
+
return result;
|
|
603
|
+
}
|
|
604
|
+
function compact(array) {
|
|
605
|
+
return array.filter(Boolean);
|
|
606
|
+
}
|
|
607
|
+
function concat(...arrays) {
|
|
608
|
+
const result = [];
|
|
609
|
+
for (const array of arrays) {
|
|
610
|
+
result.push(...array);
|
|
611
|
+
}
|
|
612
|
+
return result;
|
|
613
|
+
}
|
|
614
|
+
function differenceBy(array1, array2, iteratee) {
|
|
615
|
+
const set2 = new Set(array2.map(iteratee));
|
|
616
|
+
return array1.filter((item) => !set2.has(iteratee(item)));
|
|
617
|
+
}
|
|
618
|
+
function intersectionBy(array1, array2, iteratee) {
|
|
619
|
+
const set2 = new Set(array2.map(iteratee));
|
|
620
|
+
return array1.filter((item) => set2.has(iteratee(item)));
|
|
621
|
+
}
|
|
622
|
+
function unionBy(array1, array2, iteratee) {
|
|
623
|
+
const seen = /* @__PURE__ */ new Set();
|
|
624
|
+
const result = [];
|
|
625
|
+
for (const item of [...array1, ...array2]) {
|
|
626
|
+
const key = iteratee(item);
|
|
627
|
+
if (!seen.has(key)) {
|
|
628
|
+
seen.add(key);
|
|
629
|
+
result.push(item);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return result;
|
|
633
|
+
}
|
|
634
|
+
function uniqBy(array, iteratee) {
|
|
635
|
+
const seen = /* @__PURE__ */ new Set();
|
|
636
|
+
const result = [];
|
|
637
|
+
for (const item of array) {
|
|
638
|
+
const key = iteratee(item);
|
|
639
|
+
if (!seen.has(key)) {
|
|
640
|
+
seen.add(key);
|
|
641
|
+
result.push(item);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return result;
|
|
645
|
+
}
|
|
646
|
+
function zipWith(array1, array2, iteratee) {
|
|
647
|
+
const length = Math.min(array1.length, array2.length);
|
|
648
|
+
const result = [];
|
|
649
|
+
for (let i = 0; i < length; i++) {
|
|
650
|
+
result.push(iteratee(array1[i], array2[i]));
|
|
651
|
+
}
|
|
652
|
+
return result;
|
|
653
|
+
}
|
|
654
|
+
function unzipWith(array, iteratee) {
|
|
655
|
+
const result = [];
|
|
656
|
+
for (const [item1, item2] of array) {
|
|
657
|
+
result.push(iteratee(item1, item2));
|
|
658
|
+
}
|
|
659
|
+
return result;
|
|
660
|
+
}
|
|
661
|
+
function without(array, ...values2) {
|
|
662
|
+
const valueSet = new Set(values2);
|
|
663
|
+
return array.filter((item) => !valueSet.has(item));
|
|
664
|
+
}
|
|
665
|
+
function xor(array1, array2) {
|
|
666
|
+
const set1 = new Set(array1);
|
|
667
|
+
const set2 = new Set(array2);
|
|
668
|
+
const result = [];
|
|
669
|
+
for (const item of array1) {
|
|
670
|
+
if (!set2.has(item)) {
|
|
671
|
+
result.push(item);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
for (const item of array2) {
|
|
675
|
+
if (!set1.has(item)) {
|
|
676
|
+
result.push(item);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
return result;
|
|
680
|
+
}
|
|
681
|
+
function zipObject(keys2, values2) {
|
|
682
|
+
const result = {};
|
|
683
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
684
|
+
result[keys2[i]] = values2[i];
|
|
685
|
+
}
|
|
686
|
+
return result;
|
|
687
|
+
}
|
|
688
|
+
function zipObjectDeep(keys2, values2) {
|
|
689
|
+
const result = {};
|
|
690
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
691
|
+
const keyParts = String(keys2[i]).split(".");
|
|
692
|
+
let current = result;
|
|
693
|
+
for (let j = 0; j < keyParts.length; j++) {
|
|
694
|
+
const part = keyParts[j];
|
|
695
|
+
if (j === keyParts.length - 1) {
|
|
696
|
+
current[part] = values2[i];
|
|
697
|
+
} else {
|
|
698
|
+
current[part] = current[part] || {};
|
|
699
|
+
current = current[part];
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return result;
|
|
704
|
+
}
|
|
705
|
+
function zipWithDeep(keys2, values2, iteratee) {
|
|
706
|
+
const result = {};
|
|
707
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
708
|
+
const keyParts = String(keys2[i]).split(".");
|
|
709
|
+
let current = result;
|
|
710
|
+
for (let j = 0; j < keyParts.length; j++) {
|
|
711
|
+
const part = keyParts[j];
|
|
712
|
+
if (j === keyParts.length - 1) {
|
|
713
|
+
current[part] = iteratee(values2[i]);
|
|
714
|
+
} else {
|
|
715
|
+
current[part] = current[part] || {};
|
|
716
|
+
current = current[part];
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return result;
|
|
721
|
+
}
|
|
722
|
+
function first(array) {
|
|
723
|
+
return array[0];
|
|
724
|
+
}
|
|
725
|
+
function last(array) {
|
|
726
|
+
return array[array.length - 1];
|
|
727
|
+
}
|
|
728
|
+
function nth(array, n) {
|
|
729
|
+
if (n < 0) {
|
|
730
|
+
return array[array.length + n];
|
|
731
|
+
}
|
|
732
|
+
return array[n];
|
|
733
|
+
}
|
|
734
|
+
function keys(obj) {
|
|
735
|
+
return Object.keys(obj);
|
|
736
|
+
}
|
|
737
|
+
function values(obj) {
|
|
738
|
+
return Object.values(obj);
|
|
739
|
+
}
|
|
740
|
+
function entries(obj) {
|
|
741
|
+
return Object.entries(obj);
|
|
742
|
+
}
|
|
743
|
+
function fromEntries(entries2) {
|
|
744
|
+
const result = {};
|
|
745
|
+
for (const [key, value] of entries2) {
|
|
746
|
+
result[key] = value;
|
|
747
|
+
}
|
|
748
|
+
return result;
|
|
749
|
+
}
|
|
750
|
+
function invert(obj) {
|
|
751
|
+
const result = {};
|
|
752
|
+
for (const key in obj) {
|
|
753
|
+
if (obj.hasOwnProperty(key)) {
|
|
754
|
+
const value = obj[key];
|
|
755
|
+
result[value] = key;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return result;
|
|
759
|
+
}
|
|
760
|
+
function mapValues(obj, iteratee) {
|
|
761
|
+
const result = {};
|
|
762
|
+
for (const key in obj) {
|
|
763
|
+
if (obj.hasOwnProperty(key)) {
|
|
764
|
+
result[key] = iteratee(obj[key], key);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
return result;
|
|
768
|
+
}
|
|
769
|
+
function mapKeys(obj, iteratee) {
|
|
770
|
+
const result = {};
|
|
771
|
+
for (const key in obj) {
|
|
772
|
+
if (obj.hasOwnProperty(key)) {
|
|
773
|
+
const newKey = iteratee(obj[key], key);
|
|
774
|
+
result[newKey] = obj[key];
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return result;
|
|
778
|
+
}
|
|
779
|
+
function merge(target, ...sources) {
|
|
780
|
+
const result = { ...target };
|
|
781
|
+
for (const source of sources) {
|
|
782
|
+
for (const key in source) {
|
|
783
|
+
if (source.hasOwnProperty(key)) {
|
|
784
|
+
const sourceValue = source[key];
|
|
785
|
+
const targetValue = result[key];
|
|
786
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
787
|
+
result[key] = merge(targetValue, sourceValue);
|
|
788
|
+
} else {
|
|
789
|
+
result[key] = sourceValue;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return result;
|
|
795
|
+
}
|
|
796
|
+
function assign(target, ...sources) {
|
|
797
|
+
return Object.assign(target, ...sources);
|
|
798
|
+
}
|
|
799
|
+
function defaults(target, ...sources) {
|
|
800
|
+
const result = { ...target };
|
|
801
|
+
for (const source of sources) {
|
|
802
|
+
for (const key in source) {
|
|
803
|
+
if (source.hasOwnProperty(key) && result[key] === void 0) {
|
|
804
|
+
result[key] = source[key];
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
return result;
|
|
809
|
+
}
|
|
810
|
+
function defaultsDeep(target, ...sources) {
|
|
811
|
+
const result = { ...target };
|
|
812
|
+
for (const source of sources) {
|
|
813
|
+
for (const key in source) {
|
|
814
|
+
if (source.hasOwnProperty(key)) {
|
|
815
|
+
const sourceValue = source[key];
|
|
816
|
+
const targetValue = result[key];
|
|
817
|
+
if (typeof sourceValue === "object" && sourceValue !== null) {
|
|
818
|
+
result[key] = defaultsDeep(targetValue, sourceValue);
|
|
819
|
+
} else if (result[key] === void 0) {
|
|
820
|
+
result[key] = sourceValue;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return result;
|
|
826
|
+
}
|
|
827
|
+
function pickBy(obj, predicate) {
|
|
828
|
+
const result = {};
|
|
829
|
+
for (const key in obj) {
|
|
830
|
+
if (obj.hasOwnProperty(key)) {
|
|
831
|
+
const value = obj[key];
|
|
832
|
+
if (predicate(value, key)) {
|
|
833
|
+
result[key] = value;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
return result;
|
|
838
|
+
}
|
|
839
|
+
function omitBy(obj, predicate) {
|
|
840
|
+
const result = {};
|
|
841
|
+
for (const key in obj) {
|
|
842
|
+
if (obj.hasOwnProperty(key)) {
|
|
843
|
+
const value = obj[key];
|
|
844
|
+
if (!predicate(value, key)) {
|
|
845
|
+
result[key] = value;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return result;
|
|
850
|
+
}
|
|
851
|
+
function pickByDeep(obj, predicate) {
|
|
852
|
+
const result = {};
|
|
853
|
+
for (const key in obj) {
|
|
854
|
+
if (obj.hasOwnProperty(key)) {
|
|
855
|
+
const value = obj[key];
|
|
856
|
+
if (typeof value === "object" && value !== null) {
|
|
857
|
+
const nestedResult = pickByDeep(value, predicate);
|
|
858
|
+
if (Object.keys(nestedResult).length > 0) {
|
|
859
|
+
result[key] = nestedResult;
|
|
860
|
+
}
|
|
861
|
+
} else if (predicate(value, key)) {
|
|
862
|
+
result[key] = value;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return result;
|
|
867
|
+
}
|
|
868
|
+
function omitByDeep(obj, predicate) {
|
|
869
|
+
const result = {};
|
|
870
|
+
for (const key in obj) {
|
|
871
|
+
if (obj.hasOwnProperty(key)) {
|
|
872
|
+
const value = obj[key];
|
|
873
|
+
if (typeof value === "object" && value !== null) {
|
|
874
|
+
const nestedResult = omitByDeep(value, predicate);
|
|
875
|
+
result[key] = nestedResult;
|
|
876
|
+
} else if (!predicate(value, key)) {
|
|
877
|
+
result[key] = value;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
return result;
|
|
882
|
+
}
|
|
883
|
+
function isEmptyObject(obj) {
|
|
884
|
+
return Object.keys(obj).length === 0;
|
|
885
|
+
}
|
|
886
|
+
function isEmptyArray(arr) {
|
|
887
|
+
return arr.length === 0;
|
|
888
|
+
}
|
|
889
|
+
function isEmptyString(str) {
|
|
890
|
+
return str.trim().length === 0;
|
|
891
|
+
}
|
|
892
|
+
function isEmptyValue(value) {
|
|
893
|
+
return value == null || typeof value === "string" && value.trim().length === 0 || Array.isArray(value) && value.length === 0 || typeof value === "object" && Object.keys(value).length === 0;
|
|
894
|
+
}
|
|
895
|
+
function startsWith(str, prefix) {
|
|
896
|
+
return str.startsWith(prefix);
|
|
897
|
+
}
|
|
898
|
+
function endsWith(str, suffix) {
|
|
899
|
+
return str.endsWith(suffix);
|
|
900
|
+
}
|
|
901
|
+
function includes(str, search) {
|
|
902
|
+
return str.includes(search);
|
|
903
|
+
}
|
|
904
|
+
function repeat(str, times2) {
|
|
905
|
+
return str.repeat(times2);
|
|
906
|
+
}
|
|
907
|
+
function padStart(str, targetLength, padString = " ") {
|
|
908
|
+
return str.padStart(targetLength, padString);
|
|
909
|
+
}
|
|
910
|
+
function padEnd(str, targetLength, padString = " ") {
|
|
911
|
+
return str.padEnd(targetLength, padString);
|
|
912
|
+
}
|
|
913
|
+
function trim(str) {
|
|
914
|
+
return str.trim();
|
|
915
|
+
}
|
|
916
|
+
function trimStart(str) {
|
|
917
|
+
return str.trimStart();
|
|
918
|
+
}
|
|
919
|
+
function trimEnd(str) {
|
|
920
|
+
return str.trimEnd();
|
|
921
|
+
}
|
|
922
|
+
function truncate(str, length, omission = "...") {
|
|
923
|
+
if (str.length <= length) return str;
|
|
924
|
+
return str.slice(0, length - omission.length) + omission;
|
|
925
|
+
}
|
|
926
|
+
function escape(str) {
|
|
927
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
928
|
+
}
|
|
929
|
+
function unescape(str) {
|
|
930
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
|
|
931
|
+
}
|
|
932
|
+
function capitalizeWords(str) {
|
|
933
|
+
return str.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
934
|
+
}
|
|
935
|
+
function decapitalize(str) {
|
|
936
|
+
if (str.length === 0) return str;
|
|
937
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
938
|
+
}
|
|
939
|
+
function decapitalizeWords(str) {
|
|
940
|
+
return str.replace(/\b\w/g, (char) => char.toLowerCase());
|
|
941
|
+
}
|
|
942
|
+
function swapCase(str) {
|
|
943
|
+
return str.split("").map((char) => {
|
|
944
|
+
if (char === char.toUpperCase()) {
|
|
945
|
+
return char.toLowerCase();
|
|
946
|
+
} else {
|
|
947
|
+
return char.toUpperCase();
|
|
948
|
+
}
|
|
949
|
+
}).join("");
|
|
950
|
+
}
|
|
951
|
+
function clampNumber(num, min, max) {
|
|
952
|
+
return Math.max(min, Math.min(max, num));
|
|
953
|
+
}
|
|
954
|
+
function randomNumber(min, max) {
|
|
955
|
+
return Math.random() * (max - min) + min;
|
|
956
|
+
}
|
|
957
|
+
function round(num, precision = 0) {
|
|
958
|
+
const factor = Math.pow(10, precision);
|
|
959
|
+
return Math.round(num * factor) / factor;
|
|
960
|
+
}
|
|
961
|
+
function floor(num, precision = 0) {
|
|
962
|
+
const factor = Math.pow(10, precision);
|
|
963
|
+
return Math.floor(num * factor) / factor;
|
|
964
|
+
}
|
|
965
|
+
function ceil(num, precision = 0) {
|
|
966
|
+
const factor = Math.pow(10, precision);
|
|
967
|
+
return Math.ceil(num * factor) / factor;
|
|
968
|
+
}
|
|
969
|
+
function toFixed(num, precision = 0) {
|
|
970
|
+
return num.toFixed(precision);
|
|
971
|
+
}
|
|
972
|
+
function toExponential(num, precision = 0) {
|
|
973
|
+
return num.toExponential(precision);
|
|
974
|
+
}
|
|
975
|
+
function toPrecision(num, precision = 0) {
|
|
976
|
+
return num.toPrecision(precision);
|
|
977
|
+
}
|
|
978
|
+
function isInteger(num) {
|
|
979
|
+
return Number.isInteger(num);
|
|
980
|
+
}
|
|
981
|
+
function isFiniteNumber(num) {
|
|
982
|
+
return Number.isFinite(num);
|
|
983
|
+
}
|
|
984
|
+
function isNaNValue(num) {
|
|
985
|
+
return Number.isNaN(num);
|
|
986
|
+
}
|
|
987
|
+
function isSafeInteger(num) {
|
|
988
|
+
return Number.isSafeInteger(num);
|
|
989
|
+
}
|
|
990
|
+
function parseIntValue(str, radix = 10) {
|
|
991
|
+
return parseInt(str, radix);
|
|
992
|
+
}
|
|
993
|
+
function parseFloatValue(str) {
|
|
994
|
+
return parseFloat(str);
|
|
995
|
+
}
|
|
996
|
+
function toNumber(value) {
|
|
997
|
+
return Number(value);
|
|
998
|
+
}
|
|
999
|
+
function toInteger(value) {
|
|
1000
|
+
return parseInt(String(value), 10);
|
|
1001
|
+
}
|
|
1002
|
+
function toFinite(value) {
|
|
1003
|
+
const num = toNumber(value);
|
|
1004
|
+
if (num === Infinity) return Number.MAX_VALUE;
|
|
1005
|
+
if (num === -Infinity) return -Number.MAX_VALUE;
|
|
1006
|
+
return isNaN(num) ? 0 : num;
|
|
1007
|
+
}
|
|
1008
|
+
function toSafeInteger(value) {
|
|
1009
|
+
const num = toInteger(value);
|
|
1010
|
+
if (num > Number.MAX_SAFE_INTEGER) return Number.MAX_SAFE_INTEGER;
|
|
1011
|
+
if (num < Number.MIN_SAFE_INTEGER) return Number.MIN_SAFE_INTEGER;
|
|
1012
|
+
return num;
|
|
1013
|
+
}
|
|
1014
|
+
function toFiniteNumber(value) {
|
|
1015
|
+
const num = toNumber(value);
|
|
1016
|
+
if (num === Infinity) return Number.MAX_VALUE;
|
|
1017
|
+
if (num === -Infinity) return -Number.MAX_VALUE;
|
|
1018
|
+
return isNaN(num) ? 0 : num;
|
|
1019
|
+
}
|
|
1020
|
+
function getValue(obj, key) {
|
|
1021
|
+
return obj[key];
|
|
1022
|
+
}
|
|
1023
|
+
function setValue(obj, key, value) {
|
|
1024
|
+
obj[key] = value;
|
|
1025
|
+
}
|
|
1026
|
+
function hasKey(obj, key) {
|
|
1027
|
+
return key in obj;
|
|
1028
|
+
}
|
|
1029
|
+
function hasValue(obj, value) {
|
|
1030
|
+
return Object.values(obj).includes(value);
|
|
1031
|
+
}
|
|
1032
|
+
function getNestedValue(obj, key1, key2) {
|
|
1033
|
+
return obj[key1][key2];
|
|
1034
|
+
}
|
|
1035
|
+
function setNestedValue(obj, key1, key2, value) {
|
|
1036
|
+
obj[key1][key2] = value;
|
|
1037
|
+
}
|
|
1038
|
+
function hasNestedKey(obj, key1, key2) {
|
|
1039
|
+
return key1 in obj && key2 in obj[key1];
|
|
1040
|
+
}
|
|
1041
|
+
function hasNestedValue(obj, key1, key2, value) {
|
|
1042
|
+
return obj[key1][key2] === value;
|
|
1043
|
+
}
|
|
1044
|
+
function getDeepValue(obj, key1, key2, key3) {
|
|
1045
|
+
return obj[key1][key2][key3];
|
|
1046
|
+
}
|
|
1047
|
+
function setDeepValue(obj, key1, key2, key3, value) {
|
|
1048
|
+
obj[key1][key2][key3] = value;
|
|
1049
|
+
}
|
|
1050
|
+
function hasDeepKey(obj, key1, key2, key3) {
|
|
1051
|
+
return key1 in obj && key2 in obj[key1] && key3 in obj[key1][key2];
|
|
1052
|
+
}
|
|
1053
|
+
function hasDeepValue(obj, key1, key2, key3, value) {
|
|
1054
|
+
return obj[key1][key2][key3] === value;
|
|
1055
|
+
}
|
|
1056
|
+
function getValueByPath(obj, path) {
|
|
1057
|
+
const keys2 = path.split(".");
|
|
1058
|
+
let current = obj;
|
|
1059
|
+
for (const key of keys2) {
|
|
1060
|
+
if (current == null) return void 0;
|
|
1061
|
+
current = current[key];
|
|
1062
|
+
}
|
|
1063
|
+
return current;
|
|
1064
|
+
}
|
|
1065
|
+
function setValueByPath(obj, path, value) {
|
|
1066
|
+
const keys2 = path.split(".");
|
|
1067
|
+
let current = obj;
|
|
1068
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
1069
|
+
const key = keys2[i];
|
|
1070
|
+
if (i === keys2.length - 1) {
|
|
1071
|
+
current[key] = value;
|
|
1072
|
+
} else {
|
|
1073
|
+
current[key] = current[key] || {};
|
|
1074
|
+
current = current[key];
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
function hasKeyByPath(obj, path) {
|
|
1079
|
+
const keys2 = path.split(".");
|
|
1080
|
+
let current = obj;
|
|
1081
|
+
for (const key of keys2) {
|
|
1082
|
+
if (current == null || !(key in current)) return false;
|
|
1083
|
+
current = current[key];
|
|
1084
|
+
}
|
|
1085
|
+
return true;
|
|
1086
|
+
}
|
|
1087
|
+
function hasValueByPath(obj, path, value) {
|
|
1088
|
+
const keys2 = path.split(".");
|
|
1089
|
+
let current = obj;
|
|
1090
|
+
for (const key of keys2) {
|
|
1091
|
+
if (current == null || !(key in current)) return false;
|
|
1092
|
+
current = current[key];
|
|
1093
|
+
}
|
|
1094
|
+
return current === value;
|
|
1095
|
+
}
|
|
1096
|
+
function isNumberValue(value) {
|
|
1097
|
+
return typeof value === "number" && !isNaN(value);
|
|
1098
|
+
}
|
|
1099
|
+
function isStringValue(value) {
|
|
1100
|
+
return typeof value === "string";
|
|
1101
|
+
}
|
|
1102
|
+
function isBooleanValue(value) {
|
|
1103
|
+
return typeof value === "boolean";
|
|
1104
|
+
}
|
|
1105
|
+
function isObjectValue(value) {
|
|
1106
|
+
return typeof value === "object" && value !== null;
|
|
1107
|
+
}
|
|
1108
|
+
function isArrayValue(value) {
|
|
1109
|
+
return Array.isArray(value);
|
|
1110
|
+
}
|
|
1111
|
+
function isFunctionValue(value) {
|
|
1112
|
+
return typeof value === "function";
|
|
1113
|
+
}
|
|
1114
|
+
function isNullValue(value) {
|
|
1115
|
+
return value === null;
|
|
1116
|
+
}
|
|
1117
|
+
function isUndefinedValue(value) {
|
|
1118
|
+
return value === void 0;
|
|
1119
|
+
}
|
|
1120
|
+
function isSymbolValue(value) {
|
|
1121
|
+
return typeof value === "symbol";
|
|
1122
|
+
}
|
|
1123
|
+
function isBigIntValue(value) {
|
|
1124
|
+
return typeof value === "bigint";
|
|
1125
|
+
}
|
|
1126
|
+
function isEmail(str) {
|
|
1127
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1128
|
+
return emailRegex.test(str);
|
|
1129
|
+
}
|
|
1130
|
+
function isURL(str) {
|
|
1131
|
+
const urlRegex = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/i;
|
|
1132
|
+
return urlRegex.test(str);
|
|
1133
|
+
}
|
|
1134
|
+
function isPhoneNumber(str) {
|
|
1135
|
+
const phoneRegex = /^\+?[1-9]\d{1,14}$/;
|
|
1136
|
+
return phoneRegex.test(str);
|
|
1137
|
+
}
|
|
1138
|
+
function isPostalCode(str) {
|
|
1139
|
+
const postalCodeRegex = /^\d{5}(-\d{4})?$/;
|
|
1140
|
+
return postalCodeRegex.test(str);
|
|
1141
|
+
}
|
|
1142
|
+
function isCreditCard(str) {
|
|
1143
|
+
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})$/;
|
|
1144
|
+
return creditCardRegex.test(str);
|
|
1145
|
+
}
|
|
1146
|
+
function isISBN(str) {
|
|
1147
|
+
const isbn10Regex = /^(?:\d{9}X|\d{10})$/;
|
|
1148
|
+
const isbn13Regex = /^(?:\d{13})$/;
|
|
1149
|
+
return isbn10Regex.test(str) || isbn13Regex.test(str);
|
|
1150
|
+
}
|
|
1151
|
+
function isJSON(str) {
|
|
1152
|
+
try {
|
|
1153
|
+
JSON.parse(str);
|
|
1154
|
+
return true;
|
|
1155
|
+
} catch {
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
function isXML(str) {
|
|
1160
|
+
const parser = new DOMParser();
|
|
1161
|
+
const doc = parser.parseFromString(str, "application/xml");
|
|
1162
|
+
return !doc.querySelector("parsererror");
|
|
1163
|
+
}
|
|
1164
|
+
function isBase64(str) {
|
|
1165
|
+
const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/;
|
|
1166
|
+
return base64Regex.test(str);
|
|
1167
|
+
}
|
|
1168
|
+
function isHexadecimal(str) {
|
|
1169
|
+
const hexRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1170
|
+
return hexRegex.test(str);
|
|
1171
|
+
}
|
|
1172
|
+
function isUUID(str) {
|
|
1173
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1174
|
+
return uuidRegex.test(str);
|
|
1175
|
+
}
|
|
1176
|
+
function isIPv4(str) {
|
|
1177
|
+
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}$/;
|
|
1178
|
+
return ipv4Regex.test(str);
|
|
1179
|
+
}
|
|
1180
|
+
function isIPv6(str) {
|
|
1181
|
+
const ipv6Regex = /^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/;
|
|
1182
|
+
return ipv6Regex.test(str);
|
|
1183
|
+
}
|
|
1184
|
+
function isMACAddress(str) {
|
|
1185
|
+
const macRegex = /^([0-9A-Fa-f]{2}[:\-]){5}([0-9A-Fa-f]{2})$/;
|
|
1186
|
+
return macRegex.test(str);
|
|
1187
|
+
}
|
|
1188
|
+
function isSlug(str) {
|
|
1189
|
+
const slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
1190
|
+
return slugRegex.test(str);
|
|
1191
|
+
}
|
|
1192
|
+
function isHexColor(str) {
|
|
1193
|
+
const hexColorRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1194
|
+
return hexColorRegex.test(str);
|
|
1195
|
+
}
|
|
1196
|
+
function isRGBColor(str) {
|
|
1197
|
+
const rgbColorRegex = /^rgb\(\s*(\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/;
|
|
1198
|
+
return rgbColorRegex.test(str);
|
|
1199
|
+
}
|
|
1200
|
+
function hexToRGB(hex) {
|
|
1201
|
+
const hexRegex = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
1202
|
+
if (!hexRegex.test(hex)) return null;
|
|
1203
|
+
let r, g, b;
|
|
1204
|
+
if (hex.length === 4) {
|
|
1205
|
+
r = parseInt(hex[1] + hex[1], 16);
|
|
1206
|
+
g = parseInt(hex[2] + hex[2], 16);
|
|
1207
|
+
b = parseInt(hex[3] + hex[3], 16);
|
|
1208
|
+
} else {
|
|
1209
|
+
r = parseInt(hex.slice(1, 3), 16);
|
|
1210
|
+
g = parseInt(hex.slice(3, 5), 16);
|
|
1211
|
+
b = parseInt(hex.slice(5, 7), 16);
|
|
1212
|
+
}
|
|
1213
|
+
return { r, g, b };
|
|
1214
|
+
}
|
|
1215
|
+
function rgbToHex(r, g, b) {
|
|
1216
|
+
const toHex = (num) => num.toString(16).padStart(2, "0");
|
|
1217
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
1218
|
+
}
|
|
1219
|
+
function rgbToHSL(r, g, b) {
|
|
1220
|
+
r /= 255;
|
|
1221
|
+
g /= 255;
|
|
1222
|
+
b /= 255;
|
|
1223
|
+
const max = Math.max(r, g, b);
|
|
1224
|
+
const min = Math.min(r, g, b);
|
|
1225
|
+
let h = 0, s = 0, l = (max + min) / 2;
|
|
1226
|
+
if (max !== min) {
|
|
1227
|
+
const d = max - min;
|
|
1228
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
1229
|
+
switch (max) {
|
|
1230
|
+
case r:
|
|
1231
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1232
|
+
break;
|
|
1233
|
+
case g:
|
|
1234
|
+
h = (b - r) / d + 2;
|
|
1235
|
+
break;
|
|
1236
|
+
case b:
|
|
1237
|
+
h = (r - g) / d + 4;
|
|
1238
|
+
break;
|
|
1239
|
+
}
|
|
1240
|
+
h /= 6;
|
|
1241
|
+
}
|
|
1242
|
+
return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) };
|
|
1243
|
+
}
|
|
1244
|
+
function hslToRGB(h, s, l) {
|
|
1245
|
+
h /= 360;
|
|
1246
|
+
s /= 100;
|
|
1247
|
+
l /= 100;
|
|
1248
|
+
let r, g, b;
|
|
1249
|
+
if (s === 0) {
|
|
1250
|
+
r = g = b = l;
|
|
1251
|
+
} else {
|
|
1252
|
+
const hueToRGB = (p2, q2, t) => {
|
|
1253
|
+
if (t < 0) t += 1;
|
|
1254
|
+
if (t > 1) t -= 1;
|
|
1255
|
+
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
1256
|
+
if (t < 1 / 2) return q2;
|
|
1257
|
+
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
1258
|
+
return p2;
|
|
1259
|
+
};
|
|
1260
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
1261
|
+
const p = 2 * l - q;
|
|
1262
|
+
r = hueToRGB(p, q, h + 1 / 3);
|
|
1263
|
+
g = hueToRGB(p, q, h);
|
|
1264
|
+
b = hueToRGB(p, q, h - 1 / 3);
|
|
1265
|
+
}
|
|
1266
|
+
return { r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255) };
|
|
1267
|
+
}
|
|
1268
|
+
function hexToHSL(hex) {
|
|
1269
|
+
const rgb = hexToRGB(hex);
|
|
1270
|
+
if (!rgb) return null;
|
|
1271
|
+
return rgbToHSL(rgb.r, rgb.g, rgb.b);
|
|
1272
|
+
}
|
|
1273
|
+
function hslToHex(h, s, l) {
|
|
1274
|
+
const rgb = hslToRGB(h, s, l);
|
|
1275
|
+
return rgbToHex(rgb.r, rgb.g, rgb.b);
|
|
1276
|
+
}
|
|
1277
|
+
function lightenColor(hex, amount) {
|
|
1278
|
+
const hsl = hexToHSL(hex);
|
|
1279
|
+
if (!hsl) return null;
|
|
1280
|
+
hsl.l = Math.min(100, hsl.l + amount);
|
|
1281
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1282
|
+
}
|
|
1283
|
+
function darkenColor(hex, amount) {
|
|
1284
|
+
const hsl = hexToHSL(hex);
|
|
1285
|
+
if (!hsl) return null;
|
|
1286
|
+
hsl.l = Math.max(0, hsl.l - amount);
|
|
1287
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1288
|
+
}
|
|
1289
|
+
function saturateColor(hex, amount) {
|
|
1290
|
+
const hsl = hexToHSL(hex);
|
|
1291
|
+
if (!hsl) return null;
|
|
1292
|
+
hsl.s = Math.min(100, hsl.s + amount);
|
|
1293
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1294
|
+
}
|
|
1295
|
+
function desaturateColor(hex, amount) {
|
|
1296
|
+
const hsl = hexToHSL(hex);
|
|
1297
|
+
if (!hsl) return null;
|
|
1298
|
+
hsl.s = Math.max(0, hsl.s - amount);
|
|
1299
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1300
|
+
}
|
|
1301
|
+
function rotateHue(hex, degrees) {
|
|
1302
|
+
const hsl = hexToHSL(hex);
|
|
1303
|
+
if (!hsl) return null;
|
|
1304
|
+
hsl.h = (hsl.h + degrees) % 360;
|
|
1305
|
+
if (hsl.h < 0) hsl.h += 360;
|
|
1306
|
+
return hslToHex(hsl.h, hsl.s, hsl.l);
|
|
1307
|
+
}
|
|
1308
|
+
function invertColor(hex) {
|
|
1309
|
+
const rgb = hexToRGB(hex);
|
|
1310
|
+
if (!rgb) return null;
|
|
1311
|
+
const invertedR = 255 - rgb.r;
|
|
1312
|
+
const invertedG = 255 - rgb.g;
|
|
1313
|
+
const invertedB = 255 - rgb.b;
|
|
1314
|
+
return rgbToHex(invertedR, invertedG, invertedB);
|
|
1315
|
+
}
|
|
1316
|
+
function isLightColor(hex) {
|
|
1317
|
+
const rgb = hexToRGB(hex);
|
|
1318
|
+
if (!rgb) return null;
|
|
1319
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1320
|
+
return brightness > 128;
|
|
1321
|
+
}
|
|
1322
|
+
function isDarkColor(hex) {
|
|
1323
|
+
const rgb = hexToRGB(hex);
|
|
1324
|
+
if (!rgb) return null;
|
|
1325
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1326
|
+
return brightness <= 128;
|
|
1327
|
+
}
|
|
1328
|
+
function getContrastColor(hex) {
|
|
1329
|
+
const rgb = hexToRGB(hex);
|
|
1330
|
+
if (!rgb) return null;
|
|
1331
|
+
const brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1332
|
+
return brightness > 128 ? "#000000" : "#FFFFFF";
|
|
1333
|
+
}
|
|
1334
|
+
function blendColors(hex1, hex2, ratio) {
|
|
1335
|
+
const rgb1 = hexToRGB(hex1);
|
|
1336
|
+
const rgb2 = hexToRGB(hex2);
|
|
1337
|
+
if (!rgb1 || !rgb2) return null;
|
|
1338
|
+
const r = Math.round(rgb1.r * (1 - ratio) + rgb2.r * ratio);
|
|
1339
|
+
const g = Math.round(rgb1.g * (1 - ratio) + rgb2.g * ratio);
|
|
1340
|
+
const b = Math.round(rgb1.b * (1 - ratio) + rgb2.b * ratio);
|
|
1341
|
+
return rgbToHex(r, g, b);
|
|
1342
|
+
}
|
|
1343
|
+
function mixColors(hex1, hex2) {
|
|
1344
|
+
return blendColors(hex1, hex2, 0.5);
|
|
1345
|
+
}
|
|
1346
|
+
function shadeColor(hex, percent) {
|
|
1347
|
+
const rgb = hexToRGB(hex);
|
|
1348
|
+
if (!rgb) return null;
|
|
1349
|
+
const r = Math.round(rgb.r * (1 + percent / 100));
|
|
1350
|
+
const g = Math.round(rgb.g * (1 + percent / 100));
|
|
1351
|
+
const b = Math.round(rgb.b * (1 + percent / 100));
|
|
1352
|
+
return rgbToHex(clampNumber(r, 0, 255), clampNumber(g, 0, 255), clampNumber(b, 0, 255));
|
|
1353
|
+
}
|
|
1354
|
+
function tintColor(hex, percent) {
|
|
1355
|
+
const rgb = hexToRGB(hex);
|
|
1356
|
+
if (!rgb) return null;
|
|
1357
|
+
const r = Math.round(rgb.r + (255 - rgb.r) * (percent / 100));
|
|
1358
|
+
const g = Math.round(rgb.g + (255 - rgb.g) * (percent / 100));
|
|
1359
|
+
const b = Math.round(rgb.b + (255 - rgb.b) * (percent / 100));
|
|
1360
|
+
return rgbToHex(clampNumber(r, 0, 255), clampNumber(g, 0, 255), clampNumber(b, 0, 255));
|
|
1361
|
+
}
|
|
1362
|
+
function generateRandomColor() {
|
|
1363
|
+
const r = Math.floor(Math.random() * 256);
|
|
1364
|
+
const g = Math.floor(Math.random() * 256);
|
|
1365
|
+
const b = Math.floor(Math.random() * 256);
|
|
1366
|
+
return rgbToHex(r, g, b);
|
|
1367
|
+
}
|
|
1368
|
+
function generateRandomHexColor() {
|
|
1369
|
+
const hex = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
1370
|
+
return `#${hex}`;
|
|
1371
|
+
}
|
|
1372
|
+
function generateRandomRGBColor() {
|
|
1373
|
+
const r = Math.floor(Math.random() * 256);
|
|
1374
|
+
const g = Math.floor(Math.random() * 256);
|
|
1375
|
+
const b = Math.floor(Math.random() * 256);
|
|
1376
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
1377
|
+
}
|
|
1378
|
+
function generateRandomHSLColor() {
|
|
1379
|
+
const h = Math.floor(Math.random() * 360);
|
|
1380
|
+
const s = Math.floor(Math.random() * 100);
|
|
1381
|
+
const l = Math.floor(Math.random() * 100);
|
|
1382
|
+
return `hsl(${h}, ${s}%, ${l}%)`;
|
|
1383
|
+
}
|
|
1384
|
+
function generateRandomColorScheme(baseHex, schemeType) {
|
|
1385
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1386
|
+
if (!baseHSL) return null;
|
|
1387
|
+
const { h, s, l } = baseHSL;
|
|
1388
|
+
let scheme = [];
|
|
1389
|
+
switch (schemeType) {
|
|
1390
|
+
case "complementary":
|
|
1391
|
+
scheme.push(hslToHex((h + 180) % 360, s, l));
|
|
1392
|
+
break;
|
|
1393
|
+
case "analogous":
|
|
1394
|
+
scheme.push(hslToHex((h + 30) % 360, s, l));
|
|
1395
|
+
scheme.push(hslToHex((h - 30 + 360) % 360, s, l));
|
|
1396
|
+
break;
|
|
1397
|
+
case "triadic":
|
|
1398
|
+
scheme.push(hslToHex((h + 120) % 360, s, l));
|
|
1399
|
+
scheme.push(hslToHex((h + 240) % 360, s, l));
|
|
1400
|
+
break;
|
|
1401
|
+
case "tetradic":
|
|
1402
|
+
scheme.push(hslToHex((h + 90) % 360, s, l));
|
|
1403
|
+
scheme.push(hslToHex((h + 180) % 360, s, l));
|
|
1404
|
+
scheme.push(hslToHex((h + 270) % 360, s, l));
|
|
1405
|
+
break;
|
|
1406
|
+
}
|
|
1407
|
+
return scheme;
|
|
1408
|
+
}
|
|
1409
|
+
function generateGradientColors(startHex, endHex, steps) {
|
|
1410
|
+
const startRGB = hexToRGB(startHex);
|
|
1411
|
+
const endRGB = hexToRGB(endHex);
|
|
1412
|
+
if (!startRGB || !endRGB) return null;
|
|
1413
|
+
const gradientColors = [];
|
|
1414
|
+
for (let i = 0; i < steps; i++) {
|
|
1415
|
+
const ratio = i / (steps - 1);
|
|
1416
|
+
const r = Math.round(startRGB.r * (1 - ratio) + endRGB.r * ratio);
|
|
1417
|
+
const g = Math.round(startRGB.g * (1 - ratio) + endRGB.g * ratio);
|
|
1418
|
+
const b = Math.round(startRGB.b * (1 - ratio) + endRGB.b * ratio);
|
|
1419
|
+
gradientColors.push(rgbToHex(r, g, b));
|
|
1420
|
+
}
|
|
1421
|
+
return gradientColors;
|
|
1422
|
+
}
|
|
1423
|
+
function generateRandomGradient(steps) {
|
|
1424
|
+
const startHex = generateRandomHexColor();
|
|
1425
|
+
const endHex = generateRandomHexColor();
|
|
1426
|
+
return generateGradientColors(startHex, endHex, steps) || [];
|
|
1427
|
+
}
|
|
1428
|
+
function generateRandomColorPalette(count) {
|
|
1429
|
+
const palette = [];
|
|
1430
|
+
for (let i = 0; i < count; i++) {
|
|
1431
|
+
palette.push(generateRandomHexColor());
|
|
1432
|
+
}
|
|
1433
|
+
return palette;
|
|
1434
|
+
}
|
|
1435
|
+
function generateMonochromaticPalette(baseHex, count) {
|
|
1436
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1437
|
+
if (!baseHSL) return null;
|
|
1438
|
+
const { h, s, l } = baseHSL;
|
|
1439
|
+
const palette = [];
|
|
1440
|
+
for (let i = 0; i < count; i++) {
|
|
1441
|
+
const lightness = clampNumber(l + (i - Math.floor(count / 2)) * 10, 0, 100);
|
|
1442
|
+
palette.push(hslToHex(h, s, lightness));
|
|
1443
|
+
}
|
|
1444
|
+
return palette;
|
|
1445
|
+
}
|
|
1446
|
+
function generateAnalogousPalette(baseHex, count) {
|
|
1447
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1448
|
+
if (!baseHSL) return null;
|
|
1449
|
+
const { h, s, l } = baseHSL;
|
|
1450
|
+
const palette = [];
|
|
1451
|
+
for (let i = 0; i < count; i++) {
|
|
1452
|
+
const hue = (h + (i - Math.floor(count / 2)) * 30 + 360) % 360;
|
|
1453
|
+
palette.push(hslToHex(hue, s, l));
|
|
1454
|
+
}
|
|
1455
|
+
return palette;
|
|
1456
|
+
}
|
|
1457
|
+
function generateComplementaryPalette(baseHex) {
|
|
1458
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1459
|
+
if (!baseHSL) return null;
|
|
1460
|
+
const { h, s, l } = baseHSL;
|
|
1461
|
+
const complementaryHue = (h + 180) % 360;
|
|
1462
|
+
return [baseHex, hslToHex(complementaryHue, s, l)];
|
|
1463
|
+
}
|
|
1464
|
+
function generateTriadicPalette(baseHex) {
|
|
1465
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1466
|
+
if (!baseHSL) return null;
|
|
1467
|
+
const { h, s, l } = baseHSL;
|
|
1468
|
+
const hue1 = (h + 120) % 360;
|
|
1469
|
+
const hue2 = (h + 240) % 360;
|
|
1470
|
+
return [baseHex, hslToHex(hue1, s, l), hslToHex(hue2, s, l)];
|
|
1471
|
+
}
|
|
1472
|
+
function generateTetradicPalette(baseHex) {
|
|
1473
|
+
const baseHSL = hexToHSL(baseHex);
|
|
1474
|
+
if (!baseHSL) return null;
|
|
1475
|
+
const { h, s, l } = baseHSL;
|
|
1476
|
+
const hue1 = (h + 90) % 360;
|
|
1477
|
+
const hue2 = (h + 180) % 360;
|
|
1478
|
+
const hue3 = (h + 270) % 360;
|
|
1479
|
+
return [baseHex, hslToHex(hue1, s, l), hslToHex(hue2, s, l), hslToHex(hue3, s, l)];
|
|
1480
|
+
}
|
|
1481
|
+
function generateRandomPastelColor() {
|
|
1482
|
+
const r = Math.floor(Math.random() * 127 + 128);
|
|
1483
|
+
const g = Math.floor(Math.random() * 127 + 128);
|
|
1484
|
+
const b = Math.floor(Math.random() * 127 + 128);
|
|
1485
|
+
return rgbToHex(r, g, b);
|
|
1486
|
+
}
|
|
1487
|
+
function generateRandomVibrantColor() {
|
|
1488
|
+
const r = Math.floor(Math.random() * 256);
|
|
1489
|
+
const g = Math.floor(Math.random() * 256);
|
|
1490
|
+
const b = Math.floor(Math.random() * 256);
|
|
1491
|
+
return rgbToHex(r, g, b);
|
|
1492
|
+
}
|
|
1493
|
+
function generateRandomMutedColor() {
|
|
1494
|
+
const r = Math.floor(Math.random() * 128 + 64);
|
|
1495
|
+
const g = Math.floor(Math.random() * 128 + 64);
|
|
1496
|
+
const b = Math.floor(Math.random() * 128 + 64);
|
|
1497
|
+
return rgbToHex(r, g, b);
|
|
1498
|
+
}
|
|
1499
|
+
function generateRandomDarkColor() {
|
|
1500
|
+
const r = Math.floor(Math.random() * 128);
|
|
1501
|
+
const g = Math.floor(Math.random() * 128);
|
|
1502
|
+
const b = Math.floor(Math.random() * 128);
|
|
1503
|
+
return rgbToHex(r, g, b);
|
|
1504
|
+
}
|
|
1505
|
+
function generateRandomLightColor() {
|
|
1506
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1507
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1508
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1509
|
+
return rgbToHex(r, g, b);
|
|
1510
|
+
}
|
|
1511
|
+
function generateRandomNeutralColor() {
|
|
1512
|
+
const gray = Math.floor(Math.random() * 256);
|
|
1513
|
+
return rgbToHex(gray, gray, gray);
|
|
1514
|
+
}
|
|
1515
|
+
function generateRandomWarmColor() {
|
|
1516
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1517
|
+
const g = Math.floor(Math.random() * 128);
|
|
1518
|
+
const b = Math.floor(Math.random() * 128);
|
|
1519
|
+
return rgbToHex(r, g, b);
|
|
1520
|
+
}
|
|
1521
|
+
function generateRandomCoolColor() {
|
|
1522
|
+
const r = Math.floor(Math.random() * 128);
|
|
1523
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1524
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1525
|
+
return rgbToHex(r, g, b);
|
|
1526
|
+
}
|
|
1527
|
+
function generateRandomEarthToneColor() {
|
|
1528
|
+
const r = Math.floor(Math.random() * 64 + 64);
|
|
1529
|
+
const g = Math.floor(Math.random() * 64 + 64);
|
|
1530
|
+
const b = Math.floor(Math.random() * 64 + 32);
|
|
1531
|
+
return rgbToHex(r, g, b);
|
|
1532
|
+
}
|
|
1533
|
+
function generateRandomMetallicColor() {
|
|
1534
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1535
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1536
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1537
|
+
return rgbToHex(r, g, b);
|
|
1538
|
+
}
|
|
1539
|
+
function generateRandomNeonColor() {
|
|
1540
|
+
const r = Math.floor(Math.random() * 128 + 128);
|
|
1541
|
+
const g = Math.floor(Math.random() * 128 + 128);
|
|
1542
|
+
const b = Math.floor(Math.random() * 128 + 128);
|
|
1543
|
+
return rgbToHex(r, g, b);
|
|
1544
|
+
}
|
|
1545
|
+
function generateRandomPastelPalette(count) {
|
|
1546
|
+
const palette = [];
|
|
1547
|
+
for (let i = 0; i < count; i++) {
|
|
1548
|
+
palette.push(generateRandomPastelColor());
|
|
1549
|
+
}
|
|
1550
|
+
return palette;
|
|
1551
|
+
}
|
|
1552
|
+
function generateRandomVibrantPalette(count) {
|
|
1553
|
+
const palette = [];
|
|
1554
|
+
for (let i = 0; i < count; i++) {
|
|
1555
|
+
palette.push(generateRandomVibrantColor());
|
|
1556
|
+
}
|
|
1557
|
+
return palette;
|
|
1558
|
+
}
|
|
1559
|
+
function generateRandomMutedPalette(count) {
|
|
1560
|
+
const palette = [];
|
|
1561
|
+
for (let i = 0; i < count; i++) {
|
|
1562
|
+
palette.push(generateRandomMutedColor());
|
|
1563
|
+
}
|
|
1564
|
+
return palette;
|
|
1565
|
+
}
|
|
1566
|
+
function generateRandomDarkPalette(count) {
|
|
1567
|
+
const palette = [];
|
|
1568
|
+
for (let i = 0; i < count; i++) {
|
|
1569
|
+
palette.push(generateRandomDarkColor());
|
|
1570
|
+
}
|
|
1571
|
+
return palette;
|
|
1572
|
+
}
|
|
1573
|
+
function generateRandomLightPalette(count) {
|
|
1574
|
+
const palette = [];
|
|
1575
|
+
for (let i = 0; i < count; i++) {
|
|
1576
|
+
palette.push(generateRandomLightColor());
|
|
1577
|
+
}
|
|
1578
|
+
return palette;
|
|
1579
|
+
}
|
|
1580
|
+
function generateRandomNeutralPalette(count) {
|
|
1581
|
+
const palette = [];
|
|
1582
|
+
for (let i = 0; i < count; i++) {
|
|
1583
|
+
palette.push(generateRandomNeutralColor());
|
|
1584
|
+
}
|
|
1585
|
+
return palette;
|
|
1586
|
+
}
|
|
1587
|
+
function generateRandomWarmPalette(count) {
|
|
1588
|
+
const palette = [];
|
|
1589
|
+
for (let i = 0; i < count; i++) {
|
|
1590
|
+
palette.push(generateRandomWarmColor());
|
|
1591
|
+
}
|
|
1592
|
+
return palette;
|
|
1593
|
+
}
|
|
1594
|
+
function generateRandomCoolPalette(count) {
|
|
1595
|
+
const palette = [];
|
|
1596
|
+
for (let i = 0; i < count; i++) {
|
|
1597
|
+
palette.push(generateRandomCoolColor());
|
|
1598
|
+
}
|
|
1599
|
+
return palette;
|
|
1600
|
+
}
|
|
1601
|
+
function generateRandomEarthTonePalette(count) {
|
|
1602
|
+
const palette = [];
|
|
1603
|
+
for (let i = 0; i < count; i++) {
|
|
1604
|
+
palette.push(generateRandomEarthToneColor());
|
|
1605
|
+
}
|
|
1606
|
+
return palette;
|
|
1607
|
+
}
|
|
1608
|
+
function generateRandomMetallicPalette(count) {
|
|
1609
|
+
const palette = [];
|
|
1610
|
+
for (let i = 0; i < count; i++) {
|
|
1611
|
+
palette.push(generateRandomMetallicColor());
|
|
1612
|
+
}
|
|
1613
|
+
return palette;
|
|
1614
|
+
}
|
|
1615
|
+
function generateRandomNeonPalette(count) {
|
|
1616
|
+
const palette = [];
|
|
1617
|
+
for (let i = 0; i < count; i++) {
|
|
1618
|
+
palette.push(generateRandomNeonColor());
|
|
1619
|
+
}
|
|
1620
|
+
return palette;
|
|
1621
|
+
}
|
|
1622
|
+
function pxToRem(px, base = 16) {
|
|
1623
|
+
return `${px / base}rem`;
|
|
1624
|
+
}
|
|
1625
|
+
function remToPx(rem, base = 16) {
|
|
1626
|
+
const remValue = parseFloat(rem);
|
|
1627
|
+
return remValue * base;
|
|
1628
|
+
}
|
|
1629
|
+
function pxToEm(px, base = 16) {
|
|
1630
|
+
return `${px / base}em`;
|
|
1631
|
+
}
|
|
1632
|
+
function emToPx(em, base = 16) {
|
|
1633
|
+
const emValue = parseFloat(em);
|
|
1634
|
+
return emValue * base;
|
|
1635
|
+
}
|
|
1636
|
+
function pxToPercent(px, total) {
|
|
1637
|
+
return `${px / total * 100}%`;
|
|
1638
|
+
}
|
|
1639
|
+
function percentToPx(percent, total) {
|
|
1640
|
+
const percentValue = parseFloat(percent);
|
|
1641
|
+
return percentValue / 100 * total;
|
|
1642
|
+
}
|
|
1643
|
+
function remToEm(rem, base = 16) {
|
|
1644
|
+
const remValue = parseFloat(rem);
|
|
1645
|
+
return `${remValue}em`;
|
|
1646
|
+
}
|
|
1647
|
+
function generateUniqueId(length = 8) {
|
|
1648
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1649
|
+
let id = "";
|
|
1650
|
+
for (let i = 0; i < length; i++) {
|
|
1651
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1652
|
+
}
|
|
1653
|
+
return id;
|
|
1654
|
+
}
|
|
1655
|
+
function generateUUID() {
|
|
1656
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
1657
|
+
const r = Math.random() * 16 | 0;
|
|
1658
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
1659
|
+
return v.toString(16);
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
function generateShortId(length = 6) {
|
|
1663
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1664
|
+
let id = "";
|
|
1665
|
+
for (let i = 0; i < length; i++) {
|
|
1666
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1667
|
+
}
|
|
1668
|
+
return id;
|
|
1669
|
+
}
|
|
1670
|
+
function generateNanoId(length = 21) {
|
|
1671
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
|
|
1672
|
+
let id = "";
|
|
1673
|
+
for (let i = 0; i < length; i++) {
|
|
1674
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1675
|
+
}
|
|
1676
|
+
return id;
|
|
1677
|
+
}
|
|
1678
|
+
function generateRandomString(length = 10) {
|
|
1679
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1680
|
+
let str = "";
|
|
1681
|
+
for (let i = 0; i < length; i++) {
|
|
1682
|
+
str += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1683
|
+
}
|
|
1684
|
+
return str;
|
|
1685
|
+
}
|
|
1686
|
+
function generateRandomHexId(length = 16) {
|
|
1687
|
+
const chars = "abcdef0123456789";
|
|
1688
|
+
let id = "";
|
|
1689
|
+
for (let i = 0; i < length; i++) {
|
|
1690
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1691
|
+
}
|
|
1692
|
+
return id;
|
|
1693
|
+
}
|
|
1694
|
+
function generateRandomNumericId(length = 8) {
|
|
1695
|
+
const chars = "0123456789";
|
|
1696
|
+
let id = "";
|
|
1697
|
+
for (let i = 0; i < length; i++) {
|
|
1698
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1699
|
+
}
|
|
1700
|
+
return id;
|
|
1701
|
+
}
|
|
1702
|
+
function generateRandomAlphaId(length = 8) {
|
|
1703
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
1704
|
+
let id = "";
|
|
1705
|
+
for (let i = 0; i < length; i++) {
|
|
1706
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1707
|
+
}
|
|
1708
|
+
return id;
|
|
1709
|
+
}
|
|
1710
|
+
function generateRandomAlphanumericId(length = 8) {
|
|
1711
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1712
|
+
let id = "";
|
|
1713
|
+
for (let i = 0; i < length; i++) {
|
|
1714
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1715
|
+
}
|
|
1716
|
+
return id;
|
|
1717
|
+
}
|
|
1718
|
+
function generateRandomBase64Id(length = 12) {
|
|
1719
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1720
|
+
let id = "";
|
|
1721
|
+
for (let i = 0; i < length; i++) {
|
|
1722
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1723
|
+
}
|
|
1724
|
+
return id;
|
|
1725
|
+
}
|
|
1726
|
+
function generateRandomUrlSafeId(length = 12) {
|
|
1727
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
1728
|
+
let id = "";
|
|
1729
|
+
for (let i = 0; i < length; i++) {
|
|
1730
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1731
|
+
}
|
|
1732
|
+
return id;
|
|
1733
|
+
}
|
|
1734
|
+
function generateRandomSlug(length = 8) {
|
|
1735
|
+
const chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
1736
|
+
let slug = "";
|
|
1737
|
+
for (let i = 0; i < length; i++) {
|
|
1738
|
+
slug += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1739
|
+
}
|
|
1740
|
+
return slug;
|
|
1741
|
+
}
|
|
1742
|
+
function generateRandomToken(length = 32) {
|
|
1743
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1744
|
+
let token = "";
|
|
1745
|
+
for (let i = 0; i < length; i++) {
|
|
1746
|
+
token += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1747
|
+
}
|
|
1748
|
+
return token;
|
|
1749
|
+
}
|
|
1750
|
+
function generateRandomApiKey(length = 32) {
|
|
1751
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1752
|
+
let apiKey = "";
|
|
1753
|
+
for (let i = 0; i < length; i++) {
|
|
1754
|
+
apiKey += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1755
|
+
}
|
|
1756
|
+
return apiKey;
|
|
1757
|
+
}
|
|
1758
|
+
function generateRandomSessionId(length = 24) {
|
|
1759
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1760
|
+
let sessionId = "";
|
|
1761
|
+
for (let i = 0; i < length; i++) {
|
|
1762
|
+
sessionId += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1763
|
+
}
|
|
1764
|
+
return sessionId;
|
|
1765
|
+
}
|
|
1766
|
+
function generateRandomPassword(length = 12) {
|
|
1767
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=";
|
|
1768
|
+
let password = "";
|
|
1769
|
+
for (let i = 0; i < length; i++) {
|
|
1770
|
+
password += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1771
|
+
}
|
|
1772
|
+
return password;
|
|
1773
|
+
}
|
|
1774
|
+
function generateRandomUsername(length = 8) {
|
|
1775
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1776
|
+
let username = "";
|
|
1777
|
+
for (let i = 0; i < length; i++) {
|
|
1778
|
+
username += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1779
|
+
}
|
|
1780
|
+
return username;
|
|
1781
|
+
}
|
|
1782
|
+
function generateRandomEmail(length = 8) {
|
|
1783
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1784
|
+
let email = "";
|
|
1785
|
+
for (let i = 0; i < length; i++) {
|
|
1786
|
+
email += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1787
|
+
}
|
|
1788
|
+
return `${email.toLowerCase()}@example.com`;
|
|
1789
|
+
}
|
|
1790
|
+
function generateRandomDomain(length = 8) {
|
|
1791
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1792
|
+
let domain = "";
|
|
1793
|
+
for (let i = 0; i < length; i++) {
|
|
1794
|
+
domain += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1795
|
+
}
|
|
1796
|
+
return `${domain.toLowerCase()}.com`;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
// src/utils/date.ts
|
|
1800
|
+
var dtxParse = (value) => {
|
|
1801
|
+
if (!value) return /* @__PURE__ */ new Date();
|
|
1802
|
+
if (value instanceof Date) {
|
|
1803
|
+
return new Date(value);
|
|
1804
|
+
}
|
|
1805
|
+
return new Date(value);
|
|
1806
|
+
};
|
|
1807
|
+
var date = (value, dateFormat) => {
|
|
1808
|
+
const _dtx = dtxParse(value);
|
|
1809
|
+
const { locale, options } = dateFormat || {};
|
|
1810
|
+
const parts = new Intl.DateTimeFormat(locale || "EN", options).formatToParts(_dtx);
|
|
1811
|
+
const month = _dtx.getMonth();
|
|
1812
|
+
return {
|
|
1813
|
+
date: _dtx,
|
|
1814
|
+
month,
|
|
1815
|
+
parts,
|
|
1816
|
+
getDateSplit: (value2) => {
|
|
1817
|
+
if (!value2) return null;
|
|
1818
|
+
const [month2, year] = value2?.split("-").map(Number);
|
|
1819
|
+
return { year, month: month2 };
|
|
1820
|
+
},
|
|
1821
|
+
// MONTH
|
|
1822
|
+
getMonth: () => _dtx.getMonth(),
|
|
1823
|
+
getMonthFormat: (month2) => new Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit" }).format(_dtx.setMonth(month2)),
|
|
1824
|
+
getMonthsFormat: () => times(12, (i) => new Intl.DateTimeFormat(locale, { month: "short" }).format(_dtx.setMonth(i))),
|
|
1825
|
+
setMonth: (month2) => new Date(_dtx.setMonth(month2)),
|
|
1826
|
+
addMonth: (month2) => new Date(_dtx.setMonth(_dtx.getMonth() + month2)),
|
|
1827
|
+
subtractMonth: (month2) => new Date(_dtx.setMonth(_dtx.getMonth() - month2)),
|
|
1828
|
+
diferenceMonths: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24 * 30)),
|
|
1829
|
+
isSameMonth: (date2) => _dtx.getFullYear() === date2.getFullYear() && _dtx.getMonth() === date2.getMonth(),
|
|
1830
|
+
// YEAR
|
|
1831
|
+
setYear: (year) => new Date(_dtx.setFullYear(year)),
|
|
1832
|
+
getUTCYear: () => _dtx.getUTCFullYear(),
|
|
1833
|
+
addYears: (year) => new Date(_dtx.setFullYear(_dtx.getFullYear() + year)),
|
|
1834
|
+
subtractYears: (year) => new Date(_dtx.setFullYear(_dtx.getFullYear() - year)),
|
|
1835
|
+
diferenceYears: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24 * 365)),
|
|
1836
|
+
isSameYear: (date2) => _dtx.getFullYear() === date2.getFullYear(),
|
|
1837
|
+
// DAYS
|
|
1838
|
+
setDay: (day) => new Date(_dtx.setDate(day)),
|
|
1839
|
+
addDays: (days) => new Date(_dtx.setDate(_dtx.getDate() + days)),
|
|
1840
|
+
getDay: () => _dtx.getDate(),
|
|
1841
|
+
subtractDays: (days) => new Date(_dtx.setDate(_dtx.getDate() - days)),
|
|
1842
|
+
diferenceDays: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60 * 24)),
|
|
1843
|
+
isSameDay: (date2) => _dtx.getFullYear() === date2.getFullYear(),
|
|
1844
|
+
// HOURS
|
|
1845
|
+
addHours: (hours) => new Date(_dtx.setHours(_dtx.getHours() + hours)),
|
|
1846
|
+
setHours: (hours) => new Date(_dtx.setHours(hours)),
|
|
1847
|
+
getHours: () => _dtx.getHours(),
|
|
1848
|
+
subtractHours: (hours) => new Date(_dtx.setHours(_dtx.getHours() - hours)),
|
|
1849
|
+
diferenceHours: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60 * 60)),
|
|
1850
|
+
// MINUTES
|
|
1851
|
+
addMinutes: (minutes) => new Date(_dtx.setMinutes(_dtx.getMinutes() + minutes)),
|
|
1852
|
+
setMinutes: (minutes) => new Date(_dtx.setMinutes(minutes)),
|
|
1853
|
+
getMinutes: () => _dtx.getMinutes(),
|
|
1854
|
+
subtractMinutes: (minutes) => new Date(_dtx.setMinutes(_dtx.getMinutes() - minutes)),
|
|
1855
|
+
diferenceMinutes: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / (1e3 * 60)),
|
|
1856
|
+
// SECONDS
|
|
1857
|
+
addSeconds: (seconds) => new Date(_dtx.setSeconds(_dtx.getSeconds() + seconds)),
|
|
1858
|
+
setSeconds: (seconds) => new Date(_dtx.setSeconds(seconds)),
|
|
1859
|
+
getSeconds: () => _dtx.getSeconds(),
|
|
1860
|
+
subtractSeconds: (seconds) => new Date(_dtx.setSeconds(_dtx.getSeconds() - seconds)),
|
|
1861
|
+
diferenceSeconds: (date2) => Math.ceil((dtxParse(date2).getTime() - _dtx.getTime()) / 1e3),
|
|
1862
|
+
// Utils
|
|
1863
|
+
isToday: () => _dtx.getDate() === (/* @__PURE__ */ new Date()).getDate(),
|
|
1864
|
+
isAfter: (date2) => _dtx.getTime() > new Date(date2).getTime(),
|
|
1865
|
+
isBefore: (date2) => _dtx.getTime() < new Date(date2).getTime(),
|
|
1866
|
+
formatLastMonth: () => {
|
|
1867
|
+
const data = _dtx.setMonth(month - 1);
|
|
1868
|
+
const response = Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit", year: options?.year || "numeric" }).formatToParts(data);
|
|
1869
|
+
return response.map((part) => {
|
|
1870
|
+
if (part.type === "literal") {
|
|
1871
|
+
return "-";
|
|
137
1872
|
}
|
|
138
|
-
|
|
1873
|
+
return part.value;
|
|
1874
|
+
}).join("");
|
|
1875
|
+
},
|
|
1876
|
+
formatPrevMonth: () => {
|
|
1877
|
+
const data = _dtx.setMonth(month + 1);
|
|
1878
|
+
const response = Intl.DateTimeFormat(locale || "EN", { month: options?.month || "2-digit", year: options?.year || "numeric" }).formatToParts(data);
|
|
1879
|
+
return response.map((part) => {
|
|
1880
|
+
if (part.type === "literal") {
|
|
1881
|
+
return "-";
|
|
1882
|
+
}
|
|
1883
|
+
return part.value;
|
|
1884
|
+
}).join("");
|
|
1885
|
+
},
|
|
1886
|
+
getDaysInYear: () => new Date(_dtx.getFullYear(), 11, 31).getDate(),
|
|
1887
|
+
getDaysInMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth() + 1, 0).getDate(),
|
|
1888
|
+
getDayOfWeek: () => _dtx.getDay(),
|
|
1889
|
+
getDayOfYear: () => Math.ceil((_dtx.getTime() - new Date(_dtx.getFullYear(), 0, 1).getTime()) / (1e3 * 60 * 60 * 24) + 1),
|
|
1890
|
+
getWeekOfYear: () => Math.ceil(((_dtx.getTime() - new Date(_dtx.getFullYear(), 0, 1).getTime()) / (1e3 * 60 * 60 * 24) + 1) / 7),
|
|
1891
|
+
getStartOfDay: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate()),
|
|
1892
|
+
getEndOfDay: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate(), 23, 59, 59, 999),
|
|
1893
|
+
getStartOfMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth(), 1),
|
|
1894
|
+
getEndOfMonth: () => new Date(_dtx.getFullYear(), _dtx.getMonth() + 1, 0, 23, 59, 59, 999),
|
|
1895
|
+
getStartOfYear: () => new Date(_dtx.getFullYear(), 0, 1),
|
|
1896
|
+
getEndOfYear: () => new Date(_dtx.getFullYear(), 11, 31, 23, 59, 59, 999),
|
|
1897
|
+
isLeapYear: () => _dtx.getFullYear() % 4 === 0 && _dtx.getFullYear() % 100 !== 0 || _dtx.getFullYear() % 400 === 0,
|
|
1898
|
+
isWeekend: () => {
|
|
1899
|
+
const day = _dtx.getDay();
|
|
1900
|
+
return day === 0 || day === 6;
|
|
1901
|
+
},
|
|
1902
|
+
isTomorrow: () => {
|
|
1903
|
+
const tomorrow = /* @__PURE__ */ new Date();
|
|
1904
|
+
tomorrow.setDate((/* @__PURE__ */ new Date()).getDate() + 1);
|
|
1905
|
+
return _dtx.getDate() === tomorrow.getDate() && _dtx.getMonth() === tomorrow.getMonth() && _dtx.getFullYear() === tomorrow.getFullYear();
|
|
1906
|
+
},
|
|
1907
|
+
// FORMATS
|
|
1908
|
+
formatDateWithLocale: (locale2, options2) => _dtx.toLocaleDateString(locale2, options2),
|
|
1909
|
+
formatTimeWithLocale: (locale2, options2) => _dtx.toLocaleTimeString(locale2, options2),
|
|
1910
|
+
formatDateTimeWithLocale: (locale2, options2) => _dtx.toLocaleString(locale2, options2),
|
|
1911
|
+
getDayOfWeekWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { weekday: options?.weekday || "long" }),
|
|
1912
|
+
getMonthNameWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { month: options?.month || "long" }),
|
|
1913
|
+
getYearWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { year: options?.year || "numeric" }),
|
|
1914
|
+
getHourWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { hour: options?.hour || "2-digit" }),
|
|
1915
|
+
getMinuteWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { minute: options?.minute || "2-digit" }),
|
|
1916
|
+
getSecondWithLocale: (locale2) => _dtx.toLocaleTimeString(locale2, { second: options?.second || "2-digit" }),
|
|
1917
|
+
getDayOfYearWithLocale: (locale2) => _dtx.toLocaleDateString(locale2, { day: options?.day || "numeric" }),
|
|
1918
|
+
getTimezoneOffset: () => _dtx.getTimezoneOffset(),
|
|
1919
|
+
convertToTimezone: (timezone) => {
|
|
1920
|
+
const utcDate = new Date(_dtx.getTime() + _dtx.getTimezoneOffset() * 6e4);
|
|
1921
|
+
const tzDate = new Date(utcDate.toLocaleString(locale, { timeZone: timezone }));
|
|
1922
|
+
return tzDate;
|
|
1923
|
+
},
|
|
1924
|
+
toDate() {
|
|
1925
|
+
return dtxParse(_dtx);
|
|
1926
|
+
},
|
|
1927
|
+
Timestamp() {
|
|
1928
|
+
return _dtx.getTime();
|
|
1929
|
+
},
|
|
1930
|
+
ISO: () => {
|
|
1931
|
+
return _dtx.toISOString();
|
|
1932
|
+
},
|
|
1933
|
+
UNIX() {
|
|
1934
|
+
return Math.floor(_dtx.getTime() / 1e3);
|
|
1935
|
+
},
|
|
1936
|
+
UTC() {
|
|
1937
|
+
return new Date(Date.UTC(_dtx.getFullYear(), _dtx.getMonth(), _dtx.getDate(), _dtx.getHours(), _dtx.getMinutes(), _dtx.getSeconds()));
|
|
1938
|
+
},
|
|
1939
|
+
UTCHours() {
|
|
1940
|
+
return _dtx.getUTCHours();
|
|
1941
|
+
},
|
|
1942
|
+
UTCMinutes() {
|
|
1943
|
+
return _dtx.getUTCMinutes();
|
|
1944
|
+
},
|
|
1945
|
+
UTCSeconds() {
|
|
1946
|
+
return _dtx.getUTCSeconds();
|
|
1947
|
+
},
|
|
1948
|
+
UTCMilliseconds() {
|
|
1949
|
+
return _dtx.getUTCMilliseconds();
|
|
1950
|
+
},
|
|
1951
|
+
UTCWeekendDay() {
|
|
1952
|
+
return _dtx.getUTCDay();
|
|
1953
|
+
},
|
|
1954
|
+
UTCDay() {
|
|
1955
|
+
return _dtx.getUTCDate();
|
|
1956
|
+
},
|
|
1957
|
+
UTCMonth() {
|
|
1958
|
+
return _dtx.getUTCMonth();
|
|
1959
|
+
},
|
|
1960
|
+
UTCFullYear() {
|
|
1961
|
+
return _dtx.getUTCFullYear();
|
|
139
1962
|
}
|
|
140
|
-
return classes.join(" ");
|
|
141
1963
|
};
|
|
142
1964
|
};
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
1965
|
+
var dtx = (value, dateFormat) => {
|
|
1966
|
+
const date2 = dtxParse(value);
|
|
1967
|
+
const { locale, options } = dateFormat || {};
|
|
1968
|
+
return {
|
|
1969
|
+
date: date2,
|
|
1970
|
+
isToday() {
|
|
1971
|
+
const today = /* @__PURE__ */ new Date();
|
|
1972
|
+
return date2.getDate() === today.getDate() && date2.getMonth() === today.getMonth() && date2.getFullYear() === today.getFullYear();
|
|
1973
|
+
},
|
|
1974
|
+
isAfter(other) {
|
|
1975
|
+
return date2.getTime() > dtxParse(other).getTime();
|
|
1976
|
+
},
|
|
1977
|
+
isBefore(other) {
|
|
1978
|
+
return date2.getTime() < dtxParse(other).getTime();
|
|
1979
|
+
},
|
|
1980
|
+
format(locale2 = "it-IT", options2) {
|
|
1981
|
+
return new Intl.DateTimeFormat(
|
|
1982
|
+
locale2,
|
|
1983
|
+
options2
|
|
1984
|
+
).format(date2);
|
|
1985
|
+
},
|
|
1986
|
+
setDate(month, day) {
|
|
1987
|
+
const copy = new Date(date2);
|
|
1988
|
+
copy.setMonth(month);
|
|
1989
|
+
copy.setDate(day);
|
|
1990
|
+
return dtx(copy);
|
|
1991
|
+
},
|
|
1992
|
+
addDate(days) {
|
|
1993
|
+
const copy = new Date(date2);
|
|
1994
|
+
copy.setDate(copy.getDate() + days);
|
|
1995
|
+
return dtx(copy);
|
|
1996
|
+
},
|
|
1997
|
+
addDays(days) {
|
|
1998
|
+
const copy = new Date(date2);
|
|
1999
|
+
copy.setDate(copy.getDate() + days);
|
|
2000
|
+
return dtx(copy);
|
|
2001
|
+
},
|
|
2002
|
+
setDay(days) {
|
|
2003
|
+
const copy = new Date(date2);
|
|
2004
|
+
copy.setDate(days);
|
|
2005
|
+
return dtx(copy);
|
|
2006
|
+
},
|
|
2007
|
+
dayStart: () => {
|
|
2008
|
+
const firstDayOfMonth = new Date(date2.getFullYear(), date2.getMonth(), 1);
|
|
2009
|
+
return firstDayOfMonth.getDay();
|
|
2010
|
+
},
|
|
2011
|
+
days: new Date(date2.getFullYear(), date2.getMonth() + 1, 0).getDate(),
|
|
2012
|
+
getCurrentUTCDay: () => {
|
|
2013
|
+
const utcDate = new Date((/* @__PURE__ */ new Date()).toUTCString());
|
|
2014
|
+
return utcDate.getDay();
|
|
2015
|
+
},
|
|
2016
|
+
CalendarDaysInMonth(year, month) {
|
|
2017
|
+
return new Date(year, month + 1, 0).getDate();
|
|
2018
|
+
},
|
|
2019
|
+
isWeekend: (day) => {
|
|
2020
|
+
const date3 = /* @__PURE__ */ new Date();
|
|
2021
|
+
date3.setDate(day);
|
|
2022
|
+
const dayOfWeek = date3.getDay();
|
|
2023
|
+
return dayOfWeek === 0 || dayOfWeek === 6;
|
|
2024
|
+
},
|
|
2025
|
+
addMonth(months) {
|
|
2026
|
+
const copy = new Date(date2);
|
|
2027
|
+
copy.setMonth(copy.getMonth() + months);
|
|
2028
|
+
return dtx(copy);
|
|
2029
|
+
},
|
|
2030
|
+
setMonth(month) {
|
|
2031
|
+
const copy = new Date(date2);
|
|
2032
|
+
copy.setMonth(month);
|
|
2033
|
+
return dtx(copy);
|
|
2034
|
+
},
|
|
2035
|
+
isMonth: (month) => month === (/* @__PURE__ */ new Date()).getMonth(),
|
|
2036
|
+
startOfMonth() {
|
|
2037
|
+
return dtx(
|
|
2038
|
+
new Date(
|
|
2039
|
+
date2.getFullYear(),
|
|
2040
|
+
date2.getMonth(),
|
|
2041
|
+
1
|
|
2042
|
+
)
|
|
2043
|
+
);
|
|
2044
|
+
},
|
|
2045
|
+
endOfMonth() {
|
|
2046
|
+
return dtx(
|
|
2047
|
+
new Date(
|
|
2048
|
+
date2.getFullYear(),
|
|
2049
|
+
date2.getMonth() + 1,
|
|
2050
|
+
0
|
|
2051
|
+
)
|
|
2052
|
+
);
|
|
2053
|
+
},
|
|
2054
|
+
getMonthsLocale(locale2 = "EN") {
|
|
2055
|
+
return times(12, (i) => new Intl.DateTimeFormat(locale2, { month: options?.month || "short" }).format(new Date(2e3, i, 1)));
|
|
2056
|
+
},
|
|
2057
|
+
toDate() {
|
|
2058
|
+
return new Date(date2);
|
|
2059
|
+
},
|
|
2060
|
+
toISOString() {
|
|
2061
|
+
return date2.toISOString();
|
|
2062
|
+
},
|
|
2063
|
+
CalendarYearFormat(year, format = "YYYY") {
|
|
2064
|
+
return Intl.DateTimeFormat(dateFormat?.locale, { year: format === "YYYY" ? "numeric" : "2-digit" }).format(new Date(year, 0, 1));
|
|
2065
|
+
},
|
|
2066
|
+
calendar: (props) => {
|
|
2067
|
+
const { dtx: dtx2, month, day, data, selected } = props || {};
|
|
2068
|
+
return {
|
|
2069
|
+
day,
|
|
2070
|
+
date: dtx2.toDate(),
|
|
2071
|
+
iso: dtx2.toISOString(),
|
|
2072
|
+
month,
|
|
2073
|
+
key: dtx2.format(locale || "EN", { month: "2-digit", day: "2-digit", year: "numeric" }).replace(/\//g, "-"),
|
|
2074
|
+
monthName: dtx2.format(locale || "EN", { month: options?.month || "short" }),
|
|
2075
|
+
isToday: dtx2.isToday(),
|
|
2076
|
+
isPast: dtx2.isBefore(/* @__PURE__ */ new Date()),
|
|
2077
|
+
isFuture: dtx2.isAfter(/* @__PURE__ */ new Date()),
|
|
2078
|
+
isCurrentMonth: dtx2.isMonth(month),
|
|
2079
|
+
selected: selected?.day === day || false,
|
|
2080
|
+
data: data || null
|
|
2081
|
+
};
|
|
149
2082
|
}
|
|
150
|
-
|
|
151
|
-
}).join(" ");
|
|
2083
|
+
};
|
|
152
2084
|
};
|
|
153
2085
|
|
|
154
2086
|
// 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");
|
|
2087
|
+
function getMonthCalendar(dataFormat, year, month, startIndex, selected, props) {
|
|
2088
|
+
const { locale, days, options } = dataFormat || {};
|
|
2089
|
+
const _date = dtx(new Date(year, month, 1), dataFormat);
|
|
162
2090
|
let dayCurrent = {};
|
|
163
|
-
let startDay =
|
|
2091
|
+
let startDay = _date.dayStart();
|
|
164
2092
|
startDay = startDay === 0 ? 6 : startDay - 1;
|
|
165
|
-
const daysInMonth =
|
|
2093
|
+
const daysInMonth = _date.days;
|
|
166
2094
|
const calendar = [];
|
|
167
2095
|
let week = [];
|
|
168
2096
|
for (let i = 0; i < startDay; i++) {
|
|
169
2097
|
week.push(null);
|
|
170
2098
|
}
|
|
171
2099
|
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
|
-
});
|
|
2100
|
+
const key = _date.format(dataFormat.locale || "EN", { day: "2-digit", month: "2-digit", year: "numeric" });
|
|
2101
|
+
week.push(_date.calendar({ dtx: _date.setDate(month, day), month, day, data: [], selected, key }));
|
|
199
2102
|
if (week.length === 7) {
|
|
200
2103
|
calendar.push(week);
|
|
201
2104
|
week = [];
|
|
@@ -217,40 +2120,46 @@ function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
|
217
2120
|
return {
|
|
218
2121
|
calendar,
|
|
219
2122
|
month,
|
|
220
|
-
date:
|
|
221
|
-
daysContainer: getDaysContainer(),
|
|
222
|
-
monthLabel:
|
|
223
|
-
yearLabel:
|
|
224
|
-
days:
|
|
2123
|
+
date: _date.toDate(),
|
|
2124
|
+
daysContainer: getDaysContainer().map((i) => ({ label: isEmpty(days) ? i : days?.[i], value: i })),
|
|
2125
|
+
monthLabel: _date.getMonthsLocale(locale)[month],
|
|
2126
|
+
yearLabel: _date.CalendarYearFormat(year),
|
|
2127
|
+
days: _date.CalendarDaysInMonth(year, month),
|
|
225
2128
|
weeks: calendar.length,
|
|
226
|
-
isWeekend:
|
|
2129
|
+
isWeekend: _date.isWeekend(_date.getCurrentUTCDay()),
|
|
227
2130
|
selected: selected ? Object.assign({}, selected) : null,
|
|
228
|
-
currentDay: dayCurrent
|
|
2131
|
+
currentDay: dayCurrent,
|
|
2132
|
+
props
|
|
229
2133
|
};
|
|
230
2134
|
}
|
|
231
|
-
function getMonthCalendarProps({ year, data, value,
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
2135
|
+
function getMonthCalendarProps({ year, data, value, format }) {
|
|
2136
|
+
const dtx2 = date(new Date(year, 0, 1), format);
|
|
2137
|
+
const months = dtx2.getMonthsFormat();
|
|
2138
|
+
const r = dtx2.getDateSplit(value);
|
|
2139
|
+
const smonths = times(
|
|
2140
|
+
months.length,
|
|
2141
|
+
(i) => ({
|
|
2142
|
+
year,
|
|
2143
|
+
label: upperCase(months[i]),
|
|
2144
|
+
value: dtx2.getMonthFormat(i),
|
|
2145
|
+
disabled: dtx2.isAfter(new Date(year, i)) || !!data.exclude.find((e) => e.year === year)?.months.includes(i),
|
|
2146
|
+
selected: !data.selected ? false : r?.month === i + 1 && r?.year === year
|
|
2147
|
+
})
|
|
2148
|
+
);
|
|
2149
|
+
const resolve = {
|
|
237
2150
|
year,
|
|
238
|
-
startIndex,
|
|
2151
|
+
startIndex: dtx2.getMonth(),
|
|
239
2152
|
years: data.years,
|
|
240
2153
|
value,
|
|
241
|
-
last:
|
|
242
|
-
prev:
|
|
243
|
-
months:
|
|
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
|
-
}))
|
|
2154
|
+
last: dtx2.formatLastMonth(),
|
|
2155
|
+
prev: dtx2.formatPrevMonth(),
|
|
2156
|
+
months: smonths
|
|
249
2157
|
};
|
|
2158
|
+
return resolve;
|
|
250
2159
|
}
|
|
251
2160
|
|
|
252
2161
|
// src/utils/color.ts
|
|
253
|
-
var
|
|
2162
|
+
var rgbToHex2 = (r, g, b) => {
|
|
254
2163
|
return "#" + [r, g, b].map(
|
|
255
2164
|
(v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0")
|
|
256
2165
|
).join("");
|
|
@@ -293,7 +2202,7 @@ var createPaletteColor = (main) => {
|
|
|
293
2202
|
};
|
|
294
2203
|
var lighten = (hex, amount) => {
|
|
295
2204
|
const { r, g, b } = hexToRgb(hex);
|
|
296
|
-
return
|
|
2205
|
+
return rgbToHex2(
|
|
297
2206
|
r + (255 - r) * amount,
|
|
298
2207
|
g + (255 - g) * amount,
|
|
299
2208
|
b + (255 - b) * amount
|
|
@@ -301,7 +2210,7 @@ var lighten = (hex, amount) => {
|
|
|
301
2210
|
};
|
|
302
2211
|
var darken = (hex, amount) => {
|
|
303
2212
|
const { r, g, b } = hexToRgb(hex);
|
|
304
|
-
return
|
|
2213
|
+
return rgbToHex2(
|
|
305
2214
|
r * (1 - amount),
|
|
306
2215
|
g * (1 - amount),
|
|
307
2216
|
b * (1 - amount)
|
|
@@ -312,27 +2221,6 @@ var alpha = (hex, opacity) => {
|
|
|
312
2221
|
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
313
2222
|
};
|
|
314
2223
|
|
|
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
2224
|
// src/utils/cx.ts
|
|
337
2225
|
var cx = (...args) => {
|
|
338
2226
|
return args.flatMap((arg) => {
|
|
@@ -419,10 +2307,10 @@ var createVariants = (config) => {
|
|
|
419
2307
|
return (props = {}) => {
|
|
420
2308
|
const classes = [config.base];
|
|
421
2309
|
if (config.variants) {
|
|
422
|
-
Object.entries(config.variants).forEach(([key,
|
|
2310
|
+
Object.entries(config.variants).forEach(([key, map2]) => {
|
|
423
2311
|
const value = props[key];
|
|
424
|
-
if (value &&
|
|
425
|
-
classes.push(
|
|
2312
|
+
if (value && map2[value]) {
|
|
2313
|
+
classes.push(map2[value]);
|
|
426
2314
|
}
|
|
427
2315
|
});
|
|
428
2316
|
}
|
|
@@ -473,13 +2361,13 @@ var getNumberPhone = (phone, dial) => {
|
|
|
473
2361
|
};
|
|
474
2362
|
|
|
475
2363
|
// src/utils/merge.ts
|
|
476
|
-
function
|
|
2364
|
+
function mergeDeep2(target, source) {
|
|
477
2365
|
if (!source) return target;
|
|
478
2366
|
const output = { ...target };
|
|
479
|
-
Object.keys(source)
|
|
2367
|
+
Object.keys(source)?.forEach((key) => {
|
|
480
2368
|
const k = key;
|
|
481
2369
|
if (typeof source[k] === "object" && source[k] !== null && !Array.isArray(source[k])) {
|
|
482
|
-
output[k] =
|
|
2370
|
+
output[k] = mergeDeep2(
|
|
483
2371
|
target[k] || {},
|
|
484
2372
|
source[k]
|
|
485
2373
|
);
|
|
@@ -489,6 +2377,10 @@ function mergeDeep(target, source) {
|
|
|
489
2377
|
});
|
|
490
2378
|
return output;
|
|
491
2379
|
}
|
|
2380
|
+
function mergeInitialProps(initial, props) {
|
|
2381
|
+
if (!props) return initial;
|
|
2382
|
+
return mergeDeep2(initial, props);
|
|
2383
|
+
}
|
|
492
2384
|
|
|
493
2385
|
// src/utils/input.ts
|
|
494
2386
|
var inputCurrency = (e, value, alloweds) => {
|
|
@@ -499,6 +2391,11 @@ var inputCurrency = (e, value, alloweds) => {
|
|
|
499
2391
|
e.preventDefault();
|
|
500
2392
|
};
|
|
501
2393
|
|
|
2394
|
+
// src/utils/utils.ts
|
|
2395
|
+
var utils = {
|
|
2396
|
+
...common_exports
|
|
2397
|
+
};
|
|
2398
|
+
|
|
502
2399
|
// src/theme/breakpoint.ts
|
|
503
2400
|
var breakpoints = {
|
|
504
2401
|
xs: 0,
|
|
@@ -838,8 +2735,129 @@ var Box = ({
|
|
|
838
2735
|
"data-testid": "yr3Box",
|
|
839
2736
|
children
|
|
840
2737
|
}
|
|
841
|
-
);
|
|
2738
|
+
);
|
|
2739
|
+
};
|
|
2740
|
+
|
|
2741
|
+
// src/components/Flex/flex.variants.ts
|
|
2742
|
+
var flexVariants = createVariants({
|
|
2743
|
+
base: "yr3Flex",
|
|
2744
|
+
variants: {
|
|
2745
|
+
variant: {
|
|
2746
|
+
row: "yr3Flex--row",
|
|
2747
|
+
column: "yr3Flex--column",
|
|
2748
|
+
wrap: "yr3Flex--wrap"
|
|
2749
|
+
},
|
|
2750
|
+
container: {
|
|
2751
|
+
true: "yr3Flex--container"
|
|
2752
|
+
},
|
|
2753
|
+
center: {
|
|
2754
|
+
true: "yr3Flex--center"
|
|
2755
|
+
},
|
|
2756
|
+
between: {
|
|
2757
|
+
true: "yr3Flex--between"
|
|
2758
|
+
},
|
|
2759
|
+
bordered: {
|
|
2760
|
+
true: "yr3Flex--bordered"
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
});
|
|
2764
|
+
var flex_variants_default = flexVariants;
|
|
2765
|
+
|
|
2766
|
+
// src/components/Flex/Flex.tsx
|
|
2767
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2768
|
+
var Flex = ({
|
|
2769
|
+
container = false,
|
|
2770
|
+
spacing: spacing2 = 1,
|
|
2771
|
+
children,
|
|
2772
|
+
ui,
|
|
2773
|
+
gap,
|
|
2774
|
+
variant = "column",
|
|
2775
|
+
center = false,
|
|
2776
|
+
between = false,
|
|
2777
|
+
style,
|
|
2778
|
+
bordered = false,
|
|
2779
|
+
...props
|
|
2780
|
+
}) => {
|
|
2781
|
+
const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
|
|
2782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2783
|
+
"div",
|
|
2784
|
+
{
|
|
2785
|
+
className: classes,
|
|
2786
|
+
style: composeStyles(ui, style),
|
|
2787
|
+
...props,
|
|
2788
|
+
"data-testid": "yr3Flex",
|
|
2789
|
+
children
|
|
2790
|
+
}
|
|
2791
|
+
);
|
|
2792
|
+
};
|
|
2793
|
+
|
|
2794
|
+
// src/components/Loader/loader.variants.ts
|
|
2795
|
+
var loaderSpinnerVariants = createVariants({
|
|
2796
|
+
base: "yr3Loader--spinner",
|
|
2797
|
+
variants: {
|
|
2798
|
+
color: {
|
|
2799
|
+
primary: "yr3Loader--spinner-color-primary",
|
|
2800
|
+
secondary: "yr3Loader--spinner-color-secondary",
|
|
2801
|
+
success: "yr3Loader--spinner-color-success",
|
|
2802
|
+
error: "yr3Loader--spinner-color-error",
|
|
2803
|
+
warning: "yr3Loader--spinner-color-warning",
|
|
2804
|
+
info: "yr3Loader--spinner-color-info",
|
|
2805
|
+
disabled: "yr3Loader--spinner-color-disabled",
|
|
2806
|
+
text: "yr3Loader--spinner-color-text",
|
|
2807
|
+
background: "yr3Loader--spinner-color-background",
|
|
2808
|
+
common: "yr3Loader--spinner-color-common"
|
|
2809
|
+
},
|
|
2810
|
+
size: {
|
|
2811
|
+
sm: "yr3Loader--spinner-size-sm",
|
|
2812
|
+
md: "yr3Loader--spinner-size-md",
|
|
2813
|
+
lg: "yr3Loader--spinner-size-lg",
|
|
2814
|
+
xs: "yr3Loader--spinner-size-xs"
|
|
2815
|
+
},
|
|
2816
|
+
type: {
|
|
2817
|
+
default: "yr3Loader--spinner-default",
|
|
2818
|
+
dots: "yr3Loader--spinner-dots",
|
|
2819
|
+
fancy: "yr3Loader--spinner-fancy"
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2823
|
+
|
|
2824
|
+
// src/components/Loader/Loader.tsx
|
|
2825
|
+
var React3 = __toESM(require("react"), 1);
|
|
2826
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2827
|
+
var initialComponents = {
|
|
2828
|
+
loader: {
|
|
2829
|
+
ui: {},
|
|
2830
|
+
style: {}
|
|
2831
|
+
},
|
|
2832
|
+
spinner: {
|
|
2833
|
+
size: "sm",
|
|
2834
|
+
color: "primary",
|
|
2835
|
+
type: "default"
|
|
2836
|
+
},
|
|
2837
|
+
container: {
|
|
2838
|
+
center: true,
|
|
2839
|
+
container: true,
|
|
2840
|
+
ui: {
|
|
2841
|
+
width: "100%",
|
|
2842
|
+
height: "100%"
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
};
|
|
2846
|
+
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2847
|
+
const properties = mergeDeep2(initialComponents, propsComponent || {});
|
|
2848
|
+
const classSpinner = loaderSpinnerVariants({
|
|
2849
|
+
color: properties?.spinner?.color,
|
|
2850
|
+
type: properties?.spinner?.type,
|
|
2851
|
+
size: properties?.spinner?.size
|
|
2852
|
+
});
|
|
2853
|
+
if (!loading) return null;
|
|
2854
|
+
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: [
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {}),
|
|
2856
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {}),
|
|
2857
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {})
|
|
2858
|
+
] }) }) }) });
|
|
842
2859
|
};
|
|
2860
|
+
var Loader_default = Loader;
|
|
843
2861
|
|
|
844
2862
|
// src/components/Text/text.variants.ts
|
|
845
2863
|
var textVariants = createVariants({
|
|
@@ -888,7 +2906,7 @@ var textVariants = createVariants({
|
|
|
888
2906
|
var text_variants_default = textVariants;
|
|
889
2907
|
|
|
890
2908
|
// src/components/Text/Text.tsx
|
|
891
|
-
var
|
|
2909
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
892
2910
|
var Text = ({
|
|
893
2911
|
children,
|
|
894
2912
|
variant = "inherit",
|
|
@@ -902,7 +2920,7 @@ var Text = ({
|
|
|
902
2920
|
}) => {
|
|
903
2921
|
const styleUI = uiStyle({ ...ui, marginTop: gutters[0] || 0, marginBottom: gutters[1] || 0 });
|
|
904
2922
|
const classes = text_variants_default({ variant, color, weight });
|
|
905
|
-
return /* @__PURE__ */ (0,
|
|
2923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
906
2924
|
Component,
|
|
907
2925
|
{
|
|
908
2926
|
className: classes,
|
|
@@ -947,15 +2965,18 @@ var buttonVariant = createVariants({
|
|
|
947
2965
|
},
|
|
948
2966
|
animated: {
|
|
949
2967
|
true: "yr3Button--animated"
|
|
2968
|
+
},
|
|
2969
|
+
loading: {
|
|
2970
|
+
true: "yr3Button--spinner-size-md "
|
|
950
2971
|
}
|
|
951
2972
|
}
|
|
952
2973
|
});
|
|
953
2974
|
|
|
954
2975
|
// src/components/Button/Button.tsx
|
|
955
|
-
var
|
|
2976
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
956
2977
|
var Button = ({ icon, children, color = "text", variant = "text", animated, disabled, gradientBorder = false, size = "auto", ui, style, propsComponent, ...props }) => {
|
|
957
2978
|
const buttonClassname = buttonVariant({ variant, color, animated, disabled, gradientBorder, size });
|
|
958
|
-
return /* @__PURE__ */ (0,
|
|
2979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
959
2980
|
"button",
|
|
960
2981
|
{
|
|
961
2982
|
className: buttonClassname,
|
|
@@ -964,17 +2985,16 @@ var Button = ({ icon, children, color = "text", variant = "text", animated, disa
|
|
|
964
2985
|
...props,
|
|
965
2986
|
style: composeStyles(ui, style),
|
|
966
2987
|
children: [
|
|
967
|
-
|
|
968
|
-
/* @__PURE__ */ (0,
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Loader_default, { ...propsComponent?.loader }),
|
|
2989
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "yr3Button--icon", children: icon }),
|
|
2990
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { variant: propsComponent?.text?.variant || "button", ...propsComponent?.text, children })
|
|
969
2991
|
]
|
|
970
2992
|
}
|
|
971
2993
|
);
|
|
972
2994
|
};
|
|
973
2995
|
|
|
974
2996
|
// 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);
|
|
2997
|
+
var React4 = __toESM(require("react"), 1);
|
|
978
2998
|
|
|
979
2999
|
// src/components/Calendar/calendar.variants.ts
|
|
980
3000
|
var calendarVariants = createVariants({
|
|
@@ -1023,14 +3043,22 @@ var calendarDayVariants = createVariants({
|
|
|
1023
3043
|
});
|
|
1024
3044
|
|
|
1025
3045
|
// src/components/Calendar/Calendar.tsx
|
|
1026
|
-
var
|
|
1027
|
-
import_dayjs2.default.extend(import_weekday.default);
|
|
3046
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1028
3047
|
var initalPropsComponent = {
|
|
1029
3048
|
displayButtons: true,
|
|
1030
3049
|
displayCalendar: true,
|
|
3050
|
+
container: {
|
|
3051
|
+
ui: {
|
|
3052
|
+
width: "100%",
|
|
3053
|
+
maxWidth: 400
|
|
3054
|
+
},
|
|
3055
|
+
style: {}
|
|
3056
|
+
},
|
|
1031
3057
|
header: {
|
|
1032
3058
|
color: "primary",
|
|
1033
|
-
ui: {
|
|
3059
|
+
ui: {
|
|
3060
|
+
px: 0.5
|
|
3061
|
+
},
|
|
1034
3062
|
style: {}
|
|
1035
3063
|
},
|
|
1036
3064
|
month: {
|
|
@@ -1040,6 +3068,7 @@ var initalPropsComponent = {
|
|
|
1040
3068
|
},
|
|
1041
3069
|
day: {
|
|
1042
3070
|
color: "primary",
|
|
3071
|
+
selected: "secondary",
|
|
1043
3072
|
bordered: true,
|
|
1044
3073
|
ui: {},
|
|
1045
3074
|
style: {},
|
|
@@ -1047,49 +3076,89 @@ var initalPropsComponent = {
|
|
|
1047
3076
|
},
|
|
1048
3077
|
buttonNext: {
|
|
1049
3078
|
disabled: false,
|
|
1050
|
-
label: "next"
|
|
3079
|
+
label: "next",
|
|
3080
|
+
color: "primary",
|
|
3081
|
+
ui: {
|
|
3082
|
+
justifyContent: "flex-end",
|
|
3083
|
+
p: 0
|
|
3084
|
+
}
|
|
1051
3085
|
},
|
|
1052
3086
|
buttonBack: {
|
|
1053
3087
|
disabled: false,
|
|
1054
|
-
label: "back"
|
|
3088
|
+
label: "back",
|
|
3089
|
+
color: "primary",
|
|
3090
|
+
ui: {
|
|
3091
|
+
justifyContent: "flex-start",
|
|
3092
|
+
p: 0
|
|
3093
|
+
}
|
|
1055
3094
|
}
|
|
1056
3095
|
};
|
|
1057
|
-
var Calendar = ({ onSelect, propsComponent
|
|
1058
|
-
const
|
|
1059
|
-
const
|
|
1060
|
-
const
|
|
1061
|
-
const
|
|
1062
|
-
|
|
3096
|
+
var Calendar = ({ onSelect, propsComponent, mapCalendar, onMonthChange, dataFormat, buttonsComponent }) => {
|
|
3097
|
+
const properties = mergeInitialProps(initalPropsComponent, propsComponent);
|
|
3098
|
+
const _date = /* @__PURE__ */ new Date();
|
|
3099
|
+
const month = date(_date).getMonth();
|
|
3100
|
+
const [currentMonth, setCurrentMonth] = React4.useState(month);
|
|
3101
|
+
const [selected, setSelected] = React4.useState(null);
|
|
3102
|
+
const program = React4.useMemo(() => {
|
|
3103
|
+
return getMonthCalendar(dataFormat, (/* @__PURE__ */ new Date()).getFullYear(), currentMonth, 0, selected, mapCalendar);
|
|
1063
3104
|
}, [selected, currentMonth, mapCalendar]);
|
|
1064
|
-
|
|
3105
|
+
React4.useEffect(() => {
|
|
1065
3106
|
if (selected) {
|
|
1066
3107
|
onSelect && onSelect(selected);
|
|
1067
3108
|
} else {
|
|
1068
|
-
onSelect && onSelect(program
|
|
3109
|
+
onSelect && onSelect(program?.currentDay);
|
|
1069
3110
|
}
|
|
1070
3111
|
}, [selected, program, onSelect]);
|
|
1071
|
-
|
|
3112
|
+
React4.useEffect(() => {
|
|
1072
3113
|
if (currentMonth) {
|
|
1073
3114
|
onMonthChange && onMonthChange(currentMonth);
|
|
1074
3115
|
}
|
|
1075
3116
|
}, [currentMonth]);
|
|
1076
|
-
return /* @__PURE__ */ (0,
|
|
1077
|
-
propsComponent?.displayButtons && /* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1079
|
-
|
|
1080
|
-
|
|
3117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "yr3Calendar", "data-testid": "yr3Calendar", style: composeStyles(properties?.container?.ui, properties?.container?.style), children: [
|
|
3118
|
+
propsComponent?.displayButtons && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "yr3Calendar--header", "data-testid": "yr3CalendarHeader", style: composeStyles(properties?.header?.ui, properties?.header?.style), children: [
|
|
3119
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3120
|
+
Button,
|
|
3121
|
+
{
|
|
3122
|
+
disabled: properties?.buttonBack?.disabled || false,
|
|
3123
|
+
color: properties.buttonBack?.color || "primary",
|
|
3124
|
+
onClick: () => setCurrentMonth(currentMonth - 1),
|
|
3125
|
+
ui: { ...properties.buttonBack.ui },
|
|
3126
|
+
propsComponent: {
|
|
3127
|
+
text: {
|
|
3128
|
+
color: properties?.buttonBack?.color || "primary"
|
|
3129
|
+
}
|
|
3130
|
+
},
|
|
3131
|
+
children: buttonsComponent?.buttonBack ? buttonsComponent?.buttonBack : properties?.buttonBack?.label
|
|
3132
|
+
}
|
|
3133
|
+
),
|
|
3134
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { variant: "h6", color: properties.header?.color || "primary", ui: { textTransform: "uppercase", textAlign: "center" }, children: program?.monthLabel }),
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3136
|
+
Button,
|
|
3137
|
+
{
|
|
3138
|
+
disabled: properties?.buttonNext?.disabled,
|
|
3139
|
+
color: properties?.buttonNext?.color || "primary",
|
|
3140
|
+
onClick: () => setCurrentMonth(currentMonth + 1),
|
|
3141
|
+
propsComponent: {
|
|
3142
|
+
text: {
|
|
3143
|
+
color: properties?.buttonNext?.color || "primary"
|
|
3144
|
+
}
|
|
3145
|
+
},
|
|
3146
|
+
ui: { ...properties.buttonNext.ui },
|
|
3147
|
+
children: buttonsComponent?.buttonNext ? buttonsComponent?.buttonNext : properties?.buttonNext?.label
|
|
3148
|
+
}
|
|
3149
|
+
)
|
|
1081
3150
|
] }),
|
|
1082
|
-
|
|
1083
|
-
program?.daysContainer
|
|
3151
|
+
properties?.displayCalendar && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "yr3Calendar--container", children: [
|
|
3152
|
+
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
3153
|
Text,
|
|
1085
3154
|
{
|
|
1086
3155
|
variant: "caption",
|
|
1087
|
-
color:
|
|
1088
|
-
ui: { ...
|
|
1089
|
-
children:
|
|
3156
|
+
color: properties?.month?.color || "primary",
|
|
3157
|
+
ui: { ...properties?.month?.ui, opacity: 0.7, textTransform: "uppercase" },
|
|
3158
|
+
children: i.label
|
|
1090
3159
|
}
|
|
1091
|
-
) }, `month_day_${i}`)),
|
|
1092
|
-
times(program
|
|
3160
|
+
) }, `month_day_${i.label}`)),
|
|
3161
|
+
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
3162
|
"div",
|
|
1094
3163
|
{
|
|
1095
3164
|
className: calendarDayVariants({
|
|
@@ -1098,11 +3167,11 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1098
3167
|
isPast: program.calendar[i][j]?.isPast,
|
|
1099
3168
|
isFuture: program.calendar[i][j]?.isFuture,
|
|
1100
3169
|
isCurrentMonth: program.calendar[i][j]?.isCurrentMonth,
|
|
1101
|
-
ui:
|
|
1102
|
-
bordered: !!program.calendar[i][j] &&
|
|
1103
|
-
color:
|
|
3170
|
+
ui: properties?.day?.ui,
|
|
3171
|
+
bordered: !!program.calendar[i][j] && properties?.day?.bordered,
|
|
3172
|
+
color: properties?.day?.color || "primary"
|
|
1104
3173
|
}),
|
|
1105
|
-
style: composeStyles(
|
|
3174
|
+
style: composeStyles(properties?.day?.ui, properties?.day?.style),
|
|
1106
3175
|
"data-testid": "yr3CalendarDay",
|
|
1107
3176
|
onClick: () => {
|
|
1108
3177
|
if (selected === program.calendar[i][j]) {
|
|
@@ -1112,13 +3181,13 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1112
3181
|
}
|
|
1113
3182
|
},
|
|
1114
3183
|
children: [
|
|
1115
|
-
program
|
|
1116
|
-
/* @__PURE__ */ (0,
|
|
3184
|
+
program?.calendar[i][j]?.data && properties?.day?.component ? properties?.day?.component : null,
|
|
3185
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1117
3186
|
Text,
|
|
1118
3187
|
{
|
|
1119
3188
|
variant: "body2",
|
|
1120
|
-
color: program
|
|
1121
|
-
children: program
|
|
3189
|
+
color: program?.calendar[i][j]?.selected ? properties?.day?.selected : "primary",
|
|
3190
|
+
children: program?.calendar[i][j]?.day || ""
|
|
1122
3191
|
}
|
|
1123
3192
|
)
|
|
1124
3193
|
]
|
|
@@ -1130,8 +3199,8 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1130
3199
|
};
|
|
1131
3200
|
|
|
1132
3201
|
// src/components/Checkbox/Checkbox.tsx
|
|
1133
|
-
var
|
|
1134
|
-
var
|
|
3202
|
+
var React5 = __toESM(require("react"), 1);
|
|
3203
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1135
3204
|
var initialPropsComponent = {
|
|
1136
3205
|
checkbox: {
|
|
1137
3206
|
ui: {
|
|
@@ -1156,20 +3225,20 @@ var Checkbox = ({
|
|
|
1156
3225
|
type = "default",
|
|
1157
3226
|
variant = "text"
|
|
1158
3227
|
}) => {
|
|
1159
|
-
const [internal, setInternal] =
|
|
3228
|
+
const [internal, setInternal] = React5.useState(defaultChecked || false);
|
|
1160
3229
|
const isControlled = checked !== void 0;
|
|
1161
3230
|
const value = isControlled ? checked : internal;
|
|
1162
3231
|
const handleChange = (e) => {
|
|
1163
3232
|
if (!isControlled) setInternal(e.target.checked);
|
|
1164
3233
|
onChange?.(e, e.target.checked);
|
|
1165
3234
|
};
|
|
1166
|
-
const properties =
|
|
3235
|
+
const properties = mergeDeep2(initialPropsComponent, propsComponent || {});
|
|
1167
3236
|
const bemClasse = bem("yr3Checkbox");
|
|
1168
3237
|
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}`, type: `type-${type}` });
|
|
1169
3238
|
const boxClasses = bem("yr3Checkbox-box");
|
|
1170
3239
|
const classesBox = boxClasses(void 0, { checked: !!value });
|
|
1171
|
-
return /* @__PURE__ */ (0,
|
|
1172
|
-
/* @__PURE__ */ (0,
|
|
3240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: classes, style: uiStyle(properties?.checkbox?.ui), "data-testid": "yr3Checkbox", children: [
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1173
3242
|
"input",
|
|
1174
3243
|
{
|
|
1175
3244
|
type: "checkbox",
|
|
@@ -1179,8 +3248,8 @@ var Checkbox = ({
|
|
|
1179
3248
|
"data-testid": "yr3Checkbox-input"
|
|
1180
3249
|
}
|
|
1181
3250
|
),
|
|
1182
|
-
/* @__PURE__ */ (0,
|
|
1183
|
-
label && /* @__PURE__ */ (0,
|
|
3251
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: classesBox, "data-testid": "yr3Checkbox-box" }),
|
|
3252
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { variant: "caption", color: !value ? properties?.content?.color : color, ...properties?.content, children: label })
|
|
1184
3253
|
] });
|
|
1185
3254
|
};
|
|
1186
3255
|
|
|
@@ -1217,9 +3286,9 @@ var chipVariants = createVariants({
|
|
|
1217
3286
|
var chip_variants_default = chipVariants;
|
|
1218
3287
|
|
|
1219
3288
|
// src/Icons/IconClose.tsx
|
|
1220
|
-
var
|
|
3289
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1221
3290
|
var IconClose = (props) => {
|
|
1222
|
-
return /* @__PURE__ */ (0,
|
|
3291
|
+
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
3292
|
"path",
|
|
1224
3293
|
{
|
|
1225
3294
|
d: "M16 16L12 12M12 12L8 8M12 12L16 8M12 12L8 16",
|
|
@@ -1232,7 +3301,7 @@ var IconClose = (props) => {
|
|
|
1232
3301
|
};
|
|
1233
3302
|
|
|
1234
3303
|
// src/components/Chip/Chip.tsx
|
|
1235
|
-
var
|
|
3304
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1236
3305
|
var initialChipProps = {
|
|
1237
3306
|
label: {
|
|
1238
3307
|
ui: {},
|
|
@@ -1248,9 +3317,9 @@ var initialChipProps = {
|
|
|
1248
3317
|
}
|
|
1249
3318
|
};
|
|
1250
3319
|
var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "medium", propsComponent, ...props }) => {
|
|
1251
|
-
const properties =
|
|
3320
|
+
const properties = mergeDeep2(initialChipProps, propsComponent);
|
|
1252
3321
|
const className = chip_variants_default({ variant, colors: color, rounded, size });
|
|
1253
|
-
return /* @__PURE__ */ (0,
|
|
3322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1254
3323
|
"div",
|
|
1255
3324
|
{
|
|
1256
3325
|
className,
|
|
@@ -1259,8 +3328,8 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1259
3328
|
style: composeStyles(properties.chip?.ui, properties.chip?.style),
|
|
1260
3329
|
children: [
|
|
1261
3330
|
icon,
|
|
1262
|
-
/* @__PURE__ */ (0,
|
|
1263
|
-
deleted && /* @__PURE__ */ (0,
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "yr3Chip__label", style: composeStyles(properties?.label?.ui, properties?.label?.style), children: label }),
|
|
3332
|
+
deleted && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1264
3333
|
"span",
|
|
1265
3334
|
{
|
|
1266
3335
|
className: "yr3Chip__delete",
|
|
@@ -1268,7 +3337,7 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1268
3337
|
role: "button",
|
|
1269
3338
|
"aria-label": "delete",
|
|
1270
3339
|
style: composeStyles(properties?.delete?.ui, properties?.delete?.style),
|
|
1271
|
-
children: /* @__PURE__ */ (0,
|
|
3340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconClose, { ...properties?.icon, stroke: color })
|
|
1272
3341
|
}
|
|
1273
3342
|
)
|
|
1274
3343
|
]
|
|
@@ -1277,12 +3346,12 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1277
3346
|
};
|
|
1278
3347
|
|
|
1279
3348
|
// src/components/Collapse/Collapse.tsx
|
|
1280
|
-
var
|
|
1281
|
-
var
|
|
3349
|
+
var React6 = __toESM(require("react"), 1);
|
|
3350
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1282
3351
|
var Collapse = ({ children, open, anchor }) => {
|
|
1283
|
-
const ref =
|
|
1284
|
-
const [height, setHeight] =
|
|
1285
|
-
|
|
3352
|
+
const ref = React6.useRef(null);
|
|
3353
|
+
const [height, setHeight] = React6.useState(0);
|
|
3354
|
+
React6.useEffect(() => {
|
|
1286
3355
|
if (ref.current) {
|
|
1287
3356
|
if (open) {
|
|
1288
3357
|
setHeight(ref.current.scrollHeight);
|
|
@@ -1291,11 +3360,11 @@ var Collapse = ({ children, open, anchor }) => {
|
|
|
1291
3360
|
}
|
|
1292
3361
|
}
|
|
1293
3362
|
}, [open, children]);
|
|
1294
|
-
return /* @__PURE__ */ (0,
|
|
3363
|
+
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
3364
|
};
|
|
1296
3365
|
|
|
1297
3366
|
// src/components/Container/Container.tsx
|
|
1298
|
-
var
|
|
3367
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1299
3368
|
var Container = ({
|
|
1300
3369
|
children,
|
|
1301
3370
|
maxWidth = "sm",
|
|
@@ -1305,7 +3374,7 @@ var Container = ({
|
|
|
1305
3374
|
}) => {
|
|
1306
3375
|
const containerClassName = bem("yr3Container");
|
|
1307
3376
|
const classes = containerClassName(void 0, { maxWidth, static: fixed });
|
|
1308
|
-
return /* @__PURE__ */ (0,
|
|
3377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1309
3378
|
"div",
|
|
1310
3379
|
{
|
|
1311
3380
|
className: classes,
|
|
@@ -1317,12 +3386,12 @@ var Container = ({
|
|
|
1317
3386
|
};
|
|
1318
3387
|
|
|
1319
3388
|
// src/theme/controlContext.tsx
|
|
1320
|
-
var
|
|
1321
|
-
var ControlContext =
|
|
1322
|
-
var useControl = () =>
|
|
3389
|
+
var React7 = __toESM(require("react"), 1);
|
|
3390
|
+
var ControlContext = React7.createContext(null);
|
|
3391
|
+
var useControl = () => React7.useContext(ControlContext);
|
|
1323
3392
|
|
|
1324
3393
|
// src/components/Control/Control.tsx
|
|
1325
|
-
var
|
|
3394
|
+
var React8 = __toESM(require("react"), 1);
|
|
1326
3395
|
|
|
1327
3396
|
// src/components/Control/control.variants.ts
|
|
1328
3397
|
var controlVariants = createVariants({
|
|
@@ -1365,7 +3434,7 @@ var controlVariants = createVariants({
|
|
|
1365
3434
|
});
|
|
1366
3435
|
|
|
1367
3436
|
// src/components/Control/Control.tsx
|
|
1368
|
-
var
|
|
3437
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1369
3438
|
var Control = ({
|
|
1370
3439
|
children,
|
|
1371
3440
|
error = false,
|
|
@@ -1377,7 +3446,7 @@ var Control = ({
|
|
|
1377
3446
|
size = "auto",
|
|
1378
3447
|
label = true
|
|
1379
3448
|
}) => {
|
|
1380
|
-
const [focused, setFocused] =
|
|
3449
|
+
const [focused, setFocused] = React8.useState(false);
|
|
1381
3450
|
const value = {
|
|
1382
3451
|
focused,
|
|
1383
3452
|
setFocused,
|
|
@@ -1385,7 +3454,7 @@ var Control = ({
|
|
|
1385
3454
|
disabled
|
|
1386
3455
|
};
|
|
1387
3456
|
const classes = controlVariants({ variant, color, label, size, disabled });
|
|
1388
|
-
return /* @__PURE__ */ (0,
|
|
3457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ControlContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1389
3458
|
"div",
|
|
1390
3459
|
{
|
|
1391
3460
|
className: classes,
|
|
@@ -1428,7 +3497,7 @@ var dividerVariants = createVariants({
|
|
|
1428
3497
|
var dividerVariants_default = dividerVariants;
|
|
1429
3498
|
|
|
1430
3499
|
// src/components/Divider/Divider.tsx
|
|
1431
|
-
var
|
|
3500
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1432
3501
|
var Divider = ({
|
|
1433
3502
|
orientation = "horizontal",
|
|
1434
3503
|
text: text2,
|
|
@@ -1438,14 +3507,14 @@ var Divider = ({
|
|
|
1438
3507
|
color = "primary"
|
|
1439
3508
|
}) => {
|
|
1440
3509
|
const classname = dividerVariants_default({ orientation, align, withText: !!text2, color });
|
|
1441
|
-
return /* @__PURE__ */ (0,
|
|
3510
|
+
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
3511
|
};
|
|
1443
3512
|
|
|
1444
3513
|
// src/components/Drawer/Drawer.tsx
|
|
1445
|
-
var
|
|
3514
|
+
var React9 = __toESM(require("react"), 1);
|
|
1446
3515
|
|
|
1447
3516
|
// src/components/Drawer/DrawerContainer.tsx
|
|
1448
|
-
var
|
|
3517
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1449
3518
|
var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
1450
3519
|
const { hide } = useBackdrop();
|
|
1451
3520
|
const handleClose = () => {
|
|
@@ -1455,7 +3524,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1455
3524
|
}
|
|
1456
3525
|
return;
|
|
1457
3526
|
};
|
|
1458
|
-
return /* @__PURE__ */ (0,
|
|
3527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "yr3Drawer--container", style: composeStyles(ui, style), onClick: handleClose, "data-testid": "yr3Drawer-container", children });
|
|
1459
3528
|
};
|
|
1460
3529
|
var DrawerContainer_default = DrawerContainer;
|
|
1461
3530
|
|
|
@@ -1475,7 +3544,7 @@ var useClickAway = (ref, callback) => {
|
|
|
1475
3544
|
};
|
|
1476
3545
|
|
|
1477
3546
|
// src/components/Drawer/Drawer.tsx
|
|
1478
|
-
var
|
|
3547
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1479
3548
|
var initialPropsComponent2 = {
|
|
1480
3549
|
drawer: {},
|
|
1481
3550
|
closing: null,
|
|
@@ -1484,9 +3553,9 @@ var initialPropsComponent2 = {
|
|
|
1484
3553
|
};
|
|
1485
3554
|
var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
1486
3555
|
const { show, hide } = useBackdrop();
|
|
1487
|
-
const ref =
|
|
1488
|
-
const properties =
|
|
1489
|
-
|
|
3556
|
+
const ref = React9.useRef(null);
|
|
3557
|
+
const properties = mergeDeep2(initialPropsComponent2, propsComponent);
|
|
3558
|
+
React9.useEffect(() => {
|
|
1490
3559
|
if (open) {
|
|
1491
3560
|
show("drawer");
|
|
1492
3561
|
} else {
|
|
@@ -1501,7 +3570,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1501
3570
|
}
|
|
1502
3571
|
;
|
|
1503
3572
|
});
|
|
1504
|
-
|
|
3573
|
+
React9.useEffect(() => {
|
|
1505
3574
|
if (properties?.onClose) {
|
|
1506
3575
|
hide("drawer");
|
|
1507
3576
|
onClose();
|
|
@@ -1509,7 +3578,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1509
3578
|
}, [properties?.onClose]);
|
|
1510
3579
|
const classesBem = bem("yr3Drawer");
|
|
1511
3580
|
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1512
|
-
return /* @__PURE__ */ (0,
|
|
3581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1513
3582
|
"div",
|
|
1514
3583
|
{
|
|
1515
3584
|
className: drawerClasses,
|
|
@@ -1517,7 +3586,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1517
3586
|
onClick: (e) => e.stopPropagation(),
|
|
1518
3587
|
ref,
|
|
1519
3588
|
"data-testid": "yr3Drawer",
|
|
1520
|
-
children: /* @__PURE__ */ (0,
|
|
3589
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1521
3590
|
DrawerContainer_default,
|
|
1522
3591
|
{
|
|
1523
3592
|
children,
|
|
@@ -1532,15 +3601,15 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1532
3601
|
};
|
|
1533
3602
|
|
|
1534
3603
|
// src/components/Input/Input.tsx
|
|
1535
|
-
var
|
|
3604
|
+
var React10 = __toESM(require("react"), 1);
|
|
1536
3605
|
|
|
1537
3606
|
// src/components/Label/Label.tsx
|
|
1538
|
-
var
|
|
3607
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1539
3608
|
var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
|
|
1540
3609
|
const classes = bem("yr3Label");
|
|
1541
3610
|
const classComponent = classes(void 0, { color: `color-${color}` });
|
|
1542
3611
|
const classnames = bemMerge(classComponent, className);
|
|
1543
|
-
return /* @__PURE__ */ (0,
|
|
3612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1544
3613
|
"span",
|
|
1545
3614
|
{
|
|
1546
3615
|
className: classnames,
|
|
@@ -1593,7 +3662,7 @@ var inputVariants = createVariants({
|
|
|
1593
3662
|
});
|
|
1594
3663
|
|
|
1595
3664
|
// src/components/Input/Input.tsx
|
|
1596
|
-
var
|
|
3665
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1597
3666
|
var initiaPropsComponent = {
|
|
1598
3667
|
label: {
|
|
1599
3668
|
display: true,
|
|
@@ -1602,7 +3671,7 @@ var initiaPropsComponent = {
|
|
|
1602
3671
|
},
|
|
1603
3672
|
control: {}
|
|
1604
3673
|
};
|
|
1605
|
-
var Input =
|
|
3674
|
+
var Input = React10.forwardRef(
|
|
1606
3675
|
({
|
|
1607
3676
|
label,
|
|
1608
3677
|
value,
|
|
@@ -1611,21 +3680,27 @@ var Input = React9.forwardRef(
|
|
|
1611
3680
|
variant = "outlined",
|
|
1612
3681
|
error = "ce un errore",
|
|
1613
3682
|
separatorCurrency = ",",
|
|
3683
|
+
separatorDecimal = ".",
|
|
1614
3684
|
ui,
|
|
1615
3685
|
style,
|
|
1616
3686
|
propsComponent = initiaPropsComponent,
|
|
1617
|
-
pattern = "text",
|
|
1618
3687
|
color = "primary",
|
|
1619
3688
|
size = "auto",
|
|
1620
3689
|
disabled = false,
|
|
3690
|
+
model,
|
|
3691
|
+
pattern,
|
|
1621
3692
|
...props
|
|
1622
3693
|
}, ref) => {
|
|
1623
|
-
const [focused, setFocused] =
|
|
1624
|
-
const [internalValue, setInternalValue] =
|
|
3694
|
+
const [focused, setFocused] = React10.useState(false);
|
|
3695
|
+
const [internalValue, setInternalValue] = React10.useState(defaultValue);
|
|
1625
3696
|
const isControlled = value !== void 0;
|
|
1626
3697
|
const currentValue = isControlled ? value : internalValue;
|
|
1627
3698
|
const isActive = focused || !!currentValue;
|
|
1628
|
-
const
|
|
3699
|
+
const checkMode = (type, value2) => {
|
|
3700
|
+
if (pattern) {
|
|
3701
|
+
const regex = new RegExp(pattern);
|
|
3702
|
+
return regex.test(value2);
|
|
3703
|
+
}
|
|
1629
3704
|
switch (type) {
|
|
1630
3705
|
case "email":
|
|
1631
3706
|
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
@@ -1636,21 +3711,38 @@ var Input = React9.forwardRef(
|
|
|
1636
3711
|
case "currency":
|
|
1637
3712
|
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1638
3713
|
if (separatorCurrency === ".") return /^\d+(\.\d{0,2})?$/.test(value2);
|
|
3714
|
+
case "decimal":
|
|
3715
|
+
if (separatorDecimal === ",") return /^\d+(\,\d*)?$/.test(value2);
|
|
3716
|
+
if (separatorDecimal === ".") return /^\d+(\.\d*)?$/.test(value2);
|
|
1639
3717
|
default:
|
|
1640
3718
|
return true;
|
|
1641
3719
|
}
|
|
1642
3720
|
};
|
|
3721
|
+
const mode = (m) => {
|
|
3722
|
+
switch (m) {
|
|
3723
|
+
case "email":
|
|
3724
|
+
return "email";
|
|
3725
|
+
case "phone":
|
|
3726
|
+
return "tel";
|
|
3727
|
+
case "number":
|
|
3728
|
+
return "numeric";
|
|
3729
|
+
case "currency":
|
|
3730
|
+
return "numeric";
|
|
3731
|
+
default:
|
|
3732
|
+
return "text";
|
|
3733
|
+
}
|
|
3734
|
+
};
|
|
1643
3735
|
const handleChange = (e) => {
|
|
1644
3736
|
const newValue = e.target.value;
|
|
1645
|
-
if (newValue && !
|
|
3737
|
+
if (newValue && !checkMode(model, newValue)) return;
|
|
1646
3738
|
if (!isControlled) {
|
|
1647
3739
|
setInternalValue(newValue);
|
|
1648
3740
|
}
|
|
1649
3741
|
onChange?.(e, newValue);
|
|
1650
3742
|
};
|
|
1651
3743
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1652
|
-
return /* @__PURE__ */ (0,
|
|
1653
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0,
|
|
3744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, disabled, ...propsComponent.control, children: [
|
|
3745
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1654
3746
|
Label,
|
|
1655
3747
|
{
|
|
1656
3748
|
text: label || "",
|
|
@@ -1659,14 +3751,15 @@ var Input = React9.forwardRef(
|
|
|
1659
3751
|
...propsComponent.label
|
|
1660
3752
|
}
|
|
1661
3753
|
),
|
|
1662
|
-
/* @__PURE__ */ (0,
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1663
3755
|
"input",
|
|
1664
3756
|
{
|
|
1665
3757
|
ref,
|
|
1666
3758
|
value: currentValue,
|
|
1667
|
-
inputMode:
|
|
3759
|
+
inputMode: mode(model),
|
|
1668
3760
|
autoComplete: "off",
|
|
1669
|
-
type:
|
|
3761
|
+
type: props.type,
|
|
3762
|
+
pattern,
|
|
1670
3763
|
disabled,
|
|
1671
3764
|
onChange: handleChange,
|
|
1672
3765
|
onFocus: () => setFocused(true),
|
|
@@ -1682,12 +3775,12 @@ var Input = React9.forwardRef(
|
|
|
1682
3775
|
);
|
|
1683
3776
|
|
|
1684
3777
|
// src/components/Date/MonthSelector.tsx
|
|
1685
|
-
var
|
|
3778
|
+
var React11 = __toESM(require("react"), 1);
|
|
1686
3779
|
|
|
1687
3780
|
// src/Icons/IconSearch.tsx
|
|
1688
|
-
var
|
|
3781
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1689
3782
|
var IconSearch = (props) => {
|
|
1690
|
-
return /* @__PURE__ */ (0,
|
|
3783
|
+
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
3784
|
"path",
|
|
1692
3785
|
{
|
|
1693
3786
|
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 +3793,21 @@ var IconSearch = (props) => {
|
|
|
1700
3793
|
};
|
|
1701
3794
|
|
|
1702
3795
|
// src/Icons/IconDown.tsx
|
|
1703
|
-
var
|
|
3796
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1704
3797
|
var IconDown = (props) => {
|
|
1705
|
-
return /* @__PURE__ */ (0,
|
|
3798
|
+
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
3799
|
};
|
|
1707
3800
|
|
|
1708
3801
|
// src/Icons/IconCalendar.tsx
|
|
1709
|
-
var
|
|
3802
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1710
3803
|
var IconCalendar = (props) => {
|
|
1711
|
-
return /* @__PURE__ */ (0,
|
|
3804
|
+
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
3805
|
};
|
|
1713
3806
|
|
|
1714
3807
|
// src/Icons/IconLeft.tsx
|
|
1715
|
-
var
|
|
3808
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1716
3809
|
var IconLeft = (props) => {
|
|
1717
|
-
return /* @__PURE__ */ (0,
|
|
3810
|
+
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
3811
|
};
|
|
1719
3812
|
|
|
1720
3813
|
// src/components/Date/month.variants.ts
|
|
@@ -1771,9 +3864,9 @@ var monthSelectorContainerVariants = createVariants({
|
|
|
1771
3864
|
});
|
|
1772
3865
|
|
|
1773
3866
|
// src/Icons/IconRight.tsx
|
|
1774
|
-
var
|
|
3867
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1775
3868
|
var IconRight = (props) => {
|
|
1776
|
-
return /* @__PURE__ */ (0,
|
|
3869
|
+
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
3870
|
"path",
|
|
1778
3871
|
{
|
|
1779
3872
|
d: "M9 7L14 12L9 17",
|
|
@@ -1786,12 +3879,14 @@ var IconRight = (props) => {
|
|
|
1786
3879
|
};
|
|
1787
3880
|
|
|
1788
3881
|
// src/components/Date/MonthSelector.tsx
|
|
1789
|
-
var
|
|
3882
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1790
3883
|
var initialPropsComponent3 = {
|
|
1791
3884
|
control: {
|
|
1792
3885
|
variant: "outlined",
|
|
1793
3886
|
color: "primary",
|
|
1794
|
-
ui: {
|
|
3887
|
+
ui: {
|
|
3888
|
+
pointerEvents: "none"
|
|
3889
|
+
},
|
|
1795
3890
|
style: {}
|
|
1796
3891
|
},
|
|
1797
3892
|
label: {
|
|
@@ -1826,18 +3921,18 @@ var initialPropsComponent3 = {
|
|
|
1826
3921
|
style: {}
|
|
1827
3922
|
}
|
|
1828
3923
|
};
|
|
1829
|
-
var MonthSelector = ({ label, value, disabled, propsComponent, data,
|
|
1830
|
-
const [open, setOpen] =
|
|
1831
|
-
const [valueState, setValueState] =
|
|
1832
|
-
const [yearSelected, setYearSelected] =
|
|
1833
|
-
const ref =
|
|
3924
|
+
var MonthSelector = ({ label, value, disabled, propsComponent, data, format, onNext, onLast, onChange }) => {
|
|
3925
|
+
const [open, setOpen] = React11.useState(false);
|
|
3926
|
+
const [valueState, setValueState] = React11.useState(value || null);
|
|
3927
|
+
const [yearSelected, setYearSelected] = React11.useState(data?.years.findIndex((y) => y === data.year) || 0);
|
|
3928
|
+
const ref = React11.useRef(null);
|
|
1834
3929
|
useClickAway(ref, () => setOpen(false));
|
|
1835
|
-
const properties =
|
|
3930
|
+
const properties = mergeDeep2(initialPropsComponent3, propsComponent || {});
|
|
1836
3931
|
const iconClasses = monthSelectorIconVariants({ color: properties?.icon?.color });
|
|
1837
3932
|
const containerClasses = monthSelectorContainerVariants({ color: properties?.container?.color });
|
|
1838
|
-
const getData =
|
|
1839
|
-
return getMonthCalendarProps({ year: data.years[yearSelected], data,
|
|
1840
|
-
}, [yearSelected, data,
|
|
3933
|
+
const getData = React11.useMemo(() => {
|
|
3934
|
+
return getMonthCalendarProps({ year: data.years[yearSelected], data, format, value: valueState });
|
|
3935
|
+
}, [yearSelected, data, format, valueState]);
|
|
1841
3936
|
const handleYearChange = (newIndex) => {
|
|
1842
3937
|
setYearSelected(newIndex);
|
|
1843
3938
|
};
|
|
@@ -1848,20 +3943,19 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1848
3943
|
const nextData = getMonthCalendarProps({
|
|
1849
3944
|
year: data.years[yearSelected],
|
|
1850
3945
|
data,
|
|
1851
|
-
|
|
3946
|
+
format,
|
|
1852
3947
|
value: newValue
|
|
1853
3948
|
});
|
|
1854
3949
|
onNext?.(nextData.prev);
|
|
1855
3950
|
onLast?.(nextData.last);
|
|
1856
3951
|
};
|
|
1857
3952
|
const classes = monthSelectorVariants({ wrapper: true, disabled });
|
|
1858
|
-
return /* @__PURE__ */ (0,
|
|
1859
|
-
/* @__PURE__ */ (0,
|
|
3953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: classes, ref, children: [
|
|
3954
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1860
3955
|
Input,
|
|
1861
3956
|
{
|
|
1862
3957
|
label,
|
|
1863
3958
|
variant: "base",
|
|
1864
|
-
disabled: true,
|
|
1865
3959
|
value: valueState || "",
|
|
1866
3960
|
propsComponent: {
|
|
1867
3961
|
control: properties?.control,
|
|
@@ -1869,14 +3963,14 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1869
3963
|
}
|
|
1870
3964
|
}
|
|
1871
3965
|
),
|
|
1872
|
-
/* @__PURE__ */ (0,
|
|
3966
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1873
3967
|
"div",
|
|
1874
3968
|
{
|
|
1875
3969
|
className: iconClasses,
|
|
1876
3970
|
style: properties?.icon?.style,
|
|
1877
3971
|
onClick: () => !disabled && setOpen(true),
|
|
1878
3972
|
"data-testid": "yr3MonthSelector--icon",
|
|
1879
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0,
|
|
3973
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1880
3974
|
IconCalendar,
|
|
1881
3975
|
{
|
|
1882
3976
|
width: properties?.icon?.svg?.width,
|
|
@@ -1887,47 +3981,47 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1887
3981
|
)
|
|
1888
3982
|
}
|
|
1889
3983
|
),
|
|
1890
|
-
open && /* @__PURE__ */ (0,
|
|
3984
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1891
3985
|
"div",
|
|
1892
3986
|
{
|
|
1893
3987
|
className: "yr3MonthSelector--wrapper",
|
|
1894
3988
|
style: composeStyles(properties?.wrapper?.ui, properties?.wrapper?.style),
|
|
1895
3989
|
"data-testid": "yr3MonthSelector--wrapper",
|
|
1896
|
-
children: /* @__PURE__ */ (0,
|
|
1897
|
-
/* @__PURE__ */ (0,
|
|
3990
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "yr3MonthSelector--component", children: [
|
|
3991
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1898
3992
|
"div",
|
|
1899
3993
|
{
|
|
1900
3994
|
className: containerClasses,
|
|
1901
3995
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1902
3996
|
children: [
|
|
1903
|
-
/* @__PURE__ */ (0,
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1904
3998
|
"button",
|
|
1905
3999
|
{
|
|
1906
4000
|
disabled: disabled || yearSelected === 0,
|
|
1907
4001
|
type: "button",
|
|
1908
4002
|
className: `yr3MonthSelector--year-button-back ${yearSelected === 0 ? "yr3MonthSelector--year-button-back--disabled" : ""} `,
|
|
1909
4003
|
onClick: () => handleYearChange(yearSelected - 1),
|
|
1910
|
-
children: /* @__PURE__ */ (0,
|
|
4004
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconLeft, { width: 20, height: 20, stroke: "currentColor" })
|
|
1911
4005
|
}
|
|
1912
4006
|
),
|
|
1913
|
-
/* @__PURE__ */ (0,
|
|
4007
|
+
/* @__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
4008
|
data.years[yearSelected],
|
|
1915
4009
|
" "
|
|
1916
4010
|
] }) }),
|
|
1917
|
-
/* @__PURE__ */ (0,
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1918
4012
|
"button",
|
|
1919
4013
|
{
|
|
1920
4014
|
disabled: disabled || yearSelected === data.years.length - 1,
|
|
1921
4015
|
type: "button",
|
|
1922
4016
|
className: `yr3MonthSelector--year-button-next ${yearSelected === data.years.length - 1 ? "yr3MonthSelector--year-button-next--disabled" : ""}`,
|
|
1923
4017
|
onClick: () => handleYearChange(yearSelected + 1),
|
|
1924
|
-
children: /* @__PURE__ */ (0,
|
|
4018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconRight, { width: 20, height: 30, stroke: "currentColor" })
|
|
1925
4019
|
}
|
|
1926
4020
|
)
|
|
1927
4021
|
]
|
|
1928
4022
|
}
|
|
1929
4023
|
),
|
|
1930
|
-
/* @__PURE__ */ (0,
|
|
4024
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "yr3MonthSelector--months", children: getData.months.map((m) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1931
4025
|
"button",
|
|
1932
4026
|
{
|
|
1933
4027
|
type: "button",
|
|
@@ -1936,8 +4030,9 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1936
4030
|
className: `yr3MonthSelector--month ${m.disabled ? "yr3MonthSelector--month--disabled" : ""} ${m.selected ? "yr3MonthSelector--month--selected" : ""}`,
|
|
1937
4031
|
onClick: () => {
|
|
1938
4032
|
handleMonthChange(m.value);
|
|
4033
|
+
setOpen(false);
|
|
1939
4034
|
},
|
|
1940
|
-
children: /* @__PURE__ */ (0,
|
|
4035
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { ...properties?.text, weight: m.disabled ? "thin" : "medium", children: m.label })
|
|
1941
4036
|
},
|
|
1942
4037
|
"month-" + m.value
|
|
1943
4038
|
)) })
|
|
@@ -1948,8 +4043,8 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1948
4043
|
};
|
|
1949
4044
|
|
|
1950
4045
|
// src/components/Fade/Fade.tsx
|
|
1951
|
-
var
|
|
1952
|
-
var
|
|
4046
|
+
var React12 = __toESM(require("react"), 1);
|
|
4047
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1953
4048
|
var Fade = ({
|
|
1954
4049
|
in: inProp,
|
|
1955
4050
|
children,
|
|
@@ -1957,7 +4052,7 @@ var Fade = ({
|
|
|
1957
4052
|
onTransitionEnd,
|
|
1958
4053
|
style
|
|
1959
4054
|
}) => {
|
|
1960
|
-
|
|
4055
|
+
React12.useEffect(() => {
|
|
1961
4056
|
let timeoutId;
|
|
1962
4057
|
if (inProp) {
|
|
1963
4058
|
timeoutId = setTimeout(() => {
|
|
@@ -1966,7 +4061,7 @@ var Fade = ({
|
|
|
1966
4061
|
}
|
|
1967
4062
|
return () => clearTimeout(timeoutId);
|
|
1968
4063
|
}, [inProp, duration, onTransitionEnd]);
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
4064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1970
4065
|
"div",
|
|
1971
4066
|
{
|
|
1972
4067
|
className: `yr3Fade ${inProp ? "yr3Fade--in" : ""}`,
|
|
@@ -1977,61 +4072,8 @@ var Fade = ({
|
|
|
1977
4072
|
);
|
|
1978
4073
|
};
|
|
1979
4074
|
|
|
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
4075
|
// src/components/Grid/Grid.tsx
|
|
2034
|
-
var
|
|
4076
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2035
4077
|
var Grid = ({
|
|
2036
4078
|
container = false,
|
|
2037
4079
|
spacing: spacing2 = 0,
|
|
@@ -2064,7 +4106,7 @@ var Grid = ({
|
|
|
2064
4106
|
}
|
|
2065
4107
|
const classes = bem("yr3Grid");
|
|
2066
4108
|
const className = classes(void 0, { container, [`spacing-${spacing2}`]: center, span: item && `Col-${size}` });
|
|
2067
|
-
return /* @__PURE__ */ (0,
|
|
4109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2068
4110
|
"div",
|
|
2069
4111
|
{
|
|
2070
4112
|
className,
|
|
@@ -2077,7 +4119,7 @@ var Grid = ({
|
|
|
2077
4119
|
};
|
|
2078
4120
|
|
|
2079
4121
|
// src/components/Group/Group.tsx
|
|
2080
|
-
var
|
|
4122
|
+
var React13 = __toESM(require("react"), 1);
|
|
2081
4123
|
|
|
2082
4124
|
// src/components/Group/group.variants.ts
|
|
2083
4125
|
var groupVariants = createVariants({
|
|
@@ -2108,8 +4150,8 @@ var groupVariants = createVariants({
|
|
|
2108
4150
|
});
|
|
2109
4151
|
|
|
2110
4152
|
// src/components/Group/Group.tsx
|
|
2111
|
-
var
|
|
2112
|
-
var
|
|
4153
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4154
|
+
var initialComponents2 = (color) => ({
|
|
2113
4155
|
group: {
|
|
2114
4156
|
ui: {},
|
|
2115
4157
|
style: {}
|
|
@@ -2137,13 +4179,13 @@ var Group = ({
|
|
|
2137
4179
|
exclude = false,
|
|
2138
4180
|
propsComponent
|
|
2139
4181
|
}) => {
|
|
2140
|
-
const properties =
|
|
2141
|
-
|
|
4182
|
+
const properties = mergeDeep2(
|
|
4183
|
+
initialComponents2(type === "rounded" ? "text" : color),
|
|
2142
4184
|
propsComponent || {}
|
|
2143
4185
|
);
|
|
2144
|
-
const [internalValue, setInternalValue] =
|
|
4186
|
+
const [internalValue, setInternalValue] = React13.useState(null);
|
|
2145
4187
|
const isControlled = value !== void 0;
|
|
2146
|
-
|
|
4188
|
+
React13.useEffect(() => {
|
|
2147
4189
|
if (isControlled) {
|
|
2148
4190
|
setInternalValue(value);
|
|
2149
4191
|
}
|
|
@@ -2154,7 +4196,7 @@ var Group = ({
|
|
|
2154
4196
|
active: !exclude ? Array.isArray(value) ? value.includes(item?.value) : internalValue === item.value : false,
|
|
2155
4197
|
exclude: exclude && Array.isArray(value) ? !value.includes(item?.value) : ""
|
|
2156
4198
|
});
|
|
2157
|
-
const mappingStyle =
|
|
4199
|
+
const mappingStyle = React13.useMemo(() => {
|
|
2158
4200
|
if (variant !== "filled") return options.map((opt, index) => ({
|
|
2159
4201
|
...opt,
|
|
2160
4202
|
index,
|
|
@@ -2185,13 +4227,13 @@ var Group = ({
|
|
|
2185
4227
|
}
|
|
2186
4228
|
}));
|
|
2187
4229
|
}, [exclude, value, options, type]);
|
|
2188
|
-
return /* @__PURE__ */ (0,
|
|
4230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2189
4231
|
"div",
|
|
2190
4232
|
{
|
|
2191
4233
|
className: groupVariants({ variant, color, type }),
|
|
2192
4234
|
"data-testid": "yr3Group",
|
|
2193
4235
|
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
2194
|
-
children: options.map((opt, index) => /* @__PURE__ */ (0,
|
|
4236
|
+
children: options.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2195
4237
|
"div",
|
|
2196
4238
|
{
|
|
2197
4239
|
"data-testid": "yr3Group-item",
|
|
@@ -2209,7 +4251,7 @@ var Group = ({
|
|
|
2209
4251
|
...mappingStyle?.find((o) => o.value === opt.value)?.style
|
|
2210
4252
|
}
|
|
2211
4253
|
),
|
|
2212
|
-
children: /* @__PURE__ */ (0,
|
|
4254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2213
4255
|
Text,
|
|
2214
4256
|
{
|
|
2215
4257
|
...properties.item?.text,
|
|
@@ -2225,14 +4267,14 @@ var Group = ({
|
|
|
2225
4267
|
};
|
|
2226
4268
|
|
|
2227
4269
|
// src/components/Image/Image.tsx
|
|
2228
|
-
var
|
|
4270
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2229
4271
|
var Image = ({
|
|
2230
4272
|
src,
|
|
2231
4273
|
alt = "",
|
|
2232
4274
|
ui,
|
|
2233
4275
|
style
|
|
2234
4276
|
}) => {
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
4277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2236
4278
|
"img",
|
|
2237
4279
|
{
|
|
2238
4280
|
src,
|
|
@@ -2245,8 +4287,8 @@ var Image = ({
|
|
|
2245
4287
|
};
|
|
2246
4288
|
|
|
2247
4289
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
2248
|
-
var
|
|
2249
|
-
var
|
|
4290
|
+
var React14 = __toESM(require("react"), 1);
|
|
4291
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2250
4292
|
var initialPropsComponent4 = {
|
|
2251
4293
|
box: {},
|
|
2252
4294
|
text: {},
|
|
@@ -2255,10 +4297,10 @@ var initialPropsComponent4 = {
|
|
|
2255
4297
|
content: {}
|
|
2256
4298
|
};
|
|
2257
4299
|
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
2258
|
-
const properties =
|
|
2259
|
-
const [dragging, setDragging] =
|
|
2260
|
-
const [files, setFiles] =
|
|
2261
|
-
const inputRef =
|
|
4300
|
+
const properties = mergeDeep2(initialPropsComponent4, propsComponent || {});
|
|
4301
|
+
const [dragging, setDragging] = React14.useState(false);
|
|
4302
|
+
const [files, setFiles] = React14.useState([]);
|
|
4303
|
+
const inputRef = React14.useRef(null);
|
|
2262
4304
|
const handleFiles = (fileList) => {
|
|
2263
4305
|
if (!fileList) return;
|
|
2264
4306
|
const newFiles = Array.from(fileList);
|
|
@@ -2270,7 +4312,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2270
4312
|
};
|
|
2271
4313
|
const classes = bem("yr3Dropzone");
|
|
2272
4314
|
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
2273
|
-
return /* @__PURE__ */ (0,
|
|
4315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { as: "div", position: "relative", content: "center", ...properties?.box, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2274
4316
|
"div",
|
|
2275
4317
|
{
|
|
2276
4318
|
className: classComponent,
|
|
@@ -2287,7 +4329,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2287
4329
|
onClick: () => inputRef.current?.click(),
|
|
2288
4330
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
2289
4331
|
children: [
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
4332
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2291
4333
|
"input",
|
|
2292
4334
|
{
|
|
2293
4335
|
ref: inputRef,
|
|
@@ -2298,10 +4340,10 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2298
4340
|
onChange: (e) => handleFiles(e.target.files)
|
|
2299
4341
|
}
|
|
2300
4342
|
),
|
|
2301
|
-
isEmpty(files) && /* @__PURE__ */ (0,
|
|
2302
|
-
multiple && /* @__PURE__ */ (0,
|
|
2303
|
-
!multiple && /* @__PURE__ */ (0,
|
|
2304
|
-
!!defaultImage && /* @__PURE__ */ (0,
|
|
4343
|
+
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" }) }),
|
|
4344
|
+
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)) }),
|
|
4345
|
+
!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)) }),
|
|
4346
|
+
!!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
4347
|
component
|
|
2306
4348
|
]
|
|
2307
4349
|
}
|
|
@@ -2309,7 +4351,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2309
4351
|
};
|
|
2310
4352
|
|
|
2311
4353
|
// src/components/InputArea/InputArea.tsx
|
|
2312
|
-
var
|
|
4354
|
+
var React15 = __toESM(require("react"), 1);
|
|
2313
4355
|
|
|
2314
4356
|
// src/components/InputArea/inputAreaVariants.ts
|
|
2315
4357
|
var inputAreaVariants = createVariants({
|
|
@@ -2350,7 +4392,7 @@ var inputAreaVariants = createVariants({
|
|
|
2350
4392
|
});
|
|
2351
4393
|
|
|
2352
4394
|
// src/components/InputArea/InputArea.tsx
|
|
2353
|
-
var
|
|
4395
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2354
4396
|
var initiaPropsComponent2 = {
|
|
2355
4397
|
label: {
|
|
2356
4398
|
display: true,
|
|
@@ -2375,8 +4417,8 @@ var InputArea = ({
|
|
|
2375
4417
|
rounded = false,
|
|
2376
4418
|
propsComponent = initiaPropsComponent2
|
|
2377
4419
|
}) => {
|
|
2378
|
-
const ref =
|
|
2379
|
-
const [internalValue, setInternalValue] =
|
|
4420
|
+
const ref = React15.useRef(null);
|
|
4421
|
+
const [internalValue, setInternalValue] = React15.useState(defaultValue);
|
|
2380
4422
|
const isControlled = value !== void 0;
|
|
2381
4423
|
const currentValue = isControlled ? value : internalValue;
|
|
2382
4424
|
const handleChange = (e) => {
|
|
@@ -2393,8 +4435,8 @@ var InputArea = ({
|
|
|
2393
4435
|
el.style.resize = resize;
|
|
2394
4436
|
}
|
|
2395
4437
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
2396
|
-
return /* @__PURE__ */ (0,
|
|
2397
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0,
|
|
4438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { style: { position: "relative" }, children: [
|
|
4439
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2398
4440
|
Label,
|
|
2399
4441
|
{
|
|
2400
4442
|
text: label || "",
|
|
@@ -2402,7 +4444,7 @@ var InputArea = ({
|
|
|
2402
4444
|
...propsComponent.label
|
|
2403
4445
|
}
|
|
2404
4446
|
),
|
|
2405
|
-
/* @__PURE__ */ (0,
|
|
4447
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2406
4448
|
"textarea",
|
|
2407
4449
|
{
|
|
2408
4450
|
className: classes,
|
|
@@ -2414,76 +4456,10 @@ var InputArea = ({
|
|
|
2414
4456
|
"data-testid": "yr3InputArea"
|
|
2415
4457
|
}
|
|
2416
4458
|
),
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
4459
|
+
/* @__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
4460
|
] });
|
|
2419
4461
|
};
|
|
2420
4462
|
|
|
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
4463
|
// src/components/Modal/Modal.tsx
|
|
2488
4464
|
var React16 = __toESM(require("react"), 1);
|
|
2489
4465
|
|
|
@@ -2709,7 +4685,7 @@ var Picker = ({ label, variant, color, children, name, value, onChange, propsCom
|
|
|
2709
4685
|
const [valueState, setValueState] = React17.useState(value || null);
|
|
2710
4686
|
const ref = React17.useRef(null);
|
|
2711
4687
|
useClickAway(ref, () => setOpen(false));
|
|
2712
|
-
const properties =
|
|
4688
|
+
const properties = mergeDeep2(initiaPropsComponent3, propsComponent || {});
|
|
2713
4689
|
const classesIcon = PickerIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2714
4690
|
const classes = PickerVariants({ wrapper: true, variant, color });
|
|
2715
4691
|
React17.useEffect(() => {
|
|
@@ -2950,7 +4926,7 @@ var PlacesAutocomplete = ({
|
|
|
2950
4926
|
keyApi,
|
|
2951
4927
|
propsComponent = initPropsComponent
|
|
2952
4928
|
}) => {
|
|
2953
|
-
const [value,
|
|
4929
|
+
const [value, setValue2] = React20.useState(null);
|
|
2954
4930
|
const inputRef = React20.useRef(null);
|
|
2955
4931
|
const [anchorEl, setAnchorEl] = React20.useState(null);
|
|
2956
4932
|
const { suggestions, selectPlace } = (0, import_autocomplete_places.useAutocompletePlaces)({ input: value, apiKey: keyApi, language, provider });
|
|
@@ -2969,12 +4945,12 @@ var PlacesAutocomplete = ({
|
|
|
2969
4945
|
placeId: id
|
|
2970
4946
|
};
|
|
2971
4947
|
onSelect(locationData);
|
|
2972
|
-
|
|
4948
|
+
setValue2(place.address);
|
|
2973
4949
|
setAnchorEl(null);
|
|
2974
4950
|
};
|
|
2975
4951
|
React20.useEffect(() => {
|
|
2976
4952
|
if (defaultLocation) {
|
|
2977
|
-
|
|
4953
|
+
setValue2(defaultLocation);
|
|
2978
4954
|
}
|
|
2979
4955
|
}, [defaultLocation]);
|
|
2980
4956
|
React20.useEffect(() => {
|
|
@@ -2983,7 +4959,7 @@ var PlacesAutocomplete = ({
|
|
|
2983
4959
|
}
|
|
2984
4960
|
}, [value]);
|
|
2985
4961
|
const handleChange = (e) => {
|
|
2986
|
-
|
|
4962
|
+
setValue2(e.target.value);
|
|
2987
4963
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2988
4964
|
};
|
|
2989
4965
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
@@ -3180,12 +5156,12 @@ var initiaPropsComponent4 = {
|
|
|
3180
5156
|
component: void 0
|
|
3181
5157
|
}
|
|
3182
5158
|
};
|
|
3183
|
-
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled }) => {
|
|
5159
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled = false }) => {
|
|
3184
5160
|
const [open, setOpen] = React21.useState(false);
|
|
3185
5161
|
const [valueState, setValueState] = React21.useState(value || defaultValue || null);
|
|
3186
5162
|
const ref = React21.useRef(null);
|
|
3187
5163
|
useClickAway(ref, () => setOpen(false));
|
|
3188
|
-
const properties =
|
|
5164
|
+
const properties = mergeDeep2(initiaPropsComponent4, propsComponent || {});
|
|
3189
5165
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
3190
5166
|
const classes = selectVariants({ wrapper: true, disabled });
|
|
3191
5167
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: classes, ref, children: [
|
|
@@ -3194,10 +5170,15 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
3194
5170
|
{
|
|
3195
5171
|
label,
|
|
3196
5172
|
variant: "base",
|
|
3197
|
-
disabled: true,
|
|
3198
5173
|
value: options.find((opt) => opt.value === valueState)?.label || "",
|
|
3199
5174
|
propsComponent: {
|
|
3200
|
-
control:
|
|
5175
|
+
control: {
|
|
5176
|
+
...properties?.control,
|
|
5177
|
+
ui: {
|
|
5178
|
+
...properties?.control?.ui,
|
|
5179
|
+
pointerEvents: "none"
|
|
5180
|
+
}
|
|
5181
|
+
},
|
|
3201
5182
|
label: properties?.label
|
|
3202
5183
|
}
|
|
3203
5184
|
}
|
|
@@ -3302,7 +5283,7 @@ var Slide = ({
|
|
|
3302
5283
|
onTransitionEnd,
|
|
3303
5284
|
propsComponent
|
|
3304
5285
|
}) => {
|
|
3305
|
-
const properties =
|
|
5286
|
+
const properties = mergeDeep2(initialPropsComponent5, propsComponent || {});
|
|
3306
5287
|
const stateRef = React22.useRef(inProp ? "in" : "out");
|
|
3307
5288
|
React22.useEffect(() => {
|
|
3308
5289
|
stateRef.current = inProp ? "in" : "out";
|
|
@@ -3505,17 +5486,17 @@ function useMediaQuery(query) {
|
|
|
3505
5486
|
}, [computedQuery]);
|
|
3506
5487
|
return matches;
|
|
3507
5488
|
}
|
|
3508
|
-
function useBreakpointValue(
|
|
5489
|
+
function useBreakpointValue(values2) {
|
|
3509
5490
|
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
3510
5491
|
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
3511
5492
|
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
3512
5493
|
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
3513
5494
|
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
3514
|
-
if (xl &&
|
|
3515
|
-
if (lg &&
|
|
3516
|
-
if (md &&
|
|
3517
|
-
if (sm &&
|
|
3518
|
-
if (xs &&
|
|
5495
|
+
if (xl && values2.xl !== void 0) return values2.xl;
|
|
5496
|
+
if (lg && values2.lg !== void 0) return values2.lg;
|
|
5497
|
+
if (md && values2.md !== void 0) return values2.md;
|
|
5498
|
+
if (sm && values2.sm !== void 0) return values2.sm;
|
|
5499
|
+
if (xs && values2.xs !== void 0) return values2.xs;
|
|
3519
5500
|
return void 0;
|
|
3520
5501
|
}
|
|
3521
5502
|
|
|
@@ -3631,6 +5612,8 @@ initTheme();
|
|
|
3631
5612
|
createVariants,
|
|
3632
5613
|
cx,
|
|
3633
5614
|
darken,
|
|
5615
|
+
date,
|
|
5616
|
+
dtx,
|
|
3634
5617
|
getContrast,
|
|
3635
5618
|
getCountryCodePhone,
|
|
3636
5619
|
getDialPhone,
|
|
@@ -3640,13 +5623,12 @@ initTheme();
|
|
|
3640
5623
|
hexToRgb,
|
|
3641
5624
|
initTheme,
|
|
3642
5625
|
inputCurrency,
|
|
3643
|
-
isEmpty,
|
|
3644
5626
|
lighten,
|
|
3645
5627
|
mergeDeep,
|
|
5628
|
+
mergeInitialProps,
|
|
3646
5629
|
normalizePhone,
|
|
3647
5630
|
rgbToHex,
|
|
3648
5631
|
text,
|
|
3649
|
-
times,
|
|
3650
5632
|
uiStyle,
|
|
3651
5633
|
useBackdrop,
|
|
3652
5634
|
useBreakpoint,
|
|
@@ -3656,5 +5638,6 @@ initTheme();
|
|
|
3656
5638
|
useMediaQuery,
|
|
3657
5639
|
useNotistack,
|
|
3658
5640
|
usePlaces,
|
|
3659
|
-
useTheme
|
|
5641
|
+
useTheme,
|
|
5642
|
+
utils
|
|
3660
5643
|
});
|