@devschile/chucao 1.6.0 → 1.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 (155) hide show
  1. package/README.md +15 -12
  2. package/dist/chucao/chucao.css +1 -1
  3. package/dist/chucao/chucao.esm.js +1 -1
  4. package/dist/chucao/chucao.esm.js.map +1 -1
  5. package/dist/chucao/index.esm.js +1 -1
  6. package/dist/chucao/index.esm.js.map +1 -1
  7. package/dist/chucao/{p-175aee94.entry.js → p-13ab5f9a.entry.js} +2 -2
  8. package/dist/chucao/{p-dde82d7d.entry.js → p-1cc7042e.entry.js} +2 -2
  9. package/dist/chucao/p-23c5220b.entry.js +2 -0
  10. package/dist/chucao/p-23c5220b.entry.js.map +1 -0
  11. package/dist/chucao/p-2d7e81b2.entry.js +2 -0
  12. package/dist/chucao/p-2d7e81b2.entry.js.map +1 -0
  13. package/dist/chucao/{p-af2c57b5.entry.js → p-421cda05.entry.js} +2 -2
  14. package/dist/chucao/p-Bvah_WQV.js +3 -0
  15. package/dist/chucao/p-Bvah_WQV.js.map +1 -0
  16. package/dist/chucao/{p-d75eeeea.entry.js → p-c16b18b7.entry.js} +2 -2
  17. package/dist/chucao/p-cbb2b478.entry.js +2 -0
  18. package/dist/chucao/p-cbb2b478.entry.js.map +1 -0
  19. package/dist/chucao/{p-fcc70c8d.entry.js → p-cfb6db53.entry.js} +2 -2
  20. package/dist/chucao/p-df73f786.entry.js +2 -0
  21. package/dist/chucao/{p-85a49fd7.entry.js → p-e8fe65bb.entry.js} +2 -2
  22. package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
  23. package/dist/cjs/{ch-badge_6.cjs.entry.js → ch-alert_8.cjs.entry.js} +73 -9
  24. package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -0
  25. package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
  26. package/dist/cjs/ch-divider.cjs.entry.js +2 -2
  27. package/dist/cjs/ch-link.cjs.entry.js +1 -1
  28. package/dist/cjs/ch-modal.cjs.entry.js +167 -0
  29. package/dist/cjs/ch-modal.cjs.entry.js.map +1 -0
  30. package/dist/cjs/ch-radio.cjs.entry.js +2 -2
  31. package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
  32. package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
  33. package/dist/cjs/ch-tooltip.cjs.entry.js +82 -0
  34. package/dist/cjs/ch-tooltip.cjs.entry.js.map +1 -0
  35. package/dist/cjs/chucao.cjs.js +3 -3
  36. package/dist/cjs/chucao.cjs.js.map +1 -1
  37. package/dist/cjs/{index-CiYvuUBV.js → index-DMeDkSQU.js} +183 -11
  38. package/dist/cjs/index-DMeDkSQU.js.map +1 -0
  39. package/dist/cjs/index.cjs.js +12 -1
  40. package/dist/cjs/index.cjs.js.map +1 -1
  41. package/dist/cjs/loader.cjs.js +2 -2
  42. package/dist/collection/collection-manifest.json +5 -1
  43. package/dist/collection/components/ch-alert/ch-alert.css +77 -0
  44. package/dist/collection/components/ch-alert/ch-alert.js +118 -0
  45. package/dist/collection/components/ch-alert/ch-alert.js.map +1 -0
  46. package/dist/collection/components/ch-badge/ch-badge.js +1 -1
  47. package/dist/collection/components/ch-button/ch-button.js +1 -1
  48. package/dist/collection/components/ch-button/ch-button.js.map +1 -1
  49. package/dist/collection/components/ch-card/ch-card.js +1 -1
  50. package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
  51. package/dist/collection/components/ch-divider/ch-divider.js +1 -1
  52. package/dist/collection/components/ch-input/ch-input.js +1 -1
  53. package/dist/collection/components/ch-modal/ch-modal.css +69 -0
  54. package/dist/collection/components/ch-modal/ch-modal.js +278 -0
  55. package/dist/collection/components/ch-modal/ch-modal.js.map +1 -0
  56. package/dist/collection/components/ch-radio/ch-radio.js +1 -1
  57. package/dist/collection/components/ch-select/ch-select.js +1 -1
  58. package/dist/collection/components/ch-spinner/ch-spinner.css +39 -0
  59. package/dist/collection/components/ch-spinner/ch-spinner.js +90 -0
  60. package/dist/collection/components/ch-spinner/ch-spinner.js.map +1 -0
  61. package/dist/collection/components/ch-switch/ch-switch.js +1 -1
  62. package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
  63. package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
  64. package/dist/collection/components/ch-tooltip/ch-tooltip.css +100 -0
  65. package/dist/collection/components/ch-tooltip/ch-tooltip.js +168 -0
  66. package/dist/collection/components/ch-tooltip/ch-tooltip.js.map +1 -0
  67. package/dist/collection/tokens/tokens.js +9 -1
  68. package/dist/collection/tokens/tokens.js.map +1 -1
  69. package/dist/collection/tokens/types.js.map +1 -1
  70. package/dist/components/ch-accordion.js +1 -1
  71. package/dist/components/ch-alert.d.ts +11 -0
  72. package/dist/components/ch-alert.js +2 -0
  73. package/dist/components/ch-alert.js.map +1 -0
  74. package/dist/components/ch-badge.js +1 -1
  75. package/dist/components/ch-button.js +1 -1
  76. package/dist/components/ch-button.js.map +1 -1
  77. package/dist/components/ch-card.js +1 -1
  78. package/dist/components/ch-card.js.map +1 -1
  79. package/dist/components/ch-checkbox.js +1 -1
  80. package/dist/components/ch-divider.js +1 -1
  81. package/dist/components/ch-input.js +1 -1
  82. package/dist/components/ch-link.js +1 -1
  83. package/dist/components/ch-modal.d.ts +11 -0
  84. package/dist/components/ch-modal.js +2 -0
  85. package/dist/components/ch-modal.js.map +1 -0
  86. package/dist/components/ch-radio.js +1 -1
  87. package/dist/components/ch-select.js +1 -1
  88. package/dist/components/ch-spinner.d.ts +11 -0
  89. package/dist/components/ch-spinner.js +2 -0
  90. package/dist/components/ch-spinner.js.map +1 -0
  91. package/dist/components/ch-switch.js +1 -1
  92. package/dist/components/ch-tabs.js +1 -1
  93. package/dist/components/ch-textarea.js +1 -1
  94. package/dist/components/ch-tooltip.d.ts +11 -0
  95. package/dist/components/ch-tooltip.js +2 -0
  96. package/dist/components/ch-tooltip.js.map +1 -0
  97. package/dist/components/index.js +1 -1
  98. package/dist/components/index.js.map +1 -1
  99. package/dist/components/p-hyy-cLgi.js +2 -0
  100. package/dist/components/p-hyy-cLgi.js.map +1 -0
  101. package/dist/esm/ch-accordion.entry.js +1 -1
  102. package/dist/esm/{ch-badge_6.entry.js → ch-alert_8.entry.js} +72 -10
  103. package/dist/esm/ch-alert_8.entry.js.map +1 -0
  104. package/dist/esm/ch-checkbox.entry.js +2 -2
  105. package/dist/esm/ch-divider.entry.js +2 -2
  106. package/dist/esm/ch-link.entry.js +1 -1
  107. package/dist/esm/ch-modal.entry.js +165 -0
  108. package/dist/esm/ch-modal.entry.js.map +1 -0
  109. package/dist/esm/ch-radio.entry.js +2 -2
  110. package/dist/esm/ch-tabs.entry.js +2 -2
  111. package/dist/esm/ch-textarea.entry.js +2 -2
  112. package/dist/esm/ch-tooltip.entry.js +80 -0
  113. package/dist/esm/ch-tooltip.entry.js.map +1 -0
  114. package/dist/esm/chucao.js +4 -4
  115. package/dist/esm/chucao.js.map +1 -1
  116. package/dist/esm/{index-ImsAHlk9.js → index-Bvah_WQV.js} +183 -12
  117. package/dist/esm/index-Bvah_WQV.js.map +1 -0
  118. package/dist/esm/index.js +10 -2
  119. package/dist/esm/index.js.map +1 -1
  120. package/dist/esm/loader.js +3 -3
  121. package/dist/types/components/ch-alert/ch-alert.d.ts +34 -0
  122. package/dist/types/components/ch-modal/ch-modal.d.ts +67 -0
  123. package/dist/types/components/ch-spinner/ch-spinner.d.ts +25 -0
  124. package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +47 -0
  125. package/dist/types/components.d.ts +369 -0
  126. package/dist/types/stencil-public-runtime.d.ts +11 -0
  127. package/dist/types/tokens/tokens.d.ts +8 -0
  128. package/dist/types/tokens/types.d.ts +3 -3
  129. package/dist-react/components.d.ts +18 -1
  130. package/dist-react/components.js +39 -0
  131. package/dist-react/components.ts +55 -1
  132. package/dist-vue/index.d.ts +4 -0
  133. package/dist-vue/index.js +28 -0
  134. package/dist-vue/index.ts +36 -0
  135. package/hydrate/index.js +542 -19
  136. package/hydrate/index.mjs +542 -19
  137. package/package.json +6 -2
  138. package/dist/chucao/p-ImsAHlk9.js +0 -3
  139. package/dist/chucao/p-ImsAHlk9.js.map +0 -1
  140. package/dist/chucao/p-b4520f1c.entry.js +0 -2
  141. package/dist/chucao/p-b4520f1c.entry.js.map +0 -1
  142. package/dist/chucao/p-fe0c9320.entry.js +0 -2
  143. package/dist/cjs/ch-badge_6.cjs.entry.js.map +0 -1
  144. package/dist/cjs/index-CiYvuUBV.js.map +0 -1
  145. package/dist/components/p-x4aZoujY.js +0 -2
  146. package/dist/components/p-x4aZoujY.js.map +0 -1
  147. package/dist/esm/ch-badge_6.entry.js.map +0 -1
  148. package/dist/esm/index-ImsAHlk9.js.map +0 -1
  149. /package/dist/chucao/{p-175aee94.entry.js.map → p-13ab5f9a.entry.js.map} +0 -0
  150. /package/dist/chucao/{p-dde82d7d.entry.js.map → p-1cc7042e.entry.js.map} +0 -0
  151. /package/dist/chucao/{p-af2c57b5.entry.js.map → p-421cda05.entry.js.map} +0 -0
  152. /package/dist/chucao/{p-d75eeeea.entry.js.map → p-c16b18b7.entry.js.map} +0 -0
  153. /package/dist/chucao/{p-fcc70c8d.entry.js.map → p-cfb6db53.entry.js.map} +0 -0
  154. /package/dist/chucao/{p-fe0c9320.entry.js.map → p-df73f786.entry.js.map} +0 -0
  155. /package/dist/chucao/{p-85a49fd7.entry.js.map → p-e8fe65bb.entry.js.map} +0 -0
