shadcn-zod-formkit 1.31.0 → 1.34.0

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
@@ -1,4 +1,4 @@
1
- import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CheckIcon, XIcon, MinusIcon, CircleIcon, GripVerticalIcon, ChevronUpIcon, SearchIcon, ChevronsUpDown, Check, CalendarIcon, EyeOff, Eye, Upload, Info, Trash2, Plus, GripVertical, Loader2, Save, Pencil, Search, MessageCircleWarning, CircleCheck, CircleX } from 'lucide-react';
1
+ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CheckIcon, XIcon, MinusIcon, CircleIcon, GripVerticalIcon, ChevronUpIcon, SearchIcon, ChevronsUpDown, Check, Info, CalendarIcon, EyeOff, Eye, Upload, Trash2, Plus, GripVertical, Loader2, Save, Pencil, Search, MessageCircleWarning, CircleCheck, CircleX } from 'lucide-react';
2
2
  import { InfoCircledIcon } from '@radix-ui/react-icons';
3
3
  import { cva } from 'class-variance-authority';
4
4
  import { twMerge } from 'tailwind-merge';
@@ -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';
@@ -424,8 +425,8 @@ var buttonVariants = cva(
424
425
  );
425
426
  function Button({
426
427
  className,
427
- variant,
428
- size,
428
+ variant = "default",
429
+ size = "default",
429
430
  asChild = false,
430
431
  ...props
431
432
  }) {
@@ -434,6 +435,8 @@ function Button({
434
435
  Comp,
435
436
  {
436
437
  "data-slot": "button",
438
+ "data-variant": variant,
439
+ "data-size": size,
437
440
  className: cn(buttonVariants({ variant, size, className })),
438
441
  ...props
439
442
  }
@@ -445,7 +448,7 @@ function Calendar({
445
448
  showOutsideDays = true,
446
449
  captionLayout = "label",
447
450
  buttonVariant = "ghost",
448
- formatters: formatters2,
451
+ formatters,
449
452
  components,
450
453
  ...props
451
454
  }) {
@@ -463,7 +466,7 @@ function Calendar({
463
466
  captionLayout,
464
467
  formatters: {
465
468
  formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
466
- ...formatters2
469
+ ...formatters
467
470
  },
468
471
  classNames: {
469
472
  root: cn("w-fit", defaultClassNames.root),
@@ -523,7 +526,8 @@ function Calendar({
523
526
  defaultClassNames.week_number
524
527
  ),
525
528
  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",
529
+ "relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
530
+ props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "[&:first-child[data-selected=true]_button]:rounded-l-md",
527
531
  defaultClassNames.day
528
532
  ),
529
533
  range_start: cn(
@@ -2578,7 +2582,7 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
2578
2582
  const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
2579
2583
  const iconInvalidState = /* @__PURE__ */ jsx(CircleX, { style: { color: "#ff8080" } });
2580
2584
  const iconLoadingState = /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
2581
- const [isValid2, setIsValid] = useState(() => {
2585
+ const [isValid, setIsValid] = useState(() => {
2582
2586
  const value = form.getValues(input.name);
2583
2587
  const fieldState = form.getFieldState(input.name);
2584
2588
  return !fieldState.error && value !== void 0 && value !== "";
@@ -2638,7 +2642,7 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
2638
2642
  name: input.name,
2639
2643
  render: ({ field, fieldState }) => {
2640
2644
  const validNow = !fieldState.error && field.value !== void 0 && field.value !== "";
2641
- if (validNow !== isValid2) setIsValid(validNow);
2645
+ if (validNow !== isValid) setIsValid(validNow);
2642
2646
  return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
2643
2647
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
2644
2648
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(InputGroup, { children: [
@@ -2675,7 +2679,7 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
2675
2679
  /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
2676
2680
  /* @__PURE__ */ jsx(InputGroupText, { children: currencyFormat.currency }),
2677
2681
  input.inputGroupConfig?.textRight && /* @__PURE__ */ jsx(InputGroupText, { children: input.inputGroupConfig.textRight }),
2678
- autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
2682
+ autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
2679
2683
  ] })
2680
2684
  ] }) }),
2681
2685
  /* @__PURE__ */ jsx(FormMessage, {})
@@ -2684,1562 +2688,6 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
2684
2688
  }
2685
2689
  );
2686
2690
  };
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
2691
  var DateInput = class extends BaseInput {
4244
2692
  render() {
4245
2693
  const { input, form, isSubmitting } = this;
@@ -4247,7 +2695,8 @@ var DateInput = class extends BaseInput {
4247
2695
  }
4248
2696
  };
4249
2697
  var FieldTimeInput = ({ form, input, isSubmitting }) => {
4250
- const [isValid2, setIsValid] = useState(isValidField(input, form));
2698
+ const [isValid, setIsValid] = useState(isValidField(input, form));
2699
+ const infoTooltip = input?.infoTooltip;
4251
2700
  const groupConfig = input.inputGroupConfig;
4252
2701
  const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
4253
2702
  const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
@@ -4280,33 +2729,42 @@ var FieldTimeInput = ({ form, input, isSubmitting }) => {
4280
2729
  return /* @__PURE__ */ jsxs(FormItem, { children: [
4281
2730
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4282
2731
  /* @__PURE__ */ jsxs(Popover, { children: [
4283
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(InputGroup, { className: "flex flex-row gap-1", children: /* @__PURE__ */ jsxs(
4284
- Button,
4285
- {
4286
- variant: "outline",
4287
- className: cn(
4288
- "w-full justify-start text-left py-0.5 ",
4289
- !date && "text-muted-foreground"
4290
- ),
4291
- children: [
4292
- /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-1 justify-start text-left ", children: [
4293
- /* @__PURE__ */ jsx(CalendarIcon, {}),
4294
- date ? format(date, "PPP") : /* @__PURE__ */ jsx("span", { children: input.placeHolder ?? "Fecha" })
4295
- ] }),
4296
- (iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxs(Fragment, { children: [
4297
- textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
4298
- iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 24, className: "w-6! h-6!" }, index)),
4299
- autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
4300
- ] })
4301
- ]
4302
- }
4303
- ) }) }) }),
4304
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", children: /* @__PURE__ */ jsx(
2732
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(InputGroup, { className: "flex flex-row gap-1", children: [
2733
+ infoTooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [
2734
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Info, { size: 20 }) }),
2735
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: infoTooltip }) })
2736
+ ] }),
2737
+ /* @__PURE__ */ jsxs(
2738
+ Button,
2739
+ {
2740
+ variant: "outline",
2741
+ type: "button",
2742
+ className: cn(
2743
+ "w-full justify-start text-left py-0.5 ",
2744
+ !date && "text-muted-foreground"
2745
+ ),
2746
+ children: [
2747
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-1 justify-start text-left ", children: [
2748
+ /* @__PURE__ */ jsx(CalendarIcon, {}),
2749
+ date ? format(date, "PPP") : /* @__PURE__ */ jsx("span", { children: input.placeHolder ?? "Fecha" })
2750
+ ] }),
2751
+ (iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxs(Fragment, { children: [
2752
+ textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
2753
+ iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 24, className: "w-6! h-6!" }, index)),
2754
+ autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
2755
+ ] })
2756
+ ]
2757
+ }
2758
+ )
2759
+ ] }) }) }),
2760
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
4305
2761
  Calendar,
