@devschile/chucao 2.7.1 → 2.8.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 (238) hide show
  1. package/dist/chucao/chucao.esm.js +1 -1
  2. package/dist/chucao/{p-deb2571b.entry.js → p-0831c6f2.entry.js} +2 -2
  3. package/dist/chucao/p-0d7fc720.entry.js +2 -0
  4. package/dist/chucao/{p-60e1c1df.entry.js.map → p-0d7fc720.entry.js.map} +1 -1
  5. package/dist/chucao/{p-42028c97.entry.js → p-19d90f87.entry.js} +2 -2
  6. package/dist/chucao/{p-1b70e3f1.entry.js → p-25f4f815.entry.js} +2 -2
  7. package/dist/chucao/{p-472ec451.entry.js → p-3e0d7585.entry.js} +2 -2
  8. package/dist/chucao/{p-f917d34f.entry.js → p-46dae34b.entry.js} +2 -2
  9. package/dist/chucao/{p-01b6c7bf.entry.js → p-5093c486.entry.js} +2 -2
  10. package/dist/chucao/{p-337d7f68.entry.js → p-51f6327c.entry.js} +2 -2
  11. package/dist/chucao/{p-ffecdf25.entry.js → p-5577e0a0.entry.js} +2 -2
  12. package/dist/chucao/{p-15d27bb7.entry.js → p-56e41372.entry.js} +2 -2
  13. package/dist/chucao/{p-9ebcc7be.entry.js → p-6c2e5931.entry.js} +2 -2
  14. package/dist/chucao/{p-f6ab0a11.entry.js → p-6e93c392.entry.js} +2 -2
  15. package/dist/chucao/{p-9db118d9.entry.js → p-7f99ae48.entry.js} +2 -2
  16. package/dist/chucao/p-8b09ad3c.entry.js +2 -0
  17. package/dist/chucao/p-8b09ad3c.entry.js.map +1 -0
  18. package/dist/chucao/{p-7cdc71cc.entry.js → p-8fcf6d36.entry.js} +2 -2
  19. package/dist/chucao/{p-CIV5Gg1o.js → p-8l_6qAY9.js} +3 -3
  20. package/dist/chucao/p-8l_6qAY9.js.map +1 -0
  21. package/dist/chucao/{p-1e4cd3aa.entry.js → p-920d5727.entry.js} +2 -2
  22. package/dist/chucao/{p-c90da3c0.entry.js → p-ad41da02.entry.js} +2 -2
  23. package/dist/chucao/p-af088ffd.entry.js +2 -0
  24. package/dist/chucao/p-af088ffd.entry.js.map +1 -0
  25. package/dist/chucao/{p-d8b71751.entry.js → p-b42ec9bf.entry.js} +2 -2
  26. package/dist/chucao/{p-2e37c61b.entry.js → p-b80c39c3.entry.js} +2 -2
  27. package/dist/chucao/{p-a7c674b7.entry.js → p-ba589c2f.entry.js} +2 -2
  28. package/dist/chucao/{p-0c7f6f8d.entry.js → p-c4d68ab7.entry.js} +2 -2
  29. package/dist/chucao/{p-90284ebe.entry.js → p-c98e2a50.entry.js} +2 -2
  30. package/dist/chucao/{p-8ae680a4.entry.js → p-ca3179ae.entry.js} +2 -2
  31. package/dist/chucao/{p-5240f5ac.entry.js → p-d630f662.entry.js} +2 -2
  32. package/dist/chucao/{p-c4b2bd1f.entry.js → p-d868bdbc.entry.js} +2 -2
  33. package/dist/chucao/{p-e77d35c3.entry.js → p-e6b7b2da.entry.js} +2 -2
  34. package/dist/chucao/p-eb39b9c2.entry.js +2 -0
  35. package/dist/chucao/p-eb39b9c2.entry.js.map +1 -0
  36. package/dist/chucao/{p-10f6801e.entry.js → p-f0c288db.entry.js} +2 -2
  37. package/dist/cjs/ch-accordion.cjs.entry.js +2 -2
  38. package/dist/cjs/ch-alert_8.cjs.entry.js +8 -8
  39. package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
  40. package/dist/cjs/ch-cluster.cjs.entry.js +3 -3
  41. package/dist/cjs/ch-confirm-dialog.cjs.entry.js +138 -0
  42. package/dist/cjs/ch-confirm-dialog.cjs.entry.js.map +1 -0
  43. package/dist/cjs/ch-description-list.cjs.entry.js +2 -2
  44. package/dist/cjs/ch-divider.cjs.entry.js +2 -2
  45. package/dist/cjs/ch-drawer.cjs.entry.js +2 -2
  46. package/dist/cjs/ch-emoji.cjs.entry.js +2 -2
  47. package/dist/cjs/ch-empty-state.cjs.entry.js +2 -2
  48. package/dist/cjs/ch-grid.cjs.entry.js +2 -2
  49. package/dist/cjs/ch-icon-button.cjs.entry.js +2 -2
  50. package/dist/cjs/ch-icon.cjs.entry.js +2 -2
  51. package/dist/cjs/ch-link.cjs.entry.js +1 -1
  52. package/dist/cjs/ch-modal.cjs.entry.js +2 -2
  53. package/dist/cjs/ch-number-input.cjs.entry.js +3 -3
  54. package/dist/cjs/ch-otp-input.cjs.entry.js +196 -0
  55. package/dist/cjs/ch-otp-input.cjs.entry.js.map +1 -0
  56. package/dist/cjs/ch-page-header.cjs.entry.js +2 -2
  57. package/dist/cjs/ch-pagination.cjs.entry.js +67 -0
  58. package/dist/cjs/ch-pagination.cjs.entry.js.map +1 -0
  59. package/dist/cjs/ch-radio.cjs.entry.js +2 -2
  60. package/dist/cjs/ch-segmented-control.cjs.entry.js +2 -2
  61. package/dist/cjs/ch-skeleton.cjs.entry.js +2 -2
  62. package/dist/cjs/ch-stack.cjs.entry.js +2 -2
  63. package/dist/cjs/ch-stat.cjs.entry.js +3 -3
  64. package/dist/cjs/ch-table.cjs.entry.js +2 -2
  65. package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
  66. package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
  67. package/dist/cjs/ch-timeline.cjs.entry.js +2 -2
  68. package/dist/cjs/ch-tooltip.cjs.entry.js +3 -3
  69. package/dist/cjs/chucao.cjs.js +2 -2
  70. package/dist/cjs/{index-ByZY6aTj.js → index-C6khqyw3.js} +19 -2
  71. package/dist/cjs/index-C6khqyw3.js.map +1 -0
  72. package/dist/cjs/loader.cjs.js +2 -2
  73. package/dist/collection/collection-manifest.json +3 -0
  74. package/dist/collection/components/ch-accordion/ch-accordion.js +1 -1
  75. package/dist/collection/components/ch-alert/ch-alert.js +1 -1
  76. package/dist/collection/components/ch-badge/ch-badge.js +1 -1
  77. package/dist/collection/components/ch-card/ch-card.js +1 -1
  78. package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
  79. package/dist/collection/components/ch-cluster/ch-cluster.js +2 -2
  80. package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.css +71 -0
  81. package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.js +382 -0
  82. package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.js.map +1 -0
  83. package/dist/collection/components/ch-description-list/ch-description-list.js +1 -1
  84. package/dist/collection/components/ch-divider/ch-divider.js +1 -1
  85. package/dist/collection/components/ch-drawer/ch-drawer.js +1 -1
  86. package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
  87. package/dist/collection/components/ch-empty-state/ch-empty-state.js +1 -1
  88. package/dist/collection/components/ch-grid/ch-grid.js +1 -1
  89. package/dist/collection/components/ch-icon/ch-icon.js +1 -1
  90. package/dist/collection/components/ch-icon-button/ch-icon-button.js +1 -1
  91. package/dist/collection/components/ch-input/ch-input.js +1 -1
  92. package/dist/collection/components/ch-modal/ch-modal.js +1 -1
  93. package/dist/collection/components/ch-number-input/ch-number-input.js +2 -2
  94. package/dist/collection/components/ch-otp-input/ch-otp-input.css +86 -0
  95. package/dist/collection/components/ch-otp-input/ch-otp-input.js +478 -0
  96. package/dist/collection/components/ch-otp-input/ch-otp-input.js.map +1 -0
  97. package/dist/collection/components/ch-page-header/ch-page-header.js +1 -1
  98. package/dist/collection/components/ch-pagination/ch-pagination.css +63 -0
  99. package/dist/collection/components/ch-pagination/ch-pagination.js +228 -0
  100. package/dist/collection/components/ch-pagination/ch-pagination.js.map +1 -0
  101. package/dist/collection/components/ch-radio/ch-radio.js +1 -1
  102. package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +1 -1
  103. package/dist/collection/components/ch-select/ch-select.js +1 -1
  104. package/dist/collection/components/ch-skeleton/ch-skeleton.js +1 -1
  105. package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
  106. package/dist/collection/components/ch-stack/ch-stack.js +1 -1
  107. package/dist/collection/components/ch-stat/ch-stat.js +2 -2
  108. package/dist/collection/components/ch-switch/ch-switch.js +1 -1
  109. package/dist/collection/components/ch-table/ch-table.js +1 -1
  110. package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
  111. package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
  112. package/dist/collection/components/ch-timeline/ch-timeline.js +1 -1
  113. package/dist/collection/components/ch-tooltip/ch-tooltip.js +2 -2
  114. package/dist/components/ch-accordion.js +1 -1
  115. package/dist/components/ch-alert.js +1 -1
  116. package/dist/components/ch-badge.js +1 -1
  117. package/dist/components/ch-button.js +1 -1
  118. package/dist/components/ch-card.js +1 -1
  119. package/dist/components/ch-checkbox.js +1 -1
  120. package/dist/components/ch-cluster.js +1 -1
  121. package/dist/components/ch-confirm-dialog.d.ts +11 -0
  122. package/dist/components/ch-confirm-dialog.js +2 -0
  123. package/dist/components/ch-confirm-dialog.js.map +1 -0
  124. package/dist/components/ch-description-list.js +1 -1
  125. package/dist/components/ch-divider.js +1 -1
  126. package/dist/components/ch-drawer.js +1 -1
  127. package/dist/components/ch-emoji.js +1 -1
  128. package/dist/components/ch-empty-state.js +1 -1
  129. package/dist/components/ch-grid.js +1 -1
  130. package/dist/components/ch-icon-button.js +1 -1
  131. package/dist/components/ch-icon.js +1 -1
  132. package/dist/components/ch-input.js +1 -1
  133. package/dist/components/ch-modal.js +1 -1
  134. package/dist/components/ch-modal.js.map +1 -1
  135. package/dist/components/ch-number-input.js +1 -1
  136. package/dist/components/ch-otp-input.d.ts +11 -0
  137. package/dist/components/ch-otp-input.js +2 -0
  138. package/dist/components/ch-otp-input.js.map +1 -0
  139. package/dist/components/ch-page-header.js +1 -1
  140. package/dist/components/ch-pagination.d.ts +11 -0
  141. package/dist/components/ch-pagination.js +2 -0
  142. package/dist/components/ch-pagination.js.map +1 -0
  143. package/dist/components/ch-radio.js +1 -1
  144. package/dist/components/ch-segmented-control.js +1 -1
  145. package/dist/components/ch-select.js +1 -1
  146. package/dist/components/ch-skeleton.js +1 -1
  147. package/dist/components/ch-spinner.js +1 -1
  148. package/dist/components/ch-stack.js +1 -1
  149. package/dist/components/ch-stat.js +1 -1
  150. package/dist/components/ch-switch.js +1 -1
  151. package/dist/components/ch-table.js +1 -1
  152. package/dist/components/ch-tabs.js +1 -1
  153. package/dist/components/ch-textarea.js +1 -1
  154. package/dist/components/ch-timeline.js +1 -1
  155. package/dist/components/ch-tooltip.js +1 -1
  156. package/dist/components/{p-DiUN1WGc.js → p-CF1yV0aa.js} +2 -2
  157. package/dist/components/p-CmMN-UuJ.js +2 -0
  158. package/dist/components/p-CmMN-UuJ.js.map +1 -0
  159. package/dist/components/p-qP_9qshx.js.map +1 -1
  160. package/dist/esm/ch-accordion.entry.js +2 -2
  161. package/dist/esm/ch-alert_8.entry.js +8 -8
  162. package/dist/esm/ch-checkbox.entry.js +2 -2
  163. package/dist/esm/ch-cluster.entry.js +3 -3
  164. package/dist/esm/ch-confirm-dialog.entry.js +136 -0
  165. package/dist/esm/ch-confirm-dialog.entry.js.map +1 -0
  166. package/dist/esm/ch-description-list.entry.js +2 -2
  167. package/dist/esm/ch-divider.entry.js +2 -2
  168. package/dist/esm/ch-drawer.entry.js +2 -2
  169. package/dist/esm/ch-emoji.entry.js +2 -2
  170. package/dist/esm/ch-empty-state.entry.js +2 -2
  171. package/dist/esm/ch-grid.entry.js +2 -2
  172. package/dist/esm/ch-icon-button.entry.js +2 -2
  173. package/dist/esm/ch-icon.entry.js +2 -2
  174. package/dist/esm/ch-link.entry.js +1 -1
  175. package/dist/esm/ch-modal.entry.js +2 -2
  176. package/dist/esm/ch-number-input.entry.js +3 -3
  177. package/dist/esm/ch-otp-input.entry.js +194 -0
  178. package/dist/esm/ch-otp-input.entry.js.map +1 -0
  179. package/dist/esm/ch-page-header.entry.js +2 -2
  180. package/dist/esm/ch-pagination.entry.js +65 -0
  181. package/dist/esm/ch-pagination.entry.js.map +1 -0
  182. package/dist/esm/ch-radio.entry.js +2 -2
  183. package/dist/esm/ch-segmented-control.entry.js +2 -2
  184. package/dist/esm/ch-skeleton.entry.js +2 -2
  185. package/dist/esm/ch-stack.entry.js +2 -2
  186. package/dist/esm/ch-stat.entry.js +3 -3
  187. package/dist/esm/ch-table.entry.js +2 -2
  188. package/dist/esm/ch-tabs.entry.js +2 -2
  189. package/dist/esm/ch-textarea.entry.js +2 -2
  190. package/dist/esm/ch-timeline.entry.js +2 -2
  191. package/dist/esm/ch-tooltip.entry.js +3 -3
  192. package/dist/esm/chucao.js +3 -3
  193. package/dist/esm/{index-CIV5Gg1o.js → index-8l_6qAY9.js} +19 -2
  194. package/dist/esm/index-8l_6qAY9.js.map +1 -0
  195. package/dist/esm/loader.js +3 -3
  196. package/dist/types/components/ch-confirm-dialog/ch-confirm-dialog.d.ts +81 -0
  197. package/dist/types/components/ch-otp-input/ch-otp-input.d.ts +79 -0
  198. package/dist/types/components/ch-pagination/ch-pagination.d.ts +44 -0
  199. package/dist/types/components.d.ts +548 -0
  200. package/dist-react/components.d.ts +21 -1
  201. package/dist-react/components.js +33 -0
  202. package/dist-react/components.ts +49 -1
  203. package/dist-vue/index.d.ts +3 -0
  204. package/dist-vue/index.js +48 -0
  205. package/dist-vue/index.ts +54 -0
  206. package/hydrate/index.js +518 -35
  207. package/hydrate/index.mjs +518 -35
  208. package/package.json +13 -1
  209. package/dist/chucao/p-60e1c1df.entry.js +0 -2
  210. package/dist/chucao/p-CIV5Gg1o.js.map +0 -1
  211. package/dist/cjs/index-ByZY6aTj.js.map +0 -1
  212. package/dist/esm/index-CIV5Gg1o.js.map +0 -1
  213. /package/dist/chucao/{p-deb2571b.entry.js.map → p-0831c6f2.entry.js.map} +0 -0
  214. /package/dist/chucao/{p-42028c97.entry.js.map → p-19d90f87.entry.js.map} +0 -0
  215. /package/dist/chucao/{p-1b70e3f1.entry.js.map → p-25f4f815.entry.js.map} +0 -0
  216. /package/dist/chucao/{p-472ec451.entry.js.map → p-3e0d7585.entry.js.map} +0 -0
  217. /package/dist/chucao/{p-f917d34f.entry.js.map → p-46dae34b.entry.js.map} +0 -0
  218. /package/dist/chucao/{p-01b6c7bf.entry.js.map → p-5093c486.entry.js.map} +0 -0
  219. /package/dist/chucao/{p-337d7f68.entry.js.map → p-51f6327c.entry.js.map} +0 -0
  220. /package/dist/chucao/{p-ffecdf25.entry.js.map → p-5577e0a0.entry.js.map} +0 -0
  221. /package/dist/chucao/{p-15d27bb7.entry.js.map → p-56e41372.entry.js.map} +0 -0
  222. /package/dist/chucao/{p-9ebcc7be.entry.js.map → p-6c2e5931.entry.js.map} +0 -0
  223. /package/dist/chucao/{p-f6ab0a11.entry.js.map → p-6e93c392.entry.js.map} +0 -0
  224. /package/dist/chucao/{p-9db118d9.entry.js.map → p-7f99ae48.entry.js.map} +0 -0
  225. /package/dist/chucao/{p-7cdc71cc.entry.js.map → p-8fcf6d36.entry.js.map} +0 -0
  226. /package/dist/chucao/{p-1e4cd3aa.entry.js.map → p-920d5727.entry.js.map} +0 -0
  227. /package/dist/chucao/{p-c90da3c0.entry.js.map → p-ad41da02.entry.js.map} +0 -0
  228. /package/dist/chucao/{p-d8b71751.entry.js.map → p-b42ec9bf.entry.js.map} +0 -0
  229. /package/dist/chucao/{p-2e37c61b.entry.js.map → p-b80c39c3.entry.js.map} +0 -0
  230. /package/dist/chucao/{p-a7c674b7.entry.js.map → p-ba589c2f.entry.js.map} +0 -0
  231. /package/dist/chucao/{p-0c7f6f8d.entry.js.map → p-c4d68ab7.entry.js.map} +0 -0
  232. /package/dist/chucao/{p-90284ebe.entry.js.map → p-c98e2a50.entry.js.map} +0 -0
  233. /package/dist/chucao/{p-8ae680a4.entry.js.map → p-ca3179ae.entry.js.map} +0 -0
  234. /package/dist/chucao/{p-5240f5ac.entry.js.map → p-d630f662.entry.js.map} +0 -0
  235. /package/dist/chucao/{p-c4b2bd1f.entry.js.map → p-d868bdbc.entry.js.map} +0 -0
  236. /package/dist/chucao/{p-e77d35c3.entry.js.map → p-e6b7b2da.entry.js.map} +0 -0
  237. /package/dist/chucao/{p-10f6801e.entry.js.map → p-f0c288db.entry.js.map} +0 -0
  238. /package/dist/components/{p-DiUN1WGc.js.map → p-CF1yV0aa.js.map} +0 -0
