scb-wc-test 0.1.103 → 0.1.105
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.
|
@@ -27,7 +27,7 @@ import{a as h,n as d,i as p,x as n,t as u}from"../../vendor/vendor.js";import"..
|
|
|
27
27
|
.item.checked {
|
|
28
28
|
background-color: var(--md-sys-color-secondary-container);
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
md-icon.radio-checked{
|
|
31
|
+
color: var(--md-sys-color-primary);
|
|
32
|
+
}
|
|
33
33
|
`;s([d({type:String})],t.prototype,"value",2);s([d({type:Boolean,reflect:!0})],t.prototype,"disabled",2);s([d({type:Boolean})],t.prototype,"showCheckbox",2);s([d({type:Boolean})],t.prototype,"checked",2);s([d({type:Boolean})],t.prototype,"showRadio",2);s([d({type:String})],t.prototype,"label",2);t=s([u("scb-select-option")],t);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,n as r,i as p,x as d,t as u}from"../../vendor/vendor.js";import"./scb-select-option.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(e,i,o){try{customElements.get(e)||s(e,i,o)}catch(c){var a=String(c||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var b=Object.defineProperty,v=Object.getOwnPropertyDescriptor,n=(t,s,e,i)=>{for(var o=i>1?void 0:i?v(s,e):s,a=t.length-1,c;a>=0;a--)(c=t[a])&&(o=(i?c(s,e,o):c(o))||o);return i&&o&&b(s,e,o),o};let l=class extends p{constructor(){super(),this._internals=null,this.focusedIndex=-1,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.withRadiobuttons=!1,this._onDocumentClick=t=>{if(!this.open)return;t.composedPath().includes(this)||(this.open=!1,this.removeAttribute("open"))},this._onSlotClick=t=>{const s=this.shadowRoot?.querySelector("slot");if(!s)return;const e=s.assignedElements({flatten:!0}).filter(a=>a.tagName.toLowerCase()==="scb-select-option"),i=t.composedPath(),o=e.find(a=>i.includes(a));o&&(this._selectOption(o),t.stopPropagation())},this._onKeyDown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggleOpen())},this._onOptionKeyDown=t=>{if(t.key==="Enter"||t.key===" "){t.preventDefault();const s=this.shadowRoot?.querySelector("slot");if(!s)return;const e=s.assignedElements({flatten:!0}).filter(a=>a.tagName.toLowerCase()==="scb-select-option"),i=t.composedPath(),o=e.find(a=>i.includes(a));o&&this._selectOption(o)}},"attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentClick)}disconnectedCallback(){document.removeEventListener("mousedown",this._onDocumentClick),super.disconnectedCallback()}_toggleOpen(){this.disabled||(this.open=!this.open,this.open?(this.focusedIndex=0,this.requestUpdate()):this.focusedIndex=-1)}_selectOption(t){t.disabled||(this.variant==="multi-select"?(this.values.indexOf(t.value)>-1?this.values=this.values.filter(e=>e!==t.value):this.values=[...this.values,t.value],this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0}))):this.variant==="single-select"&&this.withRadiobuttons?(this.value=t.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))):(this.value=t.value,this.open=!1,this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))),this._updateOptionsChecked(),this.requestUpdate())}_getSelectedLabel(){const t=this.shadowRoot?.querySelector("slot");if(!t)return"";const s=t.assignedElements({flatten:!0}).filter(e=>e.tagName.toLowerCase()==="scb-select-option");if(this.variant==="multi-select"){const e=s.filter(i=>this.values.includes(i.value));return e&&e.length>0?e.map(i=>i.label).join(", "):""}else{const e=s.find(i=>i.value===this.value);return e?e.label:""}}firstUpdated(){this._updateOptionsChecked(),this._internals&&this._internals.setFormValue(this.value)}updated(){this._updateOptionsChecked(),this._internals&&this._internals.setFormValue(this.value)}_updateOptionsChecked(){const t=this.shadowRoot?.querySelector("slot");if(!t)return;t.assignedElements({flatten:!0}).filter(e=>e.tagName.toLowerCase()==="scb-select-option").forEach(e=>{this.variant==="multi-select"?(e.showCheckbox=!0,e.checked=this.values.includes(e.value),e.showRadio=!1):(e.showCheckbox=!1,e.checked=this.value===e.value,this.withRadiobuttons&&(e.showRadio=!0))})}render(){return d`
|
|
1
|
+
import{a as h,n as r,i as p,x as d,t as u}from"../../vendor/vendor.js";import"./scb-select-option.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(e,i,o){try{customElements.get(e)||s(e,i,o)}catch(c){var a=String(c||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var b=Object.defineProperty,v=Object.getOwnPropertyDescriptor,n=(t,s,e,i)=>{for(var o=i>1?void 0:i?v(s,e):s,a=t.length-1,c;a>=0;a--)(c=t[a])&&(o=(i?c(s,e,o):c(o))||o);return i&&o&&b(s,e,o),o};let l=class extends p{constructor(){super(),this._internals=null,this.focusedIndex=-1,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.withRadiobuttons=!1,this._onDocumentClick=t=>{if(!this.open)return;t.composedPath().includes(this)||(this.open=!1,this.removeAttribute("open"))},this._onSlotClick=t=>{const s=this.shadowRoot?.querySelector("slot");if(!s)return;const e=s.assignedElements({flatten:!0}).filter(a=>a.tagName.toLowerCase()==="scb-select-option"),i=t.composedPath(),o=e.find(a=>i.includes(a));o&&(this._selectOption(o),t.stopPropagation())},this._onKeyDown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggleOpen())},this._onOptionKeyDown=t=>{if(t.key==="Enter"||t.key===" "){t.preventDefault();const s=this.shadowRoot?.querySelector("slot");if(!s)return;const e=s.assignedElements({flatten:!0}).filter(a=>a.tagName.toLowerCase()==="scb-select-option"),i=t.composedPath(),o=e.find(a=>i.includes(a));o&&this._selectOption(o)}},"attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentClick)}disconnectedCallback(){document.removeEventListener("mousedown",this._onDocumentClick),super.disconnectedCallback()}_toggleOpen(){this.disabled||(this.open=!this.open,this.open?(this.focusedIndex=0,this.requestUpdate()):this.focusedIndex=-1)}_selectOption(t){t.disabled||(this.variant==="multi-select"?(this.values.indexOf(t.value)>-1?this.values=this.values.filter(e=>e!==t.value):this.values=[...this.values,t.value],this.value=this.values.join(","),this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0}))):this.variant==="single-select"&&this.withRadiobuttons?(this.value=t.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))):(this.value=t.value,this.open=!1,this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))),this._updateOptionsChecked(),this.requestUpdate())}_getSelectedLabel(){const t=this.shadowRoot?.querySelector("slot");if(!t)return"";const s=t.assignedElements({flatten:!0}).filter(e=>e.tagName.toLowerCase()==="scb-select-option");if(this.variant==="multi-select"){const e=s.filter(i=>this.values.includes(i.value));return e&&e.length>0?e.map(i=>i.label).join(", "):""}else{const e=s.find(i=>i.value===this.value);return e?e.label:""}}firstUpdated(){this._updateOptionsChecked(),this._internals&&this._internals.setFormValue(this.value)}updated(){this._updateOptionsChecked(),this._internals&&this._internals.setFormValue(this.value)}_updateOptionsChecked(){const t=this.shadowRoot?.querySelector("slot");if(!t)return;t.assignedElements({flatten:!0}).filter(e=>e.tagName.toLowerCase()==="scb-select-option").forEach(e=>{this.variant==="multi-select"?(e.showCheckbox=!0,e.checked=this.values.includes(e.value),e.showRadio=!1):(e.showCheckbox=!1,e.checked=this.value===e.value,this.withRadiobuttons&&(e.showRadio=!0))})}render(){return d`
|
|
2
2
|
${this.label||this.supportingText?d`
|
|
3
3
|
<label class="select-label" id="scb-select-label-${this.name}">
|
|
4
4
|
${this.label?d`
|
|
@@ -126,17 +126,17 @@ import{a as h,n as r,i as p,x as d,t as u}from"../../vendor/vendor.js";import"./
|
|
|
126
126
|
.options::-webkit-scrollbar {
|
|
127
127
|
width: 12px;
|
|
128
128
|
background: var(--md-sys-color-surface);
|
|
129
|
-
border-radius:
|
|
129
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
130
130
|
}
|
|
131
131
|
.options::-webkit-scrollbar-thumb {
|
|
132
132
|
background: var(--md-sys-color-outline);
|
|
133
|
-
border-radius:
|
|
133
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
134
134
|
border: 4px solid var(--md-sys-color-surface);
|
|
135
135
|
|
|
136
136
|
}
|
|
137
137
|
.options::-webkit-scrollbar-track {
|
|
138
138
|
background: var(--md-sys-color-surface);
|
|
139
|
-
border-radius:
|
|
139
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
140
140
|
}
|
|
141
141
|
:host([open]) .options {
|
|
142
142
|
max-height: 240px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.105",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -337,5 +337,5 @@
|
|
|
337
337
|
},
|
|
338
338
|
"./mvc/*": "./mvc/*"
|
|
339
339
|
},
|
|
340
|
-
"buildHash": "
|
|
340
|
+
"buildHash": "F471BF0297C09631C7B212F431BB78DE6E04C544E36E5B3038379A15174EE4B8"
|
|
341
341
|
}
|
|
@@ -45,9 +45,9 @@ e.styles = h`
|
|
|
45
45
|
.item.checked {
|
|
46
46
|
background-color: var(--md-sys-color-secondary-container);
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
md-icon.radio-checked{
|
|
49
|
+
color: var(--md-sys-color-primary);
|
|
50
|
+
}
|
|
51
51
|
`;
|
|
52
52
|
o([
|
|
53
53
|
s({ type: String })
|
package/scb-select/scb-select.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as h, LitElement as p, html as d } from "lit";
|
|
2
|
+
import { property as n, customElement as u } from "lit/decorators.js";
|
|
3
3
|
import "./scb-select-option.js";
|
|
4
4
|
import "@material/web/focus/md-focus-ring.js";
|
|
5
|
-
var b = Object.defineProperty, v = Object.getOwnPropertyDescriptor,
|
|
5
|
+
var b = Object.defineProperty, v = Object.getOwnPropertyDescriptor, r = (e, i, o, t) => {
|
|
6
6
|
for (var s = t > 1 ? void 0 : t ? v(i, o) : i, c = e.length - 1, l; c >= 0; c--)
|
|
7
7
|
(l = e[c]) && (s = (t ? l(i, o, s) : l(s)) || s);
|
|
8
8
|
return t && s && b(i, o, s), s;
|
|
9
9
|
};
|
|
10
|
-
let a = class extends
|
|
10
|
+
let a = class extends p {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(), this._internals = null, this.focusedIndex = -1, this.variant = "single-select", this.value = "", this.values = [], this.disabled = !1, this.open = !1, this.label = "", this.name = "", this.placeholder = "", this.supportingText = "", this.withRadiobuttons = !1, this._onDocumentClick = (e) => {
|
|
13
13
|
if (!this.open) return;
|
|
@@ -41,7 +41,7 @@ let a = class extends h {
|
|
|
41
41
|
this.disabled || (this.open = !this.open, this.open ? (this.focusedIndex = 0, this.requestUpdate()) : this.focusedIndex = -1);
|
|
42
42
|
}
|
|
43
43
|
_selectOption(e) {
|
|
44
|
-
e.disabled || (this.variant === "multi-select" ? (this.values.indexOf(e.value) > -1 ? this.values = this.values.filter((o) => o !== e.value) : this.values = [...this.values, e.value], this.dispatchEvent(new CustomEvent("change", { detail: { values: this.values }, bubbles: !0, composed: !0 }))) : this.variant === "single-select" && this.withRadiobuttons ? (this.value = e.value, this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 }))) : (this.value = e.value, this.open = !1, this.removeAttribute("open"), this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 }))), this._updateOptionsChecked(), this.requestUpdate());
|
|
44
|
+
e.disabled || (this.variant === "multi-select" ? (this.values.indexOf(e.value) > -1 ? this.values = this.values.filter((o) => o !== e.value) : this.values = [...this.values, e.value], this.value = this.values.join(","), this.dispatchEvent(new CustomEvent("change", { detail: { values: this.values }, bubbles: !0, composed: !0 }))) : this.variant === "single-select" && this.withRadiobuttons ? (this.value = e.value, this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 }))) : (this.value = e.value, this.open = !1, this.removeAttribute("open"), this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 }))), this._updateOptionsChecked(), this.requestUpdate());
|
|
45
45
|
}
|
|
46
46
|
_getSelectedLabel() {
|
|
47
47
|
var o;
|
|
@@ -112,7 +112,7 @@ let a = class extends h {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
a.formAssociated = !0;
|
|
115
|
-
a.styles =
|
|
115
|
+
a.styles = h`
|
|
116
116
|
:host {
|
|
117
117
|
display: block;
|
|
118
118
|
color: var(--md-sys-color-on-surface-variant);
|
|
@@ -205,17 +205,17 @@ a.styles = p`
|
|
|
205
205
|
.options::-webkit-scrollbar {
|
|
206
206
|
width: 12px;
|
|
207
207
|
background: var(--md-sys-color-surface);
|
|
208
|
-
border-radius:
|
|
208
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
209
209
|
}
|
|
210
210
|
.options::-webkit-scrollbar-thumb {
|
|
211
211
|
background: var(--md-sys-color-outline);
|
|
212
|
-
border-radius:
|
|
212
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
213
213
|
border: 4px solid var(--md-sys-color-surface);
|
|
214
214
|
|
|
215
215
|
}
|
|
216
216
|
.options::-webkit-scrollbar-track {
|
|
217
217
|
background: var(--md-sys-color-surface);
|
|
218
|
-
border-radius:
|
|
218
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
219
219
|
}
|
|
220
220
|
:host([open]) .options {
|
|
221
221
|
max-height: 240px;
|
|
@@ -239,37 +239,37 @@ a.styles = p`
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
`;
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
r([
|
|
243
|
+
n({ type: String })
|
|
244
244
|
], a.prototype, "variant", 2);
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
r([
|
|
246
|
+
n({ type: String })
|
|
247
247
|
], a.prototype, "value", 2);
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
r([
|
|
249
|
+
n({ type: Array })
|
|
250
250
|
], a.prototype, "values", 2);
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
r([
|
|
252
|
+
n({ type: Boolean })
|
|
253
253
|
], a.prototype, "disabled", 2);
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
r([
|
|
255
|
+
n({ type: Boolean, reflect: !0 })
|
|
256
256
|
], a.prototype, "open", 2);
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
r([
|
|
258
|
+
n({ type: String })
|
|
259
259
|
], a.prototype, "label", 2);
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
r([
|
|
261
|
+
n({ type: String })
|
|
262
262
|
], a.prototype, "name", 2);
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
r([
|
|
264
|
+
n({ type: String })
|
|
265
265
|
], a.prototype, "placeholder", 2);
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
r([
|
|
267
|
+
n({ type: String, attribute: "supporting-text" })
|
|
268
268
|
], a.prototype, "supportingText", 2);
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
r([
|
|
270
|
+
n({ type: Boolean, attribute: "with-radiobuttons" })
|
|
271
271
|
], a.prototype, "withRadiobuttons", 2);
|
|
272
|
-
a =
|
|
272
|
+
a = r([
|
|
273
273
|
u("scb-select")
|
|
274
274
|
], a);
|
|
275
275
|
export {
|
package/scb-wc-test.bundle.js
CHANGED
|
@@ -7008,10 +7008,10 @@ ${this.value}</textarea
|
|
|
7008
7008
|
.item.checked {
|
|
7009
7009
|
background-color: var(--md-sys-color-secondary-container);
|
|
7010
7010
|
}
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
`,St([l({type:String})],a.ScbSelectOption.prototype,"value",2),St([l({type:Boolean,reflect:!0})],a.ScbSelectOption.prototype,"disabled",2),St([l({type:Boolean})],a.ScbSelectOption.prototype,"showCheckbox",2),St([l({type:Boolean})],a.ScbSelectOption.prototype,"checked",2),St([l({type:Boolean})],a.ScbSelectOption.prototype,"showRadio",2),St([l({type:String})],a.ScbSelectOption.prototype,"label",2),a.ScbSelectOption=St([g("scb-select-option")],a.ScbSelectOption);var qh=Object.defineProperty,Uh=Object.getOwnPropertyDescriptor,xe=(o,e,t,i)=>{for(var r=i>1?void 0:i?Uh(e,t):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&qh(e,t,r),r};a.ScbSelect=class extends y{constructor(){super(),this._internals=null,this.focusedIndex=-1,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.withRadiobuttons=!1,this._onDocumentClick=e=>{if(!this.open)return;e.composedPath().includes(this)||(this.open=!1,this.removeAttribute("open"))},this._onSlotClick=e=>{var n;const t=(n=this.shadowRoot)==null?void 0:n.querySelector("slot");if(!t)return;const i=t.assignedElements({flatten:!0}).filter(h=>h.tagName.toLowerCase()==="scb-select-option"),r=e.composedPath(),s=i.find(h=>r.includes(h));s&&(this._selectOption(s),e.stopPropagation())},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._toggleOpen())},this._onOptionKeyDown=e=>{var t;if(e.key==="Enter"||e.key===" "){e.preventDefault();const i=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");if(!i)return;const r=i.assignedElements({flatten:!0}).filter(h=>h.tagName.toLowerCase()==="scb-select-option"),s=e.composedPath(),n=r.find(h=>s.includes(h));n&&this._selectOption(n)}},"attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentClick)}disconnectedCallback(){document.removeEventListener("mousedown",this._onDocumentClick),super.disconnectedCallback()}_toggleOpen(){this.disabled||(this.open=!this.open,this.open?(this.focusedIndex=0,this.requestUpdate()):this.focusedIndex=-1)}_selectOption(e){e.disabled||(this.variant==="multi-select"?(this.values.indexOf(e.value)>-1?this.values=this.values.filter(i=>i!==e.value):this.values=[...this.values,e.value],this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0}))):this.variant==="single-select"&&this.withRadiobuttons?(this.value=e.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))):(this.value=e.value,this.open=!1,this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))),this._updateOptionsChecked(),this.requestUpdate())}_getSelectedLabel(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("slot");if(!e)return"";const t=e.assignedElements({flatten:!0}).filter(r=>r.tagName.toLowerCase()==="scb-select-option");if(this.variant==="multi-select"){const r=t.filter(s=>this.values.includes(s.value));return r&&r.length>0?r.map(s=>s.label).join(", "):""}else{const r=t.find(s=>s.value===this.value);return r?r.label:""}}firstUpdated(){this._updateOptionsChecked(),this._internals&&this._internals.setFormValue(this.value)}updated(){this._updateOptionsChecked(),this._internals&&this._internals.setFormValue(this.value)}_updateOptionsChecked(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("slot");if(!e)return;e.assignedElements({flatten:!0}).filter(r=>r.tagName.toLowerCase()==="scb-select-option").forEach(r=>{this.variant==="multi-select"?(r.showCheckbox=!0,r.checked=this.values.includes(r.value),r.showRadio=!1):(r.showCheckbox=!1,r.checked=this.value===r.value,this.withRadiobuttons&&(r.showRadio=!0))})}render(){return c`
|
|
7011
|
+
md-icon.radio-checked{
|
|
7012
|
+
color: var(--md-sys-color-primary);
|
|
7013
|
+
}
|
|
7014
|
+
`,St([l({type:String})],a.ScbSelectOption.prototype,"value",2),St([l({type:Boolean,reflect:!0})],a.ScbSelectOption.prototype,"disabled",2),St([l({type:Boolean})],a.ScbSelectOption.prototype,"showCheckbox",2),St([l({type:Boolean})],a.ScbSelectOption.prototype,"checked",2),St([l({type:Boolean})],a.ScbSelectOption.prototype,"showRadio",2),St([l({type:String})],a.ScbSelectOption.prototype,"label",2),a.ScbSelectOption=St([g("scb-select-option")],a.ScbSelectOption);var qh=Object.defineProperty,Uh=Object.getOwnPropertyDescriptor,xe=(o,e,t,i)=>{for(var r=i>1?void 0:i?Uh(e,t):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&qh(e,t,r),r};a.ScbSelect=class extends y{constructor(){super(),this._internals=null,this.focusedIndex=-1,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.withRadiobuttons=!1,this._onDocumentClick=e=>{if(!this.open)return;e.composedPath().includes(this)||(this.open=!1,this.removeAttribute("open"))},this._onSlotClick=e=>{var n;const t=(n=this.shadowRoot)==null?void 0:n.querySelector("slot");if(!t)return;const i=t.assignedElements({flatten:!0}).filter(h=>h.tagName.toLowerCase()==="scb-select-option"),r=e.composedPath(),s=i.find(h=>r.includes(h));s&&(this._selectOption(s),e.stopPropagation())},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._toggleOpen())},this._onOptionKeyDown=e=>{var t;if(e.key==="Enter"||e.key===" "){e.preventDefault();const i=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");if(!i)return;const r=i.assignedElements({flatten:!0}).filter(h=>h.tagName.toLowerCase()==="scb-select-option"),s=e.composedPath(),n=r.find(h=>s.includes(h));n&&this._selectOption(n)}},"attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentClick)}disconnectedCallback(){document.removeEventListener("mousedown",this._onDocumentClick),super.disconnectedCallback()}_toggleOpen(){this.disabled||(this.open=!this.open,this.open?(this.focusedIndex=0,this.requestUpdate()):this.focusedIndex=-1)}_selectOption(e){e.disabled||(this.variant==="multi-select"?(this.values.indexOf(e.value)>-1?this.values=this.values.filter(i=>i!==e.value):this.values=[...this.values,e.value],this.value=this.values.join(","),this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0}))):this.variant==="single-select"&&this.withRadiobuttons?(this.value=e.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))):(this.value=e.value,this.open=!1,this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))),this._updateOptionsChecked(),this.requestUpdate())}_getSelectedLabel(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("slot");if(!e)return"";const t=e.assignedElements({flatten:!0}).filter(r=>r.tagName.toLowerCase()==="scb-select-option");if(this.variant==="multi-select"){const r=t.filter(s=>this.values.includes(s.value));return r&&r.length>0?r.map(s=>s.label).join(", "):""}else{const r=t.find(s=>s.value===this.value);return r?r.label:""}}firstUpdated(){this._updateOptionsChecked(),this._internals&&this._internals.setFormValue(this.value)}updated(){this._updateOptionsChecked(),this._internals&&this._internals.setFormValue(this.value)}_updateOptionsChecked(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("slot");if(!e)return;e.assignedElements({flatten:!0}).filter(r=>r.tagName.toLowerCase()==="scb-select-option").forEach(r=>{this.variant==="multi-select"?(r.showCheckbox=!0,r.checked=this.values.includes(r.value),r.showRadio=!1):(r.showCheckbox=!1,r.checked=this.value===r.value,this.withRadiobuttons&&(r.showRadio=!0))})}render(){return c`
|
|
7015
7015
|
${this.label||this.supportingText?c`
|
|
7016
7016
|
<label class="select-label" id="scb-select-label-${this.name}">
|
|
7017
7017
|
${this.label?c`
|
|
@@ -7139,17 +7139,17 @@ ${this.value}</textarea
|
|
|
7139
7139
|
.options::-webkit-scrollbar {
|
|
7140
7140
|
width: 12px;
|
|
7141
7141
|
background: var(--md-sys-color-surface);
|
|
7142
|
-
border-radius:
|
|
7142
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
7143
7143
|
}
|
|
7144
7144
|
.options::-webkit-scrollbar-thumb {
|
|
7145
7145
|
background: var(--md-sys-color-outline);
|
|
7146
|
-
border-radius:
|
|
7146
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
7147
7147
|
border: 4px solid var(--md-sys-color-surface);
|
|
7148
7148
|
|
|
7149
7149
|
}
|
|
7150
7150
|
.options::-webkit-scrollbar-track {
|
|
7151
7151
|
background: var(--md-sys-color-surface);
|
|
7152
|
-
border-radius:
|
|
7152
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
7153
7153
|
}
|
|
7154
7154
|
:host([open]) .options {
|
|
7155
7155
|
max-height: 240px;
|