@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
@@ -0,0 +1,230 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { l as loglevel } from './loglevel.js';
3
+ import { c as coerceBoolean, a as coerceNumber } from './coerce.js';
4
+ import { C as CatFormHint } from './cat-form-hint.js';
5
+ import { c as catI18nRegistry } from './cat-i18n-registry.js';
6
+ import { d as defineCustomElement$3 } from './cat-button2.js';
7
+ import { d as defineCustomElement$2 } from './cat-icon2.js';
8
+ import { d as defineCustomElement$1 } from './cat-spinner2.js';
9
+
10
+ const catInputCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important}.cat-bg-primary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-link-primary,.cat-text-primary-hover{transition:color 0.13s}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important}.cat-bg-primaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 0.13s}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important}.cat-bg-secondary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}.cat-link-secondary,.cat-text-secondary-hover{transition:color 0.13s}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important}.cat-bg-secondaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 0.13s}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg-, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important}.cat-bg-success-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}.cat-link-success,.cat-text-success-hover{transition:color 0.13s}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important}.cat-bg-warning-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}.cat-link-warning,.cat-text-warning-hover{transition:color 0.13s}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important}.cat-bg-danger-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}.cat-link-danger,.cat-text-danger-hover{transition:color 0.13s}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.label-container{flex-basis:var(--label-size, 33.33%)}.label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container .label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem}.label-optional{display:flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-character-count{display:flex;align-items:center;margin-left:auto;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}.datepicker{width:min-content}.datepicker:not(.active){display:none}.datepicker-dropdown{position:absolute;z-index:20;padding-top:4px}.datepicker-dropdown.datepicker-orient-top{padding-top:0;padding-bottom:4px}.datepicker-picker{display:flex;flex-direction:column;border-radius:var(--cat-border-radius-m, 0.25rem);background-color:white}.datepicker-dropdown .datepicker-picker{box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08)}.datepicker-main{flex:auto;padding:2px}.datepicker-footer{box-shadow:none;background-color:transparent}.datepicker-title{box-shadow:none;background-color:hsl(0, 0%, 96%);padding:0.375rem 0.75rem;text-align:center;font-weight:700}.datepicker-controls{display:flex}.datepicker-header .datepicker-controls{padding:2px 2px 0}.datepicker-controls .button{display:inline-flex;position:relative;align-items:center;justify-content:center;margin:0;border:1px solid rgb(var(--cat-border-color, 235, 236, 240));border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:none;background-color:hsl(0, 0%, 100%);cursor:pointer;padding:calc(0.375em - 1px) 0.75em;height:2.25em;vertical-align:top;text-align:center;line-height:1.5;white-space:nowrap;color:hsl(0, 0%, 21%);font-size:0.9375rem}.datepicker-controls .button:focus,.datepicker-controls .button:active{outline:none}.datepicker-controls .button:hover{border-color:#b8b8b8;color:hsl(0, 0%, 21%)}.datepicker-controls .button:focus{border-color:hsl(217, 71%, 53%);color:hsl(0, 0%, 21%)}.datepicker-controls .button:focus:not(:active){box-shadow:0 0 0 0.125em rgba(50, 115, 220, 0.25)}.datepicker-controls .button:active{border-color:#474747;color:hsl(0, 0%, 21%)}.datepicker-controls .button[disabled]{cursor:not-allowed}.datepicker-header .datepicker-controls .button{border-color:transparent;font-weight:bold}.datepicker-header .datepicker-controls .button:hover{background-color:#f2f4f7}.datepicker-header .datepicker-controls .button:active{background-color:#f2f4f7}.datepicker-footer .datepicker-controls .button{flex:auto;margin:calc(0.375rem - 1px) 0.375rem;border-radius:var(--cat-border-radius-s, 0.125rem);font-size:0.875rem}.datepicker-controls .view-switch{flex:auto}.datepicker-controls .prev-button,.datepicker-controls .next-button{padding-right:0.375rem;padding-left:0.375rem;flex:0 0 14.2857142857%}.datepicker-controls .prev-button.disabled,.datepicker-controls .next-button.disabled{visibility:hidden}.datepicker-view,.datepicker-grid{display:flex}.datepicker-view{align-items:stretch;width:17.5rem}.datepicker-grid{flex-wrap:wrap;flex:auto}.datepicker .days{display:flex;flex-direction:column;flex:auto}.datepicker .days-of-week{display:flex}.datepicker .week-numbers{display:flex;flex-direction:column;flex:0 0 9.6774193548%}.datepicker .weeks{display:flex;flex-direction:column;align-items:stretch;flex:auto}.datepicker span{display:flex;align-items:center;justify-content:center;border-radius:var(--cat-border-radius-m, 0.25rem);cursor:default;-webkit-touch-callout:none;user-select:none}.datepicker .dow{height:2rem;font-size:0.875rem0.9375rem/2;font-weight:700}.datepicker .week{flex:auto;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem}.datepicker-cell,.datepicker .days .dow{flex-basis:14.2857142857%}.datepicker-cell{height:2.5rem}.datepicker-cell:not(.day){flex-basis:25%;height:5rem}.datepicker-cell:not(.disabled):hover{background-color:transparent;cursor:pointer}.datepicker-cell.focused:not(.selected){background-color:#f2f4f7}.datepicker-cell.selected,.datepicker-cell.selected:hover{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));color:rgb(var(--cat-primary-fill, 255, 255, 255));font-weight:700}.datepicker-cell.disabled{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.prev:not(.disabled),.datepicker-cell.next:not(.disabled){color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.prev.selected,.datepicker-cell.next.selected{color:rgb(var(--cat-primary-fill, 255, 255, 255))}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today){border-radius:0;background-color:#f2f4f7}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today):not(.disabled):hover{background-color:#f2f4f7}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today).focused{background-color:#f2f4f7}.datepicker-cell.today:not(.selected){background-color:transparent}.datepicker-cell.today:not(.selected):not(.disabled){color:rgb(var(--cat-primary-text, 0, 129, 148))}.datepicker-cell.today.focused:not(.selected){background-color:#f2f4f7}.datepicker-cell.range-end:not(.selected),.datepicker-cell.range-start:not(.selected){background-color:#b8b8b8;color:rgb(var(--cat-primary-fill, 255, 255, 255))}.datepicker-cell.range-end.focused:not(.selected),.datepicker-cell.range-start.focused:not(.selected){background-color:#b3b3b3}.datepicker-cell.range-start:not(.range-end){border-radius:var(--cat-border-radius-m, 0.25rem) 0 0 var(--cat-border-radius-m, 0.25rem)}.datepicker-cell.range-end:not(.range-start){border-radius:0 var(--cat-border-radius-m, 0.25rem) var(--cat-border-radius-m, 0.25rem) 0}.datepicker-cell.range{border-radius:0;background-color:gainsboro}.datepicker-cell.range:not(.disabled):not(.focused):not(.today):hover{background-color:#d7d7d7}.datepicker-cell.range.disabled{color:#c6c6c6}.datepicker-cell.range.focused{background-color:#d1d1d1}.datepicker-input.in-edit{border-color:#276bda}.datepicker-input.in-edit:focus,.datepicker-input.in-edit:active{box-shadow:none}.datepicker-picker{border:1px solid rgb(var(--cat-border-color, 235, 236, 240))}.datepicker-main{padding:0.5rem 1rem}.datepicker-view:has(.week-numbers){width:19.375rem}.datepicker-view.months,.datepicker-view.years{width:20rem}.datepicker .dow,.datepicker .week{font-size:0.75rem;line-height:1rem;font-weight:700;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.today:not(.selected){box-shadow:inset 0 0 0 2px rgb(var(--cat-primary-bg, 0, 129, 148))}.datepicker-cell.focused:not(.selected),.datepicker-cell:not(.selected):not(.disabled):hover{background-color:#f2f4f7}.datepicker-controls{gap:0.5rem}.datepicker-header .datepicker-controls{padding:1rem 1rem 0}.datepicker-header .datepicker-controls .button{height:2.5rem}.datepicker-header .datepicker-controls .prev-button,.datepicker-header .datepicker-controls .next-button{flex-basis:2.5rem;font-size:1.25rem}.datepicker-footer .datepicker-controls{padding:0 1rem 1rem}.datepicker-footer .datepicker-controls .button{margin:0;height:2.5rem;font-size:0.9375rem}.datepicker-footer .datepicker-controls .button:hover,.datepicker-footer .datepicker-controls .button:active{border-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1)::before{content:\"\";width:700%;height:100%;border-radius:var(--cat-border-radius-m, 0.25rem);position:absolute;top:0;left:0;opacity:0;z-index:1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).today:not(.selected)::before{box-shadow:inset 0 0 0 1.5px #008194;border-radius:var(--cat-border-radius-m, 0.25rem);opacity:1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1):not(:hover)::before{background:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1):hover::before{opacity:1;background-color:transparent}.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{color:white}.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{opacity:1;background-color:rgb(var(--cat-primary-bg, 0, 129, 148));z-index:-1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).focused{background:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).focused::before{opacity:1;background-color:#f2f4f7;z-index:-1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell{position:relative}.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{z-index:2}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.today:not(.selected){box-shadow:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell:not(.disabled):hover{background-color:inherit}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.focused{background:none}:host{display:flex;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);margin-bottom:1rem}:host([hidden]){display:none}.input-field,.input-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.input-field.input-horizontal{flex-direction:row;gap:1rem}.input-wrapper{display:flex;align-items:stretch;gap:0.75rem;padding:0 0.75rem;height:2.5rem;overflow:hidden;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:inset 0 0 0 1px rgb(var(--border-color));transition:box-shadow 0.13s linear;--border-color:var(--cat-border-color-dark, 215, 219, 224);}.input-wrapper.input-round{border-radius:10rem}.input-wrapper.input-disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-wrapper:not(.input-disabled):hover{box-shadow:inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color))}.input-wrapper:focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-1px}.input-wrapper.input-invalid{--border-color:var(--cat-danger-bg, 217, 52, 13), 0.2}.input-wrapper:has(input:-webkit-autofill),.input-wrapper:has(input:-webkit-autofill):hover,.input-wrapper:has(input:-webkit-autofill):focus{background-color:#e8f0fe}.text-prefix,.text-suffix{display:inline-flex;align-items:center;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.text-prefix{border-right:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-right:0.75rem}.text-suffix{border-left:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-left:0.75rem}.icon-prefix,.icon-suffix{align-self:center}.input-inner-wrapper{display:flex;align-items:center;position:relative;flex:1 1 auto}input{font:inherit;margin:0;padding:0;width:100%;min-width:0;border:none;outline:none;background:none;}.input-disabled input{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input.has-clearable{padding-right:1.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}.clearable{position:absolute;top:calc(50% - 1rem);right:-0.5rem}";
11
+
12
+ let nextUniqueId = 0;
13
+ const CatInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
14
+ constructor() {
15
+ super();
16
+ this.__registerHost();
17
+ this.__attachShadow();
18
+ this.catChange = createEvent(this, "catChange", 7);
19
+ this.catFocus = createEvent(this, "catFocus", 7);
20
+ this.catBlur = createEvent(this, "catBlur", 7);
21
+ this._id = `cat-input-${nextUniqueId++}`;
22
+ this.hasSlottedLabel = false;
23
+ this.hasSlottedHint = false;
24
+ this.errorMap = undefined;
25
+ this.requiredMarker = 'optional';
26
+ this.horizontal = false;
27
+ this.autoComplete = undefined;
28
+ this.clearable = false;
29
+ this.disabled = false;
30
+ this.hint = undefined;
31
+ this.icon = undefined;
32
+ this.iconRight = false;
33
+ this.identifier = undefined;
34
+ this.label = '';
35
+ this.labelHidden = false;
36
+ this.max = undefined;
37
+ this.maxLength = undefined;
38
+ this.min = undefined;
39
+ this.minLength = undefined;
40
+ this.name = undefined;
41
+ this.placeholder = undefined;
42
+ this.textPrefix = undefined;
43
+ this.textSuffix = undefined;
44
+ this.readonly = false;
45
+ this.required = false;
46
+ this.round = false;
47
+ this.type = 'text';
48
+ this.value = undefined;
49
+ this.errors = undefined;
50
+ this.errorUpdate = 0;
51
+ this.nativeAttributes = undefined;
52
+ }
53
+ get id() {
54
+ return this.identifier || this._id;
55
+ }
56
+ componentWillRender() {
57
+ this.watchErrorsHandler(this.errors);
58
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
59
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
60
+ if (!this.label && !this.hasSlottedLabel) {
61
+ loglevel.warn('[A11y] Missing ARIA label on input', this);
62
+ }
63
+ }
64
+ /**
65
+ * Programmatically move focus to the input. Use this method instead of
66
+ * `input.focus()`.
67
+ *
68
+ * @param options An optional object providing options to control aspects of
69
+ * the focusing process.
70
+ */
71
+ async doFocus(options) {
72
+ this.input.focus(options);
73
+ }
74
+ /**
75
+ * Programmatically remove focus from the input. Use this method instead of
76
+ * `input.blur()`.
77
+ */
78
+ async doBlur() {
79
+ this.input.blur();
80
+ }
81
+ /**
82
+ * Programmatically simulate a click on the input.
83
+ */
84
+ async doClick() {
85
+ this.input.click();
86
+ }
87
+ /**
88
+ * Clear the input.
89
+ */
90
+ async clear() {
91
+ this.value = '';
92
+ }
93
+ watchErrorsHandler(value) {
94
+ if (!coerceBoolean(this.errorUpdate)) {
95
+ this.errorMap = undefined;
96
+ }
97
+ else {
98
+ this.errorMapSrc = Array.isArray(value)
99
+ ? value.reduce((acc, err) => (Object.assign(Object.assign({}, acc), { [err]: undefined })), {})
100
+ : value === true
101
+ ? {}
102
+ : value || undefined;
103
+ this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();
104
+ }
105
+ }
106
+ render() {
107
+ var _a, _b, _c;
108
+ return (h("div", { class: {
109
+ 'input-field': true,
110
+ 'input-horizontal': this.horizontal
111
+ } }, h("div", { class: {
112
+ hidden: this.labelHidden,
113
+ 'label-container': true
114
+ } }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id }, h("span", { class: "label-wrapper", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, h("div", { class: "label-metadata" }, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")")), this.maxLength && (h("div", { class: "label-character-count", "aria-hidden": "true" }, (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.toString().length) !== null && _b !== void 0 ? _b : 0, "/", this.maxLength))))))), h("div", { class: "input-container" }, h("div", { class: {
115
+ 'input-wrapper': true,
116
+ 'input-round': this.round,
117
+ 'input-disabled': this.disabled,
118
+ 'input-invalid': this.invalid
119
+ }, 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: {
120
+ 'has-clearable': this.clearable && !this.disabled
121
+ }, 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": catI18nRegistry.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 })))));
122
+ }
123
+ get invalid() {
124
+ return !!this.errorMap;
125
+ }
126
+ onInput(event) {
127
+ this.value = this.input.value;
128
+ this.catChange.emit(event);
129
+ this.showErrorsIfTimeout();
130
+ }
131
+ onFocus(event) {
132
+ this.catFocus.emit(event);
133
+ }
134
+ onBlur(event) {
135
+ this.catBlur.emit(event);
136
+ if (coerceBoolean(this.errorUpdate)) {
137
+ this.showErrors();
138
+ }
139
+ }
140
+ showErrors() {
141
+ this.errorMap = this.errorMapSrc;
142
+ }
143
+ showErrorsIfTimeout() {
144
+ const errorUpdate = coerceNumber(this.errorUpdate, null);
145
+ if (errorUpdate !== null) {
146
+ typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);
147
+ this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);
148
+ return true;
149
+ }
150
+ return false;
151
+ }
152
+ showErrorsIfNoFocus() {
153
+ const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.input;
154
+ if (!hasFocus) {
155
+ this.showErrors();
156
+ }
157
+ }
158
+ get hostElement() { return this; }
159
+ static get watchers() { return {
160
+ "errors": ["watchErrorsHandler"]
161
+ }; }
162
+ static get style() { return catInputCss; }
163
+ }, [1, "cat-input", {
164
+ "requiredMarker": [1, "required-marker"],
165
+ "horizontal": [4],
166
+ "autoComplete": [1, "auto-complete"],
167
+ "clearable": [4],
168
+ "disabled": [4],
169
+ "hint": [1],
170
+ "icon": [1],
171
+ "iconRight": [4, "icon-right"],
172
+ "identifier": [1],
173
+ "label": [1],
174
+ "labelHidden": [4, "label-hidden"],
175
+ "max": [8],
176
+ "maxLength": [2, "max-length"],
177
+ "min": [8],
178
+ "minLength": [2, "min-length"],
179
+ "name": [1],
180
+ "placeholder": [1],
181
+ "textPrefix": [1, "text-prefix"],
182
+ "textSuffix": [1, "text-suffix"],
183
+ "readonly": [4],
184
+ "required": [4],
185
+ "round": [4],
186
+ "type": [1],
187
+ "value": [1032],
188
+ "errors": [4],
189
+ "errorUpdate": [8, "error-update"],
190
+ "nativeAttributes": [16],
191
+ "hasSlottedLabel": [32],
192
+ "hasSlottedHint": [32],
193
+ "errorMap": [32],
194
+ "doFocus": [64],
195
+ "doBlur": [64],
196
+ "doClick": [64],
197
+ "clear": [64]
198
+ }]);
199
+ function defineCustomElement() {
200
+ if (typeof customElements === "undefined") {
201
+ return;
202
+ }
203
+ const components = ["cat-input", "cat-button", "cat-icon", "cat-spinner"];
204
+ components.forEach(tagName => { switch (tagName) {
205
+ case "cat-input":
206
+ if (!customElements.get(tagName)) {
207
+ customElements.define(tagName, CatInput);
208
+ }
209
+ break;
210
+ case "cat-button":
211
+ if (!customElements.get(tagName)) {
212
+ defineCustomElement$3();
213
+ }
214
+ break;
215
+ case "cat-icon":
216
+ if (!customElements.get(tagName)) {
217
+ defineCustomElement$2();
218
+ }
219
+ break;
220
+ case "cat-spinner":
221
+ if (!customElements.get(tagName)) {
222
+ defineCustomElement$1();
223
+ }
224
+ break;
225
+ } });
226
+ }
227
+
228
+ export { CatInput as C, defineCustomElement as d };
229
+
230
+ //# sourceMappingURL=cat-input2.js.map
@@ -0,0 +1 @@
1
+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AAI,WAAW,KAAK,IAAI,EAAE;MACxB,OAAO,IAAI,CAAC,oBAAoB,KAAK,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;MAChG,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,EAAE,WAAW,CAAC,CAAC;MACpF,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;GACd;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;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["log","i18n"],"sources":["./src/components/cat-input/cat-input.scss?tag=cat-input&encapsulation=shadow","./src/components/cat-input/cat-input.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n@use 'utils/color';\n@use '_snippets/form-label';\n@use '../cat-datepicker/vanillajs-datepicker.scss';\n\n:host {\n display: flex;\n @include cat-body('m');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.input-field,\n.input-container {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n flex: 1 1 auto;\n}\n\n.input-field.input-horizontal {\n flex-direction: row;\n gap: 1rem;\n}\n\n.input-wrapper {\n display: flex;\n align-items: stretch;\n gap: 0.75rem;\n padding: 0 0.75rem;\n height: form-label.$cat-input-height;\n overflow: hidden;\n background: cat-token('color.ui.background.input');\n border-radius: cat-border-radius('m');\n box-shadow: inset 0 0 0 1px rgb(var(--border-color));\n transition: box-shadow cat-token('time.transition.s') linear;\n --border-color: #{cat-token('color.ui.border.dark', $wrap: false)};\n\n &.input-round {\n border-radius: 10rem;\n }\n\n &.input-disabled {\n background: cat-token('color.ui.background.muted');\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &:not(.input-disabled):hover {\n box-shadow: inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color));\n }\n\n &:focus-within {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: -1px;\n }\n\n &.input-invalid {\n --border-color: #{cat-token('color.theme.danger.bg', 0.2, $wrap: false)};\n }\n\n /* stylelint-disable property-no-vendor-prefix */\n &:has(input:-webkit-autofill) {\n &,\n &:hover,\n &:focus {\n background-color: cat-token('color.ui.background.inputAutofill');\n }\n }\n /* stylelint-enable property-no-vendor-prefix */\n}\n\n.text-prefix,\n.text-suffix {\n display: inline-flex;\n align-items: center;\n @include cat-select(none);\n}\n\n.text-prefix {\n border-right: 1px solid cat-token('color.ui.border.dark');\n padding-right: 0.75rem;\n}\n\n.text-suffix {\n border-left: 1px solid cat-token('color.ui.border.dark');\n padding-left: 0.75rem;\n}\n\n.icon-prefix,\n.icon-suffix {\n align-self: center;\n}\n\n.input-inner-wrapper {\n display: flex;\n align-items: center;\n position: relative;\n flex: 1 1 auto;\n}\n\ninput {\n font: inherit;\n margin: 0;\n padding: 0;\n width: 100%;\n min-width: 0;\n border: none;\n outline: none;\n background: none;\n\n .input-disabled & {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &.has-clearable {\n padding-right: 1.5rem;\n }\n\n &::placeholder {\n color: cat-token('color.ui.font.muted');\n }\n\n /* stylelint-disable property-no-vendor-prefix */\n &:-webkit-autofill {\n &,\n &:hover,\n &:focus {\n -webkit-box-shadow: 0 0 0 9999px cat-token('color.ui.background.inputAutofill') inset;\n }\n }\n /* stylelint-enable property-no-vendor-prefix */\n}\n\n.clearable {\n position: absolute;\n top: calc(50% - 1rem);\n right: -0.5rem;\n}\n","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"],"version":3}
@@ -9,6 +9,7 @@ const CatLabel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
9
  this.__registerHost();
