@m3e/option 1.0.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +591 -428
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +7 -200
- package/dist/index.min.js.map +1 -1
- package/dist/src/OptionPanelElement.d.ts.map +1 -1
- package/package.json +2 -16
package/dist/index.min.js
CHANGED
|
@@ -3,231 +3,38 @@
|
|
|
3
3
|
* Copyright (c) 2025 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import{LitElement as t,html as e,css as o,unsafeCSS as i}from"lit";import{Selected as s,Disabled as r,Role as
|
|
6
|
+
import{LitElement as t,html as e,css as o,unsafeCSS as i}from"lit";import{Selected as s,Disabled as r,Role as n,DesignToken as a,getTextContent as l,ScrollController as c}from"@m3e/core";import{typeaheadLabel as h,removeAriaReferencedId as d,addAriaReferencedId as p}from"@m3e/core/a11y";import{positionAnchor as u}from"@m3e/core/anchoring";import{M3eDirectionality as f}from"@m3e/core/bidi";function m(t,e,o,i){var s,r=arguments.length,n=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,o,n):s(e,o))||n);return r>3&&n&&Object.defineProperty(e,o,n),n}function g(t,e,o,i){if("a"===o&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?i:"a"===o?i.call(t):i?i.value:e.get(t)}function v(t,e,o,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(t,o):s?s.value=o:e.set(t,o),o}"function"==typeof SuppressedError&&SuppressedError;
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const b=t=>(e,o)=>{void 0!==o?o.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},y=globalThis,w=y.ShadowRoot&&(void 0===y.ShadyCSS||y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$=Symbol(),E=new WeakMap;
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2019 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/let
|
|
17
|
+
*/let S=class{constructor(t,e,o){if(this._$cssResult$=!0,o!==$)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(w&&void 0===t){const o=void 0!==e&&1===e.length;o&&(t=E.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&E.set(e,t))}return t}toString(){return this.cssText}};const _=(t,e)=>{if(w)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const o of e){const e=document.createElement("style"),i=y.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=o.cssText,t.appendChild(e)}},P=w?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const o of t.cssRules)e+=o.cssText;return(t=>new S("string"==typeof t?t:t+"",void 0,$))(e)})(t):t,{is:x,defineProperty:k,getOwnPropertyDescriptor:C,getOwnPropertyNames:U,getOwnPropertySymbols:M,getPrototypeOf:O}=Object,A=globalThis,R=A.trustedTypes,T=R?R.emptyScript:"",z=A.reactiveElementPolyfillSupport,L=(t,e)=>t,W={toAttribute(t,e){switch(e){case Boolean:t=t?T:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let o=t;switch(e){case Boolean:o=null!==t;break;case Number:o=null===t?null:Number(t);break;case Object:case Array:try{o=JSON.parse(t)}catch(t){o=null}}return o}},j=(t,e)=>!x(t,e),q={attribute:!0,type:String,converter:W,reflect:!1,useDefault:!1,hasChanged:j};
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/Symbol.metadata??=Symbol("metadata"),
|
|
22
|
+
*/Symbol.metadata??=Symbol("metadata"),A.litPropertyMetadata??=new WeakMap;class D extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=q){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const o=Symbol(),i=this.getPropertyDescriptor(t,o,e);void 0!==i&&k(this.prototype,t,i)}}static getPropertyDescriptor(t,e,o){const{get:i,set:s}=C(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const r=i?.call(this);s?.call(this,e),this.requestUpdate(t,r,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??q}static _$Ei(){if(this.hasOwnProperty(L("elementProperties")))return;const t=O(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(L("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(L("properties"))){const t=this.properties,e=[...U(t),...M(t)];for(const o of e)this.createProperty(o,t[o])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,o]of e)this.elementProperties.set(t,o)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const o=this._$Eu(t,e);void 0!==o&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const o=new Set(t.flat(1/0).reverse());for(const t of o)e.unshift(P(t))}else void 0!==t&&e.push(P(t));return e}static _$Eu(t,e){const o=e.attribute;return!1===o?void 0:"string"==typeof o?o:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const o of e.keys())this.hasOwnProperty(o)&&(t.set(o,this[o]),delete this[o]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,o){this._$AK(t,o)}_$ET(t,e){const o=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,o);if(void 0!==i&&!0===o.reflect){const s=(void 0!==o.converter?.toAttribute?o.converter:W).toAttribute(e,o.type);this._$Em=t,null==s?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(t,e){const o=this.constructor,i=o._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=o.getPropertyOptions(i),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:W;this._$Em=i;const r=s.fromAttribute(e,t.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(t,e,o){if(void 0!==t){const i=this.constructor,s=this[t];if(o??=i.getPropertyOptions(t),!((o.hasChanged??j)(s,e)||o.useDefault&&o.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,o))))return;this.C(t,e,o)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:o,reflect:i,wrapped:s},r){o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==s||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||o||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,o]of t){const{wrapped:t}=o,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,o,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}D.elementStyles=[],D.shadowRootOptions={mode:"open"},D[L("elementProperties")]=new Map,D[L("finalized")]=new Map,z?.({ReactiveElement:D}),(A.reactiveElementVersions??=[]).push("2.1.1");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
28
|
+
const N={attribute:!0,type:String,converter:W,reflect:!1,hasChanged:j},I=(t=N,e,o)=>{const{kind:i,metadata:s}=o;let r=globalThis.litPropertyMetadata.get(s);if(void 0===r&&globalThis.litPropertyMetadata.set(s,r=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),r.set(o.name,t),"accessor"===i){const{name:i}=o;return{set(o){const s=e.get.call(this);e.set.call(this,o),this.requestUpdate(i,s,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=o;return function(o){const s=this[i];e.call(this,o),this.requestUpdate(i,s,t)}}throw Error("Unsupported decorator location: "+i)};
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
33
|
*/
|
|
34
|
-
function
|
|
35
|
-
<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer>
|
|
36
|
-
<m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring>
|
|
37
|
-
<m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple>
|
|
38
|
-
<div class="touch" aria-hidden="true"></div>
|
|
39
|
-
<div class="wrapper">
|
|
40
|
-
<m3e-pseudo-checkbox class="leading-icon" ?checked="${this.selected}" ?disabled="${this.disabled}">
|
|
41
|
-
</m3e-pseudo-checkbox>
|
|
42
|
-
<m3e-text-overflow class="label"><slot @slotchange="${m(this,B,"m",J)}"></slot></m3e-text-overflow>
|
|
43
|
-
<div class="trailing-icon">
|
|
44
|
-
<svg class="check" viewBox="0 -960 960 960" aria-hidden="true">
|
|
45
|
-
<path fill="currentColor" d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
|
|
46
|
-
</svg>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>`}};var F,G,V,Z,Q;J=function(t){g(this,Y,l(t.target),"f"),this.classList.toggle("-empty",this.isEmpty)},K.styles=o`
|
|
50
|
-
:host {
|
|
51
|
-
display: block;
|
|
52
|
-
outline: none;
|
|
53
|
-
user-select: none;
|
|
54
|
-
flex: none;
|
|
55
|
-
height: var(--m3e-option-container-height, 3rem);
|
|
56
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
57
|
-
}
|
|
58
|
-
:host(:not([aria-disabled="true"])) .base {
|
|
59
|
-
color: var(--m3e-option-color, ${n.color.onSurface});
|
|
60
|
-
--m3e-state-layer-hover-color: var(--m3e-option-container-hover-color, ${n.color.onSurface});
|
|
61
|
-
--m3e-state-layer-focus-color: var(--m3e-option-container-focus-color, ${n.color.onSurface});
|
|
62
|
-
--m3e-ripple-color: var(--m3e-option-ripple-color, ${n.color.onSurface});
|
|
63
|
-
}
|
|
64
|
-
:host(:not([aria-disabled="true"]):not(.-empty)[selected]) .base {
|
|
65
|
-
color: var(--m3e-option-selected-color, ${n.color.onSecondaryContainer});
|
|
66
|
-
background-color: var(--m3e-option-selected-container-color, ${n.color.secondaryContainer});
|
|
67
|
-
--m3e-state-layer-hover-color: var(
|
|
68
|
-
--m3e-option-selected-container-hover-color,
|
|
69
|
-
${n.color.onSecondaryContainer}
|
|
70
|
-
);
|
|
71
|
-
--m3e-state-layer-focus-color: var(
|
|
72
|
-
--m3e-option-selected-container-focus-color,
|
|
73
|
-
${n.color.onSecondaryContainer}
|
|
74
|
-
);
|
|
75
|
-
--m3e-ripple-color: var(--m3e-option-selected-ripple-color, ${n.color.onSecondaryContainer});
|
|
76
|
-
}
|
|
77
|
-
:host(:not([aria-disabled="true"])) {
|
|
78
|
-
cursor: pointer;
|
|
79
|
-
}
|
|
80
|
-
:host([aria-disabled="true"]) .base {
|
|
81
|
-
color: color-mix(
|
|
82
|
-
in srgb,
|
|
83
|
-
var(--m3e-option-disabled-color, ${n.color.onSurface}) var(--m3e-option-disabled-opacity, 38%),
|
|
84
|
-
transparent
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
.base {
|
|
88
|
-
box-sizing: border-box;
|
|
89
|
-
vertical-align: middle;
|
|
90
|
-
display: inline-flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
position: relative;
|
|
93
|
-
width: 100%;
|
|
94
|
-
height: 100%;
|
|
95
|
-
}
|
|
96
|
-
.touch {
|
|
97
|
-
position: absolute;
|
|
98
|
-
height: 3rem;
|
|
99
|
-
left: 0;
|
|
100
|
-
right: 0;
|
|
101
|
-
}
|
|
102
|
-
.wrapper {
|
|
103
|
-
display: inline-flex;
|
|
104
|
-
align-items: center;
|
|
105
|
-
width: 100%;
|
|
106
|
-
column-gap: var(--m3e-option-icon-label-space, 0.75rem);
|
|
107
|
-
padding-inline-start: var(--_option-padding-start, var(--m3e-option-padding-start, 0.75rem));
|
|
108
|
-
padding-inline-end: var(--m3e-option-padding-end, 0.75rem);
|
|
109
|
-
font-size: var(--m3e-option-label-text-font-size, ${n.typescale.standard.label.large.fontSize});
|
|
110
|
-
font-weight: var(--m3e-option-label-text-font-weight, ${n.typescale.standard.label.large.fontWeight});
|
|
111
|
-
line-height: var(--m3e-option-label-text-line-height, ${n.typescale.standard.label.large.lineHeight});
|
|
112
|
-
letter-spacing: var(--m3e-option-label-text-tracking, ${n.typescale.standard.label.large.tracking});
|
|
113
|
-
}
|
|
114
|
-
.focus-ring {
|
|
115
|
-
border-radius: var(--m3e-option-focus-ring-shape, ${n.shape.corner.medium});
|
|
116
|
-
}
|
|
117
|
-
.content {
|
|
118
|
-
flex: 1 1 auto;
|
|
119
|
-
overflow: hidden;
|
|
120
|
-
text-overflow: ellipsis;
|
|
121
|
-
white-space: nowrap;
|
|
122
|
-
}
|
|
123
|
-
::slotted([slot="icon"]),
|
|
124
|
-
::slotted([slot="trailing-icon"]),
|
|
125
|
-
.trailing-icon {
|
|
126
|
-
flex: none;
|
|
127
|
-
width: 1em;
|
|
128
|
-
font-size: var(--m3e-option-icon-size, 1.5rem) !important;
|
|
129
|
-
}
|
|
130
|
-
:host(.-empty) .leading-icon,
|
|
131
|
-
:host(.-empty) .trailing-icon,
|
|
132
|
-
:host(:not(.-multi):not([selected])) .trailing-icon,
|
|
133
|
-
:host(.-multi) .trailing-icon,
|
|
134
|
-
:host(:not(.-multi)) .leading-icon,
|
|
135
|
-
:host(.-hide-selection-indicator) .leading-icon,
|
|
136
|
-
:host(.-hide-selection-indicator) .trailing-icon {
|
|
137
|
-
display: none;
|
|
138
|
-
}
|
|
139
|
-
@media (forced-colors: active) {
|
|
140
|
-
.base {
|
|
141
|
-
background-color: Menu;
|
|
142
|
-
color: MenuText;
|
|
143
|
-
}
|
|
144
|
-
:host([aria-disabled="true"]) .base {
|
|
145
|
-
color: GrayText;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
`,f([I(".focus-ring")],K.prototype,"focusRing",void 0),f([I(".state-layer")],K.prototype,"stateLayer",void 0),f([I(".ripple")],K.prototype,"_ripple",void 0),f([function(t){return(e,o)=>"object"==typeof o?N(t,e,o):((t,e,o)=>{const i=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),i?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
|
34
|
+
function B(t,e){return(e,o,i)=>((t,e,o)=>(o.configurable=!0,o.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,o),o))(e,o,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}var H,Y,J,K;let F=class extends(s(r(n(t,"option")))){constructor(){super(...arguments),H.add(this),Y.set(this,void 0),J.set(this,"")}get value(){return g(this,Y,"f")??g(this,J,"f")}set value(t){v(this,Y,t,"f")}[(Y=new WeakMap,J=new WeakMap,H=new WeakSet,h)](){return g(this,J,"f")}get isEmpty(){return""===this.value}connectedCallback(){super.connectedCallback(),[this.focusRing,this.stateLayer,this._ripple].forEach(t=>t?.attach(this))}firstUpdated(t){super.firstUpdated(t),[this.focusRing,this.stateLayer,this._ripple].forEach(t=>t?.attach(this))}update(t){if(super.update(t),t.has("selected")&&this.selected){const t=this.closest("[role='listbox']")??this.closest("m3e-select");t&&"true"!==t.ariaMultiSelectable&&!t.hasAttribute("multi")&&t.querySelectorAll("m3e-option").forEach(t=>{t!==this&&t.selected&&(t.selected=!1)})}}render(){return e`<div class="base"><m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple><div class="touch" aria-hidden="true"></div><div class="wrapper"><m3e-pseudo-checkbox class="leading-icon" ?checked="${this.selected}" ?disabled="${this.disabled}"></m3e-pseudo-checkbox><m3e-text-overflow class="label"><slot @slotchange="${g(this,H,"m",K)}"></slot></m3e-text-overflow><div class="trailing-icon"><svg class="check" viewBox="0 -960 960 960" aria-hidden="true"><path fill="currentColor" d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg></div></div></div>`}};var G,V,Z,Q,X;K=function(t){v(this,J,l(t.target),"f"),this.classList.toggle("-empty",this.isEmpty)},F.styles=o`:host { display: block; outline: none; user-select: none; flex: none; height: var(--m3e-option-container-height, 3rem); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not([aria-disabled="true"])) .base { color: var(--m3e-option-color, ${a.color.onSurface}); --m3e-state-layer-hover-color: var(--m3e-option-container-hover-color, ${a.color.onSurface}); --m3e-state-layer-focus-color: var(--m3e-option-container-focus-color, ${a.color.onSurface}); --m3e-ripple-color: var(--m3e-option-ripple-color, ${a.color.onSurface}); } :host(:not([aria-disabled="true"]):not(.-empty)[selected]) .base { color: var(--m3e-option-selected-color, ${a.color.onSecondaryContainer}); background-color: var(--m3e-option-selected-container-color, ${a.color.secondaryContainer}); --m3e-state-layer-hover-color: var( --m3e-option-selected-container-hover-color, ${a.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-option-selected-container-focus-color, ${a.color.onSecondaryContainer} ); --m3e-ripple-color: var(--m3e-option-selected-ripple-color, ${a.color.onSecondaryContainer}); } :host(:not([aria-disabled="true"])) { cursor: pointer; } :host([aria-disabled="true"]) .base { color: color-mix( in srgb, var(--m3e-option-disabled-color, ${a.color.onSurface}) var(--m3e-option-disabled-opacity, 38%), transparent ); } .base { box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; position: relative; width: 100%; height: 100%; } .touch { position: absolute; height: 3rem; left: 0; right: 0; } .wrapper { display: inline-flex; align-items: center; width: 100%; column-gap: var(--m3e-option-icon-label-space, 0.75rem); padding-inline-start: var(--_option-padding-start, var(--m3e-option-padding-start, 0.75rem)); padding-inline-end: var(--m3e-option-padding-end, 0.75rem); font-size: var(--m3e-option-label-text-font-size, ${a.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-option-label-text-font-weight, ${a.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-option-label-text-line-height, ${a.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-option-label-text-tracking, ${a.typescale.standard.label.large.tracking}); } .focus-ring { border-radius: var(--m3e-option-focus-ring-shape, ${a.shape.corner.medium}); } .content { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } ::slotted([slot="icon"]), ::slotted([slot="trailing-icon"]), .trailing-icon { flex: none; width: 1em; font-size: var(--m3e-option-icon-size, 1.5rem) !important; } :host(.-empty) .leading-icon, :host(.-empty) .trailing-icon, :host(:not(.-multi):not([selected])) .trailing-icon, :host(.-multi) .trailing-icon, :host(:not(.-multi)) .leading-icon, :host(.-hide-selection-indicator) .leading-icon, :host(.-hide-selection-indicator) .trailing-icon { display: none; } @media (forced-colors: active) { .base { background-color: Menu; color: MenuText; } :host([aria-disabled="true"]) .base { color: GrayText; } }`,m([B(".focus-ring")],F.prototype,"focusRing",void 0),m([B(".state-layer")],F.prototype,"stateLayer",void 0),m([B(".ripple")],F.prototype,"_ripple",void 0),m([function(t){return(e,o)=>"object"==typeof o?I(t,e,o):((t,e,o)=>{const i=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),i?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
|
149
35
|
/**
|
|
150
36
|
* @license
|
|
151
37
|
* Copyright 2017 Google LLC
|
|
152
38
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
153
|
-
*/()],
|
|
154
|
-
<slot name="label" @slotchange="${m(this,F,"m",Z)}"></slot>
|
|
155
|
-
</m3e-text-overflow>
|
|
156
|
-
<slot></slot>`}};var tt,et,ot,it,st,rt,at,nt,lt;G=new WeakMap,V=new WeakMap,F=new WeakSet,Z=function(t){const e=t.target.assignedElements({flatten:!0})[0]??void 0;e!==m(this,V,"f")&&(m(this,V,"f")?.id&&(d(this,"aria-labelledby",m(this,V,"f").id),m(this,V,"f").id===m(this,G,"f")&&(m(this,V,"f").id="")),g(this,V,e,"f"),m(this,V,"f")&&(m(this,V,"f").id=m(this,V,"f").id||m(this,G,"f"),p(this,"aria-labelledby",m(this,V,"f").id)))},X.styles=o`
|
|
157
|
-
:host {
|
|
158
|
-
display: block;
|
|
159
|
-
--_option-padding-start: calc(var(--m3e-option-padding-start, 0.75rem) * 2);
|
|
160
|
-
}
|
|
161
|
-
.label {
|
|
162
|
-
height: var(--m3e-option-height, 3rem);
|
|
163
|
-
font-size: var(--m3e-option-font-size, ${n.typescale.standard.label.large.fontSize});
|
|
164
|
-
font-weight: var(--m3e-option-font-weight, ${n.typescale.standard.label.large.fontWeight});
|
|
165
|
-
line-height: var(--m3e-option-line-height, ${n.typescale.standard.label.large.lineHeight});
|
|
166
|
-
letter-spacing: var(--m3e-option-tracking, ${n.typescale.standard.label.large.tracking});
|
|
167
|
-
padding-inline-end: var(--m3e-option-padding-end, 0.75rem);
|
|
168
|
-
padding-inline-start: var(--m3e-option-padding-start, 0.75rem);
|
|
169
|
-
color: var(--m3e-option-color, ${n.color.onSurface});
|
|
170
|
-
flex: none;
|
|
171
|
-
}
|
|
172
|
-
`,X.__nextId=0,X=Q=f([v("m3e-optgroup")],X);let ct=lt=class extends(a(t,"listbox")){constructor(){super(...arguments),tt.add(this),et.set(this,void 0),ot.set(this,void 0),it.set(this,void 0),st.set(this,t=>m(this,tt,"m",nt).call(this,t)),rt.set(this,new c(this,{target:null,callback:()=>this.hide(!1)})),at.set(this,t=>{"closed"===t.newState&&(m(this,it,"f")?.call(this),g(this,it,void 0,"f"))})}get isOpen(){return void 0!==m(this,et,"f")}connectedCallback(){super.connectedCallback(),this.classList.add("-no-animate"),this.setAttribute("popover","manual"),this.addEventListener("toggle",m(this,at,"f")),document.addEventListener("click",m(this,st,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("toggle",m(this,at,"f")),document.removeEventListener("click",m(this,st,"f"))}async show(t,e){m(this,et,"f")&&m(this,et,"f")!==t&&this.hide(),g(this,it,await u(this,e??t,{position:"bottom-start",inline:!0,flip:!0,shift:!0},(t,e,o)=>{this.classList.toggle("-top",o.includes("top")),this.classList.toggle("-bottom",o.includes("bottom")),this.style.left=`${t}px`,this.style.top=`${e}px`}),"f"),this.showPopover(),g(this,et,t,"f"),m(this,et,"f").ariaExpanded="true",g(this,ot,e,"f"),m(this,rt,"f").observe(m(this,et,"f"))}hide(t=!1){this.hidePopover(),m(this,et,"f")&&(m(this,et,"f").ariaExpanded="false",t&&m(this,et,"f").focus(),m(this,rt,"f").unobserve(m(this,et,"f")),g(this,et,void 0,"f"))}async toggle(t,e){m(this,et,"f")?this.hide():await this.show(t,e)}render(){return e`<slot></slot>`}firstUpdated(t){super.firstUpdated(t),requestAnimationFrame(()=>this.classList.remove("-no-animate"))}};et=new WeakMap,ot=new WeakMap,it=new WeakMap,st=new WeakMap,rt=new WeakMap,at=new WeakMap,tt=new WeakSet,nt=function(t){t.composedPath().some(t=>t instanceof lt||t===m(this,et,"f")||t===m(this,ot,"f"))||this.hide()},ct.styles=o`
|
|
173
|
-
:host {
|
|
174
|
-
position: absolute;
|
|
175
|
-
flex-direction: column;
|
|
176
|
-
padding: unset;
|
|
177
|
-
margin: unset;
|
|
178
|
-
border: unset;
|
|
179
|
-
overflow-y: auto;
|
|
180
|
-
scrollbar-width: ${n.scrollbar.thinWidth};
|
|
181
|
-
scrollbar-color: ${n.scrollbar.color};
|
|
182
|
-
border-radius: var(--m3e-option-panel-container-shape, ${n.shape.corner.extraSmall});
|
|
183
|
-
min-width: var(--m3e-option-panel-container-min-width, 7rem);
|
|
184
|
-
max-width: var(--m3e-option-panel-container-max-width, 17.5rem);
|
|
185
|
-
max-height: var(--m3e-option-panel-container-max-height, 17.5rem);
|
|
186
|
-
padding-block: var(--m3e-option-panel-container-padding-block, 0.5rem);
|
|
187
|
-
background-color: var(--m3e-option-panel-container-color, ${n.color.surfaceContainer});
|
|
188
|
-
box-shadow: var(--m3e-option-panel-container-elevation, ${n.elevation.level3});
|
|
189
|
-
opacity: 0;
|
|
190
|
-
display: none;
|
|
191
|
-
}
|
|
192
|
-
:host(:not(.-no-animate)) {
|
|
193
|
-
transition: ${i(`opacity ${n.motion.duration.short2} ${n.motion.easing.standard}, \n transform ${n.motion.duration.short2} ${n.motion.easing.standard},\n overlay ${n.motion.duration.short2} ${n.motion.easing.standard} allow-discrete,\n display ${n.motion.duration.short2} ${n.motion.easing.standard} allow-discrete`)};
|
|
194
|
-
}
|
|
195
|
-
:host {
|
|
196
|
-
transform: scaleY(0.8);
|
|
197
|
-
}
|
|
198
|
-
:host(:popover-open) {
|
|
199
|
-
transform: scaleY(1);
|
|
200
|
-
display: inline-flex;
|
|
201
|
-
opacity: 1;
|
|
202
|
-
}
|
|
203
|
-
:host::backdrop {
|
|
204
|
-
background-color: transparent;
|
|
205
|
-
}
|
|
206
|
-
:host(.-bottom) {
|
|
207
|
-
transform-origin: top;
|
|
208
|
-
}
|
|
209
|
-
:host(.-top) {
|
|
210
|
-
transform-origin: bottom;
|
|
211
|
-
}
|
|
212
|
-
::slotted(m3e-divider) {
|
|
213
|
-
margin-block: var(--m3e-option-panel-divider-spacing, 0.5rem);
|
|
214
|
-
}
|
|
215
|
-
@starting-style {
|
|
216
|
-
:host(:popover-open) {
|
|
217
|
-
transform: scaleY(0.8);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
@media (prefers-reduced-motion) {
|
|
221
|
-
:host(:not(.-no-animate)) {
|
|
222
|
-
transition: none;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
@media (forced-colors: active) {
|
|
226
|
-
:host {
|
|
227
|
-
background-color: Menu;
|
|
228
|
-
color: MenuText;
|
|
229
|
-
border: 1px solid CanvasText;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
`,ct=lt=f([v("m3e-option-panel")],ct);export{X as M3eOptGroupElement,K as M3eOptionElement,ct as M3eOptionPanelElement};
|
|
39
|
+
*/()],F.prototype,"value",null),F=m([b("m3e-option")],F);let tt=X=class extends(n(t,"group")){constructor(){super(...arguments),G.add(this),V.set(this,"m3e-optgroup-label-"+X.__nextId++),Z.set(this,void 0)}render(){return e`<m3e-text-overflow class="label"><slot name="label" @slotchange="${g(this,G,"m",Q)}"></slot></m3e-text-overflow><slot></slot>`}};var et,ot,it,st,rt,nt,at,lt,ct;V=new WeakMap,Z=new WeakMap,G=new WeakSet,Q=function(t){const e=t.target.assignedElements({flatten:!0})[0]??void 0;e!==g(this,Z,"f")&&(g(this,Z,"f")?.id&&(d(this,"aria-labelledby",g(this,Z,"f").id),g(this,Z,"f").id===g(this,V,"f")&&(g(this,Z,"f").id="")),v(this,Z,e,"f"),g(this,Z,"f")&&(g(this,Z,"f").id=g(this,Z,"f").id||g(this,V,"f"),p(this,"aria-labelledby",g(this,Z,"f").id)))},tt.styles=o`:host { display: block; --_option-padding-start: calc(var(--m3e-option-padding-start, 0.75rem) * 2); } .label { height: var(--m3e-option-height, 3rem); font-size: var(--m3e-option-font-size, ${a.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-option-font-weight, ${a.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-option-line-height, ${a.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-option-tracking, ${a.typescale.standard.label.large.tracking}); padding-inline-end: var(--m3e-option-padding-end, 0.75rem); padding-inline-start: var(--m3e-option-padding-start, 0.75rem); color: var(--m3e-option-color, ${a.color.onSurface}); flex: none; }`,tt.__nextId=0,tt=X=m([b("m3e-optgroup")],tt);let ht=ct=class extends(n(t,"listbox")){constructor(){super(...arguments),et.add(this),ot.set(this,void 0),it.set(this,void 0),st.set(this,void 0),rt.set(this,t=>g(this,et,"m",lt).call(this,t)),nt.set(this,new c(this,{target:null,callback:()=>this.hide(!1)})),at.set(this,t=>{"closed"===t.newState&&(g(this,st,"f")?.call(this),v(this,st,void 0,"f"))})}get isOpen(){return void 0!==g(this,ot,"f")}connectedCallback(){super.connectedCallback(),this.classList.add("-no-animate"),this.setAttribute("popover","manual"),this.addEventListener("toggle",g(this,at,"f")),document.addEventListener("click",g(this,rt,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("toggle",g(this,at,"f")),document.removeEventListener("click",g(this,rt,"f"))}async show(t,e){g(this,ot,"f")&&g(this,ot,"f")!==t&&this.hide(),v(this,st,await u(this,e??t,{position:"bottom-start",inline:!0,flip:!0},(t,e,o)=>{this.classList.toggle("-top",o.includes("top")),this.classList.toggle("-bottom",o.includes("bottom")),"rtl"===f.current?(this.style.right=window.innerWidth-t-this.clientWidth+"px",this.style.left=""):(this.style.left=`${t}px`,this.style.right=""),this.style.top=`${e}px`}),"f"),this.showPopover(),v(this,ot,t,"f"),g(this,ot,"f").ariaExpanded="true",v(this,it,e,"f"),g(this,nt,"f").observe(g(this,ot,"f"))}hide(t=!1){this.hidePopover(),g(this,ot,"f")&&(g(this,ot,"f").ariaExpanded="false",t&&g(this,ot,"f").focus(),g(this,nt,"f").unobserve(g(this,ot,"f")),v(this,ot,void 0,"f"))}async toggle(t,e){g(this,ot,"f")?this.hide():await this.show(t,e)}render(){return e`<slot></slot>`}firstUpdated(t){super.firstUpdated(t),requestAnimationFrame(()=>this.classList.remove("-no-animate"))}};ot=new WeakMap,it=new WeakMap,st=new WeakMap,rt=new WeakMap,nt=new WeakMap,at=new WeakMap,et=new WeakSet,lt=function(t){t.composedPath().some(t=>t instanceof ct||t===g(this,ot,"f")||t===g(this,it,"f"))||this.hide()},ht.styles=o`:host { position: absolute; flex-direction: column; padding: unset; margin: unset; border: unset; overflow-y: auto; scrollbar-width: ${a.scrollbar.thinWidth}; scrollbar-color: ${a.scrollbar.color}; border-radius: var(--m3e-option-panel-container-shape, ${a.shape.corner.extraSmall}); min-width: var(--m3e-option-panel-container-min-width, 7rem); max-width: var(--m3e-option-panel-container-max-width, 17.5rem); max-height: var(--m3e-option-panel-container-max-height, 17.5rem); padding-block: var(--m3e-option-panel-container-padding-block, 0.5rem); background-color: var(--m3e-option-panel-container-color, ${a.color.surfaceContainer}); box-shadow: var(--m3e-option-panel-container-elevation, ${a.elevation.level3}); opacity: 0; display: none; } :host(:not(.-no-animate)) { transition: ${i(`opacity ${a.motion.duration.short2} ${a.motion.easing.standard}, \n transform ${a.motion.duration.short2} ${a.motion.easing.standard},\n overlay ${a.motion.duration.short2} ${a.motion.easing.standard} allow-discrete,\n display ${a.motion.duration.short2} ${a.motion.easing.standard} allow-discrete`)}; } :host { transform: scaleY(0.8); } :host(:popover-open) { transform: scaleY(1); display: inline-flex; opacity: 1; } :host::backdrop { background-color: transparent; } :host(.-bottom) { transform-origin: top; } :host(.-top) { transform-origin: bottom; } ::slotted(m3e-divider) { margin-block: var(--m3e-option-panel-divider-spacing, 0.5rem); } @starting-style { :host(:popover-open) { transform: scaleY(0.8); } } @media (prefers-reduced-motion) { :host(:not(.-no-animate)) { transition: none; } } @media (forced-colors: active) { :host { background-color: Menu; color: MenuText; border: 1px solid CanvasText; } }`,ht=ct=m([b("m3e-option-panel")],ht);export{tt as M3eOptGroupElement,F as M3eOptionElement,ht as M3eOptionPanelElement};
|
|
233
40
|
//# sourceMappingURL=index.min.js.map
|