@questpie/admin 0.0.1

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 (203) hide show
  1. package/.turbo/turbo-build.log +108 -0
  2. package/CHANGELOG.md +10 -0
  3. package/README.md +556 -0
  4. package/STATUS.md +917 -0
  5. package/VALIDATION.md +602 -0
  6. package/components.json +24 -0
  7. package/dist/__tests__/setup.mjs +38 -0
  8. package/dist/__tests__/test-utils.mjs +45 -0
  9. package/dist/__tests__/vitest.d.mjs +3 -0
  10. package/dist/components/admin-app.mjs +69 -0
  11. package/dist/components/fields/array-field.mjs +190 -0
  12. package/dist/components/fields/checkbox-field.mjs +34 -0
  13. package/dist/components/fields/custom-field.mjs +32 -0
  14. package/dist/components/fields/date-field.mjs +41 -0
  15. package/dist/components/fields/datetime-field.mjs +42 -0
  16. package/dist/components/fields/email-field.mjs +37 -0
  17. package/dist/components/fields/embedded-collection.mjs +253 -0
  18. package/dist/components/fields/field-types.mjs +1 -0
  19. package/dist/components/fields/field-utils.mjs +10 -0
  20. package/dist/components/fields/field-wrapper.mjs +34 -0
  21. package/dist/components/fields/index.mjs +23 -0
  22. package/dist/components/fields/json-field.mjs +243 -0
  23. package/dist/components/fields/locale-badge.mjs +16 -0
  24. package/dist/components/fields/number-field.mjs +39 -0
  25. package/dist/components/fields/password-field.mjs +37 -0
  26. package/dist/components/fields/relation-field.mjs +104 -0
  27. package/dist/components/fields/relation-picker.mjs +229 -0
  28. package/dist/components/fields/relation-select.mjs +188 -0
  29. package/dist/components/fields/rich-text-editor/index.mjs +897 -0
  30. package/dist/components/fields/select-field.mjs +41 -0
  31. package/dist/components/fields/switch-field.mjs +34 -0
  32. package/dist/components/fields/text-field.mjs +38 -0
  33. package/dist/components/fields/textarea-field.mjs +38 -0
  34. package/dist/components/index.mjs +59 -0
  35. package/dist/components/primitives/checkbox-input.mjs +127 -0
  36. package/dist/components/primitives/date-input.mjs +303 -0
  37. package/dist/components/primitives/index.mjs +12 -0
  38. package/dist/components/primitives/number-input.mjs +104 -0
  39. package/dist/components/primitives/select-input.mjs +177 -0
  40. package/dist/components/primitives/tag-input.mjs +135 -0
  41. package/dist/components/primitives/text-input.mjs +39 -0
  42. package/dist/components/primitives/textarea-input.mjs +37 -0
  43. package/dist/components/primitives/toggle-input.mjs +31 -0
  44. package/dist/components/primitives/types.mjs +12 -0
  45. package/dist/components/ui/accordion.mjs +55 -0
  46. package/dist/components/ui/avatar.mjs +54 -0
  47. package/dist/components/ui/badge.mjs +34 -0
  48. package/dist/components/ui/button.mjs +48 -0
  49. package/dist/components/ui/card.mjs +58 -0
  50. package/dist/components/ui/checkbox.mjs +21 -0
  51. package/dist/components/ui/combobox.mjs +163 -0
  52. package/dist/components/ui/dialog.mjs +95 -0
  53. package/dist/components/ui/dropdown-menu.mjs +138 -0
  54. package/dist/components/ui/field.mjs +113 -0
  55. package/dist/components/ui/input-group.mjs +82 -0
  56. package/dist/components/ui/input.mjs +17 -0
  57. package/dist/components/ui/label.mjs +15 -0
  58. package/dist/components/ui/popover.mjs +56 -0
  59. package/dist/components/ui/scroll-area.mjs +38 -0
  60. package/dist/components/ui/select.mjs +100 -0
  61. package/dist/components/ui/separator.mjs +16 -0
  62. package/dist/components/ui/sheet.mjs +90 -0
  63. package/dist/components/ui/sidebar.mjs +387 -0
  64. package/dist/components/ui/skeleton.mjs +14 -0
  65. package/dist/components/ui/spinner.mjs +16 -0
  66. package/dist/components/ui/switch.mjs +22 -0
  67. package/dist/components/ui/table.mjs +68 -0
  68. package/dist/components/ui/tabs.mjs +48 -0
  69. package/dist/components/ui/textarea.mjs +15 -0
  70. package/dist/components/ui/tooltip.mjs +44 -0
  71. package/dist/config/component-registry.mjs +38 -0
  72. package/dist/config/index.mjs +129 -0
  73. package/dist/hooks/admin-provider.mjs +70 -0
  74. package/dist/hooks/index.mjs +7 -0
  75. package/dist/hooks/store.mjs +178 -0
  76. package/dist/hooks/use-auth.mjs +76 -0
  77. package/dist/hooks/use-collection-db.mjs +146 -0
  78. package/dist/hooks/use-collection.mjs +112 -0
  79. package/dist/hooks/use-global.mjs +46 -0
  80. package/dist/hooks/use-mobile.mjs +20 -0
  81. package/dist/lib/utils.mjs +10 -0
  82. package/dist/styles/index.css +336 -0
  83. package/dist/styles/index.mjs +1 -0
  84. package/dist/utils/index.mjs +9 -0
  85. package/dist/views/auth/auth-layout.mjs +52 -0
  86. package/dist/views/auth/forgot-password-form.mjs +148 -0
  87. package/dist/views/auth/index.mjs +6 -0
  88. package/dist/views/auth/login-form.mjs +156 -0
  89. package/dist/views/auth/reset-password-form.mjs +184 -0
  90. package/dist/views/collection/auto-form-fields.mjs +525 -0
  91. package/dist/views/collection/collection-form.mjs +91 -0
  92. package/dist/views/collection/collection-list.mjs +76 -0
  93. package/dist/views/collection/form-field.mjs +42 -0
  94. package/dist/views/collection/index.mjs +6 -0
  95. package/dist/views/common/index.mjs +4 -0
  96. package/dist/views/common/locale-switcher.mjs +39 -0
  97. package/dist/views/common/version-history.mjs +272 -0
  98. package/dist/views/index.mjs +9 -0
  99. package/dist/views/layout/admin-layout.mjs +40 -0
  100. package/dist/views/layout/admin-router.mjs +95 -0
  101. package/dist/views/layout/admin-sidebar.mjs +63 -0
  102. package/dist/views/layout/index.mjs +5 -0
  103. package/package.json +276 -0
  104. package/src/__tests__/setup.ts +44 -0
  105. package/src/__tests__/test-utils.tsx +49 -0
  106. package/src/__tests__/vitest.d.ts +9 -0
  107. package/src/components/admin-app.tsx +221 -0
  108. package/src/components/fields/array-field.tsx +237 -0
  109. package/src/components/fields/checkbox-field.tsx +47 -0
  110. package/src/components/fields/custom-field.tsx +50 -0
  111. package/src/components/fields/date-field.tsx +65 -0
  112. package/src/components/fields/datetime-field.tsx +67 -0
  113. package/src/components/fields/email-field.tsx +51 -0
  114. package/src/components/fields/embedded-collection.tsx +315 -0
  115. package/src/components/fields/field-types.ts +162 -0
  116. package/src/components/fields/field-utils.ts +6 -0
  117. package/src/components/fields/field-wrapper.tsx +52 -0
  118. package/src/components/fields/index.ts +66 -0
  119. package/src/components/fields/json-field.tsx +440 -0
  120. package/src/components/fields/locale-badge.tsx +15 -0
  121. package/src/components/fields/number-field.tsx +57 -0
  122. package/src/components/fields/password-field.tsx +51 -0
  123. package/src/components/fields/relation-field.tsx +243 -0
  124. package/src/components/fields/relation-picker.tsx +402 -0
  125. package/src/components/fields/relation-select.tsx +327 -0
  126. package/src/components/fields/rich-text-editor/index.tsx +1337 -0
  127. package/src/components/fields/select-field.tsx +61 -0
  128. package/src/components/fields/switch-field.tsx +47 -0
  129. package/src/components/fields/text-field.tsx +55 -0
  130. package/src/components/fields/textarea-field.tsx +55 -0
  131. package/src/components/index.ts +40 -0
  132. package/src/components/primitives/checkbox-input.tsx +193 -0
  133. package/src/components/primitives/date-input.tsx +401 -0
  134. package/src/components/primitives/index.ts +24 -0
  135. package/src/components/primitives/number-input.tsx +132 -0
  136. package/src/components/primitives/select-input.tsx +296 -0
  137. package/src/components/primitives/tag-input.tsx +200 -0
  138. package/src/components/primitives/text-input.tsx +49 -0
  139. package/src/components/primitives/textarea-input.tsx +46 -0
  140. package/src/components/primitives/toggle-input.tsx +36 -0
  141. package/src/components/primitives/types.ts +235 -0
  142. package/src/components/ui/accordion.tsx +72 -0
  143. package/src/components/ui/avatar.tsx +106 -0
  144. package/src/components/ui/badge.tsx +48 -0
  145. package/src/components/ui/button.tsx +53 -0
  146. package/src/components/ui/card.tsx +94 -0
  147. package/src/components/ui/checkbox.tsx +27 -0
  148. package/src/components/ui/combobox.tsx +290 -0
  149. package/src/components/ui/dialog.tsx +151 -0
  150. package/src/components/ui/dropdown-menu.tsx +254 -0
  151. package/src/components/ui/field.tsx +227 -0
  152. package/src/components/ui/input-group.tsx +149 -0
  153. package/src/components/ui/input.tsx +20 -0
  154. package/src/components/ui/label.tsx +18 -0
  155. package/src/components/ui/popover.tsx +88 -0
  156. package/src/components/ui/scroll-area.tsx +53 -0
  157. package/src/components/ui/select.tsx +192 -0
  158. package/src/components/ui/separator.tsx +23 -0
  159. package/src/components/ui/sheet.tsx +127 -0
  160. package/src/components/ui/sidebar.tsx +723 -0
  161. package/src/components/ui/skeleton.tsx +13 -0
  162. package/src/components/ui/spinner.tsx +10 -0
  163. package/src/components/ui/switch.tsx +32 -0
  164. package/src/components/ui/table.tsx +99 -0
  165. package/src/components/ui/tabs.tsx +82 -0
  166. package/src/components/ui/textarea.tsx +18 -0
  167. package/src/components/ui/tooltip.tsx +70 -0
  168. package/src/config/component-registry.ts +190 -0
  169. package/src/config/index.ts +1099 -0
  170. package/src/hooks/README.md +269 -0
  171. package/src/hooks/admin-provider.tsx +110 -0
  172. package/src/hooks/index.ts +41 -0
  173. package/src/hooks/store.ts +248 -0
  174. package/src/hooks/use-auth.ts +168 -0
  175. package/src/hooks/use-collection-db.ts +209 -0
  176. package/src/hooks/use-collection.ts +156 -0
  177. package/src/hooks/use-global.ts +69 -0
  178. package/src/hooks/use-mobile.ts +21 -0
  179. package/src/lib/utils.ts +6 -0
  180. package/src/styles/index.css +340 -0
  181. package/src/utils/index.ts +6 -0
  182. package/src/views/auth/auth-layout.tsx +77 -0
  183. package/src/views/auth/forgot-password-form.tsx +192 -0
  184. package/src/views/auth/index.ts +21 -0
  185. package/src/views/auth/login-form.tsx +229 -0
  186. package/src/views/auth/reset-password-form.tsx +232 -0
  187. package/src/views/collection/auto-form-fields.tsx +982 -0
  188. package/src/views/collection/collection-form.tsx +186 -0
  189. package/src/views/collection/collection-list.tsx +223 -0
  190. package/src/views/collection/form-field.tsx +52 -0
  191. package/src/views/collection/index.ts +15 -0
  192. package/src/views/common/index.ts +8 -0
  193. package/src/views/common/locale-switcher.tsx +45 -0
  194. package/src/views/common/version-history.tsx +406 -0
  195. package/src/views/index.ts +25 -0
  196. package/src/views/layout/admin-layout.tsx +117 -0
  197. package/src/views/layout/admin-router.tsx +206 -0
  198. package/src/views/layout/admin-sidebar.tsx +185 -0
  199. package/src/views/layout/index.ts +12 -0
  200. package/tsconfig.json +13 -0
  201. package/tsconfig.tsbuildinfo +1 -0
  202. package/tsdown.config.ts +13 -0
  203. package/vitest.config.ts +29 -0