10
10
  this.__attachShadow();
11
11
  this.requiredMarker = 'optional';
12
+ this.horizontal = false;
12
13
  this.for = undefined;
13
14
  this.required = false;
14
15
  }
@@ -38,6 +39,7 @@ const CatLabel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
38
39
  static get style() { return catLabelCss; }
39
40
  }, [1, "cat-label", {
40
41
  "requiredMarker": [1, "required-marker"],
42
+ "horizontal": [4],
41
43
  "for": [1],
42
44
  "required": [4]
43
45
  }]);
@@ -1 +1 @@
1
- {"file":"cat-label.js","mappings":";;;AAAA,MAAM,WAAW,GAAG,sQAAsQ;;MCa7QA,UAAQ;;;;;0BAa8E,UAAU;;oBAUxF,KAAK;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AAM,CAAC;SACf;OACF;KACF;IACD,OAAO,IAAI,CAAC;GACb;;;;;;;AA9DuBA,yBAAc,GAAG;EACvC,WAAW;EACX,cAAc;EACd,cAAc;EACd,YAAY;EACZ,WAAW;EACX,YAAY;CACb,CAAC;;;;;;;;;;;;;;;;;;;;","names":["CatLabel","i18n"],"sources":["./src/components/cat-label/cat-label.scss?tag=cat-label&encapsulation=shadow","./src/components/cat-label/cat-label.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: inline-flex;\n align-items: center;\n min-height: 2.5rem;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.input-optional {\n margin-left: 0.25rem;\n @include cat-body('xs');\n color: cat-token('color.ui.font.muted');\n}\n","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"],"version":3}
1
+ {"file":"cat-label.js","mappings":";;;AAAA,MAAM,WAAW,GAAG,sQAAsQ;;MCa7QA,UAAQ;;;;;0BAa8E,UAAU;sBAKtF,KAAK;;oBAUP,KAAK;;EAExB,OAAO;;IACL,IAAI,IAAI,CAAC,GAAG,EAAE;;MAEZ,OAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,0CAAE,KAAK,EAAE,CAAC;KACjF;GACF;EAED,MAAM;IACJ,QACE,EAAC,IAAI,QACH,aAAO,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IACxD,eAAa,EACZ,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,KAC3D,YAAM,KAAK,EAAC,gBAAgB,iBAAa,MAAM,SAC3CC,eAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,MACrB,CACR,EACA,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,KAC1D,YAAM,KAAK,EAAC,gBAAgB,iBAAa,MAAM,SAC3CA,eAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,MACrB,CACR,CACK,CACH,EACP;GACH;EAEO,gBAAgB,CAAC,EAAU;;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAGD,UAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MACvD,MAAM,KAAK,GAAG,QAAQ,CAAC,oBAAoB,CAACA,UAAQ,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;GACb;;;;;;;;AAnEuBA,yBAAc,GAAG;EACvC,WAAW;EACX,cAAc;EACd,cAAc;EACd,YAAY;EACZ,WAAW;EACX,YAAY;CACb,CAAC;;;;;;;;;;;;;;;;;;;;","names":["CatLabel","i18n"],"sources":["./src/components/cat-label/cat-label.scss?tag=cat-label&encapsulation=shadow","./src/components/cat-label/cat-label.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: inline-flex;\n align-items: center;\n min-height: 2.5rem;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.input-optional {\n margin-left: 0.25rem;\n @include cat-body('xs');\n color: cat-token('color.ui.font.muted');\n}\n","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"],"version":3}
@@ -1,4 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { c as catI18nRegistry } from './cat-i18n-registry.js';
3
3
  import { d as defineCustomElement$4 } from './cat-button2.js';
