@devschile/chucao 2.7.1 → 2.9.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 (253) hide show
  1. package/dist/chucao/chucao.esm.js +1 -1
  2. package/dist/chucao/{p-01b6c7bf.entry.js → p-03acf096.entry.js} +2 -2
  3. package/dist/chucao/{p-10f6801e.entry.js → p-0ce2b15d.entry.js} +2 -2
  4. package/dist/chucao/p-10e37157.entry.js +2 -0
  5. package/dist/chucao/p-10e37157.entry.js.map +1 -0
  6. package/dist/chucao/{p-f917d34f.entry.js → p-12043dc1.entry.js} +2 -2
  7. package/dist/chucao/p-1dca55d6.entry.js +2 -0
  8. package/dist/chucao/{p-deb2571b.entry.js.map → p-1dca55d6.entry.js.map} +1 -1
  9. package/dist/chucao/{p-0c7f6f8d.entry.js → p-244d8e96.entry.js} +2 -2
  10. package/dist/chucao/{p-a7c674b7.entry.js → p-29841714.entry.js} +2 -2
  11. package/dist/chucao/{p-ffecdf25.entry.js → p-302ec527.entry.js} +2 -2
  12. package/dist/chucao/{p-337d7f68.entry.js → p-51f6327c.entry.js} +2 -2
  13. package/dist/chucao/{p-1b70e3f1.entry.js → p-5a62951e.entry.js} +2 -2
  14. package/dist/chucao/{p-472ec451.entry.js → p-5d0ac17a.entry.js} +2 -2
  15. package/dist/chucao/{p-d8b71751.entry.js → p-5e0e1012.entry.js} +2 -2
  16. package/dist/chucao/{p-15d27bb7.entry.js → p-61a94a4e.entry.js} +2 -2
  17. package/dist/chucao/p-649c2cef.entry.js +2 -0
  18. package/dist/chucao/p-649c2cef.entry.js.map +1 -0
  19. package/dist/chucao/p-674c0f61.entry.js +2 -0
  20. package/dist/chucao/p-674c0f61.entry.js.map +1 -0
  21. package/dist/chucao/{p-c4b2bd1f.entry.js → p-67f0fc77.entry.js} +2 -2
  22. package/dist/chucao/{p-5240f5ac.entry.js → p-68e4a129.entry.js} +2 -2
  23. package/dist/chucao/{p-2e37c61b.entry.js → p-6e345b3f.entry.js} +2 -2
  24. package/dist/chucao/{p-f6ab0a11.entry.js → p-72d4dacf.entry.js} +2 -2
  25. package/dist/chucao/{p-8ae680a4.entry.js → p-74d9b7e5.entry.js} +2 -2
  26. package/dist/chucao/p-791ce537.entry.js +2 -0
  27. package/dist/chucao/p-791ce537.entry.js.map +1 -0
  28. package/dist/chucao/{p-c90da3c0.entry.js → p-79e8c10b.entry.js} +2 -2
  29. package/dist/chucao/{p-90284ebe.entry.js → p-7e13f725.entry.js} +2 -2
  30. package/dist/chucao/{p-9ebcc7be.entry.js → p-8b23d072.entry.js} +2 -2
  31. package/dist/chucao/{p-CIV5Gg1o.js → p-8l_6qAY9.js} +3 -3
  32. package/dist/chucao/p-8l_6qAY9.js.map +1 -0
  33. package/dist/chucao/{p-1e4cd3aa.entry.js → p-a5430e95.entry.js} +2 -2
  34. package/dist/chucao/{p-e77d35c3.entry.js → p-a7c66879.entry.js} +2 -2
  35. package/dist/chucao/p-b452d6cb.entry.js +2 -0
  36. package/dist/chucao/p-b7332faf.entry.js +2 -0
  37. package/dist/chucao/{p-60e1c1df.entry.js.map → p-b7332faf.entry.js.map} +1 -1
  38. package/dist/chucao/{p-42028c97.entry.js → p-f3d03388.entry.js} +2 -2
  39. package/dist/chucao/{p-7cdc71cc.entry.js → p-f925d45c.entry.js} +2 -2
  40. package/dist/cjs/ch-accordion.cjs.entry.js +2 -2
  41. package/dist/cjs/ch-alert_8.cjs.entry.js +8 -8
  42. package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
  43. package/dist/cjs/ch-cluster.cjs.entry.js +3 -3
  44. package/dist/cjs/ch-combobox.cjs.entry.js +304 -0
  45. package/dist/cjs/ch-combobox.cjs.entry.js.map +1 -0
  46. package/dist/cjs/ch-confirm-dialog.cjs.entry.js +138 -0
  47. package/dist/cjs/ch-confirm-dialog.cjs.entry.js.map +1 -0
  48. package/dist/cjs/ch-description-list.cjs.entry.js +2 -2
  49. package/dist/cjs/ch-divider.cjs.entry.js +2 -2
  50. package/dist/cjs/ch-drawer.cjs.entry.js +2 -2
  51. package/dist/cjs/ch-emoji.cjs.entry.js +2 -2
  52. package/dist/cjs/ch-empty-state.cjs.entry.js +2 -2
  53. package/dist/cjs/ch-grid.cjs.entry.js +2 -2
  54. package/dist/cjs/ch-icon-button.cjs.entry.js +2 -2
  55. package/dist/cjs/ch-icon.cjs.entry.js +2 -2
  56. package/dist/cjs/ch-link.cjs.entry.js +1 -1
  57. package/dist/cjs/ch-modal.cjs.entry.js +2 -2
  58. package/dist/cjs/ch-number-input.cjs.entry.js +3 -3
  59. package/dist/cjs/ch-otp-input.cjs.entry.js +196 -0
  60. package/dist/cjs/ch-otp-input.cjs.entry.js.map +1 -0
  61. package/dist/cjs/ch-page-header.cjs.entry.js +2 -2
  62. package/dist/cjs/ch-pagination.cjs.entry.js +67 -0
  63. package/dist/cjs/ch-pagination.cjs.entry.js.map +1 -0
  64. package/dist/cjs/ch-radio.cjs.entry.js +2 -2
  65. package/dist/cjs/ch-segmented-control.cjs.entry.js +2 -2
  66. package/dist/cjs/ch-skeleton.cjs.entry.js +2 -2
  67. package/dist/cjs/ch-stack.cjs.entry.js +2 -2
  68. package/dist/cjs/ch-stat.cjs.entry.js +3 -3
  69. package/dist/cjs/ch-table.cjs.entry.js +2 -2
  70. package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
  71. package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
  72. package/dist/cjs/ch-timeline.cjs.entry.js +2 -2
  73. package/dist/cjs/ch-tooltip.cjs.entry.js +3 -3
  74. package/dist/cjs/chucao.cjs.js +2 -2
  75. package/dist/cjs/{index-ByZY6aTj.js → index-C6khqyw3.js} +19 -2
  76. package/dist/cjs/index-C6khqyw3.js.map +1 -0
  77. package/dist/cjs/loader.cjs.js +2 -2
  78. package/dist/collection/collection-manifest.json +4 -0
  79. package/dist/collection/components/ch-accordion/ch-accordion.js +1 -1
  80. package/dist/collection/components/ch-alert/ch-alert.js +1 -1
  81. package/dist/collection/components/ch-badge/ch-badge.js +1 -1
  82. package/dist/collection/components/ch-card/ch-card.js +1 -1
  83. package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
  84. package/dist/collection/components/ch-cluster/ch-cluster.js +2 -2
  85. package/dist/collection/components/ch-combobox/ch-combobox.css +153 -0
  86. package/dist/collection/components/ch-combobox/ch-combobox.js +577 -0
  87. package/dist/collection/components/ch-combobox/ch-combobox.js.map +1 -0
  88. package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.css +71 -0
  89. package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.js +382 -0
  90. package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.js.map +1 -0
  91. package/dist/collection/components/ch-description-list/ch-description-list.js +1 -1
  92. package/dist/collection/components/ch-divider/ch-divider.js +1 -1
  93. package/dist/collection/components/ch-drawer/ch-drawer.js +1 -1
  94. package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
  95. package/dist/collection/components/ch-empty-state/ch-empty-state.js +1 -1
  96. package/dist/collection/components/ch-grid/ch-grid.js +1 -1
  97. package/dist/collection/components/ch-icon/ch-icon.js +1 -1
  98. package/dist/collection/components/ch-icon-button/ch-icon-button.js +1 -1
  99. package/dist/collection/components/ch-input/ch-input.js +1 -1
  100. package/dist/collection/components/ch-modal/ch-modal.js +1 -1
  101. package/dist/collection/components/ch-number-input/ch-number-input.js +2 -2
  102. package/dist/collection/components/ch-otp-input/ch-otp-input.css +86 -0
  103. package/dist/collection/components/ch-otp-input/ch-otp-input.js +478 -0
  104. package/dist/collection/components/ch-otp-input/ch-otp-input.js.map +1 -0
  105. package/dist/collection/components/ch-page-header/ch-page-header.js +1 -1
  106. package/dist/collection/components/ch-pagination/ch-pagination.css +63 -0
  107. package/dist/collection/components/ch-pagination/ch-pagination.js +228 -0
  108. package/dist/collection/components/ch-pagination/ch-pagination.js.map +1 -0
  109. package/dist/collection/components/ch-radio/ch-radio.js +1 -1
  110. package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +1 -1
  111. package/dist/collection/components/ch-select/ch-select.js +1 -1
  112. package/dist/collection/components/ch-skeleton/ch-skeleton.js +1 -1
  113. package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
  114. package/dist/collection/components/ch-stack/ch-stack.js +1 -1
  115. package/dist/collection/components/ch-stat/ch-stat.js +2 -2
  116. package/dist/collection/components/ch-switch/ch-switch.js +1 -1
  117. package/dist/collection/components/ch-table/ch-table.js +1 -1
  118. package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
  119. package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
  120. package/dist/collection/components/ch-timeline/ch-timeline.js +1 -1
  121. package/dist/collection/components/ch-tooltip/ch-tooltip.js +2 -2
  122. package/dist/components/ch-accordion.js +1 -1
  123. package/dist/components/ch-alert.js +1 -1
  124. package/dist/components/ch-badge.js +1 -1
  125. package/dist/components/ch-button.js +1 -1
  126. package/dist/components/ch-card.js +1 -1
  127. package/dist/components/ch-checkbox.js +1 -1
  128. package/dist/components/ch-cluster.js +1 -1
  129. package/dist/components/ch-combobox.d.ts +11 -0
  130. package/dist/components/ch-combobox.js +2 -0
  131. package/dist/components/ch-combobox.js.map +1 -0
  132. package/dist/components/ch-confirm-dialog.d.ts +11 -0
  133. package/dist/components/ch-confirm-dialog.js +2 -0
  134. package/dist/components/ch-confirm-dialog.js.map +1 -0
  135. package/dist/components/ch-description-list.js +1 -1
  136. package/dist/components/ch-divider.js +1 -1
  137. package/dist/components/ch-drawer.js +1 -1
  138. package/dist/components/ch-emoji.js +1 -1
  139. package/dist/components/ch-empty-state.js +1 -1
  140. package/dist/components/ch-grid.js +1 -1
  141. package/dist/components/ch-icon-button.js +1 -1
  142. package/dist/components/ch-icon.js +1 -1
  143. package/dist/components/ch-input.js +1 -1
  144. package/dist/components/ch-modal.js +1 -1
  145. package/dist/components/ch-modal.js.map +1 -1
  146. package/dist/components/ch-number-input.js +1 -1
  147. package/dist/components/ch-otp-input.d.ts +11 -0
  148. package/dist/components/ch-otp-input.js +2 -0
  149. package/dist/components/ch-otp-input.js.map +1 -0
  150. package/dist/components/ch-page-header.js +1 -1
  151. package/dist/components/ch-pagination.d.ts +11 -0
  152. package/dist/components/ch-pagination.js +2 -0
  153. package/dist/components/ch-pagination.js.map +1 -0
  154. package/dist/components/ch-radio.js +1 -1
  155. package/dist/components/ch-segmented-control.js +1 -1
  156. package/dist/components/ch-select.js +1 -1
  157. package/dist/components/ch-skeleton.js +1 -1
  158. package/dist/components/ch-spinner.js +1 -1
  159. package/dist/components/ch-stack.js +1 -1
  160. package/dist/components/ch-stat.js +1 -1
  161. package/dist/components/ch-switch.js +1 -1
  162. package/dist/components/ch-table.js +1 -1
  163. package/dist/components/ch-tabs.js +1 -1
  164. package/dist/components/ch-textarea.js +1 -1
  165. package/dist/components/ch-timeline.js +1 -1
  166. package/dist/components/ch-tooltip.js +1 -1
  167. package/dist/components/{p-DiUN1WGc.js → p-CuSstsTP.js} +2 -2
  168. package/dist/components/p-MBLhKofG.js +2 -0
  169. package/dist/components/p-MBLhKofG.js.map +1 -0
  170. package/dist/components/p-qP_9qshx.js.map +1 -1
  171. package/dist/esm/ch-accordion.entry.js +2 -2
  172. package/dist/esm/ch-alert_8.entry.js +8 -8
  173. package/dist/esm/ch-checkbox.entry.js +2 -2
  174. package/dist/esm/ch-cluster.entry.js +3 -3
  175. package/dist/esm/ch-combobox.entry.js +302 -0
  176. package/dist/esm/ch-combobox.entry.js.map +1 -0
  177. package/dist/esm/ch-confirm-dialog.entry.js +136 -0
  178. package/dist/esm/ch-confirm-dialog.entry.js.map +1 -0
  179. package/dist/esm/ch-description-list.entry.js +2 -2
  180. package/dist/esm/ch-divider.entry.js +2 -2
  181. package/dist/esm/ch-drawer.entry.js +2 -2
  182. package/dist/esm/ch-emoji.entry.js +2 -2
  183. package/dist/esm/ch-empty-state.entry.js +2 -2
  184. package/dist/esm/ch-grid.entry.js +2 -2
  185. package/dist/esm/ch-icon-button.entry.js +2 -2
  186. package/dist/esm/ch-icon.entry.js +2 -2
  187. package/dist/esm/ch-link.entry.js +1 -1
  188. package/dist/esm/ch-modal.entry.js +2 -2
  189. package/dist/esm/ch-number-input.entry.js +3 -3
  190. package/dist/esm/ch-otp-input.entry.js +194 -0
  191. package/dist/esm/ch-otp-input.entry.js.map +1 -0
  192. package/dist/esm/ch-page-header.entry.js +2 -2
  193. package/dist/esm/ch-pagination.entry.js +65 -0
  194. package/dist/esm/ch-pagination.entry.js.map +1 -0
  195. package/dist/esm/ch-radio.entry.js +2 -2
  196. package/dist/esm/ch-segmented-control.entry.js +2 -2
  197. package/dist/esm/ch-skeleton.entry.js +2 -2
  198. package/dist/esm/ch-stack.entry.js +2 -2
  199. package/dist/esm/ch-stat.entry.js +3 -3
  200. package/dist/esm/ch-table.entry.js +2 -2
  201. package/dist/esm/ch-tabs.entry.js +2 -2
  202. package/dist/esm/ch-textarea.entry.js +2 -2
  203. package/dist/esm/ch-timeline.entry.js +2 -2
  204. package/dist/esm/ch-tooltip.entry.js +3 -3
  205. package/dist/esm/chucao.js +3 -3
  206. package/dist/esm/{index-CIV5Gg1o.js → index-8l_6qAY9.js} +19 -2
  207. package/dist/esm/index-8l_6qAY9.js.map +1 -0
  208. package/dist/esm/loader.js +3 -3
  209. package/dist/types/components/ch-combobox/ch-combobox.d.ts +98 -0
  210. package/dist/types/components/ch-confirm-dialog/ch-confirm-dialog.d.ts +81 -0
  211. package/dist/types/components/ch-otp-input/ch-otp-input.d.ts +79 -0
  212. package/dist/types/components/ch-pagination/ch-pagination.d.ts +44 -0
  213. package/dist/types/components.d.ts +757 -0
  214. package/dist-react/components.d.ts +27 -1
  215. package/dist-react/components.js +45 -0
  216. package/dist-react/components.ts +67 -1
  217. package/dist-vue/index.d.ts +4 -0
  218. package/dist-vue/index.js +67 -0
  219. package/dist-vue/index.ts +75 -0
  220. package/hydrate/index.js +855 -35
  221. package/hydrate/index.mjs +855 -35
  222. package/package.json +17 -1
  223. package/dist/chucao/p-60e1c1df.entry.js +0 -2
  224. package/dist/chucao/p-9db118d9.entry.js +0 -2
  225. package/dist/chucao/p-CIV5Gg1o.js.map +0 -1
  226. package/dist/chucao/p-deb2571b.entry.js +0 -2
  227. package/dist/cjs/index-ByZY6aTj.js.map +0 -1
  228. package/dist/esm/index-CIV5Gg1o.js.map +0 -1
  229. /package/dist/chucao/{p-01b6c7bf.entry.js.map → p-03acf096.entry.js.map} +0 -0
  230. /package/dist/chucao/{p-10f6801e.entry.js.map → p-0ce2b15d.entry.js.map} +0 -0
  231. /package/dist/chucao/{p-f917d34f.entry.js.map → p-12043dc1.entry.js.map} +0 -0
  232. /package/dist/chucao/{p-0c7f6f8d.entry.js.map → p-244d8e96.entry.js.map} +0 -0
  233. /package/dist/chucao/{p-a7c674b7.entry.js.map → p-29841714.entry.js.map} +0 -0
  234. /package/dist/chucao/{p-ffecdf25.entry.js.map → p-302ec527.entry.js.map} +0 -0
  235. /package/dist/chucao/{p-337d7f68.entry.js.map → p-51f6327c.entry.js.map} +0 -0
  236. /package/dist/chucao/{p-1b70e3f1.entry.js.map → p-5a62951e.entry.js.map} +0 -0
  237. /package/dist/chucao/{p-472ec451.entry.js.map → p-5d0ac17a.entry.js.map} +0 -0
  238. /package/dist/chucao/{p-d8b71751.entry.js.map → p-5e0e1012.entry.js.map} +0 -0
  239. /package/dist/chucao/{p-15d27bb7.entry.js.map → p-61a94a4e.entry.js.map} +0 -0
  240. /package/dist/chucao/{p-c4b2bd1f.entry.js.map → p-67f0fc77.entry.js.map} +0 -0
  241. /package/dist/chucao/{p-5240f5ac.entry.js.map → p-68e4a129.entry.js.map} +0 -0
  242. /package/dist/chucao/{p-2e37c61b.entry.js.map → p-6e345b3f.entry.js.map} +0 -0
  243. /package/dist/chucao/{p-f6ab0a11.entry.js.map → p-72d4dacf.entry.js.map} +0 -0
  244. /package/dist/chucao/{p-8ae680a4.entry.js.map → p-74d9b7e5.entry.js.map} +0 -0
  245. /package/dist/chucao/{p-c90da3c0.entry.js.map → p-79e8c10b.entry.js.map} +0 -0
  246. /package/dist/chucao/{p-90284ebe.entry.js.map → p-7e13f725.entry.js.map} +0 -0
  247. /package/dist/chucao/{p-9ebcc7be.entry.js.map → p-8b23d072.entry.js.map} +0 -0
  248. /package/dist/chucao/{p-1e4cd3aa.entry.js.map → p-a5430e95.entry.js.map} +0 -0
  249. /package/dist/chucao/{p-e77d35c3.entry.js.map → p-a7c66879.entry.js.map} +0 -0
  250. /package/dist/chucao/{p-9db118d9.entry.js.map → p-b452d6cb.entry.js.map} +0 -0
  251. /package/dist/chucao/{p-42028c97.entry.js.map → p-f3d03388.entry.js.map} +0 -0
  252. /package/dist/chucao/{p-7cdc71cc.entry.js.map → p-f925d45c.entry.js.map} +0 -0
  253. /package/dist/components/{p-DiUN1WGc.js.map → p-CuSstsTP.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{p as i,H as t,c as s,h as e,d as r,t as a}from"./p-qP_9qshx.js";import{r as o}from"./p-BXzZsX2r.js";const n=()=>`:host{display:block;width:100%;font-family:var(--typography-body)}:host([hidden]){display:none}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--color-text-primary)}.chips{display:flex;flex-wrap:wrap;gap:var(--spacing-xs);margin:0 0 var(--spacing-sm);padding:0;list-style:none}.chip{display:inline-flex;align-items:center;gap:var(--spacing-xs);max-width:100%;padding:var(--spacing-2xs) var(--spacing-sm);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-hover);font-size:var(--typography-size-sm)}.chip__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chip__remove{all:unset;cursor:pointer;padding:0 var(--spacing-2xs);border-radius:var(--radius-sm);color:var(--color-text-secondary);line-height:1}.chip__remove:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:1px}.field{position:relative}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-default);color:var(--color-text-primary);font-family:inherit;font-size:var(--typography-size-md);transition:border-color var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--color-text-secondary)}.input:focus{border-color:var(--color-accent-default);outline:2px solid var(--color-accent-default);outline-offset:1px}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input--invalid{border-color:var(--color-status-warning)}.listbox{position:absolute;z-index:var(--z-index-dropdown);top:calc(100% + var(--spacing-2xs));left:0;right:0;max-height:16rem;margin:0;padding:var(--spacing-2xs);overflow-y:auto;list-style:none;border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-default);box-shadow:var(--shadow-elevate)}.listbox[hidden]{display:none}.listbox__option{padding:var(--spacing-sm) var(--spacing-md);border-radius:var(--radius-sm);font-size:var(--typography-size-sm);cursor:pointer}.listbox__option--active{background:var(--color-surface-hover);font-weight:var(--typography-weight-semibold);box-shadow:inset 2px 0 0 var(--color-accent-default)}.listbox__option--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.listbox__empty{padding:var(--spacing-sm) var(--spacing-md);font-size:var(--typography-size-sm);color:var(--color-text-secondary)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--color-text-secondary)}.error{color:var(--color-status-warning)}`;let h=0;const l=i(class i extends t{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.chChange=s(this,"chChange");this.chFilter=s(this,"chFilter");this.internals=this.attachInternals()}inputId=`ch-combobox-${++h}`;listId=`${this.inputId}-list`;hintId=`${this.inputId}-hint`;errorId=`${this.inputId}-error`;initialValue=[];internals;formDisabled=false;get host(){return this}label;options=[];value;multiple=false;placeholder;name;disabled=false;required=false;hint;errorMessage;invalid=false;query="";expanded=false;activeIndex=-1;chChange;chFilter;get selected(){if(Array.isArray(this.value)){return this.value}return this.value===undefined||this.value===""?[]:[this.value]}get visibleOptions(){const i=this.query.trim().toLowerCase();if(i===""){return this.options}return this.options.filter((t=>t.label.toLowerCase().includes(i)))}get choosable(){if(!this.multiple){return this.visibleOptions}const i=new Set(this.selected);return this.visibleOptions.filter((t=>!i.has(t.value)))}labelFor(i){return this.options.find((t=>t.value===i))?.label??i}componentDidLoad(){this.initialValue=this.selected;this.syncForm();this.host.addEventListener("focusout",this.handleFocusOut);this.host.addEventListener("invalid",this.markTouched)}disconnectedCallback(){this.host.removeEventListener("focusout",this.handleFocusOut)}markTouched=()=>{this.host.setAttribute("data-touched","")};handleFocusOut=()=>{this.markTouched();window.setTimeout((()=>{if(!this.host.contains(document.activeElement)&&this.host.shadowRoot?.activeElement==null){this.expanded=false;this.syncForm()}}),0)};syncForm(){const i=this.internals;if(typeof i?.setFormValue!=="function"){return}const t=this.selected;if(this.multiple){const s=new FormData;for(const i of t){s.append(this.name??"",i)}i.setFormValue(t.length===0?null:s)}else{i.setFormValue(t[0]??"")}const{flags:s,message:e}=o({required:this.required,empty:t.length===0,invalid:this.invalid,errorMessage:this.errorMessage});i.setValidity(s,e)}formResetCallback(){this.value=this.multiple?[...this.initialValue]:this.initialValue[0]??"";this.query="";this.syncForm();const i=this.host.shadowRoot?.querySelector(".input");if(i){i.value=""}}formDisabledCallback(i){this.formDisabled=i}commit(i){if(this.multiple){const t=this.selected.includes(i)?this.selected:[...this.selected,i];this.value=t;this.query="";const s=this.host.shadowRoot?.querySelector(".input");if(s){s.value=""}this.activeIndex=-1}else{this.value=i;this.query=this.labelFor(i);this.expanded=false;this.activeIndex=-1}this.chChange.emit(this.value);this.syncForm()}remove(i){const t=this.selected.filter((t=>t!==i));this.value=this.multiple?t:"";this.chChange.emit(this.value);this.syncForm()}open(){if(this.disabled||this.formDisabled){return}this.expanded=true}moveActive(i){const t=this.choosable.length;if(t===0){return}const s=this.activeIndex+i;this.activeIndex=s<0?t-1:s>=t?0:s}handleInput=i=>{const t=i.target;this.query=t.value;this.expanded=true;this.activeIndex=this.choosable.length>0?0:-1;if(!this.multiple&&this.value!==undefined&&this.value!==this.labelFor(this.selected[0]??"")){this.value=""}this.chFilter.emit(this.query)};handleKeyDown=i=>{if(i.key==="ArrowDown"){i.preventDefault();this.open();this.moveActive(1);return}if(i.key==="ArrowUp"){i.preventDefault();this.open();this.moveActive(-1);return}if(i.key==="Enter"){const t=this.choosable[this.activeIndex];if(this.expanded&&t&&!t.disabled){i.preventDefault();this.commit(t.value)}return}if(i.key==="Escape"&&this.expanded){i.preventDefault();this.expanded=false;this.activeIndex=-1;return}if(i.key==="Backspace"&&this.multiple&&this.query===""){const t=this.selected[this.selected.length-1];if(t!==undefined){i.preventDefault();this.remove(t)}}};handleFocus=()=>{this.open()};handleBlur=()=>{const i=this.host.shadowRoot?.querySelector(".input");if(i&&!this.multiple){this.query="";i.value=this.selected.length>0?this.labelFor(this.selected[0]):""}};get isInvalid(){return this.invalid||this.host.hasAttribute("data-touched")&&this.selected.length===0&&this.required}get describedBy(){if(this.isInvalid&&this.errorMessage){return this.errorId}return this.hint?this.hintId:undefined}optionId(i){return`${this.inputId}-option-${i}`}render(){const i=this.choosable;const t=this.activeIndex>=0&&this.activeIndex<i.length?i[this.activeIndex]:undefined;const s=this.selected;const a=this.isInvalid&&this.errorMessage;return e(r,{key:"783df95d2970b0db5c6f839fb0acbaa7582301f0"},this.label&&e("label",{key:"232933c04601d543b391d15603f1dcfafa2f6e73",class:"label",htmlFor:this.inputId},this.label),this.multiple&&s.length>0&&e("ul",{key:"e7e92805f42a9a97d0587463f0b68fa79368cc6b",class:"chips","aria-label":"Selected values"},s.map((i=>e("li",{class:"chip",key:i},e("span",{class:"chip__label"},this.labelFor(i)),e("button",{type:"button",class:"chip__remove","aria-label":`Remove ${this.labelFor(i)}`,onClick:()=>this.remove(i)},e("span",{"aria-hidden":"true"},"×")))))),e("div",{key:"076bd78c0c43327c298baf37e9411d68e6b03734",class:"field"},e("input",{key:"0e2caa28567ea21d8b5a98a8b1ed949e07731e09",id:this.label&&!this.multiple?this.inputId:undefined,class:{input:true,"input--invalid":this.isInvalid},type:"text",role:"combobox",autocomplete:"off","aria-expanded":this.expanded?"true":"false","aria-controls":this.listId,"aria-autocomplete":"list","aria-activedescendant":t?this.optionId(this.activeIndex):undefined,"aria-invalid":this.isInvalid?"true":undefined,"aria-describedby":this.describedBy,name:this.name,disabled:this.disabled||this.formDisabled,required:this.required,placeholder:s.length===0?this.placeholder:undefined,value:this.multiple?this.query:this.query||(s[0]!==undefined?this.labelFor(s[0]):""),onInput:this.handleInput,onKeyDown:this.handleKeyDown,onFocus:this.handleFocus,onBlur:this.handleBlur}),e("ul",{key:"5f843aef03c09ff9dd1e02c3da90f6e9dbcca858",class:"listbox",id:this.listId,role:"listbox","aria-multiselectable":this.multiple?"true":undefined,hidden:!this.expanded},i.length===0&&e("li",{key:"1bb282438f1889da96af7d27b504e31ab19088e5",class:"listbox__empty",role:"presentation"},"No results"),i.map(((i,t)=>e("li",{class:{listbox__option:true,"listbox__option--active":t===this.activeIndex,"listbox__option--disabled":i.disabled===true},id:this.optionId(t),key:i.value,role:"option","aria-selected":this.multiple?"false":s[0]===i.value?"true":"false","aria-disabled":i.disabled?"true":undefined,onMouseDown:t=>{t.preventDefault();if(!i.disabled){this.commit(i.value)}}},i.label))))),this.hint&&!a&&e("p",{key:"dc7f8a5d26e55d2d7836bf72a5359a6c0fbe0220",class:"hint",id:this.hintId},this.hint),a&&e("p",{key:"d3d9beaa0eb9d830b2c9f3082ea0bf0490efe3ee",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}],multiple:[{syncForm:0}]}}static get style(){return n()}},[577,"ch-combobox",{label:[1],options:[16],value:[1025],multiple:[516],placeholder:[1],name:[513],disabled:[516],required:[516],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32],query:[32],expanded:[32],activeIndex:[32]},undefined,{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}],multiple:[{syncForm:0}]}]);function d(){if(typeof customElements==="undefined"){return}const i=["ch-combobox"];i.forEach((i=>{switch(i){case"ch-combobox":if(!customElements.get(a(i))){customElements.define(a(i),l)}break}}))}d();const c=l;const u=d;export{c as ChCombobox,u as defineCustomElement};
