@devschile/chucao 2.4.0 → 2.5.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 +17 -16
- 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-1ebd9dc4.entry.js → p-0bc141a2.entry.js} +2 -2
- package/dist/chucao/{p-449e1ba0.entry.js → p-0e044eff.entry.js} +2 -2
- package/dist/chucao/{p-a07e0e97.entry.js → p-1108062e.entry.js} +2 -2
- package/dist/chucao/{p-85db779c.entry.js → p-26e144ff.entry.js} +2 -2
- package/dist/chucao/p-2c681cc0.entry.js +2 -0
- package/dist/chucao/p-2c681cc0.entry.js.map +1 -0
- package/dist/chucao/p-2e785177.entry.js +2 -0
- package/dist/chucao/{p-0e3c83a6.entry.js.map → p-2e785177.entry.js.map} +1 -1
- package/dist/chucao/{p-6e95f31f.entry.js → p-337d7f68.entry.js} +2 -2
- package/dist/chucao/{p-7c85f5fe.entry.js → p-350f974d.entry.js} +2 -2
- package/dist/chucao/p-4846cac4.entry.js +2 -0
- package/dist/chucao/{p-d0533af6.entry.js → p-6345c9e1.entry.js} +2 -2
- package/dist/chucao/p-957acf39.entry.js +2 -0
- package/dist/chucao/p-957acf39.entry.js.map +1 -0
- package/dist/chucao/{p-34a9d1f4.entry.js → p-97655c41.entry.js} +2 -2
- package/dist/chucao/{p-b5552b50.entry.js → p-9f73855e.entry.js} +2 -2
- package/dist/chucao/p-CIV5Gg1o.js +3 -0
- package/dist/chucao/p-CIV5Gg1o.js.map +1 -0
- package/dist/chucao/p-CnivhwvG.js +2 -0
- package/dist/chucao/p-CnivhwvG.js.map +1 -0
- package/dist/chucao/{p-17451d92.entry.js → p-b53d954e.entry.js} +2 -2
- package/dist/chucao/{p-d776b092.entry.js → p-b6cc08f0.entry.js} +2 -2
- package/dist/chucao/p-be7b5c21.entry.js +2 -0
- package/dist/chucao/p-be7b5c21.entry.js.map +1 -0
- package/dist/chucao/p-c165f839.entry.js +2 -0
- package/dist/chucao/p-c165f839.entry.js.map +1 -0
- package/dist/chucao/{p-56d64d84.entry.js → p-c251b0d1.entry.js} +2 -2
- package/dist/chucao/p-f5b74bca.entry.js +2 -0
- package/dist/chucao/p-f5b74bca.entry.js.map +1 -0
- package/dist/chucao/{p-84d875e9.entry.js → p-f9fe752c.entry.js} +2 -2
- package/dist/chucao/{p-1778a313.entry.js → p-fdf065e6.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ch-alert_8.cjs.entry.js +34 -10
- package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/ch-cluster.cjs.entry.js +3 -3
- package/dist/cjs/ch-divider.cjs.entry.js +2 -2
- package/dist/cjs/ch-drawer.cjs.entry.js +2 -2
- package/dist/cjs/ch-emoji.cjs.entry.js +2 -2
- package/dist/cjs/ch-empty-state.cjs.entry.js +2 -2
- package/dist/cjs/ch-grid.cjs.entry.js +2 -2
- package/dist/cjs/ch-icon-button.cjs.entry.js +51 -0
- package/dist/cjs/ch-icon-button.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-icon.cjs.entry.js +38 -0
- package/dist/cjs/ch-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-link.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +2 -2
- package/dist/cjs/ch-page-header.cjs.entry.js +45 -0
- package/dist/cjs/ch-page-header.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-radio.cjs.entry.js +2 -2
- package/dist/cjs/ch-segmented-control.cjs.entry.js +2 -2
- package/dist/cjs/ch-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/ch-stack.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 +204 -5
- package/dist/cjs/ch-tooltip.cjs.entry.js.map +1 -1
- package/dist/cjs/chucao.cjs.js +2 -2
- package/dist/cjs/icons-CNyDgV-q.js +88 -0
- package/dist/cjs/icons-CNyDgV-q.js.map +1 -0
- package/dist/cjs/{index-ysucLiAq.js → index-ByZY6aTj.js} +81 -5
- package/dist/cjs/index-ByZY6aTj.js.map +1 -0
- package/dist/cjs/index.cjs.js +16 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/ch-alert/ch-alert.css +13 -0
- package/dist/collection/components/ch-alert/ch-alert.js +44 -1
- package/dist/collection/components/ch-alert/ch-alert.js.map +1 -1
- package/dist/collection/components/ch-badge/ch-badge.css +30 -1
- package/dist/collection/components/ch-badge/ch-badge.js +35 -1
- package/dist/collection/components/ch-badge/ch-badge.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-cluster/ch-cluster.js +2 -2
- package/dist/collection/components/ch-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-drawer/ch-drawer.js +1 -1
- package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
- package/dist/collection/components/ch-empty-state/ch-empty-state.js +1 -1
- package/dist/collection/components/ch-grid/ch-grid.js +1 -1
- package/dist/collection/components/ch-icon/ch-icon.css +25 -0
- package/dist/collection/components/ch-icon/ch-icon.js +121 -0
- package/dist/collection/components/ch-icon/ch-icon.js.map +1 -0
- package/dist/collection/components/ch-icon-button/ch-icon-button.css +99 -0
- package/dist/collection/components/ch-icon-button/ch-icon-button.js +216 -0
- package/dist/collection/components/ch-icon-button/ch-icon-button.js.map +1 -0
- package/dist/collection/components/ch-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.js +1 -1
- package/dist/collection/components/ch-page-header/ch-page-header.css +84 -0
- package/dist/collection/components/ch-page-header/ch-page-header.js +162 -0
- package/dist/collection/components/ch-page-header/ch-page-header.js.map +1 -0
- package/dist/collection/components/ch-radio/ch-radio.js +1 -1
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +1 -1
- package/dist/collection/components/ch-select/ch-select.js +1 -1
- package/dist/collection/components/ch-skeleton/ch-skeleton.js +1 -1
- package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
- package/dist/collection/components/ch-stack/ch-stack.js +1 -1
- 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 +29 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +125 -6
- package/dist/collection/components/ch-tooltip/ch-tooltip.js.map +1 -1
- package/dist/collection/tokens/tokens.js +12 -0
- package/dist/collection/tokens/tokens.js.map +1 -1
- package/dist/collection/tokens/types.js.map +1 -1
- package/dist/collection/utils/icons.js +82 -0
- package/dist/collection/utils/icons.js.map +1 -0
- package/dist/collection/utils/overlay.js +101 -0
- package/dist/collection/utils/overlay.js.map +1 -0
- package/dist/components/ch-accordion.js +1 -1
- package/dist/components/ch-alert.js +1 -1
- package/dist/components/ch-alert.js.map +1 -1
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-badge.js.map +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-cluster.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.js +1 -1
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-empty-state.js +1 -1
- package/dist/components/ch-grid.js +1 -1
- package/dist/components/ch-icon-button.d.ts +11 -0
- package/dist/components/ch-icon-button.js +2 -0
- package/dist/components/ch-icon-button.js.map +1 -0
- package/dist/components/ch-icon.d.ts +11 -0
- package/dist/components/ch-icon.js +2 -0
- package/dist/components/ch-icon.js.map +1 -0
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-link.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-page-header.d.ts +11 -0
- package/dist/components/ch-page-header.js +2 -0
- package/dist/components/ch-page-header.js.map +1 -0
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-segmented-control.js +1 -1
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-skeleton.js +1 -1
- package/dist/components/ch-spinner.js +1 -1
- package/dist/components/ch-stack.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.js +1 -1
- package/dist/components/ch-tooltip.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-no2_9Jk-.js → p-CV0rD-fF.js} +2 -2
- package/dist/components/p-CnivhwvG.js +2 -0
- package/dist/components/p-CnivhwvG.js.map +1 -0
- package/dist/components/p-qP_9qshx.js +2 -0
- package/dist/components/p-qP_9qshx.js.map +1 -0
- package/dist/esm/ch-accordion.entry.js +1 -1
- package/dist/esm/ch-alert_8.entry.js +34 -10
- package/dist/esm/ch-alert_8.entry.js.map +1 -1
- package/dist/esm/ch-checkbox.entry.js +2 -2
- package/dist/esm/ch-cluster.entry.js +3 -3
- package/dist/esm/ch-divider.entry.js +2 -2
- package/dist/esm/ch-drawer.entry.js +2 -2
- package/dist/esm/ch-emoji.entry.js +2 -2
- package/dist/esm/ch-empty-state.entry.js +2 -2
- package/dist/esm/ch-grid.entry.js +2 -2
- package/dist/esm/ch-icon-button.entry.js +49 -0
- package/dist/esm/ch-icon-button.entry.js.map +1 -0
- package/dist/esm/ch-icon.entry.js +36 -0
- package/dist/esm/ch-icon.entry.js.map +1 -0
- package/dist/esm/ch-link.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +2 -2
- package/dist/esm/ch-page-header.entry.js +43 -0
- package/dist/esm/ch-page-header.entry.js.map +1 -0
- package/dist/esm/ch-radio.entry.js +2 -2
- package/dist/esm/ch-segmented-control.entry.js +2 -2
- package/dist/esm/ch-skeleton.entry.js +2 -2
- package/dist/esm/ch-stack.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 +204 -5
- package/dist/esm/ch-tooltip.entry.js.map +1 -1
- package/dist/esm/chucao.js +3 -3
- package/dist/esm/icons-CnivhwvG.js +86 -0
- package/dist/esm/icons-CnivhwvG.js.map +1 -0
- package/dist/esm/{index-DVKZbUp9.js → index-CIV5Gg1o.js} +81 -6
- package/dist/esm/index-CIV5Gg1o.js.map +1 -0
- package/dist/esm/index.js +13 -1
- 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 +11 -0
- package/dist/types/components/ch-badge/ch-badge.d.ts +14 -0
- package/dist/types/components/ch-icon/ch-icon.d.ts +29 -0
- package/dist/types/components/ch-icon-button/ch-icon-button.d.ts +36 -0
- package/dist/types/components/ch-page-header/ch-page-header.d.ts +39 -0
- package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +32 -2
- package/dist/types/components.d.ts +406 -2
- package/dist/types/tokens/tokens.d.ts +12 -0
- package/dist/types/tokens/types.d.ts +2 -1
- package/dist/types/utils/icons.d.ts +15 -0
- package/dist/types/utils/overlay.d.ts +49 -0
- package/dist-react/components.d.ts +12 -1
- package/dist-react/components.js +27 -0
- package/dist-react/components.ts +37 -1
- package/dist-vue/index.d.ts +3 -0
- package/dist-vue/index.js +29 -1
- package/dist-vue/index.ts +35 -1
- package/hydrate/index.js +601 -34
- package/hydrate/index.mjs +601 -34
- package/package.json +91 -4
- package/dist/chucao/p-0e3c83a6.entry.js +0 -2
- package/dist/chucao/p-82216381.entry.js +0 -2
- package/dist/chucao/p-82216381.entry.js.map +0 -1
- package/dist/chucao/p-907195ff.entry.js +0 -2
- package/dist/chucao/p-DVKZbUp9.js +0 -3
- package/dist/chucao/p-DVKZbUp9.js.map +0 -1
- package/dist/chucao/p-b392021c.entry.js +0 -2
- package/dist/chucao/p-b392021c.entry.js.map +0 -1
- package/dist/cjs/index-ysucLiAq.js.map +0 -1
- package/dist/components/p-DQOKq7af.js +0 -2
- package/dist/components/p-DQOKq7af.js.map +0 -1
- package/dist/esm/index-DVKZbUp9.js.map +0 -1
- /package/dist/chucao/{p-1ebd9dc4.entry.js.map → p-0bc141a2.entry.js.map} +0 -0
- /package/dist/chucao/{p-449e1ba0.entry.js.map → p-0e044eff.entry.js.map} +0 -0
- /package/dist/chucao/{p-a07e0e97.entry.js.map → p-1108062e.entry.js.map} +0 -0
- /package/dist/chucao/{p-85db779c.entry.js.map → p-26e144ff.entry.js.map} +0 -0
- /package/dist/chucao/{p-6e95f31f.entry.js.map → p-337d7f68.entry.js.map} +0 -0
- /package/dist/chucao/{p-7c85f5fe.entry.js.map → p-350f974d.entry.js.map} +0 -0
- /package/dist/chucao/{p-907195ff.entry.js.map → p-4846cac4.entry.js.map} +0 -0
- /package/dist/chucao/{p-d0533af6.entry.js.map → p-6345c9e1.entry.js.map} +0 -0
- /package/dist/chucao/{p-34a9d1f4.entry.js.map → p-97655c41.entry.js.map} +0 -0
- /package/dist/chucao/{p-b5552b50.entry.js.map → p-9f73855e.entry.js.map} +0 -0
- /package/dist/chucao/{p-17451d92.entry.js.map → p-b53d954e.entry.js.map} +0 -0
- /package/dist/chucao/{p-d776b092.entry.js.map → p-b6cc08f0.entry.js.map} +0 -0
- /package/dist/chucao/{p-56d64d84.entry.js.map → p-c251b0d1.entry.js.map} +0 -0
- /package/dist/chucao/{p-84d875e9.entry.js.map → p-f9fe752c.entry.js.map} +0 -0
- /package/dist/chucao/{p-1778a313.entry.js.map → p-fdf065e6.entry.js.map} +0 -0
- /package/dist/components/{p-no2_9Jk-.js.map → p-CV0rD-fF.js.map} +0 -0
package/hydrate/index.mjs
CHANGED
|
@@ -423,6 +423,10 @@ var require_brace_expansion = __commonJS({
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
});
|
|
426
|
+
|
|
427
|
+
// src/utils/constants.ts
|
|
428
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
429
|
+
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
426
430
|
var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
|
|
427
431
|
PrimitiveType2["Undefined"] = "undefined";
|
|
428
432
|
PrimitiveType2["Null"] = "null";
|
|
@@ -839,6 +843,13 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
839
843
|
}
|
|
840
844
|
}
|
|
841
845
|
}
|
|
846
|
+
if (typeof nodeName === "function") {
|
|
847
|
+
return nodeName(
|
|
848
|
+
vnodeData === null ? {} : vnodeData,
|
|
849
|
+
vNodeChildren,
|
|
850
|
+
vdomFnUtils
|
|
851
|
+
);
|
|
852
|
+
}
|
|
842
853
|
const vnode = newVNode(nodeName, null);
|
|
843
854
|
vnode.$attrs$ = vnodeData;
|
|
844
855
|
if (vNodeChildren.length > 0) {
|
|
@@ -874,6 +885,36 @@ var newVNode = (tag, text) => {
|
|
|
874
885
|
};
|
|
875
886
|
var Host = {};
|
|
876
887
|
var isHost = (node) => node && node.$tag$ === Host;
|
|
888
|
+
var vdomFnUtils = {
|
|
889
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
890
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
|
|
891
|
+
};
|
|
892
|
+
var convertToPublic = (node) => ({
|
|
893
|
+
vattrs: node.$attrs$,
|
|
894
|
+
vchildren: node.$children$,
|
|
895
|
+
vkey: node.$key$,
|
|
896
|
+
vname: node.$name$,
|
|
897
|
+
vtag: node.$tag$,
|
|
898
|
+
vtext: node.$text$
|
|
899
|
+
});
|
|
900
|
+
var convertToPrivate = (node) => {
|
|
901
|
+
if (typeof node.vtag === "function") {
|
|
902
|
+
const vnodeData = { ...node.vattrs };
|
|
903
|
+
if (node.vkey) {
|
|
904
|
+
vnodeData.key = node.vkey;
|
|
905
|
+
}
|
|
906
|
+
if (node.vname) {
|
|
907
|
+
vnodeData.name = node.vname;
|
|
908
|
+
}
|
|
909
|
+
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
910
|
+
}
|
|
911
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
|
912
|
+
vnode.$attrs$ = node.vattrs;
|
|
913
|
+
vnode.$children$ = node.vchildren;
|
|
914
|
+
vnode.$key$ = node.vkey;
|
|
915
|
+
vnode.$name$ = node.vname;
|
|
916
|
+
return vnode;
|
|
917
|
+
};
|
|
877
918
|
|
|
878
919
|
// src/runtime/client-hydrate.ts
|
|
879
920
|
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
@@ -2088,12 +2129,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2088
2129
|
updateElement(null, newVNode2, isSvgMode);
|
|
2089
2130
|
}
|
|
2090
2131
|
} else {
|
|
2132
|
+
if (!isSvgMode) {
|
|
2133
|
+
isSvgMode = newVNode2.$tag$ === "svg";
|
|
2134
|
+
}
|
|
2091
2135
|
if (!win.document) {
|
|
2092
2136
|
throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
|
|
2093
2137
|
}
|
|
2094
|
-
elm = newVNode2.$elm$ = win.document.
|
|
2138
|
+
elm = newVNode2.$elm$ = win.document.createElementNS(
|
|
2139
|
+
isSvgMode ? SVG_NS : HTML_NS,
|
|
2095
2140
|
!useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2096
|
-
);
|
|
2141
|
+
) ;
|
|
2142
|
+
if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
2143
|
+
isSvgMode = false;
|
|
2144
|
+
}
|
|
2097
2145
|
{
|
|
2098
2146
|
updateElement(null, newVNode2, isSvgMode);
|
|
2099
2147
|
}
|
|
@@ -2109,6 +2157,13 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2109
2157
|
}
|
|
2110
2158
|
}
|
|
2111
2159
|
}
|
|
2160
|
+
{
|
|
2161
|
+
if (newVNode2.$tag$ === "svg") {
|
|
2162
|
+
isSvgMode = false;
|
|
2163
|
+
} else if (elm.tagName === "foreignObject") {
|
|
2164
|
+
isSvgMode = true;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2112
2167
|
}
|
|
2113
2168
|
elm["s-hn"] = hostTagName;
|
|
2114
2169
|
{
|
|
@@ -2333,6 +2388,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
2333
2388
|
const text = newVNode2.$text$;
|
|
2334
2389
|
let defaultHolder;
|
|
2335
2390
|
if (text == null) {
|
|
2391
|
+
{
|
|
2392
|
+
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
|
2393
|
+
}
|
|
2336
2394
|
{
|
|
2337
2395
|
if (tag === "slot" && !useNativeShadowDom) {
|
|
2338
2396
|
if (oldVNode.$name$ !== newVNode2.$name$) {
|
|
@@ -2357,6 +2415,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
2357
2415
|
} else if (isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) {
|
|
2358
2416
|
newVNode2.$children$ = oldChildren;
|
|
2359
2417
|
}
|
|
2418
|
+
if (isSvgMode && tag === "svg") {
|
|
2419
|
+
isSvgMode = false;
|
|
2420
|
+
}
|
|
2360
2421
|
} else if ((defaultHolder = elm["s-cr"])) {
|
|
2361
2422
|
defaultHolder.parentNode.textContent = text;
|
|
2362
2423
|
} else if (oldVNode.$text$ !== text) {
|
|
@@ -3137,6 +3198,9 @@ var getHostListenerTarget = (doc, elm, flags) => {
|
|
|
3137
3198
|
if (flags & 4 /* TargetDocument */) {
|
|
3138
3199
|
return doc;
|
|
3139
3200
|
}
|
|
3201
|
+
if (flags & 8 /* TargetWindow */) {
|
|
3202
|
+
return win;
|
|
3203
|
+
}
|
|
3140
3204
|
return elm;
|
|
3141
3205
|
};
|
|
3142
3206
|
var hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
@@ -5453,8 +5517,100 @@ class ChAccordion {
|
|
|
5453
5517
|
}; }
|
|
5454
5518
|
}
|
|
5455
5519
|
|
|
5456
|
-
const
|
|
5520
|
+
const chIcons = {
|
|
5521
|
+
alert: [
|
|
5522
|
+
{ tag: 'path', attrs: { d: 'm21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3' } },
|
|
5523
|
+
{ tag: 'path', attrs: { d: 'M12 9v4' } },
|
|
5524
|
+
{ tag: 'path', attrs: { d: 'M12 17h.01' } },
|
|
5525
|
+
],
|
|
5526
|
+
arrowRight: [
|
|
5527
|
+
{ tag: 'path', attrs: { d: 'M5 12h14' } },
|
|
5528
|
+
{ tag: 'path', attrs: { d: 'm12 5 7 7-7 7' } },
|
|
5529
|
+
],
|
|
5530
|
+
check: [{ tag: 'path', attrs: { d: 'M20 6 9 17l-5-5' } }],
|
|
5531
|
+
chevronDown: [{ tag: 'path', attrs: { d: 'm6 9 6 6 6-6' } }],
|
|
5532
|
+
chevronRight: [{ tag: 'path', attrs: { d: 'm9 18 6-6-6-6' } }],
|
|
5533
|
+
close: [
|
|
5534
|
+
{ tag: 'path', attrs: { d: 'M18 6 6 18' } },
|
|
5535
|
+
{ tag: 'path', attrs: { d: 'm6 6 12 12' } },
|
|
5536
|
+
],
|
|
5537
|
+
copy: [
|
|
5538
|
+
{ tag: 'rect', attrs: { width: '14', height: '14', x: '8', y: '8', rx: '2', ry: '2' } },
|
|
5539
|
+
{ tag: 'path', attrs: { d: 'M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2' } },
|
|
5540
|
+
],
|
|
5541
|
+
delete: [
|
|
5542
|
+
{ tag: 'path', attrs: { d: 'M10 11v6' } },
|
|
5543
|
+
{ tag: 'path', attrs: { d: 'M14 11v6' } },
|
|
5544
|
+
{ tag: 'path', attrs: { d: 'M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6' } },
|
|
5545
|
+
{ tag: 'path', attrs: { d: 'M3 6h18' } },
|
|
5546
|
+
{ tag: 'path', attrs: { d: 'M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2' } },
|
|
5547
|
+
],
|
|
5548
|
+
download: [
|
|
5549
|
+
{ tag: 'path', attrs: { d: 'M12 15V3' } },
|
|
5550
|
+
{ tag: 'path', attrs: { d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' } },
|
|
5551
|
+
{ tag: 'path', attrs: { d: 'm7 10 5 5 5-5' } },
|
|
5552
|
+
],
|
|
5553
|
+
error: [
|
|
5554
|
+
{ tag: 'circle', attrs: { cx: '12', cy: '12', r: '10' } },
|
|
5555
|
+
{ tag: 'line', attrs: {} },
|
|
5556
|
+
{ tag: 'line', attrs: {} },
|
|
5557
|
+
],
|
|
5558
|
+
externalLink: [
|
|
5559
|
+
{ tag: 'path', attrs: { d: 'M15 3h6v6' } },
|
|
5560
|
+
{ tag: 'path', attrs: { d: 'M10 14 21 3' } },
|
|
5561
|
+
{ tag: 'path', attrs: { d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6' } },
|
|
5562
|
+
],
|
|
5563
|
+
info: [
|
|
5564
|
+
{ tag: 'circle', attrs: { cx: '12', cy: '12', r: '10' } },
|
|
5565
|
+
{ tag: 'path', attrs: { d: 'M12 16v-4' } },
|
|
5566
|
+
{ tag: 'path', attrs: { d: 'M12 8h.01' } },
|
|
5567
|
+
],
|
|
5568
|
+
menu: [
|
|
5569
|
+
{ tag: 'path', attrs: { d: 'M4 5h16' } },
|
|
5570
|
+
{ tag: 'path', attrs: { d: 'M4 12h16' } },
|
|
5571
|
+
{ tag: 'path', attrs: { d: 'M4 19h16' } },
|
|
5572
|
+
],
|
|
5573
|
+
plus: [
|
|
5574
|
+
{ tag: 'path', attrs: { d: 'M5 12h14' } },
|
|
5575
|
+
{ tag: 'path', attrs: { d: 'M12 5v14' } },
|
|
5576
|
+
],
|
|
5577
|
+
search: [
|
|
5578
|
+
{ tag: 'path', attrs: { d: 'm21 21-4.34-4.34' } },
|
|
5579
|
+
{ tag: 'circle', attrs: { cx: '11', cy: '11', r: '8' } },
|
|
5580
|
+
],
|
|
5581
|
+
spinner: [
|
|
5582
|
+
{ tag: 'path', attrs: { d: 'M12 2v4' } },
|
|
5583
|
+
{ tag: 'path', attrs: { d: 'm16.2 7.8 2.9-2.9' } },
|
|
5584
|
+
{ tag: 'path', attrs: { d: 'M18 12h4' } },
|
|
5585
|
+
{ tag: 'path', attrs: { d: 'm16.2 16.2 2.9 2.9' } },
|
|
5586
|
+
{ tag: 'path', attrs: { d: 'M12 18v4' } },
|
|
5587
|
+
{ tag: 'path', attrs: { d: 'm4.9 19.1 2.9-2.9' } },
|
|
5588
|
+
{ tag: 'path', attrs: { d: 'M2 12h4' } },
|
|
5589
|
+
{ tag: 'path', attrs: { d: 'm4.9 4.9 2.9 2.9' } },
|
|
5590
|
+
],
|
|
5591
|
+
success: [
|
|
5592
|
+
{ tag: 'circle', attrs: { cx: '12', cy: '12', r: '10' } },
|
|
5593
|
+
{ tag: 'path', attrs: { d: 'm16 9-5.5 5.5L8 12' } },
|
|
5594
|
+
],
|
|
5595
|
+
upload: [
|
|
5596
|
+
{ tag: 'path', attrs: { d: 'M12 3v12' } },
|
|
5597
|
+
{ tag: 'path', attrs: { d: 'm17 8-5-5-5 5' } },
|
|
5598
|
+
{ tag: 'path', attrs: { d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' } },
|
|
5599
|
+
],
|
|
5600
|
+
};
|
|
5601
|
+
|
|
5602
|
+
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-left:var(--border-accent-bar) solid transparent;border-radius:var(--radius);font-size:var(--typography-size-sm);line-height:1.5}.alert-icon{width:var(--icon-size-md);height:var(--icon-size-md);flex:none;margin-top:1px}.alert-content{flex:1;min-width:0;overflow-wrap:anywhere}.alert--default{color:var(--text);background:var(--surface);border-color:var(--border);border-left-color:var(--color-text-secondary)}.alert--positive{color:var(--color-status-positive);background:var(--color-status-positive-background);border-color:var(--color-status-positive);border-left-color:var(--color-status-positive)}.alert--warning{color:var(--color-status-warning);background:var(--color-status-warning-background);border-color:var(--color-status-warning);border-left-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}}`;
|
|
5457
5603
|
|
|
5604
|
+
/**
|
|
5605
|
+
* The glyph paired with each variant. It is what makes the variants
|
|
5606
|
+
* distinguishable without colour: `default` is informational, `positive`
|
|
5607
|
+
* confirms and `warning` warns, and each reads differently in grayscale.
|
|
5608
|
+
*/
|
|
5609
|
+
const VARIANT_ICON = {
|
|
5610
|
+
default: 'info',
|
|
5611
|
+
positive: 'success',
|
|
5612
|
+
warning: 'alert',
|
|
5613
|
+
};
|
|
5458
5614
|
/**
|
|
5459
5615
|
* Block-level status message.
|
|
5460
5616
|
*
|
|
@@ -5463,6 +5619,11 @@ const chAlertCss = () => `:host{display:block}.alert{display:flex;align-items:fl
|
|
|
5463
5619
|
* interrupt. Both announce reliably when the alert is added to the page in
|
|
5464
5620
|
* response to something — an alert already present at load may not be read out,
|
|
5465
5621
|
* which is how live regions work rather than something this component controls.
|
|
5622
|
+
*
|
|
5623
|
+
* Every variant also carries an icon and a thicker leading edge, so the three
|
|
5624
|
+
* states stay distinguishable without colour vision. The icon is decorative:
|
|
5625
|
+
* the text next to it already says what happened, and announcing "check
|
|
5626
|
+
* circle" before it would only add noise.
|
|
5466
5627
|
*/
|
|
5467
5628
|
class ChAlert {
|
|
5468
5629
|
constructor(hostRef) {
|
|
@@ -5481,6 +5642,12 @@ class ChAlert {
|
|
|
5481
5642
|
* so without a label it would have no accessible name at all.
|
|
5482
5643
|
*/
|
|
5483
5644
|
dismissLabel;
|
|
5645
|
+
/**
|
|
5646
|
+
* Whether to show the variant's icon. On by default so the status is not
|
|
5647
|
+
* colour-only; turn it off when the surrounding copy already carries the cue
|
|
5648
|
+
* and a second marker would be redundant.
|
|
5649
|
+
*/
|
|
5650
|
+
statusCue = true;
|
|
5484
5651
|
/**
|
|
5485
5652
|
* Emitted when the dismiss button is clicked. The alert stays in the DOM —
|
|
5486
5653
|
* whether to remove it is the consumer's decision. If you do remove it, move
|
|
@@ -5493,7 +5660,8 @@ class ChAlert {
|
|
|
5493
5660
|
};
|
|
5494
5661
|
render() {
|
|
5495
5662
|
const role = this.variant === 'warning' ? 'alert' : 'status';
|
|
5496
|
-
|
|
5663
|
+
const shapes = this.statusCue ? chIcons[VARIANT_ICON[this.variant]] : undefined;
|
|
5664
|
+
return (hAsync(Host, { key: '5a14801af29be0634bd35cf8706446a3a5d33286' }, hAsync("div", { key: role, class: { alert: true, [`alert--${this.variant}`]: true }, role: role }, shapes && (hAsync("svg", { key: 'dbaf65b9d7dc08e2ba51b60b273a16ae42eacb02', class: "alert-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", focusable: "false" }, shapes.map(shape => hAsync(shape.tag, shape.attrs)))), hAsync("div", { key: 'ad1c508dea9e3f9e718ec8104f8236065f3eb0e8', class: "alert-content" }, hAsync("slot", { key: '6f906d355fa416b674994716a3ca896ae517f492' })), this.dismissLabel && (hAsync("button", { key: '165af98fa093bda95c785e86c078b69aee2c0580', class: "alert-dismiss", type: "button", "aria-label": this.dismissLabel, onClick: this.handleDismiss }, hAsync("span", { key: '0a05eff2d077559dc267bd72898299c5d42eaf8a', "aria-hidden": "true" }, "\u00D7"))))));
|
|
5497
5665
|
}
|
|
5498
5666
|
static get style() { return chAlertCss(); }
|
|
5499
5667
|
static get cmpMeta() { return {
|
|
@@ -5501,7 +5669,8 @@ class ChAlert {
|
|
|
5501
5669
|
"$tagName$": "ch-alert",
|
|
5502
5670
|
"$members$": {
|
|
5503
5671
|
"variant": [1],
|
|
5504
|
-
"dismissLabel": [1, "dismiss-label"]
|
|
5672
|
+
"dismissLabel": [1, "dismiss-label"],
|
|
5673
|
+
"statusCue": [4, "status-cue"]
|
|
5505
5674
|
},
|
|
5506
5675
|
"$listeners$": undefined,
|
|
5507
5676
|
"$lazyBundleId$": "-",
|
|
@@ -5509,8 +5678,16 @@ class ChAlert {
|
|
|
5509
5678
|
}; }
|
|
5510
5679
|
}
|
|
5511
5680
|
|
|
5512
|
-
const chBadgeCss = () => `:host{display:inline-block}.badge{display:inline-
|
|
5681
|
+
const chBadgeCss = () => `:host{display:inline-block}.badge{display:inline-flex;align-items:center;gap:var(--spacing-xs);padding:var(--spacing-2xs) var(--spacing-lg);border:var(--border-width) solid transparent;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-dot{display:block;flex:none;width:0.45em;height:0.45em;background:currentColor;border-radius:var(--radius-pill)}.badge--default{background:var(--color-surface-hover);color:var(--accent);border-color:var(--accent)}.badge--positive{background:var(--color-status-positive-background);color:var(--color-status-positive);border-color:var(--color-status-positive)}.badge--positive .badge-dot{background:transparent;border:var(--border-width) solid currentColor;border-radius:var(--radius-pill)}.badge--warning{background:var(--color-status-warning-background);color:var(--color-status-warning);border-color:var(--color-status-warning)}.badge--warning .badge-dot{border-radius:0}`;
|
|
5513
5682
|
|
|
5683
|
+
/**
|
|
5684
|
+
* Small status label.
|
|
5685
|
+
*
|
|
5686
|
+
* Variants are not colour-only: each one also changes the leading dot's shape
|
|
5687
|
+
* and adds a matching border, so a badge still says which state it is in when
|
|
5688
|
+
* printed in grayscale or seen with colour-vision deficiency. `default` uses a
|
|
5689
|
+
* filled dot, `positive` a ring, and `warning` a filled square.
|
|
5690
|
+
*/
|
|
5514
5691
|
class ChBadge {
|
|
5515
5692
|
constructor(hostRef) {
|
|
5516
5693
|
registerInstance(this, hostRef);
|
|
@@ -5519,15 +5696,22 @@ class ChBadge {
|
|
|
5519
5696
|
* The visual style of the badge. Either `default`, `positive`, or `warning`.
|
|
5520
5697
|
*/
|
|
5521
5698
|
variant = 'default';
|
|
5699
|
+
/**
|
|
5700
|
+
* Whether to show the variant marker. On by default so the state does not
|
|
5701
|
+
* depend on colour; turn it off for a badge that only repeats text already
|
|
5702
|
+
* carrying the meaning.
|
|
5703
|
+
*/
|
|
5704
|
+
statusCue = true;
|
|
5522
5705
|
render() {
|
|
5523
|
-
return (hAsync(Host, { key: '
|
|
5706
|
+
return (hAsync(Host, { key: '4690e03d920f9fd89afc7a37cab1e2c57d26f1f2' }, hAsync("span", { key: '73bac91869bb6e37d1434e7318fd716ffedc2120', class: { badge: true, [`badge--${this.variant}`]: true } }, this.statusCue && hAsync("span", { key: '8272f087de323e6d729a1820d971da6c5dc7c5b5', class: "badge-dot", "aria-hidden": "true" }), hAsync("slot", { key: 'bafc32e7a928fa7c458efb12a08fa0bbf18e83e6' }))));
|
|
5524
5707
|
}
|
|
5525
5708
|
static get style() { return chBadgeCss(); }
|
|
5526
5709
|
static get cmpMeta() { return {
|
|
5527
5710
|
"$flags$": 777,
|
|
5528
5711
|
"$tagName$": "ch-badge",
|
|
5529
5712
|
"$members$": {
|
|
5530
|
-
"variant": [1]
|
|
5713
|
+
"variant": [1],
|
|
5714
|
+
"statusCue": [4, "status-cue"]
|
|
5531
5715
|
},
|
|
5532
5716
|
"$listeners$": undefined,
|
|
5533
5717
|
"$lazyBundleId$": "-",
|
|
@@ -5650,7 +5834,7 @@ class ChCard {
|
|
|
5650
5834
|
registerInstance(this, hostRef);
|
|
5651
5835
|
}
|
|
5652
5836
|
render() {
|
|
5653
|
-
return (hAsync(Host, { key: '
|
|
5837
|
+
return (hAsync(Host, { key: 'b3952612583c8f61076164d3795b56d54b023a77' }, hAsync("div", { key: 'd0f58a9f84006c942ef9b27926f8cfa3138ad7d2', class: "card" }, hAsync("slot", { key: '9b1b54af6c5ff58417732764d4fcb8a8114348c4' }))));
|
|
5654
5838
|
}
|
|
5655
5839
|
static get style() { return chCardCss(); }
|
|
5656
5840
|
static get cmpMeta() { return {
|
|
@@ -5791,7 +5975,7 @@ class ChCheckbox {
|
|
|
5791
5975
|
return undefined;
|
|
5792
5976
|
}
|
|
5793
5977
|
render() {
|
|
5794
|
-
return (hAsync(Host, { key: '
|
|
5978
|
+
return (hAsync(Host, { key: '5246c3e6798a4ad0407f3b817ca1b83ab786ca1e' }, hAsync("label", { key: 'c3fda492b9c61c81fd3c7afe62e5c379f783ff28', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.checkboxId }, hAsync("input", { key: 'd77cdf632cbe58c74719567a52fbe224fcceca0b', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && hAsync("span", { key: 'b2707475cc9b3f1e70044566e16ce1b90facabc6', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: 'f597fbea344370911f71f2360db4eb0e57d3999d', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '75082edd8a5a477c7c95365e6e2da66f6b69d6cc', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
5795
5979
|
}
|
|
5796
5980
|
static get formAssociated() { return true; }
|
|
5797
5981
|
static get watchers() { return {
|
|
@@ -5862,13 +6046,13 @@ class ChCluster {
|
|
|
5862
6046
|
return GAPS$2.has(this.gap) ? this.gap : 'md';
|
|
5863
6047
|
}
|
|
5864
6048
|
render() {
|
|
5865
|
-
return (hAsync(Host, { key: '
|
|
6049
|
+
return (hAsync(Host, { key: 'f55b938f1f3e898b63646945af934258bf87b1af', class: {
|
|
5866
6050
|
'cluster': true,
|
|
5867
6051
|
[`cluster--gap-${this.gapStep}`]: true,
|
|
5868
6052
|
[`cluster--align-${this.align}`]: true,
|
|
5869
6053
|
[`cluster--justify-${this.justify}`]: true,
|
|
5870
6054
|
'cluster--nowrap': !this.wrap,
|
|
5871
|
-
} }, hAsync("slot", { key: '
|
|
6055
|
+
} }, hAsync("slot", { key: 'b4c3adf66aa275eac6f60c512454a9b4391e14d3' })));
|
|
5872
6056
|
}
|
|
5873
6057
|
static get style() { return chClusterCss(); }
|
|
5874
6058
|
static get cmpMeta() { return {
|
|
@@ -5897,7 +6081,7 @@ class ChDivider {
|
|
|
5897
6081
|
*/
|
|
5898
6082
|
orientation = 'horizontal';
|
|
5899
6083
|
render() {
|
|
5900
|
-
return (hAsync(Host, { key: '
|
|
6084
|
+
return (hAsync(Host, { key: 'bf9e60345f2958ac334df8e8b3cf135363a4cd84', class: { 'divider--vertical': this.orientation === 'vertical' } }, hAsync("hr", { key: '9a6348a2e46fa30c7b58a96f875c438468866b44', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
|
|
5901
6085
|
}
|
|
5902
6086
|
static get style() { return chDividerCss(); }
|
|
5903
6087
|
static get cmpMeta() { return {
|
|
@@ -6102,7 +6286,7 @@ class ChDrawer {
|
|
|
6102
6286
|
this.chClose.emit();
|
|
6103
6287
|
};
|
|
6104
6288
|
render() {
|
|
6105
|
-
return (hAsync(Host, { key: '
|
|
6289
|
+
return (hAsync(Host, { key: '38cbc3aa6b3c94202a4809193415b7ace9a4b377' }, hAsync("dialog", { key: '1c130ab25aabe596b87711ff5e61f121281ec98e', class: { drawer: true, [`drawer--${this.side}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, hAsync("div", { key: '7307a0835d140253a7ac6070cdd26eb82deb45e4', class: "drawer-head" }, hAsync("slot", { key: '371e0df2e6152642ae90763387985647fbf45794', name: "header" }), this.closeLabel && (hAsync("button", { key: 'e568aae38a6440e873342c931e0db9f6f933e20f', class: "drawer-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, hAsync("span", { key: 'cf5e72590342726586bd1d4e10e879531e70aba7', "aria-hidden": "true" }, "\u00D7")))), hAsync("div", { key: 'c832d23ce2be0e3cfd8e07a23a807cf4bc9163db', class: "drawer-body" }, hAsync("slot", { key: '16850f131819ae59d07893f40296cefd2bd4ce70' })), hAsync("slot", { key: '1682090d53ce7df009caa7d3360fc39e7bc5e47c', name: "footer" }))));
|
|
6106
6290
|
}
|
|
6107
6291
|
static get watchers() { return {
|
|
6108
6292
|
"open": [{
|
|
@@ -6214,7 +6398,7 @@ class ChEmoji {
|
|
|
6214
6398
|
this.loaded = true;
|
|
6215
6399
|
};
|
|
6216
6400
|
render() {
|
|
6217
|
-
return (hAsync(Host, { key: '
|
|
6401
|
+
return (hAsync(Host, { key: '403f04792b293ef20f1e01c201bc530e5bd4429c' }, hAsync("img", { key: '00b8c6f0cc5a048d21cca594472f17bcbc9882a5', class: {
|
|
6218
6402
|
'emoji': true,
|
|
6219
6403
|
[`emoji--${this.size}`]: true,
|
|
6220
6404
|
'emoji--hidden': !this.loaded,
|
|
@@ -6270,7 +6454,7 @@ class ChEmptyState {
|
|
|
6270
6454
|
*/
|
|
6271
6455
|
size = 'md';
|
|
6272
6456
|
render() {
|
|
6273
|
-
return (hAsync(Host, { key: '
|
|
6457
|
+
return (hAsync(Host, { key: '7438cc3c538a3d789fb3c4832d5483ce7032fcdb', class: { 'empty-state': true, [`empty-state--${this.size}`]: true } }, hAsync("div", { key: '29d06044057fc95e977fba87ce0965628509e6ef', class: "empty-state__inner" }, hAsync("div", { key: 'c49c5331ab11c03a5a0ea42fd3e622ee0093c5d6', class: "empty-state__icon", "aria-hidden": "true" }, hAsync("slot", { key: 'c5f1e5dd26438b66df8ca46c1ff7830606af2742', name: "icon" })), hAsync("h3", { key: '9604df7541e0a03c99045b93bd771a27251dbea2', class: "empty-state__title" }, this.title), this.description && hAsync("p", { key: '10800f7b89bb93c979566b657a17fb36dbb9bce8', class: "empty-state__description" }, this.description), hAsync("div", { key: '38ecef67b8c7e264acf460f715299fa21c4d7dea', class: "empty-state__actions" }, hAsync("slot", { key: '1d266f2914232f16b9e212c7cf3b2eb13d4a0fe2' })))));
|
|
6274
6458
|
}
|
|
6275
6459
|
static get style() { return chEmptyStateCss(); }
|
|
6276
6460
|
static get cmpMeta() { return {
|
|
@@ -6341,7 +6525,7 @@ class ChGrid {
|
|
|
6341
6525
|
this.el.style.setProperty('--ch-grid-columns', template);
|
|
6342
6526
|
}
|
|
6343
6527
|
render() {
|
|
6344
|
-
return (hAsync(Host, { key: '
|
|
6528
|
+
return (hAsync(Host, { key: 'a453ec09920d782d4ad324a773b1e67634e2012f', class: { grid: true, [`grid--gap-${this.gapStep}`]: true } }, hAsync("slot", { key: 'b0efb94df64941d5a94c06ae04d299e1b04f6109' })));
|
|
6345
6529
|
}
|
|
6346
6530
|
static get style() { return chGridCss(); }
|
|
6347
6531
|
static get cmpMeta() { return {
|
|
@@ -6358,6 +6542,122 @@ class ChGrid {
|
|
|
6358
6542
|
}; }
|
|
6359
6543
|
}
|
|
6360
6544
|
|
|
6545
|
+
const chIconCss = () => `:host{display:inline-flex;line-height:0}.icon{display:block;flex:none;color:inherit}.icon--sm{width:var(--icon-size-sm);height:var(--icon-size-sm)}.icon--md{width:var(--icon-size-md);height:var(--icon-size-md)}.icon--lg{width:var(--icon-size-lg);height:var(--icon-size-lg)}`;
|
|
6546
|
+
|
|
6547
|
+
/**
|
|
6548
|
+
* A single Lucide glyph.
|
|
6549
|
+
*
|
|
6550
|
+
* Decorative by default: the icon is hidden from assistive technology unless
|
|
6551
|
+
* you give it a `label`, because most icons sit next to text that already says
|
|
6552
|
+
* what they mean and a second announcement is noise. Set `label` only when the
|
|
6553
|
+
* icon carries meaning on its own; a control whose only content is an icon
|
|
6554
|
+
* should use `ch-icon-button`, which requires the name.
|
|
6555
|
+
*/
|
|
6556
|
+
class ChIcon {
|
|
6557
|
+
constructor(hostRef) {
|
|
6558
|
+
registerInstance(this, hostRef);
|
|
6559
|
+
}
|
|
6560
|
+
/**
|
|
6561
|
+
* Which glyph to draw. Unknown values render nothing rather than throwing,
|
|
6562
|
+
* so a stale name in a data payload cannot break the page.
|
|
6563
|
+
*/
|
|
6564
|
+
name;
|
|
6565
|
+
/**
|
|
6566
|
+
* `sm` is 16px, `md` is 20px and `lg` is 24px — the sizes the scale's line
|
|
6567
|
+
* heights were built around.
|
|
6568
|
+
*/
|
|
6569
|
+
size = 'md';
|
|
6570
|
+
/**
|
|
6571
|
+
* Accessible name. When set, the icon becomes `role="img"` and is announced;
|
|
6572
|
+
* when omitted it is `aria-hidden`.
|
|
6573
|
+
*/
|
|
6574
|
+
label;
|
|
6575
|
+
render() {
|
|
6576
|
+
const shapes = this.name ? chIcons[this.name] : undefined;
|
|
6577
|
+
const decorative = !this.label;
|
|
6578
|
+
return (hAsync(Host, { key: '46040274042301b799f103c483281a0c8088c23d' }, hAsync("svg", { key: '9e116b6983020700ceababc691216b1f05d1c460', class: `icon icon--${this.size}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", role: decorative ? undefined : 'img', "aria-label": this.label, "aria-hidden": decorative ? 'true' : undefined, focusable: "false" }, (shapes ?? []).map(shape => hAsync(shape.tag, shape.attrs)))));
|
|
6579
|
+
}
|
|
6580
|
+
static get style() { return chIconCss(); }
|
|
6581
|
+
static get cmpMeta() { return {
|
|
6582
|
+
"$flags$": 521,
|
|
6583
|
+
"$tagName$": "ch-icon",
|
|
6584
|
+
"$members$": {
|
|
6585
|
+
"name": [1],
|
|
6586
|
+
"size": [1],
|
|
6587
|
+
"label": [1]
|
|
6588
|
+
},
|
|
6589
|
+
"$listeners$": undefined,
|
|
6590
|
+
"$lazyBundleId$": "-",
|
|
6591
|
+
"$attrsToReflect$": []
|
|
6592
|
+
}; }
|
|
6593
|
+
}
|
|
6594
|
+
|
|
6595
|
+
const chIconButtonCss = () => `:host{display:inline-block}.button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;border:var(--border-width) solid var(--border);border-radius:var(--radius-pill);background:transparent;color:var(--text);cursor:pointer;transition:background-color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default), color var(--duration-normal) var(--easing-default)}.button--sm{width:calc(var(--icon-size-sm) + 2 * var(--spacing-md));height:calc(var(--icon-size-sm) + 2 * var(--spacing-md))}.button--md{width:calc(var(--icon-size-md) + 2 * var(--spacing-xl));height:calc(var(--icon-size-md) + 2 * var(--spacing-xl))}.button--lg{width:calc(var(--icon-size-lg) + 2 * var(--spacing-2xl));height:calc(var(--icon-size-lg) + 2 * var(--spacing-2xl))}.button--sm .icon{width:var(--icon-size-sm);height:var(--icon-size-sm)}.button--md .icon{width:var(--icon-size-md);height:var(--icon-size-md)}.button--lg .icon{width:var(--icon-size-lg);height:var(--icon-size-lg)}.button:hover:not([aria-disabled='true']){border-color:var(--border-hover);background:var(--surface-hover)}.button:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.button[aria-disabled='true']{opacity:var(--opacity-disabled);cursor:not-allowed}.button[aria-busy='true']{cursor:progress}.button[aria-busy='true'] .icon{animation:ch-icon-button-spin var(--duration-spin) linear infinite}@keyframes ch-icon-button-spin{to{transform:rotate(360deg)}}@media (pointer: coarse){.button--sm{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.button{transition:none}.button[aria-busy='true'] .icon{animation:none}}`;
|
|
6596
|
+
|
|
6597
|
+
/**
|
|
6598
|
+
* A button whose only content is an icon.
|
|
6599
|
+
*
|
|
6600
|
+
* The label is required rather than optional. An icon-only button without an
|
|
6601
|
+
* accessible name is unusable by voice, screen reader or automation, and there
|
|
6602
|
+
* is no adjacent text to fall back on — the same reasoning as `ch-modal`, and
|
|
6603
|
+
* the reason this component exists instead of letting consumers bolt an icon
|
|
6604
|
+
* slot onto `ch-button` and forget the name.
|
|
6605
|
+
*/
|
|
6606
|
+
class ChIconButton {
|
|
6607
|
+
constructor(hostRef) {
|
|
6608
|
+
registerInstance(this, hostRef);
|
|
6609
|
+
this.chClick = createEvent(this, "chClick");
|
|
6610
|
+
}
|
|
6611
|
+
/** The glyph to draw. */
|
|
6612
|
+
name;
|
|
6613
|
+
/**
|
|
6614
|
+
* Accessible name, set as `aria-label`. Required: say what the button does
|
|
6615
|
+
* ("Eliminar producto"), not what the glyph is ("papelera").
|
|
6616
|
+
*/
|
|
6617
|
+
label;
|
|
6618
|
+
/** Visual size. `md` matches the height of a default `ch-button`. */
|
|
6619
|
+
size = 'md';
|
|
6620
|
+
/** Native button type, defaulting to `button` so it never submits a form by accident. */
|
|
6621
|
+
type = 'button';
|
|
6622
|
+
disabled = false;
|
|
6623
|
+
/**
|
|
6624
|
+
* Blocks pointer and keyboard activation and marks the button `aria-busy`
|
|
6625
|
+
* while keeping it focusable, so focus does not fall to `<body>` when an
|
|
6626
|
+
* action completes.
|
|
6627
|
+
*/
|
|
6628
|
+
loading = false;
|
|
6629
|
+
/** Emitted on click. A click while disabled or loading emits nothing. */
|
|
6630
|
+
chClick;
|
|
6631
|
+
handleClick = (event) => {
|
|
6632
|
+
if (this.disabled || this.loading) {
|
|
6633
|
+
event.preventDefault();
|
|
6634
|
+
event.stopImmediatePropagation();
|
|
6635
|
+
return;
|
|
6636
|
+
}
|
|
6637
|
+
this.chClick.emit(event);
|
|
6638
|
+
};
|
|
6639
|
+
render() {
|
|
6640
|
+
const shapes = this.name ? chIcons[this.name] : undefined;
|
|
6641
|
+
return (hAsync(Host, { key: '235a3813a30b5e98cc0b37774e0fe9cce680ac4c' }, hAsync("button", { key: 'e2d76ea663bb4746f1431affde538c2429033615', class: `button button--${this.size}`, type: this.type, "aria-label": this.label, "aria-busy": this.loading ? 'true' : undefined, "aria-disabled": this.disabled ? 'true' : undefined, onClick: this.handleClick }, hAsync("svg", { key: '3cbc2fc57cf274920dbb12fb7f0a6eed189e7b23', class: "icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", focusable: "false" }, (shapes ?? []).map(shape => hAsync(shape.tag, shape.attrs))))));
|
|
6642
|
+
}
|
|
6643
|
+
static get style() { return chIconButtonCss(); }
|
|
6644
|
+
static get cmpMeta() { return {
|
|
6645
|
+
"$flags$": 521,
|
|
6646
|
+
"$tagName$": "ch-icon-button",
|
|
6647
|
+
"$members$": {
|
|
6648
|
+
"name": [1],
|
|
6649
|
+
"label": [1],
|
|
6650
|
+
"size": [1],
|
|
6651
|
+
"type": [1],
|
|
6652
|
+
"disabled": [4],
|
|
6653
|
+
"loading": [4]
|
|
6654
|
+
},
|
|
6655
|
+
"$listeners$": undefined,
|
|
6656
|
+
"$lazyBundleId$": "-",
|
|
6657
|
+
"$attrsToReflect$": []
|
|
6658
|
+
}; }
|
|
6659
|
+
}
|
|
6660
|
+
|
|
6361
6661
|
const chInputCss = () => `: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)}.input{box-sizing:border-box;width:100%;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;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus,:host(:user-invalid) .input:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.input: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)}`;
|
|
6362
6662
|
|
|
6363
6663
|
let inputIds = 0;
|
|
@@ -6479,7 +6779,7 @@ class ChInput {
|
|
|
6479
6779
|
return undefined;
|
|
6480
6780
|
}
|
|
6481
6781
|
render() {
|
|
6482
|
-
return (hAsync(Host, { key: '
|
|
6782
|
+
return (hAsync(Host, { key: 'e0bbbb592d8c90897f48060f570606453c125ce5' }, this.label && (hAsync("label", { key: '2748fad40236a1ebe4acba6405c73f26e1284dd1', class: "label", htmlFor: this.inputId }, this.label)), hAsync("input", { key: 'b7c6ed3c9135ecaddde161a88077bd415900b465', 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 || this.formDisabled, 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: 'f87c7300a6cfca70770cd9eb05e5ba242698b3cf', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'e8ed5e8059e06d23c0e742de33c0a9b651e1ced4', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
6483
6783
|
}
|
|
6484
6784
|
static get formAssociated() { return true; }
|
|
6485
6785
|
static get watchers() { return {
|
|
@@ -6728,7 +7028,7 @@ class ChModal {
|
|
|
6728
7028
|
this.chClose.emit();
|
|
6729
7029
|
};
|
|
6730
7030
|
render() {
|
|
6731
|
-
return (hAsync(Host, { key: '
|
|
7031
|
+
return (hAsync(Host, { key: 'c50dad31f2b1897549837aed1d8e6df2df8cd491' }, hAsync("dialog", { key: '327f6ef27b447386c180248bbeab4cc3ee0160eb', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, hAsync("div", { key: 'c8c2f8eacf26c817073920bc2ef1c7ac89fe8208', class: "modal-head" }, hAsync("slot", { key: '73d0e3ae45c7936d345ce6f3262d9ce08058b9e7', name: "heading" }), this.closeLabel && (hAsync("button", { key: 'a72d04701cd9d60e6c1486f5c38f46f7f3ff1da5', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, hAsync("span", { key: '10d1b697611309e79f28dcad9385fa7e4300c916', "aria-hidden": "true" }, "\u00D7")))), hAsync("div", { key: '040029fdc7dc7544a15b51f3c0b7d855902b7028', class: "modal-body" }, hAsync("slot", { key: '00291b7d78f49dcf366c1780562893260be3dc74' })))));
|
|
6732
7032
|
}
|
|
6733
7033
|
static get watchers() { return {
|
|
6734
7034
|
"open": [{
|
|
@@ -6751,6 +7051,68 @@ class ChModal {
|
|
|
6751
7051
|
}; }
|
|
6752
7052
|
}
|
|
6753
7053
|
|
|
7054
|
+
const chPageHeaderCss = () => `:host{display:block}.header{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);padding-bottom:var(--spacing-2xl);border-bottom:var(--border-width) solid var(--border)}.header-text{display:flex;flex-direction:column;gap:var(--spacing-xs);flex:1 1 20rem;min-width:0}.header-eyebrow{margin:0;color:var(--text-secondary);font-family:var(--font-heading);font-size:var(--typography-size-xs);letter-spacing:var(--typography-tracking-badge);text-transform:uppercase}.header-title{margin:0;color:var(--text);font-family:var(--font-heading);font-size:var(--typography-size-xl);font-weight:var(--typography-weight-bold);line-height:1.2;overflow-wrap:anywhere}.header-description{margin:0;color:var(--text-secondary);font-size:var(--typography-size-sm);line-height:1.5;overflow-wrap:anywhere}.header-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--spacing-md);max-width:100%}.header-actions:empty{display:none}.header--stacked .header-actions{flex-basis:100%}@media (max-width: 30rem){.header{flex-direction:column}.header-actions{width:100%}}@media (forced-colors: active){.header{border-bottom-color:CanvasText}}`;
|
|
7055
|
+
|
|
7056
|
+
/**
|
|
7057
|
+
* The heading block at the top of a page: title, optional eyebrow and
|
|
7058
|
+
* description, and a trailing actions area.
|
|
7059
|
+
*
|
|
7060
|
+
* The title is a `title` prop rather than a slot so the heading level always
|
|
7061
|
+
* matches the page. A slotted heading lets a consumer nest a second `h1`, and
|
|
7062
|
+
* "one top-level heading per page" then depends on every caller remembering it;
|
|
7063
|
+
* here the level is explicit and defaults to `h1`. The actions wrap rather than
|
|
7064
|
+
* push the page sideways at 390px, and the DOM order keeps the heading before
|
|
7065
|
+
* the actions so reading and focus order still start with the title.
|
|
7066
|
+
*/
|
|
7067
|
+
class ChPageHeader {
|
|
7068
|
+
constructor(hostRef) {
|
|
7069
|
+
registerInstance(this, hostRef);
|
|
7070
|
+
}
|
|
7071
|
+
/**
|
|
7072
|
+
* The page title. Rendered as a real heading, so it also works as the
|
|
7073
|
+
* accessible name of the page region.
|
|
7074
|
+
*/
|
|
7075
|
+
title;
|
|
7076
|
+
/**
|
|
7077
|
+
* Heading element to render. Use `h2` (or `h3`) when the page already has a
|
|
7078
|
+
* higher-level heading above this block, so the document outline stays valid.
|
|
7079
|
+
*/
|
|
7080
|
+
headingLevel = 'h1';
|
|
7081
|
+
/**
|
|
7082
|
+
* Optional small label above the title, as slotted content. Use it for a
|
|
7083
|
+
* section or entity kind ("Proyecto", "Factura #1042"), not for the title.
|
|
7084
|
+
*/
|
|
7085
|
+
eyebrow;
|
|
7086
|
+
/**
|
|
7087
|
+
* Optional supporting line under the title.
|
|
7088
|
+
*/
|
|
7089
|
+
description;
|
|
7090
|
+
/**
|
|
7091
|
+
* Puts the actions below the title instead of beside it. Use it when the
|
|
7092
|
+
* actions are too wide to sit on the same row even after wrapping.
|
|
7093
|
+
*/
|
|
7094
|
+
actionsStacked = false;
|
|
7095
|
+
render() {
|
|
7096
|
+
const Heading = this.headingLevel;
|
|
7097
|
+
return (hAsync(Host, { key: '02317c9b8a8164400ac269cbfd872e066e3269e3' }, hAsync("div", { key: 'c1ab176079e95f4854826588405cd49c1bc42b58', class: { 'header': true, 'header--stacked': this.actionsStacked } }, hAsync("div", { key: '57553e0d8ac563dfd55bedb23fb6896f922c187c', class: "header-text" }, this.eyebrow && hAsync("p", { key: 'b38cbdfbc5a08cfddf60e9f82481df3ed8ad48e6', class: "header-eyebrow" }, this.eyebrow), hAsync(Heading, { key: '521003f555a4adaae81bac11a6410638db923399', class: "header-title" }, this.title), this.description && hAsync("p", { key: '0625bcd1903f52dfe16963bfc6d3ccf7e404d13a', class: "header-description" }, this.description)), hAsync("div", { key: '23b65e1729bfa24324c24958b946435ff247cb4d', class: "header-actions" }, hAsync("slot", { key: '45b4c24e4ce2bb4edc2929a2f17563260efb410f', name: "actions" })))));
|
|
7098
|
+
}
|
|
7099
|
+
static get style() { return chPageHeaderCss(); }
|
|
7100
|
+
static get cmpMeta() { return {
|
|
7101
|
+
"$flags$": 777,
|
|
7102
|
+
"$tagName$": "ch-page-header",
|
|
7103
|
+
"$members$": {
|
|
7104
|
+
"title": [1],
|
|
7105
|
+
"headingLevel": [1, "heading-level"],
|
|
7106
|
+
"eyebrow": [1],
|
|
7107
|
+
"description": [1],
|
|
7108
|
+
"actionsStacked": [4, "actions-stacked"]
|
|
7109
|
+
},
|
|
7110
|
+
"$listeners$": undefined,
|
|
7111
|
+
"$lazyBundleId$": "-",
|
|
7112
|
+
"$attrsToReflect$": []
|
|
7113
|
+
}; }
|
|
7114
|
+
}
|
|
7115
|
+
|
|
6754
7116
|
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)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus-visible,:host(:user-invalid) .input: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)}`;
|
|
6755
7117
|
|
|
6756
7118
|
let radioIds = 0;
|
|
@@ -6862,7 +7224,7 @@ class ChRadio {
|
|
|
6862
7224
|
}
|
|
6863
7225
|
render() {
|
|
6864
7226
|
const groupName = this.name || `${this.groupId}-group`;
|
|
6865
|
-
return (hAsync(Host, { key: '
|
|
7227
|
+
return (hAsync(Host, { key: '9803d5b41d3985503d1b304d53504239d2a2de1d' }, this.label && (hAsync("span", { key: 'f75cf217d50a300e5c6ddcdcfb9c5832e1f6b964', class: "group-label", id: this.labelId }, this.label)), hAsync("div", { key: 'd8e9e24e82dfb77f728e8d9c994102202a9ce85b', 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 || this.formDisabled || 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 || this.formDisabled || 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: '91bed0d5cd70a032de7b8ba6e298903b387e1a4a', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'a2e6d6c87d60e98ac3d396f7dde907ce1e46946a', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
6866
7228
|
}
|
|
6867
7229
|
static get formAssociated() { return true; }
|
|
6868
7230
|
static get watchers() { return {
|
|
@@ -7006,7 +7368,7 @@ class ChSegmentedControl {
|
|
|
7006
7368
|
}
|
|
7007
7369
|
render() {
|
|
7008
7370
|
const groupName = this.name || `${this.groupId}-group`;
|
|
7009
|
-
return (hAsync(Host, { key: '
|
|
7371
|
+
return (hAsync(Host, { key: 'd6a9a720a1a210c73711cff1f7cd6c1ffa0c89b2' }, this.label && (hAsync("span", { key: 'af5fb9ab87e918ac6047ebd6e65e540044c6a2d0', class: "group-label", id: this.labelId }, this.label)), hAsync("div", { key: '8dd76ea8d792d918ac5e413946e8a08cb89480c7', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (hAsync("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, hAsync("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), hAsync("span", { class: "label-text" }, option.label)))))));
|
|
7010
7372
|
}
|
|
7011
7373
|
static get formAssociated() { return true; }
|
|
7012
7374
|
static get watchers() { return {
|
|
@@ -7149,7 +7511,7 @@ class ChSelect {
|
|
|
7149
7511
|
return undefined;
|
|
7150
7512
|
}
|
|
7151
7513
|
render() {
|
|
7152
|
-
return (hAsync(Host, { key: '
|
|
7514
|
+
return (hAsync(Host, { key: 'b01c1dca70dbf88556521faa1be7430dc3d2355c' }, this.label && (hAsync("label", { key: '265a09b70dafca0c9330ceaec2477b6b203a71eb', class: "label", htmlFor: this.selectId }, this.label)), hAsync("select", { key: '43b387edff4fd326beac608fa16e50f3407e8cac', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (hAsync("option", { key: '456e5220d2fd6fdb2a2171d10bcd11c6d2c58956', 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: '7f4609f6441f9ce6c5f13b4a12875d85c110ccd8', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'e05a04a3f43ad055cd7cc57deb48f8b19d1a7084', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
7153
7515
|
}
|
|
7154
7516
|
static get formAssociated() { return true; }
|
|
7155
7517
|
static get watchers() { return {
|
|
@@ -7242,7 +7604,7 @@ class ChSkeleton {
|
|
|
7242
7604
|
return { width: this.width, height: this.height };
|
|
7243
7605
|
}
|
|
7244
7606
|
render() {
|
|
7245
|
-
return (hAsync(Host, { key: '
|
|
7607
|
+
return (hAsync(Host, { key: 'bbcafacc79f0288204028378f2cf460f793ca702', "aria-hidden": "true", class: { 'skeleton': true, [`skeleton--${this.shape}`]: true, 'skeleton--animated': this.animated } }, Array.from({ length: this.items }).map((value, index) => (hAsync("span", { class: "skeleton__item", style: this.sizeStyle, key: index, "data-index": String(value) })))));
|
|
7246
7608
|
}
|
|
7247
7609
|
static get style() { return chSkeletonCss(); }
|
|
7248
7610
|
static get cmpMeta() { return {
|
|
@@ -7290,7 +7652,7 @@ class ChSpinner {
|
|
|
7290
7652
|
label;
|
|
7291
7653
|
render() {
|
|
7292
7654
|
const labelled = Boolean(this.label);
|
|
7293
|
-
return (hAsync(Host, { key: '
|
|
7655
|
+
return (hAsync(Host, { key: '9e1cc36781db28cded8318f67158332168b0bbfc' }, hAsync("span", { key: '9c923d38545c0fceab0f244b4374708e2b7e2043', class: { spinner: true, [`spinner--${this.size}`]: true }, role: labelled ? 'status' : undefined, "aria-label": labelled ? this.label : undefined, "aria-hidden": labelled ? undefined : 'true' })));
|
|
7294
7656
|
}
|
|
7295
7657
|
static get style() { return chSpinnerCss(); }
|
|
7296
7658
|
static get cmpMeta() { return {
|
|
@@ -7336,7 +7698,7 @@ class ChStack {
|
|
|
7336
7698
|
return GAPS.has(this.gap) ? this.gap : 'md';
|
|
7337
7699
|
}
|
|
7338
7700
|
render() {
|
|
7339
|
-
return (hAsync(Host, { key: '
|
|
7701
|
+
return (hAsync(Host, { key: '646286c45adc0d816b0fdbcdfe9e70f809fedb95', class: { stack: true, [`stack--gap-${this.gapStep}`]: true, [`stack--align-${this.align}`]: true, [`stack--justify-${this.justify}`]: true } }, hAsync("slot", { key: '1c18713eb95fc568a08bcbd6e018add9336a0fd0' })));
|
|
7340
7702
|
}
|
|
7341
7703
|
static get style() { return chStackCss(); }
|
|
7342
7704
|
static get cmpMeta() { return {
|
|
@@ -7461,7 +7823,7 @@ class ChSwitch {
|
|
|
7461
7823
|
return undefined;
|
|
7462
7824
|
}
|
|
7463
7825
|
render() {
|
|
7464
|
-
return (hAsync(Host, { key: '
|
|
7826
|
+
return (hAsync(Host, { key: '7c862590fa8ce9c53d168cb670361259405c72bb' }, hAsync("label", { key: 'e5602d4daa8ebf1a9832282fffb9e538fc1592a8', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.switchId }, hAsync("input", { key: 'd29c00496c4a05ccbe66ffdbebf3a496c5ae6995', 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 || this.formDisabled, 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: '5739a0b689ac7ed9ebc917e6102b3951e80ac06d', class: "track" }, hAsync("span", { key: 'e10c21f740092750dd9bb00cde84fa1c26746eb9', class: "thumb" })), this.label && hAsync("span", { key: 'bec86897b1ef0023d3eb8c8438bf6740f32a5921', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '2568bcf74334e5f081df8efa9a1196c69cb3093d', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '319d5583cf10e329f05430a577d2f1f956ac8dd5', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
7465
7827
|
}
|
|
7466
7828
|
static get formAssociated() { return true; }
|
|
7467
7829
|
static get watchers() { return {
|
|
@@ -7584,7 +7946,7 @@ class ChTabs {
|
|
|
7584
7946
|
}
|
|
7585
7947
|
render() {
|
|
7586
7948
|
const active = this.activeValue;
|
|
7587
|
-
return (hAsync(Host, { key: '
|
|
7949
|
+
return (hAsync(Host, { key: '915c7a584397bbe10a72642a1ce5ed68f2264ed2' }, hAsync("div", { key: 'b37a294722442c73d224410793cd0c098734993f', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
|
|
7588
7950
|
const selected = tab.value === active;
|
|
7589
7951
|
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));
|
|
7590
7952
|
})), 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}` }))))));
|
|
@@ -7726,7 +8088,7 @@ class ChTextarea {
|
|
|
7726
8088
|
return undefined;
|
|
7727
8089
|
}
|
|
7728
8090
|
render() {
|
|
7729
|
-
return (hAsync(Host, { key: '
|
|
8091
|
+
return (hAsync(Host, { key: '5e7f4e6c779b677f259b56ebf6cb2e829511275e' }, this.label && (hAsync("label", { key: '73a3a3d44b4926aaf0681aa68f878932c7932dae', class: "label", htmlFor: this.textareaId }, this.label)), hAsync("textarea", { key: '10edc56d4846b578bd11c7bd001e7ca47aa1838d', 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 || this.formDisabled, 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: '393ea00da6e7def75d4305c242a9cf957013359b', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'ba405aec9d92b410e063cec29235240a4a4ec715', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
7730
8092
|
}
|
|
7731
8093
|
static get formAssociated() { return true; }
|
|
7732
8094
|
static get watchers() { return {
|
|
@@ -7766,9 +8128,112 @@ class ChTextarea {
|
|
|
7766
8128
|
}; }
|
|
7767
8129
|
}
|
|
7768
8130
|
|
|
7769
|
-
const
|
|
8131
|
+
const OPPOSITE = {
|
|
8132
|
+
top: 'bottom',
|
|
8133
|
+
bottom: 'top',
|
|
8134
|
+
left: 'right',
|
|
8135
|
+
right: 'left',
|
|
8136
|
+
};
|
|
8137
|
+
const AXIS = {
|
|
8138
|
+
top: 'vertical',
|
|
8139
|
+
bottom: 'vertical',
|
|
8140
|
+
left: 'horizontal',
|
|
8141
|
+
right: 'horizontal',
|
|
8142
|
+
};
|
|
8143
|
+
/**
|
|
8144
|
+
* How far a placed surface overflows each viewport edge. Positive values are
|
|
8145
|
+
* overflow. Used both to pick a placement and to shift the surface back in.
|
|
8146
|
+
*/
|
|
8147
|
+
function overflowOf(surface, viewport) {
|
|
8148
|
+
return {
|
|
8149
|
+
top: viewport.top - surface.top,
|
|
8150
|
+
left: viewport.left - surface.left,
|
|
8151
|
+
bottom: surface.top + surface.height - (viewport.top + viewport.height),
|
|
8152
|
+
right: surface.left + surface.width - (viewport.left + viewport.width),
|
|
8153
|
+
};
|
|
8154
|
+
}
|
|
8155
|
+
function offsetFor(placement, anchor, surface, gap) {
|
|
8156
|
+
switch (placement) {
|
|
8157
|
+
case 'top':
|
|
8158
|
+
return {
|
|
8159
|
+
top: anchor.top - surface.height - gap,
|
|
8160
|
+
left: anchor.left + (anchor.width - surface.width) / 2,
|
|
8161
|
+
};
|
|
8162
|
+
case 'bottom':
|
|
8163
|
+
return {
|
|
8164
|
+
top: anchor.top + anchor.height + gap,
|
|
8165
|
+
left: anchor.left + (anchor.width - surface.width) / 2,
|
|
8166
|
+
};
|
|
8167
|
+
case 'left':
|
|
8168
|
+
return {
|
|
8169
|
+
top: anchor.top + (anchor.height - surface.height) / 2,
|
|
8170
|
+
left: anchor.left - surface.width - gap,
|
|
8171
|
+
};
|
|
8172
|
+
case 'right':
|
|
8173
|
+
return {
|
|
8174
|
+
top: anchor.top + (anchor.height - surface.height) / 2,
|
|
8175
|
+
left: anchor.left + anchor.width + gap,
|
|
8176
|
+
};
|
|
8177
|
+
}
|
|
8178
|
+
}
|
|
8179
|
+
/**
|
|
8180
|
+
* Picks the placement that overflows least and then shifts the surface along
|
|
8181
|
+
* the cross axis so it stays inside the viewport.
|
|
8182
|
+
*
|
|
8183
|
+
* The main-axis overflow is not compensated with a translate: a tooltip pinned
|
|
8184
|
+
* to the top edge would cover its own trigger. Flipping to the other side is
|
|
8185
|
+
* what keeps it readable, and the caller decides whether to accept the
|
|
8186
|
+
* remaining overflow.
|
|
8187
|
+
*/
|
|
8188
|
+
function placeOverlay({ anchor, surface, viewport, preferred, gap, }) {
|
|
8189
|
+
const candidates = [preferred, OPPOSITE[preferred]];
|
|
8190
|
+
let placement = preferred;
|
|
8191
|
+
let best = Number.POSITIVE_INFINITY;
|
|
8192
|
+
for (const candidate of candidates) {
|
|
8193
|
+
const { top, left } = offsetFor(candidate, anchor, surface, gap);
|
|
8194
|
+
const rect = { top, left, width: surface.width, height: surface.height };
|
|
8195
|
+
const overflow = overflowOf(rect, viewport);
|
|
8196
|
+
const main = AXIS[candidate] === 'vertical' ? clamp(overflow.top) + clamp(overflow.bottom) : clamp(overflow.left) + clamp(overflow.right);
|
|
8197
|
+
if (main < best) {
|
|
8198
|
+
best = main;
|
|
8199
|
+
placement = candidate;
|
|
8200
|
+
}
|
|
8201
|
+
}
|
|
8202
|
+
const { top, left } = offsetFor(placement, anchor, surface, gap);
|
|
8203
|
+
const rect = { top, left, width: surface.width, height: surface.height };
|
|
8204
|
+
const overflow = overflowOf(rect, viewport);
|
|
8205
|
+
const shifted = AXIS[placement] === 'vertical' ? { top, left: left + correction(overflow.left, overflow.right) } : { top: top + correction(overflow.top, overflow.bottom), left };
|
|
8206
|
+
return { placement, top: shifted.top, left: shifted.left };
|
|
8207
|
+
}
|
|
8208
|
+
/** Only real overflow counts: the side that fits contributes nothing. */
|
|
8209
|
+
function clamp(overflow) {
|
|
8210
|
+
return overflow > 0 ? overflow : 0;
|
|
8211
|
+
}
|
|
8212
|
+
/**
|
|
8213
|
+
* Turns the two overflows on an axis into a shift. `before` is the overflow on
|
|
8214
|
+
* the leading edge (top or left), `after` the one on the trailing edge; both
|
|
8215
|
+
* are positive when the surface spills past that edge.
|
|
8216
|
+
*
|
|
8217
|
+
* Pushing away from the leading edge moves the surface inwards, so the shift is
|
|
8218
|
+
* `+before`. The trailing edge needs the opposite sign. When both overflow the
|
|
8219
|
+
* surface is larger than the viewport: pin it to the leading edge and let
|
|
8220
|
+
* `max-width` stop the spill.
|
|
8221
|
+
*/
|
|
8222
|
+
function correction(before, after) {
|
|
8223
|
+
if (before > 0) {
|
|
8224
|
+
return before;
|
|
8225
|
+
}
|
|
8226
|
+
if (after > 0) {
|
|
8227
|
+
return -after;
|
|
8228
|
+
}
|
|
8229
|
+
return 0;
|
|
8230
|
+
}
|
|
8231
|
+
|
|
8232
|
+
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:min(16rem, calc(100vw - 2 * var(--spacing-2xl)));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--positioned{position:fixed;top:var(--ch-tooltip-offset-top);left:var(--ch-tooltip-offset-left);transform:none;margin:0}.bubble--top{bottom:100%;left:50%;transform:translateX(-50%);margin-bottom:var(--spacing-md)}.bubble.bubble--positioned.bubble--top,.bubble.bubble--positioned.bubble--bottom,.bubble.bubble--positioned.bubble--left,.bubble.bubble--positioned.bubble--right{inset:auto;top:var(--ch-tooltip-offset-top);left:var(--ch-tooltip-offset-left);right:auto;bottom:auto;transform:none;margin:0}.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}}`;
|
|
7770
8233
|
|
|
7771
8234
|
let tooltipIds = 0;
|
|
8235
|
+
/** Space between the trigger and the bubble, matching `--spacing-md`. */
|
|
8236
|
+
const GAP = 8;
|
|
7772
8237
|
/**
|
|
7773
8238
|
* Short help text shown on hover and on focus.
|
|
7774
8239
|
*
|
|
@@ -7784,6 +8249,13 @@ let tooltipIds = 0;
|
|
|
7784
8249
|
* `<input>`). A chucao component such as `ch-button` will not be described,
|
|
7785
8250
|
* because `aria-*` set on a custom element host does not reach the native
|
|
7786
8251
|
* element inside it — see the discussion in issue #47.
|
|
8252
|
+
*
|
|
8253
|
+
* Positioning is measured, not purely CSS: `placement` is the preferred side,
|
|
8254
|
+
* and the bubble flips to the opposite side when the preferred one does not
|
|
8255
|
+
* fit, then shifts along the other axis to stay inside the viewport. It
|
|
8256
|
+
* re-measures on scroll, resize and visual-viewport changes, which is what
|
|
8257
|
+
* keeps it correct inside a scrolling modal or drawer and when a mobile
|
|
8258
|
+
* keyboard shrinks the visible area.
|
|
7787
8259
|
*/
|
|
7788
8260
|
class ChTooltip {
|
|
7789
8261
|
constructor(hostRef) {
|
|
@@ -7791,8 +8263,11 @@ class ChTooltip {
|
|
|
7791
8263
|
}
|
|
7792
8264
|
get el() { return getElement(this); }
|
|
7793
8265
|
fallbackId = `ch-tooltip-${++tooltipIds}`;
|
|
8266
|
+
bubbleEl;
|
|
8267
|
+
cleanup;
|
|
7794
8268
|
/**
|
|
7795
|
-
*
|
|
8269
|
+
* The side the bubble is placed on. It is a preference: when that side has no
|
|
8270
|
+
* room the bubble flips to the opposite one.
|
|
7796
8271
|
*/
|
|
7797
8272
|
placement = 'top';
|
|
7798
8273
|
// Hover and focus are tracked apart so that neither cancels the other: a
|
|
@@ -7801,15 +8276,26 @@ class ChTooltip {
|
|
|
7801
8276
|
hovered = false;
|
|
7802
8277
|
focused = false;
|
|
7803
8278
|
dismissed = false;
|
|
8279
|
+
/** The placement actually used, which may differ from the prop after a flip. */
|
|
8280
|
+
resolvedPlacement;
|
|
8281
|
+
/** Offset applied to the bubble once it has been measured. */
|
|
8282
|
+
offset;
|
|
7804
8283
|
get visible() {
|
|
7805
8284
|
return (this.hovered || this.focused) && !this.dismissed;
|
|
7806
8285
|
}
|
|
7807
8286
|
componentDidLoad() {
|
|
7808
8287
|
this.associate();
|
|
7809
8288
|
}
|
|
8289
|
+
connectedCallback() {
|
|
8290
|
+
this.watchViewport();
|
|
8291
|
+
}
|
|
8292
|
+
disconnectedCallback() {
|
|
8293
|
+
this.cleanup?.();
|
|
8294
|
+
}
|
|
7810
8295
|
handleMouseEnter() {
|
|
7811
8296
|
this.hovered = true;
|
|
7812
8297
|
this.dismissed = false;
|
|
8298
|
+
this.position();
|
|
7813
8299
|
}
|
|
7814
8300
|
handleMouseLeave() {
|
|
7815
8301
|
this.hovered = false;
|
|
@@ -7817,6 +8303,7 @@ class ChTooltip {
|
|
|
7817
8303
|
handleFocusIn() {
|
|
7818
8304
|
this.focused = true;
|
|
7819
8305
|
this.dismissed = false;
|
|
8306
|
+
this.position();
|
|
7820
8307
|
}
|
|
7821
8308
|
handleFocusOut() {
|
|
7822
8309
|
this.focused = false;
|
|
@@ -7824,15 +8311,78 @@ class ChTooltip {
|
|
|
7824
8311
|
/**
|
|
7825
8312
|
* Listens on the document because a tooltip opened by hovering leaves focus
|
|
7826
8313
|
* wherever it was, so a host-scoped handler would never see the key.
|
|
8314
|
+
*
|
|
8315
|
+
* Only the outermost Escape handler is stopped from propagating, so a
|
|
8316
|
+
* tooltip inside an open modal closes itself and leaves the modal open.
|
|
7827
8317
|
*/
|
|
7828
8318
|
handleKeyDown(event) {
|
|
7829
|
-
if (event.key === 'Escape' && this.visible) {
|
|
8319
|
+
if (event.key === 'Escape' && this.visible && !event.defaultPrevented) {
|
|
8320
|
+
event.preventDefault();
|
|
7830
8321
|
this.dismissed = true;
|
|
7831
8322
|
}
|
|
7832
8323
|
}
|
|
8324
|
+
/** Cheap guard so scroll frames do not measure while nothing is shown. */
|
|
8325
|
+
handleScroll() {
|
|
8326
|
+
if (this.visible && this.offset) {
|
|
8327
|
+
this.position();
|
|
8328
|
+
}
|
|
8329
|
+
}
|
|
8330
|
+
handleResize() {
|
|
8331
|
+
this.position();
|
|
8332
|
+
}
|
|
8333
|
+
watchViewport() {
|
|
8334
|
+
if (typeof window === 'undefined') {
|
|
8335
|
+
return;
|
|
8336
|
+
}
|
|
8337
|
+
const viewport = window.visualViewport;
|
|
8338
|
+
if (!viewport || this.cleanup) {
|
|
8339
|
+
return;
|
|
8340
|
+
}
|
|
8341
|
+
const update = () => this.position();
|
|
8342
|
+
viewport.addEventListener('resize', update);
|
|
8343
|
+
viewport.addEventListener('scroll', update);
|
|
8344
|
+
this.cleanup = () => {
|
|
8345
|
+
viewport.removeEventListener('resize', update);
|
|
8346
|
+
viewport.removeEventListener('scroll', update);
|
|
8347
|
+
};
|
|
8348
|
+
}
|
|
7833
8349
|
slotted(name) {
|
|
7834
8350
|
return Array.from(this.el.children).find(child => child.getAttribute('slot') === name);
|
|
7835
8351
|
}
|
|
8352
|
+
/**
|
|
8353
|
+
* Measures the anchor and the bubble and stores the offset that keeps the
|
|
8354
|
+
* bubble inside the viewport. Nothing is measured before the bubble has a
|
|
8355
|
+
* box to measure, so the pre-paint render uses plain CSS.
|
|
8356
|
+
*/
|
|
8357
|
+
position() {
|
|
8358
|
+
if (typeof window === 'undefined') {
|
|
8359
|
+
return;
|
|
8360
|
+
}
|
|
8361
|
+
const bubble = this.bubbleEl ?? (this.bubbleEl = this.el.shadowRoot?.querySelector('.bubble') ?? undefined);
|
|
8362
|
+
if (!bubble || bubble.offsetWidth === 0) {
|
|
8363
|
+
return;
|
|
8364
|
+
}
|
|
8365
|
+
const anchorRect = this.slotted('trigger')?.getBoundingClientRect?.();
|
|
8366
|
+
if (!anchorRect) {
|
|
8367
|
+
return;
|
|
8368
|
+
}
|
|
8369
|
+
const surface = {
|
|
8370
|
+
width: bubble.offsetWidth + horizontalMargin(bubble),
|
|
8371
|
+
height: bubble.offsetHeight,
|
|
8372
|
+
};
|
|
8373
|
+
const viewport = window.visualViewport;
|
|
8374
|
+
const { placement, top, left } = placeOverlay({
|
|
8375
|
+
anchor: { top: anchorRect.top, left: anchorRect.left, width: anchorRect.width, height: anchorRect.height },
|
|
8376
|
+
surface,
|
|
8377
|
+
viewport: viewport
|
|
8378
|
+
? { top: viewport.offsetTop, left: viewport.offsetLeft, width: viewport.width, height: viewport.height }
|
|
8379
|
+
: { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight },
|
|
8380
|
+
preferred: this.placement,
|
|
8381
|
+
gap: GAP,
|
|
8382
|
+
});
|
|
8383
|
+
this.resolvedPlacement = placement;
|
|
8384
|
+
this.offset = { top, left };
|
|
8385
|
+
}
|
|
7836
8386
|
/**
|
|
7837
8387
|
* Points the trigger at the text with `aria-describedby`. Re-run on
|
|
7838
8388
|
* `slotchange` because a framework re-render can replace the slotted nodes
|
|
@@ -7851,7 +8401,16 @@ class ChTooltip {
|
|
|
7851
8401
|
trigger.setAttribute('aria-describedby', content.id);
|
|
7852
8402
|
};
|
|
7853
8403
|
render() {
|
|
7854
|
-
|
|
8404
|
+
const { offset } = this;
|
|
8405
|
+
return (hAsync(Host, { key: 'fb651dc0bf007fb86c9f69b2c714106520df4d4a' }, hAsync("span", { key: '74324b8e4c0b7c552255605c6aa4ae739e16d832', class: "anchor" }, hAsync("slot", { key: 'd4c2025af2d96b2ea4e7d8d601ce803be82a4a3e', name: "trigger", onSlotchange: this.associate }), hAsync("span", { key: 'f6561dce022d8d9d2d0fb2b6984591301483b1f3', ref: el => (this.bubbleEl = el), style: {
|
|
8406
|
+
'--ch-tooltip-offset-top': offset ? `${offset.top}px` : null,
|
|
8407
|
+
'--ch-tooltip-offset-left': offset ? `${offset.left}px` : null,
|
|
8408
|
+
}, class: {
|
|
8409
|
+
'bubble': true,
|
|
8410
|
+
'bubble--positioned': Boolean(this.offset),
|
|
8411
|
+
[`bubble--${this.resolvedPlacement ?? this.placement}`]: true,
|
|
8412
|
+
'bubble--visible': this.visible,
|
|
8413
|
+
} }, hAsync("slot", { key: 'a099d15660ea17211b4c50912842b3152e5f652c', name: "content", onSlotchange: this.associate })))));
|
|
7855
8414
|
}
|
|
7856
8415
|
static get style() { return chTooltipCss(); }
|
|
7857
8416
|
static get cmpMeta() { return {
|
|
@@ -7861,13 +8420,18 @@ class ChTooltip {
|
|
|
7861
8420
|
"placement": [1],
|
|
7862
8421
|
"hovered": [32],
|
|
7863
8422
|
"focused": [32],
|
|
7864
|
-
"dismissed": [32]
|
|
8423
|
+
"dismissed": [32],
|
|
8424
|
+
"resolvedPlacement": [32]
|
|
7865
8425
|
},
|
|
7866
|
-
"$listeners$": [[1, "mouseenter", "handleMouseEnter"], [1, "mouseleave", "handleMouseLeave"], [0, "focusin", "handleFocusIn"], [0, "focusout", "handleFocusOut"], [4, "keydown", "handleKeyDown"]],
|
|
8426
|
+
"$listeners$": [[1, "mouseenter", "handleMouseEnter"], [1, "mouseleave", "handleMouseLeave"], [0, "focusin", "handleFocusIn"], [0, "focusout", "handleFocusOut"], [4, "keydown", "handleKeyDown"], [11, "scroll", "handleScroll"], [9, "resize", "handleResize"]],
|
|
7867
8427
|
"$lazyBundleId$": "-",
|
|
7868
8428
|
"$attrsToReflect$": []
|
|
7869
8429
|
}; }
|
|
7870
8430
|
}
|
|
8431
|
+
function horizontalMargin(el) {
|
|
8432
|
+
const style = getComputedStyle(el);
|
|
8433
|
+
return (parseFloat(style.marginLeft) || 0) + (parseFloat(style.marginRight) || 0);
|
|
8434
|
+
}
|
|
7871
8435
|
|
|
7872
8436
|
registerComponents([
|
|
7873
8437
|
ChAccordion,
|
|
@@ -7882,9 +8446,12 @@ registerComponents([
|
|
|
7882
8446
|
ChEmoji,
|
|
7883
8447
|
ChEmptyState,
|
|
7884
8448
|
ChGrid,
|
|
8449
|
+
ChIcon,
|
|
8450
|
+
ChIconButton,
|
|
7885
8451
|
ChInput,
|
|
7886
8452
|
ChLink,
|
|
7887
8453
|
ChModal,
|
|
8454
|
+
ChPageHeader,
|
|
7888
8455
|
ChRadio,
|
|
7889
8456
|
ChSegmentedControl,
|
|
7890
8457
|
ChSelect,
|