@m3e/stepper 1.1.2 → 1.1.4
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/custom-elements.json +101 -182
- package/dist/index.js +14 -30
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +10 -9
- package/dist/index.min.js.map +1 -1
- package/dist/src/StepperButtonElementBase.d.ts +3 -11
- package/dist/src/StepperButtonElementBase.d.ts.map +1 -1
- package/dist/src/StepperElement.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -3,34 +3,34 @@
|
|
|
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 s,nothing as i}from"lit";import{Role as o,Selected as r,KeyboardClick as n,Focusable as l,HtmlFor as a,Disabled as c,AttachInternals as d,DesignToken as h}from"@m3e/core";import{addAriaReferencedId as
|
|
6
|
+
import{LitElement as t,html as e,css as s,nothing as i}from"lit";import{Role as o,Selected as r,KeyboardClick as n,Focusable as l,HtmlFor as a,Disabled as c,AttachInternals as d,DesignToken as h,ActionElementBase as p}from"@m3e/core";import{addAriaReferencedId as m,removeAriaReferencedId as u,selectionManager as v,SelectionManager as f}from"@m3e/core/a11y";import{M3eBreakpointObserver as b,Breakpoint as g}from"@m3e/core/layout";function y(t,e,s,i){var o,r=arguments.length,n=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(e,s,n):o(e,s))||n);return r>3&&n&&Object.defineProperty(e,s,n),n}function $(t,e,s,i){if("a"===s&&!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"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function _(t,e,s,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(t,s):o?o.value=s:e.set(t,s),s}"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 A=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},w=globalThis,x=w.ShadowRoot&&(void 0===w.ShadyCSS||w.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,E=Symbol(),S=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 P=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==E)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 s=void 0!==e&&1===e.length;s&&(t=S.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&S.set(e,t))}return t}toString(){return this.cssText}};const C=x?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new P("string"==typeof t?t:t+"",void 0,E))(e)})(t):t,{is:k,defineProperty:T,getOwnPropertyDescriptor:O,getOwnPropertyNames:U,getOwnPropertySymbols:M,getPrototypeOf:H}=Object,N=globalThis,z=N.trustedTypes,I=z?z.emptyScript:"",R=N.reactiveElementPolyfillSupport,j=(t,e)=>t,L={toAttribute(t,e){switch(e){case Boolean:t=t?I:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},q=(t,e)=>!k(t,e),B={attribute:!0,type:String,converter:L,reflect:!1,useDefault:!1,hasChanged:q};
|
|
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"),N.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=B){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 s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&T(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=O(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const r=i?.call(this);o?.call(this,e),this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??B}static _$Ei(){if(this.hasOwnProperty(j("elementProperties")))return;const t=H(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(j("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(j("properties"))){const t=this.properties,e=[...U(t),...M(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(C(t))}else void 0!==t&&e.push(C(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"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 s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(x)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),i=w.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=s.cssText,t.appendChild(e)}})(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,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:L).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:L;this._$Em=i;const r=o.fromAttribute(e,t.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??q)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},r){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==o||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||s||(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,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,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[j("elementProperties")]=new Map,D[j("finalized")]=new Map,R?.({ReactiveElement:D}),(N.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 W={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:q},Z=(t=W,e,s)=>{const{kind:i,metadata:o}=s;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),r.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const o=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,o,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=s;return function(s){const o=this[i];e.call(this,s),this.requestUpdate(i,o,t)}}throw Error("Unsupported decorator location: "+i)};function V(t){return(e,s)=>"object"==typeof s?Z(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/function
|
|
33
|
+
*/function K(t){return V({...t,state:!0,attribute:!1})}
|
|
34
34
|
/**
|
|
35
35
|
* @license
|
|
36
36
|
* Copyright 2017 Google LLC
|
|
@@ -41,16 +41,17 @@ const B={attribute:!0,type:String,converter:j,reflect:!1,hasChanged:L},D=(t=B,e,
|
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
43
|
*/
|
|
44
|
-
function
|
|
44
|
+
function F(t,e){return(e,s,i)=>((t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s))(e,s,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}let J=class extends(o(t,"tabpanel")){constructor(){super(...arguments),this.active=!1}connectedCallback(){this.slot="panel",super.connectedCallback()}render(){return e`<m3e-collapsible ?open="${this.active}"><div class="content"><div><slot></slot></div><slot name="actions"></slot></div></m3e-collapsible>`}};var X,G,Q,Y,tt;J.styles=s`:host { display: block; } .content { display: flex; flex-direction: column; padding: var(--m3e-step-panel-padding, 1rem 1.5rem 1.5rem 1.5rem); row-gap: var(--m3e-step-panel-spacing, 0.5rem); } ::slotted([slot="actions"]) { flex: none; display: flex; align-items: center; min-height: var(--m3e-step-panel-actions-height, 3rem); } ::slotted([slot="actions"][end]) { justify-content: flex-end; }`,y([K()],J.prototype,"active",void 0),J=y([A("m3e-step-panel")],J);let et=tt=class extends(r(n(l(a(c(d(o(t,"tab")))))))){constructor(){super(...arguments),X.add(this),G.set(this,t=>$(this,X,"m",Y).call(this,t)),this.optional=!1,this.editable=!1,this.completed=!1,this.invalid=!1,this.index=-1}get panel(){return this.control instanceof J?this.control:null}get stepper(){return this.closest("m3e-stepper")}reset(){this.invalid=!1,this.completed=!1,this.panel?.querySelector("form")?.reset()}attach(t){t instanceof J&&(t.id=t.id||"m3e-step-panel-"+tt.__nextId++,m(this,"aria-controls",t.id)),super.attach(t)}detach(){this.control?.id&&u(this,"aria-controls",this.control.id),super.detach()}connectedCallback(){this.slot="step",super.connectedCallback(),this.addEventListener("click",$(this,G,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",$(this,G,"f"))}update(t){super.update(t),t.has("selected")&&this.closest("m3e-stepper")?.[v].notifySelectionChange(this)}firstUpdated(t){super.firstUpdated(t),[this._focusRing,this._stateLayer,this._ripple].forEach(t=>t?.attach(this))}render(){const t=e`<slot name="hint">${this.optional?e`<span class="hint">(Optional)</span>`:i}</slot>`,s=e`<slot name="error">${t}</slot>`;return e`<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple><div class="wrapper"><div class="icon" aria-hidden="true">${$(this,X,"m",Q).call(this)}</div><div class="label"><slot></slot>${this.invalid?s:t}</div></div>`}};var st;G=new WeakMap,X=new WeakSet,Q=function(){if(!this.selected){if(this.invalid)return e`<slot name="error-icon"><svg viewBox="0 -960 960 960" fill="currentColor"><path d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"/></svg></slot>`;if(this.completed)return this.editable?e`<slot name="edit-icon"><svg viewBox="0 -960 960 960" fill="currentColor"><path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"/></svg></slot>`:e`<slot name="done-icon"><svg viewBox="0 -960 960 960" fill="currentColor"><path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg></slot>`}return e`<slot name="icon">${this.index+1}</slot>`},Y=function(t){this.disabled&&(t.preventDefault(),t.stopImmediatePropagation()),t.defaultPrevented||this.selected||(this.selected=!0,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))&&this.closest("m3e-stepper")?.moveTo(this.index)?this.dispatchEvent(new Event("change",{bubbles:!0})):this.selected=!1)},et.styles=s`:host { display: block; position: relative; outline: none; min-width: 0px; border-radius: var(--m3e-step-shape, ${h.shape.corner.medium}); padding: var(--m3e-step-padding, 1.5rem); user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not([aria-disabled="true"])) { cursor: pointer; } .icon { flex: none; display: flex; align-items: center; justify-content: center; border-radius: var(--m3e-step-icon-shape, 50%); width: var(--m3e-step-icon-size, 1.5rem); height: var(--m3e-step-icon-size, 1.5rem); } .icon svg, ::slotted([slot="icon"]), ::slotted([slot="edit-icon"]), ::slotted([slot="done-icon"]), ::slotted([slot="error-icon"]) { width: 1em; font-size: var(--m3e-step-icon-size, 1.5rem) !important; } :host(:not([aria-disabled="true"])[selected]) .icon { background-color: var(--m3e-step-selected-icon-container-color, ${h.color.primary}); color: var(--m3e-step-selected-icon-color, ${h.color.onPrimary}); } :host(:not([aria-disabled="true"])[completed]:not([invalid])) .icon { background-color: var(--m3e-step-completed-icon-container-color, ${h.color.primary}); color: var(--m3e-step-completed-icon-color, ${h.color.onPrimary}); } :host(:not([aria-disabled="true"]):not([selected]):not([completed]):not([invalid])) .icon { background-color: var(--m3e-step-unselected-icon-container-color, ${h.color.inverseSurface}); color: var(--m3e-step-unselected-icon-color, ${h.color.inverseOnSurface}); } :host(:not([aria-disabled="true"]):not([selected])[invalid]) .icon { color: var(--m3e-step-icon-error-color, ${h.color.error}); } :host([aria-disabled="true"]) .icon { background-color: color-mix( in srgb, var(--m3e-step-disabled-icon-container-color, ${h.color.onSurface}) 10%, transparent ); color: color-mix(in srgb, var(--m3e-step-disabled-icon-color, ${h.color.onSurface}) 38%, transparent); } :host(:not([aria-disabled="true"])) .label { color: var(--m3e-step-label-color, ${h.color.onSurface}); } :host(:not([aria-disabled="true"]):not([selected])[invalid]) .label { color: var(--m3e-step-label-error-color, ${h.color.error}); } :host([aria-disabled="true"]) .label { color: color-mix(in srgb, var(--m3e-step-disabled-label-color, ${h.color.onSurface}) 38%, transparent); } .wrapper { display: flex; align-items: center; height: 100%; border-radius: inherit; font-size: var(--m3e-step-font-size, ${h.typescale.standard.title.small.fontSize}); font-weight: var(--m3e-step-font-weight, ${h.typescale.standard.title.small.fontWeight}); line-height: var(--m3e-step-line-height, ${h.typescale.standard.title.small.lineHeight}); letter-spacing: var(--m3e-step-tracking, ${h.typescale.standard.title.small.tracking}); flex-direction: var(--_step-direction, row); gap: var(--m3e-step-icon-label-space, 0.5rem); justify-content: flex-start; } .label { display: flex; flex-direction: column; align-items: var(--_step-label-align-items, flex-start); } ::slotted([slot="hint"]), .hint, ::slotted([slot="error"]) { font-size: var(--m3e-step-hint-font-size, ${h.typescale.standard.body.small.fontSize}); font-weight: var(--m3e-step-hint-font-weight, ${h.typescale.standard.body.small.fontWeight}); line-height: var(--m3e-step-hint-line-height, ${h.typescale.standard.body.small.lineHeight}); letter-spacing: var(--m3e-step-hint-tracking, ${h.typescale.standard.body.small.tracking}); } :host(:not([aria-disabled="true"]):not([invalid])) ::slotted([slot="hint"]), :host(:not([aria-disabled="true"]):not([invalid])) .hint { color: var(--m3e-step-hint-color, ${h.color.onSurfaceVariant}); } :host([aria-disabled="true"]) ::slotted([slot="hint"]), :host([aria-disabled="true"]) .hint { color: color-mix(in srgb, var(--m3e-step-disabled-hint-color, ${h.color.onSurface}) 38%, transparent); }`,et.__nextId=0,y([F(".focus-ring")],et.prototype,"_focusRing",void 0),y([F(".state-layer")],et.prototype,"_stateLayer",void 0),y([F(".ripple")],et.prototype,"_ripple",void 0),y([V({type:Boolean,reflect:!0})],et.prototype,"optional",void 0),y([V({type:Boolean,reflect:!0})],et.prototype,"editable",void 0),y([V({type:Boolean,reflect:!0})],et.prototype,"completed",void 0),y([V({type:Boolean,reflect:!0})],et.prototype,"invalid",void 0),y([K()],et.prototype,"index",void 0),et=tt=y([A("m3e-step")],et);class it extends p{constructor(t){super(),st.set(this,void 0),_(this,st,t,"f")}_onClick(){switch($(this,st,"f")){case"next":this.closest("m3e-stepper")?.moveNext();break;case"previous":this.closest("m3e-stepper")?.movePrevious();break;case"reset":this.closest("m3e-stepper")?.reset()}}}st=new WeakMap;
|
|
45
45
|
/**
|
|
46
46
|
* @license
|
|
47
47
|
* Copyright 2017 Google LLC
|
|
48
48
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
|
-
|
|
49
|
+
*/
|
|
50
|
+
const ot=globalThis,rt=ot.trustedTypes,nt=rt?rt.createPolicy("lit-html",{createHTML:t=>t}):void 0,lt="$lit$",at=`lit$${Math.random().toFixed(9).slice(2)}$`,ct="?"+at,dt=`<${ct}>`,ht=document,pt=()=>ht.createComment(""),mt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ut=Array.isArray,vt="[ \t\n\f\r]",ft=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bt=/-->/g,gt=/>/g,yt=RegExp(`>|${vt}(?:([^\\s"'>=/]+)(${vt}*=${vt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,_t=/"/g,At=/^(?:script|style|textarea|title)$/i,wt=Symbol.for("lit-noChange"),xt=Symbol.for("lit-nothing"),Et=new WeakMap,St=ht.createTreeWalker(ht,129);function Pt(t,e){if(!ut(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==nt?nt.createHTML(e):e}const Ct=(t,e)=>{const s=t.length-1,i=[];let o,r=2===e?"<svg>":3===e?"<math>":"",n=ft;for(let e=0;e<s;e++){const s=t[e];let l,a,c=-1,d=0;for(;d<s.length&&(n.lastIndex=d,a=n.exec(s),null!==a);)d=n.lastIndex,n===ft?"!--"===a[1]?n=bt:void 0!==a[1]?n=gt:void 0!==a[2]?(At.test(a[2])&&(o=RegExp("</"+a[2],"g")),n=yt):void 0!==a[3]&&(n=yt):n===yt?">"===a[0]?(n=o??ft,c=-1):void 0===a[1]?c=-2:(c=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?yt:'"'===a[3]?_t:$t):n===_t||n===$t?n=yt:n===bt||n===gt?n=ft:(n=yt,o=void 0);const h=n===yt&&t[e+1].startsWith("/>")?" ":"";r+=n===ft?s+dt:c>=0?(i.push(l),s.slice(0,c)+lt+s.slice(c)+at+h):s+at+(-2===c?e:h)}return[Pt(t,r+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class kt{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,r=0;const n=t.length-1,l=this.parts,[a,c]=Ct(t,e);if(this.el=kt.createElement(a,s),St.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=St.nextNode())&&l.length<n;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(lt)){const e=c[r++],s=i.getAttribute(t).split(at),n=/([.?@])?(.*)/.exec(e);l.push({type:1,index:o,name:n[2],strings:s,ctor:"."===n[1]?Ht:"?"===n[1]?Nt:"@"===n[1]?zt:Mt}),i.removeAttribute(t)}else t.startsWith(at)&&(l.push({type:6,index:o}),i.removeAttribute(t));if(At.test(i.tagName)){const t=i.textContent.split(at),e=t.length-1;if(e>0){i.textContent=rt?rt.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],pt()),St.nextNode(),l.push({type:2,index:++o});i.append(t[e],pt())}}}else if(8===i.nodeType)if(i.data===ct)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=i.data.indexOf(at,t+1));)l.push({type:7,index:o}),t+=at.length-1}o++}}static createElement(t,e){const s=ht.createElement("template");return s.innerHTML=t,s}}function Tt(t,e,s=t,i){if(e===wt)return e;let o=void 0!==i?s._$Co?.[i]:s._$Cl;const r=mt(e)?void 0:e._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(t),o._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=o:s._$Cl=o),void 0!==o&&(e=Tt(t,o._$AS(t,e.values),o,i)),e}class Ot{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??ht).importNode(e,!0);St.currentNode=i;let o=St.nextNode(),r=0,n=0,l=s[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new Ut(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new It(o,this,t)),this._$AV.push(e),l=s[++n]}r!==l?.index&&(o=St.nextNode(),r++)}return St.currentNode=ht,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class Ut{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=xt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Tt(this,t,e),mt(t)?t===xt||null==t||""===t?(this._$AH!==xt&&this._$AR(),this._$AH=xt):t!==this._$AH&&t!==wt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>ut(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==xt&&mt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ht.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=kt.createElement(Pt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new Ot(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=Et.get(t.strings);return void 0===e&&Et.set(t.strings,e=new kt(t)),e}k(t){ut(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new Ut(this.O(pt()),this.O(pt()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class Mt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=xt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=xt}_$AI(t,e=this,s,i){const o=this.strings;let r=!1;if(void 0===o)t=Tt(this,t,e,0),r=!mt(t)||t!==this._$AH&&t!==wt,r&&(this._$AH=t);else{const i=t;let n,l;for(t=o[0],n=0;n<o.length-1;n++)l=Tt(this,i[s+n],e,n),l===wt&&(l=this._$AH[n]),r||=!mt(l)||l!==this._$AH[n],l===xt?t=xt:t!==xt&&(t+=(l??"")+o[n+1]),this._$AH[n]=l}r&&!i&&this.j(t)}j(t){t===xt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ht extends Mt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===xt?void 0:t}}class Nt extends Mt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==xt)}}class zt extends Mt{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=Tt(this,t,e,0)??xt)===wt)return;const s=this._$AH,i=t===xt&&s!==xt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==xt&&(s===xt||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class It{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Tt(this,t)}}const Rt=ot.litHtmlPolyfillSupport;Rt?.(kt,Ut),(ot.litHtmlVersions??=[]).push("3.3.1");
|
|
50
51
|
/**
|
|
51
52
|
* @license
|
|
52
53
|
* Copyright 2018 Google LLC
|
|
53
54
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
55
|
*/
|
|
55
|
-
const qt=t=>t??St;var Wt,Bt,Dt,Zt,Vt,Kt,Ft,Jt,Xt,Gt;let Qt=class extends(d(t)){constructor(){super(...arguments),Wt.add(this),Bt.set(this,void 0),this._selectedIndex=null,this[Gt]=(new v).withHomeAndEnd().withWrap().onSelectedItemsChange(()=>y(this,Wt,"m",Ft).call(this)),this.headerPosition="above",this.labelPosition="end",this.linear=!1,this.orientation="horizontal"}get steps(){return this[u]?.items??[]}get selectedStep(){return null!==this._selectedIndex?this.steps[this._selectedIndex]??null:null}get selectedIndex(){return this._selectedIndex??-1}movePrevious(){return this.moveTo((this._selectedIndex??1)-1)}moveNext(){return this.moveTo((this._selectedIndex??-1)+1)}moveTo(t){const e=this.selectedStep;if(e&&e.index===t)return!0;if(this.steps[t]?.disabled)return!1;if(t>=0&&t<this.steps.length){if(e){const s=y(this,Wt,"m",Jt).call(this);if(this.linear)if(t<e.index){const e=this[u].items[t];if(!e||e.completed&&!e.editable)return!1}else if(t>e.index+1){const e=this[u].items[t];if(!e||!e.completed)return!1}else if(!s&&!e.optional)return!1;e.completed=!0}return this._selectedIndex=t,this[u].select(this.selectedStep),this.dispatchEvent(new Event("change",{bubbles:!0})),!0}return e&&(this[u].deselect(e),this.dispatchEvent(new Event("change",{bubbles:!0}))),!1}reset(){this.steps.forEach(t=>t.reset());const t=this.steps.find(t=>!t.disabled);t?this.moveTo(this.steps.indexOf(t)):this.moveTo(-1)}connectedCallback(){super.connectedCallback(),this.classList.toggle("-no-animate",!0)}disconnectedCallback(){super.disconnectedCallback(),this._orientation=void 0,y(this,Bt,"f")?.call(this)}update(t){super.update(t),t.has("orientation")&&(y(this,Bt,"f")?.call(this),"auto"===this.orientation?$(this,Bt,f.observe([b.XSmall],t=>{this._orientation=t.get(b.XSmall)?"vertical":"horizontal",y(this,Wt,"m",Xt).call(this)}),"f"):y(this,Wt,"m",Xt).call(this)),t.has("_orientation")&&y(this,Wt,"m",Xt).call(this)}render(){let t;return this.selectedStep?.panel&&(t=[...this.querySelectorAll("[slot='panel']")].indexOf(this.selectedStep.panel),-1===t&&(t=void 0)),this[u].vertical?e`${y(this,Wt,"m",Dt).call(this)}<slot name="panel"></slot>`:e`${"above"===this.headerPosition?y(this,Wt,"m",Dt).call(this):i}<m3e-slide class="steps" selected-index="${qt(t)}"><slot name="panel"></slot></m3e-slide>${"below"===this.headerPosition?y(this,Wt,"m",Dt).call(this):i}`}};Bt=new WeakMap,Wt=new WeakSet,Gt=u,Dt=function(){return e`<div class="header" role="tablist" aria-orientation="${qt(this[u].vertical?"vertical":void 0)}" @change="${y(this,Wt,"m",Zt)}"><slot name="step" @slotchange="${y(this,Wt,"m",Vt)}" @keydown="${y(this,Wt,"m",Kt)}"></slot></div>`},Zt=function(t){t.stopPropagation()},Vt=function(){const{added:t,removed:e}=this[u].setItems([...this.querySelectorAll("m3e-step")]);if(t.length>0||e.length>0){this.querySelectorAll(".-m3e-step-divider").forEach(t=>t.remove());for(let t=0;t<this[u].items.length;t++){const e=this[u].items[t];if(e.index=t,t>0){const t=document.createElement("div");t.ariaHidden="true",t.classList.add("-m3e-step-divider"),t.slot="step",e.insertAdjacentElement("beforebegin",t)}}y(this,Wt,"m",Xt).call(this),0==this[u].selectedItems.length&&this[u].select(this[u].items.find(t=>!t.disabled))}},Kt=function(t){this[u].onKeyDown(t)},Ft=function(){const t=this[u].selectedItems[0];let e=t?this.steps.indexOf(t):null;-1===e&&(e=null),this._selectedIndex=e;for(const t of this[u].items)t.panel&&(t.panel.active=t.index===e);t&&this.matches(":focus-within")&&!t.matches(":focus")&&t.focus(),this.classList.contains("-no-animate")&&requestAnimationFrame(()=>this.classList.toggle("-no-animate",!1))},Jt=function(){let t=!1;return this.selectedStep&&(t=this.selectedStep.panel?.querySelector("form")?.checkValidity()??!0,this.selectedStep.optional&&(t=!0),this.selectedStep.invalid=!t),t},Xt=function(){this[u].vertical="vertical"===(this._orientation??this.orientation),this.classList.toggle("-vertical",this[u].vertical),this[u].vertical?this.steps.forEach((t,e)=>{t.style.order=`${e}`,t.panel&&(t.panel.style.order=`${e}`)}):this.steps.forEach(t=>{t.style.order="",t.panel&&(t.panel.style.order="")})},Qt.styles=s`:host { display: flex; flex-direction: column; position: relative; } :host(:not(.-vertical)) .header { display: flex; align-items: flex-start; flex-wrap: nowrap; } :host(:not(.-vertical)) ::slotted(.-m3e-step-divider) { flex: 1 1 auto; position: relative; min-width: 2rem; } :host(:not(.-vertical)) ::slotted(.-m3e-step-divider)::before { content: ""; position: absolute; left: 0; right: 0; border-bottom-width: var(--m3e-step-divider-thickness, 1px); border-bottom-style: solid; border-bottom-color: var(--m3e-step-divider-color, ${h.color.outline}); } :host(:not(.-vertical):not([label-position="below"])) ::slotted(.-m3e-step-divider)::before { top: 50%; } :host(:not(.-vertical)) ::slotted([slot="step"]) { align-self: stretch; } :host(:not(.-vertical)) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before, :host(:not(.-vertical)) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { content: ""; display: block; position: absolute; top: 0; border-bottom-width: var(--m3e-step-divider-thickness, 1px); border-bottom-style: solid; border-bottom-color: var(--m3e-step-divider-color, ${h.color.outline}); } :host(:not(.-vertical)[label-position="end"]) ::slotted(.-m3e-step-divider) { margin-block: auto; } :host(:not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before, :host(:not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { top: 50%; } :host(:not(:dir(rtl)):not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { left: 0; right: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); } :host(:dir(rtl):not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { right: 0; left: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); } :host(:not(:dir(rtl)):not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { left: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); right: 0; } :host(:dir(rtl):not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { right: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); left: 0; } :host(:not(.-vertical)[label-position="below"]) ::slotted(.-m3e-step-divider)::before, :host(:not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before, :host(:not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { margin-block-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2)); } :host(:not(:dir(rtl)):not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { left: 0; right: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem)); } :host(:dir(rtl):not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { right: 0; left: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem)); } :host(:not(:dir(rtl)):not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { left: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem)); right: 0; } :host(:dir(rtl):not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { right: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem)); left: 0; } :host(:not(.-vertical)[label-position="below"]) { --_step-direction: column; --_step-label-align-items: center; } :host(.-vertical) .header { display: contents; } :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider)) { flex: none; } :host(.-vertical) ::slotted([slot="panel"]) { margin-inline-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2)); } :host(.-vertical) ::slotted([slot="panel"]:not(:last-of-type)) { border-inline-start-width: var(--m3e-step-divider-thickness, 1px); border-inline-start-style: solid; border-inline-start-color: var(--m3e-step-divider-color, ${h.color.outline}); } :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before, :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { content: ""; display: block; position: absolute; left: 0; margin-inline-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2)); border-inline-start-width: var(--m3e-step-divider-thickness, 1px); border-inline-start-style: solid; border-inline-start-color: var(--m3e-step-divider-color, ${h.color.outline}); } :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { top: 0; bottom: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); } :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { top: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); bottom: 0; } :host(:not(.-vertical)) { --m3e-collapsible-animation-duration: 0ms; } :host(.-no-animate) { --m3e-collapsible-animation-duration: 0ms; }`,g([V()],Qt.prototype,"_orientation",void 0),g([V()],Qt.prototype,"_selectedIndex",void 0),g([Z({attribute:"header-position",reflect:!0})],Qt.prototype,"headerPosition",void 0),g([Z({attribute:"label-position",reflect:!0})],Qt.prototype,"labelPosition",void 0),g([Z({type:Boolean,reflect:!0})],Qt.prototype,"linear",void 0),g([Z({reflect:!0})],Qt.prototype,"orientation",void 0),Qt=g([_("m3e-stepper")],Qt);let Yt=class extends rt{constructor(){super("next")}};Yt=g([_("m3e-stepper-next")],Yt);let te=class extends rt{constructor(){super("previous")}};te=g([_("m3e-stepper-previous")],te);let ee=class extends rt{constructor(){super("reset")}};ee=g([_("m3e-stepper-reset")],ee);export{tt as M3eStepElement,F as M3eStepPanelElement,Qt as M3eStepperElement,Yt as M3eStepperNextElement,te as M3eStepperPreviousElement,ee as M3eStepperResetElement,rt as StepperButtonElementBase};
|
|
56
|
+
const jt=t=>t??xt;var Lt,qt,Bt,Dt,Wt,Zt,Vt,Kt,Ft,Jt;let Xt=class extends(d(t)){constructor(){super(...arguments),Lt.add(this),qt.set(this,void 0),this._selectedIndex=null,this[Jt]=(new f).withHomeAndEnd().withWrap().onSelectedItemsChange(()=>$(this,Lt,"m",Vt).call(this)),this.headerPosition="above",this.labelPosition="end",this.linear=!1,this.orientation="horizontal"}get steps(){return this[v]?.items??[]}get selectedStep(){return null!==this._selectedIndex?this.steps[this._selectedIndex]??null:null}get selectedIndex(){return this._selectedIndex??-1}movePrevious(){return this.moveTo((this._selectedIndex??1)-1)}moveNext(){return this.moveTo((this._selectedIndex??-1)+1)}moveTo(t){const e=this.selectedStep;if(e&&e.index===t)return!0;if(this.steps[t]?.disabled)return!1;if(t>=0&&t<this.steps.length){if(e){const s=$(this,Lt,"m",Kt).call(this);if(this.linear)if(t<e.index){const e=this[v].items[t];if(!e||e.completed&&!e.editable)return!1}else if(t>e.index+1){const e=this[v].items[t];if(!e||!e.completed)return!1}else if(!s&&!e.optional)return!1;e.completed=!0}return this._selectedIndex=t,this[v].select(this.selectedStep),this.dispatchEvent(new Event("change",{bubbles:!0})),!0}return e&&(this[v].deselect(e),this.dispatchEvent(new Event("change",{bubbles:!0}))),!1}reset(){this.steps.forEach(t=>t.reset());const t=this.steps.findIndex(t=>!t.disabled);t!==this._selectedIndex&&(this._selectedIndex=t,this[v].select(this.selectedStep),this.dispatchEvent(new Event("change",{bubbles:!0})))}connectedCallback(){super.connectedCallback(),this.classList.toggle("-no-animate",!0)}disconnectedCallback(){super.disconnectedCallback(),this._orientation=void 0,$(this,qt,"f")?.call(this)}update(t){super.update(t),t.has("orientation")&&($(this,qt,"f")?.call(this),"auto"===this.orientation?_(this,qt,b.observe([g.XSmall],t=>{this._orientation=t.get(g.XSmall)?"vertical":"horizontal",$(this,Lt,"m",Ft).call(this)}),"f"):(this._orientation=void 0,$(this,Lt,"m",Ft).call(this))),t.has("_orientation")&&$(this,Lt,"m",Ft).call(this)}render(){let t;return this.selectedStep?.panel&&(t=[...this.querySelectorAll("[slot='panel']")].indexOf(this.selectedStep.panel),-1===t&&(t=void 0)),this[v].vertical?e`${$(this,Lt,"m",Bt).call(this)}<slot name="panel"></slot>`:e`${"above"===this.headerPosition?$(this,Lt,"m",Bt).call(this):i}<m3e-slide class="steps" selected-index="${jt(t)}"><slot name="panel"></slot></m3e-slide>${"below"===this.headerPosition?$(this,Lt,"m",Bt).call(this):i}`}};qt=new WeakMap,Lt=new WeakSet,Jt=v,Bt=function(){return e`<div class="header" role="tablist" aria-orientation="${jt(this[v].vertical?"vertical":void 0)}" @change="${$(this,Lt,"m",Dt)}"><slot name="step" @slotchange="${$(this,Lt,"m",Wt)}" @keydown="${$(this,Lt,"m",Zt)}"></slot></div>`},Dt=function(t){t.stopPropagation()},Wt=function(){const{added:t,removed:e}=this[v].setItems([...this.querySelectorAll("m3e-step")]);if(t.length>0||e.length>0){this.querySelectorAll(".-m3e-step-divider").forEach(t=>t.remove());for(let t=0;t<this[v].items.length;t++){const e=this[v].items[t];if(e.index=t,t>0){const t=document.createElement("div");t.ariaHidden="true",t.classList.add("-m3e-step-divider"),t.slot="step",e.insertAdjacentElement("beforebegin",t)}}$(this,Lt,"m",Ft).call(this),0==this[v].selectedItems.length&&this[v].select(this[v].items.find(t=>!t.disabled))}},Zt=function(t){this[v].onKeyDown(t)},Vt=function(){const t=this[v].selectedItems[0];let e=t?this.steps.indexOf(t):null;-1===e&&(e=null),this._selectedIndex=e;for(const t of this[v].items)t.panel&&(t.panel.active=t.index===e);t&&this.matches(":focus-within")&&!t.matches(":focus")&&t.focus(),this.classList.contains("-no-animate")&&requestAnimationFrame(()=>this.classList.toggle("-no-animate",!1))},Kt=function(){let t=!1;return this.selectedStep&&(t=this.selectedStep.panel?.querySelector("form")?.checkValidity()??!0,this.selectedStep.optional&&(t=!0),this.selectedStep.invalid=!t),t},Ft=function(){this[v].vertical="vertical"===(this._orientation??this.orientation),this.classList.toggle("-vertical",this[v].vertical),this[v].vertical?this.steps.forEach((t,e)=>{t.style.order=`${e}`,t.panel&&(t.panel.style.order=`${e}`)}):this.steps.forEach(t=>{t.style.order="",t.panel&&(t.panel.style.order="")})},Xt.styles=s`:host { display: flex; flex-direction: column; position: relative; } :host(:not(.-vertical)) .header { display: flex; align-items: flex-start; flex-wrap: nowrap; } :host(:not(.-vertical)) ::slotted(.-m3e-step-divider) { flex: 1 1 auto; position: relative; min-width: 2rem; } :host(:not(.-vertical)) ::slotted(.-m3e-step-divider)::before { content: ""; position: absolute; left: 0; right: 0; border-bottom-width: var(--m3e-step-divider-thickness, 1px); border-bottom-style: solid; border-bottom-color: var(--m3e-step-divider-color, ${h.color.outline}); } :host(:not(.-vertical):not([label-position="below"])) ::slotted(.-m3e-step-divider)::before { top: 50%; } :host(:not(.-vertical)) ::slotted([slot="step"]) { align-self: stretch; } :host(:not(.-vertical)) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before, :host(:not(.-vertical)) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { content: ""; display: block; position: absolute; top: 0; border-bottom-width: var(--m3e-step-divider-thickness, 1px); border-bottom-style: solid; border-bottom-color: var(--m3e-step-divider-color, ${h.color.outline}); } :host(:not(.-vertical)[label-position="end"]) ::slotted(.-m3e-step-divider) { margin-block: auto; } :host(:not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before, :host(:not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { top: 50%; } :host(:not(:dir(rtl)):not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { left: 0; right: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); } :host(:dir(rtl):not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { right: 0; left: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); } :host(:not(:dir(rtl)):not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { left: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); right: 0; } :host(:dir(rtl):not(.-vertical)[label-position="end"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { right: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); left: 0; } :host(:not(.-vertical)[label-position="below"]) ::slotted(.-m3e-step-divider)::before, :host(:not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before, :host(:not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { margin-block-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2)); } :host(:not(:dir(rtl)):not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { left: 0; right: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem)); } :host(:dir(rtl):not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { right: 0; left: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem)); } :host(:not(:dir(rtl)):not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { left: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem)); right: 0; } :host(:dir(rtl):not(.-vertical)[label-position="below"]) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { right: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem)); left: 0; } :host(:not(.-vertical)[label-position="below"]) { --_step-direction: column; --_step-label-align-items: center; } :host(.-vertical) .header { display: contents; } :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider)) { flex: none; } :host(.-vertical) ::slotted([slot="panel"]) { margin-inline-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2)); } :host(.-vertical) ::slotted([slot="panel"]:not(:last-of-type)) { border-inline-start-width: var(--m3e-step-divider-thickness, 1px); border-inline-start-style: solid; border-inline-start-color: var(--m3e-step-divider-color, ${h.color.outline}); } :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before, :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { content: ""; display: block; position: absolute; left: 0; margin-inline-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2)); border-inline-start-width: var(--m3e-step-divider-thickness, 1px); border-inline-start-style: solid; border-inline-start-color: var(--m3e-step-divider-color, ${h.color.outline}); } :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before { top: 0; bottom: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); } :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after { top: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem)); bottom: 0; } :host(:not(.-vertical)) { --m3e-collapsible-animation-duration: 0ms; } :host(.-no-animate) { --m3e-collapsible-animation-duration: 0ms; }`,y([K()],Xt.prototype,"_orientation",void 0),y([K()],Xt.prototype,"_selectedIndex",void 0),y([V({attribute:"header-position",reflect:!0})],Xt.prototype,"headerPosition",void 0),y([V({attribute:"label-position",reflect:!0})],Xt.prototype,"labelPosition",void 0),y([V({type:Boolean,reflect:!0})],Xt.prototype,"linear",void 0),y([V({reflect:!0})],Xt.prototype,"orientation",void 0),Xt=y([A("m3e-stepper")],Xt);let Gt=class extends it{constructor(){super("next")}};Gt=y([A("m3e-stepper-next")],Gt);let Qt=class extends it{constructor(){super("previous")}};Qt=y([A("m3e-stepper-previous")],Qt);let Yt=class extends it{constructor(){super("reset")}};Yt=y([A("m3e-stepper-reset")],Yt);export{et as M3eStepElement,J as M3eStepPanelElement,Xt as M3eStepperElement,Gt as M3eStepperNextElement,Qt as M3eStepperPreviousElement,Yt as M3eStepperResetElement,it as StepperButtonElementBase};
|
|
56
57
|
//# sourceMappingURL=index.min.js.map
|