4
4
  import { d as defineCustomElement$3 } from './cat-icon2.js';
@@ -11,6 +11,7 @@ const CatPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
11
11
  super();
12
12
  this.__registerHost();
13
13
  this.__attachShadow();
14
+ this.catChange = createEvent(this, "catChange", 7);
14
15
  this.page = 0;
15
16
  this.pageCount = 1;
16
17
  this.activePadding = 1;
@@ -19,13 +20,13 @@ const CatPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
19
20
  this.variant = 'text';
20
21
  this.round = false;
21
22
  this.compact = false;
22
- this.iconPrev = 'chevron-left-outlined';
23
- this.iconNext = 'chevron-right-outlined';
23
+ this.iconPrev = '$cat:pagination-left';
24
+ this.iconNext = '$cat:pagination-right';
24
25
  }
25
26
  render() {
26
27
  return (h("nav", { role: "navigation" }, h("ol", { class: {
27
28
  [`cat-pagination-${this.size}`]: Boolean(this.size)
28
- } }, h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isFirst, a11yLabel: catI18nRegistry.t('pagination.prev'), icon: this.iconPrev, iconOnly: true, onClick: () => (this.page = this.page - 1) })), this.content, h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isLast, a11yLabel: catI18nRegistry.t('pagination.next'), icon: this.iconNext, iconOnly: true, onClick: () => (this.page = this.page + 1) })))));
29
+ } }, h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isFirst, a11yLabel: catI18nRegistry.t('pagination.prev'), icon: this.iconPrev, iconOnly: true, onClick: () => this.setPage(this.page - 1) })), this.content, h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isLast, a11yLabel: catI18nRegistry.t('pagination.next'), icon: this.iconNext, iconOnly: true, onClick: () => this.setPage(this.page + 1) })))));
29
30
  }
