@arch-cadre/ui 0.0.10 → 0.0.15

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 (256) hide show
  1. package/build.config.ts +23 -0
  2. package/dist/components/.gitkeep +0 -0
  3. package/dist/components/accordion.cjs +62 -0
  4. package/dist/components/accordion.d.ts +7 -0
  5. package/dist/components/accordion.mjs +58 -0
  6. package/dist/components/alert-dialog.cjs +127 -0
  7. package/dist/components/alert-dialog.d.ts +14 -0
  8. package/dist/components/alert-dialog.mjs +144 -0
  9. package/dist/components/alert.cjs +58 -0
  10. package/dist/components/alert.d.ts +9 -0
  11. package/dist/components/alert.mjs +62 -0
  12. package/dist/components/aspect-ratio.cjs +19 -0
  13. package/dist/components/aspect-ratio.d.ts +4 -0
  14. package/dist/components/aspect-ratio.mjs +9 -0
  15. package/dist/components/avatar.cjs +44 -0
  16. package/dist/components/avatar.d.ts +6 -0
  17. package/dist/components/avatar.mjs +50 -0
  18. package/dist/components/badge.cjs +41 -0
  19. package/dist/components/badge.d.ts +9 -0
  20. package/dist/components/badge.mjs +37 -0
  21. package/dist/components/breadcrumb.cjs +106 -0
  22. package/dist/components/breadcrumb.d.ts +11 -0
  23. package/dist/components/breadcrumb.mjs +105 -0
  24. package/dist/components/button-group.cjs +65 -0
  25. package/dist/components/button-group.d.ts +12 -0
  26. package/dist/components/button-group.mjs +76 -0
  27. package/dist/components/button.cjs +57 -0
  28. package/dist/components/button.d.ts +10 -0
  29. package/dist/components/button.mjs +51 -0
  30. package/dist/components/calendar.cjs +143 -0
  31. package/dist/components/calendar.d.ts +8 -0
  32. package/dist/components/calendar.mjs +191 -0
  33. package/dist/components/card.cjs +86 -0
  34. package/dist/components/card.d.ts +9 -0
  35. package/dist/components/card.mjs +90 -0
  36. package/dist/components/checkbox.cjs +28 -0
  37. package/dist/components/checkbox.d.ts +4 -0
  38. package/dist/components/checkbox.mjs +30 -0
  39. package/dist/components/collapsible.cjs +37 -0
  40. package/dist/components/collapsible.d.ts +6 -0
  41. package/dist/components/collapsible.mjs +31 -0
  42. package/dist/components/command.cjs +125 -0
  43. package/dist/components/command.d.ts +18 -0
  44. package/dist/components/command.mjs +169 -0
  45. package/dist/components/context-menu.cjs +188 -0
  46. package/dist/components/context-menu.d.ts +25 -0
  47. package/dist/components/context-menu.mjs +218 -0
  48. package/dist/components/dialog.cjs +123 -0
  49. package/dist/components/dialog.d.ts +15 -0
  50. package/dist/components/dialog.mjs +130 -0
  51. package/dist/components/drawer.cjs +118 -0
  52. package/dist/components/drawer.d.ts +13 -0
  53. package/dist/components/drawer.mjs +124 -0
  54. package/dist/components/dropdown-menu.cjs +190 -0
  55. package/dist/components/dropdown-menu.d.ts +25 -0
  56. package/dist/components/dropdown-menu.mjs +226 -0
  57. package/dist/components/empty.cjs +92 -0
  58. package/dist/components/empty.d.ts +12 -0
  59. package/dist/components/empty.mjs +102 -0
  60. package/dist/components/field.cjs +173 -0
  61. package/dist/components/field.d.ts +25 -0
  62. package/dist/components/field.mjs +228 -0
  63. package/dist/components/form.cjs +143 -0
  64. package/dist/components/form.d.ts +23 -0
  65. package/dist/components/form.mjs +123 -0
  66. package/dist/components/hover-card.cjs +46 -0
  67. package/dist/components/hover-card.d.ts +6 -0
  68. package/dist/components/hover-card.mjs +35 -0
  69. package/dist/components/input-group.cjs +130 -0
  70. package/dist/components/input-group.d.ts +16 -0
  71. package/dist/components/input-group.mjs +155 -0
  72. package/dist/components/input-otp.cjs +69 -0
  73. package/dist/components/input-otp.d.ts +11 -0
  74. package/dist/components/input-otp.mjs +59 -0
  75. package/dist/components/input.cjs +22 -0
  76. package/dist/components/input.d.ts +3 -0
  77. package/dist/components/input.mjs +19 -0
  78. package/dist/components/item.cjs +168 -0
  79. package/dist/components/item.d.ts +23 -0
  80. package/dist/components/item.mjs +187 -0
  81. package/dist/components/kbd.cjs +31 -0
  82. package/dist/components/kbd.d.ts +4 -0
  83. package/dist/components/kbd.mjs +28 -0
  84. package/dist/components/label.cjs +22 -0
  85. package/dist/components/label.d.ts +4 -0
  86. package/dist/components/label.mjs +21 -0
  87. package/dist/components/language-switcher.cjs +43 -0
  88. package/dist/components/language-switcher.d.ts +2 -0
  89. package/dist/components/language-switcher.mjs +30 -0
  90. package/dist/components/menubar.cjs +207 -0
  91. package/dist/components/menubar.d.ts +26 -0
  92. package/dist/components/menubar.mjs +246 -0
  93. package/dist/components/navigation-menu.cjs +113 -0
  94. package/dist/components/navigation-menu.d.ts +14 -0
  95. package/dist/components/navigation-menu.mjs +166 -0
  96. package/dist/components/pagination.cjs +106 -0
  97. package/dist/components/pagination.d.ts +15 -0
  98. package/dist/components/pagination.mjs +116 -0
  99. package/dist/components/popover.cjs +53 -0
  100. package/dist/components/popover.d.ts +7 -0
  101. package/dist/components/popover.mjs +40 -0
  102. package/dist/components/progress.cjs +29 -0
  103. package/dist/components/progress.d.ts +4 -0
  104. package/dist/components/progress.mjs +30 -0
  105. package/dist/components/radio-group.cjs +39 -0
  106. package/dist/components/radio-group.d.ts +5 -0
  107. package/dist/components/radio-group.mjs +43 -0
  108. package/dist/components/scroll-area.cjs +45 -0
  109. package/dist/components/scroll-area.d.ts +7 -0
  110. package/dist/components/scroll-area.mjs +59 -0
  111. package/dist/components/select.cjs +140 -0
  112. package/dist/components/select.d.ts +15 -0
  113. package/dist/components/select.mjs +173 -0
  114. package/dist/components/separator.cjs +26 -0
  115. package/dist/components/separator.d.ts +4 -0
  116. package/dist/components/separator.mjs +25 -0
  117. package/dist/components/sheet.cjs +120 -0
  118. package/dist/components/sheet.d.ts +13 -0
  119. package/dist/components/sheet.mjs +119 -0
  120. package/dist/components/sidebar.cjs +508 -0
  121. package/dist/components/sidebar.d.ts +69 -0
  122. package/dist/components/sidebar.mjs +635 -0
  123. package/dist/components/skeleton.cjs +20 -0
  124. package/dist/components/skeleton.d.ts +3 -0
  125. package/dist/components/skeleton.mjs +13 -0
  126. package/dist/components/slider.cjs +43 -0
  127. package/dist/components/slider.d.ts +4 -0
  128. package/dist/components/slider.mjs +59 -0
  129. package/dist/components/sonner.cjs +49 -0
  130. package/dist/components/sonner.d.ts +4 -0
  131. package/dist/components/sonner.mjs +36 -0
  132. package/dist/components/spinner.cjs +22 -0
  133. package/dist/components/spinner.d.ts +3 -0
  134. package/dist/components/spinner.mjs +15 -0
  135. package/dist/components/switch.cjs +25 -0
  136. package/dist/components/switch.d.ts +4 -0
  137. package/dist/components/switch.mjs +30 -0
  138. package/dist/components/table.cjs +101 -0
  139. package/dist/components/table.d.ts +10 -0
  140. package/dist/components/table.mjs +115 -0
  141. package/dist/components/tabs.cjs +55 -0
  142. package/dist/components/tabs.d.ts +7 -0
  143. package/dist/components/tabs.mjs +63 -0
  144. package/dist/components/textarea.cjs +20 -0
  145. package/dist/components/textarea.d.ts +3 -0
  146. package/dist/components/textarea.mjs +16 -0
  147. package/dist/components/toggle-group.cjs +65 -0
  148. package/dist/components/toggle-group.d.ts +9 -0
  149. package/dist/components/toggle-group.mjs +65 -0
  150. package/dist/components/toggle.cjs +47 -0
  151. package/dist/components/toggle.d.ts +9 -0
  152. package/dist/components/toggle.mjs +41 -0
  153. package/dist/components/tooltip.cjs +56 -0
  154. package/dist/components/tooltip.d.ts +7 -0
  155. package/dist/components/tooltip.mjs +49 -0
  156. package/dist/hooks/.gitkeep +0 -0
  157. package/dist/hooks/use-mobile.cjs +23 -0
  158. package/dist/hooks/use-mobile.d.ts +1 -0
  159. package/dist/hooks/use-mobile.mjs +17 -0
  160. package/dist/hooks/use-user.cjs +21 -0
  161. package/dist/hooks/use-user.d.ts +12 -0
  162. package/dist/hooks/use-user.mjs +12 -0
  163. package/dist/index.cjs +155 -0
  164. package/dist/index.d.ts +13 -0
  165. package/dist/index.mjs +13 -0
  166. package/dist/lib/utils.cjs +11 -0
  167. package/dist/lib/utils.d.ts +2 -0
  168. package/dist/lib/utils.mjs +5 -0
  169. package/dist/logo.cjs +49 -0
  170. package/dist/logo.d.ts +15 -0
  171. package/dist/logo.mjs +32 -0
  172. package/dist/postcss.config.cjs +13 -0
  173. package/dist/postcss.config.d.mts +3 -0
  174. package/dist/postcss.config.mjs +6 -0
  175. package/dist/providers/auth-provider.cjs +44 -0
  176. package/dist/providers/auth-provider.d.ts +15 -0
  177. package/dist/providers/auth-provider.mjs +37 -0
  178. package/dist/providers/index.cjs +47 -0
  179. package/dist/providers/index.d.ts +7 -0
  180. package/dist/providers/index.mjs +33 -0
  181. package/dist/shared/access-denied.cjs +38 -0
  182. package/dist/shared/access-denied.d.ts +2 -0
  183. package/dist/shared/access-denied.mjs +12 -0
  184. package/dist/shared/loader.cjs +95 -0
  185. package/dist/shared/loader.d.ts +11 -0
  186. package/dist/shared/loader.mjs +98 -0
  187. package/dist/shared/page-loader.cjs +23 -0
  188. package/dist/shared/page-loader.d.ts +7 -0
  189. package/dist/shared/page-loader.mjs +6 -0
  190. package/dist/shared/scroll-fade-effect.cjs +21 -0
  191. package/dist/shared/scroll-fade-effect.d.ts +4 -0
  192. package/dist/shared/scroll-fade-effect.mjs +20 -0
  193. package/dist/styles/globals.css +1 -0
  194. package/package.json +58 -49
  195. package/scripts/switchToDist.js +55 -0
  196. package/scripts/switchToSrc.js +52 -0
  197. package/src/components/accordion.tsx +2 -2
  198. package/src/components/alert-dialog.tsx +1 -1
  199. package/src/components/alert.tsx +1 -1
  200. package/src/components/aspect-ratio.tsx +2 -1
  201. package/src/components/avatar.tsx +1 -1
  202. package/src/components/badge.tsx +3 -3
  203. package/src/components/breadcrumb.tsx +5 -3
  204. package/src/components/button-group.tsx +4 -2
  205. package/src/components/button.tsx +3 -3
  206. package/src/components/calendar.tsx +2 -2
  207. package/src/components/checkbox.tsx +2 -2
  208. package/src/components/collapsible.tsx +2 -1
  209. package/src/components/command.tsx +1 -1
  210. package/src/components/context-menu.tsx +2 -2
  211. package/src/components/dialog.tsx +2 -2
  212. package/src/components/dropdown-menu.tsx +2 -2
  213. package/src/components/empty.tsx +1 -0
  214. package/src/components/field.tsx +5 -2
  215. package/src/components/form.tsx +9 -7
  216. package/src/components/hover-card.tsx +1 -1
  217. package/src/components/input-group.tsx +1 -1
  218. package/src/components/input-otp.tsx +1 -1
  219. package/src/components/item.tsx +3 -3
  220. package/src/components/kbd.tsx +1 -0
  221. package/src/components/label.tsx +1 -1
  222. package/src/components/language-switcher.tsx +16 -17
  223. package/src/components/menubar.tsx +2 -2
  224. package/src/components/navigation-menu.tsx +2 -2
  225. package/src/components/pagination.tsx +5 -2
  226. package/src/components/popover.tsx +1 -1
  227. package/src/components/progress.tsx +1 -1
  228. package/src/components/radio-group.tsx +2 -2
  229. package/src/components/scroll-area.tsx +1 -1
  230. package/src/components/select.tsx +2 -2
  231. package/src/components/separator.tsx +1 -1
  232. package/src/components/sheet.tsx +2 -2
  233. package/src/components/sidebar.tsx +6 -6
  234. package/src/components/skeleton.tsx +1 -0
  235. package/src/components/slider.tsx +1 -1
  236. package/src/components/sonner.tsx +1 -0
  237. package/src/components/spinner.tsx +1 -0
  238. package/src/components/switch.tsx +1 -1
  239. package/src/components/tabs.tsx +1 -1
  240. package/src/components/toggle-group.tsx +2 -2
  241. package/src/components/toggle.tsx +2 -2
  242. package/src/components/tooltip.tsx +1 -1
  243. package/src/hooks/use-user.ts +2 -2
  244. package/src/index.ts +8 -5
  245. package/src/logo.tsx +1 -0
  246. package/src/providers/auth-provider.tsx +7 -6
  247. package/src/providers/index.tsx +1 -0
  248. package/src/shared/access-denied.tsx +1 -0
  249. package/src/shared/loader.tsx +2 -1
  250. package/src/shared/page-loader.tsx +1 -0
  251. package/src/shared/scroll-fade-effect.tsx +1 -1
  252. package/src/styles/globals.css +258 -244
  253. package/biome.json +0 -38
  254. package/src/components/carousel.tsx +0 -241
  255. package/src/components/chart.tsx +0 -357
  256. package/tsconfig.build.json +0 -16