@@ -0,0 +1,48 @@
1
+ "use client";
2
+
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { cn } from "../../lib/utils";
5
+ import { cva } from "class-variance-authority";
6
+ import { Button as Button$1 } from "@base-ui/react/button";
7
+
8
+ //#region src/components/ui/button.tsx
9
+ const buttonVariants = cva("focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium focus-visible:ring-[2px] aria-invalid:ring-[2px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none", {
10
+ variants: {
11
+ variant: {
12
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
13
+ outline: "border-border dark:bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",
14
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
15
+ ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
16
+ destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
17
+ link: "text-primary underline-offset-4 hover:underline"
18
+ },
19
+ size: {
20
+ default: "h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
21
+ xs: "h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5",
22
+ sm: "h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
23
+ lg: "h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4",
24
+ icon: "size-7 [&_svg:not([class*='size-'])]:size-3.5",
25
+ "icon-xs": "size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5",
26
+ "icon-sm": "size-6 [&_svg:not([class*='size-'])]:size-3",
27
+ "icon-lg": "size-8 [&_svg:not([class*='size-'])]:size-4"
28
+ }
29
+ },
30
+ defaultVariants: {
31
+ variant: "default",
32
+ size: "default"
33
+ }
34
+ });
35
+ function Button({ className, variant = "default", size = "default", ...props }) {
36
+ return /* @__PURE__ */ jsx(Button$1, {
37
+ "data-slot": "button",
38
+ className: cn(buttonVariants({
39
+ variant,
40
+ size,
41
+ className
42
+ })),
43
+ ...props
44
+ });
45
+ }
46
+
47
+ //#endregion
48
+ export { Button, buttonVariants };
@@ -0,0 +1,58 @@
1
+ import "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { cn } from "../../lib/utils";
4
+
5
+ //#region src/components/ui/card.tsx
6
+ function Card({ className, size = "default", ...props }) {
7
+ return /* @__PURE__ */ jsx("div", {
8
+ "data-slot": "card",
9
+ "data-size": size,
10
+ className: cn("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-lg py-4 text-xs/relaxed ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg group/card flex flex-col", className),
11
+ ...props
12
+ });
13
+ }
14
+ function CardHeader({ className, ...props }) {
15
+ return /* @__PURE__ */ jsx("div", {
16
+ "data-slot": "card-header",
17
+ className: cn("gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]", className),
18
+ ...props
19
+ });
20
+ }
21
+ function CardTitle({ className, ...props }) {
22
+ return /* @__PURE__ */ jsx("div", {
23
+ "data-slot": "card-title",
24
+ className: cn("text-sm font-medium", className),
25
+ ...props
26
+ });
27
+ }
28
+ function CardDescription({ className, ...props }) {
29
+ return /* @__PURE__ */ jsx("div", {
30
+ "data-slot": "card-description",
31
+ className: cn("text-muted-foreground text-xs/relaxed", className),
32
+ ...props
33
+ });
34
+ }
35
+ function CardAction({ className, ...props }) {
36
+ return /* @__PURE__ */ jsx("div", {
37
+ "data-slot": "card-action",
38
+ className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
39
+ ...props
40
+ });
41
+ }
42
+ function CardContent({ className, ...props }) {
43
+ return /* @__PURE__ */ jsx("div", {
44
+ "data-slot": "card-content",
45
+ className: cn("px-4 group-data-[size=sm]/card:px-3", className),
46
+ ...props
47
+ });
48
+ }
49
+ function CardFooter({ className, ...props }) {
50
+ return /* @__PURE__ */ jsx("div", {
51
+ "data-slot": "card-footer",
52
+ className: cn("rounded-b-lg px-4 group-data-[size=sm]/card:px-3 [.border-t]:pt-4 group-data-[size=sm]/card:[.border-t]:pt-3 flex items-center", className),
53
+ ...props
54
+ });
55
+ }
56
+
57
+ //#endregion
58
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,21 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/utils";
3
+ import { CheckIcon } from "@phosphor-icons/react";
4
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
5
+
6
+ //#region src/components/ui/checkbox.tsx
7
+ function Checkbox({ className, ...props }) {
8
+ return /* @__PURE__ */ jsx(Checkbox$1.Root, {
9
+ "data-slot": "checkbox",
10
+ className: cn("border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[4px] border transition-shadow group-has-disabled/field:opacity-50 focus-visible:ring-[2px] aria-invalid:ring-[2px] peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50", className),
11
+ ...props,
12
+ children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
13
+ "data-slot": "checkbox-indicator",
14
+ className: "[&>svg]:size-3.5 grid place-content-center text-current transition-none",
15
+ children: /* @__PURE__ */ jsx(CheckIcon, {})
16
+ })
17
+ });
18
+ }
19
+
20
+ //#endregion
21
+ export { Checkbox };
@@ -0,0 +1,163 @@
1
+ import * as React$1 from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Button } from "./button";
4
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "./input-group";
5
+ import { cn } from "../../lib/utils";
6
+ import { CaretDownIcon, CheckIcon, XIcon } from "@phosphor-icons/react";
7
+ import { Combobox as Combobox$1 } from "@base-ui/react";
8
+
9
+ //#region src/components/ui/combobox.tsx
10
+ const Combobox = Combobox$1.Root;
11
+ function ComboboxValue({ ...props }) {
12
+ return /* @__PURE__ */ jsx(Combobox$1.Value, {
13
+ "data-slot": "combobox-value",
14
+ ...props
15
+ });
16
+ }
17
+ function ComboboxTrigger({ className, children, ...props }) {
18
+ return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
19
+ "data-slot": "combobox-trigger",
20
+ className: cn("[&_svg:not([class*='size-'])]:size-3.5", className),
21
+ ...props,
22
+ children: [children, /* @__PURE__ */ jsx(CaretDownIcon, { className: "text-muted-foreground size-3.5 pointer-events-none" })]
23
+ });
24
+ }
25
+ function ComboboxClear({ className, ...props }) {
26
+ return /* @__PURE__ */ jsx(Combobox$1.Clear, {
27
+ "data-slot": "combobox-clear",
28
+ render: /* @__PURE__ */ jsx(InputGroupButton, {
29
+ variant: "ghost",
30
+ size: "icon-xs"
31
+ }),
32
+ className: cn(className),
33
+ ...props,
34
+ children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
35
+ });
36
+ }
37
+ function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }) {
38
+ return /* @__PURE__ */ jsxs(InputGroup, {
39
+ className: cn("w-auto", className),
40
+ children: [
41
+ /* @__PURE__ */ jsx(Combobox$1.Input, {
42
+ render: /* @__PURE__ */ jsx(InputGroupInput, { disabled }),
43
+ ...props
44
+ }),
45
+ /* @__PURE__ */ jsxs(InputGroupAddon, {
46
+ align: "inline-end",
47
+ children: [showTrigger && /* @__PURE__ */ jsx(InputGroupButton, {
48
+ size: "icon-xs",
49
+ variant: "ghost",
50
+ render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
51
+ "data-slot": "input-group-button",
52
+ className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",
53
+ disabled
54
+ }), showClear && /* @__PURE__ */ jsx(ComboboxClear, { disabled })]
55
+ }),
56
+ children
57
+ ]
58
+ });
59
+ }
60
+ function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, ...props }) {
61
+ return /* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Combobox$1.Positioner, {
62
+ side,
63
+ sideOffset,
64
+ align,
65
+ alignOffset,
66
+ anchor,
67
+ className: "isolate z-50",
68
+ children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
69
+ "data-slot": "combobox-content",
70
+ "data-chips": !!anchor,
71
+ className: cn("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/20 dark:bg-popover max-h-72 min-w-32 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)", className),
72
+ ...props
73
+ })
74
+ }) });
75
+ }
76
+ function ComboboxList({ className, ...props }) {
77
+ return /* @__PURE__ */ jsx(Combobox$1.List, {
78
+ "data-slot": "combobox-list",
79
+ className: cn("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 data-empty:p-0 overflow-y-auto overscroll-contain", className),
80
+ ...props
81
+ });
82
+ }
83
+ function ComboboxItem({ className, children, ...props }) {
84
+ return /* @__PURE__ */ jsxs(Combobox$1.Item, {
85
+ "data-slot": "combobox-item",
86
+ className: cn("data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
87
+ ...props,
88
+ children: [children, /* @__PURE__ */ jsx(Combobox$1.ItemIndicator, {
89
+ render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute right-2 flex items-center justify-center" }),
90
+ children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none" })
91
+ })]
92
+ });
93
+ }
94
+ function ComboboxGroup({ className, ...props }) {
95
+ return /* @__PURE__ */ jsx(Combobox$1.Group, {
96
+ "data-slot": "combobox-group",
97
+ className: cn(className),
98
+ ...props
99
+ });
100
+ }
101
+ function ComboboxLabel({ className, ...props }) {
102
+ return /* @__PURE__ */ jsx(Combobox$1.GroupLabel, {
103
+ "data-slot": "combobox-label",
104
+ className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
105
+ ...props
106
+ });
107
+ }
108
+ function ComboboxCollection({ ...props }) {
109
+ return /* @__PURE__ */ jsx(Combobox$1.Collection, {
110
+ "data-slot": "combobox-collection",
111
+ ...props
112
+ });
113
+ }
114
+ function ComboboxEmpty({ className, ...props }) {
115
+ return /* @__PURE__ */ jsx(Combobox$1.Empty, {
116
+ "data-slot": "combobox-empty",
117
+ className: cn("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex", className),
118
+ ...props
119
+ });
120
+ }
121
+ function ComboboxSeparator({ className, ...props }) {
122
+ return /* @__PURE__ */ jsx(Combobox$1.Separator, {
123
+ "data-slot": "combobox-separator",
124
+ className: cn("bg-border/50 -mx-1 my-1 h-px", className),
125
+ ...props
126
+ });
127
+ }
128
+ function ComboboxChips({ className, ...props }) {
129
+ return /* @__PURE__ */ jsx(Combobox$1.Chips, {
130
+ "data-slot": "combobox-chips",
131
+ className: cn("bg-input/20 dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/30 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive dark:has-aria-invalid:border-destructive/50 flex min-h-7 flex-wrap items-center gap-1 rounded-md border bg-clip-padding px-2 py-0.5 text-xs/relaxed transition-colors focus-within:ring-[2px] has-aria-invalid:ring-[2px] has-data-[slot=combobox-chip]:px-1", className),
132
+ ...props
133
+ });
134
+ }
135
+ function ComboboxChip({ className, children, showRemove = true, ...props }) {
136
+ return /* @__PURE__ */ jsxs(Combobox$1.Chip, {
137
+ "data-slot": "combobox-chip",
138
+ className: cn("bg-muted-foreground/10 text-foreground flex h-[calc(--spacing(4.75))] w-fit items-center justify-center gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1.5 text-xs/relaxed font-medium whitespace-nowrap has-data-[slot=combobox-chip-remove]:pr-0 has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50", className),
139
+ ...props,
140
+ children: [children, showRemove && /* @__PURE__ */ jsx(Combobox$1.ChipRemove, {
141
+ render: /* @__PURE__ */ jsx(Button, {
142
+ variant: "ghost",
143
+ size: "icon-xs"
144
+ }),
145
+ className: "-ml-1 opacity-50 hover:opacity-100",
146
+ "data-slot": "combobox-chip-remove",
147
+ children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
148
+ })]
149
+ });
150
+ }
151
+ function ComboboxChipsInput({ className, ...props }) {
152
+ return /* @__PURE__ */ jsx(Combobox$1.Input, {
153
+ "data-slot": "combobox-chip-input",
154
+ className: cn("min-w-16 flex-1 outline-none", className),
155
+ ...props
156
+ });
157
+ }
158
+ function useComboboxAnchor() {
159
+ return React$1.useRef(null);
160
+ }
161
+
162
+ //#endregion
163
+ export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+
3
+ import "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Button } from "./button";
6
+ import { cn } from "../../lib/utils";
7
+ import { XIcon } from "@phosphor-icons/react";
8
+ import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
9
+
10
+ //#region src/components/ui/dialog.tsx
11
+ function Dialog({ ...props }) {
12
+ return /* @__PURE__ */ jsx(Dialog$1.Root, {
13
+ "data-slot": "dialog",
14
+ ...props
15
+ });
16
+ }
17
+ function DialogTrigger({ ...props }) {
18
+ return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
19
+ "data-slot": "dialog-trigger",
20
+ ...props
21
+ });
22
+ }
23
+ function DialogPortal({ ...props }) {
24
+ return /* @__PURE__ */ jsx(Dialog$1.Portal, {
25
+ "data-slot": "dialog-portal",
26
+ ...props
27
+ });
28
+ }
29
+ function DialogClose({ ...props }) {
30
+ return /* @__PURE__ */ jsx(Dialog$1.Close, {
31
+ "data-slot": "dialog-close",
32
+ ...props
33
+ });
34
+ }
35
+ function DialogOverlay({ className, ...props }) {
36
+ return /* @__PURE__ */ jsx(Dialog$1.Backdrop, {
37
+ "data-slot": "dialog-overlay",
38
+ className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50", className),
39
+ ...props
40
+ });
41
+ }
42
+ function DialogContent({ className, children, showCloseButton = true, ...props }) {
43
+ return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Popup, {
44
+ "data-slot": "dialog-content",
45
+ className: cn("bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-xs/relaxed ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none", className),
46
+ ...props,
47
+ children: [children, showCloseButton && /* @__PURE__ */ jsxs(Dialog$1.Close, {
48
+ "data-slot": "dialog-close",
49
+ render: /* @__PURE__ */ jsx(Button, {
50
+ variant: "ghost",
51
+ className: "absolute top-2 right-2",
52
+ size: "icon-sm"
53
+ }),
54
+ children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
55
+ className: "sr-only",
56
+ children: "Close"
57
+ })]
58
+ })]
59
+ })] });
60
+ }
61
+ function DialogHeader({ className, ...props }) {
62
+ return /* @__PURE__ */ jsx("div", {
63
+ "data-slot": "dialog-header",
64
+ className: cn("gap-1 flex flex-col", className),
65
+ ...props
66
+ });
67
+ }
68
+ function DialogFooter({ className, showCloseButton = false, children, ...props }) {
69
+ return /* @__PURE__ */ jsxs("div", {
70
+ "data-slot": "dialog-footer",
71
+ className: cn("gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
72
+ ...props,
73
+ children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
74
+ render: /* @__PURE__ */ jsx(Button, { variant: "outline" }),
75
+ children: "Close"
76
+ })]
77
+ });
78
+ }
79
+ function DialogTitle({ className, ...props }) {
80
+ return /* @__PURE__ */ jsx(Dialog$1.Title, {
81
+ "data-slot": "dialog-title",
82
+ className: cn("text-sm font-medium", className),
83
+ ...props
84
+ });
85
+ }
86
+ function DialogDescription({ className, ...props }) {
87
+ return /* @__PURE__ */ jsx(Dialog$1.Description, {
88
+ "data-slot": "dialog-description",
89
+ className: cn("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed *:[a]:underline *:[a]:underline-offset-3", className),
90
+ ...props
91
+ });
92
+ }
93
+
94
+ //#endregion
95
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
@@ -0,0 +1,138 @@
1
+ "use client";
2
+
3
+ import "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { cn } from "../../lib/utils";
6
+ import { CaretRightIcon, CheckIcon } from "@phosphor-icons/react";
7
+ import { Menu } from "@base-ui/react/menu";
8
+
9
+ //#region src/components/ui/dropdown-menu.tsx
10
+ function DropdownMenu({ ...props }) {
11
+ return /* @__PURE__ */ jsx(Menu.Root, {
12
+ "data-slot": "dropdown-menu",
13
+ ...props
14
+ });
15
+ }
16
+ function DropdownMenuPortal({ ...props }) {
17
+ return /* @__PURE__ */ jsx(Menu.Portal, {
18
+ "data-slot": "dropdown-menu-portal",
19
+ ...props
20
+ });
21
+ }
22
+ function DropdownMenuTrigger({ ...props }) {
23
+ return /* @__PURE__ */ jsx(Menu.Trigger, {
24
+ "data-slot": "dropdown-menu-trigger",
25
+ ...props
26
+ });
27
+ }
28
+ function DropdownMenuContent({ align = "start", alignOffset = 0, side = "bottom", sideOffset = 4, className, ...props }) {
29
+ return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
30
+ className: "isolate z-50 outline-none",
31
+ align,
32
+ alignOffset,
33
+ side,
34
+ sideOffset,
35
+ children: /* @__PURE__ */ jsx(Menu.Popup, {
36
+ "data-slot": "dropdown-menu-content",
37
+ className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden", className),
38
+ ...props
39
+ })
40
+ }) });
41
+ }
42
+ function DropdownMenuGroup({ ...props }) {
43
+ return /* @__PURE__ */ jsx(Menu.Group, {
44
+ "data-slot": "dropdown-menu-group",
45
+ ...props
46
+ });
47
+ }
48
+ function DropdownMenuLabel({ className, inset, ...props }) {
49
+ return /* @__PURE__ */ jsx(Menu.GroupLabel, {
50
+ "data-slot": "dropdown-menu-label",
51
+ "data-inset": inset,
52
+ className: cn("text-muted-foreground px-2 py-1.5 text-xs data-[inset]:pl-8", className),
53
+ ...props
54
+ });
55
+ }
56
+ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
57
+ return /* @__PURE__ */ jsx(Menu.Item, {
58
+ "data-slot": "dropdown-menu-item",
59
+ "data-inset": inset,
60
+ "data-variant": variant,
61
+ className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
62
+ ...props
63
+ });
64
+ }
65
+ function DropdownMenuSub({ ...props }) {
66
+ return /* @__PURE__ */ jsx(Menu.SubmenuRoot, {
67
+ "data-slot": "dropdown-menu-sub",
68
+ ...props
69
+ });
70
+ }
71
+ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
72
+ return /* @__PURE__ */ jsxs(Menu.SubmenuTrigger, {
73
+ "data-slot": "dropdown-menu-sub-trigger",
74
+ "data-inset": inset,
75
+ className: cn("focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs [&_svg:not([class*='size-'])]:size-3.5 flex cursor-default items-center outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
76
+ ...props,
77
+ children: [children, /* @__PURE__ */ jsx(CaretRightIcon, { className: "ml-auto" })]
78
+ });
79
+ }
80
+ function DropdownMenuSubContent({ align = "start", alignOffset = -3, side = "right", sideOffset = 0, className, ...props }) {
81
+ return /* @__PURE__ */ jsx(DropdownMenuContent, {
82
+ "data-slot": "dropdown-menu-sub-content",
83
+ className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 w-auto", className),
84
+ align,
85
+ alignOffset,
86
+ side,
87
+ sideOffset,
88
+ ...props
89
+ });
90
+ }
91
+ function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
92
+ return /* @__PURE__ */ jsxs(Menu.CheckboxItem, {
93
+ "data-slot": "dropdown-menu-checkbox-item",
94
+ className: cn("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
95
+ checked,
96
+ ...props,
97
+ children: [/* @__PURE__ */ jsx("span", {
98
+ className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
99
+ "data-slot": "dropdown-menu-checkbox-item-indicator",
100
+ children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
101
+ }), children]
102
+ });
103
+ }
104
+ function DropdownMenuRadioGroup({ ...props }) {
105
+ return /* @__PURE__ */ jsx(Menu.RadioGroup, {
106
+ "data-slot": "dropdown-menu-radio-group",
107
+ ...props
108
+ });
109
+ }
110
+ function DropdownMenuRadioItem({ className, children, ...props }) {
111
+ return /* @__PURE__ */ jsxs(Menu.RadioItem, {
112
+ "data-slot": "dropdown-menu-radio-item",
113
+ className: cn("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
114
+ ...props,
115
+ children: [/* @__PURE__ */ jsx("span", {
116
+ className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
117
+ "data-slot": "dropdown-menu-radio-item-indicator",
118
+ children: /* @__PURE__ */ jsx(Menu.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
119
+ }), children]
120
+ });
121
+ }
122
+ function DropdownMenuSeparator({ className, ...props }) {
123
+ return /* @__PURE__ */ jsx(Menu.Separator, {
124
+ "data-slot": "dropdown-menu-separator",
125
+ className: cn("bg-border/50 -mx-1 my-1 h-px", className),
126
+ ...props
127
+ });
128
+ }
129
+ function DropdownMenuShortcut({ className, ...props }) {
130
+ return /* @__PURE__ */ jsx("span", {
131
+ "data-slot": "dropdown-menu-shortcut",
132
+ className: cn("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-[0.625rem] tracking-widest", className),
133
+ ...props
134
+ });
135
+ }
136
+
137
+ //#endregion
138
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
@@ -0,0 +1,113 @@
1
+ "use client";
2
+
3
+ import { useMemo } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Label } from "./label";
6
+ import { Separator } from "./separator";
7
+ import { cn } from "../../lib/utils";
8
+ import { cva } from "class-variance-authority";
9
+
10
+ //#region src/components/ui/field.tsx
11
+ function FieldSet({ className, ...props }) {
12
+ return /* @__PURE__ */ jsx("fieldset", {
13
+ "data-slot": "field-set",
14
+ className: cn("gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 flex flex-col", className),
15
+ ...props
16
+ });
17
+ }
18
+ function FieldLegend({ className, variant = "legend", ...props }) {
19
+ return /* @__PURE__ */ jsx("legend", {
20
+ "data-slot": "field-legend",
21
+ "data-variant": variant,
22
+ className: cn("mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm", className),
23
+ ...props
24
+ });
25
+ }
26
+ function FieldGroup({ className, ...props }) {
27
+ return /* @__PURE__ */ jsx("div", {
28
+ "data-slot": "field-group",
29
+ className: cn("gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4 group/field-group @container/field-group flex w-full flex-col", className),
30
+ ...props
31
+ });
32
+ }
33
+ const fieldVariants = cva("data-[invalid=true]:text-destructive gap-2 group/field flex w-full", {
34
+ variants: { orientation: {
35
+ vertical: "flex-col [&>*]:w-full [&>.sr-only]:w-auto",
36
+ 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",
37
+ 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"
38
+ } },
39
+ defaultVariants: { orientation: "vertical" }
40
+ });
41
+ function Field({ className, orientation = "vertical", ...props }) {
42
+ return /* @__PURE__ */ jsx("div", {
43
+ role: "group",
44
+ "data-slot": "field",
45
+ "data-orientation": orientation,
46
+ className: cn(fieldVariants({ orientation }), className),
47
+ ...props
48
+ });
49
+ }
50
+ function FieldContent({ className, ...props }) {
51
+ return /* @__PURE__ */ jsx("div", {
52
+ "data-slot": "field-content",
53
+ className: cn("gap-0.5 group/field-content flex flex-1 flex-col leading-snug", className),
54
+ ...props
55
+ });
56
+ }
57
+ function FieldLabel({ className, ...props }) {
58
+ return /* @__PURE__ */ jsx(Label, {
59
+ "data-slot": "field-label",
60
+ className: cn("has-data-checked:bg-primary/5 dark:has-data-checked:bg-primary/10 gap-2 group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2 group/field-label peer/field-label flex w-fit leading-snug", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
61
+ ...props
62
+ });
63
+ }
64
+ function FieldTitle({ className, ...props }) {
65
+ return /* @__PURE__ */ jsx("div", {
66
+ "data-slot": "field-label",
67
+ className: cn("gap-2 text-xs/relaxed font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center leading-snug", className),
68
+ ...props
69
+ });
70
+ }
71
+ function FieldDescription({ className, ...props }) {
72
+ return /* @__PURE__ */ jsx("p", {
73
+ "data-slot": "field-description",
74
+ className: cn("text-muted-foreground text-left text-xs/relaxed [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance", "last:mt-0 nth-last-2:-mt-1", "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", className),
75
+ ...props
76
+ });
77
+ }
78
+ function FieldSeparator({ children, className, ...props }) {
79
+ return /* @__PURE__ */ jsxs("div", {
80
+ "data-slot": "field-separator",
81
+ "data-content": !!children,
82
+ className: cn("-my-2 h-5 text-xs/relaxed group-data-[variant=outline]/field-group:-mb-2 relative", className),
83
+ ...props,
84
+ children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
85
+ className: "text-muted-foreground px-2 bg-background relative mx-auto block w-fit",
86
+ "data-slot": "field-separator-content",
87
+ children
88
+ })]
89
+ });
90
+ }
91
+ function FieldError({ className, children, errors, ...props }) {
92
+ const content = useMemo(() => {
93
+ if (children) return children;
94
+ if (!errors?.length) return null;
95
+ const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
96
+ if (uniqueErrors?.length == 1) return uniqueErrors[0]?.message;
97
+ return /* @__PURE__ */ jsx("ul", {
98
+ className: "ml-4 flex list-disc flex-col gap-1",
99
+ children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index))
100
+ });
101
+ }, [children, errors]);
102
+ if (!content) return null;
103
+ return /* @__PURE__ */ jsx("div", {
104
+ role: "alert",
105
+ "data-slot": "field-error",
106
+ className: cn("text-destructive text-xs/relaxed font-normal", className),
107
+ ...props,
108
+ children: content
109
+ });
110
+ }
111
+
112
+ //#endregion
113
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };