@duskmoon-dev/core 1.19.9 → 1.19.11
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/README.md +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/datepicker.css +1 -1
- package/dist/components/file-input.css +1 -1
- package/dist/components/form-group.css +1 -1
- package/dist/components/form.css +1 -1
- package/dist/components/index.css +142 -230
- package/dist/components/input.css +1 -1
- package/dist/components/join.css +4 -4
- package/dist/components/otp-input.css +160 -2
- package/dist/components/radio.css +1 -1
- package/dist/components/select.css +1 -1
- package/dist/components/switch.css +1 -1
- package/dist/components/textarea.css +1 -1
- package/dist/components/toggle-switch.css +1 -1
- package/dist/components/toggle.css +1 -1
- package/dist/components/validator.css +1 -1
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/datepicker.js +1 -1
- package/dist/esm/components/file-input.js +1 -1
- package/dist/esm/components/form-group.js +1 -1
- package/dist/esm/components/form.js +1 -1
- package/dist/esm/components/input.js +1 -1
- package/dist/esm/components/join.js +4 -4
- package/dist/esm/components/otp-input.js +160 -2
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/switch.js +1 -1
- package/dist/esm/components/textarea.js +1 -1
- package/dist/esm/components/toggle-switch.js +1 -1
- package/dist/esm/components/toggle.js +1 -1
- package/dist/esm/components/validator.js +1 -1
- package/dist/index.css +142 -230
- package/dist/index.min.css +1 -1
- package/dist/standalone/duskmoonui-themes.css +1 -1
- package/dist/standalone/duskmoonui.css +144 -232
- package/dist/standalone/duskmoonui.js +5 -5
- package/dist/standalone/duskmoonui.mjs +5 -5
- package/package.json +1 -7
- package/dist/components/pin-input.css +0 -245
- package/dist/esm/components/pin-input.d.ts +0 -5
- package/dist/esm/components/pin-input.js +0 -254
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
51
51
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
52
52
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
53
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
53
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
54
54
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
55
55
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
56
56
|
|
|
@@ -361,8 +361,166 @@
|
|
|
361
361
|
}
|
|
362
362
|
@media (forced-colors: active) { .otp-code { background-image: none; } }
|
|
363
363
|
|
|
364
|
+
/* One native input over decorative cells, following the daisyUI OTP layout.
|
|
365
|
+
The spans must precede the input; their count matches maxlength/pattern. */
|
|
366
|
+
.otp-input:has(> .otp-code) {
|
|
367
|
+
--otp-count: 6;
|
|
368
|
+
--otp-cell: 2ch;
|
|
369
|
+
--otp-gap-ratio: 0.25;
|
|
370
|
+
--otp-gap: calc(var(--otp-cell) * var(--otp-gap-ratio));
|
|
371
|
+
--otp-stride: calc(var(--otp-cell) + var(--otp-gap));
|
|
372
|
+
--otp-width-units: calc(var(--otp-count) * (1 + var(--otp-gap-ratio)) + 0.25);
|
|
373
|
+
--otp-height: 3rem;
|
|
374
|
+
position: relative;
|
|
375
|
+
display: inline-flex;
|
|
376
|
+
flex-wrap: nowrap;
|
|
377
|
+
align-items: center;
|
|
378
|
+
gap: 0;
|
|
379
|
+
inline-size: calc(var(--otp-cell) * var(--otp-width-units) + 2px);
|
|
380
|
+
max-inline-size: 100%;
|
|
381
|
+
container-type: inline-size;
|
|
382
|
+
block-size: var(--otp-height);
|
|
383
|
+
font: 1.5rem / 1 ui-monospace, monospace;
|
|
384
|
+
direction: ltr;
|
|
385
|
+
color: var(--dm-validation-color, var(--color-on-surface));
|
|
386
|
+
border-radius: var(--radius-sm);
|
|
387
|
+
/* Reserve space for the trailing native caret and cell focus rings. */
|
|
388
|
+
clip-path: inset(-4px -4px -4px -4px);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/* Scale cells to the actual wrapper width, including inside narrow forms. */
|
|
392
|
+
.otp-input > :is(span, .otp-code), .otp-input:has(> .otp-code)::after {
|
|
393
|
+
--otp-cell: calc((100cqi - 2px) / var(--otp-width-units));
|
|
394
|
+
--otp-gap: calc(var(--otp-cell) * var(--otp-gap-ratio));
|
|
395
|
+
--otp-stride: calc(var(--otp-cell) + var(--otp-gap));
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.otp-input:has(> span:nth-child(1)) { --otp-count: 1; }
|
|
399
|
+
.otp-input:has(> span:nth-child(2)) { --otp-count: 2; }
|
|
400
|
+
.otp-input:has(> span:nth-child(3)) { --otp-count: 3; }
|
|
401
|
+
.otp-input:has(> span:nth-child(4)) { --otp-count: 4; }
|
|
402
|
+
.otp-input:has(> span:nth-child(5)) { --otp-count: 5; }
|
|
403
|
+
.otp-input:has(> span:nth-child(6)) { --otp-count: 6; }
|
|
404
|
+
.otp-input:has(> span:nth-child(7)) { --otp-count: 7; }
|
|
405
|
+
.otp-input:has(> span:nth-child(8)) { --otp-count: 8; }
|
|
406
|
+
|
|
407
|
+
.otp-input > span[aria-hidden="true"] {
|
|
408
|
+
position: absolute;
|
|
409
|
+
inset-block: 0;
|
|
410
|
+
inline-size: var(--otp-cell);
|
|
411
|
+
box-sizing: border-box;
|
|
412
|
+
background-color: var(--color-surface);
|
|
413
|
+
border: 1px solid currentColor;
|
|
414
|
+
border-radius: inherit;
|
|
415
|
+
pointer-events: none;
|
|
416
|
+
transition: background-color 150ms ease-in-out;
|
|
417
|
+
}
|
|
418
|
+
.otp-input > span:nth-child(1) { left: 0; }
|
|
419
|
+
.otp-input > span:nth-child(2) { left: var(--otp-stride); }
|
|
420
|
+
.otp-input > span:nth-child(3) { left: calc(var(--otp-stride) * 2); }
|
|
421
|
+
.otp-input > span:nth-child(4) { left: calc(var(--otp-stride) * 3); }
|
|
422
|
+
.otp-input > span:nth-child(5) { left: calc(var(--otp-stride) * 4); }
|
|
423
|
+
.otp-input > span:nth-child(6) { left: calc(var(--otp-stride) * 5); }
|
|
424
|
+
.otp-input > span:nth-child(7) { left: calc(var(--otp-stride) * 6); }
|
|
425
|
+
.otp-input > span:nth-child(8) { left: calc(var(--otp-stride) * 7); }
|
|
426
|
+
|
|
427
|
+
.otp-input > .otp-code {
|
|
428
|
+
position: relative;
|
|
429
|
+
z-index: 1;
|
|
430
|
+
field-sizing: content;
|
|
431
|
+
flex-shrink: 0;
|
|
432
|
+
inline-size: auto;
|
|
433
|
+
min-inline-size: 0;
|
|
434
|
+
max-inline-size: none;
|
|
435
|
+
block-size: 100%;
|
|
436
|
+
margin: 0;
|
|
437
|
+
padding: 0 0 0 calc((var(--otp-cell) - 1ch) / 2);
|
|
438
|
+
border: 0;
|
|
439
|
+
border-radius: 0;
|
|
440
|
+
font: inherit;
|
|
441
|
+
font-size: min(1em, var(--otp-cell));
|
|
442
|
+
letter-spacing: calc(var(--otp-stride) - 1ch);
|
|
443
|
+
color: inherit;
|
|
444
|
+
background: transparent;
|
|
445
|
+
outline: none;
|
|
446
|
+
box-shadow: none;
|
|
447
|
+
appearance: none;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/* Intrinsic input width follows the entered characters, positioning the next cell. */
|
|
451
|
+
.otp-input:has(> .otp-code)::after {
|
|
452
|
+
content: "";
|
|
453
|
+
flex-shrink: 0;
|
|
454
|
+
inline-size: var(--otp-cell);
|
|
455
|
+
block-size: var(--otp-height);
|
|
456
|
+
margin-inline-start: calc(-0.25 * var(--otp-cell));
|
|
457
|
+
border-radius: inherit;
|
|
458
|
+
pointer-events: none;
|
|
459
|
+
}
|
|
460
|
+
.otp-input:focus-within::after,
|
|
461
|
+
.otp-input:has(> .otp-code:focus) > span {
|
|
462
|
+
box-shadow: 0 0 0 3px color-mix(in oklch, currentColor 20%, transparent);
|
|
463
|
+
outline: 1px solid currentColor;
|
|
464
|
+
}
|
|
465
|
+
.otp-input:has(> .otp-code:valid:focus)::after { visibility: hidden; }
|
|
466
|
+
/* Cell indicators replace the reset's unlayered native focus outline. */
|
|
467
|
+
.otp-input > .otp-code:focus {
|
|
468
|
+
outline: none !important;
|
|
469
|
+
box-shadow: none !important;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.otp-input-xs:has(> .otp-code) { font-size: 1rem; --otp-height: 2rem; }
|
|
473
|
+
.otp-input-sm:has(> .otp-code) { font-size: 1.25rem; --otp-height: 2.5rem; }
|
|
474
|
+
.otp-input-md:has(> .otp-code) { font-size: 1.5rem; --otp-height: 3rem; }
|
|
475
|
+
.otp-input-lg:has(> .otp-code) { font-size: 1.75rem; --otp-height: 3.5rem; }
|
|
476
|
+
.otp-input-xl:has(> .otp-code) { font-size: 2rem; --otp-height: 4rem; }
|
|
477
|
+
.otp-input-joined:has(> .otp-code) { --otp-gap-ratio: 0; }
|
|
478
|
+
.otp-input-joined > span:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
|
|
479
|
+
.otp-input-joined > span:not(:nth-last-child(2)) { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
|
|
480
|
+
.otp-input-ghost > span { border-color: transparent; }
|
|
481
|
+
.otp-input-filled > span { background-color: var(--color-surface-container); }
|
|
482
|
+
.otp-input-underline > span { border-width: 0 0 1px; border-radius: 0; background-color: transparent; }
|
|
483
|
+
|
|
484
|
+
.otp-input-primary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-primary)); }
|
|
485
|
+
.otp-input-secondary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-secondary)); }
|
|
486
|
+
.otp-input-tertiary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-tertiary)); }
|
|
487
|
+
.otp-input-info:has(> .otp-code) { color: var(--dm-validation-color, var(--color-info)); }
|
|
488
|
+
.otp-input-success:has(> .otp-code) { color: var(--dm-validation-color, var(--color-success)); }
|
|
489
|
+
.otp-input-warning:has(> .otp-code) { color: var(--dm-validation-color, var(--color-warning)); }
|
|
490
|
+
.otp-input-error:has(> .otp-code) { color: var(--dm-validation-color, var(--color-error)); }
|
|
491
|
+
.otp-input-accent:has(> .otp-code) { color: var(--dm-validation-color, var(--color-accent)); }
|
|
492
|
+
.otp-input-neutral:has(> .otp-code) { color: var(--dm-validation-color, var(--color-neutral)); }
|
|
493
|
+
.otp-input-base:has(> .otp-code) { color: var(--dm-validation-color, var(--color-base-content)); }
|
|
494
|
+
|
|
495
|
+
.otp-input:has(> .otp-code:is(.validate :valid, .validate:valid, .validator.validator-success:user-valid):not([aria-invalid="true"]):not(:disabled)):not(:where(.form-group-error *, .form-control.error *)) {
|
|
496
|
+
--dm-validation-color: var(--color-success);
|
|
497
|
+
}
|
|
498
|
+
.otp-input:has(> .otp-code:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)),
|
|
499
|
+
:is(.form-group-error, .form-control.error) .otp-input {
|
|
500
|
+
--dm-validation-color: var(--color-error);
|
|
501
|
+
}
|
|
502
|
+
.otp-input:has(> .otp-code:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > span,
|
|
503
|
+
:is(.form-group-error, .form-control.error) .otp-input > span {
|
|
504
|
+
border-color: currentColor;
|
|
505
|
+
}
|
|
506
|
+
.otp-input:has(> .otp-code:disabled) {
|
|
507
|
+
opacity: 0.38;
|
|
508
|
+
cursor: not-allowed;
|
|
509
|
+
}
|
|
510
|
+
.otp-input > .otp-code:disabled { opacity: 1; }
|
|
511
|
+
|
|
512
|
+
/* Engines without content sizing retain a usable single native input. */
|
|
513
|
+
@supports not (field-sizing: content) {
|
|
514
|
+
.otp-input > .otp-code { inline-size: 100%; letter-spacing: normal; padding: 0.75rem; background-color: var(--color-surface); border: 1px solid currentColor; border-radius: inherit; }
|
|
515
|
+
.otp-input > span, .otp-input:has(> .otp-code)::after { display: none; }
|
|
516
|
+
.otp-input > .otp-code:focus { outline: 2px solid currentColor !important; outline-offset: 2px; }
|
|
517
|
+
}
|
|
518
|
+
@media (forced-colors: active) {
|
|
519
|
+
.otp-input:focus-within { outline: 2px solid Highlight; outline-offset: 2px; }
|
|
520
|
+
}
|
|
521
|
+
|
|
364
522
|
@media (prefers-reduced-motion: reduce) {
|
|
365
|
-
.otp-input-field {
|
|
523
|
+
.otp-input-field, .otp-input > span {
|
|
366
524
|
transition: none;
|
|
367
525
|
}
|
|
368
526
|
}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
51
51
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
52
52
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
53
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
53
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
54
54
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
55
55
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
56
56
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
51
51
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
52
52
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
53
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
53
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
54
54
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
55
55
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
56
56
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
51
51
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
52
52
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
53
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
53
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
54
54
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
55
55
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
56
56
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
51
51
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
52
52
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
53
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
53
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
54
54
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
55
55
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
56
56
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
51
51
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
52
52
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
53
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
53
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
54
54
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
55
55
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
56
56
|
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
56
56
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
57
57
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
58
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
58
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
59
59
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
60
60
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
61
61
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
51
51
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
52
52
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
53
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
53
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
54
54
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
55
55
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
56
56
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -55,7 +55,7 @@ export const css = `/**
|
|
|
55
55
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
56
56
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
57
57
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
58
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
58
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
59
59
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
60
60
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
61
61
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -25,20 +25,20 @@ export const css = `/**
|
|
|
25
25
|
z-index: 1;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
:is(.join, .join-horizontal) > .join-item:not(:first-child) {
|
|
28
|
+
:is(.join, .join-horizontal):not(.join-vertical) > .join-item:not(:first-child) {
|
|
29
29
|
margin-inline-start: -1px;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
:is(.join, .join-horizontal) > .join-item:not(:first-child):not(:last-child) {
|
|
32
|
+
:is(.join, .join-horizontal):not(.join-vertical) > .join-item:not(:first-child):not(:last-child) {
|
|
33
33
|
border-radius: 0;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
:is(.join, .join-horizontal) > .join-item:first-child:not(:last-child) {
|
|
36
|
+
:is(.join, .join-horizontal):not(.join-vertical) > .join-item:first-child:not(:last-child) {
|
|
37
37
|
border-start-end-radius: 0;
|
|
38
38
|
border-end-end-radius: 0;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
:is(.join, .join-horizontal) > .join-item:last-child:not(:first-child) {
|
|
41
|
+
:is(.join, .join-horizontal):not(.join-vertical) > .join-item:last-child:not(:first-child) {
|
|
42
42
|
border-start-start-radius: 0;
|
|
43
43
|
border-end-start-radius: 0;
|
|
44
44
|
}
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -362,8 +362,166 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
362
362
|
}
|
|
363
363
|
@media (forced-colors: active) { .otp-code { background-image: none; } }
|
|
364
364
|
|
|
365
|
+
/* One native input over decorative cells, following the daisyUI OTP layout.
|
|
366
|
+
The spans must precede the input; their count matches maxlength/pattern. */
|
|
367
|
+
.otp-input:has(> .otp-code) {
|
|
368
|
+
--otp-count: 6;
|
|
369
|
+
--otp-cell: 2ch;
|
|
370
|
+
--otp-gap-ratio: 0.25;
|
|
371
|
+
--otp-gap: calc(var(--otp-cell) * var(--otp-gap-ratio));
|
|
372
|
+
--otp-stride: calc(var(--otp-cell) + var(--otp-gap));
|
|
373
|
+
--otp-width-units: calc(var(--otp-count) * (1 + var(--otp-gap-ratio)) + 0.25);
|
|
374
|
+
--otp-height: 3rem;
|
|
375
|
+
position: relative;
|
|
376
|
+
display: inline-flex;
|
|
377
|
+
flex-wrap: nowrap;
|
|
378
|
+
align-items: center;
|
|
379
|
+
gap: 0;
|
|
380
|
+
inline-size: calc(var(--otp-cell) * var(--otp-width-units) + 2px);
|
|
381
|
+
max-inline-size: 100%;
|
|
382
|
+
container-type: inline-size;
|
|
383
|
+
block-size: var(--otp-height);
|
|
384
|
+
font: 1.5rem / 1 ui-monospace, monospace;
|
|
385
|
+
direction: ltr;
|
|
386
|
+
color: var(--dm-validation-color, var(--color-on-surface));
|
|
387
|
+
border-radius: var(--radius-sm);
|
|
388
|
+
/* Reserve space for the trailing native caret and cell focus rings. */
|
|
389
|
+
clip-path: inset(-4px -4px -4px -4px);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* Scale cells to the actual wrapper width, including inside narrow forms. */
|
|
393
|
+
.otp-input > :is(span, .otp-code), .otp-input:has(> .otp-code)::after {
|
|
394
|
+
--otp-cell: calc((100cqi - 2px) / var(--otp-width-units));
|
|
395
|
+
--otp-gap: calc(var(--otp-cell) * var(--otp-gap-ratio));
|
|
396
|
+
--otp-stride: calc(var(--otp-cell) + var(--otp-gap));
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.otp-input:has(> span:nth-child(1)) { --otp-count: 1; }
|
|
400
|
+
.otp-input:has(> span:nth-child(2)) { --otp-count: 2; }
|
|
401
|
+
.otp-input:has(> span:nth-child(3)) { --otp-count: 3; }
|
|
402
|
+
.otp-input:has(> span:nth-child(4)) { --otp-count: 4; }
|
|
403
|
+
.otp-input:has(> span:nth-child(5)) { --otp-count: 5; }
|
|
404
|
+
.otp-input:has(> span:nth-child(6)) { --otp-count: 6; }
|
|
405
|
+
.otp-input:has(> span:nth-child(7)) { --otp-count: 7; }
|
|
406
|
+
.otp-input:has(> span:nth-child(8)) { --otp-count: 8; }
|
|
407
|
+
|
|
408
|
+
.otp-input > span[aria-hidden="true"] {
|
|
409
|
+
position: absolute;
|
|
410
|
+
inset-block: 0;
|
|
411
|
+
inline-size: var(--otp-cell);
|
|
412
|
+
box-sizing: border-box;
|
|
413
|
+
background-color: var(--color-surface);
|
|
414
|
+
border: 1px solid currentColor;
|
|
415
|
+
border-radius: inherit;
|
|
416
|
+
pointer-events: none;
|
|
417
|
+
transition: background-color 150ms ease-in-out;
|
|
418
|
+
}
|
|
419
|
+
.otp-input > span:nth-child(1) { left: 0; }
|
|
420
|
+
.otp-input > span:nth-child(2) { left: var(--otp-stride); }
|
|
421
|
+
.otp-input > span:nth-child(3) { left: calc(var(--otp-stride) * 2); }
|
|
422
|
+
.otp-input > span:nth-child(4) { left: calc(var(--otp-stride) * 3); }
|
|
423
|
+
.otp-input > span:nth-child(5) { left: calc(var(--otp-stride) * 4); }
|
|
424
|
+
.otp-input > span:nth-child(6) { left: calc(var(--otp-stride) * 5); }
|
|
425
|
+
.otp-input > span:nth-child(7) { left: calc(var(--otp-stride) * 6); }
|
|
426
|
+
.otp-input > span:nth-child(8) { left: calc(var(--otp-stride) * 7); }
|
|
427
|
+
|
|
428
|
+
.otp-input > .otp-code {
|
|
429
|
+
position: relative;
|
|
430
|
+
z-index: 1;
|
|
431
|
+
field-sizing: content;
|
|
432
|
+
flex-shrink: 0;
|
|
433
|
+
inline-size: auto;
|
|
434
|
+
min-inline-size: 0;
|
|
435
|
+
max-inline-size: none;
|
|
436
|
+
block-size: 100%;
|
|
437
|
+
margin: 0;
|
|
438
|
+
padding: 0 0 0 calc((var(--otp-cell) - 1ch) / 2);
|
|
439
|
+
border: 0;
|
|
440
|
+
border-radius: 0;
|
|
441
|
+
font: inherit;
|
|
442
|
+
font-size: min(1em, var(--otp-cell));
|
|
443
|
+
letter-spacing: calc(var(--otp-stride) - 1ch);
|
|
444
|
+
color: inherit;
|
|
445
|
+
background: transparent;
|
|
446
|
+
outline: none;
|
|
447
|
+
box-shadow: none;
|
|
448
|
+
appearance: none;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/* Intrinsic input width follows the entered characters, positioning the next cell. */
|
|
452
|
+
.otp-input:has(> .otp-code)::after {
|
|
453
|
+
content: "";
|
|
454
|
+
flex-shrink: 0;
|
|
455
|
+
inline-size: var(--otp-cell);
|
|
456
|
+
block-size: var(--otp-height);
|
|
457
|
+
margin-inline-start: calc(-0.25 * var(--otp-cell));
|
|
458
|
+
border-radius: inherit;
|
|
459
|
+
pointer-events: none;
|
|
460
|
+
}
|
|
461
|
+
.otp-input:focus-within::after,
|
|
462
|
+
.otp-input:has(> .otp-code:focus) > span {
|
|
463
|
+
box-shadow: 0 0 0 3px color-mix(in oklch, currentColor 20%, transparent);
|
|
464
|
+
outline: 1px solid currentColor;
|
|
465
|
+
}
|
|
466
|
+
.otp-input:has(> .otp-code:valid:focus)::after { visibility: hidden; }
|
|
467
|
+
/* Cell indicators replace the reset's unlayered native focus outline. */
|
|
468
|
+
.otp-input > .otp-code:focus {
|
|
469
|
+
outline: none !important;
|
|
470
|
+
box-shadow: none !important;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.otp-input-xs:has(> .otp-code) { font-size: 1rem; --otp-height: 2rem; }
|
|
474
|
+
.otp-input-sm:has(> .otp-code) { font-size: 1.25rem; --otp-height: 2.5rem; }
|
|
475
|
+
.otp-input-md:has(> .otp-code) { font-size: 1.5rem; --otp-height: 3rem; }
|
|
476
|
+
.otp-input-lg:has(> .otp-code) { font-size: 1.75rem; --otp-height: 3.5rem; }
|
|
477
|
+
.otp-input-xl:has(> .otp-code) { font-size: 2rem; --otp-height: 4rem; }
|
|
478
|
+
.otp-input-joined:has(> .otp-code) { --otp-gap-ratio: 0; }
|
|
479
|
+
.otp-input-joined > span:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
|
|
480
|
+
.otp-input-joined > span:not(:nth-last-child(2)) { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
|
|
481
|
+
.otp-input-ghost > span { border-color: transparent; }
|
|
482
|
+
.otp-input-filled > span { background-color: var(--color-surface-container); }
|
|
483
|
+
.otp-input-underline > span { border-width: 0 0 1px; border-radius: 0; background-color: transparent; }
|
|
484
|
+
|
|
485
|
+
.otp-input-primary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-primary)); }
|
|
486
|
+
.otp-input-secondary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-secondary)); }
|
|
487
|
+
.otp-input-tertiary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-tertiary)); }
|
|
488
|
+
.otp-input-info:has(> .otp-code) { color: var(--dm-validation-color, var(--color-info)); }
|
|
489
|
+
.otp-input-success:has(> .otp-code) { color: var(--dm-validation-color, var(--color-success)); }
|
|
490
|
+
.otp-input-warning:has(> .otp-code) { color: var(--dm-validation-color, var(--color-warning)); }
|
|
491
|
+
.otp-input-error:has(> .otp-code) { color: var(--dm-validation-color, var(--color-error)); }
|
|
492
|
+
.otp-input-accent:has(> .otp-code) { color: var(--dm-validation-color, var(--color-accent)); }
|
|
493
|
+
.otp-input-neutral:has(> .otp-code) { color: var(--dm-validation-color, var(--color-neutral)); }
|
|
494
|
+
.otp-input-base:has(> .otp-code) { color: var(--dm-validation-color, var(--color-base-content)); }
|
|
495
|
+
|
|
496
|
+
.otp-input:has(> .otp-code:is(.validate :valid, .validate:valid, .validator.validator-success:user-valid):not([aria-invalid="true"]):not(:disabled)):not(:where(.form-group-error *, .form-control.error *)) {
|
|
497
|
+
--dm-validation-color: var(--color-success);
|
|
498
|
+
}
|
|
499
|
+
.otp-input:has(> .otp-code:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)),
|
|
500
|
+
:is(.form-group-error, .form-control.error) .otp-input {
|
|
501
|
+
--dm-validation-color: var(--color-error);
|
|
502
|
+
}
|
|
503
|
+
.otp-input:has(> .otp-code:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > span,
|
|
504
|
+
:is(.form-group-error, .form-control.error) .otp-input > span {
|
|
505
|
+
border-color: currentColor;
|
|
506
|
+
}
|
|
507
|
+
.otp-input:has(> .otp-code:disabled) {
|
|
508
|
+
opacity: 0.38;
|
|
509
|
+
cursor: not-allowed;
|
|
510
|
+
}
|
|
511
|
+
.otp-input > .otp-code:disabled { opacity: 1; }
|
|
512
|
+
|
|
513
|
+
/* Engines without content sizing retain a usable single native input. */
|
|
514
|
+
@supports not (field-sizing: content) {
|
|
515
|
+
.otp-input > .otp-code { inline-size: 100%; letter-spacing: normal; padding: 0.75rem; background-color: var(--color-surface); border: 1px solid currentColor; border-radius: inherit; }
|
|
516
|
+
.otp-input > span, .otp-input:has(> .otp-code)::after { display: none; }
|
|
517
|
+
.otp-input > .otp-code:focus { outline: 2px solid currentColor !important; outline-offset: 2px; }
|
|
518
|
+
}
|
|
519
|
+
@media (forced-colors: active) {
|
|
520
|
+
.otp-input:focus-within { outline: 2px solid Highlight; outline-offset: 2px; }
|
|
521
|
+
}
|
|
522
|
+
|
|
365
523
|
@media (prefers-reduced-motion: reduce) {
|
|
366
|
-
.otp-input-field {
|
|
524
|
+
.otp-input-field, .otp-input > span {
|
|
367
525
|
transition: none;
|
|
368
526
|
}
|
|
369
527
|
}
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|
|
@@ -56,7 +56,7 @@ export const css = `/**
|
|
|
56
56
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
57
57
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
58
58
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
59
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
59
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
60
60
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
61
61
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
62
62
|
|
|
@@ -51,7 +51,7 @@ export const css = `/** Opt-in native presentation. Applications own errors, mes
|
|
|
51
51
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
52
52
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
53
53
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
54
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
54
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
55
55
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
56
56
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
57
57
|
|