@yr3/ui 1.0.23 → 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 +7 -0
- package/dist/components/Control/control.css.map +1 -1
- package/dist/components/Date/month.css +25 -10
- package/dist/components/Date/month.css.map +1 -1
- package/dist/components/Input/input.css +5 -0
- package/dist/components/Input/input.css.map +1 -1
- package/dist/components/Loader/loader.css +5 -0
- package/dist/components/Loader/loader.css.map +1 -1
- package/dist/components/Select/select.css +6 -1
- package/dist/components/Select/select.css.map +1 -1
- package/dist/components/Slide/slide.css +34 -29
- package/dist/components/Slide/slide.css.map +1 -1
- package/dist/index.cjs +2479 -453
- package/dist/index.d.cts +780 -89
- package/dist/index.d.ts +780 -89
- package/dist/index.js +2490 -460
- package/dist/styles/index.css +84 -42
- 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,
|
|
@@ -841,6 +2738,127 @@ var Box = ({
|
|
|
841
2738
|
);
|
|
842
2739
|
};
|
|
843
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
|
+
] }) }) }) });
|
|
2859
|
+
};
|
|
2860
|
+
var Loader_default = Loader;
|
|
2861
|
+
|
|
844
2862
|
// src/components/Text/text.variants.ts
|
|
845
2863
|
var textVariants = createVariants({
|
|
846
2864
|
base: "yr3Text",
|
|
@@ -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
|
|
956
|
-
var Button = ({ children, color = "text", variant = "text", animated, disabled, gradientBorder = false, size = "auto", ui, style, propsComponent, ...props }) => {
|
|
2976
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
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,
|
|
@@ -963,15 +2984,17 @@ var Button = ({ children, color = "text", variant = "text", animated, disabled,
|
|
|
963
2984
|
"data-testid": "yr3Button",
|
|
964
2985
|
...props,
|
|
965
2986
|
style: composeStyles(ui, style),
|
|
966
|
-
children:
|
|
2987
|
+
children: [
|
|
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 })
|
|
2991
|
+
]
|
|
967
2992
|
}
|
|
968
2993
|
);
|
|
969
2994
|
};
|
|
970
2995
|
|
|
971
2996
|
// src/components/Calendar/Calendar.tsx
|
|
972
|
-
var
|
|
973
|
-
var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
974
|
-
var import_weekday = __toESM(require("dayjs/plugin/weekday"), 1);
|
|
2997
|
+
var React4 = __toESM(require("react"), 1);
|
|
975
2998
|
|
|
976
2999
|
// src/components/Calendar/calendar.variants.ts
|
|
977
3000
|
var calendarVariants = createVariants({
|
|
@@ -1020,14 +3043,22 @@ var calendarDayVariants = createVariants({
|
|
|
1020
3043
|
});
|
|
1021
3044
|
|
|
1022
3045
|
// src/components/Calendar/Calendar.tsx
|
|
1023
|
-
var
|
|
1024
|
-
import_dayjs2.default.extend(import_weekday.default);
|
|
3046
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1025
3047
|
var initalPropsComponent = {
|
|
1026
3048
|
displayButtons: true,
|
|
1027
3049
|
displayCalendar: true,
|
|
3050
|
+
container: {
|
|
3051
|
+
ui: {
|
|
3052
|
+
width: "100%",
|
|
3053
|
+
maxWidth: 400
|
|
3054
|
+
},
|
|
3055
|
+
style: {}
|
|
3056
|
+
},
|
|
1028
3057
|
header: {
|
|
1029
3058
|
color: "primary",
|
|
1030
|
-
ui: {
|
|
3059
|
+
ui: {
|
|
3060
|
+
px: 0.5
|
|
3061
|
+
},
|
|
1031
3062
|
style: {}
|
|
1032
3063
|
},
|
|
1033
3064
|
month: {
|
|
@@ -1037,6 +3068,7 @@ var initalPropsComponent = {
|
|
|
1037
3068
|
},
|
|
1038
3069
|
day: {
|
|
1039
3070
|
color: "primary",
|
|
3071
|
+
selected: "secondary",
|
|
1040
3072
|
bordered: true,
|
|
1041
3073
|
ui: {},
|
|
1042
3074
|
style: {},
|
|
@@ -1044,49 +3076,89 @@ var initalPropsComponent = {
|
|
|
1044
3076
|
},
|
|
1045
3077
|
buttonNext: {
|
|
1046
3078
|
disabled: false,
|
|
1047
|
-
label: "next"
|
|
3079
|
+
label: "next",
|
|
3080
|
+
color: "primary",
|
|
3081
|
+
ui: {
|
|
3082
|
+
justifyContent: "flex-end",
|
|
3083
|
+
p: 0
|
|
3084
|
+
}
|
|
1048
3085
|
},
|
|
1049
3086
|
buttonBack: {
|
|
1050
3087
|
disabled: false,
|
|
1051
|
-
label: "back"
|
|
3088
|
+
label: "back",
|
|
3089
|
+
color: "primary",
|
|
3090
|
+
ui: {
|
|
3091
|
+
justifyContent: "flex-start",
|
|
3092
|
+
p: 0
|
|
3093
|
+
}
|
|
1052
3094
|
}
|
|
1053
3095
|
};
|
|
1054
|
-
var Calendar = ({ onSelect, propsComponent
|
|
1055
|
-
const
|
|
1056
|
-
const
|
|
1057
|
-
const
|
|
1058
|
-
const
|
|
1059
|
-
|
|
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);
|
|
1060
3104
|
}, [selected, currentMonth, mapCalendar]);
|
|
1061
|
-
|
|
3105
|
+
React4.useEffect(() => {
|
|
1062
3106
|
if (selected) {
|
|
1063
3107
|
onSelect && onSelect(selected);
|
|
1064
3108
|
} else {
|
|
1065
|
-
onSelect && onSelect(program
|
|
3109
|
+
onSelect && onSelect(program?.currentDay);
|
|
1066
3110
|
}
|
|
1067
3111
|
}, [selected, program, onSelect]);
|
|
1068
|
-
|
|
3112
|
+
React4.useEffect(() => {
|
|
1069
3113
|
if (currentMonth) {
|
|
1070
3114
|
onMonthChange && onMonthChange(currentMonth);
|
|
1071
3115
|
}
|
|
1072
3116
|
}, [currentMonth]);
|
|
1073
|
-
return /* @__PURE__ */ (0,
|
|
1074
|
-
propsComponent?.displayButtons && /* @__PURE__ */ (0,
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1076
|
-
|
|
1077
|
-
|
|
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
|
+
)
|
|
1078
3150
|
] }),
|
|
1079
|
-
|
|
1080
|
-
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)(
|
|
1081
3153
|
Text,
|
|
1082
3154
|
{
|
|
1083
3155
|
variant: "caption",
|
|
1084
|
-
color:
|
|
1085
|
-
ui: { ...
|
|
1086
|
-
children:
|
|
3156
|
+
color: properties?.month?.color || "primary",
|
|
3157
|
+
ui: { ...properties?.month?.ui, opacity: 0.7, textTransform: "uppercase" },
|
|
3158
|
+
children: i.label
|
|
1087
3159
|
}
|
|
1088
|
-
) }, `month_day_${i}`)),
|
|
1089
|
-
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)(
|
|
1090
3162
|
"div",
|
|
1091
3163
|
{
|
|
1092
3164
|
className: calendarDayVariants({
|
|
@@ -1095,11 +3167,11 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1095
3167
|
isPast: program.calendar[i][j]?.isPast,
|
|
1096
3168
|
isFuture: program.calendar[i][j]?.isFuture,
|
|
1097
3169
|
isCurrentMonth: program.calendar[i][j]?.isCurrentMonth,
|
|
1098
|
-
ui:
|
|
1099
|
-
bordered: !!program.calendar[i][j] &&
|
|
1100
|
-
color:
|
|
3170
|
+
ui: properties?.day?.ui,
|
|
3171
|
+
bordered: !!program.calendar[i][j] && properties?.day?.bordered,
|
|
3172
|
+
color: properties?.day?.color || "primary"
|
|
1101
3173
|
}),
|
|
1102
|
-
style: composeStyles(
|
|
3174
|
+
style: composeStyles(properties?.day?.ui, properties?.day?.style),
|
|
1103
3175
|
"data-testid": "yr3CalendarDay",
|
|
1104
3176
|
onClick: () => {
|
|
1105
3177
|
if (selected === program.calendar[i][j]) {
|
|
@@ -1109,13 +3181,13 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1109
3181
|
}
|
|
1110
3182
|
},
|
|
1111
3183
|
children: [
|
|
1112
|
-
program
|
|
1113
|
-
/* @__PURE__ */ (0,
|
|
3184
|
+
program?.calendar[i][j]?.data && properties?.day?.component ? properties?.day?.component : null,
|
|
3185
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1114
3186
|
Text,
|
|
1115
3187
|
{
|
|
1116
3188
|
variant: "body2",
|
|
1117
|
-
color: program
|
|
1118
|
-
children: program
|
|
3189
|
+
color: program?.calendar[i][j]?.selected ? properties?.day?.selected : "primary",
|
|
3190
|
+
children: program?.calendar[i][j]?.day || ""
|
|
1119
3191
|
}
|
|
1120
3192
|
)
|
|
1121
3193
|
]
|
|
@@ -1127,8 +3199,8 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1127
3199
|
};
|
|
1128
3200
|
|
|
1129
3201
|
// src/components/Checkbox/Checkbox.tsx
|
|
1130
|
-
var
|
|
1131
|
-
var
|
|
3202
|
+
var React5 = __toESM(require("react"), 1);
|
|
3203
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1132
3204
|
var initialPropsComponent = {
|
|
1133
3205
|
checkbox: {
|
|
1134
3206
|
ui: {
|
|
@@ -1153,20 +3225,20 @@ var Checkbox = ({
|
|
|
1153
3225
|
type = "default",
|
|
1154
3226
|
variant = "text"
|
|
1155
3227
|
}) => {
|
|
1156
|
-
const [internal, setInternal] =
|
|
3228
|
+
const [internal, setInternal] = React5.useState(defaultChecked || false);
|
|
1157
3229
|
const isControlled = checked !== void 0;
|
|
1158
3230
|
const value = isControlled ? checked : internal;
|
|
1159
3231
|
const handleChange = (e) => {
|
|
1160
3232
|
if (!isControlled) setInternal(e.target.checked);
|
|
1161
3233
|
onChange?.(e, e.target.checked);
|
|
1162
3234
|
};
|
|
1163
|
-
const properties =
|
|
3235
|
+
const properties = mergeDeep2(initialPropsComponent, propsComponent || {});
|
|
1164
3236
|
const bemClasse = bem("yr3Checkbox");
|
|
1165
3237
|
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}`, type: `type-${type}` });
|
|
1166
3238
|
const boxClasses = bem("yr3Checkbox-box");
|
|
1167
3239
|
const classesBox = boxClasses(void 0, { checked: !!value });
|
|
1168
|
-
return /* @__PURE__ */ (0,
|
|
1169
|
-
/* @__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)(
|
|
1170
3242
|
"input",
|
|
1171
3243
|
{
|
|
1172
3244
|
type: "checkbox",
|
|
@@ -1176,8 +3248,8 @@ var Checkbox = ({
|
|
|
1176
3248
|
"data-testid": "yr3Checkbox-input"
|
|
1177
3249
|
}
|
|
1178
3250
|
),
|
|
1179
|
-
/* @__PURE__ */ (0,
|
|
1180
|
-
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 })
|
|
1181
3253
|
] });
|
|
1182
3254
|
};
|
|
1183
3255
|
|
|
@@ -1214,9 +3286,9 @@ var chipVariants = createVariants({
|
|
|
1214
3286
|
var chip_variants_default = chipVariants;
|
|
1215
3287
|
|
|
1216
3288
|
// src/Icons/IconClose.tsx
|
|
1217
|
-
var
|
|
3289
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1218
3290
|
var IconClose = (props) => {
|
|
1219
|
-
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)(
|
|
1220
3292
|
"path",
|
|
1221
3293
|
{
|
|
1222
3294
|
d: "M16 16L12 12M12 12L8 8M12 12L16 8M12 12L8 16",
|
|
@@ -1229,7 +3301,7 @@ var IconClose = (props) => {
|
|
|
1229
3301
|
};
|
|
1230
3302
|
|
|
1231
3303
|
// src/components/Chip/Chip.tsx
|
|
1232
|
-
var
|
|
3304
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1233
3305
|
var initialChipProps = {
|
|
1234
3306
|
label: {
|
|
1235
3307
|
ui: {},
|
|
@@ -1245,9 +3317,9 @@ var initialChipProps = {
|
|
|
1245
3317
|
}
|
|
1246
3318
|
};
|
|
1247
3319
|
var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "medium", propsComponent, ...props }) => {
|
|
1248
|
-
const properties =
|
|
3320
|
+
const properties = mergeDeep2(initialChipProps, propsComponent);
|
|
1249
3321
|
const className = chip_variants_default({ variant, colors: color, rounded, size });
|
|
1250
|
-
return /* @__PURE__ */ (0,
|
|
3322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1251
3323
|
"div",
|
|
1252
3324
|
{
|
|
1253
3325
|
className,
|
|
@@ -1256,8 +3328,8 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1256
3328
|
style: composeStyles(properties.chip?.ui, properties.chip?.style),
|
|
1257
3329
|
children: [
|
|
1258
3330
|
icon,
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1260
|
-
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)(
|
|
1261
3333
|
"span",
|
|
1262
3334
|
{
|
|
1263
3335
|
className: "yr3Chip__delete",
|
|
@@ -1265,7 +3337,7 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1265
3337
|
role: "button",
|
|
1266
3338
|
"aria-label": "delete",
|
|
1267
3339
|
style: composeStyles(properties?.delete?.ui, properties?.delete?.style),
|
|
1268
|
-
children: /* @__PURE__ */ (0,
|
|
3340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconClose, { ...properties?.icon, stroke: color })
|
|
1269
3341
|
}
|
|
1270
3342
|
)
|
|
1271
3343
|
]
|
|
@@ -1274,12 +3346,12 @@ var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "m
|
|
|
1274
3346
|
};
|
|
1275
3347
|
|
|
1276
3348
|
// src/components/Collapse/Collapse.tsx
|
|
1277
|
-
var
|
|
1278
|
-
var
|
|
3349
|
+
var React6 = __toESM(require("react"), 1);
|
|
3350
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1279
3351
|
var Collapse = ({ children, open, anchor }) => {
|
|
1280
|
-
const ref =
|
|
1281
|
-
const [height, setHeight] =
|
|
1282
|
-
|
|
3352
|
+
const ref = React6.useRef(null);
|
|
3353
|
+
const [height, setHeight] = React6.useState(0);
|
|
3354
|
+
React6.useEffect(() => {
|
|
1283
3355
|
if (ref.current) {
|
|
1284
3356
|
if (open) {
|
|
1285
3357
|
setHeight(ref.current.scrollHeight);
|
|
@@ -1288,11 +3360,11 @@ var Collapse = ({ children, open, anchor }) => {
|
|
|
1288
3360
|
}
|
|
1289
3361
|
}
|
|
1290
3362
|
}, [open, children]);
|
|
1291
|
-
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 }) });
|
|
1292
3364
|
};
|
|
1293
3365
|
|
|
1294
3366
|
// src/components/Container/Container.tsx
|
|
1295
|
-
var
|
|
3367
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1296
3368
|
var Container = ({
|
|
1297
3369
|
children,
|
|
1298
3370
|
maxWidth = "sm",
|
|
@@ -1302,7 +3374,7 @@ var Container = ({
|
|
|
1302
3374
|
}) => {
|
|
1303
3375
|
const containerClassName = bem("yr3Container");
|
|
1304
3376
|
const classes = containerClassName(void 0, { maxWidth, static: fixed });
|
|
1305
|
-
return /* @__PURE__ */ (0,
|
|
3377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1306
3378
|
"div",
|
|
1307
3379
|
{
|
|
1308
3380
|
className: classes,
|
|
@@ -1314,12 +3386,12 @@ var Container = ({
|
|
|
1314
3386
|
};
|
|
1315
3387
|
|
|
1316
3388
|
// src/theme/controlContext.tsx
|
|
1317
|
-
var
|
|
1318
|
-
var ControlContext =
|
|
1319
|
-
var useControl = () =>
|
|
3389
|
+
var React7 = __toESM(require("react"), 1);
|
|
3390
|
+
var ControlContext = React7.createContext(null);
|
|
3391
|
+
var useControl = () => React7.useContext(ControlContext);
|
|
1320
3392
|
|
|
1321
3393
|
// src/components/Control/Control.tsx
|
|
1322
|
-
var
|
|
3394
|
+
var React8 = __toESM(require("react"), 1);
|
|
1323
3395
|
|
|
1324
3396
|
// src/components/Control/control.variants.ts
|
|
1325
3397
|
var controlVariants = createVariants({
|
|
@@ -1362,7 +3434,7 @@ var controlVariants = createVariants({
|
|
|
1362
3434
|
});
|
|
1363
3435
|
|
|
1364
3436
|
// src/components/Control/Control.tsx
|
|
1365
|
-
var
|
|
3437
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1366
3438
|
var Control = ({
|
|
1367
3439
|
children,
|
|
1368
3440
|
error = false,
|
|
@@ -1374,15 +3446,15 @@ var Control = ({
|
|
|
1374
3446
|
size = "auto",
|
|
1375
3447
|
label = true
|
|
1376
3448
|
}) => {
|
|
1377
|
-
const [focused, setFocused] =
|
|
3449
|
+
const [focused, setFocused] = React8.useState(false);
|
|
1378
3450
|
const value = {
|
|
1379
3451
|
focused,
|
|
1380
3452
|
setFocused,
|
|
1381
3453
|
error,
|
|
1382
3454
|
disabled
|
|
1383
3455
|
};
|
|
1384
|
-
const classes = controlVariants({ variant, color, label, size });
|
|
1385
|
-
return /* @__PURE__ */ (0,
|
|
3456
|
+
const classes = controlVariants({ variant, color, label, size, disabled });
|
|
3457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ControlContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1386
3458
|
"div",
|
|
1387
3459
|
{
|
|
1388
3460
|
className: classes,
|
|
@@ -1425,7 +3497,7 @@ var dividerVariants = createVariants({
|
|
|
1425
3497
|
var dividerVariants_default = dividerVariants;
|
|
1426
3498
|
|
|
1427
3499
|
// src/components/Divider/Divider.tsx
|
|
1428
|
-
var
|
|
3500
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1429
3501
|
var Divider = ({
|
|
1430
3502
|
orientation = "horizontal",
|
|
1431
3503
|
text: text2,
|
|
@@ -1435,14 +3507,14 @@ var Divider = ({
|
|
|
1435
3507
|
color = "primary"
|
|
1436
3508
|
}) => {
|
|
1437
3509
|
const classname = dividerVariants_default({ orientation, align, withText: !!text2, color });
|
|
1438
|
-
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 }) });
|
|
1439
3511
|
};
|
|
1440
3512
|
|
|
1441
3513
|
// src/components/Drawer/Drawer.tsx
|
|
1442
|
-
var
|
|
3514
|
+
var React9 = __toESM(require("react"), 1);
|
|
1443
3515
|
|
|
1444
3516
|
// src/components/Drawer/DrawerContainer.tsx
|
|
1445
|
-
var
|
|
3517
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1446
3518
|
var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
1447
3519
|
const { hide } = useBackdrop();
|
|
1448
3520
|
const handleClose = () => {
|
|
@@ -1452,7 +3524,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1452
3524
|
}
|
|
1453
3525
|
return;
|
|
1454
3526
|
};
|
|
1455
|
-
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 });
|
|
1456
3528
|
};
|
|
1457
3529
|
var DrawerContainer_default = DrawerContainer;
|
|
1458
3530
|
|
|
@@ -1472,7 +3544,7 @@ var useClickAway = (ref, callback) => {
|
|
|
1472
3544
|
};
|
|
1473
3545
|
|
|
1474
3546
|
// src/components/Drawer/Drawer.tsx
|
|
1475
|
-
var
|
|
3547
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1476
3548
|
var initialPropsComponent2 = {
|
|
1477
3549
|
drawer: {},
|
|
1478
3550
|
closing: null,
|
|
@@ -1481,9 +3553,9 @@ var initialPropsComponent2 = {
|
|
|
1481
3553
|
};
|
|
1482
3554
|
var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
1483
3555
|
const { show, hide } = useBackdrop();
|
|
1484
|
-
const ref =
|
|
1485
|
-
const properties =
|
|
1486
|
-
|
|
3556
|
+
const ref = React9.useRef(null);
|
|
3557
|
+
const properties = mergeDeep2(initialPropsComponent2, propsComponent);
|
|
3558
|
+
React9.useEffect(() => {
|
|
1487
3559
|
if (open) {
|
|
1488
3560
|
show("drawer");
|
|
1489
3561
|
} else {
|
|
@@ -1498,7 +3570,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1498
3570
|
}
|
|
1499
3571
|
;
|
|
1500
3572
|
});
|
|
1501
|
-
|
|
3573
|
+
React9.useEffect(() => {
|
|
1502
3574
|
if (properties?.onClose) {
|
|
1503
3575
|
hide("drawer");
|
|
1504
3576
|
onClose();
|
|
@@ -1506,7 +3578,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1506
3578
|
}, [properties?.onClose]);
|
|
1507
3579
|
const classesBem = bem("yr3Drawer");
|
|
1508
3580
|
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1509
|
-
return /* @__PURE__ */ (0,
|
|
3581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1510
3582
|
"div",
|
|
1511
3583
|
{
|
|
1512
3584
|
className: drawerClasses,
|
|
@@ -1514,7 +3586,7 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1514
3586
|
onClick: (e) => e.stopPropagation(),
|
|
1515
3587
|
ref,
|
|
1516
3588
|
"data-testid": "yr3Drawer",
|
|
1517
|
-
children: /* @__PURE__ */ (0,
|
|
3589
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1518
3590
|
DrawerContainer_default,
|
|
1519
3591
|
{
|
|
1520
3592
|
children,
|
|
@@ -1529,15 +3601,15 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1529
3601
|
};
|
|
1530
3602
|
|
|
1531
3603
|
// src/components/Input/Input.tsx
|
|
1532
|
-
var
|
|
3604
|
+
var React10 = __toESM(require("react"), 1);
|
|
1533
3605
|
|
|
1534
3606
|
// src/components/Label/Label.tsx
|
|
1535
|
-
var
|
|
3607
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1536
3608
|
var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
|
|
1537
3609
|
const classes = bem("yr3Label");
|
|
1538
3610
|
const classComponent = classes(void 0, { color: `color-${color}` });
|
|
1539
3611
|
const classnames = bemMerge(classComponent, className);
|
|
1540
|
-
return /* @__PURE__ */ (0,
|
|
3612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1541
3613
|
"span",
|
|
1542
3614
|
{
|
|
1543
3615
|
className: classnames,
|
|
@@ -1590,7 +3662,7 @@ var inputVariants = createVariants({
|
|
|
1590
3662
|
});
|
|
1591
3663
|
|
|
1592
3664
|
// src/components/Input/Input.tsx
|
|
1593
|
-
var
|
|
3665
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1594
3666
|
var initiaPropsComponent = {
|
|
1595
3667
|
label: {
|
|
1596
3668
|
display: true,
|
|
@@ -1599,7 +3671,7 @@ var initiaPropsComponent = {
|
|
|
1599
3671
|
},
|
|
1600
3672
|
control: {}
|
|
1601
3673
|
};
|
|
1602
|
-
var Input =
|
|
3674
|
+
var Input = React10.forwardRef(
|
|
1603
3675
|
({
|
|
1604
3676
|
label,
|
|
1605
3677
|
value,
|
|
@@ -1608,20 +3680,27 @@ var Input = React9.forwardRef(
|
|
|
1608
3680
|
variant = "outlined",
|
|
1609
3681
|
error = "ce un errore",
|
|
1610
3682
|
separatorCurrency = ",",
|
|
3683
|
+
separatorDecimal = ".",
|
|
1611
3684
|
ui,
|
|
1612
3685
|
style,
|
|
1613
3686
|
propsComponent = initiaPropsComponent,
|
|
1614
|
-
pattern = "text",
|
|
1615
3687
|
color = "primary",
|
|
1616
3688
|
size = "auto",
|
|
3689
|
+
disabled = false,
|
|
3690
|
+
model,
|
|
3691
|
+
pattern,
|
|
1617
3692
|
...props
|
|
1618
3693
|
}, ref) => {
|
|
1619
|
-
const [focused, setFocused] =
|
|
1620
|
-
const [internalValue, setInternalValue] =
|
|
3694
|
+
const [focused, setFocused] = React10.useState(false);
|
|
3695
|
+
const [internalValue, setInternalValue] = React10.useState(defaultValue);
|
|
1621
3696
|
const isControlled = value !== void 0;
|
|
1622
3697
|
const currentValue = isControlled ? value : internalValue;
|
|
1623
3698
|
const isActive = focused || !!currentValue;
|
|
1624
|
-
const
|
|
3699
|
+
const checkMode = (type, value2) => {
|
|
3700
|
+
if (pattern) {
|
|
3701
|
+
const regex = new RegExp(pattern);
|
|
3702
|
+
return regex.test(value2);
|
|
3703
|
+
}
|
|
1625
3704
|
switch (type) {
|
|
1626
3705
|
case "email":
|
|
1627
3706
|
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
@@ -1632,21 +3711,38 @@ var Input = React9.forwardRef(
|
|
|
1632
3711
|
case "currency":
|
|
1633
3712
|
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1634
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);
|
|
1635
3717
|
default:
|
|
1636
3718
|
return true;
|
|
1637
3719
|
}
|
|
1638
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
|
+
};
|
|
1639
3735
|
const handleChange = (e) => {
|
|
1640
3736
|
const newValue = e.target.value;
|
|
1641
|
-
if (newValue && !
|
|
3737
|
+
if (newValue && !checkMode(model, newValue)) return;
|
|
1642
3738
|
if (!isControlled) {
|
|
1643
3739
|
setInternalValue(newValue);
|
|
1644
3740
|
}
|
|
1645
3741
|
onChange?.(e, newValue);
|
|
1646
3742
|
};
|
|
1647
3743
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1648
|
-
return /* @__PURE__ */ (0,
|
|
1649
|
-
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)(
|
|
1650
3746
|
Label,
|
|
1651
3747
|
{
|
|
1652
3748
|
text: label || "",
|
|
@@ -1655,14 +3751,16 @@ var Input = React9.forwardRef(
|
|
|
1655
3751
|
...propsComponent.label
|
|
1656
3752
|
}
|
|
1657
3753
|
),
|
|
1658
|
-
/* @__PURE__ */ (0,
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1659
3755
|
"input",
|
|
1660
3756
|
{
|
|
1661
3757
|
ref,
|
|
1662
3758
|
value: currentValue,
|
|
1663
|
-
inputMode:
|
|
3759
|
+
inputMode: mode(model),
|
|
1664
3760
|
autoComplete: "off",
|
|
1665
|
-
type:
|
|
3761
|
+
type: props.type,
|
|
3762
|
+
pattern,
|
|
3763
|
+
disabled,
|
|
1666
3764
|
onChange: handleChange,
|
|
1667
3765
|
onFocus: () => setFocused(true),
|
|
1668
3766
|
onBlur: () => setFocused(false),
|
|
@@ -1677,12 +3775,12 @@ var Input = React9.forwardRef(
|
|
|
1677
3775
|
);
|
|
1678
3776
|
|
|
1679
3777
|
// src/components/Date/MonthSelector.tsx
|
|
1680
|
-
var
|
|
3778
|
+
var React11 = __toESM(require("react"), 1);
|
|
1681
3779
|
|
|
1682
3780
|
// src/Icons/IconSearch.tsx
|
|
1683
|
-
var
|
|
3781
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1684
3782
|
var IconSearch = (props) => {
|
|
1685
|
-
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)(
|
|
1686
3784
|
"path",
|
|
1687
3785
|
{
|
|
1688
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",
|
|
@@ -1695,24 +3793,35 @@ var IconSearch = (props) => {
|
|
|
1695
3793
|
};
|
|
1696
3794
|
|
|
1697
3795
|
// src/Icons/IconDown.tsx
|
|
1698
|
-
var
|
|
3796
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1699
3797
|
var IconDown = (props) => {
|
|
1700
|
-
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" }) });
|
|
1701
3799
|
};
|
|
1702
3800
|
|
|
1703
3801
|
// src/Icons/IconCalendar.tsx
|
|
1704
|
-
var
|
|
3802
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1705
3803
|
var IconCalendar = (props) => {
|
|
1706
|
-
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" }) });
|
|
1707
3805
|
};
|
|
1708
3806
|
|
|
1709
3807
|
// src/Icons/IconLeft.tsx
|
|
1710
|
-
var
|
|
3808
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1711
3809
|
var IconLeft = (props) => {
|
|
1712
|
-
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" }) });
|
|
1713
3811
|
};
|
|
1714
3812
|
|
|
1715
3813
|
// src/components/Date/month.variants.ts
|
|
3814
|
+
var monthSelectorVariants = createVariants({
|
|
3815
|
+
base: "yr3MonthSelector",
|
|
3816
|
+
variants: {
|
|
3817
|
+
wrapper: {
|
|
3818
|
+
true: "yr3MonthSelector--wrapper"
|
|
3819
|
+
},
|
|
3820
|
+
disabled: {
|
|
3821
|
+
true: "yr3MonthSelector--disabled"
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
});
|
|
1716
3825
|
var monthSelectorIconVariants = createVariants({
|
|
1717
3826
|
base: "yr3MonthSelector--icon",
|
|
1718
3827
|
variants: {
|
|
@@ -1755,9 +3864,9 @@ var monthSelectorContainerVariants = createVariants({
|
|
|
1755
3864
|
});
|
|
1756
3865
|
|
|
1757
3866
|
// src/Icons/IconRight.tsx
|
|
1758
|
-
var
|
|
3867
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1759
3868
|
var IconRight = (props) => {
|
|
1760
|
-
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)(
|
|
1761
3870
|
"path",
|
|
1762
3871
|
{
|
|
1763
3872
|
d: "M9 7L14 12L9 17",
|
|
@@ -1770,12 +3879,14 @@ var IconRight = (props) => {
|
|
|
1770
3879
|
};
|
|
1771
3880
|
|
|
1772
3881
|
// src/components/Date/MonthSelector.tsx
|
|
1773
|
-
var
|
|
3882
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1774
3883
|
var initialPropsComponent3 = {
|
|
1775
3884
|
control: {
|
|
1776
3885
|
variant: "outlined",
|
|
1777
3886
|
color: "primary",
|
|
1778
|
-
ui: {
|
|
3887
|
+
ui: {
|
|
3888
|
+
pointerEvents: "none"
|
|
3889
|
+
},
|
|
1779
3890
|
style: {}
|
|
1780
3891
|
},
|
|
1781
3892
|
label: {
|
|
@@ -1810,18 +3921,18 @@ var initialPropsComponent3 = {
|
|
|
1810
3921
|
style: {}
|
|
1811
3922
|
}
|
|
1812
3923
|
};
|
|
1813
|
-
var MonthSelector = ({ label, value, disabled, propsComponent, data,
|
|
1814
|
-
const [open, setOpen] =
|
|
1815
|
-
const [valueState, setValueState] =
|
|
1816
|
-
const [yearSelected, setYearSelected] =
|
|
1817
|
-
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);
|
|
1818
3929
|
useClickAway(ref, () => setOpen(false));
|
|
1819
|
-
const properties =
|
|
3930
|
+
const properties = mergeDeep2(initialPropsComponent3, propsComponent || {});
|
|
1820
3931
|
const iconClasses = monthSelectorIconVariants({ color: properties?.icon?.color });
|
|
1821
3932
|
const containerClasses = monthSelectorContainerVariants({ color: properties?.container?.color });
|
|
1822
|
-
const getData =
|
|
1823
|
-
return getMonthCalendarProps({ year: data.years[yearSelected], data,
|
|
1824
|
-
}, [yearSelected, data,
|
|
3933
|
+
const getData = React11.useMemo(() => {
|
|
3934
|
+
return getMonthCalendarProps({ year: data.years[yearSelected], data, format, value: valueState });
|
|
3935
|
+
}, [yearSelected, data, format, valueState]);
|
|
1825
3936
|
const handleYearChange = (newIndex) => {
|
|
1826
3937
|
setYearSelected(newIndex);
|
|
1827
3938
|
};
|
|
@@ -1832,19 +3943,19 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1832
3943
|
const nextData = getMonthCalendarProps({
|
|
1833
3944
|
year: data.years[yearSelected],
|
|
1834
3945
|
data,
|
|
1835
|
-
|
|
3946
|
+
format,
|
|
1836
3947
|
value: newValue
|
|
1837
3948
|
});
|
|
1838
3949
|
onNext?.(nextData.prev);
|
|
1839
3950
|
onLast?.(nextData.last);
|
|
1840
3951
|
};
|
|
1841
|
-
|
|
1842
|
-
|
|
3952
|
+
const classes = monthSelectorVariants({ wrapper: true, disabled });
|
|
3953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: classes, ref, children: [
|
|
3954
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1843
3955
|
Input,
|
|
1844
3956
|
{
|
|
1845
3957
|
label,
|
|
1846
3958
|
variant: "base",
|
|
1847
|
-
disabled: true,
|
|
1848
3959
|
value: valueState || "",
|
|
1849
3960
|
propsComponent: {
|
|
1850
3961
|
control: properties?.control,
|
|
@@ -1852,14 +3963,14 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1852
3963
|
}
|
|
1853
3964
|
}
|
|
1854
3965
|
),
|
|
1855
|
-
/* @__PURE__ */ (0,
|
|
3966
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1856
3967
|
"div",
|
|
1857
3968
|
{
|
|
1858
3969
|
className: iconClasses,
|
|
1859
3970
|
style: properties?.icon?.style,
|
|
1860
3971
|
onClick: () => !disabled && setOpen(true),
|
|
1861
3972
|
"data-testid": "yr3MonthSelector--icon",
|
|
1862
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0,
|
|
3973
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1863
3974
|
IconCalendar,
|
|
1864
3975
|
{
|
|
1865
3976
|
width: properties?.icon?.svg?.width,
|
|
@@ -1870,47 +3981,47 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1870
3981
|
)
|
|
1871
3982
|
}
|
|
1872
3983
|
),
|
|
1873
|
-
open && /* @__PURE__ */ (0,
|
|
3984
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1874
3985
|
"div",
|
|
1875
3986
|
{
|
|
1876
3987
|
className: "yr3MonthSelector--wrapper",
|
|
1877
3988
|
style: composeStyles(properties?.wrapper?.ui, properties?.wrapper?.style),
|
|
1878
3989
|
"data-testid": "yr3MonthSelector--wrapper",
|
|
1879
|
-
children: /* @__PURE__ */ (0,
|
|
1880
|
-
/* @__PURE__ */ (0,
|
|
3990
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "yr3MonthSelector--component", children: [
|
|
3991
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1881
3992
|
"div",
|
|
1882
3993
|
{
|
|
1883
3994
|
className: containerClasses,
|
|
1884
3995
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1885
3996
|
children: [
|
|
1886
|
-
/* @__PURE__ */ (0,
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1887
3998
|
"button",
|
|
1888
3999
|
{
|
|
1889
4000
|
disabled: disabled || yearSelected === 0,
|
|
1890
4001
|
type: "button",
|
|
1891
4002
|
className: `yr3MonthSelector--year-button-back ${yearSelected === 0 ? "yr3MonthSelector--year-button-back--disabled" : ""} `,
|
|
1892
4003
|
onClick: () => handleYearChange(yearSelected - 1),
|
|
1893
|
-
children: /* @__PURE__ */ (0,
|
|
4004
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconLeft, { width: 20, height: 20, stroke: "currentColor" })
|
|
1894
4005
|
}
|
|
1895
4006
|
),
|
|
1896
|
-
/* @__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: [
|
|
1897
4008
|
data.years[yearSelected],
|
|
1898
4009
|
" "
|
|
1899
4010
|
] }) }),
|
|
1900
|
-
/* @__PURE__ */ (0,
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1901
4012
|
"button",
|
|
1902
4013
|
{
|
|
1903
4014
|
disabled: disabled || yearSelected === data.years.length - 1,
|
|
1904
4015
|
type: "button",
|
|
1905
4016
|
className: `yr3MonthSelector--year-button-next ${yearSelected === data.years.length - 1 ? "yr3MonthSelector--year-button-next--disabled" : ""}`,
|
|
1906
4017
|
onClick: () => handleYearChange(yearSelected + 1),
|
|
1907
|
-
children: /* @__PURE__ */ (0,
|
|
4018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconRight, { width: 20, height: 30, stroke: "currentColor" })
|
|
1908
4019
|
}
|
|
1909
4020
|
)
|
|
1910
4021
|
]
|
|
1911
4022
|
}
|
|
1912
4023
|
),
|
|
1913
|
-
/* @__PURE__ */ (0,
|
|
4024
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "yr3MonthSelector--months", children: getData.months.map((m) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1914
4025
|
"button",
|
|
1915
4026
|
{
|
|
1916
4027
|
type: "button",
|
|
@@ -1919,8 +4030,9 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1919
4030
|
className: `yr3MonthSelector--month ${m.disabled ? "yr3MonthSelector--month--disabled" : ""} ${m.selected ? "yr3MonthSelector--month--selected" : ""}`,
|
|
1920
4031
|
onClick: () => {
|
|
1921
4032
|
handleMonthChange(m.value);
|
|
4033
|
+
setOpen(false);
|
|
1922
4034
|
},
|
|
1923
|
-
children: /* @__PURE__ */ (0,
|
|
4035
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { ...properties?.text, weight: m.disabled ? "thin" : "medium", children: m.label })
|
|
1924
4036
|
},
|
|
1925
4037
|
"month-" + m.value
|
|
1926
4038
|
)) })
|
|
@@ -1931,8 +4043,8 @@ var MonthSelector = ({ label, value, disabled, propsComponent, data, daysFormat,
|
|
|
1931
4043
|
};
|
|
1932
4044
|
|
|
1933
4045
|
// src/components/Fade/Fade.tsx
|
|
1934
|
-
var
|
|
1935
|
-
var
|
|
4046
|
+
var React12 = __toESM(require("react"), 1);
|
|
4047
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1936
4048
|
var Fade = ({
|
|
1937
4049
|
in: inProp,
|
|
1938
4050
|
children,
|
|
@@ -1940,7 +4052,7 @@ var Fade = ({
|
|
|
1940
4052
|
onTransitionEnd,
|
|
1941
4053
|
style
|
|
1942
4054
|
}) => {
|
|
1943
|
-
|
|
4055
|
+
React12.useEffect(() => {
|
|
1944
4056
|
let timeoutId;
|
|
1945
4057
|
if (inProp) {
|
|
1946
4058
|
timeoutId = setTimeout(() => {
|
|
@@ -1949,7 +4061,7 @@ var Fade = ({
|
|
|
1949
4061
|
}
|
|
1950
4062
|
return () => clearTimeout(timeoutId);
|
|
1951
4063
|
}, [inProp, duration, onTransitionEnd]);
|
|
1952
|
-
return /* @__PURE__ */ (0,
|
|
4064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1953
4065
|
"div",
|
|
1954
4066
|
{
|
|
1955
4067
|
className: `yr3Fade ${inProp ? "yr3Fade--in" : ""}`,
|
|
@@ -1960,61 +4072,8 @@ var Fade = ({
|
|
|
1960
4072
|
);
|
|
1961
4073
|
};
|
|
1962
4074
|
|
|
1963
|
-
// src/components/Flex/flex.variants.ts
|
|
1964
|
-
var flexVariants = createVariants({
|
|
1965
|
-
base: "yr3Flex",
|
|
1966
|
-
variants: {
|
|
1967
|
-
variant: {
|
|
1968
|
-
row: "yr3Flex--row",
|
|
1969
|
-
column: "yr3Flex--column",
|
|
1970
|
-
wrap: "yr3Flex--wrap"
|
|
1971
|
-
},
|
|
1972
|
-
container: {
|
|
1973
|
-
true: "yr3Flex--container"
|
|
1974
|
-
},
|
|
1975
|
-
center: {
|
|
1976
|
-
true: "yr3Flex--center"
|
|
1977
|
-
},
|
|
1978
|
-
between: {
|
|
1979
|
-
true: "yr3Flex--between"
|
|
1980
|
-
},
|
|
1981
|
-
bordered: {
|
|
1982
|
-
true: "yr3Flex--bordered"
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
});
|
|
1986
|
-
var flex_variants_default = flexVariants;
|
|
1987
|
-
|
|
1988
|
-
// src/components/Flex/Flex.tsx
|
|
1989
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1990
|
-
var Flex = ({
|
|
1991
|
-
container = false,
|
|
1992
|
-
spacing: spacing2 = 1,
|
|
1993
|
-
children,
|
|
1994
|
-
ui,
|
|
1995
|
-
gap,
|
|
1996
|
-
variant = "column",
|
|
1997
|
-
center = false,
|
|
1998
|
-
between = false,
|
|
1999
|
-
style,
|
|
2000
|
-
bordered = false,
|
|
2001
|
-
...props
|
|
2002
|
-
}) => {
|
|
2003
|
-
const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
|
|
2004
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2005
|
-
"div",
|
|
2006
|
-
{
|
|
2007
|
-
className: classes,
|
|
2008
|
-
style: composeStyles(ui, style),
|
|
2009
|
-
...props,
|
|
2010
|
-
"data-testid": "yr3Flex",
|
|
2011
|
-
children
|
|
2012
|
-
}
|
|
2013
|
-
);
|
|
2014
|
-
};
|
|
2015
|
-
|
|
2016
4075
|
// src/components/Grid/Grid.tsx
|
|
2017
|
-
var
|
|
4076
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2018
4077
|
var Grid = ({
|
|
2019
4078
|
container = false,
|
|
2020
4079
|
spacing: spacing2 = 0,
|
|
@@ -2047,7 +4106,7 @@ var Grid = ({
|
|
|
2047
4106
|
}
|
|
2048
4107
|
const classes = bem("yr3Grid");
|
|
2049
4108
|
const className = classes(void 0, { container, [`spacing-${spacing2}`]: center, span: item && `Col-${size}` });
|
|
2050
|
-
return /* @__PURE__ */ (0,
|
|
4109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2051
4110
|
"div",
|
|
2052
4111
|
{
|
|
2053
4112
|
className,
|
|
@@ -2060,7 +4119,7 @@ var Grid = ({
|
|
|
2060
4119
|
};
|
|
2061
4120
|
|
|
2062
4121
|
// src/components/Group/Group.tsx
|
|
2063
|
-
var
|
|
4122
|
+
var React13 = __toESM(require("react"), 1);
|
|
2064
4123
|
|
|
2065
4124
|
// src/components/Group/group.variants.ts
|
|
2066
4125
|
var groupVariants = createVariants({
|
|
@@ -2091,8 +4150,8 @@ var groupVariants = createVariants({
|
|
|
2091
4150
|
});
|
|
2092
4151
|
|
|
2093
4152
|
// src/components/Group/Group.tsx
|
|
2094
|
-
var
|
|
2095
|
-
var
|
|
4153
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4154
|
+
var initialComponents2 = (color) => ({
|
|
2096
4155
|
group: {
|
|
2097
4156
|
ui: {},
|
|
2098
4157
|
style: {}
|
|
@@ -2120,13 +4179,13 @@ var Group = ({
|
|
|
2120
4179
|
exclude = false,
|
|
2121
4180
|
propsComponent
|
|
2122
4181
|
}) => {
|
|
2123
|
-
const properties =
|
|
2124
|
-
|
|
4182
|
+
const properties = mergeDeep2(
|
|
4183
|
+
initialComponents2(type === "rounded" ? "text" : color),
|
|
2125
4184
|
propsComponent || {}
|
|
2126
4185
|
);
|
|
2127
|
-
const [internalValue, setInternalValue] =
|
|
4186
|
+
const [internalValue, setInternalValue] = React13.useState(null);
|
|
2128
4187
|
const isControlled = value !== void 0;
|
|
2129
|
-
|
|
4188
|
+
React13.useEffect(() => {
|
|
2130
4189
|
if (isControlled) {
|
|
2131
4190
|
setInternalValue(value);
|
|
2132
4191
|
}
|
|
@@ -2137,7 +4196,7 @@ var Group = ({
|
|
|
2137
4196
|
active: !exclude ? Array.isArray(value) ? value.includes(item?.value) : internalValue === item.value : false,
|
|
2138
4197
|
exclude: exclude && Array.isArray(value) ? !value.includes(item?.value) : ""
|
|
2139
4198
|
});
|
|
2140
|
-
const mappingStyle =
|
|
4199
|
+
const mappingStyle = React13.useMemo(() => {
|
|
2141
4200
|
if (variant !== "filled") return options.map((opt, index) => ({
|
|
2142
4201
|
...opt,
|
|
2143
4202
|
index,
|
|
@@ -2168,13 +4227,13 @@ var Group = ({
|
|
|
2168
4227
|
}
|
|
2169
4228
|
}));
|
|
2170
4229
|
}, [exclude, value, options, type]);
|
|
2171
|
-
return /* @__PURE__ */ (0,
|
|
4230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2172
4231
|
"div",
|
|
2173
4232
|
{
|
|
2174
4233
|
className: groupVariants({ variant, color, type }),
|
|
2175
4234
|
"data-testid": "yr3Group",
|
|
2176
4235
|
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
2177
|
-
children: options.map((opt, index) => /* @__PURE__ */ (0,
|
|
4236
|
+
children: options.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2178
4237
|
"div",
|
|
2179
4238
|
{
|
|
2180
4239
|
"data-testid": "yr3Group-item",
|
|
@@ -2192,7 +4251,7 @@ var Group = ({
|
|
|
2192
4251
|
...mappingStyle?.find((o) => o.value === opt.value)?.style
|
|
2193
4252
|
}
|
|
2194
4253
|
),
|
|
2195
|
-
children: /* @__PURE__ */ (0,
|
|
4254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2196
4255
|
Text,
|
|
2197
4256
|
{
|
|
2198
4257
|
...properties.item?.text,
|
|
@@ -2208,14 +4267,14 @@ var Group = ({
|
|
|
2208
4267
|
};
|
|
2209
4268
|
|
|
2210
4269
|
// src/components/Image/Image.tsx
|
|
2211
|
-
var
|
|
4270
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2212
4271
|
var Image = ({
|
|
2213
4272
|
src,
|
|
2214
4273
|
alt = "",
|
|
2215
4274
|
ui,
|
|
2216
4275
|
style
|
|
2217
4276
|
}) => {
|
|
2218
|
-
return /* @__PURE__ */ (0,
|
|
4277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2219
4278
|
"img",
|
|
2220
4279
|
{
|
|
2221
4280
|
src,
|
|
@@ -2228,8 +4287,8 @@ var Image = ({
|
|
|
2228
4287
|
};
|
|
2229
4288
|
|
|
2230
4289
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
2231
|
-
var
|
|
2232
|
-
var
|
|
4290
|
+
var React14 = __toESM(require("react"), 1);
|
|
4291
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2233
4292
|
var initialPropsComponent4 = {
|
|
2234
4293
|
box: {},
|
|
2235
4294
|
text: {},
|
|
@@ -2238,10 +4297,10 @@ var initialPropsComponent4 = {
|
|
|
2238
4297
|
content: {}
|
|
2239
4298
|
};
|
|
2240
4299
|
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
2241
|
-
const properties =
|
|
2242
|
-
const [dragging, setDragging] =
|
|
2243
|
-
const [files, setFiles] =
|
|
2244
|
-
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);
|
|
2245
4304
|
const handleFiles = (fileList) => {
|
|
2246
4305
|
if (!fileList) return;
|
|
2247
4306
|
const newFiles = Array.from(fileList);
|
|
@@ -2253,7 +4312,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2253
4312
|
};
|
|
2254
4313
|
const classes = bem("yr3Dropzone");
|
|
2255
4314
|
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
2256
|
-
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)(
|
|
2257
4316
|
"div",
|
|
2258
4317
|
{
|
|
2259
4318
|
className: classComponent,
|
|
@@ -2270,7 +4329,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2270
4329
|
onClick: () => inputRef.current?.click(),
|
|
2271
4330
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
2272
4331
|
children: [
|
|
2273
|
-
/* @__PURE__ */ (0,
|
|
4332
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2274
4333
|
"input",
|
|
2275
4334
|
{
|
|
2276
4335
|
ref: inputRef,
|
|
@@ -2281,10 +4340,10 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2281
4340
|
onChange: (e) => handleFiles(e.target.files)
|
|
2282
4341
|
}
|
|
2283
4342
|
),
|
|
2284
|
-
isEmpty(files) && /* @__PURE__ */ (0,
|
|
2285
|
-
multiple && /* @__PURE__ */ (0,
|
|
2286
|
-
!multiple && /* @__PURE__ */ (0,
|
|
2287
|
-
!!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 }) }),
|
|
2288
4347
|
component
|
|
2289
4348
|
]
|
|
2290
4349
|
}
|
|
@@ -2292,7 +4351,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
2292
4351
|
};
|
|
2293
4352
|
|
|
2294
4353
|
// src/components/InputArea/InputArea.tsx
|
|
2295
|
-
var
|
|
4354
|
+
var React15 = __toESM(require("react"), 1);
|
|
2296
4355
|
|
|
2297
4356
|
// src/components/InputArea/inputAreaVariants.ts
|
|
2298
4357
|
var inputAreaVariants = createVariants({
|
|
@@ -2333,7 +4392,7 @@ var inputAreaVariants = createVariants({
|
|
|
2333
4392
|
});
|
|
2334
4393
|
|
|
2335
4394
|
// src/components/InputArea/InputArea.tsx
|
|
2336
|
-
var
|
|
4395
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2337
4396
|
var initiaPropsComponent2 = {
|
|
2338
4397
|
label: {
|
|
2339
4398
|
display: true,
|
|
@@ -2358,8 +4417,8 @@ var InputArea = ({
|
|
|
2358
4417
|
rounded = false,
|
|
2359
4418
|
propsComponent = initiaPropsComponent2
|
|
2360
4419
|
}) => {
|
|
2361
|
-
const ref =
|
|
2362
|
-
const [internalValue, setInternalValue] =
|
|
4420
|
+
const ref = React15.useRef(null);
|
|
4421
|
+
const [internalValue, setInternalValue] = React15.useState(defaultValue);
|
|
2363
4422
|
const isControlled = value !== void 0;
|
|
2364
4423
|
const currentValue = isControlled ? value : internalValue;
|
|
2365
4424
|
const handleChange = (e) => {
|
|
@@ -2376,8 +4435,8 @@ var InputArea = ({
|
|
|
2376
4435
|
el.style.resize = resize;
|
|
2377
4436
|
}
|
|
2378
4437
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
2379
|
-
return /* @__PURE__ */ (0,
|
|
2380
|
-
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)(
|
|
2381
4440
|
Label,
|
|
2382
4441
|
{
|
|
2383
4442
|
text: label || "",
|
|
@@ -2385,7 +4444,7 @@ var InputArea = ({
|
|
|
2385
4444
|
...propsComponent.label
|
|
2386
4445
|
}
|
|
2387
4446
|
),
|
|
2388
|
-
/* @__PURE__ */ (0,
|
|
4447
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2389
4448
|
"textarea",
|
|
2390
4449
|
{
|
|
2391
4450
|
className: classes,
|
|
@@ -2397,76 +4456,10 @@ var InputArea = ({
|
|
|
2397
4456
|
"data-testid": "yr3InputArea"
|
|
2398
4457
|
}
|
|
2399
4458
|
),
|
|
2400
|
-
/* @__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 : "" })
|
|
2401
4460
|
] });
|
|
2402
4461
|
};
|
|
2403
4462
|
|
|
2404
|
-
// src/components/Loader/loader.variants.ts
|
|
2405
|
-
var loaderSpinnerVariants = createVariants({
|
|
2406
|
-
base: "yr3Loader--spinner",
|
|
2407
|
-
variants: {
|
|
2408
|
-
color: {
|
|
2409
|
-
primary: "yr3Loader--spinner-color-primary",
|
|
2410
|
-
secondary: "yr3Loader--spinner-color-secondary",
|
|
2411
|
-
success: "yr3Loader--spinner-color-success",
|
|
2412
|
-
error: "yr3Loader--spinner-color-error",
|
|
2413
|
-
warning: "yr3Loader--spinner-color-warning",
|
|
2414
|
-
info: "yr3Loader--spinner-color-info",
|
|
2415
|
-
disabled: "yr3Loader--spinner-color-disabled",
|
|
2416
|
-
text: "yr3Loader--spinner-color-text",
|
|
2417
|
-
background: "yr3Loader--spinner-color-background",
|
|
2418
|
-
common: "yr3Loader--spinner-color-common"
|
|
2419
|
-
},
|
|
2420
|
-
size: {
|
|
2421
|
-
sm: "yr3Loader--spinner-size-sm",
|
|
2422
|
-
md: "yr3Loader--spinner-size-md",
|
|
2423
|
-
lg: "yr3Loader--spinner-size-lg"
|
|
2424
|
-
},
|
|
2425
|
-
type: {
|
|
2426
|
-
default: "yr3Loader--spinner-default",
|
|
2427
|
-
dots: "yr3Loader--spinner-dots",
|
|
2428
|
-
fancy: "yr3Loader--spinner-fancy"
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
});
|
|
2432
|
-
|
|
2433
|
-
// src/components/Loader/Loader.tsx
|
|
2434
|
-
var React15 = __toESM(require("react"), 1);
|
|
2435
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2436
|
-
var initialComponents2 = {
|
|
2437
|
-
loader: {
|
|
2438
|
-
ui: {},
|
|
2439
|
-
style: {}
|
|
2440
|
-
},
|
|
2441
|
-
spinner: {
|
|
2442
|
-
size: "sm",
|
|
2443
|
-
color: "primary",
|
|
2444
|
-
type: "default"
|
|
2445
|
-
},
|
|
2446
|
-
container: {
|
|
2447
|
-
center: true,
|
|
2448
|
-
container: true,
|
|
2449
|
-
ui: {
|
|
2450
|
-
width: "100%",
|
|
2451
|
-
height: "100%"
|
|
2452
|
-
}
|
|
2453
|
-
}
|
|
2454
|
-
};
|
|
2455
|
-
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2456
|
-
const properties = mergeDeep(initialComponents2, propsComponent || {});
|
|
2457
|
-
const classSpinner = loaderSpinnerVariants({
|
|
2458
|
-
color: properties?.spinner?.color,
|
|
2459
|
-
type: properties?.spinner?.type,
|
|
2460
|
-
size: properties?.spinner?.size
|
|
2461
|
-
});
|
|
2462
|
-
if (!loading) return null;
|
|
2463
|
-
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: [
|
|
2464
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {}),
|
|
2465
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {}),
|
|
2466
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {})
|
|
2467
|
-
] }) }) }) });
|
|
2468
|
-
};
|
|
2469
|
-
|
|
2470
4463
|
// src/components/Modal/Modal.tsx
|
|
2471
4464
|
var React16 = __toESM(require("react"), 1);
|
|
2472
4465
|
|
|
@@ -2692,7 +4685,7 @@ var Picker = ({ label, variant, color, children, name, value, onChange, propsCom
|
|
|
2692
4685
|
const [valueState, setValueState] = React17.useState(value || null);
|
|
2693
4686
|
const ref = React17.useRef(null);
|
|
2694
4687
|
useClickAway(ref, () => setOpen(false));
|
|
2695
|
-
const properties =
|
|
4688
|
+
const properties = mergeDeep2(initiaPropsComponent3, propsComponent || {});
|
|
2696
4689
|
const classesIcon = PickerIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2697
4690
|
const classes = PickerVariants({ wrapper: true, variant, color });
|
|
2698
4691
|
React17.useEffect(() => {
|
|
@@ -2933,7 +4926,7 @@ var PlacesAutocomplete = ({
|
|
|
2933
4926
|
keyApi,
|
|
2934
4927
|
propsComponent = initPropsComponent
|
|
2935
4928
|
}) => {
|
|
2936
|
-
const [value,
|
|
4929
|
+
const [value, setValue2] = React20.useState(null);
|
|
2937
4930
|
const inputRef = React20.useRef(null);
|
|
2938
4931
|
const [anchorEl, setAnchorEl] = React20.useState(null);
|
|
2939
4932
|
const { suggestions, selectPlace } = (0, import_autocomplete_places.useAutocompletePlaces)({ input: value, apiKey: keyApi, language, provider });
|
|
@@ -2952,12 +4945,12 @@ var PlacesAutocomplete = ({
|
|
|
2952
4945
|
placeId: id
|
|
2953
4946
|
};
|
|
2954
4947
|
onSelect(locationData);
|
|
2955
|
-
|
|
4948
|
+
setValue2(place.address);
|
|
2956
4949
|
setAnchorEl(null);
|
|
2957
4950
|
};
|
|
2958
4951
|
React20.useEffect(() => {
|
|
2959
4952
|
if (defaultLocation) {
|
|
2960
|
-
|
|
4953
|
+
setValue2(defaultLocation);
|
|
2961
4954
|
}
|
|
2962
4955
|
}, [defaultLocation]);
|
|
2963
4956
|
React20.useEffect(() => {
|
|
@@ -2966,7 +4959,7 @@ var PlacesAutocomplete = ({
|
|
|
2966
4959
|
}
|
|
2967
4960
|
}, [value]);
|
|
2968
4961
|
const handleChange = (e) => {
|
|
2969
|
-
|
|
4962
|
+
setValue2(e.target.value);
|
|
2970
4963
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2971
4964
|
};
|
|
2972
4965
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
@@ -3076,6 +5069,9 @@ var selectVariants = createVariants({
|
|
|
3076
5069
|
base: "yr3Select--base",
|
|
3077
5070
|
lined: "yr3Select--lined"
|
|
3078
5071
|
},
|
|
5072
|
+
disabled: {
|
|
5073
|
+
true: "yr3Select--disabled"
|
|
5074
|
+
},
|
|
3079
5075
|
color: {
|
|
3080
5076
|
primary: "yr3Select--color-primary",
|
|
3081
5077
|
secondary: "yr3Select--color-secondary",
|
|
@@ -3160,24 +5156,29 @@ var initiaPropsComponent4 = {
|
|
|
3160
5156
|
component: void 0
|
|
3161
5157
|
}
|
|
3162
5158
|
};
|
|
3163
|
-
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
5159
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent, disabled = false }) => {
|
|
3164
5160
|
const [open, setOpen] = React21.useState(false);
|
|
3165
5161
|
const [valueState, setValueState] = React21.useState(value || defaultValue || null);
|
|
3166
5162
|
const ref = React21.useRef(null);
|
|
3167
5163
|
useClickAway(ref, () => setOpen(false));
|
|
3168
|
-
const properties =
|
|
5164
|
+
const properties = mergeDeep2(initiaPropsComponent4, propsComponent || {});
|
|
3169
5165
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
3170
|
-
const classes = selectVariants({ wrapper: true });
|
|
5166
|
+
const classes = selectVariants({ wrapper: true, disabled });
|
|
3171
5167
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: classes, ref, children: [
|
|
3172
5168
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3173
5169
|
Input,
|
|
3174
5170
|
{
|
|
3175
5171
|
label,
|
|
3176
5172
|
variant: "base",
|
|
3177
|
-
disabled: true,
|
|
3178
5173
|
value: options.find((opt) => opt.value === valueState)?.label || "",
|
|
3179
5174
|
propsComponent: {
|
|
3180
|
-
control:
|
|
5175
|
+
control: {
|
|
5176
|
+
...properties?.control,
|
|
5177
|
+
ui: {
|
|
5178
|
+
...properties?.control?.ui,
|
|
5179
|
+
pointerEvents: "none"
|
|
5180
|
+
}
|
|
5181
|
+
},
|
|
3181
5182
|
label: properties?.label
|
|
3182
5183
|
}
|
|
3183
5184
|
}
|
|
@@ -3187,7 +5188,7 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
3187
5188
|
{
|
|
3188
5189
|
className: classesIcon,
|
|
3189
5190
|
style: properties?.icon?.style,
|
|
3190
|
-
onClick: () => setOpen((prev) => !prev),
|
|
5191
|
+
onClick: () => !disabled && setOpen((prev) => !prev),
|
|
3191
5192
|
"data-testid": "yr3Select-icon",
|
|
3192
5193
|
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3193
5194
|
IconDown,
|
|
@@ -3239,13 +5240,40 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
3239
5240
|
|
|
3240
5241
|
// src/components/Slide/Slide.tsx
|
|
3241
5242
|
var React22 = __toESM(require("react"), 1);
|
|
5243
|
+
|
|
5244
|
+
// src/components/Slide/variants.slide.ts
|
|
5245
|
+
var variantsSlide = createVariants({
|
|
5246
|
+
base: "yr3Slide--content",
|
|
5247
|
+
variants: {
|
|
5248
|
+
direction: {
|
|
5249
|
+
left: "yr3Slide--content--left",
|
|
5250
|
+
right: "yr3Slide--content--right",
|
|
5251
|
+
top: "yr3Slide--content--top",
|
|
5252
|
+
bottom: "yr3Slide--content--bottom"
|
|
5253
|
+
},
|
|
5254
|
+
open: {
|
|
5255
|
+
true: "yr3Slide--in",
|
|
5256
|
+
false: "yr3Slide--out"
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
5259
|
+
});
|
|
5260
|
+
|
|
5261
|
+
// src/components/Slide/Slide.tsx
|
|
3242
5262
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3243
5263
|
var initialPropsComponent5 = {
|
|
3244
5264
|
slide: {
|
|
3245
5265
|
ui: {},
|
|
3246
5266
|
style: {}
|
|
3247
5267
|
},
|
|
3248
|
-
|
|
5268
|
+
content: {
|
|
5269
|
+
ui: {},
|
|
5270
|
+
style: {}
|
|
5271
|
+
},
|
|
5272
|
+
box: {
|
|
5273
|
+
as: "div",
|
|
5274
|
+
ui: {},
|
|
5275
|
+
style: {}
|
|
5276
|
+
}
|
|
3249
5277
|
};
|
|
3250
5278
|
var Slide = ({
|
|
3251
5279
|
in: inProp,
|
|
@@ -3255,34 +5283,30 @@ var Slide = ({
|
|
|
3255
5283
|
onTransitionEnd,
|
|
3256
5284
|
propsComponent
|
|
3257
5285
|
}) => {
|
|
3258
|
-
const properties =
|
|
3259
|
-
const
|
|
3260
|
-
const classNameContent = bemContent(void 0, {
|
|
3261
|
-
[direction]: true,
|
|
3262
|
-
"in": !!inProp,
|
|
3263
|
-
"out": !inProp
|
|
3264
|
-
});
|
|
5286
|
+
const properties = mergeDeep2(initialPropsComponent5, propsComponent || {});
|
|
5287
|
+
const stateRef = React22.useRef(inProp ? "in" : "out");
|
|
3265
5288
|
React22.useEffect(() => {
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
}
|
|
3272
|
-
return () => clearTimeout(timeoutId);
|
|
3273
|
-
}, [inProp, duration, onTransitionEnd]);
|
|
3274
|
-
const uiStyleContent = uiStyle({ ...properties?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
5289
|
+
stateRef.current = inProp ? "in" : "out";
|
|
5290
|
+
}, [inProp]);
|
|
5291
|
+
const classesContent = variantsSlide({ direction, open: !!inProp ? "true" : "false" });
|
|
5292
|
+
const uiStyleSlider = uiStyle({ ...properties?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
5293
|
+
const uiStyleContent = uiStyle({ ...properties?.content?.ui, transitionDuration: `${duration}ms` });
|
|
3275
5294
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3276
5295
|
"div",
|
|
3277
5296
|
{
|
|
3278
5297
|
className: "yr3Slide",
|
|
3279
|
-
style: composeStyles(),
|
|
5298
|
+
style: composeStyles(uiStyleSlider, properties?.slide?.style || {}),
|
|
3280
5299
|
"data-testid": "yr3Slide",
|
|
3281
5300
|
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3282
5301
|
"div",
|
|
3283
5302
|
{
|
|
3284
|
-
className:
|
|
3285
|
-
|
|
5303
|
+
className: classesContent,
|
|
5304
|
+
onTransitionEnd: (e) => {
|
|
5305
|
+
if (e.target === e.currentTarget && e.propertyName === "transform") {
|
|
5306
|
+
onTransitionEnd?.(stateRef?.current);
|
|
5307
|
+
}
|
|
5308
|
+
},
|
|
5309
|
+
style: composeStyles(uiStyleContent, properties?.content?.style || {}),
|
|
3286
5310
|
"data-testid": "yr3Slide-content",
|
|
3287
5311
|
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box, { ...properties?.box, "data-testid": "yr3Slide-box", children })
|
|
3288
5312
|
}
|
|
@@ -3462,17 +5486,17 @@ function useMediaQuery(query) {
|
|
|
3462
5486
|
}, [computedQuery]);
|
|
3463
5487
|
return matches;
|
|
3464
5488
|
}
|
|
3465
|
-
function useBreakpointValue(
|
|
5489
|
+
function useBreakpointValue(values2) {
|
|
3466
5490
|
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
3467
5491
|
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
3468
5492
|
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
3469
5493
|
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
3470
5494
|
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
3471
|
-
if (xl &&
|
|
3472
|
-
if (lg &&
|
|
3473
|
-
if (md &&
|
|
3474
|
-
if (sm &&
|
|
3475
|
-
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;
|
|
3476
5500
|
return void 0;
|
|
3477
5501
|
}
|
|
3478
5502
|
|
|
@@ -3588,6 +5612,8 @@ initTheme();
|
|
|
3588
5612
|
createVariants,
|
|
3589
5613
|
cx,
|
|
3590
5614
|
darken,
|
|
5615
|
+
date,
|
|
5616
|
+
dtx,
|
|
3591
5617
|
getContrast,
|
|
3592
5618
|
getCountryCodePhone,
|
|
3593
5619
|
getDialPhone,
|
|
@@ -3597,13 +5623,12 @@ initTheme();
|
|
|
3597
5623
|
hexToRgb,
|
|
3598
5624
|
initTheme,
|
|
3599
5625
|
inputCurrency,
|
|
3600
|
-
isEmpty,
|
|
3601
5626
|
lighten,
|
|
3602
5627
|
mergeDeep,
|
|
5628
|
+
mergeInitialProps,
|
|
3603
5629
|
normalizePhone,
|
|
3604
5630
|
rgbToHex,
|
|
3605
5631
|
text,
|
|
3606
|
-
times,
|
|
3607
5632
|
uiStyle,
|
|
3608
5633
|
useBackdrop,
|
|
3609
5634
|
useBreakpoint,
|
|
@@ -3613,5 +5638,6 @@ initTheme();
|
|
|
3613
5638
|
useMediaQuery,
|
|
3614
5639
|
useNotistack,
|
|
3615
5640
|
usePlaces,
|
|
3616
|
-
useTheme
|
|
5641
|
+
useTheme,
|
|
5642
|
+
utils
|
|
3617
5643
|
});
|