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