@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.mjs
CHANGED
|
@@ -130,7 +130,7 @@ 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
136
|
Stencil Hydrate Platform v4.44.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -1635,6 +1635,31 @@ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
|
|
|
1635
1635
|
return cssText;
|
|
1636
1636
|
};
|
|
1637
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
|
+
|
|
1638
1663
|
// src/utils/remote-value.ts
|
|
1639
1664
|
var RemoteValue = class _RemoteValue {
|
|
1640
1665
|
/**
|
|
@@ -2549,6 +2574,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2549
2574
|
hostRef.$deferredConnectedCallback$ = false;
|
|
2550
2575
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
2551
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
|
+
}
|
|
2552
2584
|
if (hostRef.$fetchedCbList$.length) {
|
|
2553
2585
|
hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
|
|
2554
2586
|
}
|
|
@@ -2710,6 +2742,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2710
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).`
|
|
2711
2743
|
);
|
|
2712
2744
|
}
|
|
2745
|
+
const elm = hostRef.$hostElement$ ;
|
|
2713
2746
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
2714
2747
|
const flags = hostRef.$flags$;
|
|
2715
2748
|
const instance = hostRef.$lazyInstance$ ;
|
|
@@ -2720,6 +2753,27 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2720
2753
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
2721
2754
|
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
2722
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
|
+
}
|
|
2723
2777
|
if (flags & 2 /* hasRendered */) {
|
|
2724
2778
|
if (instance.componentShouldUpdate) {
|
|
2725
2779
|
const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
|
|
@@ -2738,7 +2792,18 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2738
2792
|
var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
2739
2793
|
var _a2;
|
|
2740
2794
|
const prototype = Cstr.prototype;
|
|
2741
|
-
|
|
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
|
+
}
|
|
2742
2807
|
const members = Object.entries((_a2 = cmpMeta.$members$) != null ? _a2 : {});
|
|
2743
2808
|
members.map(([memberName, [memberFlags]]) => {
|
|
2744
2809
|
if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
|
@@ -2823,6 +2888,11 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2823
2888
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
2824
2889
|
}
|
|
2825
2890
|
if (!Cstr.isProxied) {
|
|
2891
|
+
{
|
|
2892
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
2893
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
2894
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
2895
|
+
}
|
|
2826
2896
|
proxyComponent(Cstr, cmpMeta);
|
|
2827
2897
|
Cstr.isProxied = true;
|
|
2828
2898
|
}
|
|
@@ -2838,6 +2908,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2838
2908
|
{
|
|
2839
2909
|
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
2840
2910
|
}
|
|
2911
|
+
{
|
|
2912
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
2913
|
+
}
|
|
2841
2914
|
endNewInstance();
|
|
2842
2915
|
const needsDeferredCallback = cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
|
|
2843
2916
|
if (!needsDeferredCallback) {
|
|
@@ -2936,6 +3009,7 @@ var connectedCallback = (elm) => {
|
|
|
2936
3009
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
2937
3010
|
}
|
|
2938
3011
|
} else {
|
|
3012
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
2939
3013
|
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
2940
3014
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
2941
3015
|
} else if (hostRef.$flags$ & 1024 /* hasFailedLoad */) {
|
|
@@ -2957,6 +3031,38 @@ var setContentReference = (elm) => {
|
|
|
2957
3031
|
contentRefElm["s-cn"] = true;
|
|
2958
3032
|
insertBefore(elm, contentRefElm, elm.firstChild);
|
|
2959
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;
|
|
2960
3066
|
function transformTag(tag) {
|
|
2961
3067
|
return tag;
|
|
2962
3068
|
}
|
|
@@ -4947,6 +5053,7 @@ async function hydrateComponent(win2, results, tagName, elm, waitingElements) {
|
|
|
4947
5053
|
if (!hostRef) {
|
|
4948
5054
|
return;
|
|
4949
5055
|
}
|
|
5056
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4950
5057
|
try {
|
|
4951
5058
|
connectedCallback(elm);
|
|
4952
5059
|
await elm.componentOnReady();
|
|
@@ -5176,7 +5283,7 @@ var registerInstance = (lazyInstance, hostRef) => {
|
|
|
5176
5283
|
if (!hostRef) return void 0;
|
|
5177
5284
|
lazyInstance.__stencil__getHostRef = () => hostRef;
|
|
5178
5285
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
5179
|
-
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.
|
|
5286
|
+
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
|
|
5180
5287
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
5181
5288
|
}
|
|
5182
5289
|
return hostRef;
|
|
@@ -5391,7 +5498,7 @@ class ChCard {
|
|
|
5391
5498
|
registerInstance(this, hostRef);
|
|
5392
5499
|
}
|
|
5393
5500
|
render() {
|
|
5394
|
-
return (hAsync(Host, { key: '
|
|
5501
|
+
return (hAsync(Host, { key: '1541ba4361c996716356fb87cdcc73b1260d4c6a' }, hAsync("div", { key: '924070eeb79f6c8f8e6362772bbab0dcc1c6f315', class: "card" }, hAsync("slot", { key: '2fde36426395a519cb1ebe265ba0eef3aaf6ff38' }))));
|
|
5395
5502
|
}
|
|
5396
5503
|
static get style() { return chCardCss(); }
|
|
5397
5504
|
static get cmpMeta() { return {
|
|
@@ -5471,7 +5578,7 @@ class ChCheckbox {
|
|
|
5471
5578
|
return undefined;
|
|
5472
5579
|
}
|
|
5473
5580
|
render() {
|
|
5474
|
-
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))));
|
|
5475
5582
|
}
|
|
5476
5583
|
static get style() { return chCheckboxCss(); }
|
|
5477
5584
|
static get cmpMeta() { return {
|
|
@@ -5600,7 +5707,7 @@ class ChInput {
|
|
|
5600
5707
|
return undefined;
|
|
5601
5708
|
}
|
|
5602
5709
|
render() {
|
|
5603
|
-
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))));
|
|
5604
5711
|
}
|
|
5605
5712
|
static get style() { return chInputCss(); }
|
|
5606
5713
|
static get cmpMeta() { return {
|
|
@@ -5678,6 +5785,195 @@ class ChLink {
|
|
|
5678
5785
|
}; }
|
|
5679
5786
|
}
|
|
5680
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
|
+
|
|
5681
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)}`;
|
|
5682
5978
|
|
|
5683
5979
|
let radioIds = 0;
|
|
@@ -5978,7 +6274,7 @@ class ChSwitch {
|
|
|
5978
6274
|
return undefined;
|
|
5979
6275
|
}
|
|
5980
6276
|
render() {
|
|
5981
|
-
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))));
|
|
5982
6278
|
}
|
|
5983
6279
|
static get style() { return chSwitchCss(); }
|
|
5984
6280
|
static get cmpMeta() { return {
|
|
@@ -6186,7 +6482,7 @@ class ChTextarea {
|
|
|
6186
6482
|
return undefined;
|
|
6187
6483
|
}
|
|
6188
6484
|
render() {
|
|
6189
|
-
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))));
|
|
6190
6486
|
}
|
|
6191
6487
|
static get style() { return chTextareaCss(); }
|
|
6192
6488
|
static get cmpMeta() { return {
|
|
@@ -6210,6 +6506,109 @@ class ChTextarea {
|
|
|
6210
6506
|
}; }
|
|
6211
6507
|
}
|
|
6212
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
|
+
|
|
6213
6612
|
registerComponents([
|
|
6214
6613
|
ChAccordion,
|
|
6215
6614
|
ChAlert,
|
|
@@ -6220,12 +6619,14 @@ registerComponents([
|
|
|
6220
6619
|
ChDivider,
|
|
6221
6620
|
ChInput,
|
|
6222
6621
|
ChLink,
|
|
6622
|
+
ChModal,
|
|
6223
6623
|
ChRadio,
|
|
6224
6624
|
ChSelect,
|
|
6225
6625
|
ChSpinner,
|
|
6226
6626
|
ChSwitch,
|
|
6227
6627
|
ChTabs,
|
|
6228
6628
|
ChTextarea,
|
|
6629
|
+
ChTooltip,
|
|
6229
6630
|
]);
|
|
6230
6631
|
|
|
6231
6632
|
exports.hydrateApp = hydrateApp;
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r,c as a,h as e,H as t}from"./p-pfWAsOzE.js";const i=()=>`:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.textarea{box-sizing:border-box;width:100%;min-height:var(--spacing-6xl);padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;line-height:var(--spacing-5xl);resize:vertical;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.textarea::placeholder{color:var(--text-muted)}.textarea:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.textarea--invalid{border-color:var(--color-status-warning)}.textarea--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.textarea:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;let s=0;const o=4;const d=class{constructor(e){r(this,e);this.chInput=a(this,"chInput");this.chChange=a(this,"chChange")}textareaId=`ch-textarea-${++s}`;hintId=`${this.textareaId}-hint`;errorId=`${this.textareaId}-error`;label;value="";placeholder;rows=o;name;disabled=false;required=false;hint;errorMessage;invalid=false;chInput;chChange;handleInput=r=>{this.value=r.target.value;this.chInput.emit(this.value)};handleChange=r=>{this.value=r.target.value;this.chChange.emit(this.value)};get describedBy(){if(this.invalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){return e(t,{key:"894524247096933b3d2f9cd5897da2c10133cefb"},this.label&&e("label",{key:"1e1d409f458fb7431eb2670ddf2c4146bf28060f",class:"label",htmlFor:this.textareaId},this.label),e("textarea",{key:"9e2cd4f388bc31df4d498d8e32d88be063b557f1",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)&&e("p",{key:"cea50156d745ca55ef6da857c5302c8e04ceb483",class:"hint",id:this.hintId},this.hint),this.invalid&&this.errorMessage&&e("p",{key:"ea525c23bf381f8382e134c01ea76086d84164da",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}};d.style=i();export{d as ch_textarea};
|
|
2
|
-
//# sourceMappingURL=p-0305f2eb.entry.js.map
|