@jcsoftdev/ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +1 -1
  3. package/dist/atoms/button/button.d.ts +8 -1
  4. package/dist/atoms/button/button.js +10 -3
  5. package/dist/atoms/divider/divider.d.ts +15 -0
  6. package/dist/atoms/divider/divider.js +27 -0
  7. package/dist/atoms/divider/index.d.ts +1 -0
  8. package/dist/atoms/divider/index.js +1 -0
  9. package/dist/atoms/icon-button/icon-button.d.ts +1 -1
  10. package/dist/atoms/index.d.ts +1 -0
  11. package/dist/atoms/index.js +1 -0
  12. package/dist/auth/auth-illustration/auth-illustration.d.ts +35 -0
  13. package/dist/auth/auth-illustration/auth-illustration.js +72 -0
  14. package/dist/auth/auth-illustration/index.d.ts +3 -0
  15. package/dist/auth/auth-illustration/index.js +11 -0
  16. package/dist/auth/auth-illustration/look.d.ts +30 -0
  17. package/dist/auth/auth-illustration/look.js +0 -0
  18. package/dist/auth/auth-illustration/model.d.ts +133 -0
  19. package/dist/auth/auth-illustration/model.js +202 -0
  20. package/dist/auth/auth-illustration/use-art-pointer.d.ts +9 -0
  21. package/dist/auth/auth-illustration/use-art-pointer.js +69 -0
  22. package/dist/auth/auth-layout/auth-layout.d.ts +80 -0
  23. package/dist/auth/auth-layout/auth-layout.js +190 -0
  24. package/dist/auth/auth-layout/index.d.ts +1 -0
  25. package/dist/auth/auth-layout/index.js +1 -0
  26. package/dist/auth/character/character.d.ts +12 -0
  27. package/dist/auth/character/character.js +333 -0
  28. package/dist/auth/character/index.d.ts +1 -0
  29. package/dist/auth/character/index.js +1 -0
  30. package/dist/auth/index.d.ts +4 -0
  31. package/dist/auth/index.js +4 -0
  32. package/dist/auth/internal/auth-context.d.ts +17 -0
  33. package/dist/auth/internal/auth-context.js +10 -0
  34. package/dist/auth/internal/auth-styles.d.ts +1 -0
  35. package/dist/auth/internal/auth-styles.js +29 -0
  36. package/dist/auth/internal/portal-glyphs.d.ts +6 -0
  37. package/dist/auth/internal/portal-glyphs.js +39 -0
  38. package/dist/auth/login-form/context.d.ts +51 -0
  39. package/dist/auth/login-form/context.js +12 -0
  40. package/dist/auth/login-form/index.d.ts +2 -0
  41. package/dist/auth/login-form/index.js +23 -0
  42. package/dist/auth/login-form/login-form.d.ts +66 -0
  43. package/dist/auth/login-form/login-form.js +233 -0
  44. package/dist/auth/login-form/parts.d.ts +71 -0
  45. package/dist/auth/login-form/parts.js +371 -0
  46. package/dist/auth/looks/auth-illustration-any.d.ts +16 -0
  47. package/dist/auth/looks/auth-illustration-any.js +24 -0
  48. package/dist/auth/looks/index.d.ts +1 -0
  49. package/dist/auth/looks/index.js +1 -0
  50. package/dist/auth/mosaic/index.d.ts +1 -0
  51. package/dist/auth/mosaic/index.js +1 -0
  52. package/dist/auth/mosaic/mosaic.d.ts +11 -0
  53. package/dist/auth/mosaic/mosaic.js +195 -0
  54. package/dist/auth/slabs/index.d.ts +1 -0
  55. package/dist/auth/slabs/index.js +1 -0
  56. package/dist/auth/slabs/slabs.d.ts +13 -0
  57. package/dist/auth/slabs/slabs.js +136 -0
  58. package/dist/auth/stack/index.d.ts +1 -0
  59. package/dist/auth/stack/index.js +1 -0
  60. package/dist/auth/stack/stack.d.ts +6 -0
  61. package/dist/auth/stack/stack.js +222 -0
  62. package/dist/auth/statement/index.d.ts +1 -0
  63. package/dist/auth/statement/index.js +1 -0
  64. package/dist/auth/statement/statement.d.ts +13 -0
  65. package/dist/auth/statement/statement.js +99 -0
  66. package/dist/forms/index.d.ts +1 -0
  67. package/dist/forms/index.js +1 -0
  68. package/dist/forms/input/input.js +2 -1
  69. package/dist/forms/password-input/index.d.ts +1 -0
  70. package/dist/forms/password-input/index.js +1 -0
  71. package/dist/forms/password-input/password-input.d.ts +16 -0
  72. package/dist/forms/password-input/password-input.js +45 -0
  73. package/dist/i18n/strings.d.ts +64 -0
  74. package/dist/i18n/strings.js +34 -2
  75. package/dist/icons/eye.d.ts +2 -0
  76. package/dist/icons/eye.js +11 -0
  77. package/dist/icons/graduation-cap.d.ts +2 -0
  78. package/dist/icons/graduation-cap.js +12 -0
  79. package/dist/icons/house.d.ts +2 -0
  80. package/dist/icons/house.js +11 -0
  81. package/dist/icons/index.d.ts +4 -0
  82. package/dist/icons/index.js +8 -0
  83. package/dist/icons/mail.d.ts +2 -0
  84. package/dist/icons/mail.js +11 -0
  85. package/icons/svg/eye.svg +4 -0
  86. package/icons/svg/graduation-cap.svg +5 -0
  87. package/icons/svg/house.svg +4 -0
  88. package/icons/svg/mail.svg +4 -0
  89. package/package.json +2 -2
  90. package/src/atoms/button/button.tsx +25 -3
  91. package/src/atoms/divider/divider.tsx +40 -0
  92. package/src/atoms/divider/index.ts +1 -0
  93. package/src/atoms/icon-button/icon-button.tsx +1 -1
  94. package/src/atoms/index.ts +1 -0
  95. package/src/auth/auth-illustration/auth-illustration.tsx +100 -0
  96. package/src/auth/auth-illustration/index.ts +8 -0
  97. package/src/auth/auth-illustration/look.ts +32 -0
  98. package/src/auth/auth-illustration/model.ts +330 -0
  99. package/src/auth/auth-illustration/use-art-pointer.ts +78 -0
  100. package/src/auth/auth-layout/auth-layout.tsx +282 -0
  101. package/src/auth/auth-layout/index.ts +1 -0
  102. package/src/auth/character/character.tsx +346 -0
  103. package/src/auth/character/index.ts +1 -0
  104. package/src/auth/index.ts +4 -0
  105. package/src/auth/internal/auth-context.ts +26 -0
  106. package/src/auth/internal/auth-styles.tsx +39 -0
  107. package/src/auth/internal/portal-glyphs.tsx +32 -0
  108. package/src/auth/login-form/context.ts +78 -0
  109. package/src/auth/login-form/index.ts +21 -0
  110. package/src/auth/login-form/login-form.tsx +330 -0
  111. package/src/auth/login-form/parts.tsx +457 -0
  112. package/src/auth/looks/auth-illustration-any.tsx +38 -0
  113. package/src/auth/looks/index.ts +1 -0
  114. package/src/auth/mosaic/index.ts +1 -0
  115. package/src/auth/mosaic/mosaic.tsx +255 -0
  116. package/src/auth/slabs/index.ts +1 -0
  117. package/src/auth/slabs/slabs.tsx +181 -0
  118. package/src/auth/stack/index.ts +1 -0
  119. package/src/auth/stack/stack.tsx +267 -0
  120. package/src/auth/statement/index.ts +1 -0
  121. package/src/auth/statement/statement.tsx +122 -0
  122. package/src/forms/index.ts +1 -0
  123. package/src/forms/input/input.tsx +2 -0
  124. package/src/forms/password-input/index.ts +1 -0
  125. package/src/forms/password-input/password-input.tsx +57 -0
  126. package/src/i18n/strings.ts +64 -0
  127. package/src/icons/eye.tsx +12 -0
  128. package/src/icons/graduation-cap.tsx +13 -0
  129. package/src/icons/house.tsx +12 -0
  130. package/src/icons/index.ts +4 -0
  131. package/src/icons/mail.tsx +12 -0
