@nswds/ui 2.2.0 → 3.1.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/README.md +1 -1
  2. package/dist/components/badge.d.ts +11 -23
  3. package/dist/components/badge.js +22 -7
  4. package/dist/components/badge.js.map +1 -1
  5. package/dist/components/button.d.ts +7 -41
  6. package/dist/components/button.js +8 -7
  7. package/dist/components/button.js.map +1 -1
  8. package/dist/components/card.d.ts +7 -7
  9. package/dist/components/card.js +22 -6
  10. package/dist/components/card.js.map +1 -1
  11. package/dist/components/description-list.d.ts +9 -3
  12. package/dist/components/description-list.js +6 -0
  13. package/dist/components/description-list.js.map +1 -1
  14. package/dist/components/field.d.ts +11 -10
  15. package/dist/components/field.js +107 -31
  16. package/dist/components/field.js.map +1 -1
  17. package/dist/components/input.d.ts +1 -1
  18. package/dist/components/input.js +7 -1
  19. package/dist/components/input.js.map +1 -1
  20. package/dist/components/label.d.ts +1 -1
  21. package/dist/components/label.js +2 -1
  22. package/dist/components/label.js.map +1 -1
  23. package/dist/components/labeled-separator.d.ts +1 -1
  24. package/dist/components/labeled-separator.js +2 -0
  25. package/dist/components/labeled-separator.js.map +1 -1
  26. package/dist/components/link.d.ts +3 -23
  27. package/dist/components/link.js +8 -7
  28. package/dist/components/link.js.map +1 -1
  29. package/dist/components/logo.d.ts +3 -2
  30. package/dist/components/logo.js +2 -2
  31. package/dist/components/logo.js.map +1 -1
  32. package/dist/components/separator.d.ts +1 -1
  33. package/dist/components/separator.js +3 -0
  34. package/dist/components/separator.js.map +1 -1
  35. package/dist/components/spinner.d.ts +4 -2
  36. package/dist/components/spinner.js +2 -1
  37. package/dist/components/spinner.js.map +1 -1
  38. package/dist/index.d.ts +1 -0
  39. package/dist/styles.css +1 -1
  40. package/package.json +3 -4
@@ -4,11 +4,13 @@ import { cn } from '../lib/utils.js';
4
4
  function Card({
5
5
  className,
6
6
  size = "default",
7
+ ref,
7
8
  ...props
8
9
  }) {
9
10
  return /* @__PURE__ */ jsx(
10
11
  "div",
11
12
  {
13
+ ref,
12
14
  "data-slot": "card",
13
15
  "data-size": size,
14
16
  className: cn(
@@ -19,10 +21,11 @@ function Card({
19
21
  }
20
22
  );
21
23
  }
22
- function CardHeader({ className, ...props }) {
24
+ function CardHeader({ className, ref, ...props }) {
23
25
  return /* @__PURE__ */ jsx(
24
26
  "div",
25
27
  {
28
+ ref,
26
29
  "data-slot": "card-header",
27
30
  className: cn(
28
31
  "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-lg px-8 group-data-[size=sm]/card:px-6 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",
@@ -32,30 +35,37 @@ function CardHeader({ className, ...props }) {
32
35
  }
33
36
  );
34
37
  }
35
- function CardTitle({ className, ...props }) {
38
+ function CardTitle({ className, ref, ...props }) {
36
39
  return /* @__PURE__ */ jsx(
37
40
  "div",
38
41
  {
42
+ ref,
39
43
  "data-slot": "card-title",
40
44
  className: cn("font-heading text-2xl font-medium", className),
41
45
  ...props
42
46
  }
43
47
  );
44
48
  }
45
- function CardDescription({ className, ...props }) {
49
+ function CardDescription({
50
+ className,
51
+ ref,
52
+ ...props
53
+ }) {
46
54
  return /* @__PURE__ */ jsx(
47
55
  "div",
48
56
  {
57
+ ref,
49
58
  "data-slot": "card-description",
50
59
  className: cn("text-base/relaxed text-muted-foreground", className),
51
60
  ...props
52
61
  }
53
62
  );
54
63
  }
55
- function CardAction({ className, ...props }) {
64
+ function CardAction({ className, ref, ...props }) {
56
65
  return /* @__PURE__ */ jsx(
57
66
  "div",
58
67
  {
68
+ ref,
59
69
  "data-slot": "card-action",
60
70
  className: cn(
61
71
  "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
@@ -65,20 +75,26 @@ function CardAction({ className, ...props }) {
65
75
  }
66
76
  );
67
77
  }
68
- function CardContent({ className, ...props }) {
78
+ function CardContent({
79
+ className,
80
+ ref,
81
+ ...props
82
+ }) {
69
83
  return /* @__PURE__ */ jsx(
70
84
  "div",
71
85
  {
86
+ ref,
72
87
  "data-slot": "card-content",
73
88
  className: cn("px-8 group-data-[size=sm]/card:px-6", className),
74
89
  ...props
75
90
  }
76
91
  );
77
92
  }
78
- function CardFooter({ className, ...props }) {
93
+ function CardFooter({ className, ref, ...props }) {
79
94
  return /* @__PURE__ */ jsx(
80
95
  "div",
81
96
  {
97
+ ref,
82
98
  "data-slot": "card-footer",
83
99
  className: cn(
84
100
  "flex items-center rounded-b-lg px-8 group-data-[size=sm]/card:px-6 [.border-t]:pt-4 group-data-[size=sm]/card:[.border-t]:pt-3",
@@ -1 +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,+QAAA;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,mCAAA,EAAqC,SAAS,CAAA;AAAA,MAC3D,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,yCAAA,EAA2C,SAAS,CAAA;AAAA,MACjE,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-8 text-base/relaxed text-card-foreground ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-6 *:[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-8 group-data-[size=sm]/card:px-6 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-2xl 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-base/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-8 group-data-[size=sm]/card:px-6', 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-8 group-data-[size=sm]/card:px-6 [.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 CardAction,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n}\n\n// Derived prop types — exact component props for consumers wrapping these.\nexport type CardProps = React.ComponentProps<typeof Card>\nexport type CardHeaderProps = React.ComponentProps<typeof CardHeader>\nexport type CardTitleProps = React.ComponentProps<typeof CardTitle>\nexport type CardDescriptionProps = React.ComponentProps<typeof CardDescription>\nexport type CardActionProps = React.ComponentProps<typeof CardAction>\nexport type CardContentProps = React.ComponentProps<typeof CardContent>\nexport type CardFooterProps = React.ComponentProps<typeof CardFooter>\n"]}
1
+ {"version":3,"sources":["../../src/components/card.tsx"],"names":[],"mappings":";;;AAIA,SAAS,IAAA,CAAK;AAAA,EACZ,SAAA;AAAA,EACA,IAAA,GAAO,SAAA;AAAA,EACP,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA8D;AAC5D,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,MAAA;AAAA,MACV,WAAA,EAAW,IAAA;AAAA,MACX,SAAA,EAAW,EAAA;AAAA,QACT,+QAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAW,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAgC;AAC7E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,oSAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,UAAU,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAgC;AAC5E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAA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F;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 ref,\n ...props\n}: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {\n return (\n <div\n ref={ref}\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-8 text-base/relaxed text-card-foreground ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-6 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\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-8 group-data-[size=sm]/card:px-6 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, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot=\"card-title\"\n className={cn('font-heading text-2xl font-medium', className)}\n {...props}\n />\n )\n}\n\nfunction CardDescription({\n className,\n ref,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot=\"card-description\"\n className={cn('text-base/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\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({\n className,\n ref,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot=\"card-content\"\n className={cn('px-8 group-data-[size=sm]/card:px-6', className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot=\"card-footer\"\n className={cn(\n 'flex items-center rounded-b-lg px-8 group-data-[size=sm]/card:px-6 [.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 CardAction,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n}\n\n// Derived prop types — exact component props for consumers wrapping these.\nexport type CardProps = React.ComponentProps<typeof Card>\nexport type CardHeaderProps = React.ComponentProps<typeof CardHeader>\nexport type CardTitleProps = React.ComponentProps<typeof CardTitle>\nexport type CardDescriptionProps = React.ComponentProps<typeof CardDescription>\nexport type CardActionProps = React.ComponentProps<typeof CardAction>\nexport type CardContentProps = React.ComponentProps<typeof CardContent>\nexport type CardFooterProps = React.ComponentProps<typeof CardFooter>\n"]}
@@ -1,8 +1,14 @@
1
1
  import * as React from 'react';
2
2
 
3
- declare function DescriptionList({ className, ...props }: React.ComponentPropsWithoutRef<'dl'>): React.JSX.Element;
4
- declare function DescriptionTerm({ className, ...props }: React.ComponentPropsWithoutRef<'dt'>): React.JSX.Element;
5
- declare function DescriptionDetails({ className, ...props }: React.ComponentPropsWithoutRef<'dd'>): React.JSX.Element;
3
+ declare function DescriptionList({ className, ref, ...props }: React.ComponentPropsWithoutRef<'dl'> & {
4
+ ref?: React.Ref<HTMLDListElement>;
5
+ }): React.JSX.Element;
6
+ declare function DescriptionTerm({ className, ref, ...props }: React.ComponentPropsWithoutRef<'dt'> & {
7
+ ref?: React.Ref<HTMLElement>;
8
+ }): React.JSX.Element;
9
+ declare function DescriptionDetails({ className, ref, ...props }: React.ComponentPropsWithoutRef<'dd'> & {
10
+ ref?: React.Ref<HTMLElement>;
11
+ }): React.JSX.Element;
6
12
  type DescriptionListProps = React.ComponentProps<typeof DescriptionList>;
7
13
  type DescriptionTermProps = React.ComponentProps<typeof DescriptionTerm>;
8
14
  type DescriptionDetailsProps = React.ComponentProps<typeof DescriptionDetails>;
@@ -3,11 +3,13 @@ import { cn } from '../lib/utils.js';
3
3
 
4
4
  function DescriptionList({
5
5
  className,
6
+ ref,
6
7
  ...props
7
8
  }) {
8
9
  return /* @__PURE__ */ jsx(
9
10
  "dl",
10
11
  {
12
+ ref,
11
13
  ...props,
12
14
  className: cn(
13
15
  "grid grid-cols-1 text-base/6 sm:grid-cols-[min(50%,--spacing(80))_auto] sm:text-sm/6",
@@ -18,11 +20,13 @@ function DescriptionList({
18
20
  }
19
21
  function DescriptionTerm({
20
22
  className,
23
+ ref,
21
24
  ...props
22
25
  }) {
23
26
  return /* @__PURE__ */ jsx(
24
27
  "dt",
25
28
  {
29
+ ref,
26
30
  ...props,
27
31
  className: cn(
28
32
  "col-start-1 border-t border-border pt-3 text-muted-foreground first:border-none sm:border-t sm:py-3",
@@ -33,11 +37,13 @@ function DescriptionTerm({
33
37
  }
34
38
  function DescriptionDetails({
35
39
  className,
40
+ ref,
36
41
  ...props
37
42
  }) {
38
43
  return /* @__PURE__ */ jsx(
39
44
  "dd",
40
45
  {
46
+ ref,
41
47
  ...props,
42
48
  className: cn(
43
49
  "pt-1 pb-3 text-foreground sm:border-t sm:border-border sm:py-3 sm:[&:nth-child(2)]:border-none",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/description-list.tsx"],"names":[],"mappings":";;;AAIO,SAAS,eAAA,CAAgB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyC;AACvC,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,sFAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ;AAEO,SAAS,eAAA,CAAgB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyC;AACvC,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,qGAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ;AAEO,SAAS,kBAAA,CAAmB;AAAA,EACjC,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyC;AACvC,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,gGAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ","file":"description-list.js","sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nexport function DescriptionList({\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'dl'>) {\n return (\n <dl\n {...props}\n className={cn(\n 'grid grid-cols-1 text-base/6 sm:grid-cols-[min(50%,--spacing(80))_auto] sm:text-sm/6',\n className\n )}\n />\n )\n}\n\nexport function DescriptionTerm({\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'dt'>) {\n return (\n <dt\n {...props}\n className={cn(\n 'col-start-1 border-t border-border pt-3 text-muted-foreground first:border-none sm:border-t sm:py-3',\n className\n )}\n />\n )\n}\n\nexport function DescriptionDetails({\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'dd'>) {\n return (\n <dd\n {...props}\n className={cn(\n 'pt-1 pb-3 text-foreground sm:border-t sm:border-border sm:py-3 sm:[&:nth-child(2)]:border-none',\n className\n )}\n />\n )\n}\n\nexport type DescriptionListProps = React.ComponentProps<typeof DescriptionList>\nexport type DescriptionTermProps = React.ComponentProps<typeof DescriptionTerm>\nexport type DescriptionDetailsProps = React.ComponentProps<\n typeof DescriptionDetails\n>\n"]}
1
+ {"version":3,"sources":["../../src/components/description-list.tsx"],"names":[],"mappings":";;;AAIO,SAAS,eAAA,CAAgB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAEG;AACD,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACC,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,sFAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ;AAEO,SAAS,eAAA,CAAgB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAEG;AACD,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACC,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,qGAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ;AAEO,SAAS,kBAAA,CAAmB;AAAA,EACjC,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAEG;AACD,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACC,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,gGAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ","file":"description-list.js","sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nexport function DescriptionList({\n className,\n ref,\n ...props\n}: React.ComponentPropsWithoutRef<'dl'> & {\n ref?: React.Ref<HTMLDListElement>\n}) {\n return (\n <dl\n ref={ref}\n {...props}\n className={cn(\n 'grid grid-cols-1 text-base/6 sm:grid-cols-[min(50%,--spacing(80))_auto] sm:text-sm/6',\n className\n )}\n />\n )\n}\n\nexport function DescriptionTerm({\n className,\n ref,\n ...props\n}: React.ComponentPropsWithoutRef<'dt'> & {\n ref?: React.Ref<HTMLElement>\n}) {\n return (\n <dt\n ref={ref}\n {...props}\n className={cn(\n 'col-start-1 border-t border-border pt-3 text-muted-foreground first:border-none sm:border-t sm:py-3',\n className\n )}\n />\n )\n}\n\nexport function DescriptionDetails({\n className,\n ref,\n ...props\n}: React.ComponentPropsWithoutRef<'dd'> & {\n ref?: React.Ref<HTMLElement>\n}) {\n return (\n <dd\n ref={ref}\n {...props}\n className={cn(\n 'pt-1 pb-3 text-foreground sm:border-t sm:border-border sm:py-3 sm:[&:nth-child(2)]:border-none',\n className\n )}\n />\n )\n}\n\nexport type DescriptionListProps = React.ComponentProps<typeof DescriptionList>\nexport type DescriptionTermProps = React.ComponentProps<typeof DescriptionTerm>\nexport type DescriptionDetailsProps = React.ComponentProps<\n typeof DescriptionDetails\n>\n"]}
@@ -1,25 +1,26 @@
1
1
  import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import { Field as Field$1 } from '@base-ui/react/field';
2
3
  import { VariantProps } from 'class-variance-authority';
3
4
  import * as React from 'react';
4
5
  import { Label } from './label.js';
5
6
 
6
- declare function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>): React.JSX.Element;
7
- declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<'legend'> & {
7
+ declare function FieldSet({ className, ref, ...props }: React.ComponentProps<'fieldset'>): React.JSX.Element;
8
+ declare function FieldLegend({ className, variant, ref, ...props }: React.ComponentProps<'legend'> & {
8
9
  variant?: 'legend' | 'label';
9
10
  }): React.JSX.Element;
10
- declare function FieldGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
11
+ declare function FieldGroup({ className, ref, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
11
12
  declare const fieldVariants: (props?: ({
12
13
  orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
13
14
  } & class_variance_authority_types.ClassProp) | undefined) => string;
14
- declare function Field({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>): React.JSX.Element;
15
- declare function FieldContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
16
- declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React.JSX.Element;
17
- declare function FieldTitle({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
18
- declare function FieldDescription({ className, ...props }: React.ComponentProps<'p'>): React.JSX.Element;
19
- declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<'div'> & {
15
+ declare function Field({ className, orientation, ref, children, ...props }: React.ComponentProps<typeof Field$1.Root> & VariantProps<typeof fieldVariants>): React.JSX.Element;
16
+ declare function FieldContent({ className, ref, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
17
+ declare function FieldLabel({ className, ref, ...props }: React.ComponentProps<typeof Label>): React.JSX.Element;
18
+ declare function FieldTitle({ className, ref, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
19
+ declare function FieldDescription({ className, ref, ...props }: React.ComponentProps<'p'>): React.JSX.Element;
20
+ declare function FieldSeparator({ children, className, ref, ...props }: React.ComponentProps<'div'> & {
20
21
  children?: React.ReactNode;
21
22
  }): React.JSX.Element;
22
- declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<'div'> & {
23
+ declare function FieldError({ className, children, errors, ref, ...props }: React.ComponentProps<'div'> & {
23
24
  errors?: Array<{
24
25
  message?: string;
25
26
  } | undefined>;
@@ -1,15 +1,22 @@
1
1
  "use client"
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { Field as Field$1 } from '@base-ui/react/field';
3
4
  import { cva } from 'class-variance-authority';
4
- import { useMemo } from 'react';
5
+ import * as React from 'react';
5
6
  import { Label } from '../components/label.js';
6
7
  import { Separator } from '../components/separator.js';
7
8
  import { cn } from '../lib/utils.js';
8
9
 
9
- function FieldSet({ className, ...props }) {
10
+ const InsideFieldContext = React.createContext(false);
11
+ function FieldSet({
12
+ className,
13
+ ref,
14
+ ...props
15
+ }) {
10
16
  return /* @__PURE__ */ jsx(
11
17
  "fieldset",
12
18
  {
19
+ ref,
13
20
  "data-slot": "field-set",
14
21
  className: cn(
15
22
  "flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
@@ -22,11 +29,13 @@ function FieldSet({ className, ...props }) {
22
29
  function FieldLegend({
23
30
  className,
24
31
  variant = "legend",
32
+ ref,
25
33
  ...props
26
34
  }) {
27
35
  return /* @__PURE__ */ jsx(
28
36
  "legend",
29
37
  {
38
+ ref,
30
39
  "data-slot": "field-legend",
31
40
  "data-variant": variant,
32
41
  className: cn(
@@ -37,10 +46,11 @@ function FieldLegend({
37
46
  }
38
47
  );
39
48
  }
40
- function FieldGroup({ className, ...props }) {
49
+ function FieldGroup({ className, ref, ...props }) {
41
50
  return /* @__PURE__ */ jsx(
42
51
  "div",
43
52
  {
53
+ ref,
44
54
  "data-slot": "field-group",
45
55
  className: cn(
46
56
  // `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a
@@ -55,7 +65,10 @@ function FieldGroup({ className, ...props }) {
55
65
  );
56
66
  }
57
67
  const fieldVariants = cva(
58
- "group/field flex w-full gap-2 data-[invalid=true]:text-destructive",
68
+ // `data-invalid:` (presence) matches the `data-invalid` attribute Base UI's
69
+ // Field.Root sets when the field is invalid (via the `invalid` prop or native
70
+ // validation) — replacing the old hand-set `data-[invalid=true]`.
71
+ "group/field flex w-full gap-2 data-invalid:text-destructive",
59
72
  {
60
73
  variants: {
61
74
  orientation: {
@@ -72,23 +85,32 @@ const fieldVariants = cva(
72
85
  function Field({
73
86
  className,
74
87
  orientation = "vertical",
88
+ ref,
89
+ children,
75
90
  ...props
76
91
  }) {
77
92
  return /* @__PURE__ */ jsx(
78
- "div",
93
+ Field$1.Root,
79
94
  {
95
+ ref,
80
96
  role: "group",
81
97
  "data-slot": "field",
82
98
  "data-orientation": orientation,
83
99
  className: cn(fieldVariants({ orientation }), className),
84
- ...props
100
+ ...props,
101
+ children: /* @__PURE__ */ jsx(InsideFieldContext.Provider, { value: true, children })
85
102
  }
86
103
  );
87
104
  }
88
- function FieldContent({ className, ...props }) {
105
+ function FieldContent({
106
+ className,
107
+ ref,
108
+ ...props
109
+ }) {
89
110
  return /* @__PURE__ */ jsx(
90
111
  "div",
91
112
  {
113
+ ref,
92
114
  "data-slot": "field-content",
93
115
  className: cn(
94
116
  "group/field-content flex flex-1 flex-col gap-0.5 leading-snug",
@@ -98,51 +120,82 @@ function FieldContent({ className, ...props }) {
98
120
  }
99
121
  );
100
122
  }
123
+ const fieldLabelClassName = cn(
124
+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-disabled/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",
125
+ "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col"
126
+ );
101
127
  function FieldLabel({
102
128
  className,
129
+ ref,
103
130
  ...props
104
131
  }) {
132
+ const insideField = React.useContext(InsideFieldContext);
133
+ if (!insideField) {
134
+ return /* @__PURE__ */ jsx(
135
+ Label,
136
+ {
137
+ ref,
138
+ "data-slot": "field-label",
139
+ className: cn(fieldLabelClassName, className),
140
+ ...props
141
+ }
142
+ );
143
+ }
105
144
  return /* @__PURE__ */ jsx(
106
- Label,
145
+ Field$1.Label,
107
146
  {
147
+ ref,
148
+ render: /* @__PURE__ */ jsx(Label, {}),
108
149
  "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
- ),
150
+ className: cn(fieldLabelClassName, className),
114
151
  ...props
115
152
  }
116
153
  );
117
154
  }
118
- function FieldTitle({ className, ...props }) {
155
+ function FieldTitle({ className, ref, ...props }) {
119
156
  return /* @__PURE__ */ jsx(
120
157
  "div",
121
158
  {
159
+ ref,
122
160
  "data-slot": "field-label",
123
161
  className: cn(
124
- "flex w-fit items-center gap-2 text-sm/relaxed font-medium group-data-[disabled=true]/field:opacity-50",
162
+ "flex w-fit items-center gap-2 text-sm/relaxed font-medium group-data-disabled/field:opacity-50",
125
163
  className
126
164
  ),
127
165
  ...props
128
166
  }
129
167
  );
130
168
  }
131
- function FieldDescription({ className, ...props }) {
169
+ const fieldDescriptionClassName = cn(
170
+ // `group-data-[orientation=horizontal]/field:` matches the
171
+ // `data-orientation="horizontal"` attribute Field emits.
172
+ "text-start text-sm/relaxed leading-normal font-normal text-muted-foreground group-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
173
+ "last:mt-0 nth-last-2:-mt-1",
174
+ "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary"
175
+ );
176
+ function FieldDescription({
177
+ className,
178
+ ref,
179
+ ...props
180
+ }) {
181
+ const insideField = React.useContext(InsideFieldContext);
182
+ if (!insideField) {
183
+ return /* @__PURE__ */ jsx(
184
+ "p",
185
+ {
186
+ ref,
187
+ "data-slot": "field-description",
188
+ className: cn(fieldDescriptionClassName, className),
189
+ ...props
190
+ }
191
+ );
192
+ }
132
193
  return /* @__PURE__ */ jsx(
133
- "p",
194
+ Field$1.Description,
134
195
  {
196
+ ref,
135
197
  "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-sm/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
- ),
198
+ className: cn(fieldDescriptionClassName, className),
146
199
  ...props
147
200
  }
148
201
  );
@@ -150,11 +203,13 @@ function FieldDescription({ className, ...props }) {
150
203
  function FieldSeparator({
151
204
  children,
152
205
  className,
206
+ ref,
153
207
  ...props
154
208
  }) {
155
209
  return /* @__PURE__ */ jsxs(
156
210
  "div",
157
211
  {
212
+ ref,
158
213
  "data-slot": "field-separator",
159
214
  "data-content": !!children,
160
215
  className: cn(
@@ -180,9 +235,11 @@ function FieldError({
180
235
  className,
181
236
  children,
182
237
  errors,
238
+ ref,
183
239
  ...props
184
240
  }) {
185
- const content = useMemo(() => {
241
+ const insideField = React.useContext(InsideFieldContext);
242
+ const content = React.useMemo(() => {
186
243
  if (children) {
187
244
  return children;
188
245
  }
@@ -192,7 +249,7 @@ function FieldError({
192
249
  const uniqueErrors = [
193
250
  ...new Map(errors.map((error) => [error?.message, error])).values()
194
251
  ];
195
- if (uniqueErrors?.length == 1) {
252
+ if (uniqueErrors?.length === 1) {
196
253
  return uniqueErrors[0]?.message;
197
254
  }
198
255
  return /* @__PURE__ */ jsx("ul", { className: "ms-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
@@ -202,12 +259,31 @@ function FieldError({
202
259
  if (!content) {
203
260
  return null;
204
261
  }
262
+ const errorClassName = cn(
263
+ "text-sm/relaxed font-normal text-destructive",
264
+ className
265
+ );
266
+ if (!insideField) {
267
+ return /* @__PURE__ */ jsx(
268
+ "div",
269
+ {
270
+ ref,
271
+ role: "alert",
272
+ "data-slot": "field-error",
273
+ className: errorClassName,
274
+ ...props,
275
+ children: content
276
+ }
277
+ );
278
+ }
205
279
  return /* @__PURE__ */ jsx(
206
- "div",
280
+ Field$1.Error,
207
281
  {
282
+ ref,
283
+ match: true,
208
284
  role: "alert",
209
285
  "data-slot": "field-error",
210
- className: cn("text-sm/relaxed font-normal text-destructive", className),
286
+ className: errorClassName,
211
287
  ...props,
212
288
  children: content
213
289
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/field.tsx"],"names":[],"mappings":";;;;;;;AA8BA,SAAS,QAAA,CAAS,EAAE,SAAA,EAAW,GAAG,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A,CAAa,CAAC,CAAA,EAAG,OAAA;AAAA,IAC1B;AAEA,IAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,oCAAA,EACX,QAAA,EAAA,YAAA,CAAa,GAAA;AAAA,MACZ,CAAC,OAAO,KAAA,KACN,KAAA,EAAO,2BAAW,GAAA,CAAC,IAAA,EAAA,EAAgB,QAAA,EAAA,KAAA,CAAM,OAAA,EAAA,EAAd,KAAsB;AAAA,KACrD,EACF,CAAA;AAAA,EAEJ,CAAA,EAAG,CAAC,QAAA,EAAU,MAAM,CAAC,CAAA;AAErB,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,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 { cva, type VariantProps } from 'class-variance-authority'\nimport type * as React from 'react'\nimport { useMemo } from 'react'\n\nimport { Label } from '../components/label.js'\nimport { Separator } from '../components/separator.js'\nimport { cn } from '../lib/utils.js'\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Typography hierarchy (deliberate, do not collapse to a single size)\n// ─────────────────────────────────────────────────────────────────────────────\n//\n// FieldLabel inherits its font-size from the Label primitive (`text-base/\n// relaxed` = 16px) — the primary form text users read when scanning a form,\n// kept at the 16px ideal for body copy.\n// Every supporting element in this file uses `text-sm/relaxed` (14px). That\n// is below the 16px body-copy ideal but comfortably above the 12px floor\n// older versions used, so it still reads clearly as secondary information.\n// The 16/14 gap is intentional: it preserves a scannable visual hierarchy\n// (label > description / error / metadata) without shrinking supporting text\n// back down to the previous 12px.\n//\n// If you find yourself wanting to bump these to text-base, do it in\n// `label.tsx` so FieldLabel moves with the family. If you want to drop\n// them to text-xs, please raise that as a design decision — 12px is below\n// the NSW Government digital service standards minimum body-text size.\n// ─────────────────────────────────────────────────────────────────────────────\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-sm/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-sm/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-sm/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-sm/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-sm/relaxed font-normal text-destructive', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n}\n\n// Derived prop types — exact component props for consumers wrapping these.\nexport type FieldProps = React.ComponentProps<typeof Field>\nexport type FieldSetProps = React.ComponentProps<typeof FieldSet>\nexport type FieldLegendProps = React.ComponentProps<typeof FieldLegend>\nexport type FieldGroupProps = React.ComponentProps<typeof FieldGroup>\nexport type FieldContentProps = React.ComponentProps<typeof FieldContent>\nexport type FieldLabelProps = React.ComponentProps<typeof FieldLabel>\nexport type FieldTitleProps = React.ComponentProps<typeof FieldTitle>\nexport type FieldDescriptionProps = React.ComponentProps<\n typeof FieldDescription\n>\nexport type FieldSeparatorProps = React.ComponentProps<typeof FieldSeparator>\nexport type FieldErrorProps = React.ComponentProps<typeof FieldError>\n"]}
1
+ {"version":3,"sources":["../../src/components/field.tsx"],"names":["FieldPrimitive"],"mappings":";;;;;;;;AAuDA,MAAM,kBAAA,GAAqB,KAAA,CAAM,aAAA,CAAc,KAAK,CAAA;AAEpD,SAAS,QAAA,CAAS;AAAA,EAChB,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAqC;AACnC,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,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,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAsE;AACpE,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,cAAA;AAAA,MACV,cAAA,EAAc,OAAA;AAAA,MACd,SAAA,EAAW,EAAA;AAAA,QACT,qFAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAW,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAgC;AAC7E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,aAAA;AAAA,M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A,QACL,WAAA,EAAU,aAAA;AAAA,QACV,SAAA,EAAW,cAAA;AAAA,QACV,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AAEA,EAAA,uBACE,GAAA;AAAA,IAACA,OAAA,CAAe,KAAA;AAAA,IAAf;AAAA,MACC,GAAA;AAAA,MAKA,KAAA,EAAK,IAAA;AAAA,MACL,IAAA,EAAK,OAAA;AAAA,MACL,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,cAAA;AAAA,MACV,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"field.js","sourcesContent":["'use client'\n\nimport { Field as FieldPrimitive } from '@base-ui/react/field'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Label } from '../components/label.js'\nimport { Separator } from '../components/separator.js'\nimport { cn } from '../lib/utils.js'\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Base UI Field\n// ─────────────────────────────────────────────────────────────────────────────\n//\n// `Field`, `FieldLabel`, `FieldDescription`, and `FieldError` wrap Base UI's\n// Field primitive (@base-ui/react/field). Base UI owns the accessible wiring:\n// the label is associated with the control, and any description/error ids are\n// added to the control's `aria-describedby` automatically — no manual\n// `htmlFor` / `aria-describedby` / `aria-invalid` plumbing required. Set\n// `invalid` on `Field` (e.g. from react-hook-form) and the control receives\n// `aria-invalid` and the wrapper gets `data-invalid` for free.\n//\n// Base UI's Field parts must live inside a `Field.Root`. To keep the previous\n// behaviour where a label/description/error could also be used standalone\n// (e.g. a group-level FieldDescription directly inside a FieldSet), FieldLabel/\n// FieldDescription/FieldError opt into the Base UI part only when they detect a\n// surrounding `Field` (via `InsideFieldContext`) and otherwise render the plain\n// element they did before. Inside a Field they gain the automatic association;\n// outside one they are unchanged.\n//\n// `FieldSet` / `FieldLegend` stay native `<fieldset>` / `<legend>` (already\n// accessible for grouping); `FieldGroup` / `FieldContent` / `FieldSeparator` /\n// `FieldTitle` remain layout-only primitives.\n//\n// ─────────────────────────────────────────────────────────────────────────────\n// Typography hierarchy (deliberate, do not collapse to a single size)\n// ─────────────────────────────────────────────────────────────────────────────\n//\n// FieldLabel inherits its font-size from the Label primitive (`text-base/\n// relaxed` = 16px) — the primary form text users read when scanning a form,\n// kept at the 16px ideal for body copy.\n// Every supporting element in this file uses `text-sm/relaxed` (14px). That\n// is below the 16px body-copy ideal but comfortably above the 12px floor\n// older versions used, so it still reads clearly as secondary information.\n// The 16/14 gap is intentional: it preserves a scannable visual hierarchy\n// (label > description / error / metadata) without shrinking supporting text\n// back down to the previous 12px.\n//\n// If you find yourself wanting to bump these to text-base, do it in\n// `label.tsx` so FieldLabel moves with the family. If you want to drop\n// them to text-xs, please raise that as a design decision — 12px is below\n// the NSW Government digital service standards minimum body-text size.\n// ─────────────────────────────────────────────────────────────────────────────\n\n// True for descendants of our <Field> (which renders Base UI's Field.Root).\nconst InsideFieldContext = React.createContext(false)\n\nfunction FieldSet({\n className,\n ref,\n ...props\n}: React.ComponentProps<'fieldset'>) {\n return (\n <fieldset\n ref={ref}\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 ref,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n return (\n <legend\n ref={ref}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-2 font-medium data-[variant=label]:text-sm/relaxed data-[variant=legend]:text-sm',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\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 // `data-invalid:` (presence) matches the `data-invalid` attribute Base UI's\n // Field.Root sets when the field is invalid (via the `invalid` prop or native\n // validation) — replacing the old hand-set `data-[invalid=true]`.\n 'group/field flex w-full gap-2 data-invalid: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 ref,\n children,\n ...props\n}: React.ComponentProps<typeof FieldPrimitive.Root> &\n VariantProps<typeof fieldVariants>) {\n return (\n <FieldPrimitive.Root\n ref={ref}\n // Preserve the explicit group role + data-orientation the layout and the\n // accessibility tests rely on; Base UI's Root renders a bare <div>.\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n >\n <InsideFieldContext.Provider value={true}>\n {children}\n </InsideFieldContext.Provider>\n </FieldPrimitive.Root>\n )\n}\n\nfunction FieldContent({\n className,\n ref,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\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\nconst fieldLabelClassName = cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-disabled/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)\n\nfunction FieldLabel({\n className,\n ref,\n ...props\n}: React.ComponentProps<typeof Label>) {\n const insideField = React.useContext(InsideFieldContext)\n\n // Standalone (no surrounding Field): render the styled Label directly, as\n // before. Base UI's Field.Label would throw without a Field.Root ancestor.\n if (!insideField) {\n return (\n <Label\n ref={ref}\n data-slot=\"field-label\"\n className={cn(fieldLabelClassName, className)}\n {...props}\n />\n )\n }\n\n return (\n <FieldPrimitive.Label\n // Base UI's Field.Label types its ref as HTMLElement (it can render a\n // non-label); here it always renders our <Label>, so the ref is an\n // HTMLLabelElement at runtime.\n ref={ref as React.Ref<HTMLElement>}\n // Render through our styled Label so FieldLabel keeps the Label\n // primitive's typography + data-slot, while Base UI supplies the\n // automatic `htmlFor` association with the field control.\n render={<Label />}\n data-slot=\"field-label\"\n className={cn(fieldLabelClassName, className)}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot=\"field-label\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm/relaxed font-medium group-data-disabled/field:opacity-50',\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldDescriptionClassName = cn(\n // `group-data-[orientation=horizontal]/field:` matches the\n // `data-orientation=\"horizontal\"` attribute Field emits.\n 'text-start text-sm/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)\n\nfunction FieldDescription({\n className,\n ref,\n ...props\n}: React.ComponentProps<'p'>) {\n const insideField = React.useContext(InsideFieldContext)\n\n // Standalone (e.g. a group-level description inside a FieldSet): a plain\n // <p>, as before. Inside a Field, Base UI links it to the control via\n // aria-describedby.\n if (!insideField) {\n return (\n <p\n ref={ref}\n data-slot=\"field-description\"\n className={cn(fieldDescriptionClassName, className)}\n {...props}\n />\n )\n }\n\n return (\n <FieldPrimitive.Description\n ref={ref}\n data-slot=\"field-description\"\n className={cn(fieldDescriptionClassName, className)}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({\n children,\n className,\n ref,\n ...props\n}: React.ComponentProps<'div'> & {\n children?: React.ReactNode\n}) {\n return (\n <div\n ref={ref}\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n 'relative -my-2 h-5 text-sm/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 ref,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const insideField = React.useContext(InsideFieldContext)\n\n const content = React.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 const errorClassName = cn(\n 'text-sm/relaxed font-normal text-destructive',\n className\n )\n\n // Standalone: a plain alert region, as before. Inside a Field, Base UI links\n // it to the control via aria-describedby.\n if (!insideField) {\n return (\n <div\n ref={ref}\n role=\"alert\"\n data-slot=\"field-error\"\n className={errorClassName}\n {...props}\n >\n {content}\n </div>\n )\n }\n\n return (\n <FieldPrimitive.Error\n ref={ref}\n // `match` lets the `errors` array / external library drive visibility\n // instead of the control's native ValidityState. We only render this when\n // there IS content, so force it visible; Base UI then adds its id to the\n // control's `aria-describedby`.\n match\n role=\"alert\"\n data-slot=\"field-error\"\n className={errorClassName}\n {...props}\n >\n {content}\n </FieldPrimitive.Error>\n )\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n}\n\n// Derived prop types — exact component props for consumers wrapping these.\nexport type FieldProps = React.ComponentProps<typeof Field>\nexport type FieldSetProps = React.ComponentProps<typeof FieldSet>\nexport type FieldLegendProps = React.ComponentProps<typeof FieldLegend>\nexport type FieldGroupProps = React.ComponentProps<typeof FieldGroup>\nexport type FieldContentProps = React.ComponentProps<typeof FieldContent>\nexport type FieldLabelProps = React.ComponentProps<typeof FieldLabel>\nexport type FieldTitleProps = React.ComponentProps<typeof FieldTitle>\nexport type FieldDescriptionProps = React.ComponentProps<\n typeof FieldDescription\n>\nexport type FieldSeparatorProps = React.ComponentProps<typeof FieldSeparator>\nexport type FieldErrorProps = React.ComponentProps<typeof FieldError>\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- declare function Input({ className, type, ...props }: React.ComponentProps<'input'>): React.JSX.Element;
3
+ declare function Input({ className, type, ref, ...props }: React.ComponentProps<'input'>): React.JSX.Element;
4
4
 
5
5
  type InputProps = React.ComponentProps<typeof Input>;
6
6
 
@@ -3,10 +3,16 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { Input as Input$1 } from '@base-ui/react/input';
4
4
  import { cn } from '../lib/utils.js';
5
5
 
6
- function Input({ className, type, ...props }) {
6
+ function Input({
7
+ className,
8
+ type,
9
+ ref,
10
+ ...props
11
+ }) {
7
12
  return /* @__PURE__ */ jsx(
8
13
  Input$1,
9
14
  {
15
+ ref,
10
16
  type,
11
17
  "data-slot": "input",
12
18
  "data-type": type,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/input.tsx"],"names":["InputPrimitive"],"mappings":";;;;AAOA,SAAS,MAAM,EAAE,SAAA,EAAW,IAAA,EAAM,GAAG,OAAM,EAAkC;AAC3E,EAAA,uBACE,GAAA;AAAA,IAACA,OAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,WAAA,EAAU,OAAA;AAAA,MACV,WAAA,EAAW,IAAA;AAAA,MACX,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA;AAAA,QAIT,sEAAA;AAAA;AAAA;AAAA;AAAA,QAIA,+EAAA;AAAA;AAAA,QAEA,kCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,mHAAA;AAAA;AAAA,QAEA,0HAAA;AAAA;AAAA,QAEA,wCAAA;AAAA;AAAA,QAEA,8EAAA;AAAA;AAAA,QAEA,oLAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"input.js","sourcesContent":["'use client'\n\nimport { Input as InputPrimitive } from '@base-ui/react/input'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Input({ className, type, ...props }: React.ComponentProps<'input'>) {\n return (\n <InputPrimitive\n type={type}\n data-slot=\"input\"\n data-type={type}\n className={cn(\n // No `outline-none` here: it sets `--tw-outline-style: none` globally\n // on the element, which then suppresses the focus outline below\n // (which reads `outline-style: var(--tw-outline-style)`).\n 'h-12 w-full min-w-0 rounded-sm px-4 py-2 text-base transition-colors',\n // Every colour routes through the --input-* semantic tokens (layer 3,\n // theme.css / the registry theme item). Dark mode and brand themes\n // restyle the input by remapping tokens — no dark: variants here.\n 'border border-(--input-border) bg-(--input-surface) text-(--input-foreground)',\n // Hover\n 'hover:bg-(--input-surface-hover)',\n // Focus — `focus-visible:` per the design-system policy (matches\n // Button/Link). For text fields this is behaviour-preserving:\n // browsers flag keyboard-editable controls as :focus-visible even\n // when focused by pointer, so the ring still shows on click.\n 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--input-ring)',\n // File input slot\n 'file:inline-flex file:h-8 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-(--input-foreground)',\n // Placeholder styles\n 'placeholder:text-(--input-placeholder)',\n // Disabled\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n // Invalid — 2px danger border, danger hover surface (Figma error variants)\n 'aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus-visible:outline-(--input-invalid-ring)',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Input }\n\nexport type InputProps = React.ComponentProps<typeof Input>\n"]}
1
+ {"version":3,"sources":["../../src/components/input.tsx"],"names":["InputPrimitive"],"mappings":";;;;AAOA,SAAS,KAAA,CAAM;AAAA,EACb,SAAA;AAAA,EACA,IAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAkC;AAChC,EAAA,uBACE,GAAA;AAAA,IAACA,OAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAA,EAAU,OAAA;AAAA,MACV,WAAA,EAAW,IAAA;AAAA,MACX,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA;AAAA,QAIT,sEAAA;AAAA;AAAA;AAAA;AAAA,QAIA,+EAAA;AAAA;AAAA,QAEA,kCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,mHAAA;AAAA;AAAA,QAEA,0HAAA;AAAA;AAAA,QAEA,wCAAA;AAAA;AAAA,QAEA,8EAAA;AAAA;AAAA,QAEA,oLAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"input.js","sourcesContent":["'use client'\n\nimport { Input as InputPrimitive } from '@base-ui/react/input'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Input({\n className,\n type,\n ref,\n ...props\n}: React.ComponentProps<'input'>) {\n return (\n <InputPrimitive\n ref={ref}\n type={type}\n data-slot=\"input\"\n data-type={type}\n className={cn(\n // No `outline-none` here: it sets `--tw-outline-style: none` globally\n // on the element, which then suppresses the focus outline below\n // (which reads `outline-style: var(--tw-outline-style)`).\n 'h-12 w-full min-w-0 rounded-sm px-4 py-2 text-base transition-colors',\n // Every colour routes through the --input-* semantic tokens (layer 3,\n // theme.css / the registry theme item). Dark mode and brand themes\n // restyle the input by remapping tokens — no dark: variants here.\n 'border border-(--input-border) bg-(--input-surface) text-(--input-foreground)',\n // Hover\n 'hover:bg-(--input-surface-hover)',\n // Focus — `focus-visible:` per the design-system policy (matches\n // Button/Link). For text fields this is behaviour-preserving:\n // browsers flag keyboard-editable controls as :focus-visible even\n // when focused by pointer, so the ring still shows on click.\n 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--input-ring)',\n // File input slot\n 'file:inline-flex file:h-8 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-(--input-foreground)',\n // Placeholder styles\n 'placeholder:text-(--input-placeholder)',\n // Disabled\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n // Invalid — 2px danger border, danger hover surface (Figma error variants)\n 'aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus-visible:outline-(--input-invalid-ring)',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Input }\n\nexport type InputProps = React.ComponentProps<typeof Input>\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- declare function Label({ className, ...props }: React.ComponentProps<'label'>): React.JSX.Element;
3
+ declare function Label({ className, ref, ...props }: React.ComponentProps<'label'>): React.JSX.Element;
4
4
 
5
5
  type LabelProps = React.ComponentProps<typeof Label>;
6
6