@haiilo/catalyst 5.2.3 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/catalyst/catalyst.css +56 -39
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.cdn.js +1 -0
  5. package/dist/catalyst/index.esm.js +2 -2
  6. package/dist/catalyst/index.esm.js.map +1 -1
  7. package/dist/catalyst/p-34e0cbba.entry.js +10 -0
  8. package/dist/catalyst/p-34e0cbba.entry.js.map +1 -0
  9. package/dist/catalyst/{p-d1fb9d96.js → p-ce6a1db2.js} +1 -1
  10. package/dist/catalyst/p-ce6a1db2.js.map +1 -0
  11. package/dist/catalyst/p-cf32399c.js +2 -0
  12. package/dist/catalyst/p-cf32399c.js.map +1 -0
  13. package/dist/catalyst/scss/_snippets/_checkbox-hint.scss +20 -0
  14. package/dist/catalyst/scss/_snippets/_form-label.scss +2 -1
  15. package/dist/catalyst/scss/utils/_border.scss +14 -0
  16. package/dist/catalyst/scss/utils/_media.mixins.scss +0 -1
  17. package/dist/catalyst/scss/utils/_typography.mixins.scss +1 -0
  18. package/dist/cjs/{cat-alert_24.cjs.entry.js → cat-alert_27.cjs.entry.js} +3777 -192
  19. package/dist/cjs/cat-alert_27.cjs.entry.js.map +1 -0
  20. package/dist/cjs/{cat-icon-registry-671af264.js → cat-icon-registry-228164a1.js} +43 -2
  21. package/dist/cjs/cat-icon-registry-228164a1.js.map +1 -0
  22. package/dist/cjs/catalyst.cjs.js +3 -3
  23. package/dist/cjs/catalyst.cjs.js.map +1 -1
  24. package/dist/cjs/{index-01312a2e.js → index-4258b31e.js} +8 -1
  25. package/dist/{catalyst/p-d1fb9d96.js.map → cjs/index-4258b31e.js.map} +1 -1
  26. package/dist/cjs/index.cjs.js +2 -2
  27. package/dist/cjs/index.cjs.js.map +1 -1
  28. package/dist/cjs/loader.cjs.js +3 -3
  29. package/dist/cjs/loader.cjs.js.map +1 -1
  30. package/dist/collection/collection-manifest.json +5 -2
  31. package/dist/collection/components/cat-alert/cat-alert.js +5 -5
  32. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  33. package/dist/collection/components/cat-button/cat-button.css +27 -9
  34. package/dist/collection/components/cat-button/cat-button.js +27 -25
  35. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  36. package/dist/collection/components/cat-button-group/cat-button-group.css +15 -0
  37. package/dist/collection/components/cat-button-group/cat-button-group.js +51 -0
  38. package/dist/collection/components/cat-button-group/cat-button-group.js.map +1 -0
  39. package/dist/collection/components/cat-checkbox/cat-checkbox.css +24 -1
  40. package/dist/collection/components/cat-checkbox/cat-checkbox.js +8 -4
  41. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  42. package/dist/collection/components/cat-datepicker/cat-datepicker.css +381 -0
  43. package/dist/collection/components/cat-datepicker/cat-datepicker.js +873 -0
  44. package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -0
  45. package/dist/collection/components/cat-datepicker/datepicker-type.js +8 -0
  46. package/dist/collection/components/cat-datepicker/datepicker-type.js.map +1 -0
  47. package/dist/collection/components/cat-datepicker/dayjs.config.js +8 -0
  48. package/dist/collection/components/cat-datepicker/dayjs.config.js.map +1 -0
  49. package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js +46 -0
  50. package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js.map +1 -0
  51. package/dist/collection/components/cat-dropdown/cat-dropdown.css +1 -0
  52. package/dist/collection/components/cat-dropdown/cat-dropdown.js +26 -7
  53. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  54. package/dist/collection/components/cat-form-group/cat-form-group.js +29 -1
  55. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
  56. package/dist/collection/components/cat-icon/cat-icon-registry.js +29 -1
  57. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
  58. package/dist/collection/components/cat-input/cat-input.css +392 -15
  59. package/dist/collection/components/cat-input/cat-input.js +8 -4
  60. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  61. package/dist/collection/components/cat-label/cat-label.js +19 -0
  62. package/dist/collection/components/cat-label/cat-label.js.map +1 -1
  63. package/dist/collection/components/cat-notification/cat-notification.js +1 -1
  64. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  65. package/dist/collection/components/cat-pagination/cat-pagination.js +28 -6
  66. package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
  67. package/dist/collection/components/cat-radio/cat-radio.css +24 -1
  68. package/dist/collection/components/cat-radio/cat-radio.js +8 -4
  69. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  70. package/dist/collection/components/cat-radio-group/cat-radio-group.js +7 -3
  71. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  72. package/dist/collection/components/cat-scrollable/cat-scrollable.css +1 -4
  73. package/dist/collection/components/cat-select/cat-select.css +98 -11
  74. package/dist/collection/components/cat-select/cat-select.js +73 -23
  75. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  76. package/dist/collection/components/cat-skeleton/cat-skeleton.css +1 -1
  77. package/dist/collection/components/cat-textarea/cat-textarea.css +17 -16
  78. package/dist/collection/components/cat-textarea/cat-textarea.js +8 -4
  79. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  80. package/dist/collection/components/cat-timepicker/cat-timepicker.css +5 -0
  81. package/dist/collection/components/cat-timepicker/cat-timepicker.js +668 -0
  82. package/dist/collection/components/cat-timepicker/cat-timepicker.js.map +1 -0
  83. package/dist/collection/components/cat-toggle/cat-toggle.css +24 -1
  84. package/dist/collection/components/cat-toggle/cat-toggle.js +8 -4
  85. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  86. package/dist/collection/components/cat-tooltip/cat-tooltip.css +1 -8
  87. package/dist/collection/components/cat-tooltip/cat-tooltip.js +22 -18
  88. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  89. package/dist/collection/index.cdn.js +1 -0
  90. package/dist/collection/scss/_snippets/_checkbox-hint.scss +20 -0
  91. package/dist/collection/scss/_snippets/_form-label.scss +2 -1
  92. package/dist/collection/scss/utils/_border.scss +14 -0
  93. package/dist/collection/scss/utils/_media.mixins.scss +0 -1
  94. package/dist/collection/scss/utils/_typography.mixins.scss +1 -0
  95. package/dist/components/cat-alert.js +5 -5
  96. package/dist/components/cat-alert.js.map +1 -1
  97. package/dist/components/cat-button-group.d.ts +11 -0
  98. package/dist/components/cat-button-group.js +46 -0
  99. package/dist/components/cat-button-group.js.map +1 -0
  100. package/dist/components/cat-button2.js +12 -10
  101. package/dist/components/cat-button2.js.map +1 -1
  102. package/dist/components/cat-checkbox2.js +2 -2
  103. package/dist/components/cat-checkbox2.js.map +1 -1
  104. package/dist/components/cat-datepicker.d.ts +11 -0
  105. package/dist/components/cat-datepicker.js +3210 -0
  106. package/dist/components/cat-datepicker.js.map +1 -0
  107. package/dist/components/cat-dropdown2.js +640 -43
  108. package/dist/components/cat-dropdown2.js.map +1 -1
  109. package/dist/components/cat-form-group.js +11 -2
  110. package/dist/components/cat-form-group.js.map +1 -1
  111. package/dist/components/cat-icon-registry.js +42 -1
  112. package/dist/components/cat-icon-registry.js.map +1 -1
  113. package/dist/components/cat-input.js +1 -226
  114. package/dist/components/cat-input.js.map +1 -1
  115. package/dist/components/cat-input2.js +230 -0
  116. package/dist/components/cat-input2.js.map +1 -0
  117. package/dist/components/cat-label.js +2 -0
  118. package/dist/components/cat-label.js.map +1 -1
  119. package/dist/components/cat-pagination.js +10 -5
  120. package/dist/components/cat-pagination.js.map +1 -1
  121. package/dist/components/cat-radio-group.js.map +1 -1
  122. package/dist/components/cat-radio.js +2 -2
  123. package/dist/components/cat-radio.js.map +1 -1
  124. package/dist/components/cat-scrollable2.js +7 -5
  125. package/dist/components/cat-scrollable2.js.map +1 -1
  126. package/dist/components/cat-select-demo.js +2 -2
  127. package/dist/components/cat-select-demo.js.map +1 -1
  128. package/dist/components/cat-select2.js +46 -17
  129. package/dist/components/cat-select2.js.map +1 -1
  130. package/dist/components/cat-skeleton2.js +1 -1
  131. package/dist/components/cat-skeleton2.js.map +1 -1
  132. package/dist/components/cat-textarea.js +3 -3
  133. package/dist/components/cat-textarea.js.map +1 -1
  134. package/dist/components/cat-timepicker.d.ts +11 -0
  135. package/dist/components/cat-timepicker.js +258 -0
  136. package/dist/components/cat-timepicker.js.map +1 -0
  137. package/dist/components/cat-toggle.js +2 -2
  138. package/dist/components/cat-toggle.js.map +1 -1
  139. package/dist/components/cat-tooltip.js +24 -20
  140. package/dist/components/cat-tooltip.js.map +1 -1
  141. package/dist/components/floating-ui.dom.esm.js +142 -56
  142. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  143. package/dist/components/index.js +1 -1
  144. package/dist/components/index.js.map +1 -1
  145. package/dist/esm/{cat-alert_24.entry.js → cat-alert_27.entry.js} +3775 -193
  146. package/dist/esm/cat-alert_27.entry.js.map +1 -0
  147. package/dist/esm/{cat-icon-registry-d6b80490.js → cat-icon-registry-4bd597f4.js} +43 -2
  148. package/dist/esm/cat-icon-registry-4bd597f4.js.map +1 -0
  149. package/dist/esm/catalyst.js +4 -4
  150. package/dist/esm/catalyst.js.map +1 -1
  151. package/dist/esm/{index-fc2f91a4.js → index-636ce8d6.js} +8 -1
  152. package/dist/esm/index-636ce8d6.js.map +1 -0
  153. package/dist/esm/index.js +3 -3
  154. package/dist/esm/index.js.map +1 -1
  155. package/dist/esm/loader.js +4 -4
  156. package/dist/esm/loader.js.map +1 -1
  157. package/dist/types/components/cat-button/cat-button.d.ts +4 -5
  158. package/dist/types/components/cat-button-group/cat-button-group.d.ts +11 -0
  159. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +1 -1
  160. package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +187 -0
  161. package/dist/types/components/cat-datepicker/datepicker-type.d.ts +7 -0
  162. package/dist/types/components/cat-datepicker/datepicker.d.ts +1 -0
  163. package/dist/types/components/cat-datepicker/dayjs.config.d.ts +3 -0
  164. package/dist/types/components/cat-datepicker/vanillajs-datepicker.config.d.ts +4 -0
  165. package/dist/types/components/cat-form-group/cat-form-group.d.ts +5 -0
  166. package/dist/types/components/cat-input/cat-input.d.ts +1 -1
  167. package/dist/types/components/cat-label/cat-label.d.ts +4 -0
  168. package/dist/types/components/cat-pagination/cat-pagination.d.ts +6 -0
  169. package/dist/types/components/cat-radio/cat-radio.d.ts +1 -1
  170. package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +1 -1
  171. package/dist/types/components/cat-select/cat-select.d.ts +10 -1
  172. package/dist/types/components/cat-textarea/cat-textarea.d.ts +1 -1
  173. package/dist/types/components/cat-timepicker/cat-timepicker.d.ts +158 -0
  174. package/dist/types/components/cat-toggle/cat-toggle.d.ts +1 -1
  175. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +2 -2
  176. package/dist/types/components.d.ts +585 -17
  177. package/package.json +22 -18
  178. package/dist/catalyst/p-ccfebe33.js +0 -2
  179. package/dist/catalyst/p-ccfebe33.js.map +0 -1
  180. package/dist/catalyst/p-d135d677.entry.js +0 -10
  181. package/dist/catalyst/p-d135d677.entry.js.map +0 -1
  182. package/dist/cjs/cat-alert_24.cjs.entry.js.map +0 -1
  183. package/dist/cjs/cat-icon-registry-671af264.js.map +0 -1
  184. package/dist/cjs/index-01312a2e.js.map +0 -1
  185. package/dist/components/first-tabbable.js +0 -464
  186. package/dist/components/first-tabbable.js.map +0 -1
  187. package/dist/esm/cat-alert_24.entry.js.map +0 -1
  188. package/dist/esm/cat-icon-registry-d6b80490.js.map +0 -1
  189. package/dist/esm/index-fc2f91a4.js.map +0 -1
@@ -12,7 +12,7 @@
12
12
  .hint-section .input-hint,
13
13
  .hint-section ::slotted([slot=hint]) {
14
14
  font-size: 0.875rem;
15
- line-height: 1rem;
15
+ line-height: 1.125rem;
16
16
  font-weight: var(--cat-font-weight-body, 400);
17
17
  margin: 0 !important;
18
18
  }
@@ -306,24 +306,405 @@
306
306
  }
307
307
 
308
308
  .input-horizontal .label-wrapper,
309
- .textarea-horizontal .label-wrapper {
309
+ .textarea-horizontal .label-wrapper,
310
+ .select-horizontal .label-wrapper {
310
311
  flex-direction: column;
311
312
  }
312
313
  .input-horizontal label,
313
- .textarea-horizontal label {
314
+ .textarea-horizontal label,
315
+ .select-horizontal label {
314
316
  min-height: 2.5rem;
315
317
  display: inline-flex;
316
318
  align-items: center;
317
319
  }
318
320
  .input-horizontal .label-metadata,
319
- .textarea-horizontal .label-metadata {
321
+ .textarea-horizontal .label-metadata,
322
+ .select-horizontal .label-metadata {
320
323
  justify-content: flex-start;
321
324
  }
322
325
  .input-horizontal .label-metadata .label-character-count,
323
- .textarea-horizontal .label-metadata .label-character-count {
326
+ .textarea-horizontal .label-metadata .label-character-count,
327
+ .select-horizontal .label-metadata .label-character-count {
324
328
  margin-left: 0;
325
329
  }
326
330
 
331
+ .datepicker {
332
+ width: min-content;
333
+ }
334
+ .datepicker:not(.active) {
335
+ display: none;
336
+ }
337
+
338
+ .datepicker-dropdown {
339
+ position: absolute;
340
+ z-index: 20;
341
+ padding-top: 4px;
342
+ }
343
+ .datepicker-dropdown.datepicker-orient-top {
344
+ padding-top: 0;
345
+ padding-bottom: 4px;
346
+ }
347
+
348
+ .datepicker-picker {
349
+ display: flex;
350
+ flex-direction: column;
351
+ border-radius: var(--cat-border-radius-m, 0.25rem);
352
+ background-color: white;
353
+ }
354
+ .datepicker-dropdown .datepicker-picker {
355
+ box-shadow: 0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);
356
+ }
357
+
358
+ .datepicker-main {
359
+ flex: auto;
360
+ padding: 2px;
361
+ }
362
+
363
+ .datepicker-footer {
364
+ box-shadow: none;
365
+ background-color: transparent;
366
+ }
367
+
368
+ .datepicker-title {
369
+ box-shadow: none;
370
+ background-color: hsl(0, 0%, 96%);
371
+ padding: 0.375rem 0.75rem;
372
+ text-align: center;
373
+ font-weight: 700;
374
+ }
375
+
376
+ .datepicker-controls {
377
+ display: flex;
378
+ }
379
+ .datepicker-header .datepicker-controls {
380
+ padding: 2px 2px 0;
381
+ }
382
+ .datepicker-controls .button {
383
+ display: inline-flex;
384
+ position: relative;
385
+ align-items: center;
386
+ justify-content: center;
387
+ margin: 0;
388
+ border: 1px solid rgb(var(--cat-border-color, 235, 236, 240));
389
+ border-radius: var(--cat-border-radius-m, 0.25rem);
390
+ box-shadow: none;
391
+ background-color: hsl(0, 0%, 100%);
392
+ cursor: pointer;
393
+ padding: calc(0.375em - 1px) 0.75em;
394
+ height: 2.25em;
395
+ vertical-align: top;
396
+ text-align: center;
397
+ line-height: 1.5;
398
+ white-space: nowrap;
399
+ color: hsl(0, 0%, 21%);
400
+ font-size: 0.9375rem;
401
+ }
402
+ .datepicker-controls .button:focus, .datepicker-controls .button:active {
403
+ outline: none;
404
+ }
405
+ .datepicker-controls .button:hover {
406
+ border-color: #b8b8b8;
407
+ color: hsl(0, 0%, 21%);
408
+ }
409
+ .datepicker-controls .button:focus {
410
+ border-color: hsl(217, 71%, 53%);
411
+ color: hsl(0, 0%, 21%);
412
+ }
413
+ .datepicker-controls .button:focus:not(:active) {
414
+ box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25);
415
+ }
416
+ .datepicker-controls .button:active {
417
+ border-color: #474747;
418
+ color: hsl(0, 0%, 21%);
419
+ }
420
+ .datepicker-controls .button[disabled] {
421
+ cursor: not-allowed;
422
+ }
423
+ .datepicker-header .datepicker-controls .button {
424
+ border-color: transparent;
425
+ font-weight: bold;
426
+ }
427
+ .datepicker-header .datepicker-controls .button:hover {
428
+ background-color: #f2f4f7;
429
+ }
430
+ .datepicker-header .datepicker-controls .button:active {
431
+ background-color: #f2f4f7;
432
+ }
433
+ .datepicker-footer .datepicker-controls .button {
434
+ flex: auto;
435
+ margin: calc(0.375rem - 1px) 0.375rem;
436
+ border-radius: var(--cat-border-radius-s, 0.125rem);
437
+ font-size: 0.875rem;
438
+ }
439
+ .datepicker-controls .view-switch {
440
+ flex: auto;
441
+ }
442
+ .datepicker-controls .prev-button,
443
+ .datepicker-controls .next-button {
444
+ padding-right: 0.375rem;
445
+ padding-left: 0.375rem;
446
+ flex: 0 0 14.2857142857%;
447
+ }
448
+ .datepicker-controls .prev-button.disabled,
449
+ .datepicker-controls .next-button.disabled {
450
+ visibility: hidden;
451
+ }
452
+
453
+ .datepicker-view,
454
+ .datepicker-grid {
455
+ display: flex;
456
+ }
457
+
458
+ .datepicker-view {
459
+ align-items: stretch;
460
+ width: 17.5rem;
461
+ }
462
+
463
+ .datepicker-grid {
464
+ flex-wrap: wrap;
465
+ flex: auto;
466
+ }
467
+
468
+ .datepicker .days {
469
+ display: flex;
470
+ flex-direction: column;
471
+ flex: auto;
472
+ }
473
+ .datepicker .days-of-week {
474
+ display: flex;
475
+ }
476
+ .datepicker .week-numbers {
477
+ display: flex;
478
+ flex-direction: column;
479
+ flex: 0 0 9.6774193548%;
480
+ }
481
+ .datepicker .weeks {
482
+ display: flex;
483
+ flex-direction: column;
484
+ align-items: stretch;
485
+ flex: auto;
486
+ }
487
+ .datepicker span {
488
+ display: flex;
489
+ align-items: center;
490
+ justify-content: center;
491
+ border-radius: var(--cat-border-radius-m, 0.25rem);
492
+ cursor: default;
493
+ -webkit-touch-callout: none;
494
+ user-select: none;
495
+ }
496
+ .datepicker .dow {
497
+ height: 2rem;
498
+ font-size: 0.875rem0.9375rem/2;
499
+ font-weight: 700;
500
+ }
501
+ .datepicker .week {
502
+ flex: auto;
503
+ color: rgb(var(--cat-font-color-muted, 81, 92, 108));
504
+ font-size: 0.875rem;
505
+ }
506
+
507
+ .datepicker-cell, .datepicker .days .dow {
508
+ flex-basis: 14.2857142857%;
509
+ }
510
+
511
+ .datepicker-cell {
512
+ height: 2.5rem;
513
+ }
514
+ .datepicker-cell:not(.day) {
515
+ flex-basis: 25%;
516
+ height: 5rem;
517
+ }
518
+ .datepicker-cell:not(.disabled):hover {
519
+ background-color: transparent;
520
+ cursor: pointer;
521
+ }
522
+ .datepicker-cell.focused:not(.selected) {
523
+ background-color: #f2f4f7;
524
+ }
525
+ .datepicker-cell.selected, .datepicker-cell.selected:hover {
526
+ background-color: rgb(var(--cat-primary-bg, 0, 129, 148));
527
+ color: rgb(var(--cat-primary-fill, 255, 255, 255));
528
+ font-weight: 700;
529
+ }
530
+ .datepicker-cell.disabled {
531
+ color: rgb(var(--cat-font-color-muted, 81, 92, 108));
532
+ }
533
+ .datepicker-cell.prev:not(.disabled), .datepicker-cell.next:not(.disabled) {
534
+ color: rgb(var(--cat-font-color-muted, 81, 92, 108));
535
+ }
536
+ .datepicker-cell.prev.selected, .datepicker-cell.next.selected {
537
+ color: rgb(var(--cat-primary-fill, 255, 255, 255));
538
+ }
539
+ .datepicker-cell.highlighted:not(.selected):not(.range):not(.today) {
540
+ border-radius: 0;
541
+ background-color: #f2f4f7;
542
+ }
543
+ .datepicker-cell.highlighted:not(.selected):not(.range):not(.today):not(.disabled):hover {
544
+ background-color: #f2f4f7;
545
+ }
546
+ .datepicker-cell.highlighted:not(.selected):not(.range):not(.today).focused {
547
+ background-color: #f2f4f7;
548
+ }
549
+ .datepicker-cell.today:not(.selected) {
550
+ background-color: transparent;
551
+ }
552
+ .datepicker-cell.today:not(.selected):not(.disabled) {
553
+ color: rgb(var(--cat-primary-text, 0, 129, 148));
554
+ }
555
+ .datepicker-cell.today.focused:not(.selected) {
556
+ background-color: #f2f4f7;
557
+ }
558
+ .datepicker-cell.range-end:not(.selected), .datepicker-cell.range-start:not(.selected) {
559
+ background-color: #b8b8b8;
560
+ color: rgb(var(--cat-primary-fill, 255, 255, 255));
561
+ }
562
+ .datepicker-cell.range-end.focused:not(.selected), .datepicker-cell.range-start.focused:not(.selected) {
563
+ background-color: #b3b3b3;
564
+ }
565
+ .datepicker-cell.range-start:not(.range-end) {
566
+ border-radius: var(--cat-border-radius-m, 0.25rem) 0 0 var(--cat-border-radius-m, 0.25rem);
567
+ }
568
+ .datepicker-cell.range-end:not(.range-start) {
569
+ border-radius: 0 var(--cat-border-radius-m, 0.25rem) var(--cat-border-radius-m, 0.25rem) 0;
570
+ }
571
+ .datepicker-cell.range {
572
+ border-radius: 0;
573
+ background-color: gainsboro;
574
+ }
575
+ .datepicker-cell.range:not(.disabled):not(.focused):not(.today):hover {
576
+ background-color: #d7d7d7;
577
+ }
578
+ .datepicker-cell.range.disabled {
579
+ color: #c6c6c6;
580
+ }
581
+ .datepicker-cell.range.focused {
582
+ background-color: #d1d1d1;
583
+ }
584
+
585
+ .datepicker-input.in-edit {
586
+ border-color: #276bda;
587
+ }
588
+ .datepicker-input.in-edit:focus, .datepicker-input.in-edit:active {
589
+ box-shadow: none;
590
+ }
591
+
592
+ .datepicker-picker {
593
+ border: 1px solid rgb(var(--cat-border-color, 235, 236, 240));
594
+ }
595
+
596
+ .datepicker-main {
597
+ padding: 0.5rem 1rem;
598
+ }
599
+
600
+ .datepicker-view:has(.week-numbers) {
601
+ width: 19.375rem;
602
+ }
603
+
604
+ .datepicker-view.months,
605
+ .datepicker-view.years {
606
+ width: 20rem;
607
+ }
608
+
609
+ .datepicker .dow,
610
+ .datepicker .week {
611
+ font-size: 0.75rem;
612
+ line-height: 1rem;
613
+ font-weight: 700;
614
+ color: rgb(var(--cat-font-color-muted, 81, 92, 108));
615
+ }
616
+
617
+ .datepicker-cell.today:not(.selected) {
618
+ box-shadow: inset 0 0 0 2px rgb(var(--cat-primary-bg, 0, 129, 148));
619
+ }
620
+
621
+ .datepicker-cell.focused:not(.selected),
622
+ .datepicker-cell:not(.selected):not(.disabled):hover {
623
+ background-color: #f2f4f7;
624
+ }
625
+
626
+ .datepicker-controls {
627
+ gap: 0.5rem;
628
+ }
629
+ .datepicker-header .datepicker-controls {
630
+ padding: 1rem 1rem 0;
631
+ }
632
+ .datepicker-header .datepicker-controls .button {
633
+ height: 2.5rem;
634
+ }
635
+ .datepicker-header .datepicker-controls .prev-button,
636
+ .datepicker-header .datepicker-controls .next-button {
637
+ flex-basis: 2.5rem;
638
+ font-size: 1.25rem;
639
+ }
640
+ .datepicker-footer .datepicker-controls {
641
+ padding: 0 1rem 1rem;
642
+ }
643
+ .datepicker-footer .datepicker-controls .button {
644
+ margin: 0;
645
+ height: 2.5rem;
646
+ font-size: 0.9375rem;
647
+ }
648
+ .datepicker-footer .datepicker-controls .button:hover, .datepicker-footer .datepicker-controls .button:active {
649
+ border-color: rgb(var(--cat-border-color-dark, 215, 219, 224));
650
+ }
651
+
652
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1)::before {
653
+ content: "";
654
+ width: 700%;
655
+ height: 100%;
656
+ border-radius: var(--cat-border-radius-m, 0.25rem);
657
+ position: absolute;
658
+ top: 0;
659
+ left: 0;
660
+ opacity: 0;
661
+ z-index: 1;
662
+ }
663
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).today:not(.selected)::before {
664
+ box-shadow: inset 0 0 0 1.5px #008194;
665
+ border-radius: var(--cat-border-radius-m, 0.25rem);
666
+ opacity: 1;
667
+ }
668
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1):not(:hover)::before {
669
+ background: none;
670
+ }
671
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1):hover::before {
672
+ opacity: 1;
673
+ background-color: transparent;
674
+ }
675
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected, .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected.focused {
676
+ color: white;
677
+ }
678
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected::before, .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected.focused::before {
679
+ opacity: 1;
680
+ background-color: rgb(var(--cat-primary-bg, 0, 129, 148));
681
+ z-index: -1;
682
+ }
683
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).focused {
684
+ background: none;
685
+ }
686
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).focused::before {
687
+ opacity: 1;
688
+ background-color: #f2f4f7;
689
+ z-index: -1;
690
+ }
691
+
692
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell {
693
+ position: relative;
694
+ }
695
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.selected, .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.focused {
696
+ z-index: 2;
697
+ }
698
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.today:not(.selected) {
699
+ box-shadow: none;
700
+ }
701
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell:not(.disabled):hover {
702
+ background-color: inherit;
703
+ }
704
+ .datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.focused {
705
+ background: none;
706
+ }
707
+
327
708
  :host {
328
709
  display: flex;
329
710
  font-size: 0.9375rem;
@@ -358,8 +739,9 @@
358
739
  overflow: hidden;
359
740
  background: white;
360
741
  border-radius: var(--cat-border-radius-m, 0.25rem);
361
- box-shadow: 0 0 0 1px rgb(var(--cat-border-color-dark, 215, 219, 224));
742
+ box-shadow: inset 0 0 0 1px rgb(var(--border-color));
362
743
  transition: box-shadow 0.13s linear;
744
+ --border-color: var(--cat-border-color-dark, 215, 219, 224);
363
745
  /* stylelint-disable property-no-vendor-prefix */
364
746
  /* stylelint-enable property-no-vendor-prefix */
365
747
  }
@@ -372,19 +754,14 @@
372
754
  color: rgb(var(--cat-font-color-muted, 81, 92, 108));
373
755
  }
374
756
  .input-wrapper:not(.input-disabled):hover {
375
- box-shadow: 0 0 0 2px rgb(var(--cat-border-color-dark, 215, 219, 224));
757
+ box-shadow: inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color));
376
758
  }
377
- .input-wrapper:not(.input-disabled):hover.input-invalid {
378
- box-shadow: 0 0 0 2px rgba(var(--cat-danger-bg, 217, 52, 13), 0.2);
379
- }
380
- .input-wrapper:not(.input-disabled):focus-within {
759
+ .input-wrapper:focus-within {
381
760
  outline: 2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));
382
- }
383
- .input-wrapper:not(.input-disabled):focus-within.input-invalid {
384
- outline: 2px solid rgba(var(--cat-danger-bg, 217, 52, 13), 0.2);
761
+ outline-offset: -1px;
385
762
  }
386
763
  .input-wrapper.input-invalid {
387
- box-shadow: 0 0 0 1px rgba(var(--cat-danger-bg, 217, 52, 13), 0.2);
764
+ --border-color: var(--cat-danger-bg, 217, 52, 13), 0.2;
388
765
  }
389
766
  .input-wrapper:has(input:-webkit-autofill), .input-wrapper:has(input:-webkit-autofill):hover, .input-wrapper:has(input:-webkit-autofill):focus {
390
767
  background-color: #e8f0fe;
@@ -117,7 +117,7 @@ export class CatInput {
117
117
  'input-invalid': this.invalid
118
118
  }, onClick: () => this.input.focus() }, this.textPrefix && (h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-prefix", size: "l" }), h("div", { class: "input-inner-wrapper" }, h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, class: {
119
119
  'has-clearable': this.clearable && !this.disabled
120
- }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_c = this.hint) === null || _c === void 0 ? void 0 : _c.length) ? this.id + '-hint' : undefined })), this.clearable && !this.disabled && this.value && (h("cat-button", { class: "clearable", icon: "cross-circle-outlined", "icon-only": "true", size: "s", variant: "text", "a11y-label": i18n.t('input.clear'), onClick: this.clear.bind(this) }))), !this.invalid && this.icon && this.iconRight && (h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" })), this.invalid && (h("cat-icon", { icon: "alert-circle-outlined", class: "icon-suffix cat-text-danger", size: "l" })), this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))));
120
+ }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_c = this.hint) === null || _c === void 0 ? void 0 : _c.length) ? this.id + '-hint' : undefined })), this.clearable && !this.disabled && this.value && (h("cat-button", { class: "clearable", icon: "$cat:input-close", "icon-only": "true", size: "s", variant: "text", "a11y-label": i18n.t('input.clear'), onClick: this.clear.bind(this) }))), !this.invalid && this.icon && this.iconRight && (h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" })), this.invalid && h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" }), this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))));
121
121
  }