30
31
  get isFirst() {
31
32
  return this.page === 0;
@@ -33,6 +34,10 @@ const CatPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
33
34
  get isLast() {
34
35
  return this.page === this.pageCount - 1;
35
36
  }
37
+ setPage(value) {
38
+ this.page = value;
39
+ this.catChange.emit(this.page);
40
+ }
36
41
  get pages() {
37
42
  if (!this.sidePadding && !this.activePadding) {
38
43
  return [this.page];
@@ -67,7 +72,7 @@ const CatPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
67
72
  }
68
73
  return this.pages.map((page, i) => [
69
74
  i > 0 && this.pages[i - 1] !== page - 1 ? h("li", { class: "dots" }, "\u2026") : null,
70
- h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, color: this.page === page ? 'primary' : undefined, active: this.page === page, a11yLabel: catI18nRegistry.t('pagination.page', { page: page + 1 }), a11yCurrent: this.page === page ? 'step' : undefined, onClick: () => (this.page = page) }, page + 1))
75
+ h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, color: this.page === page ? 'primary' : undefined, active: this.page === page, a11yLabel: catI18nRegistry.t('pagination.page', { page: page + 1 }), a11yCurrent: this.page === page ? 'step' : undefined, onClick: () => this.setPage(page) }, page + 1))
71
76
  ]);
72
77
  }
73
78
  static get style() { return catPaginationCss; }
