@alfadocs/ui-kit-debug 0.18.2 → 0.19.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/_chunks/email-input-DKN5JERd.js +396 -0
- package/dist/_chunks/email-input-DKN5JERd.js.map +1 -0
- package/dist/_chunks/{use-password-requirements-BOgFsoIe.js → use-password-requirements-C9vKBSVn.js} +92 -81
- package/dist/_chunks/{use-password-requirements-BOgFsoIe.js.map → use-password-requirements-C9vKBSVn.js.map} +1 -1
- package/dist/agent-catalog.json +31 -1
- package/dist/components/email-input/email-input.agent.d.ts +13 -0
- package/dist/components/email-input/email-input.agent.d.ts.map +1 -0
- package/dist/components/email-input/email-input.d.ts +28 -0
- package/dist/components/email-input/email-input.d.ts.map +1 -0
- package/dist/components/email-input/index.d.ts +5 -0
- package/dist/components/email-input/index.d.ts.map +1 -0
- package/dist/components/email-input/index.js +6 -0
- package/dist/components/email-input/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/password-input/index.js +1 -1
- package/dist/components/password-input/use-password-requirements.d.ts +9 -1
- package/dist/components/password-input/use-password-requirements.d.ts.map +1 -1
- package/dist/i18n/config.js +12 -0
- package/dist/i18n/config.js.map +1 -1
- package/dist/i18n/resources.d.ts +12 -0
- package/dist/i18n/resources.d.ts.map +1 -1
- package/dist/index.js +448 -445
- package/dist/index.js.map +1 -1
- package/dist/locales/de.json +4 -0
- package/dist/locales/en.json +4 -0
- package/dist/locales/it.json +4 -0
- package/package.json +8 -2
package/dist/_chunks/{use-password-requirements-BOgFsoIe.js → use-password-requirements-C9vKBSVn.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as g, jsx as
|
|
2
|
-
import { forwardRef as ts, useRef as as, useState as C, useEffect as is, useCallback as p, useMemo as
|
|
3
|
-
import { c as
|
|
1
|
+
import { jsxs as g, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ts, useRef as as, useState as C, useEffect as is, useCallback as p, useMemo as L } from "react";
|
|
3
|
+
import { c as I } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as W } from "react-i18next";
|
|
5
5
|
import { T as rs } from "./text-input-CakysYnD.js";
|
|
6
6
|
import { u as ns } from "./form-field-context-B3APVHKx.js";
|
|
@@ -100,7 +100,7 @@ const fs = [
|
|
|
100
100
|
sm: "ds:size-4",
|
|
101
101
|
md: "ds:size-[18px]",
|
|
102
102
|
lg: "ds:size-5"
|
|
103
|
-
}, bs =
|
|
103
|
+
}, bs = I(
|
|
104
104
|
[
|
|
105
105
|
"ds:absolute ds:inset-y-0 ds:end-0 ds:ps-2 ds:pe-3",
|
|
106
106
|
"ds:inline-flex ds:items-center ds:justify-center",
|
|
@@ -114,9 +114,9 @@ const fs = [
|
|
|
114
114
|
"ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
115
115
|
"ds:disabled:cursor-not-allowed ds:disabled:opacity-50"
|
|
116
116
|
].join(" ")
|
|
117
|
-
), vs =
|
|
117
|
+
), vs = I(
|
|
118
118
|
"ds:h-1 ds:w-full ds:overflow-hidden ds:rounded-[var(--radius-full)] ds:bg-muted"
|
|
119
|
-
), ys =
|
|
119
|
+
), ys = I(
|
|
120
120
|
[
|
|
121
121
|
"ds:h-full ds:rounded-[var(--radius-full)]",
|
|
122
122
|
"ds:transition-all ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none"
|
|
@@ -137,7 +137,7 @@ const fs = [
|
|
|
137
137
|
1: "fair",
|
|
138
138
|
2: "good",
|
|
139
139
|
3: "strong"
|
|
140
|
-
}, ks =
|
|
140
|
+
}, ks = I(
|
|
141
141
|
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-meta",
|
|
142
142
|
{
|
|
143
143
|
variants: {
|
|
@@ -157,128 +157,128 @@ const fs = [
|
|
|
157
157
|
deriveStrength: u = !1,
|
|
158
158
|
autoComplete: w,
|
|
159
159
|
size: h = "md",
|
|
160
|
-
disabled:
|
|
161
|
-
name:
|
|
162
|
-
id:
|
|
163
|
-
onKeyDown:
|
|
164
|
-
onKeyUp:
|
|
165
|
-
onBlur:
|
|
166
|
-
onInput:
|
|
160
|
+
disabled: b,
|
|
161
|
+
name: o,
|
|
162
|
+
id: t,
|
|
163
|
+
onKeyDown: v,
|
|
164
|
+
onKeyUp: y,
|
|
165
|
+
onBlur: x,
|
|
166
|
+
onInput: k,
|
|
167
167
|
defaultValue: T,
|
|
168
168
|
value: m,
|
|
169
169
|
className: $,
|
|
170
170
|
...B
|
|
171
171
|
}, G) => {
|
|
172
|
-
const { t: f } = W(), M = ns().disabled ||
|
|
172
|
+
const { t: f } = W(), M = ns().disabled || b, N = as(null), J = os(G, N), [c, j] = C(!1), [Q, A] = C(!1), [_, H] = C(() => typeof m == "string" ? m : typeof T == "string" ? T : "");
|
|
173
173
|
is(() => {
|
|
174
174
|
typeof m == "string" && H(m);
|
|
175
175
|
}, [m]);
|
|
176
176
|
const X = p(
|
|
177
177
|
(s) => {
|
|
178
|
-
H(s.currentTarget.value),
|
|
178
|
+
H(s.currentTarget.value), k == null || k(s);
|
|
179
179
|
},
|
|
180
|
-
[
|
|
180
|
+
[k]
|
|
181
181
|
), z = p((s) => {
|
|
182
182
|
var R;
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
185
|
-
const
|
|
186
|
-
|
|
183
|
+
const a = N.current;
|
|
184
|
+
if (!a) return;
|
|
185
|
+
const O = Object.getPrototypeOf(a), P = (R = Object.getOwnPropertyDescriptor(O, "value")) == null ? void 0 : R.set;
|
|
186
|
+
P == null || P.call(a, s), a.dispatchEvent(new Event("input", { bubbles: !0 })), a.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
187
187
|
}, []), Y = p(() => {
|
|
188
188
|
j((s) => {
|
|
189
|
-
const
|
|
190
|
-
return e == null || e(
|
|
189
|
+
const a = !s;
|
|
190
|
+
return e == null || e(a), a;
|
|
191
191
|
});
|
|
192
|
-
}, [e]),
|
|
192
|
+
}, [e]), V = p((s) => {
|
|
193
193
|
typeof s.getModifierState == "function" && A(s.getModifierState("CapsLock"));
|
|
194
194
|
}, []), Z = p(
|
|
195
195
|
(s) => {
|
|
196
|
-
|
|
196
|
+
V(s), v == null || v(s);
|
|
197
197
|
},
|
|
198
|
-
[
|
|
199
|
-
),
|
|
198
|
+
[V, v]
|
|
199
|
+
), q = p(
|
|
200
200
|
(s) => {
|
|
201
|
-
|
|
201
|
+
V(s), y == null || y(s);
|
|
202
202
|
},
|
|
203
|
-
[
|
|
204
|
-
),
|
|
203
|
+
[V, y]
|
|
204
|
+
), D = p(
|
|
205
205
|
(s) => {
|
|
206
|
-
A(!1),
|
|
206
|
+
A(!1), x == null || x(s);
|
|
207
207
|
},
|
|
208
|
-
[
|
|
209
|
-
), U =
|
|
208
|
+
[x]
|
|
209
|
+
), U = L(
|
|
210
210
|
() => ({
|
|
211
211
|
getValue: () => {
|
|
212
212
|
var s;
|
|
213
|
-
return ((s =
|
|
213
|
+
return ((s = N.current) == null ? void 0 : s.value) ?? "";
|
|
214
214
|
},
|
|
215
215
|
setValue: (s) => z(s),
|
|
216
216
|
clear: () => z(""),
|
|
217
217
|
focus: () => {
|
|
218
218
|
var s;
|
|
219
|
-
return (s =
|
|
219
|
+
return (s = N.current) == null ? void 0 : s.focus();
|
|
220
220
|
},
|
|
221
221
|
isRevealed: () => c,
|
|
222
222
|
toggleVisibility: () => {
|
|
223
223
|
j((s) => {
|
|
224
|
-
const
|
|
225
|
-
return e == null || e(
|
|
224
|
+
const a = !s;
|
|
225
|
+
return e == null || e(a), a;
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
}),
|
|
229
229
|
[e, c, z]
|
|
230
230
|
);
|
|
231
|
-
ds(hs, U,
|
|
231
|
+
ds(hs, U, t);
|
|
232
232
|
const F = ws[h], ss = f(
|
|
233
233
|
c ? "inputs.password.toggleHide" : "inputs.password.toggleShow",
|
|
234
234
|
c ? "Hide password" : "Show password"
|
|
235
|
-
),
|
|
235
|
+
), d = L(
|
|
236
236
|
() => (l == null ? void 0 : l.map((s) => ({
|
|
237
237
|
...s,
|
|
238
238
|
met: s.test(_)
|
|
239
239
|
}))) ?? null,
|
|
240
240
|
[l, _]
|
|
241
|
-
), es =
|
|
242
|
-
if (!u || !(
|
|
243
|
-
const s =
|
|
244
|
-
return Math.min(3, Math.floor(s /
|
|
245
|
-
}, [u,
|
|
246
|
-
`inputs.password.strength.${
|
|
247
|
-
|
|
241
|
+
), es = L(() => {
|
|
242
|
+
if (!u || !(d != null && d.length)) return 0;
|
|
243
|
+
const s = d.filter((O) => O.met).length, a = d.length;
|
|
244
|
+
return Math.min(3, Math.floor(s / a * 4));
|
|
245
|
+
}, [u, d]), E = n !== void 0 ? n : u ? es : 0, S = xs[E], K = f(
|
|
246
|
+
`inputs.password.strength.${S}`,
|
|
247
|
+
S.charAt(0).toUpperCase() + S.slice(1)
|
|
248
248
|
);
|
|
249
249
|
return /* @__PURE__ */ g(
|
|
250
250
|
"div",
|
|
251
251
|
{
|
|
252
252
|
"data-component": "password-input",
|
|
253
|
-
"data-component-id":
|
|
253
|
+
"data-component-id": t,
|
|
254
254
|
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
|
|
255
255
|
children: [
|
|
256
256
|
/* @__PURE__ */ g("div", { className: "ds:relative", children: [
|
|
257
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ i(
|
|
258
258
|
rs,
|
|
259
259
|
{
|
|
260
260
|
ref: J,
|
|
261
|
-
id:
|
|
261
|
+
id: t,
|
|
262
262
|
type: c ? "text" : "password",
|
|
263
263
|
autoComplete: w ?? "current-password",
|
|
264
|
-
name:
|
|
264
|
+
name: o ?? "password",
|
|
265
265
|
spellCheck: !1,
|
|
266
266
|
autoCapitalize: "none",
|
|
267
267
|
autoCorrect: "off",
|
|
268
268
|
size: h,
|
|
269
269
|
disabled: M,
|
|
270
270
|
onKeyDown: Z,
|
|
271
|
-
onKeyUp:
|
|
272
|
-
onBlur:
|
|
271
|
+
onKeyUp: q,
|
|
272
|
+
onBlur: D,
|
|
273
273
|
onInput: X,
|
|
274
274
|
value: m,
|
|
275
275
|
defaultValue: T,
|
|
276
|
-
endAdornment: /* @__PURE__ */
|
|
276
|
+
endAdornment: /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "ds:block ds:size-4" }),
|
|
277
277
|
className: $,
|
|
278
278
|
...B
|
|
279
279
|
}
|
|
280
280
|
),
|
|
281
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ i(
|
|
282
282
|
"button",
|
|
283
283
|
{
|
|
284
284
|
type: "button",
|
|
@@ -287,11 +287,11 @@ const fs = [
|
|
|
287
287
|
disabled: M,
|
|
288
288
|
onClick: Y,
|
|
289
289
|
className: bs(),
|
|
290
|
-
children: c ? /* @__PURE__ */
|
|
290
|
+
children: c ? /* @__PURE__ */ i(ls, { "aria-hidden": "true", className: F }) : /* @__PURE__ */ i(gs, { "aria-hidden": "true", className: F })
|
|
291
291
|
}
|
|
292
292
|
)
|
|
293
293
|
] }),
|
|
294
|
-
|
|
294
|
+
d && d.length > 0 ? (
|
|
295
295
|
// `role="list"` / `role="listitem"` are set explicitly even
|
|
296
296
|
// though they're the implicit roles on <ul>/<li> — Safari
|
|
297
297
|
// VoiceOver strips the implicit list role when CSS sets
|
|
@@ -305,14 +305,14 @@ const fs = [
|
|
|
305
305
|
// alone wouldn't trigger an announcement — the sr-only span
|
|
306
306
|
// is the load-bearing piece for AT users.
|
|
307
307
|
// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
308
|
-
/* @__PURE__ */
|
|
308
|
+
/* @__PURE__ */ i(
|
|
309
309
|
"ul",
|
|
310
310
|
{
|
|
311
311
|
role: "list",
|
|
312
312
|
"aria-live": "polite",
|
|
313
313
|
"data-component": "password-requirements",
|
|
314
314
|
className: "ds:list-none ds:m-0 ds:p-0 ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
|
|
315
|
-
children:
|
|
315
|
+
children: d.map((s) => (
|
|
316
316
|
// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
317
317
|
/* @__PURE__ */ g(
|
|
318
318
|
"li",
|
|
@@ -321,20 +321,20 @@ const fs = [
|
|
|
321
321
|
"data-state": s.met ? "met" : "unmet",
|
|
322
322
|
className: ks({ met: s.met }),
|
|
323
323
|
children: [
|
|
324
|
-
s.met ? /* @__PURE__ */
|
|
324
|
+
s.met ? /* @__PURE__ */ i(
|
|
325
325
|
ps,
|
|
326
326
|
{
|
|
327
327
|
"aria-hidden": "true",
|
|
328
328
|
className: "ds:size-3.5 ds:text-success ds:shrink-0"
|
|
329
329
|
}
|
|
330
|
-
) : /* @__PURE__ */
|
|
330
|
+
) : /* @__PURE__ */ i(
|
|
331
331
|
us,
|
|
332
332
|
{
|
|
333
333
|
"aria-hidden": "true",
|
|
334
334
|
className: "ds:size-3.5 ds:shrink-0"
|
|
335
335
|
}
|
|
336
336
|
),
|
|
337
|
-
/* @__PURE__ */
|
|
337
|
+
/* @__PURE__ */ i("span", { children: s.label }),
|
|
338
338
|
/* @__PURE__ */ g("span", { className: "ds:sr-only", children: [
|
|
339
339
|
" — ",
|
|
340
340
|
s.met ? f("inputs.password.requirements.met", "met") : f("inputs.password.requirements.unmet", "not yet met")
|
|
@@ -354,13 +354,13 @@ const fs = [
|
|
|
354
354
|
"aria-live": "polite",
|
|
355
355
|
className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-meta ds:text-warning",
|
|
356
356
|
children: [
|
|
357
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ i(ms, { "aria-hidden": "true", className: "ds:size-3.5" }),
|
|
358
358
|
f("inputs.password.capsLock", "Caps Lock is on")
|
|
359
359
|
]
|
|
360
360
|
}
|
|
361
361
|
) : null,
|
|
362
362
|
r ? /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
363
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ i(
|
|
364
364
|
"div",
|
|
365
365
|
{
|
|
366
366
|
role: "progressbar",
|
|
@@ -373,7 +373,7 @@ const fs = [
|
|
|
373
373
|
),
|
|
374
374
|
"aria-valuetext": K,
|
|
375
375
|
className: vs(),
|
|
376
|
-
children: /* @__PURE__ */
|
|
376
|
+
children: /* @__PURE__ */ i(
|
|
377
377
|
"div",
|
|
378
378
|
{
|
|
379
379
|
className: ys({ level: E })
|
|
@@ -381,7 +381,7 @@ const fs = [
|
|
|
381
381
|
)
|
|
382
382
|
}
|
|
383
383
|
),
|
|
384
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ i(
|
|
385
385
|
"span",
|
|
386
386
|
{
|
|
387
387
|
"aria-hidden": "true",
|
|
@@ -397,47 +397,58 @@ const fs = [
|
|
|
397
397
|
);
|
|
398
398
|
Ns.displayName = "PasswordInput";
|
|
399
399
|
function Hs(e = {}) {
|
|
400
|
-
const { t: r } = W(), { minLength: n, uppercase: l, lowercase: u, digit: w, symbol: h } = e;
|
|
401
|
-
return
|
|
402
|
-
const
|
|
403
|
-
return typeof n == "number" && n > 0 &&
|
|
400
|
+
const { t: r } = W(), { minLength: n, uppercase: l, lowercase: u, digit: w, symbol: h, noSpaces: b } = e;
|
|
401
|
+
return L(() => {
|
|
402
|
+
const o = [];
|
|
403
|
+
return typeof n == "number" && n > 0 && o.push({
|
|
404
404
|
id: "length",
|
|
405
405
|
label: r("inputs.password.requirements.length", {
|
|
406
406
|
count: n,
|
|
407
407
|
defaultValue: `At least ${n} characters`
|
|
408
408
|
}),
|
|
409
|
-
test: (
|
|
410
|
-
}), l &&
|
|
409
|
+
test: (t) => t.length >= n
|
|
410
|
+
}), l && o.push({
|
|
411
411
|
id: "uppercase",
|
|
412
412
|
label: r(
|
|
413
413
|
"inputs.password.requirements.uppercase",
|
|
414
414
|
"One uppercase letter"
|
|
415
415
|
),
|
|
416
|
-
test: (
|
|
417
|
-
}), u &&
|
|
416
|
+
test: (t) => new RegExp("\\p{Lu}", "u").test(t)
|
|
417
|
+
}), u && o.push({
|
|
418
418
|
id: "lowercase",
|
|
419
419
|
label: r(
|
|
420
420
|
"inputs.password.requirements.lowercase",
|
|
421
421
|
"One lowercase letter"
|
|
422
422
|
),
|
|
423
|
-
test: (
|
|
424
|
-
}), w &&
|
|
423
|
+
test: (t) => new RegExp("\\p{Ll}", "u").test(t)
|
|
424
|
+
}), w && o.push({
|
|
425
425
|
id: "digit",
|
|
426
426
|
label: r("inputs.password.requirements.digit", "One number"),
|
|
427
|
-
test: (
|
|
428
|
-
}), h &&
|
|
427
|
+
test: (t) => new RegExp("\\p{Nd}", "u").test(t)
|
|
428
|
+
}), h && o.push({
|
|
429
429
|
id: "symbol",
|
|
430
430
|
label: r("inputs.password.requirements.symbol", "One symbol"),
|
|
431
431
|
// Anything that isn't a letter, number, or whitespace counts.
|
|
432
432
|
// `\p{L}` + `\p{N}` keep this Unicode-aware so non-Latin
|
|
433
433
|
// alphabets (Arabic, Chinese, …) aren't mis-classified as
|
|
434
434
|
// symbols.
|
|
435
|
-
test: (
|
|
436
|
-
}),
|
|
437
|
-
|
|
435
|
+
test: (t) => /[^\p{L}\p{N}\s]/u.test(t)
|
|
436
|
+
}), b && o.push({
|
|
437
|
+
id: "no-spaces",
|
|
438
|
+
label: r("inputs.password.requirements.noSpaces", "No spaces"),
|
|
439
|
+
// `\s` covers ASCII space + tab + newline. The explicit
|
|
440
|
+
// U+00A0 (non-breaking space) and U+202F (narrow no-break
|
|
441
|
+
// space) catch the two paste-time characters credential
|
|
442
|
+
// managers and rich-text editors most often inject without
|
|
443
|
+
// the user noticing — those are NOT always in `\s`.
|
|
444
|
+
// Authored via hex escapes (not literal characters) so the
|
|
445
|
+
// source file passes `no-irregular-whitespace`.
|
|
446
|
+
test: (t) => !/[\s\u00A0\u202F]/.test(t)
|
|
447
|
+
}), o;
|
|
448
|
+
}, [r, n, l, u, w, h, b]);
|
|
438
449
|
}
|
|
439
450
|
export {
|
|
440
451
|
Ns as P,
|
|
441
452
|
Hs as u
|
|
442
453
|
};
|
|
443
|
-
//# sourceMappingURL=use-password-requirements-
|
|
454
|
+
//# sourceMappingURL=use-password-requirements-C9vKBSVn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-password-requirements-BOgFsoIe.js","sources":["../../node_modules/lucide-react/dist/esm/icons/eye.js","../../src/components/password-input/password-input.agent.ts","../../src/components/password-input/password-input.tsx","../../src/components/password-input/use-password-requirements.ts"],"sourcesContent":["/**\n * @license lucide-react v1.8.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\",\n key: \"1nclc0\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Eye = createLucideIcon(\"eye\", __iconNode);\n\nexport { __iconNode, Eye as default };\n//# sourceMappingURL=eye.js.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — PasswordInput. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { PasswordInputHandle } from './password-input';\n\nexport const passwordInputAgent: AgentAdapter<PasswordInputHandle> = {\n id: 'password-input',\n capabilities: ['edit_inline'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.passwordInput.state.value',\n description:\n 'Current password value. Never log or persist this off-device.',\n read: (handle) => handle.getValue(),\n },\n isEmpty: {\n type: 'boolean',\n descriptionKey: 'ui.agent.passwordInput.state.isEmpty',\n description: 'Whether the input has no value.',\n read: (handle) => handle.getValue() === '',\n },\n isRevealed: {\n type: 'boolean',\n descriptionKey: 'ui.agent.passwordInput.state.isRevealed',\n description: 'Whether the password is currently shown in plain text.',\n read: (handle) => handle.isRevealed(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n descriptionKey: 'ui.agent.passwordInput.actions.setValue',\n description: 'Replace the password value.',\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n clear: {\n safety: 'destructive',\n descriptionKey: 'ui.agent.passwordInput.actions.clear',\n description: 'Empty the input. Loses any typed value.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n focus: {\n safety: 'read',\n descriptionKey: 'ui.agent.passwordInput.actions.focus',\n description: 'Move keyboard focus to the input.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n toggle_visibility: {\n safety: 'read',\n descriptionKey: 'ui.agent.passwordInput.actions.toggleVisibility',\n description: 'Toggle between masked and plain-text display.',\n invoke: (handle) => {\n handle.toggleVisibility();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'password-input',\n description: 'Marks the PasswordInput wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type FormEvent,\n type KeyboardEvent,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { AlertTriangle, Check, Circle, Eye, EyeOff } from 'lucide-react';\nimport { TextInput, type TextInputProps } from '../text-input';\nimport { useFormField } from '../form-field/form-field-context';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { useAgentRegistration } from '../../agent';\nimport { passwordInputAgent } from './password-input.agent';\n\n/** Agent-readiness curated handle for PasswordInput. */\nexport interface PasswordInputHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n clear: () => void;\n focus: () => void;\n isRevealed: () => boolean;\n toggleVisibility: () => void;\n}\n\ntype Strength = 0 | 1 | 2 | 3;\n\ntype SizeKey = NonNullable<TextInputProps['size']>;\n\nconst iconSizeClassBySize: Record<SizeKey, string> = {\n sm: 'ds:size-4',\n md: 'ds:size-[18px]',\n lg: 'ds:size-5',\n};\n\nconst toggleVariants = cva(\n [\n 'ds:absolute ds:inset-y-0 ds:end-0 ds:ps-2 ds:pe-3',\n 'ds:inline-flex ds:items-center ds:justify-center',\n 'ds:text-muted-foreground ds:hover:text-foreground',\n 'ds:bg-transparent ds:border-0 ds:cursor-pointer',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:min-w-[var(--min-target-size)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n ].join(' '),\n);\n\nconst strengthTrackVariants = cva(\n 'ds:h-1 ds:w-full ds:overflow-hidden ds:rounded-[var(--radius-full)] ds:bg-muted',\n);\n\nconst strengthBarVariants = cva(\n [\n 'ds:h-full ds:rounded-[var(--radius-full)]',\n 'ds:transition-all ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n ].join(' '),\n {\n variants: {\n level: {\n 0: 'ds:w-1/4 ds:bg-destructive',\n 1: 'ds:w-1/2 ds:bg-warning',\n 2: 'ds:w-3/4 ds:bg-success',\n 3: 'ds:w-full ds:bg-success',\n },\n },\n defaultVariants: { level: 0 },\n },\n);\n\nconst strengthLabelByLevel: Record<\n Strength,\n 'weak' | 'fair' | 'good' | 'strong'\n> = {\n 0: 'weak',\n 1: 'fair',\n 2: 'good',\n 3: 'strong',\n};\n\nconst requirementRowVariants = cva(\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-meta',\n {\n variants: {\n met: {\n true: 'ds:text-success',\n false: 'ds:text-muted-foreground',\n },\n },\n defaultVariants: { met: false },\n },\n);\n\n/**\n * One row in the live requirements checklist. Consumers either build\n * these inline or pull a pre-built set from `usePasswordRequirements`.\n */\nexport interface PasswordRequirement {\n /** Stable id — keyed render + a11y. */\n id: string;\n /** Already-translated label. The consumer owns the wording. */\n label: string;\n /** Predicate against the current value. Pure, runs on every keystroke. */\n test: (value: string) => boolean;\n}\n\nexport interface PasswordInputProps\n extends\n Omit<TextInputProps, 'type' | 'endAdornment' | 'startAdornment'>,\n VariantProps<typeof strengthBarVariants> {\n /** Callback when reveal state changes (for analytics). */\n onRevealChange?: (revealed: boolean) => void;\n /** Show the strength meter below the input. */\n showStrength?: boolean;\n /** Strength score: 0 = weak, 1 = fair, 2 = good, 3 = strong. */\n strength?: Strength;\n /**\n * Live requirements checklist rendered between the input and the\n * strength meter / caps-lock notice. Each row's predicate runs on\n * every keystroke and the row's `data-state` flips between `\"met\"`\n * and `\"unmet\"`. Backed by `aria-live=\"polite\"` so screen readers\n * announce each transition as a visually-hidden suffix span flips\n * between localised \"met\" / \"not yet met\" copy.\n *\n * Tip: hoist or `useMemo` the array — inlining it in JSX makes the\n * predicate-results memo bust every render. The kit's\n * `usePasswordRequirements` helper already does this.\n */\n requirements?: ReadonlyArray<PasswordRequirement>;\n /**\n * When `true` AND `strength` is not provided, derive a 0–3 score\n * from the proportion of `requirements` satisfied. Lets consumers\n * get the strength bar \"for free\" once they declare requirements.\n */\n deriveStrength?: boolean;\n /**\n * Autocomplete hint. Defaults to 'current-password'.\n * Use 'new-password' for registration/change-password forms.\n */\n autoComplete?: 'current-password' | 'new-password' | (string & {});\n}\n\nexport const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(\n (\n {\n onRevealChange,\n showStrength = false,\n strength,\n requirements,\n deriveStrength = false,\n autoComplete,\n size = 'md',\n disabled,\n name,\n id,\n onKeyDown,\n onKeyUp,\n onBlur,\n onInput,\n defaultValue,\n value,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const ctx = useFormField();\n const effectiveDisabled = ctx.disabled || disabled;\n\n const innerInputRef = useRef<HTMLInputElement | null>(null);\n const composedRef = composeRefs(ref, innerInputRef);\n\n const [revealed, setRevealed] = useState(false);\n const [capsLock, setCapsLock] = useState(false);\n\n // Track the current value internally so the requirements checklist\n // can re-evaluate predicates without forcing consumers to lift the\n // input into a controlled state. The seed is whichever of\n // `value` / `defaultValue` was passed; the `input` listener then\n // keeps it in sync on every keystroke (covers both controlled and\n // uncontrolled callers — for controlled callers we resync to the\n // incoming `value` prop in the effect below).\n const [internalValue, setInternalValue] = useState<string>(() => {\n if (typeof value === 'string') return value;\n if (typeof defaultValue === 'string') return defaultValue;\n return '';\n });\n\n useEffect(() => {\n if (typeof value === 'string') setInternalValue(value);\n }, [value]);\n\n const handleInput = useCallback(\n (event: FormEvent<HTMLInputElement>) => {\n setInternalValue(event.currentTarget.value);\n onInput?.(event);\n },\n [onInput],\n );\n\n const writeValueToInput = useCallback((next: string) => {\n const node = innerInputRef.current;\n if (!node) return;\n const prototype = Object.getPrototypeOf(node) as HTMLInputElement;\n const setter = Object.getOwnPropertyDescriptor(prototype, 'value')?.set;\n setter?.call(node, next);\n node.dispatchEvent(new Event('input', { bubbles: true }));\n node.dispatchEvent(new Event('change', { bubbles: true }));\n }, []);\n\n const handleToggle = useCallback(() => {\n setRevealed((prev) => {\n const next = !prev;\n onRevealChange?.(next);\n return next;\n });\n }, [onRevealChange]);\n\n const detectCaps = useCallback((event: KeyboardEvent<HTMLInputElement>) => {\n if (typeof event.getModifierState === 'function') {\n setCapsLock(event.getModifierState('CapsLock'));\n }\n }, []);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n detectCaps(event);\n onKeyDown?.(event);\n },\n [detectCaps, onKeyDown],\n );\n\n const handleKeyUp = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n detectCaps(event);\n onKeyUp?.(event);\n },\n [detectCaps, onKeyUp],\n );\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n setCapsLock(false);\n onBlur?.(event);\n },\n [onBlur],\n );\n\n const agentHandle = useMemo<PasswordInputHandle>(\n () => ({\n getValue: () => innerInputRef.current?.value ?? '',\n setValue: (next) => writeValueToInput(next),\n clear: () => writeValueToInput(''),\n focus: () => innerInputRef.current?.focus(),\n isRevealed: () => revealed,\n toggleVisibility: () => {\n setRevealed((prev) => {\n const next = !prev;\n onRevealChange?.(next);\n return next;\n });\n },\n }),\n [onRevealChange, revealed, writeValueToInput],\n );\n useAgentRegistration(passwordInputAgent, agentHandle, id);\n\n const iconSizeClass = iconSizeClassBySize[size];\n const toggleLabel = t(\n revealed ? 'inputs.password.toggleHide' : 'inputs.password.toggleShow',\n revealed ? 'Hide password' : 'Show password',\n );\n\n // Evaluate each requirement against the current value. Cheap by\n // construction — predicates are pure regex/length checks supplied\n // by the consumer; the kit doesn't memoise per-row because the\n // map is O(n) over a handful of rules and React would re-render\n // the row anyway when its `data-state` flips.\n const requirementResults = useMemo(\n () =>\n requirements?.map((req) => ({\n ...req,\n met: req.test(internalValue),\n })) ?? null,\n [requirements, internalValue],\n );\n\n // Derive a 0–3 score from the satisfied proportion when the\n // consumer hasn't supplied an explicit `strength`. Formula:\n // `floor((satisfied / total) * 4)`, clamped to 3 so a fully-met\n // checklist matches the explicit \"strong\" level. With zero\n // requirements we fall back to 0 — meaningless on its own but\n // never displayed since `showStrength` is what controls the bar.\n const derivedStrength: Strength = useMemo(() => {\n if (!deriveStrength || !requirementResults?.length) return 0;\n const satisfied = requirementResults.filter((r) => r.met).length;\n const total = requirementResults.length;\n return Math.min(3, Math.floor((satisfied / total) * 4)) as Strength;\n }, [deriveStrength, requirementResults]);\n\n const effectiveStrength: Strength =\n strength !== undefined ? strength : deriveStrength ? derivedStrength : 0;\n const strengthKey = strengthLabelByLevel[effectiveStrength];\n const strengthText = t(\n `inputs.password.strength.${strengthKey}`,\n strengthKey.charAt(0).toUpperCase() + strengthKey.slice(1),\n );\n\n return (\n <div\n data-component=\"password-input\"\n data-component-id={id}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <div className=\"ds:relative\">\n <TextInput\n ref={composedRef}\n id={id}\n type={revealed ? 'text' : 'password'}\n autoComplete={autoComplete ?? 'current-password'}\n name={name ?? 'password'}\n spellCheck={false}\n autoCapitalize=\"none\"\n autoCorrect=\"off\"\n size={size}\n disabled={effectiveDisabled}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onBlur={handleBlur}\n onInput={handleInput}\n value={value}\n defaultValue={defaultValue}\n endAdornment={\n <span aria-hidden=\"true\" className=\"ds:block ds:size-4\" />\n }\n className={className}\n {...rest}\n />\n <button\n type=\"button\"\n aria-pressed={revealed}\n aria-label={toggleLabel}\n disabled={effectiveDisabled}\n onClick={handleToggle}\n className={toggleVariants()}\n >\n {revealed ? (\n <EyeOff aria-hidden=\"true\" className={iconSizeClass} />\n ) : (\n <Eye aria-hidden=\"true\" className={iconSizeClass} />\n )}\n </button>\n </div>\n\n {requirementResults && requirementResults.length > 0 ? (\n // `role=\"list\"` / `role=\"listitem\"` are set explicitly even\n // though they're the implicit roles on <ul>/<li> — Safari\n // VoiceOver strips the implicit list role when CSS sets\n // `list-style: none` (which `ds:list-none` does), so the\n // redundancy is load-bearing for AT, not a lint nit.\n //\n // aria-live=\"polite\" announces transitions as the per-row\n // `.ds:sr-only` state suffix flips between \"met\" / \"not yet\n // met\". aria-live observes text-content mutations, not\n // attribute or class changes, so the data-state attribute\n // alone wouldn't trigger an announcement — the sr-only span\n // is the load-bearing piece for AT users.\n // eslint-disable-next-line jsx-a11y/no-redundant-roles\n <ul\n role=\"list\"\n aria-live=\"polite\"\n data-component=\"password-requirements\"\n className=\"ds:list-none ds:m-0 ds:p-0 ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\"\n >\n {requirementResults.map((req) => (\n // eslint-disable-next-line jsx-a11y/no-redundant-roles\n <li\n key={req.id}\n role=\"listitem\"\n data-state={req.met ? 'met' : 'unmet'}\n className={requirementRowVariants({ met: req.met })}\n >\n {req.met ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-3.5 ds:text-success ds:shrink-0\"\n />\n ) : (\n <Circle\n aria-hidden=\"true\"\n className=\"ds:size-3.5 ds:shrink-0\"\n />\n )}\n <span>{req.label}</span>\n <span className=\"ds:sr-only\">\n {' — '}\n {req.met\n ? t('inputs.password.requirements.met', 'met')\n : t('inputs.password.requirements.unmet', 'not yet met')}\n </span>\n </li>\n ))}\n </ul>\n ) : null}\n\n {capsLock ? (\n <span\n role=\"status\"\n aria-live=\"polite\"\n className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-meta ds:text-warning\"\n >\n <AlertTriangle aria-hidden=\"true\" className=\"ds:size-3.5\" />\n {t('inputs.password.capsLock', 'Caps Lock is on')}\n </span>\n ) : null}\n\n {showStrength ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <div\n role=\"progressbar\"\n aria-valuenow={effectiveStrength}\n aria-valuemin={0}\n aria-valuemax={3}\n aria-label={t(\n 'inputs.password.strengthLabel',\n 'Password strength',\n )}\n aria-valuetext={strengthText}\n className={strengthTrackVariants()}\n >\n <div\n className={strengthBarVariants({ level: effectiveStrength })}\n />\n </div>\n <span\n aria-hidden=\"true\"\n className=\"type-meta ds:text-muted-foreground\"\n >\n {strengthText}\n </span>\n </div>\n ) : null}\n </div>\n );\n },\n);\n\nPasswordInput.displayName = 'PasswordInput';\n","import { useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport type { PasswordRequirement } from './password-input';\n\nexport interface UsePasswordRequirementsOptions {\n /**\n * Minimum password length. When set, adds a \"length\" requirement.\n * Pass `12` (or whatever the server-side regex enforces) so the\n * inline checklist tells users the same rule they'll bounce off\n * server-side. When omitted, no length row is rendered.\n */\n minLength?: number;\n /** Adds an \"uppercase letter\" requirement when true. */\n uppercase?: boolean;\n /** Adds a \"lowercase letter\" requirement when true. */\n lowercase?: boolean;\n /** Adds a \"digit\" requirement when true. */\n digit?: boolean;\n /** Adds a \"symbol\" requirement when true. Matches anything outside `[A-Za-z0-9\\s]`. */\n symbol?: boolean;\n}\n\n/**\n * Builds the common set of password requirements with i18n-resolved\n * labels. Designed for the AlfaDocs platform's patient-registration\n * server-side regex (`/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{12,}$/`) but\n * generic enough for any consumer.\n *\n * Each opt-in flag adds one row to the returned array, in a stable\n * visual order (length → uppercase → lowercase → digit → symbol).\n * Predicates are pure and run on every keystroke.\n *\n * @example\n * const requirements = usePasswordRequirements({\n * minLength: 12,\n * uppercase: true,\n * lowercase: true,\n * digit: true,\n * });\n * <PasswordInput requirements={requirements} deriveStrength />\n */\nexport function usePasswordRequirements(\n opts: UsePasswordRequirementsOptions = {},\n): PasswordRequirement[] {\n const { t } = useTranslation();\n const { minLength, uppercase, lowercase, digit, symbol } = opts;\n\n return useMemo(() => {\n const list: PasswordRequirement[] = [];\n\n if (typeof minLength === 'number' && minLength > 0) {\n list.push({\n id: 'length',\n label: t('inputs.password.requirements.length', {\n count: minLength,\n defaultValue: `At least ${minLength} characters`,\n }),\n test: (v) => v.length >= minLength,\n });\n }\n\n if (uppercase) {\n list.push({\n id: 'uppercase',\n label: t(\n 'inputs.password.requirements.uppercase',\n 'One uppercase letter',\n ),\n test: (v) => /\\p{Lu}/u.test(v),\n });\n }\n\n if (lowercase) {\n list.push({\n id: 'lowercase',\n label: t(\n 'inputs.password.requirements.lowercase',\n 'One lowercase letter',\n ),\n test: (v) => /\\p{Ll}/u.test(v),\n });\n }\n\n if (digit) {\n list.push({\n id: 'digit',\n label: t('inputs.password.requirements.digit', 'One number'),\n test: (v) => /\\p{Nd}/u.test(v),\n });\n }\n\n if (symbol) {\n list.push({\n id: 'symbol',\n label: t('inputs.password.requirements.symbol', 'One symbol'),\n // Anything that isn't a letter, number, or whitespace counts.\n // `\\p{L}` + `\\p{N}` keep this Unicode-aware so non-Latin\n // alphabets (Arabic, Chinese, …) aren't mis-classified as\n // symbols.\n test: (v) => /[^\\p{L}\\p{N}\\s]/u.test(v),\n });\n }\n\n return list;\n }, [t, minLength, uppercase, lowercase, digit, symbol]);\n}\n"],"names":["__iconNode","Eye","createLucideIcon","passwordInputAgent","handle","args","iconSizeClassBySize","toggleVariants","cva","strengthTrackVariants","strengthBarVariants","strengthLabelByLevel","requirementRowVariants","PasswordInput","forwardRef","onRevealChange","showStrength","strength","requirements","deriveStrength","autoComplete","size","disabled","name","id","onKeyDown","onKeyUp","onBlur","onInput","defaultValue","value","className","rest","ref","t","useTranslation","effectiveDisabled","useFormField","innerInputRef","useRef","composedRef","composeRefs","revealed","setRevealed","useState","capsLock","setCapsLock","internalValue","setInternalValue","useEffect","handleInput","useCallback","event","writeValueToInput","next","node","prototype","setter","_a","handleToggle","prev","detectCaps","handleKeyDown","handleKeyUp","handleBlur","agentHandle","useMemo","useAgentRegistration","iconSizeClass","toggleLabel","requirementResults","req","derivedStrength","satisfied","r","total","effectiveStrength","strengthKey","strengthText","jsxs","jsx","TextInput","EyeOff","Check","Circle","AlertTriangle","usePasswordRequirements","opts","minLength","uppercase","lowercase","digit","symbol","list","v"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,KAAK,KAAK,SAAQ,CAAE;AAC1D,GACMC,KAAMC,GAAiB,OAAOF,EAAU,GCVjCG,KAAwD;AAAA,EACnE,IAAI;AAAA,EACJ,cAAc,CAAC,aAAa;AAAA,EAC5B,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAC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AM,mBAAmB,KAAKA,CAAC;AAAA,IAAA,CACvC,GAGID;AAAA,EACT,GAAG,CAAC3D,GAAGsD,GAAWC,GAAWC,GAAWC,GAAOC,CAAM,CAAC;AACxD;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"use-password-requirements-C9vKBSVn.js","sources":["../../node_modules/lucide-react/dist/esm/icons/eye.js","../../src/components/password-input/password-input.agent.ts","../../src/components/password-input/password-input.tsx","../../src/components/password-input/use-password-requirements.ts"],"sourcesContent":["/**\n * @license lucide-react v1.8.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\",\n key: \"1nclc0\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Eye = createLucideIcon(\"eye\", __iconNode);\n\nexport { __iconNode, Eye as default };\n//# sourceMappingURL=eye.js.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — PasswordInput. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { PasswordInputHandle } from './password-input';\n\nexport const passwordInputAgent: AgentAdapter<PasswordInputHandle> = {\n id: 'password-input',\n capabilities: ['edit_inline'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.passwordInput.state.value',\n description:\n 'Current password value. Never log or persist this off-device.',\n read: (handle) => handle.getValue(),\n },\n isEmpty: {\n type: 'boolean',\n descriptionKey: 'ui.agent.passwordInput.state.isEmpty',\n description: 'Whether the input has no value.',\n read: (handle) => handle.getValue() === '',\n },\n isRevealed: {\n type: 'boolean',\n descriptionKey: 'ui.agent.passwordInput.state.isRevealed',\n description: 'Whether the password is currently shown in plain text.',\n read: (handle) => handle.isRevealed(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n descriptionKey: 'ui.agent.passwordInput.actions.setValue',\n description: 'Replace the password value.',\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n clear: {\n safety: 'destructive',\n descriptionKey: 'ui.agent.passwordInput.actions.clear',\n description: 'Empty the input. Loses any typed value.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n focus: {\n safety: 'read',\n descriptionKey: 'ui.agent.passwordInput.actions.focus',\n description: 'Move keyboard focus to the input.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n toggle_visibility: {\n safety: 'read',\n descriptionKey: 'ui.agent.passwordInput.actions.toggleVisibility',\n description: 'Toggle between masked and plain-text display.',\n invoke: (handle) => {\n handle.toggleVisibility();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'password-input',\n description: 'Marks the PasswordInput wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type FormEvent,\n type KeyboardEvent,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { AlertTriangle, Check, Circle, Eye, EyeOff } from 'lucide-react';\nimport { TextInput, type TextInputProps } from '../text-input';\nimport { useFormField } from '../form-field/form-field-context';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { useAgentRegistration } from '../../agent';\nimport { passwordInputAgent } from './password-input.agent';\n\n/** Agent-readiness curated handle for PasswordInput. */\nexport interface PasswordInputHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n clear: () => void;\n focus: () => void;\n isRevealed: () => boolean;\n toggleVisibility: () => void;\n}\n\ntype Strength = 0 | 1 | 2 | 3;\n\ntype SizeKey = NonNullable<TextInputProps['size']>;\n\nconst iconSizeClassBySize: Record<SizeKey, string> = {\n sm: 'ds:size-4',\n md: 'ds:size-[18px]',\n lg: 'ds:size-5',\n};\n\nconst toggleVariants = cva(\n [\n 'ds:absolute ds:inset-y-0 ds:end-0 ds:ps-2 ds:pe-3',\n 'ds:inline-flex ds:items-center ds:justify-center',\n 'ds:text-muted-foreground ds:hover:text-foreground',\n 'ds:bg-transparent ds:border-0 ds:cursor-pointer',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:min-w-[var(--min-target-size)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n ].join(' '),\n);\n\nconst strengthTrackVariants = cva(\n 'ds:h-1 ds:w-full ds:overflow-hidden ds:rounded-[var(--radius-full)] ds:bg-muted',\n);\n\nconst strengthBarVariants = cva(\n [\n 'ds:h-full ds:rounded-[var(--radius-full)]',\n 'ds:transition-all ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n ].join(' '),\n {\n variants: {\n level: {\n 0: 'ds:w-1/4 ds:bg-destructive',\n 1: 'ds:w-1/2 ds:bg-warning',\n 2: 'ds:w-3/4 ds:bg-success',\n 3: 'ds:w-full ds:bg-success',\n },\n },\n defaultVariants: { level: 0 },\n },\n);\n\nconst strengthLabelByLevel: Record<\n Strength,\n 'weak' | 'fair' | 'good' | 'strong'\n> = {\n 0: 'weak',\n 1: 'fair',\n 2: 'good',\n 3: 'strong',\n};\n\nconst requirementRowVariants = cva(\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-meta',\n {\n variants: {\n met: {\n true: 'ds:text-success',\n false: 'ds:text-muted-foreground',\n },\n },\n defaultVariants: { met: false },\n },\n);\n\n/**\n * One row in the live requirements checklist. Consumers either build\n * these inline or pull a pre-built set from `usePasswordRequirements`.\n */\nexport interface PasswordRequirement {\n /** Stable id — keyed render + a11y. */\n id: string;\n /** Already-translated label. The consumer owns the wording. */\n label: string;\n /** Predicate against the current value. Pure, runs on every keystroke. */\n test: (value: string) => boolean;\n}\n\nexport interface PasswordInputProps\n extends\n Omit<TextInputProps, 'type' | 'endAdornment' | 'startAdornment'>,\n VariantProps<typeof strengthBarVariants> {\n /** Callback when reveal state changes (for analytics). */\n onRevealChange?: (revealed: boolean) => void;\n /** Show the strength meter below the input. */\n showStrength?: boolean;\n /** Strength score: 0 = weak, 1 = fair, 2 = good, 3 = strong. */\n strength?: Strength;\n /**\n * Live requirements checklist rendered between the input and the\n * strength meter / caps-lock notice. Each row's predicate runs on\n * every keystroke and the row's `data-state` flips between `\"met\"`\n * and `\"unmet\"`. Backed by `aria-live=\"polite\"` so screen readers\n * announce each transition as a visually-hidden suffix span flips\n * between localised \"met\" / \"not yet met\" copy.\n *\n * Tip: hoist or `useMemo` the array — inlining it in JSX makes the\n * predicate-results memo bust every render. The kit's\n * `usePasswordRequirements` helper already does this.\n */\n requirements?: ReadonlyArray<PasswordRequirement>;\n /**\n * When `true` AND `strength` is not provided, derive a 0–3 score\n * from the proportion of `requirements` satisfied. Lets consumers\n * get the strength bar \"for free\" once they declare requirements.\n */\n deriveStrength?: boolean;\n /**\n * Autocomplete hint. Defaults to 'current-password'.\n * Use 'new-password' for registration/change-password forms.\n */\n autoComplete?: 'current-password' | 'new-password' | (string & {});\n}\n\nexport const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(\n (\n {\n onRevealChange,\n showStrength = false,\n strength,\n requirements,\n deriveStrength = false,\n autoComplete,\n size = 'md',\n disabled,\n name,\n id,\n onKeyDown,\n onKeyUp,\n onBlur,\n onInput,\n defaultValue,\n value,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const ctx = useFormField();\n const effectiveDisabled = ctx.disabled || disabled;\n\n const innerInputRef = useRef<HTMLInputElement | null>(null);\n const composedRef = composeRefs(ref, innerInputRef);\n\n const [revealed, setRevealed] = useState(false);\n const [capsLock, setCapsLock] = useState(false);\n\n // Track the current value internally so the requirements checklist\n // can re-evaluate predicates without forcing consumers to lift the\n // input into a controlled state. The seed is whichever of\n // `value` / `defaultValue` was passed; the `input` listener then\n // keeps it in sync on every keystroke (covers both controlled and\n // uncontrolled callers — for controlled callers we resync to the\n // incoming `value` prop in the effect below).\n const [internalValue, setInternalValue] = useState<string>(() => {\n if (typeof value === 'string') return value;\n if (typeof defaultValue === 'string') return defaultValue;\n return '';\n });\n\n useEffect(() => {\n if (typeof value === 'string') setInternalValue(value);\n }, [value]);\n\n const handleInput = useCallback(\n (event: FormEvent<HTMLInputElement>) => {\n setInternalValue(event.currentTarget.value);\n onInput?.(event);\n },\n [onInput],\n );\n\n const writeValueToInput = useCallback((next: string) => {\n const node = innerInputRef.current;\n if (!node) return;\n const prototype = Object.getPrototypeOf(node) as HTMLInputElement;\n const setter = Object.getOwnPropertyDescriptor(prototype, 'value')?.set;\n setter?.call(node, next);\n node.dispatchEvent(new Event('input', { bubbles: true }));\n node.dispatchEvent(new Event('change', { bubbles: true }));\n }, []);\n\n const handleToggle = useCallback(() => {\n setRevealed((prev) => {\n const next = !prev;\n onRevealChange?.(next);\n return next;\n });\n }, [onRevealChange]);\n\n const detectCaps = useCallback((event: KeyboardEvent<HTMLInputElement>) => {\n if (typeof event.getModifierState === 'function') {\n setCapsLock(event.getModifierState('CapsLock'));\n }\n }, []);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n detectCaps(event);\n onKeyDown?.(event);\n },\n [detectCaps, onKeyDown],\n );\n\n const handleKeyUp = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n detectCaps(event);\n onKeyUp?.(event);\n },\n [detectCaps, onKeyUp],\n );\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n setCapsLock(false);\n onBlur?.(event);\n },\n [onBlur],\n );\n\n const agentHandle = useMemo<PasswordInputHandle>(\n () => ({\n getValue: () => innerInputRef.current?.value ?? '',\n setValue: (next) => writeValueToInput(next),\n clear: () => writeValueToInput(''),\n focus: () => innerInputRef.current?.focus(),\n isRevealed: () => revealed,\n toggleVisibility: () => {\n setRevealed((prev) => {\n const next = !prev;\n onRevealChange?.(next);\n return next;\n });\n },\n }),\n [onRevealChange, revealed, writeValueToInput],\n );\n useAgentRegistration(passwordInputAgent, agentHandle, id);\n\n const iconSizeClass = iconSizeClassBySize[size];\n const toggleLabel = t(\n revealed ? 'inputs.password.toggleHide' : 'inputs.password.toggleShow',\n revealed ? 'Hide password' : 'Show password',\n );\n\n // Evaluate each requirement against the current value. Cheap by\n // construction — predicates are pure regex/length checks supplied\n // by the consumer; the kit doesn't memoise per-row because the\n // map is O(n) over a handful of rules and React would re-render\n // the row anyway when its `data-state` flips.\n const requirementResults = useMemo(\n () =>\n requirements?.map((req) => ({\n ...req,\n met: req.test(internalValue),\n })) ?? null,\n [requirements, internalValue],\n );\n\n // Derive a 0–3 score from the satisfied proportion when the\n // consumer hasn't supplied an explicit `strength`. Formula:\n // `floor((satisfied / total) * 4)`, clamped to 3 so a fully-met\n // checklist matches the explicit \"strong\" level. With zero\n // requirements we fall back to 0 — meaningless on its own but\n // never displayed since `showStrength` is what controls the bar.\n const derivedStrength: Strength = useMemo(() => {\n if (!deriveStrength || !requirementResults?.length) return 0;\n const satisfied = requirementResults.filter((r) => r.met).length;\n const total = requirementResults.length;\n return Math.min(3, Math.floor((satisfied / total) * 4)) as Strength;\n }, [deriveStrength, requirementResults]);\n\n const effectiveStrength: Strength =\n strength !== undefined ? strength : deriveStrength ? derivedStrength : 0;\n const strengthKey = strengthLabelByLevel[effectiveStrength];\n const strengthText = t(\n `inputs.password.strength.${strengthKey}`,\n strengthKey.charAt(0).toUpperCase() + strengthKey.slice(1),\n );\n\n return (\n <div\n data-component=\"password-input\"\n data-component-id={id}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <div className=\"ds:relative\">\n <TextInput\n ref={composedRef}\n id={id}\n type={revealed ? 'text' : 'password'}\n autoComplete={autoComplete ?? 'current-password'}\n name={name ?? 'password'}\n spellCheck={false}\n autoCapitalize=\"none\"\n autoCorrect=\"off\"\n size={size}\n disabled={effectiveDisabled}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onBlur={handleBlur}\n onInput={handleInput}\n value={value}\n defaultValue={defaultValue}\n endAdornment={\n <span aria-hidden=\"true\" className=\"ds:block ds:size-4\" />\n }\n className={className}\n {...rest}\n />\n <button\n type=\"button\"\n aria-pressed={revealed}\n aria-label={toggleLabel}\n disabled={effectiveDisabled}\n onClick={handleToggle}\n className={toggleVariants()}\n >\n {revealed ? (\n <EyeOff aria-hidden=\"true\" className={iconSizeClass} />\n ) : (\n <Eye aria-hidden=\"true\" className={iconSizeClass} />\n )}\n </button>\n </div>\n\n {requirementResults && requirementResults.length > 0 ? (\n // `role=\"list\"` / `role=\"listitem\"` are set explicitly even\n // though they're the implicit roles on <ul>/<li> — Safari\n // VoiceOver strips the implicit list role when CSS sets\n // `list-style: none` (which `ds:list-none` does), so the\n // redundancy is load-bearing for AT, not a lint nit.\n //\n // aria-live=\"polite\" announces transitions as the per-row\n // `.ds:sr-only` state suffix flips between \"met\" / \"not yet\n // met\". aria-live observes text-content mutations, not\n // attribute or class changes, so the data-state attribute\n // alone wouldn't trigger an announcement — the sr-only span\n // is the load-bearing piece for AT users.\n // eslint-disable-next-line jsx-a11y/no-redundant-roles\n <ul\n role=\"list\"\n aria-live=\"polite\"\n data-component=\"password-requirements\"\n className=\"ds:list-none ds:m-0 ds:p-0 ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\"\n >\n {requirementResults.map((req) => (\n // eslint-disable-next-line jsx-a11y/no-redundant-roles\n <li\n key={req.id}\n role=\"listitem\"\n data-state={req.met ? 'met' : 'unmet'}\n className={requirementRowVariants({ met: req.met })}\n >\n {req.met ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-3.5 ds:text-success ds:shrink-0\"\n />\n ) : (\n <Circle\n aria-hidden=\"true\"\n className=\"ds:size-3.5 ds:shrink-0\"\n />\n )}\n <span>{req.label}</span>\n <span className=\"ds:sr-only\">\n {' — '}\n {req.met\n ? t('inputs.password.requirements.met', 'met')\n : t('inputs.password.requirements.unmet', 'not yet met')}\n </span>\n </li>\n ))}\n </ul>\n ) : null}\n\n {capsLock ? (\n <span\n role=\"status\"\n aria-live=\"polite\"\n className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-meta ds:text-warning\"\n >\n <AlertTriangle aria-hidden=\"true\" className=\"ds:size-3.5\" />\n {t('inputs.password.capsLock', 'Caps Lock is on')}\n </span>\n ) : null}\n\n {showStrength ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <div\n role=\"progressbar\"\n aria-valuenow={effectiveStrength}\n aria-valuemin={0}\n aria-valuemax={3}\n aria-label={t(\n 'inputs.password.strengthLabel',\n 'Password strength',\n )}\n aria-valuetext={strengthText}\n className={strengthTrackVariants()}\n >\n <div\n className={strengthBarVariants({ level: effectiveStrength })}\n />\n </div>\n <span\n aria-hidden=\"true\"\n className=\"type-meta ds:text-muted-foreground\"\n >\n {strengthText}\n </span>\n </div>\n ) : null}\n </div>\n );\n },\n);\n\nPasswordInput.displayName = 'PasswordInput';\n","import { useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport type { PasswordRequirement } from './password-input';\n\nexport interface UsePasswordRequirementsOptions {\n /**\n * Minimum password length. When set, adds a \"length\" requirement.\n * Pass `12` (or whatever the server-side regex enforces) so the\n * inline checklist tells users the same rule they'll bounce off\n * server-side. When omitted, no length row is rendered.\n */\n minLength?: number;\n /** Adds an \"uppercase letter\" requirement when true. */\n uppercase?: boolean;\n /** Adds a \"lowercase letter\" requirement when true. */\n lowercase?: boolean;\n /** Adds a \"digit\" requirement when true. */\n digit?: boolean;\n /** Adds a \"symbol\" requirement when true. Matches anything outside `[A-Za-z0-9\\s]`. */\n symbol?: boolean;\n /**\n * Adds a \"no spaces\" requirement when true. Fails if the value\n * contains any whitespace character (space, tab, non-breaking space,\n * narrow no-break space, etc.). Useful to catch paste-time stray\n * whitespace from credential managers.\n */\n noSpaces?: boolean;\n}\n\n/**\n * Builds the common set of password requirements with i18n-resolved\n * labels. Designed for the AlfaDocs platform's patient-registration\n * server-side regex (`/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{12,}$/`) but\n * generic enough for any consumer.\n *\n * Each opt-in flag adds one row to the returned array, in a stable\n * visual order (length → uppercase → lowercase → digit → symbol → noSpaces).\n * Predicates are pure and run on every keystroke.\n *\n * @example\n * const requirements = usePasswordRequirements({\n * minLength: 12,\n * uppercase: true,\n * lowercase: true,\n * digit: true,\n * noSpaces: true,\n * });\n * <PasswordInput requirements={requirements} deriveStrength />\n */\nexport function usePasswordRequirements(\n opts: UsePasswordRequirementsOptions = {},\n): PasswordRequirement[] {\n const { t } = useTranslation();\n const { minLength, uppercase, lowercase, digit, symbol, noSpaces } = opts;\n\n return useMemo(() => {\n const list: PasswordRequirement[] = [];\n\n if (typeof minLength === 'number' && minLength > 0) {\n list.push({\n id: 'length',\n label: t('inputs.password.requirements.length', {\n count: minLength,\n defaultValue: `At least ${minLength} characters`,\n }),\n test: (v) => v.length >= minLength,\n });\n }\n\n if (uppercase) {\n list.push({\n id: 'uppercase',\n label: t(\n 'inputs.password.requirements.uppercase',\n 'One uppercase letter',\n ),\n test: (v) => /\\p{Lu}/u.test(v),\n });\n }\n\n if (lowercase) {\n list.push({\n id: 'lowercase',\n label: t(\n 'inputs.password.requirements.lowercase',\n 'One lowercase letter',\n ),\n test: (v) => /\\p{Ll}/u.test(v),\n });\n }\n\n if (digit) {\n list.push({\n id: 'digit',\n label: t('inputs.password.requirements.digit', 'One number'),\n test: (v) => /\\p{Nd}/u.test(v),\n });\n }\n\n if (symbol) {\n list.push({\n id: 'symbol',\n label: t('inputs.password.requirements.symbol', 'One symbol'),\n // Anything that isn't a letter, number, or whitespace counts.\n // `\\p{L}` + `\\p{N}` keep this Unicode-aware so non-Latin\n // alphabets (Arabic, Chinese, …) aren't mis-classified as\n // symbols.\n test: (v) => /[^\\p{L}\\p{N}\\s]/u.test(v),\n });\n }\n\n if (noSpaces) {\n list.push({\n id: 'no-spaces',\n label: t('inputs.password.requirements.noSpaces', 'No spaces'),\n // `\\s` covers ASCII space + tab + newline. The explicit\n // U+00A0 (non-breaking space) and U+202F (narrow no-break\n // space) catch the two paste-time characters credential\n // managers and rich-text editors most often inject without\n // the user noticing — those are NOT always in `\\s`.\n // Authored via hex escapes (not literal characters) so the\n // source file passes `no-irregular-whitespace`.\n test: (v) => !/[\\s\\u00A0\\u202F]/.test(v),\n });\n }\n\n return list;\n }, [t, minLength, uppercase, lowercase, digit, symbol, noSpaces]);\n}\n"],"names":["__iconNode","Eye","createLucideIcon","passwordInputAgent","handle","args","iconSizeClassBySize","toggleVariants","cva","strengthTrackVariants","strengthBarVariants","strengthLabelByLevel","requirementRowVariants","PasswordInput","forwardRef","onRevealChange","showStrength","strength","requirements","deriveStrength","autoComplete","size","disabled","name","id","onKeyDown","onKeyUp","onBlur","onInput","defaultValue","value","className","rest","ref","t","useTranslation","effectiveDisabled","useFormField","innerInputRef","useRef","composedRef","composeRefs","revealed","setRevealed","useState","capsLock","setCapsLock","internalValue","setInternalValue","useEffect","handleInput","useCallback","event","writeValueToInput","next","node","prototype","setter","_a","handleToggle","prev","detectCaps","handleKeyDown","handleKeyUp","handleBlur","agentHandle","useMemo","useAgentRegistration","iconSizeClass","toggleLabel","requirementResults","req","derivedStrength","satisfied","r","total","effectiveStrength","strengthKey","strengthText","jsxs","jsx","TextInput","EyeOff","Check","Circle","AlertTriangle","usePasswordRequirements","opts","minLength","uppercase","lowercase","digit","symbol","noSpaces","list","v"],"mappings":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,OAAO5D;AAAA,QACL;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,MAAM,CAAC6D,MAAM,WAAA,WAAA,GAAA,EAAU,KAAKA,CAAC;AAAA,IAAA,CAC9B,GAGCJ,KACFG,EAAK,KAAK;AAAA,MACR,IAAI;AAAA,MACJ,OAAO5D,EAAE,sCAAsC,YAAY;AAAA,MAC3D,MAAM,CAAC6D,MAAM,WAAA,WAAA,GAAA,EAAU,KAAKA,CAAC;AAAA,IAAA,CAC9B,GAGCH,KACFE,EAAK,KAAK;AAAA,MACR,IAAI;AAAA,MACJ,OAAO5D,EAAE,uCAAuC,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,MAK5D,MAAM,CAAC6D,MAAM,mBAAmB,KAAKA,CAAC;AAAA,IAAA,CACvC,GAGCF,KACFC,EAAK,KAAK;AAAA,MACR,IAAI;AAAA,MACJ,OAAO5D,EAAE,yCAAyC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQ7D,MAAM,CAAC6D,MAAM,CAAC,mBAAmB,KAAKA,CAAC;AAAA,IAAA,CACxC,GAGID;AAAA,EACT,GAAG,CAAC5D,GAAGsD,GAAWC,GAAWC,GAAWC,GAAOC,GAAQC,CAAQ,CAAC;AAClE;","x_google_ignoreList":[0]}
|
package/dist/agent-catalog.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "0.
|
|
3
|
+
"packageVersion": "0.19.0",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "component",
|
|
@@ -1430,6 +1430,36 @@
|
|
|
1430
1430
|
}
|
|
1431
1431
|
}
|
|
1432
1432
|
},
|
|
1433
|
+
{
|
|
1434
|
+
"kind": "component",
|
|
1435
|
+
"id": "email-input",
|
|
1436
|
+
"capabilities": [],
|
|
1437
|
+
"state": [
|
|
1438
|
+
{
|
|
1439
|
+
"name": "value",
|
|
1440
|
+
"type": "string",
|
|
1441
|
+
"description": "The current email address typed into the field."
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
"name": "isValid",
|
|
1445
|
+
"type": "boolean",
|
|
1446
|
+
"description": "True when the value is non-empty AND parses as a valid email per RFC 5322."
|
|
1447
|
+
}
|
|
1448
|
+
],
|
|
1449
|
+
"actions": [],
|
|
1450
|
+
"domHooks": {
|
|
1451
|
+
"root": {
|
|
1452
|
+
"attr": "data-component",
|
|
1453
|
+
"value": "email-input",
|
|
1454
|
+
"description": "Marks the EmailInput wrapper. The inline error element carries `role=\"alert\"` when validation fails."
|
|
1455
|
+
},
|
|
1456
|
+
"instanceId": {
|
|
1457
|
+
"attr": "data-component-id",
|
|
1458
|
+
"sourceProp": "id",
|
|
1459
|
+
"description": "Sourced from the id prop, when provided."
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
},
|
|
1433
1463
|
{
|
|
1434
1464
|
"kind": "component",
|
|
1435
1465
|
"id": "empty-state",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentAdapter } from '../../agent/types';
|
|
2
|
+
/**
|
|
3
|
+
* Curated agent handle for EmailInput. State stays scoped to the visible
|
|
4
|
+
* value + the kit-derived validity flag; never PHI (per PRS §Security).
|
|
5
|
+
*/
|
|
6
|
+
export interface EmailInputHandle {
|
|
7
|
+
/** Returns the current input value. */
|
|
8
|
+
getValue: () => string;
|
|
9
|
+
/** Returns whether the current value parses as a valid email (non-empty + RFC). */
|
|
10
|
+
isValid: () => boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const emailInputAgent: AgentAdapter<EmailInputHandle>;
|
|
13
|
+
//# sourceMappingURL=email-input.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-input.agent.d.ts","sourceRoot":"","sources":["../../../src/components/email-input/email-input.agent.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,mFAAmF;IACnF,OAAO,EAAE,MAAM,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,gBAAgB,CAgC1D,CAAC"}
|