@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.
Files changed (158) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +855 -18
  2. package/dist/accordion.js.map +1 -1
  3. package/dist/alert-dialog.js.map +1 -1
  4. package/dist/alert.js.map +1 -1
  5. package/dist/arc.js.map +1 -1
  6. package/dist/attachment.js.map +1 -1
  7. package/dist/audio-player.js.map +1 -1
  8. package/dist/audio-waveform.js.map +1 -1
  9. package/dist/auth-forgot-password.d.ts +2 -0
  10. package/dist/auth-forgot-password.js +400 -0
  11. package/dist/auth-forgot-password.js.map +1 -0
  12. package/dist/auth-reset-password.d.ts +2 -0
  13. package/dist/auth-reset-password.js +323 -0
  14. package/dist/auth-reset-password.js.map +1 -0
  15. package/dist/auth-sign-in-split.d.ts +3 -0
  16. package/dist/auth-sign-in-split.js +443 -0
  17. package/dist/auth-sign-in-split.js.map +1 -0
  18. package/dist/auth-sign-up-card.d.ts +3 -0
  19. package/dist/auth-sign-up-card.js +590 -0
  20. package/dist/auth-sign-up-card.js.map +1 -0
  21. package/dist/auth-verify-email.d.ts +2 -0
  22. package/dist/auth-verify-email.js +339 -0
  23. package/dist/auth-verify-email.js.map +1 -0
  24. package/dist/auth-verify-otp.d.ts +2 -0
  25. package/dist/auth-verify-otp.js +349 -0
  26. package/dist/auth-verify-otp.js.map +1 -0
  27. package/dist/avatar.js.map +1 -1
  28. package/dist/badge.js.map +1 -1
  29. package/dist/branch.d.ts +2 -0
  30. package/dist/branch.js +136 -0
  31. package/dist/branch.js.map +1 -0
  32. package/dist/breadcrumb.js.map +1 -1
  33. package/dist/button.js.map +1 -1
  34. package/dist/calendar.js.map +1 -1
  35. package/dist/canvas.js.map +1 -1
  36. package/dist/card.js.map +1 -1
  37. package/dist/chain-of-thought.d.ts +3 -0
  38. package/dist/chain-of-thought.js +119 -0
  39. package/dist/chain-of-thought.js.map +1 -0
  40. package/dist/checkbox.js.map +1 -1
  41. package/dist/chord.js.map +1 -1
  42. package/dist/citation.js.map +1 -1
  43. package/dist/cloze.js.map +1 -1
  44. package/dist/cluster.js.map +1 -1
  45. package/dist/code-block-copy.js.map +1 -1
  46. package/dist/code-block.js.map +1 -1
  47. package/dist/color-picker.js.map +1 -1
  48. package/dist/combobox.js.map +1 -1
  49. package/dist/command.js.map +1 -1
  50. package/dist/compare-table.js.map +1 -1
  51. package/dist/composer.js.map +1 -1
  52. package/dist/container.js.map +1 -1
  53. package/dist/context-menu.js.map +1 -1
  54. package/dist/conversation.d.ts +3 -0
  55. package/dist/conversation.js +358 -0
  56. package/dist/conversation.js.map +1 -0
  57. package/dist/data-table.js.map +1 -1
  58. package/dist/date-picker.js.map +1 -1
  59. package/dist/deck.js.map +1 -1
  60. package/dist/dendrogram.js.map +1 -1
  61. package/dist/diagram.js.map +1 -1
  62. package/dist/dialog.js.map +1 -1
  63. package/dist/drawer.js.map +1 -1
  64. package/dist/dropdown-menu.js.map +1 -1
  65. package/dist/dropzone.js.map +1 -1
  66. package/dist/empty.js.map +1 -1
  67. package/dist/error-state.js.map +1 -1
  68. package/dist/file-tree.js.map +1 -1
  69. package/dist/flashcard.js.map +1 -1
  70. package/dist/flowchart.js.map +1 -1
  71. package/dist/form.js.map +1 -1
  72. package/dist/funnel.js.map +1 -1
  73. package/dist/gantt.js.map +1 -1
  74. package/dist/grid.js.map +1 -1
  75. package/dist/hover-card.js.map +1 -1
  76. package/dist/image-occlusion.js.map +1 -1
  77. package/dist/index.d.ts +40 -0
  78. package/dist/index.js +4839 -2813
  79. package/dist/index.js.map +1 -1
  80. package/dist/inline-citation.d.ts +2 -0
  81. package/dist/inline-citation.js +108 -0
  82. package/dist/inline-citation.js.map +1 -0
  83. package/dist/input-otp.js.map +1 -1
  84. package/dist/input.js.map +1 -1
  85. package/dist/label.js.map +1 -1
  86. package/dist/loading-indicator.js.map +1 -1
  87. package/dist/loading.js.map +1 -1
  88. package/dist/markdown.d.ts +1 -0
  89. package/dist/markdown.js +784 -4
  90. package/dist/markdown.js.map +1 -1
  91. package/dist/matrix.js.map +1 -1
  92. package/dist/menubar.js.map +1 -1
  93. package/dist/message-actions.js.map +1 -1
  94. package/dist/message-list.js.map +1 -1
  95. package/dist/message.js.map +1 -1
  96. package/dist/mind-map.js.map +1 -1
  97. package/dist/multi-combobox.js.map +1 -1
  98. package/dist/navigation-menu.js.map +1 -1
  99. package/dist/org-chart.js.map +1 -1
  100. package/dist/pagination.js.map +1 -1
  101. package/dist/plan.d.ts +3 -0
  102. package/dist/plan.js +183 -0
  103. package/dist/plan.js.map +1 -0
  104. package/dist/popover.js.map +1 -1
  105. package/dist/progress.js.map +1 -1
  106. package/dist/pyramid.js.map +1 -1
  107. package/dist/quiz.js.map +1 -1
  108. package/dist/radio-group.js.map +1 -1
  109. package/dist/reasoning.js.map +1 -1
  110. package/dist/resizable.js.map +1 -1
  111. package/dist/sankey.js.map +1 -1
  112. package/dist/schemas.d.ts +8 -0
  113. package/dist/schemas.js +774 -17
  114. package/dist/schemas.js.map +1 -1
  115. package/dist/scroll-area.js.map +1 -1
  116. package/dist/select.js.map +1 -1
  117. package/dist/separator.js.map +1 -1
  118. package/dist/sequence.js.map +1 -1
  119. package/dist/sheet.js.map +1 -1
  120. package/dist/shimmer.d.ts +2 -0
  121. package/dist/shimmer.js +39 -0
  122. package/dist/shimmer.js.map +1 -0
  123. package/dist/sidebar.js.map +1 -1
  124. package/dist/skeleton.js.map +1 -1
  125. package/dist/slider.js.map +1 -1
  126. package/dist/sources.d.ts +3 -0
  127. package/dist/sources.js +164 -0
  128. package/dist/sources.js.map +1 -0
  129. package/dist/spaced-repetition.js.map +1 -1
  130. package/dist/spacer.js.map +1 -1
  131. package/dist/speech-recognition.js.map +1 -1
  132. package/dist/stack.js.map +1 -1
  133. package/dist/stepper.js.map +1 -1
  134. package/dist/suggestion.js.map +1 -1
  135. package/dist/sunburst.js.map +1 -1
  136. package/dist/switch.js.map +1 -1
  137. package/dist/table.js.map +1 -1
  138. package/dist/tabs.js.map +1 -1
  139. package/dist/tag.js.map +1 -1
  140. package/dist/task.d.ts +3 -0
  141. package/dist/task.js +189 -0
  142. package/dist/task.js.map +1 -0
  143. package/dist/terminal.js +11 -0
  144. package/dist/terminal.js.map +1 -1
  145. package/dist/textarea.js.map +1 -1
  146. package/dist/time-axis.js.map +1 -1
  147. package/dist/time-picker.js.map +1 -1
  148. package/dist/timeline.js.map +1 -1
  149. package/dist/toggle-group.js.map +1 -1
  150. package/dist/toggle.js.map +1 -1
  151. package/dist/tool-call.js +5 -6
  152. package/dist/tool-call.js.map +1 -1
  153. package/dist/toolbar.js.map +1 -1
  154. package/dist/tooltip.js.map +1 -1
  155. package/dist/tree-map.js.map +1 -1
  156. package/dist/tree.js.map +1 -1
  157. package/dist/venn.js.map +1 -1
  158. package/package.json +9 -4
@@ -0,0 +1,590 @@
1
+ "use client";
2
+ import * as React8 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 CheckboxPrimitive from '@radix-ui/react-checkbox';
9
+ import * as LabelPrimitive from '@radix-ui/react-label';
10
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
11
+
12
+ function cn(...inputs) {
13
+ return twMerge(clsx(inputs));
14
+ }
15
+ var alertVariants = cva(
16
+ [
17
+ "relative w-full rounded-lg border px-[var(--space-4,1rem)] py-[var(--space-3,0.75rem)] text-sm",
18
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
19
+ "[&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:text-foreground",
20
+ "[&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px]"
21
+ ].join(" "),
22
+ {
23
+ variants: {
24
+ variant: {
25
+ default: "border-foreground/[0.08] bg-background text-foreground",
26
+ destructive: "border-destructive/50 text-destructive [&>svg]:text-destructive bg-destructive/5"
27
+ }
28
+ },
29
+ defaultVariants: { variant: "default" }
30
+ }
31
+ );
32
+ var Alert = React8.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
33
+ "div",
34
+ {
35
+ ref,
36
+ role: "alert",
37
+ className: cn(alertVariants({ variant }), className),
38
+ ...props
39
+ }
40
+ ));
41
+ Alert.displayName = "Alert";
42
+ var AlertTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43
+ "h5",
44
+ {
45
+ ref,
46
+ className: cn("mb-[var(--space-1,0.25rem)] font-medium leading-none tracking-tight", className),
47
+ ...props
48
+ }
49
+ ));
50
+ AlertTitle.displayName = "AlertTitle";
51
+ var AlertDescription = React8.forwardRef(
52
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("text-sm [&_p]:leading-relaxed", className), ...props })
53
+ );
54
+ AlertDescription.displayName = "AlertDescription";
55
+ var Card = React8.forwardRef(
56
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
57
+ "div",
58
+ {
59
+ ref,
60
+ className: cn(
61
+ "rounded-lg border border-foreground/[0.08] bg-card text-card-foreground",
62
+ "shadow-sm transition-all duration-[var(--duration-normal,200ms)] ease-out",
63
+ "hover:shadow-md",
64
+ className
65
+ ),
66
+ ...props
67
+ }
68
+ )
69
+ );
70
+ Card.displayName = "Card";
71
+ var CardHeader = React8.forwardRef(
72
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
73
+ "div",
74
+ {
75
+ ref,
76
+ className: cn("flex flex-col space-y-1.5 p-[var(--space-6,1.5rem)]", className),
77
+ ...props
78
+ }
79
+ )
80
+ );
81
+ CardHeader.displayName = "CardHeader";
82
+ var CardTitle = React8.forwardRef(
83
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
84
+ "h3",
85
+ {
86
+ ref,
87
+ className: cn("text-2xl font-semibold leading-none tracking-tight", className),
88
+ ...props
89
+ }
90
+ )
91
+ );
92
+ CardTitle.displayName = "CardTitle";
93
+ var CardDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
94
+ CardDescription.displayName = "CardDescription";
95
+ var CardContent = React8.forwardRef(
96
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-[var(--space-6,1.5rem)] pt-0", className), ...props })
97
+ );
98
+ CardContent.displayName = "CardContent";
99
+ var CardFooter = React8.forwardRef(
100
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
101
+ "div",
102
+ {
103
+ ref,
104
+ className: cn("flex items-center p-[var(--space-6,1.5rem)] pt-0", className),
105
+ ...props
106
+ }
107
+ )
108
+ );
109
+ CardFooter.displayName = "CardFooter";
110
+ var buttonVariants = cva(
111
+ [
112
+ "inline-flex items-center justify-center gap-[var(--gap-sm,0.5rem)] whitespace-nowrap rounded-md text-sm font-medium",
113
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
114
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
115
+ "disabled:pointer-events-none disabled:opacity-50",
116
+ "active:scale-[0.98]",
117
+ "[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"
118
+ ].join(" "),
119
+ {
120
+ variants: {
121
+ variant: {
122
+ default: [
123
+ "bg-primary text-primary-foreground",
124
+ "shadow-sm shadow-primary/20",
125
+ "hover:bg-primary/90 hover:shadow-md hover:shadow-primary/25"
126
+ ].join(" "),
127
+ destructive: [
128
+ "bg-destructive text-destructive-foreground",
129
+ "shadow-sm shadow-destructive/20",
130
+ "hover:bg-destructive/90 hover:shadow-md hover:shadow-destructive/25"
131
+ ].join(" "),
132
+ outline: [
133
+ "border border-input bg-background",
134
+ "shadow-sm inset-ring-1 inset-ring-foreground/[0.06]",
135
+ "hover:bg-accent hover:text-accent-foreground hover:shadow-md hover:inset-ring-foreground/12"
136
+ ].join(" "),
137
+ secondary: [
138
+ "bg-secondary text-secondary-foreground",
139
+ "shadow-sm inset-ring-1 inset-ring-foreground/[0.08]",
140
+ "hover:bg-secondary/80 hover:shadow-md hover:inset-ring-foreground/15"
141
+ ].join(" "),
142
+ ghost: "hover:bg-accent hover:text-accent-foreground",
143
+ link: "text-primary underline-offset-4 hover:underline"
144
+ },
145
+ size: {
146
+ default: "h-[var(--control-height-md,2.5rem)] px-[var(--space-4,1rem)] py-[var(--space-2,0.5rem)]",
147
+ sm: "h-[var(--control-height-sm,2.25rem)] rounded-md px-[var(--space-3,0.75rem)]",
148
+ lg: "h-[var(--control-height-lg,2.75rem)] rounded-md px-[var(--space-8,2rem)] text-base",
149
+ icon: "h-[var(--control-height-md,2.5rem)] w-[var(--control-height-md,2.5rem)]"
150
+ }
151
+ },
152
+ defaultVariants: {
153
+ variant: "default",
154
+ size: "default"
155
+ }
156
+ }
157
+ );
158
+ var Button = React8.forwardRef(
159
+ ({ className, variant, size, asChild = false, loading = false, children, disabled, ...props }, ref) => {
160
+ const Comp = asChild ? Slot : "button";
161
+ return /* @__PURE__ */ jsx(
162
+ Comp,
163
+ {
164
+ className: cn(buttonVariants({ variant, size, className })),
165
+ ref,
166
+ disabled: disabled || loading,
167
+ "aria-busy": loading || void 0,
168
+ ...props,
169
+ children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
170
+ /* @__PURE__ */ jsxs(
171
+ "svg",
172
+ {
173
+ className: "animate-spin h-4 w-4",
174
+ xmlns: "http://www.w3.org/2000/svg",
175
+ fill: "none",
176
+ viewBox: "0 0 24 24",
177
+ "aria-hidden": "true",
178
+ children: [
179
+ /* @__PURE__ */ jsx(
180
+ "circle",
181
+ {
182
+ className: "opacity-25",
183
+ cx: "12",
184
+ cy: "12",
185
+ r: "10",
186
+ stroke: "currentColor",
187
+ strokeWidth: "4"
188
+ }
189
+ ),
190
+ /* @__PURE__ */ jsx(
191
+ "path",
192
+ {
193
+ className: "opacity-75",
194
+ fill: "currentColor",
195
+ 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"
196
+ }
197
+ )
198
+ ]
199
+ }
200
+ ),
201
+ children
202
+ ] }) : children
203
+ }
204
+ );
205
+ }
206
+ );
207
+ Button.displayName = "Button";
208
+ var Checkbox = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
209
+ CheckboxPrimitive.Root,
210
+ {
211
+ ref,
212
+ className: cn(
213
+ "group h-4 w-4 shrink-0 rounded-sm border border-input",
214
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
215
+ "shadow-sm inset-ring-1 inset-ring-foreground/[0.06]",
216
+ "hover:border-ring/50 hover:shadow-md",
217
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
218
+ "disabled:cursor-not-allowed disabled:opacity-50",
219
+ "data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground",
220
+ "data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground",
221
+ className
222
+ ),
223
+ ...props,
224
+ children: /* @__PURE__ */ jsxs(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: [
225
+ /* @__PURE__ */ jsx(
226
+ "svg",
227
+ {
228
+ xmlns: "http://www.w3.org/2000/svg",
229
+ viewBox: "0 0 24 24",
230
+ fill: "none",
231
+ stroke: "currentColor",
232
+ strokeWidth: "3",
233
+ strokeLinecap: "round",
234
+ strokeLinejoin: "round",
235
+ className: "hidden h-3.5 w-3.5 group-data-[state=checked]:block",
236
+ "aria-hidden": "true",
237
+ children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" })
238
+ }
239
+ ),
240
+ /* @__PURE__ */ jsx(
241
+ "svg",
242
+ {
243
+ xmlns: "http://www.w3.org/2000/svg",
244
+ viewBox: "0 0 24 24",
245
+ fill: "none",
246
+ stroke: "currentColor",
247
+ strokeWidth: "3",
248
+ strokeLinecap: "round",
249
+ strokeLinejoin: "round",
250
+ className: "hidden h-3.5 w-3.5 group-data-[state=indeterminate]:block",
251
+ "aria-hidden": "true",
252
+ children: /* @__PURE__ */ jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
253
+ }
254
+ )
255
+ ] })
256
+ }
257
+ ));
258
+ Checkbox.displayName = "Checkbox";
259
+ var Input = React8.forwardRef(
260
+ ({ className, type, ...props }, ref) => {
261
+ return /* @__PURE__ */ jsx(
262
+ "input",
263
+ {
264
+ type,
265
+ className: cn(
266
+ "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",
267
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
268
+ // inset-ring gives a self-borne edge so the input field is visible on flat
269
+ // surfaces (token border alone is too low-contrast on bg-background=white).
270
+ "shadow-sm inset-ring-1 inset-ring-foreground/[0.06]",
271
+ "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
272
+ "placeholder:text-muted-foreground",
273
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
274
+ "focus-visible:shadow-md focus-visible:border-ring/50",
275
+ "hover:border-ring/30 hover:shadow-md",
276
+ "disabled:cursor-not-allowed disabled:opacity-50",
277
+ className
278
+ ),
279
+ ref,
280
+ ...props
281
+ }
282
+ );
283
+ }
284
+ );
285
+ Input.displayName = "Input";
286
+ var labelVariants = cva(
287
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
288
+ );
289
+ var Label = React8.forwardRef(
290
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props })
291
+ );
292
+ Label.displayName = "Label";
293
+ var Separator = React8.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
294
+ SeparatorPrimitive.Root,
295
+ {
296
+ ref,
297
+ decorative,
298
+ orientation,
299
+ className: cn(
300
+ "shrink-0 bg-foreground/[0.12]",
301
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
302
+ className
303
+ ),
304
+ ...props
305
+ }
306
+ ));
307
+ Separator.displayName = "Separator";
308
+ var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
309
+ function AuthSignUpCard({
310
+ adapter,
311
+ socialProviders,
312
+ signInHref = "/sign-in",
313
+ termsHref = "/terms",
314
+ privacyHref = "/privacy",
315
+ passwordMinLength = 8,
316
+ className,
317
+ onSuccess
318
+ }) {
319
+ const [name, setName] = React8.useState("");
320
+ const [email, setEmail] = React8.useState("");
321
+ const [password, setPassword] = React8.useState("");
322
+ const [confirmPassword, setConfirmPassword] = React8.useState("");
323
+ const [acceptTerms, setAcceptTerms] = React8.useState(false);
324
+ const [submitting, setSubmitting] = React8.useState(null);
325
+ const [error, setError] = React8.useState(null);
326
+ const isBusy = submitting !== null;
327
+ function validate() {
328
+ if (!EMAIL_REGEX.test(email)) {
329
+ return { code: "invalid_email", message: "Enter a valid email address." };
330
+ }
331
+ if (password.length < passwordMinLength) {
332
+ return {
333
+ code: "password_too_short",
334
+ message: `Password must be at least ${passwordMinLength} characters.`
335
+ };
336
+ }
337
+ if (password !== confirmPassword) {
338
+ return { code: "password_mismatch", message: "Passwords don't match." };
339
+ }
340
+ if (!acceptTerms) {
341
+ return {
342
+ code: "terms_required",
343
+ message: "Please accept the terms of service to continue."
344
+ };
345
+ }
346
+ return null;
347
+ }
348
+ async function handleSubmit(e) {
349
+ e.preventDefault();
350
+ const validation = validate();
351
+ if (validation) {
352
+ setError(validation);
353
+ return;
354
+ }
355
+ if (!adapter.signUpWithPassword) {
356
+ console.warn(
357
+ "[AuthSignUpCard] adapter.signUpWithPassword is not implemented \u2014 wire it up before exposing the form."
358
+ );
359
+ setError({
360
+ code: "unimplemented",
361
+ message: "Sign-up is currently unavailable. Please try again later."
362
+ });
363
+ return;
364
+ }
365
+ setError(null);
366
+ setSubmitting("password");
367
+ try {
368
+ const result = await adapter.signUpWithPassword({
369
+ email,
370
+ password,
371
+ name: name.trim().length > 0 ? name.trim() : void 0
372
+ });
373
+ if (!result.ok) {
374
+ setError(result.error ?? { code: "unknown", message: "Sign-up failed." });
375
+ return;
376
+ }
377
+ onSuccess?.(result.redirect);
378
+ } finally {
379
+ setSubmitting(null);
380
+ }
381
+ }
382
+ async function handleSocial(provider) {
383
+ if (!adapter.signInWithSocial) {
384
+ console.warn(
385
+ `[AuthSignUpCard] adapter.signInWithSocial is not implemented but a ${provider} button is rendered \u2014 drop the entry from socialProviders or wire the method.`
386
+ );
387
+ setError({
388
+ code: "unimplemented",
389
+ message: "This sign-up option is currently unavailable. Please try a different method."
390
+ });
391
+ return;
392
+ }
393
+ setError(null);
394
+ setSubmitting(provider);
395
+ try {
396
+ const result = await adapter.signInWithSocial({ provider });
397
+ if (!result.ok) {
398
+ setError(result.error ?? { code: "social-failed", message: "Sign-up failed." });
399
+ return;
400
+ }
401
+ onSuccess?.(result.redirect);
402
+ } finally {
403
+ setSubmitting(null);
404
+ }
405
+ }
406
+ return /* @__PURE__ */ jsx("div", { className: cn("flex min-h-svh items-center justify-center p-6 sm:p-10", className), children: /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md", children: [
407
+ /* @__PURE__ */ jsxs(CardHeader, { className: "space-y-2 text-center", children: [
408
+ /* @__PURE__ */ jsx(CardTitle, { className: "text-2xl", children: "Create your account" }),
409
+ /* @__PURE__ */ jsx(CardDescription, { children: "Get started in seconds \u2014 no credit card required." })
410
+ ] }),
411
+ /* @__PURE__ */ jsxs(CardContent, { className: "space-y-6", children: [
412
+ error ? /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
413
+ /* @__PURE__ */ jsx(AlertTitle, { children: "Couldn\u2019t create account" }),
414
+ /* @__PURE__ */ jsx(AlertDescription, { children: error.message })
415
+ ] }) : null,
416
+ socialProviders && socialProviders.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
417
+ /* @__PURE__ */ jsx("div", { className: "grid gap-2", children: socialProviders.map((p) => /* @__PURE__ */ jsxs(
418
+ Button,
419
+ {
420
+ type: "button",
421
+ variant: "outline",
422
+ onClick: () => handleSocial(p.provider),
423
+ disabled: isBusy,
424
+ loading: submitting === p.provider,
425
+ className: "w-full justify-center gap-2",
426
+ children: [
427
+ p.icon,
428
+ /* @__PURE__ */ jsxs("span", { children: [
429
+ "Continue with ",
430
+ p.label
431
+ ] })
432
+ ]
433
+ },
434
+ p.provider
435
+ )) }),
436
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
437
+ /* @__PURE__ */ jsx(Separator, {}),
438
+ /* @__PURE__ */ jsx("span", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-card px-2 text-xs uppercase text-muted-foreground", children: "or sign up with email" })
439
+ ] })
440
+ ] }) : null,
441
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", noValidate: true, children: [
442
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
443
+ /* @__PURE__ */ jsxs(Label, { htmlFor: "auth-sign-up-name", children: [
444
+ "Full name ",
445
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "(optional)" })
446
+ ] }),
447
+ /* @__PURE__ */ jsx(
448
+ Input,
449
+ {
450
+ id: "auth-sign-up-name",
451
+ type: "text",
452
+ autoComplete: "name",
453
+ value: name,
454
+ onChange: (e) => setName(e.target.value),
455
+ disabled: isBusy
456
+ }
457
+ )
458
+ ] }),
459
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
460
+ /* @__PURE__ */ jsx(Label, { htmlFor: "auth-sign-up-email", children: "Email" }),
461
+ /* @__PURE__ */ jsx(
462
+ Input,
463
+ {
464
+ id: "auth-sign-up-email",
465
+ type: "email",
466
+ autoComplete: "email",
467
+ required: true,
468
+ value: email,
469
+ onChange: (e) => setEmail(e.target.value),
470
+ disabled: isBusy
471
+ }
472
+ )
473
+ ] }),
474
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
475
+ /* @__PURE__ */ jsx(Label, { htmlFor: "auth-sign-up-password", children: "Password" }),
476
+ /* @__PURE__ */ jsx(
477
+ Input,
478
+ {
479
+ id: "auth-sign-up-password",
480
+ type: "password",
481
+ autoComplete: "new-password",
482
+ required: true,
483
+ minLength: passwordMinLength,
484
+ value: password,
485
+ onChange: (e) => setPassword(e.target.value),
486
+ disabled: isBusy,
487
+ "aria-describedby": "auth-sign-up-password-hint"
488
+ }
489
+ ),
490
+ /* @__PURE__ */ jsxs(
491
+ "p",
492
+ {
493
+ id: "auth-sign-up-password-hint",
494
+ className: "text-xs text-muted-foreground",
495
+ children: [
496
+ "At least ",
497
+ passwordMinLength,
498
+ " characters."
499
+ ]
500
+ }
501
+ )
502
+ ] }),
503
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
504
+ /* @__PURE__ */ jsx(Label, { htmlFor: "auth-sign-up-confirm", children: "Confirm password" }),
505
+ /* @__PURE__ */ jsx(
506
+ Input,
507
+ {
508
+ id: "auth-sign-up-confirm",
509
+ type: "password",
510
+ autoComplete: "new-password",
511
+ required: true,
512
+ value: confirmPassword,
513
+ onChange: (e) => setConfirmPassword(e.target.value),
514
+ disabled: isBusy
515
+ }
516
+ )
517
+ ] }),
518
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
519
+ /* @__PURE__ */ jsx(
520
+ Checkbox,
521
+ {
522
+ id: "auth-sign-up-terms",
523
+ checked: acceptTerms,
524
+ onCheckedChange: (v) => setAcceptTerms(v === true),
525
+ disabled: isBusy,
526
+ className: "mt-0.5"
527
+ }
528
+ ),
529
+ /* @__PURE__ */ jsxs(
530
+ Label,
531
+ {
532
+ htmlFor: "auth-sign-up-terms",
533
+ className: "text-sm font-normal leading-snug",
534
+ children: [
535
+ "I agree to the",
536
+ " ",
537
+ /* @__PURE__ */ jsx(
538
+ "a",
539
+ {
540
+ href: termsHref,
541
+ 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",
542
+ children: "Terms of Service"
543
+ }
544
+ ),
545
+ " ",
546
+ "and",
547
+ " ",
548
+ /* @__PURE__ */ jsx(
549
+ "a",
550
+ {
551
+ href: privacyHref,
552
+ 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",
553
+ children: "Privacy Policy"
554
+ }
555
+ ),
556
+ "."
557
+ ]
558
+ }
559
+ )
560
+ ] }),
561
+ /* @__PURE__ */ jsx(
562
+ Button,
563
+ {
564
+ type: "submit",
565
+ className: "w-full",
566
+ disabled: isBusy,
567
+ loading: submitting === "password",
568
+ children: submitting === "password" ? "Creating account" : "Create account"
569
+ }
570
+ )
571
+ ] })
572
+ ] }),
573
+ /* @__PURE__ */ jsxs(CardFooter, { className: "justify-center text-sm text-muted-foreground", children: [
574
+ "Already have an account?",
575
+ " ",
576
+ /* @__PURE__ */ jsx(
577
+ "a",
578
+ {
579
+ href: signInHref,
580
+ className: "ml-1 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",
581
+ children: "Sign in"
582
+ }
583
+ )
584
+ ] })
585
+ ] }) });
586
+ }
587
+
588
+ export { AuthSignUpCard };
589
+ //# sourceMappingURL=auth-sign-up-card.js.map
590
+ //# sourceMappingURL=auth-sign-up-card.js.map