122
122
  get invalid() {
123
123
  return !!this.errorMap;
@@ -668,9 +668,13 @@ export class CatInput {
668
668
  "text": "Emitted when the value is changed."
669
669
  },
670
670
  "complexType": {
671
- "original": "any",
672
- "resolved": "any",
673
- "references": {}
671
+ "original": "InputEvent",
672
+ "resolved": "InputEvent",
673
+ "references": {
674
+ "InputEvent": {
675
+ "location": "global"
676
+ }
677
+ }
674
678
  }
675
679
  }, {
676
680
  "method": "catFocus",
@@ -1 +1 @@
1
- {"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/cat-input/cat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAY,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAGxE,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,QAAQ;;IACF,QAAG,GAAG,aAAa,YAAY,EAAE,EAAE,CAAC;2BAU1B,KAAK;0BAEN,KAAK;;0BAOkE,UAAU;sBAKtF,KAAK;;qBAUN,KAAK;oBAKN,KAAK;;;qBAeJ,KAAK;;iBAUT,EAAE;uBAKI,KAAK;;;;;;;;;oBA6CR,KAAK;oBAKL,KAAK;iBAKR,KAAK;gBAKK,MAAM;;;uBAsBQ,CAAC;;;EAtJzC,IAAY,EAAE;IACZ,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC;EACrC,CAAC;EA0KD,mBAAmB;IACjB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI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UAAU,EAAE,EAAE,WAAW,CAAC,CAAC;MACpF,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;EACf,CAAC;EAEO,mBAAmB;IACzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,WAAW,IAAI,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,KAAK,CAAC;IACtG,IAAI,CAAC,QAAQ,EAAE;MACb,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { coerceBoolean, coerceNumber } from '../../utils/coerce';\nimport { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { InputType } from './input-type';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly _id = `cat-input-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n private errorMapSrc?: ErrorMap;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n @State() errorMap?: ErrorMap;\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: number | string;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: number | string;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: InputType = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.watchErrorsHandler(this.errors);\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Programmatically move focus to the input. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Programmatically remove focus from the input. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Programmatically simulate a click on the input.\n */\n @Method()\n async doClick(): Promise<void> {\n this.input.click();\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n @Watch('errors')\n watchErrorsHandler(value?: boolean | string[] | ErrorMap) {\n if (!coerceBoolean(this.errorUpdate)) {\n this.errorMap = undefined;\n } else {\n this.errorMapSrc = Array.isArray(value)\n ? (value as string[]).reduce((acc, err) => ({ ...acc, [err]: undefined }), {})\n : value === true\n ? {}\n : value || undefined;\n this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();\n }\n }\n\n render() {\n return (\n <div\n class={{\n 'input-field': true,\n 'input-horizontal': this.horizontal\n }}\n >\n <div\n class={{\n hidden: this.labelHidden,\n 'label-container': true\n }}\n >\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id}>\n <span class=\"label-wrapper\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n <div class=\"label-metadata\">\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n {this.maxLength && (\n <div class=\"label-character-count\" aria-hidden=\"true\">\n {this.value?.toString().length ?? 0}/{this.maxLength}\n </div>\n )}\n </div>\n </span>\n </label>\n )}\n </div>\n <div class=\"input-container\">\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled,\n 'input-invalid': this.invalid\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.min}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.hint?.length ? this.id + '-hint' : undefined}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {!this.invalid && this.icon && this.iconRight && (\n <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>\n )}\n {this.invalid && (\n <cat-icon icon=\"alert-circle-outlined\" class=\"icon-suffix cat-text-danger\" size=\"l\"></cat-icon>\n )}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {(this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (\n <CatFormHint\n id={this.id}\n hint={this.hint}\n slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>}\n errorMap={this.errorMap}\n />\n )}\n </div>\n </div>\n );\n }\n\n private get invalid() {\n return !!this.errorMap;\n }\n\n private onInput(event: InputEvent) {\n this.value = this.input.value;\n this.catChange.emit(event);\n this.showErrorsIfTimeout();\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n if (coerceBoolean(this.errorUpdate)) {\n this.showErrors();\n }\n }\n\n private showErrors() {\n this.errorMap = this.errorMapSrc;\n }\n\n private errorUpdateTimeoutId?: number;\n private showErrorsIfTimeout() {\n const errorUpdate = coerceNumber(this.errorUpdate, null);\n if (errorUpdate !== null) {\n typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);\n this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);\n return true;\n }\n return false;\n }\n\n private showErrorsIfNoFocus() {\n const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.input;\n if (!hasFocus) {\n this.showErrors();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/cat-input/cat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAY,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAGxE,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,QAAQ;;IACF,QAAG,GAAG,aAAa,YAAY,EAAE,EAAE,CAAC;2BAU1B,KAAK;0BAEN,KAAK;;0BAOkE,UAAU;sBAKtF,KAAK;;qBAUN,KAAK;oBAKN,KAAK;;;qB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { coerceBoolean, coerceNumber } from '../../utils/coerce';\nimport { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { InputType } from './input-type';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly _id = `cat-input-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n private errorMapSrc?: ErrorMap;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n @State() errorMap?: ErrorMap;\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: number | string;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: number | string;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: InputType = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<InputEvent>;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.watchErrorsHandler(this.errors);\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Programmatically move focus to the input. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Programmatically remove focus from the input. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Programmatically simulate a click on the input.\n */\n @Method()\n async doClick(): Promise<void> {\n this.input.click();\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n @Watch('errors')\n watchErrorsHandler(value?: boolean | string[] | ErrorMap) {\n if (!coerceBoolean(this.errorUpdate)) {\n this.errorMap = undefined;\n } else {\n this.errorMapSrc = Array.isArray(value)\n ? (value as string[]).reduce((acc, err) => ({ ...acc, [err]: undefined }), {})\n : value === true\n ? {}\n : value || undefined;\n this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();\n }\n }\n\n render() {\n return (\n <div\n class={{\n 'input-field': true,\n 'input-horizontal': this.horizontal\n }}\n >\n <div\n class={{\n hidden: this.labelHidden,\n 'label-container': true\n }}\n >\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id}>\n <span class=\"label-wrapper\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n <div class=\"label-metadata\">\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n {this.maxLength && (\n <div class=\"label-character-count\" aria-hidden=\"true\">\n {this.value?.toString().length ?? 0}/{this.maxLength}\n </div>\n )}\n </div>\n </span>\n </label>\n )}\n </div>\n <div class=\"input-container\">\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled,\n 'input-invalid': this.invalid\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.min}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.hint?.length ? this.id + '-hint' : undefined}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"$cat:input-close\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {!this.invalid && this.icon && this.iconRight && (\n <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>\n )}\n {this.invalid && <cat-icon icon=\"$cat:input-error\" class=\"icon-suffix cat-text-danger\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {(this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (\n <CatFormHint\n id={this.id}\n hint={this.hint}\n slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>}\n errorMap={this.errorMap}\n />\n )}\n </div>\n </div>\n );\n }\n\n private get invalid() {\n return !!this.errorMap;\n }\n\n private onInput(event: InputEvent) {\n this.value = this.input.value;\n this.catChange.emit(event);\n this.showErrorsIfTimeout();\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n if (coerceBoolean(this.errorUpdate)) {\n this.showErrors();\n }\n }\n\n private showErrors() {\n this.errorMap = this.errorMapSrc;\n }\n\n private errorUpdateTimeoutId?: number;\n private showErrorsIfTimeout() {\n const errorUpdate = coerceNumber(this.errorUpdate, null);\n if (errorUpdate !== null) {\n typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);\n this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);\n return true;\n }\n return false;\n }\n\n private showErrorsIfNoFocus() {\n const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.input;\n if (!hasFocus) {\n this.showErrors();\n }\n }\n}\n"]}
@@ -8,6 +8,7 @@ import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';
8
8
  export class CatLabel {
9
9
  constructor() {
10
10
  this.requiredMarker = 'optional';
11
+ this.horizontal = false;
11
12
  this.for = undefined;
12
13
  this.required = false;
13
14
  }
@@ -66,6 +67,24 @@ export class CatLabel {
66
67
  "reflect": false,
67
68
  "defaultValue": "'optional'"
68
69
  },
70
+ "horizontal": {
71
+ "type": "boolean",
72
+ "mutable": false,
73
+ "complexType": {
74
+ "original": "boolean",
75
+ "resolved": "boolean",
76
+ "references": {}
77
+ },
78
+ "required": false,
79
+ "optional": false,
80
+ "docs": {
81
+ "tags": [],
82
+ "text": "Whether the label is on top or left."
83
+ },
84
+ "attribute": "horizontal",
85
+ "reflect": false,
86
+ "defaultValue": "false"
87
+ },
69
88
  "for": {
70
89
  "type": "string",
71
90
  "mutable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"cat-label.js","sourceRoot":"","sources":["../../../src/components/cat-label/cat-label.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;;GAIG;AAMH,MAAM,OAAO,QAAQ;;0BAa8E,UAAU;;oBAUxF,KAAK;;EAExB,OAAO;;IACL,IAAI,IAAI,CAAC,GAAG,EAAE;MACZ,4DAA4D;MAC5D,MAAA,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,0CAAE,KAAK,EAAE,CAAC;KACjF;EACH,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI;MACH,aAAO,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QACxD,eAAa;QACZ,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAC/D,YAAM,KAAK,EAAC,gBAAgB,iBAAa,MAAM;;UAC3C,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;cACrB,CACR;QACA,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAC9D,YAAM,KAAK,EAAC,gBAAgB,iBAAa,MAAM;;UAC3C,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;cACrB,CACR,CACK,CACH,CACR,CAAC;EACJ,CAAC;EAEO,gBAAgB,CAAC,EAAU;;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MACvD,MAAM,KAAK,GAAG,QAAQ,CAAC,oBAAoB,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;MACxE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,0CAAE,cAAc,CAAC,EAAE,CAAC,CAAC;QACvD,IAAI,MAAM,EAAE;UACV,OAAO,MAAM,CAAC;SACf;OACF;KACF;IACD,OAAO,IAAI,CAAC;EACd,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA9DuB,uBAAc,GAAG;EACvC,WAAW;EACX,cAAc;EACd,cAAc;EACd,YAAY;EACZ,WAAW;EACX,YAAY;CACb,CAAC","sourcesContent":["import { Component, h, Host, Prop } from '@stencil/core';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\n/**\n * Labels are used to provide a short description of an input or form element.\n *\n * @deprecated Use label attribute of form elements instead.\n */\n@Component({\n tag: 'cat-label',\n styleUrl: 'cat-label.scss',\n shadow: true\n})\nexport class CatLabel {\n private static readonly SHADOW_TARGETS = [\n 'CAT-INPUT',\n 'CAT-TEXTAREA',\n 'CAT-CHECKBOX',\n 'CAT-TOGGLE',\n 'CAT-RADIO',\n 'CAT-SELECT'\n ];\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * The unique identifier for a referenced input.\n */\n @Prop() for?: string;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n onClick() {\n if (this.for) {\n // focus target that is possibly hidden inside a shadow root\n (document.getElementById(this.for) || this.findShadowTarget(this.for))?.focus();\n }\n }\n\n render() {\n return (\n <Host>\n <label htmlFor={this.for} onClick={this.onClick.bind(this)}>\n <slot></slot>\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n </label>\n </Host>\n );\n }\n\n private findShadowTarget(id: string): HTMLElement | null {\n for (let i = 0; i < CatLabel.SHADOW_TARGETS.length; i++) {\n const elems = document.getElementsByTagName(CatLabel.SHADOW_TARGETS[i]);\n for (let i = 0; i < elems.length; i++) {\n const target = elems[i].shadowRoot?.getElementById(id);\n if (target) {\n return target;\n }\n }\n }\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"cat-label.js","sourceRoot":"","sources":["../../../src/components/cat-label/cat-label.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;;GAIG;AAMH,MAAM,OAAO,QAAQ;;0BAa8E,UAAU;sBAKtF,KAAK;;oBAUP,KAAK;;EAExB,OAAO;;IACL,IAAI,IAAI,CAAC,GAAG,EAAE;MACZ,4DAA4D;MAC5D,MAAA,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CA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;;;;;;;;;;;;;;;;;;;;;;;AAnEuB,uBAAc,GAAG;EACvC,WAAW;EACX,cAAc;EACd,cAAc;EACd,YAAY;EACZ,WAAW;EACX,YAAY;CACb,CAAC","sourcesContent":["import { Component, h, Host, Prop } from '@stencil/core';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\n/**\n * Labels are used to provide a short description of an input or form element.\n *\n * @deprecated Use label attribute of form elements instead.\n */\n@Component({\n tag: 'cat-label',\n styleUrl: 'cat-label.scss',\n shadow: true\n})\nexport class CatLabel {\n private static readonly SHADOW_TARGETS = [\n 'CAT-INPUT',\n 'CAT-TEXTAREA',\n 'CAT-CHECKBOX',\n 'CAT-TOGGLE',\n 'CAT-RADIO',\n 'CAT-SELECT'\n ];\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * The unique identifier for a referenced input.\n */\n @Prop() for?: string;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n onClick() {\n if (this.for) {\n // focus target that is possibly hidden inside a shadow root\n (document.getElementById(this.for) || this.findShadowTarget(this.for))?.focus();\n }\n }\n\n render() {\n return (\n <Host>\n <label htmlFor={this.for} onClick={this.onClick.bind(this)}>\n <slot></slot>\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n </label>\n </Host>\n );\n }\n\n private findShadowTarget(id: string): HTMLElement | null {\n for (let i = 0; i < CatLabel.SHADOW_TARGETS.length; i++) {\n const elems = document.getElementsByTagName(CatLabel.SHADOW_TARGETS[i]);\n for (let i = 0; i < elems.length; i++) {\n const target = elems[i].shadowRoot?.getElementById(id);\n if (target) {\n return target;\n }\n }\n }\n return null;\n }\n}\n"]}
@@ -31,7 +31,7 @@ export class CatNotificationService {
31
31
  : ''}
32
32
  </div>
33
33
  ${(options === null || options === void 0 ? void 0 : options.autoClose) === false
34
- ? `<cat-button class="cat-toastify-close cat-button-pull" size="s" icon="cross-outlined" variant="text" icon-only="true" class="close" a11y-label="${i18n.t('notification.dismiss')}"></cat-button>`
34
+ ? `<cat-button class="cat-toastify-close cat-button-pull" size="s" icon="$cat:notification-close" variant="text" icon-only="true" class="close" a11y-label="${i18n.t('notification.dismiss')}"></cat-button>`
35
35
  : ''}
36
36
  </div>`;
37
37
  const node = template.content.firstElementChild;