@synergy-design-system/components 1.4.1 → 1.5.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/dist/chunks/chunk.3B24TYVN.js +51 -0
- package/dist/chunks/chunk.3B24TYVN.js.map +7 -0
- package/dist/chunks/{chunk.H4N7OLXW.js → chunk.4S6GR2Q7.js} +2 -2
- package/dist/chunks/{chunk.76T4PEW3.js → chunk.4STUWO3B.js} +3 -3
- package/dist/chunks/{chunk.KWUT7GQA.js → chunk.5FCLDQKW.js} +3 -3
- package/dist/chunks/{chunk.GEV4IJII.js → chunk.64EZRK2A.js} +2 -2
- package/dist/chunks/chunk.6XU6OLZ3.js +310 -0
- package/dist/chunks/chunk.6XU6OLZ3.js.map +7 -0
- package/dist/chunks/{chunk.A77SRYT2.js → chunk.7MHXK5XU.js} +2 -2
- package/dist/chunks/chunk.BQG5LF7J.js +47 -0
- package/dist/chunks/chunk.BQG5LF7J.js.map +7 -0
- package/dist/chunks/{chunk.JYBYORNL.js → chunk.D3VKCPDE.js} +6 -6
- package/dist/chunks/{chunk.OSOFK3JT.js → chunk.DLPNGATM.js} +2 -2
- package/dist/chunks/{chunk.WNPKDJ4G.js → chunk.DVCDA2IN.js} +8 -8
- package/dist/chunks/{chunk.KQCYBRJJ.js → chunk.FXTLCVXC.js} +2 -2
- package/dist/chunks/chunk.GVCB2D7B.js +12 -0
- package/dist/chunks/chunk.GVCB2D7B.js.map +7 -0
- package/dist/chunks/{chunk.FTXTH5TS.js → chunk.I3FGUPLH.js} +3 -3
- package/dist/chunks/chunk.IFDNGB63.js +96 -0
- package/dist/chunks/chunk.IFDNGB63.js.map +7 -0
- package/dist/chunks/chunk.IFE4G4PB.js +12 -0
- package/dist/chunks/chunk.IFE4G4PB.js.map +7 -0
- package/dist/chunks/{chunk.MWDOOCSU.js → chunk.IKKMWFWH.js} +2 -2
- package/dist/chunks/{chunk.JMETBEU6.js → chunk.JDDBS57F.js} +3 -3
- package/dist/chunks/chunk.JN7CLMQZ.js +53 -0
- package/dist/chunks/chunk.JN7CLMQZ.js.map +7 -0
- package/dist/chunks/{chunk.IUC3AWAU.js → chunk.K55MKNUR.js} +7 -7
- package/dist/chunks/chunk.K55MKNUR.js.map +7 -0
- package/dist/chunks/{chunk.T5GFDZAG.js → chunk.K5NVNHHD.js} +2 -2
- package/dist/chunks/{chunk.AR7MHBEC.js → chunk.KG3FXWCX.js} +3 -3
- package/dist/chunks/chunk.KG52EHDB.js +60 -0
- package/dist/chunks/chunk.KG52EHDB.js.map +7 -0
- package/dist/chunks/{chunk.ND73VYBT.js → chunk.KRTGIYIX.js} +2 -2
- package/dist/chunks/{chunk.LL3W2QAU.js → chunk.M3P4B2GP.js} +3 -3
- package/dist/chunks/{chunk.SPBKTD7Y.js → chunk.O5XNATYN.js} +2 -2
- package/dist/chunks/{chunk.5VSN3F2E.js → chunk.OAIA6MLB.js} +2 -2
- package/dist/chunks/{chunk.CQ2JMH2J.js → chunk.OJ4KOC7R.js} +2 -2
- package/dist/chunks/{chunk.QTQBU2M5.js → chunk.OKG27K27.js} +2 -2
- package/dist/chunks/chunk.OWMT6OL2.js +82 -0
- package/dist/chunks/chunk.OWMT6OL2.js.map +7 -0
- package/dist/chunks/{chunk.H3LRV4ST.js → chunk.QCDOK7E4.js} +2 -2
- package/dist/chunks/{chunk.XBVEUULD.js → chunk.QPANY6PY.js} +2 -2
- package/dist/chunks/chunk.SAGHXH7E.js +334 -0
- package/dist/chunks/chunk.SAGHXH7E.js.map +7 -0
- package/dist/chunks/{chunk.6LIMUIEF.js → chunk.SLW5NPQB.js} +2 -2
- package/dist/chunks/{chunk.Z2DLW3SL.js → chunk.T72SACBE.js} +2 -2
- package/dist/chunks/{chunk.Z2DLW3SL.js.map → chunk.T72SACBE.js.map} +1 -1
- package/dist/chunks/{chunk.5Y446GHK.js → chunk.UBTUEIMR.js} +2 -2
- package/dist/chunks/chunk.UTDK2ZT6.js +811 -0
- package/dist/chunks/chunk.UTDK2ZT6.js.map +7 -0
- package/dist/chunks/{chunk.GM3M672E.js → chunk.UYYPTTK2.js} +2 -2
- package/dist/chunks/{chunk.MTDXRKO3.js → chunk.V57DLRD2.js} +2 -2
- package/dist/chunks/{chunk.Q5UI2GVL.js → chunk.VIQZQ3S6.js} +2 -2
- package/dist/chunks/chunk.W6V7TPGK.js +104 -0
- package/dist/chunks/chunk.W6V7TPGK.js.map +7 -0
- package/dist/chunks/{chunk.XRZUXWQE.js → chunk.X4L3ZC6K.js} +2 -2
- package/dist/chunks/chunk.XFLQL2QO.js +132 -0
- package/dist/chunks/chunk.XFLQL2QO.js.map +7 -0
- package/dist/chunks/{chunk.6TJHEFXA.js → chunk.XSFEPYWK.js} +2 -2
- package/dist/chunks/chunk.YN2IXOBF.js +12 -0
- package/dist/chunks/chunk.YN2IXOBF.js.map +7 -0
- package/dist/components/button/button.component.js +7 -7
- package/dist/components/button/button.custom.styles.js +1 -1
- package/dist/components/button/button.js +8 -8
- package/dist/components/button/button.styles.js +2 -2
- package/dist/components/button-group/button-group.component.js +2 -2
- package/dist/components/button-group/button-group.js +3 -3
- package/dist/components/checkbox/checkbox.component.js +3 -3
- package/dist/components/checkbox/checkbox.js +4 -4
- package/dist/components/divider/divider.component.js +2 -2
- package/dist/components/divider/divider.js +3 -3
- package/dist/components/icon/icon.component.js +2 -2
- package/dist/components/icon/icon.js +3 -3
- package/dist/components/icon-button/icon-button.component.js +3 -3
- package/dist/components/icon-button/icon-button.js +4 -4
- package/dist/components/input/input.component.js +4 -4
- package/dist/components/input/input.js +5 -5
- package/dist/components/optgroup/optgroup.component.d.ts +47 -0
- package/dist/components/optgroup/optgroup.component.js +16 -0
- package/dist/components/optgroup/optgroup.component.js.map +7 -0
- package/dist/components/optgroup/optgroup.d.ts +8 -0
- package/dist/components/optgroup/optgroup.js +17 -0
- package/dist/components/optgroup/optgroup.js.map +7 -0
- package/dist/components/optgroup/optgroup.styles.d.ts +2 -0
- package/dist/components/optgroup/optgroup.styles.js +8 -0
- package/dist/components/optgroup/optgroup.styles.js.map +7 -0
- package/dist/components/option/option.component.d.ts +51 -0
- package/dist/components/option/option.component.js +22 -0
- package/dist/components/option/option.component.js.map +7 -0
- package/dist/components/option/option.custom.styles.d.ts +2 -0
- package/dist/components/option/option.custom.styles.js +8 -0
- package/dist/components/option/option.custom.styles.js.map +7 -0
- package/dist/components/option/option.d.ts +8 -0
- package/dist/components/option/option.js +23 -0
- package/dist/components/option/option.js.map +7 -0
- package/dist/components/option/option.styles.d.ts +2 -0
- package/dist/components/option/option.styles.js +10 -0
- package/dist/components/option/option.styles.js.map +7 -0
- package/dist/components/popup/popup.component.d.ts +139 -0
- package/dist/components/popup/popup.component.js +11 -0
- package/dist/components/popup/popup.component.js.map +7 -0
- package/dist/components/popup/popup.styles.d.ts +2 -0
- package/dist/components/popup/popup.styles.js +9 -0
- package/dist/components/popup/popup.styles.js.map +7 -0
- package/dist/components/radio/radio.component.js +3 -3
- package/dist/components/radio/radio.js +4 -4
- package/dist/components/radio-button/radio-button.component.js +5 -5
- package/dist/components/radio-button/radio-button.js +6 -6
- package/dist/components/radio-button/radio-button.styles.js +3 -3
- package/dist/components/radio-group/radio-group.component.js +3 -3
- package/dist/components/radio-group/radio-group.js +4 -4
- package/dist/components/select/select.component.d.ts +180 -0
- package/dist/components/select/select.component.js +35 -0
- package/dist/components/select/select.component.js.map +7 -0
- package/dist/components/select/select.custom.styles.d.ts +2 -0
- package/dist/components/select/select.custom.styles.js +8 -0
- package/dist/components/select/select.custom.styles.js.map +7 -0
- package/dist/components/select/select.d.ts +8 -0
- package/dist/components/select/select.js +36 -0
- package/dist/components/select/select.js.map +7 -0
- package/dist/components/select/select.styles.d.ts +2 -0
- package/dist/components/select/select.styles.js +11 -0
- package/dist/components/select/select.styles.js.map +7 -0
- package/dist/components/spinner/spinner.component.js +2 -2
- package/dist/components/switch/switch.component.js +2 -2
- package/dist/components/switch/switch.js +3 -3
- package/dist/components/tag/tag.component.js +4 -4
- package/dist/components/tag/tag.js +5 -5
- package/dist/components/textarea/textarea.component.js +2 -2
- package/dist/components/textarea/textarea.js +3 -3
- package/dist/custom-elements.json +2376 -556
- package/dist/events/events.d.ts +5 -0
- package/dist/events/syn-after-hide.d.ts +6 -0
- package/dist/events/syn-after-show.d.ts +6 -0
- package/dist/events/syn-hide.d.ts +6 -0
- package/dist/events/syn-reposition.d.ts +6 -0
- package/dist/events/syn-show.d.ts +6 -0
- package/dist/internal/animate.d.ts +22 -0
- package/dist/internal/event.d.ts +2 -0
- package/dist/internal/offset.d.ts +11 -0
- package/dist/internal/scroll.d.ts +11 -0
- package/dist/synergy.d.ts +3 -0
- package/dist/synergy.js +64 -41
- package/dist/utilities/animation-registry.d.ts +24 -0
- package/dist/utilities/animation-registry.js +12 -0
- package/dist/utilities/animation-registry.js.map +7 -0
- package/dist/vscode.html-custom-data.json +304 -17
- package/dist/web-types.json +664 -30
- package/package.json +6 -3
- package/dist/chunks/chunk.IUC3AWAU.js.map +0 -7
- /package/dist/chunks/{chunk.H4N7OLXW.js.map → chunk.4S6GR2Q7.js.map} +0 -0
- /package/dist/chunks/{chunk.76T4PEW3.js.map → chunk.4STUWO3B.js.map} +0 -0
- /package/dist/chunks/{chunk.KWUT7GQA.js.map → chunk.5FCLDQKW.js.map} +0 -0
- /package/dist/chunks/{chunk.GEV4IJII.js.map → chunk.64EZRK2A.js.map} +0 -0
- /package/dist/chunks/{chunk.A77SRYT2.js.map → chunk.7MHXK5XU.js.map} +0 -0
- /package/dist/chunks/{chunk.JYBYORNL.js.map → chunk.D3VKCPDE.js.map} +0 -0
- /package/dist/chunks/{chunk.OSOFK3JT.js.map → chunk.DLPNGATM.js.map} +0 -0
- /package/dist/chunks/{chunk.WNPKDJ4G.js.map → chunk.DVCDA2IN.js.map} +0 -0
- /package/dist/chunks/{chunk.KQCYBRJJ.js.map → chunk.FXTLCVXC.js.map} +0 -0
- /package/dist/chunks/{chunk.FTXTH5TS.js.map → chunk.I3FGUPLH.js.map} +0 -0
- /package/dist/chunks/{chunk.MWDOOCSU.js.map → chunk.IKKMWFWH.js.map} +0 -0
- /package/dist/chunks/{chunk.JMETBEU6.js.map → chunk.JDDBS57F.js.map} +0 -0
- /package/dist/chunks/{chunk.T5GFDZAG.js.map → chunk.K5NVNHHD.js.map} +0 -0
- /package/dist/chunks/{chunk.AR7MHBEC.js.map → chunk.KG3FXWCX.js.map} +0 -0
- /package/dist/chunks/{chunk.ND73VYBT.js.map → chunk.KRTGIYIX.js.map} +0 -0
- /package/dist/chunks/{chunk.LL3W2QAU.js.map → chunk.M3P4B2GP.js.map} +0 -0
- /package/dist/chunks/{chunk.SPBKTD7Y.js.map → chunk.O5XNATYN.js.map} +0 -0
- /package/dist/chunks/{chunk.5VSN3F2E.js.map → chunk.OAIA6MLB.js.map} +0 -0
- /package/dist/chunks/{chunk.CQ2JMH2J.js.map → chunk.OJ4KOC7R.js.map} +0 -0
- /package/dist/chunks/{chunk.QTQBU2M5.js.map → chunk.OKG27K27.js.map} +0 -0
- /package/dist/chunks/{chunk.H3LRV4ST.js.map → chunk.QCDOK7E4.js.map} +0 -0
- /package/dist/chunks/{chunk.XBVEUULD.js.map → chunk.QPANY6PY.js.map} +0 -0
- /package/dist/chunks/{chunk.6LIMUIEF.js.map → chunk.SLW5NPQB.js.map} +0 -0
- /package/dist/chunks/{chunk.5Y446GHK.js.map → chunk.UBTUEIMR.js.map} +0 -0
- /package/dist/chunks/{chunk.GM3M672E.js.map → chunk.UYYPTTK2.js.map} +0 -0
- /package/dist/chunks/{chunk.MTDXRKO3.js.map → chunk.V57DLRD2.js.map} +0 -0
- /package/dist/chunks/{chunk.Q5UI2GVL.js.map → chunk.VIQZQ3S6.js.map} +0 -0
- /package/dist/chunks/{chunk.XRZUXWQE.js.map → chunk.X4L3ZC6K.js.map} +0 -0
- /package/dist/chunks/{chunk.6TJHEFXA.js.map → chunk.XSFEPYWK.js.map} +0 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import {
|
|
2
|
+
popup_styles_default
|
|
3
|
+
} from "./chunk.JN7CLMQZ.js";
|
|
4
|
+
import {
|
|
5
|
+
SynergyElement
|
|
6
|
+
} from "./chunk.T72SACBE.js";
|
|
7
|
+
import {
|
|
8
|
+
__decorateClass,
|
|
9
|
+
__spreadProps,
|
|
10
|
+
__spreadValues
|
|
11
|
+
} from "./chunk.DJOAQ4JU.js";
|
|
12
|
+
|
|
13
|
+
// src/components/popup/popup.component.ts
|
|
14
|
+
import { arrow, autoUpdate, computePosition, flip, offset, platform, shift, size } from "@floating-ui/dom";
|
|
15
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
16
|
+
import { html } from "lit";
|
|
17
|
+
import { offsetParent } from "composed-offset-position";
|
|
18
|
+
import { property, query } from "lit/decorators.js";
|
|
19
|
+
function isVirtualElement(e) {
|
|
20
|
+
return e !== null && typeof e === "object" && "getBoundingClientRect" in e;
|
|
21
|
+
}
|
|
22
|
+
var SynPopup = class extends SynergyElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.active = false;
|
|
26
|
+
this.placement = "top";
|
|
27
|
+
this.strategy = "absolute";
|
|
28
|
+
this.distance = 0;
|
|
29
|
+
this.skidding = 0;
|
|
30
|
+
this.arrow = false;
|
|
31
|
+
this.arrowPlacement = "anchor";
|
|
32
|
+
this.arrowPadding = 10;
|
|
33
|
+
this.flip = false;
|
|
34
|
+
this.flipFallbackPlacements = "";
|
|
35
|
+
this.flipFallbackStrategy = "best-fit";
|
|
36
|
+
this.flipPadding = 0;
|
|
37
|
+
this.shift = false;
|
|
38
|
+
this.shiftPadding = 0;
|
|
39
|
+
this.autoSizePadding = 0;
|
|
40
|
+
}
|
|
41
|
+
async connectedCallback() {
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
await this.updateComplete;
|
|
44
|
+
this.start();
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
super.disconnectedCallback();
|
|
48
|
+
this.stop();
|
|
49
|
+
}
|
|
50
|
+
async updated(changedProps) {
|
|
51
|
+
super.updated(changedProps);
|
|
52
|
+
if (changedProps.has("active")) {
|
|
53
|
+
if (this.active) {
|
|
54
|
+
this.start();
|
|
55
|
+
} else {
|
|
56
|
+
this.stop();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (changedProps.has("anchor")) {
|
|
60
|
+
this.handleAnchorChange();
|
|
61
|
+
}
|
|
62
|
+
if (this.active) {
|
|
63
|
+
await this.updateComplete;
|
|
64
|
+
this.reposition();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async handleAnchorChange() {
|
|
68
|
+
await this.stop();
|
|
69
|
+
if (this.anchor && typeof this.anchor === "string") {
|
|
70
|
+
const root = this.getRootNode();
|
|
71
|
+
this.anchorEl = root.getElementById(this.anchor);
|
|
72
|
+
} else if (this.anchor instanceof Element || isVirtualElement(this.anchor)) {
|
|
73
|
+
this.anchorEl = this.anchor;
|
|
74
|
+
} else {
|
|
75
|
+
this.anchorEl = this.querySelector('[slot="anchor"]');
|
|
76
|
+
}
|
|
77
|
+
if (this.anchorEl instanceof HTMLSlotElement) {
|
|
78
|
+
this.anchorEl = this.anchorEl.assignedElements({ flatten: true })[0];
|
|
79
|
+
}
|
|
80
|
+
if (this.anchorEl) {
|
|
81
|
+
this.start();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
start() {
|
|
85
|
+
if (!this.anchorEl) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {
|
|
89
|
+
this.reposition();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async stop() {
|
|
93
|
+
return new Promise((resolve) => {
|
|
94
|
+
if (this.cleanup) {
|
|
95
|
+
this.cleanup();
|
|
96
|
+
this.cleanup = void 0;
|
|
97
|
+
this.removeAttribute("data-current-placement");
|
|
98
|
+
this.style.removeProperty("--auto-size-available-width");
|
|
99
|
+
this.style.removeProperty("--auto-size-available-height");
|
|
100
|
+
requestAnimationFrame(() => resolve());
|
|
101
|
+
} else {
|
|
102
|
+
resolve();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** Forces the popup to recalculate and reposition itself. */
|
|
107
|
+
reposition() {
|
|
108
|
+
if (!this.active || !this.anchorEl) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const middleware = [
|
|
112
|
+
// The offset middleware goes first
|
|
113
|
+
offset({ mainAxis: this.distance, crossAxis: this.skidding })
|
|
114
|
+
];
|
|
115
|
+
if (this.sync) {
|
|
116
|
+
middleware.push(
|
|
117
|
+
size({
|
|
118
|
+
apply: ({ rects }) => {
|
|
119
|
+
const syncWidth = this.sync === "width" || this.sync === "both";
|
|
120
|
+
const syncHeight = this.sync === "height" || this.sync === "both";
|
|
121
|
+
this.popup.style.width = syncWidth ? `${rects.reference.width}px` : "";
|
|
122
|
+
this.popup.style.height = syncHeight ? `${rects.reference.height}px` : "";
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
} else {
|
|
127
|
+
this.popup.style.width = "";
|
|
128
|
+
this.popup.style.height = "";
|
|
129
|
+
}
|
|
130
|
+
if (this.flip) {
|
|
131
|
+
middleware.push(
|
|
132
|
+
flip({
|
|
133
|
+
boundary: this.flipBoundary,
|
|
134
|
+
// @ts-expect-error - We're converting a string attribute to an array here
|
|
135
|
+
fallbackPlacements: this.flipFallbackPlacements,
|
|
136
|
+
fallbackStrategy: this.flipFallbackStrategy === "best-fit" ? "bestFit" : "initialPlacement",
|
|
137
|
+
padding: this.flipPadding
|
|
138
|
+
})
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
if (this.shift) {
|
|
142
|
+
middleware.push(
|
|
143
|
+
shift({
|
|
144
|
+
boundary: this.shiftBoundary,
|
|
145
|
+
padding: this.shiftPadding
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
if (this.autoSize) {
|
|
150
|
+
middleware.push(
|
|
151
|
+
size({
|
|
152
|
+
boundary: this.autoSizeBoundary,
|
|
153
|
+
padding: this.autoSizePadding,
|
|
154
|
+
apply: ({ availableWidth, availableHeight }) => {
|
|
155
|
+
if (this.autoSize === "vertical" || this.autoSize === "both") {
|
|
156
|
+
this.style.setProperty("--auto-size-available-height", `${availableHeight}px`);
|
|
157
|
+
} else {
|
|
158
|
+
this.style.removeProperty("--auto-size-available-height");
|
|
159
|
+
}
|
|
160
|
+
if (this.autoSize === "horizontal" || this.autoSize === "both") {
|
|
161
|
+
this.style.setProperty("--auto-size-available-width", `${availableWidth}px`);
|
|
162
|
+
} else {
|
|
163
|
+
this.style.removeProperty("--auto-size-available-width");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
} else {
|
|
169
|
+
this.style.removeProperty("--auto-size-available-width");
|
|
170
|
+
this.style.removeProperty("--auto-size-available-height");
|
|
171
|
+
}
|
|
172
|
+
if (this.arrow) {
|
|
173
|
+
middleware.push(
|
|
174
|
+
arrow({
|
|
175
|
+
element: this.arrowEl,
|
|
176
|
+
padding: this.arrowPadding
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
const getOffsetParent = this.strategy === "absolute" ? (element) => platform.getOffsetParent(element, offsetParent) : platform.getOffsetParent;
|
|
181
|
+
computePosition(this.anchorEl, this.popup, {
|
|
182
|
+
placement: this.placement,
|
|
183
|
+
middleware,
|
|
184
|
+
strategy: this.strategy,
|
|
185
|
+
platform: __spreadProps(__spreadValues({}, platform), {
|
|
186
|
+
getOffsetParent
|
|
187
|
+
})
|
|
188
|
+
}).then(({ x, y, middlewareData, placement }) => {
|
|
189
|
+
const isRtl = getComputedStyle(this).direction === "rtl";
|
|
190
|
+
const staticSide = { top: "bottom", right: "left", bottom: "top", left: "right" }[placement.split("-")[0]];
|
|
191
|
+
this.setAttribute("data-current-placement", placement);
|
|
192
|
+
Object.assign(this.popup.style, {
|
|
193
|
+
left: `${x}px`,
|
|
194
|
+
top: `${y}px`
|
|
195
|
+
});
|
|
196
|
+
if (this.arrow) {
|
|
197
|
+
const arrowX = middlewareData.arrow.x;
|
|
198
|
+
const arrowY = middlewareData.arrow.y;
|
|
199
|
+
let top = "";
|
|
200
|
+
let right = "";
|
|
201
|
+
let bottom = "";
|
|
202
|
+
let left = "";
|
|
203
|
+
if (this.arrowPlacement === "start") {
|
|
204
|
+
const value = typeof arrowX === "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
|
|
205
|
+
top = typeof arrowY === "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
|
|
206
|
+
right = isRtl ? value : "";
|
|
207
|
+
left = isRtl ? "" : value;
|
|
208
|
+
} else if (this.arrowPlacement === "end") {
|
|
209
|
+
const value = typeof arrowX === "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
|
|
210
|
+
right = isRtl ? "" : value;
|
|
211
|
+
left = isRtl ? value : "";
|
|
212
|
+
bottom = typeof arrowY === "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
|
|
213
|
+
} else if (this.arrowPlacement === "center") {
|
|
214
|
+
left = typeof arrowX === "number" ? `calc(50% - var(--arrow-size-diagonal))` : "";
|
|
215
|
+
top = typeof arrowY === "number" ? `calc(50% - var(--arrow-size-diagonal))` : "";
|
|
216
|
+
} else {
|
|
217
|
+
left = typeof arrowX === "number" ? `${arrowX}px` : "";
|
|
218
|
+
top = typeof arrowY === "number" ? `${arrowY}px` : "";
|
|
219
|
+
}
|
|
220
|
+
Object.assign(this.arrowEl.style, {
|
|
221
|
+
top,
|
|
222
|
+
right,
|
|
223
|
+
bottom,
|
|
224
|
+
left,
|
|
225
|
+
[staticSide]: "calc(var(--arrow-size-diagonal) * -1)"
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
this.emit("syn-reposition");
|
|
230
|
+
}
|
|
231
|
+
render() {
|
|
232
|
+
return html`
|
|
233
|
+
<slot name="anchor" @slotchange=${this.handleAnchorChange}></slot>
|
|
234
|
+
|
|
235
|
+
<div
|
|
236
|
+
part="popup"
|
|
237
|
+
class=${classMap({
|
|
238
|
+
popup: true,
|
|
239
|
+
"popup--active": this.active,
|
|
240
|
+
"popup--fixed": this.strategy === "fixed",
|
|
241
|
+
"popup--has-arrow": this.arrow
|
|
242
|
+
})}
|
|
243
|
+
>
|
|
244
|
+
<slot></slot>
|
|
245
|
+
${this.arrow ? html`<div part="arrow" class="popup__arrow" role="presentation"></div>` : ""}
|
|
246
|
+
</div>
|
|
247
|
+
`;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
SynPopup.styles = popup_styles_default;
|
|
251
|
+
__decorateClass([
|
|
252
|
+
query(".popup")
|
|
253
|
+
], SynPopup.prototype, "popup", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
query(".popup__arrow")
|
|
256
|
+
], SynPopup.prototype, "arrowEl", 2);
|
|
257
|
+
__decorateClass([
|
|
258
|
+
property()
|
|
259
|
+
], SynPopup.prototype, "anchor", 2);
|
|
260
|
+
__decorateClass([
|
|
261
|
+
property({ type: Boolean, reflect: true })
|
|
262
|
+
], SynPopup.prototype, "active", 2);
|
|
263
|
+
__decorateClass([
|
|
264
|
+
property({ reflect: true })
|
|
265
|
+
], SynPopup.prototype, "placement", 2);
|
|
266
|
+
__decorateClass([
|
|
267
|
+
property({ reflect: true })
|
|
268
|
+
], SynPopup.prototype, "strategy", 2);
|
|
269
|
+
__decorateClass([
|
|
270
|
+
property({ type: Number })
|
|
271
|
+
], SynPopup.prototype, "distance", 2);
|
|
272
|
+
__decorateClass([
|
|
273
|
+
property({ type: Number })
|
|
274
|
+
], SynPopup.prototype, "skidding", 2);
|
|
275
|
+
__decorateClass([
|
|
276
|
+
property({ type: Boolean })
|
|
277
|
+
], SynPopup.prototype, "arrow", 2);
|
|
278
|
+
__decorateClass([
|
|
279
|
+
property({ attribute: "arrow-placement" })
|
|
280
|
+
], SynPopup.prototype, "arrowPlacement", 2);
|
|
281
|
+
__decorateClass([
|
|
282
|
+
property({ attribute: "arrow-padding", type: Number })
|
|
283
|
+
], SynPopup.prototype, "arrowPadding", 2);
|
|
284
|
+
__decorateClass([
|
|
285
|
+
property({ type: Boolean })
|
|
286
|
+
], SynPopup.prototype, "flip", 2);
|
|
287
|
+
__decorateClass([
|
|
288
|
+
property({
|
|
289
|
+
attribute: "flip-fallback-placements",
|
|
290
|
+
converter: {
|
|
291
|
+
fromAttribute: (value) => {
|
|
292
|
+
return value.split(" ").map((p) => p.trim()).filter((p) => p !== "");
|
|
293
|
+
},
|
|
294
|
+
toAttribute: (value) => {
|
|
295
|
+
return value.join(" ");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
], SynPopup.prototype, "flipFallbackPlacements", 2);
|
|
300
|
+
__decorateClass([
|
|
301
|
+
property({ attribute: "flip-fallback-strategy" })
|
|
302
|
+
], SynPopup.prototype, "flipFallbackStrategy", 2);
|
|
303
|
+
__decorateClass([
|
|
304
|
+
property({ type: Object })
|
|
305
|
+
], SynPopup.prototype, "flipBoundary", 2);
|
|
306
|
+
__decorateClass([
|
|
307
|
+
property({ attribute: "flip-padding", type: Number })
|
|
308
|
+
], SynPopup.prototype, "flipPadding", 2);
|
|
309
|
+
__decorateClass([
|
|
310
|
+
property({ type: Boolean })
|
|
311
|
+
], SynPopup.prototype, "shift", 2);
|
|
312
|
+
__decorateClass([
|
|
313
|
+
property({ type: Object })
|
|
314
|
+
], SynPopup.prototype, "shiftBoundary", 2);
|
|
315
|
+
__decorateClass([
|
|
316
|
+
property({ attribute: "shift-padding", type: Number })
|
|
317
|
+
], SynPopup.prototype, "shiftPadding", 2);
|
|
318
|
+
__decorateClass([
|
|
319
|
+
property({ attribute: "auto-size" })
|
|
320
|
+
], SynPopup.prototype, "autoSize", 2);
|
|
321
|
+
__decorateClass([
|
|
322
|
+
property()
|
|
323
|
+
], SynPopup.prototype, "sync", 2);
|
|
324
|
+
__decorateClass([
|
|
325
|
+
property({ type: Object })
|
|
326
|
+
], SynPopup.prototype, "autoSizeBoundary", 2);
|
|
327
|
+
__decorateClass([
|
|
328
|
+
property({ attribute: "auto-size-padding", type: Number })
|
|
329
|
+
], SynPopup.prototype, "autoSizePadding", 2);
|
|
330
|
+
|
|
331
|
+
export {
|
|
332
|
+
SynPopup
|
|
333
|
+
};
|
|
334
|
+
//# sourceMappingURL=chunk.SAGHXH7E.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/popup/popup.component.ts"],
|
|
4
|
+
"sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED BY VENDORISM\n// Removing this comment will prevent it from being managed by it.\n// ---------------------------------------------------------------------\n\n/* eslint-disable */\nimport { arrow, autoUpdate, computePosition, flip, offset, platform, shift, size } from '@floating-ui/dom';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { html } from 'lit';\nimport { offsetParent } from 'composed-offset-position';\nimport { property, query } from 'lit/decorators.js';\nimport SynergyElement from '../../internal/synergy-element.js';\nimport styles from './popup.styles.js';\nimport type { CSSResultGroup } from 'lit';\n\nexport interface VirtualElement {\n getBoundingClientRect: () => DOMRect;\n}\n\nfunction isVirtualElement(e: unknown): e is VirtualElement {\n return e !== null && typeof e === 'object' && 'getBoundingClientRect' in e;\n}\n\n/**\n * @summary Popup is a utility that lets you declaratively anchor \"popup\" containers to another element.\n * @documentation https://synergy.style/components/popup\n * @status stable\n * @since 2.0\n *\n * @event syn-reposition - Emitted when the popup is repositioned. This event can fire a lot, so avoid putting expensive\n * operations in your listener or consider debouncing it.\n *\n * @slot - The popup's content.\n * @slot anchor - The element the popup will be anchored to. If the anchor lives outside of the popup, you can use the\n * `anchor` attribute or property instead.\n *\n * @csspart arrow - The arrow's container. Avoid setting `top|bottom|left|right` properties, as these values are\n * assigned dynamically as the popup moves. This is most useful for applying a background color to match the popup, and\n * maybe a border or box shadow.\n * @csspart popup - The popup's container. Useful for setting a background color, box shadow, etc.\n *\n * @cssproperty [--arrow-size=6px] - The size of the arrow. Note that an arrow won't be shown unless the `arrow`\n * attribute is used.\n * @cssproperty [--arrow-color=var(--syn-color-neutral-0)] - The color of the arrow.\n * @cssproperty [--auto-size-available-width] - A read-only custom property that determines the amount of width the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n * @cssproperty [--auto-size-available-height] - A read-only custom property that determines the amount of height the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n */\nexport default class SynPopup extends SynergyElement {\n static styles: CSSResultGroup = styles;\n\n private anchorEl: Element | VirtualElement | null;\n private cleanup: ReturnType<typeof autoUpdate> | undefined;\n\n /** A reference to the internal popup container. Useful for animating and styling the popup with JavaScript. */\n @query('.popup') popup: HTMLElement;\n @query('.popup__arrow') private arrowEl: HTMLElement;\n\n /**\n * The element the popup will be anchored to. If the anchor lives outside of the popup, you can provide the anchor\n * element `id`, a DOM element reference, or a `VirtualElement`. If the anchor lives inside the popup, use the\n * `anchor` slot instead.\n */\n @property() anchor: Element | string | VirtualElement;\n\n /**\n * Activates the positioning logic and shows the popup. When this attribute is removed, the positioning logic is torn\n * down and the popup will be hidden.\n */\n @property({ type: Boolean, reflect: true }) active = false;\n\n /**\n * The preferred placement of the popup. Note that the actual placement will vary as configured to keep the\n * panel inside of the viewport.\n */\n @property({ reflect: true }) placement:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'top';\n\n /**\n * Determines how the popup is positioned. The `absolute` strategy works well in most cases, but if overflow is\n * clipped, using a `fixed` position strategy can often workaround it.\n */\n @property({ reflect: true }) strategy: 'absolute' | 'fixed' = 'absolute';\n\n /** The distance in pixels from which to offset the panel away from its anchor. */\n @property({ type: Number }) distance = 0;\n\n /** The distance in pixels from which to offset the panel along its anchor. */\n @property({ type: Number }) skidding = 0;\n\n /**\n * Attaches an arrow to the popup. The arrow's size and color can be customized using the `--arrow-size` and\n * `--arrow-color` custom properties. For additional customizations, you can also target the arrow using\n * `::part(arrow)` in your stylesheet.\n */\n @property({ type: Boolean }) arrow = false;\n\n /**\n * The placement of the arrow. The default is `anchor`, which will align the arrow as close to the center of the\n * anchor as possible, considering available space and `arrow-padding`. A value of `start`, `end`, or `center` will\n * align the arrow to the start, end, or center of the popover instead.\n */\n @property({ attribute: 'arrow-placement' }) arrowPlacement: 'start' | 'end' | 'center' | 'anchor' = 'anchor';\n\n /**\n * The amount of padding between the arrow and the edges of the popup. If the popup has a border-radius, for example,\n * this will prevent it from overflowing the corners.\n */\n @property({ attribute: 'arrow-padding', type: Number }) arrowPadding = 10;\n\n /**\n * When set, placement of the popup will flip to the opposite site to keep it in view. You can use\n * `flipFallbackPlacements` to further configure how the fallback placement is determined.\n */\n @property({ type: Boolean }) flip = false;\n\n /**\n * If the preferred placement doesn't fit, popup will be tested in these fallback placements until one fits. Must be a\n * string of any number of placements separated by a space, e.g. \"top bottom left\". If no placement fits, the flip\n * fallback strategy will be used instead.\n * */\n @property({\n attribute: 'flip-fallback-placements',\n converter: {\n fromAttribute: (value: string) => {\n return value\n .split(' ')\n .map(p => p.trim())\n .filter(p => p !== '');\n },\n toAttribute: (value: []) => {\n return value.join(' ');\n }\n }\n })\n flipFallbackPlacements = '';\n\n /**\n * When neither the preferred placement nor the fallback placements fit, this value will be used to determine whether\n * the popup should be positioned using the best available fit based on available space or as it was initially\n * preferred.\n */\n @property({ attribute: 'flip-fallback-strategy' }) flipFallbackStrategy: 'best-fit' | 'initial' = 'best-fit';\n\n /**\n * The flip boundary describes clipping element(s) that overflow will be checked relative to when flipping. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object }) flipBoundary: Element | Element[];\n\n /** The amount of padding, in pixels, to exceed before the flip behavior will occur. */\n @property({ attribute: 'flip-padding', type: Number }) flipPadding = 0;\n\n /** Moves the popup along the axis to keep it in view when clipped. */\n @property({ type: Boolean }) shift = false;\n\n /**\n * The shift boundary describes clipping element(s) that overflow will be checked relative to when shifting. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object }) shiftBoundary: Element | Element[];\n\n /** The amount of padding, in pixels, to exceed before the shift behavior will occur. */\n @property({ attribute: 'shift-padding', type: Number }) shiftPadding = 0;\n\n /** When set, this will cause the popup to automatically resize itself to prevent it from overflowing. */\n @property({ attribute: 'auto-size' }) autoSize: 'horizontal' | 'vertical' | 'both';\n\n /** Syncs the popup's width or height to that of the anchor element. */\n @property() sync: 'width' | 'height' | 'both';\n\n /**\n * The auto-size boundary describes clipping element(s) that overflow will be checked relative to when resizing. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object }) autoSizeBoundary: Element | Element[];\n\n /** The amount of padding, in pixels, to exceed before the auto-size behavior will occur. */\n @property({ attribute: 'auto-size-padding', type: Number }) autoSizePadding = 0;\n\n async connectedCallback() {\n super.connectedCallback();\n\n // Start the positioner after the first update\n await this.updateComplete;\n this.start();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.stop();\n }\n\n async updated(changedProps: Map<string, unknown>) {\n super.updated(changedProps);\n\n // Start or stop the positioner when active changes\n if (changedProps.has('active')) {\n if (this.active) {\n this.start();\n } else {\n this.stop();\n }\n }\n\n // Update the anchor when anchor changes\n if (changedProps.has('anchor')) {\n this.handleAnchorChange();\n }\n\n // All other properties will trigger a reposition when active\n if (this.active) {\n await this.updateComplete;\n this.reposition();\n }\n }\n\n private async handleAnchorChange() {\n await this.stop();\n\n if (this.anchor && typeof this.anchor === 'string') {\n // Locate the anchor by id\n const root = this.getRootNode() as Document | ShadowRoot;\n this.anchorEl = root.getElementById(this.anchor);\n } else if (this.anchor instanceof Element || isVirtualElement(this.anchor)) {\n // Use the anchor's reference\n this.anchorEl = this.anchor;\n } else {\n // Look for a slotted anchor\n this.anchorEl = this.querySelector<HTMLElement>('[slot=\"anchor\"]');\n }\n\n // If the anchor is a <slot>, we'll use the first assigned element as the target since slots use `display: contents`\n // and positioning can't be calculated on them\n if (this.anchorEl instanceof HTMLSlotElement) {\n this.anchorEl = this.anchorEl.assignedElements({ flatten: true })[0] as HTMLElement;\n }\n\n // If the anchor is valid, start it up\n if (this.anchorEl) {\n this.start();\n }\n }\n\n private start() {\n // We can't start the positioner without an anchor\n if (!this.anchorEl) {\n return;\n }\n\n this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {\n this.reposition();\n });\n }\n\n private async stop(): Promise<void> {\n return new Promise(resolve => {\n if (this.cleanup) {\n this.cleanup();\n this.cleanup = undefined;\n this.removeAttribute('data-current-placement');\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n requestAnimationFrame(() => resolve());\n } else {\n resolve();\n }\n });\n }\n\n /** Forces the popup to recalculate and reposition itself. */\n reposition() {\n // Nothing to do if the popup is inactive or the anchor doesn't exist\n if (!this.active || !this.anchorEl) {\n return;\n }\n\n //\n // NOTE: Floating UI middlewares are order dependent: https://floating-ui.com/docs/middleware\n //\n const middleware = [\n // The offset middleware goes first\n offset({ mainAxis: this.distance, crossAxis: this.skidding })\n ];\n\n // First we sync width/height\n if (this.sync) {\n middleware.push(\n size({\n apply: ({ rects }) => {\n const syncWidth = this.sync === 'width' || this.sync === 'both';\n const syncHeight = this.sync === 'height' || this.sync === 'both';\n this.popup.style.width = syncWidth ? `${rects.reference.width}px` : '';\n this.popup.style.height = syncHeight ? `${rects.reference.height}px` : '';\n }\n })\n );\n } else {\n // Cleanup styles if we're not matching width/height\n this.popup.style.width = '';\n this.popup.style.height = '';\n }\n\n // Then we flip\n if (this.flip) {\n middleware.push(\n flip({\n boundary: this.flipBoundary,\n // @ts-expect-error - We're converting a string attribute to an array here\n fallbackPlacements: this.flipFallbackPlacements,\n fallbackStrategy: this.flipFallbackStrategy === 'best-fit' ? 'bestFit' : 'initialPlacement',\n padding: this.flipPadding\n })\n );\n }\n\n // Then we shift\n if (this.shift) {\n middleware.push(\n shift({\n boundary: this.shiftBoundary,\n padding: this.shiftPadding\n })\n );\n }\n\n // Now we adjust the size as needed\n if (this.autoSize) {\n middleware.push(\n size({\n boundary: this.autoSizeBoundary,\n padding: this.autoSizePadding,\n apply: ({ availableWidth, availableHeight }) => {\n if (this.autoSize === 'vertical' || this.autoSize === 'both') {\n this.style.setProperty('--auto-size-available-height', `${availableHeight}px`);\n } else {\n this.style.removeProperty('--auto-size-available-height');\n }\n\n if (this.autoSize === 'horizontal' || this.autoSize === 'both') {\n this.style.setProperty('--auto-size-available-width', `${availableWidth}px`);\n } else {\n this.style.removeProperty('--auto-size-available-width');\n }\n }\n })\n );\n } else {\n // Cleanup styles if we're no longer using auto-size\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n }\n\n // Finally, we add an arrow\n if (this.arrow) {\n middleware.push(\n arrow({\n element: this.arrowEl,\n padding: this.arrowPadding\n })\n );\n }\n\n //\n // Use custom positioning logic if the strategy is absolute. Otherwise, fall back to the default logic.\n //\n // More info: https://github.com/synergy-design-system/synergy/issues/1135\n //\n const getOffsetParent =\n this.strategy === 'absolute'\n ? (element: Element) => platform.getOffsetParent(element, offsetParent)\n : platform.getOffsetParent;\n\n computePosition(this.anchorEl, this.popup, {\n placement: this.placement,\n middleware,\n strategy: this.strategy,\n platform: {\n ...platform,\n getOffsetParent\n }\n }).then(({ x, y, middlewareData, placement }) => {\n //\n // Even though we have our own localization utility, it uses different heuristics to determine RTL. Because of\n // that, we'll use the same approach that Floating UI uses.\n //\n // Source: https://github.com/floating-ui/floating-ui/blob/cb3b6ab07f95275730d3e6e46c702f8d4908b55c/packages/dom/src/utils/getDocumentRect.ts#L31\n //\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const staticSide = { top: 'bottom', right: 'left', bottom: 'top', left: 'right' }[placement.split('-')[0]]!;\n\n this.setAttribute('data-current-placement', placement);\n\n Object.assign(this.popup.style, {\n left: `${x}px`,\n top: `${y}px`\n });\n\n if (this.arrow) {\n const arrowX = middlewareData.arrow!.x;\n const arrowY = middlewareData.arrow!.y;\n let top = '';\n let right = '';\n let bottom = '';\n let left = '';\n\n if (this.arrowPlacement === 'start') {\n // Start\n const value = typeof arrowX === 'number' ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : '';\n top = typeof arrowY === 'number' ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : '';\n right = isRtl ? value : '';\n left = isRtl ? '' : value;\n } else if (this.arrowPlacement === 'end') {\n // End\n const value = typeof arrowX === 'number' ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : '';\n right = isRtl ? '' : value;\n left = isRtl ? value : '';\n bottom = typeof arrowY === 'number' ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : '';\n } else if (this.arrowPlacement === 'center') {\n // Center\n left = typeof arrowX === 'number' ? `calc(50% - var(--arrow-size-diagonal))` : '';\n top = typeof arrowY === 'number' ? `calc(50% - var(--arrow-size-diagonal))` : '';\n } else {\n // Anchor (default)\n left = typeof arrowX === 'number' ? `${arrowX}px` : '';\n top = typeof arrowY === 'number' ? `${arrowY}px` : '';\n }\n\n Object.assign(this.arrowEl.style, {\n top,\n right,\n bottom,\n left,\n [staticSide]: 'calc(var(--arrow-size-diagonal) * -1)'\n });\n }\n });\n\n this.emit('syn-reposition');\n }\n\n render() {\n return html`\n <slot name=\"anchor\" @slotchange=${this.handleAnchorChange}></slot>\n\n <div\n part=\"popup\"\n class=${classMap({\n popup: true,\n 'popup--active': this.active,\n 'popup--fixed': this.strategy === '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HU;AAOD;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA7HP,SA6HS;AAG4B;AAAA,EAAvD,SAAS,EAAE,WAAW,iBAAiB,MAAM,OAAO,CAAC;AAAA,GAhInC,SAgIqC;AAGlB;AAAA,EAArC,SAAS,EAAE,WAAW,YAAY,CAAC;AAAA,GAnIjB,SAmImB;AAG1B;AAAA,EAAX,SAAS;AAAA,GAtIS,SAsIP;AAOgB;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA7IP,SA6IS;AAGgC;AAAA,EAA3D,SAAS,EAAE,WAAW,qBAAqB,MAAM,OAAO,CAAC;AAAA,GAhJvC,SAgJyC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SynIconButton
|
|
3
|
-
} from "./chunk.
|
|
3
|
+
} from "./chunk.4STUWO3B.js";
|
|
4
4
|
|
|
5
5
|
// src/components/icon-button/icon-button.ts
|
|
6
6
|
var icon_button_default = SynIconButton;
|
|
@@ -9,4 +9,4 @@ SynIconButton.define("syn-icon-button");
|
|
|
9
9
|
export {
|
|
10
10
|
icon_button_default
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=chunk.
|
|
12
|
+
//# sourceMappingURL=chunk.SLW5NPQB.js.map
|
|
@@ -48,7 +48,7 @@ var SynergyElement = class extends LitElement {
|
|
|
48
48
|
};
|
|
49
49
|
/* eslint-disable */
|
|
50
50
|
// @ts-expect-error This is auto-injected at build time.
|
|
51
|
-
SynergyElement.version = "1.
|
|
51
|
+
SynergyElement.version = "1.5.1";
|
|
52
52
|
SynergyElement.dependencies = {};
|
|
53
53
|
__decorateClass([
|
|
54
54
|
property()
|
|
@@ -60,4 +60,4 @@ __decorateClass([
|
|
|
60
60
|
export {
|
|
61
61
|
SynergyElement
|
|
62
62
|
};
|
|
63
|
-
//# sourceMappingURL=chunk.
|
|
63
|
+
//# sourceMappingURL=chunk.T72SACBE.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/internal/synergy-element.ts"],
|
|
4
|
-
"sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED BY VENDORISM\n// Removing this comment will prevent it from being managed by it.\n// ---------------------------------------------------------------------\n\n/* eslint-disable */\nimport { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n// Match event type name strings that are registered on GlobalEventHandlersEventMap...\ntype EventTypeRequiresDetail<T> = T extends keyof GlobalEventHandlersEventMap\n ? // ...where the event detail is an object...\n GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>>\n ? // ...that is non-empty...\n GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>>\n ? never\n : // ...and has at least one non-optional property\n Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail']\n ? never\n : T\n : never\n : never;\n\n// The inverse of the above (match any type that doesn't match EventTypeRequiresDetail)\ntype EventTypeDoesNotRequireDetail<T> = T extends keyof GlobalEventHandlersEventMap\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>>\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>>\n ? T\n : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail']\n ? T\n : never\n : T\n : T;\n\n// `keyof EventTypesWithRequiredDetail` lists all registered event types that require detail\ntype EventTypesWithRequiredDetail = {\n [EventType in keyof GlobalEventHandlersEventMap as EventTypeRequiresDetail<EventType>]: true;\n};\n\n// `keyof EventTypesWithoutRequiredDetail` lists all registered event types that do NOT require detail\ntype EventTypesWithoutRequiredDetail = {\n [EventType in keyof GlobalEventHandlersEventMap as EventTypeDoesNotRequireDetail<EventType>]: true;\n};\n\n// Helper to make a specific property of an object non-optional\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\n// Given an event name string, get a valid type for the options to initialize the event that is more restrictive than\n// just CustomEventInit when appropriate (validate the type of the event detail, and require it to be provided if the\n// event requires it)\ntype SynEventInit<T> = T extends keyof GlobalEventHandlersEventMap\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>>\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>>\n ? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>\n : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail']\n ? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>\n : WithRequired<CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>, 'detail'>\n : CustomEventInit\n : CustomEventInit;\n\n// Given an event name string, get the type of the event\ntype GetCustomEventType<T> = T extends keyof GlobalEventHandlersEventMap\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<unknown>\n ? GlobalEventHandlersEventMap[T]\n : CustomEvent<unknown>\n : CustomEvent<unknown>;\n\n// `keyof ValidEventTypeMap` is equivalent to `keyof GlobalEventHandlersEventMap` but gives a nicer error message\ntype ValidEventTypeMap = EventTypesWithRequiredDetail | EventTypesWithoutRequiredDetail;\n\nexport default class SynergyElement extends LitElement {\n // Make localization attributes reactive\n @property() dir: string;\n @property() lang: string;\n\n /** Emits a custom event with more convenient defaults. */\n emit<T extends string & keyof EventTypesWithoutRequiredDetail>(\n name: EventTypeDoesNotRequireDetail<T>,\n options?: SynEventInit<T> | undefined\n ): GetCustomEventType<T>;\n emit<T extends string & keyof EventTypesWithRequiredDetail>(\n name: EventTypeRequiresDetail<T>,\n options: SynEventInit<T>\n ): GetCustomEventType<T>;\n emit<T extends string & keyof ValidEventTypeMap>(\n name: T,\n options?: SynEventInit<T> | undefined\n ): GetCustomEventType<T> {\n const event = new CustomEvent(name, {\n bubbles: true,\n cancelable: false,\n composed: true,\n detail: {},\n ...options\n });\n\n this.dispatchEvent(event);\n\n return event as GetCustomEventType<T>;\n }\n\n /* eslint-disable */\n // @ts-expect-error This is auto-injected at build time.\n static version = \"1.
|
|
4
|
+
"sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED BY VENDORISM\n// Removing this comment will prevent it from being managed by it.\n// ---------------------------------------------------------------------\n\n/* eslint-disable */\nimport { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n// Match event type name strings that are registered on GlobalEventHandlersEventMap...\ntype EventTypeRequiresDetail<T> = T extends keyof GlobalEventHandlersEventMap\n ? // ...where the event detail is an object...\n GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>>\n ? // ...that is non-empty...\n GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>>\n ? never\n : // ...and has at least one non-optional property\n Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail']\n ? never\n : T\n : never\n : never;\n\n// The inverse of the above (match any type that doesn't match EventTypeRequiresDetail)\ntype EventTypeDoesNotRequireDetail<T> = T extends keyof GlobalEventHandlersEventMap\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>>\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>>\n ? T\n : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail']\n ? T\n : never\n : T\n : T;\n\n// `keyof EventTypesWithRequiredDetail` lists all registered event types that require detail\ntype EventTypesWithRequiredDetail = {\n [EventType in keyof GlobalEventHandlersEventMap as EventTypeRequiresDetail<EventType>]: true;\n};\n\n// `keyof EventTypesWithoutRequiredDetail` lists all registered event types that do NOT require detail\ntype EventTypesWithoutRequiredDetail = {\n [EventType in keyof GlobalEventHandlersEventMap as EventTypeDoesNotRequireDetail<EventType>]: true;\n};\n\n// Helper to make a specific property of an object non-optional\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\n// Given an event name string, get a valid type for the options to initialize the event that is more restrictive than\n// just CustomEventInit when appropriate (validate the type of the event detail, and require it to be provided if the\n// event requires it)\ntype SynEventInit<T> = T extends keyof GlobalEventHandlersEventMap\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>>\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>>\n ? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>\n : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail']\n ? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>\n : WithRequired<CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>, 'detail'>\n : CustomEventInit\n : CustomEventInit;\n\n// Given an event name string, get the type of the event\ntype GetCustomEventType<T> = T extends keyof GlobalEventHandlersEventMap\n ? GlobalEventHandlersEventMap[T] extends CustomEvent<unknown>\n ? GlobalEventHandlersEventMap[T]\n : CustomEvent<unknown>\n : CustomEvent<unknown>;\n\n// `keyof ValidEventTypeMap` is equivalent to `keyof GlobalEventHandlersEventMap` but gives a nicer error message\ntype ValidEventTypeMap = EventTypesWithRequiredDetail | EventTypesWithoutRequiredDetail;\n\nexport default class SynergyElement extends LitElement {\n // Make localization attributes reactive\n @property() dir: string;\n @property() lang: string;\n\n /** Emits a custom event with more convenient defaults. */\n emit<T extends string & keyof EventTypesWithoutRequiredDetail>(\n name: EventTypeDoesNotRequireDetail<T>,\n options?: SynEventInit<T> | undefined\n ): GetCustomEventType<T>;\n emit<T extends string & keyof EventTypesWithRequiredDetail>(\n name: EventTypeRequiresDetail<T>,\n options: SynEventInit<T>\n ): GetCustomEventType<T>;\n emit<T extends string & keyof ValidEventTypeMap>(\n name: T,\n options?: SynEventInit<T> | undefined\n ): GetCustomEventType<T> {\n const event = new CustomEvent(name, {\n bubbles: true,\n cancelable: false,\n composed: true,\n detail: {},\n ...options\n });\n\n this.dispatchEvent(event);\n\n return event as GetCustomEventType<T>;\n }\n\n /* eslint-disable */\n // @ts-expect-error This is auto-injected at build time.\n static version = \"1.5.1\";\n \n\n static define(name: string, elementConstructor = this, options: ElementDefinitionOptions = {}) {\n const currentlyRegisteredConstructor = customElements.get(name) as\n | CustomElementConstructor\n | typeof SynergyElement;\n\n if (!currentlyRegisteredConstructor) {\n customElements.define(name, class extends elementConstructor {} as unknown as CustomElementConstructor, options);\n return;\n }\n\n let newVersion = ' (unknown version)';\n let existingVersion = newVersion;\n\n if ('version' in elementConstructor && elementConstructor.version) {\n newVersion = ' v' + elementConstructor.version;\n }\n\n if ('version' in currentlyRegisteredConstructor && currentlyRegisteredConstructor.version) {\n existingVersion = ' v' + currentlyRegisteredConstructor.version;\n }\n\n // Need to make sure we're not working with null or empty strings before doing version comparisons.\n if (newVersion && existingVersion && newVersion === existingVersion) {\n // If versions match, we don't need to warn anyone. Carry on.\n return;\n }\n\n console.warn(\n `Attempted to register <${name}>${newVersion}, but <${name}>${existingVersion} has already been registered.`\n );\n }\n\n static dependencies: Record<string, typeof SynergyElement> = {};\n\n constructor() {\n super();\n Object.entries((this.constructor as typeof SynergyElement).dependencies).forEach(([name, component]) => {\n (this.constructor as typeof SynergyElement).define(name, component);\n });\n }\n}\n\nexport interface SynergyFormControl extends SynergyElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: string;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | 'any';\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n\n // Form validation properties\n readonly validity: ValidityState;\n readonly validationMessage: string;\n\n // Form validation methods\n checkValidity: () => boolean;\n getForm: () => HTMLFormElement | null;\n reportValidity: () => boolean;\n setCustomValidity: (message: string) => void;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;AAMA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AA+DzB,IAAqB,iBAArB,cAA4C,WAAW;AAAA,EAcr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
SynergyElement
|
|
9
|
-
} from "./chunk.
|
|
9
|
+
} from "./chunk.T72SACBE.js";
|
|
10
10
|
|
|
11
11
|
// src/components/spinner/spinner.component.ts
|
|
12
12
|
import { html } from "lit";
|
|
@@ -29,4 +29,4 @@ SynSpinner.styles = spinner_styles_default;
|
|
|
29
29
|
export {
|
|
30
30
|
SynSpinner
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=chunk.
|
|
32
|
+
//# sourceMappingURL=chunk.UBTUEIMR.js.map
|