@nswds/ui 2.2.0 → 3.0.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.
- package/README.md +1 -1
- package/dist/components/badge.d.ts +10 -22
- package/dist/components/badge.js +22 -7
- package/dist/components/badge.js.map +1 -1
- package/dist/components/button.d.ts +6 -40
- package/dist/components/button.js +8 -7
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +7 -7
- package/dist/components/card.js +22 -6
- package/dist/components/card.js.map +1 -1
- package/dist/components/description-list.d.ts +9 -3
- package/dist/components/description-list.js +6 -0
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/field.d.ts +10 -10
- package/dist/components/field.js +32 -5
- package/dist/components/field.js.map +1 -1
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +7 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/label.d.ts +1 -1
- package/dist/components/label.js +2 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/labeled-separator.d.ts +1 -1
- package/dist/components/labeled-separator.js +2 -0
- package/dist/components/labeled-separator.js.map +1 -1
- package/dist/components/link.d.ts +3 -23
- package/dist/components/link.js +8 -7
- package/dist/components/link.js.map +1 -1
- package/dist/components/logo.d.ts +3 -2
- package/dist/components/logo.js +2 -2
- package/dist/components/logo.js.map +1 -1
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +3 -0
- package/dist/components/separator.js.map +1 -1
- package/dist/components/spinner.d.ts +4 -2
- package/dist/components/spinner.js +2 -1
- package/dist/components/spinner.js.map +1 -1
- package/package.json +3 -4
package/dist/components/card.js
CHANGED
|
@@ -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({
|
|
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({
|
|
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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;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,yCAAA,EAA2C,SAAS,CAAA;AAAA,MACjE,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,gEAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY;AAAA,EACnB,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAgC;AAC9B,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,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,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 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'>
|
|
4
|
-
|
|
5
|
-
|
|
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,
|
|
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"]}
|
|
@@ -3,23 +3,23 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Label } from './label.js';
|
|
5
5
|
|
|
6
|
-
declare function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>): React.JSX.Element;
|
|
7
|
-
declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<'legend'> & {
|
|
6
|
+
declare function FieldSet({ className, ref, ...props }: React.ComponentProps<'fieldset'>): React.JSX.Element;
|
|
7
|
+
declare function FieldLegend({ className, variant, ref, ...props }: React.ComponentProps<'legend'> & {
|
|
8
8
|
variant?: 'legend' | 'label';
|
|
9
9
|
}): React.JSX.Element;
|
|
10
|
-
declare function FieldGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
10
|
+
declare function FieldGroup({ className, ref, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
11
11
|
declare const fieldVariants: (props?: ({
|
|
12
12
|
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
13
13
|
} & 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'> & {
|
|
14
|
+
declare function Field({ className, orientation, ref, ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>): React.JSX.Element;
|
|
15
|
+
declare function FieldContent({ className, ref, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
16
|
+
declare function FieldLabel({ className, ref, ...props }: React.ComponentProps<typeof Label>): React.JSX.Element;
|
|
17
|
+
declare function FieldTitle({ className, ref, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
18
|
+
declare function FieldDescription({ className, ref, ...props }: React.ComponentProps<'p'>): React.JSX.Element;
|
|
19
|
+
declare function FieldSeparator({ children, className, ref, ...props }: React.ComponentProps<'div'> & {
|
|
20
20
|
children?: React.ReactNode;
|
|
21
21
|
}): React.JSX.Element;
|
|
22
|
-
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<'div'> & {
|
|
22
|
+
declare function FieldError({ className, children, errors, ref, ...props }: React.ComponentProps<'div'> & {
|
|
23
23
|
errors?: Array<{
|
|
24
24
|
message?: string;
|
|
25
25
|
} | undefined>;
|
package/dist/components/field.js
CHANGED
|
@@ -6,10 +6,15 @@ import { Label } from '../components/label.js';
|
|
|
6
6
|
import { Separator } from '../components/separator.js';
|
|
7
7
|
import { cn } from '../lib/utils.js';
|
|
8
8
|
|
|
9
|
-
function FieldSet({
|
|
9
|
+
function FieldSet({
|
|
10
|
+
className,
|
|
11
|
+
ref,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
10
14
|
return /* @__PURE__ */ jsx(
|
|
11
15
|
"fieldset",
|
|
12
16
|
{
|
|
17
|
+
ref,
|
|
13
18
|
"data-slot": "field-set",
|
|
14
19
|
className: cn(
|
|
15
20
|
"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
@@ -22,11 +27,13 @@ function FieldSet({ className, ...props }) {
|
|
|
22
27
|
function FieldLegend({
|
|
23
28
|
className,
|
|
24
29
|
variant = "legend",
|
|
30
|
+
ref,
|
|
25
31
|
...props
|
|
26
32
|
}) {
|
|
27
33
|
return /* @__PURE__ */ jsx(
|
|
28
34
|
"legend",
|
|
29
35
|
{
|
|
36
|
+
ref,
|
|
30
37
|
"data-slot": "field-legend",
|
|
31
38
|
"data-variant": variant,
|
|
32
39
|
className: cn(
|
|
@@ -37,10 +44,11 @@ function FieldLegend({
|
|
|
37
44
|
}
|
|
38
45
|
);
|
|
39
46
|
}
|
|
40
|
-
function FieldGroup({ className, ...props }) {
|
|
47
|
+
function FieldGroup({ className, ref, ...props }) {
|
|
41
48
|
return /* @__PURE__ */ jsx(
|
|
42
49
|
"div",
|
|
43
50
|
{
|
|
51
|
+
ref,
|
|
44
52
|
"data-slot": "field-group",
|
|
45
53
|
className: cn(
|
|
46
54
|
// `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a
|
|
@@ -72,11 +80,13 @@ const fieldVariants = cva(
|
|
|
72
80
|
function Field({
|
|
73
81
|
className,
|
|
74
82
|
orientation = "vertical",
|
|
83
|
+
ref,
|
|
75
84
|
...props
|
|
76
85
|
}) {
|
|
77
86
|
return /* @__PURE__ */ jsx(
|
|
78
87
|
"div",
|
|
79
88
|
{
|
|
89
|
+
ref,
|
|
80
90
|
role: "group",
|
|
81
91
|
"data-slot": "field",
|
|
82
92
|
"data-orientation": orientation,
|
|
@@ -85,10 +95,15 @@ function Field({
|
|
|
85
95
|
}
|
|
86
96
|
);
|
|
87
97
|
}
|
|
88
|
-
function FieldContent({
|
|
98
|
+
function FieldContent({
|
|
99
|
+
className,
|
|
100
|
+
ref,
|
|
101
|
+
...props
|
|
102
|
+
}) {
|
|
89
103
|
return /* @__PURE__ */ jsx(
|
|
90
104
|
"div",
|
|
91
105
|
{
|
|
106
|
+
ref,
|
|
92
107
|
"data-slot": "field-content",
|
|
93
108
|
className: cn(
|
|
94
109
|
"group/field-content flex flex-1 flex-col gap-0.5 leading-snug",
|
|
@@ -100,11 +115,13 @@ function FieldContent({ className, ...props }) {
|
|
|
100
115
|
}
|
|
101
116
|
function FieldLabel({
|
|
102
117
|
className,
|
|
118
|
+
ref,
|
|
103
119
|
...props
|
|
104
120
|
}) {
|
|
105
121
|
return /* @__PURE__ */ jsx(
|
|
106
122
|
Label,
|
|
107
123
|
{
|
|
124
|
+
ref,
|
|
108
125
|
"data-slot": "field-label",
|
|
109
126
|
className: cn(
|
|
110
127
|
"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",
|
|
@@ -115,10 +132,11 @@ function FieldLabel({
|
|
|
115
132
|
}
|
|
116
133
|
);
|
|
117
134
|
}
|
|
118
|
-
function FieldTitle({ className, ...props }) {
|
|
135
|
+
function FieldTitle({ className, ref, ...props }) {
|
|
119
136
|
return /* @__PURE__ */ jsx(
|
|
120
137
|
"div",
|
|
121
138
|
{
|
|
139
|
+
ref,
|
|
122
140
|
"data-slot": "field-label",
|
|
123
141
|
className: cn(
|
|
124
142
|
"flex w-fit items-center gap-2 text-sm/relaxed font-medium group-data-[disabled=true]/field:opacity-50",
|
|
@@ -128,10 +146,15 @@ function FieldTitle({ className, ...props }) {
|
|
|
128
146
|
}
|
|
129
147
|
);
|
|
130
148
|
}
|
|
131
|
-
function FieldDescription({
|
|
149
|
+
function FieldDescription({
|
|
150
|
+
className,
|
|
151
|
+
ref,
|
|
152
|
+
...props
|
|
153
|
+
}) {
|
|
132
154
|
return /* @__PURE__ */ jsx(
|
|
133
155
|
"p",
|
|
134
156
|
{
|
|
157
|
+
ref,
|
|
135
158
|
"data-slot": "field-description",
|
|
136
159
|
className: cn(
|
|
137
160
|
// `group-data-[orientation=horizontal]/field:` matches the actual
|
|
@@ -150,11 +173,13 @@ function FieldDescription({ className, ...props }) {
|
|
|
150
173
|
function FieldSeparator({
|
|
151
174
|
children,
|
|
152
175
|
className,
|
|
176
|
+
ref,
|
|
153
177
|
...props
|
|
154
178
|
}) {
|
|
155
179
|
return /* @__PURE__ */ jsxs(
|
|
156
180
|
"div",
|
|
157
181
|
{
|
|
182
|
+
ref,
|
|
158
183
|
"data-slot": "field-separator",
|
|
159
184
|
"data-content": !!children,
|
|
160
185
|
className: cn(
|
|
@@ -180,6 +205,7 @@ function FieldError({
|
|
|
180
205
|
className,
|
|
181
206
|
children,
|
|
182
207
|
errors,
|
|
208
|
+
ref,
|
|
183
209
|
...props
|
|
184
210
|
}) {
|
|
185
211
|
const content = useMemo(() => {
|
|
@@ -205,6 +231,7 @@ function FieldError({
|
|
|
205
231
|
return /* @__PURE__ */ jsx(
|
|
206
232
|
"div",
|
|
207
233
|
{
|
|
234
|
+
ref,
|
|
208
235
|
role: "alert",
|
|
209
236
|
"data-slot": "field-error",
|
|
210
237
|
className: cn("text-sm/relaxed font-normal text-destructive", className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/field.tsx"],"names":[],"mappings":";;;;;;;AA8BA,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,M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,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":[],"mappings":";;;;;;;AA8BA,SAAS,QAAA,CAAS;AAAA,EAChB,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAqC;AACnC,EAAA,uB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AAQ;AACnB,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,MAAM,YAAA,GAAe;AAAA,MACnB,GAAG,IAAI,GAAA,CAAI,MAAA,CAAO,IAAI,CAAC,KAAA,KAAU,CAAC,KAAA,EAAO,OAAA,EAAS,KAAK,CAAC,CAAC,EAAE,MAAA;AAAO,KACpE;AAEA,IAAA,IAAI,YAAA,EAAc,UAAU,CAAA,EAAG;AAC7B,MAAA,OAAO,YAAA,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,GAAA;AAAA,MACA,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({\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 '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 ref,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n ref={ref}\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({\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\nfunction FieldLabel({\n className,\n ref,\n ...props\n}: React.ComponentProps<typeof Label>) {\n return (\n <Label\n ref={ref}\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, 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=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({\n className,\n ref,\n ...props\n}: React.ComponentProps<'p'>) {\n return (\n <p\n ref={ref}\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 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 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 ref={ref}\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,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
|
|
package/dist/components/input.js
CHANGED
|
@@ -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({
|
|
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,
|
|
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
|
|
package/dist/components/label.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { cn } from '../lib/utils.js';
|
|
4
4
|
|
|
5
|
-
function Label({ className, ...props }) {
|
|
5
|
+
function Label({ className, ref, ...props }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(
|
|
7
7
|
"label",
|
|
8
8
|
{
|
|
9
|
+
ref,
|
|
9
10
|
"data-slot": "label",
|
|
10
11
|
className: cn(
|
|
11
12
|
"flex items-center gap-2 text-base/relaxed font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/label.tsx"],"names":[],"mappings":";;;AAMA,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../src/components/label.tsx"],"names":[],"mappings":";;;AAMA,SAAS,MAAM,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAkC;AAC1E,EAAA,uBACE,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,OAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,kNAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"label.js","sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Label({ className, ref, ...props }: React.ComponentProps<'label'>) {\n return (\n <label\n ref={ref}\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-base/relaxed font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Label }\n\nexport type LabelProps = React.ComponentProps<typeof Label>\n"]}
|
|
@@ -11,7 +11,7 @@ import * as React from 'react';
|
|
|
11
11
|
* visible label already conveys the boundary to assistive tech; exposing two
|
|
12
12
|
* `role="separator"` elements either side of it would be redundant noise.
|
|
13
13
|
*/
|
|
14
|
-
declare function LabeledSeparator({ className, children, ...props }: React.ComponentProps<'div'> & {
|
|
14
|
+
declare function LabeledSeparator({ className, children, ref, ...props }: React.ComponentProps<'div'> & {
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
}): React.JSX.Element;
|
|
17
17
|
|
|
@@ -5,11 +5,13 @@ import { cn } from '../lib/utils.js';
|
|
|
5
5
|
function LabeledSeparator({
|
|
6
6
|
className,
|
|
7
7
|
children = "or",
|
|
8
|
+
ref,
|
|
8
9
|
...props
|
|
9
10
|
}) {
|
|
10
11
|
return /* @__PURE__ */ jsxs(
|
|
11
12
|
"div",
|
|
12
13
|
{
|
|
14
|
+
ref,
|
|
13
15
|
"data-slot": "labeled-separator",
|
|
14
16
|
className: cn("flex items-center gap-3", className),
|
|
15
17
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/labeled-separator.tsx"],"names":[],"mappings":";;;;AAgBA,SAAS,gBAAA,CAAiB;AAAA,EACxB,SAAA;AAAA,EACA,QAAA,GAAW,IAAA;AAAA,EACX,GAAG;AACL,CAAA,EAAiE;AAC/D,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,yBAAA,EAA2B,SAAS,CAAA;AAAA,MACjD,GAAG,KAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,UAAA,EAAU,IAAA,EAAC,SAAA,EAAU,QAAA,EAAS,CAAA;AAAA,wBACzC,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,WAAA,EAAU,2BAAA;AAAA,YACV,SAAA,EAAU,wCAAA;AAAA,YAET;AAAA;AAAA,SACH;AAAA,wBACA,GAAA,CAAC,SAAA,EAAA,EAAU,UAAA,EAAU,IAAA,EAAC,WAAU,QAAA,EAAS;AAAA;AAAA;AAAA,GAC3C;AAEJ","file":"labeled-separator.js","sourcesContent":["import type * as React from 'react'\n\nimport { Separator } from '../components/separator.js'\nimport { cn } from '../lib/utils.js'\n\n/**\n * A horizontal divider broken by a centred label — e.g. the \"or\" rule that\n * separates one sign-in method from another in a login form.\n *\n * Always renders a label (defaulting to \"or\"); it is not a plain horizontal\n * rule. For an unbroken divider, use the `Separator` component instead.\n *\n * The two flanking rules are rendered `decorative` (role=\"none\") because the\n * visible label already conveys the boundary to assistive tech; exposing two\n * `role=\"separator\"` elements either side of it would be redundant noise.\n */\nfunction LabeledSeparator({\n className,\n children = 'or',\n ...props\n}: React.ComponentProps<'div'> & { children?: React.ReactNode }) {\n return (\n <div\n data-slot=\"labeled-separator\"\n className={cn('flex items-center gap-3', className)}\n {...props}\n >\n <Separator decorative className=\"flex-1\" />\n <span\n data-slot=\"labeled-separator-content\"\n className=\"shrink-0 text-sm text-muted-foreground\"\n >\n {children}\n </span>\n <Separator decorative className=\"flex-1\" />\n </div>\n )\n}\n\nexport { LabeledSeparator }\n\nexport type LabeledSeparatorProps = React.ComponentProps<\n typeof LabeledSeparator\n>\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/labeled-separator.tsx"],"names":[],"mappings":";;;;AAgBA,SAAS,gBAAA,CAAiB;AAAA,EACxB,SAAA;AAAA,EACA,QAAA,GAAW,IAAA;AAAA,EACX,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAiE;AAC/D,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,yBAAA,EAA2B,SAAS,CAAA;AAAA,MACjD,GAAG,KAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,UAAA,EAAU,IAAA,EAAC,SAAA,EAAU,QAAA,EAAS,CAAA;AAAA,wBACzC,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,WAAA,EAAU,2BAAA;AAAA,YACV,SAAA,EAAU,wCAAA;AAAA,YAET;AAAA;AAAA,SACH;AAAA,wBACA,GAAA,CAAC,SAAA,EAAA,EAAU,UAAA,EAAU,IAAA,EAAC,WAAU,QAAA,EAAS;AAAA;AAAA;AAAA,GAC3C;AAEJ","file":"labeled-separator.js","sourcesContent":["import type * as React from 'react'\n\nimport { Separator } from '../components/separator.js'\nimport { cn } from '../lib/utils.js'\n\n/**\n * A horizontal divider broken by a centred label — e.g. the \"or\" rule that\n * separates one sign-in method from another in a login form.\n *\n * Always renders a label (defaulting to \"or\"); it is not a plain horizontal\n * rule. For an unbroken divider, use the `Separator` component instead.\n *\n * The two flanking rules are rendered `decorative` (role=\"none\") because the\n * visible label already conveys the boundary to assistive tech; exposing two\n * `role=\"separator\"` elements either side of it would be redundant noise.\n */\nfunction LabeledSeparator({\n className,\n children = 'or',\n ref,\n ...props\n}: React.ComponentProps<'div'> & { children?: React.ReactNode }) {\n return (\n <div\n ref={ref}\n data-slot=\"labeled-separator\"\n className={cn('flex items-center gap-3', className)}\n {...props}\n >\n <Separator decorative className=\"flex-1\" />\n <span\n data-slot=\"labeled-separator-content\"\n className=\"shrink-0 text-sm text-muted-foreground\"\n >\n {children}\n </span>\n <Separator decorative className=\"flex-1\" />\n </div>\n )\n}\n\nexport { LabeledSeparator }\n\nexport type LabeledSeparatorProps = React.ComponentProps<\n typeof LabeledSeparator\n>\n"]}
|
|
@@ -9,17 +9,13 @@ type LinkComponent = React__default.ElementType;
|
|
|
9
9
|
type LinkProps = Omit<React__default.ComponentPropsWithoutRef<'a'>, 'href'> & VariantProps<typeof linkVariants> & {
|
|
10
10
|
as?: LinkComponent;
|
|
11
11
|
href: React__default.ComponentPropsWithoutRef<'a'>['href'] | object;
|
|
12
|
+
ref?: React__default.Ref<HTMLAnchorElement>;
|
|
12
13
|
};
|
|
13
14
|
declare function LinkProvider({ children, component, }: {
|
|
14
15
|
children: React__default.ReactNode;
|
|
15
16
|
component: LinkComponent;
|
|
16
17
|
}): React__default.JSX.Element;
|
|
17
|
-
declare
|
|
18
|
-
variant?: "white" | "primary" | "secondary" | "unstyled" | null | undefined;
|
|
19
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
20
|
-
as?: LinkComponent;
|
|
21
|
-
href: React__default.ComponentPropsWithoutRef<"a">["href"] | object;
|
|
22
|
-
} & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
18
|
+
declare function Link({ as, variant, className, ref, ...props }: LinkProps): React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
|
|
23
19
|
type ExternalLinkProps = LinkProps & {
|
|
24
20
|
/**
|
|
25
21
|
* Screen-reader suffix announced after the link text. Defaults to
|
|
@@ -41,22 +37,6 @@ type ExternalLinkProps = LinkProps & {
|
|
|
41
37
|
* All `Link` props are forwarded — `variant`, `as`, `className`, etc. —
|
|
42
38
|
* and any of `target`, `rel`, `icon`, or `newTabLabel` can be overridden.
|
|
43
39
|
*/
|
|
44
|
-
declare
|
|
45
|
-
variant?: "white" | "primary" | "secondary" | "unstyled" | null | undefined;
|
|
46
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
47
|
-
as?: LinkComponent;
|
|
48
|
-
href: React__default.ComponentPropsWithoutRef<"a">["href"] | object;
|
|
49
|
-
} & {
|
|
50
|
-
/**
|
|
51
|
-
* Screen-reader suffix announced after the link text. Defaults to
|
|
52
|
-
* `"(opens in a new tab)"`. Pass an empty string to suppress.
|
|
53
|
-
*/
|
|
54
|
-
newTabLabel?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Custom trailing icon. Pass `null` to hide the icon entirely. If omitted,
|
|
57
|
-
* the default open-in-new glyph is rendered.
|
|
58
|
-
*/
|
|
59
|
-
icon?: React__default.ReactNode | null;
|
|
60
|
-
} & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
40
|
+
declare function ExternalLink({ children, icon, newTabLabel, target, rel, ref, ...props }: ExternalLinkProps): React__default.JSX.Element;
|
|
61
41
|
|
|
62
42
|
export { ExternalLink, type ExternalLinkProps, Link, type LinkComponent, type LinkProps, LinkProvider, linkVariants };
|