@devschile/chucao 1.7.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 +13 -12
- package/dist/chucao/chucao.css +1 -1
- package/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/index.esm.js +1 -1
- package/dist/chucao/index.esm.js.map +1 -1
- package/dist/chucao/{p-9a614e82.entry.js → p-13ab5f9a.entry.js} +2 -2
- package/dist/chucao/{p-053d58a4.entry.js → p-1cc7042e.entry.js} +2 -2
- package/dist/chucao/{p-c598f978.entry.js → p-23c5220b.entry.js} +2 -2
- package/dist/chucao/p-2d7e81b2.entry.js +2 -0
- package/dist/chucao/p-2d7e81b2.entry.js.map +1 -0
- package/dist/chucao/p-421cda05.entry.js +2 -0
- package/dist/chucao/{p-0305f2eb.entry.js.map → p-421cda05.entry.js.map} +1 -1
- package/dist/chucao/p-Bvah_WQV.js +3 -0
- package/dist/chucao/p-Bvah_WQV.js.map +1 -0
- package/dist/chucao/{p-ad3206a2.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-20492b73.entry.js → p-cfb6db53.entry.js} +2 -2
- package/dist/chucao/{p-488c7838.entry.js → p-df73f786.entry.js} +2 -2
- package/dist/chucao/{p-fe8e9537.entry.js → p-e8fe65bb.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ch-alert_8.cjs.entry.js +4 -4
- package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/ch-divider.cjs.entry.js +1 -1
- 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 +1 -1
- package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
- 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 +2 -2
- package/dist/cjs/{index-ls4U227d.js → index-DMeDkSQU.js} +148 -5
- package/dist/cjs/index-DMeDkSQU.js.map +1 -0
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- 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-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-switch/ch-switch.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 +4 -0
- 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.js +1 -1
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-card.js +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.js +1 -1
- 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-alert_8.entry.js +4 -4
- package/dist/esm/ch-checkbox.entry.js +2 -2
- package/dist/esm/ch-divider.entry.js +1 -1
- 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 +1 -1
- package/dist/esm/ch-tabs.entry.js +1 -1
- 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 +3 -3
- package/dist/esm/{index-pfWAsOzE.js → index-Bvah_WQV.js} +148 -6
- package/dist/esm/index-Bvah_WQV.js.map +1 -0
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/ch-modal/ch-modal.d.ts +67 -0
- package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +47 -0
- package/dist/types/components.d.ts +216 -0
- package/dist/types/tokens/tokens.d.ts +4 -0
- package/dist/types/tokens/types.d.ts +1 -1
- package/dist-react/components.d.ts +10 -1
- package/dist-react/components.js +21 -0
- package/dist-react/components.ts +31 -1
- package/dist-vue/index.d.ts +2 -0
- package/dist-vue/index.js +15 -0
- package/dist-vue/index.ts +19 -0
- package/hydrate/index.js +409 -8
- package/hydrate/index.mjs +409 -8
- package/package.json +1 -1
- package/dist/chucao/p-0305f2eb.entry.js +0 -2
- package/dist/chucao/p-pfWAsOzE.js +0 -3
- package/dist/chucao/p-pfWAsOzE.js.map +0 -1
- package/dist/cjs/index-ls4U227d.js.map +0 -1
- package/dist/components/p-ONE3uKkF.js +0 -2
- package/dist/components/p-ONE3uKkF.js.map +0 -1
- package/dist/esm/index-pfWAsOzE.js.map +0 -1
- /package/dist/chucao/{p-9a614e82.entry.js.map → p-13ab5f9a.entry.js.map} +0 -0
- /package/dist/chucao/{p-053d58a4.entry.js.map → p-1cc7042e.entry.js.map} +0 -0
- /package/dist/chucao/{p-c598f978.entry.js.map → p-23c5220b.entry.js.map} +0 -0
- /package/dist/chucao/{p-ad3206a2.entry.js.map → p-c16b18b7.entry.js.map} +0 -0
- /package/dist/chucao/{p-20492b73.entry.js.map → p-cfb6db53.entry.js.map} +0 -0
- /package/dist/chucao/{p-488c7838.entry.js.map → p-df73f786.entry.js.map} +0 -0
- /package/dist/chucao/{p-fe8e9537.entry.js.map → p-e8fe65bb.entry.js.map} +0 -0
package/hydrate/index.js
CHANGED
|
@@ -132,7 +132,7 @@ function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResu
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
const NAMESPACE = 'chucao';
|
|
135
|
-
const BUILD = /* chucao */ { hotModuleReplacement: false,
|
|
135
|
+
const BUILD = /* chucao */ { hotModuleReplacement: false, slotRelocation: true, state: true, updatable: true};
|
|
136
136
|
|
|
137
137
|
/*
|
|
138
138
|
Stencil Hydrate Platform v4.44.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -1637,6 +1637,31 @@ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
|
|
|
1637
1637
|
return cssText;
|
|
1638
1638
|
};
|
|
1639
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
|
+
|
|
1640
1665
|
// src/utils/remote-value.ts
|
|
1641
1666
|
var RemoteValue = class _RemoteValue {
|
|
1642
1667
|
/**
|
|
@@ -2551,6 +2576,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2551
2576
|
hostRef.$deferredConnectedCallback$ = false;
|
|
2552
2577
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
2553
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
|
+
}
|
|
2554
2586
|
if (hostRef.$fetchedCbList$.length) {
|
|
2555
2587
|
hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
|
|
2556
2588
|
}
|
|
@@ -2712,6 +2744,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2712
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).`
|
|
2713
2745
|
);
|
|
2714
2746
|
}
|
|
2747
|
+
const elm = hostRef.$hostElement$ ;
|
|
2715
2748
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
2716
2749
|
const flags = hostRef.$flags$;
|
|
2717
2750
|
const instance = hostRef.$lazyInstance$ ;
|
|
@@ -2722,6 +2755,27 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2722
2755
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
2723
2756
|
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
2724
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
|
+
}
|
|
2725
2779
|
if (flags & 2 /* hasRendered */) {
|
|
2726
2780
|
if (instance.componentShouldUpdate) {
|
|
2727
2781
|
const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
|
|
@@ -2740,7 +2794,18 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2740
2794
|
var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
2741
2795
|
var _a2;
|
|
2742
2796
|
const prototype = Cstr.prototype;
|
|
2743
|
-
|
|
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
|
+
}
|
|
2744
2809
|
const members = Object.entries((_a2 = cmpMeta.$members$) != null ? _a2 : {});
|
|
2745
2810
|
members.map(([memberName, [memberFlags]]) => {
|
|
2746
2811
|
if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
|
@@ -2825,6 +2890,11 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2825
2890
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
2826
2891
|
}
|
|
2827
2892
|
if (!Cstr.isProxied) {
|
|
2893
|
+
{
|
|
2894
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
2895
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
2896
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
2897
|
+
}
|
|
2828
2898
|
proxyComponent(Cstr, cmpMeta);
|
|
2829
2899
|
Cstr.isProxied = true;
|
|
2830
2900
|
}
|
|
@@ -2840,6 +2910,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2840
2910
|
{
|
|
2841
2911
|
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
2842
2912
|
}
|
|
2913
|
+
{
|
|
2914
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
2915
|
+
}
|
|
2843
2916
|
endNewInstance();
|
|
2844
2917
|
const needsDeferredCallback = cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
|
|
2845
2918
|
if (!needsDeferredCallback) {
|
|
@@ -2938,6 +3011,7 @@ var connectedCallback = (elm) => {
|
|
|
2938
3011
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
2939
3012
|
}
|
|
2940
3013
|
} else {
|
|
3014
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
2941
3015
|
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
2942
3016
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
2943
3017
|
} else if (hostRef.$flags$ & 1024 /* hasFailedLoad */) {
|
|
@@ -2959,6 +3033,38 @@ var setContentReference = (elm) => {
|
|
|
2959
3033
|
contentRefElm["s-cn"] = true;
|
|
2960
3034
|
insertBefore(elm, contentRefElm, elm.firstChild);
|
|
2961
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;
|
|
2962
3068
|
function transformTag(tag) {
|
|
2963
3069
|
return tag;
|
|
2964
3070
|
}
|
|
@@ -4949,6 +5055,7 @@ async function hydrateComponent(win2, results, tagName, elm, waitingElements) {
|
|
|
4949
5055
|
if (!hostRef) {
|
|
4950
5056
|
return;
|
|
4951
5057
|
}
|
|
5058
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4952
5059
|
try {
|
|
4953
5060
|
connectedCallback(elm);
|
|
4954
5061
|
await elm.componentOnReady();
|
|
@@ -5178,7 +5285,7 @@ var registerInstance = (lazyInstance, hostRef) => {
|
|
|
5178
5285
|
if (!hostRef) return void 0;
|
|
5179
5286
|
lazyInstance.__stencil__getHostRef = () => hostRef;
|
|
5180
5287
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
5181
|
-
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.
|
|
5288
|
+
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
|
|
5182
5289
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
5183
5290
|
}
|
|
5184
5291
|
return hostRef;
|
|
@@ -5393,7 +5500,7 @@ class ChCard {
|
|
|
5393
5500
|
registerInstance(this, hostRef);
|
|
5394
5501
|
}
|
|
5395
5502
|
render() {
|
|
5396
|
-
return (hAsync(Host, { key: '
|
|
5503
|
+
return (hAsync(Host, { key: '1541ba4361c996716356fb87cdcc73b1260d4c6a' }, hAsync("div", { key: '924070eeb79f6c8f8e6362772bbab0dcc1c6f315', class: "card" }, hAsync("slot", { key: '2fde36426395a519cb1ebe265ba0eef3aaf6ff38' }))));
|
|
5397
5504
|
}
|
|
5398
5505
|
static get style() { return chCardCss(); }
|
|
5399
5506
|
static get cmpMeta() { return {
|
|
@@ -5473,7 +5580,7 @@ class ChCheckbox {
|
|
|
5473
5580
|
return undefined;
|
|
5474
5581
|
}
|
|
5475
5582
|
render() {
|
|
5476
|
-
return (hAsync(Host, { key: '
|
|
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))));
|
|
5477
5584
|
}
|
|
5478
5585
|
static get style() { return chCheckboxCss(); }
|
|
5479
5586
|
static get cmpMeta() { return {
|
|
@@ -5602,7 +5709,7 @@ class ChInput {
|
|
|
5602
5709
|
return undefined;
|
|
5603
5710
|
}
|
|
5604
5711
|
render() {
|
|
5605
|
-
return (hAsync(Host, { key: '
|
|
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))));
|
|
5606
5713
|
}
|
|
5607
5714
|
static get style() { return chInputCss(); }
|
|
5608
5715
|
static get cmpMeta() { return {
|
|
@@ -5680,6 +5787,195 @@ class ChLink {
|
|
|
5680
5787
|
}; }
|
|
5681
5788
|
}
|
|
5682
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
|
+
|
|
5683
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)}`;
|
|
5684
5980
|
|
|
5685
5981
|
let radioIds = 0;
|
|
@@ -5980,7 +6276,7 @@ class ChSwitch {
|
|
|
5980
6276
|
return undefined;
|
|
5981
6277
|
}
|
|
5982
6278
|
render() {
|
|
5983
|
-
return (hAsync(Host, { key: '
|
|
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))));
|
|
5984
6280
|
}
|
|
5985
6281
|
static get style() { return chSwitchCss(); }
|
|
5986
6282
|
static get cmpMeta() { return {
|
|
@@ -6188,7 +6484,7 @@ class ChTextarea {
|
|
|
6188
6484
|
return undefined;
|
|
6189
6485
|
}
|
|
6190
6486
|
render() {
|
|
6191
|
-
return (hAsync(Host, { key: '
|
|
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))));
|
|
6192
6488
|
}
|
|
6193
6489
|
static get style() { return chTextareaCss(); }
|
|
6194
6490
|
static get cmpMeta() { return {
|
|
@@ -6212,6 +6508,109 @@ class ChTextarea {
|
|
|
6212
6508
|
}; }
|
|
6213
6509
|
}
|
|
6214
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
|
+
|
|
6215
6614
|
registerComponents([
|
|
6216
6615
|
ChAccordion,
|
|
6217
6616
|
ChAlert,
|
|
@@ -6222,12 +6621,14 @@ registerComponents([
|
|
|
6222
6621
|
ChDivider,
|
|
6223
6622
|
ChInput,
|
|
6224
6623
|
ChLink,
|
|
6624
|
+
ChModal,
|
|
6225
6625
|
ChRadio,
|
|
6226
6626
|
ChSelect,
|
|
6227
6627
|
ChSpinner,
|
|
6228
6628
|
ChSwitch,
|
|
6229
6629
|
ChTabs,
|
|
6230
6630
|
ChTextarea,
|
|
6631
|
+
ChTooltip,
|
|
6231
6632
|
]);
|
|
6232
6633
|
|
|
6233
6634
|
exports.hydrateApp = hydrateApp;
|