@customafk/lunas-ui 0.0.43 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-new-DFYo0Z5U.js → add-new-Cjqcjsb8.js} +1 -1
- package/dist/{add-new-DFYo0Z5U.js.map → add-new-Cjqcjsb8.js.map} +1 -1
- package/dist/{add-new-CP21dPWR.cjs → add-new-ojR4JdT-.cjs} +1 -1
- package/dist/{add-new-CP21dPWR.cjs.map → add-new-ojR4JdT-.cjs.map} +1 -1
- package/dist/{button-UJ9aBaWX.d.cts → button-B7EgZzPl.d.cts} +5 -5
- package/dist/{command-D3Z3051S.d.ts → command-BRV_7Zs4.d.ts} +12 -12
- package/dist/{command-C_qNrTKS.d.cts → command-CtsfU8-n.d.cts} +12 -12
- package/dist/data-display/empty.d.cts +2 -2
- package/dist/data-display/statistic.d.cts +2 -2
- package/dist/data-display/statistic.d.ts +2 -2
- package/dist/{dialog-CFm2UbmQ.d.ts → dialog-76EA0O7Y.d.ts} +12 -12
- package/dist/{dialog-fc1WiHOl.d.cts → dialog-C7RUCZNu.d.cts} +12 -12
- package/dist/dialogs/confirm-dialog.cjs +1 -1
- package/dist/dialogs/confirm-dialog.cjs.map +1 -1
- package/dist/dialogs/confirm-dialog.js +1 -1
- package/dist/dialogs/confirm-dialog.js.map +1 -1
- package/dist/dialogs/detail-dialog/component/sidebar.d.cts +28 -28
- package/dist/dialogs/detail-dialog/component/sidebar.d.ts +3 -3
- package/dist/dialogs/error-dialog.cjs +1 -1
- package/dist/dialogs/error-dialog.js +1 -1
- package/dist/dialogs/form-dialog.cjs +1 -1
- package/dist/dialogs/form-dialog.cjs.map +1 -1
- package/dist/dialogs/form-dialog.d.cts +2 -2
- package/dist/dialogs/form-dialog.js +1 -1
- package/dist/dialogs/form-dialog.js.map +1 -1
- package/dist/{error-dialog-C0GNuMtI.js → error-dialog-CTPWuLNO.js} +2 -2
- package/dist/{error-dialog-C0GNuMtI.js.map → error-dialog-CTPWuLNO.js.map} +1 -1
- package/dist/{error-dialog-DpMUxRz8.cjs → error-dialog-D7FS_tBU.cjs} +2 -2
- package/dist/{error-dialog-DpMUxRz8.cjs.map → error-dialog-D7FS_tBU.cjs.map} +1 -1
- package/dist/{form-wrapper-BZajFi4W.cjs → form-wrapper-CVkfJN7q.cjs} +2 -2
- package/dist/{form-wrapper-BZajFi4W.cjs.map → form-wrapper-CVkfJN7q.cjs.map} +1 -1
- package/dist/{form-wrapper-DZDGqZj4.js → form-wrapper-pnkjBZnM.js} +2 -2
- package/dist/{form-wrapper-DZDGqZj4.js.map → form-wrapper-pnkjBZnM.js.map} +1 -1
- package/dist/forms/combobox-field.d.cts +2 -2
- package/dist/forms/combobox-field.d.ts +2 -2
- package/dist/forms/date-field.cjs +1 -1
- package/dist/forms/date-field.cjs.map +1 -1
- package/dist/forms/date-field.d.ts +2 -2
- package/dist/forms/date-field.js +1 -1
- package/dist/forms/date-field.js.map +1 -1
- package/dist/forms/form-wrapper.cjs +1 -1
- package/dist/forms/form-wrapper.d.cts +2 -2
- package/dist/forms/form-wrapper.d.ts +2 -2
- package/dist/forms/form-wrapper.js +1 -1
- package/dist/forms/multi-select-field.d.cts +2 -2
- package/dist/forms/multi-select-field.d.ts +2 -2
- package/dist/forms/number-field.d.cts +2 -2
- package/dist/forms/number-field.d.ts +2 -2
- package/dist/forms/password-field.d.cts +2 -2
- package/dist/forms/password-field.d.ts +2 -2
- package/dist/forms/select-field.d.cts +2 -2
- package/dist/forms/select-field.d.ts +2 -2
- package/dist/forms/switch-field.d.cts +2 -2
- package/dist/forms/switch-field.d.ts +2 -2
- package/dist/forms/text-field.d.ts +2 -2
- package/dist/forms/textarea-field.cjs +1 -1
- package/dist/forms/textarea-field.d.cts +2 -2
- package/dist/forms/textarea-field.d.ts +2 -2
- package/dist/forms/textarea-field.js +1 -1
- package/dist/{input-D80zJt41.d.ts → input-Cng3uFxw.d.cts} +3 -3
- package/dist/{input-C_DS2fwv.d.cts → input-DfaMHsQo.d.ts} +3 -3
- package/dist/layouts/app-layout/index.d.cts +3 -3
- package/dist/layouts/app-layout/index.d.ts +2 -2
- package/dist/layouts/flex.d.cts +5 -5
- package/dist/layouts/flex.d.ts +3 -3
- package/dist/layouts/grid.cjs +2 -0
- package/dist/layouts/grid.cjs.map +1 -0
- package/dist/layouts/grid.d.cts +5 -0
- package/dist/layouts/grid.d.ts +5 -0
- package/dist/layouts/grid.js +2 -0
- package/dist/layouts/grid.js.map +1 -0
- package/dist/layouts/main/index.d.ts +4 -4
- package/dist/{refresh-BkWccsrq.cjs → refresh-CE6rdriE.cjs} +1 -1
- package/dist/{refresh-BkWccsrq.cjs.map → refresh-CE6rdriE.cjs.map} +1 -1
- package/dist/{refresh-8E8mCYT5.js → refresh-q_l82UhV.js} +1 -1
- package/dist/{refresh-8E8mCYT5.js.map → refresh-q_l82UhV.js.map} +1 -1
- package/dist/{search-input-B3dvl78s.js → search-input-CP1CX74C.js} +1 -1
- package/dist/{search-input-B3dvl78s.js.map → search-input-CP1CX74C.js.map} +1 -1
- package/dist/{search-input-BnaLd7rV.cjs → search-input-DzRJf6qI.cjs} +1 -1
- package/dist/{search-input-BnaLd7rV.cjs.map → search-input-DzRJf6qI.cjs.map} +1 -1
- package/dist/{separator-Q2WCMKuX.d.cts → separator-D36UkGvg.d.cts} +3 -3
- package/dist/{separator-D6zgZpe6.d.ts → separator-WBRIEOFh.d.ts} +3 -3
- package/dist/table/index.cjs +1 -1
- package/dist/table/index.cjs.map +1 -1
- package/dist/table/index.d.cts +2 -2
- package/dist/table/index.d.ts +2 -2
- package/dist/table/index.js +1 -1
- package/dist/table/index.js.map +1 -1
- package/dist/{table-f17OdNlX.cjs → table-0gtpLtja.cjs} +2 -2
- package/dist/{table-f17OdNlX.cjs.map → table-0gtpLtja.cjs.map} +1 -1
- package/dist/{table-BME-qkHg.js → table-Bpzbgpff.js} +2 -2
- package/dist/{table-BME-qkHg.js.map → table-Bpzbgpff.js.map} +1 -1
- package/dist/{textarea-Djn0NqJI.js → textarea-BK2brgwY.js} +2 -2
- package/dist/{textarea-Djn0NqJI.js.map → textarea-BK2brgwY.js.map} +1 -1
- package/dist/{textarea-CGXBZSUm.cjs → textarea-Y4wAXFGr.cjs} +2 -2
- package/dist/{textarea-CGXBZSUm.cjs.map → textarea-Y4wAXFGr.cjs.map} +1 -1
- package/dist/{toggle-Bin3s4t-.d.cts → toggle-D2aRhQ67.d.ts} +5 -5
- package/dist/{toggle-DH9IssyE.d.ts → toggle-DfC247hI.d.cts} +4 -4
- package/dist/{tooltip-CvoU6-LI.d.cts → tooltip-ClcR7d6G.d.cts} +6 -6
- package/dist/{tooltip-Djh_dcy5.d.ts → tooltip-WPrK6Am9.d.ts} +6 -6
- package/dist/typography/paragraph.d.ts +2 -2
- package/dist/typography/title.d.cts +2 -2
- package/dist/typography/title.d.ts +2 -2
- package/dist/ui/alert-dialog.d.cts +12 -12
- package/dist/ui/alert-dialog.d.ts +12 -12
- package/dist/ui/alert.d.cts +4 -4
- package/dist/ui/alert.d.ts +6 -6
- package/dist/ui/aspect-ratio.d.cts +2 -2
- package/dist/ui/aspect-ratio.d.ts +2 -2
- package/dist/ui/avatar.d.cts +4 -4
- package/dist/ui/avatar.d.ts +4 -4
- package/dist/ui/badge.d.cts +5 -5
- package/dist/ui/badge.d.ts +5 -5
- package/dist/ui/breadcrumb.d.cts +8 -8
- package/dist/ui/breadcrumb.d.ts +8 -8
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/buttons/add-new.cjs +1 -1
- package/dist/ui/buttons/add-new.js +1 -1
- package/dist/ui/buttons/refresh.cjs +1 -1
- package/dist/ui/buttons/refresh.js +1 -1
- package/dist/ui/calendar.d.cts +4 -4
- package/dist/ui/calendar.d.ts +3 -3
- package/dist/ui/card.d.cts +8 -8
- package/dist/ui/card.d.ts +8 -8
- package/dist/ui/carousel.d.cts +7 -7
- package/dist/ui/carousel.d.ts +6 -6
- package/dist/ui/collapsible.d.cts +4 -4
- package/dist/ui/collapsible.d.ts +4 -4
- package/dist/ui/command.d.cts +2 -2
- package/dist/ui/command.d.ts +2 -2
- package/dist/ui/context-menu.d.cts +16 -16
- package/dist/ui/context-menu.d.ts +16 -16
- package/dist/ui/dialog.d.cts +1 -1
- package/dist/ui/dialog.d.ts +1 -1
- package/dist/ui/dropdown-menu.d.cts +16 -16
- package/dist/ui/dropdown-menu.d.ts +16 -16
- package/dist/ui/file-uploader.d.cts +2 -2
- package/dist/ui/file-uploader.d.ts +2 -2
- package/dist/ui/form.d.cts +7 -7
- package/dist/ui/form.d.ts +7 -7
- package/dist/ui/hover-card.d.cts +4 -4
- package/dist/ui/hover-card.d.ts +4 -4
- package/dist/ui/input-otp.d.cts +5 -5
- package/dist/ui/input-otp.d.ts +5 -5
- package/dist/ui/input.d.cts +1 -1
- package/dist/ui/input.d.ts +1 -1
- package/dist/ui/inputs/search-input.cjs +1 -1
- package/dist/ui/inputs/search-input.d.cts +3 -3
- package/dist/ui/inputs/search-input.d.ts +3 -3
- package/dist/ui/inputs/search-input.js +1 -1
- package/dist/ui/label.d.cts +2 -2
- package/dist/ui/label.d.ts +2 -2
- package/dist/ui/menubar.d.cts +17 -17
- package/dist/ui/menubar.d.ts +17 -17
- package/dist/ui/multi-select.d.cts +2 -2
- package/dist/ui/multi-select.d.ts +2 -2
- package/dist/ui/navigation-menu.d.cts +11 -11
- package/dist/ui/navigation-menu.d.ts +9 -9
- package/dist/ui/pagination.d.cts +9 -9
- package/dist/ui/pagination.d.ts +8 -8
- package/dist/ui/popover.d.cts +5 -5
- package/dist/ui/popover.d.ts +5 -5
- package/dist/ui/progress.d.cts +2 -2
- package/dist/ui/progress.d.ts +2 -2
- package/dist/ui/radio-group.d.cts +3 -3
- package/dist/ui/radio-group.d.ts +3 -3
- package/dist/ui/resizable.d.cts +4 -4
- package/dist/ui/resizable.d.ts +4 -4
- package/dist/ui/scroll-area.d.cts +3 -3
- package/dist/ui/select.d.cts +11 -11
- package/dist/ui/select.d.ts +11 -11
- package/dist/ui/separator.d.cts +1 -1
- package/dist/ui/separator.d.ts +1 -1
- package/dist/ui/sheet.d.cts +9 -9
- package/dist/ui/sheet.d.ts +9 -9
- package/dist/ui/sidebar.d.cts +30 -30
- package/dist/ui/sidebar.d.ts +29 -29
- package/dist/ui/skeleton.d.cts +2 -2
- package/dist/ui/skeleton.d.ts +2 -2
- package/dist/ui/slider.d.cts +2 -2
- package/dist/ui/slider.d.ts +2 -2
- package/dist/ui/sonner.d.cts +2 -2
- package/dist/ui/sonner.d.ts +2 -2
- package/dist/ui/switch.d.cts +2 -2
- package/dist/ui/switch.d.ts +2 -2
- package/dist/ui/table.cjs +1 -1
- package/dist/ui/table.d.cts +9 -9
- package/dist/ui/table.d.ts +9 -9
- package/dist/ui/table.js +1 -1
- package/dist/ui/tabs.d.cts +5 -5
- package/dist/ui/tabs.d.ts +5 -5
- package/dist/ui/textarea.cjs +1 -1
- package/dist/ui/textarea.d.cts +2 -2
- package/dist/ui/textarea.d.ts +2 -2
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/toggle-group.d.cts +4 -4
- package/dist/ui/toggle-group.d.ts +4 -4
- package/dist/ui/toggle.d.cts +1 -1
- package/dist/ui/toggle.d.ts +1 -1
- package/dist/ui/tooltip.d.cts +1 -1
- package/dist/ui/tooltip.d.ts +1 -1
- package/package.json +5 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cn as e}from"../utils-D9AH0PUV.js";import{Button as t}from"../button-tXV0dTFU.js";import"../alert-dialog-Cj5WqA7x.js";import"../error-dialog-
|
|
1
|
+
import{cn as e}from"../utils-D9AH0PUV.js";import{Button as t}from"../button-tXV0dTFU.js";import"../alert-dialog-Cj5WqA7x.js";import"../error-dialog-CTPWuLNO.js";import"../label-D1XmKlc3.js";import"../form-63w5ez51.js";import{FormWrapper as n}from"../form-wrapper-pnkjBZnM.js";import{Dialog as r,DialogContent as i,DialogDescription as a,DialogFooter as o,DialogHeader as s,DialogTitle as c}from"../dialog-YTzM43YA.js";import{jsx as l,jsxs as u}from"react/jsx-runtime";const d=({form:d,open:f,isSubmitting:p=!1,isResetAfterSubmit:m=!0,disableSubmit:h=!1,title:g,description:_,className:v,onOpenChange:y,onSubmit:b,onError:x,onReset:S,children:C})=>l(r,{open:f,onOpenChange:y,children:u(i,{className:e(`flex flex-col gap-0 border-none p-0`,v),onInteractOutside:e=>{e.preventDefault(),e.stopPropagation()},children:[u(s,{className:`border-border-weak flex-0 gap-2 border-b p-6 pb-4`,children:[l(c,{children:g||`Form Dialog`}),l(a,{children:_||`This is a form dialog where you can add your form elements.`})]}),u(n,{form:d,isResetAfterSubmit:m,className:`flex flex-1 flex-col overflow-y-auto pt-4`,onSubmit:b,onError:x,children:[l(`main`,{className:`flex-1 overflow-y-auto px-6`,children:C}),u(o,{className:`border-border-weak border-t p-6 pt-4`,children:[l(t,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-full rounded-full sm:w-30`,onClick:S,children:`Reset`}),l(t,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:p,disabled:h,className:`w-full rounded-full sm:w-30`,children:`Submit`})]})]})]})});export{d as FormDialog};
|
|
2
2
|
//# sourceMappingURL=form-dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-dialog.js","names":[],"sources":["../../packages/components/dialogs/form-dialog.tsx"],"sourcesContent":["import type { FieldValues, FormState, SubmitErrorHandler, UseFormProps } from 'react-hook-form'\n\nimport { cn } from '@/lib/utils'\n\nimport { FormWrapper } from '../forms/form-wrapper'\nimport { Button } from '../ui/button'\nimport { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '../ui/dialog'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n form: UseFormProps<TFieldValues>\n\n open: boolean\n isSubmitting?: boolean\n isResetAfterSubmit?: boolean\n disableSubmit?: boolean\n title?: string\n description?: string\n className?: string\n\n onOpenChange: (open: boolean) => void\n onSubmit: (data: TFieldValues, formState: FormState<FieldValues>, dirtyFields: FormState<FieldValues>['dirtyFields']) => void | Promise<void>\n onError?: SubmitErrorHandler<TFieldValues>\n onReset?: () => void\n}\nexport const FormDialog = <TFieldValues extends FieldValues = FieldValues>({\n form,\n open,\n isSubmitting = false,\n isResetAfterSubmit = true,\n disableSubmit = false,\n title,\n description,\n className,\n\n onOpenChange,\n onSubmit,\n onError,\n onReset,\n children,\n}: React.PropsWithChildren<Props<TFieldValues>>) => {\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent\n className={cn('flex flex-col gap-0 border-none p-0', className)}\n onInteractOutside={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n >\n <DialogHeader className=\"border-border-weak flex-0 gap-2 border-b p-6 pb-4\">\n <DialogTitle>{title || 'Form Dialog'}</DialogTitle>\n <DialogDescription>{description || 'This is a form dialog where you can add your form elements.'}</DialogDescription>\n </DialogHeader>\n <FormWrapper\n form={form}\n isResetAfterSubmit={isResetAfterSubmit}\n className=\"flex flex-1 flex-col overflow-y-auto pt-4\"\n onSubmit={onSubmit}\n onError={onError}\n >\n <main className=\"flex-1 overflow-y-auto px-6\">{children}</main>\n <DialogFooter className=\"border-border-weak border-t p-6 pt-4\">\n <Button tabIndex={-1} type=\"button\" variant=\"outline\" color=\"muted\" className=\"w-
|
|
1
|
+
{"version":3,"file":"form-dialog.js","names":[],"sources":["../../packages/components/dialogs/form-dialog.tsx"],"sourcesContent":["import type { FieldValues, FormState, SubmitErrorHandler, UseFormProps } from 'react-hook-form'\n\nimport { cn } from '@/lib/utils'\n\nimport { FormWrapper } from '../forms/form-wrapper'\nimport { Button } from '../ui/button'\nimport { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '../ui/dialog'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n form: UseFormProps<TFieldValues>\n\n open: boolean\n isSubmitting?: boolean\n isResetAfterSubmit?: boolean\n disableSubmit?: boolean\n title?: string\n description?: string\n className?: string\n\n onOpenChange: (open: boolean) => void\n onSubmit: (data: TFieldValues, formState: FormState<FieldValues>, dirtyFields: FormState<FieldValues>['dirtyFields']) => void | Promise<void>\n onError?: SubmitErrorHandler<TFieldValues>\n onReset?: () => void\n}\nexport const FormDialog = <TFieldValues extends FieldValues = FieldValues>({\n form,\n open,\n isSubmitting = false,\n isResetAfterSubmit = true,\n disableSubmit = false,\n title,\n description,\n className,\n\n onOpenChange,\n onSubmit,\n onError,\n onReset,\n children,\n}: React.PropsWithChildren<Props<TFieldValues>>) => {\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent\n className={cn('flex flex-col gap-0 border-none p-0', className)}\n onInteractOutside={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n >\n <DialogHeader className=\"border-border-weak flex-0 gap-2 border-b p-6 pb-4\">\n <DialogTitle>{title || 'Form Dialog'}</DialogTitle>\n <DialogDescription>{description || 'This is a form dialog where you can add your form elements.'}</DialogDescription>\n </DialogHeader>\n <FormWrapper\n form={form}\n isResetAfterSubmit={isResetAfterSubmit}\n className=\"flex flex-1 flex-col overflow-y-auto pt-4\"\n onSubmit={onSubmit}\n onError={onError}\n >\n <main className=\"flex-1 overflow-y-auto px-6\">{children}</main>\n <DialogFooter className=\"border-border-weak border-t p-6 pt-4\">\n <Button tabIndex={-1} type=\"button\" variant=\"outline\" color=\"muted\" className=\"w-full rounded-full sm:w-30\" onClick={onReset}>\n Reset\n </Button>\n <Button autoFocus tabIndex={0} type=\"submit\" isLoading={isSubmitting} disabled={disableSubmit} className=\"w-full rounded-full sm:w-30\">\n Submit\n </Button>\n </DialogFooter>\n </FormWrapper>\n </DialogContent>\n </Dialog>\n )\n}\n"],"mappings":"odAwBA,MAAa,GAA8D,CACzE,OACA,OACA,eAAe,GACf,qBAAqB,GACrB,gBAAgB,GAChB,QACA,cACA,YAEA,eACA,WACA,UACA,UACA,cAGE,EAAC,EAAA,CAAa,OAAoB,wBAChC,EAAC,EAAA,CACC,UAAW,EAAG,sCAAuC,GACrD,kBAAoB,GAAM,CACxB,EAAE,iBACF,EAAE,6BAGJ,EAAC,EAAA,CAAa,UAAU,8DACtB,EAAC,EAAA,CAAA,SAAa,GAAS,gBACvB,EAAC,EAAA,CAAA,SAAmB,GAAe,mEAErC,EAAC,EAAA,CACO,OACc,qBACpB,UAAU,4CACA,WACD,oBAET,EAAC,OAAA,CAAK,UAAU,8BAA+B,aAC/C,EAAC,EAAA,CAAa,UAAU,iDACtB,EAAC,EAAA,CAAO,SAAU,GAAI,KAAK,SAAS,QAAQ,UAAU,MAAM,QAAQ,UAAU,8BAA8B,QAAS,WAAS,UAG9H,EAAC,EAAA,CAAO,UAAA,GAAU,SAAU,EAAG,KAAK,SAAS,UAAW,EAAc,SAAU,EAAe,UAAU,uCAA8B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AlertDialog as e,AlertDialogAction as t,AlertDialogContent as n,AlertDialogFooter as r,AlertDialogHeader as i,AlertDialogTitle as a}from"./alert-dialog-Cj5WqA7x.js";import o from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{AlertTriangleIcon as l}from"lucide-react";const u=({open:u,title:d,children:f,onOpenChange:p})=>{let m=o.useCallback(()=>{p?.(!1)},[p]);return s(e,{open:u,onOpenChange:p,children:c(n,{className:`gap-8 p-4 sm:max-w-md`,children:[s(i,{children:c(`div`,{className:`text-destructive flex flex-col items-center`,children:[s(l,{size:42}),s(a,{className:`text-xl font-medium`,children:d||`An error occurred`})]})}),f,s(r,{children:s(t,{className:`w-28`,onClick:m,children
|
|
2
|
-
//# sourceMappingURL=error-dialog-
|
|
1
|
+
import{AlertDialog as e,AlertDialogAction as t,AlertDialogContent as n,AlertDialogFooter as r,AlertDialogHeader as i,AlertDialogTitle as a}from"./alert-dialog-Cj5WqA7x.js";import o from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{AlertTriangleIcon as l}from"lucide-react";const u=({open:u,title:d,children:f,onOpenChange:p})=>{let m=o.useCallback(()=>{p?.(!1)},[p]);return s(e,{open:u,onOpenChange:p,children:c(n,{className:`gap-8 p-4 sm:max-w-md`,children:[s(i,{children:c(`div`,{className:`text-destructive flex flex-col items-center`,children:[s(l,{size:42}),s(a,{className:`text-xl font-medium`,children:d||`An error occurred`})]})}),f,s(r,{children:s(t,{className:`w-full sm:w-28`,onClick:m,children:`Close`})})]})})};export{u as ErrorDialog};
|
|
2
|
+
//# sourceMappingURL=error-dialog-CTPWuLNO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-dialog-
|
|
1
|
+
{"version":3,"file":"error-dialog-CTPWuLNO.js","names":["ErrorDialog: React.FC<React.PropsWithChildren<Props>>"],"sources":["../packages/components/dialogs/error-dialog.tsx"],"sourcesContent":["import React from 'react'\nimport { AlertTriangleIcon } from 'lucide-react'\n\nimport { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '../ui/alert-dialog'\n\ntype Props = {\n open?: boolean\n title?: string\n description?: string\n onOpenChange?: (open: boolean) => void\n}\nexport const ErrorDialog: React.FC<React.PropsWithChildren<Props>> = ({ open, title, children, onOpenChange }) => {\n const handleClose = React.useCallback(() => {\n onOpenChange?.(false)\n }, [onOpenChange])\n return (\n <AlertDialog open={open} onOpenChange={onOpenChange}>\n <AlertDialogContent className=\"gap-8 p-4 sm:max-w-md\">\n <AlertDialogHeader>\n <div className=\"text-destructive flex flex-col items-center\">\n <AlertTriangleIcon size={42} />\n <AlertDialogTitle className=\"text-xl font-medium\">{title || 'An error occurred'}</AlertDialogTitle>\n </div>\n </AlertDialogHeader>\n {children}\n <AlertDialogFooter>\n <AlertDialogAction className=\"w-full sm:w-28\" onClick={handleClose}>\n Close\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n )\n}\n"],"mappings":"oSAWA,MAAaA,GAAyD,CAAE,OAAM,QAAO,WAAU,kBAAmB,CAChH,IAAM,EAAc,EAAM,gBAAkB,CAC1C,IAAe,KACd,CAAC,IACJ,OACE,EAAC,EAAA,CAAkB,OAAoB,wBACrC,EAAC,EAAA,CAAmB,UAAU,kCAC5B,EAAC,EAAA,CAAA,SACC,EAAC,MAAA,CAAI,UAAU,wDACb,EAAC,EAAA,CAAkB,KAAM,KACzB,EAAC,EAAA,CAAiB,UAAU,+BAAuB,GAAS,2BAG/D,EACD,EAAC,EAAA,CAAA,SACC,EAAC,EAAA,CAAkB,UAAU,iBAAiB,QAAS,WAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./alert-dialog-Dp-m0Xsj.cjs`),n=e.__toESM(require(`react`)),r=e.__toESM(require(`react/jsx-runtime`)),i=e.__toESM(require(`lucide-react`)),a=({open:e,title:a,children:o,onOpenChange:s})=>{let c=n.default.useCallback(()=>{s?.(!1)},[s]);return(0,r.jsx)(t.AlertDialog,{open:e,onOpenChange:s,children:(0,r.jsxs)(t.AlertDialogContent,{className:`gap-8 p-4 sm:max-w-md`,children:[(0,r.jsx)(t.AlertDialogHeader,{children:(0,r.jsxs)(`div`,{className:`text-destructive flex flex-col items-center`,children:[(0,r.jsx)(i.AlertTriangleIcon,{size:42}),(0,r.jsx)(t.AlertDialogTitle,{className:`text-xl font-medium`,children:a||`An error occurred`})]})}),o,(0,r.jsx)(t.AlertDialogFooter,{children:(0,r.jsx)(t.AlertDialogAction,{className:`w-28`,onClick:c,children
|
|
2
|
-
//# sourceMappingURL=error-dialog-
|
|
1
|
+
const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./alert-dialog-Dp-m0Xsj.cjs`),n=e.__toESM(require(`react`)),r=e.__toESM(require(`react/jsx-runtime`)),i=e.__toESM(require(`lucide-react`)),a=({open:e,title:a,children:o,onOpenChange:s})=>{let c=n.default.useCallback(()=>{s?.(!1)},[s]);return(0,r.jsx)(t.AlertDialog,{open:e,onOpenChange:s,children:(0,r.jsxs)(t.AlertDialogContent,{className:`gap-8 p-4 sm:max-w-md`,children:[(0,r.jsx)(t.AlertDialogHeader,{children:(0,r.jsxs)(`div`,{className:`text-destructive flex flex-col items-center`,children:[(0,r.jsx)(i.AlertTriangleIcon,{size:42}),(0,r.jsx)(t.AlertDialogTitle,{className:`text-xl font-medium`,children:a||`An error occurred`})]})}),o,(0,r.jsx)(t.AlertDialogFooter,{children:(0,r.jsx)(t.AlertDialogAction,{className:`w-full sm:w-28`,onClick:c,children:`Close`})})]})})};Object.defineProperty(exports,`ErrorDialog`,{enumerable:!0,get:function(){return a}});
|
|
2
|
+
//# sourceMappingURL=error-dialog-D7FS_tBU.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-dialog-
|
|
1
|
+
{"version":3,"file":"error-dialog-D7FS_tBU.cjs","names":["ErrorDialog: React.FC<React.PropsWithChildren<Props>>","React","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertTriangleIcon","AlertDialogTitle","AlertDialogFooter","AlertDialogAction"],"sources":["../packages/components/dialogs/error-dialog.tsx"],"sourcesContent":["import React from 'react'\nimport { AlertTriangleIcon } from 'lucide-react'\n\nimport { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '../ui/alert-dialog'\n\ntype Props = {\n open?: boolean\n title?: string\n description?: string\n onOpenChange?: (open: boolean) => void\n}\nexport const ErrorDialog: React.FC<React.PropsWithChildren<Props>> = ({ open, title, children, onOpenChange }) => {\n const handleClose = React.useCallback(() => {\n onOpenChange?.(false)\n }, [onOpenChange])\n return (\n <AlertDialog open={open} onOpenChange={onOpenChange}>\n <AlertDialogContent className=\"gap-8 p-4 sm:max-w-md\">\n <AlertDialogHeader>\n <div className=\"text-destructive flex flex-col items-center\">\n <AlertTriangleIcon size={42} />\n <AlertDialogTitle className=\"text-xl font-medium\">{title || 'An error occurred'}</AlertDialogTitle>\n </div>\n </AlertDialogHeader>\n {children}\n <AlertDialogFooter>\n <AlertDialogAction className=\"w-full sm:w-28\" onClick={handleClose}>\n Close\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n )\n}\n"],"mappings":"8LAWaA,GAAyD,CAAE,OAAM,QAAO,WAAU,kBAAmB,CAChH,IAAM,EAAcC,EAAAA,QAAM,gBAAkB,CAC1C,IAAe,KACd,CAAC,IACJ,OACE,EAAA,EAAA,KAACC,EAAAA,YAAAA,CAAkB,OAAoB,yBACrC,EAAA,EAAA,MAACC,EAAAA,mBAAAA,CAAmB,UAAU,mCAC5B,EAAA,EAAA,KAACC,EAAAA,kBAAAA,CAAAA,UACC,EAAA,EAAA,MAAC,MAAA,CAAI,UAAU,yDACb,EAAA,EAAA,KAACC,EAAAA,kBAAAA,CAAkB,KAAM,MACzB,EAAA,EAAA,KAACC,EAAAA,iBAAAA,CAAiB,UAAU,+BAAuB,GAAS,2BAG/D,GACD,EAAA,EAAA,KAACC,EAAAA,kBAAAA,CAAAA,UACC,EAAA,EAAA,KAACC,EAAAA,kBAAAA,CAAkB,UAAU,iBAAiB,QAAS,WAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./error-dialog-
|
|
2
|
-
//# sourceMappingURL=form-wrapper-
|
|
1
|
+
const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./error-dialog-D7FS_tBU.cjs`),n=require(`./form-CU-tlomS.cjs`),r=e.__toESM(require(`react`)),i=e.__toESM(require(`react/jsx-runtime`)),a=e.__toESM(require(`lucide-react`)),o=e.__toESM(require(`react-hook-form`)),s=e.__toESM(require(`@hookform/error-message`)),c=({form:e,isResetAfterSubmit:c=!0,className:l,onSubmit:u,onError:d,onSubcribe:f,children:p})=>{let m=(0,o.useForm)({...e,criteriaMode:`all`}),{formState:h,reset:g,handleSubmit:_,subscribe:v}=m,{dirtyFields:y}=h,[b,x]=r.default.useState(!1),S=r.default.useCallback(e=>{u(e,h,y),c&&g()},[y,h,c,u,g]),C=r.default.useCallback(e=>{let t=Object.keys(e);t.length!==0&&(d?.(e),x(!0))},[d]);return r.default.useEffect(()=>{if(!f)return;let e=v({formState:{values:!0},callback:({values:e})=>{f(e)}});return()=>e()},[f,v]),(0,i.jsxs)(n.Form,{...m,children:[(0,i.jsx)(`form`,{className:l,onSubmit:_(S,C),children:p}),(0,i.jsx)(t.ErrorDialog,{open:b,title:`Lỗi nhập dữ liệu`,description:`An unexpected error has occurred. Please check the errors below and try again.`,onOpenChange:x,children:b&&(0,i.jsx)(i.Fragment,{children:Object.keys(h.errors).length>0?(0,i.jsxs)(`div`,{className:`flex max-w-100 flex-col gap-2 px-4`,children:[(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm font-semibold`,children:`Cảnh báo: Vui lòng kiểm tra các lỗi sau:`}),(0,i.jsx)(`div`,{className:`flex flex-col space-y-1`,children:Object.entries(h.errors).map(([e])=>(0,i.jsx)(s.ErrorMessage,{errors:h.errors,name:e,render:({messages:e})=>(0,i.jsx)(i.Fragment,{children:e?Object.entries(e).map(([e,t])=>(0,i.jsxs)(`div`,{className:`text-accent-foreground flex items-start gap-x-1 truncate text-sm font-normal`,children:[(0,i.jsx)(a.AlertCircleIcon,{size:16,className:`text-destructive mt-0.5 min-w-4 flex-0`}),(0,i.jsx)(`p`,{className:`line-clamp-2 flex-1 text-wrap`,children:t})]},e)):null})},e))})]}):(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No errors found.`})})})]})};Object.defineProperty(exports,`FormWrapper`,{enumerable:!0,get:function(){return c}});
|
|
2
|
+
//# sourceMappingURL=form-wrapper-CVkfJN7q.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-wrapper-
|
|
1
|
+
{"version":3,"file":"form-wrapper-CVkfJN7q.cjs","names":["React","Form","ErrorDialog","ErrorMessage","AlertCircleIcon"],"sources":["../packages/components/forms/form-wrapper.tsx"],"sourcesContent":["import React from 'react'\nimport { type FieldValues, type FormState, type SubmitErrorHandler, type SubmitHandler, useForm, type UseFormProps } from 'react-hook-form'\nimport { AlertCircleIcon } from 'lucide-react'\n\nimport type { AnyEntity } from '@/types'\nimport { ErrorMessage } from '@hookform/error-message'\n\nimport { ErrorDialog } from '../dialogs/error-dialog'\nimport { Form } from '../ui/form'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n form: UseFormProps<TFieldValues>\n isResetAfterSubmit?: boolean\n className?: string\n onSubmit: (data: TFieldValues, formState: FormState<FieldValues>, dirtyFields: FormState<FieldValues>['dirtyFields']) => void | Promise<void>\n onError?: SubmitErrorHandler<TFieldValues>\n onSubcribe?: (values: TFieldValues) => void\n}\n\nexport const FormWrapper = <TFieldValues extends FieldValues = FieldValues>({\n form: FormConfig,\n isResetAfterSubmit = true,\n className,\n onSubmit,\n onError,\n onSubcribe,\n children,\n}: React.PropsWithChildren<Props<TFieldValues>>) => {\n const form = useForm({\n ...FormConfig,\n criteriaMode: 'all',\n })\n\n const { formState, reset, handleSubmit, subscribe } = form\n const { dirtyFields } = formState\n\n const [errorOpen, setErrorOpen] = React.useState<boolean>(false)\n\n const handleFormSubmit = React.useCallback<SubmitHandler<TFieldValues>>(\n (data) => {\n onSubmit(data, formState, dirtyFields)\n if (isResetAfterSubmit) {\n reset()\n }\n },\n [dirtyFields, formState, isResetAfterSubmit, onSubmit, reset],\n )\n\n const handleFormError = React.useCallback<SubmitErrorHandler<TFieldValues>>(\n (errors) => {\n const errorKeys = Object.keys(errors)\n if (errorKeys.length === 0) return\n onError?.(errors)\n setErrorOpen(true)\n },\n [onError],\n )\n\n React.useEffect(() => {\n if (!onSubcribe) return\n const callback = subscribe({\n formState: { values: true },\n callback: ({ values }) => {\n onSubcribe(values)\n },\n })\n return () => callback()\n }, [onSubcribe, subscribe])\n\n return (\n <Form {...form}>\n <form className={className} onSubmit={handleSubmit(handleFormSubmit, handleFormError)}>\n {children}\n </form>\n <ErrorDialog\n open={errorOpen}\n title=\"Lỗi nhập dữ liệu\"\n description=\"An unexpected error has occurred. Please check the errors below and try again.\"\n onOpenChange={setErrorOpen}\n >\n {errorOpen && (\n <>\n {Object.keys(formState.errors).length > 0 ? (\n <div className=\"flex max-w-100 flex-col gap-2 px-4\">\n <p className=\"text-muted-foreground text-sm font-semibold\">Cảnh báo: Vui lòng kiểm tra các lỗi sau:</p>\n <div className=\"flex flex-col space-y-1\">\n {Object.entries(formState.errors).map(([key]) => (\n <ErrorMessage\n key={key}\n errors={formState.errors}\n name={key as AnyEntity}\n render={({ messages }) => {\n return (\n <>\n {messages\n ? Object.entries(messages).map(([type, message]) => {\n return (\n <div key={type} className=\"text-accent-foreground flex items-start gap-x-1 truncate text-sm font-normal\">\n <AlertCircleIcon size={16} className=\"text-destructive mt-0.5 min-w-4 flex-0\" />\n <p className=\"line-clamp-2 flex-1 text-wrap\">{message}</p>\n </div>\n )\n })\n : null}\n </>\n )\n }}\n />\n ))}\n </div>\n </div>\n ) : (\n <p className=\"text-muted-foreground text-sm\">No errors found.</p>\n )}\n </>\n )}\n </ErrorDialog>\n </Form>\n )\n}\n"],"mappings":"uTAmBa,GAA+D,CAC1E,KAAM,EACN,qBAAqB,GACrB,YACA,WACA,UACA,aACA,cACkD,CAClD,IAAM,GAAA,EAAA,EAAA,SAAe,CACnB,GAAG,EACH,aAAc,QAGV,CAAE,YAAW,QAAO,eAAc,aAAc,EAChD,CAAE,eAAgB,EAElB,CAAC,EAAW,GAAgBA,EAAAA,QAAM,SAAkB,IAEpD,EAAmBA,EAAAA,QAAM,YAC5B,GAAS,CACR,EAAS,EAAM,EAAW,GACtB,GACF,KAGJ,CAAC,EAAa,EAAW,EAAoB,EAAU,IAGnD,EAAkBA,EAAAA,QAAM,YAC3B,GAAW,CACV,IAAM,EAAY,OAAO,KAAK,GAC1B,EAAU,SAAW,IACzB,IAAU,GACV,EAAa,MAEf,CAAC,IAcH,OAXA,EAAA,QAAM,cAAgB,CACpB,GAAI,CAAC,EAAY,OACjB,IAAM,EAAW,EAAU,CACzB,UAAW,CAAE,OAAQ,IACrB,UAAW,CAAE,YAAa,CACxB,EAAW,MAGf,UAAa,KACZ,CAAC,EAAY,KAGd,EAAA,EAAA,MAACC,EAAAA,KAAAA,CAAK,GAAI,aACR,EAAA,EAAA,KAAC,OAAA,CAAgB,YAAW,SAAU,EAAa,EAAkB,GAClE,cAEH,EAAA,EAAA,KAACC,EAAAA,YAAAA,CACC,KAAM,EACN,MAAM,mBACN,YAAY,iFACZ,aAAc,WAEb,IACC,EAAA,EAAA,KAAA,EAAA,SAAA,CAAA,SACG,OAAO,KAAK,EAAU,QAAQ,OAAS,GACtC,EAAA,EAAA,MAAC,MAAA,CAAI,UAAU,gDACb,EAAA,EAAA,KAAC,IAAA,CAAE,UAAU,uDAA8C,8CAC3D,EAAA,EAAA,KAAC,MAAA,CAAI,UAAU,mCACZ,OAAO,QAAQ,EAAU,QAAQ,KAAK,CAAC,MACtC,EAAA,EAAA,KAACC,EAAAA,aAAAA,CAEC,OAAQ,EAAU,OAClB,KAAM,EACN,QAAS,CAAE,eAEP,EAAA,EAAA,KAAA,EAAA,SAAA,CAAA,SACG,EACG,OAAO,QAAQ,GAAU,KAAK,CAAC,EAAM,MAEjC,EAAA,EAAA,MAAC,MAAA,CAAe,UAAU,0FACxB,EAAA,EAAA,KAACC,EAAAA,gBAAAA,CAAgB,KAAM,GAAI,UAAU,4CACrC,EAAA,EAAA,KAAC,IAAA,CAAE,UAAU,yCAAiC,MAFtC,IAMd,QAfL,UAwBb,EAAA,EAAA,KAAC,IAAA,CAAE,UAAU,yCAAgC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ErrorDialog as e}from"./error-dialog-
|
|
2
|
-
//# sourceMappingURL=form-wrapper-
|
|
1
|
+
import{ErrorDialog as e}from"./error-dialog-CTPWuLNO.js";import{Form as t}from"./form-63w5ez51.js";import n from"react";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";import{AlertCircleIcon as o}from"lucide-react";import{useForm as s}from"react-hook-form";import{ErrorMessage as c}from"@hookform/error-message";const l=({form:l,isResetAfterSubmit:u=!0,className:d,onSubmit:f,onError:p,onSubcribe:m,children:h})=>{let g=s({...l,criteriaMode:`all`}),{formState:_,reset:v,handleSubmit:y,subscribe:b}=g,{dirtyFields:x}=_,[S,C]=n.useState(!1),w=n.useCallback(e=>{f(e,_,x),u&&v()},[x,_,u,f,v]),T=n.useCallback(e=>{let t=Object.keys(e);t.length!==0&&(p?.(e),C(!0))},[p]);return n.useEffect(()=>{if(!m)return;let e=b({formState:{values:!0},callback:({values:e})=>{m(e)}});return()=>e()},[m,b]),a(t,{...g,children:[i(`form`,{className:d,onSubmit:y(w,T),children:h}),i(e,{open:S,title:`Lỗi nhập dữ liệu`,description:`An unexpected error has occurred. Please check the errors below and try again.`,onOpenChange:C,children:S&&i(r,{children:Object.keys(_.errors).length>0?a(`div`,{className:`flex max-w-100 flex-col gap-2 px-4`,children:[i(`p`,{className:`text-muted-foreground text-sm font-semibold`,children:`Cảnh báo: Vui lòng kiểm tra các lỗi sau:`}),i(`div`,{className:`flex flex-col space-y-1`,children:Object.entries(_.errors).map(([e])=>i(c,{errors:_.errors,name:e,render:({messages:e})=>i(r,{children:e?Object.entries(e).map(([e,t])=>a(`div`,{className:`text-accent-foreground flex items-start gap-x-1 truncate text-sm font-normal`,children:[i(o,{size:16,className:`text-destructive mt-0.5 min-w-4 flex-0`}),i(`p`,{className:`line-clamp-2 flex-1 text-wrap`,children:t})]},e)):null})},e))})]}):i(`p`,{className:`text-muted-foreground text-sm`,children:`No errors found.`})})})]})};export{l as FormWrapper};
|
|
2
|
+
//# sourceMappingURL=form-wrapper-pnkjBZnM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-wrapper-
|
|
1
|
+
{"version":3,"file":"form-wrapper-pnkjBZnM.js","names":[],"sources":["../packages/components/forms/form-wrapper.tsx"],"sourcesContent":["import React from 'react'\nimport { type FieldValues, type FormState, type SubmitErrorHandler, type SubmitHandler, useForm, type UseFormProps } from 'react-hook-form'\nimport { AlertCircleIcon } from 'lucide-react'\n\nimport type { AnyEntity } from '@/types'\nimport { ErrorMessage } from '@hookform/error-message'\n\nimport { ErrorDialog } from '../dialogs/error-dialog'\nimport { Form } from '../ui/form'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n form: UseFormProps<TFieldValues>\n isResetAfterSubmit?: boolean\n className?: string\n onSubmit: (data: TFieldValues, formState: FormState<FieldValues>, dirtyFields: FormState<FieldValues>['dirtyFields']) => void | Promise<void>\n onError?: SubmitErrorHandler<TFieldValues>\n onSubcribe?: (values: TFieldValues) => void\n}\n\nexport const FormWrapper = <TFieldValues extends FieldValues = FieldValues>({\n form: FormConfig,\n isResetAfterSubmit = true,\n className,\n onSubmit,\n onError,\n onSubcribe,\n children,\n}: React.PropsWithChildren<Props<TFieldValues>>) => {\n const form = useForm({\n ...FormConfig,\n criteriaMode: 'all',\n })\n\n const { formState, reset, handleSubmit, subscribe } = form\n const { dirtyFields } = formState\n\n const [errorOpen, setErrorOpen] = React.useState<boolean>(false)\n\n const handleFormSubmit = React.useCallback<SubmitHandler<TFieldValues>>(\n (data) => {\n onSubmit(data, formState, dirtyFields)\n if (isResetAfterSubmit) {\n reset()\n }\n },\n [dirtyFields, formState, isResetAfterSubmit, onSubmit, reset],\n )\n\n const handleFormError = React.useCallback<SubmitErrorHandler<TFieldValues>>(\n (errors) => {\n const errorKeys = Object.keys(errors)\n if (errorKeys.length === 0) return\n onError?.(errors)\n setErrorOpen(true)\n },\n [onError],\n )\n\n React.useEffect(() => {\n if (!onSubcribe) return\n const callback = subscribe({\n formState: { values: true },\n callback: ({ values }) => {\n onSubcribe(values)\n },\n })\n return () => callback()\n }, [onSubcribe, subscribe])\n\n return (\n <Form {...form}>\n <form className={className} onSubmit={handleSubmit(handleFormSubmit, handleFormError)}>\n {children}\n </form>\n <ErrorDialog\n open={errorOpen}\n title=\"Lỗi nhập dữ liệu\"\n description=\"An unexpected error has occurred. Please check the errors below and try again.\"\n onOpenChange={setErrorOpen}\n >\n {errorOpen && (\n <>\n {Object.keys(formState.errors).length > 0 ? (\n <div className=\"flex max-w-100 flex-col gap-2 px-4\">\n <p className=\"text-muted-foreground text-sm font-semibold\">Cảnh báo: Vui lòng kiểm tra các lỗi sau:</p>\n <div className=\"flex flex-col space-y-1\">\n {Object.entries(formState.errors).map(([key]) => (\n <ErrorMessage\n key={key}\n errors={formState.errors}\n name={key as AnyEntity}\n render={({ messages }) => {\n return (\n <>\n {messages\n ? Object.entries(messages).map(([type, message]) => {\n return (\n <div key={type} className=\"text-accent-foreground flex items-start gap-x-1 truncate text-sm font-normal\">\n <AlertCircleIcon size={16} className=\"text-destructive mt-0.5 min-w-4 flex-0\" />\n <p className=\"line-clamp-2 flex-1 text-wrap\">{message}</p>\n </div>\n )\n })\n : null}\n </>\n )\n }}\n />\n ))}\n </div>\n </div>\n ) : (\n <p className=\"text-muted-foreground text-sm\">No errors found.</p>\n )}\n </>\n )}\n </ErrorDialog>\n </Form>\n )\n}\n"],"mappings":"wUAmBA,MAAa,GAA+D,CAC1E,KAAM,EACN,qBAAqB,GACrB,YACA,WACA,UACA,aACA,cACkD,CAClD,IAAM,EAAO,EAAQ,CACnB,GAAG,EACH,aAAc,QAGV,CAAE,YAAW,QAAO,eAAc,aAAc,EAChD,CAAE,eAAgB,EAElB,CAAC,EAAW,GAAgB,EAAM,SAAkB,IAEpD,EAAmB,EAAM,YAC5B,GAAS,CACR,EAAS,EAAM,EAAW,GACtB,GACF,KAGJ,CAAC,EAAa,EAAW,EAAoB,EAAU,IAGnD,EAAkB,EAAM,YAC3B,GAAW,CACV,IAAM,EAAY,OAAO,KAAK,GAC1B,EAAU,SAAW,IACzB,IAAU,GACV,EAAa,MAEf,CAAC,IAcH,OAXA,EAAM,cAAgB,CACpB,GAAI,CAAC,EAAY,OACjB,IAAM,EAAW,EAAU,CACzB,UAAW,CAAE,OAAQ,IACrB,UAAW,CAAE,YAAa,CACxB,EAAW,MAGf,UAAa,KACZ,CAAC,EAAY,IAGd,EAAC,EAAA,CAAK,GAAI,YACR,EAAC,OAAA,CAAgB,YAAW,SAAU,EAAa,EAAkB,GAClE,aAEH,EAAC,EAAA,CACC,KAAM,EACN,MAAM,mBACN,YAAY,iFACZ,aAAc,WAEb,GACC,EAAA,EAAA,CAAA,SACG,OAAO,KAAK,EAAU,QAAQ,OAAS,EACtC,EAAC,MAAA,CAAI,UAAU,+CACb,EAAC,IAAA,CAAE,UAAU,uDAA8C,6CAC3D,EAAC,MAAA,CAAI,UAAU,mCACZ,OAAO,QAAQ,EAAU,QAAQ,KAAK,CAAC,KACtC,EAAC,EAAA,CAEC,OAAQ,EAAU,OAClB,KAAM,EACN,QAAS,CAAE,cAEP,EAAA,EAAA,CAAA,SACG,EACG,OAAO,QAAQ,GAAU,KAAK,CAAC,EAAM,KAEjC,EAAC,MAAA,CAAe,UAAU,yFACxB,EAAC,EAAA,CAAgB,KAAM,GAAI,UAAU,2CACrC,EAAC,IAAA,CAAE,UAAU,yCAAiC,MAFtC,IAMd,QAfL,SAwBb,EAAC,IAAA,CAAE,UAAU,yCAAgC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime258 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/combobox-field.d.ts
|
|
@@ -22,7 +22,7 @@ declare const ComboboxField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
22
22
|
description,
|
|
23
23
|
options,
|
|
24
24
|
onAddNewItem
|
|
25
|
-
}: Props<TFieldValues>) =>
|
|
25
|
+
}: Props<TFieldValues>) => react_jsx_runtime258.JSX.Element;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { ComboboxField };
|
|
28
28
|
//# sourceMappingURL=combobox-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/combobox-field.d.ts
|
|
@@ -22,7 +22,7 @@ declare const ComboboxField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
22
22
|
description,
|
|
23
23
|
options,
|
|
24
24
|
onAddNewItem
|
|
25
|
-
}: Props<TFieldValues>) =>
|
|
25
|
+
}: Props<TFieldValues>) => react_jsx_runtime12.JSX.Element;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { ComboboxField };
|
|
28
28
|
//# sourceMappingURL=combobox-field.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-CUT6urMc.cjs`),t=require(`../utils-BsjVK5EW.cjs`),n=require(`../button-Cg9ZsZ68.cjs`);require(`../label-B_2ZQn0X.cjs`);const r=require(`../form-CU-tlomS.cjs`),i=require(`../popover-DCcPvdz2.cjs`),a=require(`../calendar-DB7j4ZPb.cjs`),o=e.__toESM(require(`react/jsx-runtime`)),s=e.__toESM(require(`date-fns`)),c=e.__toESM(require(`lucide-react`)),l=({name:e,label:l=`Date Field`,placeholder:u=`Select a date`,description:d=``,isShowErrorMsg:f=!1})=>(0,o.jsx)(r.FormField,{name:e,render:({field:e})=>(0,o.jsxs)(r.FormItem,{className:`w-full`,children:[(0,o.jsx)(r.FormLabel,{children:l}),(0,o.jsxs)(i.Popover,{modal:!0,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsx)(r.FormControl,{children:(0,o.jsxs)(n.Button,{variant:`outline`,className:t.cn(`w-full pl-3 text-left font-normal`,`outline-border-weak font-normal`,`hover:outline-border`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:outline-1`,`data-[state=open]:outline-primary-strong`,`data-[state=open]:ring-primary-weak`,`data-[state=open]:ring-4`,`focus:border-primary-strong`,`focus:ring-4`,`focus:ring-primary-weak`,`focus:outline-1`,`focus:outline-primary-strong`,!e.value&&`text-muted
|
|
1
|
+
"use client";const e=require(`../chunk-CUT6urMc.cjs`),t=require(`../utils-BsjVK5EW.cjs`),n=require(`../button-Cg9ZsZ68.cjs`);require(`../label-B_2ZQn0X.cjs`);const r=require(`../form-CU-tlomS.cjs`),i=require(`../popover-DCcPvdz2.cjs`),a=require(`../calendar-DB7j4ZPb.cjs`),o=e.__toESM(require(`react/jsx-runtime`)),s=e.__toESM(require(`date-fns`)),c=e.__toESM(require(`lucide-react`)),l=({name:e,label:l=`Date Field`,placeholder:u=`Select a date`,description:d=``,isShowErrorMsg:f=!1})=>(0,o.jsx)(r.FormField,{name:e,render:({field:e})=>(0,o.jsxs)(r.FormItem,{className:`w-full`,children:[(0,o.jsx)(r.FormLabel,{children:l}),(0,o.jsxs)(i.Popover,{modal:!0,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsx)(r.FormControl,{children:(0,o.jsxs)(n.Button,{variant:`outline`,color:`muted`,className:t.cn(`w-full pl-3 text-left font-normal`,`outline-border-weak font-normal`,`hover:outline-border`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:outline-1`,`data-[state=open]:outline-primary-strong`,`data-[state=open]:ring-primary-weak`,`data-[state=open]:ring-4`,`focus:border-primary-strong`,`focus:ring-4`,`focus:ring-primary-weak`,`focus:outline-1`,`focus:outline-primary-strong`,!e.value&&`text-text-positive-muted`),children:[e.value?(0,s.format)(e.value,`PPP`):(0,o.jsxs)(`span`,{children:[` `,u||`Pick a date`]}),(0,o.jsx)(c.CalendarIcon,{className:`text-text-positive-weak ml-auto size-4`})]})})}),(0,o.jsx)(i.PopoverContent,{className:`w-auto p-0`,align:`start`,children:(0,o.jsx)(a.Calendar,{mode:`single`,selected:e.value,onSelect:t=>{e.onChange(t?.toISOString())},captionLayout:`dropdown`,disabled:e=>e<new Date(`2022-01-01`)})})]}),!!d&&(0,o.jsx)(r.FormDescription,{children:d}),f&&(0,o.jsx)(r.FormMessage,{})]})});exports.DateField=l;
|
|
2
2
|
//# sourceMappingURL=date-field.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-field.cjs","names":["FormField","FormItem","FormLabel","Popover","PopoverTrigger","FormControl","Button","cn","CalendarIcon","PopoverContent","Calendar","FormDescription","FormMessage"],"sources":["../../packages/components/forms/date-field.tsx"],"sourcesContent":["'use client'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\nimport { format } from 'date-fns'\nimport { CalendarIcon } from 'lucide-react'\n\nimport { cn } from '@/lib/utils'\n\nimport { Button } from '../ui/button'\nimport { Calendar } from '../ui/calendar'\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>\n label?: string\n placeholder?: string\n description?: string\n isShowErrorMsg?: boolean\n modal?: boolean\n}\n\nexport const DateField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Date Field',\n placeholder = 'Select a date',\n description = '',\n isShowErrorMsg = false,\n}: Props<TFieldValues>) => {\n return (\n <FormField\n name={name}\n render={({ field }) => (\n <FormItem className=\"w-full\">\n <FormLabel>{label}</FormLabel>\n <Popover modal>\n <PopoverTrigger asChild>\n <FormControl>\n <Button\n variant=\"outline\"\n className={cn(\n 'w-full pl-3 text-left font-normal',\n 'outline-border-weak font-normal',\n 'hover:outline-border',\n 'data-[state=open]:text-text-positive-muted',\n 'data-[state=open]:outline-1',\n 'data-[state=open]:outline-primary-strong',\n 'data-[state=open]:ring-primary-weak',\n 'data-[state=open]:ring-4',\n 'focus:border-primary-strong',\n 'focus:ring-4',\n 'focus:ring-primary-weak',\n 'focus:outline-1',\n 'focus:outline-primary-strong',\n !field.value && 'text-muted
|
|
1
|
+
{"version":3,"file":"date-field.cjs","names":["FormField","FormItem","FormLabel","Popover","PopoverTrigger","FormControl","Button","cn","CalendarIcon","PopoverContent","Calendar","FormDescription","FormMessage"],"sources":["../../packages/components/forms/date-field.tsx"],"sourcesContent":["'use client'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\nimport { format } from 'date-fns'\nimport { CalendarIcon } from 'lucide-react'\n\nimport { cn } from '@/lib/utils'\n\nimport { Button } from '../ui/button'\nimport { Calendar } from '../ui/calendar'\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>\n label?: string\n placeholder?: string\n description?: string\n isShowErrorMsg?: boolean\n modal?: boolean\n}\n\nexport const DateField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Date Field',\n placeholder = 'Select a date',\n description = '',\n isShowErrorMsg = false,\n}: Props<TFieldValues>) => {\n return (\n <FormField\n name={name}\n render={({ field }) => (\n <FormItem className=\"w-full\">\n <FormLabel>{label}</FormLabel>\n <Popover modal>\n <PopoverTrigger asChild>\n <FormControl>\n <Button\n variant=\"outline\"\n color=\"muted\"\n className={cn(\n 'w-full pl-3 text-left font-normal',\n 'outline-border-weak font-normal',\n 'hover:outline-border',\n 'data-[state=open]:text-text-positive-muted',\n 'data-[state=open]:outline-1',\n 'data-[state=open]:outline-primary-strong',\n 'data-[state=open]:ring-primary-weak',\n 'data-[state=open]:ring-4',\n 'focus:border-primary-strong',\n 'focus:ring-4',\n 'focus:ring-primary-weak',\n 'focus:outline-1',\n 'focus:outline-primary-strong',\n !field.value && 'text-text-positive-muted',\n )}\n >\n {field.value ? format(field.value, 'PPP') : <span> {placeholder || 'Pick a date'}</span>}\n <CalendarIcon className=\"text-text-positive-weak ml-auto size-4\" />\n </Button>\n </FormControl>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <Calendar\n mode=\"single\"\n selected={field.value}\n onSelect={(date) => {\n field.onChange(date?.toISOString())\n }}\n captionLayout=\"dropdown\"\n disabled={(date) => date < new Date('2022-01-01')}\n />\n </PopoverContent>\n </Popover>\n {!!description && <FormDescription>{description}</FormDescription>}\n {isShowErrorMsg && <FormMessage />}\n </FormItem>\n )}\n />\n )\n}\n"],"mappings":"iYAqBa,GAA6D,CACxE,OACA,QAAQ,aACR,cAAc,gBACd,cAAc,GACd,iBAAiB,OAGf,EAAA,EAAA,KAACA,EAAAA,UAAAA,CACO,OACN,QAAS,CAAE,YACT,EAAA,EAAA,MAACC,EAAAA,SAAAA,CAAS,UAAU,oBAClB,EAAA,EAAA,KAACC,EAAAA,UAAAA,CAAAA,SAAW,KACZ,EAAA,EAAA,MAACC,EAAAA,QAAAA,CAAQ,MAAA,cACP,EAAA,EAAA,KAACC,EAAAA,eAAAA,CAAe,QAAA,aACd,EAAA,EAAA,KAACC,EAAAA,YAAAA,CAAAA,UACC,EAAA,EAAA,MAACC,EAAAA,OAAAA,CACC,QAAQ,UACR,MAAM,QACN,UAAWC,EAAAA,GACT,oCACA,kCACA,uBACA,6CACA,8BACA,2CACA,sCACA,2BACA,8BACA,eACA,0BACA,kBACA,+BACA,CAAC,EAAM,OAAS,sCAGjB,EAAM,OAAA,EAAA,EAAA,QAAe,EAAM,MAAO,QAAS,EAAA,EAAA,MAAC,OAAA,CAAA,SAAA,CAAK,IAAE,GAAe,kBACnE,EAAA,EAAA,KAACC,EAAAA,aAAAA,CAAa,UAAU,mDAI9B,EAAA,EAAA,KAACC,EAAAA,eAAAA,CAAe,UAAU,aAAa,MAAM,kBAC3C,EAAA,EAAA,KAACC,EAAAA,SAAAA,CACC,KAAK,SACL,SAAU,EAAM,MAChB,SAAW,GAAS,CAClB,EAAM,SAAS,GAAM,gBAEvB,cAAc,WACd,SAAW,GAAS,EAAO,IAAI,KAAK,qBAIzC,CAAC,CAAC,IAAe,EAAA,EAAA,KAACC,EAAAA,gBAAAA,CAAAA,SAAiB,IACnC,IAAkB,EAAA,EAAA,KAACC,EAAAA,YAAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/date-field.d.ts
|
|
@@ -16,7 +16,7 @@ declare const DateField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
16
16
|
placeholder,
|
|
17
17
|
description,
|
|
18
18
|
isShowErrorMsg
|
|
19
|
-
}: Props<TFieldValues>) =>
|
|
19
|
+
}: Props<TFieldValues>) => react_jsx_runtime1.JSX.Element;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { DateField };
|
|
22
22
|
//# sourceMappingURL=date-field.d.ts.map
|
package/dist/forms/date-field.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{cn as e}from"../utils-D9AH0PUV.js";import{Button as t}from"../button-tXV0dTFU.js";import"../label-D1XmKlc3.js";import{FormControl as n,FormDescription as r,FormField as i,FormItem as a,FormLabel as o,FormMessage as s}from"../form-63w5ez51.js";import{Popover as c,PopoverContent as l,PopoverTrigger as u}from"../popover-CTFp7ZXi.js";import{Calendar as d}from"../calendar-4R0xSc0m.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{format as m}from"date-fns";import{CalendarIcon as h}from"lucide-react";const g=({name:g,label:_=`Date Field`,placeholder:v=`Select a date`,description:y=``,isShowErrorMsg:b=!1})=>f(i,{name:g,render:({field:i})=>p(a,{className:`w-full`,children:[f(o,{children:_}),p(c,{modal:!0,children:[f(u,{asChild:!0,children:f(n,{children:p(t,{variant:`outline`,className:e(`w-full pl-3 text-left font-normal`,`outline-border-weak font-normal`,`hover:outline-border`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:outline-1`,`data-[state=open]:outline-primary-strong`,`data-[state=open]:ring-primary-weak`,`data-[state=open]:ring-4`,`focus:border-primary-strong`,`focus:ring-4`,`focus:ring-primary-weak`,`focus:outline-1`,`focus:outline-primary-strong`,!i.value&&`text-muted
|
|
1
|
+
"use client";import{cn as e}from"../utils-D9AH0PUV.js";import{Button as t}from"../button-tXV0dTFU.js";import"../label-D1XmKlc3.js";import{FormControl as n,FormDescription as r,FormField as i,FormItem as a,FormLabel as o,FormMessage as s}from"../form-63w5ez51.js";import{Popover as c,PopoverContent as l,PopoverTrigger as u}from"../popover-CTFp7ZXi.js";import{Calendar as d}from"../calendar-4R0xSc0m.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{format as m}from"date-fns";import{CalendarIcon as h}from"lucide-react";const g=({name:g,label:_=`Date Field`,placeholder:v=`Select a date`,description:y=``,isShowErrorMsg:b=!1})=>f(i,{name:g,render:({field:i})=>p(a,{className:`w-full`,children:[f(o,{children:_}),p(c,{modal:!0,children:[f(u,{asChild:!0,children:f(n,{children:p(t,{variant:`outline`,color:`muted`,className:e(`w-full pl-3 text-left font-normal`,`outline-border-weak font-normal`,`hover:outline-border`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:outline-1`,`data-[state=open]:outline-primary-strong`,`data-[state=open]:ring-primary-weak`,`data-[state=open]:ring-4`,`focus:border-primary-strong`,`focus:ring-4`,`focus:ring-primary-weak`,`focus:outline-1`,`focus:outline-primary-strong`,!i.value&&`text-text-positive-muted`),children:[i.value?m(i.value,`PPP`):p(`span`,{children:[` `,v||`Pick a date`]}),f(h,{className:`text-text-positive-weak ml-auto size-4`})]})})}),f(l,{className:`w-auto p-0`,align:`start`,children:f(d,{mode:`single`,selected:i.value,onSelect:e=>{i.onChange(e?.toISOString())},captionLayout:`dropdown`,disabled:e=>e<new Date(`2022-01-01`)})})]}),!!y&&f(r,{children:y}),b&&f(s,{})]})});export{g as DateField};
|
|
2
2
|
//# sourceMappingURL=date-field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-field.js","names":[],"sources":["../../packages/components/forms/date-field.tsx"],"sourcesContent":["'use client'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\nimport { format } from 'date-fns'\nimport { CalendarIcon } from 'lucide-react'\n\nimport { cn } from '@/lib/utils'\n\nimport { Button } from '../ui/button'\nimport { Calendar } from '../ui/calendar'\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>\n label?: string\n placeholder?: string\n description?: string\n isShowErrorMsg?: boolean\n modal?: boolean\n}\n\nexport const DateField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Date Field',\n placeholder = 'Select a date',\n description = '',\n isShowErrorMsg = false,\n}: Props<TFieldValues>) => {\n return (\n <FormField\n name={name}\n render={({ field }) => (\n <FormItem className=\"w-full\">\n <FormLabel>{label}</FormLabel>\n <Popover modal>\n <PopoverTrigger asChild>\n <FormControl>\n <Button\n variant=\"outline\"\n className={cn(\n 'w-full pl-3 text-left font-normal',\n 'outline-border-weak font-normal',\n 'hover:outline-border',\n 'data-[state=open]:text-text-positive-muted',\n 'data-[state=open]:outline-1',\n 'data-[state=open]:outline-primary-strong',\n 'data-[state=open]:ring-primary-weak',\n 'data-[state=open]:ring-4',\n 'focus:border-primary-strong',\n 'focus:ring-4',\n 'focus:ring-primary-weak',\n 'focus:outline-1',\n 'focus:outline-primary-strong',\n !field.value && 'text-muted
|
|
1
|
+
{"version":3,"file":"date-field.js","names":[],"sources":["../../packages/components/forms/date-field.tsx"],"sourcesContent":["'use client'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\nimport { format } from 'date-fns'\nimport { CalendarIcon } from 'lucide-react'\n\nimport { cn } from '@/lib/utils'\n\nimport { Button } from '../ui/button'\nimport { Calendar } from '../ui/calendar'\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>\n label?: string\n placeholder?: string\n description?: string\n isShowErrorMsg?: boolean\n modal?: boolean\n}\n\nexport const DateField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Date Field',\n placeholder = 'Select a date',\n description = '',\n isShowErrorMsg = false,\n}: Props<TFieldValues>) => {\n return (\n <FormField\n name={name}\n render={({ field }) => (\n <FormItem className=\"w-full\">\n <FormLabel>{label}</FormLabel>\n <Popover modal>\n <PopoverTrigger asChild>\n <FormControl>\n <Button\n variant=\"outline\"\n color=\"muted\"\n className={cn(\n 'w-full pl-3 text-left font-normal',\n 'outline-border-weak font-normal',\n 'hover:outline-border',\n 'data-[state=open]:text-text-positive-muted',\n 'data-[state=open]:outline-1',\n 'data-[state=open]:outline-primary-strong',\n 'data-[state=open]:ring-primary-weak',\n 'data-[state=open]:ring-4',\n 'focus:border-primary-strong',\n 'focus:ring-4',\n 'focus:ring-primary-weak',\n 'focus:outline-1',\n 'focus:outline-primary-strong',\n !field.value && 'text-text-positive-muted',\n )}\n >\n {field.value ? format(field.value, 'PPP') : <span> {placeholder || 'Pick a date'}</span>}\n <CalendarIcon className=\"text-text-positive-weak ml-auto size-4\" />\n </Button>\n </FormControl>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <Calendar\n mode=\"single\"\n selected={field.value}\n onSelect={(date) => {\n field.onChange(date?.toISOString())\n }}\n captionLayout=\"dropdown\"\n disabled={(date) => date < new Date('2022-01-01')}\n />\n </PopoverContent>\n </Popover>\n {!!description && <FormDescription>{description}</FormDescription>}\n {isShowErrorMsg && <FormMessage />}\n </FormItem>\n )}\n />\n )\n}\n"],"mappings":"mhBAqBA,MAAa,GAA6D,CACxE,OACA,QAAQ,aACR,cAAc,gBACd,cAAc,GACd,iBAAiB,MAGf,EAAC,EAAA,CACO,OACN,QAAS,CAAE,WACT,EAAC,EAAA,CAAS,UAAU,mBAClB,EAAC,EAAA,CAAA,SAAW,IACZ,EAAC,EAAA,CAAQ,MAAA,aACP,EAAC,EAAA,CAAe,QAAA,YACd,EAAC,EAAA,CAAA,SACC,EAAC,EAAA,CACC,QAAQ,UACR,MAAM,QACN,UAAW,EACT,oCACA,kCACA,uBACA,6CACA,8BACA,2CACA,sCACA,2BACA,8BACA,eACA,0BACA,kBACA,+BACA,CAAC,EAAM,OAAS,sCAGjB,EAAM,MAAQ,EAAO,EAAM,MAAO,OAAS,EAAC,OAAA,CAAA,SAAA,CAAK,IAAE,GAAe,iBACnE,EAAC,EAAA,CAAa,UAAU,kDAI9B,EAAC,EAAA,CAAe,UAAU,aAAa,MAAM,iBAC3C,EAAC,EAAA,CACC,KAAK,SACL,SAAU,EAAM,MAChB,SAAW,GAAS,CAClB,EAAM,SAAS,GAAM,gBAEvB,cAAc,WACd,SAAW,GAAS,EAAO,IAAI,KAAK,qBAIzC,CAAC,CAAC,GAAe,EAAC,EAAA,CAAA,SAAiB,IACnC,GAAkB,EAAC,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../utils-BsjVK5EW.cjs`),require(`../button-Cg9ZsZ68.cjs`),require(`../alert-dialog-Dp-m0Xsj.cjs`),require(`../error-dialog-
|
|
1
|
+
require(`../utils-BsjVK5EW.cjs`),require(`../button-Cg9ZsZ68.cjs`),require(`../alert-dialog-Dp-m0Xsj.cjs`),require(`../error-dialog-D7FS_tBU.cjs`),require(`../label-B_2ZQn0X.cjs`),require(`../form-CU-tlomS.cjs`);const e=require(`../form-wrapper-CVkfJN7q.cjs`);exports.FormWrapper=e.FormWrapper;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime23 from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { FieldValues, FormState, SubmitErrorHandler, UseFormProps } from "react-hook-form";
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ declare const FormWrapper: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
19
19
|
onError,
|
|
20
20
|
onSubcribe,
|
|
21
21
|
children
|
|
22
|
-
}: React.PropsWithChildren<Props<TFieldValues>>) =>
|
|
22
|
+
}: React.PropsWithChildren<Props<TFieldValues>>) => react_jsx_runtime23.JSX.Element;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { FormWrapper };
|
|
25
25
|
//# sourceMappingURL=form-wrapper.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime30 from "react/jsx-runtime";
|
|
3
3
|
import { FieldValues, FormState, SubmitErrorHandler, UseFormProps } from "react-hook-form";
|
|
4
4
|
|
|
5
5
|
//#region packages/components/forms/form-wrapper.d.ts
|
|
@@ -19,7 +19,7 @@ declare const FormWrapper: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
19
19
|
onError,
|
|
20
20
|
onSubcribe,
|
|
21
21
|
children
|
|
22
|
-
}: React.PropsWithChildren<Props<TFieldValues>>) =>
|
|
22
|
+
}: React.PropsWithChildren<Props<TFieldValues>>) => react_jsx_runtime30.JSX.Element;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { FormWrapper };
|
|
25
25
|
//# sourceMappingURL=form-wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../utils-D9AH0PUV.js";import"../button-tXV0dTFU.js";import"../alert-dialog-Cj5WqA7x.js";import"../error-dialog-
|
|
1
|
+
import"../utils-D9AH0PUV.js";import"../button-tXV0dTFU.js";import"../alert-dialog-Cj5WqA7x.js";import"../error-dialog-CTPWuLNO.js";import"../label-D1XmKlc3.js";import"../form-63w5ez51.js";import{FormWrapper as e}from"../form-wrapper-pnkjBZnM.js";export{e as FormWrapper};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/multi-select-field.d.ts
|
|
@@ -24,7 +24,7 @@ declare const MultiSelectField: <TFieldValues extends FieldValues = FieldValues>
|
|
|
24
24
|
description,
|
|
25
25
|
options,
|
|
26
26
|
onAdd
|
|
27
|
-
}: Props<TFieldValues>) =>
|
|
27
|
+
}: Props<TFieldValues>) => react_jsx_runtime6.JSX.Element;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { MultiSelectField };
|
|
30
30
|
//# sourceMappingURL=multi-select-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/multi-select-field.d.ts
|
|
@@ -24,7 +24,7 @@ declare const MultiSelectField: <TFieldValues extends FieldValues = FieldValues>
|
|
|
24
24
|
description,
|
|
25
25
|
options,
|
|
26
26
|
onAdd
|
|
27
|
-
}: Props<TFieldValues>) =>
|
|
27
|
+
}: Props<TFieldValues>) => react_jsx_runtime3.JSX.Element;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { MultiSelectField };
|
|
30
30
|
//# sourceMappingURL=multi-select-field.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/number-field.d.ts
|
|
@@ -22,7 +22,7 @@ declare const NumberField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
22
22
|
unitText,
|
|
23
23
|
description,
|
|
24
24
|
onValueChange
|
|
25
|
-
}: Props<TFieldValues>) =>
|
|
25
|
+
}: Props<TFieldValues>) => react_jsx_runtime22.JSX.Element;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { NumberField };
|
|
28
28
|
//# sourceMappingURL=number-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/number-field.d.ts
|
|
@@ -22,7 +22,7 @@ declare const NumberField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
22
22
|
unitText,
|
|
23
23
|
description,
|
|
24
24
|
onValueChange
|
|
25
|
-
}: Props<TFieldValues>) =>
|
|
25
|
+
}: Props<TFieldValues>) => react_jsx_runtime4.JSX.Element;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { NumberField };
|
|
28
28
|
//# sourceMappingURL=number-field.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime65 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/password-field.d.ts
|
|
@@ -17,7 +17,7 @@ declare const PasswordField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
17
17
|
isShowErrorMsg,
|
|
18
18
|
description,
|
|
19
19
|
onValueChange
|
|
20
|
-
}: Props<TFieldValues>) =>
|
|
20
|
+
}: Props<TFieldValues>) => react_jsx_runtime65.JSX.Element;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { PasswordField };
|
|
23
23
|
//# sourceMappingURL=password-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/password-field.d.ts
|
|
@@ -17,7 +17,7 @@ declare const PasswordField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
17
17
|
isShowErrorMsg,
|
|
18
18
|
description,
|
|
19
19
|
onValueChange
|
|
20
|
-
}: Props<TFieldValues>) =>
|
|
20
|
+
}: Props<TFieldValues>) => react_jsx_runtime6.JSX.Element;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { PasswordField };
|
|
23
23
|
//# sourceMappingURL=password-field.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/select-field.d.ts
|
|
@@ -27,7 +27,7 @@ declare const SelectField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
27
27
|
isShowErrorMsg,
|
|
28
28
|
description,
|
|
29
29
|
className
|
|
30
|
-
}: Props<TFieldValues>) =>
|
|
30
|
+
}: Props<TFieldValues>) => react_jsx_runtime5.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SelectField };
|
|
33
33
|
//# sourceMappingURL=select-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/select-field.d.ts
|
|
@@ -27,7 +27,7 @@ declare const SelectField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
27
27
|
isShowErrorMsg,
|
|
28
28
|
description,
|
|
29
29
|
className
|
|
30
|
-
}: Props<TFieldValues>) =>
|
|
30
|
+
}: Props<TFieldValues>) => react_jsx_runtime2.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SelectField };
|
|
33
33
|
//# sourceMappingURL=select-field.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime84 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/switch-field.d.ts
|
|
@@ -13,7 +13,7 @@ declare const SwitchField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
13
13
|
label,
|
|
14
14
|
description,
|
|
15
15
|
isShowErrorMsg
|
|
16
|
-
}: Props<TFieldValues>) =>
|
|
16
|
+
}: Props<TFieldValues>) => react_jsx_runtime84.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { SwitchField };
|
|
19
19
|
//# sourceMappingURL=switch-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/switch-field.d.ts
|
|
@@ -13,7 +13,7 @@ declare const SwitchField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
13
13
|
label,
|
|
14
14
|
description,
|
|
15
15
|
isShowErrorMsg
|
|
16
|
-
}: Props<TFieldValues>) =>
|
|
16
|
+
}: Props<TFieldValues>) => react_jsx_runtime9.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { SwitchField };
|
|
19
19
|
//# sourceMappingURL=switch-field.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/text-field.d.ts
|
|
@@ -25,7 +25,7 @@ declare const TextField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
25
25
|
description,
|
|
26
26
|
className,
|
|
27
27
|
onValueChange
|
|
28
|
-
}: Props<TFieldValues>) =>
|
|
28
|
+
}: Props<TFieldValues>) => react_jsx_runtime11.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { TextField };
|
|
31
31
|
//# sourceMappingURL=text-field.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../utils-BsjVK5EW.cjs`),require(`../label-B_2ZQn0X.cjs`);const t=require(`../form-CU-tlomS.cjs`),n=require(`../textarea-
|
|
1
|
+
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../utils-BsjVK5EW.cjs`),require(`../label-B_2ZQn0X.cjs`);const t=require(`../form-CU-tlomS.cjs`),n=require(`../textarea-Y4wAXFGr.cjs`),r=e.__toESM(require(`react/jsx-runtime`)),i=e.__toESM(require(`react-hook-form`)),a=({name:e,label:a=`Textarea Field`,placeholder:o=`Enter text here`,isShowErrorMsg:s=!1,isShowCount:c=!1,description:l,rows:u=3,onValueChange:d})=>{let f=(0,i.useWatch)({name:e});return(0,r.jsx)(t.FormField,{name:e,render:({field:e})=>(0,r.jsxs)(t.FormItem,{className:`w-full`,children:[(0,r.jsx)(t.FormLabel,{children:a}),(0,r.jsx)(t.FormControl,{children:(0,r.jsx)(n.Textarea,{...e,placeholder:o,className:`w-full`,rows:u,onValueChange:d})}),c&&(0,r.jsxs)(`div`,{className:`text-muted-foreground text-end text-xs`,children:[f?.length??0,` characters`]}),!!l&&(0,r.jsx)(t.FormDescription,{children:l}),s&&(0,r.jsx)(t.FormMessage,{})]})})};exports.TextareaField=a;
|
|
2
2
|
//# sourceMappingURL=textarea-field.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime21 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/textarea-field.d.ts
|
|
@@ -21,7 +21,7 @@ declare const TextareaField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
21
21
|
description,
|
|
22
22
|
rows,
|
|
23
23
|
onValueChange
|
|
24
|
-
}: Props<TFieldValues>) =>
|
|
24
|
+
}: Props<TFieldValues>) => react_jsx_runtime21.JSX.Element;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { TextareaField };
|
|
27
27
|
//# sourceMappingURL=textarea-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/textarea-field.d.ts
|
|
@@ -21,7 +21,7 @@ declare const TextareaField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
21
21
|
description,
|
|
22
22
|
rows,
|
|
23
23
|
onValueChange
|
|
24
|
-
}: Props<TFieldValues>) =>
|
|
24
|
+
}: Props<TFieldValues>) => react_jsx_runtime13.JSX.Element;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { TextareaField };
|
|
27
27
|
//# sourceMappingURL=textarea-field.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import"../utils-D9AH0PUV.js";import"../label-D1XmKlc3.js";import{FormControl as e,FormDescription as t,FormField as n,FormItem as r,FormLabel as i,FormMessage as a}from"../form-63w5ez51.js";import{Textarea as o}from"../textarea-
|
|
1
|
+
"use client";import"../utils-D9AH0PUV.js";import"../label-D1XmKlc3.js";import{FormControl as e,FormDescription as t,FormField as n,FormItem as r,FormLabel as i,FormMessage as a}from"../form-63w5ez51.js";import{Textarea as o}from"../textarea-BK2brgwY.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{useWatch as l}from"react-hook-form";const u=({name:u,label:d=`Textarea Field`,placeholder:f=`Enter text here`,isShowErrorMsg:p=!1,isShowCount:m=!1,description:h,rows:g=3,onValueChange:_})=>{let v=l({name:u});return s(n,{name:u,render:({field:n})=>c(r,{className:`w-full`,children:[s(i,{children:d}),s(e,{children:s(o,{...n,placeholder:f,className:`w-full`,rows:g,onValueChange:_})}),m&&c(`div`,{className:`text-muted-foreground text-end text-xs`,children:[v?.length??0,` characters`]}),!!h&&s(t,{children:h}),p&&s(a,{})]})})};export{u as TextareaField};
|
|
2
2
|
//# sourceMappingURL=textarea-field.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as react_jsx_runtime96 from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import * as react_jsx_runtime103 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/ui/input.d.ts
|
|
5
5
|
declare function Input({
|
|
@@ -9,7 +9,7 @@ declare function Input({
|
|
|
9
9
|
...props
|
|
10
10
|
}: React.ComponentProps<'input'> & {
|
|
11
11
|
onValueChange?: (value: string) => void;
|
|
12
|
-
}):
|
|
12
|
+
}): react_jsx_runtime96.JSX.Element;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { Input };
|
|
15
|
-
//# sourceMappingURL=input-
|
|
15
|
+
//# sourceMappingURL=input-Cng3uFxw.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as react_jsx_runtime103 from "react/jsx-runtime";
|
|
2
1
|
import React from "react";
|
|
2
|
+
import * as react_jsx_runtime116 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/ui/input.d.ts
|
|
5
5
|
declare function Input({
|
|
@@ -9,7 +9,7 @@ declare function Input({
|
|
|
9
9
|
...props
|
|
10
10
|
}: React.ComponentProps<'input'> & {
|
|
11
11
|
onValueChange?: (value: string) => void;
|
|
12
|
-
}):
|
|
12
|
+
}): react_jsx_runtime116.JSX.Element;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { Input };
|
|
15
|
-
//# sourceMappingURL=input-
|
|
15
|
+
//# sourceMappingURL=input-DfaMHsQo.d.ts.map
|