@prioticket/design-system-web 1.4.1 → 1.4.2
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/COMPONENT-DOCUMENTATION.md +19 -20
- package/component-documentation.json +20 -25
- package/custom-elements.json +60 -170
- package/dist/components/pd-select.cjs.js +136 -124
- package/dist/components/pd-select.es.js +243 -270
- package/dist/types/components/pd-select.d.ts +13 -44
- package/package.json +1 -1
|
@@ -1,280 +1,253 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { query as
|
|
1
|
+
import { css as y, LitElement as v, render as h, nothing as d, html as i } from "lit";
|
|
2
|
+
import { query as m, property as a, state as u, customElement as f } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/select/filled-select.js";
|
|
4
4
|
import "@material/web/select/outlined-select.js";
|
|
5
5
|
import "@material/web/select/select-option.js";
|
|
6
6
|
import "@material/web/icon/icon.js";
|
|
7
7
|
import "@material/web/checkbox/checkbox.js";
|
|
8
8
|
import "./pd-chip.es.js";
|
|
9
|
-
var
|
|
10
|
-
for (var n =
|
|
11
|
-
(p = e[
|
|
12
|
-
return
|
|
9
|
+
var g = Object.defineProperty, b = Object.getOwnPropertyDescriptor, s = (e, t, r, l) => {
|
|
10
|
+
for (var n = l > 1 ? void 0 : l ? b(t, r) : t, c = e.length - 1, p; c >= 0; c--)
|
|
11
|
+
(p = e[c]) && (n = (l ? p(t, r, n) : p(n)) || n);
|
|
12
|
+
return l && n && g(t, r, n), n;
|
|
13
13
|
};
|
|
14
|
-
let
|
|
14
|
+
let o = class extends v {
|
|
15
15
|
constructor() {
|
|
16
|
-
super(...arguments), this.variant = "outlined", this.label = "", this.value = "", this.disabled = !1, this.required = !1, this.errorText = "", this.error = !1, this.supportingText = "", this.options = [], this.leadingIcon = "", this.multiple = !1, this.showChips = !0, this.chipVariant = "input", this.placeholder = "", this.searchable = !1, this.isOpen = !1, this.searchQuery = "", this.selectedValues = [], this.
|
|
16
|
+
super(...arguments), this.variant = "outlined", this.label = "", this.value = "", this.disabled = !1, this.required = !1, this.errorText = "", this.error = !1, this.supportingText = "", this.options = [], this.leadingIcon = "", this.multiple = !1, this.showChips = !0, this.chipVariant = "input", this.placeholder = "", this.searchable = !1, this.isOpen = !1, this.searchQuery = "", this.selectedValues = [], this.overlayEl = null, this.updateOverlayPosition = () => {
|
|
17
|
+
if (!this.overlayEl || !this.trigger) return;
|
|
18
|
+
const e = this.trigger.getBoundingClientRect();
|
|
19
|
+
this.overlayEl.style.left = `${e.left}px`, this.overlayEl.style.top = `${e.bottom + 4}px`, this.overlayEl.style.width = `${e.width}px`;
|
|
20
|
+
}, this.handleTriggerClick = (e) => {
|
|
21
|
+
this.disabled || (e.stopPropagation(), this.searchQuery = "", this.isOpen = !this.isOpen);
|
|
22
|
+
}, this.handleClickOutside = (e) => {
|
|
23
|
+
if (!this.isOpen) return;
|
|
24
|
+
const t = e.composedPath();
|
|
25
|
+
t.includes(this) || this.overlayEl && t.includes(this.overlayEl) || (this.isOpen = !1);
|
|
26
|
+
}, this.handleKeyDown = (e) => {
|
|
27
|
+
e.key === "Escape" && (this.isOpen = !1);
|
|
28
|
+
};
|
|
17
29
|
}
|
|
18
30
|
connectedCallback() {
|
|
19
|
-
super.connectedCallback(), document.addEventListener("click", this.
|
|
31
|
+
super.connectedCallback(), document.addEventListener("click", this.handleClickOutside), document.addEventListener("keydown", this.handleKeyDown), window.addEventListener("scroll", this.updateOverlayPosition, !0), window.addEventListener("resize", this.updateOverlayPosition);
|
|
20
32
|
}
|
|
21
33
|
disconnectedCallback() {
|
|
22
|
-
super.disconnectedCallback(), document.removeEventListener("click", this.
|
|
34
|
+
super.disconnectedCallback(), document.removeEventListener("click", this.handleClickOutside), document.removeEventListener("keydown", this.handleKeyDown), window.removeEventListener("scroll", this.updateOverlayPosition, !0), window.removeEventListener("resize", this.updateOverlayPosition), this.closeOverlay();
|
|
23
35
|
}
|
|
24
36
|
willUpdate(e) {
|
|
25
|
-
e.has("value") && this.multiple && (Array.isArray(this.value) ?
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
e.stopPropagation();
|
|
29
|
-
const i = e.target;
|
|
30
|
-
this.value = i.value, this.dispatchEvent(
|
|
31
|
-
new CustomEvent("change", {
|
|
32
|
-
bubbles: !0,
|
|
33
|
-
composed: !0,
|
|
34
|
-
detail: { value: this.value }
|
|
35
|
-
})
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
handleOpen() {
|
|
39
|
-
this.trailingIcon?.classList.add("rotated");
|
|
40
|
-
}
|
|
41
|
-
handleClose() {
|
|
42
|
-
this.trailingIcon?.classList.remove("rotated");
|
|
43
|
-
}
|
|
44
|
-
// Multi-select specific handlers
|
|
45
|
-
handleTriggerClick(e) {
|
|
46
|
-
this.disabled || (e.stopPropagation(), this.isOpen = !this.isOpen, this.isOpen && (this.searchQuery = "", this.updateComplete.then(() => {
|
|
47
|
-
this.updateDropdownPosition();
|
|
48
|
-
})));
|
|
49
|
-
}
|
|
50
|
-
handleOptionClick(e, i) {
|
|
51
|
-
if (i.stopPropagation(), !this.options.find((a) => a.value === e)?.disabled) {
|
|
52
|
-
if (this.selectedValues.includes(e))
|
|
53
|
-
this.selectedValues = this.selectedValues.filter((a) => a !== e);
|
|
54
|
-
else {
|
|
55
|
-
if (this.maxSelections && this.selectedValues.length >= this.maxSelections) return;
|
|
56
|
-
this.selectedValues = [...this.selectedValues, e];
|
|
57
|
-
}
|
|
58
|
-
this.value = [...this.selectedValues], this.dispatchEvent(
|
|
59
|
-
new CustomEvent("change", {
|
|
60
|
-
bubbles: !0,
|
|
61
|
-
composed: !0,
|
|
62
|
-
detail: { value: this.selectedValues }
|
|
63
|
-
})
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
handleChipRemove(e, i) {
|
|
68
|
-
i.stopPropagation(), this.selectedValues = this.selectedValues.filter((o) => o !== e), this.value = [...this.selectedValues], this.dispatchEvent(
|
|
69
|
-
new CustomEvent("change", {
|
|
70
|
-
bubbles: !0,
|
|
71
|
-
composed: !0,
|
|
72
|
-
detail: { value: this.selectedValues }
|
|
73
|
-
})
|
|
74
|
-
), this.dispatchEvent(
|
|
75
|
-
new CustomEvent("chip-remove", {
|
|
76
|
-
bubbles: !0,
|
|
77
|
-
composed: !0,
|
|
78
|
-
detail: { value: e }
|
|
79
|
-
})
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
handleClickOutside(e) {
|
|
83
|
-
if (!this.isOpen) return;
|
|
84
|
-
e.composedPath().includes(this) || (this.isOpen = !1);
|
|
85
|
-
}
|
|
86
|
-
handleKeyDown(e) {
|
|
87
|
-
if (!this.isOpen && (e.key === "Enter" || e.key === " ")) {
|
|
88
|
-
this.multiple && e.target === this.trigger && (this.isOpen = !0, this.searchQuery = "", this.updateComplete.then(() => this.updateDropdownPosition()), e.preventDefault());
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
this.isOpen && e.key === "Escape" && (this.isOpen = !1, e.preventDefault());
|
|
92
|
-
}
|
|
93
|
-
handleSearchInput(e) {
|
|
94
|
-
const i = e.target;
|
|
95
|
-
this.searchQuery = i.value;
|
|
96
|
-
}
|
|
97
|
-
updateDropdownPosition() {
|
|
37
|
+
e.has("value") && this.multiple && (this.selectedValues = Array.isArray(this.value) ? [...this.value] : this.value ? [this.value] : []), e.has("isOpen") && (this.isOpen ? this.openOverlay() : this.closeOverlay()), this.overlayEl && (e.has("searchQuery") || e.has("selectedValues")) && (h(this.renderDropdown(), this.overlayEl), e.has("selectedValues") && this.updateComplete.then(() => {
|
|
38
|
+
requestAnimationFrame(() => this.updateOverlayPosition());
|
|
39
|
+
}));
|
|
98
40
|
}
|
|
99
41
|
getOptionLabel(e) {
|
|
100
|
-
return this.options.find((
|
|
101
|
-
}
|
|
102
|
-
isSelected(e) {
|
|
103
|
-
return this.selectedValues.includes(e);
|
|
42
|
+
return this.options.find((t) => t.value === e)?.label ?? e;
|
|
104
43
|
}
|
|
105
44
|
get filteredOptions() {
|
|
106
45
|
const e = this.searchQuery.trim().toLowerCase();
|
|
107
|
-
return e ? this.options.filter((
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
46
|
+
return e ? this.options.filter((t) => t.label.toLowerCase().includes(e)) : this.options;
|
|
47
|
+
}
|
|
48
|
+
openOverlay() {
|
|
49
|
+
if (this.overlayEl || !this.trigger) return;
|
|
50
|
+
const e = this.trigger.getBoundingClientRect(), t = document.createElement("div");
|
|
51
|
+
t.style.position = "fixed", t.style.left = `${e.left}px`, t.style.top = `${e.bottom + 4}px`, t.style.width = `${e.width}px`, t.style.zIndex = "10000";
|
|
52
|
+
const r = document.createElement("style");
|
|
53
|
+
r.textContent = o.overlayStyles, t.appendChild(r), document.body.appendChild(t), this.overlayEl = t, h(this.renderDropdown(), t);
|
|
54
|
+
}
|
|
55
|
+
closeOverlay() {
|
|
56
|
+
this.overlayEl && (h(d, this.overlayEl), this.overlayEl.remove(), this.overlayEl = null);
|
|
57
|
+
}
|
|
58
|
+
handleOptionClick(e, t) {
|
|
59
|
+
if (t.stopPropagation(), this.selectedValues.includes(e))
|
|
60
|
+
this.selectedValues = this.selectedValues.filter((r) => r !== e);
|
|
61
|
+
else {
|
|
62
|
+
if (this.maxSelections && this.selectedValues.length >= this.maxSelections) return;
|
|
63
|
+
this.selectedValues = [...this.selectedValues, e];
|
|
64
|
+
}
|
|
65
|
+
this.value = [...this.selectedValues], this.dispatchEvent(new CustomEvent("change", {
|
|
66
|
+
bubbles: !0,
|
|
67
|
+
composed: !0,
|
|
68
|
+
detail: { value: this.value }
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
handleChipRemove(e, t) {
|
|
72
|
+
t.stopPropagation(), this.selectedValues = this.selectedValues.filter((r) => r !== e), this.value = [...this.selectedValues];
|
|
73
|
+
}
|
|
74
|
+
/* -------------------- Rendering -------------------- */
|
|
75
|
+
renderDropdown() {
|
|
76
|
+
return i`
|
|
77
|
+
<div class="dropdown" role="listbox" aria-multiselectable="true">
|
|
78
|
+
${this.searchable ? i`
|
|
79
|
+
<div class="search">
|
|
80
|
+
<md-icon class="pd-icon">search</md-icon>
|
|
81
|
+
<input
|
|
82
|
+
type="text"
|
|
83
|
+
.value=${this.searchQuery}
|
|
84
|
+
@input=${(e) => this.searchQuery = e.target.value}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
` : d}
|
|
88
|
+
|
|
89
|
+
<div class="options">
|
|
90
|
+
${this.filteredOptions.map((e) => {
|
|
91
|
+
const t = this.selectedValues.includes(e.value), r = e.disabled ?? !1;
|
|
92
|
+
return i`
|
|
93
|
+
<div
|
|
94
|
+
class="option"
|
|
95
|
+
data-selected=${t}
|
|
96
|
+
data-disabled=${r}
|
|
97
|
+
@click=${(l) => !r && this.handleOptionClick(e.value, l)}
|
|
98
|
+
>
|
|
99
|
+
<md-checkbox ?checked=${t} ?disabled=${r}></md-checkbox>
|
|
100
|
+
<span>${e.label}</span>
|
|
101
|
+
</div>
|
|
102
|
+
`;
|
|
103
|
+
})}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
`;
|
|
111
107
|
}
|
|
112
|
-
// Render multi-select mode
|
|
113
108
|
renderMultiSelect() {
|
|
114
|
-
const e = this.selectedValues.length > 0,
|
|
115
|
-
return
|
|
109
|
+
const e = this.selectedValues.length > 0, t = e || this.isOpen;
|
|
110
|
+
return i`
|
|
116
111
|
<div class="container">
|
|
117
112
|
<div class="wrap">
|
|
118
|
-
${this.label ?
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
${this.label ? i`
|
|
114
|
+
<label class="label" data-float=${t}>
|
|
115
|
+
${this.label}${this.required ? i`<span class="required">*</span>` : d}
|
|
116
|
+
</label>
|
|
117
|
+
` : d}
|
|
123
118
|
|
|
124
119
|
<div
|
|
125
120
|
class="field"
|
|
126
|
-
data-open=${this.isOpen
|
|
127
|
-
|
|
128
|
-
@keydown=${this.handleKeyDown}
|
|
129
|
-
tabindex=${this.disabled ? "-1" : "0"}
|
|
121
|
+
data-open=${this.isOpen}
|
|
122
|
+
tabindex="0"
|
|
130
123
|
role="combobox"
|
|
131
|
-
|
|
132
|
-
aria-haspopup="listbox"
|
|
133
|
-
aria-disabled=${this.disabled}
|
|
134
|
-
aria-label=${this.label || "Select"}
|
|
124
|
+
@click=${this.handleTriggerClick}
|
|
135
125
|
>
|
|
136
|
-
${this.leadingIcon ?
|
|
126
|
+
${this.leadingIcon ? i`<md-icon class="pd-icon pd-icon--leading">${this.leadingIcon}</md-icon>` : d}
|
|
137
127
|
|
|
138
128
|
<div class="content">
|
|
139
|
-
${e
|
|
129
|
+
${e ? i`
|
|
140
130
|
<div class="chips">
|
|
141
|
-
${this.selectedValues.map(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
?removable=${this.chipVariant === "filter"}
|
|
148
|
-
?disabled=${this.disabled}
|
|
149
|
-
@chip-remove=${(a) => this.handleChipRemove(o, a)}
|
|
150
|
-
@chip-click=${(a) => this.handleChipRemove(o, a)}
|
|
151
|
-
></pd-chip>
|
|
152
|
-
`
|
|
153
|
-
)}
|
|
131
|
+
${this.selectedValues.map((r) => i`
|
|
132
|
+
<pd-chip
|
|
133
|
+
label=${this.getOptionLabel(r)}
|
|
134
|
+
@chip-remove=${(l) => this.handleChipRemove(r, l)}
|
|
135
|
+
></pd-chip>
|
|
136
|
+
`)}
|
|
154
137
|
</div>
|
|
155
|
-
` :
|
|
138
|
+
` : i`<span class="placeholder">${this.placeholder}</span>`}
|
|
156
139
|
</div>
|
|
157
140
|
|
|
158
|
-
<md-icon
|
|
159
|
-
class="pd-icon pd-icon--trailing"
|
|
160
|
-
aria-hidden="true"
|
|
161
|
-
data-rotated=${this.isOpen ? "true" : "false"}
|
|
162
|
-
>
|
|
141
|
+
<md-icon class="pd-icon pd-icon--trailing" data-rotated=${this.isOpen}>
|
|
163
142
|
keyboard_arrow_down
|
|
164
143
|
</md-icon>
|
|
165
144
|
</div>
|
|
166
|
-
|
|
167
|
-
${this.isOpen ? r`
|
|
168
|
-
<div class="dropdown" role="listbox" aria-multiselectable="true">
|
|
169
|
-
${this.searchable ? r`
|
|
170
|
-
<div class="search">
|
|
171
|
-
<md-icon class="pd-icon" aria-hidden="true">search</md-icon>
|
|
172
|
-
<input
|
|
173
|
-
type="text"
|
|
174
|
-
placeholder="Search..."
|
|
175
|
-
.value=${this.searchQuery}
|
|
176
|
-
@input=${this.handleSearchInput}
|
|
177
|
-
@click=${(o) => o.stopPropagation()}
|
|
178
|
-
/>
|
|
179
|
-
</div>
|
|
180
|
-
` : c}
|
|
181
|
-
|
|
182
|
-
<div class="options">
|
|
183
|
-
${this.filteredOptions.length === 0 ? r`<div class="option" data-disabled="true">No options found</div>` : this.filteredOptions.map((o) => {
|
|
184
|
-
const a = this.isSelected(o.value), n = !a && this.maxSelections !== void 0 && this.selectedValues.length >= this.maxSelections, d = !!o.disabled || n;
|
|
185
|
-
return r`
|
|
186
|
-
<div
|
|
187
|
-
class="option"
|
|
188
|
-
role="option"
|
|
189
|
-
data-selected=${a ? "true" : "false"}
|
|
190
|
-
data-disabled=${d ? "true" : "false"}
|
|
191
|
-
aria-selected=${a}
|
|
192
|
-
aria-disabled=${d}
|
|
193
|
-
@click=${(p) => !d && this.handleOptionClick(o.value, p)}
|
|
194
|
-
>
|
|
195
|
-
<md-checkbox
|
|
196
|
-
?checked=${a}
|
|
197
|
-
?disabled=${d}
|
|
198
|
-
touch-target="wrapper"
|
|
199
|
-
@click=${(p) => p.stopPropagation()}
|
|
200
|
-
@change=${(p) => !d && this.handleOptionClick(o.value, p)}
|
|
201
|
-
></md-checkbox>
|
|
202
|
-
<span>${o.label}</span>
|
|
203
|
-
</div>
|
|
204
|
-
`;
|
|
205
|
-
})}
|
|
206
|
-
</div>
|
|
207
|
-
</div>
|
|
208
|
-
` : c}
|
|
209
145
|
</div>
|
|
210
146
|
|
|
211
|
-
${this.supportingText
|
|
212
|
-
<div class="supporting">
|
|
213
|
-
${this.error && this.errorText ? this.errorText : this.supportingText}
|
|
214
|
-
</div>
|
|
215
|
-
` : c}
|
|
147
|
+
${this.supportingText ? i`<div class="supporting">${this.supportingText}</div>` : d}
|
|
216
148
|
</div>
|
|
217
149
|
`;
|
|
218
150
|
}
|
|
219
|
-
// Render single-select mode (Material Web select)
|
|
220
151
|
renderSingleSelect() {
|
|
221
|
-
const e =
|
|
222
|
-
${this.leadingIcon ?
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
<div slot="headline">${i.label}</div>
|
|
230
|
-
</md-select-option>
|
|
231
|
-
`
|
|
232
|
-
)}
|
|
233
|
-
`;
|
|
234
|
-
return this.variant === "filled" ? r`
|
|
235
|
-
<md-filled-select
|
|
236
|
-
.label=${this.label}
|
|
237
|
-
.value=${this.value}
|
|
238
|
-
?disabled=${this.disabled}
|
|
239
|
-
?required=${this.required}
|
|
240
|
-
?error=${this.error}
|
|
241
|
-
.errorText=${this.errorText}
|
|
242
|
-
.supportingText=${this.supportingText}
|
|
243
|
-
@change=${this.handleChange}
|
|
244
|
-
@opening=${this.handleOpen}
|
|
245
|
-
@closed=${this.handleClose}
|
|
246
|
-
>
|
|
247
|
-
${e}
|
|
248
|
-
</md-filled-select>
|
|
249
|
-
` : r`
|
|
250
|
-
<md-outlined-select
|
|
251
|
-
.label=${this.label}
|
|
252
|
-
.value=${this.value}
|
|
253
|
-
?disabled=${this.disabled}
|
|
254
|
-
?required=${this.required}
|
|
255
|
-
?error=${this.error}
|
|
256
|
-
.errorText=${this.errorText}
|
|
257
|
-
.supportingText=${this.supportingText}
|
|
258
|
-
@change=${this.handleChange}
|
|
259
|
-
@opening=${this.handleOpen}
|
|
260
|
-
@closed=${this.handleClose}
|
|
261
|
-
>
|
|
262
|
-
${e}
|
|
263
|
-
</md-outlined-select>
|
|
152
|
+
const e = i`
|
|
153
|
+
${this.leadingIcon ? i`<md-icon slot="leading-icon" class="pd-icon">${this.leadingIcon}</md-icon>` : d}
|
|
154
|
+
<md-icon slot="trailing-icon" class="pd-icon">keyboard_arrow_down</md-icon>
|
|
155
|
+
${this.options.map((t) => i`
|
|
156
|
+
<md-select-option .value=${t.value} ?disabled=${t.disabled}>
|
|
157
|
+
<div slot="headline">${t.label}</div>
|
|
158
|
+
</md-select-option>
|
|
159
|
+
`)}
|
|
264
160
|
`;
|
|
161
|
+
return this.variant === "filled" ? i`<md-filled-select .label=${this.label}>${e}</md-filled-select>` : i`<md-outlined-select .label=${this.label}>${e}</md-outlined-select>`;
|
|
265
162
|
}
|
|
266
163
|
render() {
|
|
267
164
|
return this.multiple ? this.renderMultiSelect() : this.renderSingleSelect();
|
|
268
165
|
}
|
|
269
166
|
};
|
|
270
|
-
|
|
167
|
+
o.overlayStyles = `
|
|
168
|
+
.dropdown {
|
|
169
|
+
background: var(--md-sys-color-surface-container, #f3edf7);
|
|
170
|
+
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
171
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
max-height: 320px;
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
animation: dropdown-open 200ms cubic-bezier(0.2, 0, 0, 1) forwards;
|
|
177
|
+
transform-origin: top left;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@keyframes dropdown-open {
|
|
181
|
+
from { opacity: 0; transform: scaleY(0.8); }
|
|
182
|
+
to { opacity: 1; transform: scaleY(1); }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.search {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 12px;
|
|
189
|
+
padding: 12px 16px;
|
|
190
|
+
border-bottom: 1px solid var(--md-sys-color-outline-variant, #cac4d0);
|
|
191
|
+
background: var(--md-sys-color-surface-container, #f3edf7);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.search input {
|
|
195
|
+
flex: 1;
|
|
196
|
+
border: none;
|
|
197
|
+
background: transparent;
|
|
198
|
+
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
199
|
+
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
200
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
201
|
+
outline: none;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.options {
|
|
205
|
+
overflow-y: auto;
|
|
206
|
+
flex: 1;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.option {
|
|
210
|
+
display: flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
gap: 12px;
|
|
213
|
+
padding: 12px 16px;
|
|
214
|
+
cursor: pointer;
|
|
215
|
+
transition: background-color 100ms ease;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.option:hover {
|
|
219
|
+
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.option[data-selected="true"] {
|
|
223
|
+
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.option[data-disabled="true"] {
|
|
227
|
+
opacity: 0.38;
|
|
228
|
+
cursor: default;
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.option span {
|
|
233
|
+
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
234
|
+
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
235
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.pd-icon {
|
|
239
|
+
font-size: 24px;
|
|
240
|
+
color: var(--md-sys-color-on-surface-variant, #49454f);
|
|
241
|
+
}
|
|
242
|
+
`;
|
|
243
|
+
o.styles = y`
|
|
271
244
|
:host {
|
|
272
245
|
display: inline-block;
|
|
273
246
|
width: 100%;
|
|
274
247
|
font-family: var(--md-sys-typescale-body-large-font, inherit);
|
|
275
248
|
/* one source of truth */
|
|
276
249
|
--pd-select-padding-x: 16px;
|
|
277
|
-
--pd-select-padding-y:
|
|
250
|
+
--pd-select-padding-y: 16px;
|
|
278
251
|
--pd-select-icon-size: 24px;
|
|
279
252
|
--pd-select-gap: 8px;
|
|
280
253
|
--md-filled-select-text-field-container-shape: var(--md-sys-shape-corner-small);
|
|
@@ -324,8 +297,8 @@ t.styles = m`
|
|
|
324
297
|
color: var(--md-sys-color-on-surface-variant);
|
|
325
298
|
pointer-events: none;
|
|
326
299
|
transition: all var(--md-sys-motion-duration-short2, 150ms)
|
|
327
|
-
|
|
328
|
-
background:
|
|
300
|
+
var(--md-sys-motion-easing-standard, ease);
|
|
301
|
+
background: #fff;
|
|
329
302
|
padding: 0 4px;
|
|
330
303
|
z-index: 1;
|
|
331
304
|
}
|
|
@@ -350,7 +323,7 @@ t.styles = m`
|
|
|
350
323
|
padding: var(--pd-select-padding-y) var(--pd-select-padding-x);
|
|
351
324
|
border-radius: var(--md-sys-shape-corner-small, 4px);
|
|
352
325
|
cursor: pointer;
|
|
353
|
-
background:
|
|
326
|
+
background: #fff;
|
|
354
327
|
transition: all var(--md-sys-motion-duration-short2, 150ms)
|
|
355
328
|
var(--md-sys-motion-easing-standard, ease);
|
|
356
329
|
}
|
|
@@ -519,74 +492,74 @@ t.styles = m`
|
|
|
519
492
|
}
|
|
520
493
|
`;
|
|
521
494
|
s([
|
|
522
|
-
|
|
523
|
-
],
|
|
495
|
+
m("md-filled-select, md-outlined-select")
|
|
496
|
+
], o.prototype, "select", 2);
|
|
524
497
|
s([
|
|
525
|
-
|
|
526
|
-
],
|
|
498
|
+
m('[slot="trailing-icon"]')
|
|
499
|
+
], o.prototype, "trailingIcon", 2);
|
|
527
500
|
s([
|
|
528
|
-
|
|
529
|
-
],
|
|
501
|
+
m(".field")
|
|
502
|
+
], o.prototype, "trigger", 2);
|
|
530
503
|
s([
|
|
531
|
-
|
|
532
|
-
],
|
|
504
|
+
a({ type: String, reflect: !0 })
|
|
505
|
+
], o.prototype, "variant", 2);
|
|
533
506
|
s([
|
|
534
|
-
|
|
535
|
-
],
|
|
507
|
+
a({ type: String })
|
|
508
|
+
], o.prototype, "label", 2);
|
|
536
509
|
s([
|
|
537
|
-
|
|
538
|
-
],
|
|
510
|
+
a({ type: String, reflect: !0 })
|
|
511
|
+
], o.prototype, "value", 2);
|
|
539
512
|
s([
|
|
540
|
-
|
|
541
|
-
],
|
|
513
|
+
a({ type: Boolean, reflect: !0 })
|
|
514
|
+
], o.prototype, "disabled", 2);
|
|
542
515
|
s([
|
|
543
|
-
|
|
544
|
-
],
|
|
516
|
+
a({ type: Boolean })
|
|
517
|
+
], o.prototype, "required", 2);
|
|
545
518
|
s([
|
|
546
|
-
|
|
547
|
-
],
|
|
519
|
+
a({ type: String, attribute: "error-text" })
|
|
520
|
+
], o.prototype, "errorText", 2);
|
|
548
521
|
s([
|
|
549
|
-
|
|
550
|
-
],
|
|
522
|
+
a({ type: Boolean, reflect: !0 })
|
|
523
|
+
], o.prototype, "error", 2);
|
|
551
524
|
s([
|
|
552
|
-
|
|
553
|
-
],
|
|
525
|
+
a({ type: String, attribute: "supporting-text" })
|
|
526
|
+
], o.prototype, "supportingText", 2);
|
|
554
527
|
s([
|
|
555
|
-
|
|
556
|
-
],
|
|
528
|
+
a({ type: Array })
|
|
529
|
+
], o.prototype, "options", 2);
|
|
557
530
|
s([
|
|
558
|
-
|
|
559
|
-
],
|
|
531
|
+
a({ type: String, attribute: "leading-icon" })
|
|
532
|
+
], o.prototype, "leadingIcon", 2);
|
|
560
533
|
s([
|
|
561
|
-
|
|
562
|
-
],
|
|
534
|
+
a({ type: Boolean })
|
|
535
|
+
], o.prototype, "multiple", 2);
|
|
563
536
|
s([
|
|
564
|
-
|
|
565
|
-
],
|
|
537
|
+
a({ type: Number, attribute: "max-selections" })
|
|
538
|
+
], o.prototype, "maxSelections", 2);
|
|
566
539
|
s([
|
|
567
|
-
|
|
568
|
-
],
|
|
540
|
+
a({ type: Boolean, attribute: "show-chips" })
|
|
541
|
+
], o.prototype, "showChips", 2);
|
|
569
542
|
s([
|
|
570
|
-
|
|
571
|
-
],
|
|
543
|
+
a({ type: String, attribute: "chip-variant" })
|
|
544
|
+
], o.prototype, "chipVariant", 2);
|
|
572
545
|
s([
|
|
573
|
-
|
|
574
|
-
],
|
|
546
|
+
a({ type: String })
|
|
547
|
+
], o.prototype, "placeholder", 2);
|
|
575
548
|
s([
|
|
576
|
-
|
|
577
|
-
],
|
|
549
|
+
a({ type: Boolean })
|
|
550
|
+
], o.prototype, "searchable", 2);
|
|
578
551
|
s([
|
|
579
552
|
u()
|
|
580
|
-
],
|
|
553
|
+
], o.prototype, "isOpen", 2);
|
|
581
554
|
s([
|
|
582
555
|
u()
|
|
583
|
-
],
|
|
556
|
+
], o.prototype, "searchQuery", 2);
|
|
584
557
|
s([
|
|
585
558
|
u()
|
|
586
|
-
],
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
],
|
|
559
|
+
], o.prototype, "selectedValues", 2);
|
|
560
|
+
o = s([
|
|
561
|
+
f("pd-select")
|
|
562
|
+
], o);
|
|
590
563
|
export {
|
|
591
|
-
|
|
564
|
+
o as PdSelect
|
|
592
565
|
};
|