@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,71 @@
1
+ :host {
2
+ display: contents;
3
+ font-family: var(--typography-body);
4
+ }
5
+
6
+ .confirm__heading {
7
+ margin: 0;
8
+ font-family: var(--typography-heading);
9
+ font-size: var(--typography-size-lg);
10
+ font-weight: var(--typography-weight-semibold);
11
+ color: var(--color-text-primary);
12
+ }
13
+
14
+ .confirm__message {
15
+ margin: 0;
16
+ font-size: var(--typography-size-sm);
17
+ color: var(--color-text-secondary);
18
+ overflow-wrap: break-word;
19
+ }
20
+
21
+ .confirm__actions {
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ justify-content: flex-end;
25
+ gap: var(--spacing-md);
26
+ margin-top: var(--spacing-2xl);
27
+ }
28
+
29
+ .confirm__button {
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ min-height: 2.25rem;
34
+ padding: 0 var(--spacing-lg);
35
+ border: var(--border-width) solid var(--color-border-default);
36
+ border-radius: var(--radius-sm);
37
+ background: var(--color-surface-default);
38
+ color: var(--color-text-primary);
39
+ font-family: var(--typography-body);
40
+ font-size: var(--typography-size-sm);
41
+ font-weight: var(--typography-weight-semibold);
42
+ cursor: pointer;
43
+ }
44
+
45
+ .confirm__button:focus-visible {
46
+ outline: 2px solid var(--color-accent-default);
47
+ outline-offset: 2px;
48
+ }
49
+
50
+ .confirm__button:disabled {
51
+ opacity: var(--opacity-disabled);
52
+ cursor: not-allowed;
53
+ }
54
+
55
+ .confirm__button--confirm {
56
+ border-color: var(--color-accent-default);
57
+ background: var(--color-accent-default);
58
+ color: var(--color-accent-text);
59
+ }
60
+
61
+ /* Destructive intent is carried by weight and iconography as well as colour. */
62
+ .confirm__button--danger {
63
+ border-color: var(--color-status-warning);
64
+ background: var(--color-status-warning);
65
+ color: var(--color-text-primary);
66
+ }
67
+
68
+ .confirm__button--danger::before {
69
+ content: '⚠';
70
+ margin-right: var(--spacing-xs);
71
+ }
@@ -0,0 +1,382 @@
1
+ import { Host, h } from "@stencil/core";
2
+ /**
3
+ * A confirmation dialog over `ch-modal`.
4
+ *
5
+ * Declarative only: the consumer opens it with `open` and handles the outcome.
6
+ * The imperative `confirm()` helper is a separate concern and a separate issue,
7
+ * because a promise-returning helper has to own mounting, focus and unhandled
8
+ * rejection, none of which a component should decide for its consumer.
9
+ *
10
+ * The guarantees this adds over a plain `ch-modal` are the ones that make a
11
+ * confirmation safe:
12
+ *
13
+ * - exactly one outcome per interaction — a double click on Confirm emits once;
14
+ * - every dismissal path (Cancel, Escape, backdrop, confirm) is reported, so a
15
+ * consumer awaiting an answer cannot hang;
16
+ * - focus lands on Cancel for a destructive action, so the absent-minded Enter
17
+ * does not destroy anything;
18
+ * - `pending` is not a cancellation: a slow request keeps the dialog open.
19
+ */
20
+ export class ChConfirmDialog {
21
+ el;
22
+ /** Whether the dialog is open. Kept in sync when it is dismissed. */
23
+ open = false;
24
+ /**
25
+ * The question, set as the dialog's accessible name. Required: a dialog
26
+ * without a name is announced as an unlabelled group.
27
+ */
28
+ heading;
29
+ /** Supporting text, rendered under the heading. */
30
+ message;
31
+ /** Label of the confirming action. */
32
+ confirmLabel = 'Confirm';
33
+ /** Label of the dismissing action. */
34
+ cancelLabel = 'Cancel';
35
+ /**
36
+ * `danger` styles the confirm action as destructive and moves the initial
37
+ * focus to Cancel, so the safe choice is the default one.
38
+ */
39
+ tone = 'default';
40
+ /** Whether the confirm action is in flight; both buttons are then disabled. */
41
+ pending = false;
42
+ /**
43
+ * Whether Escape and the backdrop dismiss the dialog. When false, the only
44
+ * way out is one of the two buttons — use it only for a decision that must
45
+ * be answered rather than abandoned.
46
+ */
47
+ dismissible = true;
48
+ /** Emitted once when the user confirms. */
49
+ chConfirm;
50
+ /** Emitted once when the dialog is dismissed without confirming. */
51
+ chCancel;
52
+ /** `true` once an outcome has been emitted for the current opening. */
53
+ settled = false;
54
+ cancelButton;
55
+ confirmButton;
56
+ componentDidLoad() {
57
+ if (this.open) {
58
+ this.onOpening();
59
+ }
60
+ }
61
+ handleOpenChange(open) {
62
+ if (open) {
63
+ this.onOpening();
64
+ return;
65
+ }
66
+ this.settled = false;
67
+ }
68
+ onOpening() {
69
+ this.settled = false;
70
+ // Focus is moved once the dialog is actually shown; the modal handles
71
+ // moving focus into itself, and this refines where it lands.
72
+ requestAnimationFrame(() => {
73
+ const target = this.tone === 'danger' ? this.cancelButton : this.confirmButton;
74
+ target?.focus();
75
+ });
76
+ }
77
+ settle(outcome) {
78
+ if (this.settled) {
79
+ return;
80
+ }
81
+ this.settled = true;
82
+ if (outcome === 'confirm') {
83
+ this.chConfirm.emit();
84
+ return;
85
+ }
86
+ this.chCancel.emit();
87
+ }
88
+ handleConfirm = () => {
89
+ if (this.pending) {
90
+ return;
91
+ }
92
+ this.settle('confirm');
93
+ };
94
+ handleCancel = () => {
95
+ if (this.pending) {
96
+ return;
97
+ }
98
+ this.open = false;
99
+ this.settle('cancel');
100
+ };
101
+ /**
102
+ * `ch-modal` reports every close that was not requested by the consumer —
103
+ * Escape and the backdrop. A close while `pending` is the consumer's own
104
+ * doing and is not a cancellation.
105
+ */
106
+ handleModalClose = () => {
107
+ this.open = false;
108
+ if (this.pending) {
109
+ return;
110
+ }
111
+ this.settle('cancel');
112
+ };
113
+ /**
114
+ * Escape is a platform close request on the inner `<dialog>`, so a
115
+ * non-dismissible dialog cancels it before it takes effect. The backdrop is
116
+ * handled by `ch-modal` and is suppressed the same way.
117
+ */
118
+ handleKeyDown = (event) => {
119
+ if (this.dismissible || event.key !== 'Escape') {
120
+ return;
121
+ }
122
+ event.preventDefault();
123
+ event.stopPropagation();
124
+ };
125
+ /**
126
+ * Focus the safe action. Exposed so a consumer can return focus deliberately
127
+ * after a request settles.
128
+ */
129
+ async focusCancel() {
130
+ this.cancelButton?.focus();
131
+ }
132
+ render() {
133
+ return (h(Host, { key: 'b51a806f4cca331fc3a95421d3342608c6e0df4c', onKeyDown: this.handleKeyDown }, h("ch-modal", { key: '453db02cd724bc9bf2ed7c4b61bcf04c77b8d449', open: this.open, label: this.heading, size: "sm", onChClose: this.handleModalClose, onChOpen: () => this.onOpening() }, h("h2", { key: '1dee8f11ee68679792c394506ab2e8a7f98b852b', slot: "heading", class: "confirm__heading" }, this.heading), this.message && h("p", { key: 'f2a8a473acfcdfee51600a0dc7bc47b85f4a0889', class: "confirm__message" }, this.message), h("div", { key: '7ecfa78e4df217e38519f115fdcb4761ed88937d', class: "confirm__actions" }, h("button", { key: '0c4a117caee9ef316932e2eea9c0aa3734f0bbee', class: { 'confirm__button': true, 'confirm__button--cancel': true }, type: "button", ref: el => (this.cancelButton = el), disabled: this.pending, onClick: this.handleCancel }, this.cancelLabel), h("button", { key: 'd33fd5f6f218bfcd39f179e29d757f7f9bdcae30', class: { 'confirm__button': true, 'confirm__button--confirm': true, 'confirm__button--danger': this.tone === 'danger' }, type: "button", ref: el => (this.confirmButton = el), disabled: this.pending, "aria-busy": this.pending ? 'true' : undefined, onClick: this.handleConfirm }, this.confirmLabel)))));
134
+ }
135
+ static get is() { return "ch-confirm-dialog"; }
136
+ static get encapsulation() { return "shadow"; }
137
+ static get originalStyleUrls() {
138
+ return {
139
+ "$": ["ch-confirm-dialog.css"]
140
+ };
141
+ }
142
+ static get styleUrls() {
143
+ return {
144
+ "$": ["ch-confirm-dialog.css"]
145
+ };
146
+ }
147
+ static get properties() {
148
+ return {
149
+ "open": {
150
+ "type": "boolean",
151
+ "mutable": true,
152
+ "complexType": {
153
+ "original": "boolean",
154
+ "resolved": "boolean",
155
+ "references": {}
156
+ },
157
+ "required": false,
158
+ "optional": false,
159
+ "docs": {
160
+ "tags": [],
161
+ "text": "Whether the dialog is open. Kept in sync when it is dismissed."
162
+ },
163
+ "getter": false,
164
+ "setter": false,
165
+ "reflect": false,
166
+ "attribute": "open",
167
+ "defaultValue": "false"
168
+ },
169
+ "heading": {
170
+ "type": "string",
171
+ "mutable": false,
172
+ "complexType": {
173
+ "original": "string",
174
+ "resolved": "string",
175
+ "references": {}
176
+ },
177
+ "required": true,
178
+ "optional": false,
179
+ "docs": {
180
+ "tags": [],
181
+ "text": "The question, set as the dialog's accessible name. Required: a dialog\nwithout a name is announced as an unlabelled group."
182
+ },
183
+ "getter": false,
184
+ "setter": false,
185
+ "reflect": false,
186
+ "attribute": "heading"
187
+ },
188
+ "message": {
189
+ "type": "string",
190
+ "mutable": false,
191
+ "complexType": {
192
+ "original": "string",
193
+ "resolved": "string",
194
+ "references": {}
195
+ },
196
+ "required": false,
197
+ "optional": true,
198
+ "docs": {
199
+ "tags": [],
200
+ "text": "Supporting text, rendered under the heading."
201
+ },
202
+ "getter": false,
203
+ "setter": false,
204
+ "reflect": false,
205
+ "attribute": "message"
206
+ },
207
+ "confirmLabel": {
208
+ "type": "string",
209
+ "mutable": false,
210
+ "complexType": {
211
+ "original": "string",
212
+ "resolved": "string",
213
+ "references": {}
214
+ },
215
+ "required": false,
216
+ "optional": false,
217
+ "docs": {
218
+ "tags": [],
219
+ "text": "Label of the confirming action."
220
+ },
221
+ "getter": false,
222
+ "setter": false,
223
+ "reflect": false,
224
+ "attribute": "confirm-label",
225
+ "defaultValue": "'Confirm'"
226
+ },
227
+ "cancelLabel": {
228
+ "type": "string",
229
+ "mutable": false,
230
+ "complexType": {
231
+ "original": "string",
232
+ "resolved": "string",
233
+ "references": {}
234
+ },
235
+ "required": false,
236
+ "optional": false,
237
+ "docs": {
238
+ "tags": [],
239
+ "text": "Label of the dismissing action."
240
+ },
241
+ "getter": false,
242
+ "setter": false,
243
+ "reflect": false,
244
+ "attribute": "cancel-label",
245
+ "defaultValue": "'Cancel'"
246
+ },
247
+ "tone": {
248
+ "type": "string",
249
+ "mutable": false,
250
+ "complexType": {
251
+ "original": "ChConfirmDialogTone",
252
+ "resolved": "\"danger\" | \"default\"",
253
+ "references": {
254
+ "ChConfirmDialogTone": {
255
+ "location": "local",
256
+ "path": "/home/runner/work/chucao/chucao/src/components/ch-confirm-dialog/ch-confirm-dialog.tsx",
257
+ "id": "src/components/ch-confirm-dialog/ch-confirm-dialog.tsx::ChConfirmDialogTone"
258
+ }
259
+ }
260
+ },
261
+ "required": false,
262
+ "optional": false,
263
+ "docs": {
264
+ "tags": [],
265
+ "text": "`danger` styles the confirm action as destructive and moves the initial\nfocus to Cancel, so the safe choice is the default one."
266
+ },
267
+ "getter": false,
268
+ "setter": false,
269
+ "reflect": false,
270
+ "attribute": "tone",
271
+ "defaultValue": "'default'"
272
+ },
273
+ "pending": {
274
+ "type": "boolean",
275
+ "mutable": false,
276
+ "complexType": {
277
+ "original": "boolean",
278
+ "resolved": "boolean",
279
+ "references": {}
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "Whether the confirm action is in flight; both buttons are then disabled."
286
+ },
287
+ "getter": false,
288
+ "setter": false,
289
+ "reflect": false,
290
+ "attribute": "pending",
291
+ "defaultValue": "false"
292
+ },
293
+ "dismissible": {
294
+ "type": "boolean",
295
+ "mutable": false,
296
+ "complexType": {
297
+ "original": "boolean",
298
+ "resolved": "boolean",
299
+ "references": {}
300
+ },
301
+ "required": false,
302
+ "optional": false,
303
+ "docs": {
304
+ "tags": [],
305
+ "text": "Whether Escape and the backdrop dismiss the dialog. When false, the only\nway out is one of the two buttons \u2014 use it only for a decision that must\nbe answered rather than abandoned."
306
+ },
307
+ "getter": false,
308
+ "setter": false,
309
+ "reflect": false,
310
+ "attribute": "dismissible",
311
+ "defaultValue": "true"
312
+ }
313
+ };
314
+ }
315
+ static get states() {
316
+ return {
317
+ "settled": {}
318
+ };
319
+ }
320
+ static get events() {
321
+ return [{
322
+ "method": "chConfirm",
323
+ "name": "chConfirm",
324
+ "bubbles": true,
325
+ "cancelable": true,
326
+ "composed": true,
327
+ "docs": {
328
+ "tags": [],
329
+ "text": "Emitted once when the user confirms."
330
+ },
331
+ "complexType": {
332
+ "original": "void",
333
+ "resolved": "void",
334
+ "references": {}
335
+ }
336
+ }, {
337
+ "method": "chCancel",
338
+ "name": "chCancel",
339
+ "bubbles": true,
340
+ "cancelable": true,
341
+ "composed": true,
342
+ "docs": {
343
+ "tags": [],
344
+ "text": "Emitted once when the dialog is dismissed without confirming."
345
+ },
346
+ "complexType": {
347
+ "original": "void",
348
+ "resolved": "void",
349
+ "references": {}
350
+ }
351
+ }];
352
+ }
353
+ static get methods() {
354
+ return {
355
+ "focusCancel": {
356
+ "complexType": {
357
+ "signature": "() => Promise<void>",
358
+ "parameters": [],
359
+ "references": {
360
+ "Promise": {
361
+ "location": "global",
362
+ "id": "global::Promise"
363
+ }
364
+ },
365
+ "return": "Promise<void>"
366
+ },
367
+ "docs": {
368
+ "text": "Focus the safe action. Exposed so a consumer can return focus deliberately\nafter a request settles.",
369
+ "tags": []
370
+ }
371
+ }
372
+ };
373
+ }
374
+ static get elementRef() { return "el"; }
375
+ static get watchers() {
376
+ return [{
377
+ "propName": "open",
378
+ "methodName": "handleOpenChange"
379
+ }];
380
+ }
381
+ }
382
+ //# sourceMappingURL=ch-confirm-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ch-confirm-dialog.js","sourceRoot":"","sources":["../../../../src/components/ch-confirm-dialog/ch-confirm-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SA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,EAC5C,OAAO,EAAE,IAAI,CAAC,aAAa,IAE1B,IAAI,CAAC,YAAY,CACX,CACL,CACG,CACN,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
@@ -30,7 +30,7 @@ export class ChDescriptionList {
30
30
  return COLUMNS.has(this.columns) ? this.columns : '1';
31
31
  }
32
32
  render() {
33
- return (h(Host, { key: '2f349aa14dc442e4e531dacc2d9f6b02fc2b141a' }, h("dl", { key: 'de4bf1b60c31f0319bc5e169304134c8e0046912', class: `list list--columns-${this.columnCount}` }, h("slot", { key: '4ef568fa3e64048ba6e586ae9e8d10c21ad326aa' }))));
33
+ return (h(Host, { key: '1fd1228705a78196b618efc4b9665de038663ae5' }, h("dl", { key: '0b724aa3c5dec011106347d9d29d0420f723012f', class: `list list--columns-${this.columnCount}` }, h("slot", { key: '4da2c6965568cf7d2f93ee98e131a7bede26d5dc' }))));
34
34
  }
35
35
  static get is() { return "ch-description-list"; }
36
36
  static get encapsulation() { return "shadow"; }
@@ -5,7 +5,7 @@ export class ChDivider {
5
5
  */
6
6
  orientation = 'horizontal';
7
7
  render() {
8
- return (h(Host, { key: '0ae19c8f91c810836781f7dac098b49b99c01389', class: { 'divider--vertical': this.orientation === 'vertical' } }, h("hr", { key: 'f5b782f7d67da28ec659fceef32ebf0f4d8ca521', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
8
+ return (h(Host, { key: 'cc193b7e7229de8ff96eb056bd345cc8d666004b', class: { 'divider--vertical': this.orientation === 'vertical' } }, h("hr", { key: '659320c0372d208aab9b13d471427e479499a72c', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
9
9
  }
10
10
  static get is() { return "ch-divider"; }
11
11
  static get encapsulation() { return "shadow"; }
@@ -145,7 +145,7 @@ export class ChDrawer {
145
145
  if (!this.label) {
146
146
  warnMissingName(this.el, 'ch-drawer', 'pass label with the same text as the header');
147
147
  }
148
- return (h(Host, { key: '871af03f0944e4272be64c1452cc28a0a39ac0f2' }, h("dialog", { key: '540da9d2bff68d5528e65146b2a049adbc9723c2', class: { drawer: true, [`drawer--${this.side}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, h("div", { key: 'de569a4d239dd5e2bf6b2741b77307eb70ddced1', class: "drawer-head" }, h("slot", { key: 'e28ade42e0835a919aa5447dafbbbfff2de903d7', name: "header" }), this.closeLabel && (h("button", { key: '5cf29d8b791652fce663459f479826564637d6ca', class: "drawer-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, h("span", { key: '06a24d8b140db10b9d543530ea5dfbd8dd991019', "aria-hidden": "true" }, "\u00D7")))), h("div", { key: 'b593bac5fb45234d501d3ec540f00d804ae5e066', class: "drawer-body" }, h("slot", { key: '854cb053b30234aa31d59fcf27bb7d2820311eb3' })), h("slot", { key: '5c1fb51d3636af1762b26d72f5eaa79c5f779a60', name: "footer" }))));
148
+ return (h(Host, { key: '1a51b3f19b956fe860fe4def9f2ac23eac7f86ac' }, h("dialog", { key: 'ad7366eb2e6274962faa2a1564a06ecc3268329c', class: { drawer: true, [`drawer--${this.side}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, h("div", { key: 'ce532be71c35234f1713051e5669f1cf9316031e', class: "drawer-head" }, h("slot", { key: 'b522a8f26dddefd2aaf146134ac24e026a5eb72a', name: "header" }), this.closeLabel && (h("button", { key: 'b51fb4e20797cd82661c72c9250b0875338180f0', class: "drawer-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, h("span", { key: 'dd21e30fcb74f08c80b1c2ba79696e1d54bf4c26', "aria-hidden": "true" }, "\u00D7")))), h("div", { key: 'eacafa24e5af7c107e09a7cbfdfc93ae6f373dc5', class: "drawer-body" }, h("slot", { key: 'ddf9370c27956bc2954a3af29064394d37ec5e67' })), h("slot", { key: '0065c8f5bafb14791e63d15bbec0ec2ba533c222', name: "footer" }))));
149
149
  }
150
150
  static get is() { return "ch-drawer"; }
151
151
  static get encapsulation() { return "shadow"; }
@@ -49,7 +49,7 @@ export class ChEmoji {
49
49
  this.loaded = true;
50
50
  };
51
51
  render() {
52
- return (h(Host, { key: '8444f71f1c84fd8b1940503c5e7bf5ff62bbb9e6' }, h("img", { key: 'ce9c083238c87557f71838ab8de50038fc43a2bd', class: {
52
+ return (h(Host, { key: 'd6e224a01b95fdebb4525b30b326585ee96e1050' }, h("img", { key: '6bc232d8f25e0099c9e2794f15b8e47f6c2dbb22', class: {
53
53
  'emoji': true,
54
54
  [`emoji--${this.size}`]: true,
55
55
  'emoji--hidden': !this.loaded,
@@ -22,7 +22,7 @@ export class ChEmptyState {
22
22
  */
23
23
  size = 'md';
24
24
  render() {
25
- return (h(Host, { key: '8ed0e4e1712c415ccc38050011af09c778a6bb48', class: { 'empty-state': true, [`empty-state--${this.size}`]: true } }, h("div", { key: '63a6dd1e1678c48da81af7e89dc90fd2288fdbfa', class: "empty-state__inner" }, h("div", { key: '3753c28a9268eff9ebb936f3b8f9d4257e63ca41', class: "empty-state__icon", "aria-hidden": "true" }, h("slot", { key: 'abc7a5a2b84d7d4d5be3cd5dcfa3da217e480a4f', name: "icon" })), h("h3", { key: 'c6be0381802f307f35ea81a58fe8571d0799b97a', class: "empty-state__title" }, this.title), this.description && h("p", { key: 'e8c953d3ed017ed9fd06c572a7d601217be317e3', class: "empty-state__description" }, this.description), h("div", { key: 'da062b6ceabc34cced61ed900f09025a83f401f4', class: "empty-state__actions" }, h("slot", { key: '18930706af315dfbb2da7a492c79d3a468be3574' })))));
25
+ return (h(Host, { key: '15a171d5e6128b278078f3564fe27a75f2d3638f', class: { 'empty-state': true, [`empty-state--${this.size}`]: true } }, h("div", { key: '959baade697f5817d46fe2ef1e08b31d1f14168d', class: "empty-state__inner" }, h("div", { key: 'c97f9d6405da2d81e538701c48e12acbb6bbbd76', class: "empty-state__icon", "aria-hidden": "true" }, h("slot", { key: 'abb50aae0a68ff11b5042a51cdb8d7f69d965ae8', name: "icon" })), h("h3", { key: '2049c3cb4714b642670ba283f8c3c9e3e1ba6ae4', class: "empty-state__title" }, this.title), this.description && h("p", { key: 'b74601952c870aab10345c7bdc856dc779396645', class: "empty-state__description" }, this.description), h("div", { key: 'c72be9f5a4f40113d1c6df1d62c9b617e8dcb407', class: "empty-state__actions" }, h("slot", { key: 'c998904407c1cf174921873e3d547c2056f3d1b5' })))));
26
26
  }
27
27
  static get is() { return "ch-empty-state"; }
28
28
  static get encapsulation() { return "shadow"; }
@@ -48,7 +48,7 @@ export class ChGrid {
48
48
  this.el.style.setProperty('--ch-grid-columns', template);
49
49
  }
50
50
  render() {
51
- return (h(Host, { key: 'de6c2d15da9a5d735327df077c6b58abe9775267', class: { grid: true, [`grid--gap-${this.gapStep}`]: true } }, h("slot", { key: '348289bcf2f46fb07e7392afa00c4619d6614fef' })));
51
+ return (h(Host, { key: '4fbcd3b5e563ebf0f5b2878ef6af0cb2d1c0f427', class: { grid: true, [`grid--gap-${this.gapStep}`]: true } }, h("slot", { key: '4fe1548392ab44de9dd895129d77f20650a0d929' })));
52
52
  }
53
53
  static get is() { return "ch-grid"; }
54
54
  static get encapsulation() { return "shadow"; }
@@ -28,7 +28,7 @@ export class ChIcon {
28
28
  render() {
29
29
  const shapes = this.name ? chIcons[this.name] : undefined;
30
30
  const decorative = !this.label;
31
- return (h(Host, { key: 'f45fcd8a7f620f12942e3c1dd1c68a16009905ad' }, h("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: decorative ? undefined : 'img', "aria-label": this.label, "aria-hidden": decorative ? 'true' : undefined, focusable: "false" }, (shapes ?? []).map(shape => h(shape.tag, shape.attrs)))));
31
+ return (h(Host, { key: 'c55af60731d59ee48bfb2566f498c5675c36cb04' }, h("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: decorative ? undefined : 'img', "aria-label": this.label, "aria-hidden": decorative ? 'true' : undefined, focusable: "false" }, (shapes ?? []).map(shape => h(shape.tag, shape.attrs)))));
32
32
  }
33
33
  static get is() { return "ch-icon"; }
34
34
  static get encapsulation() { return "shadow"; }
@@ -40,7 +40,7 @@ export class ChIconButton {
40
40
  };
41
41
  render() {
42
42
  const shapes = this.name ? chIcons[this.name] : undefined;
43
- return (h(Host, { key: 'cdef3ba2a7577cb7119aa943138746905de21dbb' }, h("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 }, h("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" }, (shapes ?? []).map(shape => h(shape.tag, shape.attrs))))));
43
+ return (h(Host, { key: '585bbba80a0811664fcc2fa8fd625cd8655e3395' }, h("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 }, h("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" }, (shapes ?? []).map(shape => h(shape.tag, shape.attrs))))));
44
44
  }
45
45
  static get is() { return "ch-icon-button"; }
46
46
  static get encapsulation() { return "shadow"; }
@@ -107,7 +107,7 @@ export class ChInput {
107
107
  return undefined;
108
108
  }
109
109
  render() {
110
- return (h(Host, { key: '2b6755db381eeecb5c7c15730f351b5a28b2f89a' }, this.label && (h("label", { key: 'a4c4be2f9ca0dddc175597a12d2e48c3a5030131', class: "label", htmlFor: this.inputId }, this.label)), h("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) && (h("p", { key: '857edf91f7b9657b34763fa06bae3d57e07d861c', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '4516a30cd0d40e3b9e53430416934497c92b1f88', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
110
+ return (h(Host, { key: '80dd56c8fa40d4c8c4eec2b62d1fea2aaa574dcc' }, this.label && (h("label", { key: 'd1d4c26e7a49f176f5d986af107395fd32abbd11', class: "label", htmlFor: this.inputId }, this.label)), h("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) && (h("p", { key: '802ec36ef19bebd3371ff9535fba4052268f3db6', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '489b9634ce6577f71c5875a45cfc5b8a5eeb6cf1', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
111
111
  }
112
112
  static get is() { return "ch-input"; }
113
113
  static get encapsulation() { return "shadow"; }
@@ -152,7 +152,7 @@ export class ChModal {
152
152
  if (!this.label) {
153
153
  warnMissingName(this.el, 'ch-modal', 'pass label with the same text as the heading');
154
154
  }
155
- return (h(Host, { key: 'b0fced593159cc6e6952831f9460cce1efd532d4' }, h("dialog", { key: '81180fe5cdd62df43f5aa35a8358b4e86cc8dc40', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, h("div", { key: '4c13adb1131ee26978f607b86e7eb8a9e65ce3a7', class: "modal-head" }, h("slot", { key: '4cb35bd7f0c290ef0c7aec5df60a839f8c383e66', name: "heading" }), this.closeLabel && (h("button", { key: 'f967cf89873760e1156081a77402d12252cbc20d', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, h("span", { key: '719e26b74726be28f50587dca769c257db3ecdec', "aria-hidden": "true" }, "\u00D7")))), h("div", { key: 'b6a44ef698e580031aa9efa5b5a177c9c1218488', class: "modal-body" }, h("slot", { key: '27c107491182196ee3ea3aa8d6746da0a9be40a6' })))));
155
+ return (h(Host, { key: '36395dc0b52676493b93d02c04d1c810d98c8028' }, h("dialog", { key: '99d446c5d0ecd9e16f8d36fc2903f1ab06c274f2', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, h("div", { key: '9dd7043302df7ffa89fdb44f54ed5c93a48fff7e', class: "modal-head" }, h("slot", { key: '473041c868d2234c66276936cde0d020b8ed74ce', name: "heading" }), this.closeLabel && (h("button", { key: 'e3f65a8c91283b8f3a27975afe44e47e65fbf03f', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, h("span", { key: 'dbacf11f6b06ed4183e6d277fc807d63867fdf1d', "aria-hidden": "true" }, "\u00D7")))), h("div", { key: '1d9e1567fe0046078f1d26f5dea25c3c06c7e6ed', class: "modal-body" }, h("slot", { key: 'cc0a63c64b512a6c40c59d8395ced225a961adfc' })))));
156
156
  }
157
157
  static get is() { return "ch-modal"; }
158
158
  static get encapsulation() { return "shadow"; }
@@ -204,10 +204,10 @@ export class ChNumberInput {
204
204
  }
205
205
  render() {
206
206
  const showError = this.isInvalid && this.errorMessage;
207
- return (h(Host, { key: '1c424d9d76ec39e6cc6018d6ba483f95bd203d32' }, this.label && (h("label", { key: '4fc03334128c33cc425da773df063cd99fee215c', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: 'ece15737f83c181d615e906aba5cce80c0bcb8ba', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid },
207
+ return (h(Host, { key: '0265106cccf730338541d292be247b7853ab00cf' }, this.label && (h("label", { key: '17293d5cc55a8d4de0cd544ea1f508d1ed820b12', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: 'ce17dc7c0f5c1064d8535aef942e486a46b72188', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid },
208
208
  // `text` with `inputmode`, not `type="number"`: a number input drops
209
209
  // partial values and cannot show grouped digits.
210
- 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 && !showError && (h("p", { key: '7a2e3031b8bfebf26857dd60eb18340f21a01f3d', class: "hint", id: this.hintId }, this.hint)), showError && (h("p", { key: 'f90492532d27088f18b258f885d5d471f31d27cb', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
210
+ 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 && !showError && (h("p", { key: '37611a7755f6885e6f87a600b1a27cc5edd5fefd', class: "hint", id: this.hintId }, this.hint)), showError && (h("p", { key: '68b8c5b964a2a98df493103b1fde088aeefda769', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
211
211
  }
212
212
  static get is() { return "ch-number-input"; }
213
213
  static get encapsulation() { return "shadow"; }