@prioticket/design-system-web 1.6.0 → 1.6.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,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": {
|
|
3
3
|
"name": "@prioticket/design-system-web",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"installation": "npm install @prioticket/design-system-web"
|
|
7
7
|
},
|
|
8
|
-
"generatedAt": "2026-02-16T14:
|
|
8
|
+
"generatedAt": "2026-02-16T14:49:33.635Z",
|
|
9
9
|
"components": {
|
|
10
10
|
"pd-box": {
|
|
11
11
|
"tagName": "pd-box",
|
package/custom-elements.json
CHANGED
|
@@ -5214,12 +5214,12 @@
|
|
|
5214
5214
|
},
|
|
5215
5215
|
{
|
|
5216
5216
|
"kind": "field",
|
|
5217
|
-
"name": "
|
|
5217
|
+
"name": "popoverEl",
|
|
5218
5218
|
"type": {
|
|
5219
5219
|
"text": "HTMLElement | null"
|
|
5220
5220
|
},
|
|
5221
5221
|
"privacy": "private",
|
|
5222
|
-
"
|
|
5222
|
+
"readonly": true
|
|
5223
5223
|
},
|
|
5224
5224
|
{
|
|
5225
5225
|
"kind": "field",
|
|
@@ -5258,26 +5258,19 @@
|
|
|
5258
5258
|
"privacy": "private",
|
|
5259
5259
|
"readonly": true
|
|
5260
5260
|
},
|
|
5261
|
-
{
|
|
5262
|
-
"kind": "field",
|
|
5263
|
-
"name": "overlayStyles",
|
|
5264
|
-
"privacy": "private",
|
|
5265
|
-
"static": true,
|
|
5266
|
-
"default": "`\n .dropdown {\n background: var(--md-sys-color-surface-container, #f3edf7);\n border-radius: var(--md-sys-shape-corner-medium, 12px);\n box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);\n overflow: hidden;\n max-height: 320px;\n display: flex;\n flex-direction: column;\n animation: dropdown-open 200ms cubic-bezier(0.2, 0, 0, 1) forwards;\n transform-origin: top left;\n }\n\n @keyframes dropdown-open {\n from { opacity: 0; transform: scaleY(0.8); }\n to { opacity: 1; transform: scaleY(1); }\n }\n\n .search {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant, #cac4d0);\n background: var(--md-sys-color-surface-container, #f3edf7);\n }\n\n .search input {\n flex: 1;\n border: none;\n background: transparent;\n font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);\n font-size: var(--md-sys-typescale-body-large-size, 1rem);\n color: var(--md-sys-color-on-surface, #1d1b20);\n outline: none;\n }\n\n .options {\n overflow-y: auto;\n flex: 1;\n }\n\n .option {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 12px 16px;\n cursor: pointer;\n transition: background-color 100ms ease;\n }\n\n .option:hover {\n background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);\n }\n\n .option[data-selected=\"true\"] {\n background-color: var(--md-sys-color-secondary-container, #e8def8);\n }\n\n .option[data-disabled=\"true\"] {\n opacity: 0.38;\n cursor: default;\n pointer-events: none;\n }\n\n .option span {\n font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);\n font-size: var(--md-sys-typescale-body-large-size, 1rem);\n color: var(--md-sys-color-on-surface, #1d1b20);\n }\n\n .pd-icon {\n font-size: 24px;\n color: var(--md-sys-color-on-surface-variant, #49454f);\n }\n `"
|
|
5267
|
-
},
|
|
5268
5261
|
{
|
|
5269
5262
|
"kind": "method",
|
|
5270
|
-
"name": "
|
|
5263
|
+
"name": "openPopover",
|
|
5271
5264
|
"privacy": "private"
|
|
5272
5265
|
},
|
|
5273
5266
|
{
|
|
5274
5267
|
"kind": "method",
|
|
5275
|
-
"name": "
|
|
5268
|
+
"name": "closePopover",
|
|
5276
5269
|
"privacy": "private"
|
|
5277
5270
|
},
|
|
5278
5271
|
{
|
|
5279
5272
|
"kind": "field",
|
|
5280
|
-
"name": "
|
|
5273
|
+
"name": "updatePopoverPosition",
|
|
5281
5274
|
"privacy": "private"
|
|
5282
5275
|
},
|
|
5283
5276
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lit"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lit"),o=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,c=Object.getOwnPropertyDescriptor,r=(a,e,t,i)=>{for(var l=i>1?void 0:i?c(e,t):e,n=a.length-1,d;n>=0;n--)(d=a[n])&&(l=(i?d(e,t,l):d(l))||l);return i&&l&&p(e,t,l),l};exports.PdSelect=class extends s.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.updatePopoverPosition=()=>{const e=this.popoverEl;if(!e||!this.trigger||!this.isOpen)return;const t=this.trigger.getBoundingClientRect();e.style.left=`${t.left}px`,e.style.top=`${t.bottom+4}px`,e.style.width=`${t.width}px`},this.handleTriggerClick=e=>{this.disabled||(e.stopPropagation(),this.searchQuery="",this.isOpen=!this.isOpen)},this.handleClickOutside=e=>{if(!this.isOpen)return;const t=e.composedPath();t.includes(this)||this.popoverEl&&t.includes(this.popoverEl)||(this.isOpen=!1)},this.handleKeyDown=e=>{e.key==="Escape"&&(this.isOpen=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleClickOutside),document.addEventListener("keydown",this.handleKeyDown),window.addEventListener("scroll",this.updatePopoverPosition,!0),window.addEventListener("resize",this.updatePopoverPosition)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("scroll",this.updatePopoverPosition,!0),window.removeEventListener("resize",this.updatePopoverPosition)}get useCustomDropdown(){return this.multiple||this.searchable}willUpdate(e){e.has("value")&&this.useCustomDropdown&&(this.selectedValues=Array.isArray(this.value)?[...this.value]:this.value?[this.value]:[])}updated(e){e.has("isOpen")&&(this.isOpen?this.openPopover():this.closePopover()),this.isOpen&&e.has("selectedValues")&&this.updateComplete.then(()=>{requestAnimationFrame(()=>this.updatePopoverPosition())})}getOptionLabel(e){return this.options.find(t=>t.value===e)?.label??e}get filteredOptions(){const e=this.searchQuery.trim().toLowerCase();return e?this.options.filter(t=>t.label.toLowerCase().includes(e)):this.options}openPopover(){const e=this.popoverEl;if(!(!e||!this.trigger)){try{e.showPopover()}catch{}this.updatePopoverPosition()}}closePopover(){const e=this.popoverEl;if(e)try{e.hidePopover()}catch{}}handleOptionClick(e,t){if(t.stopPropagation(),this.multiple){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]}else this.selectedValues=[e],this.value=e,this.isOpen=!1;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}}))}handleChipRemove(e,t){t.stopPropagation(),this.selectedValues=this.selectedValues.filter(i=>i!==e),this.value=[...this.selectedValues]}renderDropdown(){return s.html`
|
|
2
2
|
<div class="dropdown" role="listbox" aria-multiselectable=${this.multiple?"true":"false"}>
|
|
3
3
|
${this.searchable?s.html`
|
|
4
4
|
<div class="search">
|
|
@@ -64,6 +64,14 @@
|
|
|
64
64
|
|
|
65
65
|
${this.supportingText?s.html`<div class="supporting">${this.supportingText}</div>`:s.nothing}
|
|
66
66
|
</div>
|
|
67
|
+
|
|
68
|
+
<div
|
|
69
|
+
id="pd-select-popover"
|
|
70
|
+
popover="manual"
|
|
71
|
+
class="popover-overlay"
|
|
72
|
+
>
|
|
73
|
+
${this.renderDropdown()}
|
|
74
|
+
</div>
|
|
67
75
|
`}handleSingleSelectChange(e){const t=e.target;this.value=t.value,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}}))}handleSingleSelectOpen(){this.trailingIcon?.classList.add("rotated")}handleSingleSelectClose(){this.trailingIcon?.classList.remove("rotated")}renderSingleSelect(){const e=s.html`
|
|
68
76
|
${this.leadingIcon?s.html`<md-icon slot="leading-icon" class="pd-icon">${this.leadingIcon}</md-icon>`:s.nothing}
|
|
69
77
|
<md-icon slot="trailing-icon" class="pd-icon">keyboard_arrow_down</md-icon>
|
|
@@ -98,82 +106,7 @@
|
|
|
98
106
|
@opening=${this.handleSingleSelectOpen}
|
|
99
107
|
@closed=${this.handleSingleSelectClose}
|
|
100
108
|
>${e}</md-outlined-select>
|
|
101
|
-
`}render(){return this.useCustomDropdown?this.renderCustomSelect():this.renderSingleSelect()}};exports.PdSelect.
|
|
102
|
-
.dropdown {
|
|
103
|
-
background: var(--md-sys-color-surface-container, #f3edf7);
|
|
104
|
-
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
105
|
-
box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
|
|
106
|
-
overflow: hidden;
|
|
107
|
-
max-height: 320px;
|
|
108
|
-
display: flex;
|
|
109
|
-
flex-direction: column;
|
|
110
|
-
animation: dropdown-open 200ms cubic-bezier(0.2, 0, 0, 1) forwards;
|
|
111
|
-
transform-origin: top left;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
@keyframes dropdown-open {
|
|
115
|
-
from { opacity: 0; transform: scaleY(0.8); }
|
|
116
|
-
to { opacity: 1; transform: scaleY(1); }
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.search {
|
|
120
|
-
display: flex;
|
|
121
|
-
align-items: center;
|
|
122
|
-
gap: 12px;
|
|
123
|
-
padding: 12px 16px;
|
|
124
|
-
border-bottom: 1px solid var(--md-sys-color-outline-variant, #cac4d0);
|
|
125
|
-
background: var(--md-sys-color-surface-container, #f3edf7);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.search input {
|
|
129
|
-
flex: 1;
|
|
130
|
-
border: none;
|
|
131
|
-
background: transparent;
|
|
132
|
-
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
133
|
-
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
134
|
-
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
135
|
-
outline: none;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.options {
|
|
139
|
-
overflow-y: auto;
|
|
140
|
-
flex: 1;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.option {
|
|
144
|
-
display: flex;
|
|
145
|
-
align-items: center;
|
|
146
|
-
gap: 12px;
|
|
147
|
-
padding: 12px 16px;
|
|
148
|
-
cursor: pointer;
|
|
149
|
-
transition: background-color 100ms ease;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.option:hover {
|
|
153
|
-
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.option[data-selected="true"] {
|
|
157
|
-
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.option[data-disabled="true"] {
|
|
161
|
-
opacity: 0.38;
|
|
162
|
-
cursor: default;
|
|
163
|
-
pointer-events: none;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.option span {
|
|
167
|
-
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
168
|
-
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
169
|
-
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.pd-icon {
|
|
173
|
-
font-size: 24px;
|
|
174
|
-
color: var(--md-sys-color-on-surface-variant, #49454f);
|
|
175
|
-
}
|
|
176
|
-
`;exports.PdSelect.styles=s.css`
|
|
109
|
+
`}render(){return this.useCustomDropdown?this.renderCustomSelect():this.renderSingleSelect()}};exports.PdSelect.styles=s.css`
|
|
177
110
|
:host {
|
|
178
111
|
display: inline-block;
|
|
179
112
|
width: 100%;
|
|
@@ -348,21 +281,32 @@
|
|
|
348
281
|
var(--md-sys-motion-easing-emphasized, ease);
|
|
349
282
|
}
|
|
350
283
|
|
|
284
|
+
/* Popover overlay — promoted to top layer via popover="manual" */
|
|
285
|
+
.popover-overlay {
|
|
286
|
+
position: fixed;
|
|
287
|
+
margin: 0;
|
|
288
|
+
padding: 0;
|
|
289
|
+
border: none;
|
|
290
|
+
background: transparent;
|
|
291
|
+
overflow: visible;
|
|
292
|
+
inset: unset;
|
|
293
|
+
}
|
|
294
|
+
|
|
351
295
|
.dropdown {
|
|
352
|
-
|
|
353
|
-
top: 100%;
|
|
354
|
-
left: 0;
|
|
355
|
-
right: 0;
|
|
356
|
-
margin-top: 4px;
|
|
357
|
-
z-index: 9999;
|
|
358
|
-
background: var(--md-sys-color-surface-container);
|
|
296
|
+
background: var(--md-sys-color-surface-container, #f3edf7);
|
|
359
297
|
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
360
|
-
box-shadow:
|
|
361
|
-
0 2px 6px 2px rgba(0,0,0,0.15));
|
|
298
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
|
|
362
299
|
overflow: hidden;
|
|
363
300
|
max-height: 320px;
|
|
364
301
|
display: flex;
|
|
365
302
|
flex-direction: column;
|
|
303
|
+
animation: dropdown-open 200ms cubic-bezier(0.2, 0, 0, 1) forwards;
|
|
304
|
+
transform-origin: top left;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@keyframes dropdown-open {
|
|
308
|
+
from { opacity: 0; transform: scaleY(0.8); }
|
|
309
|
+
to { opacity: 1; transform: scaleY(1); }
|
|
366
310
|
}
|
|
367
311
|
|
|
368
312
|
.search {
|
|
@@ -423,4 +367,4 @@
|
|
|
423
367
|
color: var(--md-sys-color-error);
|
|
424
368
|
margin-left: 2px;
|
|
425
369
|
}
|
|
426
|
-
`;
|
|
370
|
+
`;r([o.query("md-filled-select, md-outlined-select")],exports.PdSelect.prototype,"select",2);r([o.query('[slot="trailing-icon"]')],exports.PdSelect.prototype,"trailingIcon",2);r([o.query(".field")],exports.PdSelect.prototype,"trigger",2);r([o.property({type:String,reflect:!0})],exports.PdSelect.prototype,"variant",2);r([o.property({type:String})],exports.PdSelect.prototype,"label",2);r([o.property({type:String,reflect:!0})],exports.PdSelect.prototype,"value",2);r([o.property({type:Boolean,reflect:!0})],exports.PdSelect.prototype,"disabled",2);r([o.property({type:Boolean})],exports.PdSelect.prototype,"required",2);r([o.property({type:String,attribute:"error-text"})],exports.PdSelect.prototype,"errorText",2);r([o.property({type:Boolean,reflect:!0})],exports.PdSelect.prototype,"error",2);r([o.property({type:String,attribute:"supporting-text"})],exports.PdSelect.prototype,"supportingText",2);r([o.property({type:Array})],exports.PdSelect.prototype,"options",2);r([o.property({type:String,attribute:"leading-icon"})],exports.PdSelect.prototype,"leadingIcon",2);r([o.property({type:Boolean})],exports.PdSelect.prototype,"multiple",2);r([o.property({type:Number,attribute:"max-selections"})],exports.PdSelect.prototype,"maxSelections",2);r([o.property({type:Boolean,attribute:"show-chips"})],exports.PdSelect.prototype,"showChips",2);r([o.property({type:String,attribute:"chip-variant"})],exports.PdSelect.prototype,"chipVariant",2);r([o.property({type:String})],exports.PdSelect.prototype,"placeholder",2);r([o.property({type:Boolean})],exports.PdSelect.prototype,"searchable",2);r([o.state()],exports.PdSelect.prototype,"isOpen",2);r([o.state()],exports.PdSelect.prototype,"searchQuery",2);r([o.state()],exports.PdSelect.prototype,"selectedValues",2);r([o.query("#pd-select-popover")],exports.PdSelect.prototype,"popoverEl",2);exports.PdSelect=r([o.customElement("pd-select")],exports.PdSelect);
|
|
@@ -1,46 +1,50 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { query as
|
|
1
|
+
import { css as m, LitElement as v, nothing as d, html as i } from "lit";
|
|
2
|
+
import { query as p, property as r, state as u, customElement as y } 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
|
|
11
|
-
(
|
|
12
|
-
return l &&
|
|
9
|
+
var f = Object.defineProperty, g = Object.getOwnPropertyDescriptor, o = (e, t, a, l) => {
|
|
10
|
+
for (var n = l > 1 ? void 0 : l ? g(t, a) : t, c = e.length - 1, h; c >= 0; c--)
|
|
11
|
+
(h = e[c]) && (n = (l ? h(t, a, n) : h(n)) || n);
|
|
12
|
+
return l && n && f(t, a, n), n;
|
|
13
13
|
};
|
|
14
14
|
let s = 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.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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.updatePopoverPosition = () => {
|
|
17
|
+
const e = this.popoverEl;
|
|
18
|
+
if (!e || !this.trigger || !this.isOpen) return;
|
|
19
|
+
const t = this.trigger.getBoundingClientRect();
|
|
20
|
+
e.style.left = `${t.left}px`, e.style.top = `${t.bottom + 4}px`, e.style.width = `${t.width}px`;
|
|
20
21
|
}, this.handleTriggerClick = (e) => {
|
|
21
22
|
this.disabled || (e.stopPropagation(), this.searchQuery = "", this.isOpen = !this.isOpen);
|
|
22
23
|
}, this.handleClickOutside = (e) => {
|
|
23
24
|
if (!this.isOpen) return;
|
|
24
25
|
const t = e.composedPath();
|
|
25
|
-
t.includes(this) || this.
|
|
26
|
+
t.includes(this) || this.popoverEl && t.includes(this.popoverEl) || (this.isOpen = !1);
|
|
26
27
|
}, this.handleKeyDown = (e) => {
|
|
27
28
|
e.key === "Escape" && (this.isOpen = !1);
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
connectedCallback() {
|
|
31
|
-
super.connectedCallback(), document.addEventListener("click", this.handleClickOutside), document.addEventListener("keydown", this.handleKeyDown), window.addEventListener("scroll", this.
|
|
32
|
+
super.connectedCallback(), document.addEventListener("click", this.handleClickOutside), document.addEventListener("keydown", this.handleKeyDown), window.addEventListener("scroll", this.updatePopoverPosition, !0), window.addEventListener("resize", this.updatePopoverPosition);
|
|
32
33
|
}
|
|
33
34
|
disconnectedCallback() {
|
|
34
|
-
super.disconnectedCallback(), document.removeEventListener("click", this.handleClickOutside), document.removeEventListener("keydown", this.handleKeyDown), window.removeEventListener("scroll", this.
|
|
35
|
+
super.disconnectedCallback(), document.removeEventListener("click", this.handleClickOutside), document.removeEventListener("keydown", this.handleKeyDown), window.removeEventListener("scroll", this.updatePopoverPosition, !0), window.removeEventListener("resize", this.updatePopoverPosition);
|
|
35
36
|
}
|
|
36
37
|
/** Whether to use the custom dropdown (overlay) instead of the native MD select */
|
|
37
38
|
get useCustomDropdown() {
|
|
38
39
|
return this.multiple || this.searchable;
|
|
39
40
|
}
|
|
40
41
|
willUpdate(e) {
|
|
41
|
-
e.has("value") && this.useCustomDropdown && (this.selectedValues = Array.isArray(this.value) ? [...this.value] : this.value ? [this.value] : [])
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
e.has("value") && this.useCustomDropdown && (this.selectedValues = Array.isArray(this.value) ? [...this.value] : this.value ? [this.value] : []);
|
|
43
|
+
}
|
|
44
|
+
updated(e) {
|
|
45
|
+
e.has("isOpen") && (this.isOpen ? this.openPopover() : this.closePopover()), this.isOpen && e.has("selectedValues") && this.updateComplete.then(() => {
|
|
46
|
+
requestAnimationFrame(() => this.updatePopoverPosition());
|
|
47
|
+
});
|
|
44
48
|
}
|
|
45
49
|
getOptionLabel(e) {
|
|
46
50
|
return this.options.find((t) => t.value === e)?.label ?? e;
|
|
@@ -49,20 +53,29 @@ let s = class extends v {
|
|
|
49
53
|
const e = this.searchQuery.trim().toLowerCase();
|
|
50
54
|
return e ? this.options.filter((t) => t.label.toLowerCase().includes(e)) : this.options;
|
|
51
55
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const e = this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
/* -------------------- Popover logic -------------------- */
|
|
57
|
+
openPopover() {
|
|
58
|
+
const e = this.popoverEl;
|
|
59
|
+
if (!(!e || !this.trigger)) {
|
|
60
|
+
try {
|
|
61
|
+
e.showPopover();
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
this.updatePopoverPosition();
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
closePopover() {
|
|
68
|
+
const e = this.popoverEl;
|
|
69
|
+
if (e)
|
|
70
|
+
try {
|
|
71
|
+
e.hidePopover();
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
61
74
|
}
|
|
62
75
|
handleOptionClick(e, t) {
|
|
63
76
|
if (t.stopPropagation(), this.multiple) {
|
|
64
77
|
if (this.selectedValues.includes(e))
|
|
65
|
-
this.selectedValues = this.selectedValues.filter((
|
|
78
|
+
this.selectedValues = this.selectedValues.filter((a) => a !== e);
|
|
66
79
|
else {
|
|
67
80
|
if (this.maxSelections && this.selectedValues.length >= this.maxSelections) return;
|
|
68
81
|
this.selectedValues = [...this.selectedValues, e];
|
|
@@ -77,13 +90,13 @@ let s = class extends v {
|
|
|
77
90
|
}));
|
|
78
91
|
}
|
|
79
92
|
handleChipRemove(e, t) {
|
|
80
|
-
t.stopPropagation(), this.selectedValues = this.selectedValues.filter((
|
|
93
|
+
t.stopPropagation(), this.selectedValues = this.selectedValues.filter((a) => a !== e), this.value = [...this.selectedValues];
|
|
81
94
|
}
|
|
82
95
|
/* -------------------- Rendering -------------------- */
|
|
83
96
|
renderDropdown() {
|
|
84
|
-
return
|
|
97
|
+
return i`
|
|
85
98
|
<div class="dropdown" role="listbox" aria-multiselectable=${this.multiple ? "true" : "false"}>
|
|
86
|
-
${this.searchable ?
|
|
99
|
+
${this.searchable ? i`
|
|
87
100
|
<div class="search">
|
|
88
101
|
<md-icon class="pd-icon">search</md-icon>
|
|
89
102
|
<input
|
|
@@ -92,19 +105,19 @@ let s = class extends v {
|
|
|
92
105
|
@input=${(e) => this.searchQuery = e.target.value}
|
|
93
106
|
/>
|
|
94
107
|
</div>
|
|
95
|
-
` :
|
|
108
|
+
` : d}
|
|
96
109
|
|
|
97
110
|
<div class="options">
|
|
98
111
|
${this.filteredOptions.map((e) => {
|
|
99
|
-
const t = this.selectedValues.includes(e.value),
|
|
100
|
-
return
|
|
112
|
+
const t = this.selectedValues.includes(e.value), a = e.disabled ?? !1;
|
|
113
|
+
return i`
|
|
101
114
|
<div
|
|
102
115
|
class="option"
|
|
103
116
|
data-selected=${t}
|
|
104
|
-
data-disabled=${
|
|
105
|
-
@click=${(l) => !
|
|
117
|
+
data-disabled=${a}
|
|
118
|
+
@click=${(l) => !a && this.handleOptionClick(e.value, l)}
|
|
106
119
|
>
|
|
107
|
-
${this.multiple ?
|
|
120
|
+
${this.multiple ? i`<md-checkbox ?checked=${t} ?disabled=${a}></md-checkbox>` : d}
|
|
108
121
|
<span>${e.label}</span>
|
|
109
122
|
</div>
|
|
110
123
|
`;
|
|
@@ -115,14 +128,14 @@ let s = class extends v {
|
|
|
115
128
|
}
|
|
116
129
|
renderCustomSelect() {
|
|
117
130
|
const e = this.selectedValues.length > 0, t = e || this.isOpen;
|
|
118
|
-
return
|
|
131
|
+
return i`
|
|
119
132
|
<div class="container">
|
|
120
133
|
<div class="wrap">
|
|
121
|
-
${this.label ?
|
|
134
|
+
${this.label ? i`
|
|
122
135
|
<label class="label" data-float=${t}>
|
|
123
|
-
${this.label}${this.required ?
|
|
136
|
+
${this.label}${this.required ? i`<span class="required">*</span>` : d}
|
|
124
137
|
</label>
|
|
125
|
-
` :
|
|
138
|
+
` : d}
|
|
126
139
|
|
|
127
140
|
<div
|
|
128
141
|
class="field"
|
|
@@ -131,19 +144,19 @@ let s = class extends v {
|
|
|
131
144
|
role="combobox"
|
|
132
145
|
@click=${this.handleTriggerClick}
|
|
133
146
|
>
|
|
134
|
-
${this.leadingIcon ?
|
|
147
|
+
${this.leadingIcon ? i`<md-icon class="pd-icon pd-icon--leading">${this.leadingIcon}</md-icon>` : d}
|
|
135
148
|
|
|
136
149
|
<div class="content">
|
|
137
|
-
${e ? this.multiple ?
|
|
150
|
+
${e ? this.multiple ? i`
|
|
138
151
|
<div class="chips">
|
|
139
|
-
${this.selectedValues.map((
|
|
152
|
+
${this.selectedValues.map((a) => i`
|
|
140
153
|
<pd-chip
|
|
141
|
-
label=${this.getOptionLabel(
|
|
142
|
-
@chip-remove=${(l) => this.handleChipRemove(
|
|
154
|
+
label=${this.getOptionLabel(a)}
|
|
155
|
+
@chip-remove=${(l) => this.handleChipRemove(a, l)}
|
|
143
156
|
></pd-chip>
|
|
144
157
|
`)}
|
|
145
158
|
</div>
|
|
146
|
-
` :
|
|
159
|
+
` : i`<span class="summary">${this.getOptionLabel(this.selectedValues[0])}</span>` : i`<span class="placeholder">${this.placeholder}</span>`}
|
|
147
160
|
</div>
|
|
148
161
|
|
|
149
162
|
<md-icon class="pd-icon pd-icon--trailing" data-rotated=${this.isOpen}>
|
|
@@ -152,7 +165,15 @@ let s = class extends v {
|
|
|
152
165
|
</div>
|
|
153
166
|
</div>
|
|
154
167
|
|
|
155
|
-
${this.supportingText ?
|
|
168
|
+
${this.supportingText ? i`<div class="supporting">${this.supportingText}</div>` : d}
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div
|
|
172
|
+
id="pd-select-popover"
|
|
173
|
+
popover="manual"
|
|
174
|
+
class="popover-overlay"
|
|
175
|
+
>
|
|
176
|
+
${this.renderDropdown()}
|
|
156
177
|
</div>
|
|
157
178
|
`;
|
|
158
179
|
}
|
|
@@ -171,16 +192,16 @@ let s = class extends v {
|
|
|
171
192
|
this.trailingIcon?.classList.remove("rotated");
|
|
172
193
|
}
|
|
173
194
|
renderSingleSelect() {
|
|
174
|
-
const e =
|
|
175
|
-
${this.leadingIcon ?
|
|
195
|
+
const e = i`
|
|
196
|
+
${this.leadingIcon ? i`<md-icon slot="leading-icon" class="pd-icon">${this.leadingIcon}</md-icon>` : d}
|
|
176
197
|
<md-icon slot="trailing-icon" class="pd-icon">keyboard_arrow_down</md-icon>
|
|
177
|
-
${this.options.map((t) =>
|
|
198
|
+
${this.options.map((t) => i`
|
|
178
199
|
<md-select-option .value=${t.value} ?disabled=${t.disabled}>
|
|
179
200
|
<div slot="headline">${t.label}</div>
|
|
180
201
|
</md-select-option>
|
|
181
202
|
`)}
|
|
182
203
|
`;
|
|
183
|
-
return this.variant === "filled" ?
|
|
204
|
+
return this.variant === "filled" ? i`
|
|
184
205
|
<md-filled-select
|
|
185
206
|
.label=${this.label}
|
|
186
207
|
.value=${this.value}
|
|
@@ -193,7 +214,7 @@ let s = class extends v {
|
|
|
193
214
|
@opening=${this.handleSingleSelectOpen}
|
|
194
215
|
@closed=${this.handleSingleSelectClose}
|
|
195
216
|
>${e}</md-filled-select>
|
|
196
|
-
` :
|
|
217
|
+
` : i`
|
|
197
218
|
<md-outlined-select
|
|
198
219
|
.label=${this.label}
|
|
199
220
|
.value=${this.value}
|
|
@@ -212,83 +233,7 @@ let s = class extends v {
|
|
|
212
233
|
return this.useCustomDropdown ? this.renderCustomSelect() : this.renderSingleSelect();
|
|
213
234
|
}
|
|
214
235
|
};
|
|
215
|
-
s.
|
|
216
|
-
.dropdown {
|
|
217
|
-
background: var(--md-sys-color-surface-container, #f3edf7);
|
|
218
|
-
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
219
|
-
box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
|
|
220
|
-
overflow: hidden;
|
|
221
|
-
max-height: 320px;
|
|
222
|
-
display: flex;
|
|
223
|
-
flex-direction: column;
|
|
224
|
-
animation: dropdown-open 200ms cubic-bezier(0.2, 0, 0, 1) forwards;
|
|
225
|
-
transform-origin: top left;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
@keyframes dropdown-open {
|
|
229
|
-
from { opacity: 0; transform: scaleY(0.8); }
|
|
230
|
-
to { opacity: 1; transform: scaleY(1); }
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.search {
|
|
234
|
-
display: flex;
|
|
235
|
-
align-items: center;
|
|
236
|
-
gap: 12px;
|
|
237
|
-
padding: 12px 16px;
|
|
238
|
-
border-bottom: 1px solid var(--md-sys-color-outline-variant, #cac4d0);
|
|
239
|
-
background: var(--md-sys-color-surface-container, #f3edf7);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.search input {
|
|
243
|
-
flex: 1;
|
|
244
|
-
border: none;
|
|
245
|
-
background: transparent;
|
|
246
|
-
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
247
|
-
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
248
|
-
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
249
|
-
outline: none;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.options {
|
|
253
|
-
overflow-y: auto;
|
|
254
|
-
flex: 1;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.option {
|
|
258
|
-
display: flex;
|
|
259
|
-
align-items: center;
|
|
260
|
-
gap: 12px;
|
|
261
|
-
padding: 12px 16px;
|
|
262
|
-
cursor: pointer;
|
|
263
|
-
transition: background-color 100ms ease;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.option:hover {
|
|
267
|
-
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.option[data-selected="true"] {
|
|
271
|
-
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.option[data-disabled="true"] {
|
|
275
|
-
opacity: 0.38;
|
|
276
|
-
cursor: default;
|
|
277
|
-
pointer-events: none;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.option span {
|
|
281
|
-
font-family: var(--md-sys-typescale-body-large-font, Roboto, sans-serif);
|
|
282
|
-
font-size: var(--md-sys-typescale-body-large-size, 1rem);
|
|
283
|
-
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.pd-icon {
|
|
287
|
-
font-size: 24px;
|
|
288
|
-
color: var(--md-sys-color-on-surface-variant, #49454f);
|
|
289
|
-
}
|
|
290
|
-
`;
|
|
291
|
-
s.styles = y`
|
|
236
|
+
s.styles = m`
|
|
292
237
|
:host {
|
|
293
238
|
display: inline-block;
|
|
294
239
|
width: 100%;
|
|
@@ -463,21 +408,32 @@ s.styles = y`
|
|
|
463
408
|
var(--md-sys-motion-easing-emphasized, ease);
|
|
464
409
|
}
|
|
465
410
|
|
|
411
|
+
/* Popover overlay — promoted to top layer via popover="manual" */
|
|
412
|
+
.popover-overlay {
|
|
413
|
+
position: fixed;
|
|
414
|
+
margin: 0;
|
|
415
|
+
padding: 0;
|
|
416
|
+
border: none;
|
|
417
|
+
background: transparent;
|
|
418
|
+
overflow: visible;
|
|
419
|
+
inset: unset;
|
|
420
|
+
}
|
|
421
|
+
|
|
466
422
|
.dropdown {
|
|
467
|
-
|
|
468
|
-
top: 100%;
|
|
469
|
-
left: 0;
|
|
470
|
-
right: 0;
|
|
471
|
-
margin-top: 4px;
|
|
472
|
-
z-index: 9999;
|
|
473
|
-
background: var(--md-sys-color-surface-container);
|
|
423
|
+
background: var(--md-sys-color-surface-container, #f3edf7);
|
|
474
424
|
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
475
|
-
box-shadow:
|
|
476
|
-
0 2px 6px 2px rgba(0,0,0,0.15));
|
|
425
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
|
|
477
426
|
overflow: hidden;
|
|
478
427
|
max-height: 320px;
|
|
479
428
|
display: flex;
|
|
480
429
|
flex-direction: column;
|
|
430
|
+
animation: dropdown-open 200ms cubic-bezier(0.2, 0, 0, 1) forwards;
|
|
431
|
+
transform-origin: top left;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
@keyframes dropdown-open {
|
|
435
|
+
from { opacity: 0; transform: scaleY(0.8); }
|
|
436
|
+
to { opacity: 1; transform: scaleY(1); }
|
|
481
437
|
}
|
|
482
438
|
|
|
483
439
|
.search {
|
|
@@ -540,73 +496,76 @@ s.styles = y`
|
|
|
540
496
|
}
|
|
541
497
|
`;
|
|
542
498
|
o([
|
|
543
|
-
|
|
499
|
+
p("md-filled-select, md-outlined-select")
|
|
544
500
|
], s.prototype, "select", 2);
|
|
545
501
|
o([
|
|
546
|
-
|
|
502
|
+
p('[slot="trailing-icon"]')
|
|
547
503
|
], s.prototype, "trailingIcon", 2);
|
|
548
504
|
o([
|
|
549
|
-
|
|
505
|
+
p(".field")
|
|
550
506
|
], s.prototype, "trigger", 2);
|
|
551
507
|
o([
|
|
552
|
-
|
|
508
|
+
r({ type: String, reflect: !0 })
|
|
553
509
|
], s.prototype, "variant", 2);
|
|
554
510
|
o([
|
|
555
|
-
|
|
511
|
+
r({ type: String })
|
|
556
512
|
], s.prototype, "label", 2);
|
|
557
513
|
o([
|
|
558
|
-
|
|
514
|
+
r({ type: String, reflect: !0 })
|
|
559
515
|
], s.prototype, "value", 2);
|
|
560
516
|
o([
|
|
561
|
-
|
|
517
|
+
r({ type: Boolean, reflect: !0 })
|
|
562
518
|
], s.prototype, "disabled", 2);
|
|
563
519
|
o([
|
|
564
|
-
|
|
520
|
+
r({ type: Boolean })
|
|
565
521
|
], s.prototype, "required", 2);
|
|
566
522
|
o([
|
|
567
|
-
|
|
523
|
+
r({ type: String, attribute: "error-text" })
|
|
568
524
|
], s.prototype, "errorText", 2);
|
|
569
525
|
o([
|
|
570
|
-
|
|
526
|
+
r({ type: Boolean, reflect: !0 })
|
|
571
527
|
], s.prototype, "error", 2);
|
|
572
528
|
o([
|
|
573
|
-
|
|
529
|
+
r({ type: String, attribute: "supporting-text" })
|
|
574
530
|
], s.prototype, "supportingText", 2);
|
|
575
531
|
o([
|
|
576
|
-
|
|
532
|
+
r({ type: Array })
|
|
577
533
|
], s.prototype, "options", 2);
|
|
578
534
|
o([
|
|
579
|
-
|
|
535
|
+
r({ type: String, attribute: "leading-icon" })
|
|
580
536
|
], s.prototype, "leadingIcon", 2);
|
|
581
537
|
o([
|
|
582
|
-
|
|
538
|
+
r({ type: Boolean })
|
|
583
539
|
], s.prototype, "multiple", 2);
|
|
584
540
|
o([
|
|
585
|
-
|
|
541
|
+
r({ type: Number, attribute: "max-selections" })
|
|
586
542
|
], s.prototype, "maxSelections", 2);
|
|
587
543
|
o([
|
|
588
|
-
|
|
544
|
+
r({ type: Boolean, attribute: "show-chips" })
|
|
589
545
|
], s.prototype, "showChips", 2);
|
|
590
546
|
o([
|
|
591
|
-
|
|
547
|
+
r({ type: String, attribute: "chip-variant" })
|
|
592
548
|
], s.prototype, "chipVariant", 2);
|
|
593
549
|
o([
|
|
594
|
-
|
|
550
|
+
r({ type: String })
|
|
595
551
|
], s.prototype, "placeholder", 2);
|
|
596
552
|
o([
|
|
597
|
-
|
|
553
|
+
r({ type: Boolean })
|
|
598
554
|
], s.prototype, "searchable", 2);
|
|
599
555
|
o([
|
|
600
|
-
|
|
556
|
+
u()
|
|
601
557
|
], s.prototype, "isOpen", 2);
|
|
602
558
|
o([
|
|
603
|
-
|
|
559
|
+
u()
|
|
604
560
|
], s.prototype, "searchQuery", 2);
|
|
605
561
|
o([
|
|
606
|
-
|
|
562
|
+
u()
|
|
607
563
|
], s.prototype, "selectedValues", 2);
|
|
564
|
+
o([
|
|
565
|
+
p("#pd-select-popover")
|
|
566
|
+
], s.prototype, "popoverEl", 2);
|
|
608
567
|
s = o([
|
|
609
|
-
|
|
568
|
+
y("pd-select")
|
|
610
569
|
], s);
|
|
611
570
|
export {
|
|
612
571
|
s as PdSelect
|
|
@@ -34,18 +34,18 @@ export declare class PdSelect extends LitElement {
|
|
|
34
34
|
private isOpen;
|
|
35
35
|
private searchQuery;
|
|
36
36
|
private selectedValues;
|
|
37
|
-
private
|
|
37
|
+
private readonly popoverEl;
|
|
38
38
|
connectedCallback(): void;
|
|
39
39
|
disconnectedCallback(): void;
|
|
40
40
|
/** Whether to use the custom dropdown (overlay) instead of the native MD select */
|
|
41
41
|
private get useCustomDropdown();
|
|
42
42
|
willUpdate(changed: PropertyValues): void;
|
|
43
|
+
updated(changed: PropertyValues): void;
|
|
43
44
|
private getOptionLabel;
|
|
44
45
|
private get filteredOptions();
|
|
45
|
-
private
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
private updateOverlayPosition;
|
|
46
|
+
private openPopover;
|
|
47
|
+
private closePopover;
|
|
48
|
+
private updatePopoverPosition;
|
|
49
49
|
private handleTriggerClick;
|
|
50
50
|
private handleClickOutside;
|
|
51
51
|
private handleKeyDown;
|