@@ -1 +1 @@
1
- {"file":"cat-pagination.js","mappings":";;;;;;AAAA,MAAM,gBAAgB,GAAG,+vCAA+vC;;MCe3wCA,eAAa;;;;;gBAIQ,CAAC;qBAKb,CAAC;yBAKG,CAAC;uBAKH,CAAC;gBAKuB,GAAG;mBAKC,MAAM;iBAKxC,KAAK;mBAKH,KAAK;oBAKJ,uBAAuB;oBAKvB,wBAAwB;;EAE3C,MAAM;IACJ,QACE,WAAK,IAAI,EAAC,YAAY,IACpB,UACE,KAAK,EAAE;QACL,CAAC,kBAAkB,IAAI,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;OACpD,IAED,cACE,kBACE,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,OAAO,EACtB,SAAS,EAAEC,eAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,EACpC,IAAI,EAAE,IAAI,CAAC,QAA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IAAI,IAAI,CAAC,OAAO,EAAE;MAChB,QACE,UAAI,KAAK,EAAC,MAAM,IACb,IAAI,CAAC,IAAI,GAAG,CAAC,OAAG,IAAI,CAAC,SAAS,CAC5B,EACL;KACH;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK;MACjC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,UAAI,KAAK,EAAC,MAAM,aAAO,GAAG,IAAI;MACxE,cACE,kBACE,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,SAAS,GAAG,SAAS,EACjD,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,EAC1B,SAAS,EAAEA,eAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,EACxD,WAAW,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,SAAS,EACpD,OAAO,EAAE,OAAO,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAEhC,IAAI,GAAG,CAAC,CACE,CACV;KACN,CAAC,CAAC;GACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatPagination","i18n"],"sources":["./src/components/cat-pagination/cat-pagination.scss?tag=cat-pagination&encapsulation=shadow","./src/components/cat-pagination/cat-pagination.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n$button-sizes: (\n 'xl': 3.5rem,\n 'l': 3rem,\n 'm': 2.5rem,\n 's': 2rem,\n 'xs': 1.5rem\n);\n\n:host {\n display: inline-block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nol {\n display: flex;\n flex-wrap: wrap;\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\nli {\n display: inline-flex;\n justify-content: center;\n\n &.dots {\n @include cat-select(none);\n }\n}\n\n// ----- variant\n\n:host([variant='outlined']) {\n ol {\n gap: 0.75rem;\n }\n}\n\n// ----- size\n\n@mixin size($size, $fontSize) {\n .cat-pagination-#{$size} {\n li.dots,\n li.text {\n height: map.get($button-sizes, $size);\n line-height: map.get($button-sizes, $size);\n font-size: cat-body-font-size($fontSize);\n }\n\n li.dots {\n width: map.get($button-sizes, $size);\n }\n }\n\n :host([variant='outlined']) {\n .cat-pagination-#{$size} {\n gap: map.get($button-sizes, $size) * 0.25;\n }\n }\n}\n\n@include size('xs', 's');\n@include size('s', 'm');\n@include size('m', 'm');\n@include size('l', 'm');\n@include size('xl', 'l');\n","import { Component, h, Prop } from '@stencil/core';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\n/**\n * A navigation component to switch between different pages of paged chunks of\n * data such as a table. Pagination is built with list HTML elements and a\n * wrapping `<nav>` element to identify it as a navigation section to screen\n * readers and other assistive technologies. Furthermore, the current page is\n * correctly highlighted using `aria-current`.\n */\n@Component({\n tag: 'cat-pagination',\n styleUrl: 'cat-pagination.scss',\n shadow: true\n})\nexport class CatPagination {\n /**\n * The current page.\n */\n @Prop({ mutable: true }) page = 0;\n\n /**\n * The total number of pages.\n */\n @Prop() pageCount = 1;\n\n /**\n * The number of pages to be shown around the current page.\n */\n @Prop() activePadding = 1;\n\n /**\n * The number of pages to be shown at the edges.\n */\n @Prop() sidePadding = 1;\n\n /**\n * The size of the buttons.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The rendering style of the buttons.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'text';\n\n /**\n * Use round button edges.\n */\n @Prop() round = false;\n\n /**\n * Use compact pagination mode.\n */\n @Prop() compact = false;\n\n /**\n * The icon of the \"previous\" button.\n */\n @Prop() iconPrev = 'chevron-left-outlined';\n\n /**\n * The icon of the \"next\" button.\n */\n @Prop() iconNext = 'chevron-right-outlined';\n\n render() {\n return (\n <nav role=\"navigation\">\n <ol\n class={{\n [`cat-pagination-${this.size}`]: Boolean(this.size)\n }}\n >\n <li>\n <cat-button\n variant={this.variant}\n size={this.size}\n round={this.round}\n disabled={this.isFirst}\n a11yLabel={i18n.t('pagination.prev')}\n icon={this.iconPrev}\n iconOnly\n onClick={() => (this.page = this.page - 1)}\n ></cat-button>\n </li>\n {this.content}\n <li>\n <cat-button\n variant={this.variant}\n size={this.size}\n round={this.round}\n disabled={this.isLast}\n a11yLabel={i18n.t('pagination.next')}\n icon={this.iconNext}\n iconOnly\n onClick={() => (this.page = this.page + 1)}\n ></cat-button>\n </li>\n </ol>\n </nav>\n );\n }\n\n get isFirst() {\n return this.page === 0;\n }\n\n get isLast() {\n return this.page === this.pageCount - 1;\n }\n\n get pages() {\n if (!this.sidePadding && !this.activePadding) {\n return [this.page];\n }\n\n const result = new Set<number>();\n const minPage = this.page <= this.sidePadding + this.activePadding + 1;\n const minActivepage = minPage ? this.sidePadding + 2 * this.activePadding + 2 : this.sidePadding;\n const maxPage = this.page >= this.pageCount - this.sidePadding - this.activePadding - 2;\n const maxActivepage = maxPage\n ? this.pageCount - this.sidePadding - 2 * this.activePadding - 2\n : this.pageCount - this.sidePadding;\n\n this.addSeq(result, 0, minActivepage);\n if (!minPage && !maxPage) {\n this.addSeq(result, this.page - this.activePadding, this.page + this.activePadding + 1);\n }\n this.addSeq(result, maxActivepage, this.pageCount);\n\n return [...result];\n }\n\n private addSeq(set: Set<number>, start: number, end: number) {\n const _start = this.clamp(start, 0, this.pageCount);\n const _end = this.clamp(end, 0, this.pageCount);\n Array(_end - _start)\n .fill(0)\n .forEach((_, i) => set.add(_start + i));\n }\n\n private clamp(num: number, min: number, max: number) {\n return Math.min(Math.max(num, min), max);\n }\n\n private get content() {\n if (this.compact) {\n return (\n <li class=\"text\">\n {this.page + 1}/{this.pageCount}\n </li>\n );\n }\n\n return this.pages.map((page, i) => [\n i > 0 && this.pages[i - 1] !== page - 1 ? <li class=\"dots\">…</li> : null,\n <li>\n <cat-button\n variant={this.variant}\n size={this.size}\n round={this.round}\n color={this.page === page ? 'primary' : undefined}\n active={this.page === page}\n a11yLabel={i18n.t('pagination.page', { page: page + 1 })}\n a11yCurrent={this.page === page ? 'step' : undefined}\n onClick={() => (this.page = page)}\n >\n {page + 1}\n </cat-button>\n </li>\n ]);\n }\n}\n"],"version":3}
1
+ {"file":"cat-pagination.js","mappings":";;;;;;AAAA,MAAM,gBAAgB,GAAG,+vCAA+vC;;MCe3wCA,eAAa;;;;;;gBAIQ,CAAC;qBAKb,CAAC;yBAKG,CAAC;uBAKH,CAAC;gBAKuB,GAAG;mBAKC,MAAM;iBAKxC,KAAK;mBAKH,KAAK;oBAKJ,sBAAsB;oBAKtB,uBAAuB;;EAO1C,MAAM;IACJ,QACE,WAAK,IAAI,EAAC,YAAY,IACpB,UACE,KAAK,EAAE;QACL,CAAC,kBAAkB,IAAI,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;OACpD,IAED,cACE,kBACE,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,OAAO,EACtB,SAAS,EAAEC,eAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,EACpC,IAAI,EAAE,IAAI,CAAC,QAAQ,EACnB,QAAQ,QACR,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAC9B,CACX,EACJ,IAAI,CAAC,OAAO,EACb,cACE,kBACE,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KA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C,IAAI,GAAG,CAAC,OAAG,IAAI,CAAC,SAAS,CAC5B,EACL;KACH;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK;MACjC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,UAAI,KAAK,EAAC,MAAM,aAAO,GAAG,IAAI;MACxE,cACE,kBACE,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,SAAS,GAAG,SAAS,EACjD,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,EAC1B,SAAS,EAAEA,eAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,EACxD,WAAW,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,SAAS,EACpD,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAEhC,IAAI,GAAG,CAAC,CACE,CACV;KACN,CAAC,CAAC;GACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatPagination","i18n"],"sources":["./src/components/cat-pagination/cat-pagination.scss?tag=cat-pagination&encapsulation=shadow","./src/components/cat-pagination/cat-pagination.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n$button-sizes: (\n 'xl': 3.5rem,\n 'l': 3rem,\n 'm': 2.5rem,\n 's': 2rem,\n 'xs': 1.5rem\n);\n\n:host {\n display: inline-block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nol {\n display: flex;\n flex-wrap: wrap;\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\nli {\n display: inline-flex;\n justify-content: center;\n\n &.dots {\n @include cat-select(none);\n }\n}\n\n// ----- variant\n\n:host([variant='outlined']) {\n ol {\n gap: 0.75rem;\n }\n}\n\n// ----- size\n\n@mixin size($size, $fontSize) {\n .cat-pagination-#{$size} {\n li.dots,\n li.text {\n height: map.get($button-sizes, $size);\n line-height: map.get($button-sizes, $size);\n font-size: cat-body-font-size($fontSize);\n }\n\n li.dots {\n width: map.get($button-sizes, $size);\n }\n }\n\n :host([variant='outlined']) {\n .cat-pagination-#{$size} {\n gap: map.get($button-sizes, $size) * 0.25;\n }\n }\n}\n\n@include size('xs', 's');\n@include size('s', 'm');\n@include size('m', 'm');\n@include size('l', 'm');\n@include size('xl', 'l');\n","import { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\n/**\n * A navigation component to switch between different pages of paged chunks of\n * data such as a table. Pagination is built with list HTML elements and a\n * wrapping `<nav>` element to identify it as a navigation section to screen\n * readers and other assistive technologies. Furthermore, the current page is\n * correctly highlighted using `aria-current`.\n */\n@Component({\n tag: 'cat-pagination',\n styleUrl: 'cat-pagination.scss',\n shadow: true\n})\nexport class CatPagination {\n /**\n * The current page.\n */\n @Prop({ mutable: true }) page = 0;\n\n /**\n * The total number of pages.\n */\n @Prop() pageCount = 1;\n\n /**\n * The number of pages to be shown around the current page.\n */\n @Prop() activePadding = 1;\n\n /**\n * The number of pages to be shown at the edges.\n */\n @Prop() sidePadding = 1;\n\n /**\n * The size of the buttons.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The rendering style of the buttons.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'text';\n\n /**\n * Use round button edges.\n */\n @Prop() round = false;\n\n /**\n * Use compact pagination mode.\n */\n @Prop() compact = false;\n\n /**\n * The icon of the \"previous\" button.\n */\n @Prop() iconPrev = '$cat:pagination-left';\n\n /**\n * The icon of the \"next\" button.\n */\n @Prop() iconNext = '$cat:pagination-right';\n\n /**\n * Emitted when the page of the pagination has changed.\n */\n @Event() catChange!: EventEmitter;\n\n render() {\n return (\n <nav role=\"navigation\">\n <ol\n class={{\n [`cat-pagination-${this.size}`]: Boolean(this.size)\n }}\n >\n <li>\n <cat-button\n variant={this.variant}\n size={this.size}\n round={this.round}\n disabled={this.isFirst}\n a11yLabel={i18n.t('pagination.prev')}\n icon={this.iconPrev}\n iconOnly\n onClick={() => this.setPage(this.page - 1)}\n ></cat-button>\n </li>\n {this.content}\n <li>\n <cat-button\n variant={this.variant}\n size={this.size}\n round={this.round}\n disabled={this.isLast}\n a11yLabel={i18n.t('pagination.next')}\n icon={this.iconNext}\n iconOnly\n onClick={() => this.setPage(this.page + 1)}\n ></cat-button>\n </li>\n </ol>\n </nav>\n );\n }\n\n get isFirst() {\n return this.page === 0;\n }\n\n get isLast() {\n return this.page === this.pageCount - 1;\n }\n\n private setPage(value: number) {\n this.page = value;\n this.catChange.emit(this.page);\n }\n\n get pages() {\n if (!this.sidePadding && !this.activePadding) {\n return [this.page];\n }\n\n const result = new Set<number>();\n const minPage = this.page <= this.sidePadding + this.activePadding + 1;\n const minActivepage = minPage ? this.sidePadding + 2 * this.activePadding + 2 : this.sidePadding;\n const maxPage = this.page >= this.pageCount - this.sidePadding - this.activePadding - 2;\n const maxActivepage = maxPage\n ? this.pageCount - this.sidePadding - 2 * this.activePadding - 2\n : this.pageCount - this.sidePadding;\n\n this.addSeq(result, 0, minActivepage);\n if (!minPage && !maxPage) {\n this.addSeq(result, this.page - this.activePadding, this.page + this.activePadding + 1);\n }\n this.addSeq(result, maxActivepage, this.pageCount);\n\n return [...result];\n }\n\n private addSeq(set: Set<number>, start: number, end: number) {\n const _start = this.clamp(start, 0, this.pageCount);\n const _end = this.clamp(end, 0, this.pageCount);\n Array(_end - _start)\n .fill(0)\n .forEach((_, i) => set.add(_start + i));\n }\n\n private clamp(num: number, min: number, max: number) {\n return Math.min(Math.max(num, min), max);\n }\n\n private get content() {\n if (this.compact) {\n return (\n <li class=\"text\">\n {this.page + 1}/{this.pageCount}\n </li>\n );\n }\n\n return this.pages.map((page, i) => [\n i > 0 && this.pages[i - 1] !== page - 1 ? <li class=\"dots\">…</li> : null,\n <li>\n <cat-button\n variant={this.variant}\n size={this.size}\n round={this.round}\n color={this.page === page ? 'primary' : undefined}\n active={this.page === page}\n a11yLabel={i18n.t('pagination.page', { page: page + 1 })}\n a11yCurrent={this.page === page ? 'step' : undefined}\n onClick={() => this.setPage(page)}\n >\n {page + 1}\n </cat-button>\n </li>\n ]);\n }\n}\n"],"version":3}
@@ -1 +1 @@
1
- {"file":"cat-radio-group.js","mappings":";;AAAA,MAAM,gBAAgB,GAAG,mDAAmD;;MCU/DA,eAAa;;;;;;;IAChB,kBAAa,GAA0B,EAAE,CAAC;;;oBAiB/B,KAAK;;qBAWJ,KAAK;;EAazB,aAAa,CAAC,OAAgB;IAC5B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;GACnE;EAGD,cAAc,CAAC,QAAiB;IAC9B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;IACzF,IAAI,CAAC,cAAc,EAAE,CAAC;GACvB;EAGD,iBAAiB,CAAC,QAAiB;IACjC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;GACxE;EAGD,kBAAkB,CAAC,SAAkB;IACnC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ;MACjC,IAAI,SAAS,EAAE;QACb,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;OAChC;KACF,CAAC,CAAC;GACJ;EAED,gBAAgB;IAC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sources":["./src/components/cat-radio-group/cat-radio-group.scss?tag=cat-radio-group&encapsulation=shadow","./src/components/cat-radio-group/cat-radio-group.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n","import { Component, Element, Event, EventEmitter, h, Listen, Prop, Watch } from '@stencil/core';\n\n/**\n * A group of radio buttons.\n */\n@Component({\n tag: 'cat-radio-group',\n styleUrl: 'cat-radio-group.scss',\n shadow: true\n})\nexport class CatRadioGroup {\n private catRadioGroup: HTMLCatRadioElement[] = [];\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The name of the radio group component.\n */\n @Prop() name?: string;\n\n /**\n * The value of the radio group.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Whether this radio group is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Adds an accessible label for the radio group that\n * it is only shown in assistive technologies, like screen readers.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n /**\n * Whether the label of the radios should appear to the left of them.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the radio group loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n @Watch('name')\n onNameChanged(newName?: string) {\n this.catRadioGroup.forEach(catRadio => (catRadio.name = newName));\n }\n\n @Watch('value')\n onValueChanged(newValue?: string) {\n this.catRadioGroup.forEach(catRadio => (catRadio.checked = catRadio.value === newValue));\n this.updateTabIndex();\n }\n\n @Watch('disabled')\n onDisabledChanged(disabled: boolean) {\n this.catRadioGroup.forEach(catRadio => (catRadio.disabled = disabled));\n }\n\n @Watch('labelLeft')\n onLabelLeftChanged(labelLeft: boolean) {\n this.catRadioGroup.forEach(catRadio => {\n if (labelLeft) {\n catRadio.labelLeft = labelLeft;\n }\n });\n }\n\n componentDidLoad(): void {\n this.catRadioGroup = Array.from(this.hostElement.querySelectorAll(`cat-radio`));\n this.onNameChanged(this.name);\n this.onValueChanged(this.value);\n this.onDisabledChanged(this.disabled);\n this.onLabelLeftChanged(this.labelLeft);\n }\n\n @Listen('keydown')\n onKeydown(event: KeyboardEvent): void {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key) && this.catRadioGroup.length) {\n const targetElements = this.catRadioGroup.filter(catRadio => !catRadio.disabled);\n const activeElement = document.activeElement as HTMLCatRadioElement;\n const activeIdx = this.catRadioGroup.findIndex(catRadio => catRadio === activeElement);\n const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].doFocus();\n targetElements[targetIdx].shadowRoot?.querySelector('input')?.click();\n this.updateTabIndex();\n event.preventDefault();\n }\n }\n\n @Listen('input')\n onInput(event: MouseEvent): void {\n const catRadioElement = this.catRadioGroup.find(value => value === event.target);\n this.value = catRadioElement?.value;\n this.catChange.emit();\n }\n\n @Listen('blur', { capture: true })\n onBlur(event: FocusEvent): void {\n if (!event.relatedTarget) {\n this.catBlur.emit(event);\n }\n }\n\n render() {\n return (\n <div role=\"radiogroup\" aria-label={this.a11yLabel}>\n <slot></slot>\n </div>\n );\n }\n\n private updateTabIndex() {\n if (this.catRadioGroup.length) {\n this.catRadioGroup.forEach(value => value.shadowRoot?.querySelector('input')?.setAttribute('tabindex', '-1'));\n const checkedRadioIndex = this.catRadioGroup.findIndex(value => value.checked);\n this.catRadioGroup[checkedRadioIndex >= 0 ? checkedRadioIndex : 0].shadowRoot\n ?.querySelector('input')\n ?.setAttribute('tabindex', '0');\n }\n }\n}\n"],"version":3}
1
+ {"file":"cat-radio-group.js","mappings":";;AAAA,MAAM,gBAAgB,GAAG,mDAAmD;;MCU/DA,eAAa;;;;;;;IAChB,kBAAa,GAA0B,EAAE,CAAC;;;oBAiB/B,KAAK;;qBAWJ,KAAK;;EAazB,aAAa,CAA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AAS,IAC/C,eAAa,CACT,EACN;GACH;EAEO,cAAc;;IACpB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;MAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,kBAAI,OAAA,MAAA,MAAA,KAAK,CAAC,UAAU,0CAAE,aAAa,CAAC,OAAO,CAAC,0CAAE,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA,EAAA,CAAC,CAAC;MAC9G,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;MAC/E,MAAA,MAAA,IAAI,CAAC,aAAa,CAAC,iBAAiB,IAAI,CAAC,GAAG,iBAAiB,GAAG,CAAC,CAAC,CAAC,UAAU,0CACzE,aAAa,CAAC,OAAO,CAAC,0CACtB,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;KACnC;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatRadioGroup"],"sources":["./src/components/cat-radio-group/cat-radio-group.scss?tag=cat-radio-group&encapsulation=shadow","./src/components/cat-radio-group/cat-radio-group.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n","import { Component, Element, Event, EventEmitter, h, Listen, Prop, Watch } from '@stencil/core';\n\n/**\n * A group of radio buttons.\n */\n@Component({\n tag: 'cat-radio-group',\n styleUrl: 'cat-radio-group.scss',\n shadow: true\n})\nexport class CatRadioGroup {\n private catRadioGroup: HTMLCatRadioElement[] = [];\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The name of the radio group component.\n */\n @Prop() name?: string;\n\n /**\n * The value of the radio group.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Whether this radio group is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Adds an accessible label for the radio group that\n * it is only shown in assistive technologies, like screen readers.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n /**\n * Whether the label of the radios should appear to the left of them.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<InputEvent>;\n\n /**\n * Emitted when the radio group loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n @Watch('name')\n onNameChanged(newName?: string) {\n this.catRadioGroup.forEach(catRadio => (catRadio.name = newName));\n }\n\n @Watch('value')\n onValueChanged(newValue?: string) {\n this.catRadioGroup.forEach(catRadio => (catRadio.checked = catRadio.value === newValue));\n this.updateTabIndex();\n }\n\n @Watch('disabled')\n onDisabledChanged(disabled: boolean) {\n this.catRadioGroup.forEach(catRadio => (catRadio.disabled = disabled));\n }\n\n @Watch('labelLeft')\n onLabelLeftChanged(labelLeft: boolean) {\n this.catRadioGroup.forEach(catRadio => {\n if (labelLeft) {\n catRadio.labelLeft = labelLeft;\n }\n });\n }\n\n componentDidLoad(): void {\n this.catRadioGroup = Array.from(this.hostElement.querySelectorAll(`cat-radio`));\n this.onNameChanged(this.name);\n this.onValueChanged(this.value);\n this.onDisabledChanged(this.disabled);\n this.onLabelLeftChanged(this.labelLeft);\n }\n\n @Listen('keydown')\n onKeydown(event: KeyboardEvent): void {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key) && this.catRadioGroup.length) {\n const targetElements = this.catRadioGroup.filter(catRadio => !catRadio.disabled);\n const activeElement = document.activeElement as HTMLCatRadioElement;\n const activeIdx = this.catRadioGroup.findIndex(catRadio => catRadio === activeElement);\n const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].doFocus();\n targetElements[targetIdx].shadowRoot?.querySelector('input')?.click();\n this.updateTabIndex();\n event.preventDefault();\n }\n }\n\n @Listen('input')\n onInput(event: MouseEvent): void {\n const catRadioElement = this.catRadioGroup.find(value => value === event.target);\n this.value = catRadioElement?.value;\n this.catChange.emit();\n }\n\n @Listen('blur', { capture: true })\n onBlur(event: FocusEvent): void {\n if (!event.relatedTarget) {\n this.catBlur.emit(event);\n }\n }\n\n render() {\n return (\n <div role=\"radiogroup\" aria-label={this.a11yLabel}>\n <slot></slot>\n </div>\n );\n }\n\n private updateTabIndex() {\n if (this.catRadioGroup.length) {\n this.catRadioGroup.forEach(value => value.shadowRoot?.querySelector('input')?.setAttribute('tabindex', '-1'));\n const checkedRadioIndex = this.catRadioGroup.findIndex(value => value.checked);\n this.catRadioGroup[checkedRadioIndex >= 0 ? checkedRadioIndex : 0].shadowRoot\n ?.querySelector('input')\n ?.setAttribute('tabindex', '0');\n }\n }\n}\n"],"version":3}
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
2
2
  import { l as loglevel } from './loglevel.js';
