@customafk/lunas-ui 0.0.94 → 0.0.95

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.
Files changed (233) hide show
  1. package/dist/{button-B9iPyKOi.d.ts → button-BJr39-E1.d.ts} +6 -6
  2. package/dist/{button-BB-QJmwU.d.cts → button-CkwiAMe_.d.cts} +6 -6
  3. package/dist/cards/simple-card.d.cts +2 -2
  4. package/dist/cards/simple-card.d.ts +2 -2
  5. package/dist/{command-z65cWxWY.d.ts → command-CsybdMF0.d.ts} +12 -12
  6. package/dist/{command-LElmBduI.d.cts → command-DMBJSFJb.d.cts} +12 -12
  7. package/dist/data-display/empty.d.cts +2 -2
  8. package/dist/data-display/empty.d.ts +2 -2
  9. package/dist/data-display/statistic.d.cts +2 -2
  10. package/dist/data-display/statistic.d.ts +2 -2
  11. package/dist/{dialog-DB0bDoxX.d.cts → dialog-C8Scjvgn.d.ts} +12 -12
  12. package/dist/{dialog-BFte9fya.d.ts → dialog-mmKN6bMZ.d.cts} +12 -12
  13. package/dist/dialogs/detail-dialog/component/sidebar.d.cts +28 -28
  14. package/dist/dialogs/detail-dialog/component/sidebar.d.ts +28 -28
  15. package/dist/dialogs/form-dialog.cjs +1 -1
  16. package/dist/dialogs/form-dialog.d.cts +2 -2
  17. package/dist/dialogs/form-dialog.d.ts +2 -2
  18. package/dist/dialogs/form-dialog.js +1 -1
  19. package/dist/field-DWOm17T1.cjs +2 -0
  20. package/dist/field-DWOm17T1.cjs.map +1 -0
  21. package/dist/field-GVRRZiSk.js +2 -0
  22. package/dist/field-GVRRZiSk.js.map +1 -0
  23. package/dist/{form-B_tL9lO4.js → form-De64-oXe.js} +2 -2
  24. package/dist/{form-B_tL9lO4.js.map → form-De64-oXe.js.map} +1 -1
  25. package/dist/{form-DV9tQbiO.cjs → form-rN5ezSn5.cjs} +2 -2
  26. package/dist/{form-DV9tQbiO.cjs.map → form-rN5ezSn5.cjs.map} +1 -1
  27. package/dist/{form-wrapper-CXrhlLBL.cjs → form-wrapper-A1DZnRIF.cjs} +2 -2
  28. package/dist/{form-wrapper-CXrhlLBL.cjs.map → form-wrapper-A1DZnRIF.cjs.map} +1 -1
  29. package/dist/{form-wrapper-Cw_ARA0-.js → form-wrapper-CSmgFsG0.js} +2 -2
  30. package/dist/{form-wrapper-Cw_ARA0-.js.map → form-wrapper-CSmgFsG0.js.map} +1 -1
  31. package/dist/forms/combobox-field.cjs +1 -1
  32. package/dist/forms/combobox-field.cjs.map +1 -1
  33. package/dist/forms/combobox-field.d.cts +2 -2
  34. package/dist/forms/combobox-field.d.ts +2 -2
  35. package/dist/forms/combobox-field.js +1 -1
  36. package/dist/forms/combobox-field.js.map +1 -1
  37. package/dist/forms/date-field.cjs +1 -1
  38. package/dist/forms/date-field.d.ts +2 -2
  39. package/dist/forms/date-field.js +1 -1
  40. package/dist/forms/form-wrapper.cjs +1 -1
  41. package/dist/forms/form-wrapper.d.cts +2 -2
  42. package/dist/forms/form-wrapper.js +1 -1
  43. package/dist/forms/multi-select-field.cjs +1 -1
  44. package/dist/forms/multi-select-field.cjs.map +1 -1
  45. package/dist/forms/multi-select-field.d.cts +2 -2
  46. package/dist/forms/multi-select-field.d.ts +2 -2
  47. package/dist/forms/multi-select-field.js +1 -1
  48. package/dist/forms/multi-select-field.js.map +1 -1
  49. package/dist/forms/number-field.cjs +1 -1
  50. package/dist/forms/number-field.cjs.map +1 -1
  51. package/dist/forms/number-field.d.cts +2 -2
  52. package/dist/forms/number-field.d.ts +2 -2
  53. package/dist/forms/number-field.js +1 -1
  54. package/dist/forms/number-field.js.map +1 -1
  55. package/dist/forms/password-field.cjs +1 -1
  56. package/dist/forms/password-field.d.cts +2 -2
  57. package/dist/forms/password-field.d.ts +2 -2
  58. package/dist/forms/password-field.js +1 -1
  59. package/dist/forms/select-field.cjs +1 -1
  60. package/dist/forms/select-field.cjs.map +1 -1
  61. package/dist/forms/select-field.d.cts +2 -2
  62. package/dist/forms/select-field.d.ts +2 -2
  63. package/dist/forms/select-field.js +1 -1
  64. package/dist/forms/select-field.js.map +1 -1
  65. package/dist/forms/switch-field.cjs +1 -1
  66. package/dist/forms/switch-field.cjs.map +1 -1
  67. package/dist/forms/switch-field.d.cts +2 -2
  68. package/dist/forms/switch-field.d.ts +2 -2
  69. package/dist/forms/switch-field.js +1 -1
  70. package/dist/forms/switch-field.js.map +1 -1
  71. package/dist/forms/text-field.cjs +1 -1
  72. package/dist/forms/text-field.cjs.map +1 -1
  73. package/dist/forms/text-field.d.cts +2 -2
  74. package/dist/forms/text-field.d.ts +2 -2
  75. package/dist/forms/text-field.js +1 -1
  76. package/dist/forms/text-field.js.map +1 -1
  77. package/dist/forms/textarea-field.cjs +1 -1
  78. package/dist/forms/textarea-field.cjs.map +1 -1
  79. package/dist/forms/textarea-field.d.cts +2 -2
  80. package/dist/forms/textarea-field.d.ts +2 -2
  81. package/dist/forms/textarea-field.js +1 -1
  82. package/dist/forms/textarea-field.js.map +1 -1
  83. package/dist/{input-qIwUgqQ9.d.cts → input-C5NrcQAm.d.cts} +3 -3
  84. package/dist/{input-6c2vBe4o.d.ts → input-CD0idRrj.d.ts} +3 -3
  85. package/dist/label-F0vlSMj2.d.ts +11 -0
  86. package/dist/layouts/app-layout/index.d.cts +28 -28
  87. package/dist/layouts/app-layout/index.d.ts +5 -5
  88. package/dist/layouts/flex.d.cts +2 -2
  89. package/dist/layouts/flex.d.ts +2 -2
  90. package/dist/layouts/service-layout/index.d.cts +15 -15
  91. package/dist/layouts/service-layout/index.d.ts +5 -5
  92. package/dist/pages/FeatureDeveloping.d.cts +2 -2
  93. package/dist/pages/FeatureDeveloping.d.ts +2 -2
  94. package/dist/pages/FeatureFixing.d.cts +2 -2
  95. package/dist/pages/FeatureFixing.d.ts +2 -2
  96. package/dist/pages/NotAuthorized.d.cts +2 -2
  97. package/dist/pages/NotAuthorized.d.ts +2 -2
  98. package/dist/pages/NotFound.d.cts +2 -2
  99. package/dist/pages/NotFound.d.ts +2 -2
  100. package/dist/products/product-quantity-control.d.cts +2 -2
  101. package/dist/products/product-quantity-control.d.ts +2 -2
  102. package/dist/select-B_7jKZ71.js +2 -0
  103. package/dist/select-B_7jKZ71.js.map +1 -0
  104. package/dist/select-Cf4NpYjl.cjs +2 -0
  105. package/dist/select-Cf4NpYjl.cjs.map +1 -0
  106. package/dist/{separator-Dpd6twVS.d.ts → separator-B4drkRIA.d.ts} +3 -3
  107. package/dist/{separator-BvLD0phP.d.cts → separator-D_c8h0Aq.d.cts} +3 -3
  108. package/dist/table/index.d.cts +2 -2
  109. package/dist/table/index.d.ts +2 -2
  110. package/dist/{toggle-BemciJ_z.d.ts → toggle-53uTUqXx.d.ts} +3 -3
  111. package/dist/{toggle-BNK8aaFZ.d.cts → toggle-CMYTXtd1.d.cts} +5 -5
  112. package/dist/{tooltip-BX0WfPh7.d.ts → tooltip-DTDkf-An.d.ts} +6 -6
  113. package/dist/{tooltip-BDBvb_De.d.cts → tooltip-_5h9HHwj.d.cts} +6 -6
  114. package/dist/typography/paragraph.d.cts +2 -2
  115. package/dist/typography/paragraph.d.ts +2 -2
  116. package/dist/typography/title.d.cts +2 -2
  117. package/dist/typography/title.d.ts +2 -2
  118. package/dist/ui/alert-dialog.d.cts +12 -12
  119. package/dist/ui/alert-dialog.d.ts +12 -12
  120. package/dist/ui/alert.d.cts +7 -7
  121. package/dist/ui/alert.d.ts +7 -7
  122. package/dist/ui/aspect-ratio.d.cts +2 -2
  123. package/dist/ui/aspect-ratio.d.ts +2 -2
  124. package/dist/ui/avatar.d.cts +4 -4
  125. package/dist/ui/avatar.d.ts +4 -4
  126. package/dist/ui/badge.d.cts +4 -4
  127. package/dist/ui/badge.d.ts +4 -4
  128. package/dist/ui/breadcrumb.d.cts +8 -8
  129. package/dist/ui/breadcrumb.d.ts +8 -8
  130. package/dist/ui/button-group.d.cts +8 -8
  131. package/dist/ui/button-group.d.ts +8 -8
  132. package/dist/ui/button.d.cts +1 -1
  133. package/dist/ui/button.d.ts +1 -1
  134. package/dist/ui/calendar.d.cts +4 -4
  135. package/dist/ui/calendar.d.ts +4 -4
  136. package/dist/ui/card.d.cts +8 -8
  137. package/dist/ui/card.d.ts +8 -8
  138. package/dist/ui/carousel.d.cts +7 -7
  139. package/dist/ui/carousel.d.ts +7 -7
  140. package/dist/ui/collapsible.d.cts +4 -4
  141. package/dist/ui/collapsible.d.ts +4 -4
  142. package/dist/ui/command.d.cts +2 -2
  143. package/dist/ui/command.d.ts +2 -2
  144. package/dist/ui/context-menu.d.cts +16 -16
  145. package/dist/ui/context-menu.d.ts +16 -16
  146. package/dist/ui/dialog.d.cts +1 -1
  147. package/dist/ui/dialog.d.ts +1 -1
  148. package/dist/ui/drawer.d.cts +11 -11
  149. package/dist/ui/drawer.d.ts +11 -11
  150. package/dist/ui/dropdown-menu.d.cts +16 -16
  151. package/dist/ui/dropdown-menu.d.ts +16 -16
  152. package/dist/ui/empty.d.cts +7 -7
  153. package/dist/ui/empty.d.ts +7 -7
  154. package/dist/ui/field.cjs +1 -1
  155. package/dist/ui/field.d.cts +14 -14
  156. package/dist/ui/field.d.ts +13 -13
  157. package/dist/ui/field.js +1 -1
  158. package/dist/ui/file-uploader.d.cts +2 -2
  159. package/dist/ui/file-uploader.d.ts +2 -2
  160. package/dist/ui/form.cjs +1 -1
  161. package/dist/ui/form.d.cts +7 -7
  162. package/dist/ui/form.d.ts +7 -7
  163. package/dist/ui/form.js +1 -1
  164. package/dist/ui/hover-card.d.cts +4 -4
  165. package/dist/ui/hover-card.d.ts +4 -4
  166. package/dist/ui/input-otp.d.cts +5 -5
  167. package/dist/ui/input-otp.d.ts +5 -5
  168. package/dist/ui/input.d.cts +1 -1
  169. package/dist/ui/input.d.ts +1 -1
  170. package/dist/ui/inputs/search-input.d.cts +3 -3
  171. package/dist/ui/inputs/search-input.d.ts +3 -3
  172. package/dist/ui/item.d.cts +12 -12
  173. package/dist/ui/item.d.ts +12 -12
  174. package/dist/ui/label.d.ts +1 -1
  175. package/dist/ui/menubar.d.cts +17 -17
  176. package/dist/ui/menubar.d.ts +17 -17
  177. package/dist/ui/multi-select.d.cts +2 -2
  178. package/dist/ui/multi-select.d.ts +2 -2
  179. package/dist/ui/navigation-menu.d.cts +9 -9
  180. package/dist/ui/navigation-menu.d.ts +9 -9
  181. package/dist/ui/pagination.d.cts +9 -9
  182. package/dist/ui/pagination.d.ts +9 -9
  183. package/dist/ui/popover.d.cts +5 -5
  184. package/dist/ui/popover.d.ts +5 -5
  185. package/dist/ui/progress.d.cts +2 -2
  186. package/dist/ui/progress.d.ts +2 -2
  187. package/dist/ui/radio-group.d.cts +3 -3
  188. package/dist/ui/radio-group.d.ts +3 -3
  189. package/dist/ui/resizable.d.cts +4 -4
  190. package/dist/ui/resizable.d.ts +4 -4
  191. package/dist/ui/scroll-area.d.cts +3 -3
  192. package/dist/ui/scroll-area.d.ts +3 -3
  193. package/dist/ui/select.cjs +1 -1
  194. package/dist/ui/select.d.cts +11 -11
  195. package/dist/ui/select.d.ts +11 -11
  196. package/dist/ui/select.js +1 -1
  197. package/dist/ui/separator.d.cts +1 -1
  198. package/dist/ui/separator.d.ts +1 -1
  199. package/dist/ui/sheet.d.cts +9 -9
  200. package/dist/ui/sidebar.d.cts +30 -30
  201. package/dist/ui/sidebar.d.ts +28 -28
  202. package/dist/ui/skeleton.d.cts +2 -2
  203. package/dist/ui/skeleton.d.ts +2 -2
  204. package/dist/ui/slider.d.cts +2 -2
  205. package/dist/ui/slider.d.ts +2 -2
  206. package/dist/ui/sonner.d.cts +2 -2
  207. package/dist/ui/sonner.d.ts +2 -2
  208. package/dist/ui/spinner.d.cts +2 -2
  209. package/dist/ui/spinner.d.ts +2 -2
  210. package/dist/ui/switch.d.cts +2 -2
  211. package/dist/ui/switch.d.ts +2 -2
  212. package/dist/ui/table.d.cts +9 -9
  213. package/dist/ui/table.d.ts +9 -9
  214. package/dist/ui/tabs.d.cts +5 -5
  215. package/dist/ui/tabs.d.ts +5 -5
  216. package/dist/ui/textarea.d.cts +2 -2
  217. package/dist/ui/textarea.d.ts +2 -2
  218. package/dist/ui/toggle-group.d.cts +4 -4
  219. package/dist/ui/toggle-group.d.ts +1 -1
  220. package/dist/ui/toggle.d.cts +1 -1
  221. package/dist/ui/toggle.d.ts +1 -1
  222. package/dist/ui/tooltip.d.cts +1 -1
  223. package/dist/ui/tooltip.d.ts +1 -1
  224. package/package.json +1 -1
  225. package/dist/field-A43YZ5Wj.cjs +0 -2
  226. package/dist/field-A43YZ5Wj.cjs.map +0 -1
  227. package/dist/field-CGacT8J3.js +0 -2
  228. package/dist/field-CGacT8J3.js.map +0 -1
  229. package/dist/label-DRUB18K3.d.ts +0 -11
  230. package/dist/select-B8sXsuUI.js +0 -2
  231. package/dist/select-B8sXsuUI.js.map +0 -1
  232. package/dist/select-BD7dul2u.cjs +0 -2
  233. package/dist/select-BD7dul2u.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