@@ -0,0 +1,138 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C6khqyw3.js');
4
+
5
+ const chConfirmDialogCss = () => `: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)}`;
6
+
7
+ const ChConfirmDialog = class {
8
+ constructor(hostRef) {
9
+ index.registerInstance(this, hostRef);
10
+ this.chConfirm = index.createEvent(this, "chConfirm");
11
+ this.chCancel = index.createEvent(this, "chCancel");
12
+ }
13
+ get el() { return index.getElement(this); }
14
+ /** Whether the dialog is open. Kept in sync when it is dismissed. */
15
+ open = false;
16
+ /**
17
+ * The question, set as the dialog's accessible name. Required: a dialog
18
+ * without a name is announced as an unlabelled group.
19
+ */
20
+ heading;
21
+ /** Supporting text, rendered under the heading. */
22
+ message;
23
+ /** Label of the confirming action. */
24
+ confirmLabel = 'Confirm';
25
+ /** Label of the dismissing action. */
26
+ cancelLabel = 'Cancel';
27
+ /**
28
+ * `danger` styles the confirm action as destructive and moves the initial
29
+ * focus to Cancel, so the safe choice is the default one.
30
+ */
31
+ tone = 'default';
32
+ /** Whether the confirm action is in flight; both buttons are then disabled. */
33
+ pending = false;
34
+ /**
35
+ * Whether Escape and the backdrop dismiss the dialog. When false, the only
36
+ * way out is one of the two buttons — use it only for a decision that must
37
+ * be answered rather than abandoned.
38
+ */
39
+ dismissible = true;
40
+ /** Emitted once when the user confirms. */
41
+ chConfirm;
42
+ /** Emitted once when the dialog is dismissed without confirming. */
43
+ chCancel;
44
+ /** `true` once an outcome has been emitted for the current opening. */
45
+ settled = false;
46
+ cancelButton;
47
+ confirmButton;
48
+ componentDidLoad() {
49
+ if (this.open) {
50
+ this.onOpening();
51
+ }
52
+ }
53
+ handleOpenChange(open) {
54
+ if (open) {
55
+ this.onOpening();
56
+ return;
57
+ }
58
+ this.settled = false;
59
+ }
60
+ onOpening() {
61
+ this.settled = false;
62
+ // Focus is moved once the dialog is actually shown; the modal handles
63
+ // moving focus into itself, and this refines where it lands.
64
+ requestAnimationFrame(() => {
65
+ const target = this.tone === 'danger' ? this.cancelButton : this.confirmButton;
66
+ target?.focus();
67
+ });
68
+ }
69
+ settle(outcome) {
70
+ if (this.settled) {
71
+ return;
72
+ }
73
+ this.settled = true;
74
+ if (outcome === 'confirm') {
75
+ this.chConfirm.emit();
76
+ return;
77
+ }
78
+ this.chCancel.emit();
79
+ }
80
+ handleConfirm = () => {
81
+ if (this.pending) {
82
+ return;
83
+ }
84
+ this.settle('confirm');
85
+ };
86
+ handleCancel = () => {
87
+ if (this.pending) {
88
+ return;
89
+ }
90
+ this.open = false;
91
+ this.settle('cancel');
92
+ };
93
+ /**
94
+ * `ch-modal` reports every close that was not requested by the consumer —
95
+ * Escape and the backdrop. A close while `pending` is the consumer's own
96
+ * doing and is not a cancellation.
97
+ */
98
+ handleModalClose = () => {
99
+ this.open = false;
100
+ if (this.pending) {
101
+ return;
102
+ }
103
+ this.settle('cancel');
104
+ };
105
+ /**
106
+ * Escape is a platform close request on the inner `<dialog>`, so a
107
+ * non-dismissible dialog cancels it before it takes effect. The backdrop is
108
+ * handled by `ch-modal` and is suppressed the same way.
109
+ */
110
+ handleKeyDown = (event) => {
111
+ if (this.dismissible || event.key !== 'Escape') {
112
+ return;
113
+ }
114
+ event.preventDefault();
115
+ event.stopPropagation();
116
+ };
117
+ /**
118
+ * Focus the safe action. Exposed so a consumer can return focus deliberately
119
+ * after a request settles.
120
+ */
121
+ async focusCancel() {
122
+ this.cancelButton?.focus();
123
+ }
124
+ render() {
125
+ return (index.h(index.Host, { key: '7aa8fd72a281369f47ce7f1eb99c52ab60ba4ee0', onKeyDown: this.handleKeyDown }, index.h("ch-modal", { key: '019663f042f5c2ce3dd1f58433faee170c01e8e6', open: this.open, label: this.heading, size: "sm", onChClose: this.handleModalClose, onChOpen: () => this.onOpening() }, index.h("h2", { key: '9d97f437e535a3a9feb181e9807dc9c532efd872', slot: "heading", class: "confirm__heading" }, this.heading), this.message && index.h("p", { key: 'a0d64b2b915624473162557972eabdf80b445d58', class: "confirm__message" }, this.message), index.h("div", { key: '0b44308d6eb7a4aea2c1166f8a7f6f19c41cdbb7', class: "confirm__actions" }, index.h("button", { key: '7908d0db96e7c59c7b4673220aa62c2170b29d54', class: { 'confirm__button': true, 'confirm__button--cancel': true }, type: "button", ref: el => (this.cancelButton = el), disabled: this.pending, onClick: this.handleCancel }, this.cancelLabel), index.h("button", { key: '43657105b474b303160da19e1fa5fda47f63207c', 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)))));
126
+ }
127
+ static get watchers() { return {
128
+ "open": [{
129
+ "handleOpenChange": 0
130
+ }]
131
+ }; }
132
+ };
133
+ ChConfirmDialog.style = chConfirmDialogCss();
134
+
135
+ exports.ch_confirm_dialog = ChConfirmDialog;
136
+ //# sourceMappingURL=ch-confirm-dialog.entry.cjs.js.map
137
+
138
+ //# sourceMappingURL=ch-confirm-dialog.cjs.entry.js.map
@@ -0,0 +1 @@
1
+ {"file":"ch-confirm-dialog.cjs.entry.js","mappings":"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","names":["h","Host"],"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"],"version":3}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
 
