@nswds/ui 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/badge.d.ts +12 -5
- package/dist/components/badge.js +9 -9
- package/dist/components/badge.js.map +1 -1
- package/dist/components/button.d.ts +37 -7
- package/dist/components/button.js +40 -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 +10 -0
- package/dist/components/link.js +1 -2
- package/dist/components/link.js.map +1 -1
- package/dist/components/login-form.d.ts +6 -0
- package/dist/components/login-form.js +59 -0
- package/dist/components/login-form.js.map +1 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +32 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/index.d.ts +1 -1
- 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;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACxE,E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GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,gIAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"card.js","sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"../lib/utils.js\"\n\nfunction Card({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & { size?: \"default\" | \"sm\" }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n \"group/card flex flex-col gap-4 overflow-hidden rounded-lg bg-card py-4 text-xs/relaxed text-card-foreground ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n \"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\"font-heading text-sm font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-xs/relaxed text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn(\"px-4 group-data-[size=sm]/card:px-3\", className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n \"flex items-center rounded-b-lg px-4 group-data-[size=sm]/card:px-3 [.border-t]:pt-4 group-data-[size=sm]/card:[.border-t]:pt-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { Label } from './label.js';
|
|
6
|
+
|
|
7
|
+
declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<"legend"> & {
|
|
9
|
+
variant?: "legend" | "label";
|
|
10
|
+
}): react_jsx_runtime.JSX.Element;
|
|
11
|
+
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare const fieldVariants: (props?: ({
|
|
13
|
+
orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
|
|
14
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
17
|
+
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">): react_jsx_runtime.JSX.Element;
|
|
20
|
+
declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<"div"> & {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}): react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<"div"> & {
|
|
24
|
+
errors?: Array<{
|
|
25
|
+
message?: string;
|
|
26
|
+
} | undefined>;
|
|
27
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
28
|
+
|
|
29
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
6
|
+
import { Label } from '../components/label.js';
|
|
7
|
+
import { Separator } from '../components/separator.js';
|
|
8
|
+
|
|
9
|
+
function FieldSet({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"fieldset",
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "field-set",
|
|
14
|
+
className: cn(
|
|
15
|
+
"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function FieldLegend({
|
|
23
|
+
className,
|
|
24
|
+
variant = "legend",
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
"legend",
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "field-legend",
|
|
31
|
+
"data-variant": variant,
|
|
32
|
+
className: cn(
|
|
33
|
+
"mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function FieldGroup({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "field-group",
|
|
45
|
+
className: cn(
|
|
46
|
+
// `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a
|
|
47
|
+
// checkbox/radio group child. The original `data-[slot=checkbox-group]:gap-3`
|
|
48
|
+
// was self-referential (this element's slot is `field-group`) and
|
|
49
|
+
// could never apply. Mirrors the rule on FieldSet above.
|
|
50
|
+
"group/field-group @container/field-group flex w-full flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 *:data-[slot=field-group]:gap-4",
|
|
51
|
+
className
|
|
52
|
+
),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
const fieldVariants = cva(
|
|
58
|
+
"group/field flex w-full gap-2 data-[invalid=true]:text-destructive",
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
orientation: {
|
|
62
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
63
|
+
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
64
|
+
responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
orientation: "vertical"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
function Field({
|
|
73
|
+
className,
|
|
74
|
+
orientation = "vertical",
|
|
75
|
+
...props
|
|
76
|
+
}) {
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
role: "group",
|
|
81
|
+
"data-slot": "field",
|
|
82
|
+
"data-orientation": orientation,
|
|
83
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
84
|
+
...props
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
function FieldContent({ className, ...props }) {
|
|
89
|
+
return /* @__PURE__ */ jsx(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
"data-slot": "field-content",
|
|
93
|
+
className: cn(
|
|
94
|
+
"group/field-content flex flex-1 flex-col gap-0.5 leading-snug",
|
|
95
|
+
className
|
|
96
|
+
),
|
|
97
|
+
...props
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function FieldLabel({
|
|
102
|
+
className,
|
|
103
|
+
...props
|
|
104
|
+
}) {
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
Label,
|
|
107
|
+
{
|
|
108
|
+
"data-slot": "field-label",
|
|
109
|
+
className: cn(
|
|
110
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10",
|
|
111
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",
|
|
112
|
+
className
|
|
113
|
+
),
|
|
114
|
+
...props
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function FieldTitle({ className, ...props }) {
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
"data-slot": "field-label",
|
|
123
|
+
className: cn(
|
|
124
|
+
"flex w-fit items-center gap-2 text-xs/relaxed font-medium group-data-[disabled=true]/field:opacity-50",
|
|
125
|
+
className
|
|
126
|
+
),
|
|
127
|
+
...props
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
function FieldDescription({ className, ...props }) {
|
|
132
|
+
return /* @__PURE__ */ jsx(
|
|
133
|
+
"p",
|
|
134
|
+
{
|
|
135
|
+
"data-slot": "field-description",
|
|
136
|
+
className: cn(
|
|
137
|
+
// `group-data-[orientation=horizontal]/field:` matches the actual
|
|
138
|
+
// `data-orientation="horizontal"` attribute Field emits. The previous
|
|
139
|
+
// `group-has-data-horizontal/field:` targeted a non-existent
|
|
140
|
+
// `[data-horizontal]` attribute and never fired.
|
|
141
|
+
"text-start text-xs/relaxed leading-normal font-normal text-muted-foreground group-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
|
|
142
|
+
"last:mt-0 nth-last-2:-mt-1",
|
|
143
|
+
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
144
|
+
className
|
|
145
|
+
),
|
|
146
|
+
...props
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function FieldSeparator({
|
|
151
|
+
children,
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}) {
|
|
155
|
+
return /* @__PURE__ */ jsxs(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
"data-slot": "field-separator",
|
|
159
|
+
"data-content": !!children,
|
|
160
|
+
className: cn(
|
|
161
|
+
"relative -my-2 h-5 text-xs/relaxed group-data-[variant=outline]/field-group:-mb-2",
|
|
162
|
+
className
|
|
163
|
+
),
|
|
164
|
+
...props,
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
|
|
167
|
+
children && /* @__PURE__ */ jsx(
|
|
168
|
+
"span",
|
|
169
|
+
{
|
|
170
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
171
|
+
"data-slot": "field-separator-content",
|
|
172
|
+
children
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
function FieldError({
|
|
180
|
+
className,
|
|
181
|
+
children,
|
|
182
|
+
errors,
|
|
183
|
+
...props
|
|
184
|
+
}) {
|
|
185
|
+
const content = useMemo(() => {
|
|
186
|
+
if (children) {
|
|
187
|
+
return children;
|
|
188
|
+
}
|
|
189
|
+
if (!errors?.length) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const uniqueErrors = [
|
|
193
|
+
...new Map(errors.map((error) => [error?.message, error])).values()
|
|
194
|
+
];
|
|
195
|
+
if (uniqueErrors?.length == 1) {
|
|
196
|
+
return uniqueErrors[0]?.message;
|
|
197
|
+
}
|
|
198
|
+
return /* @__PURE__ */ jsx("ul", { className: "ms-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
199
|
+
(error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
|
|
200
|
+
) });
|
|
201
|
+
}, [children, errors]);
|
|
202
|
+
if (!content) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return /* @__PURE__ */ jsx(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
role: "alert",
|
|
209
|
+
"data-slot": "field-error",
|
|
210
|
+
className: cn("text-xs/relaxed font-normal text-destructive", className),
|
|
211
|
+
...props,
|
|
212
|
+
children: content
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
218
|
+
//# sourceMappingURL=field.js.map
|
|
219
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/field.tsx"],"names":[],"mappings":";;;;;;;AAUA,SAAS,QAAA,CAAS,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AAC3E,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,WAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,kGAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY;AAAA,EACnB,SAAA;AAAA,EACA,OAAA,GAAU,QAAA;AAAA,EACV,GAAG;AACL,CAAA,EAAsE;AACpE,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,cAAA,EAAc,OAAA;AAAA,MACd,SAAA,EAAW,EAAA;AAAA,QACT,qFAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;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,GAAgB,GAAA;AAAA,EACpB,oEAAA;AAAA,EACA;AAAA,I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A,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 type * as React from 'react'\nimport { useMemo } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from \"../lib/utils.js\"\nimport { Label } from \"../components/label.js\"\nimport { Separator } from \"../components/separator.js\"\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n // `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a\n // checkbox/radio group child. The original `data-[slot=checkbox-group]:gap-3`\n // was self-referential (this element's slot is `field-group`) and\n // could never apply. Mirrors the rule on FieldSet above.\n \"group/field-group @container/field-group flex w-full flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 *:data-[slot=field-group]:gap-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n \"group/field flex w-full gap-2 data-[invalid=true]:text-destructive\",\n {\n variants: {\n orientation: {\n vertical: \"flex-col *:w-full [&>.sr-only]:w-auto\",\n horizontal:\n \"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n responsive:\n \"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n }\n)\n\nfunction Field({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n \"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLabel({\n className,\n ...props\n}: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10\",\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"flex w-fit items-center gap-2 text-xs/relaxed font-medium group-data-[disabled=true]/field:opacity-50\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n // `group-data-[orientation=horizontal]/field:` matches the actual\n // `data-orientation=\"horizontal\"` attribute Field emits. The previous\n // `group-has-data-horizontal/field:` targeted a non-existent\n // `[data-horizontal]` attribute and never fired.\n \"text-start text-xs/relaxed leading-normal font-normal text-muted-foreground group-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5\",\n \"last:mt-0 nth-last-2:-mt-1\",\n \"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"relative -my-2 h-5 text-xs/relaxed group-data-[variant=outline]/field-group:-mb-2\",\n className\n )}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const content = useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [\n ...new Map(errors.map((error) => [error?.message, error])).values(),\n ]\n\n if (uniqueErrors?.length == 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className=\"ms-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map(\n (error, index) =>\n error?.message && <li key={index}>{error.message}</li>\n )}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"text-xs/relaxed font-normal text-destructive\", className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldTitle,\n}\n"]}
|
|
@@ -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-xs/relaxed leading-none 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,6NAAA;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-xs/relaxed leading-none 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"]}
|
|
@@ -10,6 +10,16 @@ declare function LinkProvider({ children, component, }: {
|
|
|
10
10
|
children: React__default.ReactNode;
|
|
11
11
|
component: LinkComponent;
|
|
12
12
|
}): react_jsx_runtime.JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Polymorphic anchor wrapper. Renders an `<a>` by default, or any element
|
|
15
|
+
* provided via the `as` prop, or via a `<LinkProvider component={…}>` context
|
|
16
|
+
* (use the context to inject a framework Link like Next.js `next/link`).
|
|
17
|
+
*
|
|
18
|
+
* Hover / active / focus styling on consumers should use the native CSS
|
|
19
|
+
* pseudo-class utilities (`hover:`, `active:`, `focus-visible:`, and their
|
|
20
|
+
* `group-…` variants) — Tailwind v4 maps them to real CSS, no JS state
|
|
21
|
+
* tracking required.
|
|
22
|
+
*/
|
|
13
23
|
declare const Link: React__default.ForwardRefExoticComponent<Omit<Omit<React__default.DetailedHTMLProps<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">, "href"> & {
|
|
14
24
|
as?: LinkComponent;
|
|
15
25
|
href: React__default.ComponentPropsWithoutRef<"a">["href"] | object;
|
package/dist/components/link.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import * as Headless from '@headlessui/react';
|
|
4
3
|
import React, { createContext, forwardRef, useContext } from 'react';
|
|
5
4
|
|
|
6
5
|
const LinkComponentContext = createContext(null);
|
|
@@ -13,7 +12,7 @@ function LinkProvider({
|
|
|
13
12
|
const Link = forwardRef(function Link2({ as, ...props }, ref) {
|
|
14
13
|
const ContextLink = useContext(LinkComponentContext);
|
|
15
14
|
const component = as ?? ContextLink ?? "a";
|
|
16
|
-
return
|
|
15
|
+
return React.createElement(component, { ...props, ref });
|
|
17
16
|
});
|
|
18
17
|
|
|
19
18
|
export { Link, LinkProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/link.tsx"],"names":["Link"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/link.tsx"],"names":["Link"],"mappings":";;;AAWA,MAAM,oBAAA,GAAuB,cAAoC,IAAI,CAAA;AAErE,SAAS,YAAA,CAAa;AAAA,EACpB,QAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,2BACG,oBAAA,CAAqB,QAAA,EAArB,EAA8B,KAAA,EAAO,WACnC,QAAA,EACH,CAAA;AAEJ;AAYA,MAAM,IAAA,GAAO,WAAW,SAASA,KAAAA,CAC/B,EAAE,EAAA,EAAI,GAAG,KAAA,EAAM,EACf,GAAA,EACA;AACA,EAAA,MAAM,WAAA,GAAc,WAAW,oBAAoB,CAAA;AACnD,EAAA,MAAM,SAAA,GAAY,MAAM,WAAA,IAAe,GAAA;AAEvC,EAAA,OAAO,MAAM,aAAA,CAAc,SAAA,EAAW,EAAE,GAAG,KAAA,EAAO,KAAK,CAAA;AACzD,CAAC","file":"link.js","sourcesContent":["'use client'\n\nimport React, { createContext, forwardRef, useContext } from 'react'\n\ntype LinkComponent = React.ElementType\n\ntype LinkProps = Omit<React.ComponentPropsWithoutRef<'a'>, 'href'> & {\n as?: LinkComponent\n href: React.ComponentPropsWithoutRef<'a'>['href'] | object\n}\n\nconst LinkComponentContext = createContext<LinkComponent | null>(null)\n\nfunction LinkProvider({\n children,\n component,\n}: {\n children: React.ReactNode\n component: LinkComponent\n}) {\n return (\n <LinkComponentContext.Provider value={component}>\n {children}\n </LinkComponentContext.Provider>\n )\n}\n\n/**\n * Polymorphic anchor wrapper. Renders an `<a>` by default, or any element\n * provided via the `as` prop, or via a `<LinkProvider component={…}>` context\n * (use the context to inject a framework Link like Next.js `next/link`).\n *\n * Hover / active / focus styling on consumers should use the native CSS\n * pseudo-class utilities (`hover:`, `active:`, `focus-visible:`, and their\n * `group-…` variants) — Tailwind v4 maps them to real CSS, no JS state\n * tracking required.\n */\nconst Link = forwardRef(function Link(\n { as, ...props }: LinkProps,\n ref: React.ForwardedRef<HTMLAnchorElement>\n) {\n const ContextLink = useContext(LinkComponentContext)\n const component = as ?? ContextLink ?? 'a'\n\n return React.createElement(component, { ...props, ref })\n})\n\nexport { Link, LinkProvider }\nexport type { LinkComponent, LinkProps }\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
import { Button } from '../components/button.js';
|
|
5
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '../components/card.js';
|
|
6
|
+
import { FieldGroup, Field, FieldLabel, FieldDescription } from '../components/field.js';
|
|
7
|
+
import { Input } from '../components/input.js';
|
|
8
|
+
|
|
9
|
+
function LoginForm({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-6", className), ...props, children: /* @__PURE__ */ jsxs(Card, { children: [
|
|
14
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
15
|
+
/* @__PURE__ */ jsx(CardTitle, { children: "Login to your account" }),
|
|
16
|
+
/* @__PURE__ */ jsx(CardDescription, { children: "Enter your email below to login to your account" })
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("form", { children: /* @__PURE__ */ jsxs(FieldGroup, { children: [
|
|
19
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "email", children: "Email" }),
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
Input,
|
|
23
|
+
{
|
|
24
|
+
id: "email",
|
|
25
|
+
type: "email",
|
|
26
|
+
placeholder: "m@example.com",
|
|
27
|
+
required: true
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
32
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "password", children: "Password" }),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"a",
|
|
36
|
+
{
|
|
37
|
+
href: "#",
|
|
38
|
+
className: "ms-auto inline-block text-sm underline-offset-4 hover:underline",
|
|
39
|
+
children: "Forgot your password?"
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsx(Input, { id: "password", type: "password", required: true })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", children: "Login" }),
|
|
47
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", type: "button", children: "Login with Google" }),
|
|
48
|
+
/* @__PURE__ */ jsxs(FieldDescription, { className: "text-center", children: [
|
|
49
|
+
"Don't have an account? ",
|
|
50
|
+
/* @__PURE__ */ jsx("a", { href: "#", children: "Sign up" })
|
|
51
|
+
] })
|
|
52
|
+
] })
|
|
53
|
+
] }) }) })
|
|
54
|
+
] }) });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { LoginForm };
|
|
58
|
+
//# sourceMappingURL=login-form.js.map
|
|
59
|
+
//# sourceMappingURL=login-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/login-form.tsx"],"names":[],"mappings":";;;;;;;AAqBO,SAAS,SAAA,CAAU;AAAA,EACxB,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAgC;AAC9B,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,SAAS,CAAA,EAAI,GAAG,KAAA,EACxD,QAAA,kBAAA,IAAA,CAAC,IAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,UAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,aAAU,QAAA,EAAA,uBAAA,EAAqB,CAAA;AAAA,sBAChC,GAAA,CAAC,mBAAgB,QAAA,EAAA,iDAAA,EAEjB;AAAA,KAAA,EACF,CAAA;AAAA,oBACA,GAAA,CAAC,WAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EACC,+BAAC,UAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,IAAA,CAAC,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,QAAA,EAAA,OAAA,EA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AAA;AAEJ","file":"login-form.js","sourcesContent":["'use client'\n\nimport type * as React from \"react\"\n\nimport { cn } from \"../lib/utils.js\"\nimport { Button } from \"../components/button.js\"\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"../components/card.js\"\nimport {\n Field,\n FieldDescription,\n FieldGroup,\n FieldLabel,\n} from \"../components/field.js\"\nimport { Input } from \"../components/input.js\"\n\nexport function LoginForm({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div className={cn(\"flex flex-col gap-6\", className)} {...props}>\n <Card>\n <CardHeader>\n <CardTitle>Login to your account</CardTitle>\n <CardDescription>\n Enter your email below to login to your account\n </CardDescription>\n </CardHeader>\n <CardContent>\n <form>\n <FieldGroup>\n <Field>\n <FieldLabel htmlFor=\"email\">Email</FieldLabel>\n <Input\n id=\"email\"\n type=\"email\"\n placeholder=\"m@example.com\"\n required\n />\n </Field>\n <Field>\n <div className=\"flex items-center\">\n <FieldLabel htmlFor=\"password\">Password</FieldLabel>\n <a\n href=\"#\"\n className=\"ms-auto inline-block text-sm underline-offset-4 hover:underline\"\n >\n Forgot your password?\n </a>\n </div>\n <Input id=\"password\" type=\"password\" required />\n </Field>\n <Field>\n <Button type=\"submit\">Login</Button>\n <Button variant=\"outline\" type=\"button\">\n Login with Google\n </Button>\n <FieldDescription className=\"text-center\">\n Don't have an account? <a href=\"#\">Sign up</a>\n </FieldDescription>\n </Field>\n </FieldGroup>\n </form>\n </CardContent>\n </Card>\n </div>\n )\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
3
|
+
|
|
4
|
+
declare function Separator({ className, orientation, ...props }: Separator$1.Props): react_jsx_runtime.JSX.Element;
|
|
5
|
+
|
|
6
|
+
export { Separator };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
4
|
+
import { cn } from '../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
function Separator({
|
|
7
|
+
className,
|
|
8
|
+
orientation = "horizontal",
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
Separator$1,
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "separator",
|
|
15
|
+
orientation,
|
|
16
|
+
className: cn(
|
|
17
|
+
// Base UI's Separator emits `data-orientation="horizontal|vertical"`
|
|
18
|
+
// only (see @base-ui/react SeparatorDataAttributes). The previous
|
|
19
|
+
// `data-horizontal:` / `data-vertical:` selectors targeted
|
|
20
|
+
// non-existent boolean attributes and never matched, leaving the
|
|
21
|
+
// separator with no explicit axis sizing.
|
|
22
|
+
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
...props
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Separator };
|
|
31
|
+
//# sourceMappingURL=separator.js.map
|
|
32
|
+
//# sourceMappingURL=separator.js.map
|