@momentum-design/components 0.116.0 → 0.116.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/custom-elements.json +1218 -1218
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/utils/controllers/ElementStore.d.ts +21 -10
- package/dist/utils/controllers/ElementStore.js +9 -0
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
@@ -3570,7 +3570,7 @@
|
|
3570
3570
|
`,wf=[lT,...St()];var Io=class extends Kt(re){constructor(){super(...arguments);this.size=xs.SIZE;this.inline=xs.INLINE;this.inverted=xs.INVERTED}connectedCallback(){super.connectedCallback(),this.active=void 0,this.role=xs.ROLE}update(t){super.update(t),t.has("size")&&this.setSize(this.size)}setSize(t){this.setAttribute("size",Object.values(Ts).includes(t)?`${t}`:xs.SIZE.toString())}render(){return I`
|
3571
3571
|
<slot></slot>
|
3572
3572
|
${this.iconName?I` <mdc-icon name=${this.iconName} size=${kf(this.size)} length-unit="rem"></mdc-icon> `:W}
|
3573
|
-
`}};Io.styles=[...Fr.styles,...wf],p([u({type:Number,reflect:!0})],Io.prototype,"size",2),p([u({type:Boolean,reflect:!0})],Io.prototype,"inline",2),p([u({type:Boolean,reflect:!0})],Io.prototype,"inverted",2);var Lc=Io;Lc.register(Cf);var dT=Lc;Fr.register(ou);var cT=Fr;var Pl=n=>{class o extends n{constructor(...a){super(...a);this.loop="true";this.propagateAllKeyEvents=!1;this.initialFocus=0;this.handleNavigationKeyDown=a=>{let d=new Set([Z.ARROW_DOWN,Z.ARROW_UP,Z.HOME,Z.END]),m=window.getComputedStyle(this).direction==="rtl",b=this.resolveDirectionKey(a.key,m);if(!d.has(b))return;let C=a.target,O=this.getCurrentIndex(C);if(O!==-1){switch(this.resetTabIndexes(O),b){case Z.HOME:{this.resetTabIndexAndSetFocus(0,O);break}case Z.END:{this.resetTabIndexAndSetFocus(this.navItems.length-1,O);break}case Z.ARROW_DOWN:{let j=this.shouldLoop()?0:O,q=O+1===this.navItems.length?j:O+1;this.resetTabIndexAndSetFocus(q,O);break}case Z.ARROW_UP:{let j=this.shouldLoop()?this.navItems.length-1:O,q=O-1===-1?j:O-1;this.resetTabIndexAndSetFocus(q,O);break}default:break}this.propagateAllKeyEvents||(a.stopPropagation(),a.preventDefault())}};this.handleNavigationClick=a=>{let d=this.getCurrentIndex(a.target);this.resetTabIndexes(d)};this.addEventListener("keydown",this.handleNavigationKeyDown),this.addEventListener("click",this.handleNavigationClick)}async firstUpdated(a){super.firstUpdated(a);let d=Math.max(Math.min(this.initialFocus,this.navItems.length-1),0);this.resetTabIndexAndSetFocus(d,void 0,!1)}getCurrentIndex(a){return this.navItems.findIndex(d=>d===a||!!(d.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_CONTAINED_BY))}resetTabIndexes(a){if(this.navItems.length>0){this.navItems.forEach(m=>m.setAttribute("tabindex","-1"));let d=this.navItems[a]?a:0;this.navItems[d].setAttribute("tabindex","0"),this.navItems[d].focus()}}resetTabIndexAndSetFocus(a,d,m=!0){let{navItems:b}=this;if(b.length===0)return;let C=b[a]?a:0,O=b[C];a===d&&O&&O.getAttribute("tabindex")==="0"||(d===void 0?b.forEach(j=>j.setAttribute("tabindex","-1")):b[d]&&b[d].setAttribute("tabindex","-1"),O.setAttribute("tabindex","0"),m&&(O.focus({preventScroll:!0}),O.scrollIntoView({block:"nearest"})))}resolveDirectionKey(a,d){if(!d)return a;switch(a){case Z.ARROW_LEFT:return Z.ARROW_RIGHT;case Z.ARROW_RIGHT:return Z.ARROW_LEFT;default:return a}}shouldLoop(){return this.loop!=="false"}}return o};var Dl=H.constructTagName("listitem"),Da={FULL_WIDTH:"full-width",INSET_PILL:"inset-pill",INSET_RECTANGLE:"inset-rectangle"},Nf={VARIANT:Da.FULL_WIDTH};var he={CREATED:"created",DESTROYED:"destroyed",MODIFIED:"modified"};var Lf=(n,o)=>!!(n.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING);var hT=n=>!!n,Fi=class{constructor(o,t){this.cache=[];this.itemCreationHandler=o=>{this.addItem(o.target,void 0)};this.itemDestroyHandler=o=>{this.delete(o.target)};this.host=o,o.addController(this),this.isValidItem=(t==null?void 0:t.isValidItem)||hT,this.host.addEventListener(he.CREATED,this.itemCreationHandler),this.host.addEventListener(he.DESTROYED,this.itemDestroyHandler)}get items(){return this.cache}hostConnected(){}hostDisconnected(){}add(o){this.addItem(o,void 0)}addAt(o,t){this.addItem(o,t)}addItem(o,t=void 0){let i=o;if(this.isValidItem(i)&&!this.cache.includes(i)){let
|
3573
|
+
`}};Io.styles=[...Fr.styles,...wf],p([u({type:Number,reflect:!0})],Io.prototype,"size",2),p([u({type:Boolean,reflect:!0})],Io.prototype,"inline",2),p([u({type:Boolean,reflect:!0})],Io.prototype,"inverted",2);var Lc=Io;Lc.register(Cf);var dT=Lc;Fr.register(ou);var cT=Fr;var Pl=n=>{class o extends n{constructor(...a){super(...a);this.loop="true";this.propagateAllKeyEvents=!1;this.initialFocus=0;this.handleNavigationKeyDown=a=>{let d=new Set([Z.ARROW_DOWN,Z.ARROW_UP,Z.HOME,Z.END]),m=window.getComputedStyle(this).direction==="rtl",b=this.resolveDirectionKey(a.key,m);if(!d.has(b))return;let C=a.target,O=this.getCurrentIndex(C);if(O!==-1){switch(this.resetTabIndexes(O),b){case Z.HOME:{this.resetTabIndexAndSetFocus(0,O);break}case Z.END:{this.resetTabIndexAndSetFocus(this.navItems.length-1,O);break}case Z.ARROW_DOWN:{let j=this.shouldLoop()?0:O,q=O+1===this.navItems.length?j:O+1;this.resetTabIndexAndSetFocus(q,O);break}case Z.ARROW_UP:{let j=this.shouldLoop()?this.navItems.length-1:O,q=O-1===-1?j:O-1;this.resetTabIndexAndSetFocus(q,O);break}default:break}this.propagateAllKeyEvents||(a.stopPropagation(),a.preventDefault())}};this.handleNavigationClick=a=>{let d=this.getCurrentIndex(a.target);this.resetTabIndexes(d)};this.addEventListener("keydown",this.handleNavigationKeyDown),this.addEventListener("click",this.handleNavigationClick)}async firstUpdated(a){super.firstUpdated(a);let d=Math.max(Math.min(this.initialFocus,this.navItems.length-1),0);this.resetTabIndexAndSetFocus(d,void 0,!1)}getCurrentIndex(a){return this.navItems.findIndex(d=>d===a||!!(d.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_CONTAINED_BY))}resetTabIndexes(a){if(this.navItems.length>0){this.navItems.forEach(m=>m.setAttribute("tabindex","-1"));let d=this.navItems[a]?a:0;this.navItems[d].setAttribute("tabindex","0"),this.navItems[d].focus()}}resetTabIndexAndSetFocus(a,d,m=!0){let{navItems:b}=this;if(b.length===0)return;let C=b[a]?a:0,O=b[C];a===d&&O&&O.getAttribute("tabindex")==="0"||(d===void 0?b.forEach(j=>j.setAttribute("tabindex","-1")):b[d]&&b[d].setAttribute("tabindex","-1"),O.setAttribute("tabindex","0"),m&&(O.focus({preventScroll:!0}),O.scrollIntoView({block:"nearest"})))}resolveDirectionKey(a,d){if(!d)return a;switch(a){case Z.ARROW_LEFT:return Z.ARROW_RIGHT;case Z.ARROW_RIGHT:return Z.ARROW_LEFT;default:return a}}shouldLoop(){return this.loop!=="false"}}return o};var Dl=H.constructTagName("listitem"),Da={FULL_WIDTH:"full-width",INSET_PILL:"inset-pill",INSET_RECTANGLE:"inset-rectangle"},Nf={VARIANT:Da.FULL_WIDTH};var he={CREATED:"created",DESTROYED:"destroyed",MODIFIED:"modified"};var Lf=(n,o)=>!!(n.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING);var hT=n=>!!n,Fi=class{constructor(o,t){this.cache=[];this.itemCreationHandler=o=>{this.addItem(o.target,void 0)};this.itemDestroyHandler=o=>{this.delete(o.target)};this.host=o,o.addController(this),this.isValidItem=(t==null?void 0:t.isValidItem)||hT,this.onStoreUpdate=t==null?void 0:t.onStoreUpdate,this.host.addEventListener(he.CREATED,this.itemCreationHandler),this.host.addEventListener(he.DESTROYED,this.itemDestroyHandler)}get items(){return this.cache}hostConnected(){}hostDisconnected(){}add(o){this.addItem(o,void 0)}addAt(o,t){this.addItem(o,t)}addItem(o,t=void 0){var a;let i=o;if(this.isValidItem(i)&&!this.cache.includes(i)){let d=t===void 0?this.cache.findIndex(m=>Lf(i,m)):t;this.onStoreUpdate&&((a=this.onStoreUpdate)==null||a.call(this,i,"added",d===-1?this.cache.length:d,this.cache.slice())),d===-1?this.cache.push(i):d>=0&&this.cache.splice(d,0,i)}}delete(o){var i;let t=this.cache.indexOf(o);t!==-1&&(this.onStoreUpdate&&((i=this.onStoreUpdate)==null||i.call(this,o,"removed",t,this.cache.slice())),this.cache.splice(t,1))}reset(o){this.cache.length=0,this.cache.push(...o||[])}};var As=n=>{class o extends n{constructor(...a){super(...a);this.handleItemCreation=a=>{let d=a.target;d&&d.addEventListener(he.DESTROYED,this.handleItemRemovedEvent)};this.handleItemRemovedEvent=a=>{if(a.stopImmediatePropagation(),a.target&&a.type===he.DESTROYED){a.target.removeEventListener(he.DESTROYED,this.handleItemRemovedEvent);let d=new Event(a.type,{bubbles:a.bubbles,composed:a.composed});Object.defineProperty(d,"target",{set(){},get:()=>a.target}),this.dispatchEvent(d)}};this.addEventListener(he.CREATED,this.handleItemCreation)}}return o};var pT=U`
|
3574
3574
|
:host {
|
3575
3575
|
display: flex;
|
3576
3576
|
flex-direction: column;
|