3
3
  import { C as CatFormHint } from './cat-form-hint.js';
4
4
 
5
- const catRadioCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);cursor:pointer}.label-left{flex-direction:row-reverse}.radio{display:flex;position:relative;align-self:flex-start}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden;pointer-events:none}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 0, 129, 148))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}:host(.cat-error) input{border-color:rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) .circle{background-color:rgb(var(--cat-danger-bg, 217, 52, 13))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.is-disabled input{background-color:#f2f4f7}.is-disabled input:checked{border-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}.is-disabled .circle{background-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}";
5
+ const catRadioCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;min-width:0}.input-hint,::slotted([slot=hint]){color:rgb(var(--cat-font-color-muted, 81, 92, 108));line-height:1.5;flex:1 1 auto;min-width:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);cursor:pointer}.label-left{flex-direction:row-reverse}.radio{display:flex;position:relative;align-self:flex-start}.circle-placeholder{width:calc(1.25rem + 1px)}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden;pointer-events:none}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 0, 129, 148))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}:host(.cat-error) input{border-color:rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) .circle{background-color:rgb(var(--cat-danger-bg, 217, 52, 13))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.is-disabled input{background-color:#f2f4f7}.is-disabled input:checked{border-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}.is-disabled .circle{background-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}";
6
6
 
7
7
  let nextUniqueId = 0;
8
8
  const CatRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -62,7 +62,7 @@ const CatRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
62
62
  this.input.click();
63
63
  }
64
64
  render() {
65
- return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, h("span", { class: "radio" }, h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.identifier || this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) }))));
65
+ return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, h("span", { class: "radio" }, h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.identifier || this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h("div", { class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, h("div", { class: "circle-placeholder" }), h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) })))));
66
66
  }