- import { Button } from "../../../button-B9iPyKOi.js";
2
- import { Input } from "../../../input-6c2vBe4o.js";
3
- import { Separator } from "../../../separator-Dpd6twVS.js";
4
- import { TooltipContent } from "../../../tooltip-BX0WfPh7.js";
5
- import * as react_jsx_runtime281 from "react/jsx-runtime";
1
+ import { Button } from "../../../button-BJr39-E1.js";
2
+ import { Input } from "../../../input-CD0idRrj.js";
3
+ import { Separator } from "../../../separator-B4drkRIA.js";
4
+ import { TooltipContent } from "../../../tooltip-DTDkf-An.js";
5
+ import * as react_jsx_runtime280 from "react/jsx-runtime";
6
6
  import { VariantProps } from "class-variance-authority";
7
7
  import * as class_variance_authority_types9 from "class-variance-authority/types";
8
8
 
@@ -29,7 +29,7 @@ declare function SidebarProvider({
29
29
  defaultOpen?: boolean;
30
30
  open?: boolean;
31
31
  onOpenChange?: (open: boolean) => void;
32
- }): react_jsx_runtime281.JSX.Element;
32
+ }): react_jsx_runtime280.JSX.Element;
33
33
  declare function Sidebar({
34
34
  side,
35
35
  variant,
@@ -41,70 +41,70 @@ declare function Sidebar({
41
41
  side?: 'left' | 'right';
42
42
  variant?: 'sidebar' | 'floating' | 'inset';
43
43
  collapsible?: 'offcanvas' | 'icon' | 'none';
44
- }): react_jsx_runtime281.JSX.Element;
44
+ }): react_jsx_runtime280.JSX.Element;
45
45
  declare function DetailDialogSidebarTrigger({
46
46
  className,
47
47
  onClick,
48
48
  ...props
49
- }: React.ComponentProps<typeof Button>): react_jsx_runtime281.JSX.Element;
49
+ }: React.ComponentProps<typeof Button>): react_jsx_runtime280.JSX.Element;
50
50
  declare function DetailDialogSidebarRail({
51
51
  className,
52
52
  ...props
53
- }: React.ComponentProps<'button'>): react_jsx_runtime281.JSX.Element;
53
+ }: React.ComponentProps<'button'>): react_jsx_runtime280.JSX.Element;
54
54
  declare function SidebarInset({
55
55
  className,
56
56
  ...props
57
- }: React.ComponentProps<'main'>): react_jsx_runtime281.JSX.Element;
57
+ }: React.ComponentProps<'main'>): react_jsx_runtime280.JSX.Element;
58
58
  declare function SidebarInput({
59
59
  className,
60
60
  ...props
61
- }: React.ComponentProps<typeof Input>): react_jsx_runtime281.JSX.Element;
61
+ }: React.ComponentProps<typeof Input>): react_jsx_runtime280.JSX.Element;
62
62
  declare function DetailDialogSidebarHeader({
63
63
  className,
64
64
  ...props
65
- }: React.ComponentProps<'div'>): react_jsx_runtime281.JSX.Element;
65
+ }: React.ComponentProps<'div'>): react_jsx_runtime280.JSX.Element;
66
66
  declare function DetailDialogSidebarFooter({
67
67
  className,
68
68
  ...props
69
- }: React.ComponentProps<'div'>): react_jsx_runtime281.JSX.Element;
69
+ }: React.ComponentProps<'div'>): react_jsx_runtime280.JSX.Element;
70
70
  declare function DetailDialogSidebarSeparator({
71
71
  className,
72
72
  ...props
73
- }: React.ComponentProps<typeof Separator>): react_jsx_runtime281.JSX.Element;
73
+ }: React.ComponentProps<typeof Separator>): react_jsx_runtime280.JSX.Element;
74
74
  declare function DetailDialogSidebarContent({
75
75
  className,
76
76
  ...props
77
- }: React.ComponentProps<'div'>): react_jsx_runtime281.JSX.Element;
77
+ }: React.ComponentProps<'div'>): react_jsx_runtime280.JSX.Element;
78
78
  declare function DetailDialogSidebarGroup({
79
79
  className,
80
80
  ...props
81
- }: React.ComponentProps<'div'>): react_jsx_runtime281.JSX.Element;
81
+ }: React.ComponentProps<'div'>): react_jsx_runtime280.JSX.Element;
82
82
  declare function DetailDialogSidebarGroupLabel({
83
83
  className,
84
84
  asChild,
85
85
  ...props
86
86
  }: React.ComponentProps<'div'> & {
87
87
  asChild?: boolean;
88
- }): react_jsx_runtime281.JSX.Element;
88
+ }): react_jsx_runtime280.JSX.Element;
89
89
  declare function DetailDialogSidebarGroupAction({
90
90
  className,
91
91
  asChild,
92
92
  ...props
93
93
  }: React.ComponentProps<'button'> & {
94
94
  asChild?: boolean;
95
- }): react_jsx_runtime281.JSX.Element;
95
+ }): react_jsx_runtime280.JSX.Element;
96
96
  declare function DetailDialogSidebarGroupContent({
97
97
  className,
98
98
  ...props
99
- }: React.ComponentProps<'div'>): react_jsx_runtime281.JSX.Element;
99
+ }: React.ComponentProps<'div'>): react_jsx_runtime280.JSX.Element;
100
100
  declare function DetailDialogSidebarMenu({
101
101
  className,
102
102
  ...props
103
- }: React.ComponentProps<'ul'>): react_jsx_runtime281.JSX.Element;
103
+ }: React.ComponentProps<'ul'>): react_jsx_runtime280.JSX.Element;
104
104
  declare function DetailDialogSidebarMenuItem({
105
105
  className,
106
106
  ...props
107
- }: React.ComponentProps<'li'>): react_jsx_runtime281.JSX.Element;
107
+ }: React.ComponentProps<'li'>): react_jsx_runtime280.JSX.Element;
108
108
  declare const sidebarMenuButtonVariants: (props?: ({
109
109
  variant?: "default" | "outline" | null | undefined;
110
110
  size?: "sm" | "lg" | "default" | null | undefined;
@@ -121,7 +121,7 @@ declare function DetailDialogSidebarMenuButton({
121
121
  asChild?: boolean;
122
122
  isActive?: boolean;
123
123
  tooltip?: string | React.ComponentProps<typeof TooltipContent>;
124
- } & VariantProps<typeof sidebarMenuButtonVariants>): react_jsx_runtime281.JSX.Element;
124
+ } & VariantProps<typeof sidebarMenuButtonVariants>): react_jsx_runtime280.JSX.Element;
125
125
  declare function DetailDialogSidebarMenuAction({
126
126
  className,
127
127
  asChild,
@@ -130,26 +130,26 @@ declare function DetailDialogSidebarMenuAction({
130
130
  }: React.ComponentProps<'button'> & {
131
131
  asChild?: boolean;
132
132
  showOnHover?: boolean;
133
- }): react_jsx_runtime281.JSX.Element;
133
+ }): react_jsx_runtime280.JSX.Element;
134
134
  declare function DetailDialogSidebarMenuBadge({
135
135
  className,
136
136
  ...props
137
- }: React.ComponentProps<'div'>): react_jsx_runtime281.JSX.Element;
137
+ }: React.ComponentProps<'div'>): react_jsx_runtime280.JSX.Element;
138
138
  declare function DetailDialogSidebarMenuSkeleton({
139
139
  className,
140
140
  showIcon,
141
141
  ...props
142
142
  }: React.ComponentProps<'div'> & {
143
143
  showIcon?: boolean;
144
- }): react_jsx_runtime281.JSX.Element;
144
+ }): react_jsx_runtime280.JSX.Element;
145
145
  declare function DetailDialogSidebarMenuSub({
146
146
  className,
147
147
  ...props
148
- }: React.ComponentProps<'ul'>): react_jsx_runtime281.JSX.Element;
148
+ }: React.ComponentProps<'ul'>): react_jsx_runtime280.JSX.Element;
149
149
  declare function DetailDialogSidebarMenuSubItem({
150
150
  className,
151
151
  ...props
152
- }: React.ComponentProps<'li'>): react_jsx_runtime281.JSX.Element;
152
+ }: React.ComponentProps<'li'>): react_jsx_runtime280.JSX.Element;
153
153
  declare function DetailDialogSidebarMenuSubButton({
154
154
  asChild,
155
155
  size,
@@ -160,7 +160,7 @@ declare function DetailDialogSidebarMenuSubButton({
160
160
  asChild?: boolean;
161
161
  size?: 'sm' | 'md';
162
162
  isActive?: boolean;
163
- }): react_jsx_runtime281.JSX.Element;
163
+ }): react_jsx_runtime280.JSX.Element;
164
164
  //#endregion
165
165
  export { DetailDialogSidebarContent, DetailDialogSidebarFooter, DetailDialogSidebarGroup, DetailDialogSidebarGroupAction, DetailDialogSidebarGroupContent, DetailDialogSidebarGroupLabel, DetailDialogSidebarHeader, DetailDialogSidebarMenu, DetailDialogSidebarMenuAction, DetailDialogSidebarMenuBadge, DetailDialogSidebarMenuButton, DetailDialogSidebarMenuItem, DetailDialogSidebarMenuSkeleton, DetailDialogSidebarMenuSub, DetailDialogSidebarMenuSubButton, DetailDialogSidebarMenuSubItem, DetailDialogSidebarRail, DetailDialogSidebarSeparator, DetailDialogSidebarTrigger, Sidebar, SidebarInput, SidebarInset, SidebarProvider, useSidebar };
166
166
  //# sourceMappingURL=sidebar.d.ts.map
