@devschile/chucao 2.0.0 → 2.2.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 (173) hide show
  1. package/README.md +2 -0
  2. package/dist/chucao/chucao.esm.js +1 -1
  3. package/dist/chucao/chucao.esm.js.map +1 -1
  4. package/dist/chucao/{p-a0ec231a.entry.js → p-04dbcfa0.entry.js} +2 -2
  5. package/dist/chucao/{p-96c852f5.entry.js → p-077dc2a6.entry.js} +2 -2
  6. package/dist/chucao/{p-19dde4f9.entry.js → p-079c2017.entry.js} +2 -2
  7. package/dist/chucao/p-37e7f9cc.entry.js +2 -0
  8. package/dist/chucao/p-37e7f9cc.entry.js.map +1 -0
  9. package/dist/chucao/{p-f04d2f75.entry.js → p-5ae89a19.entry.js} +2 -2
  10. package/dist/chucao/p-70285203.entry.js +2 -0
  11. package/dist/chucao/p-70285203.entry.js.map +1 -0
  12. package/dist/chucao/{p-2e20c7a1.entry.js → p-9c072600.entry.js} +2 -2
  13. package/dist/chucao/{p-BaKXvAYc.js → p-DWC12BJ-.js} +2 -2
  14. package/dist/chucao/p-DWC12BJ-.js.map +1 -0
  15. package/dist/chucao/p-b678a7e2.entry.js +2 -0
  16. package/dist/chucao/p-b678a7e2.entry.js.map +1 -0
  17. package/dist/chucao/p-b8bd0310.entry.js +2 -0
  18. package/dist/chucao/p-b8bd0310.entry.js.map +1 -0
  19. package/dist/chucao/p-bb2445d1.entry.js +2 -0
  20. package/dist/chucao/p-c986036f.entry.js +2 -0
  21. package/dist/chucao/p-c986036f.entry.js.map +1 -0
  22. package/dist/chucao/p-d8DfpzMR.js +2 -0
  23. package/dist/chucao/p-d8DfpzMR.js.map +1 -0
  24. package/dist/chucao/{p-10658dc9.entry.js → p-e3265e38.entry.js} +2 -2
  25. package/dist/chucao/{p-f62e1da2.entry.js → p-ff5f5c1f.entry.js} +2 -2
  26. package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
  27. package/dist/cjs/ch-alert_8.cjs.entry.js +55 -12
  28. package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -1
  29. package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
  30. package/dist/cjs/ch-divider.cjs.entry.js +2 -2
  31. package/dist/cjs/ch-drawer.cjs.entry.js +153 -0
  32. package/dist/cjs/ch-drawer.cjs.entry.js.map +1 -0
  33. package/dist/cjs/ch-emoji.cjs.entry.js +104 -0
  34. package/dist/cjs/ch-emoji.cjs.entry.js.map +1 -0
  35. package/dist/cjs/ch-link.cjs.entry.js +1 -1
  36. package/dist/cjs/ch-modal.cjs.entry.js +5 -24
  37. package/dist/cjs/ch-modal.cjs.entry.js.map +1 -1
  38. package/dist/cjs/ch-radio.cjs.entry.js +2 -2
  39. package/dist/cjs/ch-segmented-control.cjs.entry.js +112 -0
  40. package/dist/cjs/ch-segmented-control.cjs.entry.js.map +1 -0
  41. package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
  42. package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
  43. package/dist/cjs/ch-tooltip.cjs.entry.js +2 -2
  44. package/dist/cjs/chucao.cjs.js +3 -3
  45. package/dist/cjs/chucao.cjs.js.map +1 -1
  46. package/dist/cjs/{index-C9Abf0td.js → index-C9cpLteP.js} +15 -8
  47. package/dist/cjs/index-C9cpLteP.js.map +1 -0
  48. package/dist/cjs/loader.cjs.js +2 -2
  49. package/dist/cjs/scroll-lock-DIRqLP4K.js +49 -0
  50. package/dist/cjs/scroll-lock-DIRqLP4K.js.map +1 -0
  51. package/dist/collection/collection-manifest.json +4 -1
  52. package/dist/collection/components/ch-button/ch-button.css +56 -18
  53. package/dist/collection/components/ch-button/ch-button.js +135 -8
  54. package/dist/collection/components/ch-button/ch-button.js.map +1 -1
  55. package/dist/collection/components/ch-card/ch-card.js +1 -1
  56. package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
  57. package/dist/collection/components/ch-divider/ch-divider.js +1 -1
  58. package/dist/collection/components/ch-drawer/ch-drawer.css +152 -0
  59. package/dist/collection/components/ch-drawer/ch-drawer.js +285 -0
  60. package/dist/collection/components/ch-drawer/ch-drawer.js.map +1 -0
  61. package/dist/collection/components/ch-emoji/ch-emoji.css +33 -0
  62. package/dist/collection/components/ch-emoji/ch-emoji.js +151 -0
  63. package/dist/collection/components/ch-emoji/ch-emoji.js.map +1 -0
  64. package/dist/collection/components/ch-input/ch-input.js +1 -1
  65. package/dist/collection/components/ch-modal/ch-modal.js +4 -23
  66. package/dist/collection/components/ch-modal/ch-modal.js.map +1 -1
  67. package/dist/collection/components/ch-radio/ch-radio.js +1 -1
  68. package/dist/collection/components/ch-segmented-control/ch-segmented-control.css +88 -0
  69. package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +295 -0
  70. package/dist/collection/components/ch-segmented-control/ch-segmented-control.js.map +1 -0
  71. package/dist/collection/components/ch-select/ch-select.js +1 -1
  72. package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
  73. package/dist/collection/components/ch-switch/ch-switch.js +1 -1
  74. package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
  75. package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
  76. package/dist/collection/components/ch-tooltip/ch-tooltip.js +1 -1
  77. package/dist/collection/utils/scroll-lock.js +42 -0
  78. package/dist/collection/utils/scroll-lock.js.map +1 -0
  79. package/dist/components/ch-accordion.js +1 -1
  80. package/dist/components/ch-alert.js +1 -1
  81. package/dist/components/ch-badge.js +1 -1
  82. package/dist/components/ch-button.js +1 -1
  83. package/dist/components/ch-button.js.map +1 -1
  84. package/dist/components/ch-card.js +1 -1
  85. package/dist/components/ch-checkbox.js +1 -1
  86. package/dist/components/ch-divider.js +1 -1
  87. package/dist/components/ch-drawer.d.ts +11 -0
  88. package/dist/components/ch-drawer.js +2 -0
  89. package/dist/components/ch-drawer.js.map +1 -0
  90. package/dist/components/ch-emoji.d.ts +11 -0
  91. package/dist/components/ch-emoji.js +2 -0
  92. package/dist/components/ch-emoji.js.map +1 -0
  93. package/dist/components/ch-input.js +1 -1
  94. package/dist/components/ch-link.js +1 -1
  95. package/dist/components/ch-modal.js +1 -1
  96. package/dist/components/ch-modal.js.map +1 -1
  97. package/dist/components/ch-radio.js +1 -1
  98. package/dist/components/ch-segmented-control.d.ts +11 -0
  99. package/dist/components/ch-segmented-control.js +2 -0
  100. package/dist/components/ch-segmented-control.js.map +1 -0
  101. package/dist/components/ch-select.js +1 -1
  102. package/dist/components/ch-spinner.js +1 -1
  103. package/dist/components/ch-spinner.js.map +1 -1
  104. package/dist/components/ch-switch.js +1 -1
  105. package/dist/components/ch-tabs.js +1 -1
  106. package/dist/components/ch-textarea.js +1 -1
  107. package/dist/components/ch-tooltip.js +1 -1
  108. package/dist/components/index.js +1 -1
  109. package/dist/components/{p-DL-bL54o.js → p-BhAZrOxf.js} +2 -2
  110. package/dist/components/p-BhAZrOxf.js.map +1 -0
  111. package/dist/components/p-C4eGmLcE.js +2 -0
  112. package/dist/components/p-C4eGmLcE.js.map +1 -0
  113. package/dist/components/p-d8DfpzMR.js +2 -0
  114. package/dist/components/p-d8DfpzMR.js.map +1 -0
  115. package/dist/esm/ch-accordion.entry.js +1 -1
  116. package/dist/esm/ch-alert_8.entry.js +55 -12
  117. package/dist/esm/ch-alert_8.entry.js.map +1 -1
  118. package/dist/esm/ch-checkbox.entry.js +2 -2
  119. package/dist/esm/ch-divider.entry.js +2 -2
  120. package/dist/esm/ch-drawer.entry.js +151 -0
  121. package/dist/esm/ch-drawer.entry.js.map +1 -0
  122. package/dist/esm/ch-emoji.entry.js +102 -0
  123. package/dist/esm/ch-emoji.entry.js.map +1 -0
  124. package/dist/esm/ch-link.entry.js +1 -1
  125. package/dist/esm/ch-modal.entry.js +5 -24
  126. package/dist/esm/ch-modal.entry.js.map +1 -1
  127. package/dist/esm/ch-radio.entry.js +2 -2
  128. package/dist/esm/ch-segmented-control.entry.js +110 -0
  129. package/dist/esm/ch-segmented-control.entry.js.map +1 -0
  130. package/dist/esm/ch-tabs.entry.js +2 -2
  131. package/dist/esm/ch-textarea.entry.js +2 -2
  132. package/dist/esm/ch-tooltip.entry.js +2 -2
  133. package/dist/esm/chucao.js +4 -4
  134. package/dist/esm/chucao.js.map +1 -1
  135. package/dist/esm/{index-BaKXvAYc.js → index-DWC12BJ-.js} +15 -8
  136. package/dist/esm/index-DWC12BJ-.js.map +1 -0
  137. package/dist/esm/loader.js +3 -3
  138. package/dist/esm/scroll-lock-d8DfpzMR.js +46 -0
  139. package/dist/esm/scroll-lock-d8DfpzMR.js.map +1 -0
  140. package/dist/types/components/ch-button/ch-button.d.ts +29 -5
  141. package/dist/types/components/ch-drawer/ch-drawer.d.ts +68 -0
  142. package/dist/types/components/ch-emoji/ch-emoji.d.ts +32 -0
  143. package/dist/types/components/ch-segmented-control/ch-segmented-control.d.ts +72 -0
  144. package/dist/types/components.d.ts +405 -6
  145. package/dist/types/stencil-public-runtime.d.ts +1 -0
  146. package/dist/types/utils/scroll-lock.d.ts +17 -0
  147. package/dist-react/components.d.ts +15 -1
  148. package/dist-react/components.js +30 -0
  149. package/dist-react/components.ts +43 -1
  150. package/dist-vue/index.d.ts +3 -0
  151. package/dist-vue/index.js +35 -0
  152. package/dist-vue/index.ts +41 -0
  153. package/hydrate/index.js +541 -46
  154. package/hydrate/index.mjs +541 -46
  155. package/loader/index.d.ts +1 -1
  156. package/package.json +5 -3
  157. package/dist/chucao/p-66dce533.entry.js +0 -2
  158. package/dist/chucao/p-66dce533.entry.js.map +0 -1
  159. package/dist/chucao/p-75184fe1.entry.js +0 -2
  160. package/dist/chucao/p-75184fe1.entry.js.map +0 -1
  161. package/dist/chucao/p-BaKXvAYc.js.map +0 -1
  162. package/dist/chucao/p-e48912c7.entry.js +0 -2
  163. package/dist/cjs/index-C9Abf0td.js.map +0 -1
  164. package/dist/components/p-DL-bL54o.js.map +0 -1
  165. package/dist/esm/index-BaKXvAYc.js.map +0 -1
  166. /package/dist/chucao/{p-a0ec231a.entry.js.map → p-04dbcfa0.entry.js.map} +0 -0
  167. /package/dist/chucao/{p-96c852f5.entry.js.map → p-077dc2a6.entry.js.map} +0 -0
  168. /package/dist/chucao/{p-19dde4f9.entry.js.map → p-079c2017.entry.js.map} +0 -0
  169. /package/dist/chucao/{p-f04d2f75.entry.js.map → p-5ae89a19.entry.js.map} +0 -0
  170. /package/dist/chucao/{p-2e20c7a1.entry.js.map → p-9c072600.entry.js.map} +0 -0
  171. /package/dist/chucao/{p-e48912c7.entry.js.map → p-bb2445d1.entry.js.map} +0 -0
  172. /package/dist/chucao/{p-10658dc9.entry.js.map → p-e3265e38.entry.js.map} +0 -0
  173. /package/dist/chucao/{p-f62e1da2.entry.js.map → p-ff5f5c1f.entry.js.map} +0 -0
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-C9Abf0td.js');
3
+ var index = require('./index-C9cpLteP.js');
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await index.globalScripts();
8
- return index.bootstrapLazy([["ch-alert_8.cjs",[[769,"ch-alert",{"variant":[1],"dismissLabel":[1,"dismiss-label"]}],[769,"ch-badge",{"variant":[1]}],[769,"ch-button",{"variant":[1],"disabled":[4],"label":[1]}],[257,"ch-card"],[577,"ch-input",{"label":[1],"type":[1],"value":[1025],"placeholder":[1],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[577,"ch-select",{"label":[1],"options":[16],"value":[1025],"placeholder":[1],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[513,"ch-spinner",{"size":[1],"label":[1]}],[577,"ch-switch",{"label":[1],"name":[513],"value":[1],"checked":[1028],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"checked":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-accordion.cjs",[[769,"ch-accordion",{"items":[16],"value":[1025]}]]],["ch-checkbox.cjs",[[577,"ch-checkbox",{"label":[1],"name":[513],"value":[1],"checked":[1028],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"checked":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-divider.cjs",[[513,"ch-divider",{"orientation":[1]}]]],["ch-link.cjs",[[769,"ch-link",{"href":[1],"target":[1],"variant":[1],"disabled":[4]}]]],["ch-modal.cjs",[[769,"ch-modal",{"open":[1028],"label":[1],"closeLabel":[1,"close-label"]},null,{"open":[{"handleOpenChange":0}]}]]],["ch-radio.cjs",[[577,"ch-radio",{"label":[1],"options":[16],"value":[1025],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-tabs.cjs",[[769,"ch-tabs",{"tabs":[16],"value":[1025],"label":[1]}]]],["ch-textarea.cjs",[[577,"ch-textarea",{"label":[1],"value":[1025],"placeholder":[1],"rows":[2],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-tooltip.cjs",[[769,"ch-tooltip",{"placement":[1],"hovered":[32],"focused":[32],"dismissed":[32]},[[1,"mouseenter","handleMouseEnter"],[1,"mouseleave","handleMouseLeave"],[0,"focusin","handleFocusIn"],[0,"focusout","handleFocusOut"],[4,"keydown","handleKeyDown"]]]]]], options);
8
+ return index.bootstrapLazy([["ch-accordion.cjs",[[769,"ch-accordion",{"items":[16],"value":[1025]}]]],["ch-checkbox.cjs",[[577,"ch-checkbox",{"label":[1],"name":[513],"value":[1],"checked":[1028],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"checked":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-divider.cjs",[[513,"ch-divider",{"orientation":[1]}]]],["ch-drawer.cjs",[[769,"ch-drawer",{"open":[1028],"side":[1],"label":[1],"closeLabel":[1,"close-label"]},null,{"open":[{"handleOpenChange":0}]}]]],["ch-emoji.cjs",[[513,"ch-emoji",{"name":[1],"alt":[1],"size":[1],"extIndex":[32],"loaded":[32]},null,{"name":[{"handleNameChange":0}]}]]],["ch-link.cjs",[[769,"ch-link",{"href":[1],"target":[1],"variant":[1],"disabled":[4]}]]],["ch-modal.cjs",[[769,"ch-modal",{"open":[1028],"label":[1],"closeLabel":[1,"close-label"]},null,{"open":[{"handleOpenChange":0}]}]]],["ch-radio.cjs",[[577,"ch-radio",{"label":[1],"options":[16],"value":[1025],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-segmented-control.cjs",[[577,"ch-segmented-control",{"label":[1],"options":[16],"value":[1025],"size":[1],"name":[513],"disabled":[516],"required":[516],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}]}]]],["ch-tabs.cjs",[[769,"ch-tabs",{"tabs":[16],"value":[1025],"label":[1]}]]],["ch-textarea.cjs",[[577,"ch-textarea",{"label":[1],"value":[1025],"placeholder":[1],"rows":[2],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-tooltip.cjs",[[769,"ch-tooltip",{"placement":[1],"hovered":[32],"focused":[32],"dismissed":[32]},[[1,"mouseenter","handleMouseEnter"],[1,"mouseleave","handleMouseLeave"],[0,"focusin","handleFocusIn"],[0,"focusout","handleFocusOut"],[4,"keydown","handleKeyDown"]]]]],["ch-alert_8.cjs",[[769,"ch-button",{"variant":[1],"size":[1],"disabled":[4],"loading":[4],"href":[1],"target":[1],"label":[1]}],[769,"ch-alert",{"variant":[1],"dismissLabel":[1,"dismiss-label"]}],[769,"ch-badge",{"variant":[1]}],[257,"ch-card"],[577,"ch-input",{"label":[1],"type":[1],"value":[1025],"placeholder":[1],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[577,"ch-select",{"label":[1],"options":[16],"value":[1025],"placeholder":[1],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[577,"ch-switch",{"label":[1],"name":[513],"value":[1],"checked":[1028],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"checked":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[513,"ch-spinner",{"size":[1],"label":[1]}]]]], options);
9
9
  };
10
10
 
11
11
  exports.setNonce = index.setNonce;
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ let openOverlays = 0;
4
+ let previousOverflow = '';
5
+ let previousPaddingRight = '';
6
+ /**
7
+ * Prevents the page behind an overlay from scrolling, compensating for the
8
+ * scrollbar it removes so the layout does not shift.
9
+ *
10
+ * Reference-counted on a module-level counter, so concurrent overlays (a modal
11
+ * over a drawer, several stacked dialogs) cannot unlock the page early:
12
+ * whichever overlay closes first only decrements the count, and the last one
13
+ * restores the original styles.
14
+ *
15
+ * Callers must pair every `lockScroll()` with exactly one `unlockScroll()`.
16
+ */
17
+ function lockScroll() {
18
+ openOverlays += 1;
19
+ if (openOverlays > 1) {
20
+ return;
21
+ }
22
+ const root = document.documentElement;
23
+ const scrollbar = window.innerWidth - root.clientWidth;
24
+ previousOverflow = root.style.overflow;
25
+ previousPaddingRight = root.style.paddingRight;
26
+ root.style.overflow = 'hidden';
27
+ if (scrollbar > 0) {
28
+ root.style.paddingRight = `${scrollbar}px`;
29
+ }
30
+ }
31
+ /**
32
+ * Releases one scroll lock. Only the last lock restores the page; earlier calls
33
+ * are a no-op so the overlay still open keeps the page frozen.
34
+ */
35
+ function unlockScroll() {
36
+ openOverlays -= 1;
37
+ if (openOverlays > 0) {
38
+ return;
39
+ }
40
+ const root = document.documentElement;
41
+ root.style.overflow = previousOverflow;
42
+ root.style.paddingRight = previousPaddingRight;
43
+ }
44
+
45
+ exports.lockScroll = lockScroll;
46
+ exports.unlockScroll = unlockScroll;
47
+ //# sourceMappingURL=scroll-lock-DIRqLP4K.js.map
48
+
49
+ //# sourceMappingURL=scroll-lock-DIRqLP4K.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-lock-DIRqLP4K.js","sources":["src/utils/scroll-lock.ts"],"sourcesContent":["let openOverlays = 0;\nlet previousOverflow = '';\nlet previousPaddingRight = '';\n\n/**\n * Prevents the page behind an overlay from scrolling, compensating for the\n * scrollbar it removes so the layout does not shift.\n *\n * Reference-counted on a module-level counter, so concurrent overlays (a modal\n * over a drawer, several stacked dialogs) cannot unlock the page early:\n * whichever overlay closes first only decrements the count, and the last one\n * restores the original styles.\n *\n * Callers must pair every `lockScroll()` with exactly one `unlockScroll()`.\n */\nexport function lockScroll() {\n openOverlays += 1;\n if (openOverlays > 1) {\n return;\n }\n const root = document.documentElement;\n const scrollbar = window.innerWidth - root.clientWidth;\n previousOverflow = root.style.overflow;\n previousPaddingRight = root.style.paddingRight;\n root.style.overflow = 'hidden';\n if (scrollbar > 0) {\n root.style.paddingRight = `${scrollbar}px`;\n }\n}\n\n/**\n * Releases one scroll lock. Only the last lock restores the page; earlier calls\n * are a no-op so the overlay still open keeps the page frozen.\n */\nexport function unlockScroll() {\n openOverlays -= 1;\n if (openOverlays > 0) {\n return;\n }\n const root = document.documentElement;\n root.style.overflow = previousOverflow;\n root.style.paddingRight = previousPaddingRight;\n}\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,GAAG,CAAC;AACpB,IAAI,gBAAgB,GAAG,EAAE;AACzB,IAAI,oBAAoB,GAAG,EAAE;AAE7B;;;;;;;;;;AAUG;SACa,UAAU,GAAA;IACxB,YAAY,IAAI,CAAC;AACjB,IAAA,IAAI,YAAY,GAAG,CAAC,EAAE;QACpB;;AAEF,IAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe;IACrC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW;AACtD,IAAA,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ;AACtC,IAAA,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY;AAC9C,IAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ;AAC9B,IAAA,IAAI,SAAS,GAAG,CAAC,EAAE;QACjB,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,CAAA,EAAG,SAAS,IAAI;;AAE9C;AAEA;;;AAGG;SACa,YAAY,GAAA;IAC1B,YAAY,IAAI,CAAC;AACjB,IAAA,IAAI,YAAY,GAAG,CAAC,EAAE;QACpB;;AAEF,IAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe;AACrC,IAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,gBAAgB;AACtC,IAAA,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,oBAAoB;AAChD;;;;;"}
@@ -5,8 +5,11 @@
5
5
  "components/ch-badge/ch-badge.js",
6
6
  "components/ch-button/ch-button.js",
7
7
  "components/ch-divider/ch-divider.js",
8
+ "components/ch-drawer/ch-drawer.js",
9
+ "components/ch-emoji/ch-emoji.js",
8
10
  "components/ch-link/ch-link.js",
9
11
  "components/ch-radio/ch-radio.js",
12
+ "components/ch-segmented-control/ch-segmented-control.js",
10
13
  "components/ch-select/ch-select.js",
11
14
  "components/ch-spinner/ch-spinner.js",
12
15
  "components/ch-tabs/ch-tabs.js",
@@ -21,7 +24,7 @@
21
24
  "mixins": [],
22
25
  "compiler": {
23
26
  "name": "@stencil/core",
24
- "version": "4.44.0",
27
+ "version": "4.44.2",
25
28
  "typescriptVersion": "5.8.3"
26
29
  },
27
30
  "collections": [],
@@ -5,18 +5,50 @@
5
5
  .btn {
6
6
  display: inline-flex;
7
7
  align-items: center;
8
+ justify-content: center;
8
9
  gap: var(--spacing-sm);
9
- border: none;
10
+ box-sizing: border-box;
11
+ border: var(--border-width) solid transparent;
12
+ border-radius: var(--radius-pill);
10
13
  cursor: pointer;
11
14
  font-family: inherit;
15
+ font-weight: var(--typography-weight-bold);
16
+ text-decoration: none;
17
+ line-height: 1.2;
18
+ transition:
19
+ background-color var(--duration-normal) var(--easing-default),
20
+ border-color var(--duration-normal) var(--easing-default),
21
+ color var(--duration-normal) var(--easing-default),
22
+ transform var(--duration-fast) var(--easing-default);
23
+ }
24
+
25
+ .btn--sm {
26
+ padding: var(--spacing-2xs) var(--spacing-lg);
27
+ font-size: var(--typography-size-sm);
28
+ }
29
+
30
+ .btn--md {
31
+ padding: var(--spacing-xs) var(--spacing-xl);
12
32
  font-size: inherit;
13
33
  }
14
34
 
15
- .btn:disabled {
35
+ .btn--lg {
36
+ padding: var(--spacing-sm) var(--spacing-2xl);
37
+ font-size: var(--typography-size-lg);
38
+ }
39
+
40
+ .btn:disabled,
41
+ .btn--disabled {
16
42
  opacity: var(--opacity-disabled);
17
43
  cursor: not-allowed;
18
44
  }
19
45
 
46
+ .btn--loading:disabled,
47
+ .btn--loading.btn--disabled {
48
+ opacity: 1;
49
+ cursor: progress;
50
+ }
51
+
20
52
  .btn:focus-visible {
21
53
  outline: var(--focus-outline-width) solid var(--accent);
22
54
  outline-offset: var(--focus-outline-offset);
@@ -25,15 +57,9 @@
25
57
  .btn--primary {
26
58
  background-color: var(--accent);
27
59
  color: var(--color-accent-text);
28
- font-weight: var(--typography-weight-bold);
29
- padding: var(--spacing-xs) var(--spacing-xl);
30
- border-radius: var(--radius-pill);
31
- transition:
32
- background-color var(--duration-normal) var(--easing-default),
33
- transform var(--duration-fast) var(--easing-default);
34
60
  }
35
61
 
36
- .btn--primary:hover {
62
+ .btn--primary:hover:not(:disabled) {
37
63
  background-color: var(--accent-hover);
38
64
  transform: translateY(calc(-1 * var(--spacing-elevate)));
39
65
  }
@@ -41,18 +67,30 @@
41
67
  .btn--secondary {
42
68
  background-color: transparent;
43
69
  color: var(--text);
44
- font-weight: var(--typography-weight-bold);
45
- padding: var(--spacing-xs) var(--spacing-xl);
46
- border-radius: var(--radius-pill);
47
- border: var(--border-width) solid var(--border);
48
- transition:
49
- border-color var(--duration-normal) var(--easing-default),
50
- background-color var(--duration-normal) var(--easing-default),
51
- transform var(--duration-fast) var(--easing-default);
70
+ border-color: var(--border);
52
71
  }
53
72
 
54
- .btn--secondary:hover {
73
+ .btn--secondary:hover:not(:disabled) {
55
74
  border-color: var(--border-hover);
56
75
  background-color: var(--surface-hover);
57
76
  transform: translateY(calc(-1 * var(--spacing-elevate)));
58
77
  }
78
+
79
+ .btn--ghost {
80
+ background-color: transparent;
81
+ color: var(--text);
82
+ }
83
+
84
+ .btn--ghost:hover:not(:disabled) {
85
+ background-color: var(--surface-hover);
86
+ }
87
+
88
+ .btn--danger {
89
+ background-color: var(--color-status-warning);
90
+ color: var(--bg);
91
+ }
92
+
93
+ .btn--danger:hover:not(:disabled) {
94
+ filter: brightness(0.92);
95
+ transform: translateY(calc(-1 * var(--spacing-elevate)));
96
+ }
@@ -1,17 +1,38 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  export class ChButton {
3
3
  /**
4
- * The visual style of the button. Either `primary` or `secondary`.
4
+ * The visual style of the button. One of `primary`, `secondary`, `ghost`,
5
+ * or `danger`.
5
6
  */
6
7
  variant = 'primary';
8
+ /**
9
+ * The size of the button. One of `sm`, `md`, or `lg`.
10
+ */
11
+ size = 'md';
7
12
  /**
8
13
  * Whether the button is disabled.
9
14
  */
10
15
  disabled = false;
11
16
  /**
12
- * Accessible label set as `aria-label` on the native `<button>`. Use it
13
- * when the button's content doesn't convey its purpose on its own (e.g.
14
- * an icon-only button).
17
+ * Whether the button is loading. Shows a spinner, disables interaction, and
18
+ * announces the busy state with `aria-busy`.
19
+ */
20
+ loading = false;
21
+ /**
22
+ * When set, the button renders as an `<a>` pointing to this URL while
23
+ * keeping the button styling.
24
+ */
25
+ href;
26
+ /**
27
+ * The browsing context the link opens in (e.g. `_blank`). Only used when
28
+ * `href` is set. For `_blank`, a `noopener noreferrer` `rel` is added
29
+ * automatically.
30
+ */
31
+ target;
32
+ /**
33
+ * Accessible label set as `aria-label` on the native element. Use it when
34
+ * the button's content doesn't convey its purpose on its own (e.g. an
35
+ * icon-only button).
15
36
  */
16
37
  label;
17
38
  /**
@@ -19,10 +40,32 @@ export class ChButton {
19
40
  */
20
41
  chClick;
21
42
  handleClick = (ev) => {
43
+ if (this.disabled || this.loading) {
44
+ ev.preventDefault();
45
+ return;
46
+ }
22
47
  this.chClick.emit(ev);
23
48
  };
49
+ get spinnerSize() {
50
+ return this.size === 'lg' ? 'md' : 'sm';
51
+ }
52
+ renderContent() {
53
+ return [this.loading ? h("ch-spinner", { size: this.spinnerSize }) : h("slot", { name: "start" }), h("slot", null), h("slot", { name: "end" })];
54
+ }
24
55
  render() {
25
- return (h(Host, { key: '9363b49e8d38c0fab49ed10356380ded20a8cf5e' }, h("button", { key: '3c98506ae1418c4bc88f5aa72dfe058948556ed5', class: { btn: true, [`btn--${this.variant}`]: true }, type: "button", disabled: this.disabled, "aria-label": this.label, onClick: this.handleClick }, h("slot", { key: 'cdcf4f656b995fa527d4139a41b2ea3c7086e065' }))));
56
+ const classes = {
57
+ 'btn': true,
58
+ [`btn--${this.variant}`]: true,
59
+ [`btn--${this.size}`]: true,
60
+ 'btn--loading': this.loading,
61
+ };
62
+ if (this.href && !this.disabled && !this.loading) {
63
+ return (h(Host, null, h("a", { class: classes, href: this.href, target: this.target, rel: this.target === '_blank' ? 'noopener noreferrer' : undefined, "aria-label": this.label, onClick: this.handleClick }, this.renderContent())));
64
+ }
65
+ if (this.href) {
66
+ return (h(Host, null, h("span", { class: { ...classes, 'btn--disabled': true }, "aria-label": this.label, "aria-disabled": "true", "aria-busy": this.loading ? 'true' : undefined }, this.renderContent())));
67
+ }
68
+ return (h(Host, null, h("button", { class: classes, type: "button", disabled: this.disabled || this.loading, "aria-label": this.label, "aria-busy": this.loading ? 'true' : undefined, onClick: this.handleClick }, this.renderContent())));
26
69
  }
27
70
  static get is() { return "ch-button"; }
28
71
  static get encapsulation() { return "shadow"; }
@@ -43,7 +86,7 @@ export class ChButton {
43
86
  "mutable": false,
44
87
  "complexType": {
45
88
  "original": "ChButtonVariant",
46
- "resolved": "\"primary\" | \"secondary\"",
89
+ "resolved": "\"danger\" | \"ghost\" | \"primary\" | \"secondary\"",
47
90
  "references": {
48
91
  "ChButtonVariant": {
49
92
  "location": "local",
@@ -56,7 +99,7 @@ export class ChButton {
56
99
  "optional": false,
57
100
  "docs": {
58
101
  "tags": [],
59
- "text": "The visual style of the button. Either `primary` or `secondary`."
102
+ "text": "The visual style of the button. One of `primary`, `secondary`, `ghost`,\nor `danger`."
60
103
  },
61
104
  "getter": false,
62
105
  "setter": false,
@@ -64,6 +107,32 @@ export class ChButton {
64
107
  "attribute": "variant",
65
108
  "defaultValue": "'primary'"
66
109
  },
110
+ "size": {
111
+ "type": "string",
112
+ "mutable": false,
113
+ "complexType": {
114
+ "original": "ChButtonSize",
115
+ "resolved": "\"lg\" | \"md\" | \"sm\"",
116
+ "references": {
117
+ "ChButtonSize": {
118
+ "location": "local",
119
+ "path": "/home/runner/work/chucao/chucao/src/components/ch-button/ch-button.tsx",
120
+ "id": "src/components/ch-button/ch-button.tsx::ChButtonSize"
121
+ }
122
+ }
123
+ },
124
+ "required": false,
125
+ "optional": false,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": "The size of the button. One of `sm`, `md`, or `lg`."
129
+ },
130
+ "getter": false,
131
+ "setter": false,
132
+ "reflect": false,
133
+ "attribute": "size",
134
+ "defaultValue": "'md'"
135
+ },
67
136
  "disabled": {
68
137
  "type": "boolean",
69
138
  "mutable": false,
@@ -84,6 +153,64 @@ export class ChButton {
84
153
  "attribute": "disabled",
85
154
  "defaultValue": "false"
86
155
  },
156
+ "loading": {
157
+ "type": "boolean",
158
+ "mutable": false,
159
+ "complexType": {
160
+ "original": "boolean",
161
+ "resolved": "boolean",
162
+ "references": {}
163
+ },
164
+ "required": false,
165
+ "optional": false,
166
+ "docs": {
167
+ "tags": [],
168
+ "text": "Whether the button is loading. Shows a spinner, disables interaction, and\nannounces the busy state with `aria-busy`."
169
+ },
170
+ "getter": false,
171
+ "setter": false,
172
+ "reflect": false,
173
+ "attribute": "loading",
174
+ "defaultValue": "false"
175
+ },
176
+ "href": {
177
+ "type": "string",
178
+ "mutable": false,
179
+ "complexType": {
180
+ "original": "string",
181
+ "resolved": "string",
182
+ "references": {}
183
+ },
184
+ "required": false,
185
+ "optional": true,
186
+ "docs": {
187
+ "tags": [],
188
+ "text": "When set, the button renders as an `<a>` pointing to this URL while\nkeeping the button styling."
189
+ },
190
+ "getter": false,
191
+ "setter": false,
192
+ "reflect": false,
193
+ "attribute": "href"
194
+ },
195
+ "target": {
196
+ "type": "string",
197
+ "mutable": false,
198
+ "complexType": {
199
+ "original": "string",
200
+ "resolved": "string",
201
+ "references": {}
202
+ },
203
+ "required": false,
204
+ "optional": true,
205
+ "docs": {
206
+ "tags": [],
207
+ "text": "The browsing context the link opens in (e.g. `_blank`). Only used when\n`href` is set. For `_blank`, a `noopener noreferrer` `rel` is added\nautomatically."
208
+ },
209
+ "getter": false,
210
+ "setter": false,
211
+ "reflect": false,
212
+ "attribute": "target"
213
+ },
87
214
  "label": {
88
215
  "type": "string",
89
216
  "mutable": false,
@@ -96,7 +223,7 @@ export class ChButton {
96
223
  "optional": true,
97
224
  "docs": {
98
225
  "tags": [],
99
- "text": "Accessible label set as `aria-label` on the native `<button>`. Use it\nwhen the button's content doesn't convey its purpose on its own (e.g.\nan icon-only button)."
226
+ "text": "Accessible label set as `aria-label` on the native element. Use it when\nthe button's content doesn't convey its purpose on its own (e.g. an\nicon-only button)."
100
227
  },
101
228
  "getter": false,
102
229
  "setter": false,
@@ -1 +1 @@
1
- {"version":3,"file":"ch-button.js","sourceRoot":"","sources":["../../../../src/components/ch-button/ch-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AASnF,MAAM,OAAO,QAAQ;IACnB;;OAEG;IACK,OAAO,GAAoB,SAAS,CAAC;IAE7C;;OAEG;IACK,QAAQ,GAAG,KAAK,CAAC;IAEzB;;;;OAIG;IACK,KAAK,CAAU;IAEvB;;OAEG;IACM,OAAO,CAA2B;IAEnC,WAAW,GAAG,CAAC,EAAc,EAAE,EAAE;QACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,+DAAQ,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,gBAAc,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW;gBACpJ,8DAAa,CACN,CACJ,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport type ChButtonVariant = 'primary' | 'secondary';\n\n@Component({\n tag: 'ch-button',\n styleUrl: 'ch-button.css',\n shadow: true,\n})\nexport class ChButton {\n /**\n * The visual style of the button. Either `primary` or `secondary`.\n */\n @Prop() variant: ChButtonVariant = 'primary';\n\n /**\n * Whether the button is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Accessible label set as `aria-label` on the native `<button>`. Use it\n * when the button's content doesn't convey its purpose on its own (e.g.\n * an icon-only button).\n */\n @Prop() label?: string;\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() chClick: EventEmitter<MouseEvent>;\n\n private handleClick = (ev: MouseEvent) => {\n this.chClick.emit(ev);\n };\n\n render() {\n return (\n <Host>\n <button class={{ btn: true, [`btn--${this.variant}`]: true }} type=\"button\" disabled={this.disabled} aria-label={this.label} onClick={this.handleClick}>\n <slot></slot>\n </button>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ch-button.js","sourceRoot":"","sources":["../../../../src/components/ch-button/ch-button.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport type ChButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';\nexport type ChButtonSize = 'sm' | 'md' | 'lg';\n\n@Component({\n tag: 'ch-button',\n styleUrl: 'ch-button.css',\n shadow: true,\n})\nexport class ChButton {\n /**\n * The visual style of the button. One of `primary`, `secondary`, `ghost`,\n * or `danger`.\n */\n @Prop() variant: ChButtonVariant = 'primary';\n\n /**\n * The size of the button. One of `sm`, `md`, or `lg`.\n */\n @Prop() size: ChButtonSize = 'md';\n\n /**\n * Whether the button is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether the button is loading. Shows a spinner, disables interaction, and\n * announces the busy state with `aria-busy`.\n */\n @Prop() loading = false;\n\n /**\n * When set, the button renders as an `<a>` pointing to this URL while\n * keeping the button styling.\n */\n @Prop() href?: string;\n\n /**\n * The browsing context the link opens in (e.g. `_blank`). Only used when\n * `href` is set. For `_blank`, a `noopener noreferrer` `rel` is added\n * automatically.\n */\n @Prop() target?: string;\n\n /**\n * Accessible label set as `aria-label` on the native element. Use it when\n * the button's content doesn't convey its purpose on its own (e.g. an\n * icon-only button).\n */\n @Prop() label?: string;\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() chClick: EventEmitter<MouseEvent>;\n\n private handleClick = (ev: MouseEvent) => {\n if (this.disabled || this.loading) {\n ev.preventDefault();\n return;\n }\n this.chClick.emit(ev);\n };\n\n private get spinnerSize() {\n return this.size === 'lg' ? 'md' : 'sm';\n }\n\n private renderContent() {\n return [this.loading ? <ch-spinner size={this.spinnerSize}></ch-spinner> : <slot name=\"start\"></slot>, <slot></slot>, <slot name=\"end\"></slot>];\n }\n\n render() {\n const classes = {\n 'btn': true,\n [`btn--${this.variant}`]: true,\n [`btn--${this.size}`]: true,\n 'btn--loading': this.loading,\n };\n\n if (this.href && !this.disabled && !this.loading) {\n return (\n <Host>\n <a\n class={classes}\n href={this.href}\n target={this.target}\n rel={this.target === '_blank' ? 'noopener noreferrer' : undefined}\n aria-label={this.label}\n onClick={this.handleClick}\n >\n {this.renderContent()}\n </a>\n </Host>\n );\n }\n\n if (this.href) {\n return (\n <Host>\n <span class={{ ...classes, 'btn--disabled': true }} aria-label={this.label} aria-disabled=\"true\" aria-busy={this.loading ? 'true' : undefined}>\n {this.renderContent()}\n </span>\n </Host>\n );\n }\n\n return (\n <Host>\n <button\n class={classes}\n type=\"button\"\n disabled={this.disabled || this.loading}\n aria-label={this.label}\n aria-busy={this.loading ? 'true' : undefined}\n onClick={this.handleClick}\n >\n {this.renderContent()}\n </button>\n </Host>\n );\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  export class ChCard {
3
3
  render() {
4
- return (h(Host, { key: '1541ba4361c996716356fb87cdcc73b1260d4c6a' }, h("div", { key: '924070eeb79f6c8f8e6362772bbab0dcc1c6f315', class: "card" }, h("slot", { key: '2fde36426395a519cb1ebe265ba0eef3aaf6ff38' }))));
4
+ return (h(Host, { key: '7e2833cdc6f37c6b8577c17677840913fb7cd9e1' }, h("div", { key: '223c291e98af73ee2c299b8649773cfcf54388d7', class: "card" }, h("slot", { key: 'e948386bcd492c31e264d50cf27d26e98dd771eb' }))));
5
5
  }
6
6
  static get is() { return "ch-card"; }
7
7
  static get encapsulation() { return "shadow"; }
@@ -97,7 +97,7 @@ export class ChCheckbox {
97
97
  return undefined;
98
98
  }
99
99
  render() {
100
- return (h(Host, { key: 'ca6c6f1297434052eeee68fd76cf21d6a7b99aae' }, h("label", { key: '1f3538da6eb2ce91a75cf73044e2103ba472d4ed', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.checkboxId }, h("input", { key: '7ed674616bc70af42b025a2b945378192ce48a58', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && h("span", { key: '4f5ccc7b28d95d012aa5cd87ec2411be34672d9e', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: 'b7d2b09c54ed61907e4e7110af867b2a0592924c', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '2340791705a5fce22b810a3a32377a7b1ccef852', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
100
+ return (h(Host, { key: '4011f5a338d2b006a0bfa8217d1ee9b01b987d7d' }, h("label", { key: '8c6c8d6c530d366b26f0cb602dc1e987ed8324d5', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.checkboxId }, h("input", { key: 'c1f58eeba34ae5d5371e863f349433852fc3c882', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && h("span", { key: '447812e11253c951cb6a5003adda13357fc6dec3', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '5369375f8dd0c2fa787207f8fcef4feeb78ddda6', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'e90274e1df8d205053effe57ceb56f8e8b4deca2', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
101
101
  }
102
102
  static get is() { return "ch-checkbox"; }
103
103
  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: '888debaaee690d5bbc5e276773f16ac7ead0129a', class: { 'divider--vertical': this.orientation === 'vertical' } }, h("hr", { key: 'ae175f047605cfbe2b24d50e0dab56ac362c49a1', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
8
+ return (h(Host, { key: '26aa4586507d821e539adcf1e057467654c19491', class: { 'divider--vertical': this.orientation === 'vertical' } }, h("hr", { key: '599b22093ffe91c87899d84ad8c63ab6279107cb', 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"; }
@@ -0,0 +1,152 @@
1
+ .drawer {
2
+ position: fixed;
3
+ inset: 0;
4
+ margin: 0;
5
+ box-sizing: border-box;
6
+ flex-direction: column;
7
+ gap: var(--spacing-2xl);
8
+ width: min(24rem, 100vw);
9
+ height: 100vh;
10
+ height: 100dvh;
11
+ max-width: 100vw;
12
+ max-height: 100dvh;
13
+ padding: var(--spacing-5xl);
14
+ border: var(--border-width) solid var(--border);
15
+ border-radius: 0;
16
+ background: var(--color-background-base);
17
+ color: var(--text);
18
+ font-family: var(--font-body);
19
+ font-size: var(--typography-size-md);
20
+ overflow: hidden;
21
+ }
22
+
23
+ .drawer[open] {
24
+ display: flex;
25
+ }
26
+
27
+ .drawer--start {
28
+ inset: 0 auto 0 0;
29
+ border-inline-start: none;
30
+ animation: drawer-in-start var(--duration-normal) var(--easing-default);
31
+ }
32
+
33
+ .drawer--end {
34
+ inset: 0 0 0 auto;
35
+ border-inline-end: none;
36
+ animation: drawer-in-end var(--duration-normal) var(--easing-default);
37
+ }
38
+
39
+ .drawer--top {
40
+ inset: 0 0 auto 0;
41
+ width: 100vw;
42
+ height: auto;
43
+ max-height: 80dvh;
44
+ border-block-start: none;
45
+ animation: drawer-in-top var(--duration-normal) var(--easing-default);
46
+ }
47
+
48
+ .drawer--bottom {
49
+ inset: auto 0 0 0;
50
+ width: 100vw;
51
+ height: auto;
52
+ max-height: 80dvh;
53
+ border-block-end: none;
54
+ animation: drawer-in-bottom var(--duration-normal) var(--easing-default);
55
+ }
56
+
57
+ .drawer::backdrop {
58
+ background: var(--color-scrim-default);
59
+ backdrop-filter: blur(var(--effect-blur));
60
+ }
61
+
62
+ .drawer-head {
63
+ display: flex;
64
+ align-items: flex-start;
65
+ justify-content: space-between;
66
+ gap: var(--spacing-2xl);
67
+ flex: none;
68
+ }
69
+
70
+ .drawer-body {
71
+ flex: 1;
72
+ min-height: 0;
73
+ overflow-y: auto;
74
+ }
75
+
76
+ ::slotted([slot='footer']) {
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: flex-end;
80
+ gap: var(--spacing-md);
81
+ flex: none;
82
+ padding-top: var(--spacing-2xl);
83
+ border-top: var(--border-width) solid var(--border);
84
+ }
85
+
86
+ .drawer-close {
87
+ display: inline-flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ flex: none;
91
+ padding: var(--spacing-2xs) var(--spacing-md);
92
+ border: 0;
93
+ border-radius: var(--radius);
94
+ background: none;
95
+ color: var(--text-muted);
96
+ cursor: pointer;
97
+ font-family: var(--font-heading);
98
+ font-size: var(--typography-size-lg);
99
+ line-height: 1;
100
+ transition: background-color var(--duration-normal) var(--easing-default);
101
+ }
102
+
103
+ .drawer-close:hover {
104
+ background: var(--surface-hover);
105
+ color: var(--text);
106
+ }
107
+
108
+ .drawer-close:focus-visible {
109
+ outline: var(--focus-outline-width) solid var(--accent);
110
+ outline-offset: var(--focus-outline-offset);
111
+ }
112
+
113
+ @keyframes drawer-in-start {
114
+ from {
115
+ transform: translateX(-100%);
116
+ }
117
+ }
118
+
119
+ @keyframes drawer-in-end {
120
+ from {
121
+ transform: translateX(100%);
122
+ }
123
+ }
124
+
125
+ @keyframes drawer-in-top {
126
+ from {
127
+ transform: translateY(-100%);
128
+ }
129
+ }
130
+
131
+ @keyframes drawer-in-bottom {
132
+ from {
133
+ transform: translateY(100%);
134
+ }
135
+ }
136
+
137
+ @media (pointer: coarse) {
138
+ .drawer-close {
139
+ min-width: 44px;
140
+ min-height: 44px;
141
+ }
142
+ }
143
+
144
+ @media (prefers-reduced-motion: reduce) {
145
+ .drawer {
146
+ animation: none;
147
+ }
148
+
149
+ .drawer-close {
150
+ transition: none;
151
+ }
152
+ }