shadcn-zod-formkit 1.33.0 → 1.34.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/dist/index.cjs +41 -1590
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +40 -1589
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.34.1.tgz +0 -0
- package/package.json +5 -4
- package/dist/shadcn-zod-formkit-1.33.0.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ var sonner = require('sonner');
|
|
|
27
27
|
var SwitchPrimitive = require('@radix-ui/react-switch');
|
|
28
28
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
29
29
|
var cmdk = require('cmdk');
|
|
30
|
+
var dateFns = require('date-fns');
|
|
30
31
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
31
32
|
var SliderPrimitive = require('@radix-ui/react-slider');
|
|
32
33
|
var core = require('@dnd-kit/core');
|
|
@@ -204,16 +205,17 @@ var BaseInput = class {
|
|
|
204
205
|
this.isSubmitting = isSubmitting;
|
|
205
206
|
}
|
|
206
207
|
};
|
|
207
|
-
var entityToInputOption = (entitiy, name = "name", description = "description", groupedLabel) => ({
|
|
208
|
+
var entityToInputOption = (entitiy, name = "name", description = "description", groupedLabel, optionLabel = "label") => ({
|
|
208
209
|
id: entitiy["id"],
|
|
209
210
|
name: entitiy[name],
|
|
211
|
+
label: entitiy[optionLabel],
|
|
210
212
|
description: entitiy[description],
|
|
211
213
|
groupedLabel
|
|
212
214
|
});
|
|
213
|
-
var entitiesToInputOption = (data, optionValue = "name", groupedLabel) => {
|
|
215
|
+
var entitiesToInputOption = (data, optionValue = "name", groupedLabel, optionLabel = "description") => {
|
|
214
216
|
const entities = [];
|
|
215
217
|
for (const key of data) {
|
|
216
|
-
const entidad = entityToInputOption(key, optionValue,
|
|
218
|
+
const entidad = entityToInputOption(key, optionValue, optionLabel, groupedLabel);
|
|
217
219
|
if (entidad) entities.push(entidad);
|
|
218
220
|
}
|
|
219
221
|
return entities;
|
|
@@ -461,8 +463,8 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
461
463
|
);
|
|
462
464
|
function Button({
|
|
463
465
|
className,
|
|
464
|
-
variant,
|
|
465
|
-
size,
|
|
466
|
+
variant = "default",
|
|
467
|
+
size = "default",
|
|
466
468
|
asChild = false,
|
|
467
469
|
...props
|
|
468
470
|
}) {
|
|
@@ -471,6 +473,8 @@ function Button({
|
|
|
471
473
|
Comp,
|
|
472
474
|
{
|
|
473
475
|
"data-slot": "button",
|
|
476
|
+
"data-variant": variant,
|
|
477
|
+
"data-size": size,
|
|
474
478
|
className: cn(buttonVariants({ variant, size, className })),
|
|
475
479
|
...props
|
|
476
480
|
}
|
|
@@ -482,7 +486,7 @@ function Calendar({
|
|
|
482
486
|
showOutsideDays = true,
|
|
483
487
|
captionLayout = "label",
|
|
484
488
|
buttonVariant = "ghost",
|
|
485
|
-
formatters
|
|
489
|
+
formatters,
|
|
486
490
|
components,
|
|
487
491
|
...props
|
|
488
492
|
}) {
|
|
@@ -500,7 +504,7 @@ function Calendar({
|
|
|
500
504
|
captionLayout,
|
|
501
505
|
formatters: {
|
|
502
506
|
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
503
|
-
...
|
|
507
|
+
...formatters
|
|
504
508
|
},
|
|
505
509
|
classNames: {
|
|
506
510
|
root: cn("w-fit", defaultClassNames.root),
|
|
@@ -560,7 +564,8 @@ function Calendar({
|
|
|
560
564
|
defaultClassNames.week_number
|
|
561
565
|
),
|
|
562
566
|
day: cn(
|
|
563
|
-
"relative w-full h-full p-0 text-center [&:
|
|
567
|
+
"relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
568
|
+
props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
564
569
|
defaultClassNames.day
|
|
565
570
|
),
|
|
566
571
|
range_start: cn(
|
|
@@ -1929,7 +1934,7 @@ var GroupedSwitches = ({ options, onChange, input, isSubmitting }) => {
|
|
|
1929
1934
|
] })
|
|
1930
1935
|
] }),
|
|
1931
1936
|
switches.map((opt, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `p-2 rounded-lg flex flex-row w-full items-center justify-between ${!(index % 2) ? "bg-black/5" : "bg-white/5"}`, children: [
|
|
1932
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: String(opt.id), children: opt.label || opt.name }),
|
|
1937
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: String(opt.id), children: opt.label || opt.description || opt.name }),
|
|
1933
1938
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1934
1939
|
Switch,
|
|
1935
1940
|
{
|
|
@@ -2615,7 +2620,7 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
|
|
|
2615
2620
|
const iconValidState = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheck, { style: { color: "#00bf3e" } });
|
|
2616
2621
|
const iconInvalidState = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleX, { style: { color: "#ff8080" } });
|
|
2617
2622
|
const iconLoadingState = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
|
|
2618
|
-
const [
|
|
2623
|
+
const [isValid, setIsValid] = React3.useState(() => {
|
|
2619
2624
|
const value = form.getValues(input.name);
|
|
2620
2625
|
const fieldState = form.getFieldState(input.name);
|
|
2621
2626
|
return !fieldState.error && value !== void 0 && value !== "";
|
|
@@ -2675,7 +2680,7 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
|
|
|
2675
2680
|
name: input.name,
|
|
2676
2681
|
render: ({ field, fieldState }) => {
|
|
2677
2682
|
const validNow = !fieldState.error && field.value !== void 0 && field.value !== "";
|
|
2678
|
-
if (validNow !==
|
|
2683
|
+
if (validNow !== isValid) setIsValid(validNow);
|
|
2679
2684
|
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: input.className, children: [
|
|
2680
2685
|
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
2681
2686
|
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
@@ -2712,7 +2717,7 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
|
|
|
2712
2717
|
/* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
2713
2718
|
/* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: currencyFormat.currency }),
|
|
2714
2719
|
input.inputGroupConfig?.textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: input.inputGroupConfig.textRight }),
|
|
2715
|
-
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState :
|
|
2720
|
+
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
|
|
2716
2721
|
] })
|
|
2717
2722
|
] }) }),
|
|
2718
2723
|
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
|
|
@@ -2721,1562 +2726,6 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
|
|
|
2721
2726
|
}
|
|
2722
2727
|
);
|
|
2723
2728
|
};
|
|
2724
|
-
var millisecondsInWeek = 6048e5;
|
|
2725
|
-
var millisecondsInDay = 864e5;
|
|
2726
|
-
var constructFromSymbol = Symbol.for("constructDateFrom");
|
|
2727
|
-
|
|
2728
|
-
// node_modules/date-fns/constructFrom.js
|
|
2729
|
-
function constructFrom(date, value) {
|
|
2730
|
-
if (typeof date === "function") return date(value);
|
|
2731
|
-
if (date && typeof date === "object" && constructFromSymbol in date)
|
|
2732
|
-
return date[constructFromSymbol](value);
|
|
2733
|
-
if (date instanceof Date) return new date.constructor(value);
|
|
2734
|
-
return new Date(value);
|
|
2735
|
-
}
|
|
2736
|
-
|
|
2737
|
-
// node_modules/date-fns/toDate.js
|
|
2738
|
-
function toDate(argument, context) {
|
|
2739
|
-
return constructFrom(context || argument, argument);
|
|
2740
|
-
}
|
|
2741
|
-
|
|
2742
|
-
// node_modules/date-fns/_lib/defaultOptions.js
|
|
2743
|
-
var defaultOptions = {};
|
|
2744
|
-
function getDefaultOptions() {
|
|
2745
|
-
return defaultOptions;
|
|
2746
|
-
}
|
|
2747
|
-
|
|
2748
|
-
// node_modules/date-fns/startOfWeek.js
|
|
2749
|
-
function startOfWeek(date, options) {
|
|
2750
|
-
const defaultOptions2 = getDefaultOptions();
|
|
2751
|
-
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
|
|
2752
|
-
const _date = toDate(date, options?.in);
|
|
2753
|
-
const day = _date.getDay();
|
|
2754
|
-
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
2755
|
-
_date.setDate(_date.getDate() - diff);
|
|
2756
|
-
_date.setHours(0, 0, 0, 0);
|
|
2757
|
-
return _date;
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
// node_modules/date-fns/startOfISOWeek.js
|
|
2761
|
-
function startOfISOWeek(date, options) {
|
|
2762
|
-
return startOfWeek(date, { ...options, weekStartsOn: 1 });
|
|
2763
|
-
}
|
|
2764
|
-
|
|
2765
|
-
// node_modules/date-fns/getISOWeekYear.js
|
|
2766
|
-
function getISOWeekYear(date, options) {
|
|
2767
|
-
const _date = toDate(date, options?.in);
|
|
2768
|
-
const year = _date.getFullYear();
|
|
2769
|
-
const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
|
|
2770
|
-
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
2771
|
-
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
2772
|
-
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
2773
|
-
const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
|
|
2774
|
-
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
2775
|
-
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
2776
|
-
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
|
|
2777
|
-
if (_date.getTime() >= startOfNextYear.getTime()) {
|
|
2778
|
-
return year + 1;
|
|
2779
|
-
} else if (_date.getTime() >= startOfThisYear.getTime()) {
|
|
2780
|
-
return year;
|
|
2781
|
-
} else {
|
|
2782
|
-
return year - 1;
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
|
|
2786
|
-
// node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
|
|
2787
|
-
function getTimezoneOffsetInMilliseconds(date) {
|
|
2788
|
-
const _date = toDate(date);
|
|
2789
|
-
const utcDate = new Date(
|
|
2790
|
-
Date.UTC(
|
|
2791
|
-
_date.getFullYear(),
|
|
2792
|
-
_date.getMonth(),
|
|
2793
|
-
_date.getDate(),
|
|
2794
|
-
_date.getHours(),
|
|
2795
|
-
_date.getMinutes(),
|
|
2796
|
-
_date.getSeconds(),
|
|
2797
|
-
_date.getMilliseconds()
|
|
2798
|
-
)
|
|
2799
|
-
);
|
|
2800
|
-
utcDate.setUTCFullYear(_date.getFullYear());
|
|
2801
|
-
return +date - +utcDate;
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
// node_modules/date-fns/_lib/normalizeDates.js
|
|
2805
|
-
function normalizeDates(context, ...dates) {
|
|
2806
|
-
const normalize = constructFrom.bind(
|
|
2807
|
-
null,
|
|
2808
|
-
dates.find((date) => typeof date === "object")
|
|
2809
|
-
);
|
|
2810
|
-
return dates.map(normalize);
|
|
2811
|
-
}
|
|
2812
|
-
|
|
2813
|
-
// node_modules/date-fns/startOfDay.js
|
|
2814
|
-
function startOfDay(date, options) {
|
|
2815
|
-
const _date = toDate(date, options?.in);
|
|
2816
|
-
_date.setHours(0, 0, 0, 0);
|
|
2817
|
-
return _date;
|
|
2818
|
-
}
|
|
2819
|
-
|
|
2820
|
-
// node_modules/date-fns/differenceInCalendarDays.js
|
|
2821
|
-
function differenceInCalendarDays(laterDate, earlierDate, options) {
|
|
2822
|
-
const [laterDate_, earlierDate_] = normalizeDates(
|
|
2823
|
-
options?.in,
|
|
2824
|
-
laterDate,
|
|
2825
|
-
earlierDate
|
|
2826
|
-
);
|
|
2827
|
-
const laterStartOfDay = startOfDay(laterDate_);
|
|
2828
|
-
const earlierStartOfDay = startOfDay(earlierDate_);
|
|
2829
|
-
const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
|
|
2830
|
-
const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
|
|
2831
|
-
return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
|
2832
|
-
}
|
|
2833
|
-
|
|
2834
|
-
// node_modules/date-fns/startOfISOWeekYear.js
|
|
2835
|
-
function startOfISOWeekYear(date, options) {
|
|
2836
|
-
const year = getISOWeekYear(date, options);
|
|
2837
|
-
const fourthOfJanuary = constructFrom(date, 0);
|
|
2838
|
-
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
2839
|
-
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
2840
|
-
return startOfISOWeek(fourthOfJanuary);
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
// node_modules/date-fns/isDate.js
|
|
2844
|
-
function isDate(value) {
|
|
2845
|
-
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
2846
|
-
}
|
|
2847
|
-
|
|
2848
|
-
// node_modules/date-fns/isValid.js
|
|
2849
|
-
function isValid(date) {
|
|
2850
|
-
return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
// node_modules/date-fns/startOfYear.js
|
|
2854
|
-
function startOfYear(date, options) {
|
|
2855
|
-
const date_ = toDate(date, options?.in);
|
|
2856
|
-
date_.setFullYear(date_.getFullYear(), 0, 1);
|
|
2857
|
-
date_.setHours(0, 0, 0, 0);
|
|
2858
|
-
return date_;
|
|
2859
|
-
}
|
|
2860
|
-
|
|
2861
|
-
// node_modules/date-fns/locale/en-US/_lib/formatDistance.js
|
|
2862
|
-
var formatDistanceLocale = {
|
|
2863
|
-
lessThanXSeconds: {
|
|
2864
|
-
one: "less than a second",
|
|
2865
|
-
other: "less than {{count}} seconds"
|
|
2866
|
-
},
|
|
2867
|
-
xSeconds: {
|
|
2868
|
-
one: "1 second",
|
|
2869
|
-
other: "{{count}} seconds"
|
|
2870
|
-
},
|
|
2871
|
-
halfAMinute: "half a minute",
|
|
2872
|
-
lessThanXMinutes: {
|
|
2873
|
-
one: "less than a minute",
|
|
2874
|
-
other: "less than {{count}} minutes"
|
|
2875
|
-
},
|
|
2876
|
-
xMinutes: {
|
|
2877
|
-
one: "1 minute",
|
|
2878
|
-
other: "{{count}} minutes"
|
|
2879
|
-
},
|
|
2880
|
-
aboutXHours: {
|
|
2881
|
-
one: "about 1 hour",
|
|
2882
|
-
other: "about {{count}} hours"
|
|
2883
|
-
},
|
|
2884
|
-
xHours: {
|
|
2885
|
-
one: "1 hour",
|
|
2886
|
-
other: "{{count}} hours"
|
|
2887
|
-
},
|
|
2888
|
-
xDays: {
|
|
2889
|
-
one: "1 day",
|
|
2890
|
-
other: "{{count}} days"
|
|
2891
|
-
},
|
|
2892
|
-
aboutXWeeks: {
|
|
2893
|
-
one: "about 1 week",
|
|
2894
|
-
other: "about {{count}} weeks"
|
|
2895
|
-
},
|
|
2896
|
-
xWeeks: {
|
|
2897
|
-
one: "1 week",
|
|
2898
|
-
other: "{{count}} weeks"
|
|
2899
|
-
},
|
|
2900
|
-
aboutXMonths: {
|
|
2901
|
-
one: "about 1 month",
|
|
2902
|
-
other: "about {{count}} months"
|
|
2903
|
-
},
|
|
2904
|
-
xMonths: {
|
|
2905
|
-
one: "1 month",
|
|
2906
|
-
other: "{{count}} months"
|
|
2907
|
-
},
|
|
2908
|
-
aboutXYears: {
|
|
2909
|
-
one: "about 1 year",
|
|
2910
|
-
other: "about {{count}} years"
|
|
2911
|
-
},
|
|
2912
|
-
xYears: {
|
|
2913
|
-
one: "1 year",
|
|
2914
|
-
other: "{{count}} years"
|
|
2915
|
-
},
|
|
2916
|
-
overXYears: {
|
|
2917
|
-
one: "over 1 year",
|
|
2918
|
-
other: "over {{count}} years"
|
|
2919
|
-
},
|
|
2920
|
-
almostXYears: {
|
|
2921
|
-
one: "almost 1 year",
|
|
2922
|
-
other: "almost {{count}} years"
|
|
2923
|
-
}
|
|
2924
|
-
};
|
|
2925
|
-
var formatDistance = (token, count, options) => {
|
|
2926
|
-
let result;
|
|
2927
|
-
const tokenValue = formatDistanceLocale[token];
|
|
2928
|
-
if (typeof tokenValue === "string") {
|
|
2929
|
-
result = tokenValue;
|
|
2930
|
-
} else if (count === 1) {
|
|
2931
|
-
result = tokenValue.one;
|
|
2932
|
-
} else {
|
|
2933
|
-
result = tokenValue.other.replace("{{count}}", count.toString());
|
|
2934
|
-
}
|
|
2935
|
-
if (options?.addSuffix) {
|
|
2936
|
-
if (options.comparison && options.comparison > 0) {
|
|
2937
|
-
return "in " + result;
|
|
2938
|
-
} else {
|
|
2939
|
-
return result + " ago";
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
return result;
|
|
2943
|
-
};
|
|
2944
|
-
|
|
2945
|
-
// node_modules/date-fns/locale/_lib/buildFormatLongFn.js
|
|
2946
|
-
function buildFormatLongFn(args) {
|
|
2947
|
-
return (options = {}) => {
|
|
2948
|
-
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
2949
|
-
const format2 = args.formats[width] || args.formats[args.defaultWidth];
|
|
2950
|
-
return format2;
|
|
2951
|
-
};
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2954
|
-
// node_modules/date-fns/locale/en-US/_lib/formatLong.js
|
|
2955
|
-
var dateFormats = {
|
|
2956
|
-
full: "EEEE, MMMM do, y",
|
|
2957
|
-
long: "MMMM do, y",
|
|
2958
|
-
medium: "MMM d, y",
|
|
2959
|
-
short: "MM/dd/yyyy"
|
|
2960
|
-
};
|
|
2961
|
-
var timeFormats = {
|
|
2962
|
-
full: "h:mm:ss a zzzz",
|
|
2963
|
-
long: "h:mm:ss a z",
|
|
2964
|
-
medium: "h:mm:ss a",
|
|
2965
|
-
short: "h:mm a"
|
|
2966
|
-
};
|
|
2967
|
-
var dateTimeFormats = {
|
|
2968
|
-
full: "{{date}} 'at' {{time}}",
|
|
2969
|
-
long: "{{date}} 'at' {{time}}",
|
|
2970
|
-
medium: "{{date}}, {{time}}",
|
|
2971
|
-
short: "{{date}}, {{time}}"
|
|
2972
|
-
};
|
|
2973
|
-
var formatLong = {
|
|
2974
|
-
date: buildFormatLongFn({
|
|
2975
|
-
formats: dateFormats,
|
|
2976
|
-
defaultWidth: "full"
|
|
2977
|
-
}),
|
|
2978
|
-
time: buildFormatLongFn({
|
|
2979
|
-
formats: timeFormats,
|
|
2980
|
-
defaultWidth: "full"
|
|
2981
|
-
}),
|
|
2982
|
-
dateTime: buildFormatLongFn({
|
|
2983
|
-
formats: dateTimeFormats,
|
|
2984
|
-
defaultWidth: "full"
|
|
2985
|
-
})
|
|
2986
|
-
};
|
|
2987
|
-
|
|
2988
|
-
// node_modules/date-fns/locale/en-US/_lib/formatRelative.js
|
|
2989
|
-
var formatRelativeLocale = {
|
|
2990
|
-
lastWeek: "'last' eeee 'at' p",
|
|
2991
|
-
yesterday: "'yesterday at' p",
|
|
2992
|
-
today: "'today at' p",
|
|
2993
|
-
tomorrow: "'tomorrow at' p",
|
|
2994
|
-
nextWeek: "eeee 'at' p",
|
|
2995
|
-
other: "P"
|
|
2996
|
-
};
|
|
2997
|
-
var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
|
|
2998
|
-
|
|
2999
|
-
// node_modules/date-fns/locale/_lib/buildLocalizeFn.js
|
|
3000
|
-
function buildLocalizeFn(args) {
|
|
3001
|
-
return (value, options) => {
|
|
3002
|
-
const context = options?.context ? String(options.context) : "standalone";
|
|
3003
|
-
let valuesArray;
|
|
3004
|
-
if (context === "formatting" && args.formattingValues) {
|
|
3005
|
-
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
3006
|
-
const width = options?.width ? String(options.width) : defaultWidth;
|
|
3007
|
-
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
3008
|
-
} else {
|
|
3009
|
-
const defaultWidth = args.defaultWidth;
|
|
3010
|
-
const width = options?.width ? String(options.width) : args.defaultWidth;
|
|
3011
|
-
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
3012
|
-
}
|
|
3013
|
-
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
3014
|
-
return valuesArray[index];
|
|
3015
|
-
};
|
|
3016
|
-
}
|
|
3017
|
-
|
|
3018
|
-
// node_modules/date-fns/locale/en-US/_lib/localize.js
|
|
3019
|
-
var eraValues = {
|
|
3020
|
-
narrow: ["B", "A"],
|
|
3021
|
-
abbreviated: ["BC", "AD"],
|
|
3022
|
-
wide: ["Before Christ", "Anno Domini"]
|
|
3023
|
-
};
|
|
3024
|
-
var quarterValues = {
|
|
3025
|
-
narrow: ["1", "2", "3", "4"],
|
|
3026
|
-
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
3027
|
-
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
3028
|
-
};
|
|
3029
|
-
var monthValues = {
|
|
3030
|
-
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
3031
|
-
abbreviated: [
|
|
3032
|
-
"Jan",
|
|
3033
|
-
"Feb",
|
|
3034
|
-
"Mar",
|
|
3035
|
-
"Apr",
|
|
3036
|
-
"May",
|
|
3037
|
-
"Jun",
|
|
3038
|
-
"Jul",
|
|
3039
|
-
"Aug",
|
|
3040
|
-
"Sep",
|
|
3041
|
-
"Oct",
|
|
3042
|
-
"Nov",
|
|
3043
|
-
"Dec"
|
|
3044
|
-
],
|
|
3045
|
-
wide: [
|
|
3046
|
-
"January",
|
|
3047
|
-
"February",
|
|
3048
|
-
"March",
|
|
3049
|
-
"April",
|
|
3050
|
-
"May",
|
|
3051
|
-
"June",
|
|
3052
|
-
"July",
|
|
3053
|
-
"August",
|
|
3054
|
-
"September",
|
|
3055
|
-
"October",
|
|
3056
|
-
"November",
|
|
3057
|
-
"December"
|
|
3058
|
-
]
|
|
3059
|
-
};
|
|
3060
|
-
var dayValues = {
|
|
3061
|
-
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
3062
|
-
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
3063
|
-
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
3064
|
-
wide: [
|
|
3065
|
-
"Sunday",
|
|
3066
|
-
"Monday",
|
|
3067
|
-
"Tuesday",
|
|
3068
|
-
"Wednesday",
|
|
3069
|
-
"Thursday",
|
|
3070
|
-
"Friday",
|
|
3071
|
-
"Saturday"
|
|
3072
|
-
]
|
|
3073
|
-
};
|
|
3074
|
-
var dayPeriodValues = {
|
|
3075
|
-
narrow: {
|
|
3076
|
-
am: "a",
|
|
3077
|
-
pm: "p",
|
|
3078
|
-
midnight: "mi",
|
|
3079
|
-
noon: "n",
|
|
3080
|
-
morning: "morning",
|
|
3081
|
-
afternoon: "afternoon",
|
|
3082
|
-
evening: "evening",
|
|
3083
|
-
night: "night"
|
|
3084
|
-
},
|
|
3085
|
-
abbreviated: {
|
|
3086
|
-
am: "AM",
|
|
3087
|
-
pm: "PM",
|
|
3088
|
-
midnight: "midnight",
|
|
3089
|
-
noon: "noon",
|
|
3090
|
-
morning: "morning",
|
|
3091
|
-
afternoon: "afternoon",
|
|
3092
|
-
evening: "evening",
|
|
3093
|
-
night: "night"
|
|
3094
|
-
},
|
|
3095
|
-
wide: {
|
|
3096
|
-
am: "a.m.",
|
|
3097
|
-
pm: "p.m.",
|
|
3098
|
-
midnight: "midnight",
|
|
3099
|
-
noon: "noon",
|
|
3100
|
-
morning: "morning",
|
|
3101
|
-
afternoon: "afternoon",
|
|
3102
|
-
evening: "evening",
|
|
3103
|
-
night: "night"
|
|
3104
|
-
}
|
|
3105
|
-
};
|
|
3106
|
-
var formattingDayPeriodValues = {
|
|
3107
|
-
narrow: {
|
|
3108
|
-
am: "a",
|
|
3109
|
-
pm: "p",
|
|
3110
|
-
midnight: "mi",
|
|
3111
|
-
noon: "n",
|
|
3112
|
-
morning: "in the morning",
|
|
3113
|
-
afternoon: "in the afternoon",
|
|
3114
|
-
evening: "in the evening",
|
|
3115
|
-
night: "at night"
|
|
3116
|
-
},
|
|
3117
|
-
abbreviated: {
|
|
3118
|
-
am: "AM",
|
|
3119
|
-
pm: "PM",
|
|
3120
|
-
midnight: "midnight",
|
|
3121
|
-
noon: "noon",
|
|
3122
|
-
morning: "in the morning",
|
|
3123
|
-
afternoon: "in the afternoon",
|
|
3124
|
-
evening: "in the evening",
|
|
3125
|
-
night: "at night"
|
|
3126
|
-
},
|
|
3127
|
-
wide: {
|
|
3128
|
-
am: "a.m.",
|
|
3129
|
-
pm: "p.m.",
|
|
3130
|
-
midnight: "midnight",
|
|
3131
|
-
noon: "noon",
|
|
3132
|
-
morning: "in the morning",
|
|
3133
|
-
afternoon: "in the afternoon",
|
|
3134
|
-
evening: "in the evening",
|
|
3135
|
-
night: "at night"
|
|
3136
|
-
}
|
|
3137
|
-
};
|
|
3138
|
-
var ordinalNumber = (dirtyNumber, _options) => {
|
|
3139
|
-
const number = Number(dirtyNumber);
|
|
3140
|
-
const rem100 = number % 100;
|
|
3141
|
-
if (rem100 > 20 || rem100 < 10) {
|
|
3142
|
-
switch (rem100 % 10) {
|
|
3143
|
-
case 1:
|
|
3144
|
-
return number + "st";
|
|
3145
|
-
case 2:
|
|
3146
|
-
return number + "nd";
|
|
3147
|
-
case 3:
|
|
3148
|
-
return number + "rd";
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
return number + "th";
|
|
3152
|
-
};
|
|
3153
|
-
var localize = {
|
|
3154
|
-
ordinalNumber,
|
|
3155
|
-
era: buildLocalizeFn({
|
|
3156
|
-
values: eraValues,
|
|
3157
|
-
defaultWidth: "wide"
|
|
3158
|
-
}),
|
|
3159
|
-
quarter: buildLocalizeFn({
|
|
3160
|
-
values: quarterValues,
|
|
3161
|
-
defaultWidth: "wide",
|
|
3162
|
-
argumentCallback: (quarter) => quarter - 1
|
|
3163
|
-
}),
|
|
3164
|
-
month: buildLocalizeFn({
|
|
3165
|
-
values: monthValues,
|
|
3166
|
-
defaultWidth: "wide"
|
|
3167
|
-
}),
|
|
3168
|
-
day: buildLocalizeFn({
|
|
3169
|
-
values: dayValues,
|
|
3170
|
-
defaultWidth: "wide"
|
|
3171
|
-
}),
|
|
3172
|
-
dayPeriod: buildLocalizeFn({
|
|
3173
|
-
values: dayPeriodValues,
|
|
3174
|
-
defaultWidth: "wide",
|
|
3175
|
-
formattingValues: formattingDayPeriodValues,
|
|
3176
|
-
defaultFormattingWidth: "wide"
|
|
3177
|
-
})
|
|
3178
|
-
};
|
|
3179
|
-
|
|
3180
|
-
// node_modules/date-fns/locale/_lib/buildMatchFn.js
|
|
3181
|
-
function buildMatchFn(args) {
|
|
3182
|
-
return (string, options = {}) => {
|
|
3183
|
-
const width = options.width;
|
|
3184
|
-
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
3185
|
-
const matchResult = string.match(matchPattern);
|
|
3186
|
-
if (!matchResult) {
|
|
3187
|
-
return null;
|
|
3188
|
-
}
|
|
3189
|
-
const matchedString = matchResult[0];
|
|
3190
|
-
const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
3191
|
-
const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
|
|
3192
|
-
// [TODO] -- I challenge you to fix the type
|
|
3193
|
-
findKey(parsePatterns, (pattern) => pattern.test(matchedString))
|
|
3194
|
-
);
|
|
3195
|
-
let value;
|
|
3196
|
-
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
3197
|
-
value = options.valueCallback ? (
|
|
3198
|
-
// [TODO] -- I challenge you to fix the type
|
|
3199
|
-
options.valueCallback(value)
|
|
3200
|
-
) : value;
|
|
3201
|
-
const rest = string.slice(matchedString.length);
|
|
3202
|
-
return { value, rest };
|
|
3203
|
-
};
|
|
3204
|
-
}
|
|
3205
|
-
function findKey(object, predicate) {
|
|
3206
|
-
for (const key in object) {
|
|
3207
|
-
if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
|
|
3208
|
-
return key;
|
|
3209
|
-
}
|
|
3210
|
-
}
|
|
3211
|
-
return void 0;
|
|
3212
|
-
}
|
|
3213
|
-
function findIndex(array, predicate) {
|
|
3214
|
-
for (let key = 0; key < array.length; key++) {
|
|
3215
|
-
if (predicate(array[key])) {
|
|
3216
|
-
return key;
|
|
3217
|
-
}
|
|
3218
|
-
}
|
|
3219
|
-
return void 0;
|
|
3220
|
-
}
|
|
3221
|
-
|
|
3222
|
-
// node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
|
|
3223
|
-
function buildMatchPatternFn(args) {
|
|
3224
|
-
return (string, options = {}) => {
|
|
3225
|
-
const matchResult = string.match(args.matchPattern);
|
|
3226
|
-
if (!matchResult) return null;
|
|
3227
|
-
const matchedString = matchResult[0];
|
|
3228
|
-
const parseResult = string.match(args.parsePattern);
|
|
3229
|
-
if (!parseResult) return null;
|
|
3230
|
-
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
3231
|
-
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
3232
|
-
const rest = string.slice(matchedString.length);
|
|
3233
|
-
return { value, rest };
|
|
3234
|
-
};
|
|
3235
|
-
}
|
|
3236
|
-
|
|
3237
|
-
// node_modules/date-fns/locale/en-US/_lib/match.js
|
|
3238
|
-
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
3239
|
-
var parseOrdinalNumberPattern = /\d+/i;
|
|
3240
|
-
var matchEraPatterns = {
|
|
3241
|
-
narrow: /^(b|a)/i,
|
|
3242
|
-
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
3243
|
-
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
3244
|
-
};
|
|
3245
|
-
var parseEraPatterns = {
|
|
3246
|
-
any: [/^b/i, /^(a|c)/i]
|
|
3247
|
-
};
|
|
3248
|
-
var matchQuarterPatterns = {
|
|
3249
|
-
narrow: /^[1234]/i,
|
|
3250
|
-
abbreviated: /^q[1234]/i,
|
|
3251
|
-
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
3252
|
-
};
|
|
3253
|
-
var parseQuarterPatterns = {
|
|
3254
|
-
any: [/1/i, /2/i, /3/i, /4/i]
|
|
3255
|
-
};
|
|
3256
|
-
var matchMonthPatterns = {
|
|
3257
|
-
narrow: /^[jfmasond]/i,
|
|
3258
|
-
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
3259
|
-
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
3260
|
-
};
|
|
3261
|
-
var parseMonthPatterns = {
|
|
3262
|
-
narrow: [
|
|
3263
|
-
/^j/i,
|
|
3264
|
-
/^f/i,
|
|
3265
|
-
/^m/i,
|
|
3266
|
-
/^a/i,
|
|
3267
|
-
/^m/i,
|
|
3268
|
-
/^j/i,
|
|
3269
|
-
/^j/i,
|
|
3270
|
-
/^a/i,
|
|
3271
|
-
/^s/i,
|
|
3272
|
-
/^o/i,
|
|
3273
|
-
/^n/i,
|
|
3274
|
-
/^d/i
|
|
3275
|
-
],
|
|
3276
|
-
any: [
|
|
3277
|
-
/^ja/i,
|
|
3278
|
-
/^f/i,
|
|
3279
|
-
/^mar/i,
|
|
3280
|
-
/^ap/i,
|
|
3281
|
-
/^may/i,
|
|
3282
|
-
/^jun/i,
|
|
3283
|
-
/^jul/i,
|
|
3284
|
-
/^au/i,
|
|
3285
|
-
/^s/i,
|
|
3286
|
-
/^o/i,
|
|
3287
|
-
/^n/i,
|
|
3288
|
-
/^d/i
|
|
3289
|
-
]
|
|
3290
|
-
};
|
|
3291
|
-
var matchDayPatterns = {
|
|
3292
|
-
narrow: /^[smtwf]/i,
|
|
3293
|
-
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
3294
|
-
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
3295
|
-
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
3296
|
-
};
|
|
3297
|
-
var parseDayPatterns = {
|
|
3298
|
-
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
3299
|
-
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
3300
|
-
};
|
|
3301
|
-
var matchDayPeriodPatterns = {
|
|
3302
|
-
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
3303
|
-
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
3304
|
-
};
|
|
3305
|
-
var parseDayPeriodPatterns = {
|
|
3306
|
-
any: {
|
|
3307
|
-
am: /^a/i,
|
|
3308
|
-
pm: /^p/i,
|
|
3309
|
-
midnight: /^mi/i,
|
|
3310
|
-
noon: /^no/i,
|
|
3311
|
-
morning: /morning/i,
|
|
3312
|
-
afternoon: /afternoon/i,
|
|
3313
|
-
evening: /evening/i,
|
|
3314
|
-
night: /night/i
|
|
3315
|
-
}
|
|
3316
|
-
};
|
|
3317
|
-
var match = {
|
|
3318
|
-
ordinalNumber: buildMatchPatternFn({
|
|
3319
|
-
matchPattern: matchOrdinalNumberPattern,
|
|
3320
|
-
parsePattern: parseOrdinalNumberPattern,
|
|
3321
|
-
valueCallback: (value) => parseInt(value, 10)
|
|
3322
|
-
}),
|
|
3323
|
-
era: buildMatchFn({
|
|
3324
|
-
matchPatterns: matchEraPatterns,
|
|
3325
|
-
defaultMatchWidth: "wide",
|
|
3326
|
-
parsePatterns: parseEraPatterns,
|
|
3327
|
-
defaultParseWidth: "any"
|
|
3328
|
-
}),
|
|
3329
|
-
quarter: buildMatchFn({
|
|
3330
|
-
matchPatterns: matchQuarterPatterns,
|
|
3331
|
-
defaultMatchWidth: "wide",
|
|
3332
|
-
parsePatterns: parseQuarterPatterns,
|
|
3333
|
-
defaultParseWidth: "any",
|
|
3334
|
-
valueCallback: (index) => index + 1
|
|
3335
|
-
}),
|
|
3336
|
-
month: buildMatchFn({
|
|
3337
|
-
matchPatterns: matchMonthPatterns,
|
|
3338
|
-
defaultMatchWidth: "wide",
|
|
3339
|
-
parsePatterns: parseMonthPatterns,
|
|
3340
|
-
defaultParseWidth: "any"
|
|
3341
|
-
}),
|
|
3342
|
-
day: buildMatchFn({
|
|
3343
|
-
matchPatterns: matchDayPatterns,
|
|
3344
|
-
defaultMatchWidth: "wide",
|
|
3345
|
-
parsePatterns: parseDayPatterns,
|
|
3346
|
-
defaultParseWidth: "any"
|
|
3347
|
-
}),
|
|
3348
|
-
dayPeriod: buildMatchFn({
|
|
3349
|
-
matchPatterns: matchDayPeriodPatterns,
|
|
3350
|
-
defaultMatchWidth: "any",
|
|
3351
|
-
parsePatterns: parseDayPeriodPatterns,
|
|
3352
|
-
defaultParseWidth: "any"
|
|
3353
|
-
})
|
|
3354
|
-
};
|
|
3355
|
-
|
|
3356
|
-
// node_modules/date-fns/locale/en-US.js
|
|
3357
|
-
var enUS = {
|
|
3358
|
-
code: "en-US",
|
|
3359
|
-
formatDistance,
|
|
3360
|
-
formatLong,
|
|
3361
|
-
formatRelative,
|
|
3362
|
-
localize,
|
|
3363
|
-
match,
|
|
3364
|
-
options: {
|
|
3365
|
-
weekStartsOn: 0,
|
|
3366
|
-
firstWeekContainsDate: 1
|
|
3367
|
-
}
|
|
3368
|
-
};
|
|
3369
|
-
|
|
3370
|
-
// node_modules/date-fns/getDayOfYear.js
|
|
3371
|
-
function getDayOfYear(date, options) {
|
|
3372
|
-
const _date = toDate(date, options?.in);
|
|
3373
|
-
const diff = differenceInCalendarDays(_date, startOfYear(_date));
|
|
3374
|
-
const dayOfYear = diff + 1;
|
|
3375
|
-
return dayOfYear;
|
|
3376
|
-
}
|
|
3377
|
-
|
|
3378
|
-
// node_modules/date-fns/getISOWeek.js
|
|
3379
|
-
function getISOWeek(date, options) {
|
|
3380
|
-
const _date = toDate(date, options?.in);
|
|
3381
|
-
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
|
3382
|
-
return Math.round(diff / millisecondsInWeek) + 1;
|
|
3383
|
-
}
|
|
3384
|
-
|
|
3385
|
-
// node_modules/date-fns/getWeekYear.js
|
|
3386
|
-
function getWeekYear(date, options) {
|
|
3387
|
-
const _date = toDate(date, options?.in);
|
|
3388
|
-
const year = _date.getFullYear();
|
|
3389
|
-
const defaultOptions2 = getDefaultOptions();
|
|
3390
|
-
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
3391
|
-
const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
|
|
3392
|
-
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
|
3393
|
-
firstWeekOfNextYear.setHours(0, 0, 0, 0);
|
|
3394
|
-
const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
|
|
3395
|
-
const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
|
|
3396
|
-
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
|
|
3397
|
-
firstWeekOfThisYear.setHours(0, 0, 0, 0);
|
|
3398
|
-
const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
|
|
3399
|
-
if (+_date >= +startOfNextYear) {
|
|
3400
|
-
return year + 1;
|
|
3401
|
-
} else if (+_date >= +startOfThisYear) {
|
|
3402
|
-
return year;
|
|
3403
|
-
} else {
|
|
3404
|
-
return year - 1;
|
|
3405
|
-
}
|
|
3406
|
-
}
|
|
3407
|
-
|
|
3408
|
-
// node_modules/date-fns/startOfWeekYear.js
|
|
3409
|
-
function startOfWeekYear(date, options) {
|
|
3410
|
-
const defaultOptions2 = getDefaultOptions();
|
|
3411
|
-
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
3412
|
-
const year = getWeekYear(date, options);
|
|
3413
|
-
const firstWeek = constructFrom(options?.in || date, 0);
|
|
3414
|
-
firstWeek.setFullYear(year, 0, firstWeekContainsDate);
|
|
3415
|
-
firstWeek.setHours(0, 0, 0, 0);
|
|
3416
|
-
const _date = startOfWeek(firstWeek, options);
|
|
3417
|
-
return _date;
|
|
3418
|
-
}
|
|
3419
|
-
|
|
3420
|
-
// node_modules/date-fns/getWeek.js
|
|
3421
|
-
function getWeek(date, options) {
|
|
3422
|
-
const _date = toDate(date, options?.in);
|
|
3423
|
-
const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
|
|
3424
|
-
return Math.round(diff / millisecondsInWeek) + 1;
|
|
3425
|
-
}
|
|
3426
|
-
|
|
3427
|
-
// node_modules/date-fns/_lib/addLeadingZeros.js
|
|
3428
|
-
function addLeadingZeros(number, targetLength) {
|
|
3429
|
-
const sign = number < 0 ? "-" : "";
|
|
3430
|
-
const output = Math.abs(number).toString().padStart(targetLength, "0");
|
|
3431
|
-
return sign + output;
|
|
3432
|
-
}
|
|
3433
|
-
|
|
3434
|
-
// node_modules/date-fns/_lib/format/lightFormatters.js
|
|
3435
|
-
var lightFormatters = {
|
|
3436
|
-
// Year
|
|
3437
|
-
y(date, token) {
|
|
3438
|
-
const signedYear = date.getFullYear();
|
|
3439
|
-
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
3440
|
-
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
3441
|
-
},
|
|
3442
|
-
// Month
|
|
3443
|
-
M(date, token) {
|
|
3444
|
-
const month = date.getMonth();
|
|
3445
|
-
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
3446
|
-
},
|
|
3447
|
-
// Day of the month
|
|
3448
|
-
d(date, token) {
|
|
3449
|
-
return addLeadingZeros(date.getDate(), token.length);
|
|
3450
|
-
},
|
|
3451
|
-
// AM or PM
|
|
3452
|
-
a(date, token) {
|
|
3453
|
-
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
3454
|
-
switch (token) {
|
|
3455
|
-
case "a":
|
|
3456
|
-
case "aa":
|
|
3457
|
-
return dayPeriodEnumValue.toUpperCase();
|
|
3458
|
-
case "aaa":
|
|
3459
|
-
return dayPeriodEnumValue;
|
|
3460
|
-
case "aaaaa":
|
|
3461
|
-
return dayPeriodEnumValue[0];
|
|
3462
|
-
case "aaaa":
|
|
3463
|
-
default:
|
|
3464
|
-
return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
|
3465
|
-
}
|
|
3466
|
-
},
|
|
3467
|
-
// Hour [1-12]
|
|
3468
|
-
h(date, token) {
|
|
3469
|
-
return addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
3470
|
-
},
|
|
3471
|
-
// Hour [0-23]
|
|
3472
|
-
H(date, token) {
|
|
3473
|
-
return addLeadingZeros(date.getHours(), token.length);
|
|
3474
|
-
},
|
|
3475
|
-
// Minute
|
|
3476
|
-
m(date, token) {
|
|
3477
|
-
return addLeadingZeros(date.getMinutes(), token.length);
|
|
3478
|
-
},
|
|
3479
|
-
// Second
|
|
3480
|
-
s(date, token) {
|
|
3481
|
-
return addLeadingZeros(date.getSeconds(), token.length);
|
|
3482
|
-
},
|
|
3483
|
-
// Fraction of second
|
|
3484
|
-
S(date, token) {
|
|
3485
|
-
const numberOfDigits = token.length;
|
|
3486
|
-
const milliseconds = date.getMilliseconds();
|
|
3487
|
-
const fractionalSeconds = Math.trunc(
|
|
3488
|
-
milliseconds * Math.pow(10, numberOfDigits - 3)
|
|
3489
|
-
);
|
|
3490
|
-
return addLeadingZeros(fractionalSeconds, token.length);
|
|
3491
|
-
}
|
|
3492
|
-
};
|
|
3493
|
-
|
|
3494
|
-
// node_modules/date-fns/_lib/format/formatters.js
|
|
3495
|
-
var dayPeriodEnum = {
|
|
3496
|
-
midnight: "midnight",
|
|
3497
|
-
noon: "noon",
|
|
3498
|
-
morning: "morning",
|
|
3499
|
-
afternoon: "afternoon",
|
|
3500
|
-
evening: "evening",
|
|
3501
|
-
night: "night"
|
|
3502
|
-
};
|
|
3503
|
-
var formatters = {
|
|
3504
|
-
// Era
|
|
3505
|
-
G: function(date, token, localize2) {
|
|
3506
|
-
const era = date.getFullYear() > 0 ? 1 : 0;
|
|
3507
|
-
switch (token) {
|
|
3508
|
-
// AD, BC
|
|
3509
|
-
case "G":
|
|
3510
|
-
case "GG":
|
|
3511
|
-
case "GGG":
|
|
3512
|
-
return localize2.era(era, { width: "abbreviated" });
|
|
3513
|
-
// A, B
|
|
3514
|
-
case "GGGGG":
|
|
3515
|
-
return localize2.era(era, { width: "narrow" });
|
|
3516
|
-
// Anno Domini, Before Christ
|
|
3517
|
-
case "GGGG":
|
|
3518
|
-
default:
|
|
3519
|
-
return localize2.era(era, { width: "wide" });
|
|
3520
|
-
}
|
|
3521
|
-
},
|
|
3522
|
-
// Year
|
|
3523
|
-
y: function(date, token, localize2) {
|
|
3524
|
-
if (token === "yo") {
|
|
3525
|
-
const signedYear = date.getFullYear();
|
|
3526
|
-
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
3527
|
-
return localize2.ordinalNumber(year, { unit: "year" });
|
|
3528
|
-
}
|
|
3529
|
-
return lightFormatters.y(date, token);
|
|
3530
|
-
},
|
|
3531
|
-
// Local week-numbering year
|
|
3532
|
-
Y: function(date, token, localize2, options) {
|
|
3533
|
-
const signedWeekYear = getWeekYear(date, options);
|
|
3534
|
-
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
3535
|
-
if (token === "YY") {
|
|
3536
|
-
const twoDigitYear = weekYear % 100;
|
|
3537
|
-
return addLeadingZeros(twoDigitYear, 2);
|
|
3538
|
-
}
|
|
3539
|
-
if (token === "Yo") {
|
|
3540
|
-
return localize2.ordinalNumber(weekYear, { unit: "year" });
|
|
3541
|
-
}
|
|
3542
|
-
return addLeadingZeros(weekYear, token.length);
|
|
3543
|
-
},
|
|
3544
|
-
// ISO week-numbering year
|
|
3545
|
-
R: function(date, token) {
|
|
3546
|
-
const isoWeekYear = getISOWeekYear(date);
|
|
3547
|
-
return addLeadingZeros(isoWeekYear, token.length);
|
|
3548
|
-
},
|
|
3549
|
-
// Extended year. This is a single number designating the year of this calendar system.
|
|
3550
|
-
// The main difference between `y` and `u` localizers are B.C. years:
|
|
3551
|
-
// | Year | `y` | `u` |
|
|
3552
|
-
// |------|-----|-----|
|
|
3553
|
-
// | AC 1 | 1 | 1 |
|
|
3554
|
-
// | BC 1 | 1 | 0 |
|
|
3555
|
-
// | BC 2 | 2 | -1 |
|
|
3556
|
-
// Also `yy` always returns the last two digits of a year,
|
|
3557
|
-
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
3558
|
-
u: function(date, token) {
|
|
3559
|
-
const year = date.getFullYear();
|
|
3560
|
-
return addLeadingZeros(year, token.length);
|
|
3561
|
-
},
|
|
3562
|
-
// Quarter
|
|
3563
|
-
Q: function(date, token, localize2) {
|
|
3564
|
-
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
3565
|
-
switch (token) {
|
|
3566
|
-
// 1, 2, 3, 4
|
|
3567
|
-
case "Q":
|
|
3568
|
-
return String(quarter);
|
|
3569
|
-
// 01, 02, 03, 04
|
|
3570
|
-
case "QQ":
|
|
3571
|
-
return addLeadingZeros(quarter, 2);
|
|
3572
|
-
// 1st, 2nd, 3rd, 4th
|
|
3573
|
-
case "Qo":
|
|
3574
|
-
return localize2.ordinalNumber(quarter, { unit: "quarter" });
|
|
3575
|
-
// Q1, Q2, Q3, Q4
|
|
3576
|
-
case "QQQ":
|
|
3577
|
-
return localize2.quarter(quarter, {
|
|
3578
|
-
width: "abbreviated",
|
|
3579
|
-
context: "formatting"
|
|
3580
|
-
});
|
|
3581
|
-
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
3582
|
-
case "QQQQQ":
|
|
3583
|
-
return localize2.quarter(quarter, {
|
|
3584
|
-
width: "narrow",
|
|
3585
|
-
context: "formatting"
|
|
3586
|
-
});
|
|
3587
|
-
// 1st quarter, 2nd quarter, ...
|
|
3588
|
-
case "QQQQ":
|
|
3589
|
-
default:
|
|
3590
|
-
return localize2.quarter(quarter, {
|
|
3591
|
-
width: "wide",
|
|
3592
|
-
context: "formatting"
|
|
3593
|
-
});
|
|
3594
|
-
}
|
|
3595
|
-
},
|
|
3596
|
-
// Stand-alone quarter
|
|
3597
|
-
q: function(date, token, localize2) {
|
|
3598
|
-
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
3599
|
-
switch (token) {
|
|
3600
|
-
// 1, 2, 3, 4
|
|
3601
|
-
case "q":
|
|
3602
|
-
return String(quarter);
|
|
3603
|
-
// 01, 02, 03, 04
|
|
3604
|
-
case "qq":
|
|
3605
|
-
return addLeadingZeros(quarter, 2);
|
|
3606
|
-
// 1st, 2nd, 3rd, 4th
|
|
3607
|
-
case "qo":
|
|
3608
|
-
return localize2.ordinalNumber(quarter, { unit: "quarter" });
|
|
3609
|
-
// Q1, Q2, Q3, Q4
|
|
3610
|
-
case "qqq":
|
|
3611
|
-
return localize2.quarter(quarter, {
|
|
3612
|
-
width: "abbreviated",
|
|
3613
|
-
context: "standalone"
|
|
3614
|
-
});
|
|
3615
|
-
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
3616
|
-
case "qqqqq":
|
|
3617
|
-
return localize2.quarter(quarter, {
|
|
3618
|
-
width: "narrow",
|
|
3619
|
-
context: "standalone"
|
|
3620
|
-
});
|
|
3621
|
-
// 1st quarter, 2nd quarter, ...
|
|
3622
|
-
case "qqqq":
|
|
3623
|
-
default:
|
|
3624
|
-
return localize2.quarter(quarter, {
|
|
3625
|
-
width: "wide",
|
|
3626
|
-
context: "standalone"
|
|
3627
|
-
});
|
|
3628
|
-
}
|
|
3629
|
-
},
|
|
3630
|
-
// Month
|
|
3631
|
-
M: function(date, token, localize2) {
|
|
3632
|
-
const month = date.getMonth();
|
|
3633
|
-
switch (token) {
|
|
3634
|
-
case "M":
|
|
3635
|
-
case "MM":
|
|
3636
|
-
return lightFormatters.M(date, token);
|
|
3637
|
-
// 1st, 2nd, ..., 12th
|
|
3638
|
-
case "Mo":
|
|
3639
|
-
return localize2.ordinalNumber(month + 1, { unit: "month" });
|
|
3640
|
-
// Jan, Feb, ..., Dec
|
|
3641
|
-
case "MMM":
|
|
3642
|
-
return localize2.month(month, {
|
|
3643
|
-
width: "abbreviated",
|
|
3644
|
-
context: "formatting"
|
|
3645
|
-
});
|
|
3646
|
-
// J, F, ..., D
|
|
3647
|
-
case "MMMMM":
|
|
3648
|
-
return localize2.month(month, {
|
|
3649
|
-
width: "narrow",
|
|
3650
|
-
context: "formatting"
|
|
3651
|
-
});
|
|
3652
|
-
// January, February, ..., December
|
|
3653
|
-
case "MMMM":
|
|
3654
|
-
default:
|
|
3655
|
-
return localize2.month(month, { width: "wide", context: "formatting" });
|
|
3656
|
-
}
|
|
3657
|
-
},
|
|
3658
|
-
// Stand-alone month
|
|
3659
|
-
L: function(date, token, localize2) {
|
|
3660
|
-
const month = date.getMonth();
|
|
3661
|
-
switch (token) {
|
|
3662
|
-
// 1, 2, ..., 12
|
|
3663
|
-
case "L":
|
|
3664
|
-
return String(month + 1);
|
|
3665
|
-
// 01, 02, ..., 12
|
|
3666
|
-
case "LL":
|
|
3667
|
-
return addLeadingZeros(month + 1, 2);
|
|
3668
|
-
// 1st, 2nd, ..., 12th
|
|
3669
|
-
case "Lo":
|
|
3670
|
-
return localize2.ordinalNumber(month + 1, { unit: "month" });
|
|
3671
|
-
// Jan, Feb, ..., Dec
|
|
3672
|
-
case "LLL":
|
|
3673
|
-
return localize2.month(month, {
|
|
3674
|
-
width: "abbreviated",
|
|
3675
|
-
context: "standalone"
|
|
3676
|
-
});
|
|
3677
|
-
// J, F, ..., D
|
|
3678
|
-
case "LLLLL":
|
|
3679
|
-
return localize2.month(month, {
|
|
3680
|
-
width: "narrow",
|
|
3681
|
-
context: "standalone"
|
|
3682
|
-
});
|
|
3683
|
-
// January, February, ..., December
|
|
3684
|
-
case "LLLL":
|
|
3685
|
-
default:
|
|
3686
|
-
return localize2.month(month, { width: "wide", context: "standalone" });
|
|
3687
|
-
}
|
|
3688
|
-
},
|
|
3689
|
-
// Local week of year
|
|
3690
|
-
w: function(date, token, localize2, options) {
|
|
3691
|
-
const week = getWeek(date, options);
|
|
3692
|
-
if (token === "wo") {
|
|
3693
|
-
return localize2.ordinalNumber(week, { unit: "week" });
|
|
3694
|
-
}
|
|
3695
|
-
return addLeadingZeros(week, token.length);
|
|
3696
|
-
},
|
|
3697
|
-
// ISO week of year
|
|
3698
|
-
I: function(date, token, localize2) {
|
|
3699
|
-
const isoWeek = getISOWeek(date);
|
|
3700
|
-
if (token === "Io") {
|
|
3701
|
-
return localize2.ordinalNumber(isoWeek, { unit: "week" });
|
|
3702
|
-
}
|
|
3703
|
-
return addLeadingZeros(isoWeek, token.length);
|
|
3704
|
-
},
|
|
3705
|
-
// Day of the month
|
|
3706
|
-
d: function(date, token, localize2) {
|
|
3707
|
-
if (token === "do") {
|
|
3708
|
-
return localize2.ordinalNumber(date.getDate(), { unit: "date" });
|
|
3709
|
-
}
|
|
3710
|
-
return lightFormatters.d(date, token);
|
|
3711
|
-
},
|
|
3712
|
-
// Day of year
|
|
3713
|
-
D: function(date, token, localize2) {
|
|
3714
|
-
const dayOfYear = getDayOfYear(date);
|
|
3715
|
-
if (token === "Do") {
|
|
3716
|
-
return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
|
|
3717
|
-
}
|
|
3718
|
-
return addLeadingZeros(dayOfYear, token.length);
|
|
3719
|
-
},
|
|
3720
|
-
// Day of week
|
|
3721
|
-
E: function(date, token, localize2) {
|
|
3722
|
-
const dayOfWeek = date.getDay();
|
|
3723
|
-
switch (token) {
|
|
3724
|
-
// Tue
|
|
3725
|
-
case "E":
|
|
3726
|
-
case "EE":
|
|
3727
|
-
case "EEE":
|
|
3728
|
-
return localize2.day(dayOfWeek, {
|
|
3729
|
-
width: "abbreviated",
|
|
3730
|
-
context: "formatting"
|
|
3731
|
-
});
|
|
3732
|
-
// T
|
|
3733
|
-
case "EEEEE":
|
|
3734
|
-
return localize2.day(dayOfWeek, {
|
|
3735
|
-
width: "narrow",
|
|
3736
|
-
context: "formatting"
|
|
3737
|
-
});
|
|
3738
|
-
// Tu
|
|
3739
|
-
case "EEEEEE":
|
|
3740
|
-
return localize2.day(dayOfWeek, {
|
|
3741
|
-
width: "short",
|
|
3742
|
-
context: "formatting"
|
|
3743
|
-
});
|
|
3744
|
-
// Tuesday
|
|
3745
|
-
case "EEEE":
|
|
3746
|
-
default:
|
|
3747
|
-
return localize2.day(dayOfWeek, {
|
|
3748
|
-
width: "wide",
|
|
3749
|
-
context: "formatting"
|
|
3750
|
-
});
|
|
3751
|
-
}
|
|
3752
|
-
},
|
|
3753
|
-
// Local day of week
|
|
3754
|
-
e: function(date, token, localize2, options) {
|
|
3755
|
-
const dayOfWeek = date.getDay();
|
|
3756
|
-
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
3757
|
-
switch (token) {
|
|
3758
|
-
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
3759
|
-
case "e":
|
|
3760
|
-
return String(localDayOfWeek);
|
|
3761
|
-
// Padded numerical value
|
|
3762
|
-
case "ee":
|
|
3763
|
-
return addLeadingZeros(localDayOfWeek, 2);
|
|
3764
|
-
// 1st, 2nd, ..., 7th
|
|
3765
|
-
case "eo":
|
|
3766
|
-
return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
3767
|
-
case "eee":
|
|
3768
|
-
return localize2.day(dayOfWeek, {
|
|
3769
|
-
width: "abbreviated",
|
|
3770
|
-
context: "formatting"
|
|
3771
|
-
});
|
|
3772
|
-
// T
|
|
3773
|
-
case "eeeee":
|
|
3774
|
-
return localize2.day(dayOfWeek, {
|
|
3775
|
-
width: "narrow",
|
|
3776
|
-
context: "formatting"
|
|
3777
|
-
});
|
|
3778
|
-
// Tu
|
|
3779
|
-
case "eeeeee":
|
|
3780
|
-
return localize2.day(dayOfWeek, {
|
|
3781
|
-
width: "short",
|
|
3782
|
-
context: "formatting"
|
|
3783
|
-
});
|
|
3784
|
-
// Tuesday
|
|
3785
|
-
case "eeee":
|
|
3786
|
-
default:
|
|
3787
|
-
return localize2.day(dayOfWeek, {
|
|
3788
|
-
width: "wide",
|
|
3789
|
-
context: "formatting"
|
|
3790
|
-
});
|
|
3791
|
-
}
|
|
3792
|
-
},
|
|
3793
|
-
// Stand-alone local day of week
|
|
3794
|
-
c: function(date, token, localize2, options) {
|
|
3795
|
-
const dayOfWeek = date.getDay();
|
|
3796
|
-
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
3797
|
-
switch (token) {
|
|
3798
|
-
// Numerical value (same as in `e`)
|
|
3799
|
-
case "c":
|
|
3800
|
-
return String(localDayOfWeek);
|
|
3801
|
-
// Padded numerical value
|
|
3802
|
-
case "cc":
|
|
3803
|
-
return addLeadingZeros(localDayOfWeek, token.length);
|
|
3804
|
-
// 1st, 2nd, ..., 7th
|
|
3805
|
-
case "co":
|
|
3806
|
-
return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
3807
|
-
case "ccc":
|
|
3808
|
-
return localize2.day(dayOfWeek, {
|
|
3809
|
-
width: "abbreviated",
|
|
3810
|
-
context: "standalone"
|
|
3811
|
-
});
|
|
3812
|
-
// T
|
|
3813
|
-
case "ccccc":
|
|
3814
|
-
return localize2.day(dayOfWeek, {
|
|
3815
|
-
width: "narrow",
|
|
3816
|
-
context: "standalone"
|
|
3817
|
-
});
|
|
3818
|
-
// Tu
|
|
3819
|
-
case "cccccc":
|
|
3820
|
-
return localize2.day(dayOfWeek, {
|
|
3821
|
-
width: "short",
|
|
3822
|
-
context: "standalone"
|
|
3823
|
-
});
|
|
3824
|
-
// Tuesday
|
|
3825
|
-
case "cccc":
|
|
3826
|
-
default:
|
|
3827
|
-
return localize2.day(dayOfWeek, {
|
|
3828
|
-
width: "wide",
|
|
3829
|
-
context: "standalone"
|
|
3830
|
-
});
|
|
3831
|
-
}
|
|
3832
|
-
},
|
|
3833
|
-
// ISO day of week
|
|
3834
|
-
i: function(date, token, localize2) {
|
|
3835
|
-
const dayOfWeek = date.getDay();
|
|
3836
|
-
const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
3837
|
-
switch (token) {
|
|
3838
|
-
// 2
|
|
3839
|
-
case "i":
|
|
3840
|
-
return String(isoDayOfWeek);
|
|
3841
|
-
// 02
|
|
3842
|
-
case "ii":
|
|
3843
|
-
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
3844
|
-
// 2nd
|
|
3845
|
-
case "io":
|
|
3846
|
-
return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
|
|
3847
|
-
// Tue
|
|
3848
|
-
case "iii":
|
|
3849
|
-
return localize2.day(dayOfWeek, {
|
|
3850
|
-
width: "abbreviated",
|
|
3851
|
-
context: "formatting"
|
|
3852
|
-
});
|
|
3853
|
-
// T
|
|
3854
|
-
case "iiiii":
|
|
3855
|
-
return localize2.day(dayOfWeek, {
|
|
3856
|
-
width: "narrow",
|
|
3857
|
-
context: "formatting"
|
|
3858
|
-
});
|
|
3859
|
-
// Tu
|
|
3860
|
-
case "iiiiii":
|
|
3861
|
-
return localize2.day(dayOfWeek, {
|
|
3862
|
-
width: "short",
|
|
3863
|
-
context: "formatting"
|
|
3864
|
-
});
|
|
3865
|
-
// Tuesday
|
|
3866
|
-
case "iiii":
|
|
3867
|
-
default:
|
|
3868
|
-
return localize2.day(dayOfWeek, {
|
|
3869
|
-
width: "wide",
|
|
3870
|
-
context: "formatting"
|
|
3871
|
-
});
|
|
3872
|
-
}
|
|
3873
|
-
},
|
|
3874
|
-
// AM or PM
|
|
3875
|
-
a: function(date, token, localize2) {
|
|
3876
|
-
const hours = date.getHours();
|
|
3877
|
-
const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
3878
|
-
switch (token) {
|
|
3879
|
-
case "a":
|
|
3880
|
-
case "aa":
|
|
3881
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3882
|
-
width: "abbreviated",
|
|
3883
|
-
context: "formatting"
|
|
3884
|
-
});
|
|
3885
|
-
case "aaa":
|
|
3886
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3887
|
-
width: "abbreviated",
|
|
3888
|
-
context: "formatting"
|
|
3889
|
-
}).toLowerCase();
|
|
3890
|
-
case "aaaaa":
|
|
3891
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3892
|
-
width: "narrow",
|
|
3893
|
-
context: "formatting"
|
|
3894
|
-
});
|
|
3895
|
-
case "aaaa":
|
|
3896
|
-
default:
|
|
3897
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3898
|
-
width: "wide",
|
|
3899
|
-
context: "formatting"
|
|
3900
|
-
});
|
|
3901
|
-
}
|
|
3902
|
-
},
|
|
3903
|
-
// AM, PM, midnight, noon
|
|
3904
|
-
b: function(date, token, localize2) {
|
|
3905
|
-
const hours = date.getHours();
|
|
3906
|
-
let dayPeriodEnumValue;
|
|
3907
|
-
if (hours === 12) {
|
|
3908
|
-
dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
3909
|
-
} else if (hours === 0) {
|
|
3910
|
-
dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
3911
|
-
} else {
|
|
3912
|
-
dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
3913
|
-
}
|
|
3914
|
-
switch (token) {
|
|
3915
|
-
case "b":
|
|
3916
|
-
case "bb":
|
|
3917
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3918
|
-
width: "abbreviated",
|
|
3919
|
-
context: "formatting"
|
|
3920
|
-
});
|
|
3921
|
-
case "bbb":
|
|
3922
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3923
|
-
width: "abbreviated",
|
|
3924
|
-
context: "formatting"
|
|
3925
|
-
}).toLowerCase();
|
|
3926
|
-
case "bbbbb":
|
|
3927
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3928
|
-
width: "narrow",
|
|
3929
|
-
context: "formatting"
|
|
3930
|
-
});
|
|
3931
|
-
case "bbbb":
|
|
3932
|
-
default:
|
|
3933
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3934
|
-
width: "wide",
|
|
3935
|
-
context: "formatting"
|
|
3936
|
-
});
|
|
3937
|
-
}
|
|
3938
|
-
},
|
|
3939
|
-
// in the morning, in the afternoon, in the evening, at night
|
|
3940
|
-
B: function(date, token, localize2) {
|
|
3941
|
-
const hours = date.getHours();
|
|
3942
|
-
let dayPeriodEnumValue;
|
|
3943
|
-
if (hours >= 17) {
|
|
3944
|
-
dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
3945
|
-
} else if (hours >= 12) {
|
|
3946
|
-
dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
3947
|
-
} else if (hours >= 4) {
|
|
3948
|
-
dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
3949
|
-
} else {
|
|
3950
|
-
dayPeriodEnumValue = dayPeriodEnum.night;
|
|
3951
|
-
}
|
|
3952
|
-
switch (token) {
|
|
3953
|
-
case "B":
|
|
3954
|
-
case "BB":
|
|
3955
|
-
case "BBB":
|
|
3956
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3957
|
-
width: "abbreviated",
|
|
3958
|
-
context: "formatting"
|
|
3959
|
-
});
|
|
3960
|
-
case "BBBBB":
|
|
3961
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3962
|
-
width: "narrow",
|
|
3963
|
-
context: "formatting"
|
|
3964
|
-
});
|
|
3965
|
-
case "BBBB":
|
|
3966
|
-
default:
|
|
3967
|
-
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
3968
|
-
width: "wide",
|
|
3969
|
-
context: "formatting"
|
|
3970
|
-
});
|
|
3971
|
-
}
|
|
3972
|
-
},
|
|
3973
|
-
// Hour [1-12]
|
|
3974
|
-
h: function(date, token, localize2) {
|
|
3975
|
-
if (token === "ho") {
|
|
3976
|
-
let hours = date.getHours() % 12;
|
|
3977
|
-
if (hours === 0) hours = 12;
|
|
3978
|
-
return localize2.ordinalNumber(hours, { unit: "hour" });
|
|
3979
|
-
}
|
|
3980
|
-
return lightFormatters.h(date, token);
|
|
3981
|
-
},
|
|
3982
|
-
// Hour [0-23]
|
|
3983
|
-
H: function(date, token, localize2) {
|
|
3984
|
-
if (token === "Ho") {
|
|
3985
|
-
return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
|
|
3986
|
-
}
|
|
3987
|
-
return lightFormatters.H(date, token);
|
|
3988
|
-
},
|
|
3989
|
-
// Hour [0-11]
|
|
3990
|
-
K: function(date, token, localize2) {
|
|
3991
|
-
const hours = date.getHours() % 12;
|
|
3992
|
-
if (token === "Ko") {
|
|
3993
|
-
return localize2.ordinalNumber(hours, { unit: "hour" });
|
|
3994
|
-
}
|
|
3995
|
-
return addLeadingZeros(hours, token.length);
|
|
3996
|
-
},
|
|
3997
|
-
// Hour [1-24]
|
|
3998
|
-
k: function(date, token, localize2) {
|
|
3999
|
-
let hours = date.getHours();
|
|
4000
|
-
if (hours === 0) hours = 24;
|
|
4001
|
-
if (token === "ko") {
|
|
4002
|
-
return localize2.ordinalNumber(hours, { unit: "hour" });
|
|
4003
|
-
}
|
|
4004
|
-
return addLeadingZeros(hours, token.length);
|
|
4005
|
-
},
|
|
4006
|
-
// Minute
|
|
4007
|
-
m: function(date, token, localize2) {
|
|
4008
|
-
if (token === "mo") {
|
|
4009
|
-
return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
|
|
4010
|
-
}
|
|
4011
|
-
return lightFormatters.m(date, token);
|
|
4012
|
-
},
|
|
4013
|
-
// Second
|
|
4014
|
-
s: function(date, token, localize2) {
|
|
4015
|
-
if (token === "so") {
|
|
4016
|
-
return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
|
|
4017
|
-
}
|
|
4018
|
-
return lightFormatters.s(date, token);
|
|
4019
|
-
},
|
|
4020
|
-
// Fraction of second
|
|
4021
|
-
S: function(date, token) {
|
|
4022
|
-
return lightFormatters.S(date, token);
|
|
4023
|
-
},
|
|
4024
|
-
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
4025
|
-
X: function(date, token, _localize) {
|
|
4026
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
4027
|
-
if (timezoneOffset === 0) {
|
|
4028
|
-
return "Z";
|
|
4029
|
-
}
|
|
4030
|
-
switch (token) {
|
|
4031
|
-
// Hours and optional minutes
|
|
4032
|
-
case "X":
|
|
4033
|
-
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
4034
|
-
// Hours, minutes and optional seconds without `:` delimiter
|
|
4035
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
4036
|
-
// so this token always has the same output as `XX`
|
|
4037
|
-
case "XXXX":
|
|
4038
|
-
case "XX":
|
|
4039
|
-
return formatTimezone(timezoneOffset);
|
|
4040
|
-
// Hours, minutes and optional seconds with `:` delimiter
|
|
4041
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
4042
|
-
// so this token always has the same output as `XXX`
|
|
4043
|
-
case "XXXXX":
|
|
4044
|
-
case "XXX":
|
|
4045
|
-
// Hours and minutes with `:` delimiter
|
|
4046
|
-
default:
|
|
4047
|
-
return formatTimezone(timezoneOffset, ":");
|
|
4048
|
-
}
|
|
4049
|
-
},
|
|
4050
|
-
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
4051
|
-
x: function(date, token, _localize) {
|
|
4052
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
4053
|
-
switch (token) {
|
|
4054
|
-
// Hours and optional minutes
|
|
4055
|
-
case "x":
|
|
4056
|
-
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
4057
|
-
// Hours, minutes and optional seconds without `:` delimiter
|
|
4058
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
4059
|
-
// so this token always has the same output as `xx`
|
|
4060
|
-
case "xxxx":
|
|
4061
|
-
case "xx":
|
|
4062
|
-
return formatTimezone(timezoneOffset);
|
|
4063
|
-
// Hours, minutes and optional seconds with `:` delimiter
|
|
4064
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
4065
|
-
// so this token always has the same output as `xxx`
|
|
4066
|
-
case "xxxxx":
|
|
4067
|
-
case "xxx":
|
|
4068
|
-
// Hours and minutes with `:` delimiter
|
|
4069
|
-
default:
|
|
4070
|
-
return formatTimezone(timezoneOffset, ":");
|
|
4071
|
-
}
|
|
4072
|
-
},
|
|
4073
|
-
// Timezone (GMT)
|
|
4074
|
-
O: function(date, token, _localize) {
|
|
4075
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
4076
|
-
switch (token) {
|
|
4077
|
-
// Short
|
|
4078
|
-
case "O":
|
|
4079
|
-
case "OO":
|
|
4080
|
-
case "OOO":
|
|
4081
|
-
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
4082
|
-
// Long
|
|
4083
|
-
case "OOOO":
|
|
4084
|
-
default:
|
|
4085
|
-
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
4086
|
-
}
|
|
4087
|
-
},
|
|
4088
|
-
// Timezone (specific non-location)
|
|
4089
|
-
z: function(date, token, _localize) {
|
|
4090
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
4091
|
-
switch (token) {
|
|
4092
|
-
// Short
|
|
4093
|
-
case "z":
|
|
4094
|
-
case "zz":
|
|
4095
|
-
case "zzz":
|
|
4096
|
-
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
4097
|
-
// Long
|
|
4098
|
-
case "zzzz":
|
|
4099
|
-
default:
|
|
4100
|
-
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
4101
|
-
}
|
|
4102
|
-
},
|
|
4103
|
-
// Seconds timestamp
|
|
4104
|
-
t: function(date, token, _localize) {
|
|
4105
|
-
const timestamp = Math.trunc(+date / 1e3);
|
|
4106
|
-
return addLeadingZeros(timestamp, token.length);
|
|
4107
|
-
},
|
|
4108
|
-
// Milliseconds timestamp
|
|
4109
|
-
T: function(date, token, _localize) {
|
|
4110
|
-
return addLeadingZeros(+date, token.length);
|
|
4111
|
-
}
|
|
4112
|
-
};
|
|
4113
|
-
function formatTimezoneShort(offset, delimiter = "") {
|
|
4114
|
-
const sign = offset > 0 ? "-" : "+";
|
|
4115
|
-
const absOffset = Math.abs(offset);
|
|
4116
|
-
const hours = Math.trunc(absOffset / 60);
|
|
4117
|
-
const minutes = absOffset % 60;
|
|
4118
|
-
if (minutes === 0) {
|
|
4119
|
-
return sign + String(hours);
|
|
4120
|
-
}
|
|
4121
|
-
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
4122
|
-
}
|
|
4123
|
-
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
|
4124
|
-
if (offset % 60 === 0) {
|
|
4125
|
-
const sign = offset > 0 ? "-" : "+";
|
|
4126
|
-
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
4127
|
-
}
|
|
4128
|
-
return formatTimezone(offset, delimiter);
|
|
4129
|
-
}
|
|
4130
|
-
function formatTimezone(offset, delimiter = "") {
|
|
4131
|
-
const sign = offset > 0 ? "-" : "+";
|
|
4132
|
-
const absOffset = Math.abs(offset);
|
|
4133
|
-
const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
|
4134
|
-
const minutes = addLeadingZeros(absOffset % 60, 2);
|
|
4135
|
-
return sign + hours + delimiter + minutes;
|
|
4136
|
-
}
|
|
4137
|
-
|
|
4138
|
-
// node_modules/date-fns/_lib/format/longFormatters.js
|
|
4139
|
-
var dateLongFormatter = (pattern, formatLong2) => {
|
|
4140
|
-
switch (pattern) {
|
|
4141
|
-
case "P":
|
|
4142
|
-
return formatLong2.date({ width: "short" });
|
|
4143
|
-
case "PP":
|
|
4144
|
-
return formatLong2.date({ width: "medium" });
|
|
4145
|
-
case "PPP":
|
|
4146
|
-
return formatLong2.date({ width: "long" });
|
|
4147
|
-
case "PPPP":
|
|
4148
|
-
default:
|
|
4149
|
-
return formatLong2.date({ width: "full" });
|
|
4150
|
-
}
|
|
4151
|
-
};
|
|
4152
|
-
var timeLongFormatter = (pattern, formatLong2) => {
|
|
4153
|
-
switch (pattern) {
|
|
4154
|
-
case "p":
|
|
4155
|
-
return formatLong2.time({ width: "short" });
|
|
4156
|
-
case "pp":
|
|
4157
|
-
return formatLong2.time({ width: "medium" });
|
|
4158
|
-
case "ppp":
|
|
4159
|
-
return formatLong2.time({ width: "long" });
|
|
4160
|
-
case "pppp":
|
|
4161
|
-
default:
|
|
4162
|
-
return formatLong2.time({ width: "full" });
|
|
4163
|
-
}
|
|
4164
|
-
};
|
|
4165
|
-
var dateTimeLongFormatter = (pattern, formatLong2) => {
|
|
4166
|
-
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
4167
|
-
const datePattern = matchResult[1];
|
|
4168
|
-
const timePattern = matchResult[2];
|
|
4169
|
-
if (!timePattern) {
|
|
4170
|
-
return dateLongFormatter(pattern, formatLong2);
|
|
4171
|
-
}
|
|
4172
|
-
let dateTimeFormat;
|
|
4173
|
-
switch (datePattern) {
|
|
4174
|
-
case "P":
|
|
4175
|
-
dateTimeFormat = formatLong2.dateTime({ width: "short" });
|
|
4176
|
-
break;
|
|
4177
|
-
case "PP":
|
|
4178
|
-
dateTimeFormat = formatLong2.dateTime({ width: "medium" });
|
|
4179
|
-
break;
|
|
4180
|
-
case "PPP":
|
|
4181
|
-
dateTimeFormat = formatLong2.dateTime({ width: "long" });
|
|
4182
|
-
break;
|
|
4183
|
-
case "PPPP":
|
|
4184
|
-
default:
|
|
4185
|
-
dateTimeFormat = formatLong2.dateTime({ width: "full" });
|
|
4186
|
-
break;
|
|
4187
|
-
}
|
|
4188
|
-
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
|
|
4189
|
-
};
|
|
4190
|
-
var longFormatters = {
|
|
4191
|
-
p: timeLongFormatter,
|
|
4192
|
-
P: dateTimeLongFormatter
|
|
4193
|
-
};
|
|
4194
|
-
|
|
4195
|
-
// node_modules/date-fns/_lib/protectedTokens.js
|
|
4196
|
-
var dayOfYearTokenRE = /^D+$/;
|
|
4197
|
-
var weekYearTokenRE = /^Y+$/;
|
|
4198
|
-
var throwTokens = ["D", "DD", "YY", "YYYY"];
|
|
4199
|
-
function isProtectedDayOfYearToken(token) {
|
|
4200
|
-
return dayOfYearTokenRE.test(token);
|
|
4201
|
-
}
|
|
4202
|
-
function isProtectedWeekYearToken(token) {
|
|
4203
|
-
return weekYearTokenRE.test(token);
|
|
4204
|
-
}
|
|
4205
|
-
function warnOrThrowProtectedError(token, format2, input) {
|
|
4206
|
-
const _message = message(token, format2, input);
|
|
4207
|
-
console.warn(_message);
|
|
4208
|
-
if (throwTokens.includes(token)) throw new RangeError(_message);
|
|
4209
|
-
}
|
|
4210
|
-
function message(token, format2, input) {
|
|
4211
|
-
const subject = token[0] === "Y" ? "years" : "days of the month";
|
|
4212
|
-
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
4213
|
-
}
|
|
4214
|
-
|
|
4215
|
-
// node_modules/date-fns/format.js
|
|
4216
|
-
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
4217
|
-
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
4218
|
-
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
4219
|
-
var doubleQuoteRegExp = /''/g;
|
|
4220
|
-
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
4221
|
-
function format(date, formatStr, options) {
|
|
4222
|
-
const defaultOptions2 = getDefaultOptions();
|
|
4223
|
-
const locale = defaultOptions2.locale ?? enUS;
|
|
4224
|
-
const firstWeekContainsDate = defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
4225
|
-
const weekStartsOn = defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
|
|
4226
|
-
const originalDate = toDate(date, options?.in);
|
|
4227
|
-
if (!isValid(originalDate)) {
|
|
4228
|
-
throw new RangeError("Invalid time value");
|
|
4229
|
-
}
|
|
4230
|
-
let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
|
4231
|
-
const firstCharacter = substring[0];
|
|
4232
|
-
if (firstCharacter === "p" || firstCharacter === "P") {
|
|
4233
|
-
const longFormatter = longFormatters[firstCharacter];
|
|
4234
|
-
return longFormatter(substring, locale.formatLong);
|
|
4235
|
-
}
|
|
4236
|
-
return substring;
|
|
4237
|
-
}).join("").match(formattingTokensRegExp).map((substring) => {
|
|
4238
|
-
if (substring === "''") {
|
|
4239
|
-
return { isToken: false, value: "'" };
|
|
4240
|
-
}
|
|
4241
|
-
const firstCharacter = substring[0];
|
|
4242
|
-
if (firstCharacter === "'") {
|
|
4243
|
-
return { isToken: false, value: cleanEscapedString(substring) };
|
|
4244
|
-
}
|
|
4245
|
-
if (formatters[firstCharacter]) {
|
|
4246
|
-
return { isToken: true, value: substring };
|
|
4247
|
-
}
|
|
4248
|
-
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
|
4249
|
-
throw new RangeError(
|
|
4250
|
-
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
|
4251
|
-
);
|
|
4252
|
-
}
|
|
4253
|
-
return { isToken: false, value: substring };
|
|
4254
|
-
});
|
|
4255
|
-
if (locale.localize.preprocessor) {
|
|
4256
|
-
parts = locale.localize.preprocessor(originalDate, parts);
|
|
4257
|
-
}
|
|
4258
|
-
const formatterOptions = {
|
|
4259
|
-
firstWeekContainsDate,
|
|
4260
|
-
weekStartsOn,
|
|
4261
|
-
locale
|
|
4262
|
-
};
|
|
4263
|
-
return parts.map((part) => {
|
|
4264
|
-
if (!part.isToken) return part.value;
|
|
4265
|
-
const token = part.value;
|
|
4266
|
-
if (isProtectedWeekYearToken(token) || isProtectedDayOfYearToken(token)) {
|
|
4267
|
-
warnOrThrowProtectedError(token, formatStr, String(date));
|
|
4268
|
-
}
|
|
4269
|
-
const formatter = formatters[token[0]];
|
|
4270
|
-
return formatter(originalDate, token, locale.localize, formatterOptions);
|
|
4271
|
-
}).join("");
|
|
4272
|
-
}
|
|
4273
|
-
function cleanEscapedString(input) {
|
|
4274
|
-
const matched = input.match(escapedStringRegExp);
|
|
4275
|
-
if (!matched) {
|
|
4276
|
-
return input;
|
|
4277
|
-
}
|
|
4278
|
-
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
4279
|
-
}
|
|
4280
2729
|
var DateInput = class extends BaseInput {
|
|
4281
2730
|
render() {
|
|
4282
2731
|
const { input, form, isSubmitting } = this;
|
|
@@ -4284,7 +2733,7 @@ var DateInput = class extends BaseInput {
|
|
|
4284
2733
|
}
|
|
4285
2734
|
};
|
|
4286
2735
|
var FieldTimeInput = ({ form, input, isSubmitting }) => {
|
|
4287
|
-
const [
|
|
2736
|
+
const [isValid, setIsValid] = React3.useState(isValidField(input, form));
|
|
4288
2737
|
const infoTooltip = input?.infoTooltip;
|
|
4289
2738
|
const groupConfig = input.inputGroupConfig;
|
|
4290
2739
|
const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
|
|
@@ -4335,23 +2784,25 @@ var FieldTimeInput = ({ form, input, isSubmitting }) => {
|
|
|
4335
2784
|
children: [
|
|
4336
2785
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 items-center gap-1 justify-start text-left ", children: [
|
|
4337
2786
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, {}),
|
|
4338
|
-
date ? format(date, "PPP") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: input.placeHolder ?? "Fecha" })
|
|
2787
|
+
date ? dateFns.format(date, "PPP") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: input.placeHolder ?? "Fecha" })
|
|
4339
2788
|
] }),
|
|
4340
2789
|
(iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4341
2790
|
textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textRight }),
|
|
4342
2791
|
iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 24, className: "w-6! h-6!" }, index)),
|
|
4343
|
-
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState :
|
|
2792
|
+
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
|
|
4344
2793
|
] })
|
|
4345
2794
|
]
|
|
4346
2795
|
}
|
|
4347
2796
|
)
|
|
4348
2797
|
] }) }) }),
|
|
4349
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2798
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4350
2799
|
Calendar,
|
|
4351
2800
|
{
|
|
4352
2801
|
mode: "single",
|
|
2802
|
+
defaultMonth: date,
|
|
4353
2803
|
selected: date,
|
|
4354
2804
|
onSelect: handleSelect,
|
|
2805
|
+
captionLayout: "dropdown",
|
|
4355
2806
|
initialFocus: true
|
|
4356
2807
|
}
|
|
4357
2808
|
) })
|
|
@@ -4381,7 +2832,7 @@ var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
|
|
|
4381
2832
|
const iconsLeft = groupConfig?.iconsLeft ?? [];
|
|
4382
2833
|
const textLeft = groupConfig?.textLeft;
|
|
4383
2834
|
const textRight = groupConfig?.textRight;
|
|
4384
|
-
const [
|
|
2835
|
+
const [isValid, setIsValid] = React3.useState(() => {
|
|
4385
2836
|
const value = form.getValues(input.name);
|
|
4386
2837
|
const fieldState = form.getFieldState(input.name);
|
|
4387
2838
|
return !fieldState.error && value !== void 0 && value !== "";
|
|
@@ -4402,7 +2853,7 @@ var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
|
|
|
4402
2853
|
name: input.name,
|
|
4403
2854
|
render: ({ field, fieldState }) => {
|
|
4404
2855
|
const validNow = !fieldState.error && field.value !== void 0 && field.value !== "";
|
|
4405
|
-
if (validNow !==
|
|
2856
|
+
if (validNow !== isValid) setIsValid(validNow);
|
|
4406
2857
|
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: input.className, children: [
|
|
4407
2858
|
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
4408
2859
|
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { className: "shadow-lg", children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
@@ -4425,7 +2876,7 @@ var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
|
|
|
4425
2876
|
(iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
4426
2877
|
textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textRight }),
|
|
4427
2878
|
iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 24 }, index)),
|
|
4428
|
-
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState :
|
|
2879
|
+
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
|
|
4429
2880
|
] })
|
|
4430
2881
|
] }) }),
|
|
4431
2882
|
input.description && /* @__PURE__ */ jsxRuntime.jsx(FormDescription, { children: input.description }),
|
|
@@ -4528,7 +2979,7 @@ var FieldFileMultiUpload = ({ input, form, isSubmitting }) => {
|
|
|
4528
2979
|
control: form.control,
|
|
4529
2980
|
name: input.name,
|
|
4530
2981
|
render: ({ field, fieldState }) => {
|
|
4531
|
-
const
|
|
2982
|
+
const isValid = !fieldState.error && files.length > 0;
|
|
4532
2983
|
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: input.className, children: [
|
|
4533
2984
|
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
4534
2985
|
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4581,7 +3032,7 @@ var FieldFileMultiUpload = ({ input, form, isSubmitting }) => {
|
|
|
4581
3032
|
)
|
|
4582
3033
|
] }, idx)) }),
|
|
4583
3034
|
input.description && /* @__PURE__ */ jsxRuntime.jsx(FormDescription, { children: input.description }),
|
|
4584
|
-
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: isSubmitting ? iconLoadingState :
|
|
3035
|
+
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState }),
|
|
4585
3036
|
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
|
|
4586
3037
|
] });
|
|
4587
3038
|
}
|
|
@@ -4597,7 +3048,7 @@ var TextInputGroup = class extends BaseInput {
|
|
|
4597
3048
|
}
|
|
4598
3049
|
};
|
|
4599
3050
|
var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
4600
|
-
const [
|
|
3051
|
+
const [isValid, setIsValid] = React3.useState(isValidField(input, form));
|
|
4601
3052
|
const formField = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4602
3053
|
FormField,
|
|
4603
3054
|
{
|
|
@@ -4612,7 +3063,7 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
4612
3063
|
isSubmitting,
|
|
4613
3064
|
field,
|
|
4614
3065
|
form,
|
|
4615
|
-
isValid
|
|
3066
|
+
isValid
|
|
4616
3067
|
}) }),
|
|
4617
3068
|
input.description && /* @__PURE__ */ jsxRuntime.jsx(FormDescription, { children: input.description }),
|
|
4618
3069
|
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
|
|
@@ -4630,7 +3081,7 @@ var CustomInputGroup = ({
|
|
|
4630
3081
|
form,
|
|
4631
3082
|
isSubmitting,
|
|
4632
3083
|
onChange,
|
|
4633
|
-
isValid
|
|
3084
|
+
isValid
|
|
4634
3085
|
}) => {
|
|
4635
3086
|
const groupConfig = input.inputGroupConfig;
|
|
4636
3087
|
const infoTooltip = input?.infoTooltip;
|
|
@@ -4691,7 +3142,7 @@ var CustomInputGroup = ({
|
|
|
4691
3142
|
children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 20 })
|
|
4692
3143
|
}
|
|
4693
3144
|
),
|
|
4694
|
-
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState :
|
|
3145
|
+
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
|
|
4695
3146
|
] })
|
|
4696
3147
|
] });
|
|
4697
3148
|
};
|
|
@@ -5020,7 +3471,7 @@ var FieldRepeater = ({ form, input, isSubmitting }) => {
|
|
|
5020
3471
|
});
|
|
5021
3472
|
const canAdd = !input.maxItems || fields.length < input.maxItems;
|
|
5022
3473
|
const canRemove = fields.length > (input.minItems ?? 0);
|
|
5023
|
-
const [
|
|
3474
|
+
const [isValid, setIsValid] = React3.useState(isValidField(input, form));
|
|
5024
3475
|
React3.useEffect(() => {
|
|
5025
3476
|
setIsValid(isValidField(input, form));
|
|
5026
3477
|
}, [input]);
|
|
@@ -5057,7 +3508,7 @@ var FieldRepeater = ({ form, input, isSubmitting }) => {
|
|
|
5057
3508
|
autoValidate: true,
|
|
5058
3509
|
value: field.value,
|
|
5059
3510
|
input: subField,
|
|
5060
|
-
isValid
|
|
3511
|
+
isValid,
|
|
5061
3512
|
field,
|
|
5062
3513
|
form
|
|
5063
3514
|
}
|
|
@@ -5664,7 +4115,7 @@ var StringValueListInput = class extends BaseInput {
|
|
|
5664
4115
|
var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
5665
4116
|
const fieldName = input.name;
|
|
5666
4117
|
const withAddBtn = input.withAddBtn ?? false;
|
|
5667
|
-
const [
|
|
4118
|
+
const [isValid, setIsValid] = React3.useState(isValidField(input, form));
|
|
5668
4119
|
React3.useEffect(() => {
|
|
5669
4120
|
setIsValid(isValidField(input, form));
|
|
5670
4121
|
}, [input]);
|
|
@@ -5713,7 +4164,7 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
|
5713
4164
|
autoValidate: true,
|
|
5714
4165
|
value,
|
|
5715
4166
|
input,
|
|
5716
|
-
isValid
|
|
4167
|
+
isValid,
|
|
5717
4168
|
onChange: (e) => handleChange(index, e.target.value),
|
|
5718
4169
|
form
|
|
5719
4170
|
}
|
|
@@ -5982,7 +4433,7 @@ var FieldTimeInput2 = ({ form, input, isSubmitting }) => {
|
|
|
5982
4433
|
const iconsLeft = groupConfig?.iconsLeft ?? [];
|
|
5983
4434
|
const textLeft = groupConfig?.textLeft;
|
|
5984
4435
|
const textRight = groupConfig?.textRight;
|
|
5985
|
-
const [
|
|
4436
|
+
const [isValid, setIsValid] = React3.useState(() => {
|
|
5986
4437
|
const value = form.getValues(input.name);
|
|
5987
4438
|
const fieldState = form.getFieldState(input.name);
|
|
5988
4439
|
return !fieldState.error && value !== void 0 && value !== "";
|
|
@@ -5999,7 +4450,7 @@ var FieldTimeInput2 = ({ form, input, isSubmitting }) => {
|
|
|
5999
4450
|
name: input.name,
|
|
6000
4451
|
render: ({ field, fieldState }) => {
|
|
6001
4452
|
const validNow = !fieldState.error && field.value !== void 0 && field.value !== "";
|
|
6002
|
-
if (validNow !==
|
|
4453
|
+
if (validNow !== isValid) setIsValid(validNow);
|
|
6003
4454
|
const handleChange = (val) => {
|
|
6004
4455
|
setTime(val);
|
|
6005
4456
|
handleOnChage(val, input, field);
|
|
@@ -6024,7 +4475,7 @@ var FieldTimeInput2 = ({ form, input, isSubmitting }) => {
|
|
|
6024
4475
|
(iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
6025
4476
|
textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textRight }),
|
|
6026
4477
|
iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20 }, index)),
|
|
6027
|
-
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState :
|
|
4478
|
+
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
|
|
6028
4479
|
] })
|
|
6029
4480
|
] }) }),
|
|
6030
4481
|
input.description && /* @__PURE__ */ jsxRuntime.jsx(FormDescription, { children: input.description }),
|
|
@@ -6293,8 +4744,8 @@ var DynamicForm = ({
|
|
|
6293
4744
|
};
|
|
6294
4745
|
const handleClick = async () => {
|
|
6295
4746
|
if (!onClick) return;
|
|
6296
|
-
const
|
|
6297
|
-
if (!
|
|
4747
|
+
const isValid = await form.trigger();
|
|
4748
|
+
if (!isValid) return;
|
|
6298
4749
|
const data = form.watch();
|
|
6299
4750
|
const resp = { data, form };
|
|
6300
4751
|
onClick(resp);
|