@prioticket/design-system-web 1.4.0 → 1.4.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.
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("lit"),s=require("lit/decorators.js")
|
|
2
|
-
<div class="
|
|
3
|
-
|
|
4
|
-
<div class="pd-select-trigger-wrapper">
|
|
5
|
-
<!-- Label -->
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("lit"),s=require("lit/decorators.js");require("@material/web/select/filled-select.js");require("@material/web/select/outlined-select.js");require("@material/web/select/select-option.js");require("@material/web/icon/icon.js");require("@material/web/checkbox/checkbox.js");require("./pd-chip.cjs.js");var p=Object.defineProperty,h=Object.getOwnPropertyDescriptor,i=(c,e,r,o)=>{for(var a=o>1?void 0:o?h(e,r):e,n=c.length-1,l;n>=0;n--)(l=c[n])&&(a=(o?l(e,r,a):l(a))||a);return o&&a&&p(e,r,a),a};exports.PdSelect=class extends t.LitElement{constructor(){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.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this),this.boundUpdateDropdownPosition=this.updateDropdownPosition.bind(this)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.boundHandleClickOutside),document.addEventListener("keydown",this.boundHandleKeyDown),window.addEventListener("scroll",this.boundUpdateDropdownPosition,!0),window.addEventListener("resize",this.boundUpdateDropdownPosition)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),window.removeEventListener("scroll",this.boundUpdateDropdownPosition,!0),window.removeEventListener("resize",this.boundUpdateDropdownPosition)}willUpdate(e){e.has("value")&&this.multiple&&(Array.isArray(this.value)?this.selectedValues=[...this.value]:this.value?this.selectedValues=[this.value]:this.selectedValues=[])}handleChange(e){e.stopPropagation();const r=e.target;this.value=r.value,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}}))}handleOpen(){this.trailingIcon?.classList.add("rotated")}handleClose(){this.trailingIcon?.classList.remove("rotated")}handleTriggerClick(e){this.disabled||(e.stopPropagation(),this.isOpen=!this.isOpen,this.isOpen&&(this.searchQuery="",this.updateComplete.then(()=>{this.updateDropdownPosition()})))}handleOptionClick(e,r){if(r.stopPropagation(),!this.options.find(a=>a.value===e)?.disabled){if(this.selectedValues.includes(e))this.selectedValues=this.selectedValues.filter(a=>a!==e);else{if(this.maxSelections&&this.selectedValues.length>=this.maxSelections)return;this.selectedValues=[...this.selectedValues,e]}this.value=[...this.selectedValues],this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.selectedValues}}))}}handleChipRemove(e,r){r.stopPropagation(),this.selectedValues=this.selectedValues.filter(o=>o!==e),this.value=[...this.selectedValues],this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.selectedValues}})),this.dispatchEvent(new CustomEvent("chip-remove",{bubbles:!0,composed:!0,detail:{value:e}}))}handleClickOutside(e){if(!this.isOpen)return;e.composedPath().includes(this)||(this.isOpen=!1)}handleKeyDown(e){if(!this.isOpen&&(e.key==="Enter"||e.key===" ")){this.multiple&&e.target===this.trigger&&(this.isOpen=!0,this.searchQuery="",this.updateComplete.then(()=>this.updateDropdownPosition()),e.preventDefault());return}this.isOpen&&e.key==="Escape"&&(this.isOpen=!1,e.preventDefault())}handleSearchInput(e){const r=e.target;this.searchQuery=r.value}updateDropdownPosition(){}getOptionLabel(e){return this.options.find(o=>o.value===e)?.label||e}isSelected(e){return this.selectedValues.includes(e)}get filteredOptions(){const e=this.searchQuery.trim().toLowerCase();return e?this.options.filter(r=>r.label.toLowerCase().includes(e)):this.options}get displayPlaceholder(){return this.placeholder||""}renderMultiSelect(){const e=this.selectedValues.length>0,r=e||this.isOpen;return t.html`
|
|
2
|
+
<div class="container">
|
|
3
|
+
<div class="wrap">
|
|
6
4
|
${this.label?t.html`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
<label class="label" data-float=${r?"true":"false"}>
|
|
6
|
+
${this.label}${this.required?t.html`<span class="required">*</span>`:t.nothing}
|
|
7
|
+
</label>
|
|
8
|
+
`:t.nothing}
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
class="field"
|
|
12
|
+
data-open=${this.isOpen?"true":"false"}
|
|
15
13
|
@click=${this.handleTriggerClick}
|
|
16
14
|
@keydown=${this.handleKeyDown}
|
|
17
15
|
tabindex=${this.disabled?"-1":"0"}
|
|
@@ -21,100 +19,92 @@
|
|
|
21
19
|
aria-disabled=${this.disabled}
|
|
22
20
|
aria-label=${this.label||"Select"}
|
|
23
21
|
>
|
|
24
|
-
${this.leadingIcon?t.html
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<div class="pd-select-content">
|
|
22
|
+
${this.leadingIcon?t.html`<md-icon class="pd-icon pd-icon--leading">${this.leadingIcon}</md-icon>`:t.nothing}
|
|
23
|
+
|
|
24
|
+
<div class="content">
|
|
29
25
|
${e&&this.showChips?t.html`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<span class="pd-select-summary">
|
|
45
|
-
${this.selectedValues.length} selected
|
|
46
|
-
</span>
|
|
47
|
-
`:o||!this.label?t.html`
|
|
48
|
-
<span class="pd-select-placeholder">
|
|
49
|
-
${this.displayPlaceholder}
|
|
50
|
-
</span>
|
|
51
|
-
`:t.nothing}
|
|
26
|
+
<div class="chips">
|
|
27
|
+
${this.selectedValues.map(o=>t.html`
|
|
28
|
+
<pd-chip
|
|
29
|
+
variant=${this.chipVariant}
|
|
30
|
+
label=${this.getOptionLabel(o)}
|
|
31
|
+
?remove-only=${this.chipVariant==="input"}
|
|
32
|
+
?removable=${this.chipVariant==="filter"}
|
|
33
|
+
?disabled=${this.disabled}
|
|
34
|
+
@chip-remove=${a=>this.handleChipRemove(o,a)}
|
|
35
|
+
@chip-click=${a=>this.handleChipRemove(o,a)}
|
|
36
|
+
></pd-chip>
|
|
37
|
+
`)}
|
|
38
|
+
</div>
|
|
39
|
+
`:e&&!this.showChips?t.html`<span class="summary">${this.selectedValues.length} selected</span>`:t.html`<span class="placeholder">${this.displayPlaceholder}</span>`}
|
|
52
40
|
</div>
|
|
53
|
-
|
|
54
|
-
<md-icon
|
|
41
|
+
|
|
42
|
+
<md-icon
|
|
43
|
+
class="pd-icon pd-icon--trailing"
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
data-rotated=${this.isOpen?"true":"false"}
|
|
46
|
+
>
|
|
47
|
+
keyboard_arrow_down
|
|
48
|
+
</md-icon>
|
|
55
49
|
</div>
|
|
56
50
|
|
|
57
|
-
<!-- Dropdown -->
|
|
58
51
|
${this.isOpen?t.html`
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<span class="pd-select-option-label">${i.label}</span>
|
|
52
|
+
<div class="dropdown" role="listbox" aria-multiselectable="true">
|
|
53
|
+
${this.searchable?t.html`
|
|
54
|
+
<div class="search">
|
|
55
|
+
<md-icon class="pd-icon" aria-hidden="true">search</md-icon>
|
|
56
|
+
<input
|
|
57
|
+
type="text"
|
|
58
|
+
placeholder="Search..."
|
|
59
|
+
.value=${this.searchQuery}
|
|
60
|
+
@input=${this.handleSearchInput}
|
|
61
|
+
@click=${o=>o.stopPropagation()}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
`:t.nothing}
|
|
65
|
+
|
|
66
|
+
<div class="options">
|
|
67
|
+
${this.filteredOptions.length===0?t.html`<div class="option" data-disabled="true">No options found</div>`:this.filteredOptions.map(o=>{const a=this.isSelected(o.value),n=!a&&this.maxSelections!==void 0&&this.selectedValues.length>=this.maxSelections,l=!!o.disabled||n;return t.html`
|
|
68
|
+
<div
|
|
69
|
+
class="option"
|
|
70
|
+
role="option"
|
|
71
|
+
data-selected=${a?"true":"false"}
|
|
72
|
+
data-disabled=${l?"true":"false"}
|
|
73
|
+
aria-selected=${a}
|
|
74
|
+
aria-disabled=${l}
|
|
75
|
+
@click=${d=>!l&&this.handleOptionClick(o.value,d)}
|
|
76
|
+
>
|
|
77
|
+
<md-checkbox
|
|
78
|
+
?checked=${a}
|
|
79
|
+
?disabled=${l}
|
|
80
|
+
touch-target="wrapper"
|
|
81
|
+
@click=${d=>d.stopPropagation()}
|
|
82
|
+
@change=${d=>!l&&this.handleOptionClick(o.value,d)}
|
|
83
|
+
></md-checkbox>
|
|
84
|
+
<span>${o.label}</span>
|
|
85
|
+
</div>
|
|
86
|
+
`})}
|
|
95
87
|
</div>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</div>
|
|
99
|
-
`:t.nothing}
|
|
88
|
+
</div>
|
|
89
|
+
`:t.nothing}
|
|
100
90
|
</div>
|
|
101
91
|
|
|
102
|
-
<!-- Supporting/Error Text -->
|
|
103
92
|
${this.supportingText||this.error&&this.errorText?t.html`
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
<div class="supporting">
|
|
94
|
+
${this.error&&this.errorText?this.errorText:this.supportingText}
|
|
95
|
+
</div>
|
|
96
|
+
`:t.nothing}
|
|
108
97
|
</div>
|
|
109
98
|
`}renderSingleSelect(){const e=t.html`
|
|
110
|
-
${this.leadingIcon?t.html`<md-icon slot="leading-icon">${this.leadingIcon}</md-icon>`:
|
|
111
|
-
|
|
99
|
+
${this.leadingIcon?t.html`<md-icon class="pd-icon pd-icon--leading" slot="leading-icon">${this.leadingIcon}</md-icon>`:t.nothing}
|
|
100
|
+
|
|
101
|
+
<md-icon class="pd-icon pd-icon--trailing" slot="trailing-icon">keyboard_arrow_down</md-icon>
|
|
112
102
|
|
|
113
|
-
${this.options.map(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
${this.options.map(r=>t.html`
|
|
104
|
+
<md-select-option .value=${r.value} ?disabled=${r.disabled}>
|
|
105
|
+
<div slot="headline">${r.label}</div>
|
|
106
|
+
</md-select-option>
|
|
107
|
+
`)}
|
|
118
108
|
`;return this.variant==="filled"?t.html`
|
|
119
109
|
<md-filled-select
|
|
120
110
|
.label=${this.label}
|
|
@@ -146,305 +136,253 @@
|
|
|
146
136
|
${e}
|
|
147
137
|
</md-outlined-select>
|
|
148
138
|
`}render(){return this.multiple?this.renderMultiSelect():this.renderSingleSelect()}};exports.PdSelect.styles=t.css`
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
.pd-select-option--selected {
|
|
401
|
-
background-color: var(--md-sys-color-secondary-container);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.pd-select-option--selected:hover:not(.pd-select-option--disabled) {
|
|
405
|
-
background-color: var(--md-sys-color-secondary-container);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
.pd-select-option--disabled {
|
|
409
|
-
opacity: 0.38;
|
|
410
|
-
cursor: default;
|
|
411
|
-
pointer-events: none;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
.pd-select-option-label {
|
|
415
|
-
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
416
|
-
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
417
|
-
color: var(--md-sys-color-on-surface);
|
|
418
|
-
flex: 1;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
.pd-select-empty {
|
|
422
|
-
padding: 24px 16px;
|
|
423
|
-
text-align: center;
|
|
424
|
-
font-family: var(--md-sys-typescale-body-medium-font, Roboto, sans-serif);
|
|
425
|
-
font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
|
|
426
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/* Supporting text */
|
|
430
|
-
.pd-select-supporting-text {
|
|
431
|
-
padding: 4px 16px 0;
|
|
432
|
-
font-family: var(--md-sys-typescale-body-small-font, Roboto, sans-serif);
|
|
433
|
-
font-size: var(--md-sys-typescale-body-small-size, 0.75rem);
|
|
434
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
.pd-select-supporting-text--error {
|
|
438
|
-
color: var(--md-sys-color-error);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.required-indicator {
|
|
442
|
-
color: var(--md-sys-color-error);
|
|
443
|
-
margin-left: 2px;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/* Chip overrides for compact display */
|
|
447
|
-
.pd-select-chips pd-chip {
|
|
448
|
-
--md-sys-chip-container-height: 28px;
|
|
449
|
-
}
|
|
450
|
-
`;r([s.query("md-filled-select, md-outlined-select")],exports.PdSelect.prototype,"select",2);r([s.query('[slot="trailing-icon"]')],exports.PdSelect.prototype,"trailingIcon",2);r([s.query(".pd-select-dropdown")],exports.PdSelect.prototype,"dropdown",2);r([s.query(".pd-select-trigger")],exports.PdSelect.prototype,"trigger",2);r([s.property({type:String})],exports.PdSelect.prototype,"variant",2);r([s.property({type:String})],exports.PdSelect.prototype,"label",2);r([s.property({type:String,reflect:!0})],exports.PdSelect.prototype,"value",2);r([s.property({type:Boolean,reflect:!0})],exports.PdSelect.prototype,"disabled",2);r([s.property({type:Boolean})],exports.PdSelect.prototype,"required",2);r([s.property({type:String,attribute:"error-text"})],exports.PdSelect.prototype,"errorText",2);r([s.property({type:Boolean})],exports.PdSelect.prototype,"error",2);r([s.property({type:String,attribute:"supporting-text"})],exports.PdSelect.prototype,"supportingText",2);r([s.property({type:Array})],exports.PdSelect.prototype,"options",2);r([s.property({type:String,attribute:"leading-icon"})],exports.PdSelect.prototype,"leadingIcon",2);r([s.property({type:Boolean})],exports.PdSelect.prototype,"multiple",2);r([s.property({type:Number,attribute:"max-selections"})],exports.PdSelect.prototype,"maxSelections",2);r([s.property({type:Boolean,attribute:"show-chips"})],exports.PdSelect.prototype,"showChips",2);r([s.property({type:String,attribute:"chip-variant"})],exports.PdSelect.prototype,"chipVariant",2);r([s.property({type:String})],exports.PdSelect.prototype,"placeholder",2);r([s.property({type:Boolean})],exports.PdSelect.prototype,"searchable",2);r([s.state()],exports.PdSelect.prototype,"isOpen",2);r([s.state()],exports.PdSelect.prototype,"searchQuery",2);r([s.state()],exports.PdSelect.prototype,"selectedValues",2);exports.PdSelect=r([s.customElement("pd-select")],exports.PdSelect);
|
|
139
|
+
:host {
|
|
140
|
+
display: inline-block;
|
|
141
|
+
width: 100%;
|
|
142
|
+
font-family: var(--md-sys-typescale-body-large-font, inherit);
|
|
143
|
+
/* one source of truth */
|
|
144
|
+
--pd-select-padding-x: 16px;
|
|
145
|
+
--pd-select-padding-y: 12px;
|
|
146
|
+
--pd-select-icon-size: 24px;
|
|
147
|
+
--pd-select-gap: 8px;
|
|
148
|
+
--md-filled-select-text-field-container-shape: var(--md-sys-shape-corner-small);
|
|
149
|
+
--md-outlined-select-text-field-container-shape: var(--md-sys-shape-corner-small);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
md-filled-select,
|
|
153
|
+
md-outlined-select {
|
|
154
|
+
width: 100%;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* shared icon styling (single + multi) */
|
|
158
|
+
.pd-icon {
|
|
159
|
+
font-size: var(--pd-select-icon-size);
|
|
160
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
161
|
+
flex-shrink: 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
[slot="trailing-icon"] {
|
|
165
|
+
transition: transform var(--md-sys-motion-duration-medium2, 300ms)
|
|
166
|
+
var(--md-sys-motion-easing-emphasized, ease);
|
|
167
|
+
}
|
|
168
|
+
[slot="trailing-icon"].rotated {
|
|
169
|
+
transform: rotate(180deg);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* multi layout */
|
|
173
|
+
.container {
|
|
174
|
+
width: 100%;
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.wrap {
|
|
180
|
+
position: relative;
|
|
181
|
+
width: 100%;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.label {
|
|
185
|
+
position: absolute;
|
|
186
|
+
left: var(--pd-select-padding-x);
|
|
187
|
+
top: 50%;
|
|
188
|
+
transform: translateY(-50%);
|
|
189
|
+
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
190
|
+
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
191
|
+
font-weight: var(--md-sys-typescale-body-large-weight, 400);
|
|
192
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
193
|
+
pointer-events: none;
|
|
194
|
+
transition: all var(--md-sys-motion-duration-short2, 150ms)
|
|
195
|
+
var(--md-sys-motion-easing-standard, ease);
|
|
196
|
+
background: var(--md-sys-color-surface, #fff);
|
|
197
|
+
padding: 0 4px;
|
|
198
|
+
z-index: 1;
|
|
199
|
+
}
|
|
200
|
+
.label[data-float="true"] {
|
|
201
|
+
top: 0;
|
|
202
|
+
font-size: var(--md-sys-typescale-body-small-size, 0.75rem);
|
|
203
|
+
color: var(--md-sys-color-primary);
|
|
204
|
+
}
|
|
205
|
+
:host([error]) .label {
|
|
206
|
+
color: var(--md-sys-color-error);
|
|
207
|
+
}
|
|
208
|
+
:host([disabled]) .label {
|
|
209
|
+
opacity: 0.38;
|
|
210
|
+
color: var(--md-sys-color-on-surface);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.field {
|
|
214
|
+
display: flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
min-height: var(--pd-select-min-height);
|
|
217
|
+
gap: var(--pd-select-gap);
|
|
218
|
+
padding: var(--pd-select-padding-y) var(--pd-select-padding-x);
|
|
219
|
+
border-radius: var(--md-sys-shape-corner-small, 4px);
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
background: var(--md-sys-color-surface, #fff);
|
|
222
|
+
transition: all var(--md-sys-motion-duration-short2, 150ms)
|
|
223
|
+
var(--md-sys-motion-easing-standard, ease);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* variant differences only */
|
|
227
|
+
:host([variant="outlined"]) .field {
|
|
228
|
+
border: 1px solid var(--md-sys-color-outline);
|
|
229
|
+
}
|
|
230
|
+
:host([variant="outlined"]) .field:hover {
|
|
231
|
+
border-color: var(--md-sys-color-on-surface);
|
|
232
|
+
}
|
|
233
|
+
.field[data-open="true"]:host([variant="outlined"]) {
|
|
234
|
+
/* (not used directly; keep open styling below) */
|
|
235
|
+
}
|
|
236
|
+
:host([variant="filled"]) .field {
|
|
237
|
+
border: none;
|
|
238
|
+
border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
|
|
239
|
+
border-radius: var(--md-sys-shape-corner-small, 4px)
|
|
240
|
+
var(--md-sys-shape-corner-small, 4px) 0 0;
|
|
241
|
+
background: var(--md-sys-color-surface-container-highest);
|
|
242
|
+
}
|
|
243
|
+
:host([variant="filled"]) .field:hover {
|
|
244
|
+
border-bottom-color: var(--md-sys-color-on-surface);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* state styling unified */
|
|
248
|
+
:host([disabled]) .field {
|
|
249
|
+
cursor: default;
|
|
250
|
+
opacity: 0.38;
|
|
251
|
+
pointer-events: none;
|
|
252
|
+
}
|
|
253
|
+
:host([error][variant="outlined"]) .field {
|
|
254
|
+
border-color: var(--md-sys-color-error);
|
|
255
|
+
}
|
|
256
|
+
:host([error][variant="filled"]) .field {
|
|
257
|
+
border-bottom-color: var(--md-sys-color-error);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.field[data-open="true"]:host([variant="outlined"]) {
|
|
261
|
+
/* lit can’t combine like this; use the selector below instead */
|
|
262
|
+
}
|
|
263
|
+
:host([variant="outlined"]) .field[data-open="true"] {
|
|
264
|
+
border-color: var(--md-sys-color-primary);
|
|
265
|
+
border-width: 2px;
|
|
266
|
+
}
|
|
267
|
+
:host([variant="filled"]) .field[data-open="true"] {
|
|
268
|
+
border-bottom-color: var(--md-sys-color-primary);
|
|
269
|
+
border-bottom-width: 2px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.field:focus-visible {
|
|
273
|
+
outline: 2px solid var(--md-sys-color-primary);
|
|
274
|
+
outline-offset: 2px;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.content {
|
|
278
|
+
flex: 1;
|
|
279
|
+
min-width: 0;
|
|
280
|
+
display: flex;
|
|
281
|
+
align-items: center;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.chips {
|
|
285
|
+
display: flex;
|
|
286
|
+
flex-wrap: wrap;
|
|
287
|
+
gap: 8px;
|
|
288
|
+
margin-left: -4px; /* keep visual alignment without padding hacks */
|
|
289
|
+
}
|
|
290
|
+
.chips pd-chip {
|
|
291
|
+
--md-sys-chip-container-height: 28px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.placeholder,
|
|
295
|
+
.summary {
|
|
296
|
+
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
297
|
+
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
298
|
+
}
|
|
299
|
+
.placeholder {
|
|
300
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
301
|
+
}
|
|
302
|
+
.summary {
|
|
303
|
+
color: var(--md-sys-color-on-surface);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* trailing icon rotation unified for multi */
|
|
307
|
+
.pd-icon--trailing[data-rotated="true"] {
|
|
308
|
+
transform: rotate(180deg);
|
|
309
|
+
transition: transform var(--md-sys-motion-duration-medium2, 300ms)
|
|
310
|
+
var(--md-sys-motion-easing-emphasized, ease);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.dropdown {
|
|
314
|
+
position: absolute;
|
|
315
|
+
top: 100%;
|
|
316
|
+
left: 0;
|
|
317
|
+
right: 0;
|
|
318
|
+
margin-top: 4px;
|
|
319
|
+
z-index: 9999;
|
|
320
|
+
background: var(--md-sys-color-surface-container);
|
|
321
|
+
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
322
|
+
box-shadow: var(--md-sys-elevation-2, 0 1px 2px rgba(0,0,0,0.3),
|
|
323
|
+
0 2px 6px 2px rgba(0,0,0,0.15));
|
|
324
|
+
overflow: hidden;
|
|
325
|
+
max-height: 320px;
|
|
326
|
+
display: flex;
|
|
327
|
+
flex-direction: column;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.search {
|
|
331
|
+
display: flex;
|
|
332
|
+
align-items: center;
|
|
333
|
+
gap: 12px;
|
|
334
|
+
padding: 12px var(--pd-select-padding-x);
|
|
335
|
+
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
336
|
+
background: var(--md-sys-color-surface-container);
|
|
337
|
+
}
|
|
338
|
+
.search input {
|
|
339
|
+
flex: 1;
|
|
340
|
+
border: none;
|
|
341
|
+
background: transparent;
|
|
342
|
+
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
343
|
+
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
344
|
+
color: var(--md-sys-color-on-surface);
|
|
345
|
+
outline: none;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.options {
|
|
349
|
+
overflow-y: auto;
|
|
350
|
+
flex: 1;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.option {
|
|
354
|
+
display: flex;
|
|
355
|
+
align-items: center;
|
|
356
|
+
gap: 12px;
|
|
357
|
+
padding: 12px var(--pd-select-padding-x);
|
|
358
|
+
cursor: pointer;
|
|
359
|
+
transition: background-color var(--md-sys-motion-duration-short1, 100ms)
|
|
360
|
+
var(--md-sys-motion-easing-standard, ease);
|
|
361
|
+
}
|
|
362
|
+
.option:hover {
|
|
363
|
+
background-color: var(--md-sys-color-surface-container-highest);
|
|
364
|
+
}
|
|
365
|
+
.option[data-selected="true"] {
|
|
366
|
+
background-color: var(--md-sys-color-secondary-container);
|
|
367
|
+
}
|
|
368
|
+
.option[data-disabled="true"] {
|
|
369
|
+
opacity: 0.38;
|
|
370
|
+
cursor: default;
|
|
371
|
+
pointer-events: none;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.supporting {
|
|
375
|
+
padding: 4px var(--pd-select-padding-x) 0;
|
|
376
|
+
font-family: var(--md-sys-typescale-body-small-font, Roboto, sans-serif);
|
|
377
|
+
font-size: var(--md-sys-typescale-body-small-size, 0.75rem);
|
|
378
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
379
|
+
}
|
|
380
|
+
:host([error]) .supporting {
|
|
381
|
+
color: var(--md-sys-color-error);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.required {
|
|
385
|
+
color: var(--md-sys-color-error);
|
|
386
|
+
margin-left: 2px;
|
|
387
|
+
}
|
|
388
|
+
`;i([s.query("md-filled-select, md-outlined-select")],exports.PdSelect.prototype,"select",2);i([s.query('[slot="trailing-icon"]')],exports.PdSelect.prototype,"trailingIcon",2);i([s.query(".field")],exports.PdSelect.prototype,"trigger",2);i([s.property({type:String,reflect:!0})],exports.PdSelect.prototype,"variant",2);i([s.property({type:String})],exports.PdSelect.prototype,"label",2);i([s.property({type:String,reflect:!0})],exports.PdSelect.prototype,"value",2);i([s.property({type:Boolean,reflect:!0})],exports.PdSelect.prototype,"disabled",2);i([s.property({type:Boolean})],exports.PdSelect.prototype,"required",2);i([s.property({type:String,attribute:"error-text"})],exports.PdSelect.prototype,"errorText",2);i([s.property({type:Boolean,reflect:!0})],exports.PdSelect.prototype,"error",2);i([s.property({type:String,attribute:"supporting-text"})],exports.PdSelect.prototype,"supportingText",2);i([s.property({type:Array})],exports.PdSelect.prototype,"options",2);i([s.property({type:String,attribute:"leading-icon"})],exports.PdSelect.prototype,"leadingIcon",2);i([s.property({type:Boolean})],exports.PdSelect.prototype,"multiple",2);i([s.property({type:Number,attribute:"max-selections"})],exports.PdSelect.prototype,"maxSelections",2);i([s.property({type:Boolean,attribute:"show-chips"})],exports.PdSelect.prototype,"showChips",2);i([s.property({type:String,attribute:"chip-variant"})],exports.PdSelect.prototype,"chipVariant",2);i([s.property({type:String})],exports.PdSelect.prototype,"placeholder",2);i([s.property({type:Boolean})],exports.PdSelect.prototype,"searchable",2);i([s.state()],exports.PdSelect.prototype,"isOpen",2);i([s.state()],exports.PdSelect.prototype,"searchQuery",2);i([s.state()],exports.PdSelect.prototype,"selectedValues",2);exports.PdSelect=i([s.customElement("pd-select")],exports.PdSelect);
|