67
67
  onChange(event) {
68
68
  this.checked = true;
@@ -1 +1 @@
1
- {"file":"cat-radio.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,s5DAAs5D;;ACI16D,IAAI,YAAY,GAAG,CAAC,CAAC;MAeRA,UAAQ;;;;;;;;IACF,QAAG,GAAG,aAAa,EAAE,YAAY,EAAE,CAAC;2BAS1B,KAAK;0BAEN,KAAK;mBAKI,KAAK;oBAKrB,KAAK;;iBAUR,EAAE;uBAKI,KAAK;;oBAUR,KAAK;;;qBAeJ,KAAK;;;EA5DzB,IAAY,EAAE;IACZ,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC;GACpC;EAgFD,mBAAmB;IACjB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1E,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACxE,IAAI,CAAC,IAAI,CAAC,K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I,CAAC,IAAI,CAAC,IAC9B,EACF,YAAM,KAAK,EAAC,QAAQ,GAAQ,CACvB,EACP,YAAM,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,IAC7B,CAAC,IAAI,CAAC,eAAe,IAAI,YAAM,IAAI,EAAC,OAAO,GAAQ,KAAK,IAAI,CAAC,KAAK,CAC9D,CACD,EACP,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,cAAc,MAChC,EAAC,WAAW,IAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CAC7G,CACI,EACP;GACH;EAEO,QAAQ,CAAC,KAAiB;IAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACpB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC5B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatRadio","log"],"sources":["./src/components/cat-radio/cat-radio.scss?tag=cat-radio&encapsulation=shadow","./src/components/cat-radio/cat-radio.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nlabel {\n display: flex;\n gap: 0.5rem;\n @include cat-body('m');\n cursor: pointer;\n}\n\n.label-left {\n flex-direction: row-reverse;\n}\n\n.radio {\n display: flex;\n position: relative;\n align-self: flex-start;\n}\n\n.circle {\n position: absolute;\n width: 0.75rem;\n height: 0.75rem;\n background-color: cat-token('color.theme.primary.bg');\n border-radius: 10rem;\n top: calc(50% - 0.375rem);\n left: calc(50% - 0.375rem);\n visibility: hidden;\n pointer-events: none;\n}\n\ninput {\n margin: 0;\n width: 1.25rem;\n height: 1.25rem;\n appearance: none;\n background-color: cat-token('color.ui.background.input');\n border: 1px solid cat-token('color.ui.border.dark');\n border-radius: 10rem;\n cursor: inherit;\n\n &:checked {\n border-color: cat-token('color.theme.primary.bg');\n\n + .circle {\n visibility: visible;\n }\n }\n\n &:focus-visible {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n }\n}\n\n:host(.cat-error) {\n input {\n border-color: cat-token('color.theme.danger.bg');\n }\n\n .circle {\n background-color: cat-token('color.theme.danger.bg');\n }\n}\n\n.label {\n flex: 1 1 auto;\n\n .is-hidden & {\n @include cat-visually-hidden;\n }\n}\n\n.is-disabled {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n\n input {\n background-color: cat-token('color.ui.background.muted');\n\n &:checked {\n border-color: cat-token('color.ui.border.dark');\n }\n }\n\n .circle {\n background-color: cat-token('color.ui.border.dark');\n }\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Radio Buttons are graphical interface elements that allow user to choose\n * only one of a predefined set of mutually exclusive options.\n *\n * @slot hint - Optional hint element to be displayed with the radio.\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 */\n@Component({\n tag: 'cat-radio',\n styleUrl: 'cat-radio.scss',\n shadow: true\n})\nexport class CatRadio {\n private readonly _id = `cat-radio-${++nextUniqueId}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n /**\n * Whether this radio is checked.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Whether this radio is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label of the radio that is visible.\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 * The name of the radio component.\n */\n @Prop() name?: string;\n\n /**\n * Whether the radio is required.\n */\n @Prop() required = false;\n\n /**\n * The value of the radio component.\n */\n @Prop() value?: string;\n\n /**\n * Optional hint text(s) to be displayed with the radio.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the radio component.\n */\n @Prop() labelLeft = false;\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 radio is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the radio received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the radio loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\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 radio', this);\n }\n }\n\n /**\n * Programmatically move focus to the radio button. 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 radio button. Use this method\n * instead of `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Programmatically simulate a click on the radio button.\n */\n @Method()\n async doClick(): Promise<void> {\n this.input.click();\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n role=\"radio\"\n aria-checked={this.checked ? 'true' : 'false'}\n >\n <span class=\"radio\">\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.identifier || this.id}\n type=\"radio\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onChange.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"circle\"></span>\n </span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {(this.hint || this.hasSlottedHint) && (\n <CatFormHint id={this.id} hint={this.hint} slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>} />\n )}\n </Host>\n );\n }\n\n private onChange(event: InputEvent) {\n this.checked = true;\n this.catChange.emit(event);\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 }\n}\n"],"version":3}
1
+ {"file":"cat-radio.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,qqEAAqqE;;ACIzrE,IAAI,YAAY,GAAG,CAAC,CAAC;MAeRA,UAAQ;;;;;;;;IACF,QAAG,GAAG,aAAa,EAAE,YAAY,EAAE,CAAC;2BAS1B,KAAK;0BAEN,KAAK;mBAKI,KAAK;oBAKrB,KAAK;;iBAUR,EAAE;uBAKI,KAAK;;oBAUR,KAAK;;;qBAeJ,KAAK;;;EA5DzB,IAAY,EAAE;IACZ,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC;GACpC;EAgFD,mBAAmB;IACjB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IA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C,IAAI,CAAC,EACjC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAChC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAC9B,EACF,YAAM,KAAK,EAAC,QAAQ,GAAQ,CACvB,EACP,YAAM,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,IAC7B,CAAC,IAAI,CAAC,eAAe,IAAI,YAAM,IAAI,EAAC,OAAO,GAAQ,KAAK,IAAI,CAAC,KAAK,CAC9D,CACD,EACP,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,cAAc,MAChC,WAAK,KAAK,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,SAAS,EAAE,IAChE,WAAK,KAAK,EAAC,oBAAoB,GAAO,EACtC,EAAC,WAAW,IAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CACxG,CACP,CACI,EACP;GACH;EAEO,QAAQ,CAAC,KAAiB;IAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACpB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC5B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatRadio","log"],"sources":["./src/components/cat-radio/cat-radio.scss?tag=cat-radio&encapsulation=shadow","./src/components/cat-radio/cat-radio.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n@use '_snippets/checkbox-hint';\n\n$radio-width: 1.25rem;\n$radio-height: 1.25rem;\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nlabel {\n display: flex;\n gap: 0.5rem;\n @include cat-body('m');\n cursor: pointer;\n}\n\n.label-left {\n flex-direction: row-reverse;\n}\n\n.radio {\n display: flex;\n position: relative;\n align-self: flex-start;\n}\n\n.circle-placeholder {\n width: calc($radio-width + 1px);\n}\n\n.circle {\n position: absolute;\n width: 0.75rem;\n height: 0.75rem;\n background-color: cat-token('color.theme.primary.bg');\n border-radius: 10rem;\n top: calc(50% - 0.375rem);\n left: calc(50% - 0.375rem);\n visibility: hidden;\n pointer-events: none;\n}\n\ninput {\n margin: 0;\n width: $radio-width;\n height: $radio-height;\n appearance: none;\n background-color: cat-token('color.ui.background.input');\n border: 1px solid cat-token('color.ui.border.dark');\n border-radius: 10rem;\n cursor: inherit;\n\n &:checked {\n border-color: cat-token('color.theme.primary.bg');\n\n + .circle {\n visibility: visible;\n }\n }\n\n &:focus-visible {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n }\n}\n\n:host(.cat-error) {\n input {\n border-color: cat-token('color.theme.danger.bg');\n }\n\n .circle {\n background-color: cat-token('color.theme.danger.bg');\n }\n}\n\n.label {\n flex: 1 1 auto;\n\n .is-hidden & {\n @include cat-visually-hidden;\n }\n}\n\n.is-disabled {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n\n input {\n background-color: cat-token('color.ui.background.muted');\n\n &:checked {\n border-color: cat-token('color.ui.border.dark');\n }\n }\n\n .circle {\n background-color: cat-token('color.ui.border.dark');\n }\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Radio Buttons are graphical interface elements that allow user to choose\n * only one of a predefined set of mutually exclusive options.\n *\n * @slot hint - Optional hint element to be displayed with the radio.\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 */\n@Component({\n tag: 'cat-radio',\n styleUrl: 'cat-radio.scss',\n shadow: true\n})\nexport class CatRadio {\n private readonly _id = `cat-radio-${++nextUniqueId}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n /**\n * Whether this radio is checked.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Whether this radio is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label of the radio that is visible.\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 * The name of the radio component.\n */\n @Prop() name?: string;\n\n /**\n * Whether the radio is required.\n */\n @Prop() required = false;\n\n /**\n * The value of the radio component.\n */\n @Prop() value?: string;\n\n /**\n * Optional hint text(s) to be displayed with the radio.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the radio component.\n */\n @Prop() labelLeft = false;\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 radio is changed.\n */\n @Event() catChange!: EventEmitter<InputEvent>;\n\n /**\n * Emitted when the radio received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the radio loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\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 radio', this);\n }\n }\n\n /**\n * Programmatically move focus to the radio button. 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 radio button. Use this method\n * instead of `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Programmatically simulate a click on the radio button.\n */\n @Method()\n async doClick(): Promise<void> {\n this.input.click();\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n role=\"radio\"\n aria-checked={this.checked ? 'true' : 'false'}\n >\n <span class=\"radio\">\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.identifier || this.id}\n type=\"radio\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onChange.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"circle\"></span>\n </span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {(this.hint || this.hasSlottedHint) && (\n <div class={{ 'hint-wrapper': true, 'label-left': this.labelLeft }}>\n <div class=\"circle-placeholder\"></div>\n <CatFormHint id={this.id} hint={this.hint} slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>} />\n </div>\n )}\n </Host>\n );\n }\n\n private onChange(event: InputEvent) {\n this.checked = true;\n this.catChange.emit(event);\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 }\n}\n"],"version":3}