5
5
  const chDescriptionListCss = () => `: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}`;
6
6
 
@@ -18,7 +18,7 @@ const ChDescriptionList = class {
18
18
  return COLUMNS.has(this.columns) ? this.columns : '1';
19
19
  }
20
20
  render() {
21
- return (index.h(index.Host, { key: '2f349aa14dc442e4e531dacc2d9f6b02fc2b141a' }, index.h("dl", { key: 'de4bf1b60c31f0319bc5e169304134c8e0046912', class: `list list--columns-${this.columnCount}` }, index.h("slot", { key: '4ef568fa3e64048ba6e586ae9e8d10c21ad326aa' }))));
21
+ return (index.h(index.Host, { key: '590fc24614ba9240d7708cff6cb6027eca5904bf' }, index.h("dl", { key: '868ee275cd6c792bff933c2429fe23985b9c30e3', class: `list list--columns-${this.columnCount}` }, index.h("slot", { key: '7433fcda6f0e6b2c738c790839169669c31bd266' }))));
22
22
  }
23
23
  };
24
24
  ChDescriptionList.style = chDescriptionListCss();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
 
5
5
  const chDividerCss = () => `: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%}`;
6
6
 
@@ -13,7 +13,7 @@ const ChDivider = class {
13
13
  */
14
14
  orientation = 'horizontal';
15
15
  render() {
16
- return (index.h(index.Host, { key: '0ae19c8f91c810836781f7dac098b49b99c01389', class: { 'divider--vertical': this.orientation === 'vertical' } }, index.h("hr", { key: 'f5b782f7d67da28ec659fceef32ebf0f4d8ca521', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
16
+ return (index.h(index.Host, { key: '068a29854d312d17f5f5b768975996e1b8db9317', class: { 'divider--vertical': this.orientation === 'vertical' } }, index.h("hr", { key: 'c2dca357f717b822caa028fae4c1d5e4709ae75c', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
17
17
  }
18
18
  };
19
19
  ChDivider.style = chDividerCss();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
  var scrollLock = require('./scroll-lock-DIRqLP4K.js');
5
5
 
6
6
  const chDrawerCss = () => `.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}}`;
@@ -138,7 +138,7 @@ const ChDrawer = class {
138
138
  this.chClose.emit();
139
139
  };
140
140
  render() {
141
- return (index.h(index.Host, { key: '871af03f0944e4272be64c1452cc28a0a39ac0f2' }, index.h("dialog", { key: '540da9d2bff68d5528e65146b2a049adbc9723c2', class: { drawer: true, [`drawer--${this.side}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, index.h("div", { key: 'de569a4d239dd5e2bf6b2741b77307eb70ddced1', class: "drawer-head" }, index.h("slot", { key: 'e28ade42e0835a919aa5447dafbbbfff2de903d7', name: "header" }), this.closeLabel && (index.h("button", { key: '5cf29d8b791652fce663459f479826564637d6ca', class: "drawer-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, index.h("span", { key: '06a24d8b140db10b9d543530ea5dfbd8dd991019', "aria-hidden": "true" }, "\u00D7")))), index.h("div", { key: 'b593bac5fb45234d501d3ec540f00d804ae5e066', class: "drawer-body" }, index.h("slot", { key: '854cb053b30234aa31d59fcf27bb7d2820311eb3' })), index.h("slot", { key: '5c1fb51d3636af1762b26d72f5eaa79c5f779a60', name: "footer" }))));
141
+ return (index.h(index.Host, { key: 'f20d997fbaec9bcb5a4435c53bc893513e07bf05' }, index.h("dialog", { key: '216248a651d9fbd61c659da772cb2c1cd9cdb029', class: { drawer: true, [`drawer--${this.side}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, index.h("div", { key: '2d0f9c5a66ae0f609185479722236bfa35fc15ff', class: "drawer-head" }, index.h("slot", { key: '3e3fc15109e4e463cfcff4a96cffd943a0c48f3d', name: "header" }), this.closeLabel && (index.h("button", { key: 'a6e3b3d7ab9955cb9e84405c3313c85389bb1b5a', class: "drawer-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, index.h("span", { key: '2dcb7632e635f763c0973cdb4fb7fe8dfa09fd4b', "aria-hidden": "true" }, "\u00D7")))), index.h("div", { key: '0a73837b9dcae4d31d7abb4cec14d93a9bbdec4a', class: "drawer-body" }, index.h("slot", { key: 'f9786b2da1062eeb7d7019b849508eb3a5fc83b7' })), index.h("slot", { key: '85e518742d2c5435ce50c52100d24576caae9a8b', name: "footer" }))));
142
142
  }
143
143
  static get watchers() { return {
144
144
  "open": [{
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
 
5
5
  const aaaa = "aaaa";
6
6
  const ameno = "ameno";
@@ -84,7 +84,7 @@ const ChEmoji = class {
84
84
  this.loaded = true;
85
85
  };
86
86
  render() {
87
- return (index.h(index.Host, { key: '8444f71f1c84fd8b1940503c5e7bf5ff62bbb9e6' }, index.h("img", { key: 'ce9c083238c87557f71838ab8de50038fc43a2bd', class: {
87
+ return (index.h(index.Host, { key: 'fd0f1f45a986a2668adb3cda893e4f6666f78eeb' }, index.h("img", { key: '207a6d2d6111fd13d724e4f3ce5dcc1d299f1228', class: {
88
88
  'emoji': true,
89
89
  [`emoji--${this.size}`]: true,
90
90
  'emoji--hidden': !this.loaded,
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
 
5
5
  const chEmptyStateCss = () => `: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)}`;
6
6
 
@@ -23,7 +23,7 @@ const ChEmptyState = class {
23
23
  */
24
24
  size = 'md';
25
25
  render() {
26
- return (index.h(index.Host, { key: '8ed0e4e1712c415ccc38050011af09c778a6bb48', class: { 'empty-state': true, [`empty-state--${this.size}`]: true } }, index.h("div", { key: '63a6dd1e1678c48da81af7e89dc90fd2288fdbfa', class: "empty-state__inner" }, index.h("div", { key: '3753c28a9268eff9ebb936f3b8f9d4257e63ca41', class: "empty-state__icon", "aria-hidden": "true" }, index.h("slot", { key: 'abc7a5a2b84d7d4d5be3cd5dcfa3da217e480a4f', name: "icon" })), index.h("h3", { key: 'c6be0381802f307f35ea81a58fe8571d0799b97a', class: "empty-state__title" }, this.title), this.description && index.h("p", { key: 'e8c953d3ed017ed9fd06c572a7d601217be317e3', class: "empty-state__description" }, this.description), index.h("div", { key: 'da062b6ceabc34cced61ed900f09025a83f401f4', class: "empty-state__actions" }, index.h("slot", { key: '18930706af315dfbb2da7a492c79d3a468be3574' })))));
26
+ return (index.h(index.Host, { key: 'ad3644cfbad791e9684b20b9776c8c68d15036e2', class: { 'empty-state': true, [`empty-state--${this.size}`]: true } }, index.h("div", { key: '88479d9470be1db6d4d9968ad656297f06a2526c', class: "empty-state__inner" }, index.h("div", { key: '07b46c4f6e086921367b466df1b40eb3f49aeeac', class: "empty-state__icon", "aria-hidden": "true" }, index.h("slot", { key: 'f2b769787d5b2aaa04493157f39e20c164df2322', name: "icon" })), index.h("h3", { key: '83131b17b5dac383141f2997ac2dfdde2b620d16', class: "empty-state__title" }, this.title), this.description && index.h("p", { key: 'ca76152650118f55229ebac53c2963cb84982e77', class: "empty-state__description" }, this.description), index.h("div", { key: '552f1319198b0c182cace7956e84ddc9e837043e', class: "empty-state__actions" }, index.h("slot", { key: 'b99db3bfac784acf8389f100362371c3a44f4ace' })))));
27
27
  }
28
28
  };
29
29
  ChEmptyState.style = chEmptyStateCss();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
 
5
5
  const chGridCss = () => `: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)}`;
6
6
 
@@ -48,7 +48,7 @@ const ChGrid = class {
48
48
  this.el.style.setProperty('--ch-grid-columns', template);
49
49
  }
50
50
  render() {
51
- return (index.h(index.Host, { key: 'de6c2d15da9a5d735327df077c6b58abe9775267', class: { grid: true, [`grid--gap-${this.gapStep}`]: true } }, index.h("slot", { key: '348289bcf2f46fb07e7392afa00c4619d6614fef' })));
51
+ return (index.h(index.Host, { key: '7e22752629d6e8dae0dd6ae05eb12aba96c97fc2', class: { grid: true, [`grid--gap-${this.gapStep}`]: true } }, index.h("slot", { key: 'dc7286fa1b34610aa802afc7298422147d936cbd' })));
52
52
  }
53
53
  };
54
54
  ChGrid.style = chGridCss();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
  var icons = require('./icons-CNyDgV-q.js');
5
5
 
6
6
  const chIconButtonCss = () => `: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}}`;
@@ -40,7 +40,7 @@ const ChIconButton = class {
40
40
  };
41
41
  render() {
42
42
  const shapes = this.name ? icons.chIcons[this.name] : undefined;
43
- return (index.h(index.Host, { key: 'cdef3ba2a7577cb7119aa943138746905de21dbb' }, index.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 }, index.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 => index.h(shape.tag, shape.attrs))))));
43
+ return (index.h(index.Host, { key: 'eb744fa706b32c5ffca8b174f5cfc5e5cb546879' }, index.h("button", { key: 'a0923d38dc46adce13ae3d8e12426a419fe37c4a', 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 }, index.h("svg", { key: 'db67ffae9402ea67849f8b4aa487bf3fb152da63', 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 => index.h(shape.tag, shape.attrs))))));
44
44
  }
45
45
  };
46
46
  ChIconButton.style = chIconButtonCss();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
  var icons = require('./icons-CNyDgV-q.js');
5
5
 
6
6
  const chIconCss = () => `: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)}`;
@@ -27,7 +27,7 @@ const ChIcon = class {
27
27
  render() {
28
28
  const shapes = this.name ? icons.chIcons[this.name] : undefined;
29
29
  const decorative = !this.label;
30
- return (index.h(index.Host, { key: 'f45fcd8a7f620f12942e3c1dd1c68a16009905ad' }, index.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 => index.h(shape.tag, shape.attrs)))));
30
+ return (index.h(index.Host, { key: '4d1ec8879f2715fa6973c1e06de4109f68f7b439' }, index.h("svg", { key: 'e2a72cd9a83a9672e04484f042801041f80a2b81', 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 => index.h(shape.tag, shape.attrs)))));
31
31
  }
32
32
  };
33
33
  ChIcon.style = chIconCss();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
 
5
5
  const chLinkCss = () => `:host{display:inline}.link{color:var(--accent);font-weight:var(--typography-weight-semibold);text-decoration:var(--ch-link-text-decoration, underline);text-decoration-thickness:var(--border-width);text-underline-offset:var(--spacing-shift);border-radius:var(--radius-sm);transition:color var(--duration-normal) var(--easing-default), opacity var(--duration-normal) var(--easing-default)}.link:hover{color:var(--accent-hover)}.link:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.link--muted{color:var(--text-muted);text-decoration:none}.link--muted:hover{color:var(--text)}.link--disabled{color:var(--text-muted);text-decoration:none;opacity:var(--opacity-disabled);cursor:not-allowed}`;
6
6
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
  var scrollLock = require('./scroll-lock-DIRqLP4K.js');
5
5
 
6
6
  const chModalCss = () => `.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}}`;
@@ -140,7 +140,7 @@ const ChModal = class {
140
140
  this.chClose.emit();
141
141
  };
142
142
  render() {
143
- return (index.h(index.Host, { key: 'b0fced593159cc6e6952831f9460cce1efd532d4' }, index.h("dialog", { key: '81180fe5cdd62df43f5aa35a8358b4e86cc8dc40', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, index.h("div", { key: '4c13adb1131ee26978f607b86e7eb8a9e65ce3a7', class: "modal-head" }, index.h("slot", { key: '4cb35bd7f0c290ef0c7aec5df60a839f8c383e66', name: "heading" }), this.closeLabel && (index.h("button", { key: 'f967cf89873760e1156081a77402d12252cbc20d', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, index.h("span", { key: '719e26b74726be28f50587dca769c257db3ecdec', "aria-hidden": "true" }, "\u00D7")))), index.h("div", { key: 'b6a44ef698e580031aa9efa5b5a177c9c1218488', class: "modal-body" }, index.h("slot", { key: '27c107491182196ee3ea3aa8d6746da0a9be40a6' })))));
143
+ return (index.h(index.Host, { key: 'e9b0fe7e84f3de036e01f836bb431849b4486ab3' }, index.h("dialog", { key: '0c5017b5e773534c11a74504a0773ae555b32322', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, index.h("div", { key: 'ae8988208ac3856792eff026e8ebd1f9e696b175', class: "modal-head" }, index.h("slot", { key: 'f7f231f4a5b8541ce2da8ea000b5ce95d58484b3', name: "heading" }), this.closeLabel && (index.h("button", { key: 'dbf0962e6244cff373887fa1e1501aaae6e15250', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, index.h("span", { key: 'e7e1493a5eca9afb0f9fef279efdd5692157755a', "aria-hidden": "true" }, "\u00D7")))), index.h("div", { key: '95b719095bac72ce64e6201ef4465c1173dfb16f', class: "modal-body" }, index.h("slot", { key: 'bad31888a31219e6dffd294ca18a749e9916c0f2' })))));
144
144
  }
145
145
  static get watchers() { return {
146
146
  "open": [{
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-ByZY6aTj.js');
3
+ var index = require('./index-C6khqyw3.js');
4
4
  var validationMessage = require('./validation-message-bbtJ2sa_.js');
5
5
 
6
6
  const chNumberInputCss = () => `: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)}`;
@@ -205,10 +205,10 @@ const ChNumberInput = class {
205
205
  }
206
206
  render() {
207
207
  const showError = this.isInvalid && this.errorMessage;
208
- return (index.h(index.Host, { key: '1c424d9d76ec39e6cc6018d6ba483f95bd203d32' }, this.label && (index.h("label", { key: '4fc03334128c33cc425da773df063cd99fee215c', class: "label", htmlFor: this.inputId }, this.label)), index.h("input", { key: 'ece15737f83c181d615e906aba5cce80c0bcb8ba', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid },
208
+ return (index.h(index.Host, { key: 'cf109ceb6d832f6c9dcedd666beee69fb4e434f6' }, this.label && (index.h("label", { key: 'cc6bb3e172738febaf91777499bd8f9c9e6c9701', class: "label", htmlFor: this.inputId }, this.label)), index.h("input", { key: '44f4199e9d18f4dd3600183f2a4ba4e451013bc6', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid },
209
209
  // `text` with `inputmode`, not `type="number"`: a number input drops
210
210
  // partial values and cannot show grouped digits.
211
- 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 && (index.h("p", { key: '7a2e3031b8bfebf26857dd60eb18340f21a01f3d', class: "hint", id: this.hintId }, this.hint)), showError && (index.h("p", { key: 'f90492532d27088f18b258f885d5d471f31d27cb', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
211
+ 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 && (index.h("p", { key: '30c755eee77a4fce6c04350e61ffa084a33a085d', class: "hint", id: this.hintId }, this.hint)), showError && (index.h("p", { key: '3bd96e7dae46ba2a16b23db0d7d1d528590468c9', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
212
212
  }
213
213
  static get formAssociated() { return true; }
214
214
  static get watchers() { return {
@@ -0,0 +1,196 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C6khqyw3.js');
4
+ var validationMessage = require('./validation-message-bbtJ2sa_.js');
5
+
6
+ const chOtpInputCss = () => `: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}`;
7
+
8
+ let otpIds = 0;
9
+ const ChOtpInput = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.chInput = index.createEvent(this, "chInput");
13
+ this.chComplete = index.createEvent(this, "chComplete");
14
+ if (hostRef.$hostElement$["s-ei"]) {
15
+ this.internals = hostRef.$hostElement$["s-ei"];
16
+ }
17
+ else {
18
+ this.internals = hostRef.$hostElement$.attachInternals();
19
+ hostRef.$hostElement$["s-ei"] = this.internals;
20
+ }
21
+ }
22
+ inputId = `ch-otp-input-${++otpIds}`;
23
+ hintId = `${this.inputId}-hint`;
24
+ errorId = `${this.inputId}-error`;
25
+ initialValue = '';
26
+ internals;
27
+ formDisabled = false;
28
+ get host() { return index.getElement(this); }
29
+ /** Visible label, associated with the input via `for`/`id`. */
30
+ label;
31
+ /** The code without separators. Filtered to alphanumerics on every change. */
32
+ value = '';
33
+ /** How many characters make a complete code. */
34
+ length = 6;
35
+ /**
36
+ * `numeric` restricts input to digits, which is the shape of nearly every
37
+ * one-time code and lets a phone open the number pad.
38
+ */
39
+ inputMode = 'numeric';
40
+ /** Whether the codes are masked, as for a short-lived secret. */
41
+ secret = false;
42
+ /** Placeholder shown when empty. */
43
+ placeholder;
44
+ /** Name submitted with the form. */
45
+ name;
46
+ /** Whether the field is disabled. */
47
+ disabled = false;
48
+ /** Whether a complete code is required for the field to be valid. */
49
+ required = false;
50
+ /** Helper text, replaced by `errorMessage` when invalid. */
51
+ hint;
52
+ /** Custom error message; wins over the built-in incomplete-code message. */
53
+ errorMessage;
54
+ /** Whether the field is marked invalid by the consumer. */
55
+ invalid = false;
56
+ /** Emitted on every change with the current (possibly partial) code. */
57
+ chInput;
58
+ /**
59
+ * Emitted once, when the code becomes complete and valid after not being so.
60
+ * Never fires again while it stays complete, so holding a code cannot
61
+ * resubmit it.
62
+ */
63
+ chComplete;
64
+ wasComplete = false;
65
+ componentDidLoad() {
66
+ this.initialValue = this.value;
67
+ this.wasComplete = this.isComplete;
68
+ this.syncForm();
69
+ this.host.addEventListener('focusout', this.markTouched);
70
+ this.host.addEventListener('invalid', this.markTouched);
71
+ }
72
+ /**
73
+ * Leaving the field is what turns an unfinished code into an error. The
74
+ * validity has to be recomputed here: `syncForm` reads the attribute, and
75
+ * setting it alone would not update `ElementInternals`.
76
+ */
77
+ markTouched = () => {
78
+ this.host.setAttribute('data-touched', '');
79
+ this.syncForm();
80
+ };
81
+ /** Whether the value is a complete, correctly shaped code. */
82
+ get isComplete() {
83
+ if (this.value.length !== this.length) {
84
+ return false;
85
+ }
86
+ return this.inputMode === 'numeric' ? /^\d+$/u.test(this.value) : /^[a-z0-9]+$/iu.test(this.value);
87
+ }
88
+ /** The message for an incomplete code, which is what makes it invalid. */
89
+ get incompleteMessage() {
90
+ if (this.errorMessage || this.invalid || this.value === '') {
91
+ return undefined;
92
+ }
93
+ return this.isComplete ? undefined : `Enter the ${this.length}-character code.`;
94
+ }
95
+ syncForm() {
96
+ const internals = this.internals;
97
+ if (typeof internals?.setFormValue !== 'function') {
98
+ return;
99
+ }
100
+ internals.setFormValue(this.value);
101
+ const empty = this.value === '';
102
+ const base = validationMessage.resolveValidity({ required: this.required, empty, invalid: this.invalid, errorMessage: this.errorMessage });
103
+ // A partially typed code is what the user is doing, not an error, unless
104
+ // they have already left the field once.
105
+ const touched = this.host.hasAttribute('data-touched');
106
+ const incomplete = this.incompleteMessage;
107
+ if (incomplete && touched && !empty) {
108
+ internals.setValidity({ ...base.flags, customError: true }, incomplete);
109
+ return;
110
+ }
111
+ internals.setValidity(base.flags, base.message);
112
+ }
113
+ formResetCallback() {
114
+ this.value = this.initialValue;
115
+ this.wasComplete = this.isComplete;
116
+ this.syncForm();
117
+ const input = this.host.shadowRoot?.querySelector('input');
118
+ if (input) {
119
+ input.value = this.value;
120
+ }
121
+ }
122
+ formDisabledCallback(isDisabled) {
123
+ this.formDisabled = isDisabled;
124
+ }
125
+ /** Strips everything the input mode does not allow, then caps the length. */
126
+ sanitize(raw) {
127
+ const allowed = this.inputMode === 'numeric' ? raw.replace(/\D/gu, '') : raw.replace(/[^a-z0-9]/giu, '');
128
+ return allowed.slice(0, Math.max(1, this.length));
129
+ }
130
+ handleInput = (ev) => {
131
+ const input = ev.target;
132
+ const clean = this.sanitize(input.value);
133
+ // The element holds the raw text, so a rejected character has to be
134
+ // written back or it stays visible while the value says otherwise.
135
+ if (input.value !== clean) {
136
+ input.value = clean;
137
+ }
138
+ this.value = clean;
139
+ this.chInput.emit(clean);
140
+ const complete = this.isComplete;
141
+ if (complete && !this.wasComplete) {
142
+ this.chComplete.emit(clean);
143
+ }
144
+ this.wasComplete = complete;
145
+ this.syncForm();
146
+ };
147
+ handleBlur = () => {
148
+ this.syncForm();
149
+ };
150
+ get isInvalid() {
151
+ return this.invalid || (this.host.hasAttribute('data-touched') && this.incompleteMessage !== undefined);
152
+ }
153
+ get describedBy() {
154
+ if (this.isInvalid && this.errorMessage) {
155
+ return this.errorId;
156
+ }
157
+ if (this.hint) {
158
+ return this.hintId;
159
+ }
160
+ return undefined;
161
+ }
162
+ render() {
163
+ const showError = this.isInvalid && this.errorMessage;
164
+ return (index.h(index.Host, { key: 'addfb3ad7a6a5fabefe89dd5cde1d4e5b79d7c7c' }, this.label && (index.h("label", { key: 'e2ad53ac281a2334712d04ff6e09070616a38e7f', class: "label", htmlFor: this.inputId }, this.label)), index.h("input", { key: '4ea2123ba313a2626105346db50af219f5542de3', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid }, type: this.secret ? 'password' : 'text', inputMode: this.inputMode,
165
+ // The platform fills a single field carrying this attribute; per-digit
166
+ // inputs never receive the SMS code.
167
+ 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 && !showError && (index.h("p", { key: '6ecfc85e27b82b2afe94f66959e3f5cb99708189', class: "hint", id: this.hintId }, this.hint)), showError && (index.h("p", { key: '9b429bcea9bfb40c9583778dcdc4e8f64a84b552', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
168
+ }
169
+ static get formAssociated() { return true; }
170
+ static get watchers() { return {
171
+ "value": [{
172
+ "syncForm": 0
173
+ }],
174
+ "required": [{
175
+ "syncForm": 0
176
+ }],
177
+ "invalid": [{
178
+ "syncForm": 0
179
+ }],
180
+ "errorMessage": [{
181
+ "syncForm": 0
182
+ }],
183
+ "length": [{
184
+ "syncForm": 0
185
+ }],
186
+ "inputMode": [{
187
+ "syncForm": 0
188
+ }]
189
+ }; }
190
+ };
191
+ ChOtpInput.style = chOtpInputCss();
192
+
193
+ exports.ch_otp_input = ChOtpInput;
194
+ //# sourceMappingURL=ch-otp-input.entry.cjs.js.map
195
+
196
+ //# sourceMappingURL=ch-otp-input.cjs.entry.js.map