@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"),p=require("lit/directives/class-map.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 u=Object.defineProperty,m=Object.getOwnPropertyDescriptor,r=(h,e,o,a)=>{for(var i=a>1?void 0:a?m(e,o):e,l=h.length-1,d;l>=0;l--)(d=h[l])&&(i=(a?d(e,o,i):d(i))||i);return a&&i&&u(e,o,i),i};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 o=e.target;this.value=o.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,o){if(o.stopPropagation(),!this.options.find(i=>i.value===e)?.disabled){if(this.selectedValues.includes(e))this.selectedValues=this.selectedValues.filter(i=>i!==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,o){o.stopPropagation(),this.selectedValues=this.selectedValues.filter(a=>a!==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 o=e.target;this.searchQuery=o.value.toLowerCase()}updateDropdownPosition(){}getOptionLabel(e){return this.options.find(a=>a.value===e)?.label||e}isSelected(e){return this.selectedValues.includes(e)}get filteredOptions(){return this.searchQuery?this.options.filter(e=>e.label.toLowerCase().includes(this.searchQuery)):this.options}get displayPlaceholder(){return this.placeholder||(this.multiple?"Select...":"")}renderMultiSelect(){const e=this.selectedValues.length>0,o=e||this.isOpen,a={"pd-select-trigger":!0,"pd-select-trigger--filled":this.variant==="filled","pd-select-trigger--outlined":this.variant==="outlined","pd-select-trigger--disabled":this.disabled,"pd-select-trigger--error":this.error,"pd-select-trigger--focused":this.isOpen,"pd-select-trigger--has-label":!!this.label};return t.html`
2
- <div class="pd-select-container">
3
- <!-- Trigger wrapper for dropdown positioning -->
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
- <label class=${p.classMap({"pd-select-label":!0,"pd-select-label--float":o,"pd-select-label--error":this.error,"pd-select-label--disabled":this.disabled})}>
8
- ${this.label}${this.required?t.html`<span class="required-indicator">*</span>`:""}
9
- </label>
10
- `:t.nothing}
11
-
12
- <!-- Trigger -->
13
- <div
14
- class=${p.classMap(a)}
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
- <md-icon class="pd-select-leading-icon">${this.leadingIcon}</md-icon>
26
- `:t.nothing}
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
- <div class="pd-select-chips">
31
- ${this.selectedValues.map(i=>t.html`
32
- <pd-chip
33
- variant=${this.chipVariant}
34
- label=${this.getOptionLabel(i)}
35
- ?remove-only=${this.chipVariant==="input"}
36
- ?removable=${this.chipVariant==="filter"}
37
- ?disabled=${this.disabled}
38
- @chip-remove=${l=>this.handleChipRemove(i,l)}
39
- @chip-click=${l=>this.handleChipRemove(i,l)}
40
- ></pd-chip>
41
- `)}
42
- </div>
43
- `:e&&!this.showChips?t.html`
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 class=${p.classMap({"pd-select-trailing-icon":!0,"pd-select-trailing-icon--rotated":this.isOpen})}>keyboard_arrow_down</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
- <div class="pd-select-dropdown" role="listbox" aria-multiselectable="true">
60
- ${this.searchable?t.html`
61
- <div class="pd-select-search">
62
- <md-icon class="pd-select-search-icon">search</md-icon>
63
- <input
64
- type="text"
65
- class="pd-select-search-input"
66
- placeholder="Search..."
67
- .value=${this.searchQuery}
68
- @input=${this.handleSearchInput}
69
- @click=${i=>i.stopPropagation()}
70
- />
71
- </div>
72
- `:t.nothing}
73
-
74
- <div class="pd-select-options">
75
- ${this.filteredOptions.length===0?t.html`
76
- <div class="pd-select-empty">
77
- No options found
78
- </div>
79
- `:this.filteredOptions.map(i=>{const l=this.isSelected(i.value),d=!l&&this.maxSelections!==void 0&&this.selectedValues.length>=this.maxSelections,n=i.disabled||d;return t.html`
80
- <div
81
- class=${p.classMap({"pd-select-option":!0,"pd-select-option--selected":l,"pd-select-option--disabled":n})}
82
- role="option"
83
- aria-selected=${l}
84
- aria-disabled=${n}
85
- @click=${c=>!n&&this.handleOptionClick(i.value,c)}
86
- >
87
- <md-checkbox
88
- ?checked=${l}
89
- ?disabled=${n}
90
- touch-target="wrapper"
91
- @click=${c=>c.stopPropagation()}
92
- @change=${c=>!n&&this.handleOptionClick(i.value,c)}
93
- ></md-checkbox>
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
- </div>
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
- <div class=${p.classMap({"pd-select-supporting-text":!0,"pd-select-supporting-text--error":this.error})}>
105
- ${this.error&&this.errorText?this.errorText:this.supportingText}
106
- </div>
107
- `:t.nothing}
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
- <md-icon slot="trailing-icon">keyboard_arrow_down</md-icon>
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(o=>t.html`
114
- <md-select-option .value=${o.value} ?disabled=${o.disabled}>
115
- <div slot="headline">${o.label}</div>
116
- </md-select-option>
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
- :host {
150
- display: inline-block;
151
- width: 100%;
152
- --md-filled-select-text-field-container-shape: var(--md-sys-shape-corner-small);
153
- --md-outlined-select-text-field-container-shape: var(--md-sys-shape-corner-small);
154
- }
155
-
156
- md-filled-select,
157
- md-outlined-select {
158
- width: 100%;
159
- }
160
-
161
- [slot="trailing-icon"] {
162
- transition: transform var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-emphasized, ease);
163
- }
164
-
165
- [slot="trailing-icon"].rotated {
166
- transform: rotate(180deg);
167
- }
168
-
169
- /* Multi-select styles */
170
- .pd-select-container {
171
- width: 100%;
172
- display: flex;
173
- flex-direction: column;
174
- }
175
-
176
- .pd-select-trigger-wrapper {
177
- position: relative;
178
- width: 100%;
179
- }
180
-
181
- .pd-select-label {
182
- position: absolute;
183
- left: 16px;
184
- top: 50%;
185
- transform: translateY(-50%);
186
- font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
187
- font-size: var(--md-sys-typescale-body-large-size, 1rem);
188
- font-weight: var(--md-sys-typescale-body-large-weight, 400);
189
- color: var(--md-sys-color-on-surface-variant);
190
- pointer-events: none;
191
- transition: all var(--md-sys-motion-duration-short2, 150ms) var(--md-sys-motion-easing-standard, ease);
192
- background: var(--md-sys-color-surface, #fff);
193
- padding: 0 4px;
194
- z-index: 1;
195
- }
196
-
197
- .pd-select-label--float {
198
- top: 0;
199
- font-size: var(--md-sys-typescale-body-small-size, 0.75rem);
200
- color: var(--md-sys-color-primary);
201
- }
202
-
203
- .pd-select-label--error {
204
- color: var(--md-sys-color-error);
205
- }
206
-
207
- .pd-select-label--disabled {
208
- color: var(--md-sys-color-on-surface);
209
- opacity: 0.38;
210
- }
211
-
212
- .pd-select-trigger {
213
- display: flex;
214
- align-items: center;
215
- min-height: 56px;
216
- padding: 8px 12px 8px 16px;
217
- border-radius: var(--md-sys-shape-corner-small, 4px);
218
- cursor: pointer;
219
- background: var(--md-sys-color-surface, #fff);
220
- transition: all var(--md-sys-motion-duration-short2, 150ms) var(--md-sys-motion-easing-standard, ease);
221
- gap: 8px;
222
- }
223
-
224
- .pd-select-trigger--outlined {
225
- border: 1px solid var(--md-sys-color-outline);
226
- }
227
-
228
- .pd-select-trigger--outlined:hover:not(.pd-select-trigger--disabled) {
229
- border-color: var(--md-sys-color-on-surface);
230
- }
231
-
232
- .pd-select-trigger--outlined.pd-select-trigger--focused {
233
- border-color: var(--md-sys-color-primary);
234
- border-width: 2px;
235
- padding: 7px 11px 7px 15px;
236
- }
237
-
238
- .pd-select-trigger--outlined.pd-select-trigger--error {
239
- border-color: var(--md-sys-color-error);
240
- }
241
-
242
- .pd-select-trigger--filled {
243
- border: none;
244
- border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
245
- border-radius: var(--md-sys-shape-corner-small, 4px) var(--md-sys-shape-corner-small, 4px) 0 0;
246
- background: var(--md-sys-color-surface-container-highest);
247
- }
248
-
249
- .pd-select-trigger--filled:hover:not(.pd-select-trigger--disabled) {
250
- border-bottom-color: var(--md-sys-color-on-surface);
251
- }
252
-
253
- .pd-select-trigger--filled.pd-select-trigger--focused {
254
- border-bottom-color: var(--md-sys-color-primary);
255
- border-bottom-width: 2px;
256
- padding-bottom: 7px;
257
- }
258
-
259
- .pd-select-trigger--filled.pd-select-trigger--error {
260
- border-bottom-color: var(--md-sys-color-error);
261
- }
262
-
263
- .pd-select-trigger--disabled {
264
- cursor: default;
265
- opacity: 0.38;
266
- pointer-events: none;
267
- }
268
-
269
- .pd-select-trigger:focus {
270
- outline: none;
271
- }
272
-
273
- .pd-select-trigger:focus-visible {
274
- outline: 2px solid var(--md-sys-color-primary);
275
- outline-offset: 2px;
276
- }
277
-
278
- .pd-select-leading-icon {
279
- color: var(--md-sys-color-on-surface-variant);
280
- font-size: 24px;
281
- flex-shrink: 0;
282
- }
283
-
284
- .pd-select-content {
285
- flex: 1;
286
- min-width: 0;
287
- display: flex;
288
- align-items: center;
289
- }
290
-
291
- .pd-select-chips {
292
- display: flex;
293
- flex-wrap: wrap;
294
- gap: 8px;
295
- padding: 4px 0;
296
- }
297
-
298
- .pd-select-placeholder {
299
- font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
300
- font-size: var(--md-sys-typescale-body-large-size, 1rem);
301
- color: var(--md-sys-color-on-surface-variant);
302
- }
303
-
304
- .pd-select-summary {
305
- font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
306
- font-size: var(--md-sys-typescale-body-large-size, 1rem);
307
- color: var(--md-sys-color-on-surface);
308
- }
309
-
310
- .pd-select-trailing-icon {
311
- color: var(--md-sys-color-on-surface-variant);
312
- font-size: 24px;
313
- flex-shrink: 0;
314
- transition: transform var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-emphasized, ease);
315
- }
316
-
317
- .pd-select-trailing-icon--rotated {
318
- transform: rotate(180deg);
319
- }
320
-
321
- /* Dropdown */
322
- .pd-select-dropdown {
323
- position: absolute;
324
- top: 100%;
325
- left: 0;
326
- right: 0;
327
- margin-top: 4px;
328
- z-index: 9999;
329
- background: var(--md-sys-color-surface-container);
330
- border-radius: var(--md-sys-shape-corner-medium, 12px);
331
- box-shadow: var(--md-sys-elevation-2, 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15));
332
- overflow: hidden;
333
- max-height: 320px;
334
- display: flex;
335
- flex-direction: column;
336
- animation: pd-select-dropdown-open var(--md-sys-motion-duration-short3, 200ms) var(--md-sys-motion-easing-emphasized-decelerate, ease-out);
337
- }
338
-
339
- @keyframes pd-select-dropdown-open {
340
- from {
341
- opacity: 0;
342
- transform: scaleY(0.9);
343
- transform-origin: top;
344
- }
345
- to {
346
- opacity: 1;
347
- transform: scaleY(1);
348
- }
349
- }
350
-
351
- /* Search */
352
- .pd-select-search {
353
- display: flex;
354
- align-items: center;
355
- gap: 12px;
356
- padding: 12px 16px;
357
- border-bottom: 1px solid var(--md-sys-color-outline-variant);
358
- background: var(--md-sys-color-surface-container);
359
- }
360
-
361
- .pd-select-search-icon {
362
- color: var(--md-sys-color-on-surface-variant);
363
- font-size: 20px;
364
- flex-shrink: 0;
365
- }
366
-
367
- .pd-select-search-input {
368
- flex: 1;
369
- border: none;
370
- background: transparent;
371
- font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
372
- font-size: var(--md-sys-typescale-body-large-size, 1rem);
373
- color: var(--md-sys-color-on-surface);
374
- outline: none;
375
- }
376
-
377
- .pd-select-search-input::placeholder {
378
- color: var(--md-sys-color-on-surface-variant);
379
- }
380
-
381
- /* Options */
382
- .pd-select-options {
383
- overflow-y: auto;
384
- flex: 1;
385
- }
386
-
387
- .pd-select-option {
388
- display: flex;
389
- align-items: center;
390
- gap: 12px;
391
- padding: 12px 16px;
392
- cursor: pointer;
393
- transition: background-color var(--md-sys-motion-duration-short1, 100ms) var(--md-sys-motion-easing-standard, ease);
394
- }
395
-
396
- .pd-select-option:hover:not(.pd-select-option--disabled) {
397
- background-color: var(--md-sys-color-surface-container-highest);
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);