@nswds/ui 1.3.0 → 1.5.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/dist/components/badge.d.ts +16 -7
- package/dist/components/badge.js +10 -9
- package/dist/components/badge.js.map +1 -1
- package/dist/components/button.d.ts +40 -8
- package/dist/components/button.js +41 -13
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +14 -0
- package/dist/components/card.js +94 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/field.d.ts +29 -0
- package/dist/components/field.js +219 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +50 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +21 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/link.d.ts +48 -3
- package/dist/components/link.js +120 -5
- package/dist/components/link.js.map +1 -1
- package/dist/components/login-form.d.ts +6 -0
- package/dist/components/login-form.js +57 -0
- package/dist/components/login-form.js.map +1 -0
- package/dist/components/separator.d.ts +15 -0
- package/dist/components/separator.js +44 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/spinner.d.ts +7 -1
- package/dist/components/spinner.js +13 -2
- package/dist/components/spinner.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
|
+
|
|
4
|
+
function Card({
|
|
5
|
+
className,
|
|
6
|
+
size = "default",
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "card",
|
|
13
|
+
"data-size": size,
|
|
14
|
+
className: cn(
|
|
15
|
+
"group/card flex flex-col gap-4 overflow-hidden rounded-lg bg-card py-4 text-xs/relaxed text-card-foreground ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function CardHeader({ className, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
"data-slot": "card-header",
|
|
27
|
+
className: cn(
|
|
28
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function CardTitle({ className, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
"data-slot": "card-title",
|
|
40
|
+
className: cn("font-heading text-sm font-medium", className),
|
|
41
|
+
...props
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function CardDescription({ className, ...props }) {
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
"data-slot": "card-description",
|
|
50
|
+
className: cn("text-xs/relaxed text-muted-foreground", className),
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function CardAction({ className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
"data-slot": "card-action",
|
|
60
|
+
className: cn(
|
|
61
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
62
|
+
className
|
|
63
|
+
),
|
|
64
|
+
...props
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function CardContent({ className, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
"data-slot": "card-content",
|
|
73
|
+
className: cn("px-4 group-data-[size=sm]/card:px-3", className),
|
|
74
|
+
...props
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function CardFooter({ className, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
"data-slot": "card-footer",
|
|
83
|
+
className: cn(
|
|
84
|
+
"flex items-center rounded-b-lg px-4 group-data-[size=sm]/card:px-3 [.border-t]:pt-4 group-data-[size=sm]/card:[.border-t]:pt-3",
|
|
85
|
+
className
|
|
86
|
+
),
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
93
|
+
//# sourceMappingURL=card.js.map
|
|
94
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/card.tsx"],"names":[],"mappings":";;;AAIA,SAAS,IAAA,CAAK;AAAA,EACZ,SAAA;AAAA,EACA,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACL,CAAA,EAA8D;AAC5D,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,MAAA;AAAA,MACV,WAAA,EAAW,IAAA;AAAA,MACX,SAAA,EAAW,EAAA;AAAA,QACT,6QAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;A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D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,gIAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"card.js","sourcesContent":["import * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Card({\n className,\n size = 'default',\n ...props\n}: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card flex flex-col gap-4 overflow-hidden rounded-lg bg-card py-4 text-xs/relaxed text-card-foreground ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn('font-heading text-sm font-medium', className)}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn('text-xs/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n 'col-start-2 row-span-2 row-start-1 self-start justify-self-end',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn('px-4 group-data-[size=sm]/card:px-3', className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n 'flex items-center rounded-b-lg px-4 group-data-[size=sm]/card:px-3 [.border-t]:pt-4 group-data-[size=sm]/card:[.border-t]:pt-3',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardAction,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { Label } from './label.js';
|
|
6
|
+
|
|
7
|
+
declare function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<'legend'> & {
|
|
9
|
+
variant?: 'legend' | 'label';
|
|
10
|
+
}): react_jsx_runtime.JSX.Element;
|
|
11
|
+
declare function FieldGroup({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare const fieldVariants: (props?: ({
|
|
13
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
14
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>): react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare function FieldContent({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
17
|
+
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare function FieldTitle({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare function FieldDescription({ className, ...props }: React.ComponentProps<'p'>): react_jsx_runtime.JSX.Element;
|
|
20
|
+
declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<'div'> & {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}): react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<'div'> & {
|
|
24
|
+
errors?: Array<{
|
|
25
|
+
message?: string;
|
|
26
|
+
} | undefined>;
|
|
27
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
28
|
+
|
|
29
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { Label } from '../components/label.js';
|
|
6
|
+
import { Separator } from '../components/separator.js';
|
|
7
|
+
import { cn } from '../lib/utils.js';
|
|
8
|
+
|
|
9
|
+
function FieldSet({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"fieldset",
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "field-set",
|
|
14
|
+
className: cn(
|
|
15
|
+
"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function FieldLegend({
|
|
23
|
+
className,
|
|
24
|
+
variant = "legend",
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
"legend",
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "field-legend",
|
|
31
|
+
"data-variant": variant,
|
|
32
|
+
className: cn(
|
|
33
|
+
"mb-2 font-medium data-[variant=label]:text-sm/relaxed data-[variant=legend]:text-sm",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function FieldGroup({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "field-group",
|
|
45
|
+
className: cn(
|
|
46
|
+
// `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a
|
|
47
|
+
// checkbox/radio group child. The original `data-[slot=checkbox-group]:gap-3`
|
|
48
|
+
// was self-referential (this element's slot is `field-group`) and
|
|
49
|
+
// could never apply. Mirrors the rule on FieldSet above.
|
|
50
|
+
"group/field-group @container/field-group flex w-full flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 *:data-[slot=field-group]:gap-4",
|
|
51
|
+
className
|
|
52
|
+
),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
const fieldVariants = cva(
|
|
58
|
+
"group/field flex w-full gap-2 data-[invalid=true]:text-destructive",
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
orientation: {
|
|
62
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
63
|
+
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
64
|
+
responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
orientation: "vertical"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
function Field({
|
|
73
|
+
className,
|
|
74
|
+
orientation = "vertical",
|
|
75
|
+
...props
|
|
76
|
+
}) {
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
role: "group",
|
|
81
|
+
"data-slot": "field",
|
|
82
|
+
"data-orientation": orientation,
|
|
83
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
84
|
+
...props
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
function FieldContent({ className, ...props }) {
|
|
89
|
+
return /* @__PURE__ */ jsx(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
"data-slot": "field-content",
|
|
93
|
+
className: cn(
|
|
94
|
+
"group/field-content flex flex-1 flex-col gap-0.5 leading-snug",
|
|
95
|
+
className
|
|
96
|
+
),
|
|
97
|
+
...props
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function FieldLabel({
|
|
102
|
+
className,
|
|
103
|
+
...props
|
|
104
|
+
}) {
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
Label,
|
|
107
|
+
{
|
|
108
|
+
"data-slot": "field-label",
|
|
109
|
+
className: cn(
|
|
110
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10",
|
|
111
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",
|
|
112
|
+
className
|
|
113
|
+
),
|
|
114
|
+
...props
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function FieldTitle({ className, ...props }) {
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
"data-slot": "field-label",
|
|
123
|
+
className: cn(
|
|
124
|
+
"flex w-fit items-center gap-2 text-sm/relaxed font-medium group-data-[disabled=true]/field:opacity-50",
|
|
125
|
+
className
|
|
126
|
+
),
|
|
127
|
+
...props
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
function FieldDescription({ className, ...props }) {
|
|
132
|
+
return /* @__PURE__ */ jsx(
|
|
133
|
+
"p",
|
|
134
|
+
{
|
|
135
|
+
"data-slot": "field-description",
|
|
136
|
+
className: cn(
|
|
137
|
+
// `group-data-[orientation=horizontal]/field:` matches the actual
|
|
138
|
+
// `data-orientation="horizontal"` attribute Field emits. The previous
|
|
139
|
+
// `group-has-data-horizontal/field:` targeted a non-existent
|
|
140
|
+
// `[data-horizontal]` attribute and never fired.
|
|
141
|
+
"text-start text-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
|
+
),
|
|
146
|
+
...props
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function FieldSeparator({
|
|
151
|
+
children,
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}) {
|
|
155
|
+
return /* @__PURE__ */ jsxs(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
"data-slot": "field-separator",
|
|
159
|
+
"data-content": !!children,
|
|
160
|
+
className: cn(
|
|
161
|
+
"relative -my-2 h-5 text-sm/relaxed group-data-[variant=outline]/field-group:-mb-2",
|
|
162
|
+
className
|
|
163
|
+
),
|
|
164
|
+
...props,
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
|
|
167
|
+
children && /* @__PURE__ */ jsx(
|
|
168
|
+
"span",
|
|
169
|
+
{
|
|
170
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
171
|
+
"data-slot": "field-separator-content",
|
|
172
|
+
children
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
function FieldError({
|
|
180
|
+
className,
|
|
181
|
+
children,
|
|
182
|
+
errors,
|
|
183
|
+
...props
|
|
184
|
+
}) {
|
|
185
|
+
const content = useMemo(() => {
|
|
186
|
+
if (children) {
|
|
187
|
+
return children;
|
|
188
|
+
}
|
|
189
|
+
if (!errors?.length) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const uniqueErrors = [
|
|
193
|
+
...new Map(errors.map((error) => [error?.message, error])).values()
|
|
194
|
+
];
|
|
195
|
+
if (uniqueErrors?.length == 1) {
|
|
196
|
+
return uniqueErrors[0]?.message;
|
|
197
|
+
}
|
|
198
|
+
return /* @__PURE__ */ jsx("ul", { className: "ms-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
199
|
+
(error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
|
|
200
|
+
) });
|
|
201
|
+
}, [children, errors]);
|
|
202
|
+
if (!content) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return /* @__PURE__ */ jsx(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
role: "alert",
|
|
209
|
+
"data-slot": "field-error",
|
|
210
|
+
className: cn("text-sm/relaxed font-normal text-destructive", className),
|
|
211
|
+
...props,
|
|
212
|
+
children: content
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
218
|
+
//# sourceMappingURL=field.js.map
|
|
219
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/field.tsx"],"names":[],"mappings":";;;;;;;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,MACd,SAAA,EAAW,EAAA;AAAA,QACT,qFAAA;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;AAAA;AAAA;AAAA;AAAA,QAKT,kLAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,MAAM,aAAA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AQ,MAAM;AAC5B,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,OAAO,QAAA;AAAA,IACT;AAEA,IAAA,IAAI,CAAC,QAAQ,MAAA,EAAQ;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,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"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Input as Input$1 } from '@base-ui/react/input';
|
|
4
|
+
import { cn } from '../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
function Input({ className, type, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Input$1,
|
|
9
|
+
{
|
|
10
|
+
type,
|
|
11
|
+
"data-slot": "input",
|
|
12
|
+
"data-type": type,
|
|
13
|
+
className: cn(
|
|
14
|
+
// No `outline-none` here: it sets `--tw-outline-style: none` globally
|
|
15
|
+
// on the element, which then suppresses the focus outline below
|
|
16
|
+
// (which reads `outline-style: var(--tw-outline-style)`).
|
|
17
|
+
"h-12 w-full min-w-0 rounded-sm px-4 py-2 text-base transition-colors",
|
|
18
|
+
// Default — 1px grey-02 border on surface-default
|
|
19
|
+
"border border-grey-600 bg-background text-grey-800",
|
|
20
|
+
// Dark mode — flip text to a light grey so it's readable on dark surface
|
|
21
|
+
// (mirrors how border-grey-600 → dark:border-grey-200 is handled below).
|
|
22
|
+
"dark:text-grey-100",
|
|
23
|
+
// Hover
|
|
24
|
+
"hover:bg-grey-100",
|
|
25
|
+
// Focus — Uses `focus:`
|
|
26
|
+
// (not `focus-visible:`) so the ring shows on click as well as keyboard.
|
|
27
|
+
"focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-grey-600",
|
|
28
|
+
// File input slot
|
|
29
|
+
"file:inline-flex file:h-8 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-grey-800 dark:file:text-grey-100",
|
|
30
|
+
// Placeholder styles
|
|
31
|
+
"placeholder:text-grey-500",
|
|
32
|
+
"dark:placeholder:text-grey-300",
|
|
33
|
+
// Disabled
|
|
34
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
35
|
+
// Invalid — 2px danger-600 border, danger-50 hover surface (Figma error variants)
|
|
36
|
+
"aria-invalid:border-2 aria-invalid:border-danger-600 aria-invalid:hover:bg-danger-50 aria-invalid:focus:outline-danger-600",
|
|
37
|
+
"aria-invalid:dark:border-danger-200 aria-invalid:dark:hover:bg-danger-900/30 aria-invalid:dark:focus:outline-danger-200",
|
|
38
|
+
// Dark mode — invert grey border for sufficient contrast against dark surfaces
|
|
39
|
+
"dark:border-grey-100 dark:bg-input/30",
|
|
40
|
+
"dark:hover:bg-input/50 dark:focus:outline-grey-100",
|
|
41
|
+
className
|
|
42
|
+
),
|
|
43
|
+
...props
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { Input };
|
|
49
|
+
//# sourceMappingURL=input.js.map
|
|
50
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +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,QAEA,oDAAA;AAAA;AAAA;AAAA,QAGA,oBAAA;AAAA;AAAA,QAEA,mBAAA;AAAA;AAAA;AAAA,QAGA,6EAAA;AAAA;AAAA,QAEA,sIAAA;AAAA;AAAA,QAEA,2BAAA;AAAA,QACA,gCAAA;AAAA;AAAA,QAEA,8EAAA;AAAA;AAAA,QAEA,4HAAA;AAAA,QACA,yHAAA;AAAA;AAAA,QAEA,uCAAA;AAAA,QACA,oDAAA;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 // Default — 1px grey-02 border on surface-default\n 'border border-grey-600 bg-background text-grey-800',\n // Dark mode — flip text to a light grey so it's readable on dark surface\n // (mirrors how border-grey-600 → dark:border-grey-200 is handled below).\n 'dark:text-grey-100',\n // Hover\n 'hover:bg-grey-100',\n // Focus — Uses `focus:`\n // (not `focus-visible:`) so the ring shows on click as well as keyboard.\n 'focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-grey-600',\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-grey-800 dark:file:text-grey-100',\n // Placeholder styles\n 'placeholder:text-grey-500',\n 'dark:placeholder:text-grey-300',\n // Disabled\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n // Invalid — 2px danger-600 border, danger-50 hover surface (Figma error variants)\n 'aria-invalid:border-2 aria-invalid:border-danger-600 aria-invalid:hover:bg-danger-50 aria-invalid:focus:outline-danger-600',\n 'aria-invalid:dark:border-danger-200 aria-invalid:dark:hover:bg-danger-900/30 aria-invalid:dark:focus:outline-danger-200',\n // Dark mode — invert grey border for sufficient contrast against dark surfaces\n 'dark:border-grey-100 dark:bg-input/30',\n 'dark:hover:bg-input/50 dark:focus:outline-grey-100',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Input }\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
function Label({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"label",
|
|
8
|
+
{
|
|
9
|
+
"data-slot": "label",
|
|
10
|
+
className: cn(
|
|
11
|
+
"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",
|
|
12
|
+
className
|
|
13
|
+
),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Label };
|
|
20
|
+
//# sourceMappingURL=label.js.map
|
|
21
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/label.tsx"],"names":[],"mappings":";;;AAMA,SAAS,KAAA,CAAM,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AACrE,EAAA,uBACE,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,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, ...props }: React.ComponentProps<'label'>) {\n return (\n <label\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"]}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
4
|
import React__default from 'react';
|
|
3
5
|
|
|
6
|
+
declare const linkVariants: (props?: ({
|
|
7
|
+
variant?: "white" | "primary" | "secondary" | "unstyled" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
4
9
|
type LinkComponent = React__default.ElementType;
|
|
5
|
-
type LinkProps = Omit<React__default.ComponentPropsWithoutRef<'a'>, 'href'> & {
|
|
10
|
+
type LinkProps = Omit<React__default.ComponentPropsWithoutRef<'a'>, 'href'> & VariantProps<typeof linkVariants> & {
|
|
6
11
|
as?: LinkComponent;
|
|
7
12
|
href: React__default.ComponentPropsWithoutRef<'a'>['href'] | object;
|
|
8
13
|
};
|
|
@@ -10,9 +15,49 @@ declare function LinkProvider({ children, component, }: {
|
|
|
10
15
|
children: React__default.ReactNode;
|
|
11
16
|
component: LinkComponent;
|
|
12
17
|
}): react_jsx_runtime.JSX.Element;
|
|
13
|
-
declare const Link: React__default.ForwardRefExoticComponent<Omit<Omit<React__default.DetailedHTMLProps<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">, "href"> & {
|
|
18
|
+
declare const Link: React__default.ForwardRefExoticComponent<Omit<Omit<React__default.DetailedHTMLProps<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">, "href"> & VariantProps<(props?: ({
|
|
19
|
+
variant?: "white" | "primary" | "secondary" | "unstyled" | null | undefined;
|
|
20
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
14
21
|
as?: LinkComponent;
|
|
15
22
|
href: React__default.ComponentPropsWithoutRef<"a">["href"] | object;
|
|
16
23
|
} & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
24
|
+
type ExternalLinkProps = LinkProps & {
|
|
25
|
+
/**
|
|
26
|
+
* Screen-reader suffix announced after the link text. Defaults to
|
|
27
|
+
* `"(opens in a new tab)"`. Pass an empty string to suppress.
|
|
28
|
+
*/
|
|
29
|
+
newTabLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Custom trailing icon. Pass `null` to hide the icon entirely. If omitted,
|
|
32
|
+
* the default open-in-new glyph is rendered.
|
|
33
|
+
*/
|
|
34
|
+
icon?: React__default.ReactNode | null;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Anchor preconfigured for cross-origin / new-tab navigation. Sets
|
|
38
|
+
* `target="_blank"` and `rel="noopener noreferrer"` by default, renders a
|
|
39
|
+
* trailing open-in-new icon, and appends a visually-hidden suffix so screen
|
|
40
|
+
* readers announce that the link opens a new tab.
|
|
41
|
+
*
|
|
42
|
+
* All `Link` props are forwarded — `variant`, `as`, `className`, etc. —
|
|
43
|
+
* and any of `target`, `rel`, `icon`, or `newTabLabel` can be overridden.
|
|
44
|
+
*/
|
|
45
|
+
declare const ExternalLink: React__default.ForwardRefExoticComponent<Omit<Omit<React__default.DetailedHTMLProps<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">, "href"> & VariantProps<(props?: ({
|
|
46
|
+
variant?: "white" | "primary" | "secondary" | "unstyled" | null | undefined;
|
|
47
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
48
|
+
as?: LinkComponent;
|
|
49
|
+
href: React__default.ComponentPropsWithoutRef<"a">["href"] | object;
|
|
50
|
+
} & {
|
|
51
|
+
/**
|
|
52
|
+
* Screen-reader suffix announced after the link text. Defaults to
|
|
53
|
+
* `"(opens in a new tab)"`. Pass an empty string to suppress.
|
|
54
|
+
*/
|
|
55
|
+
newTabLabel?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Custom trailing icon. Pass `null` to hide the icon entirely. If omitted,
|
|
58
|
+
* the default open-in-new glyph is rendered.
|
|
59
|
+
*/
|
|
60
|
+
icon?: React__default.ReactNode | null;
|
|
61
|
+
} & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
17
62
|
|
|
18
|
-
export { Link, type LinkComponent, type LinkProps, LinkProvider };
|
|
63
|
+
export { ExternalLink, type ExternalLinkProps, Link, type LinkComponent, type LinkProps, LinkProvider, linkVariants };
|