@m3e/web 2.0.0 → 2.0.2
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/all.js +1171 -945
- package/dist/all.js.map +1 -1
- package/dist/all.min.js +59 -59
- package/dist/all.min.js.map +1 -1
- package/dist/bottom-sheet.js +11 -5
- package/dist/bottom-sheet.js.map +1 -1
- package/dist/bottom-sheet.min.js +3 -3
- package/dist/bottom-sheet.min.js.map +1 -1
- package/dist/button.js +387 -317
- package/dist/button.js.map +1 -1
- package/dist/button.min.js +2 -2
- package/dist/button.min.js.map +1 -1
- package/dist/card.js +73 -73
- package/dist/card.js.map +1 -1
- package/dist/card.min.js +5 -5
- package/dist/card.min.js.map +1 -1
- package/dist/checkbox.js +5 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/checkbox.min.js +1 -1
- package/dist/checkbox.min.js.map +1 -1
- package/dist/core-a11y.js.map +1 -1
- package/dist/core-a11y.min.js.map +1 -1
- package/dist/core-bidi.js.map +1 -1
- package/dist/core-bidi.min.js.map +1 -1
- package/dist/core-layout.js.map +1 -1
- package/dist/core-layout.min.js.map +1 -1
- package/dist/core-platform.js.map +1 -1
- package/dist/core-platform.min.js.map +1 -1
- package/dist/core.js +42 -32
- package/dist/core.js.map +1 -1
- package/dist/core.min.js +2 -2
- package/dist/core.min.js.map +1 -1
- package/dist/css-custom-data.json +1069 -224
- package/dist/custom-elements.json +1853 -1180
- package/dist/fab.js +299 -258
- package/dist/fab.js.map +1 -1
- package/dist/fab.min.js +6 -6
- package/dist/fab.min.js.map +1 -1
- package/dist/form-field.js +10 -6
- package/dist/form-field.js.map +1 -1
- package/dist/form-field.min.js +4 -4
- package/dist/form-field.min.js.map +1 -1
- package/dist/html-custom-data.json +60 -60
- package/dist/icon-button.js +288 -232
- package/dist/icon-button.js.map +1 -1
- package/dist/icon-button.min.js +5 -5
- package/dist/icon-button.min.js.map +1 -1
- package/dist/list.js +18 -3
- package/dist/list.js.map +1 -1
- package/dist/list.min.js +8 -8
- package/dist/list.min.js.map +1 -1
- package/dist/menu.js +23 -12
- package/dist/menu.js.map +1 -1
- package/dist/menu.min.js +7 -7
- package/dist/menu.min.js.map +1 -1
- package/dist/nav-bar.js +1 -1
- package/dist/nav-bar.js.map +1 -1
- package/dist/nav-bar.min.js +1 -1
- package/dist/nav-bar.min.js.map +1 -1
- package/dist/nav-rail.js +1 -1
- package/dist/nav-rail.js.map +1 -1
- package/dist/nav-rail.min.js +4 -4
- package/dist/nav-rail.min.js.map +1 -1
- package/dist/option.js +1 -1
- package/dist/option.js.map +1 -1
- package/dist/option.min.js +1 -1
- package/dist/option.min.js.map +1 -1
- package/dist/radio-group.js +4 -0
- package/dist/radio-group.js.map +1 -1
- package/dist/radio-group.min.js +1 -1
- package/dist/radio-group.min.js.map +1 -1
- package/dist/slider.js +2 -2
- package/dist/slider.js.map +1 -1
- package/dist/slider.min.js +3 -3
- package/dist/slider.min.js.map +1 -1
- package/dist/snackbar.js.map +1 -1
- package/dist/snackbar.min.js.map +1 -1
- package/dist/split-button.js +1 -0
- package/dist/split-button.js.map +1 -1
- package/dist/split-button.min.js +1 -1
- package/dist/split-button.min.js.map +1 -1
- package/dist/src/bottom-sheet/BottomSheetElement.d.ts +2 -0
- package/dist/src/bottom-sheet/BottomSheetElement.d.ts.map +1 -1
- package/dist/src/button/ButtonElement.d.ts +70 -0
- package/dist/src/button/ButtonElement.d.ts.map +1 -1
- package/dist/src/button/styles/ButtonSizeToken.d.ts.map +1 -1
- package/dist/src/button/styles/ButtonVariantToken.d.ts.map +1 -1
- package/dist/src/card/styles/CardVariantToken.d.ts.map +1 -1
- package/dist/src/checkbox/CheckboxElement.d.ts.map +1 -1
- package/dist/src/core/a11y/AriaDescriber.d.ts +3 -1
- package/dist/src/core/a11y/AriaDescriber.d.ts.map +1 -1
- package/dist/src/core/a11y/InteractivityChecker.d.ts +3 -1
- package/dist/src/core/a11y/InteractivityChecker.d.ts.map +1 -1
- package/dist/src/core/a11y/LiveAnnouncer.d.ts +3 -1
- package/dist/src/core/a11y/LiveAnnouncer.d.ts.map +1 -1
- package/dist/src/core/bidi/Directionality.d.ts +3 -1
- package/dist/src/core/bidi/Directionality.d.ts.map +1 -1
- package/dist/src/core/layout/BreakpointObserver.d.ts +3 -1
- package/dist/src/core/layout/BreakpointObserver.d.ts.map +1 -1
- package/dist/src/core/platform/Platform.d.ts +3 -1
- package/dist/src/core/platform/Platform.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/PressedController.d.ts.map +1 -1
- package/dist/src/core/shared/primitives/FocusRingElement.d.ts +2 -0
- package/dist/src/core/shared/primitives/FocusRingElement.d.ts.map +1 -1
- package/dist/src/core/shared/primitives/FocusRingToken.d.ts +4 -0
- package/dist/src/core/shared/primitives/FocusRingToken.d.ts.map +1 -1
- package/dist/src/core/shared/primitives/ScrollContainerElement.d.ts.map +1 -1
- package/dist/src/fab/FabElement.d.ts +41 -0
- package/dist/src/fab/FabElement.d.ts.map +1 -1
- package/dist/src/fab/styles/FabSizeToken.d.ts.map +1 -1
- package/dist/src/fab/styles/FabVariantToken.d.ts.map +1 -1
- package/dist/src/form-field/FormFieldElement.d.ts.map +1 -1
- package/dist/src/icon-button/IconButtonElement.d.ts +56 -0
- package/dist/src/icon-button/IconButtonElement.d.ts.map +1 -1
- package/dist/src/icon-button/styles/IconButtonSizeToken.d.ts.map +1 -1
- package/dist/src/icon-button/styles/IconButtonVariantToken.d.ts.map +1 -1
- package/dist/src/list/ListItemButtonElement.d.ts +1 -0
- package/dist/src/list/ListItemButtonElement.d.ts.map +1 -1
- package/dist/src/list/ListItemElement.d.ts.map +1 -1
- package/dist/src/list/ListOptionElement.d.ts +1 -0
- package/dist/src/list/ListOptionElement.d.ts.map +1 -1
- package/dist/src/menu/MenuElement.d.ts +2 -0
- package/dist/src/menu/MenuElement.d.ts.map +1 -1
- package/dist/src/menu/MenuItemElementBase.d.ts +1 -0
- package/dist/src/menu/MenuItemElementBase.d.ts.map +1 -1
- package/dist/src/nav-rail/NavRailElement.d.ts.map +1 -1
- package/dist/src/option/OptionPanelElement.d.ts.map +1 -1
- package/dist/src/radio-group/RadioElement.d.ts.map +1 -1
- package/dist/src/slider/SliderThumbElement.d.ts.map +1 -1
- package/dist/src/snackbar/Snackbar.d.ts +3 -1
- package/dist/src/snackbar/Snackbar.d.ts.map +1 -1
- package/dist/src/split-button/SplitButtonElement.d.ts.map +1 -1
- package/dist/src/switch/SwitchElement.d.ts.map +1 -1
- package/dist/src/tabs/TabElement.d.ts.map +1 -1
- package/dist/src/tabs/TabsElement.d.ts.map +1 -1
- package/dist/switch.js +5 -1
- package/dist/switch.js.map +1 -1
- package/dist/switch.min.js +2 -2
- package/dist/switch.min.js.map +1 -1
- package/dist/tabs.js +2 -2
- package/dist/tabs.js.map +1 -1
- package/dist/tabs.min.js +3 -3
- package/dist/tabs.min.js.map +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.js.map +1 -1
- package/dist/tooltip.min.js +1 -1
- package/dist/tooltip.min.js.map +1 -1
- package/package.json +1 -1
package/dist/bottom-sheet.min.js
CHANGED
|
@@ -14,16 +14,16 @@ const _=t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)})
|
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2019 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/let C=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==P)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(x&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=M.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&M.set(e,t))}return t}toString(){return this.cssText}};const U=(t,e)=>{if(x)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),s=k.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}},A=x?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new C("string"==typeof t?t:t+"",void 0,P))(e)})(t):t,{is:z,defineProperty:O,getOwnPropertyDescriptor:
|
|
17
|
+
*/let C=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==P)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(x&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=M.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&M.set(e,t))}return t}toString(){return this.cssText}};const U=(t,e)=>{if(x)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),s=k.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}},A=x?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new C("string"==typeof t?t:t+"",void 0,P))(e)})(t):t,{is:z,defineProperty:O,getOwnPropertyDescriptor:L,getOwnPropertyNames:H,getOwnPropertySymbols:R,getPrototypeOf:T}=Object,W=globalThis,j=W.trustedTypes,q=j?j.emptyScript:"",D=W.reactiveElementPolyfillSupport,B=(t,e)=>t,N={toAttribute(t,e){switch(e){case Boolean:t=t?q:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},F=(t,e)=>!z(t,e),Y={attribute:!0,type:String,converter:N,reflect:!1,useDefault:!1,hasChanged:F};
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/Symbol.metadata??=Symbol("metadata"),W.litPropertyMetadata??=new WeakMap;class I 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=Y){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&O(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=
|
|
22
|
+
*/Symbol.metadata??=Symbol("metadata"),W.litPropertyMetadata??=new WeakMap;class I 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=Y){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&O(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=L(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const n=s?.call(this);o?.call(this,e),this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Y}static _$Ei(){if(this.hasOwnProperty(B("elementProperties")))return;const t=T(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){const t=this.properties,e=[...H(t),...R(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(A(t))}else void 0!==t&&e.push(A(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"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 i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return U(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,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:N).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:N;this._$Em=s;const n=o.fromAttribute(e,t.type);this[s]=n??this._$Ej?.get(s)??n,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,o=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??F)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},n){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),!0!==o||void 0!==n)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&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,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}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){}}I.elementStyles=[],I.shadowRootOptions={mode:"open"},I[B("elementProperties")]=new Map,I[B("finalized")]=new Map,D?.({ReactiveElement:I}),(W.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 K={attribute:!0,type:String,converter:N,reflect:!1,hasChanged:F},V=(t=K,e,i)=>{const{kind:s,metadata:o}=i;let n=globalThis.litPropertyMetadata.get(o);if(void 0===n&&globalThis.litPropertyMetadata.set(o,n=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),n.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,o,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];e.call(this,i),this.requestUpdate(s,o,t)}}throw Error("Unsupported decorator location: "+s)};function J(t){return(e,i)=>"object"==typeof i?V(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}let X=class extends t{_onClick(){this.closest("m3e-bottom-sheet")?.hide()}};var G,Q,Z,tt,et,it,st,ot,nt,at,rt,ht,lt,ct,dt,pt,mt,ft,ut,bt,gt,vt,yt,wt,$t,Et,St,_t,kt,xt,Pt,Mt,Ct,Ut,At,zt,Ot,Ht,Lt,Rt;X=$([_("m3e-bottom-sheet-action")],X);let Tt=Rt=class extends(e(p,"opening","opened","cancel","closing","closed")){constructor(){super(...arguments),G.add(this),Q.set(this,t=>E(this,G,"m",gt).call(this,t)),Z.set(this,t=>E(this,G,"m",vt).call(this,t)),tt.set(this,()=>E(this,G,"m",yt).call(this)),et.set(this,new Array),it.set(this,new i),st.set(this,new s(this)),ot.set(this,new o(this,{target:null,skipInitial:!0,callback:t=>E(this,G,"m",Ut).call(this,t)})),nt.set(this,null),at.set(this,void 0),rt.set(this,!1),ht.set(this,0),lt.set(this,void 0),ct.set(this,0),dt.set(this,0),pt.set(this,void 0),this.modal=!1,this.open=!1,this.handle=!1,this.handleLabel="Drag handle",this.detents=[],this.detent=0,this.hideable=!1,this.hideFriction=.5}show(t=this.detent){this.open?void 0!==t&&E(this,ht,"f")!==t&&E(this,G,"m",At).call(this,t):(S(this,lt,t,"f"),this.open=!0)}hide(){this.open=!1}toggle(t){this.open?this.hide():this.show(t)}cycle(){var t;this.open?this.detents.length>0?E(this,ht,"f")<this.detents.length-1?(S(this,ht,(t=E(this,ht,"f"),++t),"f"),E(this,G,"m",At).call(this,E(this,ht,"f"))):this.hideable&&this.hide():this.hide():this.show()}update(t){super.update(t),t.has("modal")&&(this.role=this.modal?"dialog":"region",this.ariaModal=this.modal?"true":null,this.popover=this.modal?"manual":null)}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot?.querySelector(".content");e&&(S(this,ct,e.clientHeight,"f"),E(this,ot,"f").observe(e));const i=this.shadowRoot?.querySelector(".header");i&&(S(this,dt,i.clientHeight,"f"),E(this,ot,"f").observe(i))}updated(t){if(super.updated(t),t.has("open")){if(this.open){if(!this.dispatchEvent(new Event("opening",{cancelable:!0})))return void(this.open=!1);Rt.__openSheet!==this&&Rt.__openSheet?.hide(),Rt.__openSheet=this,this.inert=!1,window.addEventListener("resize",E(this,tt,"f")),this.detents.length>0?(S(this,ht,Math.min(Math.max(0,E(this,lt,"f")??this.detent),this.detents.length-1),"f"),E(this,G,"m",Ot).call(this,E(this,G,"m",kt).call(this,this.detents[E(this,ht,"f")]))):E(this,G,"m",Ot).call(this,Math.min(E(this,G,"m",kt).call(this,"fit"),E(this,G,"m",kt).call(this,"half"))),S(this,lt,void 0,"f")}else{if(!this.dispatchEvent(new Event("closing",{cancelable:!0})))return void(this.open=!0);requestAnimationFrame(()=>this.inert=!0),window.removeEventListener("resize",E(this,tt,"f")),Rt.__openSheet===this&&(Rt.__openSheet=void 0)}if(this.modal)if(this.open){S(this,nt,document.activeElement,"f"),E(this,G,"m",Ht).call(this),E(this,st,"f").lock(),this.showPopover(),requestAnimationFrame(()=>{document.addEventListener("click",E(this,Q,"f")),document.addEventListener("keydown",E(this,Z,"f"))});let t=this.querySelector("[autofocus]");t&&g.isFocusable(t)||(t=this.shadowRoot?.querySelector(".handle")),t&&n(t)}else E(this,G,"m",zt).call(this,0).then(()=>{E(this,G,"m",Lt).call(this),E(this,st,"f").unlock(),document.removeEventListener("click",E(this,Q,"f")),document.removeEventListener("keydown",E(this,Z,"f")),this.hidePopover(),E(this,nt,"f")instanceof HTMLElement&&E(this,nt,"f").focus(),S(this,nt,null,"f")});this.dispatchEvent(new Event(this.open?"opened":"closed"))}}render(){return f`<m3e-focus-trap ?disabled="${!this.modal}"><div class="base"><m3e-elevation class="elevation"></m3e-elevation><div class="header" @pointerdown="${E(this,G,"m",ft)}" @pointermove="${E(this,G,"m",ut)}" @pointerup="${E(this,G,"m",bt)}">${this.handle?f`<div class="handle-row"><div id="handle" class="handle" role="button" aria-label="${this.handleLabel}" tabindex="0" @click="${E(this,G,"m",wt)}" @keydown="${E(this,G,"m",$t)}"><m3e-focus-ring class="focus-ring" for="handle"></m3e-focus-ring><div class="handle-touch" aria-hidden="true"></div></div></div>`:m}<slot name="header" @slotchange="${E(this,G,"m",mt)}"></slot></div><div class="body"><div class="content"><slot></slot></div></div></div></m3e-focus-trap>`}};Q=new WeakMap,Z=new WeakMap,tt=new WeakMap,et=new WeakMap,it=new WeakMap,st=new WeakMap,ot=new WeakMap,nt=new WeakMap,at=new WeakMap,rt=new WeakMap,ht=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,pt=new WeakMap,G=new WeakSet,mt=function(t){this.classList.toggle("-has-header",r(t.target))},ft=function(t){2!==t.button&&(t.target instanceof HTMLElement&&g.isFocusable(t.target)||(t.target.setPointerCapture(t.pointerId),t.target.style.cursor="grabbing",E(this,it,"f").reset(),E(this,it,"f").add(t.clientY),S(this,at,{startY:t.clientY,startHeight:this.clientHeight,maxHeight:E(this,G,"m",xt).call(this),minHeight:E(this,G,"m",Pt).call(this)},"f"),S(this,rt,!1,"f")))},ut=function(t){if(!E(this,at,"f"))return;if(Math.abs(t.clientY-E(this,at,"f").startY)<=8)return;(t.getCoalescedEvents?.()??[t]).forEach(e=>E(this,it,"f").add(e.clientY,t.timeStamp));let e=E(this,at,"f").startHeight-(t.clientY-E(this,at,"f").startY);if(e<E(this,at,"f").minHeight){const t=(E(this,at,"f").minHeight-e)*this.hideFriction;e=E(this,at,"f").minHeight-t}E(this,G,"m",Ot).call(this,Math.min(E(this,at,"f").maxHeight,e)),S(this,rt,!0,"f")},bt=function(t){if(E(this,at,"f"))try{if(t.target.releasePointerCapture(t.pointerId),t.target.style.cursor="",!E(this,rt,"f"))return;const e="touch"===t.pointerType?1200:500,i=E(this,it,"f").getVelocity();if(E(this,it,"f").reset(),this.hideable&&i>=e)this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide();else if(Math.abs(i)>=e)if(this.detents.length>0){const t=E(this,G,"m",Et).call(this);t!==E(this,ht,"f")&&E(this,G,"m",At).call(this,t)}else E(this,G,"m",zt).call(this,E(this,G,"m",kt).call(this,"full"));else{const t=20;if(this.hideable){const e=E(this,at,"f").minHeight;if(this.clientHeight<e-t)return void this.hide()}this.detents.length>0?E(this,G,"m",At).call(this,E(this,G,"m",_t).call(this)):this.clientHeight<E(this,at,"f").minHeight&&E(this,G,"m",zt).call(this,E(this,at,"f").minHeight)}}finally{S(this,at,void 0,"f")}},gt=function(t){this.open&&this.modal&&!t.composedPath().includes(this)&&this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide()},vt=function(t){this.open&&this.modal&&"Escape"===t.key&&!t.shiftKey&&!t.ctrlKey&&(t.preventDefault(),this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide())},yt=function(){if(this.detents.length>0&&"half"===this.detents[E(this,ht,"f")])return void E(this,G,"m",Ot).call(this,E(this,G,"m",kt).call(this,"half"));const t=E(this,G,"m",xt).call(this);(this.classList.contains("-full")||this.clientHeight>t)&&E(this,G,"m",Ot).call(this,t)},wt=function(){E(this,rt,"f")||this.cycle(),S(this,rt,!1,"f")},$t=function(t){if(!t.defaultPrevented&&v(t))switch(t.key){case"Up":case"ArrowUp":if(t.preventDefault(),this.detents.length>0){const t=E(this,G,"m",Et).call(this);t!==E(this,ht,"f")&&E(this,G,"m",At).call(this,t)}else E(this,G,"m",zt).call(this,E(this,G,"m",kt).call(this,"full"));break;case"Down":case"ArrowDown":if(t.preventDefault(),this.detents.length>0){const t=E(this,G,"m",St).call(this);t!==E(this,ht,"f")?E(this,G,"m",At).call(this,t):this.hideable&&this.hide()}else this.hideable&&this.hide()}},Et=function(){const t=this.clientHeight;let e=1/0,i=E(this,ht,"f");for(let s=0;s<this.detents.length;s++){if(s===E(this,ht,"f"))continue;const o=E(this,G,"m",kt).call(this,this.detents[s]);o>t&&o<e&&(e=o,i=s)}return i},St=function(){const t=this.clientHeight;let e=-1/0,i=E(this,ht,"f");for(let s=0;s<this.detents.length;s++){if(s===E(this,ht,"f"))continue;const o=E(this,G,"m",kt).call(this,this.detents[s]);o<t&&o>e&&(e=o,i=s)}return i},_t=function(){const t=this.clientHeight;let e=E(this,ht,"f"),i=1/0;for(let s=0;s<this.detents.length;s++){const o=E(this,G,"m",kt).call(this,this.detents[s]),n=Math.abs(t-o);n<i&&(i=n,e=s)}return e},kt=function(t){switch(t){case"collapsed":return E(this,G,"m",Pt).call(this);case"half":return.5*E(this,G,"m",xt).call(this);case"full":return E(this,G,"m",xt).call(this);case"fit":return E(this,G,"m",Ct).call(this)}return t.endsWith("%")?E(this,G,"m",xt).call(this)*(parseFloat(t)/100):t.endsWith("px")?parseFloat(t):E(this,G,"m",Pt).call(this)},xt=function(){const t=this.shadowRoot?.querySelector(".base");return window.innerHeight-(t?h(t,"var(--_bottom-sheet-top-space)"):0)},Pt=function(){return this.detents.includes("fit")&&!this.detents.includes("collapsed")?E(this,G,"m",Ct).call(this):E(this,G,"m",Mt).call(this)},Mt=function(){const t=this.shadowRoot?.querySelector(".base");return E(this,dt,"f")+(t?h(t,"var(--_bottom-sheet-peek-height)"):0)},Ct=function(){const t=this.shadowRoot?.querySelector(".body");if(!t)return 0;const e=getComputedStyle(t);return E(this,dt,"f")+E(this,ct,"f")+parseFloat(e.paddingBlockStart)+parseFloat(e.paddingBlockEnd)},Ut=function(t){const e=E(this,ct,"f"),i=E(this,dt,"f");for(const e of t)e.target.classList.contains("content")?S(this,ct,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f"):e.target.classList.contains("header")&&S(this,dt,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f");if(this.open&&this.detents.length>0&&(e!==E(this,ct,"f")||i!==E(this,dt,"f")))switch(this.detents[E(this,ht,"f")]){case"fit":E(this,G,"m",Ot).call(this,E(this,G,"m",Ct).call(this));break;case"collapsed":E(this,G,"m",Ot).call(this,E(this,G,"m",Pt).call(this))}},At=function(t){t>=0&&t<this.detents.length&&(S(this,ht,t,"f"),E(this,G,"m",zt).call(this,E(this,G,"m",kt).call(this,this.detents[t])))},zt=async function(t){E(this,pt,"f")&&(E(this,G,"m",Ot).call(this,this.clientHeight),E(this,pt,"f")?.cancel(),S(this,pt,void 0,"f")),l()?E(this,G,"m",Ot).call(this,t):(S(this,pt,this.animate([{"--_bottom-sheet-height":`${this.clientHeight}px`},{"--_bottom-sheet-height":`${t}px`}],{duration:250,easing:"cubic-bezier(0.2, 0.0, 0, 1.0)"}),"f"),E(this,pt,"f").onfinish=()=>{E(this,G,"m",Ot).call(this,t),S(this,pt,void 0,"f")},await E(this,pt,"f").finished)},Ot=function(t){this.style.setProperty("--_bottom-sheet-height",`${t}px`),this.classList.toggle("-full",t===E(this,G,"m",xt).call(this));const e=this.shadowRoot?.querySelector(".content");e&&(e.inert=t<=E(this,G,"m",Mt).call(this))},Ht=function(){E(this,et,"f").length=0;for(let t=this;t.parentNode&&t.parentNode!==document.documentElement;t=t.parentNode)for(const e of t.parentNode.children)e instanceof HTMLElement&&e!==t&&!e.inert&&(e.inert=!0,E(this,et,"f").push(e))},Lt=function(){E(this,et,"f").forEach(t=>t.inert=!1),E(this,et,"f").length=0},(()=>{if(document){const t=new CSSStyleSheet;t.replaceSync(u`@property --_bottom-sheet-height { syntax: "<length>"; inherits: false; initial-value: 50vh; } m3e-bottom-sheet > [slot="header"] { margin-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); margin-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); }</length>`.toString()),document.adoptedStyleSheets.push(t)}})(),Tt.styles=u`:host { display: block; position: fixed; left: 50%; top: calc(100vh - var(--_bottom-sheet-height)); margin: 0; padding: 0; outline: none; overflow: hidden; border: none; box-sizing: border-box; width: var(--m3e-bottom-sheet-width, 100%); max-width: var(--m3e-bottom-sheet-max-width, 40rem); height: var(--_bottom-sheet-height); color: var(--m3e-bottom-sheet-color, ${a.color.onSurface}); background-color: var(--m3e-bottom-sheet-container-color, ${a.color.surfaceContainerLow}); transition: ${b(`transform ${a.motion.duration.medium2} ${a.motion.easing.standardDecelerate},\n border-radius ${a.motion.duration.medium2} ${a.motion.easing.standard}`)}; } :host(:not([modal]):not(.-full)) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-elevation, ${a.elevation.level1}); } :host([modal]:not(.-full)) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-modal-elevation, ${a.elevation.level1}); } :host(.-full) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-full-elevation, ${a.elevation.level1}); } :host(:not([modal])) { z-index: var(--m3e-bottom-sheet-z-index, 10); } :host(:not([modal]):not([open])), :host([modal]:not(:popover-open)) { border-radius: var(--m3e-bottom-sheet-minimized-container-shape, ${a.shape.corner.none}); transform: translateX(-50%) translateY(100%); } :host(:not([modal])[open]:not(.-full)), :host([modal]:not(.-full):popover-open) { border-radius: var(--m3e-bottom-sheet-container-shape, ${a.shape.corner.extraLargeTop}); } :host(:not([modal])[open].-full), :host([modal].-full:popover-open) { border-radius: var(--m3e-bottom-sheet-full-container-shape, ${a.shape.corner.extraLargeTop}); } :host(:not([modal])[open]), :host([modal]:popover-open) { transform: translateX(-50%) translateY(0); } :host([modal])::backdrop { transition: ${b(`background-color ${a.motion.duration.short3} ${a.motion.easing.standard}, \n overlay ${a.motion.duration.short3} ${a.motion.easing.standard} allow-discrete,\n visibility ${a.motion.duration.short3} ${a.motion.easing.standard} allow-discrete`)}; } :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${a.color.scrim}) var(--m3e-bottom-sheet-scrim-opacity, 32%), transparent ); transition: ${b(`background-color ${a.motion.duration.long2} ${a.motion.easing.standard}, \n overlay ${a.motion.duration.long2} ${a.motion.easing.standard} allow-discrete,\n visibility ${a.motion.duration.long2} ${a.motion.easing.standard} allow-discrete`)}; } @starting-style { :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${a.color.scrim}) 0%, transparent ); } } .base { display: flex; border-radius: inherit; flex-direction: column; height: 100%; --_bottom-sheet-peek-height: var(--m3e-bottom-sheet-peek-height, 0); --_bottom-sheet-top-space: var(--m3e-bottom-sheet-compact-top-space, 4.5rem); } @media (max-height: 640px) { .base { --_bottom-sheet-top-space: var(--m3e-bottom-sheet-top-space, 3.5rem); } } .body { flex: 1 1 auto; overflow-y: auto; scrollbar-width: ${a.scrollbar.thinWidth}; scrollbar-color: ${a.scrollbar.color}; padding-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); padding-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); font-size: var(--m3e-bottom-sheet-content-font-size, ${a.typescale.standard.body.medium.fontSize}); font-weight: var( --m3e-bottom-sheet-content-font-weight, ${a.typescale.standard.body.medium.fontWeight} ); line-height: var( --m3e-bottom-sheet-content-line-height, ${a.typescale.standard.body.medium.lineHeight} ); letter-spacing: var(--m3e-bottom-sheet-content-tracking, ${a.typescale.standard.body.medium.tracking}); } .content { height: fit-content; } :host(:not([handle]):not(.-has-header)) .header { display: none; } :host(:not([handle]):not(.-has-header)) .body, .header { border-top-left-radius: inherit; border-top-right-radius: inherit; padding-block-start: var(--m3e-bottom-sheet-padding-block, 0.5rem); font-size: var(--m3e-bottom-sheet-header-font-size, ${a.typescale.standard.title.large.fontSize}); font-weight: var(--m3e-bottom-sheet-header-font-weight, ${a.typescale.standard.title.large.fontWeight}); line-height: var(--m3e-bottom-sheet-header-line-height, ${a.typescale.standard.title.large.lineHeight}); letter-spacing: var(--m3e-bottom-sheet-header-tracking, ${a.typescale.standard.title.large.tracking}); } .header { cursor: grab; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); box-sizing: border-box; flex: none; display: flex; flex-direction: column; min-height: 3rem; --m3e-app-bar-container-color: var(--m3e-bottom-sheet-container-color, ${a.color.surfaceContainerLow}); } .handle-row { position: relative; flex: none; display: flex; align-items: center; justify-content: center; opacity: 1; visibility: visible; transition: ${b(`opacity ${a.motion.duration.short3} ${a.motion.easing.standard},\n padding ${a.motion.duration.short3} ${a.motion.easing.standard},\n height ${a.motion.duration.short3} ${a.motion.easing.standard},\n visibility ${a.motion.duration.short3} ${a.motion.easing.standard} allow-discrete`)}; height: var(--m3e-bottom-sheet-handle-container-height, 1.5rem); } .handle { position: relative; width: var(--m3e-bottom-sheet-handle-width, 2rem); height: var(--m3e-bottom-sheet-handle-height, 0.25rem); border-radius: var(--m3e-bottom-sheet-handle-shape, ${a.shape.corner.full}); background-color: var(--m3e-bottom-sheet-handle-color, ${a.color.onSurfaceVariant}); } .focus-ring { top: calc(0px - var(--m3e-bottom-sheet-handle-focus-ring-offset, 0.125rem)); left: calc(0px - var(--m3e-bottom-sheet-handle-focus-ring-offset, 0.125rem)); right: calc(0px - var(--m3e-bottom-sheet-handle-focus-ring-offset, 0.125rem)); bottom: calc(0px - var(--m3e-bottom-sheet-handle-focus-ring-offset, 0.125rem)); } .handle-touch { position: absolute; aspect-ratio: 1 / 1; height: 3rem; left: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); right: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); top: calc( 0px - calc( calc(3rem - var(--m3e-bottom-sheet-handle-container-height, 1.5rem)) - calc( var(--m3e-bottom-sheet-handle-height, 0.25rem) / 2 ) ) ); } @media (prefers-reduced-motion) { :host, :host([modal])::backdrop, :host([modal]:popover-open)::backdrop, .handle { transition: none; } } @media (forced-colors: active) { :host([modal])::backdrop, :host([modal]:popover-open)::backdrop { transition: none; } .base { border-style: solid; border-width: 1px; border-color: CanvasText; } .handle { background-color: ButtonText; } }`,$([J({type:Boolean,reflect:!0})],Tt.prototype,"modal",void 0),$([J({type:Boolean,reflect:!0})],Tt.prototype,"open",void 0),$([J({type:Boolean})],Tt.prototype,"handle",void 0),$([J({attribute:"handle-label"})],Tt.prototype,"handleLabel",void 0),$([J({attribute:"detents",converter:c})],Tt.prototype,"detents",void 0),$([J({type:Number})],Tt.prototype,"detent",void 0),$([J({type:Boolean,reflect:!0})],Tt.prototype,"hideable",void 0),$([J({attribute:"hide-friction",type:Number})],Tt.prototype,"hideFriction",void 0),Tt=Rt=$([_("m3e-bottom-sheet")],Tt);let Wt=class extends(d(t)){constructor(){super(...arguments),this.secondary=!1}attach(t){t instanceof Tt&&(super.attach(t),this.parentElement&&(t.modal?this.parentElement.ariaHasPopup="dialog":this.secondary||(this.parentElement.ariaExpanded="false",y(this.parentElement,"aria-controls",t.id),this.parentElement.id&&y(t,"aria-labelledby",this.parentElement.id))))}detach(){this.control&&this.parentElement&&!this.secondary&&w(this.parentElement,"aria-controls",this.control.id),super.detach()}_onClick(){this.control instanceof Tt&&(this.control.modal?this.control.show(this.detent):(this.control.toggle(this.detent),!this.secondary&&this.parentElement&&(this.parentElement.ariaExpanded=`${this.control.open}`)))}};$([J({type:Number})],Wt.prototype,"detent",void 0),$([J({type:Boolean})],Wt.prototype,"secondary",void 0),Wt=$([_("m3e-bottom-sheet-trigger")],Wt);export{X as M3eBottomSheetActionElement,Tt as M3eBottomSheetElement,Wt as M3eBottomSheetTriggerElement};
|
|
28
|
+
const K={attribute:!0,type:String,converter:N,reflect:!1,hasChanged:F},V=(t=K,e,i)=>{const{kind:s,metadata:o}=i;let n=globalThis.litPropertyMetadata.get(o);if(void 0===n&&globalThis.litPropertyMetadata.set(o,n=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),n.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,o,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];e.call(this,i),this.requestUpdate(s,o,t)}}throw Error("Unsupported decorator location: "+s)};function J(t){return(e,i)=>"object"==typeof i?V(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}let X=class extends t{_onClick(){this.closest("m3e-bottom-sheet")?.hide()}};var G,Q,Z,tt,et,it,st,ot,nt,at,rt,ht,lt,ct,dt,pt,mt,ft,ut,bt,gt,vt,yt,wt,$t,Et,St,_t,kt,xt,Pt,Mt,Ct,Ut,At,zt,Ot,Lt,Ht,Rt;X=$([_("m3e-bottom-sheet-action")],X);let Tt=Rt=class extends(e(p,"opening","opened","cancel","closing","closed")){constructor(){super(...arguments),G.add(this),Q.set(this,t=>E(this,G,"m",gt).call(this,t)),Z.set(this,t=>E(this,G,"m",vt).call(this,t)),tt.set(this,()=>E(this,G,"m",yt).call(this)),et.set(this,new Array),it.set(this,new i),st.set(this,new s(this)),ot.set(this,new o(this,{target:null,skipInitial:!0,callback:t=>E(this,G,"m",Ut).call(this,t)})),nt.set(this,null),at.set(this,void 0),rt.set(this,!1),ht.set(this,0),lt.set(this,void 0),ct.set(this,0),dt.set(this,0),pt.set(this,void 0),this.modal=!1,this.open=!1,this.handle=!1,this.handleLabel="Drag handle",this.detents=[],this.detent=0,this.hideable=!1,this.hideFriction=.5}show(t=this.detent){this.open?void 0!==t&&E(this,ht,"f")!==t&&E(this,G,"m",At).call(this,t):(S(this,lt,t,"f"),this.open=!0)}hide(){this.open=!1}toggle(t){this.open?this.hide():this.show(t)}cycle(){var t;this.open?this.detents.length>0?E(this,ht,"f")<this.detents.length-1?(S(this,ht,(t=E(this,ht,"f"),++t),"f"),E(this,G,"m",At).call(this,E(this,ht,"f"))):this.hideable&&this.hide():this.hide():this.show()}connectedCallback(){super.connectedCallback(),this.classList.add("-no-animate")}update(t){super.update(t),t.has("modal")&&(this.role=this.modal?"dialog":"region",this.ariaModal=this.modal?"true":null,this.popover=this.modal?"manual":null)}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot?.querySelector(".content");e&&(S(this,ct,e.clientHeight,"f"),E(this,ot,"f").observe(e));const i=this.shadowRoot?.querySelector(".header");i&&(S(this,dt,i.clientHeight,"f"),E(this,ot,"f").observe(i)),this.classList.remove("-no-animate")}updated(t){if(super.updated(t),t.has("open")){if(this.open){if(!this.dispatchEvent(new Event("opening",{cancelable:!0})))return void(this.open=!1);Rt.__openSheet!==this&&Rt.__openSheet?.hide(),Rt.__openSheet=this,this.inert=!1,window.addEventListener("resize",E(this,tt,"f")),this.detents.length>0?(S(this,ht,Math.min(Math.max(0,E(this,lt,"f")??this.detent),this.detents.length-1),"f"),E(this,G,"m",Ot).call(this,E(this,G,"m",kt).call(this,this.detents[E(this,ht,"f")]))):E(this,G,"m",Ot).call(this,Math.min(E(this,G,"m",kt).call(this,"fit"),E(this,G,"m",kt).call(this,"half"))),S(this,lt,void 0,"f")}else{if(!this.dispatchEvent(new Event("closing",{cancelable:!0})))return void(this.open=!0);requestAnimationFrame(()=>this.inert=!0),window.removeEventListener("resize",E(this,tt,"f")),Rt.__openSheet===this&&(Rt.__openSheet=void 0)}if(this.modal)if(this.open){S(this,nt,document.activeElement,"f"),E(this,G,"m",Lt).call(this),E(this,st,"f").lock(),this.showPopover(),requestAnimationFrame(()=>{document.addEventListener("click",E(this,Q,"f")),document.addEventListener("keydown",E(this,Z,"f"))});let t=this.querySelector("[autofocus]");t&&g.isFocusable(t)||(t=this.shadowRoot?.querySelector(".handle")),t&&n(t)}else E(this,G,"m",zt).call(this,0).then(()=>{E(this,G,"m",Ht).call(this),E(this,st,"f").unlock(),document.removeEventListener("click",E(this,Q,"f")),document.removeEventListener("keydown",E(this,Z,"f")),this.hidePopover(),E(this,nt,"f")instanceof HTMLElement&&E(this,nt,"f").focus(),S(this,nt,null,"f")});this.dispatchEvent(new Event(this.open?"opened":"closed"))}}render(){return f`<m3e-focus-trap ?disabled="${!this.modal}"><div class="base"><m3e-elevation class="elevation"></m3e-elevation><div class="header" @pointerdown="${E(this,G,"m",ft)}" @pointermove="${E(this,G,"m",ut)}" @pointerup="${E(this,G,"m",bt)}">${this.handle?f`<div class="handle-row"><div id="handle" class="handle" role="button" aria-label="${this.handleLabel}" tabindex="0" @click="${E(this,G,"m",wt)}" @keydown="${E(this,G,"m",$t)}"><m3e-focus-ring class="focus-ring" for="handle"></m3e-focus-ring><div class="handle-touch" aria-hidden="true"></div></div></div>`:m}<slot name="header" @slotchange="${E(this,G,"m",mt)}"></slot></div><div class="body"><div class="content"><slot></slot></div></div></div></m3e-focus-trap>`}};Q=new WeakMap,Z=new WeakMap,tt=new WeakMap,et=new WeakMap,it=new WeakMap,st=new WeakMap,ot=new WeakMap,nt=new WeakMap,at=new WeakMap,rt=new WeakMap,ht=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,pt=new WeakMap,G=new WeakSet,mt=function(t){this.classList.toggle("-has-header",r(t.target))},ft=function(t){2!==t.button&&(t.target instanceof HTMLElement&&g.isFocusable(t.target)||(t.target.setPointerCapture(t.pointerId),t.target.style.cursor="grabbing",E(this,it,"f").reset(),E(this,it,"f").add(t.clientY),S(this,at,{startY:t.clientY,startHeight:this.clientHeight,maxHeight:E(this,G,"m",xt).call(this),minHeight:E(this,G,"m",Pt).call(this)},"f"),S(this,rt,!1,"f")))},ut=function(t){if(!E(this,at,"f"))return;if(Math.abs(t.clientY-E(this,at,"f").startY)<=8)return;(t.getCoalescedEvents?.()??[t]).forEach(e=>E(this,it,"f").add(e.clientY,t.timeStamp));let e=E(this,at,"f").startHeight-(t.clientY-E(this,at,"f").startY);if(e<E(this,at,"f").minHeight){const t=(E(this,at,"f").minHeight-e)*this.hideFriction;e=E(this,at,"f").minHeight-t}E(this,G,"m",Ot).call(this,Math.min(E(this,at,"f").maxHeight,e)),S(this,rt,!0,"f")},bt=function(t){if(E(this,at,"f"))try{if(t.target.releasePointerCapture(t.pointerId),t.target.style.cursor="",!E(this,rt,"f"))return;const e="touch"===t.pointerType?1200:500,i=E(this,it,"f").getVelocity();if(E(this,it,"f").reset(),this.hideable&&i>=e)this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide();else if(Math.abs(i)>=e)if(this.detents.length>0){const t=E(this,G,"m",Et).call(this);t!==E(this,ht,"f")&&E(this,G,"m",At).call(this,t)}else E(this,G,"m",zt).call(this,E(this,G,"m",kt).call(this,"full"));else{const t=20;if(this.hideable){const e=E(this,at,"f").minHeight;if(this.clientHeight<e-t)return void this.hide()}this.detents.length>0?E(this,G,"m",At).call(this,E(this,G,"m",_t).call(this)):this.clientHeight<E(this,at,"f").minHeight&&E(this,G,"m",zt).call(this,E(this,at,"f").minHeight)}}finally{S(this,at,void 0,"f")}},gt=function(t){this.open&&this.modal&&!t.composedPath().includes(this)&&this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide()},vt=function(t){this.open&&this.modal&&"Escape"===t.key&&!t.shiftKey&&!t.ctrlKey&&(t.preventDefault(),this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide())},yt=function(){if(this.detents.length>0&&"half"===this.detents[E(this,ht,"f")])return void E(this,G,"m",Ot).call(this,E(this,G,"m",kt).call(this,"half"));const t=E(this,G,"m",xt).call(this);(this.classList.contains("-full")||this.clientHeight>t)&&E(this,G,"m",Ot).call(this,t)},wt=function(){E(this,rt,"f")||this.cycle(),S(this,rt,!1,"f")},$t=function(t){if(!t.defaultPrevented&&v(t))switch(t.key){case"Up":case"ArrowUp":if(t.preventDefault(),this.detents.length>0){const t=E(this,G,"m",Et).call(this);t!==E(this,ht,"f")&&E(this,G,"m",At).call(this,t)}else E(this,G,"m",zt).call(this,E(this,G,"m",kt).call(this,"full"));break;case"Down":case"ArrowDown":if(t.preventDefault(),this.detents.length>0){const t=E(this,G,"m",St).call(this);t!==E(this,ht,"f")?E(this,G,"m",At).call(this,t):this.hideable&&this.hide()}else this.hideable&&this.hide()}},Et=function(){const t=this.clientHeight;let e=1/0,i=E(this,ht,"f");for(let s=0;s<this.detents.length;s++){if(s===E(this,ht,"f"))continue;const o=E(this,G,"m",kt).call(this,this.detents[s]);o>t&&o<e&&(e=o,i=s)}return i},St=function(){const t=this.clientHeight;let e=-1/0,i=E(this,ht,"f");for(let s=0;s<this.detents.length;s++){if(s===E(this,ht,"f"))continue;const o=E(this,G,"m",kt).call(this,this.detents[s]);o<t&&o>e&&(e=o,i=s)}return i},_t=function(){const t=this.clientHeight;let e=E(this,ht,"f"),i=1/0;for(let s=0;s<this.detents.length;s++){const o=E(this,G,"m",kt).call(this,this.detents[s]),n=Math.abs(t-o);n<i&&(i=n,e=s)}return e},kt=function(t){switch(t){case"collapsed":return E(this,G,"m",Pt).call(this);case"half":return.5*E(this,G,"m",xt).call(this);case"full":return E(this,G,"m",xt).call(this);case"fit":return E(this,G,"m",Ct).call(this)}return t.endsWith("%")?E(this,G,"m",xt).call(this)*(parseFloat(t)/100):t.endsWith("px")?parseFloat(t):E(this,G,"m",Pt).call(this)},xt=function(){const t=this.shadowRoot?.querySelector(".base");return window.innerHeight-(t?h(t,"var(--_bottom-sheet-top-space)"):0)},Pt=function(){return this.detents.includes("fit")&&!this.detents.includes("collapsed")?E(this,G,"m",Ct).call(this):E(this,G,"m",Mt).call(this)},Mt=function(){const t=this.shadowRoot?.querySelector(".base");return E(this,dt,"f")+(t?h(t,"var(--_bottom-sheet-peek-height)"):0)},Ct=function(){const t=this.shadowRoot?.querySelector(".body");if(!t)return 0;const e=getComputedStyle(t);return E(this,dt,"f")+E(this,ct,"f")+parseFloat(e.paddingBlockStart)+parseFloat(e.paddingBlockEnd)},Ut=function(t){const e=E(this,ct,"f"),i=E(this,dt,"f");for(const e of t)e.target.classList.contains("content")?S(this,ct,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f"):e.target.classList.contains("header")&&S(this,dt,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f");if(this.open&&this.detents.length>0&&(e!==E(this,ct,"f")||i!==E(this,dt,"f")))switch(this.detents[E(this,ht,"f")]){case"fit":E(this,G,"m",Ot).call(this,E(this,G,"m",Ct).call(this));break;case"collapsed":E(this,G,"m",Ot).call(this,E(this,G,"m",Pt).call(this))}},At=function(t){t>=0&&t<this.detents.length&&(S(this,ht,t,"f"),E(this,G,"m",zt).call(this,E(this,G,"m",kt).call(this,this.detents[t])))},zt=async function(t){E(this,pt,"f")&&(E(this,G,"m",Ot).call(this,this.clientHeight),E(this,pt,"f")?.cancel(),S(this,pt,void 0,"f")),l()?E(this,G,"m",Ot).call(this,t):(S(this,pt,this.animate([{"--_bottom-sheet-height":`${this.clientHeight}px`},{"--_bottom-sheet-height":`${t}px`}],{duration:250,easing:"cubic-bezier(0.2, 0.0, 0, 1.0)"}),"f"),E(this,pt,"f").onfinish=()=>{E(this,G,"m",Ot).call(this,t),S(this,pt,void 0,"f")},await E(this,pt,"f").finished)},Ot=function(t){this.style.setProperty("--_bottom-sheet-height",`${t}px`),this.classList.toggle("-full",t===E(this,G,"m",xt).call(this));const e=this.shadowRoot?.querySelector(".content");e&&(e.inert=t<=E(this,G,"m",Mt).call(this))},Lt=function(){E(this,et,"f").length=0;for(let t=this;t.parentNode&&t.parentNode!==document.documentElement;t=t.parentNode)for(const e of t.parentNode.children)e instanceof HTMLElement&&e!==t&&!e.inert&&(e.inert=!0,E(this,et,"f").push(e))},Ht=function(){E(this,et,"f").forEach(t=>t.inert=!1),E(this,et,"f").length=0},(()=>{if(document){const t=new CSSStyleSheet;t.replaceSync(u`@property --_bottom-sheet-height { syntax: "<length>"; inherits: false; initial-value: 50vh; } m3e-bottom-sheet > [slot="header"] { margin-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); margin-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); }</length>`.toString()),document.adoptedStyleSheets.push(t)}})(),Tt.styles=u`:host { display: block; position: fixed; left: 50%; top: calc(100vh - var(--_bottom-sheet-height)); margin: 0; padding: 0; outline: none; overflow: hidden; border: none; box-sizing: border-box; width: var(--m3e-bottom-sheet-width, 100%); max-width: var(--m3e-bottom-sheet-max-width, 40rem); height: var(--_bottom-sheet-height); color: var(--m3e-bottom-sheet-color, ${a.color.onSurface}); background-color: var(--m3e-bottom-sheet-container-color, ${a.color.surfaceContainerLow}); } :host(:not(.-no-animate)) { transition: ${b(`transform ${a.motion.duration.medium2} ${a.motion.easing.standardDecelerate},\n border-radius ${a.motion.duration.medium2} ${a.motion.easing.standard}`)}; } :host(:not([modal]):not(.-full)) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-elevation, ${a.elevation.level1}); } :host([modal]:not(.-full)) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-modal-elevation, ${a.elevation.level1}); } :host(.-full) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-full-elevation, ${a.elevation.level1}); } :host(:not([modal])) { z-index: var(--m3e-bottom-sheet-z-index, 10); } :host(:not([modal]):not([open])), :host([modal]:not(:popover-open)) { border-radius: var(--m3e-bottom-sheet-minimized-container-shape, ${a.shape.corner.none}); transform: translateX(-50%) translateY(100%); } :host(:not([modal])[open]:not(.-full)), :host([modal]:not(.-full):popover-open) { border-radius: var(--m3e-bottom-sheet-container-shape, ${a.shape.corner.extraLargeTop}); } :host(:not([modal])[open].-full), :host([modal].-full:popover-open) { border-radius: var(--m3e-bottom-sheet-full-container-shape, ${a.shape.corner.extraLargeTop}); } :host(:not([modal])[open]), :host([modal]:popover-open) { transform: translateX(-50%) translateY(0); } :host([modal]:not(.-no-animate))::backdrop { transition: ${b(`background-color ${a.motion.duration.short3} ${a.motion.easing.standard}, \n overlay ${a.motion.duration.short3} ${a.motion.easing.standard} allow-discrete,\n visibility ${a.motion.duration.short3} ${a.motion.easing.standard} allow-discrete`)}; } :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${a.color.scrim}) var(--m3e-bottom-sheet-scrim-opacity, 32%), transparent ); } :host([modal]:popover-open:not(.-no-animate))::backdrop { transition: ${b(`background-color ${a.motion.duration.long2} ${a.motion.easing.standard}, \n overlay ${a.motion.duration.long2} ${a.motion.easing.standard} allow-discrete,\n visibility ${a.motion.duration.long2} ${a.motion.easing.standard} allow-discrete`)}; } @starting-style { :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${a.color.scrim}) 0%, transparent ); } } .base { display: flex; border-radius: inherit; flex-direction: column; height: 100%; --_bottom-sheet-peek-height: var(--m3e-bottom-sheet-peek-height, 0); --_bottom-sheet-top-space: var(--m3e-bottom-sheet-compact-top-space, 4.5rem); } @media (max-height: 640px) { .base { --_bottom-sheet-top-space: var(--m3e-bottom-sheet-top-space, 3.5rem); } } .body { flex: 1 1 auto; overflow-y: auto; scrollbar-width: ${a.scrollbar.thinWidth}; scrollbar-color: ${a.scrollbar.color}; padding-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); padding-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); font-size: var(--m3e-bottom-sheet-content-font-size, ${a.typescale.standard.body.medium.fontSize}); font-weight: var( --m3e-bottom-sheet-content-font-weight, ${a.typescale.standard.body.medium.fontWeight} ); line-height: var( --m3e-bottom-sheet-content-line-height, ${a.typescale.standard.body.medium.lineHeight} ); letter-spacing: var(--m3e-bottom-sheet-content-tracking, ${a.typescale.standard.body.medium.tracking}); } .content { height: fit-content; } :host(:not([handle]):not(.-has-header)) .header { display: none; } :host(:not([handle]):not(.-has-header)) .body, .header { border-top-left-radius: inherit; border-top-right-radius: inherit; padding-block-start: var(--m3e-bottom-sheet-padding-block, 0.5rem); font-size: var(--m3e-bottom-sheet-header-font-size, ${a.typescale.standard.title.large.fontSize}); font-weight: var(--m3e-bottom-sheet-header-font-weight, ${a.typescale.standard.title.large.fontWeight}); line-height: var(--m3e-bottom-sheet-header-line-height, ${a.typescale.standard.title.large.lineHeight}); letter-spacing: var(--m3e-bottom-sheet-header-tracking, ${a.typescale.standard.title.large.tracking}); } .header { cursor: grab; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); box-sizing: border-box; flex: none; display: flex; flex-direction: column; min-height: 3rem; --m3e-app-bar-container-color: var(--m3e-bottom-sheet-container-color, ${a.color.surfaceContainerLow}); } .handle-row { position: relative; flex: none; display: flex; align-items: center; justify-content: center; opacity: 1; visibility: visible; height: var(--m3e-bottom-sheet-handle-container-height, 1.5rem); } :host(:not(.-no-animate)) .handle-row { transition: ${b(`opacity ${a.motion.duration.short3} ${a.motion.easing.standard},\n padding ${a.motion.duration.short3} ${a.motion.easing.standard},\n height ${a.motion.duration.short3} ${a.motion.easing.standard},\n visibility ${a.motion.duration.short3} ${a.motion.easing.standard} allow-discrete`)}; } .handle { position: relative; width: var(--m3e-bottom-sheet-handle-width, 2rem); height: var(--m3e-bottom-sheet-handle-height, 4px); border-radius: var(--m3e-bottom-sheet-handle-shape, ${a.shape.corner.full}); background-color: var(--m3e-bottom-sheet-handle-color, ${a.color.onSurfaceVariant}); } .handle-touch { position: absolute; aspect-ratio: 1 / 1; height: 3rem; left: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); right: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); top: calc( 0px - calc( calc(3rem - var(--m3e-bottom-sheet-handle-container-height, 1.5rem)) - calc( var(--m3e-bottom-sheet-handle-height, 4px) / 2 ) ) ); } @media (prefers-reduced-motion) { :host(:not(.-no-animate)), :host([modal]:not(.-no-animate))::backdrop, :host([modal]:popover-open:not(.-no-animate))::backdrop, :host(:not(.-no-animate)) .handle-row { transition: none; } } @media (forced-colors: active) { :host([modal]:not(.-no-animate))::backdrop, :host([modal]:popover-open:not(.-no-animate))::backdrop { transition: none; } .base { border-style: solid; border-width: 1px; border-color: CanvasText; } .handle { background-color: ButtonText; } }`,$([J({type:Boolean,reflect:!0})],Tt.prototype,"modal",void 0),$([J({type:Boolean,reflect:!0})],Tt.prototype,"open",void 0),$([J({type:Boolean})],Tt.prototype,"handle",void 0),$([J({attribute:"handle-label"})],Tt.prototype,"handleLabel",void 0),$([J({attribute:"detents",converter:c})],Tt.prototype,"detents",void 0),$([J({type:Number})],Tt.prototype,"detent",void 0),$([J({type:Boolean,reflect:!0})],Tt.prototype,"hideable",void 0),$([J({attribute:"hide-friction",type:Number})],Tt.prototype,"hideFriction",void 0),Tt=Rt=$([_("m3e-bottom-sheet")],Tt);let Wt=class extends(d(t)){constructor(){super(...arguments),this.secondary=!1}attach(t){t instanceof Tt&&(super.attach(t),this.parentElement&&(t.modal?this.parentElement.ariaHasPopup="dialog":this.secondary||(this.parentElement.ariaExpanded="false",y(this.parentElement,"aria-controls",t.id),this.parentElement.id&&y(t,"aria-labelledby",this.parentElement.id))))}detach(){this.control&&this.parentElement&&!this.secondary&&w(this.parentElement,"aria-controls",this.control.id),super.detach()}_onClick(){this.control instanceof Tt&&(this.control.modal?this.control.show(this.detent):(this.control.toggle(this.detent),!this.secondary&&this.parentElement&&(this.parentElement.ariaExpanded=`${this.control.open}`)))}};$([J({type:Number})],Wt.prototype,"detent",void 0),$([J({type:Boolean})],Wt.prototype,"secondary",void 0),Wt=$([_("m3e-bottom-sheet-trigger")],Wt);export{X as M3eBottomSheetActionElement,Tt as M3eBottomSheetElement,Wt as M3eBottomSheetTriggerElement};
|
|
29
29
|
//# sourceMappingURL=bottom-sheet.min.js.map
|