@duskmoon-dev/core 1.19.10 → 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 +138 -226
- package/dist/components/input.css +1 -1
- 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/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 +138 -226
- package/dist/index.min.css +1 -1
- package/dist/standalone/duskmoonui-themes.css +1 -1
- package/dist/standalone/duskmoonui.css +140 -228
- package/dist/standalone/duskmoonui.js +4 -4
- package/dist/standalone/duskmoonui.mjs +4 -4
- 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
package/README.md
CHANGED
|
@@ -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
|
|
package/dist/components/form.css
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
55
55
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
56
56
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
57
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
57
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
58
58
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
59
59
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
60
60
|
|
|
@@ -1381,7 +1381,7 @@
|
|
|
1381
1381
|
.validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
|
|
1382
1382
|
.validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
|
|
1383
1383
|
/* Keep OTP actions stationary when blur reveals an error during a click. */
|
|
1384
|
-
.otp-code ~ .validator-error { display: block; visibility: hidden; }
|
|
1384
|
+
:is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
|
|
1385
1385
|
:is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
|
|
1386
1386
|
:is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
|
|
1387
1387
|
|
|
@@ -10188,256 +10188,168 @@
|
|
|
10188
10188
|
}
|
|
10189
10189
|
@media (forced-colors: active) { .otp-code { background-image: none; } }
|
|
10190
10190
|
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
*
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
@layer components {
|
|
10204
|
-
/* Base PIN Container */
|
|
10205
|
-
.pin-input {
|
|
10191
|
+
/* One native input over decorative cells, following the daisyUI OTP layout.
|
|
10192
|
+
The spans must precede the input; their count matches maxlength/pattern. */
|
|
10193
|
+
.otp-input:has(> .otp-code) {
|
|
10194
|
+
--otp-count: 6;
|
|
10195
|
+
--otp-cell: 2ch;
|
|
10196
|
+
--otp-gap-ratio: 0.25;
|
|
10197
|
+
--otp-gap: calc(var(--otp-cell) * var(--otp-gap-ratio));
|
|
10198
|
+
--otp-stride: calc(var(--otp-cell) + var(--otp-gap));
|
|
10199
|
+
--otp-width-units: calc(var(--otp-count) * (1 + var(--otp-gap-ratio)) + 0.25);
|
|
10200
|
+
--otp-height: 3rem;
|
|
10201
|
+
position: relative;
|
|
10206
10202
|
display: inline-flex;
|
|
10203
|
+
flex-wrap: nowrap;
|
|
10207
10204
|
align-items: center;
|
|
10208
|
-
gap: 0
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
font-size: 1.5rem;
|
|
10217
|
-
font-weight: 600;
|
|
10218
|
-
text-align: center;
|
|
10219
|
-
color: var(--color-on-surface);
|
|
10220
|
-
background-color: var(--color-surface);
|
|
10221
|
-
border: 2px solid currentColor;
|
|
10205
|
+
gap: 0;
|
|
10206
|
+
inline-size: calc(var(--otp-cell) * var(--otp-width-units) + 2px);
|
|
10207
|
+
max-inline-size: 100%;
|
|
10208
|
+
container-type: inline-size;
|
|
10209
|
+
block-size: var(--otp-height);
|
|
10210
|
+
font: 1.5rem / 1 ui-monospace, monospace;
|
|
10211
|
+
direction: ltr;
|
|
10212
|
+
color: var(--dm-validation-color, var(--color-on-surface));
|
|
10222
10213
|
border-radius: var(--radius-sm);
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
caret-color: var(--color-primary);
|
|
10226
|
-
-webkit-text-security: disc;
|
|
10227
|
-
}
|
|
10228
|
-
|
|
10229
|
-
.pin-input-field::placeholder {
|
|
10230
|
-
color: var(--color-on-surface-variant);
|
|
10231
|
-
opacity: 0.3;
|
|
10232
|
-
}
|
|
10233
|
-
|
|
10234
|
-
.pin-input-field:hover:not(:disabled):not(:focus) {
|
|
10235
|
-
background-color: var(--color-surface-container);
|
|
10236
|
-
}
|
|
10237
|
-
|
|
10238
|
-
.pin-input-field:focus {
|
|
10239
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, currentColor 20%, transparent);
|
|
10240
|
-
}
|
|
10241
|
-
|
|
10242
|
-
.pin-input-field:disabled {
|
|
10243
|
-
opacity: 0.38;
|
|
10244
|
-
cursor: not-allowed;
|
|
10245
|
-
background-color: var(--color-surface-container);
|
|
10246
|
-
}
|
|
10247
|
-
|
|
10248
|
-
/* Show PIN (toggle visibility) */
|
|
10249
|
-
.pin-input-visible .pin-input-field {
|
|
10250
|
-
-webkit-text-security: none;
|
|
10251
|
-
}
|
|
10252
|
-
|
|
10253
|
-
/* Size Variants */
|
|
10254
|
-
.pin-input-sm .pin-input-field {
|
|
10255
|
-
width: 2.5rem;
|
|
10256
|
-
height: 3rem;
|
|
10257
|
-
font-size: 1.25rem;
|
|
10258
|
-
border-radius: var(--radius-xs);
|
|
10214
|
+
/* Reserve space for the trailing native caret and cell focus rings. */
|
|
10215
|
+
clip-path: inset(-4px -4px -4px -4px);
|
|
10259
10216
|
}
|
|
10260
10217
|
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10218
|
+
/* Scale cells to the actual wrapper width, including inside narrow forms. */
|
|
10219
|
+
.otp-input > :is(span, .otp-code), .otp-input:has(> .otp-code)::after {
|
|
10220
|
+
--otp-cell: calc((100cqi - 2px) / var(--otp-width-units));
|
|
10221
|
+
--otp-gap: calc(var(--otp-cell) * var(--otp-gap-ratio));
|
|
10222
|
+
--otp-stride: calc(var(--otp-cell) + var(--otp-gap));
|
|
10266
10223
|
}
|
|
10267
10224
|
|
|
10268
|
-
|
|
10269
|
-
.
|
|
10270
|
-
|
|
10271
|
-
}
|
|
10225
|
+
.otp-input:has(> span:nth-child(1)) { --otp-count: 1; }
|
|
10226
|
+
.otp-input:has(> span:nth-child(2)) { --otp-count: 2; }
|
|
10227
|
+
.otp-input:has(> span:nth-child(3)) { --otp-count: 3; }
|
|
10228
|
+
.otp-input:has(> span:nth-child(4)) { --otp-count: 4; }
|
|
10229
|
+
.otp-input:has(> span:nth-child(5)) { --otp-count: 5; }
|
|
10230
|
+
.otp-input:has(> span:nth-child(6)) { --otp-count: 6; }
|
|
10231
|
+
.otp-input:has(> span:nth-child(7)) { --otp-count: 7; }
|
|
10232
|
+
.otp-input:has(> span:nth-child(8)) { --otp-count: 8; }
|
|
10272
10233
|
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10234
|
+
.otp-input > span[aria-hidden="true"] {
|
|
10235
|
+
position: absolute;
|
|
10236
|
+
inset-block: 0;
|
|
10237
|
+
inline-size: var(--otp-cell);
|
|
10238
|
+
box-sizing: border-box;
|
|
10239
|
+
background-color: var(--color-surface);
|
|
10240
|
+
border: 1px solid currentColor;
|
|
10241
|
+
border-radius: inherit;
|
|
10242
|
+
pointer-events: none;
|
|
10243
|
+
transition: background-color 150ms ease-in-out;
|
|
10279
10244
|
}
|
|
10245
|
+
.otp-input > span:nth-child(1) { left: 0; }
|
|
10246
|
+
.otp-input > span:nth-child(2) { left: var(--otp-stride); }
|
|
10247
|
+
.otp-input > span:nth-child(3) { left: calc(var(--otp-stride) * 2); }
|
|
10248
|
+
.otp-input > span:nth-child(4) { left: calc(var(--otp-stride) * 3); }
|
|
10249
|
+
.otp-input > span:nth-child(5) { left: calc(var(--otp-stride) * 4); }
|
|
10250
|
+
.otp-input > span:nth-child(6) { left: calc(var(--otp-stride) * 5); }
|
|
10251
|
+
.otp-input > span:nth-child(7) { left: calc(var(--otp-stride) * 6); }
|
|
10252
|
+
.otp-input > span:nth-child(8) { left: calc(var(--otp-stride) * 7); }
|
|
10280
10253
|
|
|
10281
|
-
.
|
|
10282
|
-
|
|
10254
|
+
.otp-input > .otp-code {
|
|
10255
|
+
position: relative;
|
|
10256
|
+
z-index: 1;
|
|
10257
|
+
field-sizing: content;
|
|
10258
|
+
flex-shrink: 0;
|
|
10259
|
+
inline-size: auto;
|
|
10260
|
+
min-inline-size: 0;
|
|
10261
|
+
max-inline-size: none;
|
|
10262
|
+
block-size: 100%;
|
|
10263
|
+
margin: 0;
|
|
10264
|
+
padding: 0 0 0 calc((var(--otp-cell) - 1ch) / 2);
|
|
10265
|
+
border: 0;
|
|
10266
|
+
border-radius: 0;
|
|
10267
|
+
font: inherit;
|
|
10268
|
+
font-size: min(1em, var(--otp-cell));
|
|
10269
|
+
letter-spacing: calc(var(--otp-stride) - 1ch);
|
|
10270
|
+
color: inherit;
|
|
10271
|
+
background: transparent;
|
|
10272
|
+
outline: none;
|
|
10283
10273
|
box-shadow: none;
|
|
10274
|
+
appearance: none;
|
|
10284
10275
|
}
|
|
10285
10276
|
|
|
10286
|
-
/*
|
|
10287
|
-
.
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
height: 2.5rem;
|
|
10296
|
-
}
|
|
10297
|
-
|
|
10298
|
-
.pin-input-circle.pin-input-lg .pin-input-field {
|
|
10299
|
-
width: 3.5rem;
|
|
10300
|
-
height: 3.5rem;
|
|
10301
|
-
}
|
|
10302
|
-
|
|
10303
|
-
/* Dot Display (shows dots instead of numbers) */
|
|
10304
|
-
.pin-input-dots .pin-input-field {
|
|
10305
|
-
font-size: 2rem;
|
|
10306
|
-
letter-spacing: -0.25rem;
|
|
10307
|
-
}
|
|
10308
|
-
|
|
10309
|
-
/* Color Variants */
|
|
10310
|
-
.pin-input-primary .pin-input-field {
|
|
10311
|
-
color: var(--color-primary);
|
|
10312
|
-
}
|
|
10313
|
-
|
|
10314
|
-
.pin-input-primary .pin-input-field:focus {
|
|
10315
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-primary) 10%, transparent);
|
|
10316
|
-
}
|
|
10317
|
-
|
|
10318
|
-
.pin-input-secondary .pin-input-field {
|
|
10319
|
-
color: var(--color-secondary);
|
|
10320
|
-
}
|
|
10321
|
-
|
|
10322
|
-
.pin-input-secondary .pin-input-field:focus {
|
|
10323
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-secondary) 10%, transparent);
|
|
10324
|
-
}
|
|
10325
|
-
|
|
10326
|
-
.pin-input-tertiary .pin-input-field {
|
|
10327
|
-
color: var(--color-tertiary);
|
|
10328
|
-
}
|
|
10329
|
-
|
|
10330
|
-
.pin-input-tertiary .pin-input-field:focus {
|
|
10331
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-tertiary) 10%, transparent);
|
|
10332
|
-
}
|
|
10333
|
-
|
|
10334
|
-
.pin-input-info .pin-input-field {
|
|
10335
|
-
color: var(--color-info);
|
|
10336
|
-
}
|
|
10337
|
-
|
|
10338
|
-
.pin-input-info .pin-input-field:focus {
|
|
10339
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-info) 10%, transparent);
|
|
10340
|
-
}
|
|
10341
|
-
|
|
10342
|
-
.pin-input-success .pin-input-field {
|
|
10343
|
-
color: var(--color-success);
|
|
10344
|
-
}
|
|
10345
|
-
|
|
10346
|
-
.pin-input-success .pin-input-field:focus {
|
|
10347
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-success) 10%, transparent);
|
|
10348
|
-
}
|
|
10349
|
-
|
|
10350
|
-
.pin-input-warning .pin-input-field {
|
|
10351
|
-
color: var(--color-warning);
|
|
10352
|
-
}
|
|
10353
|
-
|
|
10354
|
-
.pin-input-warning .pin-input-field:focus {
|
|
10355
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-warning) 10%, transparent);
|
|
10356
|
-
}
|
|
10357
|
-
|
|
10358
|
-
.pin-input-error .pin-input-field {
|
|
10359
|
-
color: var(--color-error);
|
|
10360
|
-
animation: pin-shake 300ms ease-in-out;
|
|
10361
|
-
}
|
|
10362
|
-
|
|
10363
|
-
.pin-input-error .pin-input-field:focus {
|
|
10364
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-error) 10%, transparent);
|
|
10365
|
-
}
|
|
10366
|
-
|
|
10367
|
-
.pin-input-accent .pin-input-field {
|
|
10368
|
-
color: var(--color-accent);
|
|
10369
|
-
}
|
|
10370
|
-
|
|
10371
|
-
.pin-input-accent .pin-input-field:focus {
|
|
10372
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-accent) 10%, transparent);
|
|
10373
|
-
}
|
|
10374
|
-
|
|
10375
|
-
.pin-input-neutral .pin-input-field {
|
|
10376
|
-
color: var(--color-neutral);
|
|
10377
|
-
}
|
|
10378
|
-
|
|
10379
|
-
.pin-input-neutral .pin-input-field:focus {
|
|
10380
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-neutral) 10%, transparent);
|
|
10381
|
-
}
|
|
10382
|
-
|
|
10383
|
-
.pin-input-base .pin-input-field {
|
|
10384
|
-
color: var(--color-base-content);
|
|
10385
|
-
}
|
|
10386
|
-
|
|
10387
|
-
.pin-input-base .pin-input-field:focus {
|
|
10388
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-base-content) 10%, transparent);
|
|
10389
|
-
}
|
|
10390
|
-
|
|
10391
|
-
@keyframes pin-shake {
|
|
10392
|
-
0%, 100% { transform: translateX(0); }
|
|
10393
|
-
20%, 60% { transform: translateX(-4px); }
|
|
10394
|
-
40%, 80% { transform: translateX(4px); }
|
|
10395
|
-
}
|
|
10396
|
-
|
|
10397
|
-
/* Ghost Variant */
|
|
10398
|
-
.pin-input-ghost .pin-input-field {
|
|
10399
|
-
background-color: transparent;
|
|
10400
|
-
border-color: transparent;
|
|
10277
|
+
/* Intrinsic input width follows the entered characters, positioning the next cell. */
|
|
10278
|
+
.otp-input:has(> .otp-code)::after {
|
|
10279
|
+
content: "";
|
|
10280
|
+
flex-shrink: 0;
|
|
10281
|
+
inline-size: var(--otp-cell);
|
|
10282
|
+
block-size: var(--otp-height);
|
|
10283
|
+
margin-inline-start: calc(-0.25 * var(--otp-cell));
|
|
10284
|
+
border-radius: inherit;
|
|
10285
|
+
pointer-events: none;
|
|
10401
10286
|
}
|
|
10402
|
-
|
|
10403
|
-
.
|
|
10404
|
-
background-color: var(--color-surface-container);
|
|
10405
|
-
border-color: transparent;
|
|
10287
|
+
.otp-input:focus-within::after,
|
|
10288
|
+
.otp-input:has(> .otp-code:focus) > span {
|
|
10406
10289
|
box-shadow: 0 0 0 3px color-mix(in oklch, currentColor 20%, transparent);
|
|
10290
|
+
outline: 1px solid currentColor;
|
|
10291
|
+
}
|
|
10292
|
+
.otp-input:has(> .otp-code:valid:focus)::after { visibility: hidden; }
|
|
10293
|
+
/* Cell indicators replace the reset's unlayered native focus outline. */
|
|
10294
|
+
.otp-input > .otp-code:focus {
|
|
10295
|
+
outline: none !important;
|
|
10296
|
+
box-shadow: none !important;
|
|
10297
|
+
}
|
|
10298
|
+
|
|
10299
|
+
.otp-input-xs:has(> .otp-code) { font-size: 1rem; --otp-height: 2rem; }
|
|
10300
|
+
.otp-input-sm:has(> .otp-code) { font-size: 1.25rem; --otp-height: 2.5rem; }
|
|
10301
|
+
.otp-input-md:has(> .otp-code) { font-size: 1.5rem; --otp-height: 3rem; }
|
|
10302
|
+
.otp-input-lg:has(> .otp-code) { font-size: 1.75rem; --otp-height: 3.5rem; }
|
|
10303
|
+
.otp-input-xl:has(> .otp-code) { font-size: 2rem; --otp-height: 4rem; }
|
|
10304
|
+
.otp-input-joined:has(> .otp-code) { --otp-gap-ratio: 0; }
|
|
10305
|
+
.otp-input-joined > span:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
|
|
10306
|
+
.otp-input-joined > span:not(:nth-last-child(2)) { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
|
|
10307
|
+
.otp-input-ghost > span { border-color: transparent; }
|
|
10308
|
+
.otp-input-filled > span { background-color: var(--color-surface-container); }
|
|
10309
|
+
.otp-input-underline > span { border-width: 0 0 1px; border-radius: 0; background-color: transparent; }
|
|
10310
|
+
|
|
10311
|
+
.otp-input-primary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-primary)); }
|
|
10312
|
+
.otp-input-secondary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-secondary)); }
|
|
10313
|
+
.otp-input-tertiary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-tertiary)); }
|
|
10314
|
+
.otp-input-info:has(> .otp-code) { color: var(--dm-validation-color, var(--color-info)); }
|
|
10315
|
+
.otp-input-success:has(> .otp-code) { color: var(--dm-validation-color, var(--color-success)); }
|
|
10316
|
+
.otp-input-warning:has(> .otp-code) { color: var(--dm-validation-color, var(--color-warning)); }
|
|
10317
|
+
.otp-input-error:has(> .otp-code) { color: var(--dm-validation-color, var(--color-error)); }
|
|
10318
|
+
.otp-input-accent:has(> .otp-code) { color: var(--dm-validation-color, var(--color-accent)); }
|
|
10319
|
+
.otp-input-neutral:has(> .otp-code) { color: var(--dm-validation-color, var(--color-neutral)); }
|
|
10320
|
+
.otp-input-base:has(> .otp-code) { color: var(--dm-validation-color, var(--color-base-content)); }
|
|
10321
|
+
|
|
10322
|
+
.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 *)) {
|
|
10323
|
+
--dm-validation-color: var(--color-success);
|
|
10407
10324
|
}
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
display: flex;
|
|
10412
|
-
flex-direction: column;
|
|
10413
|
-
gap: 0.5rem;
|
|
10325
|
+
.otp-input:has(> .otp-code:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)),
|
|
10326
|
+
:is(.form-group-error, .form-control.error) .otp-input {
|
|
10327
|
+
--dm-validation-color: var(--color-error);
|
|
10414
10328
|
}
|
|
10415
|
-
|
|
10416
|
-
.
|
|
10417
|
-
|
|
10418
|
-
font-weight: 500;
|
|
10419
|
-
color: var(--color-on-surface);
|
|
10329
|
+
.otp-input:has(> .otp-code:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > span,
|
|
10330
|
+
:is(.form-group-error, .form-control.error) .otp-input > span {
|
|
10331
|
+
border-color: currentColor;
|
|
10420
10332
|
}
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
color: var(--color-on-surface-variant);
|
|
10333
|
+
.otp-input:has(> .otp-code:disabled) {
|
|
10334
|
+
opacity: 0.38;
|
|
10335
|
+
cursor: not-allowed;
|
|
10425
10336
|
}
|
|
10337
|
+
.otp-input > .otp-code:disabled { opacity: 1; }
|
|
10426
10338
|
|
|
10427
|
-
.
|
|
10428
|
-
|
|
10429
|
-
color: var(--color-
|
|
10339
|
+
/* Engines without content sizing retain a usable single native input. */
|
|
10340
|
+
@supports not (field-sizing: content) {
|
|
10341
|
+
.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; }
|
|
10342
|
+
.otp-input > span, .otp-input:has(> .otp-code)::after { display: none; }
|
|
10343
|
+
.otp-input > .otp-code:focus { outline: 2px solid currentColor !important; outline-offset: 2px; }
|
|
10344
|
+
}
|
|
10345
|
+
@media (forced-colors: active) {
|
|
10346
|
+
.otp-input:focus-within { outline: 2px solid Highlight; outline-offset: 2px; }
|
|
10430
10347
|
}
|
|
10431
10348
|
|
|
10432
|
-
/* Reduce Motion */
|
|
10433
10349
|
@media (prefers-reduced-motion: reduce) {
|
|
10434
|
-
.
|
|
10350
|
+
.otp-input-field, .otp-input > span {
|
|
10435
10351
|
transition: none;
|
|
10436
10352
|
}
|
|
10437
|
-
|
|
10438
|
-
.pin-input-error .pin-input-field {
|
|
10439
|
-
animation: none;
|
|
10440
|
-
}
|
|
10441
10353
|
}
|
|
10442
10354
|
}
|
|
10443
10355
|
|
|
@@ -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
|
|
|
@@ -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
|
|