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