asta-ui 0.3.0 → 0.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/accordion.js +1 -1
- package/dist/base/card-checkout.js +1 -1
- package/dist/base/footer-aui-025.d.ts +2 -0
- package/dist/base/footer-aui-025.js +9 -0
- package/dist/base/footer-aui-026.d.ts +2 -0
- package/dist/base/footer-aui-026.js +9 -0
- package/dist/base/footer-aui-027.d.ts +2 -0
- package/dist/base/footer-aui-027.js +9 -0
- package/dist/base/footer-aui-028.d.ts +2 -0
- package/dist/base/footer-aui-028.js +9 -0
- package/dist/base/navbar-aui-009.d.ts +2 -0
- package/dist/base/navbar-aui-009.js +9 -0
- package/dist/base/navbar-aui-010.d.ts +2 -0
- package/dist/base/navbar-aui-010.js +9 -0
- package/dist/base/navbar-aui-011.d.ts +2 -0
- package/dist/base/navbar-aui-011.js +9 -0
- package/dist/base/navbar-aui-012.d.ts +2 -0
- package/dist/base/navbar-aui-012.js +9 -0
- package/dist/base/navbar-aui-013.d.ts +2 -0
- package/dist/base/navbar-aui-013.js +9 -0
- package/dist/base/navbar-aui-014.d.ts +2 -0
- package/dist/base/navbar-aui-014.js +9 -0
- package/dist/base/now-playing.js +1 -1
- package/dist/base/payment-received.js +1 -1
- package/dist/base/pricing-aui-021.d.ts +2 -0
- package/dist/base/pricing-aui-021.js +9 -0
- package/dist/base/pricing-aui-022.d.ts +2 -0
- package/dist/base/pricing-aui-022.js +9 -0
- package/dist/base/pricing-aui-023.d.ts +2 -0
- package/dist/base/pricing-aui-023.js +9 -0
- package/dist/base/pricing-aui-024.d.ts +2 -0
- package/dist/base/pricing-aui-024.js +9 -0
- package/dist/base/sign-in-aui-015.d.ts +2 -0
- package/dist/base/sign-in-aui-015.js +9 -0
- package/dist/base/sign-in-aui-016.d.ts +2 -0
- package/dist/base/sign-in-aui-016.js +9 -0
- package/dist/base/sign-in-aui-017.d.ts +2 -0
- package/dist/base/sign-in-aui-017.js +9 -0
- package/dist/base/sign-in-aui-018.d.ts +2 -0
- package/dist/base/sign-in-aui-018.js +9 -0
- package/dist/base/sign-in-aui-019.d.ts +2 -0
- package/dist/base/sign-in-aui-019.js +9 -0
- package/dist/base/sign-in-aui-020.d.ts +2 -0
- package/dist/base/sign-in-aui-020.js +9 -0
- package/dist/base/spinner.js +1 -1
- package/dist/base.js +124 -4
- package/dist/card-checkout.js +1 -1
- package/dist/chunk-2SQQFICY.js +493 -0
- package/dist/{chunk-QJXPS55V.js → chunk-5TSQZY34.js} +1 -1
- package/dist/chunk-5U4H2CXC.js +308 -0
- package/dist/chunk-5WGDQ62P.js +122 -0
- package/dist/chunk-6B6NTRMC.js +293 -0
- package/dist/chunk-6NNHSXFD.js +539 -0
- package/dist/chunk-746WX2DF.js +480 -0
- package/dist/chunk-7GKCX4IE.js +636 -0
- package/dist/chunk-7SNVRPED.js +223 -0
- package/dist/chunk-BGVAXPHD.js +305 -0
- package/dist/chunk-F526V5BA.js +254 -0
- package/dist/chunk-LPTY5WXM.js +231 -0
- package/dist/chunk-MDI73RL6.js +245 -0
- package/dist/chunk-MUDW65ZT.js +220 -0
- package/dist/chunk-NZRQL3SA.js +201 -0
- package/dist/chunk-OFYGJUKP.js +278 -0
- package/dist/{chunk-NDBLIYMX.js → chunk-OKCSTMX3.js} +2 -2
- package/dist/chunk-P37H477M.js +236 -0
- package/dist/chunk-QSLS3ENY.js +469 -0
- package/dist/chunk-RRHQBGRO.js +327 -0
- package/dist/{chunk-2OGTIQVU.js → chunk-UEOEWP7L.js} +1 -1
- package/dist/{chunk-BP3LXM3X.js → chunk-UTGEGGSE.js} +1 -1
- package/dist/chunk-WNPMHOXE.js +136 -0
- package/dist/chunk-WTNNS7AX.js +362 -0
- package/dist/{chunk-AS6RA64I.js → chunk-XTP6ITUJ.js} +3 -1
- package/dist/footer-aui-025.d.ts +2 -0
- package/dist/footer-aui-025.js +9 -0
- package/dist/footer-aui-026.d.ts +2 -0
- package/dist/footer-aui-026.js +9 -0
- package/dist/footer-aui-027.d.ts +2 -0
- package/dist/footer-aui-027.js +9 -0
- package/dist/footer-aui-028.d.ts +2 -0
- package/dist/footer-aui-028.js +9 -0
- package/dist/index.js +125 -5
- package/dist/navbar-aui-009.d.ts +2 -0
- package/dist/navbar-aui-009.js +9 -0
- package/dist/navbar-aui-010.d.ts +2 -0
- package/dist/navbar-aui-010.js +9 -0
- package/dist/navbar-aui-011.d.ts +2 -0
- package/dist/navbar-aui-011.js +9 -0
- package/dist/navbar-aui-012.d.ts +2 -0
- package/dist/navbar-aui-012.js +9 -0
- package/dist/navbar-aui-013.d.ts +2 -0
- package/dist/navbar-aui-013.js +9 -0
- package/dist/navbar-aui-014.d.ts +2 -0
- package/dist/navbar-aui-014.js +9 -0
- package/dist/now-playing.js +1 -1
- package/dist/payment-received.js +1 -1
- package/dist/pricing-aui-021.d.ts +2 -0
- package/dist/pricing-aui-021.js +9 -0
- package/dist/pricing-aui-022.d.ts +2 -0
- package/dist/pricing-aui-022.js +9 -0
- package/dist/pricing-aui-023.d.ts +2 -0
- package/dist/pricing-aui-023.js +9 -0
- package/dist/pricing-aui-024.d.ts +2 -0
- package/dist/pricing-aui-024.js +9 -0
- package/dist/sign-in-aui-015.d.ts +2 -0
- package/dist/sign-in-aui-015.js +9 -0
- package/dist/sign-in-aui-016.d.ts +2 -0
- package/dist/sign-in-aui-016.js +9 -0
- package/dist/sign-in-aui-017.d.ts +2 -0
- package/dist/sign-in-aui-017.js +9 -0
- package/dist/sign-in-aui-018.d.ts +2 -0
- package/dist/sign-in-aui-018.js +9 -0
- package/dist/sign-in-aui-019.d.ts +2 -0
- package/dist/sign-in-aui-019.js +9 -0
- package/dist/sign-in-aui-020.d.ts +2 -0
- package/dist/sign-in-aui-020.js +9 -0
- package/dist/spinner.js +1 -1
- package/dist/types/components/kit/variants/footer-aui-025.d.ts +22 -0
- package/dist/types/components/kit/variants/footer-aui-026.d.ts +21 -0
- package/dist/types/components/kit/variants/footer-aui-027.d.ts +36 -0
- package/dist/types/components/kit/variants/footer-aui-028.d.ts +34 -0
- package/dist/types/components/kit/variants/navbar-aui-009.d.ts +62 -0
- package/dist/types/components/kit/variants/navbar-aui-010.d.ts +30 -0
- package/dist/types/components/kit/variants/navbar-aui-011.d.ts +65 -0
- package/dist/types/components/kit/variants/navbar-aui-012.d.ts +50 -0
- package/dist/types/components/kit/variants/navbar-aui-013.d.ts +70 -0
- package/dist/types/components/kit/variants/navbar-aui-014.d.ts +31 -0
- package/dist/types/components/kit/variants/pricing-aui-021.d.ts +30 -0
- package/dist/types/components/kit/variants/pricing-aui-022.d.ts +34 -0
- package/dist/types/components/kit/variants/pricing-aui-023.d.ts +26 -0
- package/dist/types/components/kit/variants/pricing-aui-024.d.ts +29 -0
- package/dist/types/components/kit/variants/sign-in-aui-015.d.ts +21 -0
- package/dist/types/components/kit/variants/sign-in-aui-016.d.ts +28 -0
- package/dist/types/components/kit/variants/sign-in-aui-017.d.ts +21 -0
- package/dist/types/components/kit/variants/sign-in-aui-018.d.ts +22 -0
- package/dist/types/components/kit/variants/sign-in-aui-019.d.ts +22 -0
- package/dist/types/components/kit/variants/sign-in-aui-020.d.ts +27 -0
- package/dist/types/packages/asta-ui/src/base/footer-aui-025.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/footer-aui-026.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/footer-aui-027.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/footer-aui-028.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/navbar-aui-009.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/navbar-aui-010.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/navbar-aui-011.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/navbar-aui-012.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/navbar-aui-013.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/navbar-aui-014.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/pricing-aui-021.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/pricing-aui-022.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/pricing-aui-023.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/pricing-aui-024.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/sign-in-aui-015.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/sign-in-aui-016.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/sign-in-aui-017.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/sign-in-aui-018.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/sign-in-aui-019.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/sign-in-aui-020.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base.d.ts +40 -0
- package/dist/types/packages/asta-ui/src/footer-aui-025.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/footer-aui-026.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/footer-aui-027.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/footer-aui-028.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/index.d.ts +40 -0
- package/dist/types/packages/asta-ui/src/navbar-aui-009.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/navbar-aui-010.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/navbar-aui-011.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/navbar-aui-012.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/navbar-aui-013.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/navbar-aui-014.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/pricing-aui-021.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/pricing-aui-022.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/pricing-aui-023.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/pricing-aui-024.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/sign-in-aui-015.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/sign-in-aui-016.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/sign-in-aui-017.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/sign-in-aui-018.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/sign-in-aui-019.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/sign-in-aui-020.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/variants/sign-in-aui-020.tsx
|
|
4
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
8
|
+
var RING = "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_12%,transparent)]";
|
|
9
|
+
var CARD = "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),0_1px_2px_rgb(0_0_0/0.04),0_18px_40px_-20px_rgb(0_0_0/0.25)]";
|
|
10
|
+
var FOCUS = "focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2 focus-visible:ring-offset-paper";
|
|
11
|
+
var LINE = 16;
|
|
12
|
+
var CSS = `
|
|
13
|
+
@keyframes aui020-rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
|
|
14
|
+
@keyframes aui020-in { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }
|
|
15
|
+
@keyframes aui020-letter { from { opacity: 0; transform: translateY(6px) scale(.8) } to { opacity: 1; transform: none } }
|
|
16
|
+
@keyframes aui020-pop { from { opacity: 0; transform: scale(.6) } 70% { transform: scale(1.06) } to { opacity: 1; transform: none } }
|
|
17
|
+
@keyframes aui020-draw { from { stroke-dashoffset: 24 } to { stroke-dashoffset: 0 } }
|
|
18
|
+
@media (prefers-reduced-motion: reduce) { .aui020 * { animation: none !important; transition: none !important } }
|
|
19
|
+
`;
|
|
20
|
+
var rise = (i) => ({ animation: `aui020-rise .6s ${EASE} ${100 + i * 55}ms both` });
|
|
21
|
+
var validEmail = (v) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(v.trim());
|
|
22
|
+
var wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
23
|
+
var Spinner = () => /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-r-transparent" });
|
|
24
|
+
var RULES = [
|
|
25
|
+
{ label: "8+ characters", test: (p) => p.length >= 8 },
|
|
26
|
+
{ label: "Upper and lower case", test: (p) => /[a-z]/.test(p) && /[A-Z]/.test(p) },
|
|
27
|
+
{ label: "A number", test: (p) => /\d/.test(p) },
|
|
28
|
+
{ label: "A symbol", test: (p) => /[^A-Za-z0-9]/.test(p) }
|
|
29
|
+
];
|
|
30
|
+
var LEVELS = ["Too weak", "Weak", "Fair", "Good", "Strong"];
|
|
31
|
+
function useShake(active, key) {
|
|
32
|
+
const ref = useRef(null);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!active || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
35
|
+
ref.current?.animate(
|
|
36
|
+
[{ transform: "none" }, { transform: "translateX(-6px)" }, { transform: "translateX(5px)" }, { transform: "translateX(-3px)" }, { transform: "translateX(2px)" }, { transform: "none" }],
|
|
37
|
+
{ duration: 420, easing: EASE }
|
|
38
|
+
);
|
|
39
|
+
}, [active, key]);
|
|
40
|
+
return ref;
|
|
41
|
+
}
|
|
42
|
+
var ErrorText = ({ id, children }) => /* @__PURE__ */ jsxs("p", { id, role: "alert", className: "flex items-center gap-1.5 text-[12.5px] text-ink", style: { animation: `aui020-in .3s ${EASE} both` }, children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5 shrink-0", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
44
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6.25" }),
|
|
45
|
+
/* @__PURE__ */ jsx("path", { d: "M8 4.8v3.6M8 11h.01" })
|
|
46
|
+
] }),
|
|
47
|
+
children
|
|
48
|
+
] });
|
|
49
|
+
function Field({ label, type, value, onChange, onBlur, error, shake, autoComplete, placeholder, describedBy, start, end, children }) {
|
|
50
|
+
const id = useId();
|
|
51
|
+
const box = useShake(!!error, shake);
|
|
52
|
+
const described = [error ? `${id}-err` : "", describedBy ?? ""].filter(Boolean).join(" ") || void 0;
|
|
53
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
54
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "text-[13px] font-medium text-ink", children: label }),
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { ref: box, className: "relative", children: [
|
|
56
|
+
start && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-y-0 left-1.5 flex items-center", children: start }),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
"input",
|
|
59
|
+
{
|
|
60
|
+
id,
|
|
61
|
+
type,
|
|
62
|
+
value,
|
|
63
|
+
autoComplete,
|
|
64
|
+
placeholder,
|
|
65
|
+
onChange: (e) => onChange(e.target.value),
|
|
66
|
+
onBlur,
|
|
67
|
+
"aria-invalid": !!error || void 0,
|
|
68
|
+
"aria-describedby": described,
|
|
69
|
+
className: cx(
|
|
70
|
+
"h-11 w-full rounded-[9px] bg-paper px-3.5 text-[14.5px] text-ink outline-none transition-shadow duration-200 placeholder:text-mute focus-visible:shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)]",
|
|
71
|
+
!!start && "pl-11",
|
|
72
|
+
!!end && "pr-11",
|
|
73
|
+
error ? "shadow-[inset_0_0_0_1.5px_var(--ink)]" : RING
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
end && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 right-1 flex items-center", children: end })
|
|
78
|
+
] }),
|
|
79
|
+
children,
|
|
80
|
+
error && /* @__PURE__ */ jsx(ErrorText, { id: `${id}-err`, children: error })
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
function LiveAvatar({ name }) {
|
|
84
|
+
const letters = name.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((p) => p[0].toUpperCase());
|
|
85
|
+
return /* @__PURE__ */ jsx(
|
|
86
|
+
"span",
|
|
87
|
+
{
|
|
88
|
+
className: cx(
|
|
89
|
+
"flex h-8 w-8 items-center justify-center rounded-full text-[11.5px] font-semibold transition-colors duration-300",
|
|
90
|
+
letters.length ? "bg-brand text-paper" : "bg-paper-2 text-mute"
|
|
91
|
+
),
|
|
92
|
+
"aria-hidden": true,
|
|
93
|
+
children: letters.length ? letters.map((l, i) => /* @__PURE__ */ jsx("span", { className: "inline-block", style: { animation: `aui020-letter .35s ${EASE} both` }, children: l }, `${i}-${l}`)) : /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
94
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "5.5", r: "2.5" }),
|
|
95
|
+
/* @__PURE__ */ jsx("path", { d: "M3 13.5c.8-2.3 2.7-3.5 5-3.5s4.2 1.2 5 3.5" })
|
|
96
|
+
] })
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function SignUpCard({
|
|
101
|
+
brand = "Astabyte",
|
|
102
|
+
title = "Create your account",
|
|
103
|
+
subtitle = "14 days free. No card needed.",
|
|
104
|
+
minStrength = 3,
|
|
105
|
+
termsHref = "#",
|
|
106
|
+
defaults,
|
|
107
|
+
onSubmit,
|
|
108
|
+
className
|
|
109
|
+
}) {
|
|
110
|
+
const id = useId();
|
|
111
|
+
const [name, setName] = useState(defaults?.name ?? "");
|
|
112
|
+
const [email, setEmail] = useState(defaults?.email ?? "");
|
|
113
|
+
const [password, setPassword] = useState(defaults?.password ?? "");
|
|
114
|
+
const [terms, setTerms] = useState(false);
|
|
115
|
+
const [reveal, setReveal] = useState(false);
|
|
116
|
+
const [touched, setTouched] = useState({ name: false, email: false, password: false, terms: false });
|
|
117
|
+
const [state, setState] = useState("idle");
|
|
118
|
+
const [formError, setFormError] = useState("");
|
|
119
|
+
const [shake, setShake] = useState(0);
|
|
120
|
+
const alive = useRef(true);
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
alive.current = true;
|
|
123
|
+
return () => {
|
|
124
|
+
alive.current = false;
|
|
125
|
+
};
|
|
126
|
+
}, []);
|
|
127
|
+
const passed = RULES.map((r) => r.test(password));
|
|
128
|
+
const score = passed.filter(Boolean).length;
|
|
129
|
+
const level = password ? score : 0;
|
|
130
|
+
const errors = {
|
|
131
|
+
name: !name.trim() ? "Enter your name." : "",
|
|
132
|
+
email: !email.trim() ? "Enter your email." : !validEmail(email) ? "That doesn't look like an email address." : "",
|
|
133
|
+
password: !password ? "Choose a password." : score < minStrength || !passed[0] ? "Make it a little stronger." : "",
|
|
134
|
+
terms: terms ? "" : "Accept the terms to continue."
|
|
135
|
+
};
|
|
136
|
+
const show = (k) => touched[k] ? errors[k] : "";
|
|
137
|
+
const termsBox = useShake(!!show("terms"), shake);
|
|
138
|
+
const submit = async (e) => {
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
if (state === "loading") return;
|
|
141
|
+
setTouched({ name: true, email: true, password: true, terms: true });
|
|
142
|
+
setFormError("");
|
|
143
|
+
if (errors.name || errors.email || errors.password || errors.terms) {
|
|
144
|
+
setShake((n) => n + 1);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
setState("loading");
|
|
148
|
+
try {
|
|
149
|
+
await (onSubmit ? onSubmit({ name: name.trim(), email: email.trim(), password }) : wait(1300));
|
|
150
|
+
if (alive.current) setState("done");
|
|
151
|
+
} catch (err) {
|
|
152
|
+
if (!alive.current) return;
|
|
153
|
+
setState("idle");
|
|
154
|
+
setFormError(err instanceof Error ? err.message : "Something went wrong. Try again.");
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const reset = () => {
|
|
158
|
+
setName("");
|
|
159
|
+
setEmail("");
|
|
160
|
+
setPassword("");
|
|
161
|
+
setTerms(false);
|
|
162
|
+
setTouched({ name: false, email: false, password: false, terms: false });
|
|
163
|
+
setState("idle");
|
|
164
|
+
};
|
|
165
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("aui020 relative w-full max-w-[420px] overflow-hidden rounded-[14px] bg-paper", CARD, className), children: [
|
|
166
|
+
/* @__PURE__ */ jsx("style", { href: "asta-sign-in-aui-020", precedence: "asta", children: CSS }),
|
|
167
|
+
state === "done" ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-[520px] flex-col items-center justify-center p-7 text-center", role: "status", children: [
|
|
168
|
+
/* @__PURE__ */ jsx("span", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-ink text-paper", style: { animation: `aui020-pop .55s ${EASE} both` }, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-7 w-7", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M5 12.5l4.5 4.5L19 7.5", strokeDasharray: "24", style: { animation: `aui020-draw .5s .2s ${EASE} both` } }) }) }),
|
|
169
|
+
/* @__PURE__ */ jsxs("h3", { className: "mt-5 text-[20px] font-medium tracking-[-0.02em] text-ink", style: rise(1), children: [
|
|
170
|
+
"Welcome to ",
|
|
171
|
+
brand,
|
|
172
|
+
", ",
|
|
173
|
+
name.trim().split(" ")[0]
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-1.5 max-w-[30ch] text-[14px] leading-snug text-mute", style: rise(2), children: [
|
|
176
|
+
"Confirm your email to finish. We sent a link to ",
|
|
177
|
+
/* @__PURE__ */ jsx("span", { className: "break-all text-ink", children: email.trim() }),
|
|
178
|
+
"."
|
|
179
|
+
] }),
|
|
180
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: reset, className: cx("mt-6 h-9 rounded-[8px] px-3.5 text-[13.5px] font-medium text-ink outline-none transition-colors hover:bg-paper-2", RING, FOCUS), style: rise(3), children: "Start over" })
|
|
181
|
+
] }) : /* @__PURE__ */ jsxs("form", { noValidate: true, onSubmit: submit, className: "flex flex-col p-6 sm:p-7", children: [
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
|
|
183
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
184
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[20px] font-medium tracking-[-0.02em] text-ink", style: rise(0), children: title }),
|
|
185
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-[14px] leading-snug text-mute", style: rise(1), children: subtitle })
|
|
186
|
+
] }),
|
|
187
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-[10.5px] uppercase tracking-[0.08em] text-mute", style: rise(0), children: brand })
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-6 flex flex-col gap-4", children: [
|
|
190
|
+
/* @__PURE__ */ jsx("div", { style: rise(2), children: /* @__PURE__ */ jsx(
|
|
191
|
+
Field,
|
|
192
|
+
{
|
|
193
|
+
label: "Full name",
|
|
194
|
+
type: "text",
|
|
195
|
+
autoComplete: "name",
|
|
196
|
+
placeholder: "Maya Lindqvist",
|
|
197
|
+
value: name,
|
|
198
|
+
onChange: setName,
|
|
199
|
+
onBlur: () => name && setTouched((t) => ({ ...t, name: true })),
|
|
200
|
+
error: show("name"),
|
|
201
|
+
shake,
|
|
202
|
+
start: /* @__PURE__ */ jsx(LiveAvatar, { name })
|
|
203
|
+
}
|
|
204
|
+
) }),
|
|
205
|
+
/* @__PURE__ */ jsx("div", { style: rise(3), children: /* @__PURE__ */ jsx(
|
|
206
|
+
Field,
|
|
207
|
+
{
|
|
208
|
+
label: "Work email",
|
|
209
|
+
type: "email",
|
|
210
|
+
autoComplete: "email",
|
|
211
|
+
placeholder: "you@company.com",
|
|
212
|
+
value: email,
|
|
213
|
+
onChange: setEmail,
|
|
214
|
+
onBlur: () => email && setTouched((t) => ({ ...t, email: true })),
|
|
215
|
+
error: show("email"),
|
|
216
|
+
shake
|
|
217
|
+
}
|
|
218
|
+
) }),
|
|
219
|
+
/* @__PURE__ */ jsx("div", { style: rise(4), children: /* @__PURE__ */ jsxs(
|
|
220
|
+
Field,
|
|
221
|
+
{
|
|
222
|
+
label: "Password",
|
|
223
|
+
type: reveal ? "text" : "password",
|
|
224
|
+
autoComplete: "new-password",
|
|
225
|
+
placeholder: "Make it hard to guess",
|
|
226
|
+
value: password,
|
|
227
|
+
onChange: setPassword,
|
|
228
|
+
onBlur: () => password && setTouched((t) => ({ ...t, password: true })),
|
|
229
|
+
error: show("password"),
|
|
230
|
+
shake,
|
|
231
|
+
describedBy: `${id}-rules`,
|
|
232
|
+
end: /* @__PURE__ */ jsx(
|
|
233
|
+
"button",
|
|
234
|
+
{
|
|
235
|
+
type: "button",
|
|
236
|
+
onClick: () => setReveal((v) => !v),
|
|
237
|
+
"aria-label": reveal ? "Hide password" : "Show password",
|
|
238
|
+
"aria-pressed": reveal,
|
|
239
|
+
className: "flex h-9 w-9 items-center justify-center rounded-[8px] text-mute outline-none transition-colors hover:bg-paper-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50",
|
|
240
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
241
|
+
/* @__PURE__ */ jsx("path", { d: "M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8Z" }),
|
|
242
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "2" }),
|
|
243
|
+
!reveal && /* @__PURE__ */ jsx("path", { d: "M2.5 13.5l11-11" })
|
|
244
|
+
] })
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-3", children: [
|
|
249
|
+
/* @__PURE__ */ jsx("div", { className: "grid flex-1 grid-cols-4 gap-1.5", "aria-hidden": true, children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx("span", { className: "relative h-[5px] overflow-hidden rounded-full bg-paper-2", children: /* @__PURE__ */ jsx(
|
|
250
|
+
"span",
|
|
251
|
+
{
|
|
252
|
+
className: cx("absolute inset-0 origin-left rounded-full transition-[transform,opacity,background-color] duration-500", score === 4 ? "bg-brand" : "bg-ink"),
|
|
253
|
+
style: { transform: `scaleX(${i < level ? 1 : 0})`, opacity: i < level ? 1 : 0, transitionTimingFunction: EASE, transitionDelay: `${(i < level ? i : 3 - i) * 50}ms` }
|
|
254
|
+
}
|
|
255
|
+
) }, i)) }),
|
|
256
|
+
/* @__PURE__ */ jsxs("span", { className: "relative w-[64px] overflow-hidden text-right text-[12px] font-medium", style: { height: LINE }, "aria-live": "polite", children: [
|
|
257
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: password ? `Password strength: ${LEVELS[score]}` : "" }),
|
|
258
|
+
/* @__PURE__ */ jsx(
|
|
259
|
+
"span",
|
|
260
|
+
{
|
|
261
|
+
"aria-hidden": true,
|
|
262
|
+
className: cx("absolute inset-x-0 top-0 flex flex-col transition-[transform,opacity] duration-500", password ? "opacity-100" : "opacity-0", score === 4 ? "text-brand" : "text-ink"),
|
|
263
|
+
style: { transform: `translateY(${-level * LINE}px)`, transitionTimingFunction: EASE },
|
|
264
|
+
children: LEVELS.map((l) => /* @__PURE__ */ jsx("span", { className: "block", style: { height: LINE, lineHeight: `${LINE}px` }, children: l }, l))
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
] })
|
|
268
|
+
] }),
|
|
269
|
+
/* @__PURE__ */ jsx("ul", { id: `${id}-rules`, className: "mt-2 grid grid-cols-2 gap-x-3 gap-y-1.5", "aria-label": "Password rules", children: RULES.map((r, i) => /* @__PURE__ */ jsxs("li", { className: cx("flex items-center gap-2 text-[12.5px] transition-colors duration-300", passed[i] ? "text-ink" : "text-mute"), children: [
|
|
270
|
+
/* @__PURE__ */ jsx("span", { className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-full shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_20%,transparent)]", "aria-hidden": true, children: /* @__PURE__ */ jsx(
|
|
271
|
+
"span",
|
|
272
|
+
{
|
|
273
|
+
className: "absolute inset-0 flex items-center justify-center rounded-full bg-ink text-paper transition-[transform,opacity] duration-300",
|
|
274
|
+
style: { transform: `scale(${passed[i] ? 1 : 0.3})`, opacity: passed[i] ? 1 : 0, transitionTimingFunction: EASE },
|
|
275
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", className: "h-2.5 w-2.5", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m3 6.2 2 2L9 4" }) })
|
|
276
|
+
}
|
|
277
|
+
) }),
|
|
278
|
+
r.label,
|
|
279
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: passed[i] ? "(done)" : "(missing)" })
|
|
280
|
+
] }, r.label)) })
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
) })
|
|
284
|
+
] }),
|
|
285
|
+
/* @__PURE__ */ jsxs("div", { ref: termsBox, className: "mt-5", style: rise(5), children: [
|
|
286
|
+
/* @__PURE__ */ jsxs("label", { className: "group flex cursor-pointer items-start gap-2.5 text-[13px] leading-snug text-mute", children: [
|
|
287
|
+
/* @__PURE__ */ jsxs("span", { className: "relative mt-px flex h-[18px] w-[18px] shrink-0", children: [
|
|
288
|
+
/* @__PURE__ */ jsx(
|
|
289
|
+
"input",
|
|
290
|
+
{
|
|
291
|
+
type: "checkbox",
|
|
292
|
+
checked: terms,
|
|
293
|
+
onChange: (e) => setTerms(e.target.checked),
|
|
294
|
+
"aria-invalid": !!show("terms") || void 0,
|
|
295
|
+
"aria-describedby": show("terms") ? `${id}-terms-err` : void 0,
|
|
296
|
+
className: cx(
|
|
297
|
+
"peer h-[18px] w-[18px] cursor-pointer appearance-none rounded-[5px] bg-paper outline-none transition-[background-color,box-shadow,transform] duration-200 checked:bg-ink active:scale-90 focus-visible:ring-2 focus-visible:ring-brand/50",
|
|
298
|
+
show("terms") ? "shadow-[inset_0_0_0_1.5px_var(--ink)]" : "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_28%,transparent)] group-hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_50%,transparent)]"
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/* @__PURE__ */ jsx(
|
|
303
|
+
"svg",
|
|
304
|
+
{
|
|
305
|
+
viewBox: "0 0 12 12",
|
|
306
|
+
className: "pointer-events-none absolute inset-0 m-auto h-3 w-3 scale-50 text-paper opacity-0 transition-[transform,opacity] duration-300 peer-checked:scale-100 peer-checked:opacity-100",
|
|
307
|
+
style: { transitionTimingFunction: EASE },
|
|
308
|
+
fill: "none",
|
|
309
|
+
stroke: "currentColor",
|
|
310
|
+
strokeWidth: "2",
|
|
311
|
+
strokeLinecap: "round",
|
|
312
|
+
strokeLinejoin: "round",
|
|
313
|
+
"aria-hidden": true,
|
|
314
|
+
children: /* @__PURE__ */ jsx("path", { d: "m3 6.2 2 2L9 4" })
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
] }),
|
|
318
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
319
|
+
"I agree to the",
|
|
320
|
+
" ",
|
|
321
|
+
/* @__PURE__ */ jsx("a", { href: termsHref, onClick: (e) => termsHref === "#" && e.preventDefault(), className: "rounded font-medium text-ink outline-none hover:underline focus-visible:ring-2 focus-visible:ring-brand/50", children: "Terms" }),
|
|
322
|
+
" ",
|
|
323
|
+
"and",
|
|
324
|
+
" ",
|
|
325
|
+
/* @__PURE__ */ jsx("a", { href: termsHref, onClick: (e) => termsHref === "#" && e.preventDefault(), className: "rounded font-medium text-ink outline-none hover:underline focus-visible:ring-2 focus-visible:ring-brand/50", children: "Privacy Policy" }),
|
|
326
|
+
"."
|
|
327
|
+
] })
|
|
328
|
+
] }),
|
|
329
|
+
show("terms") && /* @__PURE__ */ jsx("div", { className: "mt-1.5 pl-[28px]", children: /* @__PURE__ */ jsx(ErrorText, { id: `${id}-terms-err`, children: show("terms") }) })
|
|
330
|
+
] }),
|
|
331
|
+
formError && /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(ErrorText, { id: `${id}-form-err`, children: formError }) }),
|
|
332
|
+
/* @__PURE__ */ jsx("div", { style: rise(6), children: /* @__PURE__ */ jsxs(
|
|
333
|
+
"button",
|
|
334
|
+
{
|
|
335
|
+
type: "submit",
|
|
336
|
+
disabled: state === "loading",
|
|
337
|
+
"aria-busy": state === "loading" || void 0,
|
|
338
|
+
className: cx(
|
|
339
|
+
"group mt-5 inline-flex h-11 w-full items-center justify-center gap-2 rounded-[9px] bg-ink px-4 text-[14px] font-medium text-paper outline-none transition-transform duration-200 active:scale-[.985] disabled:cursor-progress",
|
|
340
|
+
FOCUS
|
|
341
|
+
),
|
|
342
|
+
children: [
|
|
343
|
+
state === "loading" && /* @__PURE__ */ jsx(Spinner, {}),
|
|
344
|
+
state === "loading" ? "Creating your account" : "Create account",
|
|
345
|
+
state !== "loading" && /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5 transition-transform duration-300 group-hover:translate-x-0.5", style: { transitionTimingFunction: EASE }, fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M3 8h10M9 4l4 4-4 4" }) })
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
) }),
|
|
349
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-4 text-center text-[13px] text-mute", style: rise(7), children: [
|
|
350
|
+
"Already have an account?",
|
|
351
|
+
" ",
|
|
352
|
+
/* @__PURE__ */ jsx("a", { href: "#", onClick: (e) => e.preventDefault(), className: "rounded font-medium text-brand outline-none hover:underline focus-visible:ring-2 focus-visible:ring-brand/50", children: "Sign in" })
|
|
353
|
+
] })
|
|
354
|
+
] })
|
|
355
|
+
] });
|
|
356
|
+
}
|
|
357
|
+
var sign_in_aui_020_default = SignUpCard;
|
|
358
|
+
|
|
359
|
+
export {
|
|
360
|
+
SignUpCard,
|
|
361
|
+
sign_in_aui_020_default
|
|
362
|
+
};
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
import { Accordion as A } from "radix-ui";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
-
var KEYFRAMES =
|
|
7
|
+
var KEYFRAMES = `/* perf-ok */
|
|
8
|
+
@keyframes kit-acc-down { from { height: 0; opacity: 0 } to { height: var(--radix-accordion-content-height); opacity: 1 } }
|
|
9
|
+
/* perf-ok */
|
|
8
10
|
@keyframes kit-acc-up { from { height: var(--radix-accordion-content-height); opacity: 1 } to { height: 0; opacity: 0 } }`;
|
|
9
11
|
function Accordion({ items, type = "single", defaultOpen = [], className }) {
|
|
10
12
|
const body = items.map((it) => /* @__PURE__ */ jsxs(
|