2
+ //# sourceMappingURL=ch-combobox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["chComboboxCss","comboboxIds","ChCombobox","__stencil_proxyCustomElement","HTMLElement","inputId","listId","this","hintId","errorId","initialValue","internals","formDisabled","label","options","value","multiple","placeholder","name","disabled","required","hint","errorMessage","invalid","query","expanded","activeIndex","chChange","chFilter","selected","Array","isArray","undefined","visibleOptions","trim","toLowerCase","filter","option","includes","choosable","chosen","Set","has","labelFor","find","componentDidLoad","syncForm","host","addEventListener","handleFocusOut","markTouched","disconnectedCallback","removeEventListener","setAttribute","window","setTimeout","contains","document","activeElement","shadowRoot","setFormValue","values","data","FormData","entry","append","length","flags","message","resolveValidity","empty","setValidity","formResetCallback","input","querySelector","formDisabledCallback","isDisabled","commit","next","emit","remove","open","moveActive","delta","count","handleInput","event","target","handleKeyDown","key","preventDefault","last","handleFocus","handleBlur","isInvalid","hasAttribute","describedBy","optionId","index","render","active","showError","h","Host","class","htmlFor","map","type","onClick","id","role","autocomplete","onInput","onKeyDown","onFocus","onBlur","hidden","listbox__option","onMouseDown"],"sources":["src/components/ch-combobox/ch-combobox.css?tag=ch-combobox&encapsulation=shadow","src/components/ch-combobox/ch-combobox.tsx"],"sourcesContent":[":host {\n display: block;\n width: 100%;\n font-family: var(--typography-body);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--color-text-primary);\n}\n\n.chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-xs);\n margin: 0 0 var(--spacing-sm);\n padding: 0;\n list-style: none;\n}\n\n.chip {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-xs);\n max-width: 100%;\n padding: var(--spacing-2xs) var(--spacing-sm);\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n background: var(--color-surface-hover);\n font-size: var(--typography-size-sm);\n}\n\n.chip__label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.chip__remove {\n all: unset;\n cursor: pointer;\n padding: 0 var(--spacing-2xs);\n border-radius: var(--radius-sm);\n color: var(--color-text-secondary);\n line-height: 1;\n}\n\n.chip__remove:focus-visible {\n outline: 2px solid var(--color-accent-default);\n outline-offset: 1px;\n}\n\n/* The list is positioned against the field, not the viewport: a dropdown that\n * is part of a form flow should move with it, unlike a tooltip. */\n.field {\n position: relative;\n}\n\n.input {\n box-sizing: border-box;\n width: 100%;\n padding: var(--spacing-xl) var(--spacing-3xl);\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n background: var(--color-surface-default);\n color: var(--color-text-primary);\n font-family: inherit;\n font-size: var(--typography-size-md);\n transition: border-color var(--duration-normal) var(--easing-default);\n}\n\n.input::placeholder {\n color: var(--color-text-secondary);\n}\n\n.input:focus {\n border-color: var(--color-accent-default);\n outline: 2px solid var(--color-accent-default);\n outline-offset: 1px;\n}\n\n.input:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.input--invalid {\n border-color: var(--color-status-warning);\n}\n\n.listbox {\n position: absolute;\n z-index: var(--z-index-dropdown);\n top: calc(100% + var(--spacing-2xs));\n left: 0;\n right: 0;\n max-height: 16rem;\n margin: 0;\n padding: var(--spacing-2xs);\n overflow-y: auto;\n list-style: none;\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n background: var(--color-surface-default);\n box-shadow: var(--shadow-elevate);\n}\n\n.listbox[hidden] {\n display: none;\n}\n\n.listbox__option {\n padding: var(--spacing-sm) var(--spacing-md);\n border-radius: var(--radius-sm);\n font-size: var(--typography-size-sm);\n cursor: pointer;\n}\n\n/* The active option is marked by a rule and weight, not only a tint. */\n.listbox__option--active {\n background: var(--color-surface-hover);\n font-weight: var(--typography-weight-semibold);\n box-shadow: inset 2px 0 0 var(--color-accent-default);\n}\n\n.listbox__option--disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.listbox__empty {\n padding: var(--spacing-sm) var(--spacing-md);\n font-size: var(--typography-size-sm);\n color: var(--color-text-secondary);\n}\n\n.hint,\n.error {\n margin: var(--spacing-sm) 0 0;\n font-size: var(--typography-size-sm);\n color: var(--color-text-secondary);\n}\n\n.error {\n color: var(--color-status-warning);\n}\n","import { AttachInternals, Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nimport { resolveValidity } from '../../utils/validation-message';\n\nexport interface ChComboboxOption {\n label: string;\n value: string;\n disabled?: boolean;\n /** Optional grouping label; consecutive options with the same group are announced together. */\n group?: string;\n}\n\nlet comboboxIds = 0;\n\n/**\n * A text field that filters a list of options and commits a choice.\n *\n * The input is a native `<input>` rather than `ch-input`: the combobox role\n * and its `aria-*` state have to sit on the element that owns the interaction,\n * and ARIA does not forward through a wrapper component.\n *\n * Single and multiple are one component. `multiple` changes the value shape\n * (`string` vs `string[]`), renders the chosen values as removable chips, and\n * keeps the list open after a pick; single commits and closes. Everything else\n * — filtering, the active option, keyboard behaviour, validity — is shared, so\n * the two cannot drift apart.\n *\n * The consumer owns the options and, if it fetches them, their ordering: this\n * component never sorts, debounces or requests anything. It filters what it is\n * given, and reports what the user asked for.\n */\n@Component({\n tag: 'ch-combobox',\n styleUrl: 'ch-combobox.css',\n shadow: true,\n formAssociated: true,\n})\nexport class ChCombobox {\n private readonly inputId = `ch-combobox-${++comboboxIds}`;\n private readonly listId = `${this.inputId}-list`;\n private readonly hintId = `${this.inputId}-hint`;\n private readonly errorId = `${this.inputId}-error`;\n private initialValue: string[] = [];\n\n @AttachInternals() internals!: ElementInternals;\n @State() formDisabled = false;\n @Element() private host!: HTMLElement;\n\n /** Visible label, associated with the input via `for`/`id`. */\n @Prop() label?: string;\n\n /** The options to filter and choose from. */\n @Prop() options: ChComboboxOption[] = [];\n\n /** The committed value. An array when `multiple`. */\n @Prop({ mutable: true }) value?: string | string[];\n\n /** Whether the user can pick more than one option. */\n @Prop({ reflect: true }) multiple = false;\n\n /** Placeholder shown while the field is empty. */\n @Prop() placeholder?: string;\n\n /** Name submitted with the form. Repeated once per value when `multiple`. */\n @Prop({ reflect: true }) name?: string;\n\n /** Whether the field is disabled. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Whether at least one value is required. */\n @Prop({ reflect: true }) required = false;\n\n /** Helper text, replaced by `errorMessage` when invalid. */\n @Prop() hint?: string;\n\n /** Custom error message; wins over the built-in messages. */\n @Prop() errorMessage?: string;\n\n /** Whether the field is marked invalid by the consumer. */\n @Prop() invalid = false;\n\n /** Text the user has typed to filter with. */\n @State() private query = '';\n\n /** Whether the list is rendered. */\n @State() private expanded = false;\n\n /** Index into `visibleOptions` of the option under the keyboard cursor. */\n @State() private activeIndex = -1;\n\n /** Emitted whenever the committed value changes. */\n @Event() chChange: EventEmitter<string | string[]>;\n\n /** Emitted as the user types, with the raw query, so a consumer can filter remotely. */\n @Event() chFilter: EventEmitter<string>;\n\n /** The committed values as an array, whatever the mode. */\n private get selected(): string[] {\n if (Array.isArray(this.value)) {\n return this.value;\n }\n return this.value === undefined || this.value === '' ? [] : [this.value];\n }\n\n /** Options that match the current query. */\n private get visibleOptions(): ChComboboxOption[] {\n const query = this.query.trim().toLowerCase();\n if (query === '') {\n return this.options;\n }\n return this.options.filter(option => option.label.toLowerCase().includes(query));\n }\n\n /** Options that are still choosable: already-picked ones drop out in multiple mode. */\n private get choosable(): ChComboboxOption[] {\n if (!this.multiple) {\n return this.visibleOptions;\n }\n const chosen = new Set(this.selected);\n return this.visibleOptions.filter(option => !chosen.has(option.value));\n }\n\n private labelFor(value: string): string {\n return this.options.find(option => option.value === value)?.label ?? value;\n }\n\n componentDidLoad() {\n this.initialValue = this.selected;\n this.syncForm();\n this.host.addEventListener('focusout', this.handleFocusOut);\n this.host.addEventListener('invalid', this.markTouched);\n }\n\n disconnectedCallback() {\n this.host.removeEventListener('focusout', this.handleFocusOut);\n }\n\n private markTouched = (): void => {\n this.host.setAttribute('data-touched', '');\n };\n\n /**\n * Closing on blur is deferred: clicking an option also blurs the input, and\n * the click must be allowed to land first.\n */\n private handleFocusOut = () => {\n this.markTouched();\n window.setTimeout(() => {\n if (!this.host.contains(document.activeElement) && this.host.shadowRoot?.activeElement == null) {\n this.expanded = false;\n this.syncForm();\n }\n }, 0);\n };\n\n @Watch('value')\n @Watch('required')\n @Watch('invalid')\n @Watch('errorMessage')\n @Watch('multiple')\n protected syncForm(): void {\n const internals = this.internals;\n if (typeof internals?.setFormValue !== 'function') {\n return;\n }\n const values = this.selected;\n // Multiple entries are submitted once per value, the way a multi-select does.\n if (this.multiple) {\n const data = new FormData();\n for (const entry of values) {\n data.append(this.name ?? '', entry);\n }\n internals.setFormValue(values.length === 0 ? null : data);\n } else {\n internals.setFormValue(values[0] ?? '');\n }\n\n const { flags, message } = resolveValidity({\n required: this.required,\n empty: values.length === 0,\n invalid: this.invalid,\n errorMessage: this.errorMessage,\n });\n internals.setValidity(flags, message);\n }\n\n formResetCallback(): void {\n this.value = this.multiple ? [...this.initialValue] : (this.initialValue[0] ?? '');\n this.query = '';\n this.syncForm();\n const input = this.host.shadowRoot?.querySelector('.input') as HTMLInputElement | null;\n if (input) {\n input.value = '';\n }\n }\n\n formDisabledCallback(isDisabled: boolean): void {\n this.formDisabled = isDisabled;\n }\n\n private commit(value: string) {\n if (this.multiple) {\n const next = this.selected.includes(value) ? this.selected : [...this.selected, value];\n this.value = next;\n this.query = '';\n const input = this.host.shadowRoot?.querySelector('.input') as HTMLInputElement | null;\n if (input) {\n input.value = '';\n }\n // Keep the list open: choosing again is the common case here.\n this.activeIndex = -1;\n } else {\n this.value = value;\n this.query = this.labelFor(value);\n this.expanded = false;\n this.activeIndex = -1;\n }\n this.chChange.emit(this.value as string | string[]);\n this.syncForm();\n }\n\n private remove(value: string) {\n const next = this.selected.filter(entry => entry !== value);\n this.value = this.multiple ? next : '';\n this.chChange.emit(this.value as string | string[]);\n this.syncForm();\n }\n\n private open() {\n if (this.disabled || this.formDisabled) {\n return;\n }\n this.expanded = true;\n }\n\n private moveActive(delta: number) {\n const count = this.choosable.length;\n if (count === 0) {\n return;\n }\n const next = this.activeIndex + delta;\n this.activeIndex = next < 0 ? count - 1 : next >= count ? 0 : next;\n }\n\n private handleInput = (event: InputEvent) => {\n const input = event.target as HTMLInputElement;\n this.query = input.value;\n this.expanded = true;\n this.activeIndex = this.choosable.length > 0 ? 0 : -1;\n // Single mode shows a typed-but-uncommitted value as no value at all.\n if (!this.multiple && this.value !== undefined && this.value !== this.labelFor(this.selected[0] ?? '')) {\n this.value = '';\n }\n this.chFilter.emit(this.query);\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.open();\n this.moveActive(1);\n return;\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.open();\n this.moveActive(-1);\n return;\n }\n if (event.key === 'Enter') {\n const option = this.choosable[this.activeIndex];\n if (this.expanded && option && !option.disabled) {\n event.preventDefault();\n this.commit(option.value);\n }\n return;\n }\n if (event.key === 'Escape' && this.expanded) {\n event.preventDefault();\n this.expanded = false;\n this.activeIndex = -1;\n return;\n }\n // Backspace in an empty multiple field removes the last chip.\n if (event.key === 'Backspace' && this.multiple && this.query === '') {\n const last = this.selected[this.selected.length - 1];\n if (last !== undefined) {\n event.preventDefault();\n this.remove(last);\n }\n }\n };\n\n private handleFocus = () => {\n this.open();\n };\n\n private handleBlur = () => {\n // A single-mode field shows the chosen label, not what was typed.\n const input = this.host.shadowRoot?.querySelector('.input') as HTMLInputElement | null;\n if (input && !this.multiple) {\n this.query = '';\n input.value = this.selected.length > 0 ? this.labelFor(this.selected[0]) : '';\n }\n };\n\n private get isInvalid(): boolean {\n return this.invalid || (this.host.hasAttribute('data-touched') && this.selected.length === 0 && this.required);\n }\n\n private get describedBy(): string | undefined {\n if (this.isInvalid && this.errorMessage) {\n return this.errorId;\n }\n return this.hint ? this.hintId : undefined;\n }\n\n /** The option id for `aria-activedescendant`. */\n private optionId(index: number): string {\n return `${this.inputId}-option-${index}`;\n }\n\n render() {\n const options = this.choosable;\n const active = this.activeIndex >= 0 && this.activeIndex < options.length ? options[this.activeIndex] : undefined;\n const chosen = this.selected;\n const showError = this.isInvalid && this.errorMessage;\n\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n </label>\n )}\n {this.multiple && chosen.length > 0 && (\n <ul class=\"chips\" aria-label=\"Selected values\">\n {chosen.map(entry => (\n <li class=\"chip\" key={entry}>\n <span class=\"chip__label\">{this.labelFor(entry)}</span>\n <button type=\"button\" class=\"chip__remove\" aria-label={`Remove ${this.labelFor(entry)}`} onClick={() => this.remove(entry)}>\n <span aria-hidden=\"true\">×</span>\n </button>\n </li>\n ))}\n </ul>\n )}\n <div class=\"field\">\n <input\n id={this.label && !this.multiple ? this.inputId : undefined}\n class={{ 'input': true, 'input--invalid': this.isInvalid }}\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-expanded={this.expanded ? 'true' : 'false'}\n aria-controls={this.listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={active ? this.optionId(this.activeIndex) : undefined}\n aria-invalid={this.isInvalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n name={this.name}\n disabled={this.disabled || this.formDisabled}\n required={this.required}\n placeholder={chosen.length === 0 ? this.placeholder : undefined}\n value={this.multiple ? this.query : this.query || (chosen[0] !== undefined ? this.labelFor(chosen[0]) : '')}\n onInput={this.handleInput}\n onKeyDown={this.handleKeyDown}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n <ul class=\"listbox\" id={this.listId} role=\"listbox\" aria-multiselectable={this.multiple ? 'true' : undefined} hidden={!this.expanded}>\n {options.length === 0 && (\n <li class=\"listbox__empty\" role=\"presentation\">\n No results\n </li>\n )}\n {options.map((option, index) => (\n <li\n class={{\n 'listbox__option': true,\n 'listbox__option--active': index === this.activeIndex,\n 'listbox__option--disabled': option.disabled === true,\n }}\n id={this.optionId(index)}\n key={option.value}\n role=\"option\"\n aria-selected={this.multiple ? 'false' : chosen[0] === option.value ? 'true' : 'false'}\n aria-disabled={option.disabled ? 'true' : undefined}\n // Pointer-down commits before the input's blur closes the list.\n onMouseDown={event => {\n event.preventDefault();\n if (!option.disabled) {\n this.commit(option.value);\n }\n }}\n >\n {option.label}\n </li>\n ))}\n </ul>\n </div>\n {this.hint && !showError && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {showError && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"],"mappings":"2GAAA,MAAMA,EAAgB,IAAM,6qFCY5B,IAAIC,EAAc,E,MAyBLC,EAAUC,EAAA,MAAAD,UAAAE,E,yLACJC,QAAU,iBAAiBJ,IAC3BK,OAAS,GAAGC,KAAKF,eACjBG,OAAS,GAAGD,KAAKF,eACjBI,QAAU,GAAGF,KAAKF,gBAC3BK,aAAyB,GAEdC,UACVC,aAAe,M,uBAIhBC,MAGAC,QAA8B,GAGbC,MAGAC,SAAW,MAG5BC,YAGiBC,KAGAC,SAAW,MAGXC,SAAW,MAG5BC,KAGAC,aAGAC,QAAU,MAGDC,MAAQ,GAGRC,SAAW,MAGXC,aAAc,EAGtBC,SAGAC,SAGT,YAAYC,GACV,GAAIC,MAAMC,QAAQxB,KAAKQ,OAAQ,CAC7B,OAAOR,KAAKQ,K,CAEd,OAAOR,KAAKQ,QAAUiB,WAAazB,KAAKQ,QAAU,GAAK,GAAK,CAACR,KAAKQ,M,CAIpE,kBAAYkB,GACV,MAAMT,EAAQjB,KAAKiB,MAAMU,OAAOC,cAChC,GAAIX,IAAU,GAAI,CAChB,OAAOjB,KAAKO,O,CAEd,OAAOP,KAAKO,QAAQsB,QAAOC,GAAUA,EAAOxB,MAAMsB,cAAcG,SAASd,I,CAI3E,aAAYe,GACV,IAAKhC,KAAKS,SAAU,CAClB,OAAOT,KAAK0B,c,CAEd,MAAMO,EAAS,IAAIC,IAAIlC,KAAKsB,UAC5B,OAAOtB,KAAK0B,eAAeG,QAAOC,IAAWG,EAAOE,IAAIL,EAAOtB,Q,CAGzD,QAAA4B,CAAS5B,GACf,OAAOR,KAAKO,QAAQ8B,MAAKP,GAAUA,EAAOtB,QAAUA,KAAQF,OAASE,C,CAGvE,gBAAA8B,GACEtC,KAAKG,aAAeH,KAAKsB,SACzBtB,KAAKuC,WACLvC,KAAKwC,KAAKC,iBAAiB,WAAYzC,KAAK0C,gBAC5C1C,KAAKwC,KAAKC,iBAAiB,UAAWzC,KAAK2C,Y,CAG7C,oBAAAC,GACE5C,KAAKwC,KAAKK,oBAAoB,WAAY7C,KAAK0C,e,CAGzCC,YAAc,KACpB3C,KAAKwC,KAAKM,aAAa,eAAgB,GAAG,EAOpCJ,eAAiB,KACvB1C,KAAK2C,cACLI,OAAOC,YAAW,KAChB,IAAKhD,KAAKwC,KAAKS,SAASC,SAASC,gBAAkBnD,KAAKwC,KAAKY,YAAYD,eAAiB,KAAM,CAC9FnD,KAAKkB,SAAW,MAChBlB,KAAKuC,U,IAEN,EAAE,EAQG,QAAAA,GACR,MAAMnC,EAAYJ,KAAKI,UACvB,UAAWA,GAAWiD,eAAiB,WAAY,CACjD,M,CAEF,MAAMC,EAAStD,KAAKsB,SAEpB,GAAItB,KAAKS,SAAU,CACjB,MAAM8C,EAAO,IAAIC,SACjB,IAAK,MAAMC,KAASH,EAAQ,CAC1BC,EAAKG,OAAO1D,KAAKW,MAAQ,GAAI8C,E,CAE/BrD,EAAUiD,aAAaC,EAAOK,SAAW,EAAI,KAAOJ,E,KAC/C,CACLnD,EAAUiD,aAAaC,EAAO,IAAM,G,CAGtC,MAAMM,MAAEA,EAAKC,QAAEA,GAAYC,EAAgB,CACzCjD,SAAUb,KAAKa,SACfkD,MAAOT,EAAOK,SAAW,EACzB3C,QAAShB,KAAKgB,QACdD,aAAcf,KAAKe,eAErBX,EAAU4D,YAAYJ,EAAOC,E,CAG/B,iBAAAI,GACEjE,KAAKQ,MAAQR,KAAKS,SAAW,IAAIT,KAAKG,cAAiBH,KAAKG,aAAa,IAAM,GAC/EH,KAAKiB,MAAQ,GACbjB,KAAKuC,WACL,MAAM2B,EAAQlE,KAAKwC,KAAKY,YAAYe,cAAc,UAClD,GAAID,EAAO,CACTA,EAAM1D,MAAQ,E,EAIlB,oBAAA4D,CAAqBC,GACnBrE,KAAKK,aAAegE,C,CAGd,MAAAC,CAAO9D,GACb,GAAIR,KAAKS,SAAU,CACjB,MAAM8D,EAAOvE,KAAKsB,SAASS,SAASvB,GAASR,KAAKsB,SAAW,IAAItB,KAAKsB,SAAUd,GAChFR,KAAKQ,MAAQ+D,EACbvE,KAAKiB,MAAQ,GACb,MAAMiD,EAAQlE,KAAKwC,KAAKY,YAAYe,cAAc,UAClD,GAAID,EAAO,CACTA,EAAM1D,MAAQ,E,CAGhBR,KAAKmB,aAAc,C,KACd,CACLnB,KAAKQ,MAAQA,EACbR,KAAKiB,MAAQjB,KAAKoC,SAAS5B,GAC3BR,KAAKkB,SAAW,MAChBlB,KAAKmB,aAAc,C,CAErBnB,KAAKoB,SAASoD,KAAKxE,KAAKQ,OACxBR,KAAKuC,U,CAGC,MAAAkC,CAAOjE,GACb,MAAM+D,EAAOvE,KAAKsB,SAASO,QAAO4B,GAASA,IAAUjD,IACrDR,KAAKQ,MAAQR,KAAKS,SAAW8D,EAAO,GACpCvE,KAAKoB,SAASoD,KAAKxE,KAAKQ,OACxBR,KAAKuC,U,CAGC,IAAAmC,GACN,GAAI1E,KAAKY,UAAYZ,KAAKK,aAAc,CACtC,M,CAEFL,KAAKkB,SAAW,I,CAGV,UAAAyD,CAAWC,GACjB,MAAMC,EAAQ7E,KAAKgC,UAAU2B,OAC7B,GAAIkB,IAAU,EAAG,CACf,M,CAEF,MAAMN,EAAOvE,KAAKmB,YAAcyD,EAChC5E,KAAKmB,YAAcoD,EAAO,EAAIM,EAAQ,EAAIN,GAAQM,EAAQ,EAAIN,C,CAGxDO,YAAeC,IACrB,MAAMb,EAAQa,EAAMC,OACpBhF,KAAKiB,MAAQiD,EAAM1D,MACnBR,KAAKkB,SAAW,KAChBlB,KAAKmB,YAAcnB,KAAKgC,UAAU2B,OAAS,EAAI,GAAI,EAEnD,IAAK3D,KAAKS,UAAYT,KAAKQ,QAAUiB,WAAazB,KAAKQ,QAAUR,KAAKoC,SAASpC,KAAKsB,SAAS,IAAM,IAAK,CACtGtB,KAAKQ,MAAQ,E,CAEfR,KAAKqB,SAASmD,KAAKxE,KAAKiB,MAAM,EAGxBgE,cAAiBF,IACvB,GAAIA,EAAMG,MAAQ,YAAa,CAC7BH,EAAMI,iBACNnF,KAAK0E,OACL1E,KAAK2E,WAAW,GAChB,M,CAEF,GAAII,EAAMG,MAAQ,UAAW,CAC3BH,EAAMI,iBACNnF,KAAK0E,OACL1E,KAAK2E,YAAW,GAChB,M,CAEF,GAAII,EAAMG,MAAQ,QAAS,CACzB,MAAMpD,EAAS9B,KAAKgC,UAAUhC,KAAKmB,aACnC,GAAInB,KAAKkB,UAAYY,IAAWA,EAAOlB,SAAU,CAC/CmE,EAAMI,iBACNnF,KAAKsE,OAAOxC,EAAOtB,M,CAErB,M,CAEF,GAAIuE,EAAMG,MAAQ,UAAYlF,KAAKkB,SAAU,CAC3C6D,EAAMI,iBACNnF,KAAKkB,SAAW,MAChBlB,KAAKmB,aAAc,EACnB,M,CAGF,GAAI4D,EAAMG,MAAQ,aAAelF,KAAKS,UAAYT,KAAKiB,QAAU,GAAI,CACnE,MAAMmE,EAAOpF,KAAKsB,SAAStB,KAAKsB,SAASqC,OAAS,GAClD,GAAIyB,IAAS3D,UAAW,CACtBsD,EAAMI,iBACNnF,KAAKyE,OAAOW,E,IAKVC,YAAc,KACpBrF,KAAK0E,MAAM,EAGLY,WAAa,KAEnB,MAAMpB,EAAQlE,KAAKwC,KAAKY,YAAYe,cAAc,UAClD,GAAID,IAAUlE,KAAKS,SAAU,CAC3BT,KAAKiB,MAAQ,GACbiD,EAAM1D,MAAQR,KAAKsB,SAASqC,OAAS,EAAI3D,KAAKoC,SAASpC,KAAKsB,SAAS,IAAM,E,GAI/E,aAAYiE,GACV,OAAOvF,KAAKgB,SAAYhB,KAAKwC,KAAKgD,aAAa,iBAAmBxF,KAAKsB,SAASqC,SAAW,GAAK3D,KAAKa,Q,CAGvG,eAAY4E,GACV,GAAIzF,KAAKuF,WAAavF,KAAKe,aAAc,CACvC,OAAOf,KAAKE,O,CAEd,OAAOF,KAAKc,KAAOd,KAAKC,OAASwB,S,CAI3B,QAAAiE,CAASC,GACf,MAAO,GAAG3F,KAAKF,kBAAkB6F,G,CAGnC,MAAAC,GACE,MAAMrF,EAAUP,KAAKgC,UACrB,MAAM6D,EAAS7F,KAAKmB,aAAe,GAAKnB,KAAKmB,YAAcZ,EAAQoD,OAASpD,EAAQP,KAAKmB,aAAeM,UACxG,MAAMQ,EAASjC,KAAKsB,SACpB,MAAMwE,EAAY9F,KAAKuF,WAAavF,KAAKe,aAEzC,OACEgF,EAACC,EAAI,CAAAd,IAAA,4CACFlF,KAAKM,OACJyF,EAAA,SAAAb,IAAA,2CAAOe,MAAM,QAAQC,QAASlG,KAAKF,SAChCE,KAAKM,OAGTN,KAAKS,UAAYwB,EAAO0B,OAAS,GAChCoC,EAAA,MAAAb,IAAA,2CAAIe,MAAM,QAAO,aAAY,mBAC1BhE,EAAOkE,KAAI1C,GACVsC,EAAA,MAAIE,MAAM,OAAOf,IAAKzB,GACpBsC,EAAA,QAAME,MAAM,eAAejG,KAAKoC,SAASqB,IACzCsC,EAAA,UAAQK,KAAK,SAASH,MAAM,eAAc,aAAa,UAAUjG,KAAKoC,SAASqB,KAAU4C,QAAS,IAAMrG,KAAKyE,OAAOhB,IAClHsC,EAAA,sBAAkB,QAAM,UAMlCA,EAAA,OAAAb,IAAA,2CAAKe,MAAM,SACTF,EAAA,SAAAb,IAAA,2CACEoB,GAAItG,KAAKM,QAAUN,KAAKS,SAAWT,KAAKF,QAAU2B,UAClDwE,MAAO,CAAE/B,MAAS,KAAM,iBAAkBlE,KAAKuF,WAC/Ca,KAAK,OACLG,KAAK,WACLC,aAAa,MAAK,gBACHxG,KAAKkB,SAAW,OAAS,QAAO,gBAChClB,KAAKD,OAAM,oBACR,OAAM,wBACD8F,EAAS7F,KAAK0F,SAAS1F,KAAKmB,aAAeM,UAAS,eAC7DzB,KAAKuF,UAAY,OAAS9D,UAAS,mBAC/BzB,KAAKyF,YACvB9E,KAAMX,KAAKW,KACXC,SAAUZ,KAAKY,UAAYZ,KAAKK,aAChCQ,SAAUb,KAAKa,SACfH,YAAauB,EAAO0B,SAAW,EAAI3D,KAAKU,YAAce,UACtDjB,MAAOR,KAAKS,SAAWT,KAAKiB,MAAQjB,KAAKiB,QAAUgB,EAAO,KAAOR,UAAYzB,KAAKoC,SAASH,EAAO,IAAM,IACxGwE,QAASzG,KAAK8E,YACd4B,UAAW1G,KAAKiF,cAChB0B,QAAS3G,KAAKqF,YACduB,OAAQ5G,KAAKsF,aAEfS,EAAA,MAAAb,IAAA,2CAAIe,MAAM,UAAUK,GAAItG,KAAKD,OAAQwG,KAAK,UAAS,uBAAuBvG,KAAKS,SAAW,OAASgB,UAAWoF,QAAS7G,KAAKkB,UACzHX,EAAQoD,SAAW,GAClBoC,EAAA,MAAAb,IAAA,2CAAIe,MAAM,iBAAiBM,KAAK,gBAAc,cAI/ChG,EAAQ4F,KAAI,CAACrE,EAAQ6D,IACpBI,EAAA,MACEE,MAAO,CACLa,gBAAmB,KACnB,0BAA2BnB,IAAU3F,KAAKmB,YAC1C,4BAA6BW,EAAOlB,WAAa,MAEnD0F,GAAItG,KAAK0F,SAASC,GAClBT,IAAKpD,EAAOtB,MACZ+F,KAAK,SAAQ,gBACEvG,KAAKS,SAAW,QAAUwB,EAAO,KAAOH,EAAOtB,MAAQ,OAAS,QAAO,gBACvEsB,EAAOlB,SAAW,OAASa,UAE1CsF,YAAahC,IACXA,EAAMI,iBACN,IAAKrD,EAAOlB,SAAU,CACpBZ,KAAKsE,OAAOxC,EAAOtB,M,IAItBsB,EAAOxB,WAKfN,KAAKc,OAASgF,GACbC,EAAA,KAAAb,IAAA,2CAAGe,MAAM,OAAOK,GAAItG,KAAKC,QACtBD,KAAKc,MAGTgF,GACCC,EAAA,KAAAb,IAAA,2CAAGe,MAAM,QAAQK,GAAItG,KAAKE,QAASqG,KAAK,SACrCvG,KAAKe,c","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface ChConfirmDialog extends Components.ChConfirmDialog, HTMLElement {}
4
+ export const ChConfirmDialog: {
5
+ prototype: ChConfirmDialog;
6
+ new (): ChConfirmDialog;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,2 @@
1
+ import{p as e,H as t,c as n,h as o,d as a,t as r}from"./p-qP_9qshx.js";import{d as i}from"./p-MBLhKofG.js";const s=()=>`:host{display:contents;font-family:var(--typography-body)}.confirm__heading{margin:0;font-family:var(--typography-heading);font-size:var(--typography-size-lg);font-weight:var(--typography-weight-semibold);color:var(--color-text-primary)}.confirm__message{margin:0;font-size:var(--typography-size-sm);color:var(--color-text-secondary);overflow-wrap:break-word}.confirm__actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--spacing-md);margin-top:var(--spacing-2xl)}.confirm__button{display:inline-flex;align-items:center;justify-content:center;min-height:2.25rem;padding:0 var(--spacing-lg);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-default);color:var(--color-text-primary);font-family:var(--typography-body);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);cursor:pointer}.confirm__button:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:2px}.confirm__button:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.confirm__button--confirm{border-color:var(--color-accent-default);background:var(--color-accent-default);color:var(--color-accent-text)}.confirm__button--danger{border-color:var(--color-status-warning);background:var(--color-status-warning);color:var(--color-text-primary)}.confirm__button--danger::before{content:'⚠';margin-right:var(--spacing-xs)}`;const c=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chConfirm=n(this,"chConfirm");this.chCancel=n(this,"chCancel")}get el(){return this}open=false;heading;message;confirmLabel="Confirm";cancelLabel="Cancel";tone="default";pending=false;dismissible=true;chConfirm;chCancel;settled=false;cancelButton;confirmButton;componentDidLoad(){if(this.open){this.onOpening()}}handleOpenChange(e){if(e){this.onOpening();return}this.settled=false}onOpening(){this.settled=false;requestAnimationFrame((()=>{const e=this.tone==="danger"?this.cancelButton:this.confirmButton;e?.focus()}))}settle(e){if(this.settled){return}this.settled=true;if(e==="confirm"){this.chConfirm.emit();return}this.chCancel.emit()}handleConfirm=()=>{if(this.pending){return}this.settle("confirm")};handleCancel=()=>{if(this.pending){return}this.open=false;this.settle("cancel")};handleModalClose=()=>{this.open=false;if(this.pending){return}this.settle("cancel")};handleKeyDown=e=>{if(this.dismissible||e.key!=="Escape"){return}e.preventDefault();e.stopPropagation()};async focusCancel(){this.cancelButton?.focus()}render(){return o(a,{key:"b51a806f4cca331fc3a95421d3342608c6e0df4c",onKeyDown:this.handleKeyDown},o("ch-modal",{key:"453db02cd724bc9bf2ed7c4b61bcf04c77b8d449",open:this.open,label:this.heading,size:"sm",onChClose:this.handleModalClose,onChOpen:()=>this.onOpening()},o("h2",{key:"1dee8f11ee68679792c394506ab2e8a7f98b852b",slot:"heading",class:"confirm__heading"},this.heading),this.message&&o("p",{key:"f2a8a473acfcdfee51600a0dc7bc47b85f4a0889",class:"confirm__message"},this.message),o("div",{key:"7ecfa78e4df217e38519f115fdcb4761ed88937d",class:"confirm__actions"},o("button",{key:"0c4a117caee9ef316932e2eea9c0aa3734f0bbee",class:{confirm__button:true,"confirm__button--cancel":true},type:"button",ref:e=>this.cancelButton=e,disabled:this.pending,onClick:this.handleCancel},this.cancelLabel),o("button",{key:"d33fd5f6f218bfcd39f179e29d757f7f9bdcae30",class:{confirm__button:true,"confirm__button--confirm":true,"confirm__button--danger":this.tone==="danger"},type:"button",ref:e=>this.confirmButton=e,disabled:this.pending,"aria-busy":this.pending?"true":undefined,onClick:this.handleConfirm},this.confirmLabel))))}static get watchers(){return{open:[{handleOpenChange:0}]}}static get style(){return s()}},[513,"ch-confirm-dialog",{open:[1028],heading:[1],message:[1],confirmLabel:[1,"confirm-label"],cancelLabel:[1,"cancel-label"],tone:[1],pending:[4],dismissible:[4],settled:[32],focusCancel:[64]},undefined,{open:[{handleOpenChange:0}]}]);function l(){if(typeof customElements==="undefined"){return}const e=["ch-confirm-dialog","ch-modal"];e.forEach((e=>{switch(e){case"ch-confirm-dialog":if(!customElements.get(r(e))){customElements.define(r(e),c)}break;case"ch-modal":if(!customElements.get(r(e))){i()}break}}))}l();const f=c;const d=l;export{f as ChConfirmDialog,d as defineCustomElement};
2
+ //# sourceMappingURL=ch-confirm-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["chConfirmDialogCss","ChConfirmDialog","__stencil_proxyCustomElement","HTMLElement","open","heading","message","confirmLabel","cancelLabel","tone","pending","dismissible","chConfirm","chCancel","settled","cancelButton","confirmButton","componentDidLoad","this","onOpening","handleOpenChange","requestAnimationFrame","target","focus","settle","outcome","emit","handleConfirm","handleCancel","handleModalClose","handleKeyDown","event","key","preventDefault","stopPropagation","focusCancel","render","h","Host","onKeyDown","label","size","onChClose","onChOpen","slot","class","confirm__button","type","ref","el","disabled","onClick","undefined"],"sources":["src/components/ch-confirm-dialog/ch-confirm-dialog.css?tag=ch-confirm-dialog&encapsulation=shadow","src/components/ch-confirm-dialog/ch-confirm-dialog.tsx"],"sourcesContent":[":host {\n display: contents;\n font-family: var(--typography-body);\n}\n\n.confirm__heading {\n margin: 0;\n font-family: var(--typography-heading);\n font-size: var(--typography-size-lg);\n font-weight: var(--typography-weight-semibold);\n color: var(--color-text-primary);\n}\n\n.confirm__message {\n margin: 0;\n font-size: var(--typography-size-sm);\n color: var(--color-text-secondary);\n overflow-wrap: break-word;\n}\n\n.confirm__actions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: var(--spacing-md);\n margin-top: var(--spacing-2xl);\n}\n\n.confirm__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 2.25rem;\n padding: 0 var(--spacing-lg);\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n background: var(--color-surface-default);\n color: var(--color-text-primary);\n font-family: var(--typography-body);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n cursor: pointer;\n}\n\n.confirm__button:focus-visible {\n outline: 2px solid var(--color-accent-default);\n outline-offset: 2px;\n}\n\n.confirm__button:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.confirm__button--confirm {\n border-color: var(--color-accent-default);\n background: var(--color-accent-default);\n color: var(--color-accent-text);\n}\n\n/* Destructive intent is carried by weight and iconography as well as colour. */\n.confirm__button--danger {\n border-color: var(--color-status-warning);\n background: var(--color-status-warning);\n color: var(--color-text-primary);\n}\n\n.confirm__button--danger::before {\n content: '⚠';\n margin-right: var(--spacing-xs);\n}\n","import { Component, Element, Event, type EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';\n\nexport type ChConfirmDialogTone = 'default' | 'danger';\n\n/**\n * A confirmation dialog over `ch-modal`.\n *\n * Declarative only: the consumer opens it with `open` and handles the outcome.\n * The imperative `confirm()` helper is a separate concern and a separate issue,\n * because a promise-returning helper has to own mounting, focus and unhandled\n * rejection, none of which a component should decide for its consumer.\n *\n * The guarantees this adds over a plain `ch-modal` are the ones that make a\n * confirmation safe:\n *\n * - exactly one outcome per interaction — a double click on Confirm emits once;\n * - every dismissal path (Cancel, Escape, backdrop, confirm) is reported, so a\n * consumer awaiting an answer cannot hang;\n * - focus lands on Cancel for a destructive action, so the absent-minded Enter\n * does not destroy anything;\n * - `pending` is not a cancellation: a slow request keeps the dialog open.\n */\n@Component({\n tag: 'ch-confirm-dialog',\n styleUrl: 'ch-confirm-dialog.css',\n shadow: true,\n})\nexport class ChConfirmDialog {\n @Element() el: HTMLElement;\n\n /** Whether the dialog is open. Kept in sync when it is dismissed. */\n @Prop({ mutable: true }) open = false;\n\n /**\n * The question, set as the dialog's accessible name. Required: a dialog\n * without a name is announced as an unlabelled group.\n */\n @Prop() heading!: string;\n\n /** Supporting text, rendered under the heading. */\n @Prop() message?: string;\n\n /** Label of the confirming action. */\n @Prop() confirmLabel = 'Confirm';\n\n /** Label of the dismissing action. */\n @Prop() cancelLabel = 'Cancel';\n\n /**\n * `danger` styles the confirm action as destructive and moves the initial\n * focus to Cancel, so the safe choice is the default one.\n */\n @Prop() tone: ChConfirmDialogTone = 'default';\n\n /** Whether the confirm action is in flight; both buttons are then disabled. */\n @Prop() pending = false;\n\n /**\n * Whether Escape and the backdrop dismiss the dialog. When false, the only\n * way out is one of the two buttons — use it only for a decision that must\n * be answered rather than abandoned.\n */\n @Prop() dismissible = true;\n\n /** Emitted once when the user confirms. */\n @Event() chConfirm: EventEmitter<void>;\n\n /** Emitted once when the dialog is dismissed without confirming. */\n @Event() chCancel: EventEmitter<void>;\n\n /** `true` once an outcome has been emitted for the current opening. */\n @State() private settled = false;\n\n private cancelButton?: HTMLButtonElement;\n private confirmButton?: HTMLButtonElement;\n\n componentDidLoad() {\n if (this.open) {\n this.onOpening();\n }\n }\n\n @Watch('open')\n handleOpenChange(open: boolean) {\n if (open) {\n this.onOpening();\n return;\n }\n this.settled = false;\n }\n\n private onOpening() {\n this.settled = false;\n // Focus is moved once the dialog is actually shown; the modal handles\n // moving focus into itself, and this refines where it lands.\n requestAnimationFrame(() => {\n const target = this.tone === 'danger' ? this.cancelButton : this.confirmButton;\n target?.focus();\n });\n }\n\n private settle(outcome: 'confirm' | 'cancel') {\n if (this.settled) {\n return;\n }\n this.settled = true;\n if (outcome === 'confirm') {\n this.chConfirm.emit();\n return;\n }\n this.chCancel.emit();\n }\n\n private handleConfirm = () => {\n if (this.pending) {\n return;\n }\n this.settle('confirm');\n };\n\n private handleCancel = () => {\n if (this.pending) {\n return;\n }\n this.open = false;\n this.settle('cancel');\n };\n\n /**\n * `ch-modal` reports every close that was not requested by the consumer —\n * Escape and the backdrop. A close while `pending` is the consumer's own\n * doing and is not a cancellation.\n */\n private handleModalClose = () => {\n this.open = false;\n if (this.pending) {\n return;\n }\n this.settle('cancel');\n };\n\n /**\n * Escape is a platform close request on the inner `<dialog>`, so a\n * non-dismissible dialog cancels it before it takes effect. The backdrop is\n * handled by `ch-modal` and is suppressed the same way.\n */\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.dismissible || event.key !== 'Escape') {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n };\n\n /**\n * Focus the safe action. Exposed so a consumer can return focus deliberately\n * after a request settles.\n */\n @Method()\n async focusCancel(): Promise<void> {\n this.cancelButton?.focus();\n }\n\n render() {\n return (\n <Host onKeyDown={this.handleKeyDown}>\n <ch-modal open={this.open} label={this.heading} size=\"sm\" onChClose={this.handleModalClose} onChOpen={() => this.onOpening()}>\n <h2 slot=\"heading\" class=\"confirm__heading\">\n {this.heading}\n </h2>\n {this.message && <p class=\"confirm__message\">{this.message}</p>}\n <div class=\"confirm__actions\">\n <button\n class={{ 'confirm__button': true, 'confirm__button--cancel': true }}\n type=\"button\"\n ref={el => (this.cancelButton = el as HTMLButtonElement)}\n disabled={this.pending}\n onClick={this.handleCancel}\n >\n {this.cancelLabel}\n </button>\n <button\n class={{ 'confirm__button': true, 'confirm__button--confirm': true, 'confirm__button--danger': this.tone === 'danger' }}\n type=\"button\"\n ref={el => (this.confirmButton = el as HTMLButtonElement)}\n disabled={this.pending}\n aria-busy={this.pending ? 'true' : undefined}\n onClick={this.handleConfirm}\n >\n {this.confirmLabel}\n </button>\n </div>\n </ch-modal>\n </Host>\n );\n }\n}\n"],"mappings":"2GAAA,MAAMA,EAAqB,IAAM,s5C,MC2BpBC,EAAeC,EAAA,MAAAD,UAAAE,E,0KAIDC,KAAO,MAMxBC,QAGAC,QAGAC,aAAe,UAGfC,YAAc,SAMdC,KAA4B,UAG5BC,QAAU,MAOVC,YAAc,KAGbC,UAGAC,SAGQC,QAAU,MAEnBC,aACAC,cAER,gBAAAC,GACE,GAAIC,KAAKd,KAAM,CACbc,KAAKC,W,EAKT,gBAAAC,CAAiBhB,GACf,GAAIA,EAAM,CACRc,KAAKC,YACL,M,CAEFD,KAAKJ,QAAU,K,CAGT,SAAAK,GACND,KAAKJ,QAAU,MAGfO,uBAAsB,KACpB,MAAMC,EAASJ,KAAKT,OAAS,SAAWS,KAAKH,aAAeG,KAAKF,cACjEM,GAAQC,OAAO,G,CAIX,MAAAC,CAAOC,GACb,GAAIP,KAAKJ,QAAS,CAChB,M,CAEFI,KAAKJ,QAAU,KACf,GAAIW,IAAY,UAAW,CACzBP,KAAKN,UAAUc,OACf,M,CAEFR,KAAKL,SAASa,M,CAGRC,cAAgB,KACtB,GAAIT,KAAKR,QAAS,CAChB,M,CAEFQ,KAAKM,OAAO,UAAU,EAGhBI,aAAe,KACrB,GAAIV,KAAKR,QAAS,CAChB,M,CAEFQ,KAAKd,KAAO,MACZc,KAAKM,OAAO,SAAS,EAQfK,iBAAmB,KACzBX,KAAKd,KAAO,MACZ,GAAIc,KAAKR,QAAS,CAChB,M,CAEFQ,KAAKM,OAAO,SAAS,EAQfM,cAAiBC,IACvB,GAAIb,KAAKP,aAAeoB,EAAMC,MAAQ,SAAU,CAC9C,M,CAEFD,EAAME,iBACNF,EAAMG,iBAAiB,EAQzB,iBAAMC,GACJjB,KAAKH,cAAcQ,O,CAGrB,MAAAa,GACE,OACEC,EAACC,EAAI,CAAAN,IAAA,2CAACO,UAAWrB,KAAKY,eACpBO,EAAA,YAAAL,IAAA,2CAAU5B,KAAMc,KAAKd,KAAMoC,MAAOtB,KAAKb,QAASoC,KAAK,KAAKC,UAAWxB,KAAKW,iBAAkBc,SAAU,IAAMzB,KAAKC,aAC/GkB,EAAA,MAAAL,IAAA,2CAAIY,KAAK,UAAUC,MAAM,oBACtB3B,KAAKb,SAEPa,KAAKZ,SAAW+B,EAAA,KAAAL,IAAA,2CAAGa,MAAM,oBAAoB3B,KAAKZ,SACnD+B,EAAA,OAAAL,IAAA,2CAAKa,MAAM,oBACTR,EAAA,UAAAL,IAAA,2CACEa,MAAO,CAAEC,gBAAmB,KAAM,0BAA2B,MAC7DC,KAAK,SACLC,IAAKC,GAAO/B,KAAKH,aAAekC,EAChCC,SAAUhC,KAAKR,QACfyC,QAASjC,KAAKU,cAEbV,KAAKV,aAER6B,EAAA,UAAAL,IAAA,2CACEa,MAAO,CAAEC,gBAAmB,KAAM,2BAA4B,KAAM,0BAA2B5B,KAAKT,OAAS,UAC7GsC,KAAK,SACLC,IAAKC,GAAO/B,KAAKF,cAAgBiC,EACjCC,SAAUhC,KAAKR,QAAO,YACXQ,KAAKR,QAAU,OAAS0C,UACnCD,QAASjC,KAAKS,eAEbT,KAAKX,gB","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{p as t,H as s,h as e,d as i,t as a}from"./p-qP_9qshx.js";const o=()=>`:host{display:block;font-family:var(--typography-body);color:var(--color-text-secondary)}:host([hidden]){display:none}.list{margin:0;display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));gap:var(--spacing-sm) var(--spacing-2xl)}.list--columns-2,.list--columns-3{grid-template-columns:repeat(2, minmax(0, 1fr))}.list--columns-3{grid-template-columns:repeat(3, minmax(0, 1fr))}@media (max-width: 48rem){.list--columns-2,.list--columns-3{grid-template-columns:minmax(0, 1fr)}}::slotted(div){display:grid;grid-template-columns:fit-content(min(12rem, 40%)) minmax(0, 1fr);gap:var(--spacing-sm);align-items:baseline}::slotted(dt){font-family:var(--typography-heading);font-weight:var(--typography-weight-semibold);font-size:var(--typography-size-sm);color:var(--color-text-primary)}::slotted(dd){margin:0;font-size:var(--typography-size-sm);min-width:0;overflow-wrap:break-word}`;const n=new Set(["1","2","3"]);const r=t(class t extends s{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow()}columns="1";get columnCount(){return n.has(this.columns)?this.columns:"1"}render(){return e(i,{key:"2f349aa14dc442e4e531dacc2d9f6b02fc2b141a"},e("dl",{key:"de4bf1b60c31f0319bc5e169304134c8e0046912",class:`list list--columns-${this.columnCount}`},e("slot",{key:"4ef568fa3e64048ba6e586ae9e8d10c21ad326aa"})))}static get style(){return o()}},[769,"ch-description-list",{columns:[1]}]);function l(){if(typeof customElements==="undefined"){return}const t=["ch-description-list"];t.forEach((t=>{switch(t){case"ch-description-list":if(!customElements.get(a(t))){customElements.define(a(t),r)}break}}))}l();const c=r;const m=l;export{c as ChDescriptionList,m as defineCustomElement};
1
+ import{p as t,H as s,h as e,d as i,t as o}from"./p-qP_9qshx.js";const a=()=>`:host{display:block;font-family:var(--typography-body);color:var(--color-text-secondary)}:host([hidden]){display:none}.list{margin:0;display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));gap:var(--spacing-sm) var(--spacing-2xl)}.list--columns-2,.list--columns-3{grid-template-columns:repeat(2, minmax(0, 1fr))}.list--columns-3{grid-template-columns:repeat(3, minmax(0, 1fr))}@media (max-width: 48rem){.list--columns-2,.list--columns-3{grid-template-columns:minmax(0, 1fr)}}::slotted(div){display:grid;grid-template-columns:fit-content(min(12rem, 40%)) minmax(0, 1fr);gap:var(--spacing-sm);align-items:baseline}::slotted(dt){font-family:var(--typography-heading);font-weight:var(--typography-weight-semibold);font-size:var(--typography-size-sm);color:var(--color-text-primary)}::slotted(dd){margin:0;font-size:var(--typography-size-sm);min-width:0;overflow-wrap:break-word}`;const n=new Set(["1","2","3"]);const r=t(class t extends s{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow()}columns="1";get columnCount(){return n.has(this.columns)?this.columns:"1"}render(){return e(i,{key:"1fd1228705a78196b618efc4b9665de038663ae5"},e("dl",{key:"0b724aa3c5dec011106347d9d29d0420f723012f",class:`list list--columns-${this.columnCount}`},e("slot",{key:"4da2c6965568cf7d2f93ee98e131a7bede26d5dc"})))}static get style(){return a()}},[769,"ch-description-list",{columns:[1]}]);function l(){if(typeof customElements==="undefined"){return}const t=["ch-description-list"];t.forEach((t=>{switch(t){case"ch-description-list":if(!customElements.get(o(t))){customElements.define(o(t),r)}break}}))}l();const m=r;const c=l;export{m as ChDescriptionList,c as defineCustomElement};
2
2
  //# sourceMappingURL=ch-description-list.js.map
