@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.
- package/README.md +15 -12
- package/dist/chucao/chucao.css +1 -1
- package/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/chucao.esm.js.map +1 -1
- package/dist/chucao/index.esm.js +1 -1
- package/dist/chucao/index.esm.js.map +1 -1
- package/dist/chucao/{p-175aee94.entry.js → p-13ab5f9a.entry.js} +2 -2
- package/dist/chucao/{p-dde82d7d.entry.js → p-1cc7042e.entry.js} +2 -2
- package/dist/chucao/p-23c5220b.entry.js +2 -0
- package/dist/chucao/p-23c5220b.entry.js.map +1 -0
- package/dist/chucao/p-2d7e81b2.entry.js +2 -0
- package/dist/chucao/p-2d7e81b2.entry.js.map +1 -0
- package/dist/chucao/{p-af2c57b5.entry.js → p-421cda05.entry.js} +2 -2
- package/dist/chucao/p-Bvah_WQV.js +3 -0
- package/dist/chucao/p-Bvah_WQV.js.map +1 -0
- package/dist/chucao/{p-d75eeeea.entry.js → p-c16b18b7.entry.js} +2 -2
- package/dist/chucao/p-cbb2b478.entry.js +2 -0
- package/dist/chucao/p-cbb2b478.entry.js.map +1 -0
- package/dist/chucao/{p-fcc70c8d.entry.js → p-cfb6db53.entry.js} +2 -2
- package/dist/chucao/p-df73f786.entry.js +2 -0
- package/dist/chucao/{p-85a49fd7.entry.js → p-e8fe65bb.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/{ch-badge_6.cjs.entry.js → ch-alert_8.cjs.entry.js} +73 -9
- package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/ch-divider.cjs.entry.js +2 -2
- package/dist/cjs/ch-link.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +167 -0
- package/dist/cjs/ch-modal.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-radio.cjs.entry.js +2 -2
- package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
- package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
- package/dist/cjs/ch-tooltip.cjs.entry.js +82 -0
- package/dist/cjs/ch-tooltip.cjs.entry.js.map +1 -0
- package/dist/cjs/chucao.cjs.js +3 -3
- package/dist/cjs/chucao.cjs.js.map +1 -1
- package/dist/cjs/{index-CiYvuUBV.js → index-DMeDkSQU.js} +183 -11
- package/dist/cjs/index-DMeDkSQU.js.map +1 -0
- package/dist/cjs/index.cjs.js +12 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/ch-alert/ch-alert.css +77 -0
- package/dist/collection/components/ch-alert/ch-alert.js +118 -0
- package/dist/collection/components/ch-alert/ch-alert.js.map +1 -0
- package/dist/collection/components/ch-badge/ch-badge.js +1 -1
- package/dist/collection/components/ch-button/ch-button.js +1 -1
- package/dist/collection/components/ch-button/ch-button.js.map +1 -1
- package/dist/collection/components/ch-card/ch-card.js +1 -1
- package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
- package/dist/collection/components/ch-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.css +69 -0
- package/dist/collection/components/ch-modal/ch-modal.js +278 -0
- package/dist/collection/components/ch-modal/ch-modal.js.map +1 -0
- package/dist/collection/components/ch-radio/ch-radio.js +1 -1
- package/dist/collection/components/ch-select/ch-select.js +1 -1
- package/dist/collection/components/ch-spinner/ch-spinner.css +39 -0
- package/dist/collection/components/ch-spinner/ch-spinner.js +90 -0
- package/dist/collection/components/ch-spinner/ch-spinner.js.map +1 -0
- package/dist/collection/components/ch-switch/ch-switch.js +1 -1
- package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
- package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.css +100 -0
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +168 -0
- package/dist/collection/components/ch-tooltip/ch-tooltip.js.map +1 -0
- package/dist/collection/tokens/tokens.js +9 -1
- package/dist/collection/tokens/tokens.js.map +1 -1
- package/dist/collection/tokens/types.js.map +1 -1
- package/dist/components/ch-accordion.js +1 -1
- package/dist/components/ch-alert.d.ts +11 -0
- package/dist/components/ch-alert.js +2 -0
- package/dist/components/ch-alert.js.map +1 -0
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-button.js.map +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-card.js.map +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-link.js +1 -1
- package/dist/components/ch-modal.d.ts +11 -0
- package/dist/components/ch-modal.js +2 -0
- package/dist/components/ch-modal.js.map +1 -0
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-spinner.d.ts +11 -0
- package/dist/components/ch-spinner.js +2 -0
- package/dist/components/ch-spinner.js.map +1 -0
- package/dist/components/ch-switch.js +1 -1
- package/dist/components/ch-tabs.js +1 -1
- package/dist/components/ch-textarea.js +1 -1
- package/dist/components/ch-tooltip.d.ts +11 -0
- package/dist/components/ch-tooltip.js +2 -0
- package/dist/components/ch-tooltip.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/p-hyy-cLgi.js +2 -0
- package/dist/components/p-hyy-cLgi.js.map +1 -0
- package/dist/esm/ch-accordion.entry.js +1 -1
- package/dist/esm/{ch-badge_6.entry.js → ch-alert_8.entry.js} +72 -10
- package/dist/esm/ch-alert_8.entry.js.map +1 -0
- package/dist/esm/ch-checkbox.entry.js +2 -2
- package/dist/esm/ch-divider.entry.js +2 -2
- package/dist/esm/ch-link.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +165 -0
- package/dist/esm/ch-modal.entry.js.map +1 -0
- package/dist/esm/ch-radio.entry.js +2 -2
- package/dist/esm/ch-tabs.entry.js +2 -2
- package/dist/esm/ch-textarea.entry.js +2 -2
- package/dist/esm/ch-tooltip.entry.js +80 -0
- package/dist/esm/ch-tooltip.entry.js.map +1 -0
- package/dist/esm/chucao.js +4 -4
- package/dist/esm/chucao.js.map +1 -1
- package/dist/esm/{index-ImsAHlk9.js → index-Bvah_WQV.js} +183 -12
- package/dist/esm/index-Bvah_WQV.js.map +1 -0
- package/dist/esm/index.js +10 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/ch-alert/ch-alert.d.ts +34 -0
- package/dist/types/components/ch-modal/ch-modal.d.ts +67 -0
- package/dist/types/components/ch-spinner/ch-spinner.d.ts +25 -0
- package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +47 -0
- package/dist/types/components.d.ts +369 -0
- package/dist/types/stencil-public-runtime.d.ts +11 -0
- package/dist/types/tokens/tokens.d.ts +8 -0
- package/dist/types/tokens/types.d.ts +3 -3
- package/dist-react/components.d.ts +18 -1
- package/dist-react/components.js +39 -0
- package/dist-react/components.ts +55 -1
- package/dist-vue/index.d.ts +4 -0
- package/dist-vue/index.js +28 -0
- package/dist-vue/index.ts +36 -0
- package/hydrate/index.js +542 -19
- package/hydrate/index.mjs +542 -19
- package/package.json +6 -2
- package/dist/chucao/p-ImsAHlk9.js +0 -3
- package/dist/chucao/p-ImsAHlk9.js.map +0 -1
- package/dist/chucao/p-b4520f1c.entry.js +0 -2
- package/dist/chucao/p-b4520f1c.entry.js.map +0 -1
- package/dist/chucao/p-fe0c9320.entry.js +0 -2
- package/dist/cjs/ch-badge_6.cjs.entry.js.map +0 -1
- package/dist/cjs/index-CiYvuUBV.js.map +0 -1
- package/dist/components/p-x4aZoujY.js +0 -2
- package/dist/components/p-x4aZoujY.js.map +0 -1
- package/dist/esm/ch-badge_6.entry.js.map +0 -1
- package/dist/esm/index-ImsAHlk9.js.map +0 -1
- /package/dist/chucao/{p-175aee94.entry.js.map → p-13ab5f9a.entry.js.map} +0 -0
- /package/dist/chucao/{p-dde82d7d.entry.js.map → p-1cc7042e.entry.js.map} +0 -0
- /package/dist/chucao/{p-af2c57b5.entry.js.map → p-421cda05.entry.js.map} +0 -0
- /package/dist/chucao/{p-d75eeeea.entry.js.map → p-c16b18b7.entry.js.map} +0 -0
- /package/dist/chucao/{p-fcc70c8d.entry.js.map → p-cfb6db53.entry.js.map} +0 -0
- /package/dist/chucao/{p-fe0c9320.entry.js.map → p-df73f786.entry.js.map} +0 -0
- /package/dist/chucao/{p-85a49fd7.entry.js.map → p-e8fe65bb.entry.js.map} +0 -0
package/hydrate/index.mjs
CHANGED
|
@@ -130,10 +130,10 @@ function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResu
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
const NAMESPACE = 'chucao';
|
|
133
|
-
const BUILD = /* chucao */ { hotModuleReplacement: false,
|
|
133
|
+
const BUILD = /* chucao */ { hotModuleReplacement: false, slotRelocation: true, state: true, updatable: true};
|
|
134
134
|
|
|
135
135
|
/*
|
|
136
|
-
Stencil Hydrate Platform v4.
|
|
136
|
+
Stencil Hydrate Platform v4.44.0 | MIT Licensed | https://stenciljs.com
|
|
137
137
|
*/
|
|
138
138
|
var __create = Object.create;
|
|
139
139
|
var __defProp = Object.defineProperty;
|
|
@@ -463,6 +463,8 @@ var DEFAULT_DOC_DATA = {
|
|
|
463
463
|
staticComponents: /* @__PURE__ */ new Set()
|
|
464
464
|
};
|
|
465
465
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
466
|
+
var MAX_LAZY_LOAD_RETRIES = 3;
|
|
467
|
+
var LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
|
|
466
468
|
|
|
467
469
|
// src/utils/style.ts
|
|
468
470
|
function createStyleSheetIfNeededAndSupported(styles2) {
|
|
@@ -523,7 +525,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
523
525
|
slottedNodes.push(childNode);
|
|
524
526
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
525
527
|
}
|
|
526
|
-
slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode
|
|
528
|
+
slottedNodes = [...slottedNodes, ...getHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName)];
|
|
527
529
|
}
|
|
528
530
|
return slottedNodes;
|
|
529
531
|
}
|
|
@@ -765,6 +767,11 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
765
767
|
} else if (child != null && typeof child !== "boolean") {
|
|
766
768
|
if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
|
|
767
769
|
child = String(child);
|
|
770
|
+
} else if (typeof nodeName !== "function" && child.$flags$ === void 0) {
|
|
771
|
+
{
|
|
772
|
+
consoleError("Invalid vNode child");
|
|
773
|
+
}
|
|
774
|
+
continue;
|
|
768
775
|
}
|
|
769
776
|
if (simple && lastSimple) {
|
|
770
777
|
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
|
@@ -1628,6 +1635,31 @@ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
|
|
|
1628
1635
|
return cssText;
|
|
1629
1636
|
};
|
|
1630
1637
|
|
|
1638
|
+
// src/runtime/normalize-watchers.ts
|
|
1639
|
+
var normalizeWatchers = (raw) => {
|
|
1640
|
+
if (!raw) return void 0;
|
|
1641
|
+
const keys = Object.keys(raw);
|
|
1642
|
+
if (keys.length === 0) return void 0;
|
|
1643
|
+
let hasLegacy = false;
|
|
1644
|
+
for (const propName of keys) {
|
|
1645
|
+
if (hasLegacy) break;
|
|
1646
|
+
for (const h2 of raw[propName]) {
|
|
1647
|
+
if (typeof h2 === "string") {
|
|
1648
|
+
hasLegacy = true;
|
|
1649
|
+
break;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
if (!hasLegacy) return raw;
|
|
1654
|
+
const out = {};
|
|
1655
|
+
for (const propName of keys) {
|
|
1656
|
+
out[propName] = raw[propName].map(
|
|
1657
|
+
(h2) => typeof h2 === "string" ? { [h2]: 0 } : h2
|
|
1658
|
+
);
|
|
1659
|
+
}
|
|
1660
|
+
return out;
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1631
1663
|
// src/utils/remote-value.ts
|
|
1632
1664
|
var RemoteValue = class _RemoteValue {
|
|
1633
1665
|
/**
|
|
@@ -2276,7 +2308,10 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
2276
2308
|
const slotName = childNode["s-sn"];
|
|
2277
2309
|
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
2278
2310
|
node = hostContentNodes[j];
|
|
2279
|
-
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] &&
|
|
2311
|
+
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
|
|
2312
|
+
// `slotName === ''` itself - a matched default node's cached `s-sn` is `''` too, which
|
|
2313
|
+
// would trivially "match" on every re-render and force pointless re-insertion.
|
|
2314
|
+
(!node["s-sh"] || node["s-sh"] !== childNode["s-hn"] || slotName !== "" && getSlotName(node) === slotName)) {
|
|
2280
2315
|
if (isNodeLocatedInSlot(node, slotName)) {
|
|
2281
2316
|
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
2282
2317
|
checkSlotFallbackVisibility = true;
|
|
@@ -2539,6 +2574,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2539
2574
|
hostRef.$deferredConnectedCallback$ = false;
|
|
2540
2575
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
2541
2576
|
}
|
|
2577
|
+
{
|
|
2578
|
+
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
2579
|
+
if (hostRef.$queuedListeners$) {
|
|
2580
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
|
|
2581
|
+
hostRef.$queuedListeners$ = void 0;
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2542
2584
|
if (hostRef.$fetchedCbList$.length) {
|
|
2543
2585
|
hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
|
|
2544
2586
|
}
|
|
@@ -2700,6 +2742,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2700
2742
|
`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).`
|
|
2701
2743
|
);
|
|
2702
2744
|
}
|
|
2745
|
+
const elm = hostRef.$hostElement$ ;
|
|
2703
2746
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
2704
2747
|
const flags = hostRef.$flags$;
|
|
2705
2748
|
const instance = hostRef.$lazyInstance$ ;
|
|
@@ -2710,6 +2753,27 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2710
2753
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
2711
2754
|
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
2712
2755
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
2756
|
+
if (cmpMeta.$watchers$) {
|
|
2757
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
2758
|
+
if (watchMethods) {
|
|
2759
|
+
watchMethods.map((watcher) => {
|
|
2760
|
+
try {
|
|
2761
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
2762
|
+
if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
|
|
2763
|
+
if (!instance) {
|
|
2764
|
+
hostRef.$fetchedCbList$.push(() => {
|
|
2765
|
+
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
2766
|
+
});
|
|
2767
|
+
} else {
|
|
2768
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
} catch (e) {
|
|
2772
|
+
consoleError(e, elm);
|
|
2773
|
+
}
|
|
2774
|
+
});
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2713
2777
|
if (flags & 2 /* hasRendered */) {
|
|
2714
2778
|
if (instance.componentShouldUpdate) {
|
|
2715
2779
|
const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
|
|
@@ -2728,7 +2792,18 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2728
2792
|
var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
2729
2793
|
var _a2;
|
|
2730
2794
|
const prototype = Cstr.prototype;
|
|
2731
|
-
|
|
2795
|
+
{
|
|
2796
|
+
{
|
|
2797
|
+
if (Cstr.watchers && !cmpMeta.$watchers$) {
|
|
2798
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
2799
|
+
}
|
|
2800
|
+
if (Cstr.deserializers && !cmpMeta.$deserializers$) {
|
|
2801
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
2802
|
+
}
|
|
2803
|
+
if (Cstr.serializers && !cmpMeta.$serializers$) {
|
|
2804
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2732
2807
|
const members = Object.entries((_a2 = cmpMeta.$members$) != null ? _a2 : {});
|
|
2733
2808
|
members.map(([memberName, [memberFlags]]) => {
|
|
2734
2809
|
if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
|
@@ -2788,10 +2863,12 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2788
2863
|
|
|
2789
2864
|
// src/runtime/initialize-component.ts
|
|
2790
2865
|
var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
2866
|
+
var _a2;
|
|
2791
2867
|
let Cstr;
|
|
2792
2868
|
try {
|
|
2793
2869
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
2794
2870
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
2871
|
+
hostRef.$flags$ &= -1025 /* hasFailedLoad */;
|
|
2795
2872
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
2796
2873
|
if (bundleId) {
|
|
2797
2874
|
const CstrImport = loadModule(cmpMeta);
|
|
@@ -2803,9 +2880,19 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2803
2880
|
Cstr = CstrImport;
|
|
2804
2881
|
}
|
|
2805
2882
|
if (!Cstr) {
|
|
2883
|
+
hostRef.$flags$ &= -33 /* hasInitializedComponent */;
|
|
2884
|
+
hostRef.$loadRetryCount$ = ((_a2 = hostRef.$loadRetryCount$) != null ? _a2 : 0) + 1;
|
|
2885
|
+
if (hostRef.$loadRetryCount$ < MAX_LAZY_LOAD_RETRIES) {
|
|
2886
|
+
hostRef.$flags$ |= 1024 /* hasFailedLoad */;
|
|
2887
|
+
}
|
|
2806
2888
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
2807
2889
|
}
|
|
2808
2890
|
if (!Cstr.isProxied) {
|
|
2891
|
+
{
|
|
2892
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
2893
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
2894
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
2895
|
+
}
|
|
2809
2896
|
proxyComponent(Cstr, cmpMeta);
|
|
2810
2897
|
Cstr.isProxied = true;
|
|
2811
2898
|
}
|
|
@@ -2821,6 +2908,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2821
2908
|
{
|
|
2822
2909
|
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
2823
2910
|
}
|
|
2911
|
+
{
|
|
2912
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
2913
|
+
}
|
|
2824
2914
|
endNewInstance();
|
|
2825
2915
|
const needsDeferredCallback = cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
|
|
2826
2916
|
if (!needsDeferredCallback) {
|
|
@@ -2866,7 +2956,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2866
2956
|
hostRef.$onRenderResolve$();
|
|
2867
2957
|
hostRef.$onRenderResolve$ = void 0;
|
|
2868
2958
|
}
|
|
2869
|
-
if (hostRef.$onReadyResolve$) {
|
|
2959
|
+
if (hostRef.$onReadyResolve$ && !(hostRef.$flags$ & 1024 /* hasFailedLoad */)) {
|
|
2870
2960
|
hostRef.$onReadyResolve$(elm);
|
|
2871
2961
|
}
|
|
2872
2962
|
}
|
|
@@ -2919,8 +3009,11 @@ var connectedCallback = (elm) => {
|
|
|
2919
3009
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
2920
3010
|
}
|
|
2921
3011
|
} else {
|
|
3012
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
2922
3013
|
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
2923
3014
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
3015
|
+
} else if (hostRef.$flags$ & 1024 /* hasFailedLoad */) {
|
|
3016
|
+
setTimeout(() => initializeComponent(elm, hostRef, cmpMeta), LAZY_LOAD_RETRY_INTERVAL_MS);
|
|
2924
3017
|
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
2925
3018
|
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
2926
3019
|
}
|
|
@@ -2938,6 +3031,38 @@ var setContentReference = (elm) => {
|
|
|
2938
3031
|
contentRefElm["s-cn"] = true;
|
|
2939
3032
|
insertBefore(elm, contentRefElm, elm.firstChild);
|
|
2940
3033
|
};
|
|
3034
|
+
var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
3035
|
+
if (listeners && win.document) {
|
|
3036
|
+
listeners.map(([flags, name, method]) => {
|
|
3037
|
+
const target = getHostListenerTarget(win.document, elm, flags) ;
|
|
3038
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
3039
|
+
const opts = hostListenerOpts(flags);
|
|
3040
|
+
plt.ael(target, name, handler, opts);
|
|
3041
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
3042
|
+
});
|
|
3043
|
+
}
|
|
3044
|
+
};
|
|
3045
|
+
var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
3046
|
+
var _a2;
|
|
3047
|
+
try {
|
|
3048
|
+
{
|
|
3049
|
+
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
3050
|
+
(_a2 = hostRef.$lazyInstance$) == null ? void 0 : _a2[methodName](ev);
|
|
3051
|
+
} else {
|
|
3052
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
} catch (e) {
|
|
3056
|
+
consoleError(e, hostRef.$hostElement$);
|
|
3057
|
+
}
|
|
3058
|
+
};
|
|
3059
|
+
var getHostListenerTarget = (doc, elm, flags) => {
|
|
3060
|
+
if (flags & 4 /* TargetDocument */) {
|
|
3061
|
+
return doc;
|
|
3062
|
+
}
|
|
3063
|
+
return elm;
|
|
3064
|
+
};
|
|
3065
|
+
var hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
2941
3066
|
function transformTag(tag) {
|
|
2942
3067
|
return tag;
|
|
2943
3068
|
}
|
|
@@ -4928,6 +5053,7 @@ async function hydrateComponent(win2, results, tagName, elm, waitingElements) {
|
|
|
4928
5053
|
if (!hostRef) {
|
|
4929
5054
|
return;
|
|
4930
5055
|
}
|
|
5056
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4931
5057
|
try {
|
|
4932
5058
|
connectedCallback(elm);
|
|
4933
5059
|
await elm.componentOnReady();
|
|
@@ -5157,7 +5283,7 @@ var registerInstance = (lazyInstance, hostRef) => {
|
|
|
5157
5283
|
if (!hostRef) return void 0;
|
|
5158
5284
|
lazyInstance.__stencil__getHostRef = () => hostRef;
|
|
5159
5285
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
5160
|
-
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.
|
|
5286
|
+
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
|
|
5161
5287
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
5162
5288
|
}
|
|
5163
5289
|
return hostRef;
|
|
@@ -5237,6 +5363,62 @@ class ChAccordion {
|
|
|
5237
5363
|
}; }
|
|
5238
5364
|
}
|
|
5239
5365
|
|
|
5366
|
+
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}}`;
|
|
5367
|
+
|
|
5368
|
+
/**
|
|
5369
|
+
* Block-level status message.
|
|
5370
|
+
*
|
|
5371
|
+
* `warning` carries `role="alert"` and is announced assertively; `default` and
|
|
5372
|
+
* `positive` use `role="status"`, since a confirmation is not urgent enough to
|
|
5373
|
+
* interrupt. Both announce reliably when the alert is added to the page in
|
|
5374
|
+
* response to something — an alert already present at load may not be read out,
|
|
5375
|
+
* which is how live regions work rather than something this component controls.
|
|
5376
|
+
*/
|
|
5377
|
+
class ChAlert {
|
|
5378
|
+
constructor(hostRef) {
|
|
5379
|
+
registerInstance(this, hostRef);
|
|
5380
|
+
this.chDismiss = createEvent(this, "chDismiss");
|
|
5381
|
+
}
|
|
5382
|
+
/**
|
|
5383
|
+
* The kind of message. `default` is neutral, `positive` confirms, and
|
|
5384
|
+
* `warning` covers both warnings and errors — the token scale has a single
|
|
5385
|
+
* status colour for the two of them.
|
|
5386
|
+
*/
|
|
5387
|
+
variant = 'default';
|
|
5388
|
+
/**
|
|
5389
|
+
* Accessible label for the dismiss button, set as `aria-label`. Setting it
|
|
5390
|
+
* is what adds the button: the button's only content is a decorative glyph,
|
|
5391
|
+
* so without a label it would have no accessible name at all.
|
|
5392
|
+
*/
|
|
5393
|
+
dismissLabel;
|
|
5394
|
+
/**
|
|
5395
|
+
* Emitted when the dismiss button is clicked. The alert stays in the DOM —
|
|
5396
|
+
* whether to remove it is the consumer's decision. If you do remove it, move
|
|
5397
|
+
* focus somewhere sensible first: removing the focused button drops focus to
|
|
5398
|
+
* `<body>`.
|
|
5399
|
+
*/
|
|
5400
|
+
chDismiss;
|
|
5401
|
+
handleDismiss = () => {
|
|
5402
|
+
this.chDismiss.emit();
|
|
5403
|
+
};
|
|
5404
|
+
render() {
|
|
5405
|
+
const role = this.variant === 'warning' ? 'alert' : 'status';
|
|
5406
|
+
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"))))));
|
|
5407
|
+
}
|
|
5408
|
+
static get style() { return chAlertCss(); }
|
|
5409
|
+
static get cmpMeta() { return {
|
|
5410
|
+
"$flags$": 777,
|
|
5411
|
+
"$tagName$": "ch-alert",
|
|
5412
|
+
"$members$": {
|
|
5413
|
+
"variant": [1],
|
|
5414
|
+
"dismissLabel": [1, "dismiss-label"]
|
|
5415
|
+
},
|
|
5416
|
+
"$listeners$": undefined,
|
|
5417
|
+
"$lazyBundleId$": "-",
|
|
5418
|
+
"$attrsToReflect$": []
|
|
5419
|
+
}; }
|
|
5420
|
+
}
|
|
5421
|
+
|
|
5240
5422
|
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)}`;
|
|
5241
5423
|
|
|
5242
5424
|
class ChBadge {
|
|
@@ -5248,7 +5430,7 @@ class ChBadge {
|
|
|
5248
5430
|
*/
|
|
5249
5431
|
variant = 'default';
|
|
5250
5432
|
render() {
|
|
5251
|
-
return (hAsync(Host, { key: '
|
|
5433
|
+
return (hAsync(Host, { key: 'ca1fb0c9d678b6ea5b68ca131ba153116bbd577d' }, hAsync("span", { key: '929e2268094bdad7df6e3c8371896e364ebf79c3', class: { badge: true, [`badge--${this.variant}`]: true } }, hAsync("slot", { key: '64422988ad046244722755d39e564295f79a6ce1' }))));
|
|
5252
5434
|
}
|
|
5253
5435
|
static get style() { return chBadgeCss(); }
|
|
5254
5436
|
static get cmpMeta() { return {
|
|
@@ -5292,7 +5474,7 @@ class ChButton {
|
|
|
5292
5474
|
this.chClick.emit(ev);
|
|
5293
5475
|
};
|
|
5294
5476
|
render() {
|
|
5295
|
-
return (hAsync(Host, { key: '
|
|
5477
|
+
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' }))));
|
|
5296
5478
|
}
|
|
5297
5479
|
static get style() { return chButtonCss(); }
|
|
5298
5480
|
static get cmpMeta() { return {
|
|
@@ -5316,7 +5498,7 @@ class ChCard {
|
|
|
5316
5498
|
registerInstance(this, hostRef);
|
|
5317
5499
|
}
|
|
5318
5500
|
render() {
|
|
5319
|
-
return (hAsync(Host, { key: '
|
|
5501
|
+
return (hAsync(Host, { key: '1541ba4361c996716356fb87cdcc73b1260d4c6a' }, hAsync("div", { key: '924070eeb79f6c8f8e6362772bbab0dcc1c6f315', class: "card" }, hAsync("slot", { key: '2fde36426395a519cb1ebe265ba0eef3aaf6ff38' }))));
|
|
5320
5502
|
}
|
|
5321
5503
|
static get style() { return chCardCss(); }
|
|
5322
5504
|
static get cmpMeta() { return {
|
|
@@ -5396,7 +5578,7 @@ class ChCheckbox {
|
|
|
5396
5578
|
return undefined;
|
|
5397
5579
|
}
|
|
5398
5580
|
render() {
|
|
5399
|
-
return (hAsync(Host, { key: '
|
|
5581
|
+
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))));
|
|
5400
5582
|
}
|
|
5401
5583
|
static get style() { return chCheckboxCss(); }
|
|
5402
5584
|
static get cmpMeta() { return {
|
|
@@ -5430,7 +5612,7 @@ class ChDivider {
|
|
|
5430
5612
|
*/
|
|
5431
5613
|
orientation = 'horizontal';
|
|
5432
5614
|
render() {
|
|
5433
|
-
return (hAsync(Host, { key: '
|
|
5615
|
+
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 })));
|
|
5434
5616
|
}
|
|
5435
5617
|
static get style() { return chDividerCss(); }
|
|
5436
5618
|
static get cmpMeta() { return {
|
|
@@ -5525,7 +5707,7 @@ class ChInput {
|
|
|
5525
5707
|
return undefined;
|
|
5526
5708
|
}
|
|
5527
5709
|
render() {
|
|
5528
|
-
return (hAsync(Host, { key: '
|
|
5710
|
+
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))));
|
|
5529
5711
|
}
|
|
5530
5712
|
static get style() { return chInputCss(); }
|
|
5531
5713
|
static get cmpMeta() { return {
|
|
@@ -5603,6 +5785,195 @@ class ChLink {
|
|
|
5603
5785
|
}; }
|
|
5604
5786
|
}
|
|
5605
5787
|
|
|
5788
|
+
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}}`;
|
|
5789
|
+
|
|
5790
|
+
let openModals = 0;
|
|
5791
|
+
let previousOverflow = '';
|
|
5792
|
+
let previousPaddingRight = '';
|
|
5793
|
+
/**
|
|
5794
|
+
* Modal dialog, built on the native `<dialog>` element and opened with
|
|
5795
|
+
* `showModal()`.
|
|
5796
|
+
*
|
|
5797
|
+
* The browser therefore supplies the parts that are easy to get wrong: moving
|
|
5798
|
+
* focus into the dialog and returning it afterwards, marking the rest of the
|
|
5799
|
+
* document inert, `Escape` to close, the top layer, `::backdrop`, and the
|
|
5800
|
+
* implicit `dialog` role with `aria-modal="true"`. Notably it does not trap
|
|
5801
|
+
* focus, which is deliberate — the W3C APA group concluded a modal should let
|
|
5802
|
+
* keyboard users reach browser UI, so a hand-rolled trap would be less
|
|
5803
|
+
* correct, not more.
|
|
5804
|
+
*
|
|
5805
|
+
* What the platform does not cover, and this component adds: locking the page
|
|
5806
|
+
* behind the dialog so it cannot scroll, and closing when the backdrop is
|
|
5807
|
+
* clicked. The latter is `closedby="any"` in the platform, which Safari does
|
|
5808
|
+
* not support yet, so it is implemented here for every browser alike rather
|
|
5809
|
+
* than only for some.
|
|
5810
|
+
*/
|
|
5811
|
+
class ChModal {
|
|
5812
|
+
constructor(hostRef) {
|
|
5813
|
+
registerInstance(this, hostRef);
|
|
5814
|
+
this.chOpen = createEvent(this, "chOpen");
|
|
5815
|
+
this.chClose = createEvent(this, "chClose");
|
|
5816
|
+
}
|
|
5817
|
+
/**
|
|
5818
|
+
* Whether the dialog is open. Kept in sync when the user closes it with
|
|
5819
|
+
* `Escape`, the close button or a click outside.
|
|
5820
|
+
*/
|
|
5821
|
+
open = false;
|
|
5822
|
+
/**
|
|
5823
|
+
* Accessible name for the dialog, set as `aria-label`. A slotted heading
|
|
5824
|
+
* cannot be referenced with `aria-labelledby` across the shadow boundary, so
|
|
5825
|
+
* the name comes through this prop — and a modal dialog needs one, so pass
|
|
5826
|
+
* the same text as the heading.
|
|
5827
|
+
*/
|
|
5828
|
+
label;
|
|
5829
|
+
/**
|
|
5830
|
+
* Accessible label for the close button, set as `aria-label`. Setting it is
|
|
5831
|
+
* what adds the button: its only content is a decorative glyph, so without a
|
|
5832
|
+
* label it would have no accessible name.
|
|
5833
|
+
*/
|
|
5834
|
+
closeLabel;
|
|
5835
|
+
/**
|
|
5836
|
+
* Emitted after the dialog opens.
|
|
5837
|
+
*/
|
|
5838
|
+
chOpen;
|
|
5839
|
+
/**
|
|
5840
|
+
* Emitted after the dialog closes, however it was closed.
|
|
5841
|
+
*/
|
|
5842
|
+
chClose;
|
|
5843
|
+
dialog;
|
|
5844
|
+
scrollLocked = false;
|
|
5845
|
+
pointerDownedOutside = false;
|
|
5846
|
+
componentDidLoad() {
|
|
5847
|
+
// Wired here rather than in JSX because Stencil derives a listener's event
|
|
5848
|
+
// name from whether `on<name>` exists on `window`, which differs between
|
|
5849
|
+
// the browser and the test environment for pointer events.
|
|
5850
|
+
this.dialog?.addEventListener('close', this.handleNativeClose);
|
|
5851
|
+
this.dialog?.addEventListener('pointerdown', this.handlePointerDown);
|
|
5852
|
+
this.dialog?.addEventListener('click', this.handleClick);
|
|
5853
|
+
if (this.open) {
|
|
5854
|
+
this.showDialog();
|
|
5855
|
+
}
|
|
5856
|
+
}
|
|
5857
|
+
disconnectedCallback() {
|
|
5858
|
+
this.dialog?.removeEventListener('close', this.handleNativeClose);
|
|
5859
|
+
this.dialog?.removeEventListener('pointerdown', this.handlePointerDown);
|
|
5860
|
+
this.dialog?.removeEventListener('click', this.handleClick);
|
|
5861
|
+
this.unlockScroll();
|
|
5862
|
+
}
|
|
5863
|
+
handleOpenChange(open) {
|
|
5864
|
+
if (open) {
|
|
5865
|
+
this.showDialog();
|
|
5866
|
+
}
|
|
5867
|
+
else {
|
|
5868
|
+
this.closeDialog();
|
|
5869
|
+
}
|
|
5870
|
+
}
|
|
5871
|
+
showDialog() {
|
|
5872
|
+
if (typeof this.dialog?.showModal !== 'function') {
|
|
5873
|
+
return;
|
|
5874
|
+
}
|
|
5875
|
+
this.lockScroll();
|
|
5876
|
+
this.dialog.showModal();
|
|
5877
|
+
this.chOpen.emit();
|
|
5878
|
+
}
|
|
5879
|
+
closeDialog() {
|
|
5880
|
+
if (typeof this.dialog?.close === 'function' && this.dialog.open) {
|
|
5881
|
+
this.dialog.close();
|
|
5882
|
+
}
|
|
5883
|
+
}
|
|
5884
|
+
lockScroll() {
|
|
5885
|
+
if (this.scrollLocked) {
|
|
5886
|
+
return;
|
|
5887
|
+
}
|
|
5888
|
+
this.scrollLocked = true;
|
|
5889
|
+
openModals += 1;
|
|
5890
|
+
if (openModals > 1) {
|
|
5891
|
+
return;
|
|
5892
|
+
}
|
|
5893
|
+
const root = document.documentElement;
|
|
5894
|
+
const scrollbar = window.innerWidth - root.clientWidth;
|
|
5895
|
+
previousOverflow = root.style.overflow;
|
|
5896
|
+
previousPaddingRight = root.style.paddingRight;
|
|
5897
|
+
root.style.overflow = 'hidden';
|
|
5898
|
+
if (scrollbar > 0) {
|
|
5899
|
+
root.style.paddingRight = `${scrollbar}px`;
|
|
5900
|
+
}
|
|
5901
|
+
}
|
|
5902
|
+
unlockScroll() {
|
|
5903
|
+
if (!this.scrollLocked) {
|
|
5904
|
+
return;
|
|
5905
|
+
}
|
|
5906
|
+
this.scrollLocked = false;
|
|
5907
|
+
openModals -= 1;
|
|
5908
|
+
if (openModals > 0) {
|
|
5909
|
+
return;
|
|
5910
|
+
}
|
|
5911
|
+
const root = document.documentElement;
|
|
5912
|
+
root.style.overflow = previousOverflow;
|
|
5913
|
+
root.style.paddingRight = previousPaddingRight;
|
|
5914
|
+
}
|
|
5915
|
+
/**
|
|
5916
|
+
* True for a pointer event on the backdrop: the `<dialog>` is the event
|
|
5917
|
+
* target for its own box only, and the coordinates fall outside that box.
|
|
5918
|
+
*/
|
|
5919
|
+
isOnBackdrop(event) {
|
|
5920
|
+
if (!this.dialog || event.target !== this.dialog) {
|
|
5921
|
+
return false;
|
|
5922
|
+
}
|
|
5923
|
+
const box = this.dialog.getBoundingClientRect();
|
|
5924
|
+
return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
5925
|
+
}
|
|
5926
|
+
handlePointerDown = (event) => {
|
|
5927
|
+
this.pointerDownedOutside = this.isOnBackdrop(event);
|
|
5928
|
+
};
|
|
5929
|
+
handleClick = (event) => {
|
|
5930
|
+
// Requiring the press to have started on the backdrop too keeps a
|
|
5931
|
+
// selection dragged out of the dialog, and a keyboard-synthesised click
|
|
5932
|
+
// (which reports coordinates of 0), from closing it.
|
|
5933
|
+
const dismiss = this.pointerDownedOutside && this.isOnBackdrop(event);
|
|
5934
|
+
this.pointerDownedOutside = false;
|
|
5935
|
+
if (dismiss) {
|
|
5936
|
+
this.closeDialog();
|
|
5937
|
+
}
|
|
5938
|
+
};
|
|
5939
|
+
handleNativeClose = () => {
|
|
5940
|
+
this.unlockScroll();
|
|
5941
|
+
if (this.open) {
|
|
5942
|
+
this.open = false;
|
|
5943
|
+
}
|
|
5944
|
+
this.chClose.emit();
|
|
5945
|
+
};
|
|
5946
|
+
handleCloseClick = () => {
|
|
5947
|
+
if (typeof this.dialog?.close === 'function' && this.dialog.open) {
|
|
5948
|
+
this.dialog.close();
|
|
5949
|
+
return;
|
|
5950
|
+
}
|
|
5951
|
+
this.open = false;
|
|
5952
|
+
this.chClose.emit();
|
|
5953
|
+
};
|
|
5954
|
+
render() {
|
|
5955
|
+
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' })))));
|
|
5956
|
+
}
|
|
5957
|
+
static get watchers() { return {
|
|
5958
|
+
"open": [{
|
|
5959
|
+
"handleOpenChange": 0
|
|
5960
|
+
}]
|
|
5961
|
+
}; }
|
|
5962
|
+
static get style() { return chModalCss(); }
|
|
5963
|
+
static get cmpMeta() { return {
|
|
5964
|
+
"$flags$": 777,
|
|
5965
|
+
"$tagName$": "ch-modal",
|
|
5966
|
+
"$members$": {
|
|
5967
|
+
"open": [1028],
|
|
5968
|
+
"label": [1],
|
|
5969
|
+
"closeLabel": [1, "close-label"]
|
|
5970
|
+
},
|
|
5971
|
+
"$listeners$": undefined,
|
|
5972
|
+
"$lazyBundleId$": "-",
|
|
5973
|
+
"$attrsToReflect$": []
|
|
5974
|
+
}; }
|
|
5975
|
+
}
|
|
5976
|
+
|
|
5606
5977
|
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)}`;
|
|
5607
5978
|
|
|
5608
5979
|
let radioIds = 0;
|
|
@@ -5673,7 +6044,7 @@ class ChRadio {
|
|
|
5673
6044
|
}
|
|
5674
6045
|
render() {
|
|
5675
6046
|
const groupName = this.name || `${this.groupId}-group`;
|
|
5676
|
-
return (hAsync(Host, { key: '
|
|
6047
|
+
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))));
|
|
5677
6048
|
}
|
|
5678
6049
|
static get style() { return chRadioCss(); }
|
|
5679
6050
|
static get cmpMeta() { return {
|
|
@@ -5767,7 +6138,7 @@ class ChSelect {
|
|
|
5767
6138
|
return undefined;
|
|
5768
6139
|
}
|
|
5769
6140
|
render() {
|
|
5770
|
-
return (hAsync(Host, { key: '
|
|
6141
|
+
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))));
|
|
5771
6142
|
}
|
|
5772
6143
|
static get style() { return chSelectCss(); }
|
|
5773
6144
|
static get cmpMeta() { return {
|
|
@@ -5791,6 +6162,51 @@ class ChSelect {
|
|
|
5791
6162
|
}; }
|
|
5792
6163
|
}
|
|
5793
6164
|
|
|
6165
|
+
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)}}`;
|
|
6166
|
+
|
|
6167
|
+
/**
|
|
6168
|
+
* Loading indicator.
|
|
6169
|
+
*
|
|
6170
|
+
* The spinner is drawn in `currentColor`, so it takes the surrounding text
|
|
6171
|
+
* colour and stays legible on any surface — inside a primary `ch-button` it
|
|
6172
|
+
* picks up the button's own text colour instead of the accent, which would be
|
|
6173
|
+
* invisible there. Set `color` on or above the element to change it.
|
|
6174
|
+
*/
|
|
6175
|
+
class ChSpinner {
|
|
6176
|
+
constructor(hostRef) {
|
|
6177
|
+
registerInstance(this, hostRef);
|
|
6178
|
+
}
|
|
6179
|
+
/**
|
|
6180
|
+
* The size of the spinner. Either `sm`, `md`, or `lg`. Each size sets a
|
|
6181
|
+
* font-size and the spinner is drawn in `em`, so it also scales with an
|
|
6182
|
+
* inherited font-size.
|
|
6183
|
+
*/
|
|
6184
|
+
size = 'md';
|
|
6185
|
+
/**
|
|
6186
|
+
* Accessible label announced while the spinner is visible, e.g. `Cargando
|
|
6187
|
+
* resultados`. When omitted the spinner is treated as decorative and hidden
|
|
6188
|
+
* from assistive technology — the right behaviour next to visible loading
|
|
6189
|
+
* text, which would otherwise be announced twice.
|
|
6190
|
+
*/
|
|
6191
|
+
label;
|
|
6192
|
+
render() {
|
|
6193
|
+
const labelled = Boolean(this.label);
|
|
6194
|
+
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' })));
|
|
6195
|
+
}
|
|
6196
|
+
static get style() { return chSpinnerCss(); }
|
|
6197
|
+
static get cmpMeta() { return {
|
|
6198
|
+
"$flags$": 521,
|
|
6199
|
+
"$tagName$": "ch-spinner",
|
|
6200
|
+
"$members$": {
|
|
6201
|
+
"size": [1],
|
|
6202
|
+
"label": [1]
|
|
6203
|
+
},
|
|
6204
|
+
"$listeners$": undefined,
|
|
6205
|
+
"$lazyBundleId$": "-",
|
|
6206
|
+
"$attrsToReflect$": []
|
|
6207
|
+
}; }
|
|
6208
|
+
}
|
|
6209
|
+
|
|
5794
6210
|
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)}`;
|
|
5795
6211
|
|
|
5796
6212
|
let switchIds = 0;
|
|
@@ -5858,7 +6274,7 @@ class ChSwitch {
|
|
|
5858
6274
|
return undefined;
|
|
5859
6275
|
}
|
|
5860
6276
|
render() {
|
|
5861
|
-
return (hAsync(Host, { key: '
|
|
6277
|
+
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))));
|
|
5862
6278
|
}
|
|
5863
6279
|
static get style() { return chSwitchCss(); }
|
|
5864
6280
|
static get cmpMeta() { return {
|
|
@@ -5965,7 +6381,7 @@ class ChTabs {
|
|
|
5965
6381
|
}
|
|
5966
6382
|
render() {
|
|
5967
6383
|
const active = this.activeValue;
|
|
5968
|
-
return (hAsync(Host, { key: '
|
|
6384
|
+
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 => {
|
|
5969
6385
|
const selected = tab.value === active;
|
|
5970
6386
|
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));
|
|
5971
6387
|
})), 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}` }))))));
|
|
@@ -6066,7 +6482,7 @@ class ChTextarea {
|
|
|
6066
6482
|
return undefined;
|
|
6067
6483
|
}
|
|
6068
6484
|
render() {
|
|
6069
|
-
return (hAsync(Host, { key: '
|
|
6485
|
+
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))));
|
|
6070
6486
|
}
|
|
6071
6487
|
static get style() { return chTextareaCss(); }
|
|
6072
6488
|
static get cmpMeta() { return {
|
|
@@ -6090,8 +6506,112 @@ class ChTextarea {
|
|
|
6090
6506
|
}; }
|
|
6091
6507
|
}
|
|
6092
6508
|
|
|
6509
|
+
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}}`;
|
|
6510
|
+
|
|
6511
|
+
let tooltipIds = 0;
|
|
6512
|
+
/**
|
|
6513
|
+
* Short help text shown on hover and on focus.
|
|
6514
|
+
*
|
|
6515
|
+
* Both the trigger and the text come from the consumer's light DOM through
|
|
6516
|
+
* named slots. That is what makes the accessible association work: an
|
|
6517
|
+
* `aria-describedby` IDREF only resolves within a single tree, and slotted
|
|
6518
|
+
* nodes stay in the document tree even though they render inside the shadow
|
|
6519
|
+
* root. Keeping the text in the shadow root instead would need a reference
|
|
6520
|
+
* pointing into a shadow tree, which the platform does not allow — element
|
|
6521
|
+
* reflection only points outwards, and `referenceTarget` is not available yet.
|
|
6522
|
+
*
|
|
6523
|
+
* The trigger has to be a natively focusable element (`<button>`, `<a>`,
|
|
6524
|
+
* `<input>`). A chucao component such as `ch-button` will not be described,
|
|
6525
|
+
* because `aria-*` set on a custom element host does not reach the native
|
|
6526
|
+
* element inside it — see the discussion in issue #47.
|
|
6527
|
+
*/
|
|
6528
|
+
class ChTooltip {
|
|
6529
|
+
constructor(hostRef) {
|
|
6530
|
+
registerInstance(this, hostRef);
|
|
6531
|
+
}
|
|
6532
|
+
get el() { return getElement(this); }
|
|
6533
|
+
fallbackId = `ch-tooltip-${++tooltipIds}`;
|
|
6534
|
+
/**
|
|
6535
|
+
* Which side of the trigger the bubble is placed on.
|
|
6536
|
+
*/
|
|
6537
|
+
placement = 'top';
|
|
6538
|
+
// Hover and focus are tracked apart so that neither cancels the other: a
|
|
6539
|
+
// pointer passing over and away must not hide a tooltip whose trigger still
|
|
6540
|
+
// holds keyboard focus.
|
|
6541
|
+
hovered = false;
|
|
6542
|
+
focused = false;
|
|
6543
|
+
dismissed = false;
|
|
6544
|
+
get visible() {
|
|
6545
|
+
return (this.hovered || this.focused) && !this.dismissed;
|
|
6546
|
+
}
|
|
6547
|
+
componentDidLoad() {
|
|
6548
|
+
this.associate();
|
|
6549
|
+
}
|
|
6550
|
+
handleMouseEnter() {
|
|
6551
|
+
this.hovered = true;
|
|
6552
|
+
this.dismissed = false;
|
|
6553
|
+
}
|
|
6554
|
+
handleMouseLeave() {
|
|
6555
|
+
this.hovered = false;
|
|
6556
|
+
}
|
|
6557
|
+
handleFocusIn() {
|
|
6558
|
+
this.focused = true;
|
|
6559
|
+
this.dismissed = false;
|
|
6560
|
+
}
|
|
6561
|
+
handleFocusOut() {
|
|
6562
|
+
this.focused = false;
|
|
6563
|
+
}
|
|
6564
|
+
/**
|
|
6565
|
+
* Listens on the document because a tooltip opened by hovering leaves focus
|
|
6566
|
+
* wherever it was, so a host-scoped handler would never see the key.
|
|
6567
|
+
*/
|
|
6568
|
+
handleKeyDown(event) {
|
|
6569
|
+
if (event.key === 'Escape' && this.visible) {
|
|
6570
|
+
this.dismissed = true;
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
slotted(name) {
|
|
6574
|
+
return Array.from(this.el.children).find(child => child.getAttribute('slot') === name);
|
|
6575
|
+
}
|
|
6576
|
+
/**
|
|
6577
|
+
* Points the trigger at the text with `aria-describedby`. Re-run on
|
|
6578
|
+
* `slotchange` because a framework re-render can replace the slotted nodes
|
|
6579
|
+
* and take the attributes with them.
|
|
6580
|
+
*/
|
|
6581
|
+
associate = () => {
|
|
6582
|
+
const trigger = this.slotted('trigger');
|
|
6583
|
+
const content = this.slotted('content');
|
|
6584
|
+
if (!trigger || !content) {
|
|
6585
|
+
return;
|
|
6586
|
+
}
|
|
6587
|
+
if (!content.id) {
|
|
6588
|
+
content.id = this.fallbackId;
|
|
6589
|
+
}
|
|
6590
|
+
content.setAttribute('role', 'tooltip');
|
|
6591
|
+
trigger.setAttribute('aria-describedby', content.id);
|
|
6592
|
+
};
|
|
6593
|
+
render() {
|
|
6594
|
+
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 })))));
|
|
6595
|
+
}
|
|
6596
|
+
static get style() { return chTooltipCss(); }
|
|
6597
|
+
static get cmpMeta() { return {
|
|
6598
|
+
"$flags$": 777,
|
|
6599
|
+
"$tagName$": "ch-tooltip",
|
|
6600
|
+
"$members$": {
|
|
6601
|
+
"placement": [1],
|
|
6602
|
+
"hovered": [32],
|
|
6603
|
+
"focused": [32],
|
|
6604
|
+
"dismissed": [32]
|
|
6605
|
+
},
|
|
6606
|
+
"$listeners$": [[1, "mouseenter", "handleMouseEnter"], [1, "mouseleave", "handleMouseLeave"], [0, "focusin", "handleFocusIn"], [0, "focusout", "handleFocusOut"], [4, "keydown", "handleKeyDown"]],
|
|
6607
|
+
"$lazyBundleId$": "-",
|
|
6608
|
+
"$attrsToReflect$": []
|
|
6609
|
+
}; }
|
|
6610
|
+
}
|
|
6611
|
+
|
|
6093
6612
|
registerComponents([
|
|
6094
6613
|
ChAccordion,
|
|
6614
|
+
ChAlert,
|
|
6095
6615
|
ChBadge,
|
|
6096
6616
|
ChButton,
|
|
6097
6617
|
ChCard,
|
|
@@ -6099,11 +6619,14 @@ registerComponents([
|
|
|
6099
6619
|
ChDivider,
|
|
6100
6620
|
ChInput,
|
|
6101
6621
|
ChLink,
|
|
6622
|
+
ChModal,
|
|
6102
6623
|
ChRadio,
|
|
6103
6624
|
ChSelect,
|
|
6625
|
+
ChSpinner,
|
|
6104
6626
|
ChSwitch,
|
|
6105
6627
|
ChTabs,
|
|
6106
6628
|
ChTextarea,
|
|
6629
|
+
ChTooltip,
|
|
6107
6630
|
]);
|
|
6108
6631
|
|
|
6109
6632
|
exports.hydrateApp = hydrateApp;
|
|
@@ -6205,7 +6728,7 @@ var NAMESPACE = (
|
|
|
6205
6728
|
);
|
|
6206
6729
|
|
|
6207
6730
|
/*
|
|
6208
|
-
Stencil Hydrate Runner v4.
|
|
6731
|
+
Stencil Hydrate Runner v4.44.0 | MIT Licensed | https://stenciljs.com
|
|
6209
6732
|
*/
|
|
6210
6733
|
var __create = Object.create;
|
|
6211
6734
|
var __defProp = Object.defineProperty;
|