4306
2762
  {
4307
2763
  mode: "single",
2764
+ defaultMonth: date,
4308
2765
  selected: date,
4309
2766
  onSelect: handleSelect,
2767
+ captionLayout: "dropdown",
4310
2768
  initialFocus: true
4311
2769
  }
4312
2770
  ) })
@@ -4336,7 +2794,7 @@ var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
4336
2794
  const iconsLeft = groupConfig?.iconsLeft ?? [];
4337
2795
  const textLeft = groupConfig?.textLeft;
4338
2796
  const textRight = groupConfig?.textRight;
4339
- const [isValid2, setIsValid] = useState(() => {
2797
+ const [isValid, setIsValid] = useState(() => {
4340
2798
  const value = form.getValues(input.name);
4341
2799
  const fieldState = form.getFieldState(input.name);
4342
2800
  return !fieldState.error && value !== void 0 && value !== "";
@@ -4357,7 +2815,7 @@ var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
4357
2815
  name: input.name,
4358
2816
  render: ({ field, fieldState }) => {
4359
2817
  const validNow = !fieldState.error && field.value !== void 0 && field.value !== "";
4360
- if (validNow !== isValid2) setIsValid(validNow);
2818
+ if (validNow !== isValid) setIsValid(validNow);
4361
2819
  return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
4362
2820
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4363
2821
  /* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children: /* @__PURE__ */ jsxs(InputGroup, { children: [
@@ -4380,7 +2838,7 @@ var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
4380
2838
  (iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
4381
2839
  textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
4382
2840
  iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 24 }, index)),
4383
- autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
2841
+ autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
4384
2842
  ] })
4385
2843
  ] }) }),
4386
2844
  input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
@@ -4483,7 +2941,7 @@ var FieldFileMultiUpload = ({ input, form, isSubmitting }) => {
4483
2941
  control: form.control,
4484
2942
  name: input.name,
4485
2943
  render: ({ field, fieldState }) => {
4486
- const isValid2 = !fieldState.error && files.length > 0;
2944
+ const isValid = !fieldState.error && files.length > 0;
4487
2945
  return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
4488
2946
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4489
2947
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(
@@ -4536,7 +2994,7 @@ var FieldFileMultiUpload = ({ input, form, isSubmitting }) => {
4536
2994
  )
4537
2995
  ] }, idx)) }),
4538
2996
  input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
4539
- autoValidate && /* @__PURE__ */ jsx("div", { className: "mt-1", children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState }),
2997
+ autoValidate && /* @__PURE__ */ jsx("div", { className: "mt-1", children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState }),
4540
2998
  /* @__PURE__ */ jsx(FormMessage, {})
4541
2999
  ] });
4542
3000
  }
@@ -4552,7 +3010,7 @@ var TextInputGroup = class extends BaseInput {
4552
3010
  }
4553
3011
  };
4554
3012
  var FieldTextGroup = ({ form, input, isSubmitting }) => {
4555
- const [isValid2, setIsValid] = useState(isValidField(input, form));
3013
+ const [isValid, setIsValid] = useState(isValidField(input, form));
4556
3014
  const formField = /* @__PURE__ */ jsx(
4557
3015
  FormField,
4558
3016
  {
@@ -4567,7 +3025,7 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
4567
3025
  isSubmitting,
4568
3026
  field,
4569
3027
  form,
4570
- isValid: isValid2
3028
+ isValid
4571
3029
  }) }),
4572
3030
  input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
4573
3031
  /* @__PURE__ */ jsx(FormMessage, {})
@@ -4585,7 +3043,7 @@ var CustomInputGroup = ({
4585
3043
  form,
4586
3044
  isSubmitting,
4587
3045
  onChange,
4588
- isValid: isValid2
3046
+ isValid
4589
3047
  }) => {
4590
3048
  const groupConfig = input.inputGroupConfig;
4591
3049
  const infoTooltip = input?.infoTooltip;
@@ -4646,7 +3104,7 @@ var CustomInputGroup = ({
4646
3104
  children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 20 }) : /* @__PURE__ */ jsx(Eye, { size: 20 })
4647
3105
  }
4648
3106
  ),
4649
- autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
3107
+ autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
4650
3108
  ] })
4651
3109
  ] });
4652
3110
  };
@@ -4975,7 +3433,7 @@ var FieldRepeater = ({ form, input, isSubmitting }) => {
4975
3433
  });
4976
3434
  const canAdd = !input.maxItems || fields.length < input.maxItems;
4977
3435
  const canRemove = fields.length > (input.minItems ?? 0);
4978
- const [isValid2, setIsValid] = useState(isValidField(input, form));
3436
+ const [isValid, setIsValid] = useState(isValidField(input, form));
4979
3437
  useEffect(() => {
4980
3438
  setIsValid(isValidField(input, form));
4981
3439
  }, [input]);
@@ -5012,7 +3470,7 @@ var FieldRepeater = ({ form, input, isSubmitting }) => {
5012
3470
  autoValidate: true,
5013
3471
  value: field.value,
5014
3472
  input: subField,
5015
- isValid: isValid2,
3473
+ isValid,
5016
3474
  field,
5017
3475
  form
5018
3476
  }
@@ -5619,7 +4077,7 @@ var StringValueListInput = class extends BaseInput {
5619
4077
  var FieldStringValueList = ({ form, input, isSubmitting }) => {
5620
4078
  const fieldName = input.name;
5621
4079
  const withAddBtn = input.withAddBtn ?? false;
5622
- const [isValid2, setIsValid] = useState(isValidField(input, form));
4080
+ const [isValid, setIsValid] = useState(isValidField(input, form));
5623
4081
  useEffect(() => {
5624
4082
  setIsValid(isValidField(input, form));
5625
4083
  }, [input]);
@@ -5668,7 +4126,7 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
5668
4126
  autoValidate: true,
5669
4127
  value,
5670
4128
  input,
5671
- isValid: isValid2,
4129
+ isValid,
5672
4130
  onChange: (e) => handleChange(index, e.target.value),
5673
4131
  form
5674
4132
  }
@@ -5937,7 +4395,7 @@ var FieldTimeInput2 = ({ form, input, isSubmitting }) => {
5937
4395
  const iconsLeft = groupConfig?.iconsLeft ?? [];
5938
4396
  const textLeft = groupConfig?.textLeft;
5939
4397
  const textRight = groupConfig?.textRight;
5940
- const [isValid2, setIsValid] = useState(() => {
4398
+ const [isValid, setIsValid] = useState(() => {
5941
4399
  const value = form.getValues(input.name);
5942
4400
  const fieldState = form.getFieldState(input.name);
5943
4401
  return !fieldState.error && value !== void 0 && value !== "";
@@ -5954,7 +4412,7 @@ var FieldTimeInput2 = ({ form, input, isSubmitting }) => {
5954
4412
  name: input.name,
5955
4413
  render: ({ field, fieldState }) => {
5956
4414
  const validNow = !fieldState.error && field.value !== void 0 && field.value !== "";
5957
- if (validNow !== isValid2) setIsValid(validNow);
4415
+ if (validNow !== isValid) setIsValid(validNow);
5958
4416
  const handleChange = (val) => {
5959
4417
  setTime(val);
5960
4418
  handleOnChage(val, input, field);
@@ -5979,7 +4437,7 @@ var FieldTimeInput2 = ({ form, input, isSubmitting }) => {
5979
4437
  (iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
5980
4438
  textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
5981
4439
  iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index)),
5982
- autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
4440
+ autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
5983
4441
  ] })
5984
4442
  ] }) }),
5985
4443
  input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
@@ -6220,7 +4678,10 @@ var DynamicForm = ({
6220
4678
  withFormWrapper = true,
6221
4679
  btnGroupDirection = "flex-end",
6222
4680
  withSubmitBtn = true,
6223
- debug = false
4681
+ debug = false,
4682
+ isWrapInWizard = false,
4683
+ totalSteps = 0,
4684
+ currentStep = 1
6224
4685
  }) => {
6225
4686
  const [isPending, startTransition] = useTransition();
6226
4687
  const schema = useMemo(() => {
@@ -6245,8 +4706,8 @@ var DynamicForm = ({
6245
4706
  };
6246
4707
  const handleClick = async () => {
6247
4708
  if (!onClick) return;
6248
- const isValid2 = await form.trigger();
6249
- if (!isValid2) return;
4709
+ const isValid = await form.trigger();
4710
+ if (!isValid) return;
6250
4711
  const data = form.watch();
6251
4712
  const resp = { data, form };
6252
4713
  onClick(resp);
@@ -6291,11 +4752,11 @@ var DynamicForm = ({
6291
4752
  disabled: isPending,
6292
4753
  onClick: onClick ? handleClick : void 0,
6293
4754
  children: isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [
6294
- /* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 mr-2 animate-spin" }),
6295
- submitBtnLabelSubmiting
4755
+ submitBtnLabelSubmiting,
4756
+ /* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 mr-2 animate-spin" })
6296
4757
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
6297
- /* @__PURE__ */ jsx(Save, { className: "h-5 w-5 mr-2" }),
6298
- submitBtnLabel
4758
+ submitBtnLabel,
4759
+ (totalSteps == 0 || totalSteps == currentStep) && /* @__PURE__ */ jsx(Save, { className: "h-5 w-5 mr-2" })
6299
4760
  ] })
6300
4761
  }
6301
4762
  )
@@ -6319,7 +4780,15 @@ var DynamicForm = ({
6319
4780
  fields
6320
4781
  }
6321
4782
  ),
6322
- withFormWrapper && /* @__PURE__ */ jsx(FormWrapper, { form, handleSubmit, children: formBody }),
4783
+ withFormWrapper && /* @__PURE__ */ jsx(
4784
+ FormWrapper,
4785
+ {
4786
+ form,
4787
+ isWrapInWizard,
4788
+ handleSubmit,
4789
+ children: formBody
4790
+ }
4791
+ ),
6323
4792
  !withFormWrapper && formBody,
6324
4793
  withErrorsAlert && errorAlertPosition === "down" && /* @__PURE__ */ jsx(
6325
4794
  FormErrorsAlert,
@@ -6332,7 +4801,7 @@ var DynamicForm = ({
6332
4801
  if (!withCard) return formContent;
6333
4802
  return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { children: formContent }) });
6334
4803
  };
6335
- var FormWrapper = ({ form, handleSubmit, children, readOnly, debug }) => {
4804
+ var FormWrapper = ({ form, handleSubmit, children, readOnly, debug, isWrapInWizard }) => {
6336
4805
  const allValues = form.watch();
6337
4806
  return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs(
6338
4807
  "form",
@@ -6404,7 +4873,10 @@ function Stepper({ steps, currentStep, clickable = false, onStepClick }) {
6404
4873
  var WizardForm = ({
6405
4874
  fields,
6406
4875
  record,
6407
- onSubmit
4876
+ onSubmit,
4877
+ children,
4878
+ isWrapInWizard = true,
4879
+ skipSteps = false
6408
4880
  }) => {
6409
4881
  const [currentStep, setCurrentStep] = useState(1);
6410
4882
  const flattenFields4 = (list) => list.flatMap((f) => Array.isArray(f) ? flattenFields4(f) : f);
@@ -6415,40 +4887,21 @@ var WizardForm = ({
6415
4887
  );
6416
4888
  const stepFields = allFields.filter((f) => (f.step ?? 1) === currentStep);
6417
4889
  return /* @__PURE__ */ jsxs(Card, { className: "flex flex-col gap-4 px-4", children: [
6418
- /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-4 gap-2 px-4", children: [
6419
- /* @__PURE__ */ jsx(
6420
- Stepper,
6421
- {
6422
- steps: Array(totalSteps).fill({}),
6423
- currentStep,
6424
- clickable: true,
6425
- onStepClick: setCurrentStep
6426
- }
6427
- ),
6428
- /* @__PURE__ */ jsxs("div", { className: "flex justify-center space-x-4 gap-2", children: [
6429
- /* @__PURE__ */ jsx(
6430
- Button,
6431
- {
6432
- variant: "outline",
6433
- className: "w-32",
6434
- onClick: () => setCurrentStep((prev) => prev - 1),
6435
- disabled: currentStep === 1,
6436
- children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
6437
- }
6438
- ),
6439
- /* @__PURE__ */ jsx(
6440
- Button,
6441
- {
6442
- variant: "outline",
6443
- className: "w-32",
6444
- onClick: () => setCurrentStep((prev) => prev + 1),
6445
- disabled: currentStep > totalSteps,
6446
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
6447
- }
6448
- )
6449
- ] })
6450
- ] }) }),
6451
- /* @__PURE__ */ jsx(
4890
+ /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx("div", { className: "flex justify-between mb-4 gap-2 px-4", children: /* @__PURE__ */ jsx(
4891
+ Stepper,
4892
+ {
4893
+ steps: Array(totalSteps).fill({}),
4894
+ currentStep,
4895
+ clickable: skipSteps,
4896
+ onStepClick: setCurrentStep
4897
+ }
4898
+ ) }) }),
4899
+ children ? children({
4900
+ stepFields,
4901
+ currentStep,
4902
+ totalSteps,
4903
+ setCurrentStep
4904
+ }) : /* @__PURE__ */ jsx(
6452
4905
  DynamicForm,
6453
4906
  {
6454
4907
  record,
@@ -6457,7 +4910,10 @@ var WizardForm = ({
6457
4910
  withCard: false,
6458
4911
  errorAlertPosition: "down",
6459
4912
  fields: stepFields,
6460
- onSubmit
4913
+ onSubmit,
4914
+ isWrapInWizard: true,
4915
+ currentStep,
4916
+ totalSteps
6461
4917
  }
6462
4918
  )
6463
4919
  ] });