@@ -1,2 +1,2 @@
1
- const e=require(`../chunk-CUT6urMc.cjs`);require(`../dist-CAevLI5t.cjs`),require(`../button-variants-BHDyMRNh.cjs`);const t=require(`../button-BCahPWI8.cjs`);require(`../alert-dialog-sCh-4H6r.cjs`),require(`../error-dialog-COl3CQ1E.cjs`),require(`../label-D6mAvVmw.cjs`),require(`../separator-DMMoR-d2.cjs`),require(`../field-A43YZ5Wj.cjs`),require(`../form-DV9tQbiO.cjs`);const n=require(`../form-wrapper-CXrhlLBL.cjs`),r=require(`../dialog-BBODhbxh.cjs`),i=require(`../drawer-C3vvvU_D.cjs`);let a=require(`@customafk/react-toolkit/utils`);a=e.__toESM(a);let o=require(`react/jsx-runtime`);o=e.__toESM(o);let s=require(`@customafk/react-toolkit/hooks/useMediaQuery`);s=e.__toESM(s);const c=({form:e,open:c,isSubmitting:l=!1,isResetAfterSubmit:u=!0,disableSubmit:d=!1,title:f,description:p,className:m,onOpenChange:h,onSubmit:g,onError:_,onReset:v,children:y})=>(0,s.useMediaQuery)(`(min-width: 768px)`)?(0,o.jsx)(r.Dialog,{open:c,onOpenChange:h,children:(0,o.jsxs)(r.DialogContent,{className:(0,a.cn)(`flex flex-col gap-0 border-none p-0`,m),onInteractOutside:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,o.jsxs)(r.DialogHeader,{className:`border-border-weak flex-0 gap-2 border-b p-6 pb-4`,children:[(0,o.jsx)(r.DialogTitle,{children:f||`Form Dialog`}),(0,o.jsx)(r.DialogDescription,{children:p||`This is a form dialog where you can add your form elements.`})]}),(0,o.jsxs)(n.FormWrapper,{form:e,isResetAfterSubmit:u,className:`flex flex-1 flex-col overflow-y-auto`,onSubmit:g,onError:_,children:[(0,o.jsx)(`div`,{className:`bg-muted-muted size-full p-2 inset-shadow-sm`,children:(0,o.jsx)(`main`,{className:`bg-card shadow-card size-full flex-1 overflow-y-auto rounded-md p-4`,children:y})}),(0,o.jsxs)(r.DialogFooter,{className:`border-border-weak border-t p-6 pt-4`,children:[(0,o.jsx)(t.Button,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-30 rounded-full`,onClick:v,children:`Reset`}),(0,o.jsx)(t.Button,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:l,disabled:d,className:`w-30 rounded-full`,children:`Submit`})]})]})]})}):(0,o.jsx)(i.Drawer,{open:c,onOpenChange:h,children:(0,o.jsxs)(i.DrawerContent,{children:[(0,o.jsxs)(i.DrawerHeader,{className:`text-left`,children:[(0,o.jsx)(i.DrawerTitle,{children:f||`Form Dialog`}),(0,o.jsx)(i.DrawerDescription,{children:p||`This is a form dialog where you can add your form elements.`})]}),(0,o.jsxs)(n.FormWrapper,{form:e,isResetAfterSubmit:u,className:`flex flex-1 flex-col overflow-y-auto`,onSubmit:g,onError:_,children:[(0,o.jsx)(`main`,{className:`size-full flex-1 overflow-y-auto p-4`,children:y}),(0,o.jsxs)(i.DrawerFooter,{className:`pt-2`,children:[(0,o.jsx)(t.Button,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:l,disabled:d,className:`w-full rounded-full`,children:`Submit`}),(0,o.jsx)(t.Button,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-full rounded-full`,onClick:v,children:`Reset`})]})]})]})});exports.FormDialog=c;
1
+ const e=require(`../chunk-CUT6urMc.cjs`);require(`../dist-CAevLI5t.cjs`),require(`../button-variants-BHDyMRNh.cjs`);const t=require(`../button-BCahPWI8.cjs`);require(`../alert-dialog-sCh-4H6r.cjs`),require(`../error-dialog-COl3CQ1E.cjs`),require(`../label-D6mAvVmw.cjs`),require(`../separator-DMMoR-d2.cjs`),require(`../field-DWOm17T1.cjs`),require(`../form-rN5ezSn5.cjs`);const n=require(`../form-wrapper-A1DZnRIF.cjs`),r=require(`../dialog-BBODhbxh.cjs`),i=require(`../drawer-C3vvvU_D.cjs`);let a=require(`@customafk/react-toolkit/utils`);a=e.__toESM(a);let o=require(`react/jsx-runtime`);o=e.__toESM(o);let s=require(`@customafk/react-toolkit/hooks/useMediaQuery`);s=e.__toESM(s);const c=({form:e,open:c,isSubmitting:l=!1,isResetAfterSubmit:u=!0,disableSubmit:d=!1,title:f,description:p,className:m,onOpenChange:h,onSubmit:g,onError:_,onReset:v,children:y})=>(0,s.useMediaQuery)(`(min-width: 768px)`)?(0,o.jsx)(r.Dialog,{open:c,onOpenChange:h,children:(0,o.jsxs)(r.DialogContent,{className:(0,a.cn)(`flex flex-col gap-0 border-none p-0`,m),onInteractOutside:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,o.jsxs)(r.DialogHeader,{className:`border-border-weak flex-0 gap-2 border-b p-6 pb-4`,children:[(0,o.jsx)(r.DialogTitle,{children:f||`Form Dialog`}),(0,o.jsx)(r.DialogDescription,{children:p||`This is a form dialog where you can add your form elements.`})]}),(0,o.jsxs)(n.FormWrapper,{form:e,isResetAfterSubmit:u,className:`flex flex-1 flex-col overflow-y-auto`,onSubmit:g,onError:_,children:[(0,o.jsx)(`div`,{className:`bg-muted-muted size-full p-2 inset-shadow-sm`,children:(0,o.jsx)(`main`,{className:`bg-card shadow-card size-full flex-1 overflow-y-auto rounded-md p-4`,children:y})}),(0,o.jsxs)(r.DialogFooter,{className:`border-border-weak border-t p-6 pt-4`,children:[(0,o.jsx)(t.Button,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-30 rounded-full`,onClick:v,children:`Reset`}),(0,o.jsx)(t.Button,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:l,disabled:d,className:`w-30 rounded-full`,children:`Submit`})]})]})]})}):(0,o.jsx)(i.Drawer,{open:c,onOpenChange:h,children:(0,o.jsxs)(i.DrawerContent,{children:[(0,o.jsxs)(i.DrawerHeader,{className:`text-left`,children:[(0,o.jsx)(i.DrawerTitle,{children:f||`Form Dialog`}),(0,o.jsx)(i.DrawerDescription,{children:p||`This is a form dialog where you can add your form elements.`})]}),(0,o.jsxs)(n.FormWrapper,{form:e,isResetAfterSubmit:u,className:`flex flex-1 flex-col overflow-y-auto`,onSubmit:g,onError:_,children:[(0,o.jsx)(`main`,{className:`size-full flex-1 overflow-y-auto p-4`,children:y}),(0,o.jsxs)(i.DrawerFooter,{className:`pt-2`,children:[(0,o.jsx)(t.Button,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:l,disabled:d,className:`w-full rounded-full`,children:`Submit`}),(0,o.jsx)(t.Button,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-full rounded-full`,onClick:v,children:`Reset`})]})]})]})});exports.FormDialog=c;
2
2
  //# sourceMappingURL=form-dialog.cjs.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime7 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
2
  import { FieldValues, FormState, SubmitErrorHandler, UseFormProps } from "react-hook-form";
3
3
 
4
4
  //#region packages/components/dialogs/form-dialog.d.ts
@@ -30,7 +30,7 @@ declare const FormDialog: <TFieldValues extends FieldValues = FieldValues>({
30
30
  onError,
31
31
  onReset,
32
32
  children
33
- }: React.PropsWithChildren<Props<TFieldValues>>) => react_jsx_runtime7.JSX.Element;
33
+ }: React.PropsWithChildren<Props<TFieldValues>>) => react_jsx_runtime1.JSX.Element;
34
34
  //#endregion
35
35
  export { FormDialog };
36
36
  //# sourceMappingURL=form-dialog.d.cts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime303 from "react/jsx-runtime";
2
2
  import { FieldValues, FormState, SubmitErrorHandler, UseFormProps } from "react-hook-form";
3
3
 
4
4
  //#region packages/components/dialogs/form-dialog.d.ts
@@ -30,7 +30,7 @@ declare const FormDialog: <TFieldValues extends FieldValues = FieldValues>({
30
30
  onError,
31
31
  onReset,
32
32
  children
33
- }: React.PropsWithChildren<Props<TFieldValues>>) => react_jsx_runtime2.JSX.Element;
33
+ }: React.PropsWithChildren<Props<TFieldValues>>) => react_jsx_runtime303.JSX.Element;
34
34
  //#endregion
35
35
  export { FormDialog };
36
36
  //# sourceMappingURL=form-dialog.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../dist-BgkALM7U.js";import"../button-variants-aFWCWUvu.js";import{Button as e}from"../button-CriBqo8S.js";import"../alert-dialog-CtzD_gfT.js";import"../error-dialog-BLiYMBlh.js";import"../label-CdrxlBJ8.js";import"../separator-D17HxS2f.js";import"../field-CGacT8J3.js";import"../form-B_tL9lO4.js";import{FormWrapper as t}from"../form-wrapper-Cw_ARA0-.js";import{Dialog as n,DialogContent as r,DialogDescription as i,DialogFooter as a,DialogHeader as o,DialogTitle as s}from"../dialog-BAlJ18xi.js";import{Drawer as c,DrawerContent as l,DrawerDescription as u,DrawerFooter as d,DrawerHeader as f,DrawerTitle as p}from"../drawer-BT0osH1O.js";import{cn as m}from"@customafk/react-toolkit/utils";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useMediaQuery as _}from"@customafk/react-toolkit/hooks/useMediaQuery";const v=({form:v,open:y,isSubmitting:b=!1,isResetAfterSubmit:x=!0,disableSubmit:S=!1,title:C,description:w,className:T,onOpenChange:E,onSubmit:D,onError:O,onReset:k,children:A})=>_(`(min-width: 768px)`)?h(n,{open:y,onOpenChange:E,children:g(r,{className:m(`flex flex-col gap-0 border-none p-0`,T),onInteractOutside:e=>{e.preventDefault(),e.stopPropagation()},children:[g(o,{className:`border-border-weak flex-0 gap-2 border-b p-6 pb-4`,children:[h(s,{children:C||`Form Dialog`}),h(i,{children:w||`This is a form dialog where you can add your form elements.`})]}),g(t,{form:v,isResetAfterSubmit:x,className:`flex flex-1 flex-col overflow-y-auto`,onSubmit:D,onError:O,children:[h(`div`,{className:`bg-muted-muted size-full p-2 inset-shadow-sm`,children:h(`main`,{className:`bg-card shadow-card size-full flex-1 overflow-y-auto rounded-md p-4`,children:A})}),g(a,{className:`border-border-weak border-t p-6 pt-4`,children:[h(e,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-30 rounded-full`,onClick:k,children:`Reset`}),h(e,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:b,disabled:S,className:`w-30 rounded-full`,children:`Submit`})]})]})]})}):h(c,{open:y,onOpenChange:E,children:g(l,{children:[g(f,{className:`text-left`,children:[h(p,{children:C||`Form Dialog`}),h(u,{children:w||`This is a form dialog where you can add your form elements.`})]}),g(t,{form:v,isResetAfterSubmit:x,className:`flex flex-1 flex-col overflow-y-auto`,onSubmit:D,onError:O,children:[h(`main`,{className:`size-full flex-1 overflow-y-auto p-4`,children:A}),g(d,{className:`pt-2`,children:[h(e,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:b,disabled:S,className:`w-full rounded-full`,children:`Submit`}),h(e,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-full rounded-full`,onClick:k,children:`Reset`})]})]})]})});export{v as FormDialog};
