@hex-core/components 1.8.1 → 1.10.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/_tsup-dts-rollup.d.ts +855 -18
- package/dist/accordion.js.map +1 -1
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.js.map +1 -1
- package/dist/arc.js.map +1 -1
- package/dist/attachment.js.map +1 -1
- package/dist/audio-player.js.map +1 -1
- package/dist/audio-waveform.js.map +1 -1
- package/dist/auth-forgot-password.d.ts +2 -0
- package/dist/auth-forgot-password.js +400 -0
- package/dist/auth-forgot-password.js.map +1 -0
- package/dist/auth-reset-password.d.ts +2 -0
- package/dist/auth-reset-password.js +323 -0
- package/dist/auth-reset-password.js.map +1 -0
- package/dist/auth-sign-in-split.d.ts +3 -0
- package/dist/auth-sign-in-split.js +443 -0
- package/dist/auth-sign-in-split.js.map +1 -0
- package/dist/auth-sign-up-card.d.ts +3 -0
- package/dist/auth-sign-up-card.js +590 -0
- package/dist/auth-sign-up-card.js.map +1 -0
- package/dist/auth-verify-email.d.ts +2 -0
- package/dist/auth-verify-email.js +339 -0
- package/dist/auth-verify-email.js.map +1 -0
- package/dist/auth-verify-otp.d.ts +2 -0
- package/dist/auth-verify-otp.js +349 -0
- package/dist/auth-verify-otp.js.map +1 -0
- package/dist/avatar.js.map +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/branch.d.ts +2 -0
- package/dist/branch.js +136 -0
- package/dist/branch.js.map +1 -0
- package/dist/breadcrumb.js.map +1 -1
- package/dist/button.js.map +1 -1
- package/dist/calendar.js.map +1 -1
- package/dist/canvas.js.map +1 -1
- package/dist/card.js.map +1 -1
- package/dist/chain-of-thought.d.ts +3 -0
- package/dist/chain-of-thought.js +119 -0
- package/dist/chain-of-thought.js.map +1 -0
- package/dist/checkbox.js.map +1 -1
- package/dist/chord.js.map +1 -1
- package/dist/citation.js.map +1 -1
- package/dist/cloze.js.map +1 -1
- package/dist/cluster.js.map +1 -1
- package/dist/code-block-copy.js.map +1 -1
- package/dist/code-block.js.map +1 -1
- package/dist/color-picker.js.map +1 -1
- package/dist/combobox.js.map +1 -1
- package/dist/command.js.map +1 -1
- package/dist/compare-table.js.map +1 -1
- package/dist/composer.js.map +1 -1
- package/dist/container.js.map +1 -1
- package/dist/context-menu.js.map +1 -1
- package/dist/conversation.d.ts +3 -0
- package/dist/conversation.js +358 -0
- package/dist/conversation.js.map +1 -0
- package/dist/data-table.js.map +1 -1
- package/dist/date-picker.js.map +1 -1
- package/dist/deck.js.map +1 -1
- package/dist/dendrogram.js.map +1 -1
- package/dist/diagram.js.map +1 -1
- package/dist/dialog.js.map +1 -1
- package/dist/drawer.js.map +1 -1
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/dropzone.js.map +1 -1
- package/dist/empty.js.map +1 -1
- package/dist/error-state.js.map +1 -1
- package/dist/file-tree.js.map +1 -1
- package/dist/flashcard.js.map +1 -1
- package/dist/flowchart.js.map +1 -1
- package/dist/form.js.map +1 -1
- package/dist/funnel.js.map +1 -1
- package/dist/gantt.js.map +1 -1
- package/dist/grid.js.map +1 -1
- package/dist/hover-card.js.map +1 -1
- package/dist/image-occlusion.js.map +1 -1
- package/dist/index.d.ts +40 -0
- package/dist/index.js +4839 -2813
- package/dist/index.js.map +1 -1
- package/dist/inline-citation.d.ts +2 -0
- package/dist/inline-citation.js +108 -0
- package/dist/inline-citation.js.map +1 -0
- package/dist/input-otp.js.map +1 -1
- package/dist/input.js.map +1 -1
- package/dist/label.js.map +1 -1
- package/dist/loading-indicator.js.map +1 -1
- package/dist/loading.js.map +1 -1
- package/dist/markdown.d.ts +1 -0
- package/dist/markdown.js +784 -4
- package/dist/markdown.js.map +1 -1
- package/dist/matrix.js.map +1 -1
- package/dist/menubar.js.map +1 -1
- package/dist/message-actions.js.map +1 -1
- package/dist/message-list.js.map +1 -1
- package/dist/message.js.map +1 -1
- package/dist/mind-map.js.map +1 -1
- package/dist/multi-combobox.js.map +1 -1
- package/dist/navigation-menu.js.map +1 -1
- package/dist/org-chart.js.map +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/plan.d.ts +3 -0
- package/dist/plan.js +183 -0
- package/dist/plan.js.map +1 -0
- package/dist/popover.js.map +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/pyramid.js.map +1 -1
- package/dist/quiz.js.map +1 -1
- package/dist/radio-group.js.map +1 -1
- package/dist/reasoning.js.map +1 -1
- package/dist/resizable.js.map +1 -1
- package/dist/sankey.js.map +1 -1
- package/dist/schemas.d.ts +8 -0
- package/dist/schemas.js +774 -17
- package/dist/schemas.js.map +1 -1
- package/dist/scroll-area.js.map +1 -1
- package/dist/select.js.map +1 -1
- package/dist/separator.js.map +1 -1
- package/dist/sequence.js.map +1 -1
- package/dist/sheet.js.map +1 -1
- package/dist/shimmer.d.ts +2 -0
- package/dist/shimmer.js +39 -0
- package/dist/shimmer.js.map +1 -0
- package/dist/sidebar.js.map +1 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.js.map +1 -1
- package/dist/sources.d.ts +3 -0
- package/dist/sources.js +164 -0
- package/dist/sources.js.map +1 -0
- package/dist/spaced-repetition.js.map +1 -1
- package/dist/spacer.js.map +1 -1
- package/dist/speech-recognition.js.map +1 -1
- package/dist/stack.js.map +1 -1
- package/dist/stepper.js.map +1 -1
- package/dist/suggestion.js.map +1 -1
- package/dist/sunburst.js.map +1 -1
- package/dist/switch.js.map +1 -1
- package/dist/table.js.map +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/tag.js.map +1 -1
- package/dist/task.d.ts +3 -0
- package/dist/task.js +189 -0
- package/dist/task.js.map +1 -0
- package/dist/terminal.js +11 -0
- package/dist/terminal.js.map +1 -1
- package/dist/textarea.js.map +1 -1
- package/dist/time-axis.js.map +1 -1
- package/dist/time-picker.js.map +1 -1
- package/dist/timeline.js.map +1 -1
- package/dist/toggle-group.js.map +1 -1
- package/dist/toggle.js.map +1 -1
- package/dist/tool-call.js +5 -6
- package/dist/tool-call.js.map +1 -1
- package/dist/toolbar.js.map +1 -1
- package/dist/tooltip.js.map +1 -1
- package/dist/tree-map.js.map +1 -1
- package/dist/tree.js.map +1 -1
- package/dist/venn.js.map +1 -1
- package/package.json +9 -4
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React6 from 'react';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
8
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
9
|
+
|
|
10
|
+
function cn(...inputs) {
|
|
11
|
+
return twMerge(clsx(inputs));
|
|
12
|
+
}
|
|
13
|
+
var alertVariants = cva(
|
|
14
|
+
[
|
|
15
|
+
"relative w-full rounded-lg border px-[var(--space-4,1rem)] py-[var(--space-3,0.75rem)] text-sm",
|
|
16
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
17
|
+
"[&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:text-foreground",
|
|
18
|
+
"[&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px]"
|
|
19
|
+
].join(" "),
|
|
20
|
+
{
|
|
21
|
+
variants: {
|
|
22
|
+
variant: {
|
|
23
|
+
default: "border-foreground/[0.08] bg-background text-foreground",
|
|
24
|
+
destructive: "border-destructive/50 text-destructive [&>svg]:text-destructive bg-destructive/5"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: { variant: "default" }
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
var Alert = React6.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
ref,
|
|
34
|
+
role: "alert",
|
|
35
|
+
className: cn(alertVariants({ variant }), className),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
));
|
|
39
|
+
Alert.displayName = "Alert";
|
|
40
|
+
var AlertTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
41
|
+
"h5",
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
className: cn("mb-[var(--space-1,0.25rem)] font-medium leading-none tracking-tight", className),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
));
|
|
48
|
+
AlertTitle.displayName = "AlertTitle";
|
|
49
|
+
var AlertDescription = React6.forwardRef(
|
|
50
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("text-sm [&_p]:leading-relaxed", className), ...props })
|
|
51
|
+
);
|
|
52
|
+
AlertDescription.displayName = "AlertDescription";
|
|
53
|
+
var emptyVariants = cva(
|
|
54
|
+
[
|
|
55
|
+
"flex flex-col items-center justify-center text-center",
|
|
56
|
+
"rounded-md border border-dashed border-border bg-muted/30"
|
|
57
|
+
].join(" "),
|
|
58
|
+
{
|
|
59
|
+
variants: {
|
|
60
|
+
size: {
|
|
61
|
+
sm: "gap-[var(--space-2,0.5rem)] px-[var(--space-4,1rem)] py-[var(--space-6,1.5rem)] text-sm",
|
|
62
|
+
default: "gap-[var(--space-3,0.75rem)] px-[var(--space-6,1.5rem)] py-[var(--space-8,2rem)]",
|
|
63
|
+
lg: "gap-[var(--space-4,1rem)] px-[var(--space-8,2rem)] py-[var(--space-12,3rem)]"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: { size: "default" }
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
var emptyIconWrapperVariants = cva(
|
|
70
|
+
"flex shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground [&_svg]:size-5",
|
|
71
|
+
{
|
|
72
|
+
variants: {
|
|
73
|
+
size: {
|
|
74
|
+
sm: "h-9 w-9",
|
|
75
|
+
default: "h-12 w-12 [&_svg]:size-6",
|
|
76
|
+
lg: "h-16 w-16 [&_svg]:size-7"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: { size: "default" }
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
var emptyTitleVariants = cva("font-semibold text-foreground", {
|
|
83
|
+
variants: {
|
|
84
|
+
size: {
|
|
85
|
+
sm: "text-sm",
|
|
86
|
+
default: "text-base",
|
|
87
|
+
lg: "text-lg"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
defaultVariants: { size: "default" }
|
|
91
|
+
});
|
|
92
|
+
var emptyDescriptionVariants = cva("max-w-md text-muted-foreground", {
|
|
93
|
+
variants: {
|
|
94
|
+
size: {
|
|
95
|
+
sm: "text-xs",
|
|
96
|
+
default: "text-sm",
|
|
97
|
+
lg: "text-base"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
defaultVariants: { size: "default" }
|
|
101
|
+
});
|
|
102
|
+
function Empty({
|
|
103
|
+
className,
|
|
104
|
+
size,
|
|
105
|
+
icon,
|
|
106
|
+
title,
|
|
107
|
+
description,
|
|
108
|
+
action,
|
|
109
|
+
titleAs = "h3",
|
|
110
|
+
ref,
|
|
111
|
+
...props
|
|
112
|
+
}) {
|
|
113
|
+
const titleId = React6.useId();
|
|
114
|
+
const TitleComp = titleAs;
|
|
115
|
+
return /* @__PURE__ */ jsxs(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref,
|
|
119
|
+
role: "region",
|
|
120
|
+
"aria-labelledby": titleId,
|
|
121
|
+
className: cn(emptyVariants({ size }), className),
|
|
122
|
+
...props,
|
|
123
|
+
children: [
|
|
124
|
+
icon ? /* @__PURE__ */ jsx("div", { className: emptyIconWrapperVariants({ size }), "aria-hidden": "true", children: icon }) : null,
|
|
125
|
+
/* @__PURE__ */ jsx(TitleComp, { id: titleId, className: emptyTitleVariants({ size }), children: title }),
|
|
126
|
+
description ? /* @__PURE__ */ jsx("div", { className: emptyDescriptionVariants({ size }), children: description }) : null,
|
|
127
|
+
action ? /* @__PURE__ */ jsx("div", { className: "mt-[var(--space-2,0.5rem)]", children: action }) : null
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
var buttonVariants = cva(
|
|
133
|
+
[
|
|
134
|
+
"inline-flex items-center justify-center gap-[var(--gap-sm,0.5rem)] whitespace-nowrap rounded-md text-sm font-medium",
|
|
135
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
136
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
137
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
138
|
+
"active:scale-[0.98]",
|
|
139
|
+
"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"
|
|
140
|
+
].join(" "),
|
|
141
|
+
{
|
|
142
|
+
variants: {
|
|
143
|
+
variant: {
|
|
144
|
+
default: [
|
|
145
|
+
"bg-primary text-primary-foreground",
|
|
146
|
+
"shadow-sm shadow-primary/20",
|
|
147
|
+
"hover:bg-primary/90 hover:shadow-md hover:shadow-primary/25"
|
|
148
|
+
].join(" "),
|
|
149
|
+
destructive: [
|
|
150
|
+
"bg-destructive text-destructive-foreground",
|
|
151
|
+
"shadow-sm shadow-destructive/20",
|
|
152
|
+
"hover:bg-destructive/90 hover:shadow-md hover:shadow-destructive/25"
|
|
153
|
+
].join(" "),
|
|
154
|
+
outline: [
|
|
155
|
+
"border border-input bg-background",
|
|
156
|
+
"shadow-sm inset-ring-1 inset-ring-foreground/[0.06]",
|
|
157
|
+
"hover:bg-accent hover:text-accent-foreground hover:shadow-md hover:inset-ring-foreground/12"
|
|
158
|
+
].join(" "),
|
|
159
|
+
secondary: [
|
|
160
|
+
"bg-secondary text-secondary-foreground",
|
|
161
|
+
"shadow-sm inset-ring-1 inset-ring-foreground/[0.08]",
|
|
162
|
+
"hover:bg-secondary/80 hover:shadow-md hover:inset-ring-foreground/15"
|
|
163
|
+
].join(" "),
|
|
164
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
165
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
166
|
+
},
|
|
167
|
+
size: {
|
|
168
|
+
default: "h-[var(--control-height-md,2.5rem)] px-[var(--space-4,1rem)] py-[var(--space-2,0.5rem)]",
|
|
169
|
+
sm: "h-[var(--control-height-sm,2.25rem)] rounded-md px-[var(--space-3,0.75rem)]",
|
|
170
|
+
lg: "h-[var(--control-height-lg,2.75rem)] rounded-md px-[var(--space-8,2rem)] text-base",
|
|
171
|
+
icon: "h-[var(--control-height-md,2.5rem)] w-[var(--control-height-md,2.5rem)]"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
defaultVariants: {
|
|
175
|
+
variant: "default",
|
|
176
|
+
size: "default"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
var Button = React6.forwardRef(
|
|
181
|
+
({ className, variant, size, asChild = false, loading = false, children, disabled, ...props }, ref) => {
|
|
182
|
+
const Comp = asChild ? Slot : "button";
|
|
183
|
+
return /* @__PURE__ */ jsx(
|
|
184
|
+
Comp,
|
|
185
|
+
{
|
|
186
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
187
|
+
ref,
|
|
188
|
+
disabled: disabled || loading,
|
|
189
|
+
"aria-busy": loading || void 0,
|
|
190
|
+
...props,
|
|
191
|
+
children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
192
|
+
/* @__PURE__ */ jsxs(
|
|
193
|
+
"svg",
|
|
194
|
+
{
|
|
195
|
+
className: "animate-spin h-4 w-4",
|
|
196
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
197
|
+
fill: "none",
|
|
198
|
+
viewBox: "0 0 24 24",
|
|
199
|
+
"aria-hidden": "true",
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ jsx(
|
|
202
|
+
"circle",
|
|
203
|
+
{
|
|
204
|
+
className: "opacity-25",
|
|
205
|
+
cx: "12",
|
|
206
|
+
cy: "12",
|
|
207
|
+
r: "10",
|
|
208
|
+
stroke: "currentColor",
|
|
209
|
+
strokeWidth: "4"
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsx(
|
|
213
|
+
"path",
|
|
214
|
+
{
|
|
215
|
+
className: "opacity-75",
|
|
216
|
+
fill: "currentColor",
|
|
217
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
children
|
|
224
|
+
] }) : children
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
Button.displayName = "Button";
|
|
230
|
+
var Input = React6.forwardRef(
|
|
231
|
+
({ className, type, ...props }, ref) => {
|
|
232
|
+
return /* @__PURE__ */ jsx(
|
|
233
|
+
"input",
|
|
234
|
+
{
|
|
235
|
+
type,
|
|
236
|
+
className: cn(
|
|
237
|
+
"flex h-[var(--control-height-md,2.5rem)] w-full rounded-md border border-input bg-background px-[var(--space-3,0.75rem)] py-[var(--space-2,0.5rem)] text-sm",
|
|
238
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
239
|
+
// inset-ring gives a self-borne edge so the input field is visible on flat
|
|
240
|
+
// surfaces (token border alone is too low-contrast on bg-background=white).
|
|
241
|
+
"shadow-sm inset-ring-1 inset-ring-foreground/[0.06]",
|
|
242
|
+
"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
|
|
243
|
+
"placeholder:text-muted-foreground",
|
|
244
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
245
|
+
"focus-visible:shadow-md focus-visible:border-ring/50",
|
|
246
|
+
"hover:border-ring/30 hover:shadow-md",
|
|
247
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
248
|
+
className
|
|
249
|
+
),
|
|
250
|
+
ref,
|
|
251
|
+
...props
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
Input.displayName = "Input";
|
|
257
|
+
var labelVariants = cva(
|
|
258
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
259
|
+
);
|
|
260
|
+
var Label = React6.forwardRef(
|
|
261
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props })
|
|
262
|
+
);
|
|
263
|
+
Label.displayName = "Label";
|
|
264
|
+
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
265
|
+
var MailIcon = () => /* @__PURE__ */ jsxs(
|
|
266
|
+
"svg",
|
|
267
|
+
{
|
|
268
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
269
|
+
viewBox: "0 0 24 24",
|
|
270
|
+
fill: "none",
|
|
271
|
+
stroke: "currentColor",
|
|
272
|
+
strokeWidth: 2,
|
|
273
|
+
strokeLinecap: "round",
|
|
274
|
+
strokeLinejoin: "round",
|
|
275
|
+
"aria-hidden": "true",
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ jsx("rect", { width: 20, height: 16, x: 2, y: 4, rx: 2 }),
|
|
278
|
+
/* @__PURE__ */ jsx("path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7" })
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
function AuthForgotPassword({
|
|
283
|
+
adapter,
|
|
284
|
+
signInHref = "/sign-in",
|
|
285
|
+
className,
|
|
286
|
+
onSuccess
|
|
287
|
+
}) {
|
|
288
|
+
const [email, setEmail] = React6.useState("");
|
|
289
|
+
const [submitting, setSubmitting] = React6.useState(false);
|
|
290
|
+
const [error, setError] = React6.useState(null);
|
|
291
|
+
const [submittedEmail, setSubmittedEmail] = React6.useState(null);
|
|
292
|
+
async function handleSubmit(e) {
|
|
293
|
+
e.preventDefault();
|
|
294
|
+
if (!EMAIL_REGEX.test(email)) {
|
|
295
|
+
setError({ code: "invalid_email", message: "Enter a valid email address." });
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (!adapter.requestPasswordReset) {
|
|
299
|
+
console.warn(
|
|
300
|
+
"[AuthForgotPassword] adapter.requestPasswordReset is not implemented \u2014 wire it up before exposing the form."
|
|
301
|
+
);
|
|
302
|
+
setError({
|
|
303
|
+
code: "unimplemented",
|
|
304
|
+
message: "Password reset is currently unavailable. Please try again later."
|
|
305
|
+
});
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
setError(null);
|
|
309
|
+
setSubmitting(true);
|
|
310
|
+
try {
|
|
311
|
+
const result = await adapter.requestPasswordReset({ email });
|
|
312
|
+
if (!result.ok) {
|
|
313
|
+
setError(result.error ?? { code: "unknown", message: "Couldn't send reset link." });
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
setSubmittedEmail(email);
|
|
317
|
+
onSuccess?.();
|
|
318
|
+
} finally {
|
|
319
|
+
setSubmitting(false);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
if (submittedEmail) {
|
|
323
|
+
return /* @__PURE__ */ jsx(
|
|
324
|
+
"div",
|
|
325
|
+
{
|
|
326
|
+
className: cn(
|
|
327
|
+
"flex min-h-svh items-center justify-center p-6 sm:p-10",
|
|
328
|
+
className
|
|
329
|
+
),
|
|
330
|
+
children: /* @__PURE__ */ jsx("div", { className: "w-full max-w-sm", children: /* @__PURE__ */ jsx(
|
|
331
|
+
Empty,
|
|
332
|
+
{
|
|
333
|
+
icon: /* @__PURE__ */ jsx(MailIcon, {}),
|
|
334
|
+
title: "Check your inbox",
|
|
335
|
+
description: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
336
|
+
"We sent a password-reset link to",
|
|
337
|
+
" ",
|
|
338
|
+
/* @__PURE__ */ jsx("strong", { className: "text-foreground", children: submittedEmail }),
|
|
339
|
+
". The link expires in 60 minutes."
|
|
340
|
+
] }),
|
|
341
|
+
action: /* @__PURE__ */ jsx(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ jsx("a", { href: signInHref, children: "Back to sign in" }) })
|
|
342
|
+
}
|
|
343
|
+
) })
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex min-h-svh items-center justify-center p-6 sm:p-10", className), children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-sm space-y-6", children: [
|
|
348
|
+
/* @__PURE__ */ jsxs("header", { className: "space-y-2 text-center", children: [
|
|
349
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: "Reset your password" }),
|
|
350
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Enter your email and we\u2019ll send you a link to set a new password." })
|
|
351
|
+
] }),
|
|
352
|
+
error ? /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
|
|
353
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Couldn\u2019t send reset link" }),
|
|
354
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: error.message })
|
|
355
|
+
] }) : null,
|
|
356
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", noValidate: true, children: [
|
|
357
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
358
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "auth-forgot-email", children: "Email" }),
|
|
359
|
+
/* @__PURE__ */ jsx(
|
|
360
|
+
Input,
|
|
361
|
+
{
|
|
362
|
+
id: "auth-forgot-email",
|
|
363
|
+
type: "email",
|
|
364
|
+
autoComplete: "email",
|
|
365
|
+
required: true,
|
|
366
|
+
value: email,
|
|
367
|
+
onChange: (e) => setEmail(e.target.value),
|
|
368
|
+
disabled: submitting
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
] }),
|
|
372
|
+
/* @__PURE__ */ jsx(
|
|
373
|
+
Button,
|
|
374
|
+
{
|
|
375
|
+
type: "submit",
|
|
376
|
+
className: "w-full",
|
|
377
|
+
disabled: submitting,
|
|
378
|
+
loading: submitting,
|
|
379
|
+
children: submitting ? "Sending link" : "Send reset link"
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ jsxs("p", { className: "text-center text-sm text-muted-foreground", children: [
|
|
384
|
+
"Remembered your password?",
|
|
385
|
+
" ",
|
|
386
|
+
/* @__PURE__ */ jsx(
|
|
387
|
+
"a",
|
|
388
|
+
{
|
|
389
|
+
href: signInHref,
|
|
390
|
+
className: "font-medium text-foreground underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded",
|
|
391
|
+
children: "Sign in"
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
] })
|
|
395
|
+
] }) });
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export { AuthForgotPassword };
|
|
399
|
+
//# sourceMappingURL=auth-forgot-password.js.map
|
|
400
|
+
//# sourceMappingURL=auth-forgot-password.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/components/alert/alert.tsx","../src/primitives/empty/empty.tsx","../src/primitives/button/button-variants.ts","../src/primitives/button/button.tsx","../src/primitives/input/input.tsx","../src/primitives/label/label.tsx","../src/blocks/auth-forgot-password/auth-forgot-password.tsx"],"names":["React","cva","React2","jsx","React3","jsxs","React4","React5","Fragment"],"mappings":";;;;;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAA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AAAA,UACV,OAAA,EAAS,UAAA;AAAA,UAER,uBAAa,cAAA,GAAiB;AAAA;AAAA;AAChC,KAAA,EACD,CAAA;AAAA,oBAEAE,IAAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,2CAAA,EAA4C,QAAA,EAAA;AAAA,MAAA,2BAAA;AAAA,MAC9B,GAAA;AAAA,sBAC1BF,GAAAA;AAAA,QAAC,GAAA;AAAA,QAAA;AAAA,UACA,IAAA,EAAM,UAAA;AAAA,UACN,SAAA,EAAU,4KAAA;AAAA,UACV,QAAA,EAAA;AAAA;AAAA;AAED,KAAA,EACD;AAAA,GAAA,EACD,CAAA,EACD,CAAA;AAEF","file":"auth-forgot-password.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n\nconst SAFE_URL_SCHEMES = [\"http:\", \"https:\", \"mailto:\"] as const;\n\n/**\n * Allowlist a URL for use as an `<a href>` against untrusted input.\n *\n * Returns the raw string when it's `http(s):` / `mailto:` / a relative\n * URL (no scheme); returns `undefined` otherwise. Defends against\n * `javascript:` / `data:` / `vbscript:` injection from streamed model\n * output or third-party JSON payloads that flow into citation chips.\n *\n * Inside a Markdown render path, `rehype-sanitize` already strips\n * `javascript:` from inline-link hrefs — but it does NOT introspect\n * JSON nested inside attribute values (e.g. `<sources data='[…]'/>`),\n * so the components that consume that data must guard themselves.\n *\n * @param raw - The candidate URL, or `undefined` when none was supplied.\n * @returns The URL when safe to render, otherwise `undefined`.\n */\nexport function safeUrl(raw: string | undefined): string | undefined {\n\tif (raw === undefined || raw === \"\") return undefined;\n\t// Relative URLs have no scheme — `new URL(relative)` throws without a base,\n\t// so a thrown URL means either malformed input OR a relative path. Treat\n\t// \"throws + does not contain a colon\" as a relative path (safe).\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(raw);\n\t} catch {\n\t\treturn raw.includes(\":\") ? undefined : raw;\n\t}\n\treturn SAFE_URL_SCHEMES.some((scheme) => scheme === parsed.protocol) ? raw : undefined;\n}\n","import { type VariantProps, cva } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\nconst alertVariants = cva(\n\t[\n\t\t\"relative w-full rounded-lg border px-[var(--space-4,1rem)] py-[var(--space-3,0.75rem)] text-sm\",\n\t\t\"transition-all duration-[var(--duration-normal,200ms)] ease-out\",\n\t\t\"[&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:text-foreground\",\n\t\t\"[&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px]\",\n\t].join(\" \"),\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: \"border-foreground/[0.08] bg-background text-foreground\",\n\t\t\t\tdestructive:\n\t\t\t\t\t\"border-destructive/50 text-destructive [&>svg]:text-destructive bg-destructive/5\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: { variant: \"default\" },\n\t},\n);\n\n/** An inline notification banner for important messages. */\nconst Alert = React.forwardRef<\n\tHTMLDivElement,\n\tReact.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n\t<div\n\t\tref={ref}\n\t\trole=\"alert\"\n\t\tclassName={cn(alertVariants({ variant }), className)}\n\t\t{...props}\n\t/>\n));\nAlert.displayName = \"Alert\";\n\n/** The alert title heading. */\nconst AlertTitle = React.forwardRef<\n\tHTMLHeadingElement,\n\tReact.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n\t<h5\n\t\tref={ref}\n\t\tclassName={cn(\"mb-[var(--space-1,0.25rem)] font-medium leading-none tracking-tight\", className)}\n\t\t{...props}\n\t/>\n));\nAlertTitle.displayName = \"AlertTitle\";\n\n/** The alert description. Renders a div so paragraph children can be styled via [&_p]. */\nconst AlertDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<div ref={ref} className={cn(\"text-sm [&_p]:leading-relaxed\", className)} {...props} />\n\t),\n);\nAlertDescription.displayName = \"AlertDescription\";\n\nexport { Alert, AlertTitle, AlertDescription, alertVariants };\n","import { type VariantProps, cva } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\nconst emptyVariants = cva(\n\t[\n\t\t\"flex flex-col items-center justify-center text-center\",\n\t\t\"rounded-md border border-dashed border-border bg-muted/30\",\n\t].join(\" \"),\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: \"gap-[var(--space-2,0.5rem)] px-[var(--space-4,1rem)] py-[var(--space-6,1.5rem)] text-sm\",\n\t\t\t\tdefault: \"gap-[var(--space-3,0.75rem)] px-[var(--space-6,1.5rem)] py-[var(--space-8,2rem)]\",\n\t\t\t\tlg: \"gap-[var(--space-4,1rem)] px-[var(--space-8,2rem)] py-[var(--space-12,3rem)]\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: { size: \"default\" },\n\t},\n);\n\nconst emptyIconWrapperVariants = cva(\n\t\"flex shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground [&_svg]:size-5\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: \"h-9 w-9\",\n\t\t\t\tdefault: \"h-12 w-12 [&_svg]:size-6\",\n\t\t\t\tlg: \"h-16 w-16 [&_svg]:size-7\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: { size: \"default\" },\n\t},\n);\n\nconst emptyTitleVariants = cva(\"font-semibold text-foreground\", {\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"text-sm\",\n\t\t\tdefault: \"text-base\",\n\t\t\tlg: \"text-lg\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"default\" },\n});\n\nconst emptyDescriptionVariants = cva(\"max-w-md text-muted-foreground\", {\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"text-xs\",\n\t\t\tdefault: \"text-sm\",\n\t\t\tlg: \"text-base\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"default\" },\n});\n\n/** Heading element used to render the Empty title. Defaults to `h3`. */\ntype EmptyTitleAs = \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"p\";\n\nexport interface EmptyProps\n\textends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\">,\n\t\tVariantProps<typeof emptyVariants> {\n\t/** Forwarded ref onto the root region element. */\n\tref?: React.Ref<HTMLDivElement>;\n\t/** Optional icon (typically an `<svg>`) rendered in a circular muted container. */\n\ticon?: React.ReactNode;\n\t/** Required heading copy. Becomes the region's accessible name via `aria-labelledby`. */\n\ttitle: React.ReactNode;\n\t/** Optional supporting copy that explains why the slot is empty + what to do next. */\n\tdescription?: React.ReactNode;\n\t/** Optional call-to-action — typically a `<Button>` that creates the missing record. */\n\taction?: React.ReactNode;\n\t/** Heading level for the title — pick to match surrounding hierarchy (default `h3`). */\n\ttitleAs?: EmptyTitleAs;\n}\n\n/**\n * A \"zero-state\" surface for lists, dashboards, and search results that have\n * no content to show. Use to explain *why* the slot is empty and *what to do*\n * next; pair the `action` slot with a button that creates the missing record.\n *\n * Distinct from {@link Loading} (transient, has a measurable wait) and\n * {@link ErrorState} (something failed and may need a retry). If you're\n * thinking \"show a message because the request just hasn't returned yet,\"\n * reach for `Loading` — Empty is for \"the request returned, and there's\n * nothing to show.\"\n *\n * @example\n * ```tsx\n * <Empty\n * icon={<InboxIcon />}\n * title=\"No messages yet\"\n * description=\"When someone sends you a message, it'll show up here.\"\n * action={<Button>Compose</Button>}\n * />\n * ```\n *\n * @returns A region landmark labeled by the title.\n */\nfunction Empty({\n\tclassName,\n\tsize,\n\ticon,\n\ttitle,\n\tdescription,\n\taction,\n\ttitleAs = \"h3\",\n\tref,\n\t...props\n}: EmptyProps) {\n\tconst titleId = React.useId();\n\tconst TitleComp = titleAs;\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\trole=\"region\"\n\t\t\taria-labelledby={titleId}\n\t\t\tclassName={cn(emptyVariants({ size }), className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{icon ? (\n\t\t\t\t<div className={emptyIconWrapperVariants({ size })} aria-hidden=\"true\">\n\t\t\t\t\t{icon}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<TitleComp id={titleId} className={emptyTitleVariants({ size })}>\n\t\t\t\t{title}\n\t\t\t</TitleComp>\n\t\t\t{description ? (\n\t\t\t\t<div className={emptyDescriptionVariants({ size })}>{description}</div>\n\t\t\t) : null}\n\t\t\t{action ? <div className=\"mt-[var(--space-2,0.5rem)]\">{action}</div> : null}\n\t\t</div>\n\t);\n}\n\nexport { Empty, emptyVariants };\n","import { type VariantProps, cva } from \"class-variance-authority\";\n\n/**\n * CVA variants for the Button component.\n *\n * Lives in its own module so RSC-safe consumers (`Pagination`, future\n * link-styled buttons in static layouts) can import variants without\n * pulling in the full `Button` runtime — `Button` itself is client-only\n * because of `Slot` + `forwardRef` + the loading spinner. Splitting the\n * variants out keeps `dist/pagination.js` free of `@radix-ui/react-slot`.\n */\nexport const buttonVariants = cva(\n\t[\n\t\t\"inline-flex items-center justify-center gap-[var(--gap-sm,0.5rem)] whitespace-nowrap rounded-md text-sm font-medium\",\n\t\t\"transition-all duration-[var(--duration-normal,200ms)] ease-out\",\n\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\"disabled:pointer-events-none disabled:opacity-50\",\n\t\t\"active:scale-[0.98]\",\n\t\t\"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n\t].join(\" \"),\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: [\n\t\t\t\t\t\"bg-primary text-primary-foreground\",\n\t\t\t\t\t\"shadow-sm shadow-primary/20\",\n\t\t\t\t\t\"hover:bg-primary/90 hover:shadow-md hover:shadow-primary/25\",\n\t\t\t\t].join(\" \"),\n\t\t\t\tdestructive: [\n\t\t\t\t\t\"bg-destructive text-destructive-foreground\",\n\t\t\t\t\t\"shadow-sm shadow-destructive/20\",\n\t\t\t\t\t\"hover:bg-destructive/90 hover:shadow-md hover:shadow-destructive/25\",\n\t\t\t\t].join(\" \"),\n\t\t\t\toutline: [\n\t\t\t\t\t\"border border-input bg-background\",\n\t\t\t\t\t\"shadow-sm inset-ring-1 inset-ring-foreground/[0.06]\",\n\t\t\t\t\t\"hover:bg-accent hover:text-accent-foreground hover:shadow-md hover:inset-ring-foreground/12\",\n\t\t\t\t].join(\" \"),\n\t\t\t\tsecondary: [\n\t\t\t\t\t\"bg-secondary text-secondary-foreground\",\n\t\t\t\t\t\"shadow-sm inset-ring-1 inset-ring-foreground/[0.08]\",\n\t\t\t\t\t\"hover:bg-secondary/80 hover:shadow-md hover:inset-ring-foreground/15\",\n\t\t\t\t].join(\" \"),\n\t\t\t\tghost: \"hover:bg-accent hover:text-accent-foreground\",\n\t\t\t\tlink: \"text-primary underline-offset-4 hover:underline\",\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault:\n\t\t\t\t\t\"h-[var(--control-height-md,2.5rem)] px-[var(--space-4,1rem)] py-[var(--space-2,0.5rem)]\",\n\t\t\t\tsm: \"h-[var(--control-height-sm,2.25rem)] rounded-md px-[var(--space-3,0.75rem)]\",\n\t\t\t\tlg: \"h-[var(--control-height-lg,2.75rem)] rounded-md px-[var(--space-8,2rem)] text-base\",\n\t\t\t\ticon: \"h-[var(--control-height-md,2.5rem)] w-[var(--control-height-md,2.5rem)]\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: \"default\",\n\t\t\tsize: \"default\",\n\t\t},\n\t},\n);\n\nexport type ButtonVariantsProps = VariantProps<typeof buttonVariants>;\n","\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\nimport { type ButtonVariantsProps, buttonVariants } from \"./button-variants.js\";\n\nexport interface ButtonProps\n\textends React.ButtonHTMLAttributes<HTMLButtonElement>,\n\t\tButtonVariantsProps {\n\tasChild?: boolean;\n\tloading?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n\t(\n\t\t{ className, variant, size, asChild = false, loading = false, children, disabled, ...props },\n\t\tref,\n\t) => {\n\t\tconst Comp = asChild ? Slot : \"button\";\n\t\treturn (\n\t\t\t<Comp\n\t\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\n\t\t\t\tref={ref}\n\t\t\t\tdisabled={disabled || loading}\n\t\t\t\taria-busy={loading || undefined}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{loading ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tclassName=\"animate-spin h-4 w-4\"\n\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<circle\n\t\t\t\t\t\t\t\tclassName=\"opacity-25\"\n\t\t\t\t\t\t\t\tcx=\"12\"\n\t\t\t\t\t\t\t\tcy=\"12\"\n\t\t\t\t\t\t\t\tr=\"10\"\n\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\tstrokeWidth=\"4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\tclassName=\"opacity-75\"\n\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\td=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tchildren\n\t\t\t\t)}\n\t\t\t</Comp>\n\t\t);\n\t},\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement>;\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n\t({ className, type, ...props }, ref) => {\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype={type}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex h-[var(--control-height-md,2.5rem)] w-full rounded-md border border-input bg-background px-[var(--space-3,0.75rem)] py-[var(--space-2,0.5rem)] text-sm\",\n\t\t\t\t\t\"transition-all duration-[var(--duration-normal,200ms)] ease-out\",\n\t\t\t\t\t// inset-ring gives a self-borne edge so the input field is visible on flat\n\t\t\t\t\t// surfaces (token border alone is too low-contrast on bg-background=white).\n\t\t\t\t\t\"shadow-sm inset-ring-1 inset-ring-foreground/[0.06]\",\n\t\t\t\t\t\"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground\",\n\t\t\t\t\t\"placeholder:text-muted-foreground\",\n\t\t\t\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t\"focus-visible:shadow-md focus-visible:border-ring/50\",\n\t\t\t\t\t\"hover:border-ring/30 hover:shadow-md\",\n\t\t\t\t\t\"disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nInput.displayName = \"Input\";\n\nexport { Input };\n","\"use client\";\n\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\nconst labelVariants = cva(\n\t\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n);\n\nexport interface LabelProps\n\textends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n\t\tVariantProps<typeof labelVariants> {}\n\nconst Label = React.forwardRef<React.ComponentRef<typeof LabelPrimitive.Root>, LabelProps>(\n\t({ className, ...props }, ref) => (\n\t\t<LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n\t),\n);\nLabel.displayName = \"Label\";\n\nexport { Label };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Alert, AlertDescription, AlertTitle } from \"../../components/alert/alert.js\";\nimport { Empty } from \"../../primitives/empty/empty.js\";\nimport { Button } from \"../../primitives/button/button.js\";\nimport { Input } from \"../../primitives/input/input.js\";\nimport { Label } from \"../../primitives/label/label.js\";\nimport { cn } from \"../../lib/utils.js\";\nimport type { AuthAdapter } from \"../_shared/auth-adapter.js\";\n\nexport interface AuthForgotPasswordProps {\n\tadapter: AuthAdapter;\n\tsignInHref?: string;\n\tclassName?: string;\n\tonSuccess?: () => void;\n}\n\nconst EMAIL_REGEX = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nconst MailIcon = () => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth={2}\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\taria-hidden=\"true\"\n\t>\n\t\t<rect width={20} height={16} x={2} y={4} rx={2} />\n\t\t<path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n\t</svg>\n);\n\n/**\n * \"Forgot password\" page. Single email field; on success swaps to a\n * confirmation state composed from `Empty` (\"we sent you a link\") plus a\n * \"back to sign in\" affordance. Routes the dispatch through\n * `adapter.requestPasswordReset`.\n */\nexport function AuthForgotPassword({\n\tadapter,\n\tsignInHref = \"/sign-in\",\n\tclassName,\n\tonSuccess,\n}: AuthForgotPasswordProps) {\n\tconst [email, setEmail] = React.useState(\"\");\n\tconst [submitting, setSubmitting] = React.useState(false);\n\tconst [error, setError] = React.useState<{ code: string; message: string } | null>(null);\n\tconst [submittedEmail, setSubmittedEmail] = React.useState<string | null>(null);\n\n\tasync function handleSubmit(e: React.FormEvent<HTMLFormElement>) {\n\t\te.preventDefault();\n\t\tif (!EMAIL_REGEX.test(email)) {\n\t\t\tsetError({ code: \"invalid_email\", message: \"Enter a valid email address.\" });\n\t\t\treturn;\n\t\t}\n\t\tif (!adapter.requestPasswordReset) {\n\t\t\tconsole.warn(\n\t\t\t\t\"[AuthForgotPassword] adapter.requestPasswordReset is not implemented — wire it up before exposing the form.\",\n\t\t\t);\n\t\t\tsetError({\n\t\t\t\tcode: \"unimplemented\",\n\t\t\t\tmessage: \"Password reset is currently unavailable. Please try again later.\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tsetError(null);\n\t\tsetSubmitting(true);\n\t\ttry {\n\t\t\tconst result = await adapter.requestPasswordReset({ email });\n\t\t\tif (!result.ok) {\n\t\t\t\tsetError(result.error ?? { code: \"unknown\", message: \"Couldn't send reset link.\" });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetSubmittedEmail(email);\n\t\t\tonSuccess?.();\n\t\t} finally {\n\t\t\tsetSubmitting(false);\n\t\t}\n\t}\n\n\tif (submittedEmail) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex min-h-svh items-center justify-center p-6 sm:p-10\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<div className=\"w-full max-w-sm\">\n\t\t\t\t\t<Empty\n\t\t\t\t\t\ticon={<MailIcon />}\n\t\t\t\t\t\ttitle=\"Check your inbox\"\n\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\tWe sent a password-reset link to{\" \"}\n\t\t\t\t\t\t\t\t<strong className=\"text-foreground\">{submittedEmail}</strong>. The\n\t\t\t\t\t\t\t\tlink expires in 60 minutes.\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\taction={\n\t\t\t\t\t\t\t<Button variant=\"outline\" asChild>\n\t\t\t\t\t\t\t\t<a href={signInHref}>Back to sign in</a>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className={cn(\"flex min-h-svh items-center justify-center p-6 sm:p-10\", className)}>\n\t\t\t<div className=\"w-full max-w-sm space-y-6\">\n\t\t\t\t<header className=\"space-y-2 text-center\">\n\t\t\t\t\t<h1 className=\"text-2xl font-semibold tracking-tight\">Reset your password</h1>\n\t\t\t\t\t<p className=\"text-sm text-muted-foreground\">\n\t\t\t\t\t\tEnter your email and we’ll send you a link to set a new password.\n\t\t\t\t\t</p>\n\t\t\t\t</header>\n\n\t\t\t\t{error ? (\n\t\t\t\t\t<Alert variant=\"destructive\">\n\t\t\t\t\t\t<AlertTitle>Couldn’t send reset link</AlertTitle>\n\t\t\t\t\t\t<AlertDescription>{error.message}</AlertDescription>\n\t\t\t\t\t</Alert>\n\t\t\t\t) : null}\n\n\t\t\t\t<form onSubmit={handleSubmit} className=\"space-y-4\" noValidate>\n\t\t\t\t\t<div className=\"space-y-2\">\n\t\t\t\t\t\t<Label htmlFor=\"auth-forgot-email\">Email</Label>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tid=\"auth-forgot-email\"\n\t\t\t\t\t\t\ttype=\"email\"\n\t\t\t\t\t\t\tautoComplete=\"email\"\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\tvalue={email}\n\t\t\t\t\t\t\tonChange={(e) => setEmail(e.target.value)}\n\t\t\t\t\t\t\tdisabled={submitting}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName=\"w-full\"\n\t\t\t\t\t\tdisabled={submitting}\n\t\t\t\t\t\tloading={submitting}\n\t\t\t\t\t>\n\t\t\t\t\t\t{submitting ? \"Sending link\" : \"Send reset link\"}\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\n\t\t\t\t<p className=\"text-center text-sm text-muted-foreground\">\n\t\t\t\t\tRemembered your password?{\" \"}\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={signInHref}\n\t\t\t\t\t\tclassName=\"font-medium text-foreground underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded\"\n\t\t\t\t\t>\n\t\t\t\t\t\tSign in\n\t\t\t\t\t</a>\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|