@@ -0,0 +1,102 @@
1
+ import { cva } from "class-variance-authority";
2
+ import * as React from "react";
3
+ import { cn } from "../lib/utils.mjs";
4
+ function Empty({ className, ...props }) {
5
+ return /* @__PURE__ */ React.createElement(
6
+ "div",
7
+ {
8
+ "data-slot": "empty",
9
+ className: cn(
10
+ "flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",
11
+ className
12
+ ),
13
+ ...props
14
+ }
15
+ );
16
+ }
17
+ function EmptyHeader({ className, ...props }) {
18
+ return /* @__PURE__ */ React.createElement(
19
+ "div",
20
+ {
21
+ "data-slot": "empty-header",
22
+ className: cn(
23
+ "flex max-w-sm flex-col items-center gap-2 text-center",
24
+ className
25
+ ),
26
+ ...props
27
+ }
28
+ );
29
+ }
30
+ const emptyMediaVariants = cva(
31
+ "flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0",
32
+ {
33
+ variants: {
34
+ variant: {
35
+ default: "bg-transparent",
36
+ icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6"
37
+ }
38
+ },
39
+ defaultVariants: {
40
+ variant: "default"
41
+ }
42
+ }
43
+ );
44
+ function EmptyMedia({
45
+ className,
46
+ variant = "default",
47
+ ...props
48
+ }) {
49
+ return /* @__PURE__ */ React.createElement(
50
+ "div",
51
+ {
52
+ "data-slot": "empty-icon",
53
+ "data-variant": variant,
54
+ className: cn(emptyMediaVariants({ variant, className })),
55
+ ...props
56
+ }
57
+ );
58
+ }
59
+ function EmptyTitle({ className, ...props }) {
60
+ return /* @__PURE__ */ React.createElement(
61
+ "div",
62
+ {
63
+ "data-slot": "empty-title",
64
+ className: cn("text-lg font-medium tracking-tight", className),
65
+ ...props
66
+ }
67
+ );
68
+ }
69
+ function EmptyDescription({ className, ...props }) {
70
+ return /* @__PURE__ */ React.createElement(
71
+ "div",
72
+ {
73
+ "data-slot": "empty-description",
74
+ className: cn(
75
+ "text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",
76
+ className
77
+ ),
78
+ ...props
79
+ }
80
+ );
81
+ }
82
+ function EmptyContent({ className, ...props }) {
83
+ return /* @__PURE__ */ React.createElement(
84
+ "div",
85
+ {
86
+ "data-slot": "empty-content",
87
+ className: cn(
88
+ "flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
89
+ className
90
+ ),
91
+ ...props
92
+ }
93
+ );
94
+ }
95
+ export {
96
+ Empty,
97
+ EmptyHeader,
98
+ EmptyTitle,
99
+ EmptyDescription,
100
+ EmptyContent,
101
+ EmptyMedia
102
+ };
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ "use client";
3
+
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.Field = Field;
8
+ exports.FieldContent = FieldContent;
9
+ exports.FieldDescription = FieldDescription;
10
+ exports.FieldError = FieldError;
11
+ exports.FieldGroup = FieldGroup;
12
+ exports.FieldLabel = FieldLabel;
13
+ exports.FieldLegend = FieldLegend;
14
+ exports.FieldSeparator = FieldSeparator;
15
+ exports.FieldSet = FieldSet;
16
+ exports.FieldTitle = FieldTitle;
17
+ var _classVarianceAuthority = require("class-variance-authority");
18
+ var _react = _interopRequireWildcard(require("react"));
19
+ var React = _react;
20
+ var _utils = require("../lib/utils.cjs");
21
+ var _label = require("./label.cjs");
22
+ var _separator = require("./separator.cjs");
23
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
24
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
25
+ function FieldSet({
26
+ className,
27
+ ...props
28
+ }) {
29
+ return /* @__PURE__ */React.createElement("fieldset", {
30
+ "data-slot": "field-set",
31
+ className: (0, _utils.cn)("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
32
+ ...props
33
+ });
34
+ }
35
+ function FieldLegend({
36
+ className,
37
+ variant = "legend",
38
+ ...props
39
+ }) {
40
+ return /* @__PURE__ */React.createElement("legend", {
41
+ "data-slot": "field-legend",
42
+ "data-variant": variant,
43
+ className: (0, _utils.cn)("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className),
44
+ ...props
45
+ });
46
+ }
47
+ function FieldGroup({
48
+ className,
49
+ ...props
50
+ }) {
51
+ return /* @__PURE__ */React.createElement("div", {
52
+ "data-slot": "field-group",
53
+ className: (0, _utils.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", className),
54
+ ...props
55
+ });
56
+ }
57
+ const fieldVariants = (0, _classVarianceAuthority.cva)("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
58
+ variants: {
59
+ orientation: {
60
+ vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
61
+ 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"],
62
+ 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"]
63
+ }
64
+ },
65
+ defaultVariants: {
66
+ orientation: "vertical"
67
+ }
68
+ });
69
+ function Field({
70
+ className,
71
+ orientation = "vertical",
72
+ ...props
73
+ }) {
74
+ return /* @__PURE__ */React.createElement("div", {
75
+ role: "group",
76
+ "data-slot": "field",
77
+ "data-orientation": orientation,
78
+ className: (0, _utils.cn)(fieldVariants({
79
+ orientation
80
+ }), className),
81
+ ...props
82
+ });
83
+ }
84
+ function FieldContent({
85
+ className,
86
+ ...props
87
+ }) {
88
+ return /* @__PURE__ */React.createElement("div", {
89
+ "data-slot": "field-content",
90
+ className: (0, _utils.cn)("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className),
91
+ ...props
92
+ });
93
+ }
94
+ function FieldLabel({
95
+ className,
96
+ ...props
97
+ }) {
98
+ return /* @__PURE__ */React.createElement(_label.Label, {
99
+ "data-slot": "field-label",
100
+ className: (0, _utils.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 dark:has-data-[state=checked]:bg-primary/10", className),
101
+ ...props
102
+ });
103
+ }
104
+ function FieldTitle({
105
+ className,
106
+ ...props
107
+ }) {
108
+ return /* @__PURE__ */React.createElement("div", {
109
+ "data-slot": "field-label",
110
+ className: (0, _utils.cn)("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50", className),
111
+ ...props
112
+ });
113
+ }
114
+ function FieldDescription({
115
+ className,
116
+ ...props
117
+ }) {
118
+ return /* @__PURE__ */React.createElement("p", {
119
+ "data-slot": "field-description",
120
+ className: (0, _utils.cn)("text-muted-foreground 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", className),
121
+ ...props
122
+ });
123
+ }
124
+ function FieldSeparator({
125
+ children,
126
+ className,
127
+ ...props
128
+ }) {
129
+ return /* @__PURE__ */React.createElement("div", {
130
+ "data-slot": "field-separator",
131
+ "data-content": !!children,
132
+ className: (0, _utils.cn)("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
133
+ ...props
134
+ }, /* @__PURE__ */React.createElement(_separator.Separator, {
135
+ className: "absolute inset-0 top-1/2"
136
+ }), children && /* @__PURE__ */React.createElement("span", {
137
+ className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
138
+ "data-slot": "field-separator-content"
139
+ }, children));
140
+ }
141
+ function FieldError({
142
+ className,
143
+ children,
144
+ errors,
145
+ ...props
146
+ }) {
147
+ const content = (0, _react.useMemo)(() => {
148
+ if (children) {
149
+ return children;
150
+ }
151
+ if (!errors?.length) {
152
+ return null;
153
+ }
154
+ const uniqueErrors = [...new Map(errors.map(error => [error?.message, error])).values()];
155
+ if (uniqueErrors?.length === 1) {
156
+ return uniqueErrors[0]?.message;
157
+ }
158
+ return /* @__PURE__ */React.createElement("ul", {
159
+ className: "ml-4 flex list-disc flex-col gap-1"
160
+ }, uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */React.createElement("li", {
161
+ key: index
162
+ }, error.message)));
163
+ }, [children, errors]);
164
+ if (!content) {
165
+ return null;
166
+ }
167
+ return /* @__PURE__ */React.createElement("div", {
168
+ role: "alert",
169
+ "data-slot": "field-error",
170
+ className: (0, _utils.cn)("text-destructive text-sm font-normal", className),
171
+ ...props
172
+ }, content);
173
+ }
@@ -0,0 +1,25 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import * as React from "react";
3
+ import { Label } from "./label";
4
+ declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): React.JSX.Element;
5
+ declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<"legend"> & {
6
+ variant?: "legend" | "label";
7
+ }): React.JSX.Element;
8
+ declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
9
+ declare const fieldVariants: (props?: ({
10
+ orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
11
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
12
+ declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): React.JSX.Element;
13
+ declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
14
+ declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React.JSX.Element;
15
+ declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
16
+ declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
17
+ declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<"div"> & {
18
+ children?: React.ReactNode;
19
+ }): React.JSX.Element;
20
+ declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<"div"> & {
21
+ errors?: Array<{
22
+ message?: string;
23
+ } | undefined>;
24
+ }): React.JSX.Element | null;
25
+ export { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle, };
@@ -0,0 +1,228 @@
1
+ "use client";
2
+ import { cva } from "class-variance-authority";
3
+ import * as React from "react";
4
+ import { useMemo } from "react";
5
+ import { cn } from "../lib/utils.mjs";
6
+ import { Label } from "./label.mjs";
7
+ import { Separator } from "./separator.mjs";
8
+ function FieldSet({ className, ...props }) {
9
+ return /* @__PURE__ */ React.createElement(
10
+ "fieldset",
11
+ {
12
+ "data-slot": "field-set",
13
+ className: cn(
14
+ "flex flex-col gap-6",
15
+ "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
16
+ className
17
+ ),
18
+ ...props
19
+ }
20
+ );
21
+ }
22
+ function FieldLegend({
23
+ className,
24
+ variant = "legend",
25
+ ...props
26
+ }) {
27
+ return /* @__PURE__ */ React.createElement(
28
+ "legend",
29
+ {
30
+ "data-slot": "field-legend",
31
+ "data-variant": variant,
32
+ className: cn(
33
+ "mb-3 font-medium",
34
+ "data-[variant=legend]:text-base",
35
+ "data-[variant=label]:text-sm",
36
+ className
37
+ ),
38
+ ...props
39
+ }
40
+ );
41
+ }
42
+ function FieldGroup({ className, ...props }) {
43
+ return /* @__PURE__ */ React.createElement(
44
+ "div",
45
+ {
46
+ "data-slot": "field-group",
47
+ className: cn(
48
+ "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",
49
+ className
50
+ ),
51
+ ...props
52
+ }
53
+ );
54
+ }
55
+ const fieldVariants = cva(
56
+ "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
57
+ {
58
+ variants: {
59
+ orientation: {
60
+ vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
61
+ horizontal: [
62
+ "flex-row items-center",
63
+ "[&>[data-slot=field-label]]:flex-auto",
64
+ "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
65
+ ],
66
+ responsive: [
67
+ "flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
68
+ "@md/field-group:[&>[data-slot=field-label]]:flex-auto",
69
+ "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
70
+ ]
71
+ }
72
+ },
73
+ defaultVariants: {
74
+ orientation: "vertical"
75
+ }
76
+ }
77
+ );
78
+ function Field({
79
+ className,
80
+ orientation = "vertical",
81
+ ...props
82
+ }) {
83
+ return /* @__PURE__ */ React.createElement(
84
+ "div",
85
+ {
86
+ role: "group",
87
+ "data-slot": "field",
88
+ "data-orientation": orientation,
89
+ className: cn(fieldVariants({ orientation }), className),
90
+ ...props
91
+ }
92
+ );
93
+ }
94
+ function FieldContent({ className, ...props }) {
95
+ return /* @__PURE__ */ React.createElement(
96
+ "div",
97
+ {
98
+ "data-slot": "field-content",
99
+ className: cn(
100
+ "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
101
+ className
102
+ ),
103
+ ...props
104
+ }
105
+ );
106
+ }
107
+ function FieldLabel({
108
+ className,
109
+ ...props
110
+ }) {
111
+ return /* @__PURE__ */ React.createElement(
112
+ Label,
113
+ {
114
+ "data-slot": "field-label",
115
+ className: cn(
116
+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
117
+ "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",
118
+ "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
119
+ className
120
+ ),
121
+ ...props
122
+ }
123
+ );
124
+ }
125
+ function FieldTitle({ className, ...props }) {
126
+ return /* @__PURE__ */ React.createElement(
127
+ "div",
128
+ {
129
+ "data-slot": "field-label",
130
+ className: cn(
131
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
132
+ className
133
+ ),
134
+ ...props
135
+ }
136
+ );
137
+ }
138
+ function FieldDescription({ className, ...props }) {
139
+ return /* @__PURE__ */ React.createElement(
140
+ "p",
141
+ {
142
+ "data-slot": "field-description",
143
+ className: cn(
144
+ "text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
145
+ "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
146
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
147
+ className
148
+ ),
149
+ ...props
150
+ }
151
+ );
152
+ }
153
+ function FieldSeparator({
154
+ children,
155
+ className,
156
+ ...props
157
+ }) {
158
+ return /* @__PURE__ */ React.createElement(
159
+ "div",
160
+ {
161
+ "data-slot": "field-separator",
162
+ "data-content": !!children,
163
+ className: cn(
164
+ "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
165
+ className
166
+ ),
167
+ ...props
168
+ },
169
+ /* @__PURE__ */ React.createElement(Separator, { className: "absolute inset-0 top-1/2" }),
170
+ children && /* @__PURE__ */ React.createElement(
171
+ "span",
172
+ {
173
+ className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
174
+ "data-slot": "field-separator-content"
175
+ },
176
+ children
177
+ )
178
+ );
179
+ }
180
+ function FieldError({
181
+ className,
182
+ children,
183
+ errors,
184
+ ...props
185
+ }) {
186
+ const content = useMemo(() => {
187
+ if (children) {
188
+ return children;
189
+ }
190
+ if (!errors?.length) {
191
+ return null;
192
+ }
193
+ const uniqueErrors = [
194
+ ...new Map(errors.map((error) => [error?.message, error])).values()
195
+ ];
196
+ if (uniqueErrors?.length === 1) {
197
+ return uniqueErrors[0]?.message;
198
+ }
199
+ return /* @__PURE__ */ React.createElement("ul", { className: "ml-4 flex list-disc flex-col gap-1" }, uniqueErrors.map(
200
+ (error, index) => error?.message && /* @__PURE__ */ React.createElement("li", { key: index }, error.message)
201
+ ));
202
+ }, [children, errors]);
203
+ if (!content) {
204
+ return null;
205
+ }
206
+ return /* @__PURE__ */ React.createElement(
207
+ "div",
208
+ {
209
+ role: "alert",
210
+ "data-slot": "field-error",
211
+ className: cn("text-destructive text-sm font-normal", className),
212
+ ...props
213
+ },
214
+ content
215
+ );
216
+ }
217
+ export {
218
+ Field,
219
+ FieldLabel,
220
+ FieldDescription,
221
+ FieldError,
222
+ FieldGroup,
223
+ FieldLegend,
224
+ FieldSeparator,
225
+ FieldSet,
226
+ FieldContent,
227
+ FieldTitle
228
+ };
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ "use client";
3
+
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.Form = void 0;
8
+ exports.FormControl = FormControl;
9
+ exports.FormDescription = FormDescription;
10
+ exports.FormField = void 0;
11
+ exports.FormItem = FormItem;
12
+ exports.FormLabel = FormLabel;
13
+ exports.FormMessage = FormMessage;
14
+ exports.useFormField = void 0;
15
+ var _radixUi = require("radix-ui");
16
+ var React = _interopRequireWildcard(require("react"));
17
+ var _reactHookForm = require("react-hook-form");
18
+ var _utils = require("../lib/utils.cjs");
19
+ var _label = require("./label.cjs");
20
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
+ const Form = exports.Form = _reactHookForm.FormProvider;
23
+ const FormFieldContext = React.createContext({});
24
+ const FormField = ({
25
+ ...props
26
+ }) => {
27
+ return /* @__PURE__ */React.createElement(FormFieldContext.Provider, {
28
+ value: {
29
+ name: props.name
30
+ }
31
+ }, /* @__PURE__ */React.createElement(_reactHookForm.Controller, {
32
+ ...props
33
+ }));
34
+ };
35
+ exports.FormField = FormField;
36
+ const useFormField = () => {
37
+ const fieldContext = React.useContext(FormFieldContext);
38
+ const itemContext = React.useContext(FormItemContext);
39
+ const {
40
+ getFieldState
41
+ } = (0, _reactHookForm.useFormContext)();
42
+ const formState = (0, _reactHookForm.useFormState)({
43
+ name: fieldContext.name
44
+ });
45
+ const fieldState = getFieldState(fieldContext.name, formState);
46
+ if (!fieldContext) {
47
+ throw new Error("useFormField should be used within <FormField>");
48
+ }
49
+ const {
50
+ id
51
+ } = itemContext;
52
+ return {
53
+ id,
54
+ name: fieldContext.name,
55
+ formItemId: `${id}-form-item`,
56
+ formDescriptionId: `${id}-form-item-description`,
57
+ formMessageId: `${id}-form-item-message`,
58
+ ...fieldState
59
+ };
60
+ };
61
+ exports.useFormField = useFormField;
62
+ const FormItemContext = React.createContext({});
63
+ function FormItem({
64
+ className,
65
+ ...props
66
+ }) {
67
+ const id = React.useId();
68
+ return /* @__PURE__ */React.createElement(FormItemContext.Provider, {
69
+ value: {
70
+ id
71
+ }
72
+ }, /* @__PURE__ */React.createElement("div", {
73
+ "data-slot": "form-item",
74
+ className: (0, _utils.cn)("grid gap-2", className),
75
+ ...props
76
+ }));
77
+ }
78
+ function FormLabel({
79
+ className,
80
+ ...props
81
+ }) {
82
+ const {
83
+ error,
84
+ formItemId
85
+ } = useFormField();
86
+ return /* @__PURE__ */React.createElement(_label.Label, {
87
+ "data-slot": "form-label",
88
+ "data-error": !!error,
89
+ className: (0, _utils.cn)("data-[error=true]:text-destructive", className),
90
+ htmlFor: formItemId,
91
+ ...props
92
+ });
93
+ }
94
+ function FormControl({
95
+ ...props
96
+ }) {
97
+ const {
98
+ error,
99
+ formItemId,
100
+ formDescriptionId,
101
+ formMessageId
102
+ } = useFormField();
103
+ return /* @__PURE__ */React.createElement(_radixUi.Slot.Slot, {
104
+ "data-slot": "form-control",
105
+ id: formItemId,
106
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
107
+ "aria-invalid": !!error,
108
+ ...props
109
+ });
110
+ }
111
+ function FormDescription({
112
+ className,
113
+ ...props
114
+ }) {
115
+ const {
116
+ formDescriptionId
117
+ } = useFormField();
118
+ return /* @__PURE__ */React.createElement("p", {
119
+ "data-slot": "form-description",
120
+ id: formDescriptionId,
121
+ className: (0, _utils.cn)("text-muted-foreground text-sm", className),
122
+ ...props
123
+ });
124
+ }
125
+ function FormMessage({
126
+ className,
127
+ ...props
128
+ }) {
129
+ const {
130
+ error,
131
+ formMessageId
132
+ } = useFormField();
133
+ const body = error ? String(error?.message ?? "") : props.children;
134
+ if (!body) {
135
+ return null;
136
+ }
137
+ return /* @__PURE__ */React.createElement("p", {
138
+ "data-slot": "form-message",
139
+ id: formMessageId,
140
+ className: (0, _utils.cn)("text-destructive text-sm", className),
141
+ ...props
142
+ }, body);
143
+ }
@@ -0,0 +1,23 @@
1
+ import { type Label as LabelPrimitive, Slot as SlotPrimitive } from "radix-ui";
2
+ import * as React from "react";
3
+ import { type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
4
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
5
+ declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
6
+ declare const useFormField: () => {
7
+ invalid: boolean;
8
+ isDirty: boolean;
9
+ isTouched: boolean;
10
+ isValidating: boolean;
11
+ error?: import("react-hook-form").FieldError;
12
+ id: string;
13
+ name: string;
14
+ formItemId: string;
15
+ formDescriptionId: string;
16
+ formMessageId: string;
17
+ };
18
+ declare function FormItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
19
+ declare function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): React.JSX.Element;
20
+ declare function FormControl({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>): React.JSX.Element;
21
+ declare function FormDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
22
+ declare function FormMessage({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element | null;
23
+ export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };