@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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/components/checkbox.css +1 -1
  3. package/dist/components/datepicker.css +1 -1
  4. package/dist/components/file-input.css +1 -1
  5. package/dist/components/form-group.css +1 -1
  6. package/dist/components/form.css +1 -1
  7. package/dist/components/index.css +142 -230
  8. package/dist/components/input.css +1 -1
  9. package/dist/components/join.css +4 -4
  10. package/dist/components/otp-input.css +160 -2
  11. package/dist/components/radio.css +1 -1
  12. package/dist/components/select.css +1 -1
  13. package/dist/components/switch.css +1 -1
  14. package/dist/components/textarea.css +1 -1
  15. package/dist/components/toggle-switch.css +1 -1
  16. package/dist/components/toggle.css +1 -1
  17. package/dist/components/validator.css +1 -1
  18. package/dist/esm/components/checkbox.js +1 -1
  19. package/dist/esm/components/datepicker.js +1 -1
  20. package/dist/esm/components/file-input.js +1 -1
  21. package/dist/esm/components/form-group.js +1 -1
  22. package/dist/esm/components/form.js +1 -1
  23. package/dist/esm/components/input.js +1 -1
  24. package/dist/esm/components/join.js +4 -4
  25. package/dist/esm/components/otp-input.js +160 -2
  26. package/dist/esm/components/radio.js +1 -1
  27. package/dist/esm/components/select.js +1 -1
  28. package/dist/esm/components/switch.js +1 -1
  29. package/dist/esm/components/textarea.js +1 -1
  30. package/dist/esm/components/toggle-switch.js +1 -1
  31. package/dist/esm/components/toggle.js +1 -1
  32. package/dist/esm/components/validator.js +1 -1
  33. package/dist/index.css +142 -230
  34. package/dist/index.min.css +1 -1
  35. package/dist/standalone/duskmoonui-themes.css +1 -1
  36. package/dist/standalone/duskmoonui.css +144 -232
  37. package/dist/standalone/duskmoonui.js +5 -5
  38. package/dist/standalone/duskmoonui.mjs +5 -5
  39. package/package.json +1 -7
  40. package/dist/components/pin-input.css +0 -245
  41. package/dist/esm/components/pin-input.d.ts +0 -5
  42. package/dist/esm/components/pin-input.js +0 -254
package/dist/index.css CHANGED
@@ -2355,7 +2355,7 @@ html {
2355
2355
  .validator-hint { font-size: 0.75rem; color: var(--color-on-surface-variant); }
2356
2356
  .validator-error { display: none; font-size: 0.75rem; color: var(--color-error); }
2357
2357
  /* Keep OTP actions stationary when blur reveals an error during a click. */
2358
- .otp-code ~ .validator-error { display: block; visibility: hidden; }
2358
+ :is(.otp-code, .otp-input) ~ .validator-error { display: block; visibility: hidden; }
2359
2359
  :is(.form-group, .form-control):has(:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > .validator-error,
2360
2360
  :is(.form-group-error, .form-control.error) > .validator-error { display: block; visibility: visible; }
2361
2361
 
@@ -11162,256 +11162,168 @@ html {
11162
11162
  }
11163
11163
  @media (forced-colors: active) { .otp-code { background-image: none; } }
11164
11164
 
11165
- @media (prefers-reduced-motion: reduce) {
11166
- .otp-input-field {
11167
- transition: none;
11168
- }
11169
- }
11170
- }
11171
-
11172
- /**
11173
- * PIN Input Component Styles
11174
- * DuskMoonUI - Secure PIN/password entry input
11175
- */
11176
-
11177
- @layer components {
11178
- /* Base PIN Container */
11179
- .pin-input {
11165
+ /* One native input over decorative cells, following the daisyUI OTP layout.
11166
+ The spans must precede the input; their count matches maxlength/pattern. */
11167
+ .otp-input:has(> .otp-code) {
11168
+ --otp-count: 6;
11169
+ --otp-cell: 2ch;
11170
+ --otp-gap-ratio: 0.25;
11171
+ --otp-gap: calc(var(--otp-cell) * var(--otp-gap-ratio));
11172
+ --otp-stride: calc(var(--otp-cell) + var(--otp-gap));
11173
+ --otp-width-units: calc(var(--otp-count) * (1 + var(--otp-gap-ratio)) + 0.25);
11174
+ --otp-height: 3rem;
11175
+ position: relative;
11180
11176
  display: inline-flex;
11177
+ flex-wrap: nowrap;
11181
11178
  align-items: center;
11182
- gap: 0.5rem;
11183
- }
11184
-
11185
- /* PIN Input Field */
11186
- .pin-input-field {
11187
- width: 3rem;
11188
- height: 3.5rem;
11189
- padding: 0;
11190
- font-size: 1.5rem;
11191
- font-weight: 600;
11192
- text-align: center;
11193
- color: var(--color-on-surface);
11194
- background-color: var(--color-surface);
11195
- border: 2px solid currentColor;
11179
+ gap: 0;
11180
+ inline-size: calc(var(--otp-cell) * var(--otp-width-units) + 2px);
11181
+ max-inline-size: 100%;
11182
+ container-type: inline-size;
11183
+ block-size: var(--otp-height);
11184
+ font: 1.5rem / 1 ui-monospace, monospace;
11185
+ direction: ltr;
11186
+ color: var(--dm-validation-color, var(--color-on-surface));
11196
11187
  border-radius: var(--radius-sm);
11197
- outline: none;
11198
- transition: border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;
11199
- caret-color: var(--color-primary);
11200
- -webkit-text-security: disc;
11201
- }
11202
-
11203
- .pin-input-field::placeholder {
11204
- color: var(--color-on-surface-variant);
11205
- opacity: 0.3;
11206
- }
11207
-
11208
- .pin-input-field:hover:not(:disabled):not(:focus) {
11209
- background-color: var(--color-surface-container);
11210
- }
11211
-
11212
- .pin-input-field:focus {
11213
- box-shadow: 0 0 0 3px color-mix(in oklch, currentColor 20%, transparent);
11214
- }
11215
-
11216
- .pin-input-field:disabled {
11217
- opacity: 0.38;
11218
- cursor: not-allowed;
11219
- background-color: var(--color-surface-container);
11220
- }
11221
-
11222
- /* Show PIN (toggle visibility) */
11223
- .pin-input-visible .pin-input-field {
11224
- -webkit-text-security: none;
11225
- }
11226
-
11227
- /* Size Variants */
11228
- .pin-input-sm .pin-input-field {
11229
- width: 2.5rem;
11230
- height: 3rem;
11231
- font-size: 1.25rem;
11232
- border-radius: var(--radius-xs);
11188
+ /* Reserve space for the trailing native caret and cell focus rings. */
11189
+ clip-path: inset(-4px -4px -4px -4px);
11233
11190
  }
11234
11191
 
11235
- .pin-input-lg .pin-input-field {
11236
- width: 3.5rem;
11237
- height: 4rem;
11238
- font-size: 1.75rem;
11239
- border-radius: var(--radius-sm);
11192
+ /* Scale cells to the actual wrapper width, including inside narrow forms. */
11193
+ .otp-input > :is(span, .otp-code), .otp-input:has(> .otp-code)::after {
11194
+ --otp-cell: calc((100cqi - 2px) / var(--otp-width-units));
11195
+ --otp-gap: calc(var(--otp-cell) * var(--otp-gap-ratio));
11196
+ --otp-stride: calc(var(--otp-cell) + var(--otp-gap));
11240
11197
  }
11241
11198
 
11242
- /* Compact Gap */
11243
- .pin-input-compact {
11244
- gap: 0.25rem;
11245
- }
11199
+ .otp-input:has(> span:nth-child(1)) { --otp-count: 1; }
11200
+ .otp-input:has(> span:nth-child(2)) { --otp-count: 2; }
11201
+ .otp-input:has(> span:nth-child(3)) { --otp-count: 3; }
11202
+ .otp-input:has(> span:nth-child(4)) { --otp-count: 4; }
11203
+ .otp-input:has(> span:nth-child(5)) { --otp-count: 5; }
11204
+ .otp-input:has(> span:nth-child(6)) { --otp-count: 6; }
11205
+ .otp-input:has(> span:nth-child(7)) { --otp-count: 7; }
11206
+ .otp-input:has(> span:nth-child(8)) { --otp-count: 8; }
11246
11207
 
11247
- /* Filled Variant */
11248
- .pin-input-filled .pin-input-field {
11249
- background-color: var(--color-surface-container);
11250
- border: none;
11251
- border-bottom: 2px solid var(--color-outline);
11252
- border-radius: var(--radius-sm) var(--radius-sm) 0 0;
11208
+ .otp-input > span[aria-hidden="true"] {
11209
+ position: absolute;
11210
+ inset-block: 0;
11211
+ inline-size: var(--otp-cell);
11212
+ box-sizing: border-box;
11213
+ background-color: var(--color-surface);
11214
+ border: 1px solid currentColor;
11215
+ border-radius: inherit;
11216
+ pointer-events: none;
11217
+ transition: background-color 150ms ease-in-out;
11253
11218
  }
11219
+ .otp-input > span:nth-child(1) { left: 0; }
11220
+ .otp-input > span:nth-child(2) { left: var(--otp-stride); }
11221
+ .otp-input > span:nth-child(3) { left: calc(var(--otp-stride) * 2); }
11222
+ .otp-input > span:nth-child(4) { left: calc(var(--otp-stride) * 3); }
11223
+ .otp-input > span:nth-child(5) { left: calc(var(--otp-stride) * 4); }
11224
+ .otp-input > span:nth-child(6) { left: calc(var(--otp-stride) * 5); }
11225
+ .otp-input > span:nth-child(7) { left: calc(var(--otp-stride) * 6); }
11226
+ .otp-input > span:nth-child(8) { left: calc(var(--otp-stride) * 7); }
11254
11227
 
11255
- .pin-input-filled .pin-input-field:focus {
11256
- border-bottom-color: var(--color-primary);
11228
+ .otp-input > .otp-code {
11229
+ position: relative;
11230
+ z-index: 1;
11231
+ field-sizing: content;
11232
+ flex-shrink: 0;
11233
+ inline-size: auto;
11234
+ min-inline-size: 0;
11235
+ max-inline-size: none;
11236
+ block-size: 100%;
11237
+ margin: 0;
11238
+ padding: 0 0 0 calc((var(--otp-cell) - 1ch) / 2);
11239
+ border: 0;
11240
+ border-radius: 0;
11241
+ font: inherit;
11242
+ font-size: min(1em, var(--otp-cell));
11243
+ letter-spacing: calc(var(--otp-stride) - 1ch);
11244
+ color: inherit;
11245
+ background: transparent;
11246
+ outline: none;
11257
11247
  box-shadow: none;
11248
+ appearance: none;
11258
11249
  }
11259
11250
 
11260
- /* Circle Variant */
11261
- .pin-input-circle .pin-input-field {
11262
- width: 3rem;
11263
- height: 3rem;
11264
- border-radius: var(--radius-full);
11265
- }
11266
-
11267
- .pin-input-circle.pin-input-sm .pin-input-field {
11268
- width: 2.5rem;
11269
- height: 2.5rem;
11270
- }
11271
-
11272
- .pin-input-circle.pin-input-lg .pin-input-field {
11273
- width: 3.5rem;
11274
- height: 3.5rem;
11275
- }
11276
-
11277
- /* Dot Display (shows dots instead of numbers) */
11278
- .pin-input-dots .pin-input-field {
11279
- font-size: 2rem;
11280
- letter-spacing: -0.25rem;
11281
- }
11282
-
11283
- /* Color Variants */
11284
- .pin-input-primary .pin-input-field {
11285
- color: var(--color-primary);
11286
- }
11287
-
11288
- .pin-input-primary .pin-input-field:focus {
11289
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-primary) 10%, transparent);
11290
- }
11291
-
11292
- .pin-input-secondary .pin-input-field {
11293
- color: var(--color-secondary);
11294
- }
11295
-
11296
- .pin-input-secondary .pin-input-field:focus {
11297
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-secondary) 10%, transparent);
11298
- }
11299
-
11300
- .pin-input-tertiary .pin-input-field {
11301
- color: var(--color-tertiary);
11302
- }
11303
-
11304
- .pin-input-tertiary .pin-input-field:focus {
11305
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-tertiary) 10%, transparent);
11306
- }
11307
-
11308
- .pin-input-info .pin-input-field {
11309
- color: var(--color-info);
11310
- }
11311
-
11312
- .pin-input-info .pin-input-field:focus {
11313
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-info) 10%, transparent);
11314
- }
11315
-
11316
- .pin-input-success .pin-input-field {
11317
- color: var(--color-success);
11318
- }
11319
-
11320
- .pin-input-success .pin-input-field:focus {
11321
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-success) 10%, transparent);
11322
- }
11323
-
11324
- .pin-input-warning .pin-input-field {
11325
- color: var(--color-warning);
11326
- }
11327
-
11328
- .pin-input-warning .pin-input-field:focus {
11329
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-warning) 10%, transparent);
11330
- }
11331
-
11332
- .pin-input-error .pin-input-field {
11333
- color: var(--color-error);
11334
- animation: pin-shake 300ms ease-in-out;
11335
- }
11336
-
11337
- .pin-input-error .pin-input-field:focus {
11338
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-error) 10%, transparent);
11339
- }
11340
-
11341
- .pin-input-accent .pin-input-field {
11342
- color: var(--color-accent);
11343
- }
11344
-
11345
- .pin-input-accent .pin-input-field:focus {
11346
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-accent) 10%, transparent);
11347
- }
11348
-
11349
- .pin-input-neutral .pin-input-field {
11350
- color: var(--color-neutral);
11351
- }
11352
-
11353
- .pin-input-neutral .pin-input-field:focus {
11354
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-neutral) 10%, transparent);
11355
- }
11356
-
11357
- .pin-input-base .pin-input-field {
11358
- color: var(--color-base-content);
11359
- }
11360
-
11361
- .pin-input-base .pin-input-field:focus {
11362
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-base-content) 10%, transparent);
11363
- }
11364
-
11365
- @keyframes pin-shake {
11366
- 0%, 100% { transform: translateX(0); }
11367
- 20%, 60% { transform: translateX(-4px); }
11368
- 40%, 80% { transform: translateX(4px); }
11369
- }
11370
-
11371
- /* Ghost Variant */
11372
- .pin-input-ghost .pin-input-field {
11373
- background-color: transparent;
11374
- border-color: transparent;
11251
+ /* Intrinsic input width follows the entered characters, positioning the next cell. */
11252
+ .otp-input:has(> .otp-code)::after {
11253
+ content: "";
11254
+ flex-shrink: 0;
11255
+ inline-size: var(--otp-cell);
11256
+ block-size: var(--otp-height);
11257
+ margin-inline-start: calc(-0.25 * var(--otp-cell));
11258
+ border-radius: inherit;
11259
+ pointer-events: none;
11375
11260
  }
11376
-
11377
- .pin-input-ghost .pin-input-field:focus {
11378
- background-color: var(--color-surface-container);
11379
- border-color: transparent;
11261
+ .otp-input:focus-within::after,
11262
+ .otp-input:has(> .otp-code:focus) > span {
11380
11263
  box-shadow: 0 0 0 3px color-mix(in oklch, currentColor 20%, transparent);
11264
+ outline: 1px solid currentColor;
11265
+ }
11266
+ .otp-input:has(> .otp-code:valid:focus)::after { visibility: hidden; }
11267
+ /* Cell indicators replace the reset's unlayered native focus outline. */
11268
+ .otp-input > .otp-code:focus {
11269
+ outline: none !important;
11270
+ box-shadow: none !important;
11271
+ }
11272
+
11273
+ .otp-input-xs:has(> .otp-code) { font-size: 1rem; --otp-height: 2rem; }
11274
+ .otp-input-sm:has(> .otp-code) { font-size: 1.25rem; --otp-height: 2.5rem; }
11275
+ .otp-input-md:has(> .otp-code) { font-size: 1.5rem; --otp-height: 3rem; }
11276
+ .otp-input-lg:has(> .otp-code) { font-size: 1.75rem; --otp-height: 3.5rem; }
11277
+ .otp-input-xl:has(> .otp-code) { font-size: 2rem; --otp-height: 4rem; }
11278
+ .otp-input-joined:has(> .otp-code) { --otp-gap-ratio: 0; }
11279
+ .otp-input-joined > span:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
11280
+ .otp-input-joined > span:not(:nth-last-child(2)) { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
11281
+ .otp-input-ghost > span { border-color: transparent; }
11282
+ .otp-input-filled > span { background-color: var(--color-surface-container); }
11283
+ .otp-input-underline > span { border-width: 0 0 1px; border-radius: 0; background-color: transparent; }
11284
+
11285
+ .otp-input-primary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-primary)); }
11286
+ .otp-input-secondary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-secondary)); }
11287
+ .otp-input-tertiary:has(> .otp-code) { color: var(--dm-validation-color, var(--color-tertiary)); }
11288
+ .otp-input-info:has(> .otp-code) { color: var(--dm-validation-color, var(--color-info)); }
11289
+ .otp-input-success:has(> .otp-code) { color: var(--dm-validation-color, var(--color-success)); }
11290
+ .otp-input-warning:has(> .otp-code) { color: var(--dm-validation-color, var(--color-warning)); }
11291
+ .otp-input-error:has(> .otp-code) { color: var(--dm-validation-color, var(--color-error)); }
11292
+ .otp-input-accent:has(> .otp-code) { color: var(--dm-validation-color, var(--color-accent)); }
11293
+ .otp-input-neutral:has(> .otp-code) { color: var(--dm-validation-color, var(--color-neutral)); }
11294
+ .otp-input-base:has(> .otp-code) { color: var(--dm-validation-color, var(--color-base-content)); }
11295
+
11296
+ .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 *)) {
11297
+ --dm-validation-color: var(--color-success);
11381
11298
  }
11382
-
11383
- /* PIN Group with Label */
11384
- .pin-group {
11385
- display: flex;
11386
- flex-direction: column;
11387
- gap: 0.5rem;
11299
+ .otp-input:has(> .otp-code:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)),
11300
+ :is(.form-group-error, .form-control.error) .otp-input {
11301
+ --dm-validation-color: var(--color-error);
11388
11302
  }
11389
-
11390
- .pin-label {
11391
- font-size: 0.875rem;
11392
- font-weight: 500;
11393
- color: var(--color-on-surface);
11303
+ .otp-input:has(> .otp-code:is([aria-invalid="true"], .validator:user-invalid, .validate :invalid, .validate:invalid):not(:disabled)) > span,
11304
+ :is(.form-group-error, .form-control.error) .otp-input > span {
11305
+ border-color: currentColor;
11394
11306
  }
11395
-
11396
- .pin-helper {
11397
- font-size: 0.75rem;
11398
- color: var(--color-on-surface-variant);
11307
+ .otp-input:has(> .otp-code:disabled) {
11308
+ opacity: 0.38;
11309
+ cursor: not-allowed;
11399
11310
  }
11311
+ .otp-input > .otp-code:disabled { opacity: 1; }
11400
11312
 
11401
- .pin-error-message {
11402
- font-size: 0.75rem;
11403
- color: var(--color-error);
11313
+ /* Engines without content sizing retain a usable single native input. */
11314
+ @supports not (field-sizing: content) {
11315
+ .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; }
11316
+ .otp-input > span, .otp-input:has(> .otp-code)::after { display: none; }
11317
+ .otp-input > .otp-code:focus { outline: 2px solid currentColor !important; outline-offset: 2px; }
11318
+ }
11319
+ @media (forced-colors: active) {
11320
+ .otp-input:focus-within { outline: 2px solid Highlight; outline-offset: 2px; }
11404
11321
  }
11405
11322
 
11406
- /* Reduce Motion */
11407
11323
  @media (prefers-reduced-motion: reduce) {
11408
- .pin-input-field {
11324
+ .otp-input-field, .otp-input > span {
11409
11325
  transition: none;
11410
11326
  }
11411
-
11412
- .pin-input-error .pin-input-field {
11413
- animation: none;
11414
- }
11415
11327
  }
11416
11328
  }
11417
11329
 
@@ -18062,20 +17974,20 @@ html {
18062
17974
  z-index: 1;
18063
17975
  }
18064
17976
 
18065
- :is(.join, .join-horizontal) > .join-item:not(:first-child) {
17977
+ :is(.join, .join-horizontal):not(.join-vertical) > .join-item:not(:first-child) {
18066
17978
  margin-inline-start: -1px;
18067
17979
  }
18068
17980
 
18069
- :is(.join, .join-horizontal) > .join-item:not(:first-child):not(:last-child) {
17981
+ :is(.join, .join-horizontal):not(.join-vertical) > .join-item:not(:first-child):not(:last-child) {
18070
17982
  border-radius: 0;
18071
17983
  }
18072
17984
 
18073
- :is(.join, .join-horizontal) > .join-item:first-child:not(:last-child) {
17985
+ :is(.join, .join-horizontal):not(.join-vertical) > .join-item:first-child:not(:last-child) {
18074
17986
  border-start-end-radius: 0;
18075
17987
  border-end-end-radius: 0;
18076
17988
  }
18077
17989
 
18078
- :is(.join, .join-horizontal) > .join-item:last-child:not(:first-child) {
17990
+ :is(.join, .join-horizontal):not(.join-vertical) > .join-item:last-child:not(:first-child) {
18079
17991
  border-start-start-radius: 0;
18080
17992
  border-end-start-radius: 0;
18081
17993
  }