@@ -1,2 +1,2 @@
1
- import{p as e,H as i,h as t,d as r,t as s}from"./p-qP_9qshx.js";const d=()=>`:host{display:block}:host(.divider--vertical){display:inline-block;height:100%;align-self:stretch}.divider{margin:0;border:none;background:var(--border)}.divider--horizontal{width:100%;height:var(--border-width)}.divider--vertical{width:var(--border-width);height:100%}`;const c=e(class e extends i{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}orientation="horizontal";render(){return t(r,{key:"0ae19c8f91c810836781f7dac098b49b99c01389",class:{"divider--vertical":this.orientation==="vertical"}},t("hr",{key:"f5b782f7d67da28ec659fceef32ebf0f4d8ca521",class:{divider:true,[`divider--${this.orientation}`]:true},"aria-orientation":this.orientation}))}static get style(){return d()}},[513,"ch-divider",{orientation:[1]}]);function o(){if(typeof customElements==="undefined"){return}const e=["ch-divider"];e.forEach((e=>{switch(e){case"ch-divider":if(!customElements.get(s(e))){customElements.define(s(e),c)}break}}))}o();const a=c;const n=o;export{a as ChDivider,n as defineCustomElement};
1
+ import{p as e,H as i,h as t,d as r,t as d}from"./p-qP_9qshx.js";const s=()=>`:host{display:block}:host(.divider--vertical){display:inline-block;height:100%;align-self:stretch}.divider{margin:0;border:none;background:var(--border)}.divider--horizontal{width:100%;height:var(--border-width)}.divider--vertical{width:var(--border-width);height:100%}`;const o=e(class e extends i{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}orientation="horizontal";render(){return t(r,{key:"cc193b7e7229de8ff96eb056bd345cc8d666004b",class:{"divider--vertical":this.orientation==="vertical"}},t("hr",{key:"659320c0372d208aab9b13d471427e479499a72c",class:{divider:true,[`divider--${this.orientation}`]:true},"aria-orientation":this.orientation}))}static get style(){return s()}},[513,"ch-divider",{orientation:[1]}]);function c(){if(typeof customElements==="undefined"){return}const e=["ch-divider"];e.forEach((e=>{switch(e){case"ch-divider":if(!customElements.get(d(e))){customElements.define(d(e),o)}break}}))}c();const n=o;const a=c;export{n as ChDivider,a as defineCustomElement};
2
2
  //# sourceMappingURL=ch-divider.js.map
@@ -1,2 +1,2 @@
1
- import{p as e,H as a,c as t,h as r,d as i,t as n}from"./p-qP_9qshx.js";import{l as o,u as s}from"./p-d8DfpzMR.js";const d=()=>`.drawer{position:fixed;inset:0;margin:0;box-sizing:border-box;flex-direction:column;gap:var(--spacing-2xl);width:min(24rem, 100vw);height:100vh;height:100dvh;max-width:100vw;max-height:100dvh;padding:var(--spacing-5xl);border:var(--border-width) solid var(--border);border-radius:0;background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-md);overflow:hidden}.drawer[open]{display:flex}.drawer--start{inset:0 auto 0 0;border-inline-start:none;animation:drawer-in-start var(--duration-normal) var(--easing-default)}.drawer--end{inset:0 0 0 auto;border-inline-end:none;animation:drawer-in-end var(--duration-normal) var(--easing-default)}.drawer--top{inset:0 0 auto 0;width:100vw;height:auto;max-height:80dvh;border-block-start:none;animation:drawer-in-top var(--duration-normal) var(--easing-default)}.drawer--bottom{inset:auto 0 0 0;width:100vw;height:auto;max-height:80dvh;border-block-end:none;animation:drawer-in-bottom var(--duration-normal) var(--easing-default)}.drawer::backdrop{background:var(--color-scrim-default);backdrop-filter:blur(var(--effect-blur))}.drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);flex:none}.drawer-body{flex:1;min-height:0;overflow-y:auto}::slotted([slot='footer']){display:flex;align-items:center;justify-content:flex-end;gap:var(--spacing-md);flex:none;padding-top:var(--spacing-2xl);border-top:var(--border-width) solid var(--border)}.drawer-close{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--spacing-2xs) var(--spacing-md);border:0;border-radius:var(--radius);background:none;color:var(--text-muted);cursor:pointer;font-family:var(--font-heading);font-size:var(--typography-size-lg);line-height:1;transition:background-color var(--duration-normal) var(--easing-default)}.drawer-close:hover{background:var(--surface-hover);color:var(--text)}.drawer-close:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}@keyframes drawer-in-start{from{transform:translateX(-100%)}}@keyframes drawer-in-end{from{transform:translateX(100%)}}@keyframes drawer-in-top{from{transform:translateY(-100%)}}@keyframes drawer-in-bottom{from{transform:translateY(100%)}}@media (pointer: coarse){.drawer-close{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.drawer{animation:none}.drawer-close{transition:none}}`;const l=e(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chOpen=t(this,"chOpen");this.chClose=t(this,"chClose")}get el(){return this}open=false;side="end";label;closeLabel;chOpen;chClose;dialog;scrollLocked=false;pointerDownedOutside=false;componentDidLoad(){this.dialog?.addEventListener("close",this.handleNativeClose);this.dialog?.addEventListener("pointerdown",this.handlePointerDown);this.dialog?.addEventListener("click",this.handleClick);if(this.open){this.showDialog()}}disconnectedCallback(){this.dialog?.removeEventListener("close",this.handleNativeClose);this.dialog?.removeEventListener("pointerdown",this.handlePointerDown);this.dialog?.removeEventListener("click",this.handleClick);this.unlockScroll()}handleOpenChange(e){if(e){this.showDialog()}else{this.closeDialog()}}showDialog(){if(typeof this.dialog?.showModal!=="function"){return}this.lockScroll();this.dialog.showModal();this.chOpen.emit()}closeDialog(){if(typeof this.dialog?.close==="function"&&this.dialog.open){this.dialog.close()}}lockScroll(){if(this.scrollLocked){return}this.scrollLocked=true;o()}unlockScroll(){if(!this.scrollLocked){return}this.scrollLocked=false;s()}isOnBackdrop(e){if(!this.dialog||e.target!==this.dialog){return false}const a=this.dialog.getBoundingClientRect();return e.clientX<a.left||e.clientX>a.right||e.clientY<a.top||e.clientY>a.bottom}handlePointerDown=e=>{this.pointerDownedOutside=this.isOnBackdrop(e)};handleClick=e=>{const a=this.pointerDownedOutside&&this.isOnBackdrop(e);this.pointerDownedOutside=false;if(a){this.closeDialog()}};handleNativeClose=()=>{this.unlockScroll();if(this.open){this.open=false}this.chClose.emit()};handleCloseClick=()=>{if(typeof this.dialog?.close==="function"&&this.dialog.open){this.dialog.close();return}this.open=false;this.chClose.emit()};render(){return r(i,{key:"871af03f0944e4272be64c1452cc28a0a39ac0f2"},r("dialog",{key:"540da9d2bff68d5528e65146b2a049adbc9723c2",class:{drawer:true,[`drawer--${this.side}`]:true},"aria-label":this.label,ref:e=>this.dialog=e},r("div",{key:"de569a4d239dd5e2bf6b2741b77307eb70ddced1",class:"drawer-head"},r("slot",{key:"e28ade42e0835a919aa5447dafbbbfff2de903d7",name:"header"}),this.closeLabel&&r("button",{key:"5cf29d8b791652fce663459f479826564637d6ca",class:"drawer-close",type:"button","aria-label":this.closeLabel,onClick:this.handleCloseClick},r("span",{key:"06a24d8b140db10b9d543530ea5dfbd8dd991019","aria-hidden":"true"},"×"))),r("div",{key:"b593bac5fb45234d501d3ec540f00d804ae5e066",class:"drawer-body"},r("slot",{key:"854cb053b30234aa31d59fcf27bb7d2820311eb3"})),r("slot",{key:"5c1fb51d3636af1762b26d72f5eaa79c5f779a60",name:"footer"})))}static get watchers(){return{open:[{handleOpenChange:0}]}}static get style(){return d()}},[769,"ch-drawer",{open:[1028],side:[1],label:[1],closeLabel:[1,"close-label"]},undefined,{open:[{handleOpenChange:0}]}]);function c(){if(typeof customElements==="undefined"){return}const e=["ch-drawer"];e.forEach((e=>{switch(e){case"ch-drawer":if(!customElements.get(n(e))){customElements.define(n(e),l)}break}}))}c();const h=l;const f=c;export{h as ChDrawer,f as defineCustomElement};
1
+ import{p as e,H as a,c as t,h as r,d as i,t as n}from"./p-qP_9qshx.js";import{l as o,u as s}from"./p-d8DfpzMR.js";const d=()=>`.drawer{position:fixed;inset:0;margin:0;box-sizing:border-box;flex-direction:column;gap:var(--spacing-2xl);width:min(24rem, 100vw);height:100vh;height:100dvh;max-width:100vw;max-height:100dvh;padding:var(--spacing-5xl);border:var(--border-width) solid var(--border);border-radius:0;background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-md);overflow:hidden}.drawer[open]{display:flex}.drawer--start{inset:0 auto 0 0;border-inline-start:none;animation:drawer-in-start var(--duration-normal) var(--easing-default)}.drawer--end{inset:0 0 0 auto;border-inline-end:none;animation:drawer-in-end var(--duration-normal) var(--easing-default)}.drawer--top{inset:0 0 auto 0;width:100vw;height:auto;max-height:80dvh;border-block-start:none;animation:drawer-in-top var(--duration-normal) var(--easing-default)}.drawer--bottom{inset:auto 0 0 0;width:100vw;height:auto;max-height:80dvh;border-block-end:none;animation:drawer-in-bottom var(--duration-normal) var(--easing-default)}.drawer::backdrop{background:var(--color-scrim-default);backdrop-filter:blur(var(--effect-blur))}.drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);flex:none}.drawer-body{flex:1;min-height:0;overflow-y:auto}::slotted([slot='footer']){display:flex;align-items:center;justify-content:flex-end;gap:var(--spacing-md);flex:none;padding-top:var(--spacing-2xl);border-top:var(--border-width) solid var(--border)}.drawer-close{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--spacing-2xs) var(--spacing-md);border:0;border-radius:var(--radius);background:none;color:var(--text-muted);cursor:pointer;font-family:var(--font-heading);font-size:var(--typography-size-lg);line-height:1;transition:background-color var(--duration-normal) var(--easing-default)}.drawer-close:hover{background:var(--surface-hover);color:var(--text)}.drawer-close:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}@keyframes drawer-in-start{from{transform:translateX(-100%)}}@keyframes drawer-in-end{from{transform:translateX(100%)}}@keyframes drawer-in-top{from{transform:translateY(-100%)}}@keyframes drawer-in-bottom{from{transform:translateY(100%)}}@media (pointer: coarse){.drawer-close{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.drawer{animation:none}.drawer-close{transition:none}}`;const l=e(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chOpen=t(this,"chOpen");this.chClose=t(this,"chClose")}get el(){return this}open=false;side="end";label;closeLabel;chOpen;chClose;dialog;scrollLocked=false;pointerDownedOutside=false;componentDidLoad(){this.dialog?.addEventListener("close",this.handleNativeClose);this.dialog?.addEventListener("pointerdown",this.handlePointerDown);this.dialog?.addEventListener("click",this.handleClick);if(this.open){this.showDialog()}}disconnectedCallback(){this.dialog?.removeEventListener("close",this.handleNativeClose);this.dialog?.removeEventListener("pointerdown",this.handlePointerDown);this.dialog?.removeEventListener("click",this.handleClick);this.unlockScroll()}handleOpenChange(e){if(e){this.showDialog()}else{this.closeDialog()}}showDialog(){if(typeof this.dialog?.showModal!=="function"){return}this.lockScroll();this.dialog.showModal();this.chOpen.emit()}closeDialog(){if(typeof this.dialog?.close==="function"&&this.dialog.open){this.dialog.close()}}lockScroll(){if(this.scrollLocked){return}this.scrollLocked=true;o()}unlockScroll(){if(!this.scrollLocked){return}this.scrollLocked=false;s()}isOnBackdrop(e){if(!this.dialog||e.target!==this.dialog){return false}const a=this.dialog.getBoundingClientRect();return e.clientX<a.left||e.clientX>a.right||e.clientY<a.top||e.clientY>a.bottom}handlePointerDown=e=>{this.pointerDownedOutside=this.isOnBackdrop(e)};handleClick=e=>{const a=this.pointerDownedOutside&&this.isOnBackdrop(e);this.pointerDownedOutside=false;if(a){this.closeDialog()}};handleNativeClose=()=>{this.unlockScroll();if(this.open){this.open=false}this.chClose.emit()};handleCloseClick=()=>{if(typeof this.dialog?.close==="function"&&this.dialog.open){this.dialog.close();return}this.open=false;this.chClose.emit()};render(){return r(i,{key:"1a51b3f19b956fe860fe4def9f2ac23eac7f86ac"},r("dialog",{key:"ad7366eb2e6274962faa2a1564a06ecc3268329c",class:{drawer:true,[`drawer--${this.side}`]:true},"aria-label":this.label,ref:e=>this.dialog=e},r("div",{key:"ce532be71c35234f1713051e5669f1cf9316031e",class:"drawer-head"},r("slot",{key:"b522a8f26dddefd2aaf146134ac24e026a5eb72a",name:"header"}),this.closeLabel&&r("button",{key:"b51fb4e20797cd82661c72c9250b0875338180f0",class:"drawer-close",type:"button","aria-label":this.closeLabel,onClick:this.handleCloseClick},r("span",{key:"dd21e30fcb74f08c80b1c2ba79696e1d54bf4c26","aria-hidden":"true"},"×"))),r("div",{key:"eacafa24e5af7c107e09a7cbfdfc93ae6f373dc5",class:"drawer-body"},r("slot",{key:"ddf9370c27956bc2954a3af29064394d37ec5e67"})),r("slot",{key:"0065c8f5bafb14791e63d15bbec0ec2ba533c222",name:"footer"})))}static get watchers(){return{open:[{handleOpenChange:0}]}}static get style(){return d()}},[769,"ch-drawer",{open:[1028],side:[1],label:[1],closeLabel:[1,"close-label"]},undefined,{open:[{handleOpenChange:0}]}]);function c(){if(typeof customElements==="undefined"){return}const e=["ch-drawer"];e.forEach((e=>{switch(e){case"ch-drawer":if(!customElements.get(n(e))){customElements.define(n(e),l)}break}}))}c();const h=l;const f=c;export{h as ChDrawer,f as defineCustomElement};
2
2
  //# sourceMappingURL=ch-drawer.js.map
