@nswds/ui 1.2.0 → 1.4.0

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 (40) hide show
  1. package/dist/components/badge.d.ts +12 -5
  2. package/dist/components/badge.js +9 -9
  3. package/dist/components/badge.js.map +1 -1
  4. package/dist/components/button.d.ts +37 -7
  5. package/dist/components/button.js +40 -13
  6. package/dist/components/button.js.map +1 -1
  7. package/dist/components/card.d.ts +14 -0
  8. package/dist/components/card.js +94 -0
  9. package/dist/components/card.js.map +1 -0
  10. package/dist/components/field.d.ts +29 -0
  11. package/dist/components/field.js +219 -0
  12. package/dist/components/field.js.map +1 -0
  13. package/dist/components/icons.js +38220 -3822
  14. package/dist/components/icons.js.map +1 -1
  15. package/dist/components/input.d.ts +6 -0
  16. package/dist/components/input.js +50 -0
  17. package/dist/components/input.js.map +1 -0
  18. package/dist/components/label.d.ts +6 -0
  19. package/dist/components/label.js +21 -0
  20. package/dist/components/label.js.map +1 -0
  21. package/dist/components/link.d.ts +10 -0
  22. package/dist/components/link.js +3 -4
  23. package/dist/components/link.js.map +1 -1
  24. package/dist/components/login-form.d.ts +6 -0
  25. package/dist/components/login-form.js +59 -0
  26. package/dist/components/login-form.js.map +1 -0
  27. package/dist/components/logo.js.map +1 -1
  28. package/dist/components/separator.d.ts +6 -0
  29. package/dist/components/separator.js +32 -0
  30. package/dist/components/separator.js.map +1 -0
  31. package/dist/components/spinner.js +1 -1
  32. package/dist/components/spinner.js.map +1 -1
  33. package/dist/index.d.ts +1 -1
  34. package/dist/lib/theme-palette.js.map +1 -1
  35. package/dist/styles.css +1 -1
  36. package/package.json +6 -4
  37. package/src/styles/globals.css.d.ts +2 -0
  38. package/dist/styles/globals.css.d.d.ts +0 -2
  39. package/dist/styles/globals.css.d.js +0 -3
  40. package/dist/styles/globals.css.d.js.map +0 -1