package/hydrate/index.js CHANGED
@@ -132,10 +132,10 @@ function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResu
132
132
 
133
133
 
134
134
  const NAMESPACE = 'chucao';
135
- const BUILD = /* chucao */ { hotModuleReplacement: false, prop: true, propChangeCallback: false, slotRelocation: true, updatable: true};
135
+ const BUILD = /* chucao */ { hotModuleReplacement: false, slotRelocation: true, state: true, updatable: true};
136
136
 
137
137
  /*
138
- Stencil Hydrate Platform v4.43.5 | MIT Licensed | https://stenciljs.com
138
+ Stencil Hydrate Platform v4.44.0 | MIT Licensed | https://stenciljs.com
139
139
  */
140
140
  var __create = Object.create;
141
141
  var __defProp = Object.defineProperty;
@@ -465,6 +465,8 @@ var DEFAULT_DOC_DATA = {
465
465
  staticComponents: /* @__PURE__ */ new Set()
466
466
  };
467
467
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
468
+ var MAX_LAZY_LOAD_RETRIES = 3;
469
+ var LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
468
470
 
469
471
  // src/utils/style.ts
470
472
  function createStyleSheetIfNeededAndSupported(styles2) {
@@ -525,7 +527,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
525
527
  slottedNodes.push(childNode);
526
528
  if (typeof slotName !== "undefined") return slottedNodes;
527
529
  }
528
- slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
530
+ slottedNodes = [...slottedNodes, ...getHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName)];
529
531
  }
530
532
  return slottedNodes;
531
533
  }
@@ -767,6 +769,11 @@ var h = (nodeName, vnodeData, ...children) => {
767
769
  } else if (child != null && typeof child !== "boolean") {
768
770
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
769
771
  child = String(child);
772
+ } else if (typeof nodeName !== "function" && child.$flags$ === void 0) {
773
+ {
774
+ consoleError("Invalid vNode child");
775
+ }
776
+ continue;
770
777
  }
771
778
  if (simple && lastSimple) {
772
779
  vNodeChildren[vNodeChildren.length - 1].$text$ += child;
@@ -1630,6 +1637,31 @@ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
1630
1637
  return cssText;
1631
1638
  };
1632
1639
 
1640
+ // src/runtime/normalize-watchers.ts
1641
+ var normalizeWatchers = (raw) => {
1642
+ if (!raw) return void 0;
1643
+ const keys = Object.keys(raw);
1644
+ if (keys.length === 0) return void 0;
1645
+ let hasLegacy = false;
1646
+ for (const propName of keys) {
1647
+ if (hasLegacy) break;
1648
+ for (const h2 of raw[propName]) {
1649
+ if (typeof h2 === "string") {
1650
+ hasLegacy = true;
1651
+ break;
1652
+ }
1653
+ }
1654
+ }
1655
+ if (!hasLegacy) return raw;
1656
+ const out = {};
1657
+ for (const propName of keys) {
1658
+ out[propName] = raw[propName].map(
1659
+ (h2) => typeof h2 === "string" ? { [h2]: 0 } : h2
1660
+ );
1661
+ }
1662
+ return out;
1663
+ };
1664
+
1633
1665
  // src/utils/remote-value.ts
1634
1666
  var RemoteValue = class _RemoteValue {
1635
1667
  /**
@@ -2278,7 +2310,10 @@ var markSlotContentForRelocation = (elm) => {
2278
2310
  const slotName = childNode["s-sn"];
2279
2311
  for (j = hostContentNodes.length - 1; j >= 0; j--) {
2280
2312
  node = hostContentNodes[j];
2281
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
2313
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && // let an exact named-slot match override a stale default-slot claim. Skip this for
2314
+ // `slotName === ''` itself - a matched default node's cached `s-sn` is `''` too, which
2315
+ // would trivially "match" on every re-render and force pointless re-insertion.
2316
+ (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"] || slotName !== "" && getSlotName(node) === slotName)) {
2282
2317
  if (isNodeLocatedInSlot(node, slotName)) {
2283
2318
  let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
2284
2319
  checkSlotFallbackVisibility = true;
@@ -2541,6 +2576,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
2541
2576
  hostRef.$deferredConnectedCallback$ = false;
2542
2577
  safeCall(instance, "connectedCallback", void 0, elm);
2543
2578
  }
2579
+ {
2580
+ hostRef.$flags$ |= 256 /* isListenReady */;
2581
+ if (hostRef.$queuedListeners$) {
2582
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
2583
+ hostRef.$queuedListeners$ = void 0;
2584
+ }
2585
+ }
2544
2586
  if (hostRef.$fetchedCbList$.length) {
2545
2587
  hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
2546
2588
  }