@@ -1,2 +1,2 @@
1
- import{p as e,H as t,h as o,d as s,t as n}from"./p-qP_9qshx.js";const i="aaaa";const a="ameno";const h="huemul-love";const l="huemul-love";const c="humo";const m="hypnotoad";const d="lmao";const u="loading";const r="loco";const g="loco2";const f="lol";const p="lol2";const j="monea";const x="negative";var v={aaaa:i,ameno:a,"huemul-huaso":"huemul-huaso","huemul-love":"huemul-love",heart:h,love:l,"huemul-trusted":"huemul-trusted",humo:c,hypnotoad:m,"lets-fucking-go":"lets-fucking-go",lmao:d,loading:u,loco:r,loco2:g,lol:f,lol2:p,monea:j,negative:x};const b=()=>`:host{display:inline-block;vertical-align:middle}.emoji{display:block;object-fit:contain}.emoji--sm{width:16px;height:16px}.emoji--md{width:24px;height:24px}.emoji--lg{width:32px;height:32px}.emoji--xl{width:48px;height:48px}.emoji--hidden{display:none}`;const y="https://static.devschile.cl/emoji";const k=["png","gif","jpg","svg"];const w=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}extIndex=0;loaded=false;name;alt;size="md";componentWillLoad(){this.resolveAsset()}handleNameChange(){this.resolveAsset()}resolveAsset(){this.extIndex=0;this.loaded=false}get assetName(){return v[this.name]??this.name}get currentSrc(){return`${y}/${this.assetName}.${k[this.extIndex]}`}handleError=()=>{if(this.extIndex<k.length-1){this.extIndex++}};handleLoad=()=>{this.loaded=true};render(){return o(s,{key:"8444f71f1c84fd8b1940503c5e7bf5ff62bbb9e6"},o("img",{key:"ce9c083238c87557f71838ab8de50038fc43a2bd",class:{emoji:true,[`emoji--${this.size}`]:true,"emoji--hidden":!this.loaded},src:this.currentSrc,alt:this.alt??this.name,onError:this.handleError,onLoad:this.handleLoad}))}static get watchers(){return{name:[{handleNameChange:0}]}}static get style(){return b()}},[513,"ch-emoji",{name:[1],alt:[1],size:[1],extIndex:[32],loaded:[32]},undefined,{name:[{handleNameChange:0}]}]);function E(){if(typeof customElements==="undefined"){return}const e=["ch-emoji"];e.forEach((e=>{switch(e){case"ch-emoji":if(!customElements.get(n(e))){customElements.define(n(e),w)}break}}))}E();const N=w;const $=E;export{N as ChEmoji,$ as defineCustomElement};
1
+ import{p as e,H as t,h as o,d as s,t as n}from"./p-qP_9qshx.js";const i="aaaa";const a="ameno";const h="huemul-love";const l="huemul-love";const c="humo";const m="hypnotoad";const d="lmao";const u="loading";const r="loco";const g="loco2";const p="lol";const f="lol2";const j="monea";const x="negative";var b={aaaa:i,ameno:a,"huemul-huaso":"huemul-huaso","huemul-love":"huemul-love",heart:h,love:l,"huemul-trusted":"huemul-trusted",humo:c,hypnotoad:m,"lets-fucking-go":"lets-fucking-go",lmao:d,loading:u,loco:r,loco2:g,lol:p,lol2:f,monea:j,negative:x};const v=()=>`:host{display:inline-block;vertical-align:middle}.emoji{display:block;object-fit:contain}.emoji--sm{width:16px;height:16px}.emoji--md{width:24px;height:24px}.emoji--lg{width:32px;height:32px}.emoji--xl{width:48px;height:48px}.emoji--hidden{display:none}`;const y="https://static.devschile.cl/emoji";const k=["png","gif","jpg","svg"];const w=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}extIndex=0;loaded=false;name;alt;size="md";componentWillLoad(){this.resolveAsset()}handleNameChange(){this.resolveAsset()}resolveAsset(){this.extIndex=0;this.loaded=false}get assetName(){return b[this.name]??this.name}get currentSrc(){return`${y}/${this.assetName}.${k[this.extIndex]}`}handleError=()=>{if(this.extIndex<k.length-1){this.extIndex++}};handleLoad=()=>{this.loaded=true};render(){return o(s,{key:"d6e224a01b95fdebb4525b30b326585ee96e1050"},o("img",{key:"6bc232d8f25e0099c9e2794f15b8e47f6c2dbb22",class:{emoji:true,[`emoji--${this.size}`]:true,"emoji--hidden":!this.loaded},src:this.currentSrc,alt:this.alt??this.name,onError:this.handleError,onLoad:this.handleLoad}))}static get watchers(){return{name:[{handleNameChange:0}]}}static get style(){return v()}},[513,"ch-emoji",{name:[1],alt:[1],size:[1],extIndex:[32],loaded:[32]},undefined,{name:[{handleNameChange:0}]}]);function E(){if(typeof customElements==="undefined"){return}const e=["ch-emoji"];e.forEach((e=>{switch(e){case"ch-emoji":if(!customElements.get(n(e))){customElements.define(n(e),w)}break}}))}E();const N=w;const $=E;export{N as ChEmoji,$ as defineCustomElement};
2
2
  //# sourceMappingURL=ch-emoji.js.map
@@ -1,2 +1,2 @@
1
- import{p as e,H as t,h as a,d as s,t as i}from"./p-qP_9qshx.js";const r=()=>`:host{display:block;font-family:var(--typography-body);color:var(--color-text-secondary);text-align:center}:host([hidden]){display:none}.empty-state__inner{display:flex;flex-direction:column;align-items:center;gap:var(--spacing-sm);padding:var(--spacing-6xl) var(--spacing-2xl);border:var(--border-width) dashed var(--color-border-default);border-radius:var(--radius-md);background:var(--color-surface-default)}.empty-state--sm .empty-state__inner{padding:var(--spacing-3xl) var(--spacing-xl);gap:var(--spacing-xs)}.empty-state__icon{display:contents;font-size:var(--typography-size-xl);line-height:1}.empty-state__icon:empty{display:none}.empty-state__title{margin:0;font-family:var(--typography-heading);font-size:var(--typography-size-md);font-weight:var(--typography-weight-semibold);color:var(--color-text-primary)}.empty-state--md .empty-state__title{font-size:var(--typography-size-lg)}.empty-state__description{margin:0;max-width:36ch;font-size:var(--typography-size-sm);line-height:1.5}.empty-state__actions:empty{display:none}.empty-state__actions{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);justify-content:center;margin-top:var(--spacing-xs)}`;const c=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}title;description;size="md";render(){return a(s,{key:"8ed0e4e1712c415ccc38050011af09c778a6bb48",class:{"empty-state":true,[`empty-state--${this.size}`]:true}},a("div",{key:"63a6dd1e1678c48da81af7e89dc90fd2288fdbfa",class:"empty-state__inner"},a("div",{key:"3753c28a9268eff9ebb936f3b8f9d4257e63ca41",class:"empty-state__icon","aria-hidden":"true"},a("slot",{key:"abc7a5a2b84d7d4d5be3cd5dcfa3da217e480a4f",name:"icon"})),a("h3",{key:"c6be0381802f307f35ea81a58fe8571d0799b97a",class:"empty-state__title"},this.title),this.description&&a("p",{key:"e8c953d3ed017ed9fd06c572a7d601217be317e3",class:"empty-state__description"},this.description),a("div",{key:"da062b6ceabc34cced61ed900f09025a83f401f4",class:"empty-state__actions"},a("slot",{key:"18930706af315dfbb2da7a492c79d3a468be3574"}))))}static get style(){return r()}},[769,"ch-empty-state",{title:[1],description:[1],size:[1]}]);function n(){if(typeof customElements==="undefined"){return}const e=["ch-empty-state"];e.forEach((e=>{switch(e){case"ch-empty-state":if(!customElements.get(i(e))){customElements.define(i(e),c)}break}}))}n();const d=c;const o=n;export{d as ChEmptyState,o as defineCustomElement};
1
+ import{p as t,H as e,h as a,d as s,t as i}from"./p-qP_9qshx.js";const r=()=>`:host{display:block;font-family:var(--typography-body);color:var(--color-text-secondary);text-align:center}:host([hidden]){display:none}.empty-state__inner{display:flex;flex-direction:column;align-items:center;gap:var(--spacing-sm);padding:var(--spacing-6xl) var(--spacing-2xl);border:var(--border-width) dashed var(--color-border-default);border-radius:var(--radius-md);background:var(--color-surface-default)}.empty-state--sm .empty-state__inner{padding:var(--spacing-3xl) var(--spacing-xl);gap:var(--spacing-xs)}.empty-state__icon{display:contents;font-size:var(--typography-size-xl);line-height:1}.empty-state__icon:empty{display:none}.empty-state__title{margin:0;font-family:var(--typography-heading);font-size:var(--typography-size-md);font-weight:var(--typography-weight-semibold);color:var(--color-text-primary)}.empty-state--md .empty-state__title{font-size:var(--typography-size-lg)}.empty-state__description{margin:0;max-width:36ch;font-size:var(--typography-size-sm);line-height:1.5}.empty-state__actions:empty{display:none}.empty-state__actions{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);justify-content:center;margin-top:var(--spacing-xs)}`;const c=t(class t extends e{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow()}title;description;size="md";render(){return a(s,{key:"15a171d5e6128b278078f3564fe27a75f2d3638f",class:{"empty-state":true,[`empty-state--${this.size}`]:true}},a("div",{key:"959baade697f5817d46fe2ef1e08b31d1f14168d",class:"empty-state__inner"},a("div",{key:"c97f9d6405da2d81e538701c48e12acbb6bbbd76",class:"empty-state__icon","aria-hidden":"true"},a("slot",{key:"abb50aae0a68ff11b5042a51cdb8d7f69d965ae8",name:"icon"})),a("h3",{key:"2049c3cb4714b642670ba283f8c3c9e3e1ba6ae4",class:"empty-state__title"},this.title),this.description&&a("p",{key:"b74601952c870aab10345c7bdc856dc779396645",class:"empty-state__description"},this.description),a("div",{key:"c72be9f5a4f40113d1c6df1d62c9b617e8dcb407",class:"empty-state__actions"},a("slot",{key:"c998904407c1cf174921873e3d547c2056f3d1b5"}))))}static get style(){return r()}},[769,"ch-empty-state",{title:[1],description:[1],size:[1]}]);function n(){if(typeof customElements==="undefined"){return}const t=["ch-empty-state"];t.forEach((t=>{switch(t){case"ch-empty-state":if(!customElements.get(i(t))){customElements.define(i(t),c)}break}}))}n();const o=c;const p=n;export{o as ChEmptyState,p as defineCustomElement};
2
2
  //# sourceMappingURL=ch-empty-state.js.map
@@ -1,2 +1,2 @@
1
- import{p as a,H as s,h as i,d as t,t as g}from"./p-qP_9qshx.js";const r=()=>`:host{display:grid;grid-template-columns:var(--ch-grid-columns, repeat(auto-fit, minmax(min(16rem, 100%), 1fr)));box-sizing:border-box}:host([hidden]){display:none}.grid--gap-none{gap:0}.grid--gap-2xs{gap:var(--spacing-2xs)}.grid--gap-xs{gap:var(--spacing-xs)}.grid--gap-sm{gap:var(--spacing-sm)}.grid--gap-md{gap:var(--spacing-md)}.grid--gap-lg{gap:var(--spacing-lg)}.grid--gap-xl{gap:var(--spacing-xl)}.grid--gap-2xl{gap:var(--spacing-2xl)}.grid--gap-3xl{gap:var(--spacing-3xl)}.grid--gap-4xl{gap:var(--spacing-4xl)}.grid--gap-5xl{gap:var(--spacing-5xl)}.grid--gap-6xl{gap:var(--spacing-6xl)}`;const e=new Set(["none","2xs","xs","sm","md","lg","xl","2xl","3xl","4xl","5xl","6xl"]);const n=a(class a extends s{constructor(a){super();if(a!==false){this.__registerHost()}this.__attachShadow()}get el(){return this}columns="auto-fit";gap="md";minItemWidth="16rem";get gapStep(){return e.has(this.gap)?this.gap:"md"}get fixedColumns(){const a=Number(this.columns);return Number.isInteger(a)&&a>=1&&a<=12?a:null}componentWillLoad(){this.applyColumns()}componentDidUpdate(){this.applyColumns()}applyColumns(){const a=this.fixedColumns===null?`repeat(auto-fit, minmax(min(${this.minItemWidth}, 100%), 1fr))`:`repeat(${this.fixedColumns}, minmax(0, 1fr))`;this.el.style.setProperty("--ch-grid-columns",a)}render(){return i(t,{key:"de6c2d15da9a5d735327df077c6b58abe9775267",class:{grid:true,[`grid--gap-${this.gapStep}`]:true}},i("slot",{key:"348289bcf2f46fb07e7392afa00c4619d6614fef"}))}static get style(){return r()}},[769,"ch-grid",{columns:[1],gap:[1],minItemWidth:[1,"min-item-width"]}]);function p(){if(typeof customElements==="undefined"){return}const a=["ch-grid"];a.forEach((a=>{switch(a){case"ch-grid":if(!customElements.get(g(a))){customElements.define(g(a),n)}break}}))}p();const d=n;const l=p;export{d as ChGrid,l as defineCustomElement};
1
+ import{p as a,H as s,h as i,d as t,t as g}from"./p-qP_9qshx.js";const r=()=>`:host{display:grid;grid-template-columns:var(--ch-grid-columns, repeat(auto-fit, minmax(min(16rem, 100%), 1fr)));box-sizing:border-box}:host([hidden]){display:none}.grid--gap-none{gap:0}.grid--gap-2xs{gap:var(--spacing-2xs)}.grid--gap-xs{gap:var(--spacing-xs)}.grid--gap-sm{gap:var(--spacing-sm)}.grid--gap-md{gap:var(--spacing-md)}.grid--gap-lg{gap:var(--spacing-lg)}.grid--gap-xl{gap:var(--spacing-xl)}.grid--gap-2xl{gap:var(--spacing-2xl)}.grid--gap-3xl{gap:var(--spacing-3xl)}.grid--gap-4xl{gap:var(--spacing-4xl)}.grid--gap-5xl{gap:var(--spacing-5xl)}.grid--gap-6xl{gap:var(--spacing-6xl)}`;const e=new Set(["none","2xs","xs","sm","md","lg","xl","2xl","3xl","4xl","5xl","6xl"]);const n=a(class a extends s{constructor(a){super();if(a!==false){this.__registerHost()}this.__attachShadow()}get el(){return this}columns="auto-fit";gap="md";minItemWidth="16rem";get gapStep(){return e.has(this.gap)?this.gap:"md"}get fixedColumns(){const a=Number(this.columns);return Number.isInteger(a)&&a>=1&&a<=12?a:null}componentWillLoad(){this.applyColumns()}componentDidUpdate(){this.applyColumns()}applyColumns(){const a=this.fixedColumns===null?`repeat(auto-fit, minmax(min(${this.minItemWidth}, 100%), 1fr))`:`repeat(${this.fixedColumns}, minmax(0, 1fr))`;this.el.style.setProperty("--ch-grid-columns",a)}render(){return i(t,{key:"4fbcd3b5e563ebf0f5b2878ef6af0cb2d1c0f427",class:{grid:true,[`grid--gap-${this.gapStep}`]:true}},i("slot",{key:"4fe1548392ab44de9dd895129d77f20650a0d929"}))}static get style(){return r()}},[769,"ch-grid",{columns:[1],gap:[1],minItemWidth:[1,"min-item-width"]}]);function p(){if(typeof customElements==="undefined"){return}const a=["ch-grid"];a.forEach((a=>{switch(a){case"ch-grid":if(!customElements.get(g(a))){customElements.define(g(a),n)}break}}))}p();const d=n;const l=p;export{d as ChGrid,l as defineCustomElement};
2
2
  //# sourceMappingURL=ch-grid.js.map