@@ -0,0 +1,94 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cn } from '../lib/utils.js';
3
+
4
+ function Card({
5
+ className,
6
+ size = "default",
7
+ ...props
8
+ }) {
9
+ return /* @__PURE__ */ jsx(
10
+ "div",
11
+ {
12
+ "data-slot": "card",
13
+ "data-size": size,
14
+ className: cn(
15
+ "group/card flex flex-col gap-4 overflow-hidden rounded-lg bg-card py-4 text-xs/relaxed text-card-foreground ring-1 ring-foreground/10 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",
16
+ className
17
+ ),
18
+ ...props
19
+ }
20
+ );
21
+ }
22
+ function CardHeader({ className, ...props }) {
23
+ return /* @__PURE__ */ jsx(
24
+ "div",
25
+ {
26
+ "data-slot": "card-header",
27
+ className: cn(
28
+ "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
29
+ className
30
+ ),
31
+ ...props
32
+ }
33
+ );
34
+ }
35
+ function CardTitle({ className, ...props }) {
36
+ return /* @__PURE__ */ jsx(
37
+ "div",
38
+ {
39
+ "data-slot": "card-title",
40
+ className: cn("font-heading text-sm font-medium", className),
41
+ ...props
42
+ }
43
+ );
44
+ }
45
+ function CardDescription({ className, ...props }) {
46
+ return /* @__PURE__ */ jsx(
47
+ "div",
48
+ {
49
+ "data-slot": "card-description",
50
+ className: cn("text-xs/relaxed text-muted-foreground", className),
51
+ ...props
52
+ }
53
+ );
54
+ }
55
+ function CardAction({ className, ...props }) {
56
+ return /* @__PURE__ */ jsx(
57
+ "div",
58
+ {
59
+ "data-slot": "card-action",
60
+ className: cn(
61
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
62
+ className
63
+ ),
64
+ ...props
65
+ }
66
+ );
67
+ }
68
+ function CardContent({ className, ...props }) {
69
+ return /* @__PURE__ */ jsx(
70
+ "div",
71
+ {
72
+ "data-slot": "card-content",
73
+ className: cn("px-4 group-data-[size=sm]/card:px-3", className),
74
+ ...props
75
+ }
76
+ );
77
+ }
78
+ function CardFooter({ className, ...props }) {
79
+ return /* @__PURE__ */ jsx(
80
+ "div",
81
+ {
82
+ "data-slot": "card-footer",
83
+ className: cn(
84
+ "flex items-center 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",
85
+ className
86
+ ),
87
+ ...props
88
+ }
89
+ );
90
+ }
91
+
92
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
93
+ //# sourceMappingURL=card.js.map
94
+ //# sourceMappingURL=card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/card.tsx"],"names":[],"mappings":";;;AAIA,SAAS,IAAA,CAAK;AAAA,EACZ,SAAA;AAAA,EACA,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACL,CAAA,EAA8D;AAC5D,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,MAAA;AAAA,MACV,WAAA,EAAW,IAAA;AAAA,MACX,SAAA,EAAW,EAAA;AAAA,QACT,6QAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,oSAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,SAAA,CAAU,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACvE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,YAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,kCAAA,EAAoC,SAAS,CAAA;AAAA,MAC1D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,eAAA,CAAgB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AAC7E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,uCAAA,EAAyC,SAAS,CAAA;AAAA,MAC/D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,gEAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,gIAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"card.js","sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"../lib/utils.js\"\n\nfunction Card({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & { size?: \"default\" | \"sm\" }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n \"group/card flex flex-col gap-4 overflow-hidden rounded-lg bg-card py-4 text-xs/relaxed text-card-foreground ring-1 ring-foreground/10 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\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n \"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\"font-heading text-sm font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-xs/relaxed text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn(\"px-4 group-data-[size=sm]/card:px-3\", className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n \"flex items-center 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\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import { VariantProps } from 'class-variance-authority';
5
+ import { Label } from './label.js';
6
+
7
+ declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): react_jsx_runtime.JSX.Element;
8
+ declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<"legend"> & {
9
+ variant?: "legend" | "label";
10
+ }): react_jsx_runtime.JSX.Element;
11
+ declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
12
+ declare const fieldVariants: (props?: ({
13
+ orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
14
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
15
+ declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): react_jsx_runtime.JSX.Element;
16
+ declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
17
+ declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): react_jsx_runtime.JSX.Element;
18
+ declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
19
+ declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">): react_jsx_runtime.JSX.Element;
20
+ declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<"div"> & {
21
+ children?: React.ReactNode;
22
+ }): react_jsx_runtime.JSX.Element;
23
+ declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<"div"> & {
24
+ errors?: Array<{
25
+ message?: string;
26
+ } | undefined>;
27
+ }): react_jsx_runtime.JSX.Element | null;
28
+
29
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
@@ -0,0 +1,219 @@
1
+ "use client"
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { useMemo } from 'react';
4
+ import { cva } from 'class-variance-authority';
5
+ import { cn } from '../lib/utils.js';
6
+ import { Label } from '../components/label.js';
7
+ import { Separator } from '../components/separator.js';
8
+
9
+ function FieldSet({ className, ...props }) {
10
+ return /* @__PURE__ */ jsx(
11
+ "fieldset",
12
+ {
13
+ "data-slot": "field-set",
14
+ className: cn(
15
+ "flex flex-col gap-4 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__ */ jsx(
28
+ "legend",
29
+ {
30
+ "data-slot": "field-legend",
31
+ "data-variant": variant,
32
+ className: cn(
33
+ "mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm",
34
+ className
35
+ ),
36
+ ...props
37
+ }
38
+ );
39
+ }
40
+ function FieldGroup({ className, ...props }) {
41
+ return /* @__PURE__ */ jsx(
42
+ "div",
43
+ {
44
+ "data-slot": "field-group",
45
+ className: cn(
46
+ // `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a
47
+ // checkbox/radio group child. The original `data-[slot=checkbox-group]:gap-3`
48
+ // was self-referential (this element's slot is `field-group`) and
49
+ // could never apply. Mirrors the rule on FieldSet above.
50
+ "group/field-group @container/field-group flex w-full flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 *:data-[slot=field-group]:gap-4",
51
+ className
52
+ ),
53
+ ...props
54
+ }
55
+ );
56
+ }
57
+ const fieldVariants = cva(
58
+ "group/field flex w-full gap-2 data-[invalid=true]:text-destructive",
59
+ {
60
+ variants: {
61
+ orientation: {
62
+ vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
63
+ horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
64
+ responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
65
+ }
66
+ },
67
+ defaultVariants: {
68
+ orientation: "vertical"
69
+ }
70
+ }
71
+ );
72
+ function Field({
73
+ className,
74
+ orientation = "vertical",
75
+ ...props
76
+ }) {
77
+ return /* @__PURE__ */ jsx(
78
+ "div",
79
+ {
80
+ role: "group",
81
+ "data-slot": "field",
82
+ "data-orientation": orientation,
83
+ className: cn(fieldVariants({ orientation }), className),
84
+ ...props
85
+ }
86
+ );
87
+ }
88
+ function FieldContent({ className, ...props }) {
89
+ return /* @__PURE__ */ jsx(
90
+ "div",
91
+ {
92
+ "data-slot": "field-content",
93
+ className: cn(
94
+ "group/field-content flex flex-1 flex-col gap-0.5 leading-snug",
95
+ className
96
+ ),
97
+ ...props
98
+ }
99
+ );
100
+ }
101
+ function FieldLabel({
102
+ className,
103
+ ...props
104
+ }) {
105
+ return /* @__PURE__ */ jsx(
106
+ Label,
107
+ {
108
+ "data-slot": "field-label",
109
+ className: cn(
110
+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10",
111
+ "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",
112
+ className
113
+ ),
114
+ ...props
115
+ }
116
+ );
117
+ }
118
+ function FieldTitle({ className, ...props }) {
119
+ return /* @__PURE__ */ jsx(
120
+ "div",
121
+ {
122
+ "data-slot": "field-label",
123
+ className: cn(
124
+ "flex w-fit items-center gap-2 text-xs/relaxed font-medium group-data-[disabled=true]/field:opacity-50",
125
+ className
126
+ ),
127
+ ...props
128
+ }
129
+ );
130
+ }
131
+ function FieldDescription({ className, ...props }) {
132
+ return /* @__PURE__ */ jsx(
133
+ "p",
134
+ {
135
+ "data-slot": "field-description",
136
+ className: cn(
137
+ // `group-data-[orientation=horizontal]/field:` matches the actual
138
+ // `data-orientation="horizontal"` attribute Field emits. The previous
139
+ // `group-has-data-horizontal/field:` targeted a non-existent
140
+ // `[data-horizontal]` attribute and never fired.
141
+ "text-start text-xs/relaxed leading-normal font-normal text-muted-foreground group-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
142
+ "last:mt-0 nth-last-2:-mt-1",
143
+ "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
144
+ className
145
+ ),
146
+ ...props
147
+ }
148
+ );
149
+ }
150
+ function FieldSeparator({
151
+ children,
152
+ className,
153
+ ...props
154
+ }) {
155
+ return /* @__PURE__ */ jsxs(
156
+ "div",
157
+ {
158
+ "data-slot": "field-separator",
159
+ "data-content": !!children,
160
+ className: cn(
161
+ "relative -my-2 h-5 text-xs/relaxed group-data-[variant=outline]/field-group:-mb-2",
162
+ className
163
+ ),
164
+ ...props,
165
+ children: [
166
+ /* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
167
+ children && /* @__PURE__ */ jsx(
168
+ "span",
169
+ {
170
+ className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
171
+ "data-slot": "field-separator-content",
172
+ children
173
+ }
174
+ )
175
+ ]
176
+ }
177
+ );
178
+ }
179
+ function FieldError({
180
+ className,
181
+ children,
182
+ errors,
183
+ ...props
184
+ }) {
185
+ const content = useMemo(() => {
186
+ if (children) {
187
+ return children;
188
+ }
189
+ if (!errors?.length) {
190
+ return null;
191
+ }
192
+ const uniqueErrors = [
193
+ ...new Map(errors.map((error) => [error?.message, error])).values()
194
+ ];
195
+ if (uniqueErrors?.length == 1) {
196
+ return uniqueErrors[0]?.message;
197
+ }
198
+ return /* @__PURE__ */ jsx("ul", { className: "ms-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
199
+ (error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
200
+ ) });
201
+ }, [children, errors]);
202
+ if (!content) {
203
+ return null;
204
+ }
205
+ return /* @__PURE__ */ jsx(
206
+ "div",
207
+ {
208
+ role: "alert",
209
+ "data-slot": "field-error",
210
+ className: cn("text-xs/relaxed font-normal text-destructive", className),
211
+ ...props,
212
+ children: content
213
+ }
214
+ );
215
+ }
216
+
217
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
218
+ //# sourceMappingURL=field.js.map
219
+ //# sourceMappingURL=field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/field.tsx"],"names":[],"mappings":";;;;;;;AAUA,SAAS,QAAA,CAAS,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AAC3E,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,WAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,kGAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY;AAAA,EACnB,SAAA;AAAA,EACA,OAAA,GAAU,QAAA;AAAA,EACV,GAAG;AACL,CAAA,EAAsE;AACpE,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,cAAA,EAAc,OAAA;AAAA,MACd,SAAA,EAAW,EAAA;AAAA,QACT,qFAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AA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K,OAAA;AAAA,MACL,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,8CAAA,EAAgD,SAAS,CAAA;AAAA,MACtE,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"field.js","sourcesContent":["'use client'\n\nimport type * as React from 'react'\nimport { useMemo } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from \"../lib/utils.js\"\nimport { Label } from \"../components/label.js\"\nimport { Separator } from \"../components/separator.js\"\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm\",\n className\n )}\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 // `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a\n // checkbox/radio group child. The original `data-[slot=checkbox-group]:gap-3`\n // was self-referential (this element's slot is `field-group`) and\n // could never apply. Mirrors the rule on FieldSet above.\n \"group/field-group @container/field-group flex w-full flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 *:data-[slot=field-group]:gap-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n \"group/field flex w-full gap-2 data-[invalid=true]:text-destructive\",\n {\n variants: {\n orientation: {\n vertical: \"flex-col *:w-full [&>.sr-only]:w-auto\",\n horizontal:\n \"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n responsive:\n \"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n }\n)\n\nfunction Field({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n \"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLabel({\n className,\n ...props\n}: 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 group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10\",\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col\",\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(\n \"flex w-fit items-center gap-2 text-xs/relaxed font-medium group-data-[disabled=true]/field:opacity-50\",\n className\n )}\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 // `group-data-[orientation=horizontal]/field:` matches the actual\n // `data-orientation=\"horizontal\"` attribute Field emits. The previous\n // `group-has-data-horizontal/field:` targeted a non-existent\n // `[data-horizontal]` attribute and never fired.\n \"text-start text-xs/relaxed leading-normal font-normal text-muted-foreground group-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5\",\n \"last:mt-0 nth-last-2:-mt-1\",\n \"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary\",\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(\n \"relative -my-2 h-5 text-xs/relaxed group-data-[variant=outline]/field-group:-mb-2\",\n className\n )}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\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?.length) {\n return null\n }\n\n const uniqueErrors = [\n ...new Map(errors.map((error) => [error?.message, error])).values(),\n ]\n\n if (uniqueErrors?.length == 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className=\"ms-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map(\n (error, index) =>\n error?.message && <li key={index}>{error.message}</li>\n )}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"text-xs/relaxed font-normal text-destructive\", className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldTitle,\n}\n"]}