@@ -2702,6 +2744,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2702
2744
  `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
2703
2745
  );
2704
2746
  }
2747
+ const elm = hostRef.$hostElement$ ;
2705
2748
  const oldVal = hostRef.$instanceValues$.get(propName);
2706
2749
  const flags = hostRef.$flags$;
2707
2750
  const instance = hostRef.$lazyInstance$ ;
@@ -2712,6 +2755,27 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2712
2755
  const didValueChange = newVal !== oldVal && !areBothNaN;
2713
2756
  if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
2714
2757
  hostRef.$instanceValues$.set(propName, newVal);
2758
+ if (cmpMeta.$watchers$) {
2759
+ const watchMethods = cmpMeta.$watchers$[propName];
2760
+ if (watchMethods) {
2761
+ watchMethods.map((watcher) => {
2762
+ try {
2763
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
2764
+ if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
2765
+ if (!instance) {
2766
+ hostRef.$fetchedCbList$.push(() => {
2767
+ hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
2768
+ });
2769
+ } else {
2770
+ instance[watchMethodName](newVal, oldVal, propName);
2771
+ }
2772
+ }
2773
+ } catch (e) {
2774
+ consoleError(e, elm);
2775
+ }
2776
+ });
2777
+ }
2778
+ }
2715
2779
  if (flags & 2 /* hasRendered */) {
2716
2780
  if (instance.componentShouldUpdate) {
2717
2781
  const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
@@ -2730,7 +2794,18 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2730
2794
  var proxyComponent = (Cstr, cmpMeta, flags) => {
2731
2795
  var _a2;
2732
2796
  const prototype = Cstr.prototype;
2733
- if (cmpMeta.$members$ || BUILD.propChangeCallback) {
2797
+ {
2798
+ {
2799
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
2800
+ cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
2801
+ }
2802
+ if (Cstr.deserializers && !cmpMeta.$deserializers$) {
2803
+ cmpMeta.$deserializers$ = Cstr.deserializers;
2804
+ }
2805
+ if (Cstr.serializers && !cmpMeta.$serializers$) {
2806
+ cmpMeta.$serializers$ = Cstr.serializers;
2807
+ }
2808
+ }
2734
2809
  const members = Object.entries((_a2 = cmpMeta.$members$) != null ? _a2 : {});
2735
2810
  members.map(([memberName, [memberFlags]]) => {
2736
2811
  if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
@@ -2790,10 +2865,12 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
2790
2865
 
2791
2866
  // src/runtime/initialize-component.ts
2792
2867
  var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2868
+ var _a2;
2793
2869
  let Cstr;
2794
2870
  try {
2795
2871
  if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
2796
2872
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2873
+ hostRef.$flags$ &= -1025 /* hasFailedLoad */;
2797
2874
  const bundleId = cmpMeta.$lazyBundleId$;
2798
2875
  if (bundleId) {
2799
2876
  const CstrImport = loadModule(cmpMeta);
@@ -2805,9 +2882,19 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2805
2882
  Cstr = CstrImport;
2806
2883
  }
2807
2884
  if (!Cstr) {
2885
+ hostRef.$flags$ &= -33 /* hasInitializedComponent */;
2886
+ hostRef.$loadRetryCount$ = ((_a2 = hostRef.$loadRetryCount$) != null ? _a2 : 0) + 1;
2887
+ if (hostRef.$loadRetryCount$ < MAX_LAZY_LOAD_RETRIES) {
2888
+ hostRef.$flags$ |= 1024 /* hasFailedLoad */;
2889
+ }
2808
2890
  throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
2809
2891
  }
2810
2892
  if (!Cstr.isProxied) {
2893
+ {
2894
+ cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
2895
+ cmpMeta.$serializers$ = Cstr.serializers;
2896
+ cmpMeta.$deserializers$ = Cstr.deserializers;
2897
+ }
2811
2898
  proxyComponent(Cstr, cmpMeta);
2812
2899
  Cstr.isProxied = true;
2813
2900
  }
@@ -2823,6 +2910,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2823
2910
  {
2824
2911
  hostRef.$flags$ &= -9 /* isConstructingInstance */;
2825
2912
  }
2913
+ {
2914
+ hostRef.$flags$ |= 128 /* isWatchReady */;
2915
+ }
2826
2916
  endNewInstance();
2827
2917
  const needsDeferredCallback = cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
2828
2918
  if (!needsDeferredCallback) {
@@ -2868,7 +2958,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2868
2958
  hostRef.$onRenderResolve$();
2869
2959
  hostRef.$onRenderResolve$ = void 0;
2870
2960
  }
2871
- if (hostRef.$onReadyResolve$) {
2961
+ if (hostRef.$onReadyResolve$ && !(hostRef.$flags$ & 1024 /* hasFailedLoad */)) {
2872
2962
  hostRef.$onReadyResolve$(elm);
2873
2963
  }
2874
2964
  }
@@ -2921,8 +3011,11 @@ var connectedCallback = (elm) => {
2921
3011
  initializeComponent(elm, hostRef, cmpMeta);
2922
3012
  }
2923
3013
  } else {
3014
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
2924
3015
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2925
3016
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
3017
+ } else if (hostRef.$flags$ & 1024 /* hasFailedLoad */) {
3018
+ setTimeout(() => initializeComponent(elm, hostRef, cmpMeta), LAZY_LOAD_RETRY_INTERVAL_MS);
2926
3019
  } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
2927
3020
  hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
2928
3021
  }
@@ -2940,6 +3033,38 @@ var setContentReference = (elm) => {
2940
3033
  contentRefElm["s-cn"] = true;
2941
3034
  insertBefore(elm, contentRefElm, elm.firstChild);
2942
3035
  };
3036
+ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
3037
+ if (listeners && win.document) {
3038
+ listeners.map(([flags, name, method]) => {
3039
+ const target = getHostListenerTarget(win.document, elm, flags) ;
3040
+ const handler = hostListenerProxy(hostRef, method);
3041
+ const opts = hostListenerOpts(flags);
3042
+ plt.ael(target, name, handler, opts);
3043
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
3044
+ });
3045
+ }
3046
+ };
3047
+ var hostListenerProxy = (hostRef, methodName) => (ev) => {
3048
+ var _a2;
3049
+ try {
3050
+ {
3051
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
3052
+ (_a2 = hostRef.$lazyInstance$) == null ? void 0 : _a2[methodName](ev);
3053
+ } else {
3054
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
3055
+ }
3056
+ }
3057
+ } catch (e) {
3058
+ consoleError(e, hostRef.$hostElement$);
3059
+ }
3060
+ };
3061
+ var getHostListenerTarget = (doc, elm, flags) => {
3062
+ if (flags & 4 /* TargetDocument */) {
3063
+ return doc;
3064
+ }
3065
+ return elm;
3066
+ };
3067
+ var hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
2943
3068
  function transformTag(tag) {
2944
3069
  return tag;
2945
3070
  }
@@ -4930,6 +5055,7 @@ async function hydrateComponent(win2, results, tagName, elm, waitingElements) {
4930
5055
  if (!hostRef) {
4931
5056
  return;
4932
5057
  }
5058
+ addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
4933
5059
  try {
4934
5060
  connectedCallback(elm);
4935
5061
  await elm.componentOnReady();
@@ -5159,7 +5285,7 @@ var registerInstance = (lazyInstance, hostRef) => {
5159
5285
  if (!hostRef) return void 0;
5160
5286
  lazyInstance.__stencil__getHostRef = () => hostRef;
5161
5287
  hostRef.$lazyInstance$ = lazyInstance;
5162
- if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.prop)) {
5288
+ if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
5163
5289
  reWireGetterSetter(lazyInstance, hostRef);
5164
5290
  }
5165
5291
  return hostRef;
@@ -5239,6 +5365,62 @@ class ChAccordion {
5239
5365
  }; }
5240
5366
  }
5241
5367
 
5368
+ const chAlertCss = () => `:host{display:block}.alert{display:flex;align-items:flex-start;gap:var(--spacing-2xl);padding:var(--spacing-2xl) var(--spacing-3xl);border:var(--border-width) solid transparent;border-radius:var(--radius);font-size:var(--typography-size-sm);line-height:1.5}.alert-content{flex:1;min-width:0;overflow-wrap:anywhere}.alert--default{color:var(--text);background:var(--surface);border-color:var(--border)}.alert--positive{color:var(--color-status-positive);background:var(--color-status-positive-background);border-color:var(--color-status-positive)}.alert--warning{color:var(--color-status-warning);background:var(--color-status-warning-background);border-color:var(--color-status-warning)}.alert-dismiss{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:inherit;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)}.alert-dismiss:hover{background:var(--surface-hover)}.alert-dismiss:focus-visible{outline:var(--focus-outline-width) solid currentColor;outline-offset:var(--focus-outline-offset)}@media (pointer: coarse){.alert-dismiss{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.alert-dismiss{transition:none}}`;
5369
+
5370
+ /**
5371
+ * Block-level status message.
5372
+ *
5373
+ * `warning` carries `role="alert"` and is announced assertively; `default` and
5374
+ * `positive` use `role="status"`, since a confirmation is not urgent enough to
5375
+ * interrupt. Both announce reliably when the alert is added to the page in
5376
+ * response to something — an alert already present at load may not be read out,
5377
+ * which is how live regions work rather than something this component controls.
5378
+ */
5379
+ class ChAlert {
5380
+ constructor(hostRef) {
5381
+ registerInstance(this, hostRef);
5382
+ this.chDismiss = createEvent(this, "chDismiss");
5383
+ }
5384
+ /**
5385
+ * The kind of message. `default` is neutral, `positive` confirms, and
5386
+ * `warning` covers both warnings and errors — the token scale has a single
5387
+ * status colour for the two of them.
5388
+ */
5389
+ variant = 'default';
5390
+ /**
5391
+ * Accessible label for the dismiss button, set as `aria-label`. Setting it
5392
+ * is what adds the button: the button's only content is a decorative glyph,
5393
+ * so without a label it would have no accessible name at all.
5394
+ */
5395
+ dismissLabel;
5396
+ /**
5397
+ * Emitted when the dismiss button is clicked. The alert stays in the DOM —
5398
+ * whether to remove it is the consumer's decision. If you do remove it, move
5399
+ * focus somewhere sensible first: removing the focused button drops focus to
5400
+ * `<body>`.
5401
+ */
5402
+ chDismiss;
5403
+ handleDismiss = () => {
5404
+ this.chDismiss.emit();
5405
+ };
5406
+ render() {
5407
+ const role = this.variant === 'warning' ? 'alert' : 'status';
5408
+ return (hAsync(Host, { key: '7d96602ad2c2b3824588f01d5b94d73098da6ce4' }, hAsync("div", { key: role, class: { alert: true, [`alert--${this.variant}`]: true }, role: role }, hAsync("div", { key: '64d7af5aad0e4b103b35cc2ba3756b1a1601b148', class: "alert-content" }, hAsync("slot", { key: '44573092407161bbeafe5117bddb54168b183d90' })), this.dismissLabel && (hAsync("button", { key: '018858ac292c0fb7f26c788f629638f533d0dfd6', class: "alert-dismiss", type: "button", "aria-label": this.dismissLabel, onClick: this.handleDismiss }, hAsync("span", { key: 'f6454d5285ed9c7c414d839d2d35d2ce0c271dd4', "aria-hidden": "true" }, "\u00D7"))))));
5409
+ }
5410
+ static get style() { return chAlertCss(); }
5411
+ static get cmpMeta() { return {
5412
+ "$flags$": 777,
5413
+ "$tagName$": "ch-alert",
5414
+ "$members$": {
5415
+ "variant": [1],
5416
+ "dismissLabel": [1, "dismiss-label"]
5417
+ },
5418
+ "$listeners$": undefined,
5419
+ "$lazyBundleId$": "-",
5420
+ "$attrsToReflect$": []
5421
+ }; }
5422
+ }
5423
+
5242
5424
  const chBadgeCss = () => `:host{display:inline-block}.badge{display:inline-block;padding:var(--spacing-2xs) var(--spacing-lg);border-radius:var(--radius-pill);font-size:var(--typography-size-xs);font-weight:var(--typography-weight-semibold);text-transform:uppercase;letter-spacing:var(--typography-tracking-badge)}.badge--default{background:var(--color-surface-hover);color:var(--accent)}.badge--positive{background:var(--color-status-positive-background);color:var(--color-status-positive)}.badge--warning{background:var(--color-status-warning-background);color:var(--color-status-warning)}`;
5243
5425
 
5244
5426
  class ChBadge {
@@ -5250,7 +5432,7 @@ class ChBadge {
5250
5432
  */
5251
5433
  variant = 'default';
5252
5434
  render() {
5253
- return (hAsync(Host, { key: 'c0acd8486b8265884b3c4a2a5a68bf10098a09cd' }, hAsync("span", { key: '2ae6af3f7ac4c6967dc6eefe607b3910ba341741', class: { badge: true, [`badge--${this.variant}`]: true } }, hAsync("slot", { key: '2aab4bb7e25492dc01cb94cf055efde3897f736b' }))));
5435
+ return (hAsync(Host, { key: 'ca1fb0c9d678b6ea5b68ca131ba153116bbd577d' }, hAsync("span", { key: '929e2268094bdad7df6e3c8371896e364ebf79c3', class: { badge: true, [`badge--${this.variant}`]: true } }, hAsync("slot", { key: '64422988ad046244722755d39e564295f79a6ce1' }))));
5254
5436
  }
5255
5437
  static get style() { return chBadgeCss(); }
5256
5438
  static get cmpMeta() { return {
@@ -5294,7 +5476,7 @@ class ChButton {
5294
5476
  this.chClick.emit(ev);
5295
5477
  };
5296
5478
  render() {
5297
- return (hAsync(Host, { key: '1fc74b55b6d69be97fba63f0fb2d72ffd217eafb' }, hAsync("button", { key: 'af6721f9eb066f7e0cb7a23031d43eb46fbbdf9e', class: { btn: true, [`btn--${this.variant}`]: true }, type: "button", disabled: this.disabled, "aria-label": this.label, onClick: this.handleClick }, hAsync("slot", { key: '2c42b74352aa7a79ac6bc231cdd828b7a62f5083' }))));
5479
+ return (hAsync(Host, { key: '9363b49e8d38c0fab49ed10356380ded20a8cf5e' }, hAsync("button", { key: '3c98506ae1418c4bc88f5aa72dfe058948556ed5', class: { btn: true, [`btn--${this.variant}`]: true }, type: "button", disabled: this.disabled, "aria-label": this.label, onClick: this.handleClick }, hAsync("slot", { key: 'cdcf4f656b995fa527d4139a41b2ea3c7086e065' }))));
5298
5480
  }
5299
5481
  static get style() { return chButtonCss(); }
5300
5482
  static get cmpMeta() { return {
@@ -5318,7 +5500,7 @@ class ChCard {
5318
5500
  registerInstance(this, hostRef);
5319
5501
  }
5320
5502
  render() {
5321
- return (hAsync(Host, { key: '89781abc150f0078e9d36233f02d2bb29f3d2cc1' }, hAsync("div", { key: '41271ca28fd5c045a4dad746ec7e2c7264a35aac', class: "card" }, hAsync("slot", { key: '1786ea797968b94fc48de08836fc0195b0731469' }))));
5503
+ return (hAsync(Host, { key: '1541ba4361c996716356fb87cdcc73b1260d4c6a' }, hAsync("div", { key: '924070eeb79f6c8f8e6362772bbab0dcc1c6f315', class: "card" }, hAsync("slot", { key: '2fde36426395a519cb1ebe265ba0eef3aaf6ff38' }))));
5322
5504
  }
5323
5505
  static get style() { return chCardCss(); }
5324
5506
  static get cmpMeta() { return {
@@ -5398,7 +5580,7 @@ class ChCheckbox {
5398
5580
  return undefined;
5399
5581
  }
5400
5582
  render() {
5401
- return (hAsync(Host, { key: '746f0c29ea01a3a0c24360d964b3c0d65985f941' }, hAsync("label", { key: '9e423a2055ec4e2d77848b7c4b86cb200315a77d', class: { 'control': true, 'control--disabled': this.disabled }, htmlFor: this.checkboxId }, hAsync("input", { key: 'b355914b0b02c9887f93e2a50fcebaf60b21d5bb', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && hAsync("span", { key: '6f7128ccac345af5c9224c0388f960575aebc150', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '402417ceee995e578248307a24ba6f9b1955bda8', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '281930b92221157759d3652391b0cdc337a1f25d', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
5583
+ return (hAsync(Host, { key: '130d1bf88ae8c73befe7ac288a0d4b7113fd73f7' }, hAsync("label", { key: '6a3dd5bd889a9b41dda934b7c804de3ff2a63584', class: { 'control': true, 'control--disabled': this.disabled }, htmlFor: this.checkboxId }, hAsync("input", { key: '9978d057782e3cf31a2fa7b4042b5d070e015be0', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && hAsync("span", { key: '8b12d266d0693b6ad710c5a72df4b3c138435ef1', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '7aa3b14ccdfb216d8bc831c820e5438e166dab1c', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'aeacbc8e1f98162182149e55fde0d8d588c97fa4', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
5402
5584
  }
5403
5585
  static get style() { return chCheckboxCss(); }
5404
5586
  static get cmpMeta() { return {
@@ -5432,7 +5614,7 @@ class ChDivider {
5432
5614
  */
5433
5615
  orientation = 'horizontal';
5434
5616
  render() {
5435
- return (hAsync(Host, { key: '30ad155d178afd93745eb4072a2d9a8012705191', class: { 'divider--vertical': this.orientation === 'vertical' } }, hAsync("hr", { key: 'ce239ccdebec97a2735e14ad62b81d14888881a5', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
5617
+ return (hAsync(Host, { key: '888debaaee690d5bbc5e276773f16ac7ead0129a', class: { 'divider--vertical': this.orientation === 'vertical' } }, hAsync("hr", { key: 'ae175f047605cfbe2b24d50e0dab56ac362c49a1', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
5436
5618
  }
5437
5619
  static get style() { return chDividerCss(); }
5438
5620
  static get cmpMeta() { return {
@@ -5527,7 +5709,7 @@ class ChInput {
5527
5709
  return undefined;
5528
5710
  }
5529
5711
  render() {
5530
- return (hAsync(Host, { key: '82557c17d49bf048b7056853a088565a243325be' }, this.label && (hAsync("label", { key: 'cc774b0001daa6c7f4e4bb8d62ea21698bd744e9', class: "label", htmlFor: this.inputId }, this.label)), hAsync("input", { key: 'dc30d9f798611a0a4bb577c18a2696d065a281ee', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.invalid }, type: this.type, name: this.name, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '21b76002a309dfe167e671fd270699f8699ed6b9', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'be64956da00a76dccdbf0979f3352b263a21fb12', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
5712
+ return (hAsync(Host, { key: '56ef5eab354235c89214be28263cde91168f5dee' }, this.label && (hAsync("label", { key: '745fe11f607591d1c571dcf7d9429d834dfa4f2b', class: "label", htmlFor: this.inputId }, this.label)), hAsync("input", { key: '18739cebe47aa1130b55fa5aaf184a1f3fad88d2', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.invalid }, type: this.type, name: this.name, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '60a43287f6329db3f4b27ad882300fced0925645', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'ea18e90000f1a244cbe51126441b5d260562e07a', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
5531
5713
  }
5532
5714
  static get style() { return chInputCss(); }
5533
5715
  static get cmpMeta() { return {
@@ -5605,6 +5787,195 @@ class ChLink {
5605
5787
  }; }
5606
5788
  }
5607
5789
 
5790
+ const chModalCss = () => `.modal{box-sizing:border-box;max-width:min(32rem, calc(100vw - var(--spacing-6xl)));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::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}}`;
5791
+
5792
+ let openModals = 0;
5793
+ let previousOverflow = '';
5794
+ let previousPaddingRight = '';
5795
+ /**
5796
+ * Modal dialog, built on the native `<dialog>` element and opened with
5797
+ * `showModal()`.
5798
+ *
5799
+ * The browser therefore supplies the parts that are easy to get wrong: moving
5800
+ * focus into the dialog and returning it afterwards, marking the rest of the
5801
+ * document inert, `Escape` to close, the top layer, `::backdrop`, and the
5802
+ * implicit `dialog` role with `aria-modal="true"`. Notably it does not trap
5803
+ * focus, which is deliberate — the W3C APA group concluded a modal should let
5804
+ * keyboard users reach browser UI, so a hand-rolled trap would be less
5805
+ * correct, not more.
5806
+ *
5807
+ * What the platform does not cover, and this component adds: locking the page
5808
+ * behind the dialog so it cannot scroll, and closing when the backdrop is
5809
+ * clicked. The latter is `closedby="any"` in the platform, which Safari does
5810
+ * not support yet, so it is implemented here for every browser alike rather
5811
+ * than only for some.
5812
+ */
5813
+ class ChModal {
5814
+ constructor(hostRef) {
5815
+ registerInstance(this, hostRef);
5816
+ this.chOpen = createEvent(this, "chOpen");
5817
+ this.chClose = createEvent(this, "chClose");
5818
+ }
5819
+ /**
5820
+ * Whether the dialog is open. Kept in sync when the user closes it with
5821
+ * `Escape`, the close button or a click outside.
5822
+ */
5823
+ open = false;
5824
+ /**
5825
+ * Accessible name for the dialog, set as `aria-label`. A slotted heading
5826
+ * cannot be referenced with `aria-labelledby` across the shadow boundary, so
5827
+ * the name comes through this prop — and a modal dialog needs one, so pass
5828
+ * the same text as the heading.
5829
+ */
5830
+ label;
5831
+ /**
5832
+ * Accessible label for the close button, set as `aria-label`. Setting it is
5833
+ * what adds the button: its only content is a decorative glyph, so without a
5834
+ * label it would have no accessible name.
5835
+ */
5836
+ closeLabel;
5837
+ /**
5838
+ * Emitted after the dialog opens.
5839
+ */
5840
+ chOpen;
5841
+ /**
5842
+ * Emitted after the dialog closes, however it was closed.
5843
+ */
5844
+ chClose;
5845
+ dialog;
5846
+ scrollLocked = false;
5847
+ pointerDownedOutside = false;
5848
+ componentDidLoad() {
5849
+ // Wired here rather than in JSX because Stencil derives a listener's event
5850
+ // name from whether `on<name>` exists on `window`, which differs between
5851
+ // the browser and the test environment for pointer events.
5852
+ this.dialog?.addEventListener('close', this.handleNativeClose);
5853
+ this.dialog?.addEventListener('pointerdown', this.handlePointerDown);
5854
+ this.dialog?.addEventListener('click', this.handleClick);
5855
+ if (this.open) {
5856
+ this.showDialog();
5857
+ }
5858
+ }
5859
+ disconnectedCallback() {
5860
+ this.dialog?.removeEventListener('close', this.handleNativeClose);
5861
+ this.dialog?.removeEventListener('pointerdown', this.handlePointerDown);
5862
+ this.dialog?.removeEventListener('click', this.handleClick);
5863
+ this.unlockScroll();
5864
+ }
5865
+ handleOpenChange(open) {
5866
+ if (open) {
5867
+ this.showDialog();
5868
+ }
5869
+ else {
5870
+ this.closeDialog();
5871
+ }
5872
+ }
5873
+ showDialog() {
5874
+ if (typeof this.dialog?.showModal !== 'function') {
5875
+ return;
5876
+ }
5877
+ this.lockScroll();
5878
+ this.dialog.showModal();
5879
+ this.chOpen.emit();
5880
+ }
5881
+ closeDialog() {
5882
+ if (typeof this.dialog?.close === 'function' && this.dialog.open) {
5883
+ this.dialog.close();
5884
+ }
5885
+ }
5886
+ lockScroll() {
5887
+ if (this.scrollLocked) {
5888
+ return;
5889
+ }
5890
+ this.scrollLocked = true;
5891
+ openModals += 1;
5892
+ if (openModals > 1) {
5893
+ return;
5894
+ }
5895
+ const root = document.documentElement;
5896
+ const scrollbar = window.innerWidth - root.clientWidth;
5897
+ previousOverflow = root.style.overflow;
5898
+ previousPaddingRight = root.style.paddingRight;
5899
+ root.style.overflow = 'hidden';
5900
+ if (scrollbar > 0) {
5901
+ root.style.paddingRight = `${scrollbar}px`;
5902
+ }
5903
+ }
5904
+ unlockScroll() {
5905
+ if (!this.scrollLocked) {
5906
+ return;
5907
+ }
5908
+ this.scrollLocked = false;
5909
+ openModals -= 1;
5910
+ if (openModals > 0) {
5911
+ return;
5912
+ }
5913
+ const root = document.documentElement;
5914
+ root.style.overflow = previousOverflow;
5915
+ root.style.paddingRight = previousPaddingRight;
5916
+ }
5917
+ /**
5918
+ * True for a pointer event on the backdrop: the `<dialog>` is the event
5919
+ * target for its own box only, and the coordinates fall outside that box.
5920
+ */
5921
+ isOnBackdrop(event) {
5922
+ if (!this.dialog || event.target !== this.dialog) {
5923
+ return false;
5924
+ }
5925
+ const box = this.dialog.getBoundingClientRect();
5926
+ return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
5927
+ }
5928
+ handlePointerDown = (event) => {
5929
+ this.pointerDownedOutside = this.isOnBackdrop(event);
5930
+ };
5931
+ handleClick = (event) => {
5932
+ // Requiring the press to have started on the backdrop too keeps a
5933
+ // selection dragged out of the dialog, and a keyboard-synthesised click
5934
+ // (which reports coordinates of 0), from closing it.
5935
+ const dismiss = this.pointerDownedOutside && this.isOnBackdrop(event);
5936
+ this.pointerDownedOutside = false;
5937
+ if (dismiss) {
5938
+ this.closeDialog();
5939
+ }
5940
+ };
5941
+ handleNativeClose = () => {
5942
+ this.unlockScroll();
5943
+ if (this.open) {
5944
+ this.open = false;
5945
+ }
5946
+ this.chClose.emit();
5947
+ };
5948
+ handleCloseClick = () => {
5949
+ if (typeof this.dialog?.close === 'function' && this.dialog.open) {
5950
+ this.dialog.close();
5951
+ return;
5952
+ }
5953
+ this.open = false;
5954
+ this.chClose.emit();
5955
+ };
5956
+ render() {
5957
+ return (hAsync(Host, { key: '92edf16d3ff079f72a4785ec9852e3e25218fd35' }, hAsync("dialog", { key: '546fc72a098e1e2d8c05fafa2f11eac19ff83fd3', class: "modal", "aria-label": this.label, ref: el => (this.dialog = el) }, hAsync("div", { key: '5a67aa39b6687db89d97533eb54d3a3b663bed56', class: "modal-head" }, hAsync("slot", { key: '2e44b59a7c5e6af4a110a7f86362964ddd30d215', name: "heading" }), this.closeLabel && (hAsync("button", { key: 'ce70baaa876c9f7b82865f0547e8e8cef5d5dfde', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, hAsync("span", { key: 'df4536a8851a1ca9d3d2c46d15d18856660a54f6', "aria-hidden": "true" }, "\u00D7")))), hAsync("div", { key: '5de77062134ccd90643df17d7b0d0ddb161f6a5f', class: "modal-body" }, hAsync("slot", { key: '3b64493e9236b311a4b2f5250c5027f866bce8fd' })))));
5958
+ }
5959
+ static get watchers() { return {
5960
+ "open": [{
5961
+ "handleOpenChange": 0
5962
+ }]
5963
+ }; }
5964
+ static get style() { return chModalCss(); }
5965
+ static get cmpMeta() { return {
5966
+ "$flags$": 777,
5967
+ "$tagName$": "ch-modal",
5968
+ "$members$": {
5969
+ "open": [1028],
5970
+ "label": [1],
5971
+ "closeLabel": [1, "close-label"]
5972
+ },
5973
+ "$listeners$": undefined,
5974
+ "$lazyBundleId$": "-",
5975
+ "$attrsToReflect$": []
5976
+ }; }
5977
+ }
5978
+
5608
5979
  const chRadioCss = () => `:host{display:inline-block}.group-label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.radio-group{display:flex;flex-direction:column;gap:var(--spacing-lg)}.control{display:inline-flex;align-items:center;gap:var(--spacing-lg);cursor:pointer}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--spacing-4xl);height:var(--spacing-4xl);margin:0;flex-shrink:0;border:var(--border-width) solid var(--border);border-radius:50%;background:var(--surface);cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.input:checked{border-color:var(--accent)}.input:checked::before{content:'';width:var(--spacing-md);height:var(--spacing-md);border-radius:50%;background:var(--accent)}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus-visible{outline-color:var(--color-status-warning)}.label-text{color:var(--text)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
5609
5980
 
5610
5981
  let radioIds = 0;
@@ -5675,7 +6046,7 @@ class ChRadio {
5675
6046
  }
5676
6047
  render() {
5677
6048
  const groupName = this.name || `${this.groupId}-group`;
5678
- return (hAsync(Host, { key: 'd9a24c29e5fe841d5c6fefc68bc22db1d9c4ee02' }, this.label && (hAsync("span", { key: 'c8dc580a29569ca98f7e6dafce797fa6ac5f7442', class: "group-label", id: this.labelId }, this.label)), hAsync("div", { key: '6b10d53fbf83286ad18b29d3238df4927b3341db', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (hAsync("label", { class: { 'control': true, 'control--disabled': this.disabled || option.disabled } }, hAsync("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), hAsync("span", { class: "mark" }), hAsync("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '654315541c6b5ed2886283fae2fb72c37f91f575', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '1ed129bddbf96f3b6562552edf416293a0ba0071', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
6049
+ return (hAsync(Host, { key: '68ce563b4a03669b76ff3822705b1ff92c4c02f2' }, this.label && (hAsync("span", { key: '1887f5b70a5bf9f049495d76588458181d3f7735', class: "group-label", id: this.labelId }, this.label)), hAsync("div", { key: 'c38ee340f9527e16c5587f2309f91ea463bb7cad', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (hAsync("label", { class: { 'control': true, 'control--disabled': this.disabled || option.disabled } }, hAsync("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), hAsync("span", { class: "mark" }), hAsync("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: 'ad60ce772279809ee334fc30182be1d0350d5586', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '316c911f9e1a29d17cc2d6b0e60ed35755420ae2', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
5679
6050
  }
5680
6051
  static get style() { return chRadioCss(); }
5681
6052
  static get cmpMeta() { return {
@@ -5769,7 +6140,7 @@ class ChSelect {
5769
6140
  return undefined;
5770
6141
  }
5771
6142
  render() {
5772
- return (hAsync(Host, { key: '206697f7162cbac4e5486a937d7e44bb971b6ee4' }, this.label && (hAsync("label", { key: '664e7423e7ac1a5dd6c626f2094c0ffe63d7ea36', class: "label", htmlFor: this.selectId }, this.label)), hAsync("select", { key: 'd010c2ea52bf449d823d115fa835b53dfa28390a', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (hAsync("option", { key: '9a28e73a3ef6742d037eaa825f1a66dfd4447ae6', value: "", disabled: true, hidden: true, selected: !this.value }, this.placeholder)), this.options.map(option => (hAsync("option", { value: option.value, disabled: option.disabled, selected: option.value === this.value }, option.label)))), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '6d3ff7d72bc488b723a3d9cd0982f5e3d4d46c87', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'bbc4b768cb94c39b57663d27a86b886e2ff9a556', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
6143
+ return (hAsync(Host, { key: '90aaf1fa70da54071539de8a22ebe9373f2ae90a' }, this.label && (hAsync("label", { key: '8b14b4deb611c4f1eb496c6f0d3fa58b7c4342b6', class: "label", htmlFor: this.selectId }, this.label)), hAsync("select", { key: 'c93b4ba079e9e61ef5bb2392256545af73263665', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (hAsync("option", { key: 'df8e97bdb0bd3e5426558027d34c1eb63ee76f1e', value: "", disabled: true, hidden: true, selected: !this.value }, this.placeholder)), this.options.map(option => (hAsync("option", { value: option.value, disabled: option.disabled, selected: option.value === this.value }, option.label)))), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '6b6078e31a1a2f183951f5ada63a5e7e7f582f96', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'f7791b37b8660441a43a6b45d99472b2df7df0ab', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
5773
6144
  }
5774
6145
  static get style() { return chSelectCss(); }
5775
6146
  static get cmpMeta() { return {
@@ -5793,6 +6164,51 @@ class ChSelect {
5793
6164
  }; }
5794
6165
  }
5795
6166
 
6167
+ const chSpinnerCss = () => `:host{display:inline-block;vertical-align:middle}.spinner{display:block;box-sizing:border-box;width:1em;height:1em;border:0.125em solid currentColor;border-top-color:transparent;border-radius:50%;animation:ch-spinner-rotate var(--duration-spin) var(--easing-linear) infinite}.spinner--sm{font-size:var(--typography-size-sm)}.spinner--md{font-size:var(--typography-size-lg)}.spinner--lg{font-size:var(--typography-size-xl)}@keyframes ch-spinner-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spinner{animation-duration:calc(var(--duration-spin) * 4)}}`;
6168
+
6169
+ /**
6170
+ * Loading indicator.
6171
+ *
6172
+ * The spinner is drawn in `currentColor`, so it takes the surrounding text
6173
+ * colour and stays legible on any surface — inside a primary `ch-button` it
6174
+ * picks up the button's own text colour instead of the accent, which would be
6175
+ * invisible there. Set `color` on or above the element to change it.
6176
+ */
6177
+ class ChSpinner {
6178
+ constructor(hostRef) {
6179
+ registerInstance(this, hostRef);
6180
+ }
6181
+ /**
6182
+ * The size of the spinner. Either `sm`, `md`, or `lg`. Each size sets a
6183
+ * font-size and the spinner is drawn in `em`, so it also scales with an
6184
+ * inherited font-size.
6185
+ */
6186
+ size = 'md';
6187
+ /**
6188
+ * Accessible label announced while the spinner is visible, e.g. `Cargando
6189
+ * resultados`. When omitted the spinner is treated as decorative and hidden
6190
+ * from assistive technology — the right behaviour next to visible loading
6191
+ * text, which would otherwise be announced twice.
6192
+ */
6193
+ label;
6194
+ render() {
6195
+ const labelled = Boolean(this.label);
6196
+ return (hAsync(Host, { key: 'dc7c7e19f6a6878680555b0d7dbd84f5dc5774c8' }, hAsync("span", { key: 'd29d5f3344ae578d2a28382b13b45b901d41e52b', class: { spinner: true, [`spinner--${this.size}`]: true }, role: labelled ? 'status' : undefined, "aria-label": labelled ? this.label : undefined, "aria-hidden": labelled ? undefined : 'true' })));
6197
+ }
6198
+ static get style() { return chSpinnerCss(); }
6199
+ static get cmpMeta() { return {
6200
+ "$flags$": 521,
6201
+ "$tagName$": "ch-spinner",
6202
+ "$members$": {
6203
+ "size": [1],
6204
+ "label": [1]
6205
+ },
6206
+ "$listeners$": undefined,
6207
+ "$lazyBundleId$": "-",
6208
+ "$attrsToReflect$": []
6209
+ }; }
6210
+ }
6211
+
5796
6212
  const chSwitchCss = () => `:host{display:inline-block}.control{position:relative;display:inline-flex;align-items:center;gap:var(--spacing-lg);cursor:pointer}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.input:focus-visible~.track{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.track{position:relative;box-sizing:border-box;width:var(--spacing-6xl);height:var(--spacing-5xl);flex-shrink:0;border:var(--border-width) solid var(--border);border-radius:var(--radius-pill);background:var(--surface);transition:border-color var(--duration-normal) var(--easing-default), background-color var(--duration-normal) var(--easing-default)}.thumb{position:absolute;top:50%;left:var(--spacing-2xs);width:var(--spacing-2xl);height:var(--spacing-2xl);border-radius:50%;background:var(--text-muted);transform:translateY(-50%);transition:left var(--duration-normal) var(--easing-default), background-color var(--duration-normal) var(--easing-default)}.input:checked~.track{border-color:var(--accent);background:var(--accent)}.input:checked~.track .thumb{left:calc(100% - var(--spacing-2xl) - var(--spacing-2xs));background:var(--color-accent-text)}.input--invalid~.track{border-color:var(--color-status-warning)}.input--invalid:focus-visible~.track{outline-color:var(--color-status-warning)}.label-text{color:var(--text)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
5797
6213
 
5798
6214
  let switchIds = 0;
@@ -5860,7 +6276,7 @@ class ChSwitch {
5860
6276
  return undefined;
5861
6277
  }
5862
6278
  render() {
5863
- return (hAsync(Host, { key: 'a2872e01803daa52a44e9ffe16e5c57ebd8f2a93' }, hAsync("label", { key: 'fb94e4de3381b617a17b8aec2342ee5c72be775a', class: { 'control': true, 'control--disabled': this.disabled }, htmlFor: this.switchId }, hAsync("input", { key: '4861655716af08d93965d78d98fe09a871ab409b', id: this.switchId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, required: this.required, "aria-checked": this.checked ? 'true' : 'false', "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), hAsync("span", { key: 'e94675c142dd85c09d1e188a80cffc6978e98369', class: "track" }, hAsync("span", { key: '9ffbd604a65b8530cb9f67c44ec81adc206acdfe', class: "thumb" })), this.label && hAsync("span", { key: 'c8c1cf4745dd7cf9647101269b02cf3d75d8ded4', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: 'aa3afe7f4720766c7e0ab4cdc6baae85f68c8577', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '274e2599ccbd6d5ff6df8fad7bf9c59efcc0ffb6', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
6279
+ return (hAsync(Host, { key: 'f95f9b724e37771ea3949ff569881dc1eff370a1' }, hAsync("label", { key: '878c3c47e380356a3b79e79fdd135df627ce37a6', class: { 'control': true, 'control--disabled': this.disabled }, htmlFor: this.switchId }, hAsync("input", { key: '14ee6041b8aeb4115db1f7ca9c542314651f34ea', id: this.switchId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, required: this.required, "aria-checked": this.checked ? 'true' : 'false', "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), hAsync("span", { key: '0d58863f220b6e9f04babd6231a35dea039a41a2', class: "track" }, hAsync("span", { key: '588617f6bb1c61168b860c4b2863892828fd5df5', class: "thumb" })), this.label && hAsync("span", { key: '530e64cc85761e91a019431f977bb9d2d8e86e27', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '71ffd6b56a753673f9d5663054a217e250363ce1', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '63f9965c30d8cd2820554de31ac7edc364aee22b', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
5864
6280
  }
5865
6281
  static get style() { return chSwitchCss(); }
5866
6282
  static get cmpMeta() { return {
@@ -5967,7 +6383,7 @@ class ChTabs {
5967
6383
  }
5968
6384
  render() {
5969
6385
  const active = this.activeValue;
5970
- return (hAsync(Host, { key: '76a7f50b0cfa62b3a9a97114c99ab217da83aeb3' }, hAsync("div", { key: '544691573ac6940ec8406e8377ac0ed5fd95140e', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
6386
+ return (hAsync(Host, { key: '0467e7ea24884d4c19c33b736a07303569dfaa3b' }, hAsync("div", { key: '8ad451816ef31809c82486f3c9dd36b6e89e77e5', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
5971
6387
  const selected = tab.value === active;
5972
6388
  return (hAsync("button", { key: tab.value, type: "button", class: { 'tab': true, 'tab--active': selected, 'tab--disabled': Boolean(tab.disabled) }, role: "tab", id: this.tabId(tab.value), "data-value": tab.value, "aria-selected": selected ? 'true' : 'false', "aria-controls": this.panelId(tab.value), tabIndex: selected ? FIRST_TAB_INDEX : LAST_TAB_INDEX, disabled: tab.disabled, onClick: () => this.select(tab.value) }, tab.label));
5973
6389
  })), this.tabs.map(tab => (hAsync("div", { key: `${tab.value}-panel`, class: "tabpanel", id: this.panelId(tab.value), role: "tabpanel", "aria-labelledby": this.tabId(tab.value), tabIndex: FIRST_TAB_INDEX, hidden: tab.value !== active }, hAsync("slot", { name: `panel-${tab.value}` }))))));
@@ -6068,7 +6484,7 @@ class ChTextarea {
6068
6484
  return undefined;
6069
6485
  }
6070
6486
  render() {
6071
- return (hAsync(Host, { key: '90ce8125e93dee720379afabe1aaa5de55534581' }, this.label && (hAsync("label", { key: '6b34d5e3a2a765b1ef799952e40f8661fd747daf', class: "label", htmlFor: this.textareaId }, this.label)), hAsync("textarea", { key: '096be417a6e7fee736a246ab19f894d4ba2da9c7', id: this.label ? this.textareaId : undefined, class: { 'textarea': true, 'textarea--invalid': this.invalid }, rows: this.rows, name: this.name, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: 'fedff430ddcfe43965696683203465c1d6e03edc', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'f4a68f2976b14eca667c6ed4b648aa8df88d548a', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
6487
+ return (hAsync(Host, { key: '1e5846687f73807b36da2328106aec84bdecb7cb' }, this.label && (hAsync("label", { key: '9a8d410d07bb6b9cc9a5329088786de6365af507', class: "label", htmlFor: this.textareaId }, this.label)), hAsync("textarea", { key: '7353cc267072e7df111d94ad0466588d0b7e77d8', id: this.label ? this.textareaId : undefined, class: { 'textarea': true, 'textarea--invalid': this.invalid }, rows: this.rows, name: this.name, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '5b953e2c568b151c502404fccc4a79d6d6e516f9', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'bc500a5bd32ac35cf4de723b02cb42f459614c39', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
6072
6488
  }
6073
6489
  static get style() { return chTextareaCss(); }
6074
6490
  static get cmpMeta() { return {
@@ -6092,8 +6508,112 @@ class ChTextarea {
6092
6508
  }; }
6093
6509
  }
6094
6510
 
6511
+ const chTooltipCss = () => `:host{display:inline-block}.anchor{position:relative;display:inline-flex}.bubble{position:absolute;z-index:var(--z-index-dropdown);width:max-content;max-width:16rem;padding:var(--spacing-md) var(--spacing-2xl);border:var(--border-width) solid var(--border);border-radius:var(--radius-sm);background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-sm);line-height:1.4;opacity:0;visibility:hidden;transition:opacity var(--duration-fast) var(--easing-default), visibility var(--duration-fast) var(--easing-default)}.bubble--visible{opacity:1;visibility:visible}.bubble::before{content:'';position:absolute}.bubble--top{bottom:100%;left:50%;transform:translateX(-50%);margin-bottom:var(--spacing-md)}.bubble--top::before{top:100%;left:0;right:0;height:var(--spacing-md)}.bubble--bottom{top:100%;left:50%;transform:translateX(-50%);margin-top:var(--spacing-md)}.bubble--bottom::before{bottom:100%;left:0;right:0;height:var(--spacing-md)}.bubble--left{right:100%;top:50%;transform:translateY(-50%);margin-right:var(--spacing-md)}.bubble--left::before{left:100%;top:0;bottom:0;width:var(--spacing-md)}.bubble--right{left:100%;top:50%;transform:translateY(-50%);margin-left:var(--spacing-md)}.bubble--right::before{right:100%;top:0;bottom:0;width:var(--spacing-md)}@media (prefers-reduced-motion: reduce){.bubble{transition:none}}`;
6512
+
6513
+ let tooltipIds = 0;
6514
+ /**
6515
+ * Short help text shown on hover and on focus.
6516
+ *
6517
+ * Both the trigger and the text come from the consumer's light DOM through
6518
+ * named slots. That is what makes the accessible association work: an
6519
+ * `aria-describedby` IDREF only resolves within a single tree, and slotted
6520
+ * nodes stay in the document tree even though they render inside the shadow
6521
+ * root. Keeping the text in the shadow root instead would need a reference
6522
+ * pointing into a shadow tree, which the platform does not allow — element
6523
+ * reflection only points outwards, and `referenceTarget` is not available yet.
6524
+ *
6525
+ * The trigger has to be a natively focusable element (`<button>`, `<a>`,
6526
+ * `<input>`). A chucao component such as `ch-button` will not be described,
6527
+ * because `aria-*` set on a custom element host does not reach the native
6528
+ * element inside it — see the discussion in issue #47.
6529
+ */
6530
+ class ChTooltip {
6531
+ constructor(hostRef) {
6532
+ registerInstance(this, hostRef);
6533
+ }
6534
+ get el() { return getElement(this); }
6535
+ fallbackId = `ch-tooltip-${++tooltipIds}`;
6536
+ /**
6537
+ * Which side of the trigger the bubble is placed on.
6538
+ */
6539
+ placement = 'top';
6540
+ // Hover and focus are tracked apart so that neither cancels the other: a
6541
+ // pointer passing over and away must not hide a tooltip whose trigger still
6542
+ // holds keyboard focus.
6543
+ hovered = false;
6544
+ focused = false;
6545
+ dismissed = false;
6546
+ get visible() {
6547
+ return (this.hovered || this.focused) && !this.dismissed;
6548
+ }
6549
+ componentDidLoad() {
6550
+ this.associate();
6551
+ }
6552
+ handleMouseEnter() {
6553
+ this.hovered = true;
6554
+ this.dismissed = false;
6555
+ }
6556
+ handleMouseLeave() {
6557
+ this.hovered = false;
6558
+ }
6559
+ handleFocusIn() {
6560
+ this.focused = true;
6561
+ this.dismissed = false;
6562
+ }
6563
+ handleFocusOut() {
6564
+ this.focused = false;
6565
+ }
6566
+ /**
6567
+ * Listens on the document because a tooltip opened by hovering leaves focus
6568
+ * wherever it was, so a host-scoped handler would never see the key.
6569
+ */
6570
+ handleKeyDown(event) {
6571
+ if (event.key === 'Escape' && this.visible) {
6572
+ this.dismissed = true;
6573
+ }
6574
+ }
6575
+ slotted(name) {
6576
+ return Array.from(this.el.children).find(child => child.getAttribute('slot') === name);
6577
+ }
6578
+ /**
6579
+ * Points the trigger at the text with `aria-describedby`. Re-run on
6580
+ * `slotchange` because a framework re-render can replace the slotted nodes
6581
+ * and take the attributes with them.
6582
+ */
6583
+ associate = () => {
6584
+ const trigger = this.slotted('trigger');
6585
+ const content = this.slotted('content');
6586
+ if (!trigger || !content) {
6587
+ return;
6588
+ }
6589
+ if (!content.id) {
6590
+ content.id = this.fallbackId;
6591
+ }
6592
+ content.setAttribute('role', 'tooltip');
6593
+ trigger.setAttribute('aria-describedby', content.id);
6594
+ };
6595
+ render() {
6596
+ return (hAsync(Host, { key: '654d4a12f84c94e014691e911e7c63c6c45b8755' }, hAsync("span", { key: '726269e02fedc37efc39f1561d8b9baf83d6a4cc', class: "anchor" }, hAsync("slot", { key: '876cb19249032d6d1c66f22bd2c255683b6a7f66', name: "trigger", onSlotchange: this.associate }), hAsync("span", { key: '7436eb75b40b33d0b6c8ce194245d4a08a29facb', class: { 'bubble': true, [`bubble--${this.placement}`]: true, 'bubble--visible': this.visible } }, hAsync("slot", { key: '24648cc6078d61803793df011058da9515b466b5', name: "content", onSlotchange: this.associate })))));
6597
+ }
6598
+ static get style() { return chTooltipCss(); }
6599
+ static get cmpMeta() { return {
6600
+ "$flags$": 777,
6601
+ "$tagName$": "ch-tooltip",
6602
+ "$members$": {
6603
+ "placement": [1],
6604
+ "hovered": [32],
6605
+ "focused": [32],
6606
+ "dismissed": [32]
6607
+ },
6608
+ "$listeners$": [[1, "mouseenter", "handleMouseEnter"], [1, "mouseleave", "handleMouseLeave"], [0, "focusin", "handleFocusIn"], [0, "focusout", "handleFocusOut"], [4, "keydown", "handleKeyDown"]],
6609
+ "$lazyBundleId$": "-",
6610
+ "$attrsToReflect$": []
6611
+ }; }
6612
+ }
6613
+
6095
6614
  registerComponents([
6096
6615
  ChAccordion,
6616
+ ChAlert,
6097
6617
  ChBadge,
6098
6618
  ChButton,
6099
6619
  ChCard,
@@ -6101,11 +6621,14 @@ registerComponents([
6101
6621
  ChDivider,
6102
6622
  ChInput,
6103
6623
  ChLink,
6624
+ ChModal,
6104
6625
  ChRadio,
6105
6626
  ChSelect,
6627
+ ChSpinner,
6106
6628
  ChSwitch,
6107
6629
  ChTabs,
6108
6630
  ChTextarea,
6631
+ ChTooltip,
6109
6632
  ]);
6110
6633
 
6111
6634
  exports.hydrateApp = hydrateApp;
@@ -6207,7 +6730,7 @@ var NAMESPACE = (
6207
6730
  );
6208
6731
 
6209
6732
  /*
6210
- Stencil Hydrate Runner v4.43.5 | MIT Licensed | https://stenciljs.com
6733
+ Stencil Hydrate Runner v4.44.0 | MIT Licensed | https://stenciljs.com
6211
6734
  */
6212
6735
  var __create = Object.create;
6213
6736
  var __defProp = Object.defineProperty;