@cas-smartdesign/popover 4.1.1
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/LICENSE +8 -0
- package/dist/docs/3_created_from_source.js +1 -0
- package/dist/docs/doc.css +1 -0
- package/dist/docs/doc.mjs +211 -0
- package/dist/docs/index.html +25 -0
- package/dist/popover-with-externals.js +8 -0
- package/dist/popover-with-externals.js.map +7 -0
- package/dist/popover.d.ts +76 -0
- package/dist/popover.mjs +281 -0
- package/dist/popover.mjs.map +1 -0
- package/npm-third-party-licenses.json +192 -0
- package/package.json +33 -0
- package/readme.md +69 -0
package/dist/popover.mjs
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { createPopper as d } from "@popperjs/core";
|
|
2
|
+
const g = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="12" viewBox="0 0 24 12">\r
|
|
3
|
+
<path d="M0 0l11.96 12L24 0z" fill="#999" class="arrow-border"/>\r
|
|
4
|
+
<path d="M12 11L1 0h22z" fill="#f2f2f2" class="arrow-background"/>\r
|
|
5
|
+
</svg>\r
|
|
6
|
+
`, f = navigator.userAgent.indexOf("Trident") !== -1, h = 1, l = "sd-popover-open", o = class o extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments), this._open = !1, this._firstUpdated = !1, this.toggle = () => {
|
|
9
|
+
this.open = !this.open;
|
|
10
|
+
}, this.show = () => {
|
|
11
|
+
this.open = !0;
|
|
12
|
+
}, this.hide = () => {
|
|
13
|
+
this.open = !1;
|
|
14
|
+
}, this.hideIfExternalTarget = (e) => {
|
|
15
|
+
const t = e.target;
|
|
16
|
+
(!(t instanceof HTMLElement) || !this._container.contains(t) && !this.targetElement.contains(t)) && this.hide();
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
get triggerType() {
|
|
20
|
+
return this.getAttribute("trigger-type");
|
|
21
|
+
}
|
|
22
|
+
set triggerType(e) {
|
|
23
|
+
e ? this.setAttribute("trigger-type", e) : this.removeAttribute("trigger-type");
|
|
24
|
+
}
|
|
25
|
+
get placement() {
|
|
26
|
+
return this.getAttribute("placement");
|
|
27
|
+
}
|
|
28
|
+
set placement(e) {
|
|
29
|
+
e ? this.setAttribute("placement", e) : this.removeAttribute("placement");
|
|
30
|
+
}
|
|
31
|
+
get targetElement() {
|
|
32
|
+
return this._targetElement;
|
|
33
|
+
}
|
|
34
|
+
set targetElement(e) {
|
|
35
|
+
this.removeTargetEventListener(this.targetElement), this._targetElement && this._targetElement.getAttribute("aria-expanded") == "true" && this._targetElement.setAttribute("aria-expanded", "false"), this._targetElement = e, e.setAttribute("aria-expanded", "false"), this.addTargetEventListener(this.targetElement), this.updatePopper();
|
|
36
|
+
}
|
|
37
|
+
get targetSelector() {
|
|
38
|
+
return this.getAttribute("target-selector");
|
|
39
|
+
}
|
|
40
|
+
set targetSelector(e) {
|
|
41
|
+
e ? this.setAttribute("target-selector", e) : this.removeAttribute("target-selector");
|
|
42
|
+
}
|
|
43
|
+
get modal() {
|
|
44
|
+
return this.hasAttribute("modal");
|
|
45
|
+
}
|
|
46
|
+
set modal(e) {
|
|
47
|
+
e ? this.setAttribute("modal", "") : this.removeAttribute("modal");
|
|
48
|
+
}
|
|
49
|
+
get popoverFor() {
|
|
50
|
+
return this.getAttribute("popover-for");
|
|
51
|
+
}
|
|
52
|
+
set popoverFor(e) {
|
|
53
|
+
e ? this.setAttribute("popover-for", e) : this.removeAttribute("popover-for");
|
|
54
|
+
}
|
|
55
|
+
get flipPriority() {
|
|
56
|
+
return this._flipPriority;
|
|
57
|
+
}
|
|
58
|
+
set flipPriority(e) {
|
|
59
|
+
e && e.length > 0 ? this._flipPriority = e : this._flipPriority = null, this.reConfigurePopper();
|
|
60
|
+
}
|
|
61
|
+
get offset() {
|
|
62
|
+
return this.getAttribute("offset") ? parseInt(this.getAttribute("offset")) : 0;
|
|
63
|
+
}
|
|
64
|
+
set offset(e) {
|
|
65
|
+
e ? this.setAttribute("offset", e.toString()) : this.removeAttribute("offset"), this.reConfigurePopper();
|
|
66
|
+
}
|
|
67
|
+
reConfigurePopper() {
|
|
68
|
+
this._popper && this.configurePopper();
|
|
69
|
+
}
|
|
70
|
+
get noArrow() {
|
|
71
|
+
return this.hasAttribute("no-arrow");
|
|
72
|
+
}
|
|
73
|
+
set noArrow(e) {
|
|
74
|
+
e ? this.setAttribute("no-arrow", "") : this.removeAttribute("no-arrow");
|
|
75
|
+
}
|
|
76
|
+
static get observedAttributes() {
|
|
77
|
+
return ["placement", "target-selector", "trigger-type"];
|
|
78
|
+
}
|
|
79
|
+
attributeChangedCallback(e, t) {
|
|
80
|
+
switch (e) {
|
|
81
|
+
case "placement": {
|
|
82
|
+
this.updatePopper();
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case "trigger-type": {
|
|
86
|
+
this.removeTargetEventListener(this.targetElement), this.addTargetEventListener(this.targetElement);
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case "target-selector": {
|
|
90
|
+
this.handleTargetSelectorChange(t);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
connectedCallback() {
|
|
96
|
+
this._firstUpdated || (this.firstUpdated(), this._firstUpdated = !0), this.targetElement ? this.addTargetEventListener(this.targetElement) : this.targetSelector && requestAnimationFrame(() => {
|
|
97
|
+
this.isConnected && this.handleTargetSelectorChange(null);
|
|
98
|
+
}), this._arrow = document.createElement("div"), this._arrow.classList.add("popover-arrow"), this._arrow.setAttribute("data-popper-arrow", ""), this._arrow.style.display = "flex", this._arrow.innerHTML = g;
|
|
99
|
+
}
|
|
100
|
+
disconnectedCallback() {
|
|
101
|
+
this.targetElement && (this.removeTargetEventListener(this.targetElement), this.removeTargetClassForOpen(this.targetElement)), this._resizeObserver && (this._resizeObserver.disconnect(), this._resizeObserver = null);
|
|
102
|
+
}
|
|
103
|
+
firstUpdated() {
|
|
104
|
+
this.style.display = "none", this.triggerType = this.triggerType || "click", this.placement = this.placement || "auto";
|
|
105
|
+
}
|
|
106
|
+
get open() {
|
|
107
|
+
return this._open;
|
|
108
|
+
}
|
|
109
|
+
set open(e) {
|
|
110
|
+
e !== this._open && (this._open = e, this.handleOpenChange());
|
|
111
|
+
}
|
|
112
|
+
handleOpenChange() {
|
|
113
|
+
this.open ? (this._popper || this.configurePopper(), this._container.innerHTML = "", this.popoverFor && this._container.setAttribute("popover-for", this.popoverFor), this.content && (this._container.prepend(this.content), Object.assign(this.content.style, {
|
|
114
|
+
position: "relative",
|
|
115
|
+
display: "block",
|
|
116
|
+
zIndex: 1
|
|
117
|
+
}), window.requestAnimationFrame(() => {
|
|
118
|
+
let e = getComputedStyle(this.content).backgroundColor;
|
|
119
|
+
e == "rgba(0, 0, 0, 0)" && (this.content.style.background = e = "#f2f2f2"), this._arrow.querySelector(".arrow-background").style.fill = e;
|
|
120
|
+
})), this.ensureArrowIsAdded(), this.ownerDocument.body.appendChild(this._container), this.updatePopper(), this.setAttribute("open", ""), this.modal && (window.addEventListener("click", this.hideIfExternalTarget, { capture: !0 }), window.addEventListener("focus", this.hideIfExternalTarget, { capture: !0 })), this.targetElement && (this.addTargetClassForOpen(this.targetElement), this.targetElement.setAttribute("aria-expanded", "true")), this.dispatchEvent(new CustomEvent("open"))) : (this.ownerDocument.body.removeChild(this._container), this.removeAttribute("open"), window.removeEventListener("click", this.hideIfExternalTarget, { capture: !0 }), window.removeEventListener("focus", this.hideIfExternalTarget, { capture: !0 }), this.targetElement && (this.removeTargetClassForOpen(this.targetElement), this.targetElement.setAttribute("aria-expanded", "false")), this.dispatchEvent(new CustomEvent("close")));
|
|
121
|
+
}
|
|
122
|
+
handleTargetSelectorChange(e) {
|
|
123
|
+
const t = document.querySelector(e);
|
|
124
|
+
t && (this.removeTargetEventListener(t), this.removeTargetClassForOpen(t)), this.targetSelector && (this.targetElement = document.querySelector(this.targetSelector), this.addTargetEventListener(this.targetElement));
|
|
125
|
+
}
|
|
126
|
+
addTargetEventListener(e) {
|
|
127
|
+
if (e)
|
|
128
|
+
switch (this.triggerType) {
|
|
129
|
+
case "hover": {
|
|
130
|
+
e.addEventListener("mouseenter", this.show), e.addEventListener("mouseleave", this.hide);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case "click": {
|
|
134
|
+
e.addEventListener("click", this.toggle);
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
removeTargetEventListener(e) {
|
|
140
|
+
if (e)
|
|
141
|
+
switch (this.triggerType) {
|
|
142
|
+
case "hover": {
|
|
143
|
+
e.removeEventListener("mouseenter", this.show), e.removeEventListener("mouseleave", this.hide);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case "click": {
|
|
147
|
+
e.removeEventListener("click", this.toggle);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
configurePopper() {
|
|
153
|
+
this.createContentContainer(), this.ensureArrowIsAdded();
|
|
154
|
+
const e = this, t = {
|
|
155
|
+
placement: e.placement,
|
|
156
|
+
strategy: "absolute",
|
|
157
|
+
modifiers: [
|
|
158
|
+
{
|
|
159
|
+
name: "computeStyles",
|
|
160
|
+
options: {
|
|
161
|
+
gpuAcceleration: !f
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "flip",
|
|
166
|
+
options: {
|
|
167
|
+
fallbackPlacements: e._flipPriority
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "offset",
|
|
172
|
+
options: {
|
|
173
|
+
offset: () => [
|
|
174
|
+
0,
|
|
175
|
+
e.noArrow ? 0 + e.offset : this._arrow.clientHeight + e.offset
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: "arrow",
|
|
181
|
+
options: {
|
|
182
|
+
padding: 6
|
|
183
|
+
// Avoid to reach the edges of the popper element with the arrow
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "resetArrowStyles",
|
|
188
|
+
enabled: !0,
|
|
189
|
+
phase: "beforeWrite",
|
|
190
|
+
fn({ state: r }) {
|
|
191
|
+
Object.assign(e._arrow.style, {
|
|
192
|
+
top: r.styles.arrow.top || "",
|
|
193
|
+
left: r.styles.arrow.left || "",
|
|
194
|
+
bottom: r.styles.arrow.bottom || "",
|
|
195
|
+
right: r.styles.arrow.right || ""
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "onUpdate",
|
|
201
|
+
enabled: !0,
|
|
202
|
+
phase: "afterWrite",
|
|
203
|
+
fn({ state: r }) {
|
|
204
|
+
e.updateArrow(r.placement);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
};
|
|
209
|
+
this._popper = d(this.targetElement, this._container, t);
|
|
210
|
+
}
|
|
211
|
+
createContentContainer() {
|
|
212
|
+
this._container = document.createElement("div"), this._container.classList.add("popover-container"), this._container.tabIndex = 0, this._resizeObserver && this._resizeObserver.disconnect(), this._resizeObserver = new ResizeObserver(() => {
|
|
213
|
+
this._popper && this._popper.update();
|
|
214
|
+
}), this._resizeObserver.observe(this._container), Object.assign(this._container.style, {
|
|
215
|
+
boxShadow: `0 4px 5px 0 rgba(0, 0, 0, 0.14),
|
|
216
|
+
0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
217
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.4)`,
|
|
218
|
+
border: "1px solid #999",
|
|
219
|
+
boxSizing: "border-box",
|
|
220
|
+
zIndex: 2e4
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
ensureArrowIsAdded() {
|
|
224
|
+
!this.noArrow && !this._container.contains(this._arrow) && this._container.appendChild(this._arrow);
|
|
225
|
+
}
|
|
226
|
+
updatePopper() {
|
|
227
|
+
this._popper && (this._popper.state.elements.reference = this.targetElement, this._popper.state.options.placement = this.placement, this.open && this._popper.update());
|
|
228
|
+
}
|
|
229
|
+
updateArrow(e) {
|
|
230
|
+
if (this._arrow) {
|
|
231
|
+
const t = this.getArrowVariant(e);
|
|
232
|
+
if (this._arrow.setAttribute("variant", t), this._content) {
|
|
233
|
+
const r = this._arrow.querySelector("svg"), p = this._arrow.clientWidth, s = this._arrow.clientHeight, n = `-${s - h}px`, c = (p - s) / 2, a = `-${s + c - h}px`;
|
|
234
|
+
switch (t) {
|
|
235
|
+
case "bottom": {
|
|
236
|
+
this._arrow.style.top = n, r.style.transform = "rotate(180deg)";
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
case "top": {
|
|
240
|
+
this._arrow.style.bottom = n, r.style.transform = "rotate(0deg)";
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
case "left": {
|
|
244
|
+
this._arrow.style.right = a, r.style.transform = "rotate(270deg)";
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
case "right": {
|
|
248
|
+
this._arrow.style.left = a, r.style.transform = "rotate(90deg)";
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
getArrowVariant(e) {
|
|
256
|
+
if (e.indexOf("bottom") !== -1)
|
|
257
|
+
return "bottom";
|
|
258
|
+
if (e.indexOf("top") !== -1)
|
|
259
|
+
return "top";
|
|
260
|
+
if (e.indexOf("left") !== -1)
|
|
261
|
+
return "left";
|
|
262
|
+
if (e.indexOf("right") !== -1)
|
|
263
|
+
return "right";
|
|
264
|
+
}
|
|
265
|
+
get content() {
|
|
266
|
+
return this._content || (this._content = this.firstElementChild, this._content.setAttribute("data-popper-content", "")), this._content;
|
|
267
|
+
}
|
|
268
|
+
addTargetClassForOpen(e) {
|
|
269
|
+
e && e.classList.add(l);
|
|
270
|
+
}
|
|
271
|
+
removeTargetClassForOpen(e) {
|
|
272
|
+
e && e.classList.remove(l);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
o.ID = "sd-popover";
|
|
276
|
+
let i = o;
|
|
277
|
+
customElements.get(i.ID) || customElements.define(i.ID, i);
|
|
278
|
+
export {
|
|
279
|
+
i as default
|
|
280
|
+
};
|
|
281
|
+
//# sourceMappingURL=popover.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.mjs","sources":["../arrow.svg?raw","../popover.ts"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"24\\\" height=\\\"12\\\" viewBox=\\\"0 0 24 12\\\">\\r\\n <path d=\\\"M0 0l11.96 12L24 0z\\\" fill=\\\"#999\\\" class=\\\"arrow-border\\\"/>\\r\\n <path d=\\\"M12 11L1 0h22z\\\" fill=\\\"#f2f2f2\\\" class=\\\"arrow-background\\\"/>\\r\\n</svg>\\r\\n\"","import { createPopper, Instance as Popper, Options, Placement } from \"@popperjs/core\";\nimport { default as arrowSvg } from \"./arrow.svg?raw\";\n\nconst isIE11 = navigator.userAgent.indexOf(\"Trident\") !== -1;\nconst arrowOverlapOffset = 1;\nconst targetClassOpen = \"sd-popover-open\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Popover.ID]: Popover;\n }\n}\n\nexport type TriggerType = \"click\" | \"hover\" | \"manual\";\nexport type ArrowVariant = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type IOpenEvent = void;\nexport type ICloseEvent = void;\n\nexport interface CustomEventMap extends HTMLElementEventMap {\n open: CustomEvent<IOpenEvent>;\n close: CustomEvent<ICloseEvent>;\n}\n\nexport default interface Popover {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport default class Popover extends HTMLElement {\n public static readonly ID = \"sd-popover\";\n private _open = false;\n private _popper: Popper;\n private _targetElement: HTMLElement;\n private _container: HTMLElement;\n private _arrow: HTMLElement;\n private _content: HTMLElement;\n private _firstUpdated = false;\n private _flipPriority: Placement[];\n private _resizeObserver: ResizeObserver;\n\n public get triggerType(): TriggerType {\n return this.getAttribute(\"trigger-type\") as TriggerType;\n }\n\n public set triggerType(type: TriggerType) {\n if (type) {\n this.setAttribute(\"trigger-type\", type);\n } else {\n this.removeAttribute(\"trigger-type\");\n }\n }\n\n public get placement(): Placement {\n return this.getAttribute(\"placement\") as Placement;\n }\n\n public set placement(placement: Placement) {\n if (placement) {\n this.setAttribute(\"placement\", placement);\n } else {\n this.removeAttribute(\"placement\");\n }\n }\n\n public get targetElement(): HTMLElement {\n return this._targetElement;\n }\n\n public set targetElement(element: HTMLElement) {\n this.removeTargetEventListener(this.targetElement);\n if (this._targetElement && \"true\" == this._targetElement.getAttribute(\"aria-expanded\")) {\n this._targetElement.setAttribute(\"aria-expanded\", \"false\");\n }\n this._targetElement = element;\n element.setAttribute(\"aria-expanded\", \"false\");\n this.addTargetEventListener(this.targetElement);\n this.updatePopper();\n }\n\n public get targetSelector(): string {\n return this.getAttribute(\"target-selector\");\n }\n\n public set targetSelector(selector: string) {\n if (selector) {\n this.setAttribute(\"target-selector\", selector);\n } else {\n this.removeAttribute(\"target-selector\");\n }\n }\n\n public get modal(): boolean {\n return this.hasAttribute(\"modal\");\n }\n\n public set modal(modal: boolean) {\n if (modal) {\n this.setAttribute(\"modal\", \"\");\n } else {\n this.removeAttribute(\"modal\");\n }\n }\n\n public get popoverFor(): string {\n return this.getAttribute(\"popover-for\");\n }\n\n public set popoverFor(popoverFor: string) {\n if (popoverFor) {\n this.setAttribute(\"popover-for\", popoverFor);\n } else {\n this.removeAttribute(\"popover-for\");\n }\n }\n\n public get flipPriority(): Placement[] {\n return this._flipPriority;\n }\n\n public set flipPriority(priority: Placement[]) {\n if (priority && priority.length > 0) {\n this._flipPriority = priority;\n } else {\n this._flipPriority = null;\n }\n this.reConfigurePopper();\n }\n\n public get offset(): number {\n return this.getAttribute(\"offset\") ? parseInt(this.getAttribute(\"offset\")) : 0;\n }\n\n public set offset(offset: number) {\n if (offset) {\n this.setAttribute(\"offset\", offset.toString());\n } else {\n this.removeAttribute(\"offset\");\n }\n this.reConfigurePopper();\n }\n\n private reConfigurePopper() {\n if (this._popper) {\n this.configurePopper();\n }\n }\n\n public get noArrow(): boolean {\n return this.hasAttribute(\"no-arrow\");\n }\n\n public set noArrow(noArrow: boolean) {\n if (noArrow) {\n this.setAttribute(\"no-arrow\", \"\");\n } else {\n this.removeAttribute(\"no-arrow\");\n }\n }\n\n static get observedAttributes(): string[] {\n return [\"placement\", \"target-selector\", \"trigger-type\"];\n }\n\n public attributeChangedCallback(name: string, oldValue: string): void {\n switch (name) {\n case \"placement\": {\n this.updatePopper();\n break;\n }\n case \"trigger-type\": {\n this.removeTargetEventListener(this.targetElement);\n this.addTargetEventListener(this.targetElement);\n break;\n }\n case \"target-selector\": {\n this.handleTargetSelectorChange(oldValue);\n break;\n }\n }\n }\n\n public connectedCallback(): void {\n if (!this._firstUpdated) {\n this.firstUpdated();\n this._firstUpdated = true;\n }\n if (this.targetElement) {\n this.addTargetEventListener(this.targetElement);\n } else if (this.targetSelector) {\n // The browser is currently attaching html nodes to the dom tree, the target may not be present in it yet.\n requestAnimationFrame(() => {\n if (this.isConnected) {\n this.handleTargetSelectorChange(null);\n }\n });\n }\n\n this._arrow = document.createElement(\"div\");\n this._arrow.classList.add(\"popover-arrow\");\n this._arrow.setAttribute(\"data-popper-arrow\", \"\");\n this._arrow.style.display = \"flex\";\n this._arrow.innerHTML = arrowSvg;\n }\n\n public disconnectedCallback(): void {\n if (this.targetElement) {\n this.removeTargetEventListener(this.targetElement);\n this.removeTargetClassForOpen(this.targetElement);\n }\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n this._resizeObserver = null;\n }\n }\n\n public toggle = (): void => {\n this.open = !this.open;\n };\n\n public show = (): void => {\n this.open = true;\n };\n\n public hide = (): void => {\n this.open = false;\n };\n\n private firstUpdated(): void {\n this.style.display = \"none\";\n this.triggerType = this.triggerType || \"click\";\n this.placement = this.placement || \"auto\";\n }\n\n private get open(): boolean {\n return this._open;\n }\n\n private set open(open: boolean) {\n if (open !== this._open) {\n this._open = open;\n this.handleOpenChange();\n }\n }\n\n private handleOpenChange(): void {\n if (this.open) {\n if (!this._popper) {\n this.configurePopper();\n }\n\n this._container.innerHTML = \"\";\n if (this.popoverFor) {\n this._container.setAttribute(\"popover-for\", this.popoverFor);\n }\n if (this.content) {\n this._container.prepend(this.content);\n Object.assign(this.content.style, {\n position: \"relative\",\n display: \"block\",\n zIndex: 1,\n });\n window.requestAnimationFrame(() => {\n let backgroundColor = getComputedStyle(this.content).backgroundColor;\n if (backgroundColor == \"rgba(0, 0, 0, 0)\") {\n this.content.style.background = backgroundColor = \"#f2f2f2\";\n }\n (this._arrow.querySelector(\".arrow-background\") as HTMLElement).style.fill = backgroundColor;\n });\n }\n this.ensureArrowIsAdded();\n this.ownerDocument.body.appendChild(this._container);\n this.updatePopper();\n this.setAttribute(\"open\", \"\");\n\n if (this.modal) {\n window.addEventListener(\"click\", this.hideIfExternalTarget, { capture: true });\n window.addEventListener(\"focus\", this.hideIfExternalTarget, { capture: true });\n }\n if (this.targetElement) {\n this.addTargetClassForOpen(this.targetElement);\n this.targetElement.setAttribute(\"aria-expanded\", \"true\");\n }\n this.dispatchEvent(new CustomEvent(\"open\"));\n } else {\n this.ownerDocument.body.removeChild(this._container);\n this.removeAttribute(\"open\");\n window.removeEventListener(\"click\", this.hideIfExternalTarget, { capture: true });\n window.removeEventListener(\"focus\", this.hideIfExternalTarget, { capture: true });\n\n if (this.targetElement) {\n this.removeTargetClassForOpen(this.targetElement);\n this.targetElement.setAttribute(\"aria-expanded\", \"false\");\n }\n this.dispatchEvent(new CustomEvent(\"close\"));\n }\n }\n\n private hideIfExternalTarget = (event: Event) => {\n const target = event.target;\n if (\n !(target instanceof HTMLElement) ||\n (!this._container.contains(target) && !this.targetElement.contains(target))\n ) {\n this.hide();\n }\n };\n\n private handleTargetSelectorChange(oldValue: string): void {\n const oldTarget = document.querySelector<HTMLElement>(oldValue);\n if (oldTarget) {\n this.removeTargetEventListener(oldTarget);\n this.removeTargetClassForOpen(oldTarget);\n }\n if (this.targetSelector) {\n this.targetElement = document.querySelector(this.targetSelector);\n this.addTargetEventListener(this.targetElement);\n }\n }\n\n private addTargetEventListener(target: HTMLElement): void {\n if (target) {\n switch (this.triggerType) {\n case \"hover\": {\n target.addEventListener(\"mouseenter\", this.show);\n target.addEventListener(\"mouseleave\", this.hide);\n break;\n }\n case \"click\": {\n target.addEventListener(\"click\", this.toggle);\n break;\n }\n }\n }\n }\n\n private removeTargetEventListener(target: HTMLElement): void {\n if (target) {\n switch (this.triggerType) {\n case \"hover\": {\n target.removeEventListener(\"mouseenter\", this.show);\n target.removeEventListener(\"mouseleave\", this.hide);\n break;\n }\n case \"click\": {\n target.removeEventListener(\"click\", this.toggle);\n break;\n }\n }\n }\n }\n\n private configurePopper(): void {\n this.createContentContainer();\n // In popper.js 2 the arrow needs to be added before calling Popper#createPopper\n this.ensureArrowIsAdded();\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const popover = this;\n const options: Options = {\n placement: popover.placement as Placement,\n strategy: \"absolute\",\n modifiers: [\n {\n name: \"computeStyles\",\n options: {\n gpuAcceleration: !isIE11,\n },\n },\n {\n name: \"flip\",\n options: {\n fallbackPlacements: popover._flipPriority,\n },\n },\n {\n name: \"offset\",\n options: {\n offset: () => {\n return [\n 0,\n popover.noArrow ? 0 + popover.offset : this._arrow.clientHeight + popover.offset,\n ];\n },\n },\n },\n {\n name: \"arrow\",\n options: {\n padding: 6, // Avoid to reach the edges of the popper element with the arrow\n },\n },\n {\n name: \"resetArrowStyles\",\n enabled: true,\n phase: \"beforeWrite\",\n fn({ state }) {\n Object.assign(popover._arrow.style, {\n top: state.styles.arrow.top || \"\",\n left: state.styles.arrow.left || \"\",\n bottom: state.styles.arrow.bottom || \"\",\n right: state.styles.arrow.right || \"\",\n });\n },\n },\n {\n name: \"onUpdate\",\n enabled: true,\n phase: \"afterWrite\",\n fn({ state }) {\n popover.updateArrow(state.placement);\n },\n },\n ],\n };\n this._popper = createPopper(this.targetElement, this._container, options);\n }\n\n private createContentContainer(): void {\n this._container = document.createElement(\"div\");\n this._container.classList.add(\"popover-container\");\n this._container.tabIndex = 0;\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n }\n this._resizeObserver = new ResizeObserver(() => {\n if (this._popper) {\n this._popper.update();\n }\n });\n this._resizeObserver.observe(this._container);\n Object.assign(this._container.style, {\n boxShadow: `0 4px 5px 0 rgba(0, 0, 0, 0.14),\n 0 1px 10px 0 rgba(0, 0, 0, 0.12),\n 0 2px 4px -1px rgba(0, 0, 0, 0.4)`,\n border: \"1px solid #999\",\n boxSizing: \"border-box\",\n zIndex: 20000,\n });\n }\n\n private ensureArrowIsAdded() {\n if (!this.noArrow && !this._container.contains(this._arrow)) {\n this._container.appendChild(this._arrow);\n }\n }\n\n public updatePopper(): void {\n if (this._popper) {\n this._popper.state.elements.reference = this.targetElement;\n this._popper.state.options.placement = this.placement;\n\n if (this.open) {\n this._popper.update();\n }\n }\n }\n\n private updateArrow(placement: Placement): void {\n if (this._arrow) {\n const arrowVariant = this.getArrowVariant(placement);\n this._arrow.setAttribute(\"variant\", arrowVariant);\n if (this._content) {\n const svg = this._arrow.querySelector(\"svg\");\n\n const arrowWidth = this._arrow.clientWidth;\n const arrowHeight = this._arrow.clientHeight;\n const verticalOffset = `-${arrowHeight - arrowOverlapOffset}px`;\n\n const horizontalTransformationOffset = (arrowWidth - arrowHeight) / 2;\n // Note that arrowHeight is used on purpose for the horizontalOffset\n // as this is the height of the unrotated wrapper div which defines the gap between the\n // reference element and the popover.\n const horizontalOffset = `-${arrowHeight + horizontalTransformationOffset - arrowOverlapOffset}px`;\n\n switch (arrowVariant) {\n case \"bottom\": {\n this._arrow.style.top = verticalOffset;\n svg.style.transform = \"rotate(180deg)\";\n break;\n }\n case \"top\": {\n this._arrow.style.bottom = verticalOffset;\n svg.style.transform = \"rotate(0deg)\";\n break;\n }\n case \"left\": {\n this._arrow.style.right = horizontalOffset;\n svg.style.transform = \"rotate(270deg)\";\n break;\n }\n case \"right\": {\n this._arrow.style.left = horizontalOffset;\n svg.style.transform = \"rotate(90deg)\";\n break;\n }\n }\n }\n }\n }\n\n private getArrowVariant(placement: Placement): ArrowVariant {\n if (placement.indexOf(\"bottom\") !== -1) {\n return \"bottom\";\n } else if (placement.indexOf(\"top\") !== -1) {\n return \"top\";\n } else if (placement.indexOf(\"left\") !== -1) {\n return \"left\";\n } else if (placement.indexOf(\"right\") !== -1) {\n return \"right\";\n }\n }\n\n private get content(): HTMLElement {\n if (!this._content) {\n this._content = this.firstElementChild as HTMLElement;\n this._content.setAttribute(\"data-popper-content\", \"\");\n }\n return this._content;\n }\n\n private addTargetClassForOpen(target: HTMLElement): void {\n if (target) {\n target.classList.add(targetClassOpen);\n }\n }\n\n private removeTargetClassForOpen(target: HTMLElement): void {\n if (target) {\n target.classList.remove(targetClassOpen);\n }\n }\n}\n\nif (!customElements.get(Popover.ID)) {\n customElements.define(Popover.ID, Popover);\n}\n"],"names":["arrowSvg","isIE11","arrowOverlapOffset","targetClassOpen","_Popover","event","target","type","placement","element","selector","modal","popoverFor","priority","offset","noArrow","name","oldValue","open","backgroundColor","oldTarget","popover","options","state","createPopper","arrowVariant","svg","arrowWidth","arrowHeight","verticalOffset","horizontalTransformationOffset","horizontalOffset","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AAO,MAAM,OAAOK,GACzBL,EAAI,MAAM,YAAY;AACtB;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA,EAEQ,gBAAgBlB,GAAoC;AACxD,QAAIA,EAAU,QAAQ,QAAQ,MAAM;AACzB,aAAA;AACA,QAAAA,EAAU,QAAQ,KAAK,MAAM;AAC7B,aAAA;AACA,QAAAA,EAAU,QAAQ,MAAM,MAAM;AAC9B,aAAA;AACA,QAAAA,EAAU,QAAQ,OAAO,MAAM;AAC/B,aAAA;AAAA,EAEf;AAAA,EAEA,IAAY,UAAuB;AAC3B,WAAC,KAAK,aACN,KAAK,WAAW,KAAK,mBAChB,KAAA,SAAS,aAAa,uBAAuB,EAAE,IAEjD,KAAK;AAAA,EAChB;AAAA,EAEQ,sBAAsBF,GAA2B;AACrD,IAAIA,KACOA,EAAA,UAAU,IAAIH,CAAe;AAAA,EAE5C;AAAA,EAEQ,yBAAyBG,GAA2B;AACxD,IAAIA,KACOA,EAAA,UAAU,OAAOH,CAAe;AAAA,EAE/C;AACJ;AAtfIC,EAAuB,KAAK;AADhC,IAAqB4B,IAArB5B;AAyfK,eAAe,IAAI4B,EAAQ,EAAE,KACf,eAAA,OAAOA,EAAQ,IAAIA,CAAO;"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@cypress/vite-dev-server@5.0.7": {
|
|
3
|
+
"licenses": "MIT",
|
|
4
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
5
|
+
"licenseUrl": "https://github.com/cypress-io/cypress/tree/develop/npm/vite-dev-server#readme"
|
|
6
|
+
},
|
|
7
|
+
"@popperjs/core@2.11.8": {
|
|
8
|
+
"licenses": "MIT",
|
|
9
|
+
"repository": "https://github.com/popperjs/popper-core",
|
|
10
|
+
"licenseUrl": "https://github.com/popperjs/popper-core/raw/HEAD/LICENSE.md"
|
|
11
|
+
},
|
|
12
|
+
"@rollup/plugin-node-resolve@15.2.3": {
|
|
13
|
+
"licenses": "MIT",
|
|
14
|
+
"repository": "https://github.com/rollup/plugins",
|
|
15
|
+
"licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
|
|
16
|
+
},
|
|
17
|
+
"@types/node@20.10.6": {
|
|
18
|
+
"licenses": "MIT",
|
|
19
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
20
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
21
|
+
},
|
|
22
|
+
"@types/postcss-prefix-selector@1.16.3": {
|
|
23
|
+
"licenses": "MIT",
|
|
24
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
25
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
26
|
+
},
|
|
27
|
+
"@typescript-eslint/eslint-plugin@6.17.0": {
|
|
28
|
+
"licenses": "MIT",
|
|
29
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
30
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
31
|
+
},
|
|
32
|
+
"@typescript-eslint/parser@6.17.0": {
|
|
33
|
+
"licenses": "BSD-2-Clause",
|
|
34
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
35
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
36
|
+
},
|
|
37
|
+
"@vitest/coverage-v8@1.1.1": {
|
|
38
|
+
"licenses": "MIT",
|
|
39
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
40
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
41
|
+
},
|
|
42
|
+
"@vitest/ui@1.1.1": {
|
|
43
|
+
"licenses": "MIT",
|
|
44
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
45
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
46
|
+
},
|
|
47
|
+
"axe-core@4.8.3": {
|
|
48
|
+
"licenses": "MPL-2.0",
|
|
49
|
+
"repository": "https://github.com/dequelabs/axe-core",
|
|
50
|
+
"licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
|
|
51
|
+
},
|
|
52
|
+
"cypress-axe@1.5.0": {
|
|
53
|
+
"licenses": "MIT",
|
|
54
|
+
"repository": "https://github.com/component-driven/cypress-axe",
|
|
55
|
+
"licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
|
|
56
|
+
},
|
|
57
|
+
"cypress-real-events@1.13.0": {
|
|
58
|
+
"licenses": "MIT",
|
|
59
|
+
"repository": "https://github.com/dmtrKovalenko/cypress-real-events",
|
|
60
|
+
"licenseUrl": "https://github.com/dmtrKovalenko/cypress-real-events"
|
|
61
|
+
},
|
|
62
|
+
"cypress@13.6.2": {
|
|
63
|
+
"licenses": "MIT",
|
|
64
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
65
|
+
"licenseUrl": "https://cypress.io"
|
|
66
|
+
},
|
|
67
|
+
"esbuild@0.19.11": {
|
|
68
|
+
"licenses": "MIT",
|
|
69
|
+
"repository": "https://github.com/evanw/esbuild",
|
|
70
|
+
"licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
|
|
71
|
+
},
|
|
72
|
+
"eslint-config-google@0.14.0": {
|
|
73
|
+
"licenses": "Apache-2.0",
|
|
74
|
+
"repository": "https://github.com/google/eslint-config-google",
|
|
75
|
+
"licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
|
|
76
|
+
},
|
|
77
|
+
"eslint-config-prettier@9.1.0": {
|
|
78
|
+
"licenses": "MIT",
|
|
79
|
+
"repository": "https://github.com/prettier/eslint-config-prettier",
|
|
80
|
+
"licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
|
|
81
|
+
},
|
|
82
|
+
"eslint@8.56.0": {
|
|
83
|
+
"licenses": "MIT",
|
|
84
|
+
"repository": "https://github.com/eslint/eslint",
|
|
85
|
+
"licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
|
|
86
|
+
},
|
|
87
|
+
"github-markdown-css@5.5.0": {
|
|
88
|
+
"licenses": "MIT",
|
|
89
|
+
"repository": "https://github.com/sindresorhus/github-markdown-css",
|
|
90
|
+
"licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
|
|
91
|
+
},
|
|
92
|
+
"highlight.js@11.9.0": {
|
|
93
|
+
"licenses": "BSD-3-Clause",
|
|
94
|
+
"repository": "https://github.com/highlightjs/highlight.js",
|
|
95
|
+
"licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
|
|
96
|
+
},
|
|
97
|
+
"junit-report-builder@3.1.0": {
|
|
98
|
+
"licenses": "MIT",
|
|
99
|
+
"repository": "https://github.com/davidparsson/junit-report-builder",
|
|
100
|
+
"licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
|
|
101
|
+
},
|
|
102
|
+
"lint-staged@15.2.0": {
|
|
103
|
+
"licenses": "MIT",
|
|
104
|
+
"repository": "https://github.com/okonet/lint-staged",
|
|
105
|
+
"licenseUrl": "https://github.com/okonet/lint-staged/raw/HEAD/LICENSE"
|
|
106
|
+
},
|
|
107
|
+
"marked@11.1.1": {
|
|
108
|
+
"licenses": "MIT",
|
|
109
|
+
"repository": "https://github.com/markedjs/marked",
|
|
110
|
+
"licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
|
|
111
|
+
},
|
|
112
|
+
"postcss-prefix-selector@1.16.0": {
|
|
113
|
+
"licenses": "MIT",
|
|
114
|
+
"repository": "https://github.com/RadValentin/postcss-prefix-selector",
|
|
115
|
+
"licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
|
|
116
|
+
},
|
|
117
|
+
"postcss@8.4.32": {
|
|
118
|
+
"licenses": "MIT",
|
|
119
|
+
"repository": "https://github.com/postcss/postcss",
|
|
120
|
+
"licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
|
|
121
|
+
},
|
|
122
|
+
"prettier@3.1.1": {
|
|
123
|
+
"licenses": "MIT",
|
|
124
|
+
"repository": "https://github.com/prettier/prettier",
|
|
125
|
+
"licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
|
|
126
|
+
},
|
|
127
|
+
"resolve-pkg@2.0.0": {
|
|
128
|
+
"licenses": "MIT",
|
|
129
|
+
"repository": "https://github.com/sindresorhus/resolve-pkg",
|
|
130
|
+
"licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
|
|
131
|
+
},
|
|
132
|
+
"sass@1.69.6": {
|
|
133
|
+
"licenses": "MIT",
|
|
134
|
+
"repository": "https://github.com/sass/dart-sass",
|
|
135
|
+
"licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
|
|
136
|
+
},
|
|
137
|
+
"stylelint-config-recommended-scss@14.0.0": {
|
|
138
|
+
"licenses": "MIT",
|
|
139
|
+
"repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
|
|
140
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
|
|
141
|
+
},
|
|
142
|
+
"stylelint-config-standard@36.0.0": {
|
|
143
|
+
"licenses": "MIT",
|
|
144
|
+
"repository": "https://github.com/stylelint/stylelint-config-standard",
|
|
145
|
+
"licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
|
|
146
|
+
},
|
|
147
|
+
"stylelint-scss@6.0.0": {
|
|
148
|
+
"licenses": "MIT",
|
|
149
|
+
"repository": "https://github.com/stylelint-scss/stylelint-scss",
|
|
150
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
|
|
151
|
+
},
|
|
152
|
+
"stylelint@16.1.0": {
|
|
153
|
+
"licenses": "MIT",
|
|
154
|
+
"repository": "https://github.com/stylelint/stylelint",
|
|
155
|
+
"licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
|
|
156
|
+
},
|
|
157
|
+
"tsup@8.0.1": {
|
|
158
|
+
"licenses": "MIT",
|
|
159
|
+
"repository": "https://github.com/egoist/tsup",
|
|
160
|
+
"licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
|
|
161
|
+
},
|
|
162
|
+
"turbo@1.11.2": {
|
|
163
|
+
"licenses": "MPL-2.0",
|
|
164
|
+
"repository": "https://github.com/vercel/turbo",
|
|
165
|
+
"licenseUrl": "https://github.com/vercel/turbo/raw/HEAD/LICENSE"
|
|
166
|
+
},
|
|
167
|
+
"typescript@5.3.3": {
|
|
168
|
+
"licenses": "Apache-2.0",
|
|
169
|
+
"repository": "https://github.com/Microsoft/TypeScript",
|
|
170
|
+
"licenseUrl": "https://github.com/Microsoft/TypeScript/raw/HEAD/LICENSE.txt"
|
|
171
|
+
},
|
|
172
|
+
"vite-tsconfig-paths@4.2.3": {
|
|
173
|
+
"licenses": "MIT",
|
|
174
|
+
"repository": "https://github.com/aleclarson/vite-tsconfig-paths",
|
|
175
|
+
"licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
|
|
176
|
+
},
|
|
177
|
+
"vite@5.0.10": {
|
|
178
|
+
"licenses": "MIT",
|
|
179
|
+
"repository": "https://github.com/vitejs/vite",
|
|
180
|
+
"licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
|
|
181
|
+
},
|
|
182
|
+
"vitest@1.1.1": {
|
|
183
|
+
"licenses": "MIT",
|
|
184
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
185
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
|
|
186
|
+
},
|
|
187
|
+
"yargs@17.7.2": {
|
|
188
|
+
"licenses": "MIT",
|
|
189
|
+
"repository": "https://github.com/yargs/yargs",
|
|
190
|
+
"licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
|
|
191
|
+
}
|
|
192
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cas-smartdesign/popover",
|
|
3
|
+
"version": "4.1.1",
|
|
4
|
+
"description": "A popover element which appears next to its target when triggered",
|
|
5
|
+
"main": "dist/popover-with-externals.js",
|
|
6
|
+
"module": "dist/popover.mjs",
|
|
7
|
+
"types": "dist/popover.d.ts",
|
|
8
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@popperjs/core": "^2.11.8"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"npm-third-party-licenses.json"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"registry": "https://registry.npmjs.org/",
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@cas-smartdesign/element-preview": "^0.2.1",
|
|
22
|
+
"@cas-smartdesign/license-generator": "^1.6.1"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"version": "pnpm version",
|
|
26
|
+
"generate-declaration": "tsc -p tsconfig.types.json",
|
|
27
|
+
"build:no-license": "vite build && pnpm generate-declaration && vite build --mode documentation",
|
|
28
|
+
"build": "pnpm generate-license && pnpm build:no-license",
|
|
29
|
+
"watch": "vite build --watch",
|
|
30
|
+
"dev": "vite",
|
|
31
|
+
"generate-license": "sd-license-generator --r ../../"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @cas-smartdesign/popover
|
|
2
|
+
|
|
3
|
+
A popover element with SmartDesign look & feel.
|
|
4
|
+
|
|
5
|
+
## Attributes
|
|
6
|
+
|
|
7
|
+
- `placement`: **_string (default: "auto")_**
|
|
8
|
+
- Defines the placement of the popper relative to the reference element
|
|
9
|
+
- Valid placements are: `auto`, `top`, `right`, `bottom`, `left`
|
|
10
|
+
- Each placement can have a variation from this list: `-start`, `-end`
|
|
11
|
+
- The `auto` placement will place the window on the side with more space available.
|
|
12
|
+
- `target-selector`: **_string (default: "")_**
|
|
13
|
+
- Defines the selector to use to find the target element
|
|
14
|
+
- `trigger-type` **_string (default: "click")_**
|
|
15
|
+
- Defines the type of event for which the popover should open
|
|
16
|
+
- Valid values are:
|
|
17
|
+
- `click` - clicking on the target element
|
|
18
|
+
- `hover` - moving the cursor on the target element
|
|
19
|
+
- `manual` - no event handler will be set up, the popover can be opened programatically by calling the `show` method and hid by calling the `hide` method
|
|
20
|
+
- `modal` **_boolean (default: false)_**
|
|
21
|
+
- Defines whether the popover is modal and closed on clicks or focusing outside of the content or target element.
|
|
22
|
+
- `no-arrow` **_boolean (default: false)_**
|
|
23
|
+
- Defines whether the popover contains an arrow pointing to the reference element.
|
|
24
|
+
- `popover-for` **_string (default: "")_**
|
|
25
|
+
- This value is mirrored to the opened popover-container.
|
|
26
|
+
- By that the popover can be identified for example for styling purposes.
|
|
27
|
+
- `offset` **_string (default: "0")_**
|
|
28
|
+
- The offset attribute lets you displace a popper element from its reference element.
|
|
29
|
+
|
|
30
|
+
## Properties
|
|
31
|
+
|
|
32
|
+
- `placement`: Placement
|
|
33
|
+
- Reflects the corresponding attribute
|
|
34
|
+
- `targetSelector`: string
|
|
35
|
+
- Reflects the corresponding attribute
|
|
36
|
+
- `triggerType`: TriggerType
|
|
37
|
+
- Reflects the corresponding attribute
|
|
38
|
+
- `modal`: boolean
|
|
39
|
+
- Reflects the corresponding attribute
|
|
40
|
+
- `noArrow`: boolean
|
|
41
|
+
- Reflects the corresponding attribute
|
|
42
|
+
- `popoverFor`: string
|
|
43
|
+
- Reflects the corresponding attribute
|
|
44
|
+
- `flipPriority`: Position[]
|
|
45
|
+
- Defines the preferred order of positions to place the window in order to prevent overflow
|
|
46
|
+
- `offset`: number
|
|
47
|
+
- Reflects the correspondig attribute
|
|
48
|
+
|
|
49
|
+
## Public methods
|
|
50
|
+
|
|
51
|
+
- `show`
|
|
52
|
+
- Sets the `open` attribute to true, thus showing the popover
|
|
53
|
+
- `hide`
|
|
54
|
+
- Sets the `open` attribute to false, thus hiding the popover
|
|
55
|
+
- `toggle`
|
|
56
|
+
- Negates the value of the `open` attribute
|
|
57
|
+
|
|
58
|
+
## Custom events
|
|
59
|
+
|
|
60
|
+
- `open`
|
|
61
|
+
- Dispatched when the popover has opened.
|
|
62
|
+
- `close`
|
|
63
|
+
- Dispatched when the popover has closed.
|
|
64
|
+
|
|
65
|
+
## Adding a child element
|
|
66
|
+
|
|
67
|
+
- The first child element represents the content of the popover window.
|
|
68
|
+
|
|
69
|
+
## Examples
|