@momentum-design/components 0.130.2 → 0.130.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/browser/index.js +3 -3
- package/dist/browser/index.js.map +3 -3
- package/dist/custom-elements.json +13 -1
- package/dist/utils/mixins/IconNameMixin.js +1 -1
- package/dist/utils/mixins/ListNavigationMixin.js +3 -1
- package/dist/utils/mixins/lifecycle/LifeCycleMixin.js +12 -4
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -929,7 +929,7 @@
|
|
|
929
929
|
:host([variant='borderless']) ::slotted(mdc-accordionbutton[expanded]) {
|
|
930
930
|
border-bottom: 1px solid var(--mdc-accordiongroup-items-border-color);
|
|
931
931
|
}
|
|
932
|
-
`,Ru=[XE,...St()];var pi=class extends q{constructor(){super();this.size=$n.SIZE;this.variant=$n.VARIANT;this.allowMultiple=!1;this.addEventListener("shown",this.handleAccordionExpanded)}handleAccordionExpanded(t){this.allowMultiple||[...this.accordionItems,...this.accordionButtonItems].forEach(r=>{r!==t.target&&r.hasAttribute("expanded")&&r.toggleAttribute("expanded")})}setChildrenAccordionAttributes(t,r){[...this.accordionItems].forEach(s=>{s.setAttribute(t,r)}),[...this.accordionButtonItems].forEach(s=>{s.setAttribute(t,r)})}updated(t){super.updated(t),t.has("size")&&(this.size||(this.size=$n.SIZE),this.setChildrenAccordionAttributes("size",this.size)),t.has("variant")&&(this.variant||(this.variant=$n.VARIANT),this.setChildrenAccordionAttributes("variant",this.variant))}render(){return C` <slot></slot> `}};pi.styles=[...q.styles,...Ru],m([u({type:String,reflect:!0})],pi.prototype,"size",2),m([u({type:String,reflect:!0})],pi.prototype,"variant",2),m([u({type:Boolean,reflect:!0,attribute:"allow-multiple"})],pi.prototype,"allowMultiple",2),m([Ft({selector:vl})],pi.prototype,"accordionItems",2),m([Ft({selector:fl})],pi.prototype,"accordionButtonItems",2);var Nc=pi;Nc.register(Lu);var ZE=Nc;Ts.register(fl);var QE=Ts;var te=a=>{class o extends a{}return m([u({type:String,attribute:"icon-name"})],o.prototype,"iconName",2),o};var JE=U`
|
|
932
|
+
`,Ru=[XE,...St()];var pi=class extends q{constructor(){super();this.size=$n.SIZE;this.variant=$n.VARIANT;this.allowMultiple=!1;this.addEventListener("shown",this.handleAccordionExpanded)}handleAccordionExpanded(t){this.allowMultiple||[...this.accordionItems,...this.accordionButtonItems].forEach(r=>{r!==t.target&&r.hasAttribute("expanded")&&r.toggleAttribute("expanded")})}setChildrenAccordionAttributes(t,r){[...this.accordionItems].forEach(s=>{s.setAttribute(t,r)}),[...this.accordionButtonItems].forEach(s=>{s.setAttribute(t,r)})}updated(t){super.updated(t),t.has("size")&&(this.size||(this.size=$n.SIZE),this.setChildrenAccordionAttributes("size",this.size)),t.has("variant")&&(this.variant||(this.variant=$n.VARIANT),this.setChildrenAccordionAttributes("variant",this.variant))}render(){return C` <slot></slot> `}};pi.styles=[...q.styles,...Ru],m([u({type:String,reflect:!0})],pi.prototype,"size",2),m([u({type:String,reflect:!0})],pi.prototype,"variant",2),m([u({type:Boolean,reflect:!0,attribute:"allow-multiple"})],pi.prototype,"allowMultiple",2),m([Ft({selector:vl})],pi.prototype,"accordionItems",2),m([Ft({selector:fl})],pi.prototype,"accordionButtonItems",2);var Nc=pi;Nc.register(Lu);var ZE=Nc;Ts.register(fl);var QE=Ts;var te=a=>{class o extends a{}return m([u({type:String,attribute:"icon-name",reflect:!0})],o.prototype,"iconName",2),o};var JE=U`
|
|
933
933
|
:host {
|
|
934
934
|
height: 1.5rem;
|
|
935
935
|
gap: 0.25rem;
|
|
@@ -3823,7 +3823,7 @@
|
|
|
3823
3823
|
`,Qv=[oA,...St()];var Zo=class extends te(pe){constructor(){super(...arguments);this.size=Gs.SIZE;this.inline=Gs.INLINE;this.inverted=Gs.INVERTED}connectedCallback(){super.connectedCallback(),this.active=void 0,this.role=Gs.ROLE}update(t){super.update(t),t.has("size")&&this.setSize(this.size)}setSize(t){this.setAttribute("size",Object.values(Hs).includes(t)?`${t}`:Gs.SIZE.toString())}render(){return C`
|
|
3824
3824
|
<slot></slot>
|
|
3825
3825
|
${this.iconName?C` <mdc-icon name=${this.iconName} size=${Zv(this.size)} length-unit="rem"></mdc-icon> `:j}
|
|
3826
|
-
`}};Zo.styles=[...Yr.styles,...Qv],m([u({type:Number,reflect:!0})],Zo.prototype,"size",2),m([u({type:Boolean,reflect:!0})],Zo.prototype,"inline",2),m([u({type:Boolean,reflect:!0})],Zo.prototype,"inverted",2);var wh=Zo;wh.register(Xv);var sA=wh;Yr.register(Lf);var nA=Yr;var Ht={CREATED:"created",FIRST_UPDATE_COMPLETED:"first-update-completed",DESTROYED:"destroyed",MODIFIED:"modified"};var Ks=a=>{class o extends Lt(Ct(a)){constructor(...s){super(...s);this.loop="true";this.propagateAllKeyEvents=!1;this.initialFocus=0;this.handleItemCreation=s=>{let{target:d}=s;this.navItems.length===0&&d instanceof q&&d.setAttribute("tabindex","0")};this.handleNavigationClick=s=>{let d=s.target,c=this.getCurrentIndex(d);if(c!==-1){let f=!(this.navItems.at(c)!==d&&document.activeElement===s.target);this.resetTabIndexAndSetFocus(c,void 0,f,!1)}};this.handleNavBeforeFocus=s=>{let d=bc(s.relatedTarget);if(this!==d&&!this.contains(document.activeElement)&&this.contains(d)){s.preventDefault();let c=this.navItems.find(y=>y.contains(d)),f=this.getCurrentIndex(c);if(f===-1)return;this.resetTabIndexes(f)}};this.addEventListener(Ht.CREATED,this.handleItemCreation),this.addEventListener("keydown",this.handleNavigationKeyDown.bind(this)),this.addEventListener("click",this.handleNavigationClick)}connectedCallback(){super.connectedCallback(),document.addEventListener("navbeforefocus",this.handleNavBeforeFocus)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("navbeforefocus",this.handleNavBeforeFocus)}async firstUpdated(s){super.firstUpdated(s),this.setInitialFocus()}setInitialFocus(){let s=Math.max(Math.min(this.initialFocus,this.navItems.length-1),0);this.resetTabIndexAndSetFocus(s,void 0,!1)}handleNavigationKeyDown(s){let d=this.getActionForKeyEvent(s,!0),c=new Set([X.DOWN,X.UP,X.HOME,X.END]);if(!d||!c.has(d))return;let f=s.target,y=this.getCurrentIndex(f);if(y===-1)return;this.resetTabIndexes(y);let I=!1;switch(d){case X.HOME:{I=this.resetTabIndexAndSetFocus(0,y);break}case X.END:{I=this.resetTabIndexAndSetFocus(this.navItems.length-1,y);break}case X.DOWN:{let $=this.shouldLoop()?0:y,Y=y+1===this.navItems.length?$:y+1;I=this.resetTabIndexAndSetFocus(Y,y);break}case X.UP:{let $=this.shouldLoop()?this.navItems.length-1:y,Y=y-1===-1?$:y-1;I=this.resetTabIndexAndSetFocus(Y,y);break}default:break}I&&(this.keyDownEventHandled(),this.propagateAllKeyEvents||(s.stopPropagation(),s.preventDefault()))}getCurrentIndex(s){return s?this.navItems.findIndex(d=>d===s||!!(d.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINED_BY)):-1}resetTabIndexes(s,d=!0){var c;if(this.navItems.length>0){this.navItems.forEach(I=>I.setAttribute("tabindex","-1"));let f=this.navItems.at(s)?s:0,y=(c=this.navItems.at(f))!=null?c:this.navItems.find(Boolean);y&&(y.setAttribute("tabindex","0"),d&&y.focus())}}resetTabIndexAndSetFocus(s,d,c=!0,f=!0){var $;let{navItems:y}=this;if(y.length===0)return!1;let I=($=y.at(s))!=null?$:y.find(Boolean);return s===d&&I&&I.getAttribute("tabindex")==="0"?!1:(d===void 0?y.forEach(Y=>Y.setAttribute("tabindex","-1")):y.at(d)&&y.at(d).setAttribute("tabindex","-1"),I.setAttribute("tabindex","0"),c&&(I.focus({preventScroll:!0}),f&&I.scrollIntoView({block:"nearest"})),!0)}shouldLoop(){return this.getKeyboardNavMode()===Kt.SPATIAL?!1:this.loop!=="false"}}return o};var fd=V.constructTagName("listitem"),na={FULL_WIDTH:"full-width",INSET_PILL:"inset-pill",INSET_RECTANGLE:"inset-rectangle"},Jv={VARIANT:na.FULL_WIDTH};var aA=a=>!!a,Zr=class{constructor(o,t){this.cache=[];this.itemCreationHandler=o=>{this.addItem(o.target,void 0)};this.itemDestroyHandler=o=>{this.delete(o.detail.originalTarget)};this.host=o,o.addController(this),this.isValidItem=(t==null?void 0:t.isValidItem)||aA,this.onStoreUpdate=t==null?void 0:t.onStoreUpdate}get items(){return this.cache}hostConnected(){this.host.addEventListener(Ht.CREATED,this.itemCreationHandler),this.host.addEventListener(Ht.DESTROYED,this.itemDestroyHandler)}hostDisconnected(){this.host.removeEventListener(Ht.CREATED,this.itemCreationHandler),this.host.removeEventListener(Ht.DESTROYED,this.itemDestroyHandler),this.reset()}add(o){this.addItem(o,void 0)}addAt(o,t){this.addItem(o,t)}getIndexToInsertInCache(o){if(!this.cache.length||!cu(this.cache.at(-1),o))return-1;let t=0,r=this.cache.length-1;for(;t<=r;){let s=Math.floor((t+r)/2);hu(this.cache[s],o)?t=s+1:r=s-1}return t}addItem(o,t=void 0){var s;let r=o;if(this.isValidItem(r)&&!this.cache.includes(r)){let d=t===void 0?this.getIndexToInsertInCache(r):t;this.onStoreUpdate&&((s=this.onStoreUpdate)==null||s.call(this,r,"added",d===-1?this.cache.length:d,this.cache.slice())),d===-1?this.cache.push(r):d>=0&&this.cache.splice(d,0,r)}}delete(o){var r;let t=this.cache.indexOf(o);t!==-1&&(this.onStoreUpdate&&((r=this.onStoreUpdate)==null||r.call(this,o,"removed",t,this.cache.slice())),this.cache.splice(t,1))}reset(o){this.cache.length=0,o&&this.cache.push(...o)}};var eo=a=>{class o extends a{constructor(...s){super(...s);this.handleItemCreation=s=>{let d=s.target;d&&d.addEventListener(Ht.DESTROYED,this.handleItemRemovedEvent)};this.handleItemRemovedEvent=s=>{s.stopImmediatePropagation(),s.target&&s.type===Ht.DESTROYED&&(s.target.removeEventListener(Ht.DESTROYED,this.handleItemRemovedEvent),this.dispatchEvent(new CustomEvent(s.type,{bubbles:s.bubbles,composed:s.composed,detail:{originalTarget:s.target}})))};this.addEventListener(Ht.CREATED,this.handleItemCreation)}}return o};var lA=U`
|
|
3826
|
+
`}};Zo.styles=[...Yr.styles,...Qv],m([u({type:Number,reflect:!0})],Zo.prototype,"size",2),m([u({type:Boolean,reflect:!0})],Zo.prototype,"inline",2),m([u({type:Boolean,reflect:!0})],Zo.prototype,"inverted",2);var wh=Zo;wh.register(Xv);var sA=wh;Yr.register(Lf);var nA=Yr;var Ht={CREATED:"created",FIRST_UPDATE_COMPLETED:"first-update-completed",DESTROYED:"destroyed",MODIFIED:"modified"};var Ks=a=>{class o extends Lt(Ct(a)){constructor(...s){super(...s);this.loop="true";this.propagateAllKeyEvents=!1;this.initialFocus=0;this.handleItemCreation=s=>{var f;let{target:d}=s,c=s instanceof CustomEvent&&((f=s.detail)==null?void 0:f.lifecycle);this.navItems.length===0&&d instanceof q&&c&&d.setAttribute("tabindex","0")};this.handleNavigationClick=s=>{let d=s.target,c=this.getCurrentIndex(d);if(c!==-1){let f=!(this.navItems.at(c)!==d&&document.activeElement===s.target);this.resetTabIndexAndSetFocus(c,void 0,f,!1)}};this.handleNavBeforeFocus=s=>{let d=bc(s.relatedTarget);if(this!==d&&!this.contains(document.activeElement)&&this.contains(d)){s.preventDefault();let c=this.navItems.find(y=>y.contains(d)),f=this.getCurrentIndex(c);if(f===-1)return;this.resetTabIndexes(f)}};this.addEventListener(Ht.CREATED,this.handleItemCreation),this.addEventListener("keydown",this.handleNavigationKeyDown.bind(this)),this.addEventListener("click",this.handleNavigationClick)}connectedCallback(){super.connectedCallback(),document.addEventListener("navbeforefocus",this.handleNavBeforeFocus)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("navbeforefocus",this.handleNavBeforeFocus)}async firstUpdated(s){super.firstUpdated(s),this.setInitialFocus()}setInitialFocus(){let s=Math.max(Math.min(this.initialFocus,this.navItems.length-1),0);this.resetTabIndexAndSetFocus(s,void 0,!1)}handleNavigationKeyDown(s){let d=this.getActionForKeyEvent(s,!0),c=new Set([X.DOWN,X.UP,X.HOME,X.END]);if(!d||!c.has(d))return;let f=s.target,y=this.getCurrentIndex(f);if(y===-1)return;this.resetTabIndexes(y);let I=!1;switch(d){case X.HOME:{I=this.resetTabIndexAndSetFocus(0,y);break}case X.END:{I=this.resetTabIndexAndSetFocus(this.navItems.length-1,y);break}case X.DOWN:{let $=this.shouldLoop()?0:y,Y=y+1===this.navItems.length?$:y+1;I=this.resetTabIndexAndSetFocus(Y,y);break}case X.UP:{let $=this.shouldLoop()?this.navItems.length-1:y,Y=y-1===-1?$:y-1;I=this.resetTabIndexAndSetFocus(Y,y);break}default:break}I&&(this.keyDownEventHandled(),this.propagateAllKeyEvents||(s.stopPropagation(),s.preventDefault()))}getCurrentIndex(s){return s?this.navItems.findIndex(d=>d===s||!!(d.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINED_BY)):-1}resetTabIndexes(s,d=!0){var c;if(this.navItems.length>0){this.navItems.forEach(I=>I.setAttribute("tabindex","-1"));let f=this.navItems.at(s)?s:0,y=(c=this.navItems.at(f))!=null?c:this.navItems.find(Boolean);y&&(y.setAttribute("tabindex","0"),d&&y.focus())}}resetTabIndexAndSetFocus(s,d,c=!0,f=!0){var $;let{navItems:y}=this;if(y.length===0)return!1;let I=($=y.at(s))!=null?$:y.find(Boolean);return s===d&&I&&I.getAttribute("tabindex")==="0"?!1:(d===void 0?y.forEach(Y=>Y.setAttribute("tabindex","-1")):y.at(d)&&y.at(d).setAttribute("tabindex","-1"),I.setAttribute("tabindex","0"),c&&(I.focus({preventScroll:!0}),f&&I.scrollIntoView({block:"nearest"})),!0)}shouldLoop(){return this.getKeyboardNavMode()===Kt.SPATIAL?!1:this.loop!=="false"}}return o};var fd=V.constructTagName("listitem"),na={FULL_WIDTH:"full-width",INSET_PILL:"inset-pill",INSET_RECTANGLE:"inset-rectangle"},Jv={VARIANT:na.FULL_WIDTH};var aA=a=>!!a,Zr=class{constructor(o,t){this.cache=[];this.itemCreationHandler=o=>{this.addItem(o.target,void 0)};this.itemDestroyHandler=o=>{this.delete(o.detail.originalTarget)};this.host=o,o.addController(this),this.isValidItem=(t==null?void 0:t.isValidItem)||aA,this.onStoreUpdate=t==null?void 0:t.onStoreUpdate}get items(){return this.cache}hostConnected(){this.host.addEventListener(Ht.CREATED,this.itemCreationHandler),this.host.addEventListener(Ht.DESTROYED,this.itemDestroyHandler)}hostDisconnected(){this.host.removeEventListener(Ht.CREATED,this.itemCreationHandler),this.host.removeEventListener(Ht.DESTROYED,this.itemDestroyHandler),this.reset()}add(o){this.addItem(o,void 0)}addAt(o,t){this.addItem(o,t)}getIndexToInsertInCache(o){if(!this.cache.length||!cu(this.cache.at(-1),o))return-1;let t=0,r=this.cache.length-1;for(;t<=r;){let s=Math.floor((t+r)/2);hu(this.cache[s],o)?t=s+1:r=s-1}return t}addItem(o,t=void 0){var s;let r=o;if(this.isValidItem(r)&&!this.cache.includes(r)){let d=t===void 0?this.getIndexToInsertInCache(r):t;this.onStoreUpdate&&((s=this.onStoreUpdate)==null||s.call(this,r,"added",d===-1?this.cache.length:d,this.cache.slice())),d===-1?this.cache.push(r):d>=0&&this.cache.splice(d,0,r)}}delete(o){var r;let t=this.cache.indexOf(o);t!==-1&&(this.onStoreUpdate&&((r=this.onStoreUpdate)==null||r.call(this,o,"removed",t,this.cache.slice())),this.cache.splice(t,1))}reset(o){this.cache.length=0,o&&this.cache.push(...o)}};var eo=a=>{class o extends a{constructor(...s){super(...s);this.handleItemCreation=s=>{let d=s.target;d&&d.addEventListener(Ht.DESTROYED,this.handleItemRemovedEvent)};this.handleItemRemovedEvent=s=>{s.stopImmediatePropagation(),s.target&&s.type===Ht.DESTROYED&&(s.target.removeEventListener(Ht.DESTROYED,this.handleItemRemovedEvent),this.dispatchEvent(new CustomEvent(s.type,{bubbles:s.bubbles,composed:s.composed,detail:{originalTarget:s.target}})))};this.addEventListener(Ht.CREATED,this.handleItemCreation)}}return o};var lA=U`
|
|
3827
3827
|
:host {
|
|
3828
3828
|
display: flex;
|
|
3829
3829
|
flex-direction: column;
|
|
@@ -3888,7 +3888,7 @@
|
|
|
3888
3888
|
size="1"
|
|
3889
3889
|
length-unit="rem"
|
|
3890
3890
|
></mdc-icon>`:j}
|
|
3891
|
-
`}};ro.styles=[...q.styles,...rg],m([u({type:String,attribute:"prefix-icon"})],ro.prototype,"prefixIcon",2),m([u({type:String,attribute:"postfix-icon"})],ro.prototype,"postfixIcon",2),m([u({type:String,attribute:"header-text"})],ro.prototype,"headerText",2),m([u({type:Boolean,reflect:!0})],ro.prototype,"disabled",2);var Lh=ro;var ig=V.constructTagName("listheader");Lh.register(ig);var cA=Lh;var og=a=>{class o extends a{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new
|
|
3891
|
+
`}};ro.styles=[...q.styles,...rg],m([u({type:String,attribute:"prefix-icon"})],ro.prototype,"prefixIcon",2),m([u({type:String,attribute:"postfix-icon"})],ro.prototype,"postfixIcon",2),m([u({type:String,attribute:"header-text"})],ro.prototype,"headerText",2),m([u({type:Boolean,reflect:!0})],ro.prototype,"disabled",2);var Lh=ro;var ig=V.constructTagName("listheader");Lh.register(ig);var cA=Lh;var og=a=>{class o extends a{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(Ht.CREATED,{bubbles:!0,composed:!0,detail:{lifecycle:!0}})),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent(Ht.FIRST_UPDATE_COMPLETED,{bubbles:!0,composed:!0,detail:{lifecycle:!0}}))})}disconnectedCallback(){super.disconnectedCallback(),this.dispatchEvent(new CustomEvent(Ht.DESTROYED,{bubbles:!0,composed:!0,detail:{lifecycle:!0}}))}dispatchModifiedEvent(r){this.dispatchEvent(new CustomEvent(Ht.MODIFIED,{detail:{change:r,lifecycle:!0},bubbles:!0,composed:!0}))}}return o};var aa=class{static dispatchListItemEvent(o,t){t.dispatchEvent(new Event(o,{composed:!0,bubbles:!0}))}static onDisableListItem(o){this.dispatchListItemEvent("disabled",o)}static onEnableListItem(o){this.dispatchListItemEvent("enabled",o)}static onCreatedListItem(o){setTimeout(()=>{this.dispatchListItemEvent("created",o)},0)}static onDestroyedListItem(o){this.dispatchListItemEvent("destroyed",o)}};var hA=U`
|
|
3892
3892
|
:host {
|
|
3893
3893
|
--mdc-listitem-default-background-color: var(--mds-color-theme-background-primary-ghost);
|
|
3894
3894
|
--mdc-listitem-default-active-background-color: var(--mds-color-theme-background-primary-active);
|