@esri/calcite-components 5.1.0-next.8 → 5.1.0-next.9
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/dist/cdn/{YCTMZBN3.js → 24BVOJIY.js} +1 -1
- package/dist/cdn/{AQRFO7EB.js → 34EJXQYF.js} +1 -1
- package/dist/cdn/{LS6DCTIG.js → 3GXLGKZV.js} +1 -1
- package/dist/cdn/{OHI6NELF.js → 3IHT5FIP.js} +1 -1
- package/dist/cdn/{IMFR5NEO.js → 3O7NXGXJ.js} +1 -1
- package/dist/cdn/{TRQXVBXU.js → 43FMFYKZ.js} +1 -1
- package/dist/cdn/{H764MK3H.js → 43SP7K3P.js} +1 -1
- package/dist/cdn/{GOV5YXBE.js → 45Z5R6GR.js} +1 -1
- package/dist/cdn/{G3LIWIPW.js → 47RTCYTX.js} +1 -1
- package/dist/cdn/{L36EVTCL.js → 4AQ3DQDN.js} +1 -1
- package/dist/cdn/{OGR5ARIW.js → 4DJKUEBQ.js} +1 -1
- package/dist/cdn/4IBKGKIH.js +2 -0
- package/dist/cdn/{G5PEBD22.js → 4JVVYRDW.js} +1 -1
- package/dist/cdn/{ISXEEXKP.js → 4U633XVG.js} +1 -1
- package/dist/cdn/{OXIEI7FU.js → 55GOZN42.js} +1 -1
- package/dist/cdn/{AKHHJLNI.js → 575ZYV35.js} +1 -1
- package/dist/cdn/{VZBGQAPM.js → 5LUEFKD3.js} +1 -1
- package/dist/cdn/{24AJZ7NF.js → 5RDU2ZNH.js} +1 -1
- package/dist/cdn/{Z5H3SBF4.js → 5TJGOI64.js} +1 -1
- package/dist/cdn/{CZLSVHDA.js → 67QHQNZF.js} +1 -1
- package/dist/cdn/{O64Y2APR.js → 6C76CPWO.js} +1 -1
- package/dist/cdn/{222PZZVE.js → 6LA4PLL2.js} +1 -1
- package/dist/cdn/{NKB7CA3Y.js → 6OKASMD7.js} +1 -1
- package/dist/cdn/{OI35UHBC.js → 7ECYZZBW.js} +1 -1
- package/dist/cdn/{SJMZTW3M.js → 7JGWCRII.js} +1 -1
- package/dist/cdn/{XWSZOGW5.js → 7XBTO6NQ.js} +1 -1
- package/dist/cdn/{EXQURJYX.js → A6XPQQWN.js} +1 -1
- package/dist/cdn/{PXNLTA7Q.js → ANQRSTGE.js} +1 -1
- package/dist/cdn/{7PY56QMA.js → AS2M2ZWD.js} +1 -1
- package/dist/cdn/{6LSU4JVT.js → BAMCFG7H.js} +1 -1
- package/dist/cdn/{YCAYW3ES.js → BDQCESE7.js} +1 -1
- package/dist/cdn/{47YWJRMK.js → BG7CCT2Q.js} +1 -1
- package/dist/cdn/{WGLBPXGA.js → BMRN6G4T.js} +1 -1
- package/dist/cdn/{OI5C3DZQ.js → BPIG37CO.js} +1 -1
- package/dist/cdn/{2MVB66KM.js → BZGE52YU.js} +1 -1
- package/dist/cdn/{EBTV6BQC.js → C25ETLQX.js} +1 -1
- package/dist/cdn/{FA4JJMDD.js → CKMZY3H7.js} +1 -1
- package/dist/cdn/{T2ZN7HPU.js → CMVTCAFL.js} +1 -1
- package/dist/cdn/{FHTREWRA.js → CNR7IJIS.js} +1 -1
- package/dist/cdn/{6UI3PKF5.js → CSOE3CJR.js} +1 -1
- package/dist/cdn/{I7TFCBQO.js → DRQCOAQ4.js} +1 -1
- package/dist/cdn/{BLZ5Z3L3.js → DTUD5FAT.js} +1 -1
- package/dist/cdn/{7J54SLPG.js → DYBHFMG7.js} +1 -1
- package/dist/cdn/{N4R7WBTP.js → E6EGKXUX.js} +1 -1
- package/dist/cdn/{M7DW3FTJ.js → EB4M47KA.js} +1 -1
- package/dist/cdn/{DOWM2T5Z.js → EIXE62NK.js} +1 -1
- package/dist/cdn/{HFAM5MEC.js → EQZPTVS3.js} +1 -1
- package/dist/cdn/{ZQO6FYUW.js → ESATITDD.js} +1 -1
- package/dist/cdn/{OZVZ5LCR.js → ETIO6SPJ.js} +1 -1
- package/dist/cdn/EY7FPNVS.js +2 -0
- package/dist/cdn/{XHL646A2.js → FIEDEHAP.js} +1 -1
- package/dist/cdn/{P76VFMZV.js → FZ6ZUHKQ.js} +1 -1
- package/dist/cdn/{LESJQSHY.js → GGGN54CY.js} +1 -1
- package/dist/cdn/{DML4UYSR.js → GH34TDLL.js} +1 -1
- package/dist/cdn/{2KWDJDMW.js → HG2EYXWI.js} +1 -1
- package/dist/cdn/{7SJGHMRM.js → HQDFIE2B.js} +1 -1
- package/dist/cdn/{R7ZYHFUG.js → HZGU4N3I.js} +1 -1
- package/dist/cdn/{4KMSHV4T.js → I5G3H4D4.js} +1 -1
- package/dist/cdn/{C6PZ6UXS.js → I7BWPAOF.js} +1 -1
- package/dist/cdn/{XMUU3UTU.js → IBQYZCFQ.js} +1 -1
- package/dist/cdn/{FP7RUVVK.js → IJ7V345Q.js} +1 -1
- package/dist/cdn/{FE36XWQT.js → IQ4VNR4Q.js} +1 -1
- package/dist/cdn/{LWQNBQLX.js → IWG7JAQJ.js} +1 -1
- package/dist/cdn/{MMKBWG37.js → IZLDBAPA.js} +1 -1
- package/dist/cdn/{T72X6C55.js → J2OGE3DI.js} +1 -1
- package/dist/cdn/{V6KMTSY3.js → JPWQ44GC.js} +1 -1
- package/dist/cdn/{I3AH3MF6.js → JRF656V5.js} +1 -1
- package/dist/cdn/{VSGEBKJL.js → JRWW665Q.js} +1 -1
- package/dist/cdn/{WVFJMOTI.js → JVAE3MLA.js} +1 -1
- package/dist/cdn/{CFOEAERZ.js → K2H2TINH.js} +1 -1
- package/dist/cdn/{BH25NEU3.js → KDZRPYFR.js} +1 -1
- package/dist/cdn/{YWGODKAA.js → KHIMNKVO.js} +1 -1
- package/dist/cdn/{7Q6OKLFD.js → KMOFSKZF.js} +1 -1
- package/dist/cdn/{YJRANKFJ.js → KQNOWW4C.js} +1 -1
- package/dist/cdn/{KB33IA7A.js → KYKC2CK2.js} +1 -1
- package/dist/cdn/{H6GZBNAP.js → L24DVRWE.js} +1 -1
- package/dist/cdn/{6LVCAJSU.js → L5LBH4FP.js} +1 -1
- package/dist/cdn/{KONOZFYK.js → LKRLVAVK.js} +1 -1
- package/dist/cdn/{SZBL6UYR.js → LQD663MA.js} +1 -1
- package/dist/cdn/{BYFOQ5L7.js → M6MHKAA5.js} +1 -1
- package/dist/cdn/MMEADS6E.js +2 -0
- package/dist/cdn/{ZNRHT3KC.js → MVA4NE6I.js} +1 -1
- package/dist/cdn/{2G4JQYU3.js → NGXAYCAR.js} +1 -1
- package/dist/cdn/{7BCKEAN4.js → NJRKH5Q7.js} +1 -1
- package/dist/cdn/{4OYHP3ZM.js → NVHH3XZJ.js} +1 -1
- package/dist/cdn/{RLE4LAGP.js → NVSO6GLT.js} +1 -1
- package/dist/cdn/{FEK3PIOE.js → NY7A5LKZ.js} +1 -1
- package/dist/cdn/{H5CLLKA7.js → O7BFREIB.js} +1 -1
- package/dist/cdn/{MIZ37SIW.js → OLYLT2L5.js} +1 -1
- package/dist/cdn/{NRP3ANIH.js → OPHJLVOH.js} +1 -1
- package/dist/cdn/{ZTRVZ3XB.js → OQ2UCUQP.js} +1 -1
- package/dist/cdn/{2MN63CPE.js → OXCJDMGQ.js} +1 -1
- package/dist/cdn/{QKC2XFP5.js → P4JFMLKY.js} +1 -1
- package/dist/cdn/{W26FRFX7.js → PCTQTX5N.js} +1 -1
- package/dist/cdn/{CW3BSFXN.js → PFKFYB45.js} +1 -1
- package/dist/cdn/{3KDUSL55.js → PHGT3YNE.js} +1 -1
- package/dist/cdn/{BWVI7Y36.js → PIU3YYLU.js} +1 -1
- package/dist/cdn/{YOWRCPCO.js → QCDS2TXE.js} +1 -1
- package/dist/cdn/{YCIXRDI4.js → QR4JRFEP.js} +1 -1
- package/dist/cdn/{YRXMN6UU.js → QULVDSNJ.js} +1 -1
- package/dist/cdn/{V6PUXCHJ.js → QWALXRY6.js} +1 -1
- package/dist/cdn/{YDUAJXOW.js → RCUNETDY.js} +1 -1
- package/dist/cdn/{B6PZTEUN.js → RPT5BJMD.js} +1 -1
- package/dist/cdn/{4C3MDIBF.js → S7XHDLIF.js} +1 -1
- package/dist/cdn/{7MOAOZLZ.js → SAQAAU52.js} +1 -1
- package/dist/cdn/{2IVE7ZEH.js → SG24GAXY.js} +1 -1
- package/dist/cdn/{UW5IDOUT.js → SHD6TE4R.js} +1 -1
- package/dist/cdn/{6WOFQ5YL.js → SIMNCT4V.js} +1 -1
- package/dist/cdn/{OOITRFLJ.js → SJSCENKK.js} +1 -1
- package/dist/cdn/{UWFSTP6H.js → SLVFP6JA.js} +1 -1
- package/dist/cdn/{A5U47A46.js → TKH5LW5O.js} +1 -1
- package/dist/cdn/{2HAZSBOB.js → TMOOTRK4.js} +1 -1
- package/dist/cdn/{ZWUAND2V.js → TTFCVVON.js} +1 -1
- package/dist/cdn/{VAIV6TN5.js → TXRFE5GH.js} +1 -1
- package/dist/cdn/{6UFBJC4N.js → TXYWJHYI.js} +1 -1
- package/dist/cdn/{DY2ED436.js → U4MTAQRM.js} +1 -1
- package/dist/cdn/UHQ454NG.js +2 -0
- package/dist/cdn/{QLMMEMXZ.js → UKC7JB7P.js} +1 -1
- package/dist/cdn/{UW2OIFN6.js → UTQKB5CS.js} +1 -1
- package/dist/cdn/{SDD3P4XX.js → V2EVNXUV.js} +1 -1
- package/dist/cdn/{EDTUYGTH.js → VOTW2RMD.js} +1 -1
- package/dist/cdn/{X7WG3NQR.js → VQHTMUYJ.js} +1 -1
- package/dist/cdn/{VS2M3PA6.js → WBJUAZ65.js} +1 -1
- package/dist/cdn/{N6UQ2IN3.js → WEAILY72.js} +1 -1
- package/dist/cdn/{M5HMGRI3.js → WITGQRKF.js} +1 -1
- package/dist/cdn/{GBD3L2UH.js → WM4NZNNA.js} +1 -1
- package/dist/cdn/{QZKM3D6F.js → XJZLGVT6.js} +1 -1
- package/dist/cdn/{PWPVALIF.js → XUSE3II4.js} +1 -1
- package/dist/cdn/{FZIKVG4Q.js → XW3UC4FN.js} +1 -1
- package/dist/cdn/{WDKSZZPO.js → YANXY6FO.js} +1 -1
- package/dist/cdn/{PUV74SQM.js → YJHXVSEP.js} +1 -1
- package/dist/cdn/{ITDGV5OO.js → YM6QAFEQ.js} +1 -1
- package/dist/cdn/{QO4WS7CE.js → YMHR4PKM.js} +1 -1
- package/dist/cdn/{3KC2E42Z.js → YMSZKTCN.js} +1 -1
- package/dist/cdn/{QHJ5GHM6.js → YYDYHAP7.js} +1 -1
- package/dist/cdn/{UPCUFECO.js → ZEASFJJQ.js} +1 -1
- package/dist/cdn/{OLJ3NCJ2.js → ZGCRVGEK.js} +1 -1
- package/dist/cdn/{ITZTBZ6D.js → ZGJRTQBX.js} +1 -1
- package/dist/cdn/{23OTAQAT.js → ZPZI63EH.js} +1 -1
- package/dist/cdn/{TWMPNHXY.js → ZTV4V5SF.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/dom.js +5 -5
- package/dist/chunks/floating-ui.js +1 -4
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/useReferenceElement.js +505 -0
- package/dist/components/calcite-block/customElement.js +1 -1
- package/dist/components/calcite-popover/customElement.js +11 -176
- package/dist/components/calcite-sheet/customElement.js +1 -1
- package/dist/components/calcite-tab-nav/customElement.js +1 -1
- package/dist/components/calcite-tabs/customElement.js +1 -1
- package/dist/components/calcite-tooltip/customElement.js +11 -310
- package/dist/components/calcite-tree-item/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +2 -2
- package/dist/cdn/5XX7HCEA.js +0 -2
- package/dist/cdn/7JKP2OCF.js +0 -2
- package/dist/cdn/CMJEMF3I.js +0 -2
- package/dist/cdn/XIHNK7BL.js +0 -2
- package/dist/chunks/FloatingArrow.js +0 -24
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import { ref } from "lit/directives/ref.js";
|
|
3
|
+
import { keyed } from "lit/directives/keyed.js";
|
|
4
|
+
import { nothing, svg, html } from "lit";
|
|
5
|
+
import { safeClassMap } from "@arcgis/lumina";
|
|
6
|
+
import { x as getShadowRootNode, j as isPrimaryPointerButton, y as isKeyboardTriggeredClick, q as queryElementRoots } from "./dom.js";
|
|
7
|
+
import { i as isActivationKey } from "./key.js";
|
|
8
|
+
import { t as toAriaBoolean } from "./aria.js";
|
|
9
|
+
import { makeGenericController } from "@arcgis/lumina/controllers";
|
|
10
|
+
const CSS = {
|
|
11
|
+
arrow: "calcite-floating-ui-arrow",
|
|
12
|
+
arrowStroke: "calcite-floating-ui-arrow__stroke"
|
|
13
|
+
};
|
|
14
|
+
const DEFAULTS = {
|
|
15
|
+
width: 12,
|
|
16
|
+
height: 6,
|
|
17
|
+
strokeWidth: 1
|
|
18
|
+
};
|
|
19
|
+
const FloatingArrow = ({ floatingLayout, key, ref: ref$1 }) => {
|
|
20
|
+
const { width, height, strokeWidth } = DEFAULTS;
|
|
21
|
+
const svgX = width / 2;
|
|
22
|
+
const isVertical = floatingLayout === "vertical";
|
|
23
|
+
const dValue = `M0,0 H${width} L${width - svgX},${height} Q${svgX},${height} ${svgX},${height} Z`;
|
|
24
|
+
return keyed(key, html`<svg aria-hidden=true class=${safeClassMap(CSS.arrow)} height=${width} viewBox=${`0 0 ${width} ${width + (!isVertical ? strokeWidth : 0)}`} width=${width + (isVertical ? strokeWidth : 0)} ${ref(ref$1)}>${svg`${svg`<path class=${safeClassMap(CSS.arrowStroke)} d=${dValue ?? nothing} fill=none stroke-width=${strokeWidth + 1} />` || ""}<path d=${dValue ?? nothing} stroke=none />`}</svg>`);
|
|
25
|
+
};
|
|
26
|
+
function haveSameComponents(components, activeComponents) {
|
|
27
|
+
if (components === activeComponents) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (components.length !== activeComponents.length) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const s1 = new Set(components);
|
|
34
|
+
const s2 = new Set(activeComponents);
|
|
35
|
+
if (s1.size !== s2.size) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
for (const item of s1) {
|
|
39
|
+
if (!s2.has(item)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
const clickTolerance = 5;
|
|
46
|
+
const HOVER_OPEN_DELAY_MS = 300;
|
|
47
|
+
const HOVER_QUICK_OPEN_DELAY_MS = HOVER_OPEN_DELAY_MS / 3;
|
|
48
|
+
const HOVER_CLOSE_DELAY_MS = HOVER_OPEN_DELAY_MS * 1.5;
|
|
49
|
+
function isDrag({
|
|
50
|
+
startX,
|
|
51
|
+
startY,
|
|
52
|
+
endX,
|
|
53
|
+
endY
|
|
54
|
+
}) {
|
|
55
|
+
const distance = Math.hypot(endX - startX, endY - startY);
|
|
56
|
+
return distance > clickTolerance;
|
|
57
|
+
}
|
|
58
|
+
const referenceElementManager = (options) => {
|
|
59
|
+
const registeredElements = /* @__PURE__ */ new Map();
|
|
60
|
+
const registeredShadowRootCounts = /* @__PURE__ */ new WeakMap();
|
|
61
|
+
let activeComponents = null;
|
|
62
|
+
let clickedComponents = null;
|
|
63
|
+
let hoverCloseTimeout = null;
|
|
64
|
+
let hoverOpenTimeout = null;
|
|
65
|
+
let hoveredComponents = null;
|
|
66
|
+
let pointerDownPosition = null;
|
|
67
|
+
let registeredComponentCount = 0;
|
|
68
|
+
const queryComponents = (composedPath, type) => {
|
|
69
|
+
const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
|
|
70
|
+
if (!registeredElement) {
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
73
|
+
const components = registeredElements.get(registeredElement);
|
|
74
|
+
return components?.filter((component) => component.referenceElementType === type);
|
|
75
|
+
};
|
|
76
|
+
const toggleComponents = (event, type) => {
|
|
77
|
+
const composedPath = event.composedPath();
|
|
78
|
+
const components = queryComponents(composedPath, type);
|
|
79
|
+
components?.forEach((component) => {
|
|
80
|
+
if (component && !component.triggerDisabled) {
|
|
81
|
+
component.open = !component.open;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Array.from(registeredElements.values()).flat().filter(
|
|
85
|
+
(component) => !components?.includes(component) && component.autoClose && component.open && !composedPath.includes(component.el)
|
|
86
|
+
).forEach((component) => component.open = false);
|
|
87
|
+
};
|
|
88
|
+
const clickHandler = (event) => {
|
|
89
|
+
if (isKeyboardTriggeredClick(event) || event.defaultPrevented || pointerDownPosition && isDrag({
|
|
90
|
+
endY: event.clientY,
|
|
91
|
+
endX: event.clientX,
|
|
92
|
+
startY: pointerDownPosition.y,
|
|
93
|
+
startX: pointerDownPosition.x
|
|
94
|
+
})) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
pointerDownPosition = null;
|
|
98
|
+
toggleComponents(event, "click");
|
|
99
|
+
};
|
|
100
|
+
const clearHoverOpenTimeout = () => {
|
|
101
|
+
if (hoverOpenTimeout != null) {
|
|
102
|
+
window.clearTimeout(hoverOpenTimeout);
|
|
103
|
+
}
|
|
104
|
+
hoverOpenTimeout = null;
|
|
105
|
+
};
|
|
106
|
+
const clearHoverCloseTimeout = () => {
|
|
107
|
+
if (hoverCloseTimeout != null) {
|
|
108
|
+
window.clearTimeout(hoverCloseTimeout);
|
|
109
|
+
}
|
|
110
|
+
hoverCloseTimeout = null;
|
|
111
|
+
};
|
|
112
|
+
const clearHoverTimeout = () => {
|
|
113
|
+
clearHoverOpenTimeout();
|
|
114
|
+
clearHoverCloseTimeout();
|
|
115
|
+
};
|
|
116
|
+
const pathHasOpenHoverComponent = (components, composedPath) => {
|
|
117
|
+
return activeComponents?.some((component) => component?.open && composedPath.includes(component.el)) || components?.some((component) => component?.open && composedPath.includes(component.el));
|
|
118
|
+
};
|
|
119
|
+
const toggleHoverComponents = (components, open) => {
|
|
120
|
+
components?.forEach((component) => component.open = open);
|
|
121
|
+
activeComponents = open ? components : null;
|
|
122
|
+
};
|
|
123
|
+
const closeActiveHoverComponents = () => {
|
|
124
|
+
toggleHoverComponents(activeComponents, false);
|
|
125
|
+
};
|
|
126
|
+
const hoverKeyDownHandler = (event) => {
|
|
127
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
128
|
+
const openActiveHoverComponents = activeComponents?.filter((component) => component?.open);
|
|
129
|
+
if (openActiveHoverComponents?.length) {
|
|
130
|
+
clearHoverTimeout();
|
|
131
|
+
closeActiveHoverComponents();
|
|
132
|
+
const composedPath = event.composedPath();
|
|
133
|
+
if (openActiveHoverComponents.some(
|
|
134
|
+
(component) => component.referenceEl instanceof Element && composedPath.includes(component.referenceEl) || composedPath.includes(component.el)
|
|
135
|
+
)) {
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const hoverClickHandler = (event) => {
|
|
142
|
+
if (event.defaultPrevented) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
clickedComponents = null;
|
|
146
|
+
const composedPath = event.composedPath();
|
|
147
|
+
const components = queryComponents(composedPath, "hover");
|
|
148
|
+
if (pathHasOpenHoverComponent(components, composedPath)) {
|
|
149
|
+
clearHoverTimeout();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
closeActiveHoverComponents();
|
|
153
|
+
if (!components?.length) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
clearHoverTimeout();
|
|
157
|
+
const closeOnClickHoverComponents = components.filter((component) => component.closeOnClick);
|
|
158
|
+
const nonCloseOnClickHoverComponents = components.filter((component) => !component.closeOnClick);
|
|
159
|
+
if (closeOnClickHoverComponents?.length) {
|
|
160
|
+
clickedComponents = closeOnClickHoverComponents;
|
|
161
|
+
toggleHoverComponents(closeOnClickHoverComponents, false);
|
|
162
|
+
}
|
|
163
|
+
toggleHoverComponents(nonCloseOnClickHoverComponents, true);
|
|
164
|
+
};
|
|
165
|
+
const pointerDownHandler = (event) => {
|
|
166
|
+
if (event.defaultPrevented || !isPrimaryPointerButton(event)) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const { clientX, clientY } = event;
|
|
170
|
+
pointerDownPosition = { x: clientX, y: clientY };
|
|
171
|
+
};
|
|
172
|
+
const keyDownHandler = (event) => {
|
|
173
|
+
if (event.defaultPrevented) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (event.key === "Escape") {
|
|
177
|
+
closeAllComponents();
|
|
178
|
+
} else if (isActivationKey(event.key)) {
|
|
179
|
+
toggleComponents(event, "click");
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const closeAllComponents = () => {
|
|
183
|
+
Array.from(registeredElements.values()).flat().forEach((component) => component.open = false);
|
|
184
|
+
};
|
|
185
|
+
const closeComponentsIfNotActive = (components) => {
|
|
186
|
+
if (!haveSameComponents(components ?? [], activeComponents ?? [])) {
|
|
187
|
+
closeActiveHoverComponents();
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const openHoveredComponents = (components) => {
|
|
191
|
+
hoverOpenTimeout = window.setTimeout(
|
|
192
|
+
() => {
|
|
193
|
+
if (hoverOpenTimeout === null || !haveSameComponents(components ?? [], hoveredComponents ?? [])) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
clearHoverCloseTimeout();
|
|
197
|
+
closeComponentsIfNotActive(components);
|
|
198
|
+
toggleHoverComponents(components, true);
|
|
199
|
+
},
|
|
200
|
+
activeComponents?.some((component) => component.open) ? HOVER_QUICK_OPEN_DELAY_MS : HOVER_OPEN_DELAY_MS
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
const closeHoveredComponents = () => {
|
|
204
|
+
hoverCloseTimeout = window.setTimeout(() => {
|
|
205
|
+
if (hoverCloseTimeout === null) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
closeActiveHoverComponents();
|
|
209
|
+
}, HOVER_CLOSE_DELAY_MS);
|
|
210
|
+
};
|
|
211
|
+
const pointerMoveHandler = (event) => {
|
|
212
|
+
if (event.defaultPrevented) {
|
|
213
|
+
closeActiveHoverComponents();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const composedPath = event.composedPath();
|
|
217
|
+
const components = queryComponents(composedPath, "hover");
|
|
218
|
+
if (pathHasOpenHoverComponent(components, composedPath)) {
|
|
219
|
+
clearHoverTimeout();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (components?.some((component) => clickedComponents?.includes(component))) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (!components?.some((component) => hoveredComponents?.includes(component))) {
|
|
226
|
+
clearHoverOpenTimeout();
|
|
227
|
+
}
|
|
228
|
+
hoveredComponents = components;
|
|
229
|
+
if (components?.length) {
|
|
230
|
+
openHoveredComponents(components);
|
|
231
|
+
} else if (activeComponents?.some((component) => component?.open)) {
|
|
232
|
+
closeHoveredComponents();
|
|
233
|
+
}
|
|
234
|
+
clickedComponents = null;
|
|
235
|
+
};
|
|
236
|
+
const blurHandler = () => {
|
|
237
|
+
closeActiveHoverComponents();
|
|
238
|
+
};
|
|
239
|
+
const pointerLeaveHandler = (event) => {
|
|
240
|
+
if (event.defaultPrevented) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
clearHoverTimeout();
|
|
244
|
+
closeHoveredComponents();
|
|
245
|
+
};
|
|
246
|
+
const addListeners = () => {
|
|
247
|
+
if (options.click) {
|
|
248
|
+
window.addEventListener("click", clickHandler);
|
|
249
|
+
window.addEventListener("keydown", keyDownHandler);
|
|
250
|
+
window.addEventListener("pointerdown", pointerDownHandler);
|
|
251
|
+
}
|
|
252
|
+
if (options.hover) {
|
|
253
|
+
window.addEventListener("click", hoverClickHandler);
|
|
254
|
+
window.addEventListener("keydown", hoverKeyDownHandler);
|
|
255
|
+
window.addEventListener("pointermove", pointerMoveHandler);
|
|
256
|
+
window.addEventListener("focusin", focusInHandler);
|
|
257
|
+
window.addEventListener("blur", blurHandler);
|
|
258
|
+
document.addEventListener("pointerleave", pointerLeaveHandler);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
const removeListeners = () => {
|
|
262
|
+
if (options.click) {
|
|
263
|
+
window.removeEventListener("pointerdown", pointerDownHandler);
|
|
264
|
+
window.removeEventListener("click", clickHandler);
|
|
265
|
+
window.removeEventListener("keydown", keyDownHandler);
|
|
266
|
+
}
|
|
267
|
+
if (options.hover) {
|
|
268
|
+
window.removeEventListener("click", hoverClickHandler);
|
|
269
|
+
window.removeEventListener("keydown", hoverKeyDownHandler);
|
|
270
|
+
window.removeEventListener("pointermove", pointerMoveHandler);
|
|
271
|
+
window.removeEventListener("focusin", focusInHandler);
|
|
272
|
+
window.removeEventListener("blur", blurHandler);
|
|
273
|
+
document.removeEventListener("pointerleave", pointerLeaveHandler);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const toggleFocusedComponents = (components, open) => {
|
|
277
|
+
{
|
|
278
|
+
clearHoverTimeout();
|
|
279
|
+
}
|
|
280
|
+
toggleHoverComponents(components, open);
|
|
281
|
+
};
|
|
282
|
+
const getReferenceElShadowRootNode = (referenceEl) => {
|
|
283
|
+
return referenceEl instanceof Element ? getShadowRootNode(referenceEl) : null;
|
|
284
|
+
};
|
|
285
|
+
const focusInHandler = (event) => {
|
|
286
|
+
if (event.defaultPrevented) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const composedPath = event.composedPath();
|
|
290
|
+
const components = queryComponents(composedPath, "hover");
|
|
291
|
+
if (pathHasOpenHoverComponent(components, composedPath)) {
|
|
292
|
+
clearHoverTimeout();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (components?.some((component) => clickedComponents?.includes(component))) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
clickedComponents = null;
|
|
299
|
+
closeComponentsIfNotActive(components);
|
|
300
|
+
if (!components?.length) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
toggleFocusedComponents(components, true);
|
|
304
|
+
};
|
|
305
|
+
const updateElement = (component, referenceEl) => {
|
|
306
|
+
if (!referenceEl || !component.referenceElementType) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (options.click && "ariaExpanded" in referenceEl) {
|
|
310
|
+
const existingComponents = registeredElements.get(referenceEl) ?? [];
|
|
311
|
+
const existingComponentOpen = existingComponents?.some((component2) => component2.open) ?? false;
|
|
312
|
+
referenceEl.ariaExpanded = toAriaBoolean(component.open || existingComponentOpen);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
const addShadowListeners = (shadowRoot) => {
|
|
316
|
+
shadowRoot.addEventListener("focusin", focusInHandler);
|
|
317
|
+
};
|
|
318
|
+
const removeShadowListeners = (shadowRoot) => {
|
|
319
|
+
shadowRoot.removeEventListener("focusin", focusInHandler);
|
|
320
|
+
};
|
|
321
|
+
const registerShadowRoot = (shadowRoot) => {
|
|
322
|
+
const count = registeredShadowRootCounts.get(shadowRoot);
|
|
323
|
+
const newCount = (typeof count === "number" ? count : 0) + 1;
|
|
324
|
+
if (newCount === 1) {
|
|
325
|
+
addShadowListeners(shadowRoot);
|
|
326
|
+
}
|
|
327
|
+
registeredShadowRootCounts.set(shadowRoot, newCount);
|
|
328
|
+
};
|
|
329
|
+
const unregisterShadowRoot = (shadowRoot) => {
|
|
330
|
+
const count = registeredShadowRootCounts.get(shadowRoot);
|
|
331
|
+
const currentCount = typeof count === "number" ? count : 0;
|
|
332
|
+
const newCount = Math.max(0, currentCount - 1);
|
|
333
|
+
if (currentCount > 0 && newCount === 0) {
|
|
334
|
+
removeShadowListeners(shadowRoot);
|
|
335
|
+
registeredShadowRootCounts.delete(shadowRoot);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (newCount > 0) {
|
|
339
|
+
registeredShadowRootCounts.set(shadowRoot, newCount);
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
const registerElement = (component, referenceEl) => {
|
|
343
|
+
if (!referenceEl || !component.referenceElementType) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const existingComponents = registeredElements.get(referenceEl) ?? [];
|
|
347
|
+
if (existingComponents.includes(component)) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (options.click && "ariaControlsElements" in referenceEl) {
|
|
351
|
+
const currentElements = referenceEl.ariaControlsElements ?? [];
|
|
352
|
+
if (!currentElements.includes(component)) {
|
|
353
|
+
const updatedElements = [...currentElements, component];
|
|
354
|
+
referenceEl.ariaControlsElements = updatedElements;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (options.hover && "ariaDescribedByElements" in referenceEl) {
|
|
358
|
+
const currentElements = referenceEl.ariaDescribedByElements ?? [];
|
|
359
|
+
if (!currentElements.includes(component)) {
|
|
360
|
+
const updatedElements = [...currentElements, component];
|
|
361
|
+
referenceEl.ariaDescribedByElements = updatedElements;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
registeredComponentCount++;
|
|
365
|
+
registeredElements.set(referenceEl, [...existingComponents, component]);
|
|
366
|
+
const shadowRoot = options.hover ? getReferenceElShadowRootNode(referenceEl) : null;
|
|
367
|
+
if (shadowRoot) {
|
|
368
|
+
registerShadowRoot(shadowRoot);
|
|
369
|
+
}
|
|
370
|
+
if (registeredComponentCount === 1) {
|
|
371
|
+
addListeners();
|
|
372
|
+
}
|
|
373
|
+
updateElement(component, referenceEl);
|
|
374
|
+
};
|
|
375
|
+
const decrementRegisteredElementCount = (shadowRoot) => {
|
|
376
|
+
registeredComponentCount--;
|
|
377
|
+
if (shadowRoot) {
|
|
378
|
+
unregisterShadowRoot(shadowRoot);
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
const unregisterElement = (component, referenceEl) => {
|
|
382
|
+
if (!referenceEl || !component.referenceElementType) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const shadowRoot = options.hover ? getReferenceElShadowRootNode(referenceEl) : null;
|
|
386
|
+
const existingComponents = registeredElements.get(referenceEl) ?? [];
|
|
387
|
+
const updatedComponents = existingComponents.filter((p) => p !== component);
|
|
388
|
+
if (updatedComponents.length > 0) {
|
|
389
|
+
registeredElements.set(referenceEl, updatedComponents);
|
|
390
|
+
if (updatedComponents.length !== existingComponents.length) {
|
|
391
|
+
decrementRegisteredElementCount(shadowRoot);
|
|
392
|
+
}
|
|
393
|
+
} else if (registeredElements.delete(referenceEl)) {
|
|
394
|
+
decrementRegisteredElementCount(shadowRoot);
|
|
395
|
+
}
|
|
396
|
+
if (registeredComponentCount === 0) {
|
|
397
|
+
removeListeners();
|
|
398
|
+
clearHoverTimeout();
|
|
399
|
+
}
|
|
400
|
+
if (options.click && "ariaControlsElements" in referenceEl) {
|
|
401
|
+
const newElements = referenceEl.ariaControlsElements?.filter((element) => element !== component);
|
|
402
|
+
referenceEl.ariaControlsElements = newElements?.length > 0 ? newElements : null;
|
|
403
|
+
}
|
|
404
|
+
if (options.click && "ariaExpanded" in referenceEl) {
|
|
405
|
+
const hasRegisteredComponents = (updatedComponents?.length ?? 0) > 0;
|
|
406
|
+
if (hasRegisteredComponents) {
|
|
407
|
+
const existingComponentOpen = updatedComponents?.some((component2) => component2.open) ?? false;
|
|
408
|
+
referenceEl.ariaExpanded = toAriaBoolean(existingComponentOpen);
|
|
409
|
+
} else {
|
|
410
|
+
referenceEl.ariaExpanded = null;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (options.hover && "ariaDescribedByElements" in referenceEl) {
|
|
414
|
+
const newElements = referenceEl.ariaDescribedByElements?.filter((element) => element !== component);
|
|
415
|
+
referenceEl.ariaDescribedByElements = newElements?.length > 0 ? newElements : null;
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
return {
|
|
419
|
+
registerElement,
|
|
420
|
+
unregisterElement,
|
|
421
|
+
updateElement
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
const useReferenceElement = (options) => {
|
|
425
|
+
const { manager } = options;
|
|
426
|
+
return makeGenericController((component, controller) => {
|
|
427
|
+
let animationFrameId = null;
|
|
428
|
+
let lastRegisteredReferenceEl = null;
|
|
429
|
+
const canManageReferenceElement = (referenceEl) => {
|
|
430
|
+
return Boolean(referenceEl && component.referenceElementType);
|
|
431
|
+
};
|
|
432
|
+
const registerReferenceElement = (referenceEl) => {
|
|
433
|
+
if (!canManageReferenceElement(referenceEl)) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
manager.registerElement(component, referenceEl);
|
|
437
|
+
lastRegisteredReferenceEl = referenceEl;
|
|
438
|
+
};
|
|
439
|
+
const unregisterReferenceElement = (referenceEl) => {
|
|
440
|
+
if (!canManageReferenceElement(referenceEl)) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
manager.unregisterElement(component, referenceEl);
|
|
444
|
+
if (lastRegisteredReferenceEl === referenceEl) {
|
|
445
|
+
lastRegisteredReferenceEl = null;
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
const getReferenceElement = (component2) => {
|
|
449
|
+
const { referenceElement, el } = component2;
|
|
450
|
+
return (typeof referenceElement === "string" ? queryElementRoots(el, { id: referenceElement }) : referenceElement) || null;
|
|
451
|
+
};
|
|
452
|
+
const setUpReferenceElement = (warn = true) => {
|
|
453
|
+
if (!component.referenceElementType) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
component.referenceEl = getReferenceElement(component);
|
|
457
|
+
const { el, referenceElement, referenceEl } = component;
|
|
458
|
+
if (warn && referenceElement && !referenceEl) {
|
|
459
|
+
console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
|
|
460
|
+
el
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
controller.onConnected(() => {
|
|
465
|
+
animationFrameId = requestAnimationFrame(() => {
|
|
466
|
+
if (!component.el.isConnected) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
setUpReferenceElement(component.manager.loadedCalled);
|
|
470
|
+
registerReferenceElement(component.referenceEl);
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
controller.onLoaded(() => {
|
|
474
|
+
if (component.referenceElement && !component.referenceEl) {
|
|
475
|
+
setUpReferenceElement();
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
controller.onUpdate((changes) => {
|
|
479
|
+
if (!component.hasUpdated) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
if (changes.has("referenceElement")) {
|
|
483
|
+
setUpReferenceElement();
|
|
484
|
+
}
|
|
485
|
+
if (changes.has("referenceEl")) {
|
|
486
|
+
unregisterReferenceElement(changes.get("referenceEl"));
|
|
487
|
+
registerReferenceElement(component.referenceEl);
|
|
488
|
+
} else if (changes.has("open")) {
|
|
489
|
+
manager.updateElement(component, component.referenceEl);
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
controller.onDisconnected(() => {
|
|
493
|
+
if (animationFrameId != null) {
|
|
494
|
+
cancelAnimationFrame(animationFrameId);
|
|
495
|
+
animationFrameId = null;
|
|
496
|
+
}
|
|
497
|
+
unregisterReferenceElement(lastRegisteredReferenceEl);
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
export {
|
|
502
|
+
FloatingArrow as F,
|
|
503
|
+
referenceElementManager as r,
|
|
504
|
+
useReferenceElement as u
|
|
505
|
+
};
|
|
@@ -55,7 +55,7 @@ const ICONS = {
|
|
|
55
55
|
valid: "check-circle",
|
|
56
56
|
invalid: "exclamation-mark-triangle"
|
|
57
57
|
};
|
|
58
|
-
const styles = css`:host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host([scale=s]) .header{gap:var(--calcite-spacing-sm)}:host([scale=s]) .icon-end-container{gap:var(--calcite-spacing-sm);padding-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .heading{font-size:var(--calcite-font-size-sm)}:host([scale=s]) .description{font-size:var(--calcite-font-size-xs)}:host([scale=s]){--calcite-internal-block-actions-spacing: var(--calcite-spacing-xxs);--calcite-internal-block-header-content-padding: var(--calcite-spacing-sm);--calcite-internal-block-padding-block: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-xxs)) );--calcite-internal-block-padding-inline: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-sm)) )}:host([scale=m]) .header{gap:var(--calcite-spacing-md)}:host([scale=m]) .icon-end-container{gap:var(--calcite-spacing-md);padding-inline-end:var(--calcite-spacing-md)}:host([scale=m]) .heading{font-size:var(--calcite-font-size)}:host([scale=m]) .description{font-size:var(--calcite-font-size-sm)}:host([scale=m]){--calcite-internal-block-actions-spacing: var(--calcite-spacing-xxs);--calcite-internal-block-header-content-padding: var(--calcite-spacing-md);--calcite-internal-block-padding-block: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-sm)) );--calcite-internal-block-padding-inline: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-md)) )}:host([scale=l]) .header{gap:var(--calcite-spacing-lg)}:host([scale=l]) .icon-end-container{gap:var(--calcite-spacing-lg);padding-inline-end:var(--calcite-spacing-lg)}:host([scale=l]) .heading{font-size:var(--calcite-font-size-md)}:host([scale=l]) .description{font-size:var(--calcite-font-size)}:host([scale=l]){--calcite-internal-block-actions-spacing: var(--calcite-spacing-xs);--calcite-internal-block-header-content-padding: var(--calcite-spacing-lg);--calcite-internal-block-padding-block: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-md)) );--calcite-internal-block-padding-inline: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-lg)) )}:host{display:flex;flex-shrink:0;flex-grow:0;flex-direction:column;border-width:0px;border-block-end-width:1px;border-style:solid;padding:0;transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:var(--calcite-animation-timing);transition-timing-function:cubic-bezier(.215,.44,.42,.88);flex-basis:auto;border-color:var(--calcite-block-border-color, var(--calcite-color-border-3))}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.header{justify-content:flex-start}.header--has-content{padding:var(--calcite-internal-block-header-content-padding)}.header--draggable{padding-inline-start:var(--calcite-spacing-xxs)}.header,.toggle{grid-area:header}.header-container{display:grid;align-items:stretch;grid-template:auto/auto 1fr auto auto auto auto;grid-template-areas:"handle header icon-end menu actions-end"}.icon--start,.icon--end{color:var(--calcite-block-icon-color, var(--calcite-color-text-3))}.actions-end{align-items:center;display:flex;gap:var(--calcite-internal-block-actions-spacing);grid-area:actions-end;padding-block:var(--calcite-internal-block-actions-spacing);padding-inline-end:var(--calcite-internal-block-actions-spacing)}.toggle{margin:0;display:flex;cursor:pointer;flex-wrap:nowrap;align-items:center;justify-content:space-between;border-style:none;padding:0;outline-color:transparent;font-family:inherit;text-align:initial;background-color:var(--calcite-block-header-background-color, transparent)}.toggle:hover{background-color:var(--calcite-block-header-background-color-hover, var(--calcite-color-foreground-2))}.toggle:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.toggle:active{background-color:var(--calcite-block-header-background-color-press, var(--calcite-color-foreground-3))}calcite-loader[inline]{align-self:center}calcite-sort-handle{align-self:center;grid-area:handle;margin-block:var(--calcite-internal-block-actions-spacing);padding-inline-start:var(--calcite-spacing-xxs)}.title{display:flex;flex-direction:column}.header .title .heading{padding:0;word-wrap:break-word;word-break:break-word;color:var(--calcite-block-heading-text-color, var(--calcite-color-text-1));font-weight:var(--calcite-font-weight-normal);line-height:var(--calcite-font-line-height-relative-snug)}.description{padding:0;word-wrap:break-word;word-break:break-word;color:var(--calcite-block-description-text-color, var(--calcite-color-text-3));font-weight:var(--calcite-font-weight-regular);line-height:var(--calcite-font-line-height-relative-snug)}.icon{display:flex}.status-icon.valid{color:var(--calcite-color-status-success)}.status-icon.invalid{color:var(--calcite-color-status-danger)}@keyframes spin{0%{transform:rotate(0)}50%{transform:rotate(180deg)}to{transform:rotate(360deg)}}.icon-end-container{display:flex;align-items:center;grid-area:icon-end}.toggle-icon{align-self:center;justify-self:end;transition-property:color;transition-duration:var(--calcite-animation-timing);transition-timing-function:cubic-bezier(.4,0,.2,1);color:var(--calcite-block-icon-color, var(--calcite-color-text-3))}.toggle:hover .toggle-icon{color:var(--calcite-block-icon-color-hover, var(--calcite-color-text-1))}.container{position:relative;display:flex;block-size:100%;flex-direction:column}.content{position:relative;min-block-size:0px;flex:1 1 0
|
|
58
|
+
const styles = css`:host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host([scale=s]) .header{gap:var(--calcite-spacing-sm)}:host([scale=s]) .icon-end-container{gap:var(--calcite-spacing-sm);padding-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .heading{font-size:var(--calcite-font-size-sm)}:host([scale=s]) .description{font-size:var(--calcite-font-size-xs)}:host([scale=s]){--calcite-internal-block-actions-spacing: var(--calcite-spacing-xxs);--calcite-internal-block-header-content-padding: var(--calcite-spacing-sm);--calcite-internal-block-padding-block: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-xxs)) );--calcite-internal-block-padding-inline: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-sm)) )}:host([scale=m]) .header{gap:var(--calcite-spacing-md)}:host([scale=m]) .icon-end-container{gap:var(--calcite-spacing-md);padding-inline-end:var(--calcite-spacing-md)}:host([scale=m]) .heading{font-size:var(--calcite-font-size)}:host([scale=m]) .description{font-size:var(--calcite-font-size-sm)}:host([scale=m]){--calcite-internal-block-actions-spacing: var(--calcite-spacing-xxs);--calcite-internal-block-header-content-padding: var(--calcite-spacing-md);--calcite-internal-block-padding-block: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-sm)) );--calcite-internal-block-padding-inline: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-md)) )}:host([scale=l]) .header{gap:var(--calcite-spacing-lg)}:host([scale=l]) .icon-end-container{gap:var(--calcite-spacing-lg);padding-inline-end:var(--calcite-spacing-lg)}:host([scale=l]) .heading{font-size:var(--calcite-font-size-md)}:host([scale=l]) .description{font-size:var(--calcite-font-size)}:host([scale=l]){--calcite-internal-block-actions-spacing: var(--calcite-spacing-xs);--calcite-internal-block-header-content-padding: var(--calcite-spacing-lg);--calcite-internal-block-padding-block: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-md)) );--calcite-internal-block-padding-inline: var( --calcite-block-content-space, var(--calcite-block-padding, var(--calcite-spacing-lg)) )}:host{display:flex;flex-shrink:0;flex-grow:0;flex-direction:column;border-width:0px;border-block-end-width:1px;border-style:solid;padding:0;transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:var(--calcite-animation-timing);transition-timing-function:cubic-bezier(.215,.44,.42,.88);flex-basis:auto;border-color:var(--calcite-block-border-color, var(--calcite-color-border-3))}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.header{justify-content:flex-start}.header--has-content{padding:var(--calcite-internal-block-header-content-padding)}.header--draggable{padding-inline-start:var(--calcite-spacing-xxs)}.header,.toggle{grid-area:header}.header-container{display:grid;align-items:stretch;grid-template:auto/auto 1fr auto auto auto auto;grid-template-areas:"handle header icon-end menu actions-end"}.icon--start,.icon--end{color:var(--calcite-block-icon-color, var(--calcite-color-text-3))}.actions-end{align-items:center;display:flex;gap:var(--calcite-internal-block-actions-spacing);grid-area:actions-end;padding-block:var(--calcite-internal-block-actions-spacing);padding-inline-end:var(--calcite-internal-block-actions-spacing)}.toggle{margin:0;display:flex;cursor:pointer;flex-wrap:nowrap;align-items:center;justify-content:space-between;border-style:none;padding:0;outline-color:transparent;font-family:inherit;text-align:initial;background-color:var(--calcite-block-header-background-color, transparent)}.toggle:hover{background-color:var(--calcite-block-header-background-color-hover, var(--calcite-color-foreground-2))}.toggle:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.toggle:active{background-color:var(--calcite-block-header-background-color-press, var(--calcite-color-foreground-3))}calcite-loader[inline]{align-self:center}calcite-sort-handle{align-self:center;grid-area:handle;margin-block:var(--calcite-internal-block-actions-spacing);padding-inline-start:var(--calcite-spacing-xxs)}.title{display:flex;flex-direction:column}.header .title .heading{padding:0;word-wrap:break-word;word-break:break-word;color:var(--calcite-block-heading-text-color, var(--calcite-color-text-1));font-weight:var(--calcite-font-weight-normal);line-height:var(--calcite-font-line-height-relative-snug)}.description{padding:0;word-wrap:break-word;word-break:break-word;color:var(--calcite-block-description-text-color, var(--calcite-color-text-3));font-weight:var(--calcite-font-weight-regular);line-height:var(--calcite-font-line-height-relative-snug)}.icon{display:flex}.status-icon.valid{color:var(--calcite-color-status-success)}.status-icon.invalid{color:var(--calcite-color-status-danger)}@keyframes spin{0%{transform:rotate(0)}50%{transform:rotate(180deg)}to{transform:rotate(360deg)}}.icon-end-container{display:flex;align-items:center;grid-area:icon-end}.toggle-icon{align-self:center;justify-self:end;transition-property:color;transition-duration:var(--calcite-animation-timing);transition-timing-function:cubic-bezier(.4,0,.2,1);color:var(--calcite-block-icon-color, var(--calcite-color-text-3))}.toggle:hover .toggle-icon{color:var(--calcite-block-icon-color-hover, var(--calcite-color-text-1))}.container{position:relative;display:flex;block-size:100%;flex-direction:column}.content{position:relative;min-block-size:0px;flex:1 1 0%;opacity:0;padding-block:var(--calcite-internal-block-padding-block);padding-inline:var(--calcite-internal-block-padding-inline);transition:opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(.215,.44,.42,.88)}.content-end,.content-start{display:flex;align-items:center;color:var(--calcite-block-text-color, var(--calcite-color-text-3))}calcite-action-menu{align-self:center;grid-area:menu;margin-inline-end:var(--calcite-internal-block-actions-spacing)}:host([expanded]){margin-block:.5rem}:host([expanded]) .header .title .heading{color:var(--calcite-block-heading-text-color, var(--calcite-block-heading-text-color-press, var(--calcite-color-text-1)));font-weight:var(--calcite-font-weight-medium)}:host([expanded]) .description{color:var(--calcite-block-description-text-color, var(--calcite-color-text-2))}:host([expanded]) .icon--start,:host([expanded]) .icon--end{color:var(--calcite-block-icon-color, var(--calcite-color-text-1))}:host([expanded]) .content{opacity:1}:host([expanded][scale=s]){margin-block:var(--calcite-spacing-xxs)}:host([expanded][scale=l]){margin-block:var(--calcite-spacing-md)}:host([hidden]){display:none}[hidden]{display:none}`;
|
|
59
59
|
class Block extends LitElement {
|
|
60
60
|
constructor() {
|
|
61
61
|
super(...arguments);
|