@@ -1,2 +1,2 @@
1
- import{p as i,H as t,c as e,h as n,d as o,t as a}from"./p-qP_9qshx.js";import{c as r}from"./p-CnivhwvG.js";const s=()=>`:host{display:inline-block}.button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;border:var(--border-width) solid var(--border);border-radius:var(--radius-pill);background:transparent;color:var(--text);cursor:pointer;transition:background-color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default), color var(--duration-normal) var(--easing-default)}.button--sm{width:calc(var(--icon-size-sm) + 2 * var(--spacing-md));height:calc(var(--icon-size-sm) + 2 * var(--spacing-md))}.button--md{width:calc(var(--icon-size-md) + 2 * var(--spacing-xl));height:calc(var(--icon-size-md) + 2 * var(--spacing-xl))}.button--lg{width:calc(var(--icon-size-lg) + 2 * var(--spacing-2xl));height:calc(var(--icon-size-lg) + 2 * var(--spacing-2xl))}.button--sm .icon{width:var(--icon-size-sm);height:var(--icon-size-sm)}.button--md .icon{width:var(--icon-size-md);height:var(--icon-size-md)}.button--lg .icon{width:var(--icon-size-lg);height:var(--icon-size-lg)}.button:hover:not([aria-disabled='true']){border-color:var(--border-hover);background:var(--surface-hover)}.button:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.button[aria-disabled='true']{opacity:var(--opacity-disabled);cursor:not-allowed}.button[aria-busy='true']{cursor:progress}.button[aria-busy='true'] .icon{animation:ch-icon-button-spin var(--duration-spin) linear infinite}@keyframes ch-icon-button-spin{to{transform:rotate(360deg)}}@media (pointer: coarse){.button--sm{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.button{transition:none}.button[aria-busy='true'] .icon{animation:none}}`;const c=i(class i extends t{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.chClick=e(this,"chClick")}name;label;size="md";type="button";disabled=false;loading=false;chClick;handleClick=i=>{if(this.disabled||this.loading){i.preventDefault();i.stopImmediatePropagation();return}this.chClick.emit(i)};render(){const i=this.name?r[this.name]:undefined;return n(o,{key:"cdef3ba2a7577cb7119aa943138746905de21dbb"},n("button",{key:"2b3afb472d1483b84927a47e997d1f44665f5c62",class:`button button--${this.size}`,type:this.type,"aria-label":this.label,"aria-busy":this.loading?"true":undefined,"aria-disabled":this.disabled?"true":undefined,onClick:this.handleClick},n("svg",{key:"cdbe7d1bcb75b9a3bc9c6613a5baf3a7421b20d9",class:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"},(i??[]).map((i=>n(i.tag,i.attrs))))))}static get style(){return s()}},[513,"ch-icon-button",{name:[1],label:[1],size:[1],type:[1],disabled:[4],loading:[4]}]);function d(){if(typeof customElements==="undefined"){return}const i=["ch-icon-button"];i.forEach((i=>{switch(i){case"ch-icon-button":if(!customElements.get(a(i))){customElements.define(a(i),c)}break}}))}d();const l=c;const u=d;export{l as ChIconButton,u as defineCustomElement};
1
+ import{p as i,H as t,c as e,h as n,d as o,t as a}from"./p-qP_9qshx.js";import{c as r}from"./p-CnivhwvG.js";const s=()=>`:host{display:inline-block}.button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;border:var(--border-width) solid var(--border);border-radius:var(--radius-pill);background:transparent;color:var(--text);cursor:pointer;transition:background-color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default), color var(--duration-normal) var(--easing-default)}.button--sm{width:calc(var(--icon-size-sm) + 2 * var(--spacing-md));height:calc(var(--icon-size-sm) + 2 * var(--spacing-md))}.button--md{width:calc(var(--icon-size-md) + 2 * var(--spacing-xl));height:calc(var(--icon-size-md) + 2 * var(--spacing-xl))}.button--lg{width:calc(var(--icon-size-lg) + 2 * var(--spacing-2xl));height:calc(var(--icon-size-lg) + 2 * var(--spacing-2xl))}.button--sm .icon{width:var(--icon-size-sm);height:var(--icon-size-sm)}.button--md .icon{width:var(--icon-size-md);height:var(--icon-size-md)}.button--lg .icon{width:var(--icon-size-lg);height:var(--icon-size-lg)}.button:hover:not([aria-disabled='true']){border-color:var(--border-hover);background:var(--surface-hover)}.button:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.button[aria-disabled='true']{opacity:var(--opacity-disabled);cursor:not-allowed}.button[aria-busy='true']{cursor:progress}.button[aria-busy='true'] .icon{animation:ch-icon-button-spin var(--duration-spin) linear infinite}@keyframes ch-icon-button-spin{to{transform:rotate(360deg)}}@media (pointer: coarse){.button--sm{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.button{transition:none}.button[aria-busy='true'] .icon{animation:none}}`;const c=i(class i extends t{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.chClick=e(this,"chClick")}name;label;size="md";type="button";disabled=false;loading=false;chClick;handleClick=i=>{if(this.disabled||this.loading){i.preventDefault();i.stopImmediatePropagation();return}this.chClick.emit(i)};render(){const i=this.name?r[this.name]:undefined;return n(o,{key:"585bbba80a0811664fcc2fa8fd625cd8655e3395"},n("button",{key:"d817e9eda842b824a052be9b822c860b9417ddd4",class:`button button--${this.size}`,type:this.type,"aria-label":this.label,"aria-busy":this.loading?"true":undefined,"aria-disabled":this.disabled?"true":undefined,onClick:this.handleClick},n("svg",{key:"2f0278d9f551da6b526c3fe5a6680cd38080502e",class:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"},(i??[]).map((i=>n(i.tag,i.attrs))))))}static get style(){return s()}},[513,"ch-icon-button",{name:[1],label:[1],size:[1],type:[1],disabled:[4],loading:[4]}]);function d(){if(typeof customElements==="undefined"){return}const i=["ch-icon-button"];i.forEach((i=>{switch(i){case"ch-icon-button":if(!customElements.get(a(i))){customElements.define(a(i),c)}break}}))}d();const l=c;const u=d;export{l as ChIconButton,u as defineCustomElement};
2
2
  //# sourceMappingURL=ch-icon-button.js.map
@@ -1,2 +1,2 @@
1
- import{p as e,H as i,h as s,d as n,t}from"./p-qP_9qshx.js";import{c as o}from"./p-CnivhwvG.js";const c=()=>`:host{display:inline-flex;line-height:0}.icon{display:block;flex:none;color:inherit}.icon--sm{width:var(--icon-size-sm);height:var(--icon-size-sm)}.icon--md{width:var(--icon-size-md);height:var(--icon-size-md)}.icon--lg{width:var(--icon-size-lg);height:var(--icon-size-lg)}`;const a=e(class e extends i{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}name;size="md";label;render(){const e=this.name?o[this.name]:undefined;const i=!this.label;return s(n,{key:"f45fcd8a7f620f12942e3c1dd1c68a16009905ad"},s("svg",{key:"c529a79b5ae690200fa0f66aa7eb482e26409ed5",class:`icon icon--${this.size}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",role:i?undefined:"img","aria-label":this.label,"aria-hidden":i?"true":undefined,focusable:"false"},(e??[]).map((e=>s(e.tag,e.attrs)))))}static get style(){return c()}},[513,"ch-icon",{name:[1],size:[1],label:[1]}]);function r(){if(typeof customElements==="undefined"){return}const e=["ch-icon"];e.forEach((e=>{switch(e){case"ch-icon":if(!customElements.get(t(e))){customElements.define(t(e),a)}break}}))}r();const l=a;const d=r;export{l as ChIcon,d as defineCustomElement};
1
+ import{p as e,H as i,h as s,d as n,t}from"./p-qP_9qshx.js";import{c as o}from"./p-CnivhwvG.js";const c=()=>`:host{display:inline-flex;line-height:0}.icon{display:block;flex:none;color:inherit}.icon--sm{width:var(--icon-size-sm);height:var(--icon-size-sm)}.icon--md{width:var(--icon-size-md);height:var(--icon-size-md)}.icon--lg{width:var(--icon-size-lg);height:var(--icon-size-lg)}`;const r=e(class e extends i{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}name;size="md";label;render(){const e=this.name?o[this.name]:undefined;const i=!this.label;return s(n,{key:"c55af60731d59ee48bfb2566f498c5675c36cb04"},s("svg",{key:"65334ba063c059ef2a505c7ea34859d1d1971f01",class:`icon icon--${this.size}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",role:i?undefined:"img","aria-label":this.label,"aria-hidden":i?"true":undefined,focusable:"false"},(e??[]).map((e=>s(e.tag,e.attrs)))))}static get style(){return c()}},[513,"ch-icon",{name:[1],size:[1],label:[1]}]);function a(){if(typeof customElements==="undefined"){return}const e=["ch-icon"];e.forEach((e=>{switch(e){case"ch-icon":if(!customElements.get(t(e))){customElements.define(t(e),r)}break}}))}a();const l=r;const d=a;export{l as ChIcon,d as defineCustomElement};
2
2
  //# sourceMappingURL=ch-icon.js.map
@@ -1,2 +1,2 @@
1
- import{p as t,H as i,c as r,h as s,d as e,t as a}from"./p-qP_9qshx.js";import{r as o}from"./p-BXzZsX2r.js";const n=()=>`:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus,:host(:user-invalid) .input:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;let d=0;const h=t(class t extends i{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.chInput=r(this,"chInput");this.chChange=r(this,"chChange");this.internals=this.attachInternals()}inputId=`ch-input-${++d}`;hintId=`${this.inputId}-hint`;errorId=`${this.inputId}-error`;initialValue="";internals;formDisabled=false;get host(){return this}label;type="text";value="";placeholder;name;disabled=false;required=false;hint;errorMessage;invalid=false;chInput;chChange;handleInput=t=>{this.value=t.target.value;this.chInput.emit(this.value)};handleChange=t=>{this.value=t.target.value;this.chChange.emit(this.value)};syncForm(){const t=this.internals;if(typeof t?.setFormValue!=="function"){return}t.setFormValue(this.value);const{flags:i,message:r}=o({required:this.required,empty:this.value==="",invalid:this.invalid,errorMessage:this.errorMessage});t.setValidity(i,r)}componentDidLoad(){this.initialValue=this.value;this.syncForm();this.host.addEventListener("change",this.markTouched);this.host.addEventListener("focusout",this.markTouched);this.host.addEventListener("invalid",this.markTouched)}markTouched=()=>{this.host.setAttribute("data-touched","")};formResetCallback(){this.value=this.initialValue}formDisabledCallback(t){this.formDisabled=t}get describedBy(){if(this.invalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){return s(e,{key:"2b6755db381eeecb5c7c15730f351b5a28b2f89a"},this.label&&s("label",{key:"a4c4be2f9ca0dddc175597a12d2e48c3a5030131",class:"label",htmlFor:this.inputId},this.label),s("input",{key:"b080e37229425a745588d6080bab48cf62be8aa8",id:this.label?this.inputId:undefined,class:{input:true,"input--invalid":this.invalid},type:this.type,name:this.name,placeholder:this.placeholder,disabled:this.disabled||this.formDisabled,required:this.required,value:this.value,"aria-invalid":this.invalid?"true":undefined,"aria-describedby":this.describedBy,onInput:this.handleInput,onChange:this.handleChange}),this.hint&&!(this.invalid&&this.errorMessage)&&s("p",{key:"857edf91f7b9657b34763fa06bae3d57e07d861c",class:"hint",id:this.hintId},this.hint),this.invalid&&this.errorMessage&&s("p",{key:"4516a30cd0d40e3b9e53430416934497c92b1f88",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}}static get style(){return n()}},[577,"ch-input",{label:[1],type:[1],value:[1025],placeholder:[1],name:[513],disabled:[516],required:[516],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32]},undefined,{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}]);function l(){if(typeof customElements==="undefined"){return}const t=["ch-input"];t.forEach((t=>{switch(t){case"ch-input":if(!customElements.get(a(t))){customElements.define(a(t),h)}break}}))}l();const c=h;const u=l;export{c as ChInput,u as defineCustomElement};
1
+ import{p as t,H as i,c as r,h as s,d as e,t as a}from"./p-qP_9qshx.js";import{r as o}from"./p-BXzZsX2r.js";const n=()=>`:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus,:host(:user-invalid) .input:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;let d=0;const h=t(class t extends i{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.chInput=r(this,"chInput");this.chChange=r(this,"chChange");this.internals=this.attachInternals()}inputId=`ch-input-${++d}`;hintId=`${this.inputId}-hint`;errorId=`${this.inputId}-error`;initialValue="";internals;formDisabled=false;get host(){return this}label;type="text";value="";placeholder;name;disabled=false;required=false;hint;errorMessage;invalid=false;chInput;chChange;handleInput=t=>{this.value=t.target.value;this.chInput.emit(this.value)};handleChange=t=>{this.value=t.target.value;this.chChange.emit(this.value)};syncForm(){const t=this.internals;if(typeof t?.setFormValue!=="function"){return}t.setFormValue(this.value);const{flags:i,message:r}=o({required:this.required,empty:this.value==="",invalid:this.invalid,errorMessage:this.errorMessage});t.setValidity(i,r)}componentDidLoad(){this.initialValue=this.value;this.syncForm();this.host.addEventListener("change",this.markTouched);this.host.addEventListener("focusout",this.markTouched);this.host.addEventListener("invalid",this.markTouched)}markTouched=()=>{this.host.setAttribute("data-touched","")};formResetCallback(){this.value=this.initialValue}formDisabledCallback(t){this.formDisabled=t}get describedBy(){if(this.invalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){return s(e,{key:"80dd56c8fa40d4c8c4eec2b62d1fea2aaa574dcc"},this.label&&s("label",{key:"d1d4c26e7a49f176f5d986af107395fd32abbd11",class:"label",htmlFor:this.inputId},this.label),s("input",{key:"9220c4f98593dce4af626a2d068e654cf360199b",id:this.label?this.inputId:undefined,class:{input:true,"input--invalid":this.invalid},type:this.type,name:this.name,placeholder:this.placeholder,disabled:this.disabled||this.formDisabled,required:this.required,value:this.value,"aria-invalid":this.invalid?"true":undefined,"aria-describedby":this.describedBy,onInput:this.handleInput,onChange:this.handleChange}),this.hint&&!(this.invalid&&this.errorMessage)&&s("p",{key:"802ec36ef19bebd3371ff9535fba4052268f3db6",class:"hint",id:this.hintId},this.hint),this.invalid&&this.errorMessage&&s("p",{key:"489b9634ce6577f71c5875a45cfc5b8a5eeb6cf1",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}}static get style(){return n()}},[577,"ch-input",{label:[1],type:[1],value:[1025],placeholder:[1],name:[513],disabled:[516],required:[516],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32]},undefined,{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}]);function c(){if(typeof customElements==="undefined"){return}const t=["ch-input"];t.forEach((t=>{switch(t){case"ch-input":if(!customElements.get(a(t))){customElements.define(a(t),h)}break}}))}c();const l=h;const u=c;export{l as ChInput,u as defineCustomElement};
2
2
  //# sourceMappingURL=ch-input.js.map
@@ -1,2 +1,2 @@
1
- import{p as e,H as a,c as t,h as i,d as s,t as o}from"./p-qP_9qshx.js";import{l,u as r}from"./p-d8DfpzMR.js";const c=()=>`.modal{box-sizing:border-box;max-height:calc(100vh - var(--spacing-6xl));padding:var(--spacing-5xl);border:var(--border-width) solid var(--border);border-radius:var(--radius);background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-md)}.modal--sm{max-width:min(var(--ch-modal-width, 24rem), calc(100vw - var(--spacing-6xl)))}.modal--md{max-width:min(var(--ch-modal-width, 32rem), calc(100vw - var(--spacing-6xl)))}.modal--lg{max-width:min(var(--ch-modal-width, 48rem), calc(100vw - var(--spacing-6xl)))}.modal::backdrop{background:var(--color-scrim-default);backdrop-filter:blur(var(--effect-blur))}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);margin-bottom:var(--spacing-2xl)}.modal-body{overflow-y:auto}.modal-close{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--spacing-2xs) var(--spacing-md);border:0;border-radius:var(--radius);background:none;color:var(--text-muted);cursor:pointer;font-family:var(--font-heading);font-size:var(--typography-size-lg);line-height:1;transition:background-color var(--duration-normal) var(--easing-default)}.modal-close:hover{background:var(--surface-hover);color:var(--text)}.modal-close:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}@media (pointer: coarse){.modal-close{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.modal-close{transition:none}}`;const n=e(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chOpen=t(this,"chOpen");this.chClose=t(this,"chClose")}get el(){return this}open=false;label;closeLabel;size="md";chOpen;chClose;dialog;scrollLocked=false;pointerDownedOutside=false;componentDidLoad(){this.dialog?.addEventListener("close",this.handleNativeClose);this.dialog?.addEventListener("pointerdown",this.handlePointerDown);this.dialog?.addEventListener("click",this.handleClick);if(this.open){this.showDialog()}}disconnectedCallback(){this.dialog?.removeEventListener("close",this.handleNativeClose);this.dialog?.removeEventListener("pointerdown",this.handlePointerDown);this.dialog?.removeEventListener("click",this.handleClick);this.unlockScroll()}handleOpenChange(e){if(e){this.showDialog()}else{this.closeDialog()}}showDialog(){if(typeof this.dialog?.showModal!=="function"){return}this.lockScroll();this.dialog.showModal();this.chOpen.emit()}closeDialog(){if(typeof this.dialog?.close==="function"&&this.dialog.open){this.dialog.close()}}lockScroll(){if(this.scrollLocked){return}this.scrollLocked=true;l()}unlockScroll(){if(!this.scrollLocked){return}this.scrollLocked=false;r()}isOnBackdrop(e){if(!this.dialog||e.target!==this.dialog){return false}const a=this.dialog.getBoundingClientRect();return e.clientX<a.left||e.clientX>a.right||e.clientY<a.top||e.clientY>a.bottom}handlePointerDown=e=>{this.pointerDownedOutside=this.isOnBackdrop(e)};handleClick=e=>{const a=this.pointerDownedOutside&&this.isOnBackdrop(e);this.pointerDownedOutside=false;if(a){this.closeDialog()}};handleNativeClose=()=>{this.unlockScroll();if(this.open){this.open=false}this.chClose.emit()};handleCloseClick=()=>{if(typeof this.dialog?.close==="function"&&this.dialog.open){this.dialog.close();return}this.open=false;this.chClose.emit()};render(){return i(s,{key:"b0fced593159cc6e6952831f9460cce1efd532d4"},i("dialog",{key:"81180fe5cdd62df43f5aa35a8358b4e86cc8dc40",class:{modal:true,[`modal--${this.size}`]:true},"aria-label":this.label,ref:e=>this.dialog=e},i("div",{key:"4c13adb1131ee26978f607b86e7eb8a9e65ce3a7",class:"modal-head"},i("slot",{key:"4cb35bd7f0c290ef0c7aec5df60a839f8c383e66",name:"heading"}),this.closeLabel&&i("button",{key:"f967cf89873760e1156081a77402d12252cbc20d",class:"modal-close",type:"button","aria-label":this.closeLabel,onClick:this.handleCloseClick},i("span",{key:"719e26b74726be28f50587dca769c257db3ecdec","aria-hidden":"true"},"×"))),i("div",{key:"b6a44ef698e580031aa9efa5b5a177c9c1218488",class:"modal-body"},i("slot",{key:"27c107491182196ee3ea3aa8d6746da0a9be40a6"}))))}static get watchers(){return{open:[{handleOpenChange:0}]}}static get style(){return c()}},[769,"ch-modal",{open:[1028],label:[1],closeLabel:[1,"close-label"],size:[1]},undefined,{open:[{handleOpenChange:0}]}]);function d(){if(typeof customElements==="undefined"){return}const e=["ch-modal"];e.forEach((e=>{switch(e){case"ch-modal":if(!customElements.get(o(e))){customElements.define(o(e),n)}break}}))}d();const h=n;const f=d;export{h as ChModal,f as defineCustomElement};
1
+ import{C as o,d as s}from"./p-MBLhKofG.js";const t=o;const p=s;export{t as ChModal,p as defineCustomElement};
2
2
  //# sourceMappingURL=ch-modal.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["chModalCss","ChModal","__stencil_proxyCustomElement","HTMLElement","open","label","closeLabel","size","chOpen","chClose","dialog","scrollLocked","pointerDownedOutside","componentDidLoad","this","addEventListener","handleNativeClose","handlePointerDown","handleClick","showDialog","disconnectedCallback","removeEventListener","unlockScroll","handleOpenChange","closeDialog","showModal","lockScroll","emit","close","lockPageScroll","unlockPageScroll","isOnBackdrop","event","target","box","getBoundingClientRect","clientX","left","right","clientY","top","bottom","dismiss","handleCloseClick","render","h","Host","key","class","modal","ref","el","name","type","onClick"],"sources":["src/components/ch-modal/ch-modal.css?tag=ch-modal&encapsulation=shadow","src/components/ch-modal/ch-modal.tsx"],"sourcesContent":[".modal {\n box-sizing: border-box;\n max-height: calc(100vh - var(--spacing-6xl));\n padding: var(--spacing-5xl);\n border: var(--border-width) solid var(--border);\n border-radius: var(--radius);\n background: var(--color-background-base);\n color: var(--text);\n font-family: var(--font-body);\n font-size: var(--typography-size-md);\n}\n\n.modal--sm {\n max-width: min(var(--ch-modal-width, 24rem), calc(100vw - var(--spacing-6xl)));\n}\n\n.modal--md {\n max-width: min(var(--ch-modal-width, 32rem), calc(100vw - var(--spacing-6xl)));\n}\n\n.modal--lg {\n max-width: min(var(--ch-modal-width, 48rem), calc(100vw - var(--spacing-6xl)));\n}\n\n.modal::backdrop {\n background: var(--color-scrim-default);\n backdrop-filter: blur(var(--effect-blur));\n}\n\n.modal-head {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--spacing-2xl);\n margin-bottom: var(--spacing-2xl);\n}\n\n.modal-body {\n overflow-y: auto;\n}\n\n.modal-close {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n padding: var(--spacing-2xs) var(--spacing-md);\n border: 0;\n border-radius: var(--radius);\n background: none;\n color: var(--text-muted);\n cursor: pointer;\n font-family: var(--font-heading);\n font-size: var(--typography-size-lg);\n line-height: 1;\n transition: background-color var(--duration-normal) var(--easing-default);\n}\n\n.modal-close:hover {\n background: var(--surface-hover);\n color: var(--text);\n}\n\n.modal-close:focus-visible {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n@media (pointer: coarse) {\n .modal-close {\n min-width: 44px;\n min-height: 44px;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .modal-close {\n transition: none;\n }\n}\n","import { Component, Element, Event, type EventEmitter, Host, Prop, Watch, h } from '@stencil/core';\n\nimport { warnMissingName } from '../../utils/accessibility';\nimport { lockScroll as lockPageScroll, unlockScroll as unlockPageScroll } from '../../utils/scroll-lock';\n\nexport type ChModalSize = 'sm' | 'md' | 'lg';\n\n/**\n * Modal dialog, built on the native `<dialog>` element and opened with\n * `showModal()`.\n *\n * The browser therefore supplies the parts that are easy to get wrong: moving\n * focus into the dialog and returning it afterwards, marking the rest of the\n * document inert, `Escape` to close, the top layer, `::backdrop`, and the\n * implicit `dialog` role with `aria-modal=\"true\"`. Notably it does not trap\n * focus, which is deliberate — the W3C APA group concluded a modal should let\n * keyboard users reach browser UI, so a hand-rolled trap would be less\n * correct, not more.\n *\n * What the platform does not cover, and this component adds: locking the page\n * behind the dialog so it cannot scroll, and closing when the backdrop is\n * clicked. The latter is `closedby=\"any\"` in the platform, which Safari does\n * not support yet, so it is implemented here for every browser alike rather\n * than only for some.\n */\n@Component({\n tag: 'ch-modal',\n styleUrl: 'ch-modal.css',\n shadow: true,\n})\nexport class ChModal {\n @Element() el: HTMLChModalElement;\n\n /**\n * Whether the dialog is open. Kept in sync when the user closes it with\n * `Escape`, the close button or a click outside.\n */\n @Prop({ mutable: true }) open = false;\n\n /**\n * Accessible name for the dialog, set as `aria-label`. A slotted heading\n * cannot be referenced with `aria-labelledby` across the shadow boundary, so\n * the name comes through this prop — and a modal dialog needs one, so pass\n * the same text as the heading. Omitting it logs a warning in development builds.\n */\n @Prop() label?: string;\n\n /**\n * Accessible label for the close button, set as `aria-label`. Setting it is\n * what adds the button: its only content is a decorative glyph, so without a\n * label it would have no accessible name.\n */\n @Prop() closeLabel?: string;\n\n /**\n * The maximum width of the dialog. One of `sm` (24rem), `md` (32rem), or\n * `lg` (48rem). The `--ch-modal-width` custom property overrides it for a\n * width none of the three cover. Either way the dialog never exceeds the\n * viewport.\n */\n @Prop() size: ChModalSize = 'md';\n\n /**\n * Emitted after the dialog opens.\n */\n @Event() chOpen: EventEmitter<void>;\n\n /**\n * Emitted after the dialog closes, however it was closed.\n */\n @Event() chClose: EventEmitter<void>;\n\n private dialog?: HTMLDialogElement;\n private scrollLocked = false;\n private pointerDownedOutside = false;\n\n componentDidLoad() {\n // Wired here rather than in JSX because Stencil derives a listener's event\n // name from whether `on<name>` exists on `window`, which differs between\n // the browser and the test environment for pointer events.\n this.dialog?.addEventListener('close', this.handleNativeClose);\n this.dialog?.addEventListener('pointerdown', this.handlePointerDown);\n this.dialog?.addEventListener('click', this.handleClick);\n if (this.open) {\n this.showDialog();\n }\n }\n\n disconnectedCallback() {\n this.dialog?.removeEventListener('close', this.handleNativeClose);\n this.dialog?.removeEventListener('pointerdown', this.handlePointerDown);\n this.dialog?.removeEventListener('click', this.handleClick);\n this.unlockScroll();\n }\n\n @Watch('open')\n handleOpenChange(open: boolean) {\n if (open) {\n this.showDialog();\n } else {\n this.closeDialog();\n }\n }\n\n private showDialog() {\n if (typeof this.dialog?.showModal !== 'function') {\n return;\n }\n this.lockScroll();\n this.dialog.showModal();\n this.chOpen.emit();\n }\n\n private closeDialog() {\n if (typeof this.dialog?.close === 'function' && this.dialog.open) {\n this.dialog.close();\n }\n }\n\n private lockScroll() {\n if (this.scrollLocked) {\n return;\n }\n this.scrollLocked = true;\n lockPageScroll();\n }\n\n private unlockScroll() {\n if (!this.scrollLocked) {\n return;\n }\n this.scrollLocked = false;\n unlockPageScroll();\n }\n\n /**\n * True for a pointer event on the backdrop: the `<dialog>` is the event\n * target for its own box only, and the coordinates fall outside that box.\n */\n private isOnBackdrop(event: MouseEvent) {\n if (!this.dialog || event.target !== this.dialog) {\n return false;\n }\n const box = this.dialog.getBoundingClientRect();\n return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n }\n\n private handlePointerDown = (event: Event) => {\n this.pointerDownedOutside = this.isOnBackdrop(event as MouseEvent);\n };\n\n private handleClick = (event: Event) => {\n // Requiring the press to have started on the backdrop too keeps a\n // selection dragged out of the dialog, and a keyboard-synthesised click\n // (which reports coordinates of 0), from closing it.\n const dismiss = this.pointerDownedOutside && this.isOnBackdrop(event as MouseEvent);\n this.pointerDownedOutside = false;\n if (dismiss) {\n this.closeDialog();\n }\n };\n\n private handleNativeClose = () => {\n this.unlockScroll();\n if (this.open) {\n this.open = false;\n }\n this.chClose.emit();\n };\n\n private handleCloseClick = () => {\n if (typeof this.dialog?.close === 'function' && this.dialog.open) {\n this.dialog.close();\n return;\n }\n this.open = false;\n this.chClose.emit();\n };\n\n render() {\n if (!this.label) {\n warnMissingName(this.el, 'ch-modal', 'pass label with the same text as the heading');\n }\n return (\n <Host>\n <dialog class={{ modal: true, [`modal--${this.size}`]: true }} aria-label={this.label} ref={el => (this.dialog = el as HTMLDialogElement)}>\n <div class=\"modal-head\">\n <slot name=\"heading\"></slot>\n {this.closeLabel && (\n <button class=\"modal-close\" type=\"button\" aria-label={this.closeLabel} onClick={this.handleCloseClick}>\n <span aria-hidden=\"true\">×</span>\n </button>\n )}\n </div>\n <div class=\"modal-body\">\n <slot></slot>\n </div>\n </dialog>\n </Host>\n );\n }\n}\n"],"mappings":"6GAAA,MAAMA,EAAa,IAAM,igD,MC8BZC,EAAOC,EAAA,MAAAD,UAAAE,E,kKAOOC,KAAO,MAQxBC,MAOAC,WAQAC,KAAoB,KAKnBC,OAKAC,QAEDC,OACAC,aAAe,MACfC,qBAAuB,MAE/B,gBAAAC,GAIEC,KAAKJ,QAAQK,iBAAiB,QAASD,KAAKE,mBAC5CF,KAAKJ,QAAQK,iBAAiB,cAAeD,KAAKG,mBAClDH,KAAKJ,QAAQK,iBAAiB,QAASD,KAAKI,aAC5C,GAAIJ,KAAKV,KAAM,CACbU,KAAKK,Y,EAIT,oBAAAC,GACEN,KAAKJ,QAAQW,oBAAoB,QAASP,KAAKE,mBAC/CF,KAAKJ,QAAQW,oBAAoB,cAAeP,KAAKG,mBACrDH,KAAKJ,QAAQW,oBAAoB,QAASP,KAAKI,aAC/CJ,KAAKQ,c,CAIP,gBAAAC,CAAiBnB,GACf,GAAIA,EAAM,CACRU,KAAKK,Y,KACA,CACLL,KAAKU,a,EAID,UAAAL,GACN,UAAWL,KAAKJ,QAAQe,YAAc,WAAY,CAChD,M,CAEFX,KAAKY,aACLZ,KAAKJ,OAAOe,YACZX,KAAKN,OAAOmB,M,CAGN,WAAAH,GACN,UAAWV,KAAKJ,QAAQkB,QAAU,YAAcd,KAAKJ,OAAON,KAAM,CAChEU,KAAKJ,OAAOkB,O,EAIR,UAAAF,GACN,GAAIZ,KAAKH,aAAc,CACrB,M,CAEFG,KAAKH,aAAe,KACpBkB,G,CAGM,YAAAP,GACN,IAAKR,KAAKH,aAAc,CACtB,M,CAEFG,KAAKH,aAAe,MACpBmB,G,CAOM,YAAAC,CAAaC,GACnB,IAAKlB,KAAKJ,QAAUsB,EAAMC,SAAWnB,KAAKJ,OAAQ,CAChD,OAAO,K,CAET,MAAMwB,EAAMpB,KAAKJ,OAAOyB,wBACxB,OAAOH,EAAMI,QAAUF,EAAIG,MAAQL,EAAMI,QAAUF,EAAII,OAASN,EAAMO,QAAUL,EAAIM,KAAOR,EAAMO,QAAUL,EAAIO,M,CAGzGxB,kBAAqBe,IAC3BlB,KAAKF,qBAAuBE,KAAKiB,aAAaC,EAAoB,EAG5Dd,YAAec,IAIrB,MAAMU,EAAU5B,KAAKF,sBAAwBE,KAAKiB,aAAaC,GAC/DlB,KAAKF,qBAAuB,MAC5B,GAAI8B,EAAS,CACX5B,KAAKU,a,GAIDR,kBAAoB,KAC1BF,KAAKQ,eACL,GAAIR,KAAKV,KAAM,CACbU,KAAKV,KAAO,K,CAEdU,KAAKL,QAAQkB,MAAM,EAGbgB,iBAAmB,KACzB,UAAW7B,KAAKJ,QAAQkB,QAAU,YAAcd,KAAKJ,OAAON,KAAM,CAChEU,KAAKJ,OAAOkB,QACZ,M,CAEFd,KAAKV,KAAO,MACZU,KAAKL,QAAQkB,MAAM,EAGrB,MAAAiB,GAIE,OACEC,EAACC,EAAI,CAAAC,IAAA,4CACHF,EAAA,UAAAE,IAAA,2CAAQC,MAAO,CAAEC,MAAO,KAAM,CAAC,UAAUnC,KAAKP,QAAS,MAAM,aAAcO,KAAKT,MAAO6C,IAAKC,GAAOrC,KAAKJ,OAASyC,GAC/GN,EAAA,OAAAE,IAAA,2CAAKC,MAAM,cACTH,EAAA,QAAAE,IAAA,2CAAMK,KAAK,YACVtC,KAAKR,YACJuC,EAAA,UAAAE,IAAA,2CAAQC,MAAM,cAAcK,KAAK,SAAQ,aAAavC,KAAKR,WAAYgD,QAASxC,KAAK6B,kBACnFE,EAAA,QAAAE,IAAA,yDAAkB,QAAM,OAI9BF,EAAA,OAAAE,IAAA,2CAAKC,MAAM,cACTH,EAAA,QAAAE,IAAA,+C","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":[],"mappings":"","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{p as t,H as i,c as r,h as s,d as e,t as n}from"./p-qP_9qshx.js";import{r as a}from"./p-BXzZsX2r.js";const o=()=>`:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus,:host(:user-invalid) .input:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;let h=0;const d=t(class t extends i{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.chInput=r(this,"chInput");this.chChange=r(this,"chChange");this.internals=this.attachInternals()}inputId=`ch-number-input-${++h}`;hintId=`${this.inputId}-hint`;errorId=`${this.inputId}-error`;initialValue="";internals;formDisabled=false;get host(){return this}label;value="";format="plain";placeholder;name;disabled=false;required=false;min;max;step="any";hint;errorMessage;invalid=false;chInput;chChange;draft="";typing=false;componentWillLoad(){this.draft=this.formatDisplay(this.value)}get decimals(){return this.format!=="clp"}formatDisplay(t){if(t===""){return""}if(this.format==="clp"){const i=t.replace(/\D/gu,"");return i===""?"":Number(i).toLocaleString("es-CL")}return t}toCanonical(t){if(this.format==="clp"){return t.replace(/\D/gu,"")}const i=t.replace(/\s/gu,"").replace(",",".");const r=/^-?\d*(?:\.\d*)?/u.exec(i);return r?r[0]:""}get isEmpty(){return!/^-?\d/u.test(this.toCanonical(this.draft))}get canonical(){return this.isEmpty?"":this.toCanonical(this.draft)}get numericValue(){return Number(this.canonical)}outOfRange(t){const{min:i,max:r}=this;if(i!==undefined&&t<i){return`Enter a value of at least ${i}.`}if(r!==undefined&&t>r){return`Enter a value of at most ${r}.`}return undefined}rangeError(){if(this.errorMessage||this.isEmpty||this.invalid){return undefined}const t=this.numericValue;return Number.isNaN(t)?"Enter a valid number.":this.outOfRange(t)}syncForm(){const{internals:t,required:i,invalid:r,errorMessage:s,canonical:e}=this;if(typeof t?.setFormValue!=="function"){return}t.setFormValue(e);const n=a({required:i,empty:e==="",invalid:r,errorMessage:s});const o=this.rangeError();if(o){t.setValidity({...n.flags,badInput:true},o);return}t.setValidity(n.flags,n.message)}componentDidLoad(){this.initialValue=this.value;this.syncForm();this.host.addEventListener("change",this.markTouched);this.host.addEventListener("focusout",this.markTouched);this.host.addEventListener("invalid",this.markTouched)}markTouched=()=>{this.host.setAttribute("data-touched","")};formResetCallback(){this.value=this.initialValue;this.draft=this.formatDisplay(this.initialValue);this.typing=false;this.syncForm();const t=this.host.shadowRoot?.querySelector("input");if(t){t.value=this.formatDisplay(this.initialValue)}}formDisabledCallback(t){this.formDisabled=t}commit(t){this.typing=true;this.draft=t;this.value=this.canonical;this.chInput.emit(this.value);this.syncForm()}handleInput=t=>{this.commit(t.target.value)};handleChange=t=>{this.commit(t.target.value);this.chChange.emit(this.value)};handleBlur=()=>{if(this.format==="clp"){this.draft=this.formatDisplay(this.canonical)}};get isInvalid(){return this.invalid||this.rangeError()!==undefined}get describedBy(){if(this.isInvalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){const t=this.isInvalid&&this.errorMessage;return s(e,{key:"1c424d9d76ec39e6cc6018d6ba483f95bd203d32"},this.label&&s("label",{key:"4fc03334128c33cc425da773df063cd99fee215c",class:"label",htmlFor:this.inputId},this.label),s("input",{key:"ece15737f83c181d615e906aba5cce80c0bcb8ba",id:this.label?this.inputId:undefined,class:{input:true,"input--invalid":this.isInvalid},type:"text",inputMode:this.decimals?"decimal":"numeric",name:this.name,placeholder:this.placeholder,disabled:this.disabled||this.formDisabled,required:this.required,value:this.typing?this.draft:this.formatDisplay(this.value),"aria-invalid":this.isInvalid?"true":undefined,"aria-describedby":this.describedBy,onInput:this.handleInput,onChange:this.handleChange,onBlur:this.handleBlur}),this.hint&&!t&&s("p",{key:"7a2e3031b8bfebf26857dd60eb18340f21a01f3d",class:"hint",id:this.hintId},this.hint),t&&s("p",{key:"f90492532d27088f18b258f885d5d471f31d27cb",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}],min:[{syncForm:0}],max:[{syncForm:0}]}}static get style(){return o()}},[577,"ch-number-input",{label:[1],value:[1025],format:[1],placeholder:[1],name:[513],disabled:[516],required:[516],min:[2],max:[2],step:[8],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32],draft:[32],typing:[32]},undefined,{required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}],min:[{syncForm:0}],max:[{syncForm:0}]}]);function c(){if(typeof customElements==="undefined"){return}const t=["ch-number-input"];t.forEach((t=>{switch(t){case"ch-number-input":if(!customElements.get(n(t))){customElements.define(n(t),d)}break}}))}c();const u=d;const l=c;export{u as ChNumberInput,l as defineCustomElement};
1
+ import{p as t,H as i,c as r,h as e,d as s,t as a}from"./p-qP_9qshx.js";import{r as n}from"./p-BXzZsX2r.js";const o=()=>`:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus,:host(:user-invalid) .input:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;let h=0;const d=t(class t extends i{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.chInput=r(this,"chInput");this.chChange=r(this,"chChange");this.internals=this.attachInternals()}inputId=`ch-number-input-${++h}`;hintId=`${this.inputId}-hint`;errorId=`${this.inputId}-error`;initialValue="";internals;formDisabled=false;get host(){return this}label;value="";format="plain";placeholder;name;disabled=false;required=false;min;max;step="any";hint;errorMessage;invalid=false;chInput;chChange;draft="";typing=false;componentWillLoad(){this.draft=this.formatDisplay(this.value)}get decimals(){return this.format!=="clp"}formatDisplay(t){if(t===""){return""}if(this.format==="clp"){const i=t.replace(/\D/gu,"");return i===""?"":Number(i).toLocaleString("es-CL")}return t}toCanonical(t){if(this.format==="clp"){return t.replace(/\D/gu,"")}const i=t.replace(/\s/gu,"").replace(",",".");const r=/^-?\d*(?:\.\d*)?/u.exec(i);return r?r[0]:""}get isEmpty(){return!/^-?\d/u.test(this.toCanonical(this.draft))}get canonical(){return this.isEmpty?"":this.toCanonical(this.draft)}get numericValue(){return Number(this.canonical)}outOfRange(t){const{min:i,max:r}=this;if(i!==undefined&&t<i){return`Enter a value of at least ${i}.`}if(r!==undefined&&t>r){return`Enter a value of at most ${r}.`}return undefined}rangeError(){if(this.errorMessage||this.isEmpty||this.invalid){return undefined}const t=this.numericValue;return Number.isNaN(t)?"Enter a valid number.":this.outOfRange(t)}syncForm(){const{internals:t,required:i,invalid:r,errorMessage:e,canonical:s}=this;if(typeof t?.setFormValue!=="function"){return}t.setFormValue(s);const a=n({required:i,empty:s==="",invalid:r,errorMessage:e});const o=this.rangeError();if(o){t.setValidity({...a.flags,badInput:true},o);return}t.setValidity(a.flags,a.message)}componentDidLoad(){this.initialValue=this.value;this.syncForm();this.host.addEventListener("change",this.markTouched);this.host.addEventListener("focusout",this.markTouched);this.host.addEventListener("invalid",this.markTouched)}markTouched=()=>{this.host.setAttribute("data-touched","")};formResetCallback(){this.value=this.initialValue;this.draft=this.formatDisplay(this.initialValue);this.typing=false;this.syncForm();const t=this.host.shadowRoot?.querySelector("input");if(t){t.value=this.formatDisplay(this.initialValue)}}formDisabledCallback(t){this.formDisabled=t}commit(t){this.typing=true;this.draft=t;this.value=this.canonical;this.chInput.emit(this.value);this.syncForm()}handleInput=t=>{this.commit(t.target.value)};handleChange=t=>{this.commit(t.target.value);this.chChange.emit(this.value)};handleBlur=()=>{if(this.format==="clp"){this.draft=this.formatDisplay(this.canonical)}};get isInvalid(){return this.invalid||this.rangeError()!==undefined}get describedBy(){if(this.isInvalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){const t=this.isInvalid&&this.errorMessage;return e(s,{key:"0265106cccf730338541d292be247b7853ab00cf"},this.label&&e("label",{key:"17293d5cc55a8d4de0cd544ea1f508d1ed820b12",class:"label",htmlFor:this.inputId},this.label),e("input",{key:"ce17dc7c0f5c1064d8535aef942e486a46b72188",id:this.label?this.inputId:undefined,class:{input:true,"input--invalid":this.isInvalid},type:"text",inputMode:this.decimals?"decimal":"numeric",name:this.name,placeholder:this.placeholder,disabled:this.disabled||this.formDisabled,required:this.required,value:this.typing?this.draft:this.formatDisplay(this.value),"aria-invalid":this.isInvalid?"true":undefined,"aria-describedby":this.describedBy,onInput:this.handleInput,onChange:this.handleChange,onBlur:this.handleBlur}),this.hint&&!t&&e("p",{key:"37611a7755f6885e6f87a600b1a27cc5edd5fefd",class:"hint",id:this.hintId},this.hint),t&&e("p",{key:"68b8c5b964a2a98df493103b1fde088aeefda769",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}],min:[{syncForm:0}],max:[{syncForm:0}]}}static get style(){return o()}},[577,"ch-number-input",{label:[1],value:[1025],format:[1],placeholder:[1],name:[513],disabled:[516],required:[516],min:[2],max:[2],step:[8],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32],draft:[32],typing:[32]},undefined,{required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}],min:[{syncForm:0}],max:[{syncForm:0}]}]);function u(){if(typeof customElements==="undefined"){return}const t=["ch-number-input"];t.forEach((t=>{switch(t){case"ch-number-input":if(!customElements.get(a(t))){customElements.define(a(t),d)}break}}))}u();const c=d;const l=u;export{c as ChNumberInput,l as defineCustomElement};
2
2
  //# sourceMappingURL=ch-number-input.js.map
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface ChOtpInput extends Components.ChOtpInput, HTMLElement {}
4
+ export const ChOtpInput: {
5
+ prototype: ChOtpInput;
6
+ new (): ChOtpInput;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,2 @@
1
+ import{p as t,H as i,c as e,h as s,d as r,t as a}from"./p-qP_9qshx.js";import{r as o}from"./p-BXzZsX2r.js";const n=()=>`:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus,:host(:user-invalid) .input:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}.input{font-family:var(--typography-heading);font-size:var(--typography-size-lg);letter-spacing:0.4em;text-align:center;font-variant-numeric:tabular-nums}`;let h=0;const c=t(class t extends i{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.chInput=e(this,"chInput");this.chComplete=e(this,"chComplete");this.internals=this.attachInternals()}inputId=`ch-otp-input-${++h}`;hintId=`${this.inputId}-hint`;errorId=`${this.inputId}-error`;initialValue="";internals;formDisabled=false;get host(){return this}label;value="";length=6;inputMode="numeric";secret=false;placeholder;name;disabled=false;required=false;hint;errorMessage;invalid=false;chInput;chComplete;wasComplete=false;componentDidLoad(){this.initialValue=this.value;this.wasComplete=this.isComplete;this.syncForm();this.host.addEventListener("focusout",this.markTouched);this.host.addEventListener("invalid",this.markTouched)}markTouched=()=>{this.host.setAttribute("data-touched","");this.syncForm()};get isComplete(){if(this.value.length!==this.length){return false}return this.inputMode==="numeric"?/^\d+$/u.test(this.value):/^[a-z0-9]+$/iu.test(this.value)}get incompleteMessage(){if(this.errorMessage||this.invalid||this.value===""){return undefined}return this.isComplete?undefined:`Enter the ${this.length}-character code.`}syncForm(){const t=this.internals;if(typeof t?.setFormValue!=="function"){return}t.setFormValue(this.value);const i=this.value==="";const e=o({required:this.required,empty:i,invalid:this.invalid,errorMessage:this.errorMessage});const s=this.host.hasAttribute("data-touched");const r=this.incompleteMessage;if(r&&s&&!i){t.setValidity({...e.flags,customError:true},r);return}t.setValidity(e.flags,e.message)}formResetCallback(){this.value=this.initialValue;this.wasComplete=this.isComplete;this.syncForm();const t=this.host.shadowRoot?.querySelector("input");if(t){t.value=this.value}}formDisabledCallback(t){this.formDisabled=t}sanitize(t){const i=this.inputMode==="numeric"?t.replace(/\D/gu,""):t.replace(/[^a-z0-9]/giu,"");return i.slice(0,Math.max(1,this.length))}handleInput=t=>{const i=t.target;const e=this.sanitize(i.value);if(i.value!==e){i.value=e}this.value=e;this.chInput.emit(e);const s=this.isComplete;if(s&&!this.wasComplete){this.chComplete.emit(e)}this.wasComplete=s;this.syncForm()};handleBlur=()=>{this.syncForm()};get isInvalid(){return this.invalid||this.host.hasAttribute("data-touched")&&this.incompleteMessage!==undefined}get describedBy(){if(this.isInvalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){const t=this.isInvalid&&this.errorMessage;return s(r,{key:"1ce9d8e77463ecb270b870461ef96f8e84f418df"},this.label&&s("label",{key:"d19c88141314b68912c91af235d45eceaa12555b",class:"label",htmlFor:this.inputId},this.label),s("input",{key:"e2e93f1672fa753b3b20bc032abc6e375591cf3f",id:this.label?this.inputId:undefined,class:{input:true,"input--invalid":this.isInvalid},type:this.secret?"password":"text",inputMode:this.inputMode,autocomplete:"one-time-code",autocapitalize:this.inputMode==="text"?"characters":"off",spellcheck:false,name:this.name,placeholder:this.placeholder,maxLength:this.length,disabled:this.disabled||this.formDisabled,required:this.required,value:this.value,"aria-invalid":this.isInvalid?"true":undefined,"aria-describedby":this.describedBy,onInput:this.handleInput,onBlur:this.handleBlur}),this.hint&&!t&&s("p",{key:"f02aa008051c1c0d64bba7045fb72d8c89ebaddd",class:"hint",id:this.hintId},this.hint),t&&s("p",{key:"ff9dc44ff5de84fd100fe617677ad18ab898fe1e",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}],length:[{syncForm:0}],inputMode:[{syncForm:0}]}}static get style(){return n()}},[577,"ch-otp-input",{label:[1],value:[1025],length:[2],inputMode:[1,"input-mode"],secret:[4],placeholder:[1],name:[513],disabled:[516],required:[516],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32]},undefined,{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}],length:[{syncForm:0}],inputMode:[{syncForm:0}]}]);function d(){if(typeof customElements==="undefined"){return}const t=["ch-otp-input"];t.forEach((t=>{switch(t){case"ch-otp-input":if(!customElements.get(a(t))){customElements.define(a(t),c)}break}}))}d();const l=c;const u=d;export{l as ChOtpInput,u as defineCustomElement};
2
+ //# sourceMappingURL=ch-otp-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["chOtpInputCss","otpIds","ChOtpInput","__stencil_proxyCustomElement","HTMLElement","inputId","hintId","this","errorId","initialValue","internals","formDisabled","label","value","length","inputMode","secret","placeholder","name","disabled","required","hint","errorMessage","invalid","chInput","chComplete","wasComplete","componentDidLoad","isComplete","syncForm","host","addEventListener","markTouched","setAttribute","test","incompleteMessage","undefined","setFormValue","empty","base","resolveValidity","touched","hasAttribute","incomplete","setValidity","flags","customError","message","formResetCallback","input","shadowRoot","querySelector","formDisabledCallback","isDisabled","sanitize","raw","allowed","replace","slice","Math","max","handleInput","ev","target","clean","emit","complete","handleBlur","isInvalid","describedBy","render","showError","h","Host","key","class","htmlFor","id","type","autocomplete","autocapitalize","spellcheck","maxLength","onInput","onBlur","role"],"sources":["src/components/ch-otp-input/ch-otp-input.css?tag=ch-otp-input&encapsulation=shadow","src/components/ch-otp-input/ch-otp-input.tsx"],"sourcesContent":[":host {\n display: inline-block;\n width: 100%;\n}\n\n.label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--text);\n}\n\n.input {\n box-sizing: border-box;\n width: 100%;\n padding: var(--spacing-xl) var(--spacing-3xl);\n border-radius: var(--radius);\n border: var(--border-width) solid var(--border);\n background: var(--surface);\n color: var(--text);\n backdrop-filter: blur(var(--effect-blur));\n font-family: inherit;\n font-size: inherit;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.input::placeholder {\n color: var(--text-muted);\n}\n\n.input:focus {\n border-color: var(--accent);\n box-shadow: var(--shadow-focus-ring);\n outline: none;\n}\n\n.input--invalid {\n border-color: var(--color-status-warning);\n}\n\n.input--invalid:focus {\n border-color: var(--color-status-warning);\n box-shadow: 0 0 0 3px var(--color-status-warning-background);\n}\n\n:host([data-touched]:invalid) .input,\n:host(:user-invalid) .input {\n border-color: var(--color-status-warning);\n}\n\n:host([data-touched]:invalid) .input:focus,\n:host(:user-invalid) .input:focus {\n border-color: var(--color-status-warning);\n box-shadow: 0 0 0 3px var(--color-status-warning-background);\n}\n\n.input:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.hint,\n.error {\n margin: var(--spacing-sm) 0 0;\n font-size: var(--typography-size-sm);\n color: var(--text-muted);\n}\n\n.error {\n color: var(--color-status-warning);\n}\n\n/*\n * One field, segmented by letter-spacing rather than by separate boxes: the\n * value stays a single string the platform can autofill and people can paste.\n */\n.input {\n font-family: var(--typography-heading);\n font-size: var(--typography-size-lg);\n letter-spacing: 0.4em;\n text-align: center;\n font-variant-numeric: tabular-nums;\n}\n","import { AttachInternals, Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nimport { resolveValidity } from '../../utils/validation-message';\n\nlet otpIds = 0;\n\n/**\n * One-time-code input.\n *\n * One native `<input>` holds the whole code, not a box per digit. Per-digit\n * inputs break paste, break SMS autofill (the platform fills a single field\n * carrying `autocomplete=\"one-time-code\"`), and give a keyboard user several\n * tab stops for what is one value. The segmented look is drawn by the shadow\n * CSS over the single field.\n *\n * It never submits on completion: a code entered is not a decision to send it,\n * so the consumer listens to `chComplete` and submits when it decides to.\n */\n@Component({\n tag: 'ch-otp-input',\n styleUrl: 'ch-otp-input.css',\n shadow: true,\n formAssociated: true,\n})\nexport class ChOtpInput {\n private readonly inputId = `ch-otp-input-${++otpIds}`;\n private readonly hintId = `${this.inputId}-hint`;\n private readonly errorId = `${this.inputId}-error`;\n private initialValue = '';\n\n @AttachInternals() internals!: ElementInternals;\n @State() formDisabled = false;\n @Element() private host!: HTMLElement;\n\n /** Visible label, associated with the input via `for`/`id`. */\n @Prop() label?: string;\n\n /** The code without separators. Filtered to alphanumerics on every change. */\n @Prop({ mutable: true }) value = '';\n\n /** How many characters make a complete code. */\n @Prop() length = 6;\n\n /**\n * `numeric` restricts input to digits, which is the shape of nearly every\n * one-time code and lets a phone open the number pad.\n */\n @Prop() inputMode: 'numeric' | 'text' = 'numeric';\n\n /** Whether the codes are masked, as for a short-lived secret. */\n @Prop() secret = false;\n\n /** Placeholder shown when empty. */\n @Prop() placeholder?: string;\n\n /** Name submitted with the form. */\n @Prop({ reflect: true }) name?: string;\n\n /** Whether the field is disabled. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Whether a complete code is required for the field to be valid. */\n @Prop({ reflect: true }) required = false;\n\n /** Helper text, replaced by `errorMessage` when invalid. */\n @Prop() hint?: string;\n\n /** Custom error message; wins over the built-in incomplete-code message. */\n @Prop() errorMessage?: string;\n\n /** Whether the field is marked invalid by the consumer. */\n @Prop() invalid = false;\n\n /** Emitted on every change with the current (possibly partial) code. */\n @Event() chInput: EventEmitter<string>;\n\n /**\n * Emitted once, when the code becomes complete and valid after not being so.\n * Never fires again while it stays complete, so holding a code cannot\n * resubmit it.\n */\n @Event() chComplete: EventEmitter<string>;\n\n private wasComplete = false;\n\n componentDidLoad() {\n this.initialValue = this.value;\n this.wasComplete = this.isComplete;\n this.syncForm();\n this.host.addEventListener('focusout', this.markTouched);\n this.host.addEventListener('invalid', this.markTouched);\n }\n\n /**\n * Leaving the field is what turns an unfinished code into an error. The\n * validity has to be recomputed here: `syncForm` reads the attribute, and\n * setting it alone would not update `ElementInternals`.\n */\n private markTouched = (): void => {\n this.host.setAttribute('data-touched', '');\n this.syncForm();\n };\n\n /** Whether the value is a complete, correctly shaped code. */\n private get isComplete(): boolean {\n if (this.value.length !== this.length) {\n return false;\n }\n return this.inputMode === 'numeric' ? /^\\d+$/u.test(this.value) : /^[a-z0-9]+$/iu.test(this.value);\n }\n\n /** The message for an incomplete code, which is what makes it invalid. */\n private get incompleteMessage(): string | undefined {\n if (this.errorMessage || this.invalid || this.value === '') {\n return undefined;\n }\n return this.isComplete ? undefined : `Enter the ${this.length}-character code.`;\n }\n\n @Watch('value')\n @Watch('required')\n @Watch('invalid')\n @Watch('errorMessage')\n @Watch('length')\n @Watch('inputMode')\n protected syncForm(): void {\n const internals = this.internals;\n if (typeof internals?.setFormValue !== 'function') {\n return;\n }\n internals.setFormValue(this.value);\n\n const empty = this.value === '';\n const base = resolveValidity({ required: this.required, empty, invalid: this.invalid, errorMessage: this.errorMessage });\n\n // A partially typed code is what the user is doing, not an error, unless\n // they have already left the field once.\n const touched = this.host.hasAttribute('data-touched');\n const incomplete = this.incompleteMessage;\n if (incomplete && touched && !empty) {\n internals.setValidity({ ...base.flags, customError: true }, incomplete);\n return;\n }\n internals.setValidity(base.flags, base.message);\n }\n\n formResetCallback(): void {\n this.value = this.initialValue;\n this.wasComplete = this.isComplete;\n this.syncForm();\n const input = this.host.shadowRoot?.querySelector('input');\n if (input) {\n input.value = this.value;\n }\n }\n\n formDisabledCallback(isDisabled: boolean): void {\n this.formDisabled = isDisabled;\n }\n\n /** Strips everything the input mode does not allow, then caps the length. */\n private sanitize(raw: string): string {\n const allowed = this.inputMode === 'numeric' ? raw.replace(/\\D/gu, '') : raw.replace(/[^a-z0-9]/giu, '');\n return allowed.slice(0, Math.max(1, this.length));\n }\n\n private handleInput = (ev: InputEvent) => {\n const input = ev.target as HTMLInputElement;\n const clean = this.sanitize(input.value);\n // The element holds the raw text, so a rejected character has to be\n // written back or it stays visible while the value says otherwise.\n if (input.value !== clean) {\n input.value = clean;\n }\n this.value = clean;\n this.chInput.emit(clean);\n\n const complete = this.isComplete;\n if (complete && !this.wasComplete) {\n this.chComplete.emit(clean);\n }\n this.wasComplete = complete;\n this.syncForm();\n };\n\n private handleBlur = () => {\n this.syncForm();\n };\n\n private get isInvalid(): boolean {\n return this.invalid || (this.host.hasAttribute('data-touched') && this.incompleteMessage !== undefined);\n }\n\n private get describedBy(): string | undefined {\n if (this.isInvalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n const showError = this.isInvalid && this.errorMessage;\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n </label>\n )}\n <input\n id={this.label ? this.inputId : undefined}\n class={{ 'input': true, 'input--invalid': this.isInvalid }}\n type={this.secret ? 'password' : 'text'}\n inputMode={this.inputMode}\n // The platform fills a single field carrying this attribute; per-digit\n // inputs never receive the SMS code.\n autocomplete=\"one-time-code\"\n autocapitalize={this.inputMode === 'text' ? 'characters' : 'off'}\n spellcheck={false}\n name={this.name}\n placeholder={this.placeholder}\n maxLength={this.length}\n disabled={this.disabled || this.formDisabled}\n required={this.required}\n value={this.value}\n aria-invalid={this.isInvalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onInput={this.handleInput}\n onBlur={this.handleBlur}\n />\n {this.hint && !showError && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {showError && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{p as e,H as a,h as t,d as r,t as s}from"./p-qP_9qshx.js";const d=()=>`:host{display:block}.header{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);padding-bottom:var(--spacing-2xl);border-bottom:var(--border-width) solid var(--border)}.header-text{display:flex;flex-direction:column;gap:var(--spacing-xs);flex:1 1 20rem;min-width:0}.header-eyebrow{margin:0;color:var(--text-secondary);font-family:var(--font-heading);font-size:var(--typography-size-xs);letter-spacing:var(--typography-tracking-badge);text-transform:uppercase}.header-title{margin:0;color:var(--text);font-family:var(--font-heading);font-size:var(--typography-size-xl);font-weight:var(--typography-weight-bold);line-height:1.2;overflow-wrap:anywhere}.header-description{margin:0;color:var(--text-secondary);font-size:var(--typography-size-sm);line-height:1.5;overflow-wrap:anywhere}.header-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--spacing-md);max-width:100%}.header-actions:empty{display:none}.header--stacked .header-actions{flex-basis:100%}@media (max-width: 30rem){.header{flex-direction:column}.header-actions{width:100%}}@media (forced-colors: active){.header{border-bottom-color:CanvasText}}`;const i=e(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}title;headingLevel="h1";eyebrow;description;actionsStacked=false;render(){const e=this.headingLevel;return t(r,{key:"3d8de76e3df7fba8be55d0708861c7d136b05722"},t("div",{key:"057d2b4359b9faff34b9fbf6886b04d5d89dc9ac",class:{header:true,"header--stacked":this.actionsStacked}},t("div",{key:"1ff40b1cd100d41a72d80ab35e619f93b4a43633",class:"header-text"},this.eyebrow&&t("p",{key:"6c2538bf1d450a6dca25fd2815968a9622f7fcbf",class:"header-eyebrow"},this.eyebrow),t(e,{key:"54cdf8e62468e11cf9fe084023e4fe624f958452",class:"header-title"},this.title),this.description&&t("p",{key:"fe9c6cc78354b38b8833871ddc53d412007abe29",class:"header-description"},this.description)),t("div",{key:"e91a66715e2c23478c375ce9ddcf29c04f85b3eb",class:"header-actions"},t("slot",{key:"06654c2a28d004791ed5b9c213cd66ef80bbcc85",name:"actions"}))))}static get style(){return d()}},[769,"ch-page-header",{title:[1],headingLevel:[1,"heading-level"],eyebrow:[1],description:[1],actionsStacked:[4,"actions-stacked"]}]);function c(){if(typeof customElements==="undefined"){return}const e=["ch-page-header"];e.forEach((e=>{switch(e){case"ch-page-header":if(!customElements.get(s(e))){customElements.define(s(e),i)}break}}))}c();const o=i;const n=c;export{o as ChPageHeader,n as defineCustomElement};
1
+ import{p as e,H as a,h as t,d as r,t as s}from"./p-qP_9qshx.js";const c=()=>`:host{display:block}.header{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);padding-bottom:var(--spacing-2xl);border-bottom:var(--border-width) solid var(--border)}.header-text{display:flex;flex-direction:column;gap:var(--spacing-xs);flex:1 1 20rem;min-width:0}.header-eyebrow{margin:0;color:var(--text-secondary);font-family:var(--font-heading);font-size:var(--typography-size-xs);letter-spacing:var(--typography-tracking-badge);text-transform:uppercase}.header-title{margin:0;color:var(--text);font-family:var(--font-heading);font-size:var(--typography-size-xl);font-weight:var(--typography-weight-bold);line-height:1.2;overflow-wrap:anywhere}.header-description{margin:0;color:var(--text-secondary);font-size:var(--typography-size-sm);line-height:1.5;overflow-wrap:anywhere}.header-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--spacing-md);max-width:100%}.header-actions:empty{display:none}.header--stacked .header-actions{flex-basis:100%}@media (max-width: 30rem){.header{flex-direction:column}.header-actions{width:100%}}@media (forced-colors: active){.header{border-bottom-color:CanvasText}}`;const d=e(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}title;headingLevel="h1";eyebrow;description;actionsStacked=false;render(){const e=this.headingLevel;return t(r,{key:"482cd87ddc139731c8b09ba6441231657aae0fcd"},t("div",{key:"9b4d97c14cc6c88d926e4384c6e85df097fdd4ac",class:{header:true,"header--stacked":this.actionsStacked}},t("div",{key:"55daa00350e1204e7a80cc7ee9d1efad49bc517f",class:"header-text"},this.eyebrow&&t("p",{key:"f30b06834abcc2c6e4aca65b56d6860e8a242dfe",class:"header-eyebrow"},this.eyebrow),t(e,{key:"2f0c4b1e6608403ce1b4d9316247d6012c4c810f",class:"header-title"},this.title),this.description&&t("p",{key:"28633505d6dcc8346a34010e85664d48bc8b019b",class:"header-description"},this.description)),t("div",{key:"1bda14e777cc0744a9391ea64accb9d2c734dfc2",class:"header-actions"},t("slot",{key:"7869965c1649dfc6ffa0e019e84d6785344187d2",name:"actions"}))))}static get style(){return c()}},[769,"ch-page-header",{title:[1],headingLevel:[1,"heading-level"],eyebrow:[1],description:[1],actionsStacked:[4,"actions-stacked"]}]);function i(){if(typeof customElements==="undefined"){return}const e=["ch-page-header"];e.forEach((e=>{switch(e){case"ch-page-header":if(!customElements.get(s(e))){customElements.define(s(e),d)}break}}))}i();const o=d;const n=i;export{o as ChPageHeader,n as defineCustomElement};
2
2
  //# sourceMappingURL=ch-page-header.js.map
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface ChPagination extends Components.ChPagination, HTMLElement {}
4
+ export const ChPagination: {
5
+ prototype: ChPagination;
6
+ new (): ChPagination;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,2 @@
1
+ import{p as e,H as t,c as a,h as r,d as s,t as i}from"./p-qP_9qshx.js";const o=()=>`:host{display:block;font-family:var(--typography-body);color:var(--color-text-primary)}:host([hidden]){display:none}.pager{display:flex;align-items:center;gap:var(--spacing-md)}.pager__button{display:inline-flex;align-items:center;justify-content:center;min-width:2rem;height:2rem;padding:0 var(--spacing-sm);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-default);color:var(--color-text-primary);font-size:var(--typography-size-md);line-height:1;cursor:pointer}.pager__button:hover:not(:disabled){border-color:var(--color-border-hover);background:var(--color-surface-hover)}.pager__button:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:2px}.pager__button:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.pager__summary{margin:0;font-size:var(--typography-size-sm);color:var(--color-text-secondary);font-variant-numeric:tabular-nums}.pager--sm .pager__button{min-width:1.5rem;height:1.5rem}.pager--sm .pager__summary{font-size:var(--typography-size-xs)}`;let n=0;const c=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chPageChange=a(this,"chPageChange")}labelId=`ch-pagination-${++n}`;page=1;pageSize=10;total=0;label="Pagination";size="md";disabled=false;chPageChange;get pageCount(){if(this.total<=0||this.pageSize<=0){return 0}return Math.ceil(this.total/this.pageSize)}get rowsOnPage(){if(this.pageCount===0){return 0}const e=this.total-(this.page-1)*this.pageSize;return Math.max(0,Math.min(this.pageSize,e))}get firstRow(){return this.rowsOnPage===0?0:(this.page-1)*this.pageSize+1}get lastRow(){return this.rowsOnPage===0?0:this.firstRow+this.rowsOnPage-1}go(e){if(this.disabled||e<1||e>this.pageCount||e===this.page){return}this.chPageChange.emit({page:e,pageSize:this.pageSize})}render(){const e=this.pageCount;const t=this.page<=1;const a=e===0||this.page>=e;const i=this.disabled||e===0;return r(s,{key:"c5091d1a0791a1e0a87fb483ae026484d2aa6c6a"},r("nav",{key:"f70132cdc0ebd3f08d6b712b843bc5a36b20d355",class:{pager:true,[`pager--${this.size}`]:true},"aria-label":this.label},r("button",{key:"3aebe1cce9b909f8b5977f231bd540121fc95f50",class:"pager__button",type:"button",disabled:i||t,onClick:()=>this.go(this.page-1),"aria-label":"Previous page"},r("span",{key:"e68021c2356a38c6a79ecf79a9a7cbcd9063e6cf","aria-hidden":"true"},"‹")),r("p",{key:"d615f3d94d3c5c9a4232ca50ddf1fc8113eb932e",class:"pager__summary",id:this.labelId,"aria-live":"polite"},e===0?"No results":`${this.firstRow}–${this.lastRow} of ${this.total}`),r("button",{key:"0724d97b05c7fe1ef2501317bd28218fa4d8c440",class:"pager__button",type:"button",disabled:i||a,onClick:()=>this.go(this.page+1),"aria-label":"Next page"},r("span",{key:"05cbf13c2be6ccc33e4a517b995a22113306883b","aria-hidden":"true"},"›"))))}static get style(){return o()}},[513,"ch-pagination",{page:[2],pageSize:[2,"page-size"],total:[2],label:[1],size:[1],disabled:[516]}]);function l(){if(typeof customElements==="undefined"){return}const e=["ch-pagination"];e.forEach((e=>{switch(e){case"ch-pagination":if(!customElements.get(i(e))){customElements.define(i(e),c)}break}}))}l();const d=c;const h=l;export{d as ChPagination,h as defineCustomElement};
2
+ //# sourceMappingURL=ch-pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["chPaginationCss","paginationIds","ChPagination","__stencil_proxyCustomElement","HTMLElement","labelId","page","pageSize","total","label","size","disabled","chPageChange","pageCount","this","Math","ceil","rowsOnPage","remaining","max","min","firstRow","lastRow","go","next","emit","render","count","atStart","atEnd","blocked","h","Host","key","class","pager","type","onClick","id"],"sources":["src/components/ch-pagination/ch-pagination.css?tag=ch-pagination&encapsulation=shadow","src/components/ch-pagination/ch-pagination.tsx"],"sourcesContent":[":host {\n display: block;\n font-family: var(--typography-body);\n color: var(--color-text-primary);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.pager {\n display: flex;\n align-items: center;\n gap: var(--spacing-md);\n}\n\n.pager__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n padding: 0 var(--spacing-sm);\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n background: var(--color-surface-default);\n color: var(--color-text-primary);\n font-size: var(--typography-size-md);\n line-height: 1;\n cursor: pointer;\n}\n\n.pager__button:hover:not(:disabled) {\n border-color: var(--color-border-hover);\n background: var(--color-surface-hover);\n}\n\n.pager__button:focus-visible {\n outline: 2px solid var(--color-accent-default);\n outline-offset: 2px;\n}\n\n.pager__button:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.pager__summary {\n margin: 0;\n font-size: var(--typography-size-sm);\n color: var(--color-text-secondary);\n /* Digits do not jitter as the range changes. */\n font-variant-numeric: tabular-nums;\n}\n\n.pager--sm .pager__button {\n min-width: 1.5rem;\n height: 1.5rem;\n}\n\n.pager--sm .pager__summary {\n font-size: var(--typography-size-xs);\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport type ChPaginationSize = 'sm' | 'md';\n\nlet paginationIds = 0;\n\n/**\n * Controlled pagination for a known total.\n *\n * It holds no page state: `page` and `pageSize` come from the consumer and\n * every action emits `chPageChange` with the page it wants. That matches\n * `ch-table`, so a consumer wiring the two together has one model to reason\n * about — the table shows the rows for `page`, the pagination asks for the\n * next one, and nothing moves until the consumer's data does.\n *\n * No numbered page list. A list of numbers is wrong more often than it is\n * right (it depends on how many pages fit, which depends on the font, the\n * locale and the container), and it is the part consumers most often need to\n * replace with their own. Prev/next plus a position summary covers the\n * default case; the summary is what tells a screen-reader user where they are.\n */\n@Component({\n tag: 'ch-pagination',\n styleUrl: 'ch-pagination.css',\n shadow: true,\n})\nexport class ChPagination {\n private readonly labelId = `ch-pagination-${++paginationIds}`;\n\n /** The current page, 1-based. Controlled by the consumer. */\n @Prop() page = 1;\n\n /** How many rows a page holds. Controlled by the consumer. */\n @Prop() pageSize = 10;\n\n /** How many rows exist in total. Zero renders a disabled, empty pager. */\n @Prop() total = 0;\n\n /** Accessible name for the navigation landmark. */\n @Prop() label = 'Pagination';\n\n /** Size of the controls. */\n @Prop() size: ChPaginationSize = 'md';\n\n /** Whether the whole control is disabled. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Emitted when the user asks for another page. The consumer applies it. */\n @Event() chPageChange: EventEmitter<{ page: number; pageSize: number }>;\n\n private get pageCount(): number {\n if (this.total <= 0 || this.pageSize <= 0) {\n return 0;\n }\n return Math.ceil(this.total / this.pageSize);\n }\n\n /** How many rows this page shows, which is short on the last page. */\n private get rowsOnPage(): number {\n if (this.pageCount === 0) {\n return 0;\n }\n const remaining = this.total - (this.page - 1) * this.pageSize;\n return Math.max(0, Math.min(this.pageSize, remaining));\n }\n\n private get firstRow(): number {\n return this.rowsOnPage === 0 ? 0 : (this.page - 1) * this.pageSize + 1;\n }\n\n private get lastRow(): number {\n return this.rowsOnPage === 0 ? 0 : this.firstRow + this.rowsOnPage - 1;\n }\n\n private go(next: number) {\n if (this.disabled || next < 1 || next > this.pageCount || next === this.page) {\n return;\n }\n this.chPageChange.emit({ page: next, pageSize: this.pageSize });\n }\n\n render() {\n const count = this.pageCount;\n const atStart = this.page <= 1;\n const atEnd = count === 0 || this.page >= count;\n const blocked = this.disabled || count === 0;\n\n return (\n <Host>\n <nav class={{ pager: true, [`pager--${this.size}`]: true }} aria-label={this.label}>\n <button class=\"pager__button\" type=\"button\" disabled={blocked || atStart} onClick={() => this.go(this.page - 1)} aria-label=\"Previous page\">\n <span aria-hidden=\"true\">‹</span>\n </button>\n <p class=\"pager__summary\" id={this.labelId} aria-live=\"polite\">\n {count === 0 ? 'No results' : `${this.firstRow}–${this.lastRow} of ${this.total}`}\n </p>\n <button class=\"pager__button\" type=\"button\" disabled={blocked || atEnd} onClick={() => this.go(this.page + 1)} aria-label=\"Next page\">\n <span aria-hidden=\"true\">›</span>\n </button>\n </nav>\n </Host>\n );\n }\n}\n"],"mappings":"uEAAA,MAAMA,EAAkB,IAAM,gjCCI9B,IAAIC,EAAgB,E,MAsBPC,EAAYC,EAAA,MAAAD,UAAAE,E,0HACNC,QAAU,mBAAmBJ,IAGtCK,KAAO,EAGPC,SAAW,GAGXC,MAAQ,EAGRC,MAAQ,aAGRC,KAAyB,KAGRC,SAAW,MAG3BC,aAET,aAAYC,GACV,GAAIC,KAAKN,OAAS,GAAKM,KAAKP,UAAY,EAAG,CACzC,OAAO,C,CAET,OAAOQ,KAAKC,KAAKF,KAAKN,MAAQM,KAAKP,S,CAIrC,cAAYU,GACV,GAAIH,KAAKD,YAAc,EAAG,CACxB,OAAO,C,CAET,MAAMK,EAAYJ,KAAKN,OAASM,KAAKR,KAAO,GAAKQ,KAAKP,SACtD,OAAOQ,KAAKI,IAAI,EAAGJ,KAAKK,IAAIN,KAAKP,SAAUW,G,CAG7C,YAAYG,GACV,OAAOP,KAAKG,aAAe,EAAI,GAAKH,KAAKR,KAAO,GAAKQ,KAAKP,SAAW,C,CAGvE,WAAYe,GACV,OAAOR,KAAKG,aAAe,EAAI,EAAIH,KAAKO,SAAWP,KAAKG,WAAa,C,CAG/D,EAAAM,CAAGC,GACT,GAAIV,KAAKH,UAAYa,EAAO,GAAKA,EAAOV,KAAKD,WAAaW,IAASV,KAAKR,KAAM,CAC5E,M,CAEFQ,KAAKF,aAAaa,KAAK,CAAEnB,KAAMkB,EAAMjB,SAAUO,KAAKP,U,CAGtD,MAAAmB,GACE,MAAMC,EAAQb,KAAKD,UACnB,MAAMe,EAAUd,KAAKR,MAAQ,EAC7B,MAAMuB,EAAQF,IAAU,GAAKb,KAAKR,MAAQqB,EAC1C,MAAMG,EAAUhB,KAAKH,UAAYgB,IAAU,EAE3C,OACEI,EAACC,EAAI,CAAAC,IAAA,4CACHF,EAAA,OAAAE,IAAA,2CAAKC,MAAO,CAAEC,MAAO,KAAM,CAAC,UAAUrB,KAAKJ,QAAS,MAAM,aAAcI,KAAKL,OAC3EsB,EAAA,UAAAE,IAAA,2CAAQC,MAAM,gBAAgBE,KAAK,SAASzB,SAAUmB,GAAWF,EAASS,QAAS,IAAMvB,KAAKS,GAAGT,KAAKR,KAAO,GAAE,aAAa,iBAC1HyB,EAAA,QAAAE,IAAA,yDAAkB,QAAM,MAE1BF,EAAA,KAAAE,IAAA,2CAAGC,MAAM,iBAAiBI,GAAIxB,KAAKT,QAAO,YAAY,UACnDsB,IAAU,EAAI,aAAe,GAAGb,KAAKO,YAAYP,KAAKQ,cAAcR,KAAKN,SAE5EuB,EAAA,UAAAE,IAAA,2CAAQC,MAAM,gBAAgBE,KAAK,SAASzB,SAAUmB,GAAWD,EAAOQ,QAAS,IAAMvB,KAAKS,GAAGT,KAAKR,KAAO,GAAE,aAAa,aACxHyB,EAAA,QAAAE,IAAA,yDAAkB,QAAM,O","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{p as i,H as e,c as t,h as s,d as r,t as a}from"./p-qP_9qshx.js";import{r as o}from"./p-BXzZsX2r.js";const n=()=>`:host{display:inline-block}.group-label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.radio-group{display:flex;flex-direction:column;gap:var(--spacing-lg)}.control{display:inline-flex;align-items:center;gap:var(--spacing-lg);cursor:pointer}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--spacing-4xl);height:var(--spacing-4xl);margin:0;flex-shrink:0;border:var(--border-width) solid var(--border);border-radius:50%;background:var(--surface);cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.input:checked{border-color:var(--accent)}.input:checked::before{content:'';width:var(--spacing-md);height:var(--spacing-md);border-radius:50%;background:var(--accent)}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus-visible{outline-color:var(--color-status-warning)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus-visible,:host(:user-invalid) .input:focus-visible{outline-color:var(--color-status-warning)}.label-text{color:var(--text)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;let l=0;const c=i(class i extends e{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.chChange=t(this,"chChange");this.internals=this.attachInternals()}groupId=`ch-radio-${++l}`;labelId=`${this.groupId}-label`;hintId=`${this.groupId}-hint`;errorId=`${this.groupId}-error`;initialValue;internals;formDisabled=false;get host(){return this}label;options=[];value;name;disabled=false;required=false;hint;errorMessage;invalid=false;chChange;handleChange=i=>{this.value=i.target.value;this.chChange.emit(this.value)};syncForm(){const i=this.internals;if(typeof i?.setFormValue!=="function"){return}i.setFormValue(this.value??null);const{flags:e,message:t}=o({required:this.required,empty:!this.value,invalid:this.invalid,errorMessage:this.errorMessage});i.setValidity(e,t)}componentDidLoad(){this.initialValue=this.value;this.syncForm();this.host.addEventListener("change",this.markTouched);this.host.addEventListener("focusout",this.markTouched);this.host.addEventListener("invalid",this.markTouched)}markTouched=()=>{this.host.setAttribute("data-touched","")};formResetCallback(){this.value=this.initialValue}formDisabledCallback(i){this.formDisabled=i}get describedBy(){if(this.invalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){const i=this.name||`${this.groupId}-group`;return s(r,{key:"a027da2d803a6e8a2a35afa1920dd3b0f8e06b01"},this.label&&s("span",{key:"28e11cd1148a89a4f3e85d331f00e39f1d7751ce",class:"group-label",id:this.labelId},this.label),s("div",{key:"43d8a53c9bec1dc129b6588c0118ebe2109b4b7e",class:"radio-group",role:"radiogroup","aria-labelledby":this.label?this.labelId:undefined},this.options.map((e=>s("label",{class:{control:true,"control--disabled":this.disabled||this.formDisabled||e.disabled}},s("input",{class:{input:true,"input--invalid":this.invalid},type:"radio",name:i,value:e.value,checked:e.value===this.value,disabled:this.disabled||this.formDisabled||e.disabled,"aria-invalid":this.invalid?"true":undefined,"aria-describedby":this.describedBy,onChange:this.handleChange}),s("span",{class:"mark"}),s("span",{class:"label-text"},e.label))))),this.hint&&!(this.invalid&&this.errorMessage)&&s("p",{key:"27335cc50f8b280f93857eea370aa37e2290b46b",class:"hint",id:this.hintId},this.hint),this.invalid&&this.errorMessage&&s("p",{key:"83f93bdc0739961136062acb784a3d6e666de349",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}}static get style(){return n()}},[577,"ch-radio",{label:[1],options:[16],value:[1025],name:[513],disabled:[516],required:[516],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32]},undefined,{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}]);function d(){if(typeof customElements==="undefined"){return}const i=["ch-radio"];i.forEach((i=>{switch(i){case"ch-radio":if(!customElements.get(a(i))){customElements.define(a(i),c)}break}}))}d();const h=c;const u=d;export{h as ChRadio,u as defineCustomElement};
1
+ import{p as i,H as e,c as t,h as s,d as r,t as a}from"./p-qP_9qshx.js";import{r as o}from"./p-BXzZsX2r.js";const n=()=>`:host{display:inline-block}.group-label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.radio-group{display:flex;flex-direction:column;gap:var(--spacing-lg)}.control{display:inline-flex;align-items:center;gap:var(--spacing-lg);cursor:pointer}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--spacing-4xl);height:var(--spacing-4xl);margin:0;flex-shrink:0;border:var(--border-width) solid var(--border);border-radius:50%;background:var(--surface);cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.input:checked{border-color:var(--accent)}.input:checked::before{content:'';width:var(--spacing-md);height:var(--spacing-md);border-radius:50%;background:var(--accent)}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus-visible{outline-color:var(--color-status-warning)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus-visible,:host(:user-invalid) .input:focus-visible{outline-color:var(--color-status-warning)}.label-text{color:var(--text)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;let l=0;const c=i(class i extends e{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.chChange=t(this,"chChange");this.internals=this.attachInternals()}groupId=`ch-radio-${++l}`;labelId=`${this.groupId}-label`;hintId=`${this.groupId}-hint`;errorId=`${this.groupId}-error`;initialValue;internals;formDisabled=false;get host(){return this}label;options=[];value;name;disabled=false;required=false;hint;errorMessage;invalid=false;chChange;handleChange=i=>{this.value=i.target.value;this.chChange.emit(this.value)};syncForm(){const i=this.internals;if(typeof i?.setFormValue!=="function"){return}i.setFormValue(this.value??null);const{flags:e,message:t}=o({required:this.required,empty:!this.value,invalid:this.invalid,errorMessage:this.errorMessage});i.setValidity(e,t)}componentDidLoad(){this.initialValue=this.value;this.syncForm();this.host.addEventListener("change",this.markTouched);this.host.addEventListener("focusout",this.markTouched);this.host.addEventListener("invalid",this.markTouched)}markTouched=()=>{this.host.setAttribute("data-touched","")};formResetCallback(){this.value=this.initialValue}formDisabledCallback(i){this.formDisabled=i}get describedBy(){if(this.invalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){const i=this.name||`${this.groupId}-group`;return s(r,{key:"51bc6a2d4ff9a098889dc65b55afdb7e70a65d5b"},this.label&&s("span",{key:"0e043e7f3e5a8b48e700975e84c7d5a3515b645a",class:"group-label",id:this.labelId},this.label),s("div",{key:"70853bba1a97cae044ef799a892049f32eb4d61c",class:"radio-group",role:"radiogroup","aria-labelledby":this.label?this.labelId:undefined},this.options.map((e=>s("label",{class:{control:true,"control--disabled":this.disabled||this.formDisabled||e.disabled}},s("input",{class:{input:true,"input--invalid":this.invalid},type:"radio",name:i,value:e.value,checked:e.value===this.value,disabled:this.disabled||this.formDisabled||e.disabled,"aria-invalid":this.invalid?"true":undefined,"aria-describedby":this.describedBy,onChange:this.handleChange}),s("span",{class:"mark"}),s("span",{class:"label-text"},e.label))))),this.hint&&!(this.invalid&&this.errorMessage)&&s("p",{key:"cb17c2fc139bb933acf2fc8080e10ee0466c1b68",class:"hint",id:this.hintId},this.hint),this.invalid&&this.errorMessage&&s("p",{key:"de2406de9bec97f248c3252a9acd9c1ab0c745e0",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}}static get style(){return n()}},[577,"ch-radio",{label:[1],options:[16],value:[1025],name:[513],disabled:[516],required:[516],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32]},undefined,{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}]);function d(){if(typeof customElements==="undefined"){return}const i=["ch-radio"];i.forEach((i=>{switch(i){case"ch-radio":if(!customElements.get(a(i))){customElements.define(a(i),c)}break}}))}d();const h=c;const u=d;export{h as ChRadio,u as defineCustomElement};
2
2
  //# sourceMappingURL=ch-radio.js.map