1
+ import"../dist-BgkALM7U.js";import"../button-variants-aFWCWUvu.js";import{Button as e}from"../button-CriBqo8S.js";import"../alert-dialog-CtzD_gfT.js";import"../error-dialog-BLiYMBlh.js";import"../label-CdrxlBJ8.js";import"../separator-D17HxS2f.js";import"../field-GVRRZiSk.js";import"../form-De64-oXe.js";import{FormWrapper as t}from"../form-wrapper-CSmgFsG0.js";import{Dialog as n,DialogContent as r,DialogDescription as i,DialogFooter as a,DialogHeader as o,DialogTitle as s}from"../dialog-BAlJ18xi.js";import{Drawer as c,DrawerContent as l,DrawerDescription as u,DrawerFooter as d,DrawerHeader as f,DrawerTitle as p}from"../drawer-BT0osH1O.js";import{cn as m}from"@customafk/react-toolkit/utils";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useMediaQuery as _}from"@customafk/react-toolkit/hooks/useMediaQuery";const v=({form:v,open:y,isSubmitting:b=!1,isResetAfterSubmit:x=!0,disableSubmit:S=!1,title:C,description:w,className:T,onOpenChange:E,onSubmit:D,onError:O,onReset:k,children:A})=>_(`(min-width: 768px)`)?h(n,{open:y,onOpenChange:E,children:g(r,{className:m(`flex flex-col gap-0 border-none p-0`,T),onInteractOutside:e=>{e.preventDefault(),e.stopPropagation()},children:[g(o,{className:`border-border-weak flex-0 gap-2 border-b p-6 pb-4`,children:[h(s,{children:C||`Form Dialog`}),h(i,{children:w||`This is a form dialog where you can add your form elements.`})]}),g(t,{form:v,isResetAfterSubmit:x,className:`flex flex-1 flex-col overflow-y-auto`,onSubmit:D,onError:O,children:[h(`div`,{className:`bg-muted-muted size-full p-2 inset-shadow-sm`,children:h(`main`,{className:`bg-card shadow-card size-full flex-1 overflow-y-auto rounded-md p-4`,children:A})}),g(a,{className:`border-border-weak border-t p-6 pt-4`,children:[h(e,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-30 rounded-full`,onClick:k,children:`Reset`}),h(e,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:b,disabled:S,className:`w-30 rounded-full`,children:`Submit`})]})]})]})}):h(c,{open:y,onOpenChange:E,children:g(l,{children:[g(f,{className:`text-left`,children:[h(p,{children:C||`Form Dialog`}),h(u,{children:w||`This is a form dialog where you can add your form elements.`})]}),g(t,{form:v,isResetAfterSubmit:x,className:`flex flex-1 flex-col overflow-y-auto`,onSubmit:D,onError:O,children:[h(`main`,{className:`size-full flex-1 overflow-y-auto p-4`,children:A}),g(d,{className:`pt-2`,children:[h(e,{autoFocus:!0,tabIndex:0,type:`submit`,isLoading:b,disabled:S,className:`w-full rounded-full`,children:`Submit`}),h(e,{tabIndex:-1,type:`button`,variant:`outline`,color:`muted`,className:`w-full rounded-full`,onClick:k,children:`Reset`})]})]})]})});export{v as FormDialog};
2
2
  //# sourceMappingURL=form-dialog.js.map
@@ -0,0 +1,2 @@
1
+ const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./label-D6mAvVmw.cjs`),n=require(`./separator-DMMoR-d2.cjs`);let r=require(`@customafk/react-toolkit/utils`);r=e.__toESM(r);let i=require(`react`);i=e.__toESM(i);let a=require(`react/jsx-runtime`);a=e.__toESM(a);let o=require(`class-variance-authority`);o=e.__toESM(o);function s({className:e,...t}){return(0,a.jsx)(`fieldset`,{"data-slot":`field-set`,className:(0,r.cn)(`flex flex-col gap-6`,`has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function c({className:e,variant:t=`legend`,...n}){return(0,a.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:(0,r.cn)(`mb-3 font-medium`,`data-[variant=legend]:text-base`,`data-[variant=label]:text-sm`,e),...n})}function l({className:e,...t}){return(0,a.jsx)(`div`,{"data-slot":`field-group`,className:(0,r.cn)(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4`,e),...t})}const u=(0,o.cva)(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:[`flex-col [&>*]:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`[&>[data-slot=field-label]]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col [&>*]:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:[&>*]:w-auto`,`@md/field-group:[&>[data-slot=field-label]]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}});function d({className:e,orientation:t=`vertical`,...n}){return(0,a.jsx)(`div`,{"data-slot":`field`,"data-orientation":t,className:(0,r.cn)(u({orientation:t}),e),...n})}function f({className:e,...t}){return(0,a.jsx)(`div`,{"data-slot":`field-content`,className:(0,r.cn)(`group/field-content flex basis-2/5 flex-col gap-1.5 leading-snug`,e),...t})}function p({className:e,...n}){return(0,a.jsx)(t.Label,{"data-slot":`field-label`,className:(0,r.cn)(`group/field-label peer/field-label flex w-fit gap-2 leading-snug`,`group-data-[disabled=true]/field:opacity-50`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`[&>*]:data-[slot=field]:p-4`,`has-data-[state=checked]:bg-primary/5`,`has-data-[state=checked]:border-primary`,e),...n})}function m({className:e,...t}){return(0,a.jsx)(`div`,{"data-slot":`field-label`,className:(0,r.cn)(`flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50`,e),...t})}function h({className:e,...t}){return(0,a.jsx)(`p`,{"data-slot":`field-description`,className:(0,r.cn)(`text-text-positive-weak text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...t})}function g({children:e,className:t,...i}){return(0,a.jsxs)(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:(0,r.cn)(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...i,children:[(0,a.jsx)(n.Separator,{className:`absolute inset-0 top-1/2`}),e&&(0,a.jsx)(`span`,{className:`bg-background text-text-positive-weak relative mx-auto block w-fit px-2`,"data-slot":`field-separator-content`,children:e})]})}function _({className:e,children:t,errors:n,...o}){let s=(0,i.useMemo)(()=>t||(n?n?.length===1&&n[0]?.message?n[0].message:(0,a.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:n.map(e=>e?.message&&(0,a.jsx)(`li`,{children:e.message},e.message))}):null),[t,n]);return s?(0,a.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:(0,r.cn)(`text-danger text-sm font-normal`,e),...o,children:s}):null}Object.defineProperty(exports,`Field`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`FieldContent`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`FieldDescription`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`FieldError`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`FieldGroup`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`FieldLabel`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`FieldLegend`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`FieldSeparator`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`FieldSet`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`FieldTitle`,{enumerable:!0,get:function(){return m}});
2
+ //# sourceMappingURL=field-DWOm17T1.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-DWOm17T1.cjs","names":["Label","Separator"],"sources":["../packages/components/ui/field.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Label } from '@/components/ui/label';\nimport { Separator } from '@/components/ui/separator';\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn('flex flex-col gap-6', 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className)}\n {...props}\n />\n );\n}\n\nfunction FieldLegend({ className, variant = 'legend', ...props }: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium', 'data-[variant=legend]:text-base', 'data-[variant=label]:text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4',\n className\n )}\n {...props}\n />\n );\n}\n\nconst fieldVariants = cva('group/field flex w-full gap-3 data-[invalid=true]:text-destructive', {\n variants: {\n orientation: {\n vertical: ['flex-col [&>*]:w-full [&>.sr-only]:w-auto'],\n horizontal: [\n 'flex-row items-center',\n '[&>[data-slot=field-label]]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start',\n 'has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col [&>*]:w-full [&>.sr-only]:w-auto',\n '@md/field-group:flex-row',\n '@md/field-group:items-center',\n '@md/field-group:[&>*]:w-auto',\n '@md/field-group:[&>[data-slot=field-label]]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start',\n '@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\nfunction Field({ className, orientation = 'vertical', ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) {\n return <div data-slot=\"field\" data-orientation={orientation} className={cn(fieldVariants({ orientation }), className)} {...props} />;\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"field-content\" className={cn('group/field-content flex basis-2/5 flex-col gap-1.5 leading-snug', className)} {...props} />;\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug',\n 'group-data-[disabled=true]/field:opacity-50',\n 'has-[>[data-slot=field]]:w-full',\n 'has-[>[data-slot=field]]:flex-col',\n 'has-[>[data-slot=field]]:rounded-md',\n 'has-[>[data-slot=field]]:border',\n '[&>*]:data-[slot=field]:p-4',\n 'has-data-[state=checked]:bg-primary/5',\n 'has-data-[state=checked]:border-primary',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn('flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50', className)}\n {...props}\n />\n );\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n 'text-text-positive-weak text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span className=\"bg-background text-text-positive-weak relative mx-auto block w-fit px-2\" data-slot=\"field-separator-content\">\n {children}\n </span>\n )}\n </div>\n );\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return errors[0].message;\n }\n\n return <ul className=\"ml-4 flex list-disc flex-col gap-1\">{errors.map(error => error?.message && <li key={error.message}>{error.message}</li>)}</ul>;\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div role=\"alert\" data-slot=\"field-error\" className={cn('text-danger text-sm font-normal', className)} {...props}>\n {content}\n </div>\n );\n}\n\nexport { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle };\n"],"mappings":"gUAUA,SAAS,EAAS,CAAE,YAAW,GAAG,GAA2C,CAC3E,OACE,EAAA,EAAA,KAAC,WAAA,CACC,YAAU,YACV,WAAA,EAAA,EAAA,IAAc,sBAAuB,+EAAgF,EAAU,CAC/H,GAAI,GACJ,CAIN,SAAS,EAAY,CAAE,YAAW,UAAU,SAAU,GAAG,GAA4E,CACnI,OACE,EAAA,EAAA,KAAC,SAAA,CACC,YAAU,eACV,eAAc,EACd,WAAA,EAAA,EAAA,IAAc,mBAAoB,kCAAmC,+BAAgC,EAAU,CAC/G,GAAI,GACJ,CAIN,SAAS,EAAW,CAAE,YAAW,GAAG,GAAsC,CACxE,OACE,EAAA,EAAA,KAAC,MAAA,CACC,YAAU,cACV,WAAA,EAAA,EAAA,IACE,yIACA,EACD,CACD,GAAI,GACJ,CAIN,MAAM,GAAA,EAAA,EAAA,KAAoB,qEAAsE,CAC9F,SAAU,CACR,YAAa,CACX,SAAU,CAAC,4CAA4C,CACvD,WAAY,CACV,wBACA,wCACA,+CACA,0EACD,CACD,WAAY,CACV,4CACA,2BACA,+BACA,+BACA,wDACA,+DACA,0FACD,CACF,CACF,CACD,gBAAiB,CACf,YAAa,WACd,CACF,CAAC,CAEF,SAAS,EAAM,CAAE,YAAW,cAAc,WAAY,GAAG,GAA2E,CAClI,OAAO,EAAA,EAAA,KAAC,MAAA,CAAI,YAAU,QAAQ,mBAAkB,EAAa,WAAA,EAAA,EAAA,IAAc,EAAc,CAAE,cAAa,CAAC,CAAE,EAAU,CAAE,GAAI,GAAS,CAGtI,SAAS,EAAa,CAAE,YAAW,GAAG,GAAsC,CAC1E,OAAO,EAAA,EAAA,KAAC,MAAA,CAAI,YAAU,gBA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,EAAO,CAAC,CAMtB,OAJK,GAKH,EAAA,EAAA,KAAC,MAAA,CAAI,KAAK,QAAQ,YAAU,cAAc,WAAA,EAAA,EAAA,IAAc,kCAAmC,EAAU,CAAE,GAAI,WACxG,GACG,CANC"}
@@ -0,0 +1,2 @@
1
+ import{Label as e}from"./label-CdrxlBJ8.js";import{Separator as t}from"./separator-D17HxS2f.js";import{cn as n}from"@customafk/react-toolkit/utils";import{useMemo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{cva as o}from"class-variance-authority";function s({className:e,...t}){return i(`fieldset`,{"data-slot":`field-set`,className:n(`flex flex-col gap-6`,`has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function c({className:e,variant:t=`legend`,...r}){return i(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:n(`mb-3 font-medium`,`data-[variant=legend]:text-base`,`data-[variant=label]:text-sm`,e),...r})}function l({className:e,...t}){return i(`div`,{"data-slot":`field-group`,className:n(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4`,e),...t})}const u=o(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:[`flex-col [&>*]:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`[&>[data-slot=field-label]]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col [&>*]:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:[&>*]:w-auto`,`@md/field-group:[&>[data-slot=field-label]]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}});function d({className:e,orientation:t=`vertical`,...r}){return i(`div`,{"data-slot":`field`,"data-orientation":t,className:n(u({orientation:t}),e),...r})}function f({className:e,...t}){return i(`div`,{"data-slot":`field-content`,className:n(`group/field-content flex basis-2/5 flex-col gap-1.5 leading-snug`,e),...t})}function p({className:t,...r}){return i(e,{"data-slot":`field-label`,className:n(`group/field-label peer/field-label flex w-fit gap-2 leading-snug`,`group-data-[disabled=true]/field:opacity-50`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`[&>*]:data-[slot=field]:p-4`,`has-data-[state=checked]:bg-primary/5`,`has-data-[state=checked]:border-primary`,t),...r})}function m({className:e,...t}){return i(`div`,{"data-slot":`field-label`,className:n(`flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50`,e),...t})}function h({className:e,...t}){return i(`p`,{"data-slot":`field-description`,className:n(`text-text-positive-weak text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...t})}function g({children:e,className:r,...o}){return a(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:n(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,r),...o,children:[i(t,{className:`absolute inset-0 top-1/2`}),e&&i(`span`,{className:`bg-background text-text-positive-weak relative mx-auto block w-fit px-2`,"data-slot":`field-separator-content`,children:e})]})}function _({className:e,children:t,errors:a,...o}){let s=r(()=>t||(a?a?.length===1&&a[0]?.message?a[0].message:i(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:a.map(e=>e?.message&&i(`li`,{children:e.message},e.message))}):null),[t,a]);return s?i(`div`,{role:`alert`,"data-slot":`field-error`,className:n(`text-danger text-sm font-normal`,e),...o,children:s}):null}export{d as Field,f as FieldContent,h as FieldDescription,_ as FieldError,l as FieldGroup,p as FieldLabel,c as FieldLegend,g as FieldSeparator,s as FieldSet,m as FieldTitle};
2
+ //# sourceMappingURL=field-GVRRZiSk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-GVRRZiSk.js","names":[],"sources":["../packages/components/ui/field.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Label } from '@/components/ui/label';\nimport { Separator } from '@/components/ui/separator';\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn('flex flex-col gap-6', 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className)}\n {...props}\n />\n );\n}\n\nfunction FieldLegend({ className, variant = 'legend', ...props }: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium', 'data-[variant=legend]:text-base', 'data-[variant=label]:text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4',\n className\n )}\n {...props}\n />\n );\n}\n\nconst fieldVariants = cva('group/field flex w-full gap-3 data-[invalid=true]:text-destructive', {\n variants: {\n orientation: {\n vertical: ['flex-col [&>*]:w-full [&>.sr-only]:w-auto'],\n horizontal: [\n 'flex-row items-center',\n '[&>[data-slot=field-label]]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start',\n 'has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col [&>*]:w-full [&>.sr-only]:w-auto',\n '@md/field-group:flex-row',\n '@md/field-group:items-center',\n '@md/field-group:[&>*]:w-auto',\n '@md/field-group:[&>[data-slot=field-label]]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start',\n '@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\nfunction Field({ className, orientation = 'vertical', ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) {\n return <div data-slot=\"field\" data-orientation={orientation} className={cn(fieldVariants({ orientation }), className)} {...props} />;\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"field-content\" className={cn('group/field-content flex basis-2/5 flex-col gap-1.5 leading-snug', className)} {...props} />;\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug',\n 'group-data-[disabled=true]/field:opacity-50',\n 'has-[>[data-slot=field]]:w-full',\n 'has-[>[data-slot=field]]:flex-col',\n 'has-[>[data-slot=field]]:rounded-md',\n 'has-[>[data-slot=field]]:border',\n '[&>*]:data-[slot=field]:p-4',\n 'has-data-[state=checked]:bg-primary/5',\n 'has-data-[state=checked]:border-primary',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn('flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50', className)}\n {...props}\n />\n );\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n 'text-text-positive-weak text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span className=\"bg-background text-text-positive-weak relative mx-auto block w-fit px-2\" data-slot=\"field-separator-content\">\n {children}\n </span>\n )}\n </div>\n );\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return errors[0].message;\n }\n\n return <ul className=\"ml-4 flex list-disc flex-col gap-1\">{errors.map(error => error?.message && <li key={error.message}>{error.message}</li>)}</ul>;\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div role=\"alert\" data-slot=\"field-error\" className={cn('text-danger text-sm font-normal', className)} {...props}>\n {content}\n </div>\n );\n}\n\nexport { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle };\n"],"mappings":"qRAUA,SAAS,EAAS,CAAE,YAAW,GAAG,GAA2C,CAC3E,OACE,EAAC,WAAA,CACC,YAAU,YACV,UAAW,EAAG,sBAAuB,+EAAgF,EAAU,CAC/H,GAAI,GACJ,CAIN,SAAS,EAAY,CAAE,YAAW,UAAU,SAAU,GAAG,GAA4E,CACnI,OACE,EAAC,SAAA,CACC,YAAU,eACV,eAAc,EACd,UAAW,EAAG,mBAAoB,kCAAmC,+BAAgC,EAAU,CAC/G,GAAI,GACJ,CAIN,SAAS,EAAW,CAAE,YAAW,GAAG,GAAsC,CACxE,OACE,EAAC,MAAA,CACC,YAAU,cACV,UAAW,EACT,yIACA,EACD,CACD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U,0BACjG,YACI,CAAA,EAEL,CAIV,SAAS,EAAW,CAClB,YACA,WACA,SACA,GAAG,GAGF,CACD,IAAM,EAAU,MACV,IAIC,EAID,GAAQ,SAAW,GAAK,EAAO,IAAI,QAC9B,EAAO,GAAG,QAGZ,EAAC,KAAA,CAAG,UAAU,8CAAsC,EAAO,IAAI,GAAS,GAAO,SAAW,EAAC,KAAA,CAAA,SAAwB,EAAM,QAAA,CAAtB,EAAM,QAA6B,CAAC,EAAM,CAP3I,MAQR,CAAC,EAAU,EAAO,CAAC,CAMtB,OAJK,EAKH,EAAC,MAAA,CAAI,KAAK,QAAQ,YAAU,cAAc,UAAW,EAAG,kCAAmC,EAAU,CAAE,GAAI,WACxG,GACG,CANC"}
@@ -1,2 +1,2 @@
1
- import{Field as e,FieldDescription as t,FieldLabel as n}from"./field-CGacT8J3.js";import{cn as r}from"@customafk/react-toolkit/utils";import{createContext as i,useContext as a,useId as o}from"react";import{jsx as s}from"react/jsx-runtime";import{Slot as c}from"radix-ui";import{Controller as l,FormProvider as u,useFormContext as d,useFormState as f}from"react-hook-form";const p=u,m=i({}),h=({...e})=>s(m.Provider,{value:{name:e.name},children:s(l,{...e})}),g=()=>{let e=a(m),t=a(_),{getFieldState:n,control:r,resetField:i}=d(),o=f({name:e.name}),s=n(e.name,o);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:c}=t;return{id:c,control:r,resetField:i,name:e.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...s}},_=i({});function v({className:t,...n}){let r=o();return s(_.Provider,{value:{id:r},children:s(e,{orientation:`responsive`,...n})})}function y({...e}){let{formItemId:t}=g();return s(n,{htmlFor:t,...e})}function b({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=g();return s(c.Slot,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function x({className:e,...n}){let{formDescriptionId:i}=g();return s(t,{id:i,className:r(`text-text-positive-weak text-sm leading-normal font-normal`,`group-has-[[data-orientation=horizontal]]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...n})}function S({className:e,children:t,...n}){let{error:i,formMessageId:a}=g();return s(`span`,{"data-slot":`form-message`,id:a,className:r(`text-danger text-xs`,e),...n,children:i?String(i?.message??``):t})}export{p as Form,b as FormControl,x as FormDescription,h as FormField,v as FormItem,y as FormLabel,S as FormMessage,g as useFormField};
2
- //# sourceMappingURL=form-B_tL9lO4.js.map
1
+ import{Field as e,FieldDescription as t,FieldLabel as n}from"./field-GVRRZiSk.js";import{cn as r}from"@customafk/react-toolkit/utils";import{createContext as i,useContext as a,useId as o}from"react";import{jsx as s}from"react/jsx-runtime";import{Slot as c}from"radix-ui";import{Controller as l,FormProvider as u,useFormContext as d,useFormState as f}from"react-hook-form";const p=u,m=i({}),h=({...e})=>s(m.Provider,{value:{name:e.name},children:s(l,{...e})}),g=()=>{let e=a(m),t=a(_),{getFieldState:n,control:r,resetField:i}=d(),o=f({name:e.name}),s=n(e.name,o);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:c}=t;return{id:c,control:r,resetField:i,name:e.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...s}},_=i({});function v({className:t,...n}){let r=o();return s(_.Provider,{value:{id:r},children:s(e,{orientation:`responsive`,...n})})}function y({...e}){let{formItemId:t}=g();return s(n,{htmlFor:t,...e})}function b({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=g();return s(c.Slot,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function x({className:e,...n}){let{formDescriptionId:i}=g();return s(t,{id:i,className:r(`text-text-positive-weak text-sm leading-normal font-normal`,`group-has-[[data-orientation=horizontal]]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...n})}function S({className:e,children:t,...n}){let{error:i,formMessageId:a}=g();return s(`span`,{"data-slot":`form-message`,id:a,className:r(`text-danger text-xs`,e),...n,children:i?String(i?.message??``):t})}export{p as Form,b as FormControl,x as FormDescription,h as FormField,v as FormItem,y as FormLabel,S as FormMessage,g as useFormField};
2
+ //# sourceMappingURL=form-De64-oXe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-B_tL9lO4.js","names":["SlotPrimitive"],"sources":["../packages/components/ui/form.tsx"],"sourcesContent":["'use client';\nimport { createContext, useContext, useId } from 'react';\nimport type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';\nimport { Controller, FormProvider, useFormContext, useFormState } from 'react-hook-form';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { type Label as LabelPrimitive, Slot as SlotPrimitive } from 'radix-ui';\nimport { Field, FieldDescription, FieldLabel } from './field';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState, control, resetField } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n control,\n resetField,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <Field orientation=\"responsive\" {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { formItemId } = useFormField();\n return <FieldLabel htmlFor={formItemId} {...props} />;\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <SlotPrimitive.Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <FieldDescription\n id={formDescriptionId}\n className={cn(\n 'text-text-positive-weak text-sm leading-normal font-normal',\n 'group-has-[[data-orientation=horizontal]]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, children, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n\n return (\n <span data-slot=\"form-message\" id={formMessageId} className={cn('text-danger text-xs', className)} {...props}>\n {error ? String(error?.message ?? '') : children}\n </span>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };\n"],"mappings":"oXAUA,MAAM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AE5C,OACE,EAAC,EAAA,CACC,GAAI,EACJ,UAAW,EACT,6DACA,+DACA,+DACA,oEACA,EACD,CACD,GAAI,GACJ,CAIN,SAAS,EAAY,CAAE,YAAW,WAAU,GAAG,GAAoC,CACjF,GAAM,CAAE,QAAO,iBAAkB,GAAc,CAE/C,OACE,EAAC,OAAA,CAAK,YAAU,eAAe,GAAI,EAAe,UAAW,EAAG,sBAAuB,EAAU,CAAE,GAAI,WACpG,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,GACnC"}
1
+ {"version":3,"file":"form-De64-oXe.js","names":["SlotPrimitive"],"sources":["../packages/components/ui/form.tsx"],"sourcesContent":["'use client';\nimport { createContext, useContext, useId } from 'react';\nimport type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';\nimport { Controller, FormProvider, useFormContext, useFormState } from 'react-hook-form';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { type Label as LabelPrimitive, Slot as SlotPrimitive } from 'radix-ui';\nimport { Field, FieldDescription, FieldLabel } from './field';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState, control, resetField } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n control,\n resetField,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <Field orientation=\"responsive\" {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { formItemId } = useFormField();\n return <FieldLabel htmlFor={formItemId} {...props} />;\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <SlotPrimitive.Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <FieldDescription\n id={formDescriptionId}\n className={cn(\n 'text-text-positive-weak text-sm leading-normal font-normal',\n 'group-has-[[data-orientation=horizontal]]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, children, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n\n return (\n <span data-slot=\"form-message\" id={formMessageId} className={cn('text-danger text-xs', className)} {...props}>\n {error ? String(error?.message ?? '') : children}\n </span>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };\n"],"mappings":"oXAUA,MAAM,EAA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,OACE,EAAC,EAAA,CACC,GAAI,EACJ,UAAW,EACT,6DACA,+DACA,+DACA,oEACA,EACD,CACD,GAAI,GACJ,CAIN,SAAS,EAAY,CAAE,YAAW,WAAU,GAAG,GAAoC,CACjF,GAAM,CAAE,QAAO,iBAAkB,GAAc,CAE/C,OACE,EAAC,OAAA,CAAK,YAAU,eAAe,GAAI,EAAe,UAAW,EAAG,sBAAuB,EAAU,CAAE,GAAI,WACpG,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,GACnC"}
@@ -1,2 +1,2 @@
1
- const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./field-A43YZ5Wj.cjs`);let n=require(`@customafk/react-toolkit/utils`);n=e.__toESM(n);let r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`);i=e.__toESM(i);let a=require(`radix-ui`);a=e.__toESM(a);let o=require(`react-hook-form`);o=e.__toESM(o);const s=o.FormProvider,c=(0,r.createContext)({}),l=({...e})=>(0,i.jsx)(c.Provider,{value:{name:e.name},children:(0,i.jsx)(o.Controller,{...e})}),u=()=>{let e=(0,r.useContext)(c),t=(0,r.useContext)(d),{getFieldState:n,control:i,resetField:a}=(0,o.useFormContext)(),s=(0,o.useFormState)({name:e.name}),l=n(e.name,s);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:u}=t;return{id:u,control:i,resetField:a,name:e.name,formItemId:`${u}-form-item`,formDescriptionId:`${u}-form-item-description`,formMessageId:`${u}-form-item-message`,...l}},d=(0,r.createContext)({});function f({className:e,...n}){let a=(0,r.useId)();return(0,i.jsx)(d.Provider,{value:{id:a},children:(0,i.jsx)(t.Field,{orientation:`responsive`,...n})})}function p({...e}){let{formItemId:n}=u();return(0,i.jsx)(t.FieldLabel,{htmlFor:n,...e})}function m({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:o}=u();return(0,i.jsx)(a.Slot.Slot,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${o}`:`${r}`,"aria-invalid":!!t,...e})}function h({className:e,...r}){let{formDescriptionId:a}=u();return(0,i.jsx)(t.FieldDescription,{id:a,className:(0,n.cn)(`text-text-positive-weak text-sm leading-normal font-normal`,`group-has-[[data-orientation=horizontal]]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...r})}function g({className:e,children:t,...r}){let{error:a,formMessageId:o}=u();return(0,i.jsx)(`span`,{"data-slot":`form-message`,id:o,className:(0,n.cn)(`text-danger text-xs`,e),...r,children:a?String(a?.message??``):t})}Object.defineProperty(exports,`Form`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`FormControl`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`FormDescription`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`FormField`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`FormItem`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`FormLabel`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`FormMessage`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`useFormField`,{enumerable:!0,get:function(){return u}});
2
- //# sourceMappingURL=form-DV9tQbiO.cjs.map
1
+ const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./field-DWOm17T1.cjs`);let n=require(`@customafk/react-toolkit/utils`);n=e.__toESM(n);let r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`);i=e.__toESM(i);let a=require(`radix-ui`);a=e.__toESM(a);let o=require(`react-hook-form`);o=e.__toESM(o);const s=o.FormProvider,c=(0,r.createContext)({}),l=({...e})=>(0,i.jsx)(c.Provider,{value:{name:e.name},children:(0,i.jsx)(o.Controller,{...e})}),u=()=>{let e=(0,r.useContext)(c),t=(0,r.useContext)(d),{getFieldState:n,control:i,resetField:a}=(0,o.useFormContext)(),s=(0,o.useFormState)({name:e.name}),l=n(e.name,s);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:u}=t;return{id:u,control:i,resetField:a,name:e.name,formItemId:`${u}-form-item`,formDescriptionId:`${u}-form-item-description`,formMessageId:`${u}-form-item-message`,...l}},d=(0,r.createContext)({});function f({className:e,...n}){let a=(0,r.useId)();return(0,i.jsx)(d.Provider,{value:{id:a},children:(0,i.jsx)(t.Field,{orientation:`responsive`,...n})})}function p({...e}){let{formItemId:n}=u();return(0,i.jsx)(t.FieldLabel,{htmlFor:n,...e})}function m({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:o}=u();return(0,i.jsx)(a.Slot.Slot,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${o}`:`${r}`,"aria-invalid":!!t,...e})}function h({className:e,...r}){let{formDescriptionId:a}=u();return(0,i.jsx)(t.FieldDescription,{id:a,className:(0,n.cn)(`text-text-positive-weak text-sm leading-normal font-normal`,`group-has-[[data-orientation=horizontal]]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...r})}function g({className:e,children:t,...r}){let{error:a,formMessageId:o}=u();return(0,i.jsx)(`span`,{"data-slot":`form-message`,id:o,className:(0,n.cn)(`text-danger text-xs`,e),...r,children:a?String(a?.message??``):t})}Object.defineProperty(exports,`Form`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`FormControl`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`FormDescription`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`FormField`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`FormItem`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`FormLabel`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`FormMessage`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`useFormField`,{enumerable:!0,get:function(){return u}});
2
+ //# sourceMappingURL=form-rN5ezSn5.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-DV9tQbiO.cjs","names":["FormProvider","Controller","Field","FieldLabel","SlotPrimitive","FieldDescription"],"sources":["../packages/components/ui/form.tsx"],"sourcesContent":["'use client';\nimport { createContext, useContext, useId } from 'react';\nimport type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';\nimport { Controller, FormProvider, useFormContext, useFormState } from 'react-hook-form';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { type Label as LabelPrimitive, Slot as SlotPrimitive } from 'radix-ui';\nimport { Field, FieldDescription, FieldLabel } from './field';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState, control, resetField } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n control,\n resetField,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <Field orientation=\"responsive\" {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { formItemId } = useFormField();\n return <FieldLabel htmlFor={formItemId} {...props} />;\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <SlotPrimitive.Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <FieldDescription\n id={formDescriptionId}\n className={cn(\n 'text-text-positive-weak text-sm leading-normal font-normal',\n 'group-has-[[data-orientation=horizontal]]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, children, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n\n return (\n <span data-slot=\"form-message\" id={formMessageId} className={cn('text-danger text-xs', className)} {...props}>\n {error ? String(error?.message ?? '') : children}\n </span>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };\n"],"mappings":"0TAUA,MAAM,EAAOA,EAAAA,aAMP,GAAA,EAAA,EAAA,eAAwD,EAAE,CAA0B,CAEpF,GAA8H,CAClI,GAAG,MAGD,EAAA,EAAA,KAAC,EAAiB,SAAA,CAAS,MAAO,CAAE,KAAM,EAAM,KAAM,WACpD,EAAA,EAAA,KAACC,EAAAA,WAAAA,CAAW,GAAI,EAAA,CAAS,EACC,CAI1B,MAAqB,CACzB,IAAM,GAAA,EAAA,EAAA,YAA0B,EAAiB,CAC3C,GAAA,E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,oEACA,EACD,CACD,GAAI,GACJ,CAIN,SAAS,EAAY,CAAE,YAAW,WAAU,GAAG,GAAoC,CACjF,GAAM,CAAE,QAAO,iBAAkB,GAAc,CAE/C,OACE,EAAA,EAAA,KAAC,OAAA,CAAK,YAAU,eAAe,GAAI,EAAe,WAAA,EAAA,EAAA,IAAc,sBAAuB,EAAU,CAAE,GAAI,WACpG,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,GACnC"}
1
+ {"version":3,"file":"form-rN5ezSn5.cjs","names":["FormProvider","Controller","Field","FieldLabel","SlotPrimitive","FieldDescription"],"sources":["../packages/components/ui/form.tsx"],"sourcesContent":["'use client';\nimport { createContext, useContext, useId } from 'react';\nimport type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';\nimport { Controller, FormProvider, useFormContext, useFormState } from 'react-hook-form';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { type Label as LabelPrimitive, Slot as SlotPrimitive } from 'radix-ui';\nimport { Field, FieldDescription, FieldLabel } from './field';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState, control, resetField } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n control,\n resetField,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <Field orientation=\"responsive\" {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { formItemId } = useFormField();\n return <FieldLabel htmlFor={formItemId} {...props} />;\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <SlotPrimitive.Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <FieldDescription\n id={formDescriptionId}\n className={cn(\n 'text-text-positive-weak text-sm leading-normal font-normal',\n 'group-has-[[data-orientation=horizontal]]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, children, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n\n return (\n <span data-slot=\"form-message\" id={formMessageId} className={cn('text-danger text-xs', className)} {...props}>\n {error ? String(error?.message ?? '') : children}\n </span>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };\n"],"mappings":"0TAUA,MAAM,EAAOA,EA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,eACV,GAAI,EACJ,mBAAmB,EAAiC,GAAG,EAAkB,GAAG,IAAjD,GAAG,IAC9B,eAAc,CAAC,CAAC,EAChB,GAAI,GACJ,CAIN,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAoC,CAC3E,GAAM,CAAE,qBAAsB,GAAc,CAE5C,OACE,EAAA,EAAA,KAACC,EAAAA,iBAAAA,CACC,GAAI,EACJ,WAAA,EAAA,EAAA,IACE,6DACA,+DACA,+DACA,oEACA,EACD,CACD,GAAI,GACJ,CAIN,SAAS,EAAY,CAAE,YAAW,WAAU,GAAG,GAAoC,CACjF,GAAM,CAAE,QAAO,iBAAkB,GAAc,CAE/C,OACE,EAAA,EAAA,KAAC,OAAA,CAAK,YAAU,eAAe,GAAI,EAAe,WAAA,EAAA,EAAA,IAAc,sBAAuB,EAAU,CAAE,GAAI,WACpG,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,GACnC"}
@@ -1,2 +1,2 @@
1
- const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./error-dialog-COl3CQ1E.cjs`),n=require(`./field-A43YZ5Wj.cjs`),r=require(`./form-DV9tQbiO.cjs`);let i=require(`lucide-react`);i=e.__toESM(i);let a=require(`react`);a=e.__toESM(a);let o=require(`react/jsx-runtime`);o=e.__toESM(o);let s=require(`react-hook-form`);s=e.__toESM(s);let c=require(`@hookform/error-message`);c=e.__toESM(c);const l=({form:e,isResetAfterSubmit:l=!0,title:u,description:d,className:f,onSubmit:p,onError:m,onSubcribe:h,children:g})=>{let _=(0,s.useForm)({...e,criteriaMode:`all`}),{formState:v,reset:y,handleSubmit:b,subscribe:x}=_,{dirtyFields:S}=v,[C,w]=(0,a.useState)(!1),T=(0,a.useCallback)(e=>{p(e,v,S),l&&y()},[S,v,l,p,y]),E=(0,a.useCallback)(e=>{Object.keys(e).length!==0&&(m?.(e),w(!0))},[m]);return(0,a.useEffect)(()=>{if(!h)return;let e=x({formState:{values:!0},callback:({values:e})=>{h(e)}});return()=>e()},[h,x]),(0,o.jsxs)(r.Form,{..._,children:[(0,o.jsx)(`form`,{className:f,onSubmit:b(T,E),children:(0,o.jsxs)(n.FieldSet,{children:[(0,o.jsxs)(a.Activity,{mode:u||d?`visible`:`hidden`,children:[(0,o.jsx)(n.FieldLegend,{children:u}),(0,o.jsx)(n.FieldDescription,{children:d}),(0,o.jsx)(n.FieldSeparator,{})]}),(0,o.jsx)(n.FieldGroup,{children:g})]})}),(0,o.jsx)(t.ErrorDialog,{open:C,title:`Lỗi nhập dữ liệu`,description:`An unexpected error has occurred. Please check the errors below and try again.`,onOpenChange:w,children:C&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.Activity,{mode:Object.keys(v.errors).length>0?`visible`:`hidden`,children:(0,o.jsxs)(`div`,{className:`flex max-w-100 flex-col gap-2 px-4`,children:[(0,o.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,o.jsx)(`div`,{className:`flex flex-col space-y-1`,children:Object.entries(v.errors).map(([e])=>(0,o.jsx)(c.ErrorMessage,{errors:v.errors,name:e,render:({messages:e})=>e?(0,o.jsx)(o.Fragment,{children:Object.entries(e).map(([e,t])=>(0,o.jsxs)(`div`,{className:`text-accent-foreground flex items-start gap-x-1 truncate text-sm font-normal`,children:[(0,o.jsx)(i.AlertCircleIcon,{size:16,className:`text-destructive mt-0.5 min-w-4 flex-0`}),(0,o.jsx)(`p`,{className:`line-clamp-2 flex-1 text-wrap`,children:t})]},e))}):null},e))})]})}),(0,o.jsx)(a.Activity,{mode:Object.keys(v.errors).length===0?`visible`:`hidden`,children:(0,o.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No errors found.`})})]})})]})};Object.defineProperty(exports,`FormWrapper`,{enumerable:!0,get:function(){return l}});
2
- //# sourceMappingURL=form-wrapper-CXrhlLBL.cjs.map
1
+ const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./error-dialog-COl3CQ1E.cjs`),n=require(`./field-DWOm17T1.cjs`),r=require(`./form-rN5ezSn5.cjs`);let i=require(`lucide-react`);i=e.__toESM(i);let a=require(`react`);a=e.__toESM(a);let o=require(`react/jsx-runtime`);o=e.__toESM(o);let s=require(`react-hook-form`);s=e.__toESM(s);let c=require(`@hookform/error-message`);c=e.__toESM(c);const l=({form:e,isResetAfterSubmit:l=!0,title:u,description:d,className:f,onSubmit:p,onError:m,onSubcribe:h,children:g})=>{let _=(0,s.useForm)({...e,criteriaMode:`all`}),{formState:v,reset:y,handleSubmit:b,subscribe:x}=_,{dirtyFields:S}=v,[C,w]=(0,a.useState)(!1),T=(0,a.useCallback)(e=>{p(e,v,S),l&&y()},[S,v,l,p,y]),E=(0,a.useCallback)(e=>{Object.keys(e).length!==0&&(m?.(e),w(!0))},[m]);return(0,a.useEffect)(()=>{if(!h)return;let e=x({formState:{values:!0},callback:({values:e})=>{h(e)}});return()=>e()},[h,x]),(0,o.jsxs)(r.Form,{..._,children:[(0,o.jsx)(`form`,{className:f,onSubmit:b(T,E),children:(0,o.jsxs)(n.FieldSet,{children:[(0,o.jsxs)(a.Activity,{mode:u||d?`visible`:`hidden`,children:[(0,o.jsx)(n.FieldLegend,{children:u}),(0,o.jsx)(n.FieldDescription,{children:d}),(0,o.jsx)(n.FieldSeparator,{})]}),(0,o.jsx)(n.FieldGroup,{children:g})]})}),(0,o.jsx)(t.ErrorDialog,{open:C,title:`Lỗi nhập dữ liệu`,description:`An unexpected error has occurred. Please check the errors below and try again.`,onOpenChange:w,children:C&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.Activity,{mode:Object.keys(v.errors).length>0?`visible`:`hidden`,children:(0,o.jsxs)(`div`,{className:`flex max-w-100 flex-col gap-2 px-4`,children:[(0,o.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,o.jsx)(`div`,{className:`flex flex-col space-y-1`,children:Object.entries(v.errors).map(([e])=>(0,o.jsx)(c.ErrorMessage,{errors:v.errors,name:e,render:({messages:e})=>e?(0,o.jsx)(o.Fragment,{children:Object.entries(e).map(([e,t])=>(0,o.jsxs)(`div`,{className:`text-accent-foreground flex items-start gap-x-1 truncate text-sm font-normal`,children:[(0,o.jsx)(i.AlertCircleIcon,{size:16,className:`text-destructive mt-0.5 min-w-4 flex-0`}),(0,o.jsx)(`p`,{className:`line-clamp-2 flex-1 text-wrap`,children:t})]},e))}):null},e))})]})}),(0,o.jsx)(a.Activity,{mode:Object.keys(v.errors).length===0?`visible`:`hidden`,children:(0,o.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No errors found.`})})]})})]})};Object.defineProperty(exports,`FormWrapper`,{enumerable:!0,get:function(){return l}});
2
+ //# sourceMappingURL=form-wrapper-A1DZnRIF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-wrapper-CXrhlLBL.cjs","names":["Form","FieldSet","Activity","FieldLegend","FieldDescription","FieldSeparator","FieldGroup","ErrorDialog","ErrorMessage","AlertCircleIcon"],"sources":["../packages/components/forms/form-wrapper.tsx"],"sourcesContent":["import { Activity, useCallback, useEffect, useState } from 'react';\nimport { type FieldValues, type FormState, type SubmitErrorHandler, type SubmitHandler, type UseFormProps, useForm } from 'react-hook-form';\n\nimport { AlertCircleIcon } from 'lucide-react';\n\nimport { ErrorMessage } from '@hookform/error-message';\nimport type { AnyEntity } from '@/types';\nimport { ErrorDialog } from '../dialogs/error-dialog';\nimport { FieldDescription, FieldGroup, FieldLegend, FieldSeparator, FieldSet } from '../ui/field';\nimport { Form } from '../ui/form';\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n form: UseFormProps<TFieldValues>;\n isResetAfterSubmit?: boolean;\n title?: string;\n description?: string;\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 title,\n description,\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] = useState<boolean>(false);\n\n const handleFormSubmit = 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 = 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 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 <FieldSet>\n <Activity mode={title || description ? 'visible' : 'hidden'}>\n <FieldLegend>{title}</FieldLegend>\n <FieldDescription>{description}</FieldDescription>\n <FieldSeparator />\n </Activity>\n <FieldGroup>{children}</FieldGroup>\n </FieldSet>\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 <Activity mode={Object.keys(formState.errors).length > 0 ? 'visible' : 'hidden'}>\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 if (!messages) return null;\n return (\n <>\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 </>\n );\n }}\n />\n ))}\n </div>\n </div>\n </Activity>\n <Activity mode={Object.keys(formState.errors).length === 0 ? 'visible' : 'hidden'}>\n <p className=\"text-muted-foreground text-sm\">No errors found.</p>\n </Activity>\n </>\n )}\n </ErrorDialog>\n </Form>\n );\n};\n"],"mappings":"iYAsBA,MAAa,GAA+D,CAC1E,KAAM,EACN,qBAAqB,GACrB,QACA,cACA,YACA,WACA,UACA,aACA,cACkD,CAClD,IAAM,GAAA,EAAA,EAAA,SAAe,CACnB,GAAG,EACH,aAAc,MACf,CAAC,CAEI,CAAE,YAAW,QAAO,eAAc,aAAc,EAChD,CAAE,eAAgB,EAElB,CAAC,EAAW,IAAA,EAAA,EAAA,UAAkC,GAAM,CAEpD,GAAA,EAAA,EAAA,aACJ,GAAQ,CACN,EAAS,EAAM,EAAW,EAAY,CAClC,GACF,GAAO,EAGX,CAAC,EAAa,EAAW,EAAoB,EAAU,EAAM,CAC9D,CAEK,GAAA,EAAA,EAAA,aACJ,GAAU,CACU,OAAO,KAAK,EAAO,CACvB,SAAW,IACzB,IAAU,EAAO,CACjB,EAAa,GAAK,GAEpB,CAAC,EAAQ,CACV,CAaD,OAXA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAY,OACjB,IAAM,EAAW,EAAU,CACzB,UAAW,CAAE,OAAQ,GAAM,CAC3B,UAAW,CAAE,YAAa,CACxB,EAAW,EAAO,EAErB,CAAC,CACF,UAAa,GAAU,EACtB,CAAC,EAAY,EAAU,CAAC,EA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CAA2C,EAChF,EAAA,EAAA,KAAC,IAAA,CAAE,UAAU,yCAAiC,GAAY,CAAA,EAFlD,EAGJ,CAER,CAAA,CACD,CAXiB,MAJnB,EAkBL,CACF,EACE,CAAA,EACF,EACG,EACX,EAAA,EAAA,KAACP,EAAAA,SAAAA,CAAS,KAAM,OAAO,KAAK,EAAU,OAAO,CAAC,SAAW,EAAI,UAAY,mBACvE,EAAA,EAAA,KAAC,IAAA,CAAE,UAAU,yCAAgC,oBAAoB,EACxD,CAAA,CAAA,CACV,EAEO,CAAA,EACT"}
1
+ {"version":3,"file":"form-wrapper-A1DZnRIF.cjs","names":["Form","FieldSet","Activity","FieldLegend","FieldDescription","FieldSeparator","FieldGroup","ErrorDialog","ErrorMessage","AlertCircleIcon"],"sources":["../packages/components/forms/form-wrapper.tsx"],"sourcesContent":["import { Activity, useCallback, useEffect, useState } from 'react';\nimport { type FieldValues, type FormState, type SubmitErrorHandler, type SubmitHandler, type UseFormProps, useForm } from 'react-hook-form';\n\nimport { AlertCircleIcon } from 'lucide-react';\n\nimport { ErrorMessage } from '@hookform/error-message';\nimport type { AnyEntity } from '@/types';\nimport { ErrorDialog } from '../dialogs/error-dialog';\nimport { FieldDescription, FieldGroup, FieldLegend, FieldSeparator, FieldSet } from '../ui/field';\nimport { Form } from '../ui/form';\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n form: UseFormProps<TFieldValues>;\n isResetAfterSubmit?: boolean;\n title?: string;\n description?: string;\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 title,\n description,\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] = useState<boolean>(false);\n\n const handleFormSubmit = 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 = 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 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 <FieldSet>\n <Activity mode={title || description ? 'visible' : 'hidden'}>\n <FieldLegend>{title}</FieldLegend>\n <FieldDescription>{description}</FieldDescription>\n <FieldSeparator />\n </Activity>\n <FieldGroup>{children}</FieldGroup>\n </FieldSet>\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 <Activity mode={Object.keys(formState.errors).length > 0 ? 'visible' : 'hidden'}>\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 if (!messages) return null;\n return (\n <>\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 </>\n );\n }}\n />\n ))}\n </div>\n </div>\n </Activity>\n <Activity mode={Object.keys(formState.errors).length === 0 ? 'visible' : 'hidden'}>\n <p className=\"text-muted-foreground text-sm\">No errors found.</p>\n </Activity>\n </>\n )}\n </ErrorDialog>\n </Form>\n );\n};\n"],"mappings":"iYAsBA,MAAa,GAA+D,CAC1E,KAAM,EACN,qBAAqB,GACrB,QACA,cACA,YACA,WACA,UACA,aACA,cACkD,CAClD,IAAM,GAAA,EAAA,EAAA,SAAe,CACnB,GAAG,EACH,aAAc,MACf,CAAC,CAEI,CAAE,YAAW,QAAO,eAAc,aAAc,EAChD,CAAE,eAAgB,EAElB,CAAC,EAAW,IAAA,EAAA,EAAA,UAAkC,GAAM,CAEpD,GAAA,EAAA,EAAA,aACJ,GAAQ,CACN,EAAS,EAAM,EAAW,EAAY,CAClC,GACF,GAAO,EAGX,CAAC,EAAa,EAAW,EAAoB,EAAU,EAAM,CAC9D,CAEK,GAAA,EAAA,EAAA,aACJ,GAAU,CACU,OAAO,KAAK,EAAO,CACvB,SAAW,IACzB,IAAU,EAAO,CACjB,EAAa,GAAK,GAEpB,CAAC,EAAQ,CACV,CAaD,OAXA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAY,OACjB,IAAM,EAAW,EAAU,CACzB,UAAW,CAAE,OAAQ,GAAM,CAC3B,UAAW,CAAE,YAAa,CACxB,EAAW,EAAO,EAErB,CAAC,CACF,UAAa,GAAU,EACtB,CAAC,EAAY,EAAU,CAAC,EAGzB,EAAA,EAAA,MAACA,EAAAA,KAAAA,CAAK,GAAI,aACR,EAAA,EAAA,KAAC,OAAA,CAAgB,YAAW,SAAU,EAAa,EAAkB,EAAgB,WACnF,EAAA,EAAA,MAACC,EAAAA,SAAAA,CAAAA,SAAAA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EAAAA,SAAAA,CAAS,KAAM,OAAO,KAAK,EAAU,OAAO,CAAC,SAAW,EAAI,UAAY,mBACvE,EAAA,EAAA,KAAC,IAAA,CAAE,UAAU,yCAAgC,oBAAoB,EACxD,CAAA,CAAA,CACV,EAEO,CAAA,EACT"}
@@ -1,2 +1,2 @@
1
- import{ErrorDialog as e}from"./error-dialog-BLiYMBlh.js";import{FieldDescription as t,FieldGroup as n,FieldLegend as r,FieldSeparator as i,FieldSet as a}from"./field-CGacT8J3.js";import{Form as o}from"./form-B_tL9lO4.js";import{AlertCircleIcon as s}from"lucide-react";import{Activity as c,useCallback as l,useEffect as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{useForm as h}from"react-hook-form";import{ErrorMessage as g}from"@hookform/error-message";const _=({form:_,isResetAfterSubmit:v=!0,title:y,description:b,className:x,onSubmit:S,onError:C,onSubcribe:w,children:T})=>{let E=h({..._,criteriaMode:`all`}),{formState:D,reset:O,handleSubmit:k,subscribe:A}=E,{dirtyFields:j}=D,[M,N]=d(!1),P=l(e=>{S(e,D,j),v&&O()},[j,D,v,S,O]),F=l(e=>{Object.keys(e).length!==0&&(C?.(e),N(!0))},[C]);return u(()=>{if(!w)return;let e=A({formState:{values:!0},callback:({values:e})=>{w(e)}});return()=>e()},[w,A]),m(o,{...E,children:[p(`form`,{className:x,onSubmit:k(P,F),children:m(a,{children:[m(c,{mode:y||b?`visible`:`hidden`,children:[p(r,{children:y}),p(t,{children:b}),p(i,{})]}),p(n,{children:T})]})}),p(e,{open:M,title:`Lỗi nhập dữ liệu`,description:`An unexpected error has occurred. Please check the errors below and try again.`,onOpenChange:N,children:M&&m(f,{children:[p(c,{mode:Object.keys(D.errors).length>0?`visible`:`hidden`,children:m(`div`,{className:`flex max-w-100 flex-col gap-2 px-4`,children:[p(`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:`}),p(`div`,{className:`flex flex-col space-y-1`,children:Object.entries(D.errors).map(([e])=>p(g,{errors:D.errors,name:e,render:({messages:e})=>e?p(f,{children:Object.entries(e).map(([e,t])=>m(`div`,{className:`text-accent-foreground flex items-start gap-x-1 truncate text-sm font-normal`,children:[p(s,{size:16,className:`text-destructive mt-0.5 min-w-4 flex-0`}),p(`p`,{className:`line-clamp-2 flex-1 text-wrap`,children:t})]},e))}):null},e))})]})}),p(c,{mode:Object.keys(D.errors).length===0?`visible`:`hidden`,children:p(`p`,{className:`text-muted-foreground text-sm`,children:`No errors found.`})})]})})]})};export{_ as FormWrapper};
2
- //# sourceMappingURL=form-wrapper-Cw_ARA0-.js.map
1
+ import{ErrorDialog as e}from"./error-dialog-BLiYMBlh.js";import{FieldDescription as t,FieldGroup as n,FieldLegend as r,FieldSeparator as i,FieldSet as a}from"./field-GVRRZiSk.js";import{Form as o}from"./form-De64-oXe.js";import{AlertCircleIcon as s}from"lucide-react";import{Activity as c,useCallback as l,useEffect as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{useForm as h}from"react-hook-form";import{ErrorMessage as g}from"@hookform/error-message";const _=({form:_,isResetAfterSubmit:v=!0,title:y,description:b,className:x,onSubmit:S,onError:C,onSubcribe:w,children:T})=>{let E=h({..._,criteriaMode:`all`}),{formState:D,reset:O,handleSubmit:k,subscribe:A}=E,{dirtyFields:j}=D,[M,N]=d(!1),P=l(e=>{S(e,D,j),v&&O()},[j,D,v,S,O]),F=l(e=>{Object.keys(e).length!==0&&(C?.(e),N(!0))},[C]);return u(()=>{if(!w)return;let e=A({formState:{values:!0},callback:({values:e})=>{w(e)}});return()=>e()},[w,A]),m(o,{...E,children:[p(`form`,{className:x,onSubmit:k(P,F),children:m(a,{children:[m(c,{mode:y||b?`visible`:`hidden`,children:[p(r,{children:y}),p(t,{children:b}),p(i,{})]}),p(n,{children:T})]})}),p(e,{open:M,title:`Lỗi nhập dữ liệu`,description:`An unexpected error has occurred. Please check the errors below and try again.`,onOpenChange:N,children:M&&m(f,{children:[p(c,{mode:Object.keys(D.errors).length>0?`visible`:`hidden`,children:m(`div`,{className:`flex max-w-100 flex-col gap-2 px-4`,children:[p(`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:`}),p(`div`,{className:`flex flex-col space-y-1`,children:Object.entries(D.errors).map(([e])=>p(g,{errors:D.errors,name:e,render:({messages:e})=>e?p(f,{children:Object.entries(e).map(([e,t])=>m(`div`,{className:`text-accent-foreground flex items-start gap-x-1 truncate text-sm font-normal`,children:[p(s,{size:16,className:`text-destructive mt-0.5 min-w-4 flex-0`}),p(`p`,{className:`line-clamp-2 flex-1 text-wrap`,children:t})]},e))}):null},e))})]})}),p(c,{mode:Object.keys(D.errors).length===0?`visible`:`hidden`,children:p(`p`,{className:`text-muted-foreground text-sm`,children:`No errors found.`})})]})})]})};export{_ as FormWrapper};
2
+ //# sourceMappingURL=form-wrapper-CSmgFsG0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-wrapper-Cw_ARA0-.js","names":[],"sources":["../packages/components/forms/form-wrapper.tsx"],"sourcesContent":["import { Activity, useCallback, useEffect, useState } from 'react';\nimport { type FieldValues, type FormState, type SubmitErrorHandler, type SubmitHandler, type UseFormProps, useForm } from 'react-hook-form';\n\nimport { AlertCircleIcon } from 'lucide-react';\n\nimport { ErrorMessage } from '@hookform/error-message';\nimport type { AnyEntity } from '@/types';\nimport { ErrorDialog } from '../dialogs/error-dialog';\nimport { FieldDescription, FieldGroup, FieldLegend, FieldSeparator, FieldSet } from '../ui/field';\nimport { Form } from '../ui/form';\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n form: UseFormProps<TFieldValues>;\n isResetAfterSubmit?: boolean;\n title?: string;\n description?: string;\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 title,\n description,\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] = useState<boolean>(false);\n\n const handleFormSubmit = 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 = 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 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 <FieldSet>\n <Activity mode={title || description ? 'visible' : 'hidden'}>\n <FieldLegend>{title}</FieldLegend>\n <FieldDescription>{description}</FieldDescription>\n <FieldSeparator />\n </Activity>\n <FieldGroup>{children}</FieldGroup>\n </FieldSet>\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 <Activity mode={Object.keys(formState.errors).length > 0 ? 'visible' : 'hidden'}>\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 if (!messages) return null;\n return (\n <>\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 </>\n );\n }}\n />\n ))}\n </div>\n </div>\n </Activity>\n <Activity mode={Object.keys(formState.errors).length === 0 ? 'visible' : 'hidden'}>\n <p className=\"text-muted-foreground text-sm\">No errors found.</p>\n </Activity>\n </>\n )}\n </ErrorDialog>\n </Form>\n );\n};\n"],"mappings":"4fAsBA,MAAa,GAA+D,CAC1E,KAAM,EACN,qBAAqB,GACrB,QACA,cACA,YACA,WACA,UACA,aACA,cACkD,CAClD,IAAM,EAAO,EAAQ,CACnB,GAAG,EACH,aAAc,MACf,CAAC,CAEI,CAAE,YAAW,QAAO,eAAc,aAAc,EAChD,CAAE,eAAgB,EAElB,CAAC,EAAW,GAAgB,EAAkB,GAAM,CAEpD,EAAmB,EACvB,GAAQ,CACN,EAAS,EAAM,EAAW,EAAY,CAClC,GACF,GAAO,EAGX,CAAC,EAAa,EAAW,EAAoB,EAAU,EAAM,CAC9D,CAEK,EAAkB,EACtB,GAAU,CACU,OAAO,KAAK,EAAO,CACvB,SAAW,IACzB,IAAU,EAAO,CACjB,EAAa,GAAK,GAEpB,CAAC,EAAQ,CACV,CAaD,OAXA,MAAgB,CACd,GAAI,CAAC,EAAY,OACjB,IAAM,EAAW,EAAU,CACzB,UAAW,CAAE,OAAQ,GAAM,CAC3B,UAAW,CAAE,YAAa,CACxB,EAAW,EAAO,EAErB,CAAC,CACF,UAAa,GAAU,EACtB,CAAC,EAAY,EAAU,CAAC,CAGzB,EAAC,EAAA,CAAK,GAAI,YACR,EAAC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per.tsx"],"sourcesContent":["import { Activity, useCallback, useEffect, useState } from 'react';\nimport { type FieldValues, type FormState, type SubmitErrorHandler, type SubmitHandler, type UseFormProps, useForm } from 'react-hook-form';\n\nimport { AlertCircleIcon } from 'lucide-react';\n\nimport { ErrorMessage } from '@hookform/error-message';\nimport type { AnyEntity } from '@/types';\nimport { ErrorDialog } from '../dialogs/error-dialog';\nimport { FieldDescription, FieldGroup, FieldLegend, FieldSeparator, FieldSet } from '../ui/field';\nimport { Form } from '../ui/form';\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n form: UseFormProps<TFieldValues>;\n isResetAfterSubmit?: boolean;\n title?: string;\n description?: string;\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 title,\n description,\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] = useState<boolean>(false);\n\n const handleFormSubmit = 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 = 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 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 <FieldSet>\n <Activity mode={title || description ? 'visible' : 'hidden'}>\n <FieldLegend>{title}</FieldLegend>\n <FieldDescription>{description}</FieldDescription>\n <FieldSeparator />\n </Activity>\n <FieldGroup>{children}</FieldGroup>\n </FieldSet>\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 <Activity mode={Object.keys(formState.errors).length > 0 ? 'visible' : 'hidden'}>\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 if (!messages) return null;\n return (\n <>\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 </>\n );\n }}\n />\n ))}\n </div>\n </div>\n </Activity>\n <Activity mode={Object.keys(formState.errors).length === 0 ? 'visible' : 'hidden'}>\n <p className=\"text-muted-foreground text-sm\">No errors found.</p>\n </Activity>\n </>\n )}\n </ErrorDialog>\n </Form>\n );\n};\n"],"mappings":"4fAsBA,MAAa,GAA+D,CAC1E,KAAM,EACN,qBAAqB,GACrB,QACA,cACA,YACA,WACA,UACA,aACA,cACkD,CAClD,IAAM,EAAO,EAAQ,CACnB,GAAG,EACH,aAAc,MACf,CAAC,CAEI,CAAE,YAAW,QAAO,eAAc,a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ClB,KAAM,EACN,QAAS,CAAE,cACJ,EAEH,EAAA,EAAA,CAAA,SACG,OAAO,QAAQ,EAAS,CAAC,KAAK,CAAC,EAAM,KAElC,EAAC,MAAA,CAAe,UAAU,yFACxB,EAAC,EAAA,CAAgB,KAAM,GAAI,UAAU,0CAA2C,CAChF,EAAC,IAAA,CAAE,UAAU,yCAAiC,GAAY,CAAA,EAFlD,EAGJ,CAER,CAAA,CACD,CAXiB,MAJnB,EAkBL,CACF,EACE,CAAA,EACF,EACG,CACX,EAAC,EAAA,CAAS,KAAM,OAAO,KAAK,EAAU,OAAO,CAAC,SAAW,EAAI,UAAY,kBACvE,EAAC,IAAA,CAAE,UAAU,yCAAgC,oBAAoB,EACxD,CAAA,CAAA,CACV,EAEO,CAAA,EACT"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../dist-CAevLI5t.cjs`),require(`../button-variants-BHDyMRNh.cjs`);const t=require(`../button-BCahPWI8.cjs`);require(`../label-D6mAvVmw.cjs`),require(`../separator-DMMoR-d2.cjs`);const n=require(`../field-A43YZ5Wj.cjs`),r=require(`../form-DV9tQbiO.cjs`);require(`../dialog-BBODhbxh.cjs`);const i=require(`../command-C13pL2M3.cjs`),a=require(`../popover-D6vyPDKA.cjs`);let o=require(`lucide-react`);o=e.__toESM(o);let s=require(`@customafk/react-toolkit/utils`);s=e.__toESM(s);let c=require(`react`);c=e.__toESM(c);let l=require(`react/jsx-runtime`);l=e.__toESM(l);const u=({name:e,label:u=`Combobox`,placeholder:d=`Chọn một mục`,description:f,options:p,onAddNewItem:m})=>(0,l.jsx)(r.FormField,{name:e,render:({field:e})=>(0,l.jsxs)(r.FormItem,{className:`w-full`,children:[(0,l.jsx)(c.Activity,{mode:u||f?`visible`:`hidden`,children:(0,l.jsxs)(n.FieldContent,{children:[(0,l.jsx)(r.FormLabel,{children:u}),!!f&&(0,l.jsx)(r.FormDescription,{children:f})]})}),(0,l.jsxs)(a.Popover,{modal:!0,children:[(0,l.jsx)(a.PopoverTrigger,{asChild:!0,children:(0,l.jsx)(r.FormControl,{children:(0,l.jsxs)(t.Button,{type:`button`,variant:`outline`,role:`combobox`,color:`muted`,className:(0,s.cn)(`shadow-input flex justify-between rounded-md px-3`,`outline-border-weak font-normal`,`[&_div]:w-full`,`[&_div]:justify-between`,`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`),children:[e.value?(0,l.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:p?.find(({value:t})=>t===e.value)?.label}):(0,l.jsx)(`span`,{className:`text-text-positive-muted`,children:d}),(0,l.jsx)(o.ChevronDownIcon,{size:16,className:`text-text-positive-weak shrink-0`,"aria-hidden":`true`})]})})}),(0,l.jsx)(a.PopoverContent,{className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,l.jsxs)(i.Command,{className:`border-none`,children:[(0,l.jsx)(i.CommandInput,{placeholder:d??`Tìm kiếm`}),(0,l.jsxs)(i.CommandList,{children:[(0,l.jsx)(i.CommandGroup,{className:`max-h-40 overflow-y-auto`,children:p?.map(({value:t,label:n})=>(0,l.jsx)(i.CommandItem,{value:n,onSelect:()=>e.onChange(t),children:n},t))}),m&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i.CommandSeparator,{}),(0,l.jsx)(i.CommandGroup,{children:(0,l.jsxs)(t.Button,{type:`button`,variant:`ghost`,className:`w-full justify-start font-normal`,children:[(0,l.jsx)(o.PlusIcon,{size:14,className:`-ms-2 opacity-60`,"aria-hidden":`true`}),`Thêm mới`]})})]})]}),(0,l.jsx)(i.CommandEmpty,{children:`Không có kết quả`})]})})]})]})});exports.ComboboxField=u;
1
+ "use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../dist-CAevLI5t.cjs`),require(`../button-variants-BHDyMRNh.cjs`);const t=require(`../button-BCahPWI8.cjs`);require(`../label-D6mAvVmw.cjs`),require(`../separator-DMMoR-d2.cjs`);const n=require(`../field-DWOm17T1.cjs`),r=require(`../form-rN5ezSn5.cjs`);require(`../dialog-BBODhbxh.cjs`);const i=require(`../command-C13pL2M3.cjs`),a=require(`../popover-D6vyPDKA.cjs`);let o=require(`lucide-react`);o=e.__toESM(o);let s=require(`@customafk/react-toolkit/utils`);s=e.__toESM(s);let c=require(`react`);c=e.__toESM(c);let l=require(`react/jsx-runtime`);l=e.__toESM(l);const u=({name:e,label:u=`Combobox`,placeholder:d=`Chọn một mục`,description:f,options:p,onAddNewItem:m})=>(0,l.jsx)(r.FormField,{name:e,render:({field:e})=>(0,l.jsxs)(r.FormItem,{className:`w-full`,children:[(0,l.jsx)(c.Activity,{mode:u||f?`visible`:`hidden`,children:(0,l.jsxs)(n.FieldContent,{children:[(0,l.jsx)(r.FormLabel,{children:u}),!!f&&(0,l.jsx)(r.FormDescription,{children:f})]})}),(0,l.jsxs)(a.Popover,{modal:!0,children:[(0,l.jsx)(a.PopoverTrigger,{asChild:!0,children:(0,l.jsx)(r.FormControl,{children:(0,l.jsxs)(t.Button,{type:`button`,variant:`outline`,role:`combobox`,color:`muted`,className:(0,s.cn)(`w-full md:max-w-80`,`shadow-input flex justify-between rounded-md px-3`,`outline-border-weak font-normal`,`[&_div]:w-full`,`[&_div]:justify-between`,`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`),children:[e.value?(0,l.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:p?.find(({value:t})=>t===e.value)?.label}):(0,l.jsx)(`span`,{className:`text-text-positive-muted`,children:d}),(0,l.jsx)(o.ChevronDownIcon,{size:16,className:`text-text-positive-weak shrink-0`,"aria-hidden":`true`})]})})}),(0,l.jsx)(a.PopoverContent,{className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,l.jsxs)(i.Command,{className:`border-none`,children:[(0,l.jsx)(i.CommandInput,{placeholder:d??`Tìm kiếm`}),(0,l.jsxs)(i.CommandList,{children:[(0,l.jsx)(i.CommandGroup,{className:`max-h-40 overflow-y-auto`,children:p?.map(({value:t,label:n})=>(0,l.jsx)(i.CommandItem,{value:n,onSelect:()=>e.onChange(t),children:n},t))}),m&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i.CommandSeparator,{}),(0,l.jsx)(i.CommandGroup,{children:(0,l.jsxs)(t.Button,{type:`button`,variant:`ghost`,className:`w-full justify-start font-normal`,children:[(0,l.jsx)(o.PlusIcon,{size:14,className:`-ms-2 opacity-60`,"aria-hidden":`true`}),`Thêm mới`]})})]})]}),(0,l.jsx)(i.CommandEmpty,{children:`Không có kết quả`})]})})]})]})});exports.ComboboxField=u;
2
2
  //# sourceMappingURL=combobox-field.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-field.cjs","names":["FormField","FormItem","Activity","FieldContent","FormLabel","FormDescription","Popover","PopoverTrigger","FormControl","Button","ChevronDownIcon","PopoverContent","Command","CommandInput","CommandList","CommandGroup","CommandItem","label","CommandSeparator","PlusIcon","CommandEmpty"],"sources":["../../packages/components/forms/combobox-field.tsx"],"sourcesContent":["'use client';\nimport { Activity } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\nimport { ChevronDownIcon, PlusIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from '@/components/ui/command';\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel } from '@/components/ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';\nimport { FieldContent } from '../ui/field';\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>;\n label?: string;\n placeholder?: string;\n options?: { value: string | number; label: string }[];\n isShowErrorMsg?: boolean;\n modal?: boolean;\n description?: string;\n onAddNewItem?: () => void;\n};\n\nexport const ComboboxField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Combobox',\n placeholder = 'Chọn một mục',\n description,\n options,\n onAddNewItem,\n}: Props<TFieldValues>) => {\n return (\n <FormField\n name={name}\n render={({ field }) => {\n return (\n <FormItem className=\"w-full\">\n <Activity mode={label || description ? 'visible' : 'hidden'}>\n <FieldContent>\n <FormLabel>{label}</FormLabel>\n {!!description && <FormDescription>{description}</FormDescription>}\n </FieldContent>\n </Activity>\n <Popover modal={true}>\n <PopoverTrigger asChild>\n <FormControl>\n <Button\n type=\"button\"\n variant=\"outline\"\n role=\"combobox\"\n color=\"muted\"\n className={cn(\n 'shadow-input flex justify-between rounded-md px-3',\n 'outline-border-weak font-normal',\n '[&_div]:w-full',\n '[&_div]:justify-between',\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 )}\n >\n {field.value ? (\n <span className=\"flex min-w-0 items-center gap-2\">{options?.find(({ value }) => value === field.value)?.label}</span>\n ) : (\n <span className=\"text-text-positive-muted\">{placeholder}</span>\n )}\n <ChevronDownIcon size={16} className=\"text-text-positive-weak shrink-0\" aria-hidden=\"true\" />\n </Button>\n </FormControl>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\">\n <Command className=\"border-none\">\n <CommandInput placeholder={placeholder ?? 'Tìm kiếm'} />\n <CommandList>\n <CommandGroup className=\"max-h-40 overflow-y-auto\">\n {options?.map(({ value, label }) => (\n <CommandItem key={value} value={label} onSelect={() => field.onChange(value)}>\n {label}\n </CommandItem>\n ))}\n </CommandGroup>\n {onAddNewItem && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <Button type=\"button\" variant=\"ghost\" className=\"w-full justify-start font-normal\">\n <PlusIcon size={14} className=\"-ms-2 opacity-60\" aria-hidden=\"true\" />\n Thêm mới\n </Button>\n </CommandGroup>\n </>\n )}\n </CommandList>\n <CommandEmpty>Không có kết quả</CommandEmpty>\n </Command>\n </PopoverContent>\n </Popover>\n </FormItem>\n );\n }}\n />\n );\n};\n"],"mappings":"knBAyBA,MAAa,GAAiE,CAC5E,OACA,QAAQ,WACR,cAAc,eACd,cACA,UACA,mBAGE,EAAA,EAAA,KAACA,EAAAA,UAAAA,CACO,OACN,QAAS,CAAE,YAEP,EAAA,EAAA,MAACC,EAAAA,SAAAA,CAAS,UAAU,oBAClB,EAAA,EAAA,KAACC,EAAAA,SAAAA,CAAS,KAAM,GAAS,EAAc,UAAY,mBACjD,EAAA,EAAA,MAACC,EAAAA,aAAAA,CAAAA,SAAAA,EACC,EAAA,EAAA,KAACC,EAAAA,UAAAA,CAAAA,SAAW,EAAA,CAAkB,CAC7B,CAAC,CAAC,IAAe,EAAA,EAAA,KAACC,EAAAA,gBAAAA,CAAAA,SAAiB,EAAA,CAA8B,CAAA,CAAA,CACrD,EACN,EACX,EAAA,EAAA,MAACC,EAAAA,QAAAA,CAAQ,MAAO,cACd,EAAA,EAAA,KAACC,EAAAA,eAAAA,CAAe,QAAA,aACd,EAAA,EAAA,KAACC,EAAAA,YAAAA,CAAAA,UACC,EAAA,EAAA,MAACC,EAAAA,OAAAA,CACC,KAAK,SACL,QAAQ,UACR,KAAK,WACL,MAAM,QACN,WAAA,EAAA,EAAA,IACE,oDACA,kCACA,iBACA,0BACA,uBACA,6CACA,8BACA,2CACA,sCACA,2BACA,8BACA,eACA,0BACA,kBACA,+BACD,WAEA,EA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activity","FieldContent","FormLabel","FormDescription","Popover","PopoverTrigger","FormControl","Button","ChevronDownIcon","PopoverContent","Command","CommandInput","CommandList","CommandGroup","CommandItem","label","CommandSeparator","PlusIcon","CommandEmpty"],"sources":["../../packages/components/forms/combobox-field.tsx"],"sourcesContent":["'use client';\nimport { Activity } from 'react';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\nimport { ChevronDownIcon, PlusIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from '@/components/ui/command';\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel } from '@/components/ui/form';\nimport { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';\nimport { FieldContent } from '../ui/field';\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>;\n label?: string;\n placeholder?: string;\n options?: { value: string | number; label: string }[];\n isShowErrorMsg?: boolean;\n modal?: boolean;\n description?: string;\n onAddNewItem?: () => void;\n};\n\nexport const ComboboxField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Combobox',\n placeholder = 'Chọn một mục',\n description,\n options,\n onAddNewItem,\n}: Props<TFieldValues>) => {\n return (\n <FormField\n name={name}\n render={({ field }) => {\n return (\n <FormItem className=\"w-full\">\n <Activity mode={label || description ? 'visible' : 'hidden'}>\n <FieldContent>\n <FormLabel>{label}</FormLabel>\n {!!description && <FormDescription>{description}</FormDescription>}\n </FieldContent>\n </Activity>\n <Popover modal={true}>\n <PopoverTrigger asChild>\n <FormControl>\n <Button\n type=\"button\"\n variant=\"outline\"\n role=\"combobox\"\n color=\"muted\"\n className={cn(\n 'w-full md:max-w-80',\n 'shadow-input flex justify-between rounded-md px-3',\n 'outline-border-weak font-normal',\n '[&_div]:w-full',\n '[&_div]:justify-between',\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 )}\n >\n {field.value ? (\n <span className=\"flex min-w-0 items-center gap-2\">{options?.find(({ value }) => value === field.value)?.label}</span>\n ) : (\n <span className=\"text-text-positive-muted\">{placeholder}</span>\n )}\n <ChevronDownIcon size={16} className=\"text-text-positive-weak shrink-0\" aria-hidden=\"true\" />\n </Button>\n </FormControl>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\">\n <Command className=\"border-none\">\n <CommandInput placeholder={placeholder ?? 'Tìm kiếm'} />\n <CommandList>\n <CommandGroup className=\"max-h-40 overflow-y-auto\">\n {options?.map(({ value, label }) => (\n <CommandItem key={value} value={label} onSelect={() => field.onChange(value)}>\n {label}\n </CommandItem>\n ))}\n </CommandGroup>\n {onAddNewItem && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <Button type=\"button\" variant=\"ghost\" className=\"w-full justify-start font-normal\">\n <PlusIcon size={14} className=\"-ms-2 opacity-60\" aria-hidden=\"true\" />\n Thêm mới\n </Button>\n </CommandGroup>\n </>\n )}\n </CommandList>\n <CommandEmpty>Không có kết quả</CommandEmpty>\n </Command>\n </PopoverContent>\n </Popover>\n </FormItem>\n );\n }}\n />\n );\n};\n"],"mappings":"knBAyBA,MAAa,GAAiE,CAC5E,OACA,QAAQ,WACR,cAAc,eACd,cACA,UACA,mBAGE,EAAA,EAAA,KAACA,EAAAA,UAAAA,CACO,OACN,QAAS,CAAE,YAEP,EAAA,EAAA,MAACC,EAAAA,SAAAA,CAAS,UAAU,oBAClB,EAAA,EAAA,KAACC,EAAAA,SAAAA,CAAS,KAAM,GAAS,EAAc,UAAY,mBACjD,EAAA,EAAA,MAACC,EAAAA,aAAAA,CAAAA,SAAAA,EACC,EAAA,E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,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,EACE,EAAA,EAAA,KAACC,EAAAA,iBAAAA,EAAAA,CAAmB,EACpB,EAAA,EAAA,KAACH,EAAAA,aAAAA,CAAAA,UACC,EAAA,EAAA,MAACN,EAAAA,OAAAA,CAAO,KAAK,SAAS,QAAQ,QAAQ,UAAU,8CAC9C,EAAA,EAAA,KAACU,EAAAA,SAAAA,CAAS,KAAM,GAAI,UAAU,mBAAmB,cAAY,QAAS,CAAA,WAAA,EAE/D,CAAA,CACI,CAAA,CAAA,CACd,CAAA,CAAA,CAEO,EACd,EAAA,EAAA,KAACC,EAAAA,aAAAA,CAAAA,SAAa,mBAAA,CAA+B,GACrC,EACK,CAAA,EACT,CAAA,EACD,EAGf"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
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/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>) => react_jsx_runtime1.JSX.Element;
25
+ }: Props<TFieldValues>) => react_jsx_runtime5.JSX.Element;
26
26
  //#endregion
27
27
  export { ComboboxField };
28
28
  //# sourceMappingURL=combobox-field.d.cts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
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/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>) => react_jsx_runtime3.JSX.Element;
25
+ }: Props<TFieldValues>) => react_jsx_runtime4.JSX.Element;
26
26
  //#endregion
27
27
  export { ComboboxField };
28
28
  //# sourceMappingURL=combobox-field.d.ts.map