dgz-ui-shared 1.2.18 → 1.2.20

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.
@@ -0,0 +1,177 @@
1
+ import { jsxs as n, jsx as s } from "react/jsx-runtime";
2
+ import { Button as k } from "dgz-ui/button";
3
+ import { DATE as L, Calendar as d } from "dgz-ui/calendar";
4
+ import { Input as w } from "dgz-ui/form";
5
+ import { Popover as P, PopoverTrigger as A, PopoverContent as M } from "dgz-ui/popover";
6
+ import { cn as c } from "dgz-ui/utils";
7
+ import { XIcon as z, Calendar1 as E } from "lucide-react";
8
+ import { useState as v, useEffect as F, useMemo as I } from "react";
9
+ import { useTranslation as Z } from "react-i18next";
10
+ const Q = ({
11
+ className: O,
12
+ format: l = L,
13
+ selected: r,
14
+ timezone: h,
15
+ onRangeSelected: m = () => {
16
+ },
17
+ placeholder: T,
18
+ disabled: i,
19
+ error: x,
20
+ inputProps: N,
21
+ ...p
22
+ }) => {
23
+ const { t: a } = Z(), [j, y] = v(!1), [t, f] = v();
24
+ F(() => {
25
+ f(r);
26
+ }, [r]);
27
+ const C = I(() => {
28
+ const o = dayjs().endOf("day");
29
+ return [
30
+ {
31
+ from: o.startOf("week").toDate(),
32
+ to: o.endOf("week").toDate(),
33
+ label: a("This week")
34
+ },
35
+ {
36
+ from: o.startOf("month").toDate(),
37
+ to: o.endOf("month").toDate(),
38
+ label: a("This month")
39
+ },
40
+ {
41
+ from: o.startOf("year").toDate(),
42
+ to: o.endOf("year").toDate(),
43
+ label: a("This year")
44
+ },
45
+ {
46
+ from: o.subtract(7, "day").startOf("day").toDate(),
47
+ to: o.toDate(),
48
+ label: a("Last 7 days")
49
+ },
50
+ {
51
+ from: o.subtract(30, "day").startOf("day").toDate(),
52
+ to: o.toDate(),
53
+ label: a("Last 30 days")
54
+ },
55
+ {
56
+ from: o.subtract(3, "month").startOf("day").toDate(),
57
+ to: o.toDate(),
58
+ label: a("Last 3 months")
59
+ },
60
+ {
61
+ from: o.subtract(6, "month").startOf("day").toDate(),
62
+ to: o.toDate(),
63
+ label: a("Last 6 months")
64
+ },
65
+ {
66
+ from: o.subtract(12, "month").startOf("day").toDate(),
67
+ to: o.toDate(),
68
+ label: a("Last 12 months")
69
+ }
70
+ ].map((e) => {
71
+ var D, b;
72
+ return {
73
+ ...e,
74
+ isActive: ((D = r == null ? void 0 : r.from) == null ? void 0 : D.getTime()) === e.from.getTime() && ((b = r == null ? void 0 : r.to) == null ? void 0 : b.getTime()) === e.to.getTime()
75
+ };
76
+ });
77
+ }, [a, r]), u = (o) => {
78
+ f(o), o != null && o.from && (o != null && o.to) && (m(o), y(!1));
79
+ };
80
+ return /* @__PURE__ */ n(P, { open: j, onOpenChange: y, children: [
81
+ /* @__PURE__ */ s(A, { asChild: !0, className: "m-0!", disabled: i, children: /* @__PURE__ */ n("div", { className: "relative", children: [
82
+ /* @__PURE__ */ s(
83
+ w,
84
+ {
85
+ variant: x ? "failure" : "default",
86
+ ...N,
87
+ readOnly: !0,
88
+ value: t != null && t.from ? t.to ? `${dayjs(t.from).format(l)}-${dayjs(t.to).format(l)}` : dayjs(t.from).format(l) : "",
89
+ placeholder: T,
90
+ disabled: i,
91
+ className: c(O)
92
+ }
93
+ ),
94
+ t && /* @__PURE__ */ s(
95
+ z,
96
+ {
97
+ onClick: () => {
98
+ f(void 0), m == null || m(void 0);
99
+ },
100
+ className: c(
101
+ "text-secondary absolute top-3 right-8 size-4 cursor-pointer",
102
+ i && "pointer-events-none opacity-50"
103
+ )
104
+ }
105
+ ),
106
+ /* @__PURE__ */ s(
107
+ E,
108
+ {
109
+ className: c(
110
+ "text-secondary absolute top-2.5 right-2 size-5",
111
+ i && "pointer-events-none opacity-50"
112
+ )
113
+ }
114
+ )
115
+ ] }) }),
116
+ /* @__PURE__ */ n(M, { className: "flex w-auto p-0", align: "end", side: "bottom", children: [
117
+ /* @__PURE__ */ s(
118
+ "div",
119
+ {
120
+ className: "border-border-alpha-light flex flex-col space-y-1 border-e p-2",
121
+ children: C.map((o, e) => /* @__PURE__ */ s(
122
+ k,
123
+ {
124
+ size: "xs",
125
+ variant: o.isActive ? "default" : "ghost",
126
+ className: "justify-start",
127
+ onClick: () => u(o),
128
+ children: o.label
129
+ },
130
+ e
131
+ ))
132
+ }
133
+ ),
134
+ /* @__PURE__ */ s(
135
+ d,
136
+ {
137
+ ...p,
138
+ className: "border-border-alpha-light border-e",
139
+ mode: "single",
140
+ endMonth: t == null ? void 0 : t.to,
141
+ selected: t == null ? void 0 : t.from,
142
+ selectedToDate: t == null ? void 0 : t.to,
143
+ selectedFromDate: t == null ? void 0 : t.from,
144
+ timeZone: h,
145
+ disabled: t != null && t.to ? {
146
+ after: t.to
147
+ } : void 0,
148
+ onSelect: (o) => {
149
+ f({ ...t, from: o });
150
+ }
151
+ }
152
+ ),
153
+ /* @__PURE__ */ s(
154
+ d,
155
+ {
156
+ ...p,
157
+ mode: "single",
158
+ startMonth: t == null ? void 0 : t.from,
159
+ selected: t == null ? void 0 : t.to,
160
+ timeZone: h,
161
+ disabled: t != null && t.from ? {
162
+ before: t.from
163
+ } : void 0,
164
+ selectedToDate: t == null ? void 0 : t.to,
165
+ selectedFromDate: t == null ? void 0 : t.from,
166
+ onSelect: (o) => {
167
+ t && u({ ...t, to: o });
168
+ }
169
+ }
170
+ )
171
+ ] })
172
+ ] });
173
+ };
174
+ export {
175
+ Q as D
176
+ };
177
+ //# sourceMappingURL=DateRangePicker-BEguo3VF.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateRangePicker-BEguo3VF.es.js","sources":["../../src/components/datepicker/DateRangePicker.tsx"],"sourcesContent":["import { Button } from 'dgz-ui/button';\nimport { Calendar, type CalendarProps, DATE } from 'dgz-ui/calendar';\nimport { Input, type InputProps } from 'dgz-ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from 'dgz-ui/popover';\nimport { cn } from 'dgz-ui/utils';\nimport { Calendar1, XIcon } from 'lucide-react';\nimport { type ReactNode, useEffect, useMemo, useState } from 'react';\nimport { type DateRange } from 'react-day-picker';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * Props for the DateRangePicker component.\n */\nexport type DateRangePickerProps = Omit<\n CalendarProps,\n 'mode' | 'disabled' | 'selected'\n> & {\n /** The date format string (e.g., 'YYYY-MM-DD'). */\n format?: string;\n /** Placeholder text when no date is selected. */\n placeholder?: string;\n /** The currently selected date range. */\n selected?: DateRange;\n /** Timezone for date calculations. */\n timezone?: string;\n /** Error message to display (modifies styling). */\n error?: string;\n /** Callback function when a date range is selected. */\n onRangeSelected?: (value?: DateRange) => void;\n inputProps?: InputProps;\n disabled?: boolean;\n};\n\n/**\n * Type definition for a date range preset configuration.\n */\ntype PresetType = DateRange & {\n /** Label for the preset (e.g., \"Last 7 days\"). */\n label: ReactNode;\n isActive?: boolean;\n};\n\n/**\n * DateRangePicker displays a two-month range picker with helpful presets.\n *\n * @param props.format - Display date format.\n * @param props.selected - Currently selected date range.\n * @param props.timezone - Time zone for date calculations.\n * @param props.onRangeSelected - Callback when a full range is selected.\n * @param props.placeholder - Placeholder when no date selected.\n * @param props.error - Optional error message that adjusts styling.\n * @param props.inputProps - Props passed to the underlying Input component.\n * @param props.disabled - Whether the date range picker is disabled.\n * @returns A date range picker component.\n */\nexport const DateRangePicker = ({\n className,\n format = DATE,\n selected,\n timezone,\n onRangeSelected = () => {},\n placeholder,\n disabled,\n error,\n inputProps,\n ...props\n}: DateRangePickerProps) => {\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const [date, setDate] = useState<DateRange | undefined>();\n\n useEffect(() => {\n setDate(selected);\n }, [selected]);\n\n const presets: PresetType[] = useMemo(() => {\n const today = dayjs().endOf('day');\n return [\n {\n from: today.startOf('week').toDate(),\n to: today.endOf('week').toDate(),\n label: t('This week'),\n },\n {\n from: today.startOf('month').toDate(),\n to: today.endOf('month').toDate(),\n label: t('This month'),\n },\n {\n from: today.startOf('year').toDate(),\n to: today.endOf('year').toDate(),\n label: t('This year'),\n },\n {\n from: today.subtract(7, 'day').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 7 days'),\n },\n {\n from: today.subtract(30, 'day').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 30 days'),\n },\n {\n from: today.subtract(3, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 3 months'),\n },\n {\n from: today.subtract(6, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 6 months'),\n },\n {\n from: today.subtract(12, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 12 months'),\n },\n ].map((item) => ({\n ...item,\n isActive:\n selected?.from?.getTime() === item.from.getTime() &&\n selected?.to?.getTime() === item.to.getTime(),\n }));\n }, [t, selected]);\n\n const handleRangeSelect = (range: DateRange) => {\n setDate(range);\n if (range?.from && range?.to) {\n onRangeSelected(range);\n setOpen(false);\n }\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild className={'m-0!'} disabled={disabled}>\n <div className={'relative'}>\n <Input\n variant={error ? 'failure' : 'default'}\n {...inputProps}\n readOnly\n value={\n date?.from\n ? date.to\n ? `${dayjs(date.from).format(format)}-${dayjs(date.to).format(format)}`\n : dayjs(date.from).format(format)\n : ''\n }\n placeholder={placeholder}\n disabled={disabled}\n className={cn(className)}\n />\n {date && (\n <XIcon\n onClick={() => {\n setDate(undefined);\n onRangeSelected?.(undefined);\n }}\n className={cn(\n 'text-secondary absolute top-3 right-8 size-4 cursor-pointer',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n )}\n <Calendar1\n className={cn(\n 'text-secondary absolute top-2.5 right-2 size-5',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n </div>\n </PopoverTrigger>\n <PopoverContent className=\"flex w-auto p-0\" align=\"end\" side={'bottom'}>\n <div\n className={\n 'border-border-alpha-light flex flex-col space-y-1 border-e p-2'\n }\n >\n {presets.map((preset, index) => (\n <Button\n size={'xs'}\n key={index}\n variant={preset.isActive ? 'default' : 'ghost'}\n className={'justify-start'}\n onClick={() => handleRangeSelect(preset)}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n <Calendar\n {...props}\n className={'border-border-alpha-light border-e'}\n mode=\"single\"\n endMonth={date?.to}\n selected={date?.from}\n selectedToDate={date?.to}\n selectedFromDate={date?.from}\n timeZone={timezone}\n disabled={\n date?.to\n ? {\n after: date.to,\n }\n : undefined\n }\n onSelect={(from) => {\n setDate({ ...date, from: from as Date | undefined });\n }}\n />\n <Calendar\n {...props}\n mode=\"single\"\n startMonth={date?.from}\n selected={date?.to}\n timeZone={timezone}\n disabled={\n date?.from\n ? {\n before: date.from,\n }\n : undefined\n }\n selectedToDate={date?.to}\n selectedFromDate={date?.from}\n onSelect={(to) => {\n if (date) {\n handleRangeSelect({ ...date, to: to as Date | undefined });\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n};\n"],"names":["DateRangePicker","className","format","DATE","selected","timezone","onRangeSelected","placeholder","disabled","error","inputProps","props","t","useTranslation","open","setOpen","useState","date","setDate","useEffect","presets","useMemo","today","item","_a","_b","handleRangeSelect","range","jsxs","Popover","jsx","PopoverTrigger","Input","cn","XIcon","Calendar1","PopoverContent","preset","index","Button","Calendar","from","to"],"mappings":";;;;;;;;;AAuDO,MAAMA,IAAkB,CAAC;AAAA,EAC9B,WAAAC;AAAA,EACA,QAAAC,IAASC;AAAA,EACT,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC,IAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,MAA4B;AAC1B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAK,GAChC,CAACC,GAAMC,CAAO,IAAIF,EAAA;AAExB,EAAAG,EAAU,MAAM;AACd,IAAAD,EAAQd,CAAQ;AAAA,EAClB,GAAG,C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E,GAAGD,GAAM,MAAAwB,GAAgC;AAAA,UACrD;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,gBAAAX;AAAA,QAACU;AAAA,QAAA;AAAA,UACE,GAAG7B;AAAA,UACJ,MAAK;AAAA,UACL,YAAYM,KAAA,gBAAAA,EAAM;AAAA,UAClB,UAAUA,KAAA,gBAAAA,EAAM;AAAA,UAChB,UAAUZ;AAAA,UACV,UACEY,KAAA,QAAAA,EAAM,OACF;AAAA,YACE,QAAQA,EAAK;AAAA,UAAA,IAEf;AAAA,UAEN,gBAAgBA,KAAA,gBAAAA,EAAM;AAAA,UACtB,kBAAkBA,KAAA,gBAAAA,EAAM;AAAA,UACxB,UAAU,CAACyB,MAAO;AAChB,YAAIzB,KACFS,EAAkB,EAAE,GAAGT,GAAM,IAAAyB,GAA4B;AAAA,UAE7D;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const e=require("react/jsx-runtime"),k=require("dgz-ui/button"),f=require("dgz-ui/calendar"),L=require("dgz-ui/form"),u=require("dgz-ui/popover"),h=require("dgz-ui/utils"),v=require("lucide-react"),m=require("react"),P=require("react-i18next"),w=({className:j,format:c=f.DATE,selected:s,timezone:y,onRangeSelected:n=()=>{},placeholder:O,disabled:i,error:T,inputProps:q,...b})=>{const{t:r}=P.useTranslation(),[N,D]=m.useState(!1),[t,l]=m.useState();m.useEffect(()=>{l(s)},[s]);const C=m.useMemo(()=>{const o=dayjs().endOf("day");return[{from:o.startOf("week").toDate(),to:o.endOf("week").toDate(),label:r("This week")},{from:o.startOf("month").toDate(),to:o.endOf("month").toDate(),label:r("This month")},{from:o.startOf("year").toDate(),to:o.endOf("year").toDate(),label:r("This year")},{from:o.subtract(7,"day").startOf("day").toDate(),to:o.toDate(),label:r("Last 7 days")},{from:o.subtract(30,"day").startOf("day").toDate(),to:o.toDate(),label:r("Last 30 days")},{from:o.subtract(3,"month").startOf("day").toDate(),to:o.toDate(),label:r("Last 3 months")},{from:o.subtract(6,"month").startOf("day").toDate(),to:o.toDate(),label:r("Last 6 months")},{from:o.subtract(12,"month").startOf("day").toDate(),to:o.toDate(),label:r("Last 12 months")}].map(a=>{var p,x;return{...a,isActive:((p=s==null?void 0:s.from)==null?void 0:p.getTime())===a.from.getTime()&&((x=s==null?void 0:s.to)==null?void 0:x.getTime())===a.to.getTime()}})},[r,s]),d=o=>{l(o),o!=null&&o.from&&(o!=null&&o.to)&&(n(o),D(!1))};return e.jsxs(u.Popover,{open:N,onOpenChange:D,children:[e.jsx(u.PopoverTrigger,{asChild:!0,className:"m-0!",disabled:i,children:e.jsxs("div",{className:"relative",children:[e.jsx(L.Input,{variant:T?"failure":"default",...q,readOnly:!0,value:t!=null&&t.from?t.to?`${dayjs(t.from).format(c)}-${dayjs(t.to).format(c)}`:dayjs(t.from).format(c):"",placeholder:O,disabled:i,className:h.cn(j)}),t&&e.jsx(v.XIcon,{onClick:()=>{l(void 0),n==null||n(void 0)},className:h.cn("text-secondary absolute top-3 right-8 size-4 cursor-pointer",i&&"pointer-events-none opacity-50")}),e.jsx(v.Calendar1,{className:h.cn("text-secondary absolute top-2.5 right-2 size-5",i&&"pointer-events-none opacity-50")})]})}),e.jsxs(u.PopoverContent,{className:"flex w-auto p-0",align:"end",side:"bottom",children:[e.jsx("div",{className:"border-border-alpha-light flex flex-col space-y-1 border-e p-2",children:C.map((o,a)=>e.jsx(k.Button,{size:"xs",variant:o.isActive?"default":"ghost",className:"justify-start",onClick:()=>d(o),children:o.label},a))}),e.jsx(f.Calendar,{...b,className:"border-border-alpha-light border-e",mode:"single",endMonth:t==null?void 0:t.to,selected:t==null?void 0:t.from,selectedToDate:t==null?void 0:t.to,selectedFromDate:t==null?void 0:t.from,timeZone:y,disabled:t!=null&&t.to?{after:t.to}:void 0,onSelect:o=>{l({...t,from:o})}}),e.jsx(f.Calendar,{...b,mode:"single",startMonth:t==null?void 0:t.from,selected:t==null?void 0:t.to,timeZone:y,disabled:t!=null&&t.from?{before:t.from}:void 0,selectedToDate:t==null?void 0:t.to,selectedFromDate:t==null?void 0:t.from,onSelect:o=>{t&&d({...t,to:o})}})]})]})};exports.DateRangePicker=w;
2
+ //# sourceMappingURL=DateRangePicker-lHqe5Mb6.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateRangePicker-lHqe5Mb6.cjs.js","sources":["../../src/components/datepicker/DateRangePicker.tsx"],"sourcesContent":["import { Button } from 'dgz-ui/button';\nimport { Calendar, type CalendarProps, DATE } from 'dgz-ui/calendar';\nimport { Input, type InputProps } from 'dgz-ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from 'dgz-ui/popover';\nimport { cn } from 'dgz-ui/utils';\nimport { Calendar1, XIcon } from 'lucide-react';\nimport { type ReactNode, useEffect, useMemo, useState } from 'react';\nimport { type DateRange } from 'react-day-picker';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * Props for the DateRangePicker component.\n */\nexport type DateRangePickerProps = Omit<\n CalendarProps,\n 'mode' | 'disabled' | 'selected'\n> & {\n /** The date format string (e.g., 'YYYY-MM-DD'). */\n format?: string;\n /** Placeholder text when no date is selected. */\n placeholder?: string;\n /** The currently selected date range. */\n selected?: DateRange;\n /** Timezone for date calculations. */\n timezone?: string;\n /** Error message to display (modifies styling). */\n error?: string;\n /** Callback function when a date range is selected. */\n onRangeSelected?: (value?: DateRange) => void;\n inputProps?: InputProps;\n disabled?: boolean;\n};\n\n/**\n * Type definition for a date range preset configuration.\n */\ntype PresetType = DateRange & {\n /** Label for the preset (e.g., \"Last 7 days\"). */\n label: ReactNode;\n isActive?: boolean;\n};\n\n/**\n * DateRangePicker displays a two-month range picker with helpful presets.\n *\n * @param props.format - Display date format.\n * @param props.selected - Currently selected date range.\n * @param props.timezone - Time zone for date calculations.\n * @param props.onRangeSelected - Callback when a full range is selected.\n * @param props.placeholder - Placeholder when no date selected.\n * @param props.error - Optional error message that adjusts styling.\n * @param props.inputProps - Props passed to the underlying Input component.\n * @param props.disabled - Whether the date range picker is disabled.\n * @returns A date range picker component.\n */\nexport const DateRangePicker = ({\n className,\n format = DATE,\n selected,\n timezone,\n onRangeSelected = () => {},\n placeholder,\n disabled,\n error,\n inputProps,\n ...props\n}: DateRangePickerProps) => {\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const [date, setDate] = useState<DateRange | undefined>();\n\n useEffect(() => {\n setDate(selected);\n }, [selected]);\n\n const presets: PresetType[] = useMemo(() => {\n const today = dayjs().endOf('day');\n return [\n {\n from: today.startOf('week').toDate(),\n to: today.endOf('week').toDate(),\n label: t('This week'),\n },\n {\n from: today.startOf('month').toDate(),\n to: today.endOf('month').toDate(),\n label: t('This month'),\n },\n {\n from: today.startOf('year').toDate(),\n to: today.endOf('year').toDate(),\n label: t('This year'),\n },\n {\n from: today.subtract(7, 'day').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 7 days'),\n },\n {\n from: today.subtract(30, 'day').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 30 days'),\n },\n {\n from: today.subtract(3, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 3 months'),\n },\n {\n from: today.subtract(6, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 6 months'),\n },\n {\n from: today.subtract(12, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 12 months'),\n },\n ].map((item) => ({\n ...item,\n isActive:\n selected?.from?.getTime() === item.from.getTime() &&\n selected?.to?.getTime() === item.to.getTime(),\n }));\n }, [t, selected]);\n\n const handleRangeSelect = (range: DateRange) => {\n setDate(range);\n if (range?.from && range?.to) {\n onRangeSelected(range);\n setOpen(false);\n }\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild className={'m-0!'} disabled={disabled}>\n <div className={'relative'}>\n <Input\n variant={error ? 'failure' : 'default'}\n {...inputProps}\n readOnly\n value={\n date?.from\n ? date.to\n ? `${dayjs(date.from).format(format)}-${dayjs(date.to).format(format)}`\n : dayjs(date.from).format(format)\n : ''\n }\n placeholder={placeholder}\n disabled={disabled}\n className={cn(className)}\n />\n {date && (\n <XIcon\n onClick={() => {\n setDate(undefined);\n onRangeSelected?.(undefined);\n }}\n className={cn(\n 'text-secondary absolute top-3 right-8 size-4 cursor-pointer',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n )}\n <Calendar1\n className={cn(\n 'text-secondary absolute top-2.5 right-2 size-5',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n </div>\n </PopoverTrigger>\n <PopoverContent className=\"flex w-auto p-0\" align=\"end\" side={'bottom'}>\n <div\n className={\n 'border-border-alpha-light flex flex-col space-y-1 border-e p-2'\n }\n >\n {presets.map((preset, index) => (\n <Button\n size={'xs'}\n key={index}\n variant={preset.isActive ? 'default' : 'ghost'}\n className={'justify-start'}\n onClick={() => handleRangeSelect(preset)}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n <Calendar\n {...props}\n className={'border-border-alpha-light border-e'}\n mode=\"single\"\n endMonth={date?.to}\n selected={date?.from}\n selectedToDate={date?.to}\n selectedFromDate={date?.from}\n timeZone={timezone}\n disabled={\n date?.to\n ? {\n after: date.to,\n }\n : undefined\n }\n onSelect={(from) => {\n setDate({ ...date, from: from as Date | undefined });\n }}\n />\n <Calendar\n {...props}\n mode=\"single\"\n startMonth={date?.from}\n selected={date?.to}\n timeZone={timezone}\n disabled={\n date?.from\n ? {\n before: date.from,\n }\n : undefined\n }\n selectedToDate={date?.to}\n selectedFromDate={date?.from}\n onSelect={(to) => {\n if (date) {\n handleRangeSelect({ ...date, to: to as Date | undefined });\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n};\n"],"names":["DateRangePicker","className","format","DATE","selected","timezone","onRangeSelected","placeholder","disabled","error","inputProps","props","t","useTranslation","open","setOpen","useState","date","setDate","useEffect","presets","useMemo","today","item","_a","_b","handleRangeSelect","range","jsxs","Popover","jsx","PopoverTrigger","Input","cn","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AAA,MAAAA,EAAM,KACF,CACE,OAAQA,EAAK,IAAA,EAEf,OAEN,eAAgBA,GAAA,YAAAA,EAAM,GACtB,iBAAkBA,GAAA,YAAAA,EAAM,KACxB,SAAWyB,GAAO,CACZzB,GACFS,EAAkB,CAAE,GAAGT,EAAM,GAAAyB,EAA4B,CAE7D,CAAA,CAAA,CACF,CAAA,CACF,CAAA,EACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/DateRangePicker-H-_fkN-r.cjs.js");exports.DateRangePicker=e.DateRangePicker;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/DateRangePicker-lHqe5Mb6.cjs.js");exports.DateRangePicker=e.DateRangePicker;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1,4 +1,4 @@
1
- import { D as r } from "../../chunks/DateRangePicker-DQoK4BQV.es.js";
1
+ import { D as r } from "../../chunks/DateRangePicker-BEguo3VF.es.js";
2
2
  export {
3
3
  r as DateRangePicker
4
4
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("dgz-ui/form"),e=require("react/jsx-runtime"),F=require("react"),k=require("dayjs"),h=require("dgz-ui/calendar"),u=require("dgz-ui/popover"),i=require("dgz-ui/utils"),y=require("../../chunks/lodash-BjH0kD7j.cjs.js"),b=require("lucide-react"),C=require("../../chunks/DateRangePicker-H-_fkN-r.cjs.js"),v=require("../../chunks/MyInput-C9PNyYby.cjs.js"),I=require("../../chunks/MySelect-Ovb1pK5c.cjs.js"),P=r=>r&&r.__esModule?r:{default:r},q=P(k),S=({control:r,name:a,label:c,rules:o,...l})=>{const n=F.useId();return a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:t})=>e.jsx(s.FormLabel,{className:"block",htmlFor:l.id||n,children:e.jsxs(s.FormItem,{className:"flex flex-row items-start gap-3",children:[e.jsx(s.FormControl,{children:e.jsx(s.Checkbox,{id:l.id||n,checked:t.value,onCheckedChange:t.onChange,...l})}),e.jsx("div",{className:"space-y-1 leading-none",children:c&&e.jsx("div",{children:c})})]})})})||null},R=({control:r,name:a,label:c,required:o,rules:l,format:n=h.DATE,floatingError:t,placeholder:d,disabled:m,register:x,className:N,inputProps:M,...g})=>a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:l,render:({field:j,formState:p})=>e.jsxs(s.FormItem,{className:i.cn(t&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",o&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsxs(u.Popover,{children:[e.jsx(u.PopoverTrigger,{asChild:!0,children:e.jsx(s.FormControl,{children:e.jsxs("div",{className:"relative",children:[e.jsx(s.Input,{...M,variant:y.lodashExports.get(p.errors,`${a}.message`)?"failure":"default",disabled:m,...j,readOnly:!0,placeholder:d||"Pick a date",value:q.default(j.value).format(n),className:i.cn("m-0 text-start",N)}),e.jsx(b.Calendar1,{className:i.cn("text-secondary absolute top-2.5 right-2 size-5",m&&"pointer-events-none opacity-50")})]})})}),!m&&e.jsx(u.PopoverContent,{className:"w-auto p-0",align:"start",children:e.jsx(h.Calendar,{...g,mode:"single",selected:j.value,onSelect:j.onChange})})]}),e.jsx(s.FormMessage,{className:i.cn(t&&"absolute -bottom-5")})]})})||null,T=({control:r,name:a,label:c,required:o,rules:l,placeholder:n,floatingError:t,...d})=>a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:l,render:({field:m,formState:x})=>e.jsxs(s.FormItem,{className:i.cn(t&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",o&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(C.DateRangePicker,{...d,error:`${y.lodashExports.get(x.errors,a,"")}`,selected:m.value,onRangeSelected:m.onChange,placeholder:n})}),e.jsx(s.FormMessage,{className:i.cn(t&&"absolute -bottom-5")})]})})||null,L=({control:r,name:a,label:c,rules:o,required:l,floatingError:n,...t})=>a&&r?e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:d})=>e.jsxs(s.FormItem,{className:i.cn(n&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",l&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(s.HtmlEditor,{...d,...t})}),e.jsx(s.FormMessage,{className:i.cn(n&&"absolute -bottom-5")})]})}):e.jsx(s.HtmlEditor,{...t}),f=({control:r,name:a,label:c,rules:o,required:l,floatingError:n,...t})=>a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:d})=>e.jsxs(s.FormItem,{className:i.cn(n&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",l&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(s.MaskInput,{thousandsSeparator:" ",lazy:!1,placeholderChar:"_",unmask:!0,...d,...t,onAccept:m=>d.onChange(m)})}),e.jsx(s.FormMessage,{className:i.cn(n&&"absolute -bottom-5")})]})})||null,w=({control:r,name:a,label:c,rules:o,value:l,...n})=>{const t=F.useId();return a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:d})=>e.jsx(s.FormLabel,{className:"block",htmlFor:n.id||t,children:e.jsxs(s.FormItem,{className:"flex flex-row items-start gap-3",children:[e.jsx(s.FormControl,{children:e.jsx(s.RadioGroupItem,{id:n.id||t,value:l,checked:d.value===l,onClick:()=>{d.value!==l&&d.onChange(l)},...n})}),e.jsx("div",{className:"space-y-1 leading-none",children:c&&e.jsx("div",{children:c})})]})})})||null},D=({control:r,name:a,label:c,rules:o,...l})=>{const n=F.useId();return a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:t})=>e.jsx(s.FormLabel,{className:"block",htmlFor:l.id||n,children:e.jsxs(s.FormItem,{className:"flex flex-row items-start gap-3",children:[e.jsx(s.FormControl,{children:e.jsx(s.Switch,{id:l.id||n,className:"m-0",checked:t.value,onCheckedChange:t.onChange,...l})}),e.jsx("div",{className:"space-y-1 leading-none",children:c&&e.jsx("div",{children:c})})]})})})||null},O=({control:r,name:a,label:c,required:o,rules:l,className:n,floatingError:t,...d})=>a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:l,render:({field:m,formState:x})=>e.jsxs(s.FormItem,{className:i.cn(t&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",o&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(s.Textarea,{variant:y.lodashExports.get(x.errors,`${a}.message`)?"failure":"default",...d,...m,className:i.cn(n)})}),e.jsx(s.FormMessage,{className:i.cn(t&&"absolute -bottom-5")})]})})||null,_=({control:r,name:a,label:c,required:o,className:l,rules:n,floatingError:t,...d})=>a&&r?e.jsx(s.FormField,{control:r,name:a,rules:n,render:({field:m})=>e.jsxs(s.FormItem,{className:i.cn(t&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",o&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(h.TimePicker,{...m,...d})}),e.jsx(s.FormMessage,{className:i.cn(t&&"absolute -bottom-5")})]})}):e.jsx(h.TimePicker,{className:"mt-2",...d});exports.MyInput=v.MyInput;exports.MySelect=I.MySelect;exports.MyCheckbox=S;exports.MyDatePicker=R;exports.MyDateRangePicker=T;exports.MyHtmlEditor=L;exports.MyMaskInput=f;exports.MyRadio=w;exports.MySwitch=D;exports.MyTextarea=O;exports.MyTimePicker=_;Object.keys(s).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(exports,r)&&Object.defineProperty(exports,r,{enumerable:!0,get:()=>s[r]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("dgz-ui/form"),e=require("react/jsx-runtime"),F=require("react"),j=require("dgz-ui/calendar"),u=require("dgz-ui/popover"),d=require("dgz-ui/utils"),y=require("../../chunks/lodash-BjH0kD7j.cjs.js"),p=require("lucide-react"),b=require("../../chunks/DateRangePicker-lHqe5Mb6.cjs.js"),C=require("../../chunks/MyInput-C9PNyYby.cjs.js"),v=require("../../chunks/MySelect-Ovb1pK5c.cjs.js"),I=({control:r,name:a,label:c,rules:o,...n})=>{const l=F.useId();return a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:t})=>e.jsx(s.FormLabel,{className:"block",htmlFor:n.id||l,children:e.jsxs(s.FormItem,{className:"flex flex-row items-start gap-3",children:[e.jsx(s.FormControl,{children:e.jsx(s.Checkbox,{id:n.id||l,checked:t.value,onCheckedChange:t.onChange,...n})}),e.jsx("div",{className:"space-y-1 leading-none",children:c&&e.jsx("div",{children:c})})]})})})||null},P=({control:r,name:a,label:c,required:o,rules:n,format:l=j.DATE,floatingError:t,placeholder:i,disabled:m,register:x,className:N,inputProps:M,...g})=>a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:n,render:({field:h,formState:k})=>e.jsxs(s.FormItem,{className:d.cn(t&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",o&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsxs(u.Popover,{children:[e.jsx(u.PopoverTrigger,{asChild:!0,children:e.jsx(s.FormControl,{children:e.jsxs("div",{className:"relative",children:[e.jsx(s.Input,{...M,variant:y.lodashExports.get(k.errors,`${a}.message`)?"failure":"default",disabled:m,...h,readOnly:!0,placeholder:i||"Pick a date",value:d.dayjs(h.value).format(l),className:d.cn("m-0 text-start",N)}),e.jsx(p.Calendar1,{className:d.cn("text-secondary absolute top-2.5 right-2 size-5",m&&"pointer-events-none opacity-50")})]})})}),!m&&e.jsx(u.PopoverContent,{className:"w-auto p-0",align:"start",children:e.jsx(j.Calendar,{...g,mode:"single",selected:h.value,onSelect:h.onChange})})]}),e.jsx(s.FormMessage,{className:d.cn(t&&"absolute -bottom-5")})]})})||null,q=({control:r,name:a,label:c,required:o,rules:n,placeholder:l,floatingError:t,...i})=>a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:n,render:({field:m,formState:x})=>e.jsxs(s.FormItem,{className:d.cn(t&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",o&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(b.DateRangePicker,{...i,error:`${y.lodashExports.get(x.errors,a,"")}`,selected:m.value,onRangeSelected:m.onChange,placeholder:l})}),e.jsx(s.FormMessage,{className:d.cn(t&&"absolute -bottom-5")})]})})||null,S=({control:r,name:a,label:c,rules:o,required:n,floatingError:l,...t})=>a&&r?e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:i})=>e.jsxs(s.FormItem,{className:d.cn(l&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",n&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(s.HtmlEditor,{...i,...t})}),e.jsx(s.FormMessage,{className:d.cn(l&&"absolute -bottom-5")})]})}):e.jsx(s.HtmlEditor,{...t}),R=({control:r,name:a,label:c,rules:o,required:n,floatingError:l,...t})=>a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:i})=>e.jsxs(s.FormItem,{className:d.cn(l&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",n&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(s.MaskInput,{thousandsSeparator:" ",lazy:!1,placeholderChar:"_",unmask:!0,...i,...t,onAccept:m=>i.onChange(m)})}),e.jsx(s.FormMessage,{className:d.cn(l&&"absolute -bottom-5")})]})})||null,T=({control:r,name:a,label:c,rules:o,value:n,...l})=>{const t=F.useId();return a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:i})=>e.jsx(s.FormLabel,{className:"block",htmlFor:l.id||t,children:e.jsxs(s.FormItem,{className:"flex flex-row items-start gap-3",children:[e.jsx(s.FormControl,{children:e.jsx(s.RadioGroupItem,{id:l.id||t,value:n,checked:i.value===n,onClick:()=>{i.value!==n&&i.onChange(n)},...l})}),e.jsx("div",{className:"space-y-1 leading-none",children:c&&e.jsx("div",{children:c})})]})})})||null},L=({control:r,name:a,label:c,rules:o,...n})=>{const l=F.useId();return a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:o,render:({field:t})=>e.jsx(s.FormLabel,{className:"block",htmlFor:n.id||l,children:e.jsxs(s.FormItem,{className:"flex flex-row items-start gap-3",children:[e.jsx(s.FormControl,{children:e.jsx(s.Switch,{id:n.id||l,className:"m-0",checked:t.value,onCheckedChange:t.onChange,...n})}),e.jsx("div",{className:"space-y-1 leading-none",children:c&&e.jsx("div",{children:c})})]})})})||null},w=({control:r,name:a,label:c,required:o,rules:n,className:l,floatingError:t,...i})=>a&&r&&e.jsx(s.FormField,{control:r,name:a,rules:n,render:({field:m,formState:x})=>e.jsxs(s.FormItem,{className:d.cn(t&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",o&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(s.Textarea,{variant:y.lodashExports.get(x.errors,`${a}.message`)?"failure":"default",...i,...m,className:d.cn(l)})}),e.jsx(s.FormMessage,{className:d.cn(t&&"absolute -bottom-5")})]})})||null,D=({control:r,name:a,label:c,required:o,className:n,rules:l,floatingError:t,...i})=>a&&r?e.jsx(s.FormField,{control:r,name:a,rules:l,render:({field:m})=>e.jsxs(s.FormItem,{className:d.cn(t&&"space-y-0"),children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",o&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsx(s.FormControl,{children:e.jsx(j.TimePicker,{...m,...i})}),e.jsx(s.FormMessage,{className:d.cn(t&&"absolute -bottom-5")})]})}):e.jsx(j.TimePicker,{className:"mt-2",...i});exports.MyInput=C.MyInput;exports.MySelect=v.MySelect;exports.MyCheckbox=I;exports.MyDatePicker=P;exports.MyDateRangePicker=q;exports.MyHtmlEditor=S;exports.MyMaskInput=R;exports.MyRadio=T;exports.MySwitch=L;exports.MyTextarea=w;exports.MyTimePicker=D;Object.keys(s).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(exports,r)&&Object.defineProperty(exports,r,{enumerable:!0,get:()=>s[r]})});
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../src/components/form/MyCheckbox.tsx","../../../src/components/form/MyDatePicker.tsx","../../../src/components/form/MyDateRangePicker.tsx","../../../src/components/form/MyHtmlEditor.tsx","../../../src/components/form/MyMaskInput.tsx","../../../src/components/form/MyRadio.tsx","../../../src/components/form/MySwitch.tsx","../../../src/components/form/MyTextarea.tsx","../../../src/components/form/MyTimePicker.tsx"],"sourcesContent":["import {\n Checkbox,\n type CheckboxProps,\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n} from 'dgz-ui/form';\nimport { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyCheckbox component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyCheckboxProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & CheckboxProps;\n\n/**\n * MyCheckbox is a checkbox component with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the checkbox.\n * @param rules - The `react-hook-form` validation rules.\n * @param props - Checkbox and form item props.\n * @returns A checkbox component wrapped with form handling logic.\n */\nexport const MyCheckbox = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n ...props\n}: MyCheckboxProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <Checkbox\n id={props.id || id}\n checked={field.value}\n onCheckedChange={field.onChange}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n","import dayjs from 'dayjs';\nimport { Calendar, type CalendarProps, DATE } from 'dgz-ui/calendar';\nimport {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Input,\n type InputProps,\n} from 'dgz-ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from 'dgz-ui/popover';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport { Calendar1 } from 'lucide-react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyDatePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyDatePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n Omit<CalendarProps, 'mode' | 'disabled'> & {\n /** Date format string for display. */\n format?: string;\n inputProps?: Omit<InputProps, 'onSelect'>;\n placeholder?: string;\n disabled?: boolean;\n };\n\n/**\n * MyDatePicker shows a calendar popover to pick a single date, integrated with react-hook-form.\n * Can also be used standalone when no control/name are provided.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the date picker.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param format - The date format for display.\n * @param placeholder - The placeholder text when no date selected.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param register - The `react-hook-form` register function.\n * @param disabled - Whether the date picker is disabled.\n * @param inputProps - Props passed to the underlying Input component.\n * @param props - Calendar, button and form item props.\n * @returns A date picker component integrated with react-hook-form.\n */\nexport const MyDatePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n format = DATE,\n floatingError,\n placeholder,\n disabled,\n register,\n className,\n inputProps,\n ...props\n}: MyDatePickerProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <Popover>\n <PopoverTrigger asChild>\n <FormControl>\n <div className={'relative'}>\n <Input\n {...inputProps}\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n disabled={disabled}\n {...field}\n readOnly\n placeholder={placeholder || 'Pick a date'}\n value={dayjs(field.value).format(format)}\n className={cn('m-0 text-start', className)}\n />\n <Calendar1\n className={cn(\n 'text-secondary absolute top-2.5 right-2 size-5',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n </div>\n </FormControl>\n </PopoverTrigger>\n {!disabled && (\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <Calendar\n {...props}\n mode=\"single\"\n selected={field.value}\n onSelect={field.onChange}\n />\n </PopoverContent>\n )}\n </Popover>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\nimport { DateRangePicker, type DateRangePickerProps } from '../datepicker';\n\n/**\n * Props for the MyDateRangePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyDateRangePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n Omit<DateRangePickerProps, 'required'> & {\n required?: boolean;\n };\n\n/**\n * MyDateRangePicker renders a date range selector integrated with react-hook-form.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the date range picker.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param format - The date format for display.\n * @param placeholder - The placeholder text when no date is selected.\n * @param props - DateRangePicker props and form item props.\n * @returns A date range picker integrated with react-hook-form.\n */\nexport const MyDateRangePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n placeholder,\n floatingError,\n ...props\n}: MyDateRangePickerProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <DateRangePicker\n {...props}\n error={`${get(formState.errors, name, '')}`}\n selected={field.value}\n onRangeSelected={field.onChange}\n placeholder={placeholder}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n HtmlEditor,\n type HtmlEditorProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyHtmlEditor component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyHtmlEditorProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n HtmlEditorProps & {\n /** Whether the field is required. */\n required?: boolean;\n };\n\n/**\n * MyHtmlEditor is a rich-text HTML editor with optional react-hook-form integration.\n * Works in both controlled (with control/name) and uncontrolled modes.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the HTML editor.\n * @param rules - The `react-hook-form` validation rules.\n * @param required - Whether the field is required.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - HtmlEditor and form item props.\n * @returns React element rendering an HtmlEditor with label, helper text, and validation message.\n */\nexport const MyHtmlEditor = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n required,\n floatingError,\n ...props\n}: MyHtmlEditorProps<TFieldValues>) => {\n return name && control ? (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <HtmlEditor {...field} {...props} />\n </FormControl>\n <FormMessage className={cn(floatingError && 'absolute -bottom-5')} />\n </FormItem>\n )}\n />\n ) : (\n <HtmlEditor {...props} />\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n MaskInput,\n type MaskInputProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyMaskInput component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyMaskInputProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n MaskInputProps & {\n /** Whether the field is required. */\n required?: boolean;\n };\n\n/**\n * MyMaskInput is an input component with masking support and optional react-hook-form integration.\n * Works in both controlled (with control/name) and uncontrolled modes. By default it uses a space as\n * thousands separator, underscores as placeholder characters, lazy formatting disabled, and returns\n * unmasked value on change.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the mask input.\n * @param rules - The `react-hook-form` validation rules.\n * @param required - Whether the field is required.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - MaskInput and form item props.\n * @returns React element rendering a masked input with label, helper text, and validation message.\n */\nexport const MyMaskInput = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n required,\n floatingError,\n ...props\n}: MyMaskInputProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <MaskInput\n thousandsSeparator={' '}\n lazy={false}\n placeholderChar=\"_\"\n unmask\n {...field}\n {...props}\n onAccept={(value) => field.onChange(value)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n RadioGroupItem,\n} from 'dgz-ui/form';\nimport React, { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\ntype RadioItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupItem>;\n\n/**\n * Props for the MyRadio component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyRadioProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & RadioItemProps;\n\n/**\n * MyRadio is a radio input that can integrate with react-hook-form when control and name are provided.\n * Falls back to an uncontrolled radio item when not used inside a form.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the radio input.\n * @param rules - The `react-hook-form` validation rules.\n * @param value - The value of the radio input.\n * @param props - Radio item and form item props.\n * @returns A radio button item.\n */\nconst MyRadio = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n value,\n ...props\n}: MyRadioProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <RadioGroupItem\n id={props.id || id}\n value={value}\n checked={field.value === value}\n onClick={() => {\n if (field.value !== value) {\n field.onChange(value);\n }\n }}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n\nexport { MyRadio };\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n Switch,\n type SwitchProps,\n} from 'dgz-ui/form';\nimport { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MySwitch component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MySwitchProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & SwitchProps;\n\n/**\n * MySwitch is a toggle switch with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the switch.\n * @param rules - The `react-hook-form` validation rules.\n * @param props - Switch and form item props.\n * @returns A toggle switch component, or null if name or control are missing.\n */\nexport const MySwitch = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n ...props\n}: MySwitchProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <Switch\n id={props.id || id}\n className={'m-0'}\n checked={field.value}\n onCheckedChange={field.onChange}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Textarea,\n type TextareaProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyTextarea component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyTextareaProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & TextareaProps;\n\n/**\n * MyTextarea is a textarea component with optional react-hook-form integration.\n * Supports floating error message styling.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the textarea.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param className - Custom CSS class name.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - Textarea and form item props.\n * @returns A textarea component integrated with react-hook-form.\n */\nexport const MyTextarea = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n className,\n floatingError,\n ...props\n}: MyTextareaProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <Textarea\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n {...props}\n {...field}\n className={cn(className)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import { TimePicker, type TimePickerProps } from 'dgz-ui/calendar';\nimport {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyTimePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyTimePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n TimePickerProps & {\n /** Whether the field is required. */\n required?: boolean;\n /** Custom CSS class name. */\n className?: string;\n };\n\n/**\n * MyTimePicker is a time selection input with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the time picker.\n * @param required - Whether the field is required.\n * @param className - Custom CSS class name.\n * @param rules - The `react-hook-form` validation rules.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - TimePicker and form item props.\n * @returns A time picker component integrated with react-hook-form.\n */\nexport const MyTimePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n className,\n rules,\n floatingError,\n ...props\n}: MyTimePickerProps<TFieldValues>) => {\n return name && control ? (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <TimePicker {...field} {...props} />\n </FormControl>\n <FormMessage className={cn(floatingError && 'absolute -bottom-5')} />\n </FormItem>\n )}\n />\n ) : (\n <TimePicker className={'mt-2'} {...props} />\n );\n};\n"],"names":["MyCheckbox","control","name","label","rules","props","id","useId","jsx","FormField","field","FormLabel","jsxs","FormItem","FormControl","Checkbox","MyDatePicker","required","format","DATE","floatingError","placeholder","disabled","register","className","inputProps","formState","cn","Popover","PopoverTrigger","Input","get","dayjs","Calendar1","PopoverContent","Calendar","FormMessage","MyDateRangePicker","DateRangePicker","MyHtmlEditor","HtmlEditor","MyMaskInput","MaskInput","value","MyRadio","RadioGroupItem","MySwitch","Switch","MyTextarea","Textarea","MyTimePicker","TimePicker"],"mappings":"2hBA8BaA,EAAa,CAAmC,CAC3D,QAAAC,EACA,KAAAC,EACA,MAAAC,EACA,MAAAC,EACA,GAAGC,CACL,IAAqC,CACnC,MAAMC,EAAKC,EAAAA,MAAA,EACX,OACGL,GAAQD,GACPO,EAAAA,IAACC,EAAAA,UAAA,CACC,QAAAR,EACA,KAAAC,EACA,MAAAE,EACA,OAAQ,CAAC,CAAE,MAAAM,WACRC,EAAAA,UAAA,CAAU,UAAW,QAAS,QAASN,EAAM,IAAMC,EAClD,SAAAM,EAAAA,KAACC,EAAAA,SAAA,CAAS,UAAU,kCAClB,SAAA,CAAAL,MAACM,EAAAA,YAAA,CACC,SAAAN,EAAAA,IAACO,EAAAA,SAAA,CACC,GAAIV,EAAM,IAAMC,EAChB,QAASI,EAAM,MACf,gBAAiBA,EAAM,SACtB,GAAGL,CAAA,CAAA,EAER,EACAG,EAAAA,IAAC,OAAI,UAAU,yBACZ,YAASA,EAAAA,IAAC,MAAA,CAAK,WAAM,CAAA,CACxB,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAAA,GAIN,IAEJ,ECdaQ,EAAe,CAAmC,CAC7D,QAAAf,EACA,KAAAC,EACA,MAAAC,EACA,SAAAc,EACA,MAAAb,EACA,OAAAc,EAASC,EAAAA,KACT,cAAAC,EACA,YAAAC,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,EACA,WAAAC,EACA,GAAGpB,CACL,IAEKH,GAAQD,GACPO,EAAAA,IAACC,EAAAA,UAAA,CACC,QAAAR,EACA,KAAAC,EACA,MAAAE,EACA,OAAQ,CAAC,CAAE,MAAAM,EAAO,UAAAgB,CAAA,IAChBd,EAAAA,KAACC,EAAAA,SAAA,CAAS,UAAWc,EAAAA,GAAGP,GAAiB,WAAW,EACjD,SAAA,CAAAjB,GACCS,EAAAA,KAACD,EAAAA,UAAA,CAAU,UAAW,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,GAAA,CAAC,CAAA,EACzD,EAEFA,EAAAA,IAACM,EAAAA,aACC,SAAAN,MAAC2C,EAAAA,WAAA,CAAY,GAAGzC,EAAQ,GAAGL,EAAO,EACpC,QACC+B,EAAAA,YAAA,CAAY,UAAWT,EAAAA,GAAGP,GAAiB,oBAAoB,CAAA,CAAG,CAAA,CAAA,CACrE,CAAA,CAAA,EAIJZ,EAAAA,IAAC2C,EAAAA,WAAA,CAAW,UAAW,OAAS,GAAG9C,EAAO"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../src/components/form/MyCheckbox.tsx","../../../src/components/form/MyDatePicker.tsx","../../../src/components/form/MyDateRangePicker.tsx","../../../src/components/form/MyHtmlEditor.tsx","../../../src/components/form/MyMaskInput.tsx","../../../src/components/form/MyRadio.tsx","../../../src/components/form/MySwitch.tsx","../../../src/components/form/MyTextarea.tsx","../../../src/components/form/MyTimePicker.tsx"],"sourcesContent":["import {\n Checkbox,\n type CheckboxProps,\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n} from 'dgz-ui/form';\nimport { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyCheckbox component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyCheckboxProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & CheckboxProps;\n\n/**\n * MyCheckbox is a checkbox component with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the checkbox.\n * @param rules - The `react-hook-form` validation rules.\n * @param props - Checkbox and form item props.\n * @returns A checkbox component wrapped with form handling logic.\n */\nexport const MyCheckbox = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n ...props\n}: MyCheckboxProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <Checkbox\n id={props.id || id}\n checked={field.value}\n onCheckedChange={field.onChange}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n","import { Calendar, type CalendarProps, DATE } from 'dgz-ui/calendar';\nimport {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Input,\n type InputProps,\n} from 'dgz-ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from 'dgz-ui/popover';\nimport { cn, dayjs } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport { Calendar1 } from 'lucide-react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyDatePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyDatePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n Omit<CalendarProps, 'mode' | 'disabled'> & {\n /** Date format string for display. */\n format?: string;\n inputProps?: Omit<InputProps, 'onSelect'>;\n placeholder?: string;\n disabled?: boolean;\n };\n\n/**\n * MyDatePicker shows a calendar popover to pick a single date, integrated with react-hook-form.\n * Can also be used standalone when no control/name are provided.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the date picker.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param format - The date format for display.\n * @param placeholder - The placeholder text when no date selected.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param register - The `react-hook-form` register function.\n * @param disabled - Whether the date picker is disabled.\n * @param inputProps - Props passed to the underlying Input component.\n * @param props - Calendar, button and form item props.\n * @returns A date picker component integrated with react-hook-form.\n */\nexport const MyDatePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n format = DATE,\n floatingError,\n placeholder,\n disabled,\n register,\n className,\n inputProps,\n ...props\n}: MyDatePickerProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <Popover>\n <PopoverTrigger asChild>\n <FormControl>\n <div className={'relative'}>\n <Input\n {...inputProps}\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n disabled={disabled}\n {...field}\n readOnly\n placeholder={placeholder || 'Pick a date'}\n value={dayjs(field.value).format(format)}\n className={cn('m-0 text-start', className)}\n />\n <Calendar1\n className={cn(\n 'text-secondary absolute top-2.5 right-2 size-5',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n </div>\n </FormControl>\n </PopoverTrigger>\n {!disabled && (\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <Calendar\n {...props}\n mode=\"single\"\n selected={field.value}\n onSelect={field.onChange}\n />\n </PopoverContent>\n )}\n </Popover>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\nimport { DateRangePicker, type DateRangePickerProps } from '../datepicker';\n\n/**\n * Props for the MyDateRangePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyDateRangePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n Omit<DateRangePickerProps, 'required'> & {\n required?: boolean;\n };\n\n/**\n * MyDateRangePicker renders a date range selector integrated with react-hook-form.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the date range picker.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param format - The date format for display.\n * @param placeholder - The placeholder text when no date is selected.\n * @param props - DateRangePicker props and form item props.\n * @returns A date range picker integrated with react-hook-form.\n */\nexport const MyDateRangePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n placeholder,\n floatingError,\n ...props\n}: MyDateRangePickerProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <DateRangePicker\n {...props}\n error={`${get(formState.errors, name, '')}`}\n selected={field.value}\n onRangeSelected={field.onChange}\n placeholder={placeholder}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n HtmlEditor,\n type HtmlEditorProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyHtmlEditor component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyHtmlEditorProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n HtmlEditorProps & {\n /** Whether the field is required. */\n required?: boolean;\n };\n\n/**\n * MyHtmlEditor is a rich-text HTML editor with optional react-hook-form integration.\n * Works in both controlled (with control/name) and uncontrolled modes.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the HTML editor.\n * @param rules - The `react-hook-form` validation rules.\n * @param required - Whether the field is required.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - HtmlEditor and form item props.\n * @returns React element rendering an HtmlEditor with label, helper text, and validation message.\n */\nexport const MyHtmlEditor = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n required,\n floatingError,\n ...props\n}: MyHtmlEditorProps<TFieldValues>) => {\n return name && control ? (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <HtmlEditor {...field} {...props} />\n </FormControl>\n <FormMessage className={cn(floatingError && 'absolute -bottom-5')} />\n </FormItem>\n )}\n />\n ) : (\n <HtmlEditor {...props} />\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n MaskInput,\n type MaskInputProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyMaskInput component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyMaskInputProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n MaskInputProps & {\n /** Whether the field is required. */\n required?: boolean;\n };\n\n/**\n * MyMaskInput is an input component with masking support and optional react-hook-form integration.\n * Works in both controlled (with control/name) and uncontrolled modes. By default it uses a space as\n * thousands separator, underscores as placeholder characters, lazy formatting disabled, and returns\n * unmasked value on change.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the mask input.\n * @param rules - The `react-hook-form` validation rules.\n * @param required - Whether the field is required.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - MaskInput and form item props.\n * @returns React element rendering a masked input with label, helper text, and validation message.\n */\nexport const MyMaskInput = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n required,\n floatingError,\n ...props\n}: MyMaskInputProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <MaskInput\n thousandsSeparator={' '}\n lazy={false}\n placeholderChar=\"_\"\n unmask\n {...field}\n {...props}\n onAccept={(value) => field.onChange(value)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n RadioGroupItem,\n} from 'dgz-ui/form';\nimport React, { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\ntype RadioItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupItem>;\n\n/**\n * Props for the MyRadio component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyRadioProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & RadioItemProps;\n\n/**\n * MyRadio is a radio input that can integrate with react-hook-form when control and name are provided.\n * Falls back to an uncontrolled radio item when not used inside a form.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the radio input.\n * @param rules - The `react-hook-form` validation rules.\n * @param value - The value of the radio input.\n * @param props - Radio item and form item props.\n * @returns A radio button item.\n */\nconst MyRadio = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n value,\n ...props\n}: MyRadioProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <RadioGroupItem\n id={props.id || id}\n value={value}\n checked={field.value === value}\n onClick={() => {\n if (field.value !== value) {\n field.onChange(value);\n }\n }}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n\nexport { MyRadio };\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n Switch,\n type SwitchProps,\n} from 'dgz-ui/form';\nimport { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MySwitch component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MySwitchProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & SwitchProps;\n\n/**\n * MySwitch is a toggle switch with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the switch.\n * @param rules - The `react-hook-form` validation rules.\n * @param props - Switch and form item props.\n * @returns A toggle switch component, or null if name or control are missing.\n */\nexport const MySwitch = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n ...props\n}: MySwitchProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <Switch\n id={props.id || id}\n className={'m-0'}\n checked={field.value}\n onCheckedChange={field.onChange}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Textarea,\n type TextareaProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyTextarea component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyTextareaProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & TextareaProps;\n\n/**\n * MyTextarea is a textarea component with optional react-hook-form integration.\n * Supports floating error message styling.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the textarea.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param className - Custom CSS class name.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - Textarea and form item props.\n * @returns A textarea component integrated with react-hook-form.\n */\nexport const MyTextarea = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n className,\n floatingError,\n ...props\n}: MyTextareaProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <Textarea\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n {...props}\n {...field}\n className={cn(className)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import { TimePicker, type TimePickerProps } from 'dgz-ui/calendar';\nimport {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyTimePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyTimePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n TimePickerProps & {\n /** Whether the field is required. */\n required?: boolean;\n /** Custom CSS class name. */\n className?: string;\n };\n\n/**\n * MyTimePicker is a time selection input with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the time picker.\n * @param required - Whether the field is required.\n * @param className - Custom CSS class name.\n * @param rules - The `react-hook-form` validation rules.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - TimePicker and form item props.\n * @returns A time picker component integrated with react-hook-form.\n */\nexport const MyTimePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n className,\n rules,\n floatingError,\n ...props\n}: MyTimePickerProps<TFieldValues>) => {\n return name && control ? (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <TimePicker {...field} {...props} />\n </FormControl>\n <FormMessage className={cn(floatingError && 'absolute -bottom-5')} />\n </FormItem>\n )}\n />\n ) : (\n <TimePicker className={'mt-2'} {...props} />\n );\n};\n"],"names":["MyCheckbox","control","name","label","rules","props","id","useId","jsx","FormField","field","FormLabel","jsxs","FormItem","FormControl","Checkbox","MyDatePicker","required","format","DATE","floatingError","placeholder","disabled","register","className","inputProps","formState","cn","Popover","PopoverTrigger","Input","get","dayjs","Calendar1","PopoverContent","Calendar","FormMessage","MyDateRangePicker","DateRangePicker","MyHtmlEditor","HtmlEditor","MyMaskInput","MaskInput","value","MyRadio","RadioGroupItem","MySwitch","Switch","MyText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aACC,SAAAN,MAAC2C,EAAAA,WAAA,CAAY,GAAGzC,EAAQ,GAAGL,EAAO,EACpC,QACC+B,EAAAA,YAAA,CAAY,UAAWT,EAAAA,GAAGP,GAAiB,oBAAoB,CAAA,CAAG,CAAA,CAAA,CACrE,CAAA,CAAA,EAIJZ,EAAAA,IAAC2C,EAAAA,WAAA,CAAW,UAAW,OAAS,GAAG9C,EAAO"}
@@ -2,16 +2,15 @@ import { FormField as h, FormLabel as u, FormItem as N, FormControl as p, Checkb
2
2
  export * from "dgz-ui/form";
3
3
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
4
4
  import { useId as g } from "react";
5
- import j from "dayjs";
6
- import { DATE as $, Calendar as z, TimePicker as M } from "dgz-ui/calendar";
7
- import { Popover as A, PopoverTrigger as H, PopoverContent as G } from "dgz-ui/popover";
8
- import { cn as o } from "dgz-ui/utils";
5
+ import { DATE as j, Calendar as $, TimePicker as M } from "dgz-ui/calendar";
6
+ import { Popover as z, PopoverTrigger as A, PopoverContent as H } from "dgz-ui/popover";
7
+ import { cn as o, dayjs as G } from "dgz-ui/utils";
9
8
  import { l as v } from "../../chunks/lodash-CRDOWzbs.es.js";
10
9
  import { Calendar1 as L } from "lucide-react";
11
- import { D as O } from "../../chunks/DateRangePicker-DQoK4BQV.es.js";
12
- import { M as ie } from "../../chunks/MyInput-Wb0DSWo_.es.js";
13
- import { M as me } from "../../chunks/MySelect-D8ML7nhM.es.js";
14
- const Y = ({
10
+ import { D as O } from "../../chunks/DateRangePicker-BEguo3VF.es.js";
11
+ import { M as de } from "../../chunks/MyInput-Wb0DSWo_.es.js";
12
+ import { M as oe } from "../../chunks/MySelect-D8ML7nhM.es.js";
13
+ const X = ({
15
14
  control: s,
16
15
  name: a,
17
16
  label: r,
@@ -39,13 +38,13 @@ const Y = ({
39
38
  ] }) })
40
39
  }
41
40
  ) || null;
42
- }, Z = ({
41
+ }, Y = ({
43
42
  control: s,
44
43
  name: a,
45
44
  label: r,
46
45
  required: n,
47
46
  rules: t,
48
- format: l = $,
47
+ format: l = j,
49
48
  floatingError: c,
50
49
  placeholder: d,
51
50
  disabled: m,
@@ -65,8 +64,8 @@ const Y = ({
65
64
  " ",
66
65
  n && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
67
66
  ] }),
68
- /* @__PURE__ */ i(A, { children: [
69
- /* @__PURE__ */ e(H, { asChild: !0, children: /* @__PURE__ */ e(p, { children: /* @__PURE__ */ i("div", { className: "relative", children: [
67
+ /* @__PURE__ */ i(z, { children: [
68
+ /* @__PURE__ */ e(A, { asChild: !0, children: /* @__PURE__ */ e(p, { children: /* @__PURE__ */ i("div", { className: "relative", children: [
70
69
  /* @__PURE__ */ e(
71
70
  w,
72
71
  {
@@ -76,7 +75,7 @@ const Y = ({
76
75
  ...y,
77
76
  readOnly: !0,
78
77
  placeholder: d || "Pick a date",
79
- value: j(y.value).format(l),
78
+ value: G(y.value).format(l),
80
79
  className: o("m-0 text-start", b)
81
80
  }
82
81
  ),
@@ -90,8 +89,8 @@ const Y = ({
90
89
  }
91
90
  )
92
91
  ] }) }) }),
93
- !m && /* @__PURE__ */ e(G, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ e(
94
- z,
92
+ !m && /* @__PURE__ */ e(H, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ e(
93
+ $,
95
94
  {
96
95
  ...F,
97
96
  mode: "single",
@@ -108,7 +107,7 @@ const Y = ({
108
107
  )
109
108
  ] })
110
109
  }
111
- ) || null, E = ({
110
+ ) || null, Z = ({
112
111
  control: s,
113
112
  name: a,
114
113
  label: r,
@@ -147,7 +146,7 @@ const Y = ({
147
146
  )
148
147
  ] })
149
148
  }
150
- ) || null, ee = ({
149
+ ) || null, E = ({
151
150
  control: s,
152
151
  name: a,
153
152
  label: r,
@@ -171,7 +170,7 @@ const Y = ({
171
170
  /* @__PURE__ */ e(k, { className: o(l && "absolute -bottom-5") })
172
171
  ] })
173
172
  }
174
- ) : /* @__PURE__ */ e(C, { ...c }), ae = ({
173
+ ) : /* @__PURE__ */ e(C, { ...c }), ee = ({
175
174
  control: s,
176
175
  name: a,
177
176
  label: r,
@@ -211,7 +210,7 @@ const Y = ({
211
210
  )
212
211
  ] })
213
212
  }
214
- ) || null, se = ({
213
+ ) || null, ae = ({
215
214
  control: s,
216
215
  name: a,
217
216
  label: r,
@@ -243,7 +242,7 @@ const Y = ({
243
242
  ] }) })
244
243
  }
245
244
  ) || null;
246
- }, re = ({
245
+ }, se = ({
247
246
  control: s,
248
247
  name: a,
249
248
  label: r,
@@ -272,7 +271,7 @@ const Y = ({
272
271
  ] }) })
273
272
  }
274
273
  ) || null;
275
- }, ce = ({
274
+ }, re = ({
276
275
  control: s,
277
276
  name: a,
278
277
  label: r,
@@ -310,7 +309,7 @@ const Y = ({
310
309
  )
311
310
  ] })
312
311
  }
313
- ) || null, te = ({
312
+ ) || null, ce = ({
314
313
  control: s,
315
314
  name: a,
316
315
  label: r,
@@ -337,16 +336,16 @@ const Y = ({
337
336
  }
338
337
  ) : /* @__PURE__ */ e(M, { className: "mt-2", ...d });
339
338
  export {
340
- Y as MyCheckbox,
341
- Z as MyDatePicker,
342
- E as MyDateRangePicker,
343
- ee as MyHtmlEditor,
344
- ie as MyInput,
345
- ae as MyMaskInput,
346
- se as MyRadio,
347
- me as MySelect,
348
- re as MySwitch,
349
- ce as MyTextarea,
350
- te as MyTimePicker
339
+ X as MyCheckbox,
340
+ Y as MyDatePicker,
341
+ Z as MyDateRangePicker,
342
+ E as MyHtmlEditor,
343
+ de as MyInput,
344
+ ee as MyMaskInput,
345
+ ae as MyRadio,
346
+ oe as MySelect,
347
+ se as MySwitch,
348
+ re as MyTextarea,
349
+ ce as MyTimePicker
351
350
  };
352
351
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../src/components/form/MyCheckbox.tsx","../../../src/components/form/MyDatePicker.tsx","../../../src/components/form/MyDateRangePicker.tsx","../../../src/components/form/MyHtmlEditor.tsx","../../../src/components/form/MyMaskInput.tsx","../../../src/components/form/MyRadio.tsx","../../../src/components/form/MySwitch.tsx","../../../src/components/form/MyTextarea.tsx","../../../src/components/form/MyTimePicker.tsx"],"sourcesContent":["import {\n Checkbox,\n type CheckboxProps,\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n} from 'dgz-ui/form';\nimport { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyCheckbox component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyCheckboxProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & CheckboxProps;\n\n/**\n * MyCheckbox is a checkbox component with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the checkbox.\n * @param rules - The `react-hook-form` validation rules.\n * @param props - Checkbox and form item props.\n * @returns A checkbox component wrapped with form handling logic.\n */\nexport const MyCheckbox = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n ...props\n}: MyCheckboxProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <Checkbox\n id={props.id || id}\n checked={field.value}\n onCheckedChange={field.onChange}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n","import dayjs from 'dayjs';\nimport { Calendar, type CalendarProps, DATE } from 'dgz-ui/calendar';\nimport {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Input,\n type InputProps,\n} from 'dgz-ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from 'dgz-ui/popover';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport { Calendar1 } from 'lucide-react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyDatePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyDatePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n Omit<CalendarProps, 'mode' | 'disabled'> & {\n /** Date format string for display. */\n format?: string;\n inputProps?: Omit<InputProps, 'onSelect'>;\n placeholder?: string;\n disabled?: boolean;\n };\n\n/**\n * MyDatePicker shows a calendar popover to pick a single date, integrated with react-hook-form.\n * Can also be used standalone when no control/name are provided.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the date picker.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param format - The date format for display.\n * @param placeholder - The placeholder text when no date selected.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param register - The `react-hook-form` register function.\n * @param disabled - Whether the date picker is disabled.\n * @param inputProps - Props passed to the underlying Input component.\n * @param props - Calendar, button and form item props.\n * @returns A date picker component integrated with react-hook-form.\n */\nexport const MyDatePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n format = DATE,\n floatingError,\n placeholder,\n disabled,\n register,\n className,\n inputProps,\n ...props\n}: MyDatePickerProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <Popover>\n <PopoverTrigger asChild>\n <FormControl>\n <div className={'relative'}>\n <Input\n {...inputProps}\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n disabled={disabled}\n {...field}\n readOnly\n placeholder={placeholder || 'Pick a date'}\n value={dayjs(field.value).format(format)}\n className={cn('m-0 text-start', className)}\n />\n <Calendar1\n className={cn(\n 'text-secondary absolute top-2.5 right-2 size-5',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n </div>\n </FormControl>\n </PopoverTrigger>\n {!disabled && (\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <Calendar\n {...props}\n mode=\"single\"\n selected={field.value}\n onSelect={field.onChange}\n />\n </PopoverContent>\n )}\n </Popover>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\nimport { DateRangePicker, type DateRangePickerProps } from '../datepicker';\n\n/**\n * Props for the MyDateRangePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyDateRangePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n Omit<DateRangePickerProps, 'required'> & {\n required?: boolean;\n };\n\n/**\n * MyDateRangePicker renders a date range selector integrated with react-hook-form.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the date range picker.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param format - The date format for display.\n * @param placeholder - The placeholder text when no date is selected.\n * @param props - DateRangePicker props and form item props.\n * @returns A date range picker integrated with react-hook-form.\n */\nexport const MyDateRangePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n placeholder,\n floatingError,\n ...props\n}: MyDateRangePickerProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <DateRangePicker\n {...props}\n error={`${get(formState.errors, name, '')}`}\n selected={field.value}\n onRangeSelected={field.onChange}\n placeholder={placeholder}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n HtmlEditor,\n type HtmlEditorProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyHtmlEditor component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyHtmlEditorProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n HtmlEditorProps & {\n /** Whether the field is required. */\n required?: boolean;\n };\n\n/**\n * MyHtmlEditor is a rich-text HTML editor with optional react-hook-form integration.\n * Works in both controlled (with control/name) and uncontrolled modes.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the HTML editor.\n * @param rules - The `react-hook-form` validation rules.\n * @param required - Whether the field is required.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - HtmlEditor and form item props.\n * @returns React element rendering an HtmlEditor with label, helper text, and validation message.\n */\nexport const MyHtmlEditor = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n required,\n floatingError,\n ...props\n}: MyHtmlEditorProps<TFieldValues>) => {\n return name && control ? (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <HtmlEditor {...field} {...props} />\n </FormControl>\n <FormMessage className={cn(floatingError && 'absolute -bottom-5')} />\n </FormItem>\n )}\n />\n ) : (\n <HtmlEditor {...props} />\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n MaskInput,\n type MaskInputProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyMaskInput component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyMaskInputProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n MaskInputProps & {\n /** Whether the field is required. */\n required?: boolean;\n };\n\n/**\n * MyMaskInput is an input component with masking support and optional react-hook-form integration.\n * Works in both controlled (with control/name) and uncontrolled modes. By default it uses a space as\n * thousands separator, underscores as placeholder characters, lazy formatting disabled, and returns\n * unmasked value on change.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the mask input.\n * @param rules - The `react-hook-form` validation rules.\n * @param required - Whether the field is required.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - MaskInput and form item props.\n * @returns React element rendering a masked input with label, helper text, and validation message.\n */\nexport const MyMaskInput = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n required,\n floatingError,\n ...props\n}: MyMaskInputProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <MaskInput\n thousandsSeparator={' '}\n lazy={false}\n placeholderChar=\"_\"\n unmask\n {...field}\n {...props}\n onAccept={(value) => field.onChange(value)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n RadioGroupItem,\n} from 'dgz-ui/form';\nimport React, { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\ntype RadioItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupItem>;\n\n/**\n * Props for the MyRadio component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyRadioProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & RadioItemProps;\n\n/**\n * MyRadio is a radio input that can integrate with react-hook-form when control and name are provided.\n * Falls back to an uncontrolled radio item when not used inside a form.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the radio input.\n * @param rules - The `react-hook-form` validation rules.\n * @param value - The value of the radio input.\n * @param props - Radio item and form item props.\n * @returns A radio button item.\n */\nconst MyRadio = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n value,\n ...props\n}: MyRadioProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <RadioGroupItem\n id={props.id || id}\n value={value}\n checked={field.value === value}\n onClick={() => {\n if (field.value !== value) {\n field.onChange(value);\n }\n }}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n\nexport { MyRadio };\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n Switch,\n type SwitchProps,\n} from 'dgz-ui/form';\nimport { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MySwitch component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MySwitchProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & SwitchProps;\n\n/**\n * MySwitch is a toggle switch with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the switch.\n * @param rules - The `react-hook-form` validation rules.\n * @param props - Switch and form item props.\n * @returns A toggle switch component, or null if name or control are missing.\n */\nexport const MySwitch = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n ...props\n}: MySwitchProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <Switch\n id={props.id || id}\n className={'m-0'}\n checked={field.value}\n onCheckedChange={field.onChange}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Textarea,\n type TextareaProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyTextarea component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyTextareaProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & TextareaProps;\n\n/**\n * MyTextarea is a textarea component with optional react-hook-form integration.\n * Supports floating error message styling.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the textarea.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param className - Custom CSS class name.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - Textarea and form item props.\n * @returns A textarea component integrated with react-hook-form.\n */\nexport const MyTextarea = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n className,\n floatingError,\n ...props\n}: MyTextareaProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <Textarea\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n {...props}\n {...field}\n className={cn(className)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import { TimePicker, type TimePickerProps } from 'dgz-ui/calendar';\nimport {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyTimePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyTimePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n TimePickerProps & {\n /** Whether the field is required. */\n required?: boolean;\n /** Custom CSS class name. */\n className?: string;\n };\n\n/**\n * MyTimePicker is a time selection input with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the time picker.\n * @param required - Whether the field is required.\n * @param className - Custom CSS class name.\n * @param rules - The `react-hook-form` validation rules.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - TimePicker and form item props.\n * @returns A time picker component integrated with react-hook-form.\n */\nexport const MyTimePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n className,\n rules,\n floatingError,\n ...props\n}: MyTimePickerProps<TFieldValues>) => {\n return name && control ? (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <TimePicker {...field} {...props} />\n </FormControl>\n <FormMessage className={cn(floatingError && 'absolute -bottom-5')} />\n </FormItem>\n )}\n />\n ) : (\n <TimePicker className={'mt-2'} {...props} />\n );\n};\n"],"names":["MyCheckbox","control","name","label","rules","props","id","useId","jsx","FormField","field","FormLabel","jsxs","FormItem","FormControl","Checkbox","MyDatePicker","required","format","DATE","floatingError","placeholder","disabled","register","className","inputProps","formState","cn","Popover","PopoverTrigger","Input","get","dayjs","Calendar1","PopoverContent","Calendar","FormMessage","MyDateRangePicker","DateRangePicker","MyHtmlEditor","HtmlEditor","MyMaskInput","MaskInput","value","MyRadio","RadioGroupItem","MySwitch","Switch","MyTextarea","Textarea","MyTimePicker","TimePicker"],"mappings":";;;;;;;;;;;;;AA8BO,MAAMA,IAAa,CAAmC;AAAA,EAC3D,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAqC;AACnC,QAAMC,IAAKC,EAAA;AACX,SACGL,KAAQD,KACP,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAR;AAAA,MACA,MAAAC;AAAA,MACA,OAAAE;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAM,0BACRC,GAAA,EAAU,WAAW,SAAS,SAASN,EAAM,MAAMC,GAClD,UAAA,gBA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../../src/components/form/MyDatePicker.tsx","../../../src/components/form/MyDateRangePicker.tsx","../../../src/components/form/MyHtmlEditor.tsx","../../../src/components/form/MyMaskInput.tsx","../../../src/components/form/MyRadio.tsx","../../../src/components/form/MySwitch.tsx","../../../src/components/form/MyTextarea.tsx","../../../src/components/form/MyTimePicker.tsx"],"sourcesContent":["import {\n Checkbox,\n type CheckboxProps,\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n} from 'dgz-ui/form';\nimport { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyCheckbox component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyCheckboxProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & CheckboxProps;\n\n/**\n * MyCheckbox is a checkbox component with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the checkbox.\n * @param rules - The `react-hook-form` validation rules.\n * @param props - Checkbox and form item props.\n * @returns A checkbox component wrapped with form handling logic.\n */\nexport const MyCheckbox = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n ...props\n}: MyCheckboxProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <Checkbox\n id={props.id || id}\n checked={field.value}\n onCheckedChange={field.onChange}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n","import { Calendar, type CalendarProps, DATE } from 'dgz-ui/calendar';\nimport {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Input,\n type InputProps,\n} from 'dgz-ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from 'dgz-ui/popover';\nimport { cn, dayjs } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport { Calendar1 } from 'lucide-react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyDatePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyDatePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n Omit<CalendarProps, 'mode' | 'disabled'> & {\n /** Date format string for display. */\n format?: string;\n inputProps?: Omit<InputProps, 'onSelect'>;\n placeholder?: string;\n disabled?: boolean;\n };\n\n/**\n * MyDatePicker shows a calendar popover to pick a single date, integrated with react-hook-form.\n * Can also be used standalone when no control/name are provided.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the date picker.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param format - The date format for display.\n * @param placeholder - The placeholder text when no date selected.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param register - The `react-hook-form` register function.\n * @param disabled - Whether the date picker is disabled.\n * @param inputProps - Props passed to the underlying Input component.\n * @param props - Calendar, button and form item props.\n * @returns A date picker component integrated with react-hook-form.\n */\nexport const MyDatePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n format = DATE,\n floatingError,\n placeholder,\n disabled,\n register,\n className,\n inputProps,\n ...props\n}: MyDatePickerProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <Popover>\n <PopoverTrigger asChild>\n <FormControl>\n <div className={'relative'}>\n <Input\n {...inputProps}\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n disabled={disabled}\n {...field}\n readOnly\n placeholder={placeholder || 'Pick a date'}\n value={dayjs(field.value).format(format)}\n className={cn('m-0 text-start', className)}\n />\n <Calendar1\n className={cn(\n 'text-secondary absolute top-2.5 right-2 size-5',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n </div>\n </FormControl>\n </PopoverTrigger>\n {!disabled && (\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <Calendar\n {...props}\n mode=\"single\"\n selected={field.value}\n onSelect={field.onChange}\n />\n </PopoverContent>\n )}\n </Popover>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\nimport { DateRangePicker, type DateRangePickerProps } from '../datepicker';\n\n/**\n * Props for the MyDateRangePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyDateRangePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n Omit<DateRangePickerProps, 'required'> & {\n required?: boolean;\n };\n\n/**\n * MyDateRangePicker renders a date range selector integrated with react-hook-form.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the date range picker.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param format - The date format for display.\n * @param placeholder - The placeholder text when no date is selected.\n * @param props - DateRangePicker props and form item props.\n * @returns A date range picker integrated with react-hook-form.\n */\nexport const MyDateRangePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n placeholder,\n floatingError,\n ...props\n}: MyDateRangePickerProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <DateRangePicker\n {...props}\n error={`${get(formState.errors, name, '')}`}\n selected={field.value}\n onRangeSelected={field.onChange}\n placeholder={placeholder}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n HtmlEditor,\n type HtmlEditorProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyHtmlEditor component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyHtmlEditorProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n HtmlEditorProps & {\n /** Whether the field is required. */\n required?: boolean;\n };\n\n/**\n * MyHtmlEditor is a rich-text HTML editor with optional react-hook-form integration.\n * Works in both controlled (with control/name) and uncontrolled modes.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the HTML editor.\n * @param rules - The `react-hook-form` validation rules.\n * @param required - Whether the field is required.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - HtmlEditor and form item props.\n * @returns React element rendering an HtmlEditor with label, helper text, and validation message.\n */\nexport const MyHtmlEditor = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n required,\n floatingError,\n ...props\n}: MyHtmlEditorProps<TFieldValues>) => {\n return name && control ? (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <HtmlEditor {...field} {...props} />\n </FormControl>\n <FormMessage className={cn(floatingError && 'absolute -bottom-5')} />\n </FormItem>\n )}\n />\n ) : (\n <HtmlEditor {...props} />\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n MaskInput,\n type MaskInputProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyMaskInput component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyMaskInputProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n MaskInputProps & {\n /** Whether the field is required. */\n required?: boolean;\n };\n\n/**\n * MyMaskInput is an input component with masking support and optional react-hook-form integration.\n * Works in both controlled (with control/name) and uncontrolled modes. By default it uses a space as\n * thousands separator, underscores as placeholder characters, lazy formatting disabled, and returns\n * unmasked value on change.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the mask input.\n * @param rules - The `react-hook-form` validation rules.\n * @param required - Whether the field is required.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - MaskInput and form item props.\n * @returns React element rendering a masked input with label, helper text, and validation message.\n */\nexport const MyMaskInput = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n required,\n floatingError,\n ...props\n}: MyMaskInputProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <MaskInput\n thousandsSeparator={' '}\n lazy={false}\n placeholderChar=\"_\"\n unmask\n {...field}\n {...props}\n onAccept={(value) => field.onChange(value)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n RadioGroupItem,\n} from 'dgz-ui/form';\nimport React, { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\ntype RadioItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupItem>;\n\n/**\n * Props for the MyRadio component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyRadioProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & RadioItemProps;\n\n/**\n * MyRadio is a radio input that can integrate with react-hook-form when control and name are provided.\n * Falls back to an uncontrolled radio item when not used inside a form.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the radio input.\n * @param rules - The `react-hook-form` validation rules.\n * @param value - The value of the radio input.\n * @param props - Radio item and form item props.\n * @returns A radio button item.\n */\nconst MyRadio = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n value,\n ...props\n}: MyRadioProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <RadioGroupItem\n id={props.id || id}\n value={value}\n checked={field.value === value}\n onClick={() => {\n if (field.value !== value) {\n field.onChange(value);\n }\n }}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n\nexport { MyRadio };\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n Switch,\n type SwitchProps,\n} from 'dgz-ui/form';\nimport { useId } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MySwitch component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MySwitchProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & SwitchProps;\n\n/**\n * MySwitch is a toggle switch with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the switch.\n * @param rules - The `react-hook-form` validation rules.\n * @param props - Switch and form item props.\n * @returns A toggle switch component, or null if name or control are missing.\n */\nexport const MySwitch = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n rules,\n ...props\n}: MySwitchProps<TFieldValues>) => {\n const id = useId();\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormLabel className={'block'} htmlFor={props.id || id}>\n <FormItem className=\"flex flex-row items-start gap-3\">\n <FormControl>\n <Switch\n id={props.id || id}\n className={'m-0'}\n checked={field.value}\n onCheckedChange={field.onChange}\n {...props}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && <div>{label}</div>}\n </div>\n </FormItem>\n </FormLabel>\n )}\n />\n )) ||\n null\n );\n};\n","import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Textarea,\n type TextareaProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyTextarea component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyTextareaProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & TextareaProps;\n\n/**\n * MyTextarea is a textarea component with optional react-hook-form integration.\n * Supports floating error message styling.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the textarea.\n * @param required - Whether the field is required.\n * @param rules - The `react-hook-form` validation rules.\n * @param className - Custom CSS class name.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - Textarea and form item props.\n * @returns A textarea component integrated with react-hook-form.\n */\nexport const MyTextarea = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n rules,\n className,\n floatingError,\n ...props\n}: MyTextareaProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <Textarea\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n {...props}\n {...field}\n className={cn(className)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n","import { TimePicker, type TimePickerProps } from 'dgz-ui/calendar';\nimport {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyTimePicker component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyTimePickerProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n TimePickerProps & {\n /** Whether the field is required. */\n required?: boolean;\n /** Custom CSS class name. */\n className?: string;\n };\n\n/**\n * MyTimePicker is a time selection input with optional react-hook-form integration.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the time picker.\n * @param required - Whether the field is required.\n * @param className - Custom CSS class name.\n * @param rules - The `react-hook-form` validation rules.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - TimePicker and form item props.\n * @returns A time picker component integrated with react-hook-form.\n */\nexport const MyTimePicker = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n className,\n rules,\n floatingError,\n ...props\n}: MyTimePickerProps<TFieldValues>) => {\n return name && control ? (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field }) => (\n <FormItem className={cn(floatingError && 'space-y-0')}>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <FormControl>\n <TimePicker {...field} {...props} />\n </FormControl>\n <FormMessage className={cn(floatingError && 'absolute -bottom-5')} />\n </FormItem>\n )}\n />\n ) : (\n <TimePicker className={'mt-2'} {...props} />\n );\n};\n"],"names":["MyCheckbox","control","name","label","rules","props","id","useId","jsx","FormField","field","FormLabel","jsxs","FormItem","FormControl","Checkbox","MyDatePicker","required","format","DATE","floatingError","placeholder","disabled","register","className","inputProps","formState","cn","Popover","PopoverTrigger","Input","get","dayjs","Calendar1","PopoverContent","Calendar","FormMessage","MyDateRangePicker","DateRangePicker","MyHtmlEditor","HtmlEditor","MyMaskInput","MaskInput","value","MyRadio","RadioGroupItem","MySwitch","Switch","MyTextarea","Textarea","MyTimePicker","TimePicker"],"mappings":";;;;;;;;;;;;AA8BO,MAAMA,IAAa,CAAmC;AAAA,EAC3D,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAqC;AACnC,QAAMC,IAAKC,EAAA;AACX,SACGL,KAAQD,KACP,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAR;AAAA,MACA,MAAAC;AAAA,MACA,OAAAE;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAM,0BACRC,GA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
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/datepicker/DateRangePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,aAAa,EAAQ,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAKrD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,aAAa,EACb,MAAM,GAAG,UAAU,GAAG,UAAU,CACjC,GAAG;IACF,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAWF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,GAAI,gHAW7B,oBAAoB,4CAyKtB,CAAC"}
1
+ {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/datepicker/DateRangePicker.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,aAAa,EAAQ,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAKrD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,aAAa,EACb,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;GAkBG;AACH,eAAO,MAAM,YAAY,GAAI,YAAY,SAAS,WAAW,EAAE,oIAc5D,iBAAiB,CAAC,YAAY,CAAC,mDA6DjC,CAAC"}
1
+ {"version":3,"file":"MyDatePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/form/MyDatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAQ,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAIL,KAAK,aAAa,EAIlB,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AAKrB,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,YAAY,SAAS,WAAW,IAC5D,aAAa,CAAC,YAAY,CAAC,GACzB,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG;IACzC,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEN;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,GAAI,YAAY,SAAS,WAAW,EAAE,oIAc5D,iBAAiB,CAAC,YAAY,CAAC,mDA6DjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dgz-ui-shared",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
4
4
  "description": "Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library",
5
5
  "keywords": [
6
6
  "dgz-ui",
@@ -176,8 +176,7 @@
176
176
  },
177
177
  "dependencies": {
178
178
  "@hookform/resolvers": "^5.0.1",
179
- "dayjs": "^1.11.19",
180
- "dgz-ui": "^1.4.11",
179
+ "dgz-ui": "^1.4.12",
181
180
  "file-saver": "^2.0.5",
182
181
  "lodash": "^4.17.21",
183
182
  "lucide-react": "^0.563.0",
@@ -1,178 +0,0 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import l from "dayjs";
3
- import { Button as j } from "dgz-ui/button";
4
- import { DATE as w, Calendar as O } from "dgz-ui/calendar";
5
- import { Input as P } from "dgz-ui/form";
6
- import { Popover as A, PopoverTrigger as M, PopoverContent as z } from "dgz-ui/popover";
7
- import { cn as h } from "dgz-ui/utils";
8
- import { XIcon as E, Calendar1 as F } from "lucide-react";
9
- import { useState as d, useEffect as I, useMemo as Z } from "react";
10
- import { useTranslation as $ } from "react-i18next";
11
- const V = ({
12
- className: T,
13
- format: n = w,
14
- selected: r,
15
- timezone: p,
16
- onRangeSelected: m = () => {
17
- },
18
- placeholder: x,
19
- disabled: i,
20
- error: N,
21
- inputProps: C,
22
- ...u
23
- }) => {
24
- const { t: a } = $(), [k, D] = d(!1), [o, f] = d();
25
- I(() => {
26
- f(r);
27
- }, [r]);
28
- const L = Z(() => {
29
- const t = l().endOf("day");
30
- return [
31
- {
32
- from: t.startOf("week").toDate(),
33
- to: t.endOf("week").toDate(),
34
- label: a("This week")
35
- },
36
- {
37
- from: t.startOf("month").toDate(),
38
- to: t.endOf("month").toDate(),
39
- label: a("This month")
40
- },
41
- {
42
- from: t.startOf("year").toDate(),
43
- to: t.endOf("year").toDate(),
44
- label: a("This year")
45
- },
46
- {
47
- from: t.subtract(7, "day").startOf("day").toDate(),
48
- to: t.toDate(),
49
- label: a("Last 7 days")
50
- },
51
- {
52
- from: t.subtract(30, "day").startOf("day").toDate(),
53
- to: t.toDate(),
54
- label: a("Last 30 days")
55
- },
56
- {
57
- from: t.subtract(3, "month").startOf("day").toDate(),
58
- to: t.toDate(),
59
- label: a("Last 3 months")
60
- },
61
- {
62
- from: t.subtract(6, "month").startOf("day").toDate(),
63
- to: t.toDate(),
64
- label: a("Last 6 months")
65
- },
66
- {
67
- from: t.subtract(12, "month").startOf("day").toDate(),
68
- to: t.toDate(),
69
- label: a("Last 12 months")
70
- }
71
- ].map((s) => {
72
- var y, v;
73
- return {
74
- ...s,
75
- isActive: ((y = r == null ? void 0 : r.from) == null ? void 0 : y.getTime()) === s.from.getTime() && ((v = r == null ? void 0 : r.to) == null ? void 0 : v.getTime()) === s.to.getTime()
76
- };
77
- });
78
- }, [a, r]), b = (t) => {
79
- f(t), t != null && t.from && (t != null && t.to) && (m(t), D(!1));
80
- };
81
- return /* @__PURE__ */ c(A, { open: k, onOpenChange: D, children: [
82
- /* @__PURE__ */ e(M, { asChild: !0, className: "m-0!", disabled: i, children: /* @__PURE__ */ c("div", { className: "relative", children: [
83
- /* @__PURE__ */ e(
84
- P,
85
- {
86
- variant: N ? "failure" : "default",
87
- ...C,
88
- readOnly: !0,
89
- value: o != null && o.from ? o.to ? `${l(o.from).format(n)}-${l(o.to).format(n)}` : l(o.from).format(n) : "",
90
- placeholder: x,
91
- disabled: i,
92
- className: h(T)
93
- }
94
- ),
95
- o && /* @__PURE__ */ e(
96
- E,
97
- {
98
- onClick: () => {
99
- f(void 0), m == null || m(void 0);
100
- },
101
- className: h(
102
- "text-secondary absolute top-3 right-8 size-4 cursor-pointer",
103
- i && "pointer-events-none opacity-50"
104
- )
105
- }
106
- ),
107
- /* @__PURE__ */ e(
108
- F,
109
- {
110
- className: h(
111
- "text-secondary absolute top-2.5 right-2 size-5",
112
- i && "pointer-events-none opacity-50"
113
- )
114
- }
115
- )
116
- ] }) }),
117
- /* @__PURE__ */ c(z, { className: "flex w-auto p-0", align: "end", side: "bottom", children: [
118
- /* @__PURE__ */ e(
119
- "div",
120
- {
121
- className: "border-border-alpha-light flex flex-col space-y-1 border-e p-2",
122
- children: L.map((t, s) => /* @__PURE__ */ e(
123
- j,
124
- {
125
- size: "xs",
126
- variant: t.isActive ? "default" : "ghost",
127
- className: "justify-start",
128
- onClick: () => b(t),
129
- children: t.label
130
- },
131
- s
132
- ))
133
- }
134
- ),
135
- /* @__PURE__ */ e(
136
- O,
137
- {
138
- ...u,
139
- className: "border-border-alpha-light border-e",
140
- mode: "single",
141
- endMonth: o == null ? void 0 : o.to,
142
- selected: o == null ? void 0 : o.from,
143
- selectedToDate: o == null ? void 0 : o.to,
144
- selectedFromDate: o == null ? void 0 : o.from,
145
- timeZone: p,
146
- disabled: o != null && o.to ? {
147
- after: o.to
148
- } : void 0,
149
- onSelect: (t) => {
150
- f({ ...o, from: t });
151
- }
152
- }
153
- ),
154
- /* @__PURE__ */ e(
155
- O,
156
- {
157
- ...u,
158
- mode: "single",
159
- startMonth: o == null ? void 0 : o.from,
160
- selected: o == null ? void 0 : o.to,
161
- timeZone: p,
162
- disabled: o != null && o.from ? {
163
- before: o.from
164
- } : void 0,
165
- selectedToDate: o == null ? void 0 : o.to,
166
- selectedFromDate: o == null ? void 0 : o.from,
167
- onSelect: (t) => {
168
- o && b({ ...o, to: t });
169
- }
170
- }
171
- )
172
- ] })
173
- ] });
174
- };
175
- export {
176
- V as D
177
- };
178
- //# sourceMappingURL=DateRangePicker-DQoK4BQV.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateRangePicker-DQoK4BQV.es.js","sources":["../../src/components/datepicker/DateRangePicker.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Button } from 'dgz-ui/button';\nimport { Calendar, type CalendarProps, DATE } from 'dgz-ui/calendar';\nimport { Input, type InputProps } from 'dgz-ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from 'dgz-ui/popover';\nimport { cn } from 'dgz-ui/utils';\nimport { Calendar1, XIcon } from 'lucide-react';\nimport { type ReactNode, useEffect, useMemo, useState } from 'react';\nimport { type DateRange } from 'react-day-picker';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * Props for the DateRangePicker component.\n */\nexport type DateRangePickerProps = Omit<\n CalendarProps,\n 'mode' | 'disabled' | 'selected'\n> & {\n /** The date format string (e.g., 'YYYY-MM-DD'). */\n format?: string;\n /** Placeholder text when no date is selected. */\n placeholder?: string;\n /** The currently selected date range. */\n selected?: DateRange;\n /** Timezone for date calculations. */\n timezone?: string;\n /** Error message to display (modifies styling). */\n error?: string;\n /** Callback function when a date range is selected. */\n onRangeSelected?: (value?: DateRange) => void;\n inputProps?: InputProps;\n disabled?: boolean;\n};\n\n/**\n * Type definition for a date range preset configuration.\n */\ntype PresetType = DateRange & {\n /** Label for the preset (e.g., \"Last 7 days\"). */\n label: ReactNode;\n isActive?: boolean;\n};\n\n/**\n * DateRangePicker displays a two-month range picker with helpful presets.\n *\n * @param props.format - Display date format.\n * @param props.selected - Currently selected date range.\n * @param props.timezone - Time zone for date calculations.\n * @param props.onRangeSelected - Callback when a full range is selected.\n * @param props.placeholder - Placeholder when no date selected.\n * @param props.error - Optional error message that adjusts styling.\n * @param props.inputProps - Props passed to the underlying Input component.\n * @param props.disabled - Whether the date range picker is disabled.\n * @returns A date range picker component.\n */\nexport const DateRangePicker = ({\n className,\n format = DATE,\n selected,\n timezone,\n onRangeSelected = () => {},\n placeholder,\n disabled,\n error,\n inputProps,\n ...props\n}: DateRangePickerProps) => {\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const [date, setDate] = useState<DateRange | undefined>();\n\n useEffect(() => {\n setDate(selected);\n }, [selected]);\n\n const presets: PresetType[] = useMemo(() => {\n const today = dayjs().endOf('day');\n return [\n {\n from: today.startOf('week').toDate(),\n to: today.endOf('week').toDate(),\n label: t('This week'),\n },\n {\n from: today.startOf('month').toDate(),\n to: today.endOf('month').toDate(),\n label: t('This month'),\n },\n {\n from: today.startOf('year').toDate(),\n to: today.endOf('year').toDate(),\n label: t('This year'),\n },\n {\n from: today.subtract(7, 'day').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 7 days'),\n },\n {\n from: today.subtract(30, 'day').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 30 days'),\n },\n {\n from: today.subtract(3, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 3 months'),\n },\n {\n from: today.subtract(6, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 6 months'),\n },\n {\n from: today.subtract(12, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 12 months'),\n },\n ].map((item) => ({\n ...item,\n isActive:\n selected?.from?.getTime() === item.from.getTime() &&\n selected?.to?.getTime() === item.to.getTime(),\n }));\n }, [t, selected]);\n\n const handleRangeSelect = (range: DateRange) => {\n setDate(range);\n if (range?.from && range?.to) {\n onRangeSelected(range);\n setOpen(false);\n }\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild className={'m-0!'} disabled={disabled}>\n <div className={'relative'}>\n <Input\n variant={error ? 'failure' : 'default'}\n {...inputProps}\n readOnly\n value={\n date?.from\n ? date.to\n ? `${dayjs(date.from).format(format)}-${dayjs(date.to).format(format)}`\n : dayjs(date.from).format(format)\n : ''\n }\n placeholder={placeholder}\n disabled={disabled}\n className={cn(className)}\n />\n {date && (\n <XIcon\n onClick={() => {\n setDate(undefined);\n onRangeSelected?.(undefined);\n }}\n className={cn(\n 'text-secondary absolute top-3 right-8 size-4 cursor-pointer',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n )}\n <Calendar1\n className={cn(\n 'text-secondary absolute top-2.5 right-2 size-5',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n </div>\n </PopoverTrigger>\n <PopoverContent className=\"flex w-auto p-0\" align=\"end\" side={'bottom'}>\n <div\n className={\n 'border-border-alpha-light flex flex-col space-y-1 border-e p-2'\n }\n >\n {presets.map((preset, index) => (\n <Button\n size={'xs'}\n key={index}\n variant={preset.isActive ? 'default' : 'ghost'}\n className={'justify-start'}\n onClick={() => handleRangeSelect(preset)}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n <Calendar\n {...props}\n className={'border-border-alpha-light border-e'}\n mode=\"single\"\n endMonth={date?.to}\n selected={date?.from}\n selectedToDate={date?.to}\n selectedFromDate={date?.from}\n timeZone={timezone}\n disabled={\n date?.to\n ? {\n after: date.to,\n }\n : undefined\n }\n onSelect={(from) => {\n setDate({ ...date, from: from as Date | undefined });\n }}\n />\n <Calendar\n {...props}\n mode=\"single\"\n startMonth={date?.from}\n selected={date?.to}\n timeZone={timezone}\n disabled={\n date?.from\n ? {\n before: date.from,\n }\n : undefined\n }\n selectedToDate={date?.to}\n selectedFromDate={date?.from}\n onSelect={(to) => {\n if (date) {\n handleRangeSelect({ ...date, to: to as Date | undefined });\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n};\n"],"names":["DateRangePicker","className","format","DATE","selected","timezone","onRangeSelected","placeholder","disabled","error","inputProps","props","t","useTranslation","open","setOpen","useState","date","setDate","useEffect","presets","useMemo","today","dayjs","item","_a","_b","handleRangeSelect","range","jsxs","Popover","jsx","PopoverTrigger","Input","cn","XIcon","Calendar1","PopoverContent","preset","index","Button","Calendar","from","to"],"mappings":";;;;;;;;;;AAwDO,MAAMA,IAAkB,CAAC;AAAA,EAC9B,WAAAC;AAAA,EACA,QAAAC,IAASC;AAAA,EACT,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC,IAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,MAA4B;AAC1B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAK,GAChC,CAACC,GAAMC,CAAO,IAAIF,EAAA;AAExB,EAAAG,EAAU,MAAM;AACd,IAAAD,EAAQd,CAAQ;AAAA,EAClB,GAAG,CAACA,CAAQ,CAAC;AAEb,QAAMgB,IAAwBC,EAAQ,MAAM;AAC1C,UAAMC,IAAQC,IAAQ,MAAM,KAAK;AACjC,WAAO;AAAA,MACL;AAAA,QACE,MAAMD,EAAM,QAAQ,MAAM,EAAE,OAAA;AAAA,QAC5B,IAAIA,EAAM,MAAM,MAAM,EAAE,OAAA;AAAA,QACxB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A,EAAM;AAAA,UAChB,UAAUZ;AAAA,UACV,UACEY,KAAA,QAAAA,EAAM,OACF;AAAA,YACE,QAAQA,EAAK;AAAA,UAAA,IAEf;AAAA,UAEN,gBAAgBA,KAAA,gBAAAA,EAAM;AAAA,UACtB,kBAAkBA,KAAA,gBAAAA,EAAM;AAAA,UACxB,UAAU,CAAC0B,MAAO;AAChB,YAAI1B,KACFU,EAAkB,EAAE,GAAGV,GAAM,IAAA0B,GAA4B;AAAA,UAE7D;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -1,2 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),L=require("dayjs"),P=require("dgz-ui/button"),h=require("dgz-ui/calendar"),_=require("dgz-ui/form"),d=require("dgz-ui/popover"),D=require("dgz-ui/utils"),O=require("lucide-react"),c=require("react"),w=require("react-i18next"),M=a=>a&&a.__esModule?a:{default:a},m=M(L),A=({className:a,format:u=h.DATE,selected:s,timezone:b,onRangeSelected:i=()=>{},placeholder:T,disabled:l,error:q,inputProps:N,...y})=>{const{t:r}=w.useTranslation(),[C,p]=c.useState(!1),[t,f]=c.useState();c.useEffect(()=>{f(s)},[s]);const k=c.useMemo(()=>{const o=m.default().endOf("day");return[{from:o.startOf("week").toDate(),to:o.endOf("week").toDate(),label:r("This week")},{from:o.startOf("month").toDate(),to:o.endOf("month").toDate(),label:r("This month")},{from:o.startOf("year").toDate(),to:o.endOf("year").toDate(),label:r("This year")},{from:o.subtract(7,"day").startOf("day").toDate(),to:o.toDate(),label:r("Last 7 days")},{from:o.subtract(30,"day").startOf("day").toDate(),to:o.toDate(),label:r("Last 30 days")},{from:o.subtract(3,"month").startOf("day").toDate(),to:o.toDate(),label:r("Last 3 months")},{from:o.subtract(6,"month").startOf("day").toDate(),to:o.toDate(),label:r("Last 6 months")},{from:o.subtract(12,"month").startOf("day").toDate(),to:o.toDate(),label:r("Last 12 months")}].map(n=>{var v,j;return{...n,isActive:((v=s==null?void 0:s.from)==null?void 0:v.getTime())===n.from.getTime()&&((j=s==null?void 0:s.to)==null?void 0:j.getTime())===n.to.getTime()}})},[r,s]),x=o=>{f(o),o!=null&&o.from&&(o!=null&&o.to)&&(i(o),p(!1))};return e.jsxs(d.Popover,{open:C,onOpenChange:p,children:[e.jsx(d.PopoverTrigger,{asChild:!0,className:"m-0!",disabled:l,children:e.jsxs("div",{className:"relative",children:[e.jsx(_.Input,{variant:q?"failure":"default",...N,readOnly:!0,value:t!=null&&t.from?t.to?`${m.default(t.from).format(u)}-${m.default(t.to).format(u)}`:m.default(t.from).format(u):"",placeholder:T,disabled:l,className:D.cn(a)}),t&&e.jsx(O.XIcon,{onClick:()=>{f(void 0),i==null||i(void 0)},className:D.cn("text-secondary absolute top-3 right-8 size-4 cursor-pointer",l&&"pointer-events-none opacity-50")}),e.jsx(O.Calendar1,{className:D.cn("text-secondary absolute top-2.5 right-2 size-5",l&&"pointer-events-none opacity-50")})]})}),e.jsxs(d.PopoverContent,{className:"flex w-auto p-0",align:"end",side:"bottom",children:[e.jsx("div",{className:"border-border-alpha-light flex flex-col space-y-1 border-e p-2",children:k.map((o,n)=>e.jsx(P.Button,{size:"xs",variant:o.isActive?"default":"ghost",className:"justify-start",onClick:()=>x(o),children:o.label},n))}),e.jsx(h.Calendar,{...y,className:"border-border-alpha-light border-e",mode:"single",endMonth:t==null?void 0:t.to,selected:t==null?void 0:t.from,selectedToDate:t==null?void 0:t.to,selectedFromDate:t==null?void 0:t.from,timeZone:b,disabled:t!=null&&t.to?{after:t.to}:void 0,onSelect:o=>{f({...t,from:o})}}),e.jsx(h.Calendar,{...y,mode:"single",startMonth:t==null?void 0:t.from,selected:t==null?void 0:t.to,timeZone:b,disabled:t!=null&&t.from?{before:t.from}:void 0,selectedToDate:t==null?void 0:t.to,selectedFromDate:t==null?void 0:t.from,onSelect:o=>{t&&x({...t,to:o})}})]})]})};exports.DateRangePicker=A;
2
- //# sourceMappingURL=DateRangePicker-H-_fkN-r.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateRangePicker-H-_fkN-r.cjs.js","sources":["../../src/components/datepicker/DateRangePicker.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Button } from 'dgz-ui/button';\nimport { Calendar, type CalendarProps, DATE } from 'dgz-ui/calendar';\nimport { Input, type InputProps } from 'dgz-ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from 'dgz-ui/popover';\nimport { cn } from 'dgz-ui/utils';\nimport { Calendar1, XIcon } from 'lucide-react';\nimport { type ReactNode, useEffect, useMemo, useState } from 'react';\nimport { type DateRange } from 'react-day-picker';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * Props for the DateRangePicker component.\n */\nexport type DateRangePickerProps = Omit<\n CalendarProps,\n 'mode' | 'disabled' | 'selected'\n> & {\n /** The date format string (e.g., 'YYYY-MM-DD'). */\n format?: string;\n /** Placeholder text when no date is selected. */\n placeholder?: string;\n /** The currently selected date range. */\n selected?: DateRange;\n /** Timezone for date calculations. */\n timezone?: string;\n /** Error message to display (modifies styling). */\n error?: string;\n /** Callback function when a date range is selected. */\n onRangeSelected?: (value?: DateRange) => void;\n inputProps?: InputProps;\n disabled?: boolean;\n};\n\n/**\n * Type definition for a date range preset configuration.\n */\ntype PresetType = DateRange & {\n /** Label for the preset (e.g., \"Last 7 days\"). */\n label: ReactNode;\n isActive?: boolean;\n};\n\n/**\n * DateRangePicker displays a two-month range picker with helpful presets.\n *\n * @param props.format - Display date format.\n * @param props.selected - Currently selected date range.\n * @param props.timezone - Time zone for date calculations.\n * @param props.onRangeSelected - Callback when a full range is selected.\n * @param props.placeholder - Placeholder when no date selected.\n * @param props.error - Optional error message that adjusts styling.\n * @param props.inputProps - Props passed to the underlying Input component.\n * @param props.disabled - Whether the date range picker is disabled.\n * @returns A date range picker component.\n */\nexport const DateRangePicker = ({\n className,\n format = DATE,\n selected,\n timezone,\n onRangeSelected = () => {},\n placeholder,\n disabled,\n error,\n inputProps,\n ...props\n}: DateRangePickerProps) => {\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const [date, setDate] = useState<DateRange | undefined>();\n\n useEffect(() => {\n setDate(selected);\n }, [selected]);\n\n const presets: PresetType[] = useMemo(() => {\n const today = dayjs().endOf('day');\n return [\n {\n from: today.startOf('week').toDate(),\n to: today.endOf('week').toDate(),\n label: t('This week'),\n },\n {\n from: today.startOf('month').toDate(),\n to: today.endOf('month').toDate(),\n label: t('This month'),\n },\n {\n from: today.startOf('year').toDate(),\n to: today.endOf('year').toDate(),\n label: t('This year'),\n },\n {\n from: today.subtract(7, 'day').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 7 days'),\n },\n {\n from: today.subtract(30, 'day').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 30 days'),\n },\n {\n from: today.subtract(3, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 3 months'),\n },\n {\n from: today.subtract(6, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 6 months'),\n },\n {\n from: today.subtract(12, 'month').startOf('day').toDate(),\n to: today.toDate(),\n label: t('Last 12 months'),\n },\n ].map((item) => ({\n ...item,\n isActive:\n selected?.from?.getTime() === item.from.getTime() &&\n selected?.to?.getTime() === item.to.getTime(),\n }));\n }, [t, selected]);\n\n const handleRangeSelect = (range: DateRange) => {\n setDate(range);\n if (range?.from && range?.to) {\n onRangeSelected(range);\n setOpen(false);\n }\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild className={'m-0!'} disabled={disabled}>\n <div className={'relative'}>\n <Input\n variant={error ? 'failure' : 'default'}\n {...inputProps}\n readOnly\n value={\n date?.from\n ? date.to\n ? `${dayjs(date.from).format(format)}-${dayjs(date.to).format(format)}`\n : dayjs(date.from).format(format)\n : ''\n }\n placeholder={placeholder}\n disabled={disabled}\n className={cn(className)}\n />\n {date && (\n <XIcon\n onClick={() => {\n setDate(undefined);\n onRangeSelected?.(undefined);\n }}\n className={cn(\n 'text-secondary absolute top-3 right-8 size-4 cursor-pointer',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n )}\n <Calendar1\n className={cn(\n 'text-secondary absolute top-2.5 right-2 size-5',\n disabled && 'pointer-events-none opacity-50'\n )}\n />\n </div>\n </PopoverTrigger>\n <PopoverContent className=\"flex w-auto p-0\" align=\"end\" side={'bottom'}>\n <div\n className={\n 'border-border-alpha-light flex flex-col space-y-1 border-e p-2'\n }\n >\n {presets.map((preset, index) => (\n <Button\n size={'xs'}\n key={index}\n variant={preset.isActive ? 'default' : 'ghost'}\n className={'justify-start'}\n onClick={() => handleRangeSelect(preset)}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n <Calendar\n {...props}\n className={'border-border-alpha-light border-e'}\n mode=\"single\"\n endMonth={date?.to}\n selected={date?.from}\n selectedToDate={date?.to}\n selectedFromDate={date?.from}\n timeZone={timezone}\n disabled={\n date?.to\n ? {\n after: date.to,\n }\n : undefined\n }\n onSelect={(from) => {\n setDate({ ...date, from: from as Date | undefined });\n }}\n />\n <Calendar\n {...props}\n mode=\"single\"\n startMonth={date?.from}\n selected={date?.to}\n timeZone={timezone}\n disabled={\n date?.from\n ? {\n before: date.from,\n }\n : undefined\n }\n selectedToDate={date?.to}\n selectedFromDate={date?.from}\n onSelect={(to) => {\n if (date) {\n handleRangeSelect({ ...date, to: to as Date | undefined });\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n};\n"],"names":["DateRangePicker","className","format","DATE","selected","timezone","onRangeSelected","placeholder","disabled","error","inputProps","props","t","useTranslation","open","setOpen","useState","date","setDate","useEffect","presets","useMemo","today","dayjs","item","_a","_b","handleRangeSelect","range","jsxs","Popover","jsx","PopoverTrigger","Input","cn","XIcon","Calendar1","PopoverContent","preset","index","Button","Calendar","from","to"],"mappings":"8TAwDaA,EAAkB,CAAC,CAC9B,UAAAC,EACA,OAAAC,EAASC,EAAAA,KACT,SAAAC,EACA,SAAAC,EACA,gBAAAC,EAAkB,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,CACZ1B,GACFU,EAAkB,CAAE,GAAGV,EAAM,GAAA0B,EAA4B,CAE7D,CAAA,CAAA,CACF,CAAA,CACF,CAAA,EACF,CAEJ"}
@@ -1,7 +0,0 @@
1
- import { default as dayjs, Dayjs } from 'dayjs';
2
- /**
3
- * Re-export of dayjs with the customParseFormat plugin extended.
4
- * This ensures that dayjs is consistently configured across the application.
5
- */
6
- export { dayjs, Dayjs };
7
- //# sourceMappingURL=day.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"day.d.ts","sourceRoot":"","sources":["../../../src/utils/day.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAIrC;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC"}