@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,811 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAnimation,
|
|
3
|
+
setDefaultAnimation
|
|
4
|
+
} from "./chunk.BQG5LF7J.js";
|
|
5
|
+
import {
|
|
6
|
+
SynTag
|
|
7
|
+
} from "./chunk.I3FGUPLH.js";
|
|
8
|
+
import {
|
|
9
|
+
select_styles_default
|
|
10
|
+
} from "./chunk.6XU6OLZ3.js";
|
|
11
|
+
import {
|
|
12
|
+
SynPopup
|
|
13
|
+
} from "./chunk.SAGHXH7E.js";
|
|
14
|
+
import {
|
|
15
|
+
defaultValue
|
|
16
|
+
} from "./chunk.WFAJR3FN.js";
|
|
17
|
+
import {
|
|
18
|
+
HasSlotController
|
|
19
|
+
} from "./chunk.XGXFE6IF.js";
|
|
20
|
+
import {
|
|
21
|
+
LocalizeController
|
|
22
|
+
} from "./chunk.LAB4YJYE.js";
|
|
23
|
+
import {
|
|
24
|
+
FormControlController
|
|
25
|
+
} from "./chunk.AMTCNRDE.js";
|
|
26
|
+
import {
|
|
27
|
+
SynIcon
|
|
28
|
+
} from "./chunk.OKG27K27.js";
|
|
29
|
+
import {
|
|
30
|
+
watch
|
|
31
|
+
} from "./chunk.VZ7S7YYN.js";
|
|
32
|
+
import {
|
|
33
|
+
SynergyElement
|
|
34
|
+
} from "./chunk.T72SACBE.js";
|
|
35
|
+
import {
|
|
36
|
+
__decorateClass,
|
|
37
|
+
__spreadProps,
|
|
38
|
+
__spreadValues
|
|
39
|
+
} from "./chunk.DJOAQ4JU.js";
|
|
40
|
+
|
|
41
|
+
// src/internal/animate.ts
|
|
42
|
+
function animateTo(el, keyframes, options) {
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
|
+
if ((options == null ? void 0 : options.duration) === Infinity) {
|
|
45
|
+
throw new Error("Promise-based animations must be finite.");
|
|
46
|
+
}
|
|
47
|
+
const animation = el.animate(keyframes, __spreadProps(__spreadValues({}, options), {
|
|
48
|
+
duration: prefersReducedMotion() ? 0 : options.duration
|
|
49
|
+
}));
|
|
50
|
+
animation.addEventListener("cancel", resolve, { once: true });
|
|
51
|
+
animation.addEventListener("finish", resolve, { once: true });
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function prefersReducedMotion() {
|
|
55
|
+
const query2 = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
56
|
+
return query2.matches;
|
|
57
|
+
}
|
|
58
|
+
function stopAnimations(el) {
|
|
59
|
+
return Promise.all(
|
|
60
|
+
el.getAnimations().map((animation) => {
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
const handleAnimationEvent = requestAnimationFrame(resolve);
|
|
63
|
+
animation.addEventListener("cancel", () => handleAnimationEvent, { once: true });
|
|
64
|
+
animation.addEventListener("finish", () => handleAnimationEvent, { once: true });
|
|
65
|
+
animation.cancel();
|
|
66
|
+
});
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/components/select/select.component.ts
|
|
72
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
73
|
+
import { html } from "lit";
|
|
74
|
+
import { property, query, state } from "lit/decorators.js";
|
|
75
|
+
|
|
76
|
+
// src/internal/offset.ts
|
|
77
|
+
function getOffset(element, parent) {
|
|
78
|
+
return {
|
|
79
|
+
top: Math.round(element.getBoundingClientRect().top - parent.getBoundingClientRect().top),
|
|
80
|
+
left: Math.round(element.getBoundingClientRect().left - parent.getBoundingClientRect().left)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/internal/scroll.ts
|
|
85
|
+
function scrollIntoView(element, container, direction = "vertical", behavior = "smooth") {
|
|
86
|
+
const offset = getOffset(element, container);
|
|
87
|
+
const offsetTop = offset.top + container.scrollTop;
|
|
88
|
+
const offsetLeft = offset.left + container.scrollLeft;
|
|
89
|
+
const minX = container.scrollLeft;
|
|
90
|
+
const maxX = container.scrollLeft + container.offsetWidth;
|
|
91
|
+
const minY = container.scrollTop;
|
|
92
|
+
const maxY = container.scrollTop + container.offsetHeight;
|
|
93
|
+
if (direction === "horizontal" || direction === "both") {
|
|
94
|
+
if (offsetLeft < minX) {
|
|
95
|
+
container.scrollTo({ left: offsetLeft, behavior });
|
|
96
|
+
} else if (offsetLeft + element.clientWidth > maxX) {
|
|
97
|
+
container.scrollTo({ left: offsetLeft - container.offsetWidth + element.clientWidth, behavior });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (direction === "vertical" || direction === "both") {
|
|
101
|
+
if (offsetTop < minY) {
|
|
102
|
+
container.scrollTo({ top: offsetTop, behavior });
|
|
103
|
+
} else if (offsetTop + element.clientHeight > maxY) {
|
|
104
|
+
container.scrollTo({ top: offsetTop - container.offsetHeight + element.clientHeight, behavior });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// src/components/select/select.component.ts
|
|
110
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
111
|
+
|
|
112
|
+
// src/internal/event.ts
|
|
113
|
+
function waitForEvent(el, eventName) {
|
|
114
|
+
return new Promise((resolve) => {
|
|
115
|
+
function done(event) {
|
|
116
|
+
if (event.target === el) {
|
|
117
|
+
el.removeEventListener(eventName, done);
|
|
118
|
+
resolve();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
el.addEventListener(eventName, done);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// src/components/select/select.component.ts
|
|
126
|
+
var SynSelect = class extends SynergyElement {
|
|
127
|
+
constructor() {
|
|
128
|
+
super(...arguments);
|
|
129
|
+
this.formControlController = new FormControlController(this, {
|
|
130
|
+
assumeInteractionOn: ["syn-blur", "syn-input"]
|
|
131
|
+
});
|
|
132
|
+
this.hasSlotController = new HasSlotController(this, "help-text", "label");
|
|
133
|
+
this.localize = new LocalizeController(this);
|
|
134
|
+
this.typeToSelectString = "";
|
|
135
|
+
this.hasFocus = false;
|
|
136
|
+
this.displayLabel = "";
|
|
137
|
+
this.selectedOptions = [];
|
|
138
|
+
this.name = "";
|
|
139
|
+
this.value = "";
|
|
140
|
+
this.defaultValue = "";
|
|
141
|
+
this.size = "medium";
|
|
142
|
+
this.placeholder = "";
|
|
143
|
+
this.multiple = false;
|
|
144
|
+
this.maxOptionsVisible = 3;
|
|
145
|
+
this.disabled = false;
|
|
146
|
+
this.clearable = false;
|
|
147
|
+
this.open = false;
|
|
148
|
+
this.hoist = false;
|
|
149
|
+
this.label = "";
|
|
150
|
+
this.placement = "bottom";
|
|
151
|
+
this.helpText = "";
|
|
152
|
+
this.form = "";
|
|
153
|
+
this.required = false;
|
|
154
|
+
this.getTag = (option) => {
|
|
155
|
+
return html`
|
|
156
|
+
<syn-tag
|
|
157
|
+
part="tag"
|
|
158
|
+
exportparts="
|
|
159
|
+
base:tag__base,
|
|
160
|
+
content:tag__content,
|
|
161
|
+
remove-button:tag__remove-button,
|
|
162
|
+
remove-button__base:tag__remove-button__base
|
|
163
|
+
"
|
|
164
|
+
size=${this.size}
|
|
165
|
+
removable
|
|
166
|
+
@syn-remove=${(event) => this.handleTagRemove(event, option)}
|
|
167
|
+
>
|
|
168
|
+
${option.getTextLabel()}
|
|
169
|
+
</syn-tag>
|
|
170
|
+
`;
|
|
171
|
+
};
|
|
172
|
+
this.handleDocumentFocusIn = (event) => {
|
|
173
|
+
const path = event.composedPath();
|
|
174
|
+
if (this && !path.includes(this)) {
|
|
175
|
+
this.hide();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
this.handleDocumentKeyDown = (event) => {
|
|
179
|
+
const target = event.target;
|
|
180
|
+
const isClearButton = target.closest(".select__clear") !== null;
|
|
181
|
+
const isIconButton = target.closest("syn-icon-button") !== null;
|
|
182
|
+
if (isClearButton || isIconButton) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (event.key === "Escape" && this.open) {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
event.stopPropagation();
|
|
188
|
+
this.hide();
|
|
189
|
+
this.displayInput.focus({ preventScroll: true });
|
|
190
|
+
}
|
|
191
|
+
if (event.key === "Enter" || event.key === " " && this.typeToSelectString === "") {
|
|
192
|
+
event.preventDefault();
|
|
193
|
+
event.stopImmediatePropagation();
|
|
194
|
+
if (!this.open) {
|
|
195
|
+
this.show();
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (this.currentOption && !this.currentOption.disabled) {
|
|
199
|
+
if (this.multiple) {
|
|
200
|
+
this.toggleOptionSelection(this.currentOption);
|
|
201
|
+
} else {
|
|
202
|
+
this.setSelectedOptions(this.currentOption);
|
|
203
|
+
}
|
|
204
|
+
this.updateComplete.then(() => {
|
|
205
|
+
this.emit("syn-input");
|
|
206
|
+
this.emit("syn-change");
|
|
207
|
+
});
|
|
208
|
+
if (!this.multiple) {
|
|
209
|
+
this.hide();
|
|
210
|
+
this.displayInput.focus({ preventScroll: true });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) {
|
|
216
|
+
const allOptions = this.getAllOptions();
|
|
217
|
+
const currentIndex = allOptions.indexOf(this.currentOption);
|
|
218
|
+
let newIndex = Math.max(0, currentIndex);
|
|
219
|
+
event.preventDefault();
|
|
220
|
+
if (!this.open) {
|
|
221
|
+
this.show();
|
|
222
|
+
if (this.currentOption) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (event.key === "ArrowDown") {
|
|
227
|
+
newIndex = currentIndex + 1;
|
|
228
|
+
if (newIndex > allOptions.length - 1)
|
|
229
|
+
newIndex = 0;
|
|
230
|
+
} else if (event.key === "ArrowUp") {
|
|
231
|
+
newIndex = currentIndex - 1;
|
|
232
|
+
if (newIndex < 0)
|
|
233
|
+
newIndex = allOptions.length - 1;
|
|
234
|
+
} else if (event.key === "Home") {
|
|
235
|
+
newIndex = 0;
|
|
236
|
+
} else if (event.key === "End") {
|
|
237
|
+
newIndex = allOptions.length - 1;
|
|
238
|
+
}
|
|
239
|
+
this.setCurrentOption(allOptions[newIndex]);
|
|
240
|
+
}
|
|
241
|
+
if (event.key.length === 1 || event.key === "Backspace") {
|
|
242
|
+
const allOptions = this.getAllOptions();
|
|
243
|
+
if (event.metaKey || event.ctrlKey || event.altKey) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (!this.open) {
|
|
247
|
+
if (event.key === "Backspace") {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
this.show();
|
|
251
|
+
}
|
|
252
|
+
event.stopPropagation();
|
|
253
|
+
event.preventDefault();
|
|
254
|
+
clearTimeout(this.typeToSelectTimeout);
|
|
255
|
+
this.typeToSelectTimeout = window.setTimeout(() => this.typeToSelectString = "", 1e3);
|
|
256
|
+
if (event.key === "Backspace") {
|
|
257
|
+
this.typeToSelectString = this.typeToSelectString.slice(0, -1);
|
|
258
|
+
} else {
|
|
259
|
+
this.typeToSelectString += event.key.toLowerCase();
|
|
260
|
+
}
|
|
261
|
+
for (const option of allOptions) {
|
|
262
|
+
const label = option.getTextLabel().toLowerCase();
|
|
263
|
+
if (label.startsWith(this.typeToSelectString)) {
|
|
264
|
+
this.setCurrentOption(option);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
this.handleDocumentMouseDown = (event) => {
|
|
271
|
+
const path = event.composedPath();
|
|
272
|
+
if (this && !path.includes(this)) {
|
|
273
|
+
this.hide();
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/** Gets the validity state object */
|
|
278
|
+
get validity() {
|
|
279
|
+
return this.valueInput.validity;
|
|
280
|
+
}
|
|
281
|
+
/** Gets the validation message */
|
|
282
|
+
get validationMessage() {
|
|
283
|
+
return this.valueInput.validationMessage;
|
|
284
|
+
}
|
|
285
|
+
connectedCallback() {
|
|
286
|
+
super.connectedCallback();
|
|
287
|
+
this.open = false;
|
|
288
|
+
}
|
|
289
|
+
addOpenListeners() {
|
|
290
|
+
document.addEventListener("focusin", this.handleDocumentFocusIn);
|
|
291
|
+
document.addEventListener("keydown", this.handleDocumentKeyDown);
|
|
292
|
+
document.addEventListener("mousedown", this.handleDocumentMouseDown);
|
|
293
|
+
}
|
|
294
|
+
removeOpenListeners() {
|
|
295
|
+
document.removeEventListener("focusin", this.handleDocumentFocusIn);
|
|
296
|
+
document.removeEventListener("keydown", this.handleDocumentKeyDown);
|
|
297
|
+
document.removeEventListener("mousedown", this.handleDocumentMouseDown);
|
|
298
|
+
}
|
|
299
|
+
handleFocus() {
|
|
300
|
+
this.hasFocus = true;
|
|
301
|
+
this.displayInput.setSelectionRange(0, 0);
|
|
302
|
+
this.emit("syn-focus");
|
|
303
|
+
}
|
|
304
|
+
handleBlur() {
|
|
305
|
+
this.hasFocus = false;
|
|
306
|
+
this.emit("syn-blur");
|
|
307
|
+
}
|
|
308
|
+
handleLabelClick() {
|
|
309
|
+
this.displayInput.focus();
|
|
310
|
+
}
|
|
311
|
+
handleComboboxMouseDown(event) {
|
|
312
|
+
const path = event.composedPath();
|
|
313
|
+
const isIconButton = path.some((el) => el instanceof Element && el.tagName.toLowerCase() === "syn-icon-button");
|
|
314
|
+
if (this.disabled || isIconButton) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
this.displayInput.focus({ preventScroll: true });
|
|
319
|
+
this.open = !this.open;
|
|
320
|
+
}
|
|
321
|
+
handleComboboxKeyDown(event) {
|
|
322
|
+
event.stopPropagation();
|
|
323
|
+
this.handleDocumentKeyDown(event);
|
|
324
|
+
}
|
|
325
|
+
handleClearClick(event) {
|
|
326
|
+
event.stopPropagation();
|
|
327
|
+
if (this.value !== "") {
|
|
328
|
+
this.setSelectedOptions([]);
|
|
329
|
+
this.displayInput.focus({ preventScroll: true });
|
|
330
|
+
this.updateComplete.then(() => {
|
|
331
|
+
this.emit("syn-clear");
|
|
332
|
+
this.emit("syn-input");
|
|
333
|
+
this.emit("syn-change");
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
handleClearMouseDown(event) {
|
|
338
|
+
event.stopPropagation();
|
|
339
|
+
event.preventDefault();
|
|
340
|
+
}
|
|
341
|
+
handleOptionClick(event) {
|
|
342
|
+
const target = event.target;
|
|
343
|
+
const option = target.closest("syn-option");
|
|
344
|
+
const oldValue = this.value;
|
|
345
|
+
if (option && !option.disabled) {
|
|
346
|
+
if (this.multiple) {
|
|
347
|
+
this.toggleOptionSelection(option);
|
|
348
|
+
} else {
|
|
349
|
+
this.setSelectedOptions(option);
|
|
350
|
+
}
|
|
351
|
+
this.updateComplete.then(() => this.displayInput.focus({ preventScroll: true }));
|
|
352
|
+
if (this.value !== oldValue) {
|
|
353
|
+
this.updateComplete.then(() => {
|
|
354
|
+
this.emit("syn-input");
|
|
355
|
+
this.emit("syn-change");
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
if (!this.multiple) {
|
|
359
|
+
this.hide();
|
|
360
|
+
this.displayInput.focus({ preventScroll: true });
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
handleDefaultSlotChange() {
|
|
365
|
+
const allOptions = this.getAllOptions();
|
|
366
|
+
const value = Array.isArray(this.value) ? this.value : [this.value];
|
|
367
|
+
const values = [];
|
|
368
|
+
if (customElements.get("syn-option")) {
|
|
369
|
+
allOptions.forEach((option) => values.push(option.value));
|
|
370
|
+
this.setSelectedOptions(allOptions.filter((el) => value.includes(el.value)));
|
|
371
|
+
} else {
|
|
372
|
+
customElements.whenDefined("syn-option").then(() => this.handleDefaultSlotChange());
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
handleTagRemove(event, option) {
|
|
376
|
+
event.stopPropagation();
|
|
377
|
+
if (!this.disabled) {
|
|
378
|
+
this.toggleOptionSelection(option, false);
|
|
379
|
+
this.updateComplete.then(() => {
|
|
380
|
+
this.emit("syn-input");
|
|
381
|
+
this.emit("syn-change");
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
// Gets an array of all <syn-option> elements
|
|
386
|
+
getAllOptions() {
|
|
387
|
+
return [...this.querySelectorAll("syn-option")];
|
|
388
|
+
}
|
|
389
|
+
// Gets the first <syn-option> element
|
|
390
|
+
getFirstOption() {
|
|
391
|
+
return this.querySelector("syn-option");
|
|
392
|
+
}
|
|
393
|
+
// Sets the current option, which is the option the user is currently interacting with (e.g. via keyboard). Only one
|
|
394
|
+
// option may be "current" at a time.
|
|
395
|
+
setCurrentOption(option) {
|
|
396
|
+
const allOptions = this.getAllOptions();
|
|
397
|
+
allOptions.forEach((el) => {
|
|
398
|
+
el.current = false;
|
|
399
|
+
el.tabIndex = -1;
|
|
400
|
+
});
|
|
401
|
+
if (option) {
|
|
402
|
+
this.currentOption = option;
|
|
403
|
+
option.current = true;
|
|
404
|
+
option.tabIndex = 0;
|
|
405
|
+
option.focus();
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// Sets the selected option(s)
|
|
409
|
+
setSelectedOptions(option) {
|
|
410
|
+
const allOptions = this.getAllOptions();
|
|
411
|
+
const newSelectedOptions = Array.isArray(option) ? option : [option];
|
|
412
|
+
allOptions.forEach((el) => el.selected = false);
|
|
413
|
+
if (newSelectedOptions.length) {
|
|
414
|
+
newSelectedOptions.forEach((el) => el.selected = true);
|
|
415
|
+
}
|
|
416
|
+
this.selectionChanged();
|
|
417
|
+
}
|
|
418
|
+
// Toggles an option's selected state
|
|
419
|
+
toggleOptionSelection(option, force) {
|
|
420
|
+
if (force === true || force === false) {
|
|
421
|
+
option.selected = force;
|
|
422
|
+
} else {
|
|
423
|
+
option.selected = !option.selected;
|
|
424
|
+
}
|
|
425
|
+
this.selectionChanged();
|
|
426
|
+
}
|
|
427
|
+
// This method must be called whenever the selection changes. It will update the selected options cache, the current
|
|
428
|
+
// value, and the display value
|
|
429
|
+
selectionChanged() {
|
|
430
|
+
var _a, _b, _c, _d;
|
|
431
|
+
this.selectedOptions = this.getAllOptions().filter((el) => el.selected);
|
|
432
|
+
if (this.multiple) {
|
|
433
|
+
this.value = this.selectedOptions.map((el) => el.value);
|
|
434
|
+
if (this.placeholder && this.value.length === 0) {
|
|
435
|
+
this.displayLabel = "";
|
|
436
|
+
} else {
|
|
437
|
+
this.displayLabel = this.localize.term("numOptionsSelected", this.selectedOptions.length);
|
|
438
|
+
}
|
|
439
|
+
} else {
|
|
440
|
+
this.value = (_b = (_a = this.selectedOptions[0]) == null ? void 0 : _a.value) != null ? _b : "";
|
|
441
|
+
this.displayLabel = (_d = (_c = this.selectedOptions[0]) == null ? void 0 : _c.getTextLabel()) != null ? _d : "";
|
|
442
|
+
}
|
|
443
|
+
this.updateComplete.then(() => {
|
|
444
|
+
this.formControlController.updateValidity();
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
get tags() {
|
|
448
|
+
return this.selectedOptions.map((option, index) => {
|
|
449
|
+
if (index < this.maxOptionsVisible || this.maxOptionsVisible <= 0) {
|
|
450
|
+
const tag = this.getTag(option, index);
|
|
451
|
+
return html`<div @syn-remove=${(e) => this.handleTagRemove(e, option)}>
|
|
452
|
+
${typeof tag === "string" ? unsafeHTML(tag) : tag}
|
|
453
|
+
</div>`;
|
|
454
|
+
} else if (index === this.maxOptionsVisible) {
|
|
455
|
+
return html`<syn-tag>+${this.selectedOptions.length - index}</syn-tag>`;
|
|
456
|
+
}
|
|
457
|
+
return html``;
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
handleInvalid(event) {
|
|
461
|
+
this.formControlController.setValidity(false);
|
|
462
|
+
this.formControlController.emitInvalidEvent(event);
|
|
463
|
+
}
|
|
464
|
+
handleDisabledChange() {
|
|
465
|
+
if (this.disabled) {
|
|
466
|
+
this.open = false;
|
|
467
|
+
this.handleOpenChange();
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
handleValueChange() {
|
|
471
|
+
const allOptions = this.getAllOptions();
|
|
472
|
+
const value = Array.isArray(this.value) ? this.value : [this.value];
|
|
473
|
+
this.setSelectedOptions(allOptions.filter((el) => value.includes(el.value)));
|
|
474
|
+
}
|
|
475
|
+
async handleOpenChange() {
|
|
476
|
+
if (this.open && !this.disabled) {
|
|
477
|
+
this.setCurrentOption(this.selectedOptions[0] || this.getFirstOption());
|
|
478
|
+
this.emit("syn-show");
|
|
479
|
+
this.addOpenListeners();
|
|
480
|
+
await stopAnimations(this);
|
|
481
|
+
this.listbox.hidden = false;
|
|
482
|
+
this.popup.active = true;
|
|
483
|
+
requestAnimationFrame(() => {
|
|
484
|
+
this.setCurrentOption(this.currentOption);
|
|
485
|
+
});
|
|
486
|
+
const { keyframes, options } = getAnimation(this, "select.show", { dir: this.localize.dir() });
|
|
487
|
+
await animateTo(this.popup.popup, keyframes, options);
|
|
488
|
+
if (this.currentOption) {
|
|
489
|
+
scrollIntoView(this.currentOption, this.listbox, "vertical", "auto");
|
|
490
|
+
}
|
|
491
|
+
this.emit("syn-after-show");
|
|
492
|
+
} else {
|
|
493
|
+
this.emit("syn-hide");
|
|
494
|
+
this.removeOpenListeners();
|
|
495
|
+
await stopAnimations(this);
|
|
496
|
+
const { keyframes, options } = getAnimation(this, "select.hide", { dir: this.localize.dir() });
|
|
497
|
+
await animateTo(this.popup.popup, keyframes, options);
|
|
498
|
+
this.listbox.hidden = true;
|
|
499
|
+
this.popup.active = false;
|
|
500
|
+
this.emit("syn-after-hide");
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
/** Shows the listbox. */
|
|
504
|
+
async show() {
|
|
505
|
+
if (this.open || this.disabled) {
|
|
506
|
+
this.open = false;
|
|
507
|
+
return void 0;
|
|
508
|
+
}
|
|
509
|
+
this.open = true;
|
|
510
|
+
return waitForEvent(this, "syn-after-show");
|
|
511
|
+
}
|
|
512
|
+
/** Hides the listbox. */
|
|
513
|
+
async hide() {
|
|
514
|
+
if (!this.open || this.disabled) {
|
|
515
|
+
this.open = false;
|
|
516
|
+
return void 0;
|
|
517
|
+
}
|
|
518
|
+
this.open = false;
|
|
519
|
+
return waitForEvent(this, "syn-after-hide");
|
|
520
|
+
}
|
|
521
|
+
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
522
|
+
checkValidity() {
|
|
523
|
+
return this.valueInput.checkValidity();
|
|
524
|
+
}
|
|
525
|
+
/** Gets the associated form, if one exists. */
|
|
526
|
+
getForm() {
|
|
527
|
+
return this.formControlController.getForm();
|
|
528
|
+
}
|
|
529
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
530
|
+
reportValidity() {
|
|
531
|
+
return this.valueInput.reportValidity();
|
|
532
|
+
}
|
|
533
|
+
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
534
|
+
setCustomValidity(message) {
|
|
535
|
+
this.valueInput.setCustomValidity(message);
|
|
536
|
+
this.formControlController.updateValidity();
|
|
537
|
+
}
|
|
538
|
+
/** Sets focus on the control. */
|
|
539
|
+
focus(options) {
|
|
540
|
+
this.displayInput.focus(options);
|
|
541
|
+
}
|
|
542
|
+
/** Removes focus from the control. */
|
|
543
|
+
blur() {
|
|
544
|
+
this.displayInput.blur();
|
|
545
|
+
}
|
|
546
|
+
render() {
|
|
547
|
+
const hasLabelSlot = this.hasSlotController.test("label");
|
|
548
|
+
const hasHelpTextSlot = this.hasSlotController.test("help-text");
|
|
549
|
+
const hasLabel = this.label ? true : !!hasLabelSlot;
|
|
550
|
+
const hasHelpText = this.helpText ? true : !!hasHelpTextSlot;
|
|
551
|
+
const hasClearIcon = this.clearable && !this.disabled && this.value.length > 0;
|
|
552
|
+
const isPlaceholderVisible = this.placeholder && this.value.length === 0;
|
|
553
|
+
return html`
|
|
554
|
+
<div
|
|
555
|
+
part="form-control"
|
|
556
|
+
class=${classMap({
|
|
557
|
+
"form-control": true,
|
|
558
|
+
"form-control--small": this.size === "small",
|
|
559
|
+
"form-control--medium": this.size === "medium",
|
|
560
|
+
"form-control--large": this.size === "large",
|
|
561
|
+
"form-control--has-label": hasLabel,
|
|
562
|
+
"form-control--has-help-text": hasHelpText
|
|
563
|
+
})}
|
|
564
|
+
>
|
|
565
|
+
<label
|
|
566
|
+
id="label"
|
|
567
|
+
part="form-control-label"
|
|
568
|
+
class="form-control__label"
|
|
569
|
+
aria-hidden=${hasLabel ? "false" : "true"}
|
|
570
|
+
@click=${this.handleLabelClick}
|
|
571
|
+
>
|
|
572
|
+
<slot name="label">${this.label}</slot>
|
|
573
|
+
</label>
|
|
574
|
+
|
|
575
|
+
<div part="form-control-input" class="form-control-input">
|
|
576
|
+
<syn-popup
|
|
577
|
+
class=${classMap({
|
|
578
|
+
select: true,
|
|
579
|
+
"select--standard": true,
|
|
580
|
+
"select--open": this.open,
|
|
581
|
+
"select--disabled": this.disabled,
|
|
582
|
+
"select--multiple": this.multiple,
|
|
583
|
+
"select--focused": this.hasFocus,
|
|
584
|
+
"select--placeholder-visible": isPlaceholderVisible,
|
|
585
|
+
"select--top": this.placement === "top",
|
|
586
|
+
"select--bottom": this.placement === "bottom",
|
|
587
|
+
"select--small": this.size === "small",
|
|
588
|
+
"select--medium": this.size === "medium",
|
|
589
|
+
"select--large": this.size === "large"
|
|
590
|
+
})}
|
|
591
|
+
placement=${this.placement}
|
|
592
|
+
strategy=${this.hoist ? "fixed" : "absolute"}
|
|
593
|
+
flip
|
|
594
|
+
shift
|
|
595
|
+
sync="width"
|
|
596
|
+
auto-size="vertical"
|
|
597
|
+
auto-size-padding="10"
|
|
598
|
+
>
|
|
599
|
+
<div
|
|
600
|
+
part="combobox"
|
|
601
|
+
class="select__combobox"
|
|
602
|
+
slot="anchor"
|
|
603
|
+
@keydown=${this.handleComboboxKeyDown}
|
|
604
|
+
@mousedown=${this.handleComboboxMouseDown}
|
|
605
|
+
>
|
|
606
|
+
<slot part="prefix" name="prefix" class="select__prefix"></slot>
|
|
607
|
+
|
|
608
|
+
<input
|
|
609
|
+
part="display-input"
|
|
610
|
+
class="select__display-input"
|
|
611
|
+
type="text"
|
|
612
|
+
placeholder=${this.placeholder}
|
|
613
|
+
.disabled=${this.disabled}
|
|
614
|
+
.value=${this.displayLabel}
|
|
615
|
+
autocomplete="off"
|
|
616
|
+
spellcheck="false"
|
|
617
|
+
autocapitalize="off"
|
|
618
|
+
readonly
|
|
619
|
+
aria-controls="listbox"
|
|
620
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
621
|
+
aria-haspopup="listbox"
|
|
622
|
+
aria-labelledby="label"
|
|
623
|
+
aria-disabled=${this.disabled ? "true" : "false"}
|
|
624
|
+
aria-describedby="help-text"
|
|
625
|
+
role="combobox"
|
|
626
|
+
tabindex="0"
|
|
627
|
+
@focus=${this.handleFocus}
|
|
628
|
+
@blur=${this.handleBlur}
|
|
629
|
+
/>
|
|
630
|
+
|
|
631
|
+
${this.multiple ? html`<div part="tags" class="select__tags">${this.tags}</div>` : ""}
|
|
632
|
+
|
|
633
|
+
<input
|
|
634
|
+
class="select__value-input"
|
|
635
|
+
type="text"
|
|
636
|
+
?disabled=${this.disabled}
|
|
637
|
+
?required=${this.required}
|
|
638
|
+
.value=${Array.isArray(this.value) ? this.value.join(", ") : this.value}
|
|
639
|
+
tabindex="-1"
|
|
640
|
+
aria-hidden="true"
|
|
641
|
+
@focus=${() => this.focus()}
|
|
642
|
+
@invalid=${this.handleInvalid}
|
|
643
|
+
/>
|
|
644
|
+
|
|
645
|
+
${hasClearIcon ? html`
|
|
646
|
+
<button
|
|
647
|
+
part="clear-button"
|
|
648
|
+
class="select__clear"
|
|
649
|
+
type="button"
|
|
650
|
+
aria-label=${this.localize.term("clearEntry")}
|
|
651
|
+
@mousedown=${this.handleClearMouseDown}
|
|
652
|
+
@click=${this.handleClearClick}
|
|
653
|
+
tabindex="-1"
|
|
654
|
+
>
|
|
655
|
+
<slot name="clear-icon">
|
|
656
|
+
<syn-icon name="x-circle-fill" library="system"></syn-icon>
|
|
657
|
+
</slot>
|
|
658
|
+
</button>
|
|
659
|
+
` : ""}
|
|
660
|
+
|
|
661
|
+
<slot name="expand-icon" part="expand-icon" class="select__expand-icon">
|
|
662
|
+
<syn-icon library="system" name="chevron-down"></syn-icon>
|
|
663
|
+
</slot>
|
|
664
|
+
</div>
|
|
665
|
+
|
|
666
|
+
<div
|
|
667
|
+
id="listbox"
|
|
668
|
+
role="listbox"
|
|
669
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
670
|
+
aria-multiselectable=${this.multiple ? "true" : "false"}
|
|
671
|
+
aria-labelledby="label"
|
|
672
|
+
part="listbox"
|
|
673
|
+
class="select__listbox"
|
|
674
|
+
tabindex="-1"
|
|
675
|
+
@mouseup=${this.handleOptionClick}
|
|
676
|
+
@slotchange=${this.handleDefaultSlotChange}
|
|
677
|
+
>
|
|
678
|
+
<slot></slot>
|
|
679
|
+
</div>
|
|
680
|
+
</syn-popup>
|
|
681
|
+
</div>
|
|
682
|
+
|
|
683
|
+
<div
|
|
684
|
+
part="form-control-help-text"
|
|
685
|
+
id="help-text"
|
|
686
|
+
class="form-control__help-text"
|
|
687
|
+
aria-hidden=${hasHelpText ? "false" : "true"}
|
|
688
|
+
>
|
|
689
|
+
<slot name="help-text">${this.helpText}</slot>
|
|
690
|
+
</div>
|
|
691
|
+
</div>
|
|
692
|
+
`;
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
SynSelect.styles = select_styles_default;
|
|
696
|
+
SynSelect.dependencies = {
|
|
697
|
+
"syn-icon": SynIcon,
|
|
698
|
+
"syn-popup": SynPopup,
|
|
699
|
+
"syn-tag": SynTag
|
|
700
|
+
};
|
|
701
|
+
__decorateClass([
|
|
702
|
+
query(".select")
|
|
703
|
+
], SynSelect.prototype, "popup", 2);
|
|
704
|
+
__decorateClass([
|
|
705
|
+
query(".select__combobox")
|
|
706
|
+
], SynSelect.prototype, "combobox", 2);
|
|
707
|
+
__decorateClass([
|
|
708
|
+
query(".select__display-input")
|
|
709
|
+
], SynSelect.prototype, "displayInput", 2);
|
|
710
|
+
__decorateClass([
|
|
711
|
+
query(".select__value-input")
|
|
712
|
+
], SynSelect.prototype, "valueInput", 2);
|
|
713
|
+
__decorateClass([
|
|
714
|
+
query(".select__listbox")
|
|
715
|
+
], SynSelect.prototype, "listbox", 2);
|
|
716
|
+
__decorateClass([
|
|
717
|
+
state()
|
|
718
|
+
], SynSelect.prototype, "hasFocus", 2);
|
|
719
|
+
__decorateClass([
|
|
720
|
+
state()
|
|
721
|
+
], SynSelect.prototype, "displayLabel", 2);
|
|
722
|
+
__decorateClass([
|
|
723
|
+
state()
|
|
724
|
+
], SynSelect.prototype, "currentOption", 2);
|
|
725
|
+
__decorateClass([
|
|
726
|
+
state()
|
|
727
|
+
], SynSelect.prototype, "selectedOptions", 2);
|
|
728
|
+
__decorateClass([
|
|
729
|
+
property()
|
|
730
|
+
], SynSelect.prototype, "name", 2);
|
|
731
|
+
__decorateClass([
|
|
732
|
+
property({
|
|
733
|
+
converter: {
|
|
734
|
+
fromAttribute: (value) => value.split(" "),
|
|
735
|
+
toAttribute: (value) => value.join(" ")
|
|
736
|
+
}
|
|
737
|
+
})
|
|
738
|
+
], SynSelect.prototype, "value", 2);
|
|
739
|
+
__decorateClass([
|
|
740
|
+
defaultValue()
|
|
741
|
+
], SynSelect.prototype, "defaultValue", 2);
|
|
742
|
+
__decorateClass([
|
|
743
|
+
property({ reflect: true })
|
|
744
|
+
], SynSelect.prototype, "size", 2);
|
|
745
|
+
__decorateClass([
|
|
746
|
+
property()
|
|
747
|
+
], SynSelect.prototype, "placeholder", 2);
|
|
748
|
+
__decorateClass([
|
|
749
|
+
property({ type: Boolean, reflect: true })
|
|
750
|
+
], SynSelect.prototype, "multiple", 2);
|
|
751
|
+
__decorateClass([
|
|
752
|
+
property({ attribute: "max-options-visible", type: Number })
|
|
753
|
+
], SynSelect.prototype, "maxOptionsVisible", 2);
|
|
754
|
+
__decorateClass([
|
|
755
|
+
property({ type: Boolean, reflect: true })
|
|
756
|
+
], SynSelect.prototype, "disabled", 2);
|
|
757
|
+
__decorateClass([
|
|
758
|
+
property({ type: Boolean })
|
|
759
|
+
], SynSelect.prototype, "clearable", 2);
|
|
760
|
+
__decorateClass([
|
|
761
|
+
property({ type: Boolean, reflect: true })
|
|
762
|
+
], SynSelect.prototype, "open", 2);
|
|
763
|
+
__decorateClass([
|
|
764
|
+
property({ type: Boolean })
|
|
765
|
+
], SynSelect.prototype, "hoist", 2);
|
|
766
|
+
__decorateClass([
|
|
767
|
+
property()
|
|
768
|
+
], SynSelect.prototype, "label", 2);
|
|
769
|
+
__decorateClass([
|
|
770
|
+
property({ reflect: true })
|
|
771
|
+
], SynSelect.prototype, "placement", 2);
|
|
772
|
+
__decorateClass([
|
|
773
|
+
property({ attribute: "help-text" })
|
|
774
|
+
], SynSelect.prototype, "helpText", 2);
|
|
775
|
+
__decorateClass([
|
|
776
|
+
property({ reflect: true })
|
|
777
|
+
], SynSelect.prototype, "form", 2);
|
|
778
|
+
__decorateClass([
|
|
779
|
+
property({ type: Boolean, reflect: true })
|
|
780
|
+
], SynSelect.prototype, "required", 2);
|
|
781
|
+
__decorateClass([
|
|
782
|
+
property()
|
|
783
|
+
], SynSelect.prototype, "getTag", 2);
|
|
784
|
+
__decorateClass([
|
|
785
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
786
|
+
], SynSelect.prototype, "handleDisabledChange", 1);
|
|
787
|
+
__decorateClass([
|
|
788
|
+
watch("value", { waitUntilFirstUpdate: true })
|
|
789
|
+
], SynSelect.prototype, "handleValueChange", 1);
|
|
790
|
+
__decorateClass([
|
|
791
|
+
watch("open", { waitUntilFirstUpdate: true })
|
|
792
|
+
], SynSelect.prototype, "handleOpenChange", 1);
|
|
793
|
+
setDefaultAnimation("select.show", {
|
|
794
|
+
keyframes: [
|
|
795
|
+
{ opacity: 0, scale: 0.9 },
|
|
796
|
+
{ opacity: 1, scale: 1 }
|
|
797
|
+
],
|
|
798
|
+
options: { duration: 100, easing: "ease" }
|
|
799
|
+
});
|
|
800
|
+
setDefaultAnimation("select.hide", {
|
|
801
|
+
keyframes: [
|
|
802
|
+
{ opacity: 1, scale: 1 },
|
|
803
|
+
{ opacity: 0, scale: 0.9 }
|
|
804
|
+
],
|
|
805
|
+
options: { duration: 100, easing: "ease" }
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
export {
|
|
809
|
+
SynSelect
|
|
810
|
+
};
|
|
811
|
+
//# sourceMappingURL=chunk.UTDK2ZT6.js.map
|