@@ -0,0 +1,333 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { BOARD_LIGHTS, boardLit, keystroke } from "../auth-illustration/model.js";
4
+ import { PORTAL_GLYPHS } from "../internal/portal-glyphs.js";
5
+ const CSS = `
6
+ @keyframes ui-chr-bob{50%{transform:translateY(-12px)}}
7
+ @keyframes ui-chr-pulse{50%{transform:scale(.8);opacity:.6}}
8
+ @keyframes ui-chr-blink{0%,93%,100%{transform:scaleY(0)}96%{transform:scaleY(1)}}
9
+ @keyframes ui-chr-nod-0{40%{transform:rotate(-5deg) translateY(2px)}}
10
+ @keyframes ui-chr-nod-1{40%{transform:rotate(5deg) translateY(2px)}}
11
+ @keyframes ui-chr-shake{15%,55%{transform:translateX(-7px) rotate(-4deg)}35%,75%{transform:translateX(7px) rotate(4deg)}}
12
+ @keyframes ui-chr-hop{0%{transform:translateY(0)}18%{transform:translateY(8px) scaleY(.94)}48%{transform:translateY(-58px)}74%{transform:translateY(4px)}100%{transform:translateY(0)}}
13
+ @keyframes ui-chr-hop-shadow{48%{transform:scale(.55);opacity:.35}}
14
+ @keyframes ui-chr-boost{0%,12%{opacity:0;transform:scaleY(.2)}30%{opacity:1;transform:scaleY(1.25)}62%{opacity:1;transform:scaleY(.9)}100%{opacity:0;transform:scaleY(.3)}}
15
+ @keyframes ui-chr-flicker{50%{transform:scaleY(.7)}}
16
+ @keyframes ui-chr-drift{50%{transform:translate(10px,-8px)}}
17
+ @keyframes ui-chr-in{from{opacity:0;transform:translateY(36px) scale(.92)}}
18
+ .ui-chr{--side:1;--line:color-mix(in srgb,black 80%,var(--accent));--skin:color-mix(in srgb,white 90%,var(--accent));--hoodie:var(--accent);--pack:color-mix(in srgb,var(--ink) 22%,color-mix(in srgb,black 62%,var(--accent)));--hair:color-mix(in srgb,var(--ink) 22%,color-mix(in srgb,black 72%,var(--accent)));--pants:color-mix(in srgb,black 45%,var(--accent));--deck:color-mix(in srgb,var(--ink) 22%,color-mix(in srgb,black 70%,var(--accent)));--lamp:color-mix(in srgb,white 30%,var(--accent-2));--lamp-off:color-mix(in srgb,white 18%,var(--deck));--blush:color-mix(in srgb,var(--danger) 30%,white);--flame:var(--accent-2);--decor:color-mix(in srgb,var(--accent) 45%,transparent);overflow:visible}
19
+ .ui-auth-art[data-panel=solid] .ui-chr{--hoodie:color-mix(in srgb,var(--auth-art-ink) 34%,var(--auth-art-bg));--decor:color-mix(in srgb,var(--auth-art-ink) 18%,transparent);--flame:var(--ua-tint)}
20
+ :where([data-layout=split-reverse]) .ui-chr{--side:-1}
21
+ .ui-chr-line{stroke:var(--line);stroke-width:3;stroke-linejoin:round;stroke-linecap:round}
22
+ .ui-chr-fill-skin{fill:var(--skin)}.ui-chr-fill-hoodie{fill:var(--hoodie)}.ui-chr-fill-pack{fill:var(--pack)}.ui-chr-fill-hair{fill:var(--hair)}.ui-chr-fill-pants{fill:var(--pants)}.ui-chr-fill-deck{fill:var(--deck)}.ui-chr-fill-line{fill:var(--line)}
23
+ .ui-chr-dots{fill:color-mix(in srgb,black 30%,transparent)}
24
+ .ui-chr-shine{fill:white;opacity:.7}
25
+ .ui-chr-blush{fill:var(--blush);opacity:.75}
26
+ .ui-chr-in{animation:ui-chr-in .9s var(--ua-land) backwards .1s}
27
+ .ui-chr-shadow{fill:var(--ua-shadow);transform-box:fill-box;transform-origin:center;animation:ui-chr-pulse 3.2s ease-in-out infinite}
28
+ .ui-chr-bob{animation:ui-chr-bob 3.2s ease-in-out infinite}
29
+ .ui-chr-par{transform:translate(calc(var(--px,0) * 6px),calc(var(--py,0) * 3px));transition:transform .6s var(--ua-glide)}
30
+ .ui-chr-hop,.ui-chr-head,.ui-chr-nod,.ui-chr-turn,.ui-chr-arm,.ui-chr-brow,.ui-chr-flame,.ui-chr-lid{transform-box:view-box}
31
+ .ui-chr-head,.ui-chr-nod{transform-origin:200px 200px}
32
+ .ui-chr-turn{transition:transform .45s var(--ua-bounce)}
33
+ .ui-chr-nod-0{animation:ui-chr-nod-0 .34s var(--ua-glide)}
34
+ .ui-chr-nod-1{animation:ui-chr-nod-1 .34s var(--ua-glide)}
35
+ .ui-chr-eyes{transform:translate(calc(var(--ex,var(--px,0)) * 6px),calc(var(--ey,var(--py,0)) * 4px));transition:transform .3s var(--ua-glide)}
36
+ .ui-auth-art[data-state=typing] .ui-chr-eyes{--ex:calc(var(--side) * 1.1);--ey:.9}
37
+ .ui-auth-art[data-state=password] .ui-chr-turn{transform:translateX(calc(var(--side) * -6px)) rotate(calc(var(--side) * -6deg))}
38
+ .ui-chr-lid{transform-box:fill-box;transform-origin:50% 0;transform:scaleY(0);animation:ui-chr-blink 4.6s infinite}
39
+ .ui-chr-lid rect{fill:var(--skin)}
40
+ .ui-auth-art[data-state=password] .ui-chr-lid{animation:none;transform:scaleY(1);transition:transform .18s ease-out}
41
+ .ui-chr-brow{transition:transform .35s var(--ua-bounce)}
42
+ .ui-auth-art[data-state=error] .ui-chr-brow-l{transform:translateY(3px) rotate(16deg);transform-box:fill-box;transform-origin:center}
43
+ .ui-auth-art[data-state=error] .ui-chr-brow-r{transform:translateY(3px) rotate(-16deg);transform-box:fill-box;transform-origin:center}
44
+ .ui-auth-art[data-state=success] .ui-chr-brow{transform:translateY(-4px)}
45
+ .ui-chr-mouth{opacity:0;transition:opacity .2s linear}
46
+ .ui-auth-art:is([data-state=idle],[data-state=typing]) .ui-chr-mouth-smile,.ui-auth-art[data-state=password] .ui-chr-mouth-hush,.ui-auth-art[data-state=error] .ui-chr-mouth-wobble,.ui-auth-art[data-state=success] .ui-chr-mouth-grin{opacity:1}
47
+ .ui-chr-sweat{fill:color-mix(in srgb,white 55%,var(--accent-2));opacity:0;transform:translateY(-6px);transition:opacity .2s linear,transform .5s var(--ua-glide)}
48
+ .ui-auth-art[data-state=error] .ui-chr-sweat{opacity:1;transform:none}
49
+ .ui-chr-arm{transition:transform .5s var(--ua-bounce)}
50
+ .ui-chr-arm-l{transform-origin:158px 214px}.ui-chr-arm-r{transform-origin:242px 214px}
51
+ .ui-auth-art[data-state=password] .ui-chr-arm-l{transform:rotate(-170deg)}
52
+ .ui-auth-art[data-state=password] .ui-chr-arm-r{transform:rotate(170deg)}
53
+ .ui-auth-art[data-state=success] .ui-chr-arm-l{transform:rotate(138deg)}
54
+ .ui-auth-art[data-state=success] .ui-chr-arm-r{transform:rotate(-138deg)}
55
+ .ui-auth-art[data-state=error] .ui-chr-arm-l{transform:rotate(-18deg)}
56
+ .ui-auth-art[data-state=error] .ui-chr-arm-r{transform:rotate(18deg)}
57
+ .ui-auth-art[data-state=error] .ui-chr-head{animation:ui-chr-shake .6s var(--ua-glide)}
58
+ .ui-auth-art[data-state=success] .ui-chr-hop{animation:ui-chr-hop 1s var(--ua-glide) .1s}
59
+ .ui-auth-art[data-state=success] .ui-chr-shadow-hop{animation:ui-chr-hop-shadow 1s var(--ua-glide) .1s;transform-box:fill-box;transform-origin:center}
60
+ .ui-chr-lamp{fill:var(--lamp-off);transition:opacity .3s linear}
61
+ .ui-chr-lamp-on{fill:var(--lamp);opacity:var(--on);transition:opacity .3s linear;transition-delay:calc(var(--i) * 60ms)}
62
+ .ui-auth-art[data-state=error] .ui-chr-lamp-on{fill:var(--danger)}
63
+ .ui-chr-flame{fill:var(--flame);transform-box:fill-box;transform-origin:50% 0;opacity:0}
64
+ .ui-chr-flame-idle{opacity:.55;animation:ui-chr-flicker .5s ease-in-out infinite;transform:scaleY(.55)}
65
+ .ui-auth-art[data-state=success] .ui-chr-flame-boost{animation:ui-chr-boost 1.1s var(--ua-glide) .1s}
66
+ .ui-chr-decor{display:none;fill:var(--decor)}
67
+ .ui-chr-drift{transform-box:fill-box;animation:ui-chr-drift 7s ease-in-out infinite;animation-delay:calc(var(--i) * -2.3s)}
68
+ @container art (min-width:24rem){.ui-chr-decor{display:inline}}
69
+ .ui-auth-art[data-state=success] .ui-auth-spark{animation-delay:.45s}
70
+ @media (prefers-reduced-motion:reduce){
71
+ .ui-chr *,.ui-auth-art[data-state] .ui-chr *{animation:none!important;transition:none!important}
72
+ .ui-chr-par,.ui-chr-eyes{transform:none}
73
+ .ui-chr-flame-idle{transform:scaleY(.55)}
74
+ }
75
+ `;
76
+ const LAMPS = Array.from({ length: BOARD_LIGHTS }, (_, i) => 132 + i * 30);
77
+ const SPARKS = [
78
+ { dx: "-70px", dy: "-60px", star: true },
79
+ { dx: "60px", dy: "-80px", star: false },
80
+ { dx: "86px", dy: "-20px", star: true },
81
+ { dx: "-90px", dy: "-10px", star: false },
82
+ { dx: "10px", dy: "-104px", star: true }
83
+ ];
84
+ function Arm({ side }) {
85
+ const d = side === "l" ? "M158 216 Q142 244 148 268" : "M242 216 Q258 244 252 268";
86
+ const hand = side === "l" ? { cx: 148, cy: 272 } : { cx: 252, cy: 272 };
87
+ return /* @__PURE__ */ jsxs("g", { className: `ui-chr-arm ui-chr-arm-${side}`, children: [
88
+ /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: "var(--line)", strokeWidth: "25", strokeLinecap: "round" }),
89
+ /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: "var(--hoodie)", strokeWidth: "19", strokeLinecap: "round" }),
90
+ /* @__PURE__ */ jsx("circle", { className: "ui-chr-fill-skin ui-chr-line", cx: hand.cx, cy: hand.cy, r: "10.5" })
91
+ ] });
92
+ }
93
+ function Character({ state, progress, activeIndex, uid }) {
94
+ const dots = `url(#${uid}-chr-dots)`;
95
+ const tick = keystroke(progress);
96
+ const nod = tick.count > 0 ? `ui-chr-nod ui-chr-nod-${tick.phase}` : "ui-chr-nod";
97
+ const lit = boardLit(state, progress);
98
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
99
+ /* @__PURE__ */ jsx("style", { href: "jcsoftdev-ui-auth-character", precedence: "default", children: CSS }),
100
+ /* @__PURE__ */ jsxs("svg", { viewBox: "40 8 320 432", focusable: "false", className: "ui-chr", children: [
101
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", { id: `${uid}-chr-dots`, width: "5", height: "5", patternUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx("circle", { className: "ui-chr-dots", cx: "2.5", cy: "2.5", r: "1" }) }) }),
102
+ /* @__PURE__ */ jsx("g", { className: "ui-chr-decor", children: [
103
+ { x: 84, y: 130, s: 1.2 },
104
+ { x: 312, y: 104, s: 0.8 },
105
+ { x: 318, y: 290, s: 1 },
106
+ { x: 76, y: 300, s: 0.7 }
107
+ ].map((star, i) => /* @__PURE__ */ jsx("g", { transform: `translate(${star.x} ${star.y}) scale(${star.s})`, children: /* @__PURE__ */ jsx(
108
+ "path",
109
+ {
110
+ className: "ui-chr-drift",
111
+ style: { "--i": i },
112
+ d: "M0 -14 Q2 -2 14 0 Q2 2 0 14 Q-2 2 -14 0 Q-2 -2 0 -14 Z"
113
+ }
114
+ ) }, star.x)) }),
115
+ /* @__PURE__ */ jsxs("g", { className: "ui-chr-in", children: [
116
+ /* @__PURE__ */ jsx("g", { className: "ui-chr-shadow-hop", children: /* @__PURE__ */ jsx("ellipse", { className: "ui-chr-shadow", cx: "200", cy: "414", rx: "92", ry: "11" }) }),
117
+ /* @__PURE__ */ jsx("g", { className: "ui-chr-par", children: /* @__PURE__ */ jsx("g", { className: "ui-chr-hop", children: /* @__PURE__ */ jsxs("g", { className: "ui-chr-bob", children: [
118
+ [150, 250].map((x) => /* @__PURE__ */ jsxs("g", { children: [
119
+ /* @__PURE__ */ jsx(
120
+ "path",
121
+ {
122
+ className: "ui-chr-flame ui-chr-flame-idle",
123
+ d: `M${x - 8} 360 Q${x} 392 ${x + 8} 360 Z`
124
+ }
125
+ ),
126
+ /* @__PURE__ */ jsx(
127
+ "path",
128
+ {
129
+ className: "ui-chr-flame ui-chr-flame-boost",
130
+ d: `M${x - 11} 360 Q${x - 4} 420 ${x} 432 Q${x + 4} 420 ${x + 11} 360 Z`
131
+ }
132
+ ),
133
+ /* @__PURE__ */ jsx(
134
+ "rect",
135
+ {
136
+ className: "ui-chr-fill-deck ui-chr-line",
137
+ x: x - 14,
138
+ y: "344",
139
+ width: "28",
140
+ height: "18",
141
+ rx: "6"
142
+ }
143
+ )
144
+ ] }, x)),
145
+ /* @__PURE__ */ jsx(
146
+ "rect",
147
+ {
148
+ className: "ui-chr-fill-deck ui-chr-line",
149
+ x: "104",
150
+ y: "326",
151
+ width: "192",
152
+ height: "22",
153
+ rx: "11"
154
+ }
155
+ ),
156
+ /* @__PURE__ */ jsx("rect", { x: "104", y: "326", width: "192", height: "22", rx: "11", fill: dots }),
157
+ LAMPS.map((x, i) => /* @__PURE__ */ jsxs("g", { children: [
158
+ /* @__PURE__ */ jsx("rect", { className: "ui-chr-lamp", x, y: "334", width: "16", height: "6", rx: "3" }),
159
+ /* @__PURE__ */ jsx(
160
+ "rect",
161
+ {
162
+ className: "ui-chr-lamp-on",
163
+ style: { "--i": i, "--on": i < lit ? 1 : 0 },
164
+ x,
165
+ y: "334",
166
+ width: "16",
167
+ height: "6",
168
+ rx: "3"
169
+ }
170
+ )
171
+ ] }, x)),
172
+ /* @__PURE__ */ jsx(
173
+ "rect",
174
+ {
175
+ className: "ui-chr-fill-pants ui-chr-line",
176
+ x: "174",
177
+ y: "276",
178
+ width: "22",
179
+ height: "44",
180
+ rx: "8"
181
+ }
182
+ ),
183
+ /* @__PURE__ */ jsx(
184
+ "rect",
185
+ {
186
+ className: "ui-chr-fill-pants ui-chr-line",
187
+ x: "204",
188
+ y: "276",
189
+ width: "22",
190
+ height: "44",
191
+ rx: "8"
192
+ }
193
+ ),
194
+ /* @__PURE__ */ jsx(
195
+ "path",
196
+ {
197
+ className: "ui-chr-fill-skin ui-chr-line",
198
+ d: "M170 314 h28 v9 q0 5 -5 5 h-28 q-6 0 -6 -6 q0 -8 11 -8 Z"
199
+ }
200
+ ),
201
+ /* @__PURE__ */ jsx(
202
+ "path",
203
+ {
204
+ className: "ui-chr-fill-skin ui-chr-line",
205
+ d: "M230 314 h-28 v9 q0 5 5 5 h28 q6 0 6 -6 q0 -8 -11 -8 Z"
206
+ }
207
+ ),
208
+ /* @__PURE__ */ jsx(
209
+ "rect",
210
+ {
211
+ className: "ui-chr-fill-pack ui-chr-line",
212
+ x: "134",
213
+ y: "204",
214
+ width: "132",
215
+ height: "76",
216
+ rx: "24"
217
+ }
218
+ ),
219
+ /* @__PURE__ */ jsx("rect", { x: "134", y: "204", width: "132", height: "76", rx: "24", fill: dots }),
220
+ /* @__PURE__ */ jsx(
221
+ "path",
222
+ {
223
+ className: "ui-chr-fill-hoodie ui-chr-line",
224
+ d: "M160 208 Q200 190 240 208 L252 278 Q200 296 148 278 Z"
225
+ }
226
+ ),
227
+ /* @__PURE__ */ jsx("path", { d: "M226 202 Q244 210 252 278 Q240 284 228 286 Z", fill: dots }),
228
+ /* @__PURE__ */ jsx("path", { className: "ui-chr-line", fill: "none", d: "M170 206 Q166 236 172 270" }),
229
+ /* @__PURE__ */ jsx("path", { className: "ui-chr-line", fill: "none", d: "M230 206 Q234 236 228 270" }),
230
+ /* @__PURE__ */ jsx("circle", { className: "ui-chr-fill-skin ui-chr-line", cx: "200", cy: "246", r: "17" }),
231
+ /* @__PURE__ */ jsx(
232
+ "g",
233
+ {
234
+ transform: "translate(188 234) scale(.24)",
235
+ style: {
236
+ "--glyph-a": "var(--hoodie)",
237
+ "--glyph-b": "var(--line)",
238
+ "--glyph-c": "var(--skin)",
239
+ "--glyph-line": "var(--line)"
240
+ },
241
+ children: PORTAL_GLYPHS[activeIndex] ?? PORTAL_GLYPHS[0]
242
+ }
243
+ ),
244
+ /* @__PURE__ */ jsx("g", { className: "ui-chr-head", children: /* @__PURE__ */ jsx("g", { className: nod, children: /* @__PURE__ */ jsxs("g", { className: "ui-chr-turn", children: [
245
+ /* @__PURE__ */ jsx("circle", { className: "ui-chr-fill-skin ui-chr-line", cx: "200", cy: "148", r: "54" }),
246
+ /* @__PURE__ */ jsx(
247
+ "path",
248
+ {
249
+ className: "ui-chr-fill-hair ui-chr-line",
250
+ d: "M146 146 Q144 92 200 92 Q258 92 254 148 Q240 122 214 120 Q206 132 186 126 Q164 124 146 146 Z"
251
+ }
252
+ ),
253
+ /* @__PURE__ */ jsx("path", { d: "M216 96 Q250 104 254 146 Q242 124 220 120 Z", fill: dots }),
254
+ /* @__PURE__ */ jsx("circle", { className: "ui-chr-blush", cx: "168", cy: "172", r: "9" }),
255
+ /* @__PURE__ */ jsx("circle", { className: "ui-chr-blush", cx: "232", cy: "172", r: "9" }),
256
+ /* @__PURE__ */ jsx("g", { className: "ui-chr-brow ui-chr-brow-l", children: /* @__PURE__ */ jsx("path", { className: "ui-chr-line", fill: "none", d: "M172 136 q10 -6 20 -2" }) }),
257
+ /* @__PURE__ */ jsx("g", { className: "ui-chr-brow ui-chr-brow-r", children: /* @__PURE__ */ jsx("path", { className: "ui-chr-line", fill: "none", d: "M208 134 q10 -4 20 2" }) }),
258
+ /* @__PURE__ */ jsx("g", { className: "ui-chr-eyes", children: [182, 218].map((x) => /* @__PURE__ */ jsxs("g", { children: [
259
+ /* @__PURE__ */ jsx("ellipse", { className: "ui-chr-fill-line", cx: x, cy: "156", rx: "6", ry: "8" }),
260
+ /* @__PURE__ */ jsx("circle", { className: "ui-chr-shine", cx: x + 2, cy: "152", r: "2.2" })
261
+ ] }, x)) }),
262
+ [182, 218].map((x) => /* @__PURE__ */ jsxs("g", { className: "ui-chr-lid", children: [
263
+ /* @__PURE__ */ jsx("rect", { x: x - 9, y: "146", width: "18", height: "18" }),
264
+ /* @__PURE__ */ jsx("path", { className: "ui-chr-line", fill: "none", d: `M${x - 8} 164 q8 5 16 0` })
265
+ ] }, x)),
266
+ /* @__PURE__ */ jsx(
267
+ "path",
268
+ {
269
+ className: "ui-chr-mouth ui-chr-mouth-smile ui-chr-line",
270
+ fill: "none",
271
+ d: "M190 178 q10 8 20 0"
272
+ }
273
+ ),
274
+ /* @__PURE__ */ jsx(
275
+ "path",
276
+ {
277
+ className: "ui-chr-mouth ui-chr-mouth-hush ui-chr-line",
278
+ fill: "none",
279
+ d: "M194 180 h12"
280
+ }
281
+ ),
282
+ /* @__PURE__ */ jsx(
283
+ "path",
284
+ {
285
+ className: "ui-chr-mouth ui-chr-mouth-wobble ui-chr-line",
286
+ fill: "none",
287
+ d: "M188 182 q4 -5 8 0 t8 0 t8 0"
288
+ }
289
+ ),
290
+ /* @__PURE__ */ jsx(
291
+ "path",
292
+ {
293
+ className: "ui-chr-mouth ui-chr-mouth-grin ui-chr-fill-line ui-chr-line",
294
+ d: "M186 174 h28 q0 18 -14 18 q-14 0 -14 -18 Z"
295
+ }
296
+ ),
297
+ /* @__PURE__ */ jsx(
298
+ "path",
299
+ {
300
+ className: "ui-chr-sweat ui-chr-line",
301
+ strokeWidth: "2",
302
+ d: "M246 118 q8 12 0 16 q-8 -4 0 -16 Z"
303
+ }
304
+ )
305
+ ] }) }) }),
306
+ /* @__PURE__ */ jsx(Arm, { side: "l" }),
307
+ /* @__PURE__ */ jsx(Arm, { side: "r" })
308
+ ] }) }) }),
309
+ state === "success" ? /* @__PURE__ */ jsx("g", { transform: "translate(200 210)", children: SPARKS.map((spark) => /* @__PURE__ */ jsx(
310
+ "g",
311
+ {
312
+ className: "ui-auth-spark",
313
+ style: { "--dx": spark.dx, "--dy": spark.dy },
314
+ children: spark.star ? /* @__PURE__ */ jsx(
315
+ "path",
316
+ {
317
+ d: "M0 -9 L2.5 -2.5 L9 0 L2.5 2.5 L0 9 L-2.5 2.5 L-9 0 L-2.5 -2.5 Z",
318
+ fill: "var(--ua-spark-0)",
319
+ stroke: "var(--line)",
320
+ strokeWidth: "1.6"
321
+ }
322
+ ) : /* @__PURE__ */ jsx("circle", { r: "5", fill: "var(--ua-spark-1)", stroke: "var(--line)", strokeWidth: "1.6" })
323
+ },
324
+ `${spark.dx}${spark.dy}`
325
+ )) }) : null
326
+ ] })
327
+ ] })
328
+ ] });
329
+ }
330
+ Character.variant = "character";
331
+ export {
332
+ Character
333
+ };
@@ -0,0 +1 @@
1
+ export * from "./character.js";
@@ -0,0 +1 @@
1
+ export * from "./character.js";
@@ -0,0 +1,4 @@
1
+ export * from "./auth-illustration/index.js";
2
+ export * from "./auth-layout/index.js";
3
+ export * from "./login-form/index.js";
4
+ export * from "./slabs/index.js";
@@ -0,0 +1,4 @@
1
+ export * from "./auth-illustration/index.js";
2
+ export * from "./auth-layout/index.js";
3
+ export * from "./login-form/index.js";
4
+ export * from "./slabs/index.js";
@@ -0,0 +1,17 @@
1
+ import type { AuthState } from "../auth-illustration/model.js";
2
+ export type AuthPanel = "paper" | "solid";
3
+ export interface AuthContextValue {
4
+ /** Composition of the screen: the card over paper, or a solid side panel with an open form. */
5
+ panel: AuthPanel;
6
+ state: AuthState;
7
+ setState: (state: AuthState) => void;
8
+ /** Fill of the whole form, 0 to 1. */
9
+ progress: number;
10
+ setProgress: (progress: number) => void;
11
+ /** Index of the portal the user is signing in through; the illustration lifts it. */
12
+ activeIndex: number;
13
+ setActiveIndex: (index: number) => void;
14
+ }
15
+ export declare const AuthContext: import("react").Context<AuthContextValue | null>;
16
+ /** The state an `AuthLayout` shares with its illustration and form, or `null` outside one. */
17
+ export declare function useOptionalAuth(): AuthContextValue | null;
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { createContext, useContext } from "react";
3
+ const AuthContext = createContext(null);
4
+ function useOptionalAuth() {
5
+ return useContext(AuthContext);
6
+ }
7
+ export {
8
+ AuthContext,
9
+ useOptionalAuth
10
+ };
@@ -0,0 +1 @@
1
+ export declare function AuthStyles(): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ const CSS = `
3
+ @keyframes ui-auth-spark{0%{opacity:0;transform:scale(.3) rotate(0)}12%{opacity:1}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(1.1) rotate(120deg)}}
4
+ @keyframes ui-auth-shake{20%,60%{transform:translateX(-9px)}40%,80%{transform:translateX(9px)}}
5
+ @keyframes ui-auth-rise{from{opacity:0;transform:translateY(18px)}}
6
+ .ui-auth-rise{animation:ui-auth-rise .7s .25s var(--motion-ease,cubic-bezier(.2,.7,.2,1)) backwards}
7
+ .ui-auth-art{--ua-edge:color-mix(in srgb,var(--ink) 88%,var(--surface));--ua-shadow:color-mix(in srgb,black 14%,transparent);--ua-spark-0:var(--accent);--ua-spark-1:var(--accent-2);--ua-spark-2:var(--accent-soft);--ua-spark-3:var(--ink);--ua-bounce:cubic-bezier(.34,1.5,.5,1);--ua-land:cubic-bezier(.2,.9,.25,1.15);--ua-glide:cubic-bezier(.2,.7,.2,1)}
8
+ .ui-auth-art[data-panel=solid]{--ua-edge:var(--auth-art-ink);--ua-tint:color-mix(in srgb,var(--auth-art-bg) 22%,white);--ua-mid:color-mix(in srgb,var(--auth-art-ink) 30%,var(--auth-art-bg));--ua-shadow:color-mix(in srgb,var(--auth-art-ink) 22%,transparent);--ua-spark-0:var(--auth-art-ink);--ua-spark-1:var(--ua-tint);--ua-spark-2:color-mix(in srgb,var(--auth-art-ink) 55%,var(--auth-art-bg));--ua-spark-3:var(--auth-art-ink)}
9
+ .ui-auth-art>svg{display:block;width:100%;height:auto;max-height:var(--auth-art-max-h,none);overflow:visible}
10
+ .ui-auth-art[data-state=error]>svg{animation:ui-auth-shake .5s var(--ua-glide)}
11
+ .ui-auth-g{stroke-width:3;stroke-linejoin:round;stroke:var(--glyph-b)}
12
+ .ui-auth-ga{fill:var(--glyph-a)}
13
+ .ui-auth-gc{fill:var(--glyph-c)}
14
+ .ui-auth-gline{fill:none}
15
+ .ui-auth-spark{fill:var(--ua-spark-0);opacity:0;transform-box:fill-box;transform-origin:center;animation:ui-auth-spark 1s .75s cubic-bezier(.1,.7,.3,1) both}
16
+ .ui-auth-spark[data-tone="1"]{fill:var(--ua-spark-1)}
17
+ .ui-auth-spark[data-tone="2"]{fill:var(--ua-spark-2)}
18
+ .ui-auth-spark[data-tone="3"]{fill:var(--ua-spark-3)}
19
+ @media (prefers-reduced-motion:reduce){
20
+ .ui-auth-rise,.ui-auth-art[data-state=error]>svg{animation:none}
21
+ .ui-auth-spark{animation:none;opacity:1;transform:translate(calc(var(--dx) * .62),calc(var(--dy) * .62))}
22
+ }
23
+ `;
24
+ function AuthStyles() {
25
+ return /* @__PURE__ */ jsx("style", { href: "jcsoftdev-ui-auth-styles", precedence: "default", children: CSS });
26
+ }
27
+ export {
28
+ AuthStyles
29
+ };
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * The three portal glyphs (a book, a house and a graduation cap) on a 100px square. They paint with
4
+ * `--glyph-a` (fill), `--glyph-b` (outline), `--glyph-c` (detail) and `--glyph-line` (accent line).
5
+ */
6
+ export declare const PORTAL_GLYPHS: readonly ReactNode[];
@@ -0,0 +1,39 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ const PORTAL_GLYPHS = [
3
+ /* @__PURE__ */ jsxs("g", { children: [
4
+ /* @__PURE__ */ jsx(
5
+ "path",
6
+ {
7
+ className: "ui-auth-g ui-auth-ga",
8
+ d: "M18 30 Q34 23 50 32 Q66 23 82 30 V74 Q66 67 50 76 Q34 67 18 74Z"
9
+ }
10
+ ),
11
+ /* @__PURE__ */ jsx(
12
+ "path",
13
+ {
14
+ className: "ui-auth-g ui-auth-gline",
15
+ d: "M50 32V76",
16
+ style: { stroke: "var(--glyph-line)" }
17
+ }
18
+ )
19
+ ] }, "book"),
20
+ /* @__PURE__ */ jsxs("g", { children: [
21
+ /* @__PURE__ */ jsx("path", { className: "ui-auth-g ui-auth-ga", d: "M50 20 L84 48 H75 V78 H25 V48 H16Z" }),
22
+ /* @__PURE__ */ jsx("rect", { className: "ui-auth-g ui-auth-gc", x: "42", y: "56", width: "16", height: "22" })
23
+ ] }, "house"),
24
+ /* @__PURE__ */ jsxs("g", { children: [
25
+ /* @__PURE__ */ jsx("path", { className: "ui-auth-g ui-auth-ga", d: "M50 24 L90 44 L50 64 L10 44Z" }),
26
+ /* @__PURE__ */ jsx(
27
+ "path",
28
+ {
29
+ className: "ui-auth-g ui-auth-gline",
30
+ d: "M28 55 V70 Q50 84 72 70 V55",
31
+ style: { stroke: "var(--glyph-line)", strokeWidth: 5 }
32
+ }
33
+ ),
34
+ /* @__PURE__ */ jsx("path", { className: "ui-auth-g ui-auth-gline", d: "M88 46 V72" })
35
+ ] }, "cap")
36
+ ];
37
+ export {
38
+ PORTAL_GLYPHS
39
+ };
@@ -0,0 +1,51 @@
1
+ import { type ReactNode, type RefObject } from "react";
2
+ import type { ClassNames } from "../../utils/class-names.js";
3
+ export interface LoginPortal {
4
+ /** Value reported to `onSubmit` and the form's `portal` field. */
5
+ value: string;
6
+ label: string;
7
+ /** Line under the title while this portal is selected. */
8
+ description?: string;
9
+ /** Label and placeholder of the identifier field while this portal is selected. */
10
+ identifierLabel?: string;
11
+ /** Icon of the tile; the first three portals fall back to a book, a house and a cap. */
12
+ icon?: ReactNode;
13
+ }
14
+ export type LoginFormPart = "root" | "header" | "title" | "description" | "portals" | "portal" | "identifier" | "password" | "error" | "submit" | "options" | "providers" | "footer";
15
+ export type LoginFormAppearance = "card" | "open";
16
+ export type LoginField = "identifier" | "password";
17
+ /**
18
+ * Where the current error is shown: `field` under the field it is about (a field left empty),
19
+ * `form` in `LoginForm.Error` (the sign-in itself failed).
20
+ */
21
+ export type LoginErrorPlacement = "field" | "form";
22
+ export interface LoginFormContextValue {
23
+ ids: {
24
+ identifier: string;
25
+ password: string;
26
+ /** `LoginForm.Error`, the live region of errors about the whole sign-in. */
27
+ error: string;
28
+ /** Message under the identifier or the password, for errors about that field. */
29
+ fieldError: string;
30
+ portals: string;
31
+ };
32
+ portals: readonly LoginPortal[];
33
+ portal: LoginPortal | undefined;
34
+ setPortal: (value: string) => void;
35
+ identifier: string;
36
+ password: string;
37
+ appearance: LoginFormAppearance;
38
+ remember: boolean;
39
+ setRemember: (remember: boolean) => void;
40
+ loading: boolean;
41
+ error: string | null;
42
+ /** The field the current error belongs to, so it can be marked invalid. */
43
+ invalidField: LoginField | null;
44
+ errorPlacement: LoginErrorPlacement | null;
45
+ setValue: (field: LoginField, value: string) => void;
46
+ identifierRef: RefObject<HTMLInputElement | null>;
47
+ passwordRef: RefObject<HTMLInputElement | null>;
48
+ classNames: ClassNames<LoginFormPart> | undefined;
49
+ }
50
+ export declare const LoginFormContext: import("react").Context<LoginFormContextValue | null>;
51
+ export declare function useLoginForm(part: string): LoginFormContextValue;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { createContext, useContext } from "react";
3
+ const LoginFormContext = createContext(null);
4
+ function useLoginForm(part) {
5
+ const context = useContext(LoginFormContext);
6
+ if (!context) throw new Error(`LoginForm.${part} must be rendered inside a LoginForm`);
7
+ return context;
8
+ }
9
+ export {
10
+ LoginFormContext,
11
+ useLoginForm
12
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./login-form.js";
2
+ export { LoginFormError, type LoginFormErrorProps, type LoginFormFieldProps, LoginFormFooter, type LoginFormFooterProps, LoginFormHeader, type LoginFormHeaderProps, LoginFormIdentifier, LoginFormOptions, type LoginFormOptionsProps, LoginFormPassword, type LoginFormPasswordProps, LoginFormPortals, type LoginFormPortalsProps, LoginFormProviders, type LoginFormProvidersProps, LoginFormSubmit, type LoginFormSubmitProps, } from "./parts.js";
@@ -0,0 +1,23 @@
1
+ export * from "./login-form.js";
2
+ import {
3
+ LoginFormError,
4
+ LoginFormFooter,
5
+ LoginFormHeader,
6
+ LoginFormIdentifier,
7
+ LoginFormOptions,
8
+ LoginFormPassword,
9
+ LoginFormPortals,
10
+ LoginFormProviders,
11
+ LoginFormSubmit
12
+ } from "./parts.js";
13
+ export {
14
+ LoginFormError,
15
+ LoginFormFooter,
16
+ LoginFormHeader,
17
+ LoginFormIdentifier,
18
+ LoginFormOptions,
19
+ LoginFormPassword,
20
+ LoginFormPortals,
21
+ LoginFormProviders,
22
+ LoginFormSubmit
23
+ };
@@ -0,0 +1,66 @@
1
+ import { type ComponentPropsWithoutRef, type ReactNode } from "react";
2
+ import type { ClassNames } from "../../utils/class-names.js";
3
+ import { type LoginFormAppearance, type LoginFormPart, type LoginPortal } from "./context.js";
4
+ import { LoginFormError, LoginFormFooter, LoginFormHeader, LoginFormIdentifier, LoginFormOptions, LoginFormPassword, LoginFormPortals, LoginFormProviders, LoginFormSubmit } from "./parts.js";
5
+ export type { LoginFormAppearance, LoginFormPart, LoginPortal } from "./context.js";
6
+ export interface LoginValues {
7
+ identifier: string;
8
+ password: string;
9
+ /** Value of the selected portal; `undefined` when the form has none. */
10
+ portal: string | undefined;
11
+ /** State of `LoginForm.Options`' remember-me checkbox. */
12
+ remember: boolean;
13
+ }
14
+ export interface LoginFormProps extends Omit<ComponentPropsWithoutRef<"form">, "onSubmit" | "children"> {
15
+ /**
16
+ * Called with the values when the form is submitted with both fields filled. A returned promise
17
+ * keeps the form loading; if it resolves the form reads as signed in, if it rejects the message of
18
+ * the error (or the localized default) is shown. Leave it out and drive `loading`, `error` and
19
+ * `success` yourself.
20
+ */
21
+ onSubmit?: (values: LoginValues) => void | Promise<void>;
22
+ /** Portals the person can sign in through. With two or more, `LoginForm.Portals` renders a picker. */
23
+ portals?: readonly LoginPortal[];
24
+ /** Selected portal value. Controlled; omit it for an uncontrolled picker. */
25
+ portal?: string;
26
+ defaultPortal?: string;
27
+ onPortalChange?: (value: string) => void;
28
+ /**
29
+ * `card` is the form inside the panel card, labels hidden visually. `open` has no card chrome and
30
+ * shows the labels above the fields with a pill button. Defaults to `open` inside an
31
+ * `AuthLayout panel="solid"` and `card` otherwise.
32
+ */
33
+ appearance?: LoginFormAppearance;
34
+ /** The form is waiting for the server. Overrides the state `onSubmit` keeps. */
35
+ loading?: boolean;
36
+ /** Sign-in error to show. `null` clears it. Overrides the state `onSubmit` keeps. */
37
+ error?: string | null;
38
+ /** The sign-in worked. Overrides the state `onSubmit` keeps. */
39
+ success?: boolean;
40
+ /**
41
+ * Parts to place yourself: `LoginForm.Header`, `.Portals`, `.Error`, `.Identifier`, `.Password`,
42
+ * `.Options`, `.Submit`, `.Providers` and `.Footer`. Without children the form renders them in that
43
+ * order (no `.Options`, `.Providers` or `.Footer`). A field left empty is reported under that field;
44
+ * `.Error` shows only errors about the sign-in itself, so place it above the fields.
45
+ */
46
+ children?: ReactNode;
47
+ /** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
48
+ classNames?: ClassNames<LoginFormPart>;
49
+ }
50
+ /**
51
+ * Sign-in form that works alone and, inside an `AuthLayout`, drives its illustration: focusing the
52
+ * identifier or the password, typing, failing and signing in all update the layout's state and
53
+ * progress, and the selected portal becomes the illustration's active slab.
54
+ */
55
+ export declare function LoginForm({ onSubmit, portals, portal: portalProp, appearance: appearanceProp, defaultPortal, onPortalChange, loading: loadingProp, error: errorProp, success: successProp, children, className, classNames, onFocus, onBlur, ...props }: LoginFormProps): import("react").JSX.Element;
56
+ export declare namespace LoginForm {
57
+ var Header: typeof LoginFormHeader;
58
+ var Portals: typeof LoginFormPortals;
59
+ var Identifier: typeof LoginFormIdentifier;
60
+ var Password: typeof LoginFormPassword;
61
+ var Options: typeof LoginFormOptions;
62
+ var Providers: typeof LoginFormProviders;
63
+ var Error: typeof LoginFormError;
64
+ var Submit: typeof LoginFormSubmit;
65
+ var Footer: typeof